!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";var e=6371008.8,r={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*e,kilometers:6371.0088,kilometres:6371.0088,meters:e,metres:e,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:e/1852,radians:1,yards:6967335.223679999},n={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e,yards:1.0936133},i={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function o(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function a(t,e,r){switch(t){case"Point":return s(e).geometry;case"LineString":return h(e).geometry;case"Polygon":return l(e).geometry;case"MultiPoint":return g(e).geometry;case"MultiLineString":return d(e).geometry;case"MultiPolygon":return y(e).geometry;default:throw new Error(t+" is invalid")}}function s(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!P(t[0])||!P(t[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:t},e,r)}function u(t,e,r){return void 0===r&&(r={}),f(t.map((function(t){return s(t,e)})),r)}function l(t,e,r){void 0===r&&(r={});for(var n=0,i=t;n=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}function _(t,e){void 0===e&&(e="kilometers");var n=r[e];if(!n)throw new Error(e+" units is invalid");return t*n}function x(t,e){void 0===e&&(e="kilometers");var n=r[e];if(!n)throw new Error(e+" units is invalid");return t/n}function b(t,e){return E(x(t,e))}function w(t){var e=t%360;return e<0&&(e+=360),e}function E(t){return t%(2*Math.PI)*180/Math.PI}function I(t){return t%360*Math.PI/180}function S(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return _(x(t,e),r)}function C(t,e,r){if(void 0===e&&(e="meters"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var n=i[e];if(!n)throw new Error("invalid original units");var o=i[r];if(!o)throw new Error("invalid final units");return t/n*o}function P(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function M(t){return!!t&&t.constructor===Object}function T(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!P(t))throw new Error("bbox must only contain numbers")}))}function L(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}var A=Object.freeze({__proto__:null,earthRadius:e,factors:r,unitsFactors:n,areaFactors:i,feature:o,geometry:a,point:s,points:u,polygon:l,polygons:c,lineString:h,lineStrings:p,featureCollection:f,multiLineString:d,multiPoint:g,multiPolygon:y,geometryCollection:m,round:v,radiansToLength:_,lengthToRadians:x,lengthToDegrees:b,bearingToAzimuth:w,radiansToDegrees:E,degreesToRadians:I,convertLength:S,convertArea:C,isNumber:P,isObject:M,validateBBox:T,validateId:L});function k(t,e,r){if(null!==t)for(var n,i,o,a,s,u,l,c,h=0,p=0,f=t.type,d="FeatureCollection"===f,g="Feature"===f,y=d?t.features.length:1,m=0;ms||f>u||d>l)return a=o,s=r,u=f,l=d,void(i=0);var g=h([a,o],t.properties);if(!1===e(g,r,n,d,i))return!1;i++,a=o}))&&void 0}}}))}function G(t,e,r){var n=r,i=!1;return q(t,(function(t,o,a,s,u){n=!1===i&&void 0===r?t:e(n,t,o,a,s,u),i=!0})),n}function X(t,e){if(!t)throw new Error("geojson is required");j(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var a=0;at[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2]=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function $(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Q(t){if(t.length>1&&P(t[0])&&P(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return Q(t[0]);throw new Error("coordinates must only contain numbers")}function tt(t,e,r){if(!e||!r)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.type)}function et(t,e,r){if(!t)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+t.geometry.type)}function rt(t,e,r){if(!t)throw new Error("No featureCollection passed");if(!r)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+r+", FeatureCollection required");for(var n=0,i=t.features;n=0&&g>=0&&g=0;c--)if(Math.abs(e[c][0][0]-u)<=1e-7&&Math.abs(e[c][0][1]-l)<=1e-7){for(var h=a.path.length-2;h>=0;--h)e[c].unshift(a.path[h]);s=!0;break}s||(e[r++]=a.path)}var p}))})),e}(function(t,e){for(var r=t.length-1,n=t[0].length-1,i={rows:r,cols:n,cells:[]},o=0;o=e?8:0,s|=l>=e?4:0,s|=c>=e?2:0;var p,f,d,g,y=!1;if(5==(s|=h>=e?1:0)||10===s){var m=(u+l+c+h)/4;5===s&&mr;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);xt(t,e,Math.max(r,Math.floor(e-a*u/o+l)),Math.min(n,Math.floor(e+(o-a)*u/o+l)),i)}var c=t[e],h=r,p=n;for(bt(t,r,e),i(t[n],c)>0&&bt(t,r,n);h0;)p--}0===i(t[r],c)?bt(t,r,p):bt(t,++p,n),p<=e&&(r=p+1),e<=p&&(n=p-1)}}function bt(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function wt(t,e){return te?1:0}mt.default=vt;var Et=St,It=St;function St(t,e){if(!(this instanceof St))return new St(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Ct(t,e,r){if(!r)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function Ot(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function zt(t,e,r,n,i){for(var o,a=[e,r];a.length;)(r=a.pop())-(e=a.pop())<=n||(o=e+Math.ceil((r-e)/n/2)*n,mt(t,o,e,r,i),a.push(e,o,o,r))}function Ft(t){var e={exports:{}};return t(e,e.exports),e.exports}St.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,r=[],n=this.toBBox;if(!Rt(t,e))return r;for(var i,o,a,s,u=[];e;){for(i=0,o=e.children.length;i=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var r=t[e],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);var o=this._chooseSplitIndex(r,i,n),a=Ot(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,Pt(r,this.toBBox),Pt(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(r,a)},_splitRoot:function(t,e){this.data=Ot([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Pt(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,r){var n,i,o,a,s,u,l,c,h,p,f,d,g,y;for(u=l=1/0,n=e;n<=r-e;n++)h=i=Mt(t,0,n,this.toBBox),p=o=Mt(t,n,r,this.toBBox),void 0,void 0,void 0,void 0,f=Math.max(h.minX,p.minX),d=Math.max(h.minY,p.minY),g=Math.min(h.maxX,p.maxX),y=Math.min(h.maxY,p.maxY),a=Math.max(0,g-f)*Math.max(0,y-d),s=kt(i)+kt(o),a=e;i--)o=t.children[i],Tt(u,t.leaf?a(o):o),l+=Nt(u);return l},_adjustParentBBoxes:function(t,e,r){for(var n=r;n>=0;n--)Tt(e[n],t)},_condense:function(t){for(var e,r=t.length-1;r>=0;r--)0===t[r].children.length?r>0?(e=t[r-1].children).splice(e.indexOf(t[r]),1):this.clear():Pt(t[r],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},Et.default=It;var Bt=function(t,e,r){var n=t*e,i=Ut*t,o=i-(i-t),a=t-o,s=Ut*e,u=s-(s-e),l=e-u,c=a*l-(n-o*u-a*u-o*l);return r?(r[0]=c,r[1]=n,r):[c,n]},Ut=+(Math.pow(2,27)+1),jt=function(t,e){var r=0|t.length,n=0|e.length;if(1===r&&1===n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);return i?[i,r]:[r]}(t[0],e[0]);var i,o,a=new Array(r+n),s=0,u=0,l=0,c=Math.abs,h=t[u],p=c(h),f=e[l],d=c(f);p=n?(i=h,(u+=1)=n?(i=h,(u+=1)>1;return["sum(",r(t.slice(0,e)),",",r(t.slice(e)),")"].join("")}function n(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var i=[],o=0;o0){if(a<=0)return s;n=i+a}else{if(!(i<0))return s;if(a>=0)return s;n=-(i+a)}var u=33306690738754716e-32*n;return s>=u||s<=-u?s:o(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],o=e[0]-n[0],s=r[0]-n[0],u=t[1]-n[1],l=e[1]-n[1],c=r[1]-n[1],h=t[2]-n[2],p=e[2]-n[2],f=r[2]-n[2],d=o*c,g=s*l,y=s*u,m=i*c,v=i*l,_=o*u,x=h*(d-g)+p*(y-m)+f*(v-_),b=7771561172376103e-31*((Math.abs(d)+Math.abs(g))*Math.abs(h)+(Math.abs(y)+Math.abs(m))*Math.abs(p)+(Math.abs(v)+Math.abs(_))*Math.abs(f));return x>b||-x>b?x:a(t,e,r,n)}];function u(t){var e=s[t.length];return e||(e=s[t.length]=i(t.length)),e.apply(void 0,t)}!function(){for(;s.length<=5;)s.push(i(s.length));for(var e=[],r=["slow"],n=0;n<=5;++n)e.push("a"+n),r.push("o"+n);var o=["function getOrientation(",e.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=5;++n)o.push("case ",n,":return o",n,"(",e.slice(0,n).join(),");");o.push("}var s=new Array(arguments.length);for(var i=0;i0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function Jt(t,e){return te?1:0}Ht.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=s,t=o}e[t]=i}},Yt.default=Wt;var Kt=function(t,e){for(var r=t[0],n=t[1],i=!1,o=0,a=e.length-1;on!=c>n&&r<(l-s)*(n-u)/(c-u)+s&&(i=!i)}return i},$t=Xt[3],Qt=ee,te=ee;function ee(t,e,r){e=Math.max(0,void 0===e?2:e),r=r||0;for(var n,i=function(t){for(var e=t[0],r=t[0],n=t[0],i=t[0],o=0;on[0]&&(n=a),a[1]i[1]&&(i=a)}var s=[e,r,n,i],u=s.slice();for(o=0;o1&&Zt(t[o[l-2]],t[o[l-1]],u)<=0;)l-=1,o.pop();for(o.push(s),l=a.length;l>1&&Zt(t[a[l-2]],t[a[l-1]],u)>=0;)l-=1,a.pop();a.push(s)}r=new Array(a.length+o.length-2);for(var c=0,h=(n=0,o.length);n0;--p)r[c++]=a[p];return r}(u),c=[];for(o=0;oo||s.push({node:c,dist:h})}for(;s.length&&!s.peek().node.children;){var p=s.pop(),f=p.node,d=ce(f,e,r),g=ce(f,n,i);if(p.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function ae(t,e,r){for(var n,i,o,a,s=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=r.search({minX:s,minY:u,maxX:l,maxY:c}),p=0;p0!=$t(n,i,a)>0&&$t(o,a,n)>0!=$t(o,a,i)>0)return!1;return!0}function se(t){var e=t.p,r=t.next.p;return t.minX=Math.min(e[0],r[0]),t.minY=Math.min(e[1],r[1]),t.maxX=Math.max(e[0],r[0]),t.maxY=Math.max(e[1],r[1]),t}function ue(t,e){var r={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(r.next=e.next,r.prev=e,e.next.prev=r,e.next=r):(r.prev=r,r.next=r),r}function le(t,e){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n}function ce(t,e,r){var n=e[0],i=e[1],o=r[0]-n,a=r[1]-i;if(0!==o||0!==a){var s=((t[0]-n)*o+(t[1]-i)*a)/(o*o+a*a);s>1?(n=r[0],i=r[1]):s>0&&(n+=o*s,i+=a*s)}return(o=t[0]-n)*o+(a=t[1]-i)*a}function he(t,e,r,n,i,o,a,s){var u,l,c,h,p=r-t,f=n-e,d=a-i,g=s-o,y=t-i,m=e-o,v=p*p+f*f,_=p*d+f*g,x=d*d+g*g,b=p*y+f*m,w=d*y+g*m,E=v*x-_*_,I=E,S=E;0===E?(l=0,I=1,h=w,S=x):(h=v*w-_*b,(l=_*w-x*b)<0?(l=0,h=w,S=x):l>I&&(l=I,h=w+_,S=x)),h<0?(h=0,-b<0?l=0:-b>v?l=I:(l=-b,I=v)):h>S&&(h=S,-b+_<0?l=0:-b+_>v?l=I:(l=-b+_,I=v));var C=(1-(c=0===h?0:h/S))*i+c*a-((1-(u=0===l?0:l/I))*t+u*r),P=(1-c)*o+c*s-((1-u)*e+u*n);return C*C+P*P}function pe(t,e){void 0===e&&(e={}),e.concavity=e.concavity||1/0;var r=[];if(k(t,(function(t){r.push([t[0],t[1]])})),!r.length)return null;var n=Qt(r,e.concavity);return n.length>3?l([n]):null}function fe(t,e,r){if(void 0===r&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var n=K(t),i=nt(e),o=i.type,a=e.bbox,s=i.coordinates;if(a&&!1===function(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}(n,a))return!1;"Polygon"===o&&(s=[s]);for(var u=!1,l=0;lt[1]!=l>t[1]&&t[0]<(u-a)*(t[1]-s)/(l-s)+a&&(n=!n)}return n}function ge(t,e){var r=[];return O(t,(function(t){var n=!1;if("Point"===t.geometry.type)B(e,(function(e){fe(t,e)&&(n=!0)})),n&&r.push(t);else{if("MultiPoint"!==t.geometry.type)throw new Error("Input geometry must be a Point or MultiPoint");var i=[];B(e,(function(e){k(t,(function(t){fe(t,e)&&(n=!0,i.push(t))}))})),n&&r.push(g(i))}})),f(r)}function ye(t,e,r){void 0===r&&(r={});var n=K(t),i=K(e),o=I(i[1]-n[1]),a=I(i[0]-n[0]),s=I(n[1]),u=I(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(u);return _(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),r.units)}function me(t,e){var r=!1;return f(function(t){if(t.length<3)return[];t.sort(_e);for(var e,r,n,i,o,a,s=t.length-1,u=t[s].x,l=t[0].x,c=t[s].y,h=c;s--;)t[s].yh&&(h=t[s].y);var p,f=l-u,d=h-c,g=f>d?f:d,y=.5*(l+u),m=.5*(h+c),v=[new ve({__sentinel:!0,x:y-20*g,y:m-g},{__sentinel:!0,x:y,y:m+20*g},{__sentinel:!0,x:y+20*g,y:m-g})],_=[],x=[];s=t.length;for(;s--;){for(x.length=0,p=v.length;p--;)(f=t[s].x-v[p].x)>0&&f*f>v[p].r?(_.push(v[p]),v.splice(p,1)):f*f+(d=t[s].y-v[p].y)*d>v[p].r||(x.push(v[p].a,v[p].b,v[p].b,v[p].c,v[p].c,v[p].a),v.splice(p,1));for(xe(x),p=x.length;p;)r=x[--p],e=x[--p],n=t[s],i=r.x-e.x,o=r.y-e.y,a=2*(i*(n.y-r.y)-o*(n.x-r.x)),Math.abs(a)>1e-12&&v.push(new ve(e,r,n))}Array.prototype.push.apply(_,v),s=_.length;for(;s--;)(_[s].a.__sentinel||_[s].b.__sentinel||_[s].c.__sentinel)&&_.splice(s,1);return _}(t.features.map((function(t){var n={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?n.z=t.properties[e]:3===t.geometry.coordinates.length&&(r=!0,n.z=t.geometry.coordinates[2]),n}))).map((function(t){var e=[t.a.x,t.a.y],n=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return r?(e.push(t.a.z),n.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},l([[e,n,i,e]],o)})))}Qt.default=te;var ve=function(t,e,r){this.a=t,this.b=e,this.c=r;var n,i,o=e.x-t.x,a=e.y-t.y,s=r.x-t.x,u=r.y-t.y,l=o*(t.x+e.x)+a*(t.y+e.y),c=s*(t.x+r.x)+u*(t.y+r.y),h=2*(o*(r.y-e.y)-a*(r.x-e.x));this.x=(u*l-a*c)/h,this.y=(o*c-s*l)/h,n=this.x-t.x,i=this.y-t.y,this.r=n*n+i*i};function _e(t,e){return e.x-t.x}function xe(t){var e,r,n,i,o,a=t.length;t:for(;a;)for(r=t[--a],e=t[--a],n=a;n;)if(o=t[--n],e===(i=t[--n])&&r===o||e===o&&r===i){t.splice(a,2),t.splice(n,2),a-=2;continue t}}function be(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return we(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"features":return;default:e[r]=t[r]}})),e.features=t.features.map((function(t){return we(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Ie(t);default:throw new Error("unknown GeoJSON type")}}function we(t){var e={type:"Feature"};return Object.keys(t).forEach((function(r){switch(r){case"type":case"properties":case"geometry":return;default:e[r]=t[r]}})),e.properties=Ee(t.properties),e.geometry=Ie(t.geometry),e}function Ee(t){var e={};return t?(Object.keys(t).forEach((function(r){var n=t[r];"object"==typeof n?null===n?e[r]=null:Array.isArray(n)?e[r]=n.map((function(t){return t})):e[r]=Ee(n):e[r]=n})),e):e}function Ie(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Ie(t)})),e):(e.coordinates=Se(t.coordinates),e)}function Se(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Se(t)}))}function Ce(t){return t[0].toString()+","+t[1].toString()}function Pe(t){return t}function Me(t,e){var r=function(t){if(null==t)return Pe;var e,r,n=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=r=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*n+o,c[1]=(r+=t[1])*i+a;u1)for(var o,s,u=1,l=a(i[0]);ul&&(s=i[0],i[0]=i[u],i[u]=s,l=o);return i})).filter((function(t){return t.length>0}))}}var Le=Object.prototype.hasOwnProperty;function Ae(t,e,r,n,i,o){3===arguments.length&&(n=o=Array,i=null);for(var a=new n(t=1<=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=n,s[l]=o,o},maybeSet:function(n,o){for(var l=e(n)&u,c=a[l],h=0;c!=i;){if(r(c,n))return s[l];if(++h>=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=n,s[l]=o,o},get:function(n,o){for(var l=e(n)&u,c=a[l],h=0;c!=i;){if(r(c,n))return s[l];if(++h>=t)break;c=a[l=l+1&u]}return o},keys:function(){for(var t=[],e=0,r=a.length;e>7^Re[2]^Re[3])}function ze(t,e,r,n){Fe(t,e,r),Fe(t,e,e+n),Fe(t,e+n,r)}function Fe(t,e,r){for(var n,i=e+(r---e>>1);en&&(n=o),ai&&(i=a)}function u(t){t.forEach(s)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return n>=e&&i>=r?[e,r,n,i]:void 0}(t=function(t){var e,r,n={};for(e in t)n[e]=null==(r=t[e])?{type:null}:("FeatureCollection"===r.type?Be:"Feature"===r.type?Ue:je)(r);return n}(t)),n=e>0&&r&&function(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=o-n?(r-1)/(o-n):1,u=a-i?(r-1)/(a-i):1;function l(t){return[Math.round((t[0]-n)*s),Math.round((t[1]-i)*u)]}function c(t,e){for(var r,o,a,l,c,h=-1,p=0,f=t.length,d=new Array(f);++h=0){var o=h[r];i===e&&o===n||i===n&&o===e||(++f,p[r]=1)}else c[r]=e,h[r]=n}}function b(t){return Oe(o[t])}function w(t,e){return ke(o[t],o[e])}l=c=h=null;var E,I=function(t,e,r,n,i){3===arguments.length&&(n=Array,i=null);for(var o=new n(t=1<=t)throw new Error("full hashset");u=o[s=s+1&a]}return o[s]=n,!0},has:function(n){for(var s=e(n)&a,u=o[s],l=0;u!=i;){if(r(u,n))return!0;if(++l>=t)break;u=o[s=s+1&a]}return!1},values:function(){for(var t=[],e=0,r=o.length;e2&&Je(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1))}if(r.push(e[e.length-1]),i=r.length,He(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Je(r[i-3],r[i-1],r[i-2])&&r.splice(r.length-2,1),r}function He(t,e){return t[0]===e[0]&&t[1]===e[1]}function Je(t,e,r){var n=r[0],i=r[1],o=t[0],a=t[1],s=e[0],u=e[1],l=s-o,c=u-a;return 0==(n-o)*c-(i-a)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=n&&n<=s:s<=n&&n<=o:c>0?a<=i&&i<=u:u<=i&&i<=a)}function Ke(t,e,r){var n=e.x,i=e.y,o=r.x-n,a=r.y-i;if(0!==o||0!==a){var s=((t.x-n)*o+(t.y-i)*a)/(o*o+a*a);s>1?(n=r.x,i=r.y):s>0&&(n+=o*s,i+=a*s)}return(o=t.x-n)*o+(a=t.y-i)*a}function $e(t,e,r,n,i){for(var o,a=n,s=e+1;sa&&(o=s,a=u)}a>n&&(o-e>1&&$e(t,e,o,n,i),i.push(t[o]),r-o>1&&$e(t,o,r,n,i))}function Qe(t,e){var r=t.length-1,n=[t[0]];return $e(t,0,r,e,n),n.push(t[r]),n}function tr(t,e,r){if(t.length<=2)return t;var n=void 0!==e?e*e:1;return Qe(t=r?t:function(t,e){for(var r,n,i,o,a,s=t[0],u=[s],l=1,c=t.length;le&&(u.push(r),s=r);return s!==r&&u.push(r),u}(t,n),n)}function er(t,e,r){return tr(t.map((function(t){return{x:t[0],y:t[1],z:t[2]}})),e,r).map((function(t){return t.z?[t.x,t.y,t.z]:[t.x,t.y]}))}function rr(t,e,r){return t.map((function(t){var n=t.map((function(t){return{x:t[0],y:t[1]}}));if(n.length<4)throw new Error("invalid polygon");for(var i=tr(n,e,r).map((function(t){return[t.x,t.y]}));!nr(i);)i=tr(n,e-=.01*e,r).map((function(t){return[t.x,t.y]}));return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function nr(t){return!(t.length<3||3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var ir=function(){function t(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;et&&(e.push(n),r=i)}return e},t.prototype.vector=function(t){var e=this.pos(t+10),r=this.pos(t-10);return{angle:180*Math.atan2(e.y-r.y,e.x-r.x)/3.14,speed:Math.sqrt((r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y)+(r.z-e.z)*(r.z-e.z))}},t.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var r=e/this.duration;if(r>=1)return this.points[this.length-1];var n=Math.floor((this.points.length-1)*r);return function(t,e,r,n,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+n.x*o[1]+r.x*o[2]+e.x*o[3],y:i.y*o[0]+n.y*o[1]+r.y*o[2]+e.y*o[3],z:i.z*o[0]+n.z*o[1]+r.z*o[2]+e.z*o[3]}}((this.length-1)*r-n,this.points[n],this.controls[n][1],this.controls[n+1][0],this.points[n+1])},t}();function or(t,e){void 0===e&&(e={});for(var r=e.resolution||1e4,n=e.sharpness||.85,i=[],o=nt(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),a=new ir({duration:r,points:o,sharpness:n}),s=function(t){var e=a.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])},u=0;u=ye(t.slice(0,2),[e,i])){var o=(r+i)/2;return[e,o-(n-e)/2,n,o+(n-e)/2]}var a=(e+n)/2;return[a-(i-r)/2,r,a+(i-r)/2,i]}function lr(t,e,r,n){void 0===n&&(n={});var i=K(t),o=I(i[0]),a=I(i[1]),u=I(r),l=x(e,n.units),c=Math.asin(Math.sin(a)*Math.cos(l)+Math.cos(a)*Math.sin(l)*Math.cos(u));return s([E(o+Math.atan2(Math.sin(u)*Math.sin(l)*Math.cos(a),Math.cos(l)-Math.sin(a)*Math.sin(c))),E(c)],n.properties)}function cr(t,e,r){void 0===r&&(r={});for(var n=r.steps||64,i=r.properties?r.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],a=0;a80*r){n=o=t[0],i=a=t[1];for(var d=r;do&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return xr(p,f,r,n,i,l),f}function vr(t,e,r,n,i){var o,a;if(i===Br(t,e,r,n)>0)for(o=e;o=e;o-=n)a=Or(o,t[o],t[o+1],a);return a&&kr(a,a.next)&&(zr(a),a=a.next),a}function _r(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!kr(n,n.next)&&0!==Ar(n.prev,n,n.next))n=n.next;else{if(zr(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function xr(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Pr(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?wr(t,n,i,o):br(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),zr(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?xr(t=Er(t,e,r),e,r,n,i,o,2):2===a&&Ir(t,e,r,n,i,o):xr(_r(t),e,r,n,i,o,1);break}}}function br(t){var e=t.prev,r=t,n=t.next;if(Ar(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Tr(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ar(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function wr(t,e,r,n){var i=t.prev,o=t,a=t.next;if(Ar(i,o,a)>=0)return!1;for(var s=i.xo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,c=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=Pr(s,u,e,r,n),p=Pr(l,c,e,r,n),f=t.prevZ,d=t.nextZ;f&&f.z>=h&&d&&d.z<=p;){if(f!==t.prev&&f!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ar(f.prev,f,f.next)>=0)return!1;if(f=f.prevZ,d!==t.prev&&d!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ar(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;f&&f.z>=h;){if(f!==t.prev&&f!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&Ar(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;d&&d.z<=p;){if(d!==t.prev&&d!==t.next&&Tr(i.x,i.y,o.x,o.y,a.x,a.y,d.x,d.y)&&Ar(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function Er(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!kr(i,o)&&Nr(i,n,n.next,o)&&Dr(i,o)&&Dr(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),zr(n),zr(n.next),n=t=o),n=n.next}while(n!==t);return n}function Ir(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Lr(a,s)){var u=Rr(a,s);return a=_r(a,a.next),u=_r(u,u.next),xr(a,e,r,n,i,o),void xr(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function Sr(t,e){return t.x-e.x}function Cr(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Tr(or.x)&&Dr(n,t)&&(r=n,p=u),n=n.next;return r}(t,e)){var r=Rr(e,t);_r(r,r.next)}}function Pr(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Mr(t){var e=t,r=t;do{e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function Lr(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Nr(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&Dr(t,e)&&Dr(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function Ar(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function kr(t,e){return t.x===e.x&&t.y===e.y}function Nr(t,e,r,n){return!!(kr(t,e)&&kr(r,n)||kr(t,n)&&kr(r,e))||Ar(t,e,r)>0!=Ar(t,e,n)>0&&Ar(r,n,t)>0!=Ar(r,n,e)>0}function Dr(t,e){return Ar(t.prev,t,t.next)<0?Ar(t,e,t.next)>=0&&Ar(t,t.prev,e)>=0:Ar(t,e,t.prev)<0||Ar(t,t.next,e)<0}function Rr(t,e){var r=new Fr(t.i,t.x,t.y),n=new Fr(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Or(t,e,r,n){var i=new Fr(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function zr(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Fr(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Br(t,e,r,n){for(var i=0,o=e,a=r-n;o0&&(n+=t[i-1].length,r.holes.push(n))}return r}(t),r=gr(e.vertices,e.holes,2),n=[],i=[];r.forEach((function(t,n){var o=r[n];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;oi?r:i,n>o?n:o]}(t,n),r.push(i),n})),r})(r,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}}(t,e)})),f(e)}mr.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Br(t,0,o,r));if(i)for(var s=0,u=e.length;s0&&(n+=t[i-1].length,r.holes.push(n))}return r},gr.default=yr;var qr=Ft((function(t,e){function r(t,e,r){void 0===r&&(r={});var n={type:"Feature"};return(0===r.id||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function n(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!f(t[0])||!f(t[1]))throw new Error("coordinates must contain numbers");return r({type:"Point",coordinates:t},e,n)}function i(t,e,n){void 0===n&&(n={});for(var i=0,o=t;i=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r},e.radiansToLength=c,e.lengthToRadians=h,e.lengthToDegrees=function(t,e){return p(h(t,e))},e.bearingToAzimuth=function(t){var e=t%360;return e<0&&(e+=360),e},e.radiansToDegrees=p,e.degreesToRadians=function(t){return t%360*Math.PI/180},e.convertLength=function(t,e,r){if(void 0===e&&(e="kilometers"),void 0===r&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return c(h(t,e),r)},e.convertArea=function(t,r,n){if(void 0===r&&(r="meters"),void 0===n&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=e.areaFactors[r];if(!i)throw new Error("invalid original units");var o=e.areaFactors[n];if(!o)throw new Error("invalid final units");return t/i*o},e.isNumber=f,e.isObject=function(t){return!!t&&t.constructor===Object},e.validateBBox=function(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!f(t))throw new Error("bbox must only contain numbers")}))},e.validateId=function(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(typeof t))throw new Error("id must be a number or a string")}}));function Gr(t,e,r){if(null!==t)for(var n,i,o,a,s,u,l,c,h=0,p=0,f=t.type,d="FeatureCollection"===f,g="Feature"===f,y=d?t.features.length:1,m=0;ms||p>u||f>l)return a=o,s=r,u=p,l=f,void(i=0);var d=qr.lineString([a,o],t.properties);if(!1===e(d,r,n,f,i))return!1;i++,a=o}))&&void 0}}}))}function Jr(t,e){if(!t)throw new Error("geojson is required");Wr(t,(function(t,r,n){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,r,n,0,0))return!1;break;case"Polygon":for(var a=0;at[0]&&(e[0]=t[0]),e[1]>t[1]&&(e[1]=t[1]),e[2] line1 must only contain 2 coordinates");if(2!==n.length)throw new Error(" line2 must only contain 2 coordinates");var i=r[0][0],o=r[0][1],a=r[1][0],u=r[1][1],l=n[0][0],c=n[0][1],h=n[1][0],p=n[1][1],f=(p-c)*(a-i)-(h-l)*(u-o);if(0===f)return null;var d=((h-l)*(o-c)-(p-c)*(i-l))/f,g=((a-i)*(o-c)-(u-o)*(i-l))/f;return d>=0&&d<=1&&g>=0&&g<=1?s([i+d*(a-i),o+d*(u-o)]):null}function yn(t,e,r){void 0===r&&(r={});var n=s([1/0,1/0],{dist:1/0}),i=0;return j(t,(function(t){for(var o=$(t),a=0;a0&&((m=y.features[0]).properties.dist=ye(e,m,r),m.properties.location=i+ye(u,m,r)),u.properties.dist180?-360:i[0]-o[0]>180?360:0,S(function(t,r,n){var i=n=void 0===n?e:Number(n),o=t[1]*Math.PI/180,a=r[1]*Math.PI/180,s=a-o,u=Math.abs(r[0]-t[0])*Math.PI/180;u>Math.PI&&(u-=2*Math.PI);var l=Math.log(Math.tan(a/2+Math.PI/4)/Math.tan(o/2+Math.PI/4)),c=Math.abs(l)>1e-11?s/l:Math.cos(o);return Math.sqrt(s*s+c*c*u*u)*i}(i,o),"meters",n.units)}function vn(t,e,r){if(void 0===r&&(r={}),r.method||(r.method="geodesic"),r.units||(r.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=s(t):"Point"===t.type?t=o(t):et(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=h(e):"LineString"===e.type?e=o(e):et(e,"LineString","line");var n=1/0,i=t.geometry.coordinates;return q(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],a=function(t,e,r,n){var i=[r[0]-e[0],r[1]-e[1]],o=_n([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return xn(t,e,{method:n.method,units:"degrees"});var a=_n(i,i);if(a<=o)return xn(t,r,{method:n.method,units:"degrees"});var s=o/a;return xn(t,[e[0]+s*i[0],e[1]+s*i[1]],{method:n.method,units:"degrees"})}(i,e,o,r);a=0&&l<=1&&(p.onLine1=!0),c>=0&&c<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}function wn(t){for(var e=function(t){return"FeatureCollection"!==t.type?"Feature"!==t.type?f([o(t)]):f([t]):t}(t),r=pr(e),n=!1,i=0;!n&&i0){e+=Math.abs(Pn(t[0]));for(var r=1;r2){for(a=0;a=c&&p===i.length-1);p++){if(c>e&&0===o.length){if(!(a=e-c))return o.push(i[p]),h(o);s=hr(i[p],i[p-1])-180,u=lr(i[p],a,s,n),o.push(u.geometry.coordinates)}if(c>=r)return(a=r-c)?(s=hr(i[p],i[p-1])-180,u=lr(i[p],a,s,n),o.push(u.geometry.coordinates),h(o)):(o.push(i[p]),h(o));if(c>=e&&o.push(i[p]),p===i.length-1)return h(o);c+=ye(i[p],i[p+1],n)}if(ci)return!1}else if(0!==f)return!1;return n?"start"===n?Math.abs(h)>=Math.abs(p)?h>0?s0?u=Math.abs(p)?h>0?s<=o&&o0?u<=a&&a=Math.abs(p)?h>0?s0?u=Math.abs(p)?h>0?s<=o&&o<=l:l<=o&&o<=s:p>0?u<=a&&a<=c:c<=a&&a<=u}function Nn(t,e){var r=nt(t),n=nt(e),i=r.type,o=n.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var r,n=!1;for(r=0;re[0]||t[2]e[1]||t[3] is required");if("number"!=typeof r)throw new Error(" must be a number");if("number"!=typeof n)throw new Error(" must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,r);return k(t,(function(t){!function(t,e,r){t.length>r&&t.splice(r,t.length);for(var n=0;n=1||u<=0||l>=1||l<=0))){var g=d,y=!o[g];y&&(o[g]=!0),e?i.push(e(d,t,r,c,h,u,a,s,p,f,l,y)):i.push(d)}}function g(t,e){var r,i,o,a,s=n[t][e],u=n[t][e+1];return s[0]p[e.isect].coord?-1:1}));for(u=[];w.length>0;){var P=w.pop(),M=P.isect,T=P.parent,L=P.winding,A=u.length,k=[p[M].coord],N=M;if(p[M].ringAndEdge1Walkable)var D=p[M].ringAndEdge1,R=p[M].nxtIsectAlongRingAndEdge1;else D=p[M].ringAndEdge2,R=p[M].nxtIsectAlongRingAndEdge2;for(;!Zn(p[M].coord,p[R].coord);){k.push(p[R].coord);var O=void 0;for(n=0;n1)for(e=0;e=0==e}function Xn(t){for(var e=0,r=0;r1&&r.push(h(l)),f(r)}function ri(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var r,n=1/0;return O(e,(function(e){var i=yn(e,t).properties.dist;ic&&f.push(lr(t,e,c,i).geometry.coordinates),h(f,u)}function oi(t){var e=t%360;return e<0&&(e+=360),e}function ai(t,e){void 0===e&&(e={});var r=nt(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),r.type){case"Polygon":return si(r,e);case"MultiPolygon":return function(t,e){void 0===e&&(e={});var r=nt(t).coordinates,n=e.properties?e.properties:"Feature"===t.type?t.properties:{},i=[];return r.forEach((function(t){i.push(ui(t,n))})),f(i)}(r,e);default:throw new Error("invalid poly")}}function si(t,e){return void 0===e&&(e={}),ui(nt(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function ui(t,e){return t.length>1?d(t,e):h(t[0],e)}function li(t,e){var r,n,i;void 0===e&&(e={});var o=e.properties,a=null===(r=e.autoComplete)||void 0===r||r,s=null===(n=e.orderCoords)||void 0===n||n;if("FeatureCollection"===(null!==(i=e.mutate)&&void 0!==i&&i||(t=be(t)),t.type)){var u=[];return t.features.forEach((function(t){u.push($(ci(t,{},a,s)))})),y(u,o)}return ci(t,o,a,s)}function ci(t,e,r,n){e=e||("Feature"===t.type?t.properties:{});var i=nt(t),o=i.coordinates,a=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(a){case"LineString":return r&&(o=hi(o)),l([o],e);case"MultiLineString":var s=[],u=0;return o.forEach((function(t){if(r&&(t=hi(t)),n){var e=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.abs(e-n)*Math.abs(r-i)}(J(h(t)));e>u?(s.unshift(t),u=e):s.push(t)}else s.push(t)})),l(s,e);default:throw new Error("geometry type "+a+" is not supported")}}function hi(t){var e=t[0],r=e[0],n=e[1],i=t[t.length-1],o=i[0],a=i[1];return r===o&&n===a||t.push(e),t}function pi(t,e){var r,n,i,o,a,s,u;for(n=1;n<=8;n*=2){for(r=[],o=!(di(i=t[t.length-1],e)&n),a=0;ae[2]&&(r|=2),t[1]e[3]&&(r|=8),r}function gi(t,e){for(var r=[],n=0,i=t;n0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&r.push(o))}return r}Qn.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),r=Math.sin(t*this.g)/Math.sin(this.g),n=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),a=Hn*Math.atan2(o,Math.sqrt(Math.pow(n,2)+Math.pow(i,2)));return[Hn*Math.atan2(i,n),a]},Qn.prototype.Arc=function(t,e){var r=[];if(!t||t<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var n=1/(t-1),i=0;ip&&(g>c&&dc&&gu&&(u=y)}var m=[];if(s&&u0&&Math.abs(x-r[_-1][0])>p){var b=parseFloat(r[_-1][0]),w=parseFloat(r[_-1][1]),E=parseFloat(r[_][0]),I=parseFloat(r[_][1]);if(b>-180&&b-180&&r[_-1][0]c&&b<180&&-180===E&&_+1c&&r[_-1][0]<180){v.push([180,r[_][1]]),_++,v.push([r[_][0],r[_][1]]);continue}if(bc){var S=b;b=E,E=S;var C=w;w=I,I=C}if(b>c&&E=180&&bc?180:-180,M]),(v=[]).push([r[_-1][0]>c?-180:180,M]),m.push(v)}else v=[],m.push(v);v.push([x,r[_][1]])}else v.push([r[_][0],r[_][1]])}}else{var T=[];m.push(T);for(var L=0;L=0;s--)if(l[s]!=c[s])return!1;for(s=l.length-1;s>=0;s--)if(u=l[s],!r(t[u],o[u],a))return!1;return typeof t==typeof o}(t,o,a))};function n(t){return null==t}function i(t){return!(!t||"object"!=typeof t||"number"!=typeof t.length||"function"!=typeof t.copy||"function"!=typeof t.slice||t.length>0&&"number"!=typeof t[0])}}));function _i(t,e,r){if(void 0===r&&(r={}),!M(r=r||{}))throw new Error("options is invalid");var n,i=r.tolerance||0,o=[],a=pn(),s=Vr(t);return a.load(s),q(e,(function(t){var e=!1;t&&(O(a.search(t),(function(r){if(!1===e){var o=$(t).sort(),a=$(r).sort();vi(o,a)||(0===i?An(o[0],r)&&An(o[1],r):yn(r,o[0]).properties.dist<=i&&yn(r,o[1]).properties.dist<=i)?(e=!0,n=n?xi(n,t):t):(0===i?An(a[0],t)&&An(a[1],t):yn(t,a[0]).properties.dist<=i&&yn(t,a[1]).properties.dist<=i)&&(n=n?xi(n,r):r)}})),!1===e&&n&&(o.push(n),n=void 0))})),n&&o.push(n),f(o)}function xi(t,e){var r=$(e),n=$(t),i=n[0],o=n[n.length-1],a=t.geometry.coordinates;return vi(r[0],i)?a.unshift(r[1]):vi(r[0],o)?a.push(r[1]):vi(r[1],i)?a.unshift(r[0]):vi(r[1],o)&&a.push(r[0]),t}function bi(t){var e=t%360;return e<0&&(e+=360),e}function wi(t,e,r){var n;return void 0===r&&(r={}),(n=r.final?Ei(K(e),K(t)):Ei(K(t),K(e)))>180?-(360-n):n}function Ei(t,e){var r=I(t[1]),n=I(e[1]),i=I(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(n/2+Math.PI/4)/Math.tan(r/2+Math.PI/4));return(E(Math.atan2(i,o))+360)%360}function Ii(t,r,n,i){void 0===i&&(i={});var o=r<0,a=S(Math.abs(r),i.units,"meters");o&&(a=-Math.abs(a));var u=K(t),l=function(t,r,n,i){var o=r/(i=void 0===i?e:Number(i)),a=t[0]*Math.PI/180,s=I(t[1]),u=I(n),l=o*Math.cos(u),c=s+l;Math.abs(c)>Math.PI/2&&(c=c>0?Math.PI-c:-Math.PI-c);var h=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(s/2+Math.PI/4)),p=Math.abs(h)>1e-11?l/h:Math.cos(s);return[(180*(a+o*Math.sin(u)/p)/Math.PI+540)%360-180,180*c/Math.PI]}(u,a,n);return l[0]+=l[0]-u[0]>180?-360:u[0]-l[0]>180?360:0,s(l,i.properties)}function Si(t,e,r,n,i,o){for(var a=0;a0?Pi(e,s,i)<0||(i=s):r>0&&n<=0&&(Ci(e,s,o)||(o=s)),r=n}return[i,o]}function Ci(t,e,r){return Pi(t,e,r)>0}function Pi(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])}function Mi(t){for(var e,r,n=$(t),i=0,o=1;o0}function Ti(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return B(t,(function(t){Ti(t,e)})),t;case"LineString":return Li($(t),e),t;case"Polygon":return Ai($(t),e),t;case"MultiLineString":return $(t).forEach((function(t){Li(t,e)})),t;case"MultiPolygon":return $(t).forEach((function(t){Ai(t,e)})),t;case"Point":case"MultiPoint":return t}}function Li(t,e){Mi(t)===e&&t.reverse()}function Ai(t,e){Mi(t[0])!==e&&t[0].reverse();for(var r=1;ra?128:64,l|=ha?32:16,l|=pa?8:4;var d=+(l|=fa?2:1),g=0;if(17===l||18===l||33===l||34===l||38===l||68===l||72===l||98===l||102===l||132===l||136===l||137===l||152===l||153===l){var y=(c+h+p+f)/4;g=y>a?2:y0?(l=156,g=4):l=152:33===l?g>0?(l=139,g=4):l=137:72===l?g>0?(l=99,g=4):l=98:132===l&&(g>0?(l=39,g=4):l=38)}if(0!=l&&170!=l){var m,v,_,x,b,w,E,I;m=v=_=x=b=w=E=I=.5;var S=[];1===l?(_=1-So(e,p,f),I=1-So(e,c,f),S.push(_o[l])):169===l?(_=So(a,f,p),I=So(a,f,c),S.push(_o[l])):4===l?(w=1-So(e,h,p),x=So(e,f,p),S.push(mo[l])):166===l?(w=So(a,p,h),x=1-So(a,p,f),S.push(mo[l])):16===l?(b=So(e,p,h),v=So(e,c,h),S.push(yo[l])):154===l?(b=1-So(a,h,p),v=1-So(a,h,c),S.push(yo[l])):64===l?(E=So(e,f,c),m=1-So(e,h,c),S.push(bo[l])):106===l?(E=1-So(a,c,f),m=So(a,c,h),S.push(bo[l])):168===l?(x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),S.push(vo[l]),S.push(_o[l])):2===l?(x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),S.push(vo[l]),S.push(_o[l])):162===l?(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),S.push(vo[l]),S.push(_o[l])):8===l?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),S.push(yo[l]),S.push(mo[l])):138===l?(b=1-So(e,h,p),w=1-So(a,h,p),m=1-So(a,h,c),v=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):32===l?(b=So(a,p,h),w=So(e,p,h),m=So(e,c,h),v=So(a,c,h),S.push(yo[l]),S.push(mo[l])):42===l?(I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(xo[l]),S.push(bo[l])):128===l&&(I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(xo[l]),S.push(bo[l])),5===l?(w=1-So(e,h,p),I=1-So(e,c,f),S.push(mo[l])):165===l?(w=So(a,p,h),I=So(a,f,c),S.push(mo[l])):20===l?(x=So(e,f,p),v=So(e,c,h),S.push(vo[l])):150===l?(x=1-So(a,p,f),v=1-So(a,h,c),S.push(vo[l])):80===l?(b=So(e,p,h),E=So(e,f,c),S.push(yo[l])):90===l?(b=1-So(a,h,p),E=1-So(a,c,f),S.push(yo[l])):65===l?(_=1-So(e,p,f),m=1-So(e,h,c),S.push(_o[l])):105===l?(_=So(a,f,p),m=So(a,c,h),S.push(_o[l])):160===l?(b=So(a,p,h),w=So(e,p,h),I=So(e,f,c),E=So(a,f,c),S.push(yo[l]),S.push(mo[l])):10===l?(b=1-So(e,h,p),w=1-So(a,h,p),I=1-So(a,c,f),E=1-So(e,c,f),S.push(yo[l]),S.push(mo[l])):130===l?(x=1-So(e,p,f),_=1-So(a,p,f),m=1-So(a,h,c),v=1-So(e,h,c),S.push(vo[l]),S.push(_o[l])):40===l?(x=So(a,f,p),_=So(e,f,p),m=So(e,c,h),v=So(a,c,h),S.push(vo[l]),S.push(_o[l])):101===l?(w=So(a,p,h),m=So(a,c,h),S.push(mo[l])):69===l?(w=1-So(e,h,p),m=1-So(e,h,c),S.push(mo[l])):149===l?(I=So(a,f,c),v=1-So(a,h,c),S.push(xo[l])):21===l?(I=1-So(e,c,f),v=So(e,c,h),S.push(xo[l])):86===l?(x=1-So(a,p,f),E=1-So(a,c,f),S.push(vo[l])):84===l?(x=So(e,f,p),E=So(e,f,c),S.push(vo[l])):89===l?(b=1-So(a,h,p),_=So(a,f,p),S.push(_o[l])):81===l?(b=So(e,p,h),_=1-So(e,p,f),S.push(_o[l])):96===l?(b=So(a,p,h),w=So(e,p,h),E=So(e,f,c),m=So(a,c,h),S.push(yo[l]),S.push(mo[l])):74===l?(b=1-So(e,h,p),w=1-So(a,h,p),E=1-So(a,c,f),m=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):24===l?(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),v=So(e,c,h),S.push(yo[l]),S.push(_o[l])):146===l?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),v=1-So(a,h,c),S.push(yo[l]),S.push(_o[l])):6===l?(w=1-So(e,h,p),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),S.push(mo[l]),S.push(vo[l])):164===l?(w=So(a,p,h),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),S.push(mo[l]),S.push(vo[l])):129===l?(_=1-So(e,p,f),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(_o[l]),S.push(xo[l])):41===l?(_=So(a,f,p),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(_o[l]),S.push(xo[l])):66===l?(x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=1-So(e,h,c),S.push(vo[l]),S.push(_o[l])):104===l?(x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=So(a,c,h),S.push(_o[l]),S.push(wo[l])):144===l?(b=So(e,p,h),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c),S.push(yo[l]),S.push(bo[l])):26===l?(b=1-So(a,h,p),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h),S.push(yo[l]),S.push(bo[l])):36===l?(w=So(a,p,h),x=So(e,f,p),m=So(e,c,h),v=So(a,c,h),S.push(mo[l]),S.push(vo[l])):134===l?(w=1-So(e,h,p),x=1-So(a,p,f),m=1-So(a,h,c),v=1-So(e,h,c),S.push(mo[l]),S.push(vo[l])):9===l?(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=1-So(e,c,f),S.push(yo[l]),S.push(mo[l])):161===l?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=So(a,f,c),S.push(yo[l]),S.push(mo[l])):37===l?(w=So(a,p,h),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h),S.push(mo[l]),S.push(xo[l])):133===l?(w=1-So(e,h,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c),S.push(mo[l]),S.push(xo[l])):148===l?(x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c),S.push(vo[l]),S.push(bo[l])):22===l?(x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h),S.push(vo[l]),S.push(bo[l])):82===l?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),S.push(yo[l]),S.push(_o[l])):88===l?(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),S.push(yo[l]),S.push(_o[l])):73===l?(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),m=1-So(e,h,c),S.push(yo[l]),S.push(mo[l])):97===l?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),m=So(a,c,h),S.push(yo[l]),S.push(mo[l])):145===l?(b=So(e,p,h),_=1-So(e,p,f),I=So(a,f,c),v=1-So(a,h,c),S.push(yo[l]),S.push(xo[l])):25===l?(b=1-So(a,h,p),_=So(a,f,p),I=1-So(e,c,f),v=So(e,c,h),S.push(yo[l]),S.push(xo[l])):70===l?(w=1-So(e,h,p),x=1-So(a,p,f),E=1-So(a,c,f),m=1-So(e,h,c),S.push(mo[l]),S.push(vo[l])):100===l?(w=So(a,p,h),x=So(e,f,p),E=So(e,f,c),m=So(a,c,h),S.push(mo[l]),S.push(vo[l])):34===l?(0===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):35===l?(4===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l]),S.push(bo[l])):136===l?(0===g?(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):153===l?(0===g?(b=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(_o[l])):102===l?(0===g?(w=1-So(e,h,p),x=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(mo[l]),S.push(bo[l])):155===l?(4===g?(b=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(xo[l])):103===l?(4===g?(w=1-So(e,h,p),x=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(mo[l]),S.push(vo[l])):152===l?(0===g?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(vo[l]),S.push(_o[l])):156===l?(4===g?(b=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),v=So(e,c,h)):(b=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),I=So(e,f,c),E=So(a,f,c),v=1-So(a,h,c)),S.push(yo[l]),S.push(_o[l]),S.push(bo[l])):137===l?(0===g?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l])):139===l?(4===g?(b=So(a,p,h),w=So(e,p,h),_=1-So(e,p,f),I=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)):(b=1-So(e,h,p),w=1-So(a,h,p),_=So(a,f,p),I=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)),S.push(yo[l]),S.push(mo[l]),S.push(xo[l])):98===l?(0===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(bo[l])):99===l?(4===g?(b=1-So(e,h,p),w=1-So(a,h,p),x=So(a,f,p),_=So(e,f,p),E=So(e,f,c),m=1-So(e,h,c)):(b=So(a,p,h),w=So(e,p,h),x=1-So(e,p,f),_=1-So(a,p,f),E=1-So(a,c,f),m=So(a,c,h)),S.push(yo[l]),S.push(mo[l]),S.push(_o[l])):38===l?(0===g?(w=1-So(e,h,p),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(mo[l]),S.push(xo[l]),S.push(bo[l])):39===l?(4===g?(w=1-So(e,h,p),x=So(e,f,p),I=So(e,f,c),E=So(a,f,c),m=1-So(a,h,c),v=1-So(e,h,c)):(w=So(a,p,h),x=1-So(a,p,f),I=1-So(a,c,f),E=1-So(e,c,f),m=So(e,c,h),v=So(a,c,h)),S.push(mo[l]),S.push(vo[l]),S.push(bo[l])):85===l&&(b=1,w=0,x=1,_=0,I=0,E=1,m=0,v=1),(m<0||m>1||v<0||v>1||b<0||b>1||x<0||x>1||I<0||I>1||E<0||E>1)&&console.log("MarchingSquaresJS-isoBands: "+l+" "+d+" "+c+","+h+","+p+","+f+" "+g+" "+m+" "+v+" "+b+" "+w+" "+x+" "+_+" "+I+" "+E),o.cells[s][u]={cval:l,cval_real:d,flipped:g,topleft:m,topright:v,righttop:b,rightbottom:w,bottomright:x,bottomleft:_,leftbottom:I,lefttop:E,edges:S}}}}}return o}(t,e,r);return Ni.polygons?(Ni.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(t){var e=[],r=0;return t.cells.forEach((function(t,n){t.forEach((function(t,i){if(void 0!==t){var o=Io[t.cval](t);"object"==typeof o&&Co(o)?"object"==typeof o[0]&&Co(o[0])?"object"==typeof o[0][0]&&Co(o[0][0])?o.forEach((function(t){t.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=t})):(o.forEach((function(t){t[0]+=i,t[1]+=n})),e[r++]=o):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}}))})),e}(l)):(Ni.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(t){for(var e=[],r=t.rows,n=t.cols,i=[],o=0;o0){var s=Mo(t.cells[o][a]),u=null,l=a,c=o;null!==s&&i.push([s.p[0]+l,s.p[1]+c]);do{if(null===(u=To(t.cells[c][l],s.x,s.y,s.o)))break;if(i.push([u.p[0]+l,u.p[1]+c]),l+=u.x,s=u,(c+=u.y)<0||c>=r||l<0||l>=n||void 0===t.cells[c][l]){var h=Po(t,l-=u.x,c-=u.y,u.x,u.y,u.o);if(null===h)break;h.path.forEach((function(t){i.push(t)})),l=h.i,c=h.j,s=h}}while(void 0!==t.cells[c][l]&&t.cells[c][l].edges.length>0);e.push(i),i=[],t.cells[o][a].edges.length>0&&a--}return e}(l)),"function"==typeof Ni.successCallback&&Ni.successCallback(u),u}var Ri=64,Oi=16,zi=[],Fi=[],Bi=[],Ui=[],ji=[],Vi=[],qi=[],Gi=[],Xi=[],Zi=[],Yi=[],Wi=[],Hi=[],Ji=[],Ki=[],$i=[],Qi=[],to=[],eo=[],ro=[],no=[],io=[],oo=[],ao=[];qi[85]=Zi[85]=-1,Gi[85]=Yi[85]=0,Xi[85]=Wi[85]=1,eo[85]=io[85]=1,ro[85]=oo[85]=0,no[85]=ao[85]=1,zi[85]=Ui[85]=0,Fi[85]=ji[85]=-1,Bi[85]=Ki[85]=0,$i[85]=Hi[85]=0,Qi[85]=Ji[85]=1,Vi[85]=to[85]=1,io[1]=io[169]=0,oo[1]=oo[169]=-1,ao[1]=ao[169]=0,Hi[1]=Hi[169]=-1,Ji[1]=Ji[169]=0,Ki[1]=Ki[169]=0,Zi[4]=Zi[166]=0,Yi[4]=Yi[166]=-1,Wi[4]=Wi[166]=1,$i[4]=$i[166]=1,Qi[4]=Qi[166]=0,to[4]=to[166]=0,qi[16]=qi[154]=0,Gi[16]=Gi[154]=1,Xi[16]=Xi[154]=1,Ui[16]=Ui[154]=1,ji[16]=ji[154]=0,Vi[16]=Vi[154]=1,eo[64]=eo[106]=0,ro[64]=ro[106]=1,no[64]=no[106]=0,zi[64]=zi[106]=-1,Fi[64]=Fi[106]=0,Bi[64]=Bi[106]=1,eo[2]=eo[168]=0,ro[2]=ro[168]=-1,no[2]=no[168]=1,io[2]=io[168]=0,oo[2]=oo[168]=-1,ao[2]=ao[168]=0,Hi[2]=Hi[168]=-1,Ji[2]=Ji[168]=0,Ki[2]=Ki[168]=0,$i[2]=$i[168]=-1,Qi[2]=Qi[168]=0,to[2]=to[168]=1,qi[8]=qi[162]=0,Gi[8]=Gi[162]=-1,Xi[8]=Xi[162]=0,Zi[8]=Zi[162]=0,Yi[8]=Yi[162]=-1,Wi[8]=Wi[162]=1,Hi[8]=Hi[162]=1,Ji[8]=Ji[162]=0,Ki[8]=Ki[162]=1,$i[8]=$i[162]=1,Qi[8]=Qi[162]=0,to[8]=to[162]=0,qi[32]=qi[138]=0,Gi[32]=Gi[138]=1,Xi[32]=Xi[138]=1,Zi[32]=Zi[138]=0,Yi[32]=Yi[138]=1,Wi[32]=Wi[138]=0,zi[32]=zi[138]=1,Fi[32]=Fi[138]=0,Bi[32]=Bi[138]=0,Ui[32]=Ui[138]=1,ji[32]=ji[138]=0,Vi[32]=Vi[138]=1,io[128]=io[42]=0,oo[128]=oo[42]=1,ao[128]=ao[42]=1,eo[128]=eo[42]=0,ro[128]=ro[42]=1,no[128]=no[42]=0,zi[128]=zi[42]=-1,Fi[128]=Fi[42]=0,Bi[128]=Bi[42]=1,Ui[128]=Ui[42]=-1,ji[128]=ji[42]=0,Vi[128]=Vi[42]=0,Zi[5]=Zi[165]=-1,Yi[5]=Yi[165]=0,Wi[5]=Wi[165]=0,io[5]=io[165]=1,oo[5]=oo[165]=0,ao[5]=ao[165]=0,$i[20]=$i[150]=0,Qi[20]=Qi[150]=1,to[20]=to[150]=1,Ui[20]=Ui[150]=0,ji[20]=ji[150]=-1,Vi[20]=Vi[150]=1,qi[80]=qi[90]=-1,Gi[80]=Gi[90]=0,Xi[80]=Xi[90]=1,eo[80]=eo[90]=1,ro[80]=ro[90]=0,no[80]=no[90]=1,Hi[65]=Hi[105]=0,Ji[65]=Ji[105]=1,Ki[65]=Ki[105]=0,zi[65]=zi[105]=0,Fi[65]=Fi[105]=-1,Bi[65]=Bi[105]=0,qi[160]=qi[10]=-1,Gi[160]=Gi[10]=0,Xi[160]=Xi[10]=1,Zi[160]=Zi[10]=-1,Yi[160]=Yi[10]=0,Wi[160]=Wi[10]=0,io[160]=io[10]=1,oo[160]=oo[10]=0,ao[160]=ao[10]=0,eo[160]=eo[10]=1,ro[160]=ro[10]=0,no[160]=no[10]=1,$i[130]=$i[40]=0,Qi[130]=Qi[40]=1,to[130]=to[40]=1,Hi[130]=Hi[40]=0,Ji[130]=Ji[40]=1,Ki[130]=Ki[40]=0,zi[130]=zi[40]=0,Fi[130]=Fi[40]=-1,Bi[130]=Bi[40]=0,Ui[130]=Ui[40]=0,ji[130]=ji[40]=-1,Vi[130]=Vi[40]=1,Zi[37]=Zi[133]=0,Yi[37]=Yi[133]=1,Wi[37]=Wi[133]=1,io[37]=io[133]=0,oo[37]=oo[133]=1,ao[37]=ao[133]=0,zi[37]=zi[133]=-1,Fi[37]=Fi[133]=0,Bi[37]=Bi[133]=0,Ui[37]=Ui[133]=1,ji[37]=ji[133]=0,Vi[37]=Vi[133]=0,$i[148]=$i[22]=-1,Qi[148]=Qi[22]=0,to[148]=to[22]=0,io[148]=io[22]=0,oo[148]=oo[22]=-1,ao[148]=ao[22]=1,eo[148]=eo[22]=0,ro[148]=ro[22]=1,no[148]=no[22]=1,Ui[148]=Ui[22]=-1,ji[148]=ji[22]=0,Vi[148]=Vi[22]=1,qi[82]=qi[88]=0,Gi[82]=Gi[88]=-1,Xi[82]=Xi[88]=1,$i[82]=$i[88]=1,Qi[82]=Qi[88]=0,to[82]=to[88]=1,Hi[82]=Hi[88]=-1,Ji[82]=Ji[88]=0,Ki[82]=Ki[88]=1,eo[82]=eo[88]=0,ro[82]=ro[88]=-1,no[82]=no[88]=0,qi[73]=qi[97]=0,Gi[73]=Gi[97]=1,Xi[73]=Xi[97]=0,Zi[73]=Zi[97]=0,Yi[73]=Yi[97]=-1,Wi[73]=Wi[97]=0,Hi[73]=Hi[97]=1,Ji[73]=Ji[97]=0,Ki[73]=Ki[97]=0,zi[73]=zi[97]=1,Fi[73]=Fi[97]=0,Bi[73]=Bi[97]=1,qi[145]=qi[25]=0,Gi[145]=Gi[25]=-1,Xi[145]=Xi[25]=0,Hi[145]=Hi[25]=1,Ji[145]=Ji[25]=0,Ki[145]=Ki[25]=1,io[145]=io[25]=0,oo[145]=oo[25]=1,ao[145]=ao[25]=1,Ui[145]=Ui[25]=-1,ji[145]=ji[25]=0,Vi[145]=Vi[25]=0,Zi[70]=Zi[100]=0,Yi[70]=Yi[100]=1,Wi[70]=Wi[100]=0,$i[70]=$i[100]=-1,Qi[70]=Qi[100]=0,to[70]=to[100]=1,eo[70]=eo[100]=0,ro[70]=ro[100]=-1,no[70]=no[100]=1,zi[70]=zi[100]=1,Fi[70]=Fi[100]=0,Bi[70]=Bi[100]=0,Zi[101]=Zi[69]=0,Yi[101]=Yi[69]=1,Wi[101]=Wi[69]=0,zi[101]=zi[69]=1,Fi[101]=Fi[69]=0,Bi[101]=Bi[69]=0,io[149]=io[21]=0,oo[149]=oo[21]=1,ao[149]=ao[21]=1,Ui[149]=Ui[21]=-1,ji[149]=ji[21]=0,Vi[149]=Vi[21]=0,$i[86]=$i[84]=-1,Qi[86]=Qi[84]=0,to[86]=to[84]=1,eo[86]=eo[84]=0,ro[86]=ro[84]=-1,no[86]=no[84]=1,qi[89]=qi[81]=0,Gi[89]=Gi[81]=-1,Xi[89]=Xi[81]=0,Hi[89]=Hi[81]=1,Ji[89]=Ji[81]=0,Ki[89]=Ki[81]=1,qi[96]=qi[74]=0,Gi[96]=Gi[74]=1,Xi[96]=Xi[74]=0,Zi[96]=Zi[74]=-1,Yi[96]=Yi[74]=0,Wi[96]=Wi[74]=1,eo[96]=eo[74]=1,ro[96]=ro[74]=0,no[96]=no[74]=0,zi[96]=zi[74]=1,Fi[96]=Fi[74]=0,Bi[96]=Bi[74]=1,qi[24]=qi[146]=0,Gi[24]=Gi[146]=-1,Xi[24]=Xi[146]=1,$i[24]=$i[146]=1,Qi[24]=Qi[146]=0,to[24]=to[146]=1,Hi[24]=Hi[146]=0,Ji[24]=Ji[146]=1,Ki[24]=Ki[146]=1,Ui[24]=Ui[146]=0,ji[24]=ji[146]=-1,Vi[24]=Vi[146]=0,Zi[6]=Zi[164]=-1,Yi[6]=Yi[164]=0,Wi[6]=Wi[164]=1,$i[6]=$i[164]=-1,Qi[6]=Qi[164]=0,to[6]=to[164]=0,io[6]=io[164]=0,oo[6]=oo[164]=-1,ao[6]=ao[164]=1,eo[6]=eo[164]=1,ro[6]=ro[164]=0,no[6]=no[164]=0,Hi[129]=Hi[41]=0,Ji[129]=Ji[41]=1,Ki[129]=Ki[41]=1,io[129]=io[41]=0,oo[129]=oo[41]=1,ao[129]=ao[41]=0,zi[129]=zi[41]=-1,Fi[129]=Fi[41]=0,Bi[129]=Bi[41]=0,Ui[129]=Ui[41]=0,ji[129]=ji[41]=-1,Vi[129]=Vi[41]=0,$i[66]=$i[104]=0,Qi[66]=Qi[104]=1,to[66]=to[104]=0,Hi[66]=Hi[104]=-1,Ji[66]=Ji[104]=0,Ki[66]=Ki[104]=1,eo[66]=eo[104]=0,ro[66]=ro[104]=-1,no[66]=no[104]=0,zi[66]=zi[104]=0,Fi[66]=Fi[104]=-1,Bi[66]=Bi[104]=1,qi[144]=qi[26]=-1,Gi[144]=Gi[26]=0,Xi[144]=Xi[26]=0,io[144]=io[26]=1,oo[144]=oo[26]=0,ao[144]=ao[26]=1,eo[144]=eo[26]=0,ro[144]=ro[26]=1,no[144]=no[26]=1,Ui[144]=Ui[26]=-1,ji[144]=ji[26]=0,Vi[144]=Vi[26]=1,Zi[36]=Zi[134]=0,Yi[36]=Yi[134]=1,Wi[36]=Wi[134]=1,$i[36]=$i[134]=0,Qi[36]=Qi[134]=1,to[36]=to[134]=0,zi[36]=zi[134]=0,Fi[36]=Fi[134]=-1,Bi[36]=Bi[134]=1,Ui[36]=Ui[134]=1,ji[36]=ji[134]=0,Vi[36]=Vi[134]=0,qi[9]=qi[161]=-1,Gi[9]=Gi[161]=0,Xi[9]=Xi[161]=0,Zi[9]=Zi[161]=0,Yi[9]=Yi[161]=-1,Wi[9]=Wi[161]=0,Hi[9]=Hi[161]=1,Ji[9]=Ji[161]=0,Ki[9]=Ki[161]=0,io[9]=io[161]=1,oo[9]=oo[161]=0,ao[9]=ao[161]=1,qi[136]=0,Gi[136]=1,Xi[136]=1,Zi[136]=0,Yi[136]=1,Wi[136]=0,$i[136]=-1,Qi[136]=0,to[136]=1,Hi[136]=-1,Ji[136]=0,Ki[136]=0,io[136]=0,oo[136]=-1,ao[136]=0,eo[136]=0,ro[136]=-1,no[136]=1,zi[136]=1,Fi[136]=0,Bi[136]=0,Ui[136]=1,ji[136]=0,Vi[136]=1,qi[34]=0,Gi[34]=-1,Xi[34]=0,Zi[34]=0,Yi[34]=-1,Wi[34]=1,$i[34]=1,Qi[34]=0,to[34]=0,Hi[34]=1,Ji[34]=0,Ki[34]=1,io[34]=0,oo[34]=1,ao[34]=1,eo[34]=0,ro[34]=1,no[34]=0,zi[34]=-1,Fi[34]=0,Bi[34]=1,Ui[34]=-1,ji[34]=0,Vi[34]=0,qi[35]=0,Gi[35]=1,Xi[35]=1,Zi[35]=0,Yi[35]=-1,Wi[35]=1,$i[35]=1,Qi[35]=0,to[35]=0,Hi[35]=-1,Ji[35]=0,Ki[35]=0,io[35]=0,oo[35]=-1,ao[35]=0,eo[35]=0,ro[35]=1,no[35]=0,zi[35]=-1,Fi[35]=0,Bi[35]=1,Ui[35]=1,ji[35]=0,Vi[35]=1,qi[153]=0,Gi[153]=1,Xi[153]=1,Hi[153]=-1,Ji[153]=0,Ki[153]=0,io[153]=0,oo[153]=-1,ao[153]=0,Ui[153]=1,ji[153]=0,Vi[153]=1,Zi[102]=0,Yi[102]=-1,Wi[102]=1,$i[102]=1,Qi[102]=0,to[102]=0,eo[102]=0,ro[102]=1,no[102]=0,zi[102]=-1,Fi[102]=0,Bi[102]=1,qi[155]=0,Gi[155]=-1,Xi[155]=0,Hi[155]=1,Ji[155]=0,Ki[155]=1,io[155]=0,oo[155]=1,ao[155]=1,Ui[155]=-1,ji[155]=0,Vi[155]=0,Zi[103]=0,Yi[103]=1,Wi[103]=0,$i[103]=-1,Qi[103]=0,to[103]=1,eo[103]=0,ro[103]=-1,no[103]=1,zi[103]=1,Fi[103]=0,Bi[103]=0,qi[152]=0,Gi[152]=1,Xi[152]=1,$i[152]=-1,Qi[152]=0,to[152]=1,Hi[152]=-1,Ji[152]=0,Ki[152]=0,io[152]=0,oo[152]=-1,ao[152]=0,eo[152]=0,ro[152]=-1,no[152]=1,Ui[152]=1,ji[152]=0,Vi[152]=1,qi[156]=0,Gi[156]=-1,Xi[156]=1,$i[156]=1,Qi[156]=0,to[156]=1,Hi[156]=-1,Ji[156]=0,Ki[156]=0,io[156]=0,oo[156]=-1,ao[156]=0,eo[156]=0,ro[156]=1,no[156]=1,Ui[156]=-1,ji[156]=0,Vi[156]=1,qi[137]=0,Gi[137]=1,Xi[137]=1,Zi[137]=0,Yi[137]=1,Wi[137]=0,Hi[137]=-1,Ji[137]=0,Ki[137]=0,io[137]=0,oo[137]=-1,ao[137]=0,zi[137]=1,Fi[137]=0,Bi[137]=0,Ui[137]=1,ji[137]=0,Vi[137]=1,qi[139]=0,Gi[139]=1,Xi[139]=1,Zi[139]=0,Yi[139]=-1,Wi[139]=0,Hi[139]=1,Ji[139]=0,Ki[139]=0,io[139]=0,oo[139]=1,ao[139]=0,zi[139]=-1,Fi[139]=0,Bi[139]=0,Ui[139]=1,ji[139]=0,Vi[139]=1,qi[98]=0,Gi[98]=-1,Xi[98]=0,Zi[98]=0,Yi[98]=-1,Wi[98]=1,$i[98]=1,Qi[98]=0,to[98]=0,Hi[98]=1,Ji[98]=0,Ki[98]=1,eo[98]=0,ro[98]=1,no[98]=0,zi[98]=-1,Fi[98]=0,Bi[98]=1,qi[99]=0,Gi[99]=1,Xi[99]=0,Zi[99]=0,Yi[99]=-1,Wi[99]=1,$i[99]=1,Qi[99]=0,to[99]=0,Hi[99]=-1,Ji[99]=0,Ki[99]=1,eo[99]=0,ro[99]=-1,no[99]=0,zi[99]=1,Fi[99]=0,Bi[99]=1,Zi[38]=0,Yi[38]=-1,Wi[38]=1,$i[38]=1,Qi[38]=0,to[38]=0,io[38]=0,oo[38]=1,ao[38]=1,eo[38]=0,ro[38]=1,no[38]=0,zi[38]=-1,Fi[38]=0,Bi[38]=1,Ui[38]=-1,ji[38]=0,Vi[38]=0,Zi[39]=0,Yi[39]=1,Wi[39]=1,$i[39]=-1,Qi[39]=0,to[39]=0,io[39]=0,oo[39]=-1,ao[39]=1,eo[39]=0,ro[39]=1,no[39]=0,zi[39]=-1,Fi[39]=0,Bi[39]=1,Ui[39]=1,ji[39]=0,Vi[39]=0;var so=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},uo=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},lo=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},co=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},ho=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},po=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},fo=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},go=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},yo=[],mo=[],vo=[],_o=[],xo=[],bo=[],wo=[],Eo=[];_o[1]=xo[1]=18,_o[169]=xo[169]=18,vo[4]=mo[4]=12,vo[166]=mo[166]=12,yo[16]=Eo[16]=4,yo[154]=Eo[154]=4,bo[64]=wo[64]=22,bo[106]=wo[106]=22,vo[2]=bo[2]=17,_o[2]=xo[2]=18,vo[168]=bo[168]=17,_o[168]=xo[168]=18,yo[8]=_o[8]=9,mo[8]=vo[8]=12,yo[162]=_o[162]=9,mo[162]=vo[162]=12,yo[32]=Eo[32]=4,mo[32]=wo[32]=1,yo[138]=Eo[138]=4,mo[138]=wo[138]=1,xo[128]=Eo[128]=21,bo[128]=wo[128]=22,xo[42]=Eo[42]=21,bo[42]=wo[42]=22,mo[5]=xo[5]=14,mo[165]=xo[165]=14,vo[20]=Eo[20]=6,vo[150]=Eo[150]=6,yo[80]=bo[80]=11,yo[90]=bo[90]=11,_o[65]=wo[65]=3,_o[105]=wo[105]=3,yo[160]=bo[160]=11,mo[160]=xo[160]=14,yo[10]=bo[10]=11,mo[10]=xo[10]=14,vo[130]=Eo[130]=6,_o[130]=wo[130]=3,vo[40]=Eo[40]=6,_o[40]=wo[40]=3,mo[101]=wo[101]=1,mo[69]=wo[69]=1,xo[149]=Eo[149]=21,xo[21]=Eo[21]=21,vo[86]=bo[86]=17,vo[84]=bo[84]=17,yo[89]=_o[89]=9,yo[81]=_o[81]=9,yo[96]=wo[96]=0,mo[96]=bo[96]=15,yo[74]=wo[74]=0,mo[74]=bo[74]=15,yo[24]=vo[24]=8,_o[24]=Eo[24]=7,yo[146]=vo[146]=8,_o[146]=Eo[146]=7,mo[6]=bo[6]=15,vo[6]=xo[6]=16,mo[164]=bo[164]=15,vo[164]=xo[164]=16,_o[129]=Eo[129]=7,xo[129]=wo[129]=20,_o[41]=Eo[41]=7,xo[41]=wo[41]=20,vo[66]=wo[66]=2,_o[66]=bo[66]=19,vo[104]=wo[104]=2,_o[104]=bo[104]=19,yo[144]=xo[144]=10,bo[144]=Eo[144]=23,yo[26]=xo[26]=10,bo[26]=Eo[26]=23,mo[36]=Eo[36]=5,vo[36]=wo[36]=2,mo[134]=Eo[134]=5,vo[134]=wo[134]=2,yo[9]=xo[9]=10,mo[9]=_o[9]=13,yo[161]=xo[161]=10,mo[161]=_o[161]=13,mo[37]=Eo[37]=5,xo[37]=wo[37]=20,mo[133]=Eo[133]=5,xo[133]=wo[133]=20,vo[148]=xo[148]=16,bo[148]=Eo[148]=23,vo[22]=xo[22]=16,bo[22]=Eo[22]=23,yo[82]=vo[82]=8,_o[82]=bo[82]=19,yo[88]=vo[88]=8,_o[88]=bo[88]=19,yo[73]=wo[73]=0,mo[73]=_o[73]=13,yo[97]=wo[97]=0,mo[97]=_o[97]=13,yo[145]=_o[145]=9,xo[145]=Eo[145]=21,yo[25]=_o[25]=9,xo[25]=Eo[25]=21,mo[70]=wo[70]=1,vo[70]=bo[70]=17,mo[100]=wo[100]=1,vo[100]=bo[100]=17,yo[34]=_o[34]=9,mo[34]=vo[34]=12,xo[34]=Eo[34]=21,bo[34]=wo[34]=22,yo[136]=Eo[136]=4,mo[136]=wo[136]=1,vo[136]=bo[136]=17,_o[136]=xo[136]=18,yo[35]=Eo[35]=4,mo[35]=vo[35]=12,_o[35]=xo[35]=18,bo[35]=wo[35]=22,yo[153]=Eo[153]=4,_o[153]=xo[153]=18,mo[102]=vo[102]=12,bo[102]=wo[102]=22,yo[155]=_o[155]=9,xo[155]=Eo[155]=23,mo[103]=wo[103]=1,vo[103]=bo[103]=17,yo[152]=Eo[152]=4,vo[152]=bo[152]=17,_o[152]=xo[152]=18,yo[156]=vo[156]=8,_o[156]=xo[156]=18,bo[156]=Eo[156]=23,yo[137]=Eo[137]=4,mo[137]=wo[137]=1,_o[137]=xo[137]=18,yo[139]=Eo[139]=4,mo[139]=_o[139]=13,xo[139]=wo[139]=20,yo[98]=_o[98]=9,mo[98]=vo[98]=12,bo[98]=wo[98]=22,yo[99]=wo[99]=0,mo[99]=vo[99]=12,_o[99]=bo[99]=19,mo[38]=vo[38]=12,xo[38]=Eo[38]=21,bo[38]=wo[38]=22,mo[39]=Eo[39]=5,vo[39]=xo[39]=16,bo[39]=wo[39]=22;var Io=[];function So(t,e,r){return(t-e)/(r-e)}function Co(t){return t.constructor.toString().indexOf("Array")>-1}function Po(t,e,r,n,i,o){for(var a=t.cells[r][e],s=a.cval_real,u=e+n,l=r+i,c=[],h=!1;!h;){if(void 0===t.cells[l]||void 0===t.cells[l][u])if(l-=i,u-=n,s=(a=t.cells[l][u]).cval_real,-1===i)if(0===o)if(1&s)c.push([u,l]),n=-1,i=0,o=0;else{if(!(4&s)){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+1,l]),n=1,i=0,o=0}else{if(!(1&s)){if(4&s){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u+a.bottomleft,l]),n=0,i=1,o=0,h=!0;break}c.push([u,l]),n=-1,i=0,o=0}else if(1===i)if(0===o){if(!(s&Oi)){if(s&Ri){c.push([u+a.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+a.topright,l+1]),n=0,i=-1,o=1,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}else c.push([u+1,l+1]),n=1,i=0,o=1;else if(-1===n)if(0===o){if(!(s&Ri)){if(1&s){c.push([u,l+a.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+a.lefttop]),n=1,i=0,o=1,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}else{if(!(s&Ri)){console.log("MarchingSquaresJS-isoBands: wtf");break}c.push([u,l+1]),n=0,i=1,o=0}else{if(1!==n){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(0===o){if(!(4&s)){c.push([u+1,l+a.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}else{if(!(4&s)){if(s&Oi){c.push([u+1,l+a.righttop]),n=-1,i=0,o=1;break}c.push([u+1,l+a.rightbottom]),n=-1,i=0,o=0,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else if(s=(a=t.cells[l][u]).cval_real,-1===n)if(0===o)if(void 0!==t.cells[l-1]&&void 0!==t.cells[l-1][u])n=0,i=-1,o=1;else{if(!(1&s)){c.push([u+a.bottomright,l]),n=0,i=1,o=1,h=!0;break}c.push([u,l])}else{if(!(s&Ri)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(1===n){if(0===o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l+1]&&void 0!==t.cells[l+1][u])n=0,i=1,o=0;else{if(!(s&Oi)){c.push([u+a.topleft,l+1]),n=0,i=-1,o=0,h=!0;break}c.push([u+1,l+1]),n=1,i=0,o=1}}else if(-1===i){if(1!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u+1])n=1,i=0,o=1;else{if(!(4&s)){c.push([u+1,l+a.righttop]),n=-1,i=0,o=1,h=!0;break}c.push([u+1,l]),n=0,i=-1,o=1}}else{if(1!==i){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(0!==o){console.log("MarchingSquaresJS-isoBands: wtf");break}if(void 0!==t.cells[l][u-1])n=-1,i=0,o=0;else{if(!(s&Ri)){c.push([u,l+a.leftbottom]),n=1,i=0,o=0,h=!0;break}c.push([u,l+1]),n=0,i=1,o=0}}if(l+=i,(u+=n)===e&&l===r)break}return{path:c,i:u,j:l,x:n,y:i,o:o}}function Mo(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],r=t.cval_real;switch(e){case 0:return r&Oi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&r?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&r?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return r&Oi?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&r?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&r?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&r?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return r&Ri?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&r?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return r&Ri?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&r?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return r&Ri?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&r?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return r&Ri?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return r&Ri?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return r&Oi?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return r&Ri?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return r&Oi?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}function To(t,e,r,n){var i,o,a,s,u,l=t.cval;switch(e){case-1:if(0===n)i=mo[l],a=Zi[l],s=Yi[l],u=Wi[l];else i=yo[l],a=qi[l],s=Gi[l],u=Xi[l];break;case 1:if(0===n)i=xo[l],a=io[l],s=oo[l],u=ao[l];else i=bo[l],a=eo[l],s=ro[l],u=no[l];break;default:switch(r){case-1:if(0===n)i=wo[l],a=zi[l],s=Fi[l],u=Bi[l];else i=Eo[l],a=Ui[l],s=ji[l],u=Vi[l];break;case 1:if(0===n)i=_o[l],a=Hi[l],s=Ji[l],u=Ki[l];else i=vo[l],a=$i[l],s=Qi[l],u=to[l]}}if(o=t.edges.indexOf(i),void 0===t.edges[o])return null;switch(function(t,e){delete t.edges[e];for(var r=e+1;r0){var s=n[e-1],u=function(t,e){return!function(t,e){return 0===Fo(zo(t),zo(e))}(t,e)&&function(t,e){var r,n,i=t[0],o=zo(t),a=e[0],s=zo(e),u=Fo(o,s);return function(t,e){return[t[0]+e[0],t[1]+e[1]]}(i,function(t,e){return[t*e[0],t*e[1]]}(Fo((n=i,[(r=a)[0]-n[0],r[1]-n[1]]),s)/u,o))}(t,e)}(r,s);!1!==u&&(s[1]=u,r[0]=u),a.push(s[0]),e===o.length-2&&(a.push(r[0]),a.push(r[1]))}2===o.length&&(a.push(r[0]),a.push(r[1]))}var l,c,h,p,f,d})),h(a,t.properties)}function Uo(t,e,r){var n=e[0]-t[0],i=e[1]-t[1],o=r[0]-e[0];return function(t){return(t>0)-(t<0)||+t}(n*(r[1]-e[1])-o*i)}function jo(t,e){return e.geometry.coordinates[0].every((function(e){return fe(s(e),t)}))}Io[1]=Io[169]=so,Io[4]=Io[166]=uo,Io[16]=Io[154]=lo,Io[64]=Io[106]=co,Io[168]=Io[2]=ho,Io[162]=Io[8]=po,Io[138]=Io[32]=fo,Io[42]=Io[128]=go,Io[5]=Io[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Io[20]=Io[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Io[80]=Io[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Io[65]=Io[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[160]=Io[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Io[130]=Io[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Io[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Io[101]=Io[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Io[149]=Io[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Io[86]=Io[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Io[89]=Io[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Io[96]=Io[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[24]=Io[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Io[6]=Io[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Io[129]=Io[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Io[66]=Io[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[144]=Io[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[36]=Io[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Io[9]=Io[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Io[37]=Io[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[148]=Io[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[82]=Io[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Io[73]=Io[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Io[145]=Io[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[70]=Io[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[34]=function(t){return[go(t),po(t)]},Io[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Io[136]=function(t){return[fo(t),ho(t)]},Io[153]=function(t){return[lo(t),so(t)]},Io[102]=function(t){return[uo(t),co(t)]},Io[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Io[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[152]=function(t){return[lo(t),ho(t)]},Io[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Io[137]=function(t){return[fo(t),so(t)]},Io[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Io[98]=function(t){return[po(t),co(t)]},Io[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Io[38]=function(t){return[uo(t),go(t)]},Io[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var Vo=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(t){return t.join(",")},t.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))},t.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))},t.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,r){var n=e.to,i=r.to;if(n.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(n.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(n.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return n.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?n.coordinates[1]-i.coordinates[1]:i.coordinates[1]-n.coordinates[1];var o=Uo(t.coordinates,n.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(n.coordinates[0]-t.coordinates[0],2)+Math.pow(n.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},t.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},t}(),qo=function(){function t(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return h([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(t){return Uo(t.from.coordinates,t.to.coordinates,this.to.coordinates)},t}(),Go=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},t.prototype.get=function(t){return this.edges[t]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.edges.forEach(t)},t.prototype.map=function(t){return this.edges.map(t)},t.prototype.some=function(t){return this.edges.some(t)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var t=this,e=this.edges.reduce((function(e,r,n){return r.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=n),e}),0),r=(0===e?this.length:e)-1,n=(e+1)%this.length,i=Uo(this.edges[r].from.coordinates,this.edges[e].from.coordinates,this.edges[n].from.coordinates);return 0===i?this.edges[r].from.coordinates[0]>this.edges[n].from.coordinates[0]:i>0},t.prototype.toMultiPoint=function(){return g(this.edges.map((function(t){return t.from.coordinates})))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=l([t])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=sr(this.toPolygon())},t.findEdgeRingContaining=function(t,e){var r,n,i=t.getEnvelope();return e.forEach((function(e){var o,a,u,l,c,h,p=e.getEnvelope();if((n&&(r=n.getEnvelope()),a=i,u=(o=p).geometry.coordinates[0].map((function(t){return t[0]})),l=o.geometry.coordinates[0].map((function(t){return t[1]})),c=a.geometry.coordinates[0].map((function(t){return t[0]})),h=a.geometry.coordinates[0].map((function(t){return t[1]})),Math.max.apply(null,u)!==Math.max.apply(null,c)||Math.max.apply(null,l)!==Math.max.apply(null,h)||Math.min.apply(null,u)!==Math.min.apply(null,c)||Math.min.apply(null,l)!==Math.min.apply(null,h))&&jo(p,i)){for(var f=t.map((function(t){return t.from.coordinates})),d=void 0,g=function(t){e.some((function(e){return r=t,n=e.from.coordinates,r[0]===n[0]&&r[1]===n[1];var r,n}))||(d=t)},y=0,m=f;y=0;--o){var a=i[o],s=a.symetric,u=void 0,l=void 0;a.label===e&&(u=a),s.label===e&&(l=s),u&&l&&(l&&(n=l),u&&(n&&(n.next=u,n=void 0),r||(r=u)))}n&&(n.next=r)},t.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach((function(r){if(!(r.label>=0)){t.push(r);var n=r;do{n.label=e,n=n.next}while(!r.isEqual(n));e++}})),t},t.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(r){t._computeNextCCWEdges(r,e.label)}))}));var e=[];return this.edges.forEach((function(r){r.ring||e.push(t._findEdgeRing(r))})),e},t.prototype._findIntersectionNodes=function(t){var e=[],r=t,n=function(){var n=0;r.from.getOuterEdges().forEach((function(e){e.label===t.label&&++n})),n>1&&e.push(r.from),r=r.next};do{n()}while(!t.isEqual(r));return e},t.prototype._findEdgeRing=function(t){var e=t,r=new Go;do{r.push(e),e.ring=r,e=e.next}while(!t.isEqual(e));return r},t.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]},t.prototype.removeEdge=function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()},t}();function Zo(t,e){var r=!0;return j(t,(function(t){j(e,(function(e){if(!1===r)return!1;r=function(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return r=t.coordinates,n=e.coordinates,!(r[0]===n[0]&&r[1]===n[1]);case"LineString":return!Yo(e,t);case"Polygon":return!fe(t,e)}break;case"LineString":switch(e.type){case"Point":return!Yo(t,e);case"LineString":return!function(t,e){return dn(t,e).features.length>0}(t,e);case"Polygon":return!Wo(e,t)}break;case"Polygon":switch(e.type){case"Point":return!fe(e,t);case"LineString":return!Wo(t,e);case"Polygon":return!function(t,e){for(var r=0,n=t.coordinates[0];r0}(e,t)}}var r,n;return!1}(t.geometry,e.geometry)}))})),r}function Yo(t,e){for(var r=0;r0}function Ho(t,e,r){var n=r[0]-t[0],i=r[1]-t[1],o=e[0]-t[0],a=e[1]-t[1];return 0==n*a-i*o&&(Math.abs(o)>=Math.abs(a)?o>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:a>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1])}function Jo(t,e){return!(t[0]>e[0]||t[2]e[1]||t[3]0}function ea(t,e){for(var r=!1,n=!1,i=t.coordinates.length,o=0;o=Math.abs(s)?a>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:s>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]:Math.abs(a)>=Math.abs(s)?a>0?t[0]0?t[1]=0&&(r=[].concat(t.slice(n,t.length),t.slice(1,n+1))),r},na.prototype.comparePath=function(t,e){var r=this;return t.every((function(t,e){return r.compareCoord(t,this[e])}),e)},na.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var r=t.coordinates.slice(1,t.coordinates.length),n=e.coordinates.slice(1,e.coordinates.length),i=this;return r.every((function(t){return this.some((function(e){return i.compareLine(t,e,1,!0)}))}),n)}return!1},na.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},na.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},na.prototype.removePseudo=function(t){return t};var sa=na;function ua(t,e){var r=!1;return j(t,(function(t){j(e,(function(e){if(!0===r)return!0;r=!Zo(t.geometry,e.geometry)}))})),r}var la=Ft((function(t){function e(t,e,r,n){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(t,e,r,n)}e.prototype.run=function(t,e,r,n){this._init(t,e,r,n);for(var i=0;i=this.minPts&&(e=this._mergeArrays(e,i))}1!==this._assigned[n]&&this._addToCluster(n,t)}},e.prototype._addToCluster=function(t,e){this.clusters[e].push(t),this._assigned[t]=1},e.prototype._regionQuery=function(t){for(var e=[],r=0;r0){for(u=0;u=0);return t},e.prototype.assign=function(){for(var t,e=!1,r=this.dataset.length,n=0;ni&&(r=n):e=this.minPts)return r},r.prototype._regionQuery=function(t,e){e=e||this.epsilon;for(var r=[],n=0,i=this.dataset.length;n0,f=[];if(r)i="kmrand"==r?function(t,e){for(var r={},n=[],i=e<<2,o=t.length,a=t[0].length>0;n.length0;){var s=t[Math.floor(Math.random()*o)],u=a?s.join("_"):""+s;r[u]||(r[u]=!0,n.push(s))}if(n.length0,a=t[Math.floor(Math.random()*i)];o&&a.join("_");for(n.push(a);n.length0;){var u=a.pop();if(u===r)return wa(u);u.closed=!0;for(var l=t.neighbors(u),c=0,h=l.length;c0)){if(o/=p,p<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=n-u,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o0)){if(o/=f,f<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=i-l,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o0||h<1)||(c>0&&(t[0]=[u+c*p,l+c*f]),h<1&&(t[1]=[u+h*p,l+h*f]),!0)}}}}}function Ua(t,e,r,n,i){var o=t[1];if(o)return!0;var a,s,u=t[0],l=t.left,c=t.right,h=l[0],p=l[1],f=c[0],d=c[1],g=(h+f)/2,y=(p+d)/2;if(d===p){if(g=n)return;if(h>f){if(u){if(u[1]>=i)return}else u=[g,r];o=[g,i]}else{if(u){if(u[1]1)if(h>f){if(u){if(u[1]>=i)return}else u=[(r-s)/a,r];o=[(i-s)/a,i]}else{if(u){if(u[1]=n)return}else u=[e,a*e+s];o=[n,a*n+s]}else{if(u){if(u[0]0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)0;){var r=(t+1>>1)-1,n=this.content[r];if(!(this.scoreFunction(e)=-us)){var f=u*u+l*l,d=c*c+h*h,g=(h*f-l*d)/p,y=(u*d-c*f)/p,m=Xa.pop()||new Za;m.arc=t,m.site=i,m.x=g+a,m.y=(m.cy=y+s)+Math.sqrt(g*g+y*y),t.circle=m;for(var v=null,_=os._;_;)if(m.y<_.y||m.y===_.y&&m.x<=_.x){if(!_.L){v=_.P;break}_=_.L}else{if(!_.R){v=_;break}_=_.R}os.insert(v,m),v||(Ga=m)}}}}function Wa(t){var e=t.circle;e&&(e.P||(Ga=e.N),os.remove(e),Xa.push(e),ka(e),t.circle=null)}var Ha=[];function Ja(){ka(this),this.edge=this.site=this.circle=null}function Ka(t){var e=Ha.pop()||new Ja;return e.site=t,e}function $a(t){Wa(t),ns.remove(t),Ha.push(t),ka(t)}function Qa(t){var e=t.circle,r=e.x,n=e.cy,i=[r,n],o=t.P,a=t.N,s=[t];$a(t);for(var u=o;u.circle&&Math.abs(r-u.circle.x)ss)s=s.L;else{if(!((i=o-rs(s,a))>ss)){n>-ss?(e=s.P,r=s):i>-ss?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}!function(t){is[t.index]={site:t,halfedges:[]}}(t);var u=Ka(t);if(ns.insert(e,u),e||r){if(e===r)return Wa(e),r=Ka(e.site),ns.insert(u,r),u.edge=r.edge=Oa(e.site,u.site),Ya(e),void Ya(r);if(r){Wa(e),Wa(r);var l=e.site,c=l[0],h=l[1],p=t[0]-c,f=t[1]-h,d=r.site,g=d[0]-c,y=d[1]-h,m=2*(p*y-f*g),v=p*p+f*f,_=g*g+y*y,x=[(y*v-f*_)/m+c,(p*_-g*v)/m+h];Fa(r.edge,l,d,x),u.edge=Oa(l,t,null,x),r.edge=Oa(t,d,null,x),Ya(e),Ya(r)}else u.edge=Oa(e.site,u.site)}}function es(t,e){var r=t.site,n=r[0],i=r[1],o=i-e;if(!o)return n;var a=t.P;if(!a)return-1/0;var s=(r=a.site)[0],u=r[1],l=u-e;if(!l)return s;var c=s-n,h=1/o-1/l,p=c/l;return h?(-p+Math.sqrt(p*p-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+n:(n+s)/2}function rs(t,e){var r=t.N;if(r)return es(r,e);var n=t.site;return n[1]===e?n[0]:1/0}var ns,is,os,as,ss=1e-6,us=1e-12;function ls(t,e){return e[1]-t[1]||e[0]-t[0]}function cs(t,e){var r,n,i,o=t.sort(ls).pop();for(as=[],is=new Array(t.length),ns=new Aa,os=new Aa;;)if(i=Ga,o&&(!i||o[1]ss||Math.abs(i[0][1]-i[1][1])>ss)||delete as[o]}(a,s,u,l),function(t,e,r,n){var i,o,a,s,u,l,c,h,p,f,d,g,y=is.length,m=!0;for(i=0;iss||Math.abs(g-p)>ss)&&(u.splice(s,0,as.push(za(a,f,Math.abs(d-t)ss?[t,Math.abs(h-t)ss?[Math.abs(p-n)ss?[r,Math.abs(h-r)ss?[Math.abs(p-e)=-270&&(g=-g),d<-180&&d>=-360&&(y=-y),"degrees"===o){var m=g*Math.cos(h)+y*Math.sin(h),v=y*Math.cos(h)-g*Math.sin(h);g=m,y=v}p.push([g+c[0],y+c[1]])}return p.push(p[0]),"degrees"===o?l([p],u):Do(l([p],u),a,{pivot:s})}function fs(t){var e=t*Math.PI/180;return Math.tan(e)}function ds(t,e){void 0===e&&(e={});var r=0,n=0,i=0;return B(t,(function(t,o,a){var s=e.weight?null==a?void 0:a[e.weight]:void 0;if(!P(s=null==s?1:s))throw new Error("weight value must be a number for feature index "+o);(s=Number(s))>0&&k(t,(function(t){r+=t[0]*s,n+=t[1]*s,i+=s}))})),s([r/i,n/i],e.properties,e)}function gs(t,e,r,n,i){var o=n.tolerance||.001,a=0,u=0,l=0,c=0;if(O(r,(function(e){var r,n=null===(r=e.properties)||void 0===r?void 0:r.weight,i=null==n?1:n;if(!P(i=Number(i)))throw new Error("weight value must be a number");if(i>0){c+=1;var o=i*ye(e,t);0===o&&(o=1);var s=i/o;a+=e.geometry.coordinates[0]*s,u+=e.geometry.coordinates[1]*s,l+=s}})),c<1)throw new Error("no features to measure");var h=a/l,p=u/l;return 1===c||0===i||Math.abs(h-e[0])r&&(r=u,n=o,e.push([]));var l=o-n,c=t.coordinates[u][l+1],h=i[0],p=i[1],f=c[0],d=c[1];e[u].push([.75*h+.25*f,.75*p+.25*d]),e[u].push([.25*h+.75*f,.25*p+.75*d])}),!0),e.forEach((function(t){t.push(t[0])}))}function vs(t,e){var r=0,n=0,i=0;k(t,(function(o,a,s,u,l){u>i&&(i=u,n=a,e.push([[]])),l>r&&(r=l,n=a,e[u].push([]));var c=a-n,h=t.coordinates[u][l][c+1],p=o[0],f=o[1],d=h[0],g=h[1];e[u][l].push([.75*p+.25*d,.75*f+.25*g]),e[u][l].push([.25*p+.75*d,.25*f+.75*g])}),!0),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}function _s(t,e,r){void 0===r&&(r=2);var n=K(t),i=K(e),o=n[0]-i[0],a=n[1]-i[1];return 1===r?Math.abs(o)+Math.abs(a):Math.pow(Math.pow(o,r)+Math.pow(a,r),1/r)}function xs(t,e){var r=(e=e||{}).threshold||1e4,n=e.p||2,i=e.binary||!1,o=e.alpha||-1,a=e.standardization||!1,s=[];O(t,(function(t){s.push(fr(t))}));for(var u=[],l=0;l0?1:0}(t[0]))*e,r*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>n&&(i[0]=n),i[0]<-n&&(i[0]=-n),i[1]>n&&(i[1]=n),i[1]<-n&&(i[1]=-n),i}function Cs(t){var e=180/Math.PI,r=6378137;return[t[0]*e/r,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/r)))*e]}cs.prototype={constructor:cs,polygons:function(){var t=this.edges;return this.cells.map((function(e){var r=e.halfedges.map((function(r){return Va(e,t[r])}));return r.data=e.site.data,r}))},triangles:function(){var t=[],e=this.edges;return this.cells.forEach((function(r,n){if(o=(i=r.halfedges).length)for(var i,o,a,s,u,l,c=r.site,h=-1,p=e[i[o-1]],f=p.left===c?p.right:p.left;++h=s)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[n=a],a=null,i.halfedges.forEach((function(r){var n=o.edges[r],s=n.left;if(s!==i.site&&s||(s=n.right)){var u=t-s[0],l=e-s[1],h=u*u+l*l;h0?t+r[e-1]:t})),o.forEach((function(t){t=2*t*Math.PI/o[o.length-1];var r=Math.random();i.push([r*(e.max_radial_length||10)*Math.sin(t),r*(e.max_radial_length||10)*Math.cos(t)])})),i[i.length-1]=i[0],i=i.map((n=Ms(e.bbox),function(t){return[t[0]+n[0],t[1]+n[1]]})),r.push(l([i]))},i=0;ie?1:t0))break;if(null===e.right)break;if(r(t,e.right.key)>0){s=e.right;if(e.right=s.left,s.left=e,null===(e=s).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=n.right,e.right=n.left,e}function Zs(t,e,r,n){var i=new qs(t,e);if(null===r)return i.left=i.right=null,i;var o=n(t,(r=Xs(t,r,n)).key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function Ys(t,e,r){var n=null,i=null;if(e){var o=r((e=Xs(t,e,r)).key,t);0===o?(n=e.left,i=e.right):o<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function Ws(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&Ws(t.left,o,!1,n,i),t.right&&Ws(t.right,o,!0,n,i)}}var Hs=function(){function t(t){void 0===t&&(t=Gs),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=Zs(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new qs(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var n=this._comparator,i=Xs(t,this._root,n),o=n(t,i.key);return 0===o?this._root=i:(o<0?(r.left=i.left,r.right=i,i.left=null):o>0&&(r.right=i.right,r.left=i,i.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=Xs(t,e,r)).key)?(null===e.left?n=e.right:(n=Xs(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=Xs(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=Xs(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){for(var i=[],o=this._comparator,a=this._root;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(o((a=i.pop()).key,e)>0)break;if(o(a.key,t)>=0&&r.call(n,a))return this;a=a.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){for(var e=t,r=[],n=!1,i=new qs(null,null),o=i;!n;)e?(r.push(e),e=e.left):r.length>0?e=(e=o=o.next=r.pop()).right:n=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var n=t.length,i=this._comparator;if(r&&$s(t,e,0,n-1,i),null===this._root)this._root=Js(t,e,0,n),this._size=n;else{var o=function(t,e,r){for(var n=new qs(null,null),i=n,o=t,a=e;null!==o&&null!==a;)r(o.key,a.key)<0?(i.next=o,o=o.next):(i.next=a,a=a.next),i=i.next;null!==o?i.next=o:null!==a&&(i.next=a);return n.next}(this.toList(),function(t,e){for(var r=new qs(null,null),n=r,i=0;i0){var o=r+Math.floor(i/2),a=t[o],s=e[o],u=new qs(a,s);return u.left=Js(t,e,r,o),u.right=Js(t,e,o+1,n),u}return null}function Ks(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=Ks(t,e,i),a=t.head;return a.left=o,t.head=t.head.next,a.right=Ks(t,i+1,r),a}return null}function $s(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],a=r-1,s=n+1;;){do{a++}while(i(t[a],o)<0);do{s--}while(i(t[s],o)>0);if(a>=s)break;var u=t[a];t[a]=t[s],t[s]=u,u=e[a],e[a]=e[s],e[s]=u}$s(t,e,r,s,i),$s(t,e,s+1,n,i)}}function Qs(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tu(t,e){for(var r=0;re.x?1:t.ye.y?1:0}}]),eu(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,r=0,n=e.length;r=0&&u>=0?al?-1:0:o<0&&u<0?al?1:0:uo?1:0}}}]),t}(),vu=0,_u=function(){function t(e,r,n,i){Qs(this,t),this.id=++vu,this.leftSE=e,e.segment=this,e.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=e,this.rings=n,this.windings=i}return eu(t,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(oa&&s>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(r>n){if(as&&a>l)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var f=t.comparePoint(e.rightSE.point);return f<0?1:f>0?-1:1}if(as)return 1;if(io){var g=t.comparePoint(e.rightSE.point);if(g<0)return 1;if(g>0)return-1}if(i!==o){var y=u-a,m=i-r,v=l-s,_=o-n;if(y>m&&v<_)return 1;if(y_)return-1}return i>o?1:il?1:t.ide.id?1:0}}]),eu(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:te?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x0&&s.swapEvents(),mu.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,r=this.windings.length;e0){var o=r;r=n,n=o}if(r.prev===n){var a=r;r=n,n=a}for(var s=0,u=n.rings.length;s0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=r,o=e,a=-1}return new t(new mu(i,!0),new mu(o,!1),[n],[a])}}]),t}(),xu=function(){function t(e,r,n){if(Qs(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=r,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=lu.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,a=1,s=e.length;athis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(_u.fromRing(o,i,this))}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=r}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=r}return eu(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e0&&(t=n)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Iu=function(){function t(e){Qs(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return eu(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,r=this.interiorRings.length;e1&&void 0!==arguments[1]?arguments[1]:_u.compare;Qs(this,t),this.queue=e,this.tree=new Hs(r),this.segments=[]}return eu(t,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=n,o=n,a=void 0,s=void 0;void 0===a;)null===(i=this.tree.prev(i))?a=null:void 0===i.key.consumedBy&&(a=i.key);for(;void 0===s;)null===(o=this.tree.next(o))?s=null:void 0===o.key.consumedBy&&(s=o.key);if(t.isLeft){var u=null;if(a){var l=a.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!a.isAnEndpoint(l)))for(var c=this._splitSafely(a,l),h=0,p=c.length;h0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=a)}else{if(a&&s){var w=a.getIntersection(s);if(null!==w){if(!a.isAnEndpoint(w))for(var E=this._splitSafely(a,w),I=0,S=E.length;IPu)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var _=new Cu(f),x=f.size,b=f.pop();b;){var w=b.key;if(f.size===x){var E=w.segment;throw new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(E.id," ")+"[".concat(E.leftSE.point.x,", ").concat(E.leftSE.point.y,"] -> ")+"[".concat(E.rightSE.point.x,", ").concat(E.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(f.size>Pu)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(_.segments.length>Mu)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=_.process(w),S=0,C=I.length;S1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;n1?e-1:0),n=1;ne.x?1:this.ye.y?1:0},Bu.prototype.clone=function(){},Bu.prototype.copy=function(){return new Bu(this)},Bu.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},Bu.prototype.distance3D=function(t){var e=this.x-t.x,r=this.y-t.y,n=this.z-t.z;return Math.sqrt(e*e+r*r+n*n)},Bu.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},Bu.prototype.hashCode=function(){var t=17;return 37*(t=37*t+Bu.hashCode(this.x))+Bu.hashCode(this.y)},Bu.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},Bu.prototype.interfaces_=function(){return[Ru,Ou,Fu]},Bu.prototype.getClass=function(){return Bu},Bu.hashCode=function(){if(1===arguments.length){var t=Nu.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},Uu.DimensionalComparator.get=function(){return ju},Uu.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},Uu.NULL_ORDINATE.get=function(){return Nu.NaN},Uu.X.get=function(){return 0},Uu.Y.get=function(){return 1},Uu.Z.get=function(){return 2},Object.defineProperties(Bu,Uu);var ju=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new ku("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};ju.prototype.compare=function(t,e){var r=t,n=e,i=ju.compare(r.x,n.x);if(0!==i)return i;var o=ju.compare(r.y,n.y);return 0!==o?o:this._dimensionsToTest<=2?0:ju.compare(r.z,n.z)},ju.prototype.interfaces_=function(){return[zu]},ju.prototype.getClass=function(){return ju},ju.compare=function(t,e){return te?1:Nu.isNaN(t)?Nu.isNaN(e)?0:-1:Nu.isNaN(e)?1:0};var Vu=function(){};Vu.prototype.create=function(){},Vu.prototype.interfaces_=function(){return[]},Vu.prototype.getClass=function(){return Vu};var qu=function(){},Gu={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};qu.prototype.interfaces_=function(){return[]},qu.prototype.getClass=function(){return qu},qu.toLocationSymbol=function(t){switch(t){case qu.EXTERIOR:return"e";case qu.BOUNDARY:return"b";case qu.INTERIOR:return"i";case qu.NONE:return"-"}throw new ku("Unknown location value: "+t)},Gu.INTERIOR.get=function(){return 0},Gu.BOUNDARY.get=function(){return 1},Gu.EXTERIOR.get=function(){return 2},Gu.NONE.get=function(){return-1},Object.defineProperties(qu,Gu);var Xu=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Zu=function(){},Yu={LOG_10:{configurable:!0}};Zu.prototype.interfaces_=function(){return[]},Zu.prototype.getClass=function(){return Zu},Zu.log10=function(t){var e=Math.log(t);return Nu.isInfinite(e)||Nu.isNaN(e)?e:e/Zu.LOG_10},Zu.min=function(t,e,r,n){var i=t;return er?r:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var n=arguments[0],i=arguments[1],o=arguments[2];return no?o:n}},Zu.wrap=function(t,e){return t<0?e- -t%e:t%e},Zu.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[0];return t>r&&(r=t),e>r&&(r=e),r}if(4===arguments.length){var n=arguments[1],i=arguments[2],o=arguments[3],a=arguments[0];return n>a&&(a=n),i>a&&(a=i),o>a&&(a=o),a}},Zu.average=function(t,e){return(t+e)/2},Yu.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Zu,Yu);var Wu=function(t){this.str=t};Wu.prototype.append=function(t){this.str+=t},Wu.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},Wu.prototype.toString=function(t){return this.str};var Hu=function(t){this.value=t};Hu.prototype.intValue=function(){return this.value},Hu.prototype.compareTo=function(t){return this.valuet?1:0},Hu.isNaN=function(t){return Number.isNaN(t)};var Ju=function(){};Ju.isWhitespace=function(t){return t<=32&&t>=0||127===t},Ju.toUpperCase=function(t){return t.toUpperCase()};var Ku=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var r=arguments[0];this.init(r)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n,i)}},$u={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};Ku.prototype.le=function(t){return(this._hi9?(c=!0,h="9"):h="0"+l,a.append(h),r=r.subtract(Ku.valueOf(l)).multiply(Ku.TEN),c&&r.selfAdd(Ku.TEN);var p=!0,f=Ku.magnitude(r._hi);if(f<0&&Math.abs(f)>=s-u&&(p=!1),!p)break}return e[0]=n,a.toString()},Ku.prototype.sqr=function(){return this.multiply(this)},Ku.prototype.doubleValue=function(){return this._hi+this._lo},Ku.prototype.subtract=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},Ku.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},Ku.prototype.isZero=function(){return 0===this._hi&&0===this._lo},Ku.prototype.selfSubtract=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},Ku.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},Ku.prototype.min=function(t){return this.le(t)?this:t},Ku.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var r,n,i,o,a=arguments[0],s=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/a,h=(u=(c=Ku.SPLIT*i)-(u=c-i))*(l=(h=Ku.SPLIT*a)-(l=h-a))-(o=i*a)+u*(n=a-l)+(r=i-u)*l+r*n,h=i+(c=(this._hi-o-h+this._lo-i*s)/a),this._hi=h,this._lo=i-h+c,this}},Ku.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},Ku.prototype.divide=function(){if(arguments[0]instanceof Ku){var t,e,r,n,i=arguments[0],o=null,a=null,s=null,u=null;t=(r=this._hi/i._hi)-(o=(s=Ku.SPLIT*r)-(o=s-r)),u=o*(a=(u=Ku.SPLIT*i._hi)-(a=u-i._hi))-(n=r*i._hi)+o*(e=i._hi-a)+t*a+t*e;var l=u=r+(s=(this._hi-n-u+this._lo-r*i._lo)/i._hi);return new Ku(l,r-u+s)}if("number"==typeof arguments[0]){var c=arguments[0];return Nu.isNaN(c)?Ku.createNaN():Ku.copy(this).selfDivide(c,0)}},Ku.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},Ku.prototype.pow=function(t){if(0===t)return Ku.valueOf(1);var e=new Ku(this),r=Ku.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&r.selfMultiply(e),(n/=2)>0&&(e=e.sqr());else r=e;return t<0?r.reciprocal():r},Ku.prototype.ceil=function(){if(this.isNaN())return Ku.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new Ku(t,e)},Ku.prototype.compareTo=function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0},Ku.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},Ku.prototype.setValue=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},Ku.prototype.max=function(t){return this.ge(t)?this:t},Ku.prototype.sqrt=function(){if(this.isZero())return Ku.valueOf(0);if(this.isNegative())return Ku.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,r=Ku.valueOf(e),n=this.subtract(r.sqr())._hi*(.5*t);return r.add(n)},Ku.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,r,n,i,o,a=arguments[0],s=null;return s=(n=this._hi+a)-(i=n-this._hi),r=(o=(s=a-i+(this._hi-s))+this._lo)+(n-(e=n+o)),this._hi=e+r,this._lo=r+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,p=arguments[0],f=arguments[1],d=null,g=null,y=null;c=this._hi+p,l=this._lo+f,g=c-(y=c-this._hi),d=l-(h=l-this._lo);var m=(u=c+(y=(g=p-y+(this._hi-g))+l))+(y=(d=f-h+(this._lo-d))+(y+(c-u))),v=y+(u-m);return this._hi=m,this._lo=v,this}},Ku.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof Ku){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var r,n,i=arguments[0],o=arguments[1],a=null,s=null,u=null,l=null;a=(u=Ku.SPLIT*this._hi)-this._hi,l=Ku.SPLIT*i,a=u-a,r=this._hi-a,s=l-i;var c=(u=this._hi*i)+(l=a*(s=l-s)-u+a*(n=i-s)+r*s+r*n+(this._hi*o+this._lo*i)),h=l+(a=u-c);return this._hi=c,this._lo=h,this}},Ku.prototype.selfSqr=function(){return this.selfMultiply(this)},Ku.prototype.floor=function(){if(this.isNaN())return Ku.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new Ku(t,e)},Ku.prototype.negate=function(){return this.isNaN()?this:new Ku(-this._hi,-this._lo)},Ku.prototype.clone=function(){},Ku.prototype.multiply=function(){if(arguments[0]instanceof Ku){var t=arguments[0];return t.isNaN()?Ku.createNaN():Ku.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return Nu.isNaN(e)?Ku.createNaN():Ku.copy(this).selfMultiply(e,0)}},Ku.prototype.isNaN=function(){return Nu.isNaN(this._hi)},Ku.prototype.intValue=function(){return Math.trunc(this._hi)},Ku.prototype.toString=function(){var t=Ku.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},Ku.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!0,e),n=e[0]+1,i=r;if("."===r.charAt(0))i="0"+r;else if(n<0)i="0."+Ku.stringOfChar("0",-n)+r;else if(-1===r.indexOf(".")){var o=n-r.length;i=r+Ku.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},Ku.prototype.reciprocal=function(){var t,e,r,n,i=null,o=null,a=null,s=null;t=(r=1/this._hi)-(i=(a=Ku.SPLIT*r)-(i=a-r)),o=(s=Ku.SPLIT*this._hi)-this._hi;var u=r+(a=(1-(n=r*this._hi)-(s=i*(o=s-o)-n+i*(e=this._hi-o)+t*o+t*e)-r*this._lo)/this._hi);return new Ku(u,r-u+a)},Ku.prototype.toSciNotation=function(){if(this.isZero())return Ku.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),r=this.extractSignificantDigits(!1,e),n=Ku.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===r.charAt(0))throw new Error("Found leading zero: "+r);var i="";r.length>1&&(i=r.substring(1));var o=r.charAt(0)+"."+i;return this.isNegative()?"-"+o+n:o+n},Ku.prototype.abs=function(){return this.isNaN()?Ku.NaN:this.isNegative()?this.negate():new Ku(this)},Ku.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},Ku.prototype.lt=function(t){return(this._hit._hi||this._hi===t._hi)&&this._lo>t._lo},Ku.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},Ku.prototype.trunc=function(){return this.isNaN()?Ku.NaN:this.isPositive()?this.floor():this.ceil()},Ku.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},Ku.prototype.interfaces_=function(){return[Fu,Ru,Ou]},Ku.prototype.getClass=function(){return Ku},Ku.sqr=function(t){return Ku.valueOf(t).selfMultiply(t)},Ku.valueOf=function(){if("string"==typeof arguments[0]){return Ku.parse(arguments[0])}if("number"==typeof arguments[0]){return new Ku(arguments[0])}},Ku.sqrt=function(t){return Ku.valueOf(t).sqrt()},Ku.parse=function(t){for(var e=0,r=t.length;Ju.isWhitespace(t.charAt(e));)e++;var n=!1;if(e=r);){var l=t.charAt(e);if(e++,Ju.isDigit(l)){var c=l-"0";o.selfMultiply(Ku.TEN),o.selfAdd(c),a++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=Hu.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}s=a}}var p=o,f=a-s-u;if(0===f)p=o;else if(f>0){var d=Ku.TEN.pow(f);p=o.divide(d)}else if(f<0){var g=Ku.TEN.pow(-f);p=o.multiply(g)}return n?p.negate():p},Ku.createNaN=function(){return new Ku(Nu.NaN,Nu.NaN)},Ku.copy=function(t){return new Ku(t)},Ku.magnitude=function(t){var e=Math.abs(t),r=Math.log(e)/Math.log(10),n=Math.trunc(Math.floor(r));return 10*Math.pow(10,n)<=e&&(n+=1),n},Ku.stringOfChar=function(t,e){for(var r=new Wu,n=0;n0){if(o<=0)return Qu.signum(a);n=i+o}else{if(!(i<0))return Qu.signum(a);if(o>=0)return Qu.signum(a);n=-i-o}var s=Qu.DP_SAFE_EPSILON*n;return a>=s||-a>=s?Qu.signum(a):2},Qu.signum=function(t){return t>0?1:t<0?-1:0},tl.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Qu,tl);var el=function(){},rl={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};rl.X.get=function(){return 0},rl.Y.get=function(){return 1},rl.Z.get=function(){return 2},rl.M.get=function(){return 3},el.prototype.setOrdinate=function(t,e,r){},el.prototype.size=function(){},el.prototype.getOrdinate=function(t,e){},el.prototype.getCoordinate=function(){},el.prototype.getCoordinateCopy=function(t){},el.prototype.getDimension=function(){},el.prototype.getX=function(t){},el.prototype.clone=function(){},el.prototype.expandEnvelope=function(t){},el.prototype.copy=function(){},el.prototype.getY=function(t){},el.prototype.toCoordinateArray=function(){},el.prototype.interfaces_=function(){return[Ou]},el.prototype.getClass=function(){return el},Object.defineProperties(el,rl);var nl=function(){},il=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(nl),ol=function(){};ol.arraycopy=function(t,e,r,n,i){for(var o=0,a=e;at._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny,n=this._maxx=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&n>=this._miny&&n<=this._maxy}},sl.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof sl){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||rthis._maxy||nthis._maxx&&(this._maxx=e._maxx),e._minythis._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=n,this._maxy=n):(rthis._maxx&&(this._maxx=r),nthis._maxy&&(this._maxy=n))}},sl.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0},sl.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},sl.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},sl.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},sl.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},sl.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},sl.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=r,this._maxy+=r,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},sl.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof sl){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Bu){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];return this.covers(r,n)}},sl.prototype.centre=function(){return this.isNull()?null:new Bu((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},sl.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof sl){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.init(r.x,n.x,r.y,n.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];it._maxx&&(e=this._minx-t._maxx);var r=0;return this._maxyt._maxy&&(r=this._miny-t._maxy),0===e?r:0===r?e:Math.sqrt(e*e+r*r)},sl.prototype.hashCode=function(){var t=17;return 37*(t=37*(t=37*(t=37*t+Bu.hashCode(this._minx))+Bu.hashCode(this._maxx))+Bu.hashCode(this._miny))+Bu.hashCode(this._maxy)},sl.prototype.interfaces_=function(){return[Ru,Fu]},sl.prototype.getClass=function(){return sl},sl.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],r=arguments[2];return r.x>=(t.xe.x?t.x:e.x)&&r.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],a=arguments[3],s=Math.min(o.x,a.x),u=Math.max(o.x,a.x),l=Math.min(n.x,i.x),c=Math.max(n.x,i.x);return!(l>u||cu||cthis.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},ml.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},ml.prototype.setPrecisionModel=function(t){this._precisionModel=t},ml.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],r=0;ri?n:i;else{var a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);0!==(o=n>i?a:s)||t.equals(e)||(o=Math.max(a,s))}return yl.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},ml.nonRobustComputeEdgeDistance=function(t,e,r){var n=t.x-e.x,i=t.y-e.y,o=Math.sqrt(n*n+i*i);return yl.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},vl.DONT_INTERSECT.get=function(){return 0},vl.DO_INTERSECT.get=function(){return 1},vl.COLLINEAR.get=function(){return 2},vl.NO_INTERSECTION.get=function(){return 0},vl.POINT_INTERSECTION.get=function(){return 1},vl.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(ml,vl);var _l=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new sl(this._inputLines[0][0],this._inputLines[0][1]),r=new sl(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&r.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],r=arguments[1],n=arguments[2];if(this._isProper=!1,sl.intersects(r,n,e)&&0===wl.orientationIndex(r,n,e)&&0===wl.orientationIndex(n,r,e))return this._isProper=!0,(e.equals(r)||e.equals(n))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,r,n,i){i.x=this.smallestInAbsValue(t.x,e.x,r.x,n.x),i.y=this.smallestInAbsValue(t.y,e.y,r.y,n.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,r.x-=i.x,r.y-=i.y,n.x-=i.x,n.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,r,n,i){var o=null;try{o=al.intersection(t,r,n,i)}catch(a){if(!(a instanceof il))throw a;o=e.nearestEndpoint(t,r,n,i)}return o},e.prototype.intersection=function(t,r,n,i){var o=this.intersectionWithNormalization(t,r,n,i);return this.isInSegmentEnvelopes(o)||(o=new Bu(e.nearestEndpoint(t,r,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,r,n){var i=t,o=Math.abs(i);return Math.abs(e)1e-4&&ol.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,r,n){var i=new Bu(t),o=new Bu(e),a=new Bu(r),s=new Bu(n),u=new Bu;this.normalizeToEnvCentre(i,o,a,s,u);var l=this.safeHCoordinateIntersection(i,o,a,s);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,r,n,i){var o=sl.intersects(e,r,n),a=sl.intersects(e,r,i),s=sl.intersects(n,i,e),u=sl.intersects(n,i,r);return o&&a?(this._intPt[0]=n,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):s&&u?(this._intPt[0]=e,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):o&&s?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||a||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=n,this._intPt[1]=r,!n.equals(r)||a||s?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&s?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&u?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||o||s?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,r,n,i){var o=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=r.xn.x?r.x:n.x,p=r.y>n.y?r.y:n.y,f=((o>l?o:l)+(sc?a:c)+(u0&&a>0||o<0&&a<0)return t.NO_INTERSECTION;var s=wl.orientationIndex(n,i,e),u=wl.orientationIndex(n,i,r);return s>0&&u>0||s<0&&u<0?t.NO_INTERSECTION:0===o&&0===a&&0===s&&0===u?this.computeCollinearIntersection(e,r,n,i):(0===o||0===a||0===s||0===u?(this._isProper=!1,e.equals2D(n)||e.equals2D(i)?this._intPt[0]=e:r.equals2D(n)||r.equals2D(i)?this._intPt[0]=r:0===o?this._intPt[0]=new Bu(n):0===a?this._intPt[0]=new Bu(i):0===s?this._intPt[0]=new Bu(e):0===u&&(this._intPt[0]=new Bu(r))):(this._isProper=!0,this._intPt[0]=this.intersection(e,r,n,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,r,n){var i=t,o=wl.distancePointLine(t,r,n),a=wl.distancePointLine(e,r,n);return a0?r>0?-i:i:r>0?i:-i;if(0===e||0===r)return n>0?t>0?i:-i:t>0?-i:i;if(e>0?n>0?e<=n||(i=-i,o=t,t=r,r=o,o=e,e=n,n=o):e<=-n?(i=-i,r=-r,n=-n):(o=t,t=-r,r=o,o=e,e=-n,n=o):n>0?-e<=n?(i=-i,t=-t,e=-e):(o=-t,t=r,r=o,o=-e,e=n,n=o):e>=n?(t=-t,e=-e,r=-r,n=-n):(i=-i,o=-t,t=-r,r=o,o=-e,e=-n,n=o),t>0){if(!(r>0))return i;if(!(t<=r))return i}else{if(r>0)return-i;if(!(t>=r))return-i;i=-i,t=-t,r=-r}for(;;){if((n-=(a=Math.floor(r/t))*e)<0)return-i;if(n>e)return i;if(t>(r-=a*t)+r){if(en+n)return-i;r=t-r,n=e-n,i=-i}if(0===n)return 0===r?0:-i;if(0===r)return i;if((e-=(a=Math.floor(t/r))*n)<0)return i;if(e>n)return-i;if(r>(t-=a*r)+t){if(ne+e)return i;t=r-t,e=n-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var bl=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};bl.prototype.countSegment=function(t,e){if(t.xn&&(r=e.x,n=t.x),this._p.x>=r&&this._p.x<=n&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,a=e.x-this._p.x,s=e.y-this._p.y,u=xl.signOfDet2x2(i,o,a,s);if(0===u)return this._isPointOnSegment=!0,null;s0&&this._crossingCount++}},bl.prototype.isPointInPolygon=function(){return this.getLocation()!==qu.EXTERIOR},bl.prototype.getLocation=function(){return this._isPointOnSegment?qu.BOUNDARY:this._crossingCount%2==1?qu.INTERIOR:qu.EXTERIOR},bl.prototype.isOnSegment=function(){return this._isPointOnSegment},bl.prototype.interfaces_=function(){return[]},bl.prototype.getClass=function(){return bl},bl.locatePointInRing=function(){if(arguments[0]instanceof Bu&&Xu(arguments[1],el)){for(var t=arguments[1],e=new bl(arguments[0]),r=new Bu,n=new Bu,i=1;i1||s<0||s>1)&&(i=!0)}}else i=!0;return i?Zu.min(wl.distancePointLine(t,r,n),wl.distancePointLine(e,r,n),wl.distancePointLine(r,t,e),wl.distancePointLine(n,t,e)):0},wl.isPointInRing=function(t,e){return wl.locatePointInRing(t,e)!==qu.EXTERIOR},wl.computeLength=function(t){var e=t.size();if(e<=1)return 0;var r=0,n=new Bu;t.getCoordinate(0,n);for(var i=n.x,o=n.y,a=1;ar.y&&(r=o,n=i)}var a=n;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(r)&&a!==n);var s=n;do{s=(s+1)%e}while(t[s].equals2D(r)&&s!==n);var u=t[a],l=t[s];if(u.equals2D(r)||l.equals2D(r)||u.equals2D(l))return!1;var c=wl.computeOrientation(u,r,l);return 0===c?u.x>l.x:c>0},wl.locatePointInRing=function(t,e){return bl.locatePointInRing(t,e)},wl.distancePointLinePerpendicular=function(t,e,r){var n=(r.x-e.x)*(r.x-e.x)+(r.y-e.y)*(r.y-e.y),i=((e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)},wl.computeOrientation=function(t,e,r){return wl.orientationIndex(t,e,r)},wl.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new ku("Line array must contain at least one vertex");for(var r=t.distance(e[0]),n=0;n=1)return o.distance(s);var c=((a.y-o.y)*(s.x-a.x)-(a.x-o.x)*(s.y-a.y))/u;return Math.abs(c)*Math.sqrt(u)}},wl.isOnLine=function(t,e){for(var r=new _l,n=1;n0},kl.prototype.interfaces_=function(){return[Tl]},kl.prototype.getClass=function(){return kl};var Nl=function(){};Nl.prototype.isInBoundary=function(t){return t>1},Nl.prototype.interfaces_=function(){return[Tl]},Nl.prototype.getClass=function(){return Nl};var Dl=function(){};Dl.prototype.isInBoundary=function(t){return 1===t},Dl.prototype.interfaces_=function(){return[Tl]},Dl.prototype.getClass=function(){return Dl};var Rl=function(){};function Ol(t){this.message=t||""}Rl.prototype.add=function(){},Rl.prototype.addAll=function(){},Rl.prototype.isEmpty=function(){},Rl.prototype.iterator=function(){},Rl.prototype.size=function(){},Rl.prototype.toArray=function(){},Rl.prototype.remove=function(){},Ol.prototype=new Error,Ol.prototype.name="IndexOutOfBoundsException";var zl=function(){};zl.prototype.hasNext=function(){},zl.prototype.next=function(){},zl.prototype.remove=function(){};var Fl=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Rl);function Bl(t){this.message=t||""}Bl.prototype=new Error,Bl.prototype.name="NoSuchElementException";var Ul=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Rl&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Rl]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var r=this.array_[t];return this.array_[t]=e,r},e.prototype.iterator=function(){return new jl(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new Ol;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e=1){if(this.get(this.size()-1).equals2D(o))return null}t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var a=arguments[0],s=arguments[1];return this.add(a,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Bu){var p=arguments[0],f=arguments[1];if(!arguments[2]){var d=this.size();if(d>0){if(p>0){if(this.get(p-1).equals2D(f))return null}if(pv&&(_=-1);for(var x=m;x!==v;x+=_)e.add(g[x],y);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new Bu(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,r),e}(Ul),ql=function(){},Gl={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Gl.ForwardComparator.get=function(){return Xl},Gl.BidirectionalComparator.get=function(){return Zl},Gl.coordArrayType.get=function(){return new Array(0).fill(null)},ql.prototype.interfaces_=function(){return[]},ql.prototype.getClass=function(){return ql},ql.isRing=function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))},ql.ptNotInList=function(t,e){for(var r=0;r=t?e:[]},ql.indexOf=function(t,e){for(var r=0;r0)&&(e=t[r]);return e},ql.extract=function(t,e,r){e=Zu.clamp(e,0,t.length);var n=(r=Zu.clamp(r,-1,t.length))-e+1;r<0&&(n=0),e>=t.length&&(n=0),rn.length)return 1;if(0===r.length)return 0;var i=ql.compare(r,n);return ql.isEqualReversed(r,n)?0:i},Zl.prototype.OLDcompare=function(t,e){var r=t,n=e;if(r.lengthn.length)return 1;if(0===r.length)return 0;for(var i=ql.increasingDirection(r),o=ql.increasingDirection(n),a=i>0?0:r.length-1,s=o>0?0:r.length-1,u=0;u0))return e.value;e=e.right}}return null},ic.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,n,i=this.root_;do{if(r=i,(n=t.compareTo(i.key))<0)i=i.left;else{if(!(n>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var a={key:t,left:null,right:null,value:e,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return n<0?r.left=a:r.right=a,this.fixAfterInsertion(a),this.size_++,null},ic.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(tc(t)===rc(tc(tc(t)))){var r=nc(tc(tc(t)));1===Ql(r)?(ec(tc(t),0),ec(r,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===nc(tc(t))&&(t=tc(t),e.rotateLeft(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateRight(tc(tc(t))))}else{var n=rc(tc(tc(t)));1===Ql(n)?(ec(tc(t),0),ec(n,0),ec(tc(tc(t)),1),t=tc(tc(t))):(t===rc(tc(t))&&(t=tc(t),e.rotateRight(t)),ec(tc(t),0),ec(tc(tc(t)),1),e.rotateLeft(tc(tc(t))))}this.root_.color=0},ic.prototype.values=function(){var t=new Ul,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=ic.successor(e));)t.add(e.value);return t},ic.prototype.entrySet=function(){var t=new Kl,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=ic.successor(e));)t.add(e);return t},ic.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},ic.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},ic.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},ic.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var r=t.parent,n=t;null!==r&&n===r.right;)n=r,r=r.parent;return r},ic.prototype.size=function(){return this.size_};var oc=function(){};function ac(){}function sc(){this.array_=[],arguments[0]instanceof Rl&&this.addAll(arguments[0])}oc.prototype.interfaces_=function(){return[]},oc.prototype.getClass=function(){return oc},ac.prototype=new Jl,sc.prototype=new ac,sc.prototype.contains=function(t){for(var e=0,r=this.array_.length;e=0;){var a=i.substring(0,o);n.add(a),o=(i=i.substring(o+r)).indexOf(e)}i.length>0&&n.add(i);for(var s=new Array(n.size()).fill(null),u=0;u0)for(var o=i;o0&&n.append(" ");for(var o=0;o0&&n.append(","),n.append(Ic.toString(t.getOrdinate(i,o)))}return n.append(")"),n.toString()}},Cc.ensureValidRing=function(t,e){var r=e.size();return 0===r?e:r<=3?Cc.createClosedRing(t,e,4):e.getOrdinate(0,el.X)===e.getOrdinate(r-1,el.X)&&e.getOrdinate(0,el.Y)===e.getOrdinate(r-1,el.Y)?e:Cc.createClosedRing(t,e,r+1)},Cc.createClosedRing=function(t,e,r){var n=t.create(r,e.getDimension()),i=e.size();Cc.copy(e,0,n,0,i);for(var o=i;o0&&Cc.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?cc.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return wl.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return Cc.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,r=0;e= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.MINIMUM_VALID_SIZE.get=function(){return 4},r.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,r),e}(Pc),Dc=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return Sl.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],r=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,r)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),r=0;r0?e.createPoint(r[0]):e.createPoint():t},Fc.prototype.interfaces_=function(){return[Rc.GeometryEditorOperation]},Fc.prototype.getClass=function(){return Fc};var Bc=function(){};Bc.prototype.edit=function(t,e){return t instanceof Nc?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof Pc?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Tc?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Bc.prototype.interfaces_=function(){return[Rc.GeometryEditorOperation]},Bc.prototype.getClass=function(){return Bc};var Uc=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var r=0;r0){var t=new Wu(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(e=3),e<2?new Uc(t):new Uc(t,e)}},Vc.prototype.interfaces_=function(){return[Vu,Fu]},Vc.prototype.getClass=function(){return Vc},Vc.instance=function(){return Vc.instanceObject},qc.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},qc.instanceObject.get=function(){return new Vc},Object.defineProperties(Vc,qc);var Gc=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new Ul,e=this.map_.values(),r=e.next();!r.done;)t.add(r.value),r=e.next();return t},e.prototype.entrySet=function(){var t=new Kl;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(Yl),Xc=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Yc){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var r=arguments[0];this._modelType=t.FIXED,this.setScale(r)}else if(arguments[0]instanceof t){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}},Zc={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Xc.prototype.equals=function(t){if(!(t instanceof Xc))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Xc.prototype.compareTo=function(t){var e=t,r=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return new Hu(r).compareTo(new Hu(n))},Xc.prototype.getScale=function(){return this._scale},Xc.prototype.isFloating=function(){return this._modelType===Xc.FLOATING||this._modelType===Xc.FLOATING_SINGLE},Xc.prototype.getType=function(){return this._modelType},Xc.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Xc.FLOATING?t="Floating":this._modelType===Xc.FLOATING_SINGLE?t="Floating-Single":this._modelType===Xc.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Xc.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return Nu.isNaN(t)||this._modelType===Xc.FLOATING_SINGLE?t:this._modelType===Xc.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof Bu){var e=arguments[0];if(this._modelType===Xc.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Xc.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Xc.FLOATING?t=16:this._modelType===Xc.FLOATING_SINGLE?t=6:this._modelType===Xc.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Xc.prototype.setScale=function(t){this._scale=Math.abs(t)},Xc.prototype.interfaces_=function(){return[Fu,Ru]},Xc.prototype.getClass=function(){return Xc},Xc.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Zc.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},Zc.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Xc,Zc);var Yc=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Wc={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Yc.prototype.readResolve=function(){return Yc.nameToTypeMap.get(this._name)},Yc.prototype.toString=function(){return this._name},Yc.prototype.interfaces_=function(){return[Fu]},Yc.prototype.getClass=function(){return Yc},Wc.serialVersionUID.get=function(){return-552860263173159e4},Wc.nameToTypeMap.get=function(){return new Gc},Object.defineProperties(Yc,Wc),Xc.Type=Yc,Xc.FIXED=new Yc("FIXED"),Xc.FLOATING=new Yc("FLOATING"),Xc.FLOATING_SINGLE=new Yc("FLOATING SINGLE");var Hc=function t(){this._precisionModel=new Xc,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?Xu(arguments[0],Vu)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Xc&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},Jc={serialVersionUID:{configurable:!0}};Hc.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new Bu(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new Bu(t.getMinX(),t.getMinY()),new Bu(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new Bu(t.getMinX(),t.getMinY()),new Bu(t.getMinX(),t.getMaxY()),new Bu(t.getMaxX(),t.getMaxY()),new Bu(t.getMaxX(),t.getMinY()),new Bu(t.getMinX(),t.getMinY())]),null)},Hc.prototype.createLineString=function(t){return t?t instanceof Array?new Pc(this.getCoordinateSequenceFactory().create(t),this):Xu(t,el)?new Pc(t,this):void 0:new Pc(this.getCoordinateSequenceFactory().create([]),this)},Hc.prototype.createMultiLineString=function(){if(0===arguments.length)return new gc(null,this);if(1===arguments.length){return new gc(arguments[0],this)}},Hc.prototype.buildGeometry=function(t){for(var e=null,r=!1,n=!1,i=t.iterator();i.hasNext();){var o=i.next(),a=o.getClass();null===e&&(e=a),a!==e&&(r=!0),o.isGeometryCollectionOrDerived()&&(n=!0)}if(null===e)return this.createGeometryCollection();if(r||n)return this.createGeometryCollection(Hc.toGeometryArray(t));var s=t.iterator().next();if(t.size()>1){if(s instanceof Ac)return this.createMultiPolygon(Hc.toPolygonArray(t));if(s instanceof Pc)return this.createMultiLineString(Hc.toLineStringArray(t));if(s instanceof Tc)return this.createMultiPoint(Hc.toPointArray(t));yl.shouldNeverReachHere("Unhandled class: "+s.getClass().getName())}return s},Hc.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},Hc.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Bu){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(Xu(arguments[0],el)){return new Tc(arguments[0],this)}}},Hc.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Hc.prototype.createPolygon=function(){if(0===arguments.length)return new Ac(null,null,this);if(1===arguments.length){if(Xu(arguments[0],el)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Nc){var r=arguments[0];return this.createPolygon(r,null)}}else if(2===arguments.length){return new Ac(arguments[0],arguments[1],this)}},Hc.prototype.getSRID=function(){return this._SRID},Hc.prototype.createGeometryCollection=function(){if(0===arguments.length)return new dc(null,this);if(1===arguments.length){return new dc(arguments[0],this)}},Hc.prototype.createGeometry=function(t){return new Rc(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},Hc.prototype.getPrecisionModel=function(){return this._precisionModel},Hc.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Xu(arguments[0],el)){return new Nc(arguments[0],this)}}},Hc.prototype.createMultiPolygon=function(){if(0===arguments.length)return new Dc(null,this);if(1===arguments.length){return new Dc(arguments[0],this)}},Hc.prototype.createMultiPoint=function(){if(0===arguments.length)return new kc(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){return new kc(arguments[0],this)}if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(Xu(arguments[0],el)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(e.size()).fill(null),n=0;n=this.size())throw new Error;return this.array_[t]},ah.prototype.push=function(t){return this.array_.push(t),t},ah.prototype.pop=function(t){if(0===this.array_.length)throw new oh;return this.array_.pop()},ah.prototype.peek=function(){if(0===this.array_.length)throw new oh;return this.array_[this.array_.length-1]},ah.prototype.empty=function(){return 0===this.array_.length},ah.prototype.isEmpty=function(){return this.empty()},ah.prototype.search=function(t){return this.array_.indexOf(t)},ah.prototype.size=function(){return this.array_.length},ah.prototype.toArray=function(){for(var t=[],e=0,r=this.array_.length;e0&&this._minIndexthis._minCoord.y&&r.y>this._minCoord.y&&n===wl.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},sh.prototype.getRightmostSideOfSegment=function(t,e){var r=t.getEdge().getCoordinates();if(e<0||e+1>=r.length)return-1;if(r[e].y===r[e+1].y)return-1;var n=nh.LEFT;return r[e].ye._minCoord.x)&&(e._minDe=t,e._minIndex=n,e._minCoord=r[n])},sh.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},sh.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var r=e.next();r.isForward()&&this.checkForRightmostCoordinate(r)}yl.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===nh.LEFT&&(this._orientedDe=this._minDe.getSym())},sh.prototype.interfaces_=function(){return[]},sh.prototype.getClass=function(){return sh};var uh=function(t){function e(r,n){t.call(this,e.msgWithCoord(r,n)),this.pt=n?new Bu(n):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(dl),lh=function(){this.array_=[]};lh.prototype.addLast=function(t){this.array_.push(t)},lh.prototype.removeFirst=function(){return this.array_.shift()},lh.prototype.isEmpty=function(){return 0===this.array_.length};var ch=function(){this._finder=null,this._dirEdgeList=new Ul,this._nodes=new Ul,this._rightMostCoord=null,this._env=null,this._finder=new sh};ch.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},ch.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ch.prototype.computeNodeDepth=function(t){for(var e=null,r=t.getEdges().iterator();r.hasNext();){var n=r.next();if(n.isVisited()||n.getSym().isVisited()){e=n;break}}if(null===e)throw new uh("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},ch.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(nh.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},ch.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ch.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(nh.RIGHT)>=1&&e.getDepth(nh.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},ch.prototype.computeDepths=function(t){var e=new Kl,r=new lh,n=t.getNode();for(r.addLast(n),e.add(n),t.setVisited(!0);!r.isEmpty();){var i=r.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var a=o.next().getSym();if(!a.isVisited()){var s=a.getNode();e.contains(s)||(r.addLast(s),e.add(s))}}}},ch.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},ch.prototype.getEnvelope=function(){if(null===this._env){for(var t=new sl,e=this._dirEdgeList.iterator();e.hasNext();)for(var r=e.next().getEdge().getCoordinates(),n=0;nthis.location.length){var e=new Array(3).fill(null);e[nh.ON]=this.location[nh.ON],e[nh.LEFT]=qu.NONE,e[nh.RIGHT]=qu.NONE,this.location=e}for(var r=0;r1&&t.append(qu.toLocationSymbol(this.location[nh.LEFT])),t.append(qu.toLocationSymbol(this.location[nh.ON])),this.location.length>1&&t.append(qu.toLocationSymbol(this.location[nh.RIGHT])),t.toString()},hh.prototype.setLocations=function(t,e,r){this.location[nh.ON]=t,this.location[nh.LEFT]=e,this.location[nh.RIGHT]=r},hh.prototype.get=function(t){return t1},hh.prototype.isAnyNull=function(){for(var t=0;tt._maxNodeDegree&&(t._maxNodeDegree=r),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},fh.prototype.addPoints=function(t,e,r){var n=t.getCoordinates();if(e){var i=1;r&&(i=0);for(var o=i;o=0;s--)this._pts.add(n[s])}},fh.prototype.isHole=function(){return this._isHole},fh.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},fh.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!wl.isPointInRing(t,e.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(t))return!1;return!0},fh.prototype.addHole=function(t){this._holes.add(t)},fh.prototype.isShell=function(){return null===this._shell},fh.prototype.getLabel=function(){return this._label},fh.prototype.getEdges=function(){return this._edges},fh.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},fh.prototype.getShell=function(){return this._shell},fh.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],r=arguments[0].getLocation(e,nh.RIGHT);if(r===qu.NONE)return null;if(this._label.getLocation(e)===qu.NONE)return this._label.setLocation(e,r),null}},fh.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},fh.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),r=0;r=2,"found partial label"),this.computeIM(t)},yh.prototype.isInResult=function(){return this._isInResult},yh.prototype.isVisited=function(){return this._isVisited},yh.prototype.interfaces_=function(){return[]},yh.prototype.getClass=function(){return yh};var mh=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],r=arguments[1];this._coord=e,this._edges=r,this._label=new ph(0,qu.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var r=qu.NONE;if(r=this._label.getLocation(e),!t.isNull(e)){var n=t.getLocation(e);r!==qu.BOUNDARY&&(r=n)}return r},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],r=arguments[1];null===this._label?this._label=new ph(e,r):this._label.setLocation(e,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof ph)for(var n=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(n,i);t._label.getLocation(i)===qu.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=qu.NONE;null!==this._label&&(e=this._label.getLocation(t));var r=null;if(e===qu.BOUNDARY)r=qu.INTERIOR;else r=qu.BOUNDARY;this._label.setLocation(t,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(yh),vh=function(){this.nodeMap=new ic,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};vh.prototype.find=function(t){return this.nodeMap.get(t)},vh.prototype.addNode=function(){if(arguments[0]instanceof Bu){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof mh){var r=arguments[0],n=this.nodeMap.get(r.getCoordinate());return null===n?(this.nodeMap.put(r.getCoordinate(),r),r):(n.mergeLabel(r),n)}},vh.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},vh.prototype.iterator=function(){return this.nodeMap.values().iterator()},vh.prototype.values=function(){return this.nodeMap.values()},vh.prototype.getBoundaryNodes=function(t){for(var e=new Ul,r=this.iterator();r.hasNext();){var n=r.next();n.getLabel().getLocation(t)===qu.BOUNDARY&&e.add(n)}return e},vh.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},vh.prototype.interfaces_=function(){return[]},vh.prototype.getClass=function(){return vh};var _h=function(){},xh={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};_h.prototype.interfaces_=function(){return[]},_h.prototype.getClass=function(){return _h},_h.isNorthern=function(t){return t===_h.NE||t===_h.NW},_h.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},_h.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var r=te?t:e)?3:r},_h.isInHalfPlane=function(t,e){return e===_h.SE?t===_h.SE||t===_h.SW:t===e||t===e+1},_h.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new ku("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?_h.NE:_h.SE:e>=0?_h.NW:_h.SW}if(arguments[0]instanceof Bu&&arguments[1]instanceof Bu){var r=arguments[0],n=arguments[1];if(n.x===r.x&&n.y===r.y)throw new ku("Cannot compute the quadrant for two identical points "+r);return n.x>=r.x?n.y>=r.y?_h.NE:_h.SE:n.y>=r.y?_h.NW:_h.SW}},xh.NE.get=function(){return 0},xh.NW.get=function(){return 1},xh.SW.get=function(){return 2},xh.SE.get=function(){return 3},Object.defineProperties(_h,xh);var bh=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._edge=e,this.init(r,n),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];this._edge=i,this.init(o,a),this._label=s}};bh.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var a=o.buildMinimalRings(),s=this.findShell(a);null!==s?(this.placePolygonHoles(s,a),e.add(s)):r.addAll(a)}else n.add(o)}return n},Sh.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},Sh.prototype.buildMaximalEdgeRings=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next();if(n.isInResult()&&n.getLabel().isArea()&&null===n.getEdgeRing()){var i=new gh(n,this._geometryFactory);e.add(i),i.setInResult()}}return e},Sh.prototype.placePolygonHoles=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next();n.isHole()&&n.setShell(t)}},Sh.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Sh.prototype.findEdgeRingContaining=function(t,e){for(var r=t.getLinearRing(),n=r.getEnvelopeInternal(),i=r.getCoordinateN(0),o=null,a=null,s=e.iterator();s.hasNext();){var u=s.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(a=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(n)&&wl.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||a.contains(c))&&(o=u)}return o},Sh.prototype.findShell=function(t){for(var e=0,r=null,n=t.iterator();n.hasNext();){var i=n.next();i.isHole()||(r=i,e++)}return yl.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),r},Sh.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];Ih.linkResultDirectedEdges(arguments[1]);var r=this.buildMaximalEdgeRings(e),n=new Ul,i=this.buildMinimalEdgeRings(r,this._shellList,n);this.sortShellsAndHoles(i,this._shellList,n),this.placeFreeHoles(this._shellList,n)}},Sh.prototype.interfaces_=function(){return[]},Sh.prototype.getClass=function(){return Sh};var Ch=function(){};Ch.prototype.getBounds=function(){},Ch.prototype.interfaces_=function(){return[]},Ch.prototype.getClass=function(){return Ch};var Ph=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Ph.prototype.getItem=function(){return this._item},Ph.prototype.getBounds=function(){return this._bounds},Ph.prototype.interfaces_=function(){return[Ch,Fu]},Ph.prototype.getClass=function(){return Ph};var Mh=function(){this._size=null,this._items=null,this._size=0,this._items=new Ul,this._items.add(null)};Mh.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Mh.prototype.size=function(){return this._size},Mh.prototype.reorder=function(t){for(var e=this,r=null,n=this._items.get(t);2*t<=this._size&&((r=2*t)!==e._size&&e._items.get(r+1).compareTo(e._items.get(r))<0&&r++,e._items.get(r).compareTo(n)<0);t=r)e._items.set(t,e._items.get(r));this._items.set(t,n)},Mh.prototype.clear=function(){this._size=0,this._items.clear()},Mh.prototype.isEmpty=function(){return 0===this._size},Mh.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Mh.prototype.interfaces_=function(){return[]},Mh.prototype.getClass=function(){return Mh};var Th=function(){};Th.prototype.visitItem=function(t){},Th.prototype.interfaces_=function(){return[]},Th.prototype.getClass=function(){return Th};var Lh=function(){};Lh.prototype.insert=function(t,e){},Lh.prototype.remove=function(t,e){},Lh.prototype.query=function(){},Lh.prototype.interfaces_=function(){return[]},Lh.prototype.getClass=function(){return Lh};var Ah=function(){if(this._childBoundables=new Ul,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},kh={serialVersionUID:{configurable:!0}};Ah.prototype.getLevel=function(){return this._level},Ah.prototype.size=function(){return this._childBoundables.size()},Ah.prototype.getChildBoundables=function(){return this._childBoundables},Ah.prototype.addChildBoundable=function(t){yl.isTrue(null===this._bounds),this._childBoundables.add(t)},Ah.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ah.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},Ah.prototype.interfaces_=function(){return[Ch,Fu]},Ah.prototype.getClass=function(){return Ah},kh.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(Ah,kh);var Nh=function(){};Nh.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Nh.min=function(t){return Nh.sort(t),t.get(0)},Nh.sort=function(t,e){var r=t.toArray();e?lc.sort(r,e):lc.sort(r);for(var n=t.iterator(),i=0,o=r.length;iDh.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(r)return this.expand(this._boundable1,this._boundable2,t,e),null;if(n)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new ku("neither boundable is composite")},Dh.prototype.isLeaves=function(){return!(Dh.isComposite(this._boundable1)||Dh.isComposite(this._boundable2))},Dh.prototype.compareTo=function(t){var e=t;return this._distancee._distance?1:0},Dh.prototype.expand=function(t,e,r,n){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),a=new Dh(o,e,this._itemDistance);a.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=r}},Oh={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Rh.prototype.getNodeCapacity=function(){return this._nodeCapacity},Rh.prototype.lastNode=function(t){return t.get(t.size()-1)},Rh.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var r=e.next();r instanceof Ah?t+=this.size(r):r instanceof Ph&&(t+=1)}return t}},Rh.prototype.removeItem=function(t,e){for(var r=null,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Ph&&i.getItem()===e&&(r=i)}return null!==r&&(t.getChildBoundables().remove(r),!0)},Rh.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new Ul:t}if(1===arguments.length){for(var e=arguments[0],r=new Ul,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Ah){var o=this.itemsTree(i);null!==o&&r.add(o)}else i instanceof Ph?r.add(i.getItem()):yl.shouldNeverReachHere()}return r.size()<=0?null:r}},Rh.prototype.insert=function(t,e){yl.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Ph(t,e))},Rh.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new Ul;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];if(yl.isTrue(r>-2),n.getLevel()===r)return i.add(n),null;for(var o=n.getChildBoundables().iterator();o.hasNext();){var a=o.next();a instanceof Ah?this.boundablesAtLevel(r,a,i):(yl.isTrue(a instanceof Ph),-1===r&&i.add(a))}return null}},Rh.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var r=new Ul;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,r),r}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i)}else if(3===arguments.length)if(Xu(arguments[2],Th)&&arguments[0]instanceof Object&&arguments[1]instanceof Ah)for(var o=arguments[0],a=arguments[2],s=arguments[1].getChildBoundables(),u=0;ut&&(t=n)}}return t+1}},Rh.prototype.createParentBoundables=function(t,e){var r=this;yl.isTrue(!t.isEmpty());var n=new Ul;n.add(this.createNode(e));var i=new Ul(t);Nh.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var a=o.next();r.lastNode(n).getChildBoundables().size()===r.getNodeCapacity()&&n.add(r.createNode(e)),r.lastNode(n).addChildBoundable(a)}return n},Rh.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Rh.prototype.interfaces_=function(){return[Fu]},Rh.prototype.getClass=function(){return Rh},Rh.compareDoubles=function(t,e){return t>e?1:t0);for(var r=new Ul,n=0;n0;){var h=c.poll(),p=h.getDistance();if(p>=u)break;h.isLeaves()?(u=p,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var f=arguments[2],d=new Ph(arguments[0],arguments[1]),g=new Dh(this.getRoot(),d,f);return this.nearestNeighbour(g)[0]}},e.prototype.interfaces_=function(){return[Lh,Fu]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},r.STRtreeNode.get=function(){return Uh},r.serialVersionUID.get=function(){return 0x39920f7d5f261e0},r.xComparator.get=function(){return{interfaces_:function(){return[zu]},compare:function(r,n){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(n.getBounds()))}}},r.yComparator.get=function(){return{interfaces_:function(){return[zu]},compare:function(r,n){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(n.getBounds()))}}},r.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},r.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,r),e}(Rh),Uh=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var r=e.next();null===t?t=new sl(r.getBounds()):t.expandToInclude(r.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ah),jh=function(){};jh.prototype.interfaces_=function(){return[]},jh.prototype.getClass=function(){return jh},jh.relativeSign=function(t,e){return te?1:0},jh.compare=function(t,e,r){if(e.equals2D(r))return 0;var n=jh.relativeSign(e.x,r.x),i=jh.relativeSign(e.y,r.y);switch(t){case 0:return jh.compareValue(n,i);case 1:return jh.compareValue(i,n);case 2:return jh.compareValue(i,-n);case 3:return jh.compareValue(-n,i);case 4:return jh.compareValue(-n,-i);case 5:return jh.compareValue(-i,-n);case 6:return jh.compareValue(-i,n);case 7:return jh.compareValue(n,-i)}return yl.shouldNeverReachHere("invalid octant value"),0},jh.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var Vh=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._segString=t,this.coord=new Bu(e),this.segmentIndex=r,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(r))};Vh.prototype.getCoordinate=function(){return this.coord},Vh.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},Vh.prototype.compareTo=function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:jh.compare(this._segmentOctant,this.coord,e.coord)},Vh.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},Vh.prototype.isInterior=function(){return this._isInterior},Vh.prototype.interfaces_=function(){return[Ru]},Vh.prototype.getClass=function(){return Vh};var qh=function(){this._nodeMap=new ic,this._edge=null;var t=arguments[0];this._edge=t};qh.prototype.getSplitCoordinates=function(){var t=new Vl;this.addEndpoints();for(var e=this.iterator(),r=e.next();e.hasNext();){var n=e.next();this.addEdgeCoordinates(r,n,t),r=n}return t.toCoordinateArray()},qh.prototype.addCollapsedNodes=function(){var t=new Ul;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var r=e.next().intValue();this.add(this._edge.getCoordinate(r),r)}},qh.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},qh.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e=0?e>=0?r>=n?0:1:r>=n?7:6:e>=0?r>=n?3:2:r>=n?4:5}if(arguments[0]instanceof Bu&&arguments[1]instanceof Bu){var i=arguments[0],o=arguments[1],a=o.x-i.x,s=o.y-i.y;if(0===a&&0===s)throw new ku("Cannot compute the octant for two identical points "+i);return Gh.octant(a,s)}};var Xh=function(){};Xh.prototype.getCoordinates=function(){},Xh.prototype.size=function(){},Xh.prototype.getCoordinate=function(t){},Xh.prototype.isClosed=function(){},Xh.prototype.setData=function(t){},Xh.prototype.getData=function(){},Xh.prototype.interfaces_=function(){return[]},Xh.prototype.getClass=function(){return Xh};var Zh=function(){};Zh.prototype.addIntersection=function(t,e){},Zh.prototype.interfaces_=function(){return[Xh]},Zh.prototype.getClass=function(){return Zh};var Yh=function(){this._nodeList=new qh(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Yh.prototype.getCoordinates=function(){return this._pts},Yh.prototype.size=function(){return this._pts.length},Yh.prototype.getCoordinate=function(t){return this._pts[t]},Yh.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Yh.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},Yh.prototype.setData=function(t){this._data=t},Yh.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:Gh.octant(t,e)},Yh.prototype.getData=function(){return this._data},Yh.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var r=arguments[1],n=arguments[3],i=new Bu(arguments[0].getIntersection(n));this.addIntersection(i,r)}},Yh.prototype.toString=function(){return fl.toLineString(new Uc(this._pts))},Yh.prototype.getNodeList=function(){return this._nodeList},Yh.prototype.addIntersectionNode=function(t,e){var r=e,n=r+1;if(n=0&&r>=0||e<=0&&r<=0?Math.max(e,r):0}if(arguments[0]instanceof Bu){var n=arguments[0];return wl.orientationIndex(this.p0,this.p1,n)}},Wh.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Wh.prototype.isVertical=function(){return this.p0.x===this.p1.x},Wh.prototype.equals=function(t){if(!(t instanceof Wh))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Wh.prototype.intersection=function(t){var e=new _l;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Wh.prototype.project=function(){if(arguments[0]instanceof Bu){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Bu(t);var e=this.projectionFactor(t),r=new Bu;return r.x=this.p0.x+e*(this.p1.x-this.p0.x),r.y=this.p0.y+e*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof Wh){var n=arguments[0],i=this.projectionFactor(n.p0),o=this.projectionFactor(n.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var a=this.project(n.p0);i<0&&(a=this.p0),i>1&&(a=this.p1);var s=this.project(n.p1);return o<0&&(s=this.p0),o>1&&(s=this.p1),new Wh(a,s)}},Wh.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Wh.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Wh.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},Wh.prototype.distancePerpendicular=function(t){return wl.distancePointLinePerpendicular(t,this.p0,this.p1)},Wh.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Wh.prototype.midPoint=function(){return Wh.midPoint(this.p0,this.p1)},Wh.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,r=this.p1.y-this.p0.y,n=e*e+r*r;return n<=0?Nu.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*r)/n},Wh.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var r=new Array(2).fill(null),n=Nu.MAX_VALUE,i=null,o=this.closestPoint(t.p0);n=o.distance(t.p0),r[0]=o,r[1]=t.p0;var a=this.closestPoint(t.p1);(i=a.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||Nu.isNaN(e))&&(e=1),e},Wh.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Wh.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Wh.prototype.distance=function(){if(arguments[0]instanceof Wh){var t=arguments[0];return wl.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Bu){var e=arguments[0];return wl.distancePointLine(e,this.p0,this.p1)}},Wh.prototype.pointAlong=function(t){var e=new Bu;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},Wh.prototype.hashCode=function(){var t=Nu.doubleToLongBits(this.p0.x);t^=31*Nu.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),r=Nu.doubleToLongBits(this.p1.x);return r^=31*Nu.doubleToLongBits(this.p1.y),e^Math.trunc(r)^Math.trunc(r>>32)},Wh.prototype.interfaces_=function(){return[Ru,Fu]},Wh.prototype.getClass=function(){return Wh},Wh.midPoint=function(t,e){return new Bu((t.x+e.x)/2,(t.y+e.y)/2)},Hh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Wh,Hh);var Jh=function(){this.tempEnv1=new sl,this.tempEnv2=new sl,this._overlapSeg1=new Wh,this._overlapSeg2=new Wh};Jh.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],r=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},Jh.prototype.interfaces_=function(){return[]},Jh.prototype.getClass=function(){return Jh};var Kh=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],r=arguments[2],n=arguments[3];this._pts=t,this._start=e,this._end=r,this._context=n};Kh.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},Kh.prototype.computeSelect=function(t,e,r,n){var i=this._pts[e],o=this._pts[r];if(n.tempEnv1.init(i,o),r-e==1)return n.select(this,e),null;if(!t.intersects(n.tempEnv1))return null;var a=Math.trunc((e+r)/2);e=t.length-1)return t.length-1;for(var n=_h.quadrant(t[r],t[r+1]),i=e+1;in.getId()&&(n.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},r.SegmentOverlapAction.get=function(){return rp},Object.defineProperties(e,r),e}(tp),rp=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],r=arguments[2],n=arguments[3],i=arguments[0].getContext(),o=r.getContext();this._si.processIntersections(i,e,o,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Jh),np=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(a),this.setMitreLimit(s)}},ip={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};np.prototype.getEndCapStyle=function(){return this._endCapStyle},np.prototype.isSingleSided=function(){return this._isSingleSided},np.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=np.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=np.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==np.JOIN_ROUND&&(this._quadrantSegments=np.DEFAULT_QUADRANT_SEGMENTS)},np.prototype.getJoinStyle=function(){return this._joinStyle},np.prototype.setJoinStyle=function(t){this._joinStyle=t},np.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},np.prototype.getSimplifyFactor=function(){return this._simplifyFactor},np.prototype.getQuadrantSegments=function(){return this._quadrantSegments},np.prototype.setEndCapStyle=function(t){this._endCapStyle=t},np.prototype.getMitreLimit=function(){return this._mitreLimit},np.prototype.setMitreLimit=function(t){this._mitreLimit=t},np.prototype.setSingleSided=function(t){this._isSingleSided=t},np.prototype.interfaces_=function(){return[]},np.prototype.getClass=function(){return np},np.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},ip.CAP_ROUND.get=function(){return 1},ip.CAP_FLAT.get=function(){return 2},ip.CAP_SQUARE.get=function(){return 3},ip.JOIN_ROUND.get=function(){return 1},ip.JOIN_MITRE.get=function(){return 2},ip.JOIN_BEVEL.get=function(){return 3},ip.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},ip.DEFAULT_MITRE_LIMIT.get=function(){return 5},ip.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(np,ip);var op=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=wl.COUNTERCLOCKWISE,this._inputLine=t||null},ap={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};op.prototype.isDeletable=function(t,e,r,n){var i=this._inputLine[t],o=this._inputLine[e],a=this._inputLine[r];return!!this.isConcave(i,o,a)&&!!this.isShallow(i,o,a,n)&&this.isShallowSampled(i,o,t,r,n)},op.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,r=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(r),i=!1;n=0;n--)this.addPt(t[n])},sp.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=lp.PI_TIMES_2;for(;t<=-Math.PI;)t+=lp.PI_TIMES_2;return t},lp.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],r=arguments[1],n=r.x-e.x,i=r.y-e.y;return Math.atan2(i,n)}},lp.isAcute=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)>0},lp.isObtuse=function(t,e,r){var n=t.x-e.x,i=t.y-e.y;return n*(r.x-e.x)+i*(r.y-e.y)<0},lp.interiorAngle=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r);return Math.abs(i-n)},lp.normalizePositive=function(t){if(t<0){for(;t<0;)t+=lp.PI_TIMES_2;t>=lp.PI_TIMES_2&&(t=0)}else{for(;t>=lp.PI_TIMES_2;)t-=lp.PI_TIMES_2;t<0&&(t=0)}return t},lp.angleBetween=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r);return lp.diff(n,i)},lp.diff=function(t,e){var r=null;return(r=tMath.PI&&(r=2*Math.PI-r),r},lp.toRadians=function(t){return t*Math.PI/180},lp.getTurn=function(t,e){var r=Math.sin(e-t);return r>0?lp.COUNTERCLOCKWISE:r<0?lp.CLOCKWISE:lp.NONE},lp.angleBetweenOriented=function(t,e,r){var n=lp.angle(e,t),i=lp.angle(e,r)-n;return i<=-Math.PI?i+lp.PI_TIMES_2:i>Math.PI?i-lp.PI_TIMES_2:i},cp.PI_TIMES_2.get=function(){return 2*Math.PI},cp.PI_OVER_2.get=function(){return Math.PI/2},cp.PI_OVER_4.get=function(){return Math.PI/4},cp.COUNTERCLOCKWISE.get=function(){return wl.COUNTERCLOCKWISE},cp.CLOCKWISE.get=function(){return wl.CLOCKWISE},cp.NONE.get=function(){return wl.COLLINEAR},Object.defineProperties(lp,cp);var hp=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Wh,this._seg1=new Wh,this._offset0=new Wh,this._offset1=new Wh,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=r,this._li=new _l,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===np.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)},pp={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};hp.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var r=wl.computeOrientation(this._s0,this._s1,this._s2),n=r===wl.CLOCKWISE&&this._side===nh.LEFT||r===wl.COUNTERCLOCKWISE&&this._side===nh.RIGHT;0===r?this.addCollinear(e):n?this.addOutsideTurn(r,e):this.addInsideTurn(r,e)},hp.prototype.addLineEndCap=function(t,e){var r=new Wh(t,e),n=new Wh;this.computeOffsetSegment(r,nh.LEFT,this._distance,n);var i=new Wh;this.computeOffsetSegment(r,nh.RIGHT,this._distance,i);var o=e.x-t.x,a=e.y-t.y,s=Math.atan2(a,o);switch(this._bufParams.getEndCapStyle()){case np.CAP_ROUND:this._segList.addPt(n.p1),this.addFilletArc(e,s+Math.PI/2,s-Math.PI/2,wl.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case np.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(i.p1);break;case np.CAP_SQUARE:var u=new Bu;u.x=Math.abs(this._distance)*Math.cos(s),u.y=Math.abs(this._distance)*Math.sin(s);var l=new Bu(n.p1.x+u.x,n.p1.y+u.y),c=new Bu(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},hp.prototype.getCoordinates=function(){return this._segList.getCoordinates()},hp.prototype.addMitreJoin=function(t,e,r,n){var i=!0,o=null;try{o=al.intersection(e.p0,e.p1,r.p0,r.p1),(n<=0?1:o.distance(t)/Math.abs(n))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof il))throw t;o=new Bu(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,r,n,this._bufParams.getMitreLimit())},hp.prototype.addFilletCorner=function(t,e,r,n,i){var o=e.x-t.x,a=e.y-t.y,s=Math.atan2(a,o),u=r.x-t.x,l=r.y-t.y,c=Math.atan2(l,u);n===wl.CLOCKWISE?s<=c&&(s+=2*Math.PI):s>=c&&(s-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,s,c,n,i),this._segList.addPt(r)},hp.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)0){var r=new Bu((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r);var n=new Bu((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},hp.prototype.createCircle=function(t){var e=new Bu(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},hp.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},hp.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sp,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*hp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},hp.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===np.JOIN_BEVEL||this._bufParams.getJoinStyle()===np.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,wl.CLOCKWISE,this._distance))},hp.prototype.closeRing=function(){this._segList.closeRing()},hp.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},hp.prototype.interfaces_=function(){return[]},hp.prototype.getClass=function(){return hp},pp.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},pp.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},pp.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},pp.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(hp,pp);var fp=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};fp.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var r=e<0,n=Math.abs(e),i=this.getSegGen(n);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,r,i);var o=i.getCoordinates();return r&&ql.reverse(o),o},fp.prototype.computeSingleSidedBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){r.addSegments(t,!0);var i=op.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],nh.LEFT),r.addFirstSegment();for(var a=o-2;a>=0;a--)r.addNextSegment(i[a],!0)}else{r.addSegments(t,!1);var s=op.simplify(t,n),u=s.length-1;r.initSideSegments(s[0],s[1],nh.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(s[l],!0)}r.addLastSegment(),r.closeRing()},fp.prototype.computeRingBufferCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);e===nh.RIGHT&&(n=-n);var i=op.simplify(t,n),o=i.length-1;r.initSideSegments(i[o-1],i[0],e);for(var a=1;a<=o;a++){var s=1!==a;r.addNextSegment(i[a],s)}r.closeRing()},fp.prototype.computeLineBufferCurve=function(t,e){var r=this.simplifyTolerance(this._distance),n=op.simplify(t,r),i=n.length-1;e.initSideSegments(n[0],n[1],nh.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(n[o],!0);e.addLastSegment(),e.addLineEndCap(n[i-1],n[i]);var a=op.simplify(t,-r),s=a.length-1;e.initSideSegments(a[s],a[s-1],nh.LEFT);for(var u=s-2;u>=0;u--)e.addNextSegment(a[u],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()},fp.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case np.CAP_ROUND:e.createCircle(t);break;case np.CAP_SQUARE:e.createSquare(t)}},fp.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var r=Math.abs(e),n=this.getSegGen(r);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()},fp.prototype.getBufferParameters=function(){return this._bufParams},fp.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},fp.prototype.getRingCurve=function(t,e,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return fp.copyCoordinates(t);var n=this.getSegGen(r);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()},fp.prototype.computeOffsetCurve=function(t,e,r){var n=this.simplifyTolerance(this._distance);if(e){var i=op.simplify(t,-n),o=i.length-1;r.initSideSegments(i[o],i[o-1],nh.LEFT),r.addFirstSegment();for(var a=o-2;a>=0;a--)r.addNextSegment(i[a],!0)}else{var s=op.simplify(t,n),u=s.length-1;r.initSideSegments(s[0],s[1],nh.LEFT),r.addFirstSegment();for(var l=2;l<=u;l++)r.addNextSegment(s[l],!0)}r.addLastSegment()},fp.prototype.getSegGen=function(t){return new hp(this._precisionModel,this._bufParams,t)},fp.prototype.interfaces_=function(){return[]},fp.prototype.getClass=function(){return fp},fp.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),r=0;ro.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),r)}return r}if(3===arguments.length)if(Xu(arguments[2],Fl)&&arguments[0]instanceof Bu&&arguments[1]instanceof wh)for(var a=arguments[0],s=arguments[1],u=arguments[2],l=s.getEdge().getCoordinates(),c=0;ct._seg.p1.y&&t._seg.reverse();if(!(Math.max(t._seg.p0.x,t._seg.p1.x)t._seg.p1.y||wl.computeOrientation(t._seg.p0,t._seg.p1,a)===wl.RIGHT)){var h=s.getDepth(nh.LEFT);t._seg.p0.equals(l[c])||(h=s.getDepth(nh.RIGHT));var p=new yp(t._seg,h);u.add(p)}}else if(Xu(arguments[2],Fl)&&arguments[0]instanceof Bu&&Xu(arguments[1],Fl))for(var f=arguments[0],d=arguments[2],g=arguments[1].iterator();g.hasNext();){var y=g.next();y.isForward()&&t.findStabbedSegments(f,y,d)}},dp.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:Nh.min(e)._leftDepth},dp.prototype.interfaces_=function(){return[]},dp.prototype.getClass=function(){return dp},gp.DepthSegment.get=function(){return yp},Object.defineProperties(dp,gp);var yp=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Wh(t),this._leftDepth=e};yp.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==r||0!=(r=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?r:this._upwardSeg.compareTo(e._upwardSeg)},yp.prototype.compareX=function(t,e){var r=t.p0.compareTo(e.p0);return 0!==r?r:t.p1.compareTo(e.p1)},yp.prototype.toString=function(){return this._upwardSeg.toString()},yp.prototype.interfaces_=function(){return[Ru]},yp.prototype.getClass=function(){return yp};var mp=function(t,e,r){this.p0=t||null,this.p1=e||null,this.p2=r||null};mp.prototype.area=function(){return mp.area(this.p0,this.p1,this.p2)},mp.prototype.signedArea=function(){return mp.signedArea(this.p0,this.p1,this.p2)},mp.prototype.interpolateZ=function(t){if(null===t)throw new ku("Supplied point is null.");return mp.interpolateZ(t,this.p0,this.p1,this.p2)},mp.prototype.longestSideLength=function(){return mp.longestSideLength(this.p0,this.p1,this.p2)},mp.prototype.isAcute=function(){return mp.isAcute(this.p0,this.p1,this.p2)},mp.prototype.circumcentre=function(){return mp.circumcentre(this.p0,this.p1,this.p2)},mp.prototype.area3D=function(){return mp.area3D(this.p0,this.p1,this.p2)},mp.prototype.centroid=function(){return mp.centroid(this.p0,this.p1,this.p2)},mp.prototype.inCentre=function(){return mp.inCentre(this.p0,this.p1,this.p2)},mp.prototype.interfaces_=function(){return[]},mp.prototype.getClass=function(){return mp},mp.area=function(t,e,r){return Math.abs(((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2)},mp.signedArea=function(t,e,r){return((r.x-t.x)*(e.y-t.y)-(e.x-t.x)*(r.y-t.y))/2},mp.det=function(t,e,r,n){return t*n-e*r},mp.interpolateZ=function(t,e,r,n){var i=e.x,o=e.y,a=r.x-i,s=n.x-i,u=r.y-o,l=n.y-o,c=a*l-s*u,h=t.x-i,p=t.y-o,f=(l*h-s*p)/c,d=(-u*h+a*p)/c;return e.z+f*(r.z-e.z)+d*(n.z-e.z)},mp.longestSideLength=function(t,e,r){var n=t.distance(e),i=e.distance(r),o=r.distance(t),a=n;return i>a&&(a=i),o>a&&(a=o),a},mp.isAcute=function(t,e,r){return!!lp.isAcute(t,e,r)&&!!lp.isAcute(e,r,t)&&!!lp.isAcute(r,t,e)},mp.circumcentre=function(t,e,r){var n=r.x,i=r.y,o=t.x-n,a=t.y-i,s=e.x-n,u=e.y-i,l=2*mp.det(o,a,s,u),c=mp.det(a,o*o+a*a,u,s*s+u*u),h=mp.det(o,o*o+a*a,s,s*s+u*u);return new Bu(n-c/l,i+h/l)},mp.perpendicularBisector=function(t,e){var r=e.x-t.x,n=e.y-t.y,i=new al(t.x+r/2,t.y+n/2,1),o=new al(t.x-n+r/2,t.y+r+n/2,1);return new al(i,o)},mp.angleBisector=function(t,e,r){var n=e.distance(t),i=n/(n+e.distance(r)),o=r.x-t.x,a=r.y-t.y;return new Bu(t.x+i*o,t.y+i*a)},mp.area3D=function(t,e,r){var n=e.x-t.x,i=e.y-t.y,o=e.z-t.z,a=r.x-t.x,s=r.y-t.y,u=r.z-t.z,l=i*u-o*s,c=o*a-n*u,h=n*s-i*a,p=l*l+c*c+h*h;return Math.sqrt(p)/2},mp.centroid=function(t,e,r){var n=(t.x+e.x+r.x)/3,i=(t.y+e.y+r.y)/3;return new Bu(n,i)},mp.inCentre=function(t,e,r){var n=e.distance(r),i=t.distance(r),o=t.distance(e),a=n+i+o,s=(n*t.x+i*e.x+o*r.x)/a,u=(n*t.y+i*e.y+o*r.y)/a;return new Bu(s,u)};var vp=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Ul;var t=arguments[0],e=arguments[1],r=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=r};vp.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),r=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(r,qu.EXTERIOR,qu.INTERIOR)},vp.prototype.addPolygon=function(t){var e=this,r=this._distance,n=nh.LEFT;this._distance<0&&(r=-this._distance,n=nh.RIGHT);var i=t.getExteriorRing(),o=ql.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,r,n,qu.EXTERIOR,qu.INTERIOR);for(var a=0;a0&&e.isErodedCompletely(s,-e._distance)||e.addPolygonRing(u,r,nh.opposite(n),qu.INTERIOR,qu.EXTERIOR)}},vp.prototype.isTriangleErodedCompletely=function(t,e){var r=new mp(t[0],t[1],t[2]),n=r.inCentre();return wl.distancePointLine(n,r.p0,r.p1)=Nc.MINIMUM_VALID_SIZE&&wl.isCCW(t)&&(o=i,a=n,r=nh.opposite(r));var s=this._curveBuilder.getRingCurve(t,r,e);this.addCurve(s,o,a)},vp.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Ac?this.addPolygon(t):t instanceof Pc?this.addLineString(t):t instanceof Tc?this.addPoint(t):(t instanceof kc||t instanceof gc||t instanceof Dc||t instanceof dc)&&this.addCollection(t)},vp.prototype.isErodedCompletely=function(t,e){var r=t.getCoordinates();if(r.length<4)return e<0;if(4===r.length)return this.isTriangleErodedCompletely(r,e);var n=t.getEnvelopeInternal(),i=Math.min(n.getHeight(),n.getWidth());return e<0&&2*Math.abs(e)>i},vp.prototype.addCollection=function(t){for(var e=0;e=this._max)throw new Bl;var t=this._parent.getGeometryN(this._index++);return t instanceof dc?(this._subcollectionIterator=new xp(t),this._subcollectionIterator.next()):t},xp.prototype.remove=function(){throw new Error(this.getClass().getName())},xp.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},xp.prototype.interfaces_=function(){return[zl]},xp.prototype.getClass=function(){return xp},xp.isAtomic=function(t){return!(t instanceof dc)};var bp=function(){this._geom=null;var t=arguments[0];this._geom=t};bp.prototype.locate=function(t){return bp.locate(t,this._geom)},bp.prototype.interfaces_=function(){return[_p]},bp.prototype.getClass=function(){return bp},bp.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&wl.isPointInRing(t,e.getCoordinates())},bp.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var r=e.getExteriorRing();if(!bp.isPointInRing(t,r))return!1;for(var n=0;n=0;r--){var n=this._edgeList.get(r),i=n.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=n}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),r=t.getDepth(nh.LEFT),n=t.getDepth(nh.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),r);if(this.computeDepths(0,e,i)!==n)throw new uh("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],a=arguments[2],s=arguments[0];s=0;o--){var a=e._resultAreaEdgeList.get(o),s=a.getSym();switch(null===r&&a.getEdgeRing()===t&&(r=a),i){case e._SCANNING_FOR_INCOMING:if(s.getEdgeRing()!==t)continue;n=s,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(a.getEdgeRing()!==t)continue;n.setNextMin(a),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(yl.isTrue(null!==r,"found null for first outgoing dirEdge"),yl.isTrue(r.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(r))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var r=arguments[0],n=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===r&&n++}return n}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=qu.NONE,e=this.iterator();e.hasNext();){var r=e.next(),n=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){t=qu.INTERIOR;break}if(n.isInResult()){t=qu.EXTERIOR;break}}}if(t===qu.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var a=o.next(),s=a.getSym();a.isLineEdge()?a.getEdge().setCovered(i===qu.INTERIOR):(a.isInResult()&&(i=qu.EXTERIOR),s.isInResult()&&(i=qu.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new ph(qu.NONE);for(var r=this.iterator();r.hasNext();)for(var n=r.next().getEdge().getLabel(),i=0;i<2;i++){var o=n.getLocation(i);o!==qu.INTERIOR&&o!==qu.BOUNDARY||this._label.setLocation(i,qu.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(wp),Ip=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new mh(t,new Ep)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Eh),Sp=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Sp.prototype.compareTo=function(t){var e=t;return Sp.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Sp.prototype.interfaces_=function(){return[Ru]},Sp.prototype.getClass=function(){return Sp},Sp.orientation=function(t){return 1===ql.increasingDirection(t)},Sp.compareOriented=function(t,e,r,n){for(var i=e?1:-1,o=n?1:-1,a=e?t.length:-1,s=n?r.length:-1,u=e?0:t.length-1,l=n?0:r.length-1;;){var c=t[u].compareTo(r[l]);if(0!==c)return c;var h=(u+=i)===a,p=(l+=o)===s;if(h&&!p)return-1;if(!h&&p)return 1;if(h&&p)return 0}};var Cp=function(){this._edges=new Ul,this._ocaMap=new ic};Cp.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var n=r.getCoordinates(),i=0;i0&&t.print(","),t.print(n[i].x+" "+n[i].y);t.println(")")}t.print(") ")},Cp.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Cp.prototype.findEdgeIndex=function(t){for(var e=0;e0||!e.coord.equals2D(n);i||r--;var o=new Array(r).fill(null),a=0;o[a++]=new Bu(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)o[a++]=this.edge.pts[s];return i&&(o[a]=e.coord),new Rp(o,new ph(this.edge._label))},Lp.prototype.add=function(t,e,r){var n=new Tp(t,e,r),i=this._nodeMap.get(n);return null!==i?i:(this._nodeMap.put(n,n),n)},Lp.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Lp.prototype.interfaces_=function(){return[]},Lp.prototype.getClass=function(){return Lp};var Ap=function(){};Ap.prototype.getChainStartIndices=function(t){var e=0,r=new Ul;r.add(new Hu(e));do{var n=this.findChainEnd(t,e);r.add(new Hu(n)),e=n}while(er?e:r},kp.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,r=this.pts[this.startIndex[t+1]].x;return er&&(i=1),t._depth[e][n]=i}}},Np.prototype.getDelta=function(t){return this._depth[t][nh.RIGHT]-this._depth[t][nh.LEFT]},Np.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?qu.EXTERIOR:qu.INTERIOR},Np.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Np.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],r=0;r<2;r++)for(var n=1;n<3;n++){var i=e.getLocation(r,n);i!==qu.EXTERIOR&&i!==qu.INTERIOR||(t.isNull(r,n)?t._depth[r][n]=Np.depthAtLocation(i):t._depth[r][n]+=Np.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],a=arguments[1];arguments[2]===qu.INTERIOR&&this._depth[o][a]++}},Np.prototype.interfaces_=function(){return[]},Np.prototype.getClass=function(){return Np},Np.depthAtLocation=function(t){return t===qu.EXTERIOR?0:t===qu.INTERIOR?1:Np.NULL_VALUE},Dp.NULL_VALUE.get=function(){return-1},Object.defineProperties(Np,Dp);var Rp=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Lp(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Np,this._depthDelta=0,1===arguments.length){var r=arguments[0];e.call(this,r,null)}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.pts=n,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,ph.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var r=t;if(this.pts.length!==r.pts.length)return!1;for(var n=!0,i=!0,o=this.pts.length,a=0;a0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new kp(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new sl;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;en||this._maxyo;if(a)return!1;var s=this.intersectsToleranceSquare(t,e);return yl.isTrue(!(a&&s),"Found bad envelope test"),s},Up.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new Bu(this._maxx,this._maxy),this._corner[1]=new Bu(this._minx,this._maxy),this._corner[2]=new Bu(this._minx,this._miny),this._corner[3]=new Bu(this._maxx,this._miny)},Up.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Up.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},Up.prototype.getCoordinate=function(){return this._originalPt},Up.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},Up.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=Up.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new sl(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},Up.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))},Up.prototype.intersectsToleranceSquare=function(t,e){var r=!1,n=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||r&&n||t.equals(this._pt)||e.equals(this._pt)))))},Up.prototype.addSnappedNode=function(t,e){var r=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(r,n)&&(t.addIntersection(this.getCoordinate(),e),!0)},Up.prototype.interfaces_=function(){return[]},Up.prototype.getClass=function(){return Up},jp.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(Up,jp);var Vp=function(){this.tempEnv1=new sl,this.selectedSegment=new Wh};Vp.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},Vp.prototype.interfaces_=function(){return[]},Vp.prototype.getClass=function(){return Vp};var qp=function(){this._index=null;var t=arguments[0];this._index=t},Gp={HotPixelSnapAction:{configurable:!0}};qp.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2],i=e.getSafeEnvelope(),o=new Xp(e,r,n);return this._index.query(i,{interfaces_:function(){return[Th]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},qp.prototype.interfaces_=function(){return[]},qp.prototype.getClass=function(){return qp},Gp.HotPixelSnapAction.get=function(){return Xp},Object.defineProperties(qp,Gp);var Xp=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],r=arguments[1],n=arguments[2];this._hotPixel=e,this._parentEdge=r,this._hotPixelVertexIndex=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],r=arguments[0].getContext();if(null!==this._parentEdge&&r===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(r,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Vp),Zp=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new Ul};Zp.prototype.processIntersections=function(t,e,r,n){if(t===r&&e===n)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];if(this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof uh))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var r=arguments[0],n=Wp.precisionScaleFactor(this._argGeom,this._distance,r),i=new Xc(n);this.bufferFixedPrecision(i)}},Wp.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Xc.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},Wp.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},Wp.prototype.bufferOriginalPrecision=function(){try{var t=new Op(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof dl))throw t;this._saveException=t}},Wp.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},Wp.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},Wp.prototype.interfaces_=function(){return[]},Wp.prototype.getClass=function(){return Wp},Wp.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new Wp(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Sl&&"number"==typeof arguments[1]){var e=arguments[1],r=arguments[2],n=new Wp(arguments[0]);n.setQuadrantSegments(r);return n.getResultGeometry(e)}if(arguments[2]instanceof np&&arguments[0]instanceof Sl&&"number"==typeof arguments[1]){var i=arguments[1];return new Wp(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],a=arguments[2],s=arguments[3],u=new Wp(arguments[0]);u.setQuadrantSegments(a),u.setEndCapStyle(s);return u.getResultGeometry(o)}},Wp.precisionScaleFactor=function(t,e,r){var n=t.getEnvelopeInternal(),i=Zu.max(Math.abs(n.getMaxX()),Math.abs(n.getMaxY()),Math.abs(n.getMinX()),Math.abs(n.getMinY()))+2*(e>0?e:0),o=r-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},Hp.CAP_ROUND.get=function(){return np.CAP_ROUND},Hp.CAP_BUTT.get=function(){return np.CAP_FLAT},Hp.CAP_FLAT.get=function(){return np.CAP_FLAT},Hp.CAP_SQUARE.get=function(){return np.CAP_SQUARE},Hp.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Wp,Hp);var Jp=function(){this._pt=[new Bu,new Bu],this._distance=Nu.NaN,this._isNull=!0};Jp.prototype.getCoordinates=function(){return this._pt},Jp.prototype.getCoordinate=function(t){return this._pt[t]},Jp.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],r=arguments[1];if(this._isNull)return this.initialize(e,r),null;var n=e.distance(r);nthis._distance&&this.initialize(e,r,n)}},Jp.prototype.interfaces_=function(){return[]},Jp.prototype.getClass=function(){return Jp};var Kp=function(){};Kp.prototype.interfaces_=function(){return[]},Kp.prototype.getClass=function(){return Kp},Kp.computeDistance=function(){if(arguments[2]instanceof Jp&&arguments[0]instanceof Pc&&arguments[1]instanceof Bu)for(var t=arguments[1],e=arguments[2],r=arguments[0].getCoordinates(),n=new Wh,i=0;i0||this._isIn?qu.INTERIOR:qu.EXTERIOR)},of.prototype.interfaces_=function(){return[]},of.prototype.getClass=function(){return of};var af=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){t.call(this,arguments[0],t.INSIDE_AREA,arguments[1])}else if(3===arguments.length){var e=arguments[0],r=arguments[1],n=arguments[2];this._component=e,this._segIndex=r,this._pt=n}},sf={INSIDE_AREA:{configurable:!0}};af.prototype.isInsideArea=function(){return this._segIndex===af.INSIDE_AREA},af.prototype.getCoordinate=function(){return this._pt},af.prototype.getGeometryComponent=function(){return this._component},af.prototype.getSegmentIndex=function(){return this._segIndex},af.prototype.interfaces_=function(){return[]},af.prototype.getClass=function(){return af},sf.INSIDE_AREA.get=function(){return-1},Object.defineProperties(af,sf);var uf=function(t){this._pts=t||null};uf.prototype.filter=function(t){t instanceof Tc&&this._pts.add(t)},uf.prototype.interfaces_=function(){return[pc]},uf.prototype.getClass=function(){return uf},uf.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Tc?Nh.singletonList(t):uf.getPoints(t,new Ul)}if(2===arguments.length){var e=arguments[0],r=arguments[1];return e instanceof Tc?r.add(e):e instanceof dc&&e.apply(new uf(r)),r}};var lf=function(){this._locations=null;var t=arguments[0];this._locations=t};lf.prototype.filter=function(t){(t instanceof Tc||t instanceof Pc||t instanceof Ac)&&this._locations.add(new af(t,0,t.getCoordinate()))},lf.prototype.interfaces_=function(){return[pc]},lf.prototype.getClass=function(){return lf},lf.getLocations=function(t){var e=new Ul;return t.apply(new lf(e)),e};var cf=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new of,this._minDistanceLocation=null,this._minDistance=Nu.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var r=arguments[0],n=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=n,this._terminateDistance=i}};cf.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var r=arguments[0],n=arguments[1],i=1-r,o=rf.getPolygons(this._geom[r]);if(o.size()>0){var a=lf.getLocations(this._geom[i]);if(this.computeContainmentDistance(a,o,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=n[0],this._minDistanceLocation[r]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&Xu(arguments[0],Fl)&&Xu(arguments[1],Fl)){for(var s=arguments[0],u=arguments[1],l=arguments[2],c=0;cthis._minDistance)return null;for(var i=e.getCoordinates(),o=r.getCoordinate(),a=0;athis._minDistance)return null;for(var p=l.getCoordinates(),f=c.getCoordinates(),d=0;dthis._distance&&this.initialize(e,r,n)}},hf.prototype.interfaces_=function(){return[]},hf.prototype.getClass=function(){return hf};var pf=function(){};pf.prototype.interfaces_=function(){return[]},pf.prototype.getClass=function(){return pf},pf.computeDistance=function(){if(arguments[2]instanceof hf&&arguments[0]instanceof Pc&&arguments[1]instanceof Bu)for(var t=arguments[0],e=arguments[1],r=arguments[2],n=new Wh,i=t.getCoordinates(),o=0;o1||t<=0)throw new ku("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},ff.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},ff.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ff.prototype.computeOrientedDistance=function(t,e,r){var n=new gf(e);if(t.apply(n),r.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){var i=new yf(e,this._densifyFrac);t.apply(i),r.setMaximum(i.getMaxPointDistance())}},ff.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ff.prototype.interfaces_=function(){return[]},ff.prototype.getClass=function(){return ff},ff.distance=function(){if(2===arguments.length){return new ff(arguments[0],arguments[1]).distance()}if(3===arguments.length){var t=arguments[2],e=new ff(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},df.MaxPointDistanceFilter.get=function(){return gf},df.MaxDensifiedByFractionDistanceFilter.get=function(){return yf},Object.defineProperties(ff,df);var gf=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._euclideanDist=new pf,this._geom=null;var t=arguments[0];this._geom=t};gf.prototype.filter=function(t){this._minPtDist.initialize(),pf.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},gf.prototype.getMaxPointDistance=function(){return this._maxPtDist},gf.prototype.interfaces_=function(){return[Ml]},gf.prototype.getClass=function(){return gf};var yf=function(){this._maxPtDist=new hf,this._minPtDist=new hf,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};yf.prototype.filter=function(t,e){var r=this;if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-n.x)/this._numSubSegs,a=(i.y-n.y)/this._numSubSegs,s=0;sr){this._isValid=!1;var i=n.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fl.toLineString(i[0],i[1])+")"}},mf.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=mf.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),mf.VERBOSE&&ol.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},mf.prototype.checkNegativeValid=function(){if(!(this._input instanceof Ac||this._input instanceof Dc||this._input instanceof dc))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},mf.prototype.getErrorIndicator=function(){return this._errorIndicator},mf.prototype.checkMinimumDistance=function(t,e,r){var n=new cf(t,e,r);if(this._minDistanceFound=n.distance(),this._minDistanceFound0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},_f.prototype.report=function(t){if(!_f.VERBOSE)return null;ol.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},_f.prototype.getErrorMessage=function(){return this._errorMsg},_f.prototype.interfaces_=function(){return[]},_f.prototype.getClass=function(){return _f},_f.isValidMsg=function(t,e,r){var n=new _f(t,e,r);return n.isValid()?null:n.getErrorMessage()},_f.isValid=function(t,e,r){return!!new _f(t,e,r).isValid()},xf.VERBOSE.get=function(){return!1},xf.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(_f,xf);var bf=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};bf.prototype.getCoordinates=function(){return this._pts},bf.prototype.size=function(){return this._pts.length},bf.prototype.getCoordinate=function(t){return this._pts[t]},bf.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},bf.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:Gh.octant(this.getCoordinate(t),this.getCoordinate(t+1))},bf.prototype.setData=function(t){this._data=t},bf.prototype.getData=function(){return this._data},bf.prototype.toString=function(){return fl.toLineString(new Uc(this._pts))},bf.prototype.interfaces_=function(){return[Xh]},bf.prototype.getClass=function(){return bf};var wf=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new Ul,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};wf.prototype.getInteriorIntersection=function(){return this._interiorIntersection},wf.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},wf.prototype.getIntersectionSegments=function(){return this._intSegments},wf.prototype.count=function(){return this._intersectionCount},wf.prototype.getIntersections=function(){return this._intersections},wf.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},wf.prototype.setKeepIntersections=function(t){this._keepIntersections=t},wf.prototype.processIntersections=function(t,e,r,n){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!this.isEndSegment(t,e)&&!this.isEndSegment(r,n))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=a,this._intSegments[3]=s,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},wf.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},wf.prototype.hasIntersection=function(){return null!==this._interiorIntersection},wf.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},wf.prototype.interfaces_=function(){return[Pp]},wf.prototype.getClass=function(){return wf},wf.createAllIntersectionsFinder=function(t){var e=new wf(t);return e.setFindAllIntersections(!0),e},wf.createAnyIntersectionFinder=function(t){return new wf(t)},wf.createIntersectionCounter=function(t){var e=new wf(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ef=function(){this._li=new _l,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ef.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ef.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ef.prototype.isValid=function(){return this.execute(),this._isValid},Ef.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ef.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new wf(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new ep;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ef.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new uh(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ef.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fl.toLineString(t[0],t[1])+" and "+fl.toLineString(t[2],t[3])},Ef.prototype.interfaces_=function(){return[]},Ef.prototype.getClass=function(){return Ef},Ef.computeIntersections=function(t){var e=new Ef(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var If=function t(){this._nv=null;var e=arguments[0];this._nv=new Ef(t.toSegmentStrings(e))};If.prototype.checkValid=function(){this._nv.checkValid()},If.prototype.interfaces_=function(){return[]},If.prototype.getClass=function(){return If},If.toSegmentStrings=function(t){for(var e=new Ul,r=t.iterator();r.hasNext();){var n=r.next();e.add(new bf(n.getCoordinates(),n))}return e},If.checkValid=function(t){new If(t).checkValid()};var Sf=function(t){this._mapOp=t};Sf.prototype.map=function(t){for(var e=new Ul,r=0;r0&&n<4&&!this._preserveType?this._factory.createLineString(r):this._factory.createLinearRing(r)},Mf.prototype.interfaces_=function(){return[]},Mf.prototype.getClass=function(){return Mf};var Tf=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Wh,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof Pc&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var r=arguments[0],n=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=n}};Tf.prototype.snapVertices=function(t,e){for(var r=this._isClosed?t.size()-1:t.size(),n=0;n=0&&t.add(o+1,new Bu(i),!1)}},Tf.prototype.findSegmentIndexToSnap=function(t,e){for(var r=this,n=Nu.MAX_VALUE,i=-1,o=0;oe&&(e=n)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Lf.computeOverlaySnapTolerance(i),Lf.computeOverlaySnapTolerance(o))}},Lf.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Lf.SNAP_PRECISION_FACTOR},Lf.snapToSelf=function(t,e,r){return new Lf(t).snapToSelf(e,r)},Af.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Lf,Af);var kf=function(t){function e(e,r,n){t.call(this),this._snapTolerance=e||null,this._snapPts=r||null,this._isSelfSnap=void 0!==n&&n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var r=new Tf(t,this._snapTolerance);return r.setAllowSnappingToSourceVertices(this._isSelfSnap),r.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var r=t.toCoordinateArray(),n=this.snapLine(r,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Mf),Nf=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Nf.prototype.getCommon=function(){return Nu.longBitsToDouble(this._commonBits)},Nf.prototype.add=function(t){var e=Nu.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Nf.signExpBits(this._commonBits),this._isFirst=!1,null):Nf.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Nf.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Nf.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Nf.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=Nu.longBitsToDouble(t),r="0000000000000000000000000000000000000000000000000000000000000000"+Nu.toBinaryString(t),n=r.substring(r.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}},Nf.prototype.interfaces_=function(){return[]},Nf.prototype.getClass=function(){return Nf},Nf.getBit=function(t,e){return 0!=(t&1<>52},Nf.zeroLowerBits=function(t,e){return t&~((1<=0;n--){if(Nf.getBit(t,n)!==Nf.getBit(e,n))return r;r++}return 52};var Df=function(){this._commonCoord=null,this._ccFilter=new Of},Rf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Df.prototype.addCommonBits=function(t){var e=new zf(this._commonCoord);t.apply(e),t.geometryChanged()},Df.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new Bu(this._commonCoord);e.x=-e.x,e.y=-e.y;var r=new zf(e);return t.apply(r),t.geometryChanged(),t},Df.prototype.getCommonCoordinate=function(){return this._commonCoord},Df.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Df.prototype.interfaces_=function(){return[]},Df.prototype.getClass=function(){return Df},Rf.CommonCoordinateFilter.get=function(){return Of},Rf.Translater.get=function(){return zf},Object.defineProperties(Df,Rf);var Of=function(){this._commonBitsX=new Nf,this._commonBitsY=new Nf};Of.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Of.prototype.getCommonCoordinate=function(){return new Bu(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Of.prototype.interfaces_=function(){return[Ml]},Of.prototype.getClass=function(){return Of};var zf=function(){this.trans=null;var t=arguments[0];this.trans=t};zf.prototype.filter=function(t,e){var r=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,r),t.setOrdinate(e,1,n)},zf.prototype.isDone=function(){return!1},zf.prototype.isGeometryChanged=function(){return!0},zf.prototype.interfaces_=function(){return[fc]},zf.prototype.getClass=function(){return zf};var Ff=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Ff.prototype.selfSnap=function(t){return new Lf(t).snapTo(t,this._snapTolerance)},Ff.prototype.removeCommonBits=function(t){this._cbr=new Df,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},Ff.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Ff.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),r=ad.overlayOp(e[0],e[1],t);return this.prepareResult(r)},Ff.prototype.checkValid=function(t){t.isValid()||ol.out.println("Snapped geometry is invalid")},Ff.prototype.computeSnapTolerance=function(){this._snapTolerance=Lf.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Ff.prototype.snap=function(t){var e=this.removeCommonBits(t);return Lf.snap(e[0],e[1],this._snapTolerance)},Ff.prototype.interfaces_=function(){return[]},Ff.prototype.getClass=function(){return Ff},Ff.overlayOp=function(t,e,r){return new Ff(t,e).getResultGeometry(r)},Ff.union=function(t,e){return Ff.overlayOp(t,e,ad.UNION)},Ff.intersection=function(t,e){return Ff.overlayOp(t,e,ad.INTERSECTION)},Ff.symDifference=function(t,e){return Ff.overlayOp(t,e,ad.SYMDIFFERENCE)},Ff.difference=function(t,e){return Ff.overlayOp(t,e,ad.DIFFERENCE)};var Bf=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};Bf.prototype.getResultGeometry=function(t){var e=null,r=!1,n=null;try{e=ad.overlayOp(this._geom[0],this._geom[1],t);r=!0}catch(t){if(!(t instanceof dl))throw t;n=t}if(!r)try{e=Ff.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof dl?n:t}return e},Bf.prototype.interfaces_=function(){return[]},Bf.prototype.getClass=function(){return Bf},Bf.overlayOp=function(t,e,r){return new Bf(t,e).getResultGeometry(r)},Bf.union=function(t,e){return Bf.overlayOp(t,e,ad.UNION)},Bf.intersection=function(t,e){return Bf.overlayOp(t,e,ad.INTERSECTION)},Bf.symDifference=function(t,e){return Bf.overlayOp(t,e,ad.SYMDIFFERENCE)},Bf.difference=function(t,e){return Bf.overlayOp(t,e,ad.DIFFERENCE)};var Uf=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Uf.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Uf.prototype.interfaces_=function(){return[]},Uf.prototype.getClass=function(){return Uf};var jf=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],r=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=r}else if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=n,this._xValue=i,this._obj=o}},Vf={INSERT:{configurable:!0},DELETE:{configurable:!0}};jf.prototype.isDelete=function(){return this._eventType===jf.DELETE},jf.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},jf.prototype.getObject=function(){return this._obj},jf.prototype.compareTo=function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},jf.prototype.getInsertEvent=function(){return this._insertEvent},jf.prototype.isInsert=function(){return this._eventType===jf.INSERT},jf.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},jf.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},jf.prototype.interfaces_=function(){return[Ru]},jf.prototype.getClass=function(){return jf},Vf.INSERT.get=function(){return 1},Vf.DELETE.get=function(){return 2},Object.defineProperties(jf,Vf);var qf=function(){};qf.prototype.interfaces_=function(){return[]},qf.prototype.getClass=function(){return qf};var Gf=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],r=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=r};Gf.prototype.isTrivialIntersection=function(t,e,r,n){if(t===r&&1===this._li.getIntersectionNum()){if(Gf.isAdjacentSegments(e,n))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1},Gf.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Gf.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Gf.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Gf.prototype.isBoundaryPointInternal=function(t,e){for(var r=e.iterator();r.hasNext();){var n=r.next().getCoordinate();if(t.isIntersection(n))return!0}return!1},Gf.prototype.hasProperIntersection=function(){return this._hasProper},Gf.prototype.hasIntersection=function(){return this._hasIntersection},Gf.prototype.isDone=function(){return this._isDone},Gf.prototype.isBoundaryPoint=function(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))},Gf.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Gf.prototype.addIntersections=function(t,e,r,n){if(t===r&&e===n)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=r.getCoordinates()[n],s=r.getCoordinates()[n+1];this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),r.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,r,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),r.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Gf.prototype.interfaces_=function(){return[]},Gf.prototype.getClass=function(){return Gf},Gf.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Xf=function(t){function e(){t.call(this),this.events=new Ul,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Nh.sort(this.events);for(var t=0;te||this._maxo?1:0},Wf.prototype.interfaces_=function(){return[zu]},Wf.prototype.getClass=function(){return Wf};var Hf=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],r=arguments[1],n=arguments[2];this._min=e,this._max=r,this._item=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;r.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zf),Jf=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],r=arguments[1];this._node1=e,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,r){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,r),null!==this._node2&&this._node2.query(t,e,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Zf),Kf=function(){this._leaves=new Ul,this._root=null,this._level=0};Kf.prototype.buildTree=function(){Nh.sort(this._leaves,new Zf.NodeComparator);for(var t=this._leaves,e=null,r=new Ul;;){if(this.buildLevel(t,r),1===r.size())return r.get(0);e=t,t=r,r=e}},Kf.prototype.insert=function(t,e,r){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Hf(t,e,r))},Kf.prototype.query=function(t,e,r){this.init(),this._root.query(t,e,r)},Kf.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},Kf.prototype.printNode=function(t){ol.out.println(fl.toLineString(new Bu(t._min,this._level),new Bu(t._max,this._level)))},Kf.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},Kf.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var r=0;r=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),r=0,n=t.iterator();n.hasNext();){var i=n.next();e[r++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,r){if(this.isBoundaryNode(t,e))return null;r===qu.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,r)},e.prototype.addPolygonRing=function(t,e,r){if(t.isEmpty())return null;var n=ql.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;var i=e,o=r;wl.isCCW(n)&&(i=r,o=e);var a=new Rp(n,new ph(this._argIndex,qu.BOUNDARY,i,o));this._lineEdgeMap.put(t,a),this.insertEdge(a),this.insertPoint(this._argIndex,n[0],qu.BOUNDARY)},e.prototype.insertPoint=function(t,e,r){var n=this._nodes.addNode(e),i=n.getLabel();null===i?n._label=new ph(t,r):i.setLocation(t,r)},e.prototype.createEdgeSetIntersector=function(){return new Xf},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var r=e.next(),n=r.getLabel().getLocation(t),i=r.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,n)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Dc&&(this._useBoundaryDeterminationRule=!1),e instanceof Ac)this.addPolygon(e);else if(e instanceof Pc)this.addLineString(e);else if(e instanceof Tc)this.addPoint(e);else if(e instanceof kc)this.addCollection(e);else if(e instanceof gc)this.addCollection(e);else if(e instanceof Dc)this.addCollection(e);else{if(!(e instanceof dc))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new Qf(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?qu.BOUNDARY:qu.INTERIOR},e}(Ih),id=function(){if(this._li=new _l,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new nd(0,t)}else if(2===arguments.length){var e=arguments[0],r=arguments[1],n=Tl.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nd(0,e,n),this._arg[1]=new nd(1,r,n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new nd(0,i,a),this._arg[1]=new nd(1,o,a)}};id.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},id.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},id.prototype.interfaces_=function(){return[]},id.prototype.getClass=function(){return id};var od=function(){};od.prototype.interfaces_=function(){return[]},od.prototype.getClass=function(){return od},od.map=function(){if(arguments[0]instanceof Sl&&Xu(arguments[1],od.MapOp)){for(var t=arguments[0],e=arguments[1],r=new Ul,n=0;n=t.size()?null:t.get(e)},fd.union=function(t){return new fd(t).union()},dd.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(fd,dd);var gd=function(){};function yd(){return new md}function md(){this.reset()}gd.prototype.interfaces_=function(){return[]},gd.prototype.getClass=function(){return gd},gd.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ad.createEmptyResult(ad.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),Bf.overlayOp(t,e,ad.UNION)},md.prototype={constructor:md,reset:function(){this.s=this.t=0},add:function(t){_d(vd,t,this.t),_d(this,vd.s,this.s),this.s?this.t+=vd.t:this.s=vd.t},valueOf:function(){return this.s}};var vd=new md;function _d(t,e,r){var n=t.s=e+r,i=n-e,o=n-i;t.t=e-o+(r-i)}var xd=1e-6,bd=Math.PI,wd=bd/2,Ed=bd/4,Id=2*bd,Sd=180/bd,Cd=bd/180,Pd=Math.abs,Md=Math.atan,Td=Math.atan2,Ld=Math.cos,Ad=Math.sin,kd=Math.sqrt;function Nd(t){return t>1?0:t<-1?bd:Math.acos(t)}function Dd(t){return t>1?wd:t<-1?-wd:Math.asin(t)}function Rd(){}function Od(t,e){t&&Ud.hasOwnProperty(t.type)&&Ud[t.type](t,e)}var zd,Fd,Bd={Feature:function(t,e){Od(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nbd?t-Id:t<-bd?t+Id:t,e]}function $d(t){return function(e,r){return[(e+=t)>bd?e-Id:e<-bd?e+Id:e,r]}}function Qd(t){var e=$d(t);return e.invert=$d(-t),e}function tg(t,e){var r=Ld(t),n=Ad(t),i=Ld(e),o=Ad(e);function a(t,e){var a=Ld(e),s=Ld(t)*a,u=Ad(t)*a,l=Ad(e),c=l*r+s*n;return[Td(u*i-c*o,s*r-l*n),Dd(c*i+u*o)]}return a.invert=function(t,e){var a=Ld(e),s=Ld(t)*a,u=Ad(t)*a,l=Ad(e),c=l*i-u*o;return[Td(u*i+l*o,s*r+c*n),Dd(c*r-s*n)]},a}function eg(t,e){(e=Gd(e))[0]-=t,Hd(e);var r=Nd(-e[1]);return((-e[2]<0?-r:r)+Id-xd)%Id}function rg(){var t,e=[];return{point:function(e,r){t.push([e,r])},lineStart:function(){e.push(t=[])},lineEnd:Rd,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function ng(t,e){return Pd(t[0]-e[0])=0;--o)i.point((c=l[o])[0],c[1]);else n(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,f=!f}while(!p.v);i.lineEnd()}}}function ag(t){if(e=t.length){for(var e,r,n=0,i=t[0];++ne?1:t>=e?0:NaN}Kd.invert=Kd;1===(zd=sg).length&&(Fd=zd,zd=function(t,e){return sg(Fd(t),e)});function ug(t){for(var e,r,n,i=t.length,o=-1,a=0;++o=0;)for(e=(n=t[i]).length;--e>=0;)r[--a]=n[e];return r}var lg=1e9,cg=-lg;var hg=yd();yd();function pg(t){return t}yd(),yd();var fg=1/0,dg=fg,gg=-fg,yg=gg,mg={point:function(t,e){tgg&&(gg=t);eyg&&(yg=e)},lineStart:Rd,lineEnd:Rd,polygonStart:Rd,polygonEnd:Rd,result:function(){var t=[[fg,dg],[gg,yg]];return gg=yg=-(dg=fg=1/0),t}};yd();function vg(t,e,r,n){return function(i,o){var a,s,u,l=e(o),c=i.invert(n[0],n[1]),h=rg(),p=e(h),f=!1,d={point:g,lineStart:m,lineEnd:v,polygonStart:function(){d.point=_,d.lineStart=x,d.lineEnd=b,s=[],a=[]},polygonEnd:function(){d.point=g,d.lineStart=m,d.lineEnd=v,s=ug(s);var t=function(t,e){var r=e[0],n=e[1],i=[Ad(r),-Ld(r),0],o=0,a=0;hg.reset();for(var s=0,u=t.length;s=0?1:-1,I=E*w,S=I>bd,C=d*x;if(hg.add(Td(C*E*Ad(I),g*b+C*Ld(I))),o+=S?w+E*Id:w,S^p>=r^v>=r){var P=Zd(Gd(h),Gd(m));Hd(P);var M=Zd(i,P);Hd(M);var T=(S^w>=0?-1:1)*Dd(M[2]);(n>T||n===T&&(P[0]||P[1]))&&(a+=S^w>=0?1:-1)}}return(o<-1e-6||o0){for(f||(o.polygonStart(),f=!0),o.lineStart(),t=0;t1&&2&i&&l.push(l.pop().concat(l.shift())),s.push(l.filter(_g))}return d}}function _g(t){return t.length>1}function xg(t,e){return((t=t.x)[0]<0?t[1]-wd-xd:wd-t[1])-((e=e.x)[0]<0?e[1]-wd-xd:wd-e[1])}var bg=vg((function(){return!0}),(function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?bd:-bd,u=Pd(o-r);Pd(u-bd)0?wd:-wd),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(o,n),e=0):i!==s&&u>=bd&&(Pd(r-i)xd?Md((Ad(e)*(o=Ld(n))*Ad(r)-Ad(n)*(i=Ld(e))*Ad(t))/(i*o*a)):(e+n)/2}(r,n,o,a),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=o,n=a),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}}),(function(t,e,r,n){var i;if(null==t)i=r*wd,n.point(-bd,i),n.point(0,i),n.point(bd,i),n.point(bd,0),n.point(bd,-i),n.point(0,-i),n.point(-bd,-i),n.point(-bd,0),n.point(-bd,i);else if(Pd(t[0]-e[0])>xd){var o=t[0]4*e&&g--){var x=a+p,b=s+f,w=u+d,E=kd(x*x+b*b+w*w),I=Dd(w/=E),S=Pd(Pd(w)-1)e||Pd((m*T+v*L)/_-.5)>.3||a*p+s*f+u*d0,i=Pd(r)>xd;function o(t,e){return Ld(t)*Ld(e)>r}function a(t,e,n){var i=[1,0,0],o=Zd(Gd(t),Gd(e)),a=Xd(o,o),s=o[0],u=a-s*s;if(!u)return!n&&t;var l=r*a/u,c=-r*s/u,h=Zd(i,o),p=Wd(i,l);Yd(p,Wd(o,c));var f=h,d=Xd(p,f),g=Xd(f,f),y=d*d-g*(Xd(p,p)-1);if(!(y<0)){var m=kd(y),v=Wd(f,(-d-m)/g);if(Yd(v,p),v=qd(v),!n)return v;var _,x=t[0],b=e[0],w=t[1],E=e[1];b0^v[1]<(Pd(v[0]-x)bd^(x<=v[0]&&v[0]<=b)){var C=Wd(f,(-d+m)/g);return Yd(C,p),[v,qd(C)]}}}function s(e,r){var i=n?t:bd-t,o=0;return e<-i?o|=1:e>i&&(o|=2),r<-i?o|=4:r>i&&(o|=8),o}return vg(o,(function(t){var e,r,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,p){var f,d=[h,p],g=o(h,p),y=n?g?0:s(h,p):g?s(h+(h<0?bd:-bd),p):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(f=a(e,d))||ng(e,f)||ng(d,f))&&(d[0]+=xd,d[1]+=xd,g=o(d[0],d[1])),g!==u)c=0,g?(t.lineStart(),f=a(d,e),t.point(f[0],f[1])):(f=a(e,d),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^g){var m;y&r||!(m=a(d,e,!0))||(c=0,n?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||e&&ng(e,d)||t.point(d[0],d[1]),e=d,u=g,r=y},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(r,n,i,o){!function(t,e,r,n,i,o){if(r){var a=Ld(e),s=Ad(e),u=n*r;null==i?(i=e+n*Id,o=e-u/2):(i=eg(a,i),o=eg(a,o),(n>0?io)&&(i+=n*Id));for(var l,c=i;n>0?c>o:c0)do{l.point(0===c||3===c?t:r,c>1?n:e)}while((c=(c+s+4)%4)!==h);else l.point(o[0],o[1])}function a(n,i){return Pd(n[0]-t)0?0:3:Pd(n[0]-r)0?2:1:Pd(n[1]-e)0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}return function(a){var u,l,c,h,p,f,d,g,y,m,v,_=a,x=rg(),b={point:w,lineStart:function(){b.point=E,l&&l.push(c=[]);m=!0,y=!1,d=g=NaN},lineEnd:function(){u&&(E(h,p),f&&y&&x.rejoin(),u.push(x.result()));b.point=w,y&&_.lineEnd()},polygonStart:function(){_=x,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,r=0,i=l.length;rn&&(p-o)*(n-a)>(f-a)*(t-o)&&++e:f<=n&&(p-o)*(n-a)<(f-a)*(t-o)&&--e;return e}(),r=v&&e,i=(u=ug(u)).length;(r||i)&&(a.polygonStart(),r&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&og(u,s,e,o,a),a.polygonEnd());_=a,u=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function E(o,a){var s=i(o,a);if(l&&c.push([o,a]),m)h=o,p=a,f=s,m=!1,s&&(_.lineStart(),_.point(o,a));else if(s&&y)_.point(o,a);else{var u=[d=Math.max(cg,Math.min(lg,d)),g=Math.max(cg,Math.min(lg,g))],x=[o=Math.max(cg,Math.min(lg,o)),a=Math.max(cg,Math.min(lg,a))];!function(t,e,r,n,i,o){var a,s=t[0],u=t[1],l=0,c=1,h=e[0]-s,p=e[1]-u;if(a=r-s,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a0)){if(a/=p,p<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-u,p||!(a<0)){if(a/=p,p<0){if(a>c)return;a>l&&(l=a)}else if(p>0){if(a0&&(t[0]=s+l*h,t[1]=u+l*p),c<1&&(e[0]=s+c*h,e[1]=u+c*p),!0}}}}}(u,x,t,e,r,n)?s&&(_.lineStart(),_.point(o,a),v=!1):(y||(_.lineStart(),_.point(u[0],u[1])),_.point(x[0],x[1]),s||_.lineEnd(),v=!1)}d=o,g=a,y=s}return b}}(b=+t[0][0],a=+t[0][1],s=+t[1][0],u=+t[1][1]),T()):null==b?null:[[b,a],[s,u]]},S.scale=function(t){return arguments.length?(h=+t,M()):h},S.translate=function(t){return arguments.length?(p=+t[0],f=+t[1],M()):[p,f]},S.center=function(t){return arguments.length?(d=t[0]%360*Cd,g=t[1]%360*Cd,M()):[d*Sd,g*Sd]},S.rotate=function(t){return arguments.length?(y=t[0]%360*Cd,m=t[1]%360*Cd,v=t.length>2?t[2]%360*Cd:0,M()):[y*Sd,m*Sd,v*Sd]},S.precision=function(t){return arguments.length?(I=Cg(P,E=t*t),T()):kd(E)},S.fitExtent=function(t,e){return Ig(S,t,e)},S.fitSize=function(t,e){return function(t,e,r){return Ig(t,[[0,0],e],r)}(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&C,M()}}((function(){return t}))()}var Tg=function(t,e){var r=Ld(t),n=Ld(e),i=function(t){return(t=Nd(t))&&t/Ad(t)}(r*n);return[i*n*Ad(t),i*Ad(e)]};function Lg(t,r,n,i){var a=t.properties||{},s="Feature"===t.type?t.geometry:t;if("GeometryCollection"===s.type){var u=[];return B(t,(function(t){var e=Lg(t,r,n,i);e&&u.push(e)})),f(u)}var l=function(t){var r=pr(t).geometry.coordinates,n=[-r[0],-r[1]];return Mg(Tg).scale(79.4188).clipAngle(179.999).rotate(n).scale(e)}(s),c={type:s.type,coordinates:kg(s.coordinates,l)},h=(new eh).read(c),p=_(x(r,n),"meters"),d=Wp.bufferOp(h,p,i);if(!Ag((d=(new rh).write(d)).coordinates))return o({type:d.type,coordinates:Ng(d.coordinates,l)},a)}function Ag(t){return Array.isArray(t[0])?Ag(t[0]):isNaN(t[0])}function kg(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return kg(t,e)}))}function Ng(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return Ng(t,e)}))}function Dg(t,e,r){void 0===r&&(r={});var n=nt(t),i=nt(e),o=Lu.intersection(n.coordinates,i.coordinates);return 0===o.length?null:1===o.length?l(o[0],r.properties):y(o,r.properties)}function Rg(t,e,r){void 0===r&&(r={});var n=JSON.stringify(r.properties||{}),i=t[0],o=t[1],a=t[2],s=t[3],u=(o+s)/2,l=(i+a)/2,c=2*e/ye([i,u],[a,u],r)*(a-i),h=2*e/ye([l,o],[l,s],r)*(s-o),p=c/2,d=2*p,g=Math.sqrt(3)/2*h,y=a-i,m=s-o,v=3/4*d,_=g,x=(y-d)/(d-p/2),b=Math.floor(x),w=(b*v-p/2-y)/2-p/2+v/2,E=Math.floor((m-g)/g),I=(m-E*g)/2,S=E*g-m>g/2;S&&(I-=g/4);for(var C=[],P=[],M=0;M<6;M++){var T=2*Math.PI/6*M;C.push(Math.cos(T)),P.push(Math.sin(T))}for(var L=[],A=0;A<=b;A++)for(var k=0;k<=E;k++){var N=A%2==1;if(!(0===k&&N||0===k&&S)){var D=A*v+i-w,R=k*_+o+I;if(N&&(R-=g/2),!0===r.triangles)zg([D,R],c/2,h/2,JSON.parse(n),C,P).forEach((function(t){r.mask?Dg(r.mask,t)&&L.push(t):L.push(t)}));else{var O=Og([D,R],c/2,h/2,JSON.parse(n),C,P);r.mask?Dg(r.mask,O)&&L.push(O):L.push(O)}}}return f(L)}function Og(t,e,r,n,i,o){for(var a=[],s=0;s<6;s++){var u=t[0]+e*i[s],c=t[1]+r*o[s];a.push([u,c])}return a.push(a[0].slice()),l([a],n)}function zg(t,e,r,n,i,o){for(var a=[],s=0;s<6;s++){var u=[];u.push(t),u.push([t[0]+e*i[s],t[1]+r*o[s]]),u.push([t[0]+e*i[(s+1)%6],t[1]+r*o[(s+1)%6]]),u.push(t),a.push(l([u],n))}return a}function Fg(t){return y(t)}function Bg(t,e,r){return void 0===r&&(r={}),function(t,e,r,n){void 0===n&&(n={});for(var i=[],o=t[0],a=t[1],s=t[2],u=t[3],c=e/ye([o,a],[s,a],n)*(s-o),h=r/ye([o,a],[o,u],n)*(u-a),p=s-o,d=u-a,g=Math.floor(p/c),y=Math.floor(d/h),m=(d-y*h)/2,v=o+(p-g*c)/2,_=0;_=i&&o===n.length-1);o++){if(i>=e){var a=e-i;if(a){var u=hr(n[o],n[o-1])-180;return lr(n[o],a,u,r)}return s(n[o])}i+=ye(n[o],n[o+1],r)}return s(n[n.length-1])},t.angle=function(t,e,r,n){if(void 0===n&&(n={}),!M(n))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!r)throw new Error("endPoint is required");var i=t,o=e,a=r,s=w(!0!==n.mercator?hr(i,o):wi(i,o)),u=w(!0!==n.mercator?hr(a,o):wi(a,o)),l=Math.abs(s-u);return!0===n.explementary?360-l:l},t.applyFilter=Bs,t.area=Sn,t.areaFactors=i,t.bbox=J,t.bboxClip=function(t,e){var r=nt(t),n=r.type,i="Feature"===t.type?t.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":var a=[];return"LineString"===n&&(o=[o]),o.forEach((function(t){!function(t,e,r){var n,i,o,a,s,u=t.length,l=di(t[0],e),c=[];for(r||(r=[]),n=1;n0)for(var r=0;r0},t.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==ba(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==ba(e,"line2"))throw new Error("line2 must be a LineString");for(var r=Vr(Ye(t)).features,n=Vr(Ye(e)).features,i=0;ir&&(e.numberOfClusters=r),!0!==e.mutate&&(t=be(t));var n=F(t),i=n.slice(0,e.numberOfClusters),o=_a(n,e.numberOfClusters,i),a={};return o.centroids.forEach((function(t,e){a[e]=t})),O(t,(function(t,e){var r=o.idxs[e];t.properties.cluster=r,t.properties.centroid=a[r]})),t},t.collect=function(t,e,r,n){var i=Et(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[r]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=J(t),r=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];r.forEach((function(e){fe([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[n]=o})),t},t.collectionOf=rt,t.combine=function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return O(t,(function(t){var r,n,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(n=e.MultiLineString.coordinates).push.apply(n,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),f(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return o({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},t.concave=function(t,e){void 0===e&&(e={});var r=e.maxEdge||1/0,n=me(function(t){var e=[],r={};return O(t,(function(t){if(t.geometry){var n=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(r,n)||(e.push(t),r[n]=!0)}})),f(e)}(t));if(n.features=n.features.filter((function(t){var n=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],a=ye(n,i,e),s=ye(i,o,e),u=ye(n,o,e);return a<=r&&s<=r&&u<=r})),n.features.length<1)return null;var i=Ze(n);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),o(i)},t.containsNumber=Q,t.convertArea=C,t.convertDistance=S,t.convertLength=S,t.convex=pe,t.coordAll=F,t.coordEach=k,t.coordReduce=N,t.createBins=Fs,t.degrees2radians=I,t.degreesToRadians=I,t.destination=lr,t.difference=function(t,e){var r=nt(t),n=nt(e),i=t.properties||{},o=Lu.difference(r.coordinates,n.coordinates);return 0===o.length?null:1===o.length?l(o[0],i):y(o,i)},t.dissolve=function(t,e){if(!M(e=e||{}))throw new Error("options is invalid");var r=e.propertyName;rt(t,"Polygon","dissolve");var n=[];if(!e.propertyName)return Bn(y(Lu.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};O(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[r])||(i[t.properties[r]]=[]),i[t.properties[r]].push(t)}));for(var o=Object.keys(i),a=0;a0&&(a=l(o).geometry),ms(a,s),o=s.slice(0);r.push(l(o,i));break;case"MultiPolygon":o=[[[]]];for(var c=0;c0&&(a=y(o).geometry),vs(a,s),o=s.slice(0);r.push(y(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),f(r)},t.polygonTangents=function(t,e){var r,n,i,o,a=$(t),u=$(e),l=J(e),c=0,h=null;switch(a[0]>l[0]&&a[0]l[1]&&a[1] is required");if("boolean"!=typeof r)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=be(t));var i=[];switch(t.type){case"GeometryCollection":return B(t,(function(t){Ti(t,r)})),t;case"FeatureCollection":return O(t,(function(t){O(Ti(t,r),(function(t){i.push(t)}))})),f(i)}return Ti(t,r)},t.rhumbBearing=wi,t.rhumbDestination=Ii,t.rhumbDistance=mn,t.round=v,t.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");return f(function(t,e){for(var r,n,i=t.slice(0),o=t.length,a=o-e;o-- >a;)r=i[n=Math.floor((o+1)*Math.random())],i[n]=i[o],i[o]=r;return i.slice(a)}(t.features,e))},t.sector=function(t,e,r,n,i){if(!M(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==n)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(bi(r)===bi(n))return cr(t,e,i);var a=$(t),s=ii(t,e,r,n,i),u=[[a]];return k(s,(function(t){u[0].push(t)})),u[0].push(a),l(u,o)},t.segmentEach=q,t.segmentReduce=G,t.shortestPath=function(t,e,r){if(!M(r=r||{}))throw new Error("options is invalid");var n=r.resolution,i=r.minDistance,a=r.obstacles||f([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(n&&!P(n)||n<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var u=K(t),l=K(e);switch(t=s(u),e=s(l),it(a)){case"FeatureCollection":if(0===a.features.length)return h([u,l]);break;case"Polygon":a=f([o(nt(a))]);break;default:throw new Error("invalid obstacles")}var c=a;c.features.push(t),c.features.push(e);var p=J(Ro(ar(J(c)),1.15));n||(n=ye([p[0],p[1]],[p[2],p[1]],r)/100),c.features.pop(),c.features.pop();for(var d=p[0],g=p[1],y=p[2],m=p[3],v=n/ye([d,g],[y,g],r)*(y-d),_=n/ye([d,g],[d,m],r)*(m-g),x=y-d,b=m-g,w=Math.floor(x/v),E=Math.floor(b/_),I=(x-w*v)/2,S=[],C=[],T=[],L=[],A=1/0,k=1/0,N=m-(b-E*_)/2,D=0;N>=g;){for(var R=[],O=[],z=d+I,F=0;z<=y;){var B=s([z,N]),U=Pa(B,a);R.push(U?0:1),O.push(z+"|"+N);var j=ye(B,t);!U&&j(n=1))return n;for(;ro?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var i=o;function o(t,e){this.x=t,this.y=e}o.prototype={clone:function(){return new o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},o.convert=function(t){return t instanceof o?t:Array.isArray(t)?new o(t[0],t[1]):t};var a="undefined"!=typeof self?self:{},s=Math.pow(2,53)-1;function u(t,e,n,i){var o=new r(t,e,n,i);return function(t){return o.solve(t)}}var l=u(.25,.1,.25,1);function c(t,e,r){return Math.min(r,Math.max(e,t))}function h(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function p(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n>e/4).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function y(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function m(t,e){t.forEach((function(t){e[t]&&(e[t]=e[t].bind(e))}))}function v(t,e){return-1!==t.indexOf(e,t.length-e.length)}function _(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n}function x(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function b(t){return Array.isArray(t)?t.map(b):"object"==typeof t&&t?_(t,b):t}var w={};function E(t){w[t]||("undefined"!=typeof console&&console.warn(t),w[t]=!0)}function I(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function S(t){for(var e=0,r=0,n=t.length,i=n-1,o=void 0,a=void 0;r@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(function(t,r,n,i){var o=n||i;return e[r]=!o||o.toLowerCase(),""})),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}var M=null;function T(t){if(null==M){var e=t.navigator?t.navigator.userAgent:null;M=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return M}function L(t){try{var e=a[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}var A,k,N,D,R=a.performance&&a.performance.now?a.performance.now.bind(a.performance):Date.now.bind(Date),O=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,z=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,F={now:R,frame:function(t){var e=O(t);return{cancel:function(){return z(e)}}},getImageData:function(t,e){void 0===e&&(e=0);var r=a.document.createElement("canvas"),n=r.getContext("2d");if(!n)throw new Error("failed to create canvas 2d context");return r.width=t.width,r.height=t.height,n.drawImage(t,0,0,t.width,t.height),n.getImageData(-e,-e,t.width+2*e,t.height+2*e)},resolveURL:function(t){return A||(A=a.document.createElement("a")),A.href=t,A.href},hardwareConcurrency:a.navigator&&a.navigator.hardwareConcurrency||4,get devicePixelRatio(){return a.devicePixelRatio},get prefersReducedMotion(){return!!a.matchMedia&&(null==k&&(k=a.matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}},B={API_URL:"https://api.mapbox.com",get EVENTS_URL(){return this.API_URL?0===this.API_URL.indexOf("https://api.mapbox.cn")?"https://events.mapbox.cn/events/v2":0===this.API_URL.indexOf("https://api.mapbox.com")?"https://events.mapbox.com/events/v2":null:null},FEEDBACK_URL:"https://apps.mapbox.com/feedback",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},U={supported:!1,testSupport:function(t){!j&&D&&(V?q(t):N=t)}},j=!1,V=!1;function q(t){var e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,D),t.isContextLost())return;U.supported=!0}catch(t){}t.deleteTexture(e),j=!0}a.document&&((D=a.document.createElement("img")).onload=function(){N&&q(N),N=null,V=!0},D.onerror=function(){j=!0,N=null},D.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");var G="01",X=function(t,e){this._transformRequestFn=t,this._customAccessToken=e,this._createSkuToken()};function Z(t){return 0===t.indexOf("mapbox:")}X.prototype._createSkuToken=function(){var t=function(){for(var t="",e=0;e<10;e++)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",G,t].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt},X.prototype._isSkuTokenExpired=function(){return Date.now()>this._skuTokenExpiresAt},X.prototype.transformRequest=function(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}},X.prototype.normalizeStyleURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/styles/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeGlyphsURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/fonts/v1"+r.path,this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeSourceURL=function(t,e){if(!Z(t))return t;var r=J(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),this._makeAPIURL(r,this._customAccessToken||e)},X.prototype.normalizeSpriteURL=function(t,e,r,n){var i=J(t);return Z(t)?(i.path="/styles/v1"+i.path+"/sprite"+e+r,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=""+e+r,K(i))},X.prototype.normalizeTileURL=function(t,e){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Z(t))return t;var r=J(t);r.path=r.path.replace(/(\.(png|jpg)\d*)(?=$)/,(F.devicePixelRatio>=2||512===e?"@2x":"")+(U.supported?".webp":"$1")),r.path=r.path.replace(/^.+\/v4\//,"/"),r.path="/v4"+r.path;var n=this._customAccessToken||function(t){for(var e=0,r=t;e=0&&t.params.splice(i,1)}if("/"!==n.path&&(t.path=""+n.path+t.path),!B.REQUIRE_ACCESS_TOKEN)return K(t);if(!(e=e||B.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+r);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+r);return t.params=t.params.filter((function(t){return-1===t.indexOf("access_token")})),t.params.push("access_token="+e),K(t)},X.prototype.setTransformRequest=function(t){this._transformRequestFn=t};var Y=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;function W(t){return Y.test(t)}var H=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function J(t){var e=t.match(H);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function K(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}function $(t){if(!t)return null;var e=t.split(".");if(!e||3!==e.length)return null;try{return JSON.parse(decodeURIComponent(a.atob(e[1]).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join("")))}catch(t){return null}}var Q=function(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null};Q.prototype.getStorageKey=function(t){var e,r=$(B.ACCESS_TOKEN);return e=r&&r.u?a.btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(function(t,e){return String.fromCharCode(Number("0x"+e))}))):B.ACCESS_TOKEN||"",t?"mapbox.eventData."+t+":"+e:"mapbox.eventData:"+e},Q.prototype.fetchEventData=function(){var t=L("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{var n=a.localStorage.getItem(e);n&&(this.eventData=JSON.parse(n));var i=a.localStorage.getItem(r);i&&(this.anonId=i)}catch(t){E("Unable to read from LocalStorage")}},Q.prototype.saveEventData=function(){var t=L("localStorage"),e=this.getStorageKey(),r=this.getStorageKey("uuid");if(t)try{a.localStorage.setItem(r,this.anonId),Object.keys(this.eventData).length>=1&&a.localStorage.setItem(e,JSON.stringify(this.eventData))}catch(t){E("Unable to write to LocalStorage")}},Q.prototype.processRequests=function(t){},Q.prototype.postEvent=function(t,e,r,n){var i=this;if(B.EVENTS_URL){var o=J(B.EVENTS_URL);o.params.push("access_token="+(n||B.ACCESS_TOKEN||""));var a={event:this.type,created:new Date(t).toISOString(),sdkIdentifier:"mapbox-gl-js",sdkVersion:"1.15.2",skuId:G,userId:this.anonId},s=e?p(a,e):a,u={url:K(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([s])};this.pendingRequest=wt(u,(function(t){i.pendingRequest=null,r(t),i.saveEventData(),i.processRequests(n)}))}},Q.prototype.queueRequest=function(t,e){this.queue.push(t),this.processRequests(e)};var tt,et,rt=function(t){function e(){t.call(this,"map.load"),this.success={},this.skuToken=""}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postMapLoadEvent=function(t,e,r,n){this.skuToken=r,(B.EVENTS_URL&&n||B.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||W(t)})))&&this.queueRequest({id:e,timestamp:Date.now()},n)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){var r=this.queue.shift(),n=r.id,i=r.timestamp;n&&this.success[n]||(this.anonId||this.fetchEventData(),y(this.anonId)||(this.anonId=g()),this.postEvent(i,{skuToken:this.skuToken},(function(t){t||n&&(e.success[n]=!0)}),t))}},e}(Q),nt=new(function(t){function e(e){t.call(this,"appUserTurnstile"),this._customAccessToken=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.postTurnstileEvent=function(t,e){B.EVENTS_URL&&B.ACCESS_TOKEN&&Array.isArray(t)&&t.some((function(t){return Z(t)||W(t)}))&&this.queueRequest(Date.now(),e)},e.prototype.processRequests=function(t){var e=this;if(!this.pendingRequest&&0!==this.queue.length){this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();var r=$(B.ACCESS_TOKEN),n=r?r.u:B.ACCESS_TOKEN,i=n!==this.eventData.tokenU;y(this.anonId)||(this.anonId=g(),i=!0);var o=this.queue.shift();if(this.eventData.lastSuccess){var a=new Date(this.eventData.lastSuccess),s=new Date(o),u=(o-this.eventData.lastSuccess)/864e5;i=i||u>=1||u<-1||a.getDate()!==s.getDate()}else i=!0;if(!i)return this.processRequests();this.postEvent(o,{"enabled.telemetry":!1},(function(t){t||(e.eventData.lastSuccess=o,e.eventData.tokenU=n)}),t)}},e}(Q)),it=nt.postTurnstileEvent.bind(nt),ot=new rt,at=ot.postMapLoadEvent.bind(ot),st=500,ut=50;function lt(){a.caches&&!tt&&(tt=a.caches.open("mapbox-tiles"))}function ct(t){var e=t.indexOf("?");return e<0?t:t.slice(0,e)}var ht,pt=1/0;function ft(){return null==ht&&(ht=a.OffscreenCanvas&&new a.OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof a.createImageBitmap),ht}var dt={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};"function"==typeof Object.freeze&&Object.freeze(dt);var gt=function(t){function e(e,r,n){401===r&&W(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://www.mapbox.com/api-documentation/#access-tokens-and-token-scopes"),t.call(this,e),this.status=r,this.url=n,this.name=this.constructor.name,this.message=e}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.toString=function(){return this.name+": "+this.message+" ("+this.status+"): "+this.url},e}(Error),yt=C()?function(){return self.worker&&self.worker.referrer}:function(){return("blob:"===a.location.protocol?a.parent:a).location.href};function mt(t,e){var r,n=new a.AbortController,i=new a.Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:yt(),signal:n.signal}),o=!1,s=!1,u=(r=i.url).indexOf("sku=")>0&&W(r);"json"===t.type&&i.headers.set("Accept","application/json");var l=function(r,n,o){if(!s){if(r&&"SecurityError"!==r.message&&E(r),n&&o)return c(n);var l=Date.now();a.fetch(i).then((function(r){if(r.ok){var n=u?r.clone():null;return c(r,n,l)}return e(new gt(r.statusText,r.status,t.url))})).catch((function(t){20!==t.code&&e(new Error(t.message))}))}},c=function(r,n,u){("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((function(t){s||(n&&u&&function(t,e,r){if(lt(),tt){var n={status:e.status,statusText:e.statusText,headers:new a.Headers};e.headers.forEach((function(t,e){return n.headers.set(e,t)}));var i=P(e.headers.get("Cache-Control")||"");i["no-store"]||(i["max-age"]&&n.headers.set("Expires",new Date(r+1e3*i["max-age"]).toUTCString()),new Date(n.headers.get("Expires")).getTime()-r<42e4||function(t,e){if(void 0===et)try{new Response(new ReadableStream),et=!0}catch(t){et=!1}et?e(t.body):t.blob().then(e)}(e,(function(e){var r=new a.Response(e,n);lt(),tt&&tt.then((function(e){return e.put(ct(t.url),r)})).catch((function(t){return E(t.message)}))})))}}(i,n,u),o=!0,e(null,t,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((function(t){s||e(new Error(t.message))}))};return u?function(t,e){if(lt(),!tt)return e(null);var r=ct(t.url);tt.then((function(t){t.match(r).then((function(n){var i=function(t){if(!t)return!1;var e=new Date(t.headers.get("Expires")||0),r=P(t.headers.get("Cache-Control")||"");return e>Date.now()&&!r["no-cache"]}(n);t.delete(r),i&&t.put(r,n.clone()),e(null,n,i)})).catch(e)})).catch(e)}(i,l):l(null,null),{cancel:function(){s=!0,o||n.abort()}}}var vt,_t,xt=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!C()){var r=t.url.substring(0,t.url.indexOf("://"));return(B.REGISTERED_PROTOCOLS[r]||mt)(t,e)}}if(!(/^file:/.test(n=t.url)||/^file:/.test(yt())&&!/^\w+:/.test(n))){if(a.fetch&&a.Request&&a.AbortController&&a.Request.prototype.hasOwnProperty("signal"))return mt(t,e);if(C()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var n;return function(t,e){var r=new a.XMLHttpRequest;for(var n in r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer"),t.headers)r.setRequestHeader(n,t.headers[n]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){var n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else e(new gt(r.statusText,r.status,t.url))},r.send(t.body),{cancel:function(){return r.abort()}}}(t,e)},bt=function(t,e){return xt(p(t,{type:"arrayBuffer"}),e)},wt=function(t,e){return xt(p(t,{method:"POST"}),e)},Et="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";vt=[],_t=0;var It=function(t,e){if(U.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),_t>=B.MAX_PARALLEL_IMAGE_REQUESTS){var r={requestParameters:t,callback:e,cancelled:!1,cancel:function(){this.cancelled=!0}};return vt.push(r),r}_t++;var n=!1,i=function(){if(!n)for(n=!0,_t--;vt.length&&_t0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},Tt.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this};var Lt={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}},At=function(t,e,r,n){this.message=(t?t+": ":"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)};function kt(t){var e=t.value;return e?[new At(t.key,e,"constants have been deprecated as of v8")]:[]}function Nt(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];for(var n=0,i=e;n":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var Jt=[Ft,Bt,Ut,jt,Vt,Zt,qt,Wt(Gt),Yt];function Kt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Kt(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var r=0,n=Jt;r255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function a(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{e.parseCSSColor=function(t){var e,s=t.replace(/ /g,"").toLowerCase();if(s in r)return r[s].slice();if("#"===s[0])return 4===s.length?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===s.length&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var u=s.indexOf("("),l=s.indexOf(")");if(-1!==u&&l+1===s.length){var c=s.substr(0,u),h=s.substr(u+1,l-(u+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=o(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),p];case"hsla":if(4!==h.length)return null;p=o(h.pop());case"hsl":if(3!==h.length)return null;var f=(parseFloat(h[0])%360+360)%360/360,d=o(h[1]),g=o(h[2]),y=g<=.5?g*(d+1):g+d-g*d,m=2*g-y;return[n(255*a(m,y,f+1/3)),n(255*a(m,y,f)),n(255*a(m,y,f-1/3)),p];default:return null}}return null}}catch(t){}})).parseCSSColor,ee=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};ee.parse=function(t){if(t){if(t instanceof ee)return t;if("string"==typeof t){var e=te(t);if(e)return new ee(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},ee.prototype.toString=function(){var t=this.toArray(),e=t[1],r=t[2],n=t[3];return"rgba("+Math.round(t[0])+","+Math.round(e)+","+Math.round(r)+","+n+")"},ee.prototype.toArray=function(){var t=this.a;return 0===t?[0,0,0,0]:[255*this.r/t,255*this.g/t,255*this.b/t,t]},ee.black=new ee(0,0,0,1),ee.white=new ee(1,1,1,1),ee.transparent=new ee(0,0,0,0),ee.red=new ee(1,0,0,1);var re=function(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})};re.prototype.compare=function(t,e){return this.collator.compare(t,e)},re.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ne=function(t,e,r,n,i){this.text=t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i},ie=function(t){this.sections=t};ie.fromString=function(t){return new ie([new ne(t,null,null,null,null)])},ie.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},ie.factory=function(t){return t instanceof ie?t:ie.fromString(t)},ie.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},ie.prototype.serialize=function(){for(var t=["format"],e=0,r=this.sections;e=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function se(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof ee)return!0;if(t instanceof re)return!0;if(t instanceof ie)return!0;if(t instanceof oe)return!0;if(Array.isArray(t)){for(var e=0,r=t;e2){var s=t[1];if("string"!=typeof s||!(s in pe)||"object"===s)return e.error('The item type argument of "array" must be one of string, number, boolean',1);o=pe[s],n++}else o=Gt;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);a=t[2],n++}r=Wt(o,a)}else r=pe[i];for(var u=[];n1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var de=function(t){this.type=Zt,this.sections=t};de.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");for(var n=[],i=!1,o=1;o<=t.length-1;++o){var a=t[o];if(i&&"object"==typeof a&&!Array.isArray(a)){i=!1;var s=null;if(a["font-scale"]&&!(s=e.parse(a["font-scale"],1,Bt)))return null;var u=null;if(a["text-font"]&&!(u=e.parse(a["text-font"],1,Wt(Ut))))return null;var l=null;if(a["text-color"]&&!(l=e.parse(a["text-color"],1,Vt)))return null;var c=n[n.length-1];c.scale=s,c.font=u,c.textColor=l}else{var h=e.parse(t[o],1,Gt);if(!h)return null;var p=h.type.kind;if("string"!==p&&"value"!==p&&"null"!==p&&"resolvedImage"!==p)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:h,scale:null,font:null,textColor:null})}}return new de(n)},de.prototype.evaluate=function(t){return new ie(this.sections.map((function(e){var r=e.content.evaluate(t);return ue(r)===Yt?new ne("",r,null,null,null):new ne(le(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},de.prototype.eachChild=function(t){for(var e=0,r=this.sections;e-1),r},ge.prototype.eachChild=function(t){t(this.input)},ge.prototype.outputDefined=function(){return!1},ge.prototype.serialize=function(){return["image",this.input.serialize()]};var ye={"to-boolean":jt,"to-color":Vt,"to-number":Bt,"to-string":Ut},me=function(t,e){this.type=t,this.args=e};me.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var r=t[0];if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");for(var n=ye[r],i=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":ae(e[0],e[1],e[2],e[3])))return new ee(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new he(r||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var a=null,s=0,u=this.args;s=e[2]||t[1]<=e[1]||t[3]>=e[3])}function Ie(t,e){var r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*8192),Math.round(n*i*8192)]}function Se(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function Ce(t,e){for(var r,n,i,o,a,s,u,l=!1,c=0,h=e.length;c0&&s<0||a<0&&s>0}function Te(t,e,r){for(var n=0,i=r;nr[2]){var i=.5*n,o=t[0]-r[0]>i?-n:r[0]-t[0]>i?n:0;0===o&&(o=t[0]-r[2]>i?-n:r[2]-t[0]>i?n:0),t[0]+=o}we(e,t)}function Re(t,e,r,n){for(var i=8192*Math.pow(2,n.z),o=[8192*n.x,8192*n.y],a=[],s=0,u=t;s=0)return!1;var r=!0;return t.eachChild((function(t){r&&!Ue(t,e)&&(r=!1)})),r}ze.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(se(t[1])){var r=t[1];if("FeatureCollection"===r.type)for(var n=0;ne))throw new he("Input is not a number.");o=a-1}return 0}Ve.prototype.parse=function(t,e,r,n,i){return void 0===i&&(i={}),e?this.concat(e,r,n)._parse(t,i):this._parse(t,i)},Ve.prototype._parse=function(t,e){function r(t,e,r){return"assert"===r?new fe(e,[t]):"coerce"===r?new me(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var i=this.registry[n];if(i){var o=i.parse(t,this);if(!o)return null;if(this.expectedType){var a=this.expectedType,s=o.type;if("string"!==a.kind&&"number"!==a.kind&&"boolean"!==a.kind&&"object"!==a.kind&&"array"!==a.kind||"value"!==s.kind)if("color"!==a.kind&&"formatted"!==a.kind&&"resolvedImage"!==a.kind||"value"!==s.kind&&"string"!==s.kind){if(this.checkSubtype(a,s))return null}else o=r(o,a,e.typeAnnotation||"coerce");else o=r(o,a,e.typeAnnotation||"assert")}if(!(o instanceof ce)&&"resolvedImage"!==o.type.kind&&function t(e){if(e instanceof je)return t(e.boundExpression);if(e instanceof xe&&"error"===e.name)return!1;if(e instanceof be)return!1;if(e instanceof ze)return!1;var r=e instanceof me||e instanceof fe,n=!0;return e.eachChild((function(e){n=r?n&&t(e):n&&e instanceof ce})),!!n&&Fe(e)&&Ue(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}(o)){var u=new _e;try{o=new ce(o.type,o.evaluate(u))}catch(t){return this.error(t.message),null}}return o}return this.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':"Expected an array, but found "+typeof t+" instead.")},Ve.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new Ve(this.registry,n,e||null,i,this.errors)},Ve.prototype.error=function(t){for(var e=[],r=arguments.length-1;r-- >0;)e[r]=arguments[r+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Ot(n,t))},Ve.prototype.checkSubtype=function(t,e){var r=Kt(t,e);return r&&this.error(r),r};var Ge=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=a)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);var c=e.parse(s,l,i);if(!c)return null;i=i||c.type,n.push([a,c])}return new Ge(i,r,n)},Ge.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[qe(e,n)].evaluate(t)},Ge.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var Ze=Object.freeze({__proto__:null,number:Xe,color:function(t,e,r){return new ee(Xe(t.r,e.r,r),Xe(t.g,e.g,r),Xe(t.b,e.b,r),Xe(t.a,e.a,r))},array:function(t,e,r){return t.map((function(t,n){return Xe(t,e[n],r)}))}}),Ye=6/29*3*(6/29),We=Math.PI/180,He=180/Math.PI;function Je(t){return t>.008856451679035631?Math.pow(t,1/3):t/Ye+4/29}function Ke(t){return t>6/29?t*t*t:Ye*(t-4/29)}function $e(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Qe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function tr(t){var e=Qe(t.r),r=Qe(t.g),n=Qe(t.b),i=Je((.4124564*e+.3575761*r+.1804375*n)/.95047),o=Je((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*o-16,a:500*(i-o),b:200*(o-Je((.0193339*e+.119192*r+.9503041*n)/1.08883)),alpha:t.a}}function er(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Ke(e),r=.95047*Ke(r),n=1.08883*Ke(n),new ee($e(3.2404542*r-1.5371385*e-.4985314*n),$e(-.969266*r+1.8760108*e+.041556*n),$e(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function rr(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}var nr={forward:tr,reverse:er,interpolate:function(t,e,r){return{l:Xe(t.l,e.l,r),a:Xe(t.a,e.a,r),b:Xe(t.b,e.b,r),alpha:Xe(t.alpha,e.alpha,r)}}},ir={forward:function(t){var e=tr(t),r=e.l,n=e.a,i=e.b,o=Math.atan2(i,n)*He;return{h:o<0?o+360:o,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*We,r=t.c;return er({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:rr(t.h,e.h,r),c:Xe(t.c,e.c,r),l:Xe(t.l,e.l,r),alpha:Xe(t.alpha,e.alpha,r)}}},or=Object.freeze({__proto__:null,lab:nr,hcl:ir}),ar=function(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(var o=0,a=i;o1})))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:s}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(i=e.parse(i,2,Bt)))return null;var u=[],l=null;"interpolate-hcl"===r||"interpolate-lab"===r?l=Vt:e.expectedType&&"value"!==e.expectedType.kind&&(l=e.expectedType);for(var c=0;c=h)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',f);var g=e.parse(p,d,l);if(!g)return null;l=l||g.type,u.push([h,g])}return"number"===l.kind||"color"===l.kind||"array"===l.kind&&"number"===l.itemType.kind&&"number"==typeof l.N?new ar(l,r,n,i,u):e.error("Type "+Ht(l)+" is not interpolatable.")},ar.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=qe(e,n),a=ar.interpolationFactor(this.interpolation,n,e[o],e[o+1]),s=r[o].evaluate(t),u=r[o+1].evaluate(t);return"interpolate"===this.operator?Ze[this.type.kind.toLowerCase()](s,u,a):"interpolate-hcl"===this.operator?ir.reverse(ir.interpolate(ir.forward(s),ir.forward(u),a)):nr.reverse(nr.interpolate(nr.forward(s),nr.forward(u),a))},ar.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e=r.length)throw new he("Array index out of bounds: "+e+" > "+(r.length-1)+".");if(e!==Math.floor(e))throw new he("Array index must be an integer, but found "+e+" instead.");return r[e]},cr.prototype.eachChild=function(t){t(this.index),t(this.input)},cr.prototype.outputDefined=function(){return!1},cr.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var hr=function(t,e){this.type=jt,this.needle=t,this.haystack=e};hr.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Gt),n=e.parse(t[2],2,Gt);return r&&n?$t(r.type,[jt,Ut,Bt,Ft,Gt])?new hr(r,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead"):null},hr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Qt(e,["boolean","string","number","null"]))throw new he("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new he("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");return r.indexOf(e)>=0},hr.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},hr.prototype.outputDefined=function(){return!0},hr.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var pr=function(t,e,r){this.type=Bt,this.needle=t,this.haystack=e,this.fromIndex=r};pr.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Gt),n=e.parse(t[2],2,Gt);if(!r||!n)return null;if(!$t(r.type,[jt,Ut,Bt,Ft,Gt]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Bt);return i?new pr(r,n,i):null}return new pr(r,n)},pr.prototype.evaluate=function(t){var e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Qt(e,["boolean","string","number","null"]))throw new he("Expected first argument to be of type boolean, string, number or null, but found "+Ht(ue(e))+" instead.");if(!Qt(r,["string","array"]))throw new he("Expected second argument to be of type array or string, but found "+Ht(ue(r))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)},pr.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},pr.prototype.outputDefined=function(){return!1},pr.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var fr=function(t,e,r,n,i,o){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=o};fr.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var i={},o=[],a=2;aNumber.MAX_SAFE_INTEGER)return l.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof p&&Math.floor(p)!==p)return l.error("Numeric branch labels must be integer values.");if(r){if(l.checkSubtype(r,ue(p)))return null}else r=ue(p);if(void 0!==i[String(p)])return l.error("Branch labels must be unique.");i[String(p)]=o.length}var f=e.parse(u,a,n);if(!f)return null;n=n||f.type,o.push(f)}var d=e.parse(t[1],1,Gt);if(!d)return null;var g=e.parse(t[t.length-1],t.length-1,n);return g?"value"!==d.type.kind&&e.concat(1).checkSubtype(r,d.type)?null:new fr(r,n,d,i,o,g):null},fr.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(ue(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},fr.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},fr.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},fr.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],r=[],n={},i=0,o=Object.keys(this.cases).sort();i=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1,Gt),n=e.parse(t[2],2,Bt);if(!r||!n)return null;if(!$t(r.type,[Wt(Gt),Ut,Gt]))return e.error("Expected first argument to be of type array or string, but found "+Ht(r.type)+" instead");if(4===t.length){var i=e.parse(t[3],3,Bt);return i?new gr(r.type,r,n,i):null}return new gr(r.type,r,n)},gr.prototype.evaluate=function(t){var e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Qt(e,["string","array"]))throw new he("Expected first argument to be of type array or string, but found "+Ht(ue(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)},gr.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},gr.prototype.outputDefined=function(){return!1},gr.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var _r=vr("==",(function(t,e,r){return e===r}),mr),xr=vr("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!mr(0,e,r,n)})),br=vr("<",(function(t,e,r){return e",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),Er=vr("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),Ir=vr(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0})),Sr=function(t,e,r,n,i){this.type=Ut,this.number=t,this.locale=e,this.currency=r,this.minFractionDigits=n,this.maxFractionDigits=i};Sr.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var r=e.parse(t[1],1,Bt);if(!r)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var i=null;if(n.locale&&!(i=e.parse(n.locale,1,Ut)))return null;var o=null;if(n.currency&&!(o=e.parse(n.currency,1,Ut)))return null;var a=null;if(n["min-fraction-digits"]&&!(a=e.parse(n["min-fraction-digits"],1,Bt)))return null;var s=null;return n["max-fraction-digits"]&&!(s=e.parse(n["max-fraction-digits"],1,Bt))?null:new Sr(r,i,o,a,s)},Sr.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Sr.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Sr.prototype.outputDefined=function(){return!1},Sr.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Cr=function(t){this.type=Bt,this.input=t};Cr.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error("Expected argument of type string or array, but found "+Ht(r.type)+" instead."):new Cr(r):null},Cr.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new he("Expected value to be of type string or array, but found "+Ht(ue(e))+" instead.")},Cr.prototype.eachChild=function(t){t(this.input)},Cr.prototype.outputDefined=function(){return!1},Cr.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Pr={"==":_r,"!=":xr,">":wr,"<":br,">=":Ir,"<=":Er,array:fe,at:cr,boolean:fe,case:dr,coalesce:ur,collator:be,format:de,image:ge,in:hr,"index-of":pr,interpolate:ar,"interpolate-hcl":ar,"interpolate-lab":ar,length:Cr,let:lr,literal:ce,match:fr,number:fe,"number-format":Sr,object:fe,slice:gr,step:Ge,string:fe,"to-boolean":me,"to-color":me,"to-number":me,"to-string":me,var:je,within:ze};function Mr(t,e){var r=e[0],n=e[1],i=e[2],o=e[3];r=r.evaluate(t),n=n.evaluate(t),i=i.evaluate(t);var a=o?o.evaluate(t):1,s=ae(r,n,i,a);if(s)throw new he(s);return new ee(r/255*a,n/255*a,i/255*a,a)}function Tr(t,e){return t in e}function Lr(t,e){var r=e[t];return void 0===r?null:r}function Ar(t){return{type:t}}function kr(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}function Dr(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}function Rr(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Or(t){return!!t.expression&&t.expression.interpolated}function zr(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}function Fr(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Br(t){return t}function Ur(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function jr(t,e,r,n,i){return Ur(typeof r===i?n[r]:void 0,t.default,e.default)}function Vr(t,e,r){if("number"!==zr(r))return Ur(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var i=qe(t.stops.map((function(t){return t[0]})),r);return t.stops[i][1]}function qr(t,e,r){var n=void 0!==t.base?t.base:1;if("number"!==zr(r))return Ur(t.default,e.default);var i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];var o=qe(t.stops.map((function(t){return t[0]})),r),a=function(t,e,r,n){var i=n-r,o=t-r;return 0===i?0:1===e?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],u=t.stops[o+1][1],l=Ze[e.type]||Br;if(t.colorSpace&&"rgb"!==t.colorSpace){var c=or[t.colorSpace];l=function(t,e){return c.reverse(c.interpolate(c.forward(t),c.forward(e),a))}}return"function"==typeof s.evaluate?{evaluate:function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var r=s.evaluate.apply(void 0,t),n=u.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return l(r,n,a)}}:l(s,u,a)}function Gr(t,e,r){return"color"===e.type?r=ee.parse(r):"formatted"===e.type?r=ie.fromString(r.toString()):"resolvedImage"===e.type?r=oe.fromString(r.toString()):zr(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ur(r,t.default,e.default)}xe.register(Pr,{error:[{kind:"error"},[Ut],function(t,e){throw new he(e[0].evaluate(t))}],typeof:[Ut,[Gt],function(t,e){return Ht(ue(e[0].evaluate(t)))}],"to-rgba":[Wt(Bt,4),[Vt],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Vt,[Bt,Bt,Bt],Mr],rgba:[Vt,[Bt,Bt,Bt,Bt],Mr],has:{type:jt,overloads:[[[Ut],function(t,e){return Tr(e[0].evaluate(t),t.properties())}],[[Ut,qt],function(t,e){var r=e[1];return Tr(e[0].evaluate(t),r.evaluate(t))}]]},get:{type:Gt,overloads:[[[Ut],function(t,e){return Lr(e[0].evaluate(t),t.properties())}],[[Ut,qt],function(t,e){var r=e[1];return Lr(e[0].evaluate(t),r.evaluate(t))}]]},"feature-state":[Gt,[Ut],function(t,e){return Lr(e[0].evaluate(t),t.featureState||{})}],properties:[qt,[],function(t){return t.properties()}],"geometry-type":[Ut,[],function(t){return t.geometryType()}],id:[Gt,[],function(t){return t.id()}],zoom:[Bt,[],function(t){return t.globals.zoom}],"heatmap-density":[Bt,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Bt,[],function(t){return t.globals.lineProgress||0}],accumulated:[Gt,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Bt,Ar(Bt),function(t,e){for(var r=0,n=0,i=e;n":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>o}],"filter-id->":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i<=o}],"filter-id-<=":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[jt,[Ut,Gt],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],o=n.value;return typeof i==typeof o&&i>=o}],"filter-id->=":[jt,[Gt],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[jt,[Gt],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[jt,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[jt,[Wt(Ut)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[jt,[Wt(Gt)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[jt,[Ut,Wt(Gt)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[jt,[Ut,Wt(Gt)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],all:{type:jt,overloads:[[[jt,jt],function(t,e){var r=e[1];return e[0].evaluate(t)&&r.evaluate(t)}],[Ar(jt),function(t,e){for(var r=0,n=e;r0&&"string"==typeof t[0]&&t[0]in Pr}function Yr(t,e){var r=new Ve(Pr,[],e?function(t){var e={color:Vt,string:Ut,number:Bt,enum:Ut,boolean:jt,formatted:Zt,resolvedImage:Yt};return"array"===t.type?Wt(e[t.value]||Gt,t.length):e[t.type]}(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?kr(new Xr(n,e)):Nr(r.errors)}Xr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)},Xr.prototype.evaluate=function(t,e,r,n,i,o){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=o||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new he("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Wr=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Be(e.expression)};Wr.prototype.evaluateWithoutErrorHandling=function(t,e,r,n,i,o){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,o)},Wr.prototype.evaluate=function(t,e,r,n,i,o){return this._styleExpression.evaluate(t,e,r,n,i,o)};var Hr=function(t,e,r,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Be(e.expression),this.interpolationType=n};function Jr(t,e){if("error"===(t=Yr(t,e)).result)return t;var r=t.value.expression,n=Fe(r);if(!n&&!Dr(e))return Nr([new Ot("","data expressions not supported")]);var i=Ue(r,["zoom"]);if(!i&&!Rr(e))return Nr([new Ot("","zoom expressions not supported")]);var o=function t(e){var r=null;if(e instanceof lr)r=t(e.result);else if(e instanceof ur)for(var n=0,i=e.args;nn.maximum?[new At(e,r,r+" is greater than the maximum value "+n.maximum)]:[]}function en(t){var e,r,n,i=t.valueSpec,o=Dt(t.value.type),a={},s="categorical"!==o&&void 0===t.value.property,u=!s,l="array"===zr(t.value.stops)&&"array"===zr(t.value.stops[0])&&"object"===zr(t.value.stops[0][0]),c=$r({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){if("identity"===o)return[new At(t.key,t.value,'identity function may not have a "stops" property')];var e=[],r=t.value;return e=e.concat(Qr({key:t.key,value:r,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:h})),"array"===zr(r)&&0===r.length&&e.push(new At(t.key,r,"array must have at least one stop")),e},default:function(t){return In({key:t.key,value:t.value,valueSpec:i,style:t.style,styleSpec:t.styleSpec})}}});return"identity"===o&&s&&c.push(new At(t.key,t.value,'missing required property "property"')),"identity"===o||t.value.stops||c.push(new At(t.key,t.value,'missing required property "stops"')),"exponential"===o&&t.valueSpec.expression&&!Or(t.valueSpec)&&c.push(new At(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(u&&!Dr(t.valueSpec)?c.push(new At(t.key,t.value,"property functions not supported")):s&&!Rr(t.valueSpec)&&c.push(new At(t.key,t.value,"zoom functions not supported"))),"categorical"!==o&&!l||void 0!==t.value.property||c.push(new At(t.key,t.value,'"property" property is required')),c;function h(t){var e=[],o=t.value,s=t.key;if("array"!==zr(o))return[new At(s,o,"array expected, "+zr(o)+" found")];if(2!==o.length)return[new At(s,o,"array length 2 expected, length "+o.length+" found")];if(l){if("object"!==zr(o[0]))return[new At(s,o,"object expected, "+zr(o[0])+" found")];if(void 0===o[0].zoom)return[new At(s,o,"object stop key must have zoom")];if(void 0===o[0].value)return[new At(s,o,"object stop key must have value")];if(n&&n>Dt(o[0].zoom))return[new At(s,o[0].zoom,"stop zoom values must appear in ascending order")];Dt(o[0].zoom)!==n&&(n=Dt(o[0].zoom),r=void 0,a={}),e=e.concat($r({key:s+"[0]",value:o[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:tn,value:p}}))}else e=e.concat(p({key:s+"[0]",value:o[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},o));return Zr(Rt(o[1]))?e.concat([new At(s+"[1]",o[1],"expressions are not allowed in function stops.")]):e.concat(In({key:s+"[1]",value:o[1],valueSpec:i,style:t.style,styleSpec:t.styleSpec}))}function p(t,n){var s=zr(t.value),u=Dt(t.value),l=null!==t.value?t.value:n;if(e){if(s!==e)return[new At(t.key,l,s+" stop domain type must match previous stop domain type "+e)]}else e=s;if("number"!==s&&"string"!==s&&"boolean"!==s)return[new At(t.key,l,"stop domain value must be a number, string, or boolean")];if("number"!==s&&"categorical"!==o){var c="number expected, "+s+" found";return Dr(i)&&void 0===o&&(c+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new At(t.key,l,c)]}return"categorical"!==o||"number"!==s||isFinite(u)&&Math.floor(u)===u?"categorical"!==o&&"number"===s&&void 0!==r&&u=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function ln(t){if(!t)return!0;var e,r=t[0];return t.length<=1?"any"!==r:"=="===r?cn(t[1],t[2],"=="):"!="===r?fn(cn(t[1],t[2],"==")):"<"===r||">"===r||"<="===r||">="===r?cn(t[1],t[2],r):"any"===r?(e=t.slice(1),["any"].concat(e.map(ln))):"all"===r?["all"].concat(t.slice(1).map(ln)):"none"===r?["all"].concat(t.slice(1).map(ln).map(fn)):"in"===r?hn(t[1],t.slice(2)):"!in"===r?fn(hn(t[1],t.slice(2))):"has"===r?pn(t[1]):"!has"===r?fn(pn(t[1])):"within"!==r||t}function cn(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function hn(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(un)]]:["filter-in-small",t,["literal",e]]}}function pn(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function fn(t){return["!",t]}function dn(t){return on(Rt(t.value))?rn(Nt({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):function t(e){var r=e.value,n=e.key;if("array"!==zr(r))return[new At(n,r,"array expected, "+zr(r)+" found")];var i,o=e.styleSpec,a=[];if(r.length<1)return[new At(n,r,"filter array must have at least 1 element")];switch(a=a.concat(nn({key:n+"[0]",value:r[0],valueSpec:o.filter_operator,style:e.style,styleSpec:e.styleSpec})),Dt(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&"$type"===Dt(r[1])&&a.push(new At(n,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&a.push(new At(n,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(i=zr(r[1]))&&a.push(new At(n+"[1]",r[1],"string expected, "+i+" found"));for(var s=2;s=c[f+0]&&n>=c[f+1])?(a[p]=!0,o.push(l[p])):a[p]=!1}}},Rn.prototype._forEachCell=function(t,e,r,n,i,o,a,s){for(var u=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=u;p<=c;p++)for(var f=l;f<=h;f++){var d=this.d*f+p;if((!s||s(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&i.call(this,t,e,r,n,d,o,a,s))return}},Rn.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},Rn.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},Rn.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=3+this.cells.length+1+1,r=0,n=0;n=0)){var c=t[l];u[l]=Fn[s].shallow.indexOf(l)>=0?c:qn(c,e)}t instanceof Error&&(u.message=t.message)}if(u.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==s&&(u.$name=s),u}throw new Error("can't serialize object of type "+typeof t)}function Gn(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||jn(t)||Vn(t)||ArrayBuffer.isView(t)||t instanceof On)return t;if(Array.isArray(t))return t.map(Gn);if("object"==typeof t){var e=t.$name||"Object",r=Fn[e].klass;if(!r)throw new Error("can't deserialize unregistered class "+e);if(r.deserialize)return r.deserialize(t);for(var n=Object.create(r.prototype),i=0,o=Object.keys(t);i=0?s:Gn(s)}}return n}throw new Error("can't deserialize object of type "+typeof t)}var Xn=function(){this.first=!0};Xn.prototype.update=function(t,e){var r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},Khmer:function(t){return t>=6016&&t<=6143},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}};function Yn(t){for(var e=0,r=t;e=65097&&t<=65103)||Zn["CJK Compatibility Ideographs"](t)||Zn["CJK Compatibility"](t)||Zn["CJK Radicals Supplement"](t)||Zn["CJK Strokes"](t)||!(!Zn["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||Zn["CJK Unified Ideographs Extension A"](t)||Zn["CJK Unified Ideographs"](t)||Zn["Enclosed CJK Letters and Months"](t)||Zn["Hangul Compatibility Jamo"](t)||Zn["Hangul Jamo Extended-A"](t)||Zn["Hangul Jamo Extended-B"](t)||Zn["Hangul Jamo"](t)||Zn["Hangul Syllables"](t)||Zn.Hiragana(t)||Zn["Ideographic Description Characters"](t)||Zn.Kanbun(t)||Zn["Kangxi Radicals"](t)||Zn["Katakana Phonetic Extensions"](t)||Zn.Katakana(t)&&12540!==t||!(!Zn["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!Zn["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Zn["Unified Canadian Aboriginal Syllabics"](t)||Zn["Unified Canadian Aboriginal Syllabics Extended"](t)||Zn["Vertical Forms"](t)||Zn["Yijing Hexagram Symbols"](t)||Zn["Yi Syllables"](t)||Zn["Yi Radicals"](t))))}function Hn(t){return!(Wn(t)||function(t){return!!(Zn["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||Zn["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||Zn["Letterlike Symbols"](t)||Zn["Number Forms"](t)||Zn["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||Zn["Control Pictures"](t)&&9251!==t||Zn["Optical Character Recognition"](t)||Zn["Enclosed Alphanumerics"](t)||Zn["Geometric Shapes"](t)||Zn["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||Zn["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||Zn["CJK Symbols and Punctuation"](t)||Zn.Katakana(t)||Zn["Private Use Area"](t)||Zn["CJK Compatibility Forms"](t)||Zn["Small Form Variants"](t)||Zn["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function Jn(t){return t>=1424&&t<=2303||Zn["Arabic Presentation Forms-A"](t)||Zn["Arabic Presentation Forms-B"](t)}function Kn(t,e){return!(!e&&Jn(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Zn.Khmer(t))}function $n(t){for(var e=0,r=t;e-1&&(ti="error"),Qn&&Qn(t)};function ni(){ii.fire(new Pt("pluginStateChange",{pluginStatus:ti,pluginURL:ei}))}var ii=new Tt,oi=function(){return ti},ai=function(){if("deferred"!==ti||!ei)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ti="loading",ni(),ei&&bt({url:ei},(function(t){t?ri(t):(ti="loaded",ni())}))},si={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:function(){return"loaded"===ti||null!=si.applyArabicShaping},isLoading:function(){return"loading"===ti},setState:function(t){ti=t.pluginStatus,ei=t.pluginURL},isParsed:function(){return null!=si.applyArabicShaping&&null!=si.processBidirectionalText&&null!=si.processStyledBidirectionalText},getPluginURL:function(){return ei}},ui=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Xn,this.transition={})};ui.prototype.isSupportedScript=function(t){return function(t,e){for(var r=0,n=t;rthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}};var li=function(t,e){this.property=t,this.value=e,this.expression=function(t,e){if(Fr(t))return new Kr(t,e);if(Zr(t)){var r=Jr(t,e);if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));return r.value}var n=t;return"string"==typeof t&&"color"===e.type&&(n=ee.parse(t)),{kind:"constant",evaluate:function(){return n}}}(void 0===e?t.specification.default:e,t.specification)};li.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},li.prototype.possiblyEvaluate=function(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)};var ci=function(t){this.property=t,this.value=new li(t,void 0)};ci.prototype.transitioned=function(t,e){return new pi(this.property,this.value,e,p({},t.transition,this.transition),t.now)},ci.prototype.untransitioned=function(){return new pi(this.property,this.value,null,{},0)};var hi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};hi.prototype.getValue=function(t){return b(this._values[t].value.value)},hi.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].value=new li(this._values[t].property,null===e?void 0:b(e))},hi.prototype.getTransition=function(t){return b(this._values[t].transition)},hi.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new ci(this._values[t].property)),this._values[t].transition=b(e)||void 0},hi.prototype.serialize=function(){for(var t={},e=0,r=Object.keys(this._values);ethis.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}(a))}return i};var fi=function(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)};fi.prototype.possiblyEvaluate=function(t,e,r){for(var n=new yi(this._properties),i=0,o=Object.keys(this._values);in.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},e.prototype.interpolate=function(t){return t},e}(vi),xi=function(t){this.specification=t};xi.prototype.possiblyEvaluate=function(t,e,r,n){if(void 0!==t.value){if("constant"===t.expression.kind){var i=t.expression.evaluate(e,null,{},r,n);return this._calculate(i,i,i,e)}return this._calculate(t.expression.evaluate(new ui(Math.floor(e.zoom-1),e)),t.expression.evaluate(new ui(Math.floor(e.zoom),e)),t.expression.evaluate(new ui(Math.floor(e.zoom+1),e)),e)}},xi.prototype._calculate=function(t,e,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}},xi.prototype.interpolate=function(t){return t};var bi=function(t){this.specification=t};bi.prototype.possiblyEvaluate=function(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)},bi.prototype.interpolate=function(){return!1};var wi=function(t){for(var e in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[],t){var r=t[e];r.specification.overridable&&this.overridableProperties.push(e);var n=this.defaultPropertyValues[e]=new li(r,void 0),i=this.defaultTransitionablePropertyValues[e]=new ci(r);this.defaultTransitioningPropertyValues[e]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=n.possiblyEvaluate({})}};Bn("DataDrivenProperty",vi),Bn("DataConstantProperty",mi),Bn("CrossFadedDataDrivenProperty",_i),Bn("CrossFadedProperty",xi),Bn("ColorRampProperty",bi);var Ei=function(t){function e(e,r){if(t.call(this),this.id=e.id,this.type=e.type,this._featureFilter={filter:function(){return!0},needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new di(r.layout)),r.paint)){for(var n in this._transitionablePaint=new hi(r.paint),e.paint)this.setPaintProperty(n,e.paint[n],{validate:!1});for(var i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new yi(r.paint)}}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getCrossfadeParameters=function(){return this._crossfadeParameters},e.prototype.getLayoutProperty=function(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)},e.prototype.setLayoutProperty=function(t,e,r){void 0===r&&(r={}),null!=e&&this._validate(kn,"layers."+this.id+".layout."+t,t,e,r)||("visibility"!==t?this._unevaluatedLayout.setValue(t,e):this.visibility=e)},e.prototype.getPaintProperty=function(t){return v(t,"-transition")?this._transitionablePaint.getTransition(t.slice(0,-"-transition".length)):this._transitionablePaint.getValue(t)},e.prototype.setPaintProperty=function(t,e,r){if(void 0===r&&(r={}),null!=e&&this._validate(An,"layers."+this.id+".paint."+t,t,e,r))return!1;if(v(t,"-transition"))return this._transitionablePaint.setTransition(t.slice(0,-"-transition".length),e||void 0),!1;var n=this._transitionablePaint._values[t],i="cross-faded-data-driven"===n.property.specification["property-type"],o=n.value.isDataDriven(),a=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);var s=this._transitionablePaint._values[t].value;return s.isDataDriven()||o||i||this._handleOverridablePaintPropertyUpdate(t,a,s)},e.prototype._handleSpecialPaintPropertyUpdate=function(t){},e.prototype._handleOverridablePaintPropertyUpdate=function(t,e,r){return!1},e.prototype.isHidden=function(t){return!!(this.minzoom&&t=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),x(t,(function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)}))},e.prototype._validate=function(t,e,r,n,i){return void 0===i&&(i={}),(!i||!1!==i.validate)&&Nn(this,t.call(Tn,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:Lt,style:{glyphs:!0,sprite:!0}}))},e.prototype.is3D=function(){return!1},e.prototype.isTileClipped=function(){return!1},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e.prototype.isStateDependent=function(){for(var t in this.paint._values){var e=this.paint.get(t);if(e instanceof gi&&Dr(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}return!1},e}(Tt),Ii={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Si=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},Ci=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};function Pi(t,e){void 0===e&&(e=1);var r=0,n=0;return{members:t.map((function(t){var i=Ii[t.type].BYTES_PER_ELEMENT,o=r=Mi(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:o}})),size:Mi(r,Math.max(n,e)),alignment:e}}function Mi(t,e){return Math.ceil(t/e)*e}Ci.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},Ci.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},Ci.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},Ci.prototype.clear=function(){this.length=0},Ci.prototype.resize=function(t){this.reserve(t),this.length=t},Ci.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},Ci.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")};var Ti=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t},e}(Ci);Ti.prototype.bytesPerElement=4,Bn("StructArrayLayout2i4",Ti);var Li=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,t},e}(Ci);Li.prototype.bytesPerElement=8,Bn("StructArrayLayout4i8",Li);var Ai=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ci);Ai.prototype.bytesPerElement=12,Bn("StructArrayLayout2i4i12",Ai);var ki=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=4*t,u=8*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=o,this.uint8[u+7]=a,t},e}(Ci);ki.prototype.bytesPerElement=8,Bn("StructArrayLayout2i4ub8",ki);var Ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t},e}(Ci);Ni.prototype.bytesPerElement=8,Bn("StructArrayLayout2f8",Ni);var Di=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l){var c=this.length;return this.resize(c+1),this.emplace(c,t,e,r,n,i,o,a,s,u,l)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c){var h=10*t;return this.uint16[h+0]=e,this.uint16[h+1]=r,this.uint16[h+2]=n,this.uint16[h+3]=i,this.uint16[h+4]=o,this.uint16[h+5]=a,this.uint16[h+6]=s,this.uint16[h+7]=u,this.uint16[h+8]=l,this.uint16[h+9]=c,t},e}(Ci);Di.prototype.bytesPerElement=20,Bn("StructArrayLayout10ui20",Di);var Ri=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,h){var p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,o,a,s,u,l,c,h)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p){var f=12*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.uint16[f+4]=o,this.uint16[f+5]=a,this.uint16[f+6]=s,this.uint16[f+7]=u,this.int16[f+8]=l,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=p,t},e}(Ci);Ri.prototype.bytesPerElement=24,Bn("StructArrayLayout4i4ui4i24",Ri);var Oi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t},e}(Ci);Oi.prototype.bytesPerElement=12,Bn("StructArrayLayout3f12",Oi);var zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint32[1*t+0]=e,t},e}(Ci);zi.prototype.bytesPerElement=4,Bn("StructArrayLayout1ul4",zi);var Fi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u){var l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,n,i,o,a,s,u)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l){var c=10*t,h=5*t;return this.int16[c+0]=e,this.int16[c+1]=r,this.int16[c+2]=n,this.int16[c+3]=i,this.int16[c+4]=o,this.int16[c+5]=a,this.uint32[h+3]=s,this.uint16[c+8]=u,this.uint16[c+9]=l,t},e}(Ci);Fi.prototype.bytesPerElement=20,Bn("StructArrayLayout6i1ul2ui20",Fi);var Bi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o){var a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,o)},e.prototype.emplace=function(t,e,r,n,i,o,a){var s=6*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,this.int16[s+4]=o,this.int16[s+5]=a,t},e}(Ci);Bi.prototype.bytesPerElement=12,Bn("StructArrayLayout2i2i2i12",Bi);var Ui=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i){var o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i)},e.prototype.emplace=function(t,e,r,n,i,o){var a=4*t,s=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[s+6]=i,this.int16[s+7]=o,t},e}(Ci);Ui.prototype.bytesPerElement=16,Bn("StructArrayLayout2f1f2i16",Ui);var ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=12*t,a=3*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[a+1]=n,this.float32[a+2]=i,t},e}(Ci);ji.prototype.bytesPerElement=12,Bn("StructArrayLayout2ub2f12",ji);var Vi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t},e}(Ci);Vi.prototype.bytesPerElement=6,Bn("StructArrayLayout3ui6",Vi);var qi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y){var m=this.length;return this.resize(m+1),this.emplace(m,t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m){var v=24*t,_=12*t,x=48*t;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[_+2]=o,this.uint32[_+3]=a,this.uint32[_+4]=s,this.uint16[v+10]=u,this.uint16[v+11]=l,this.uint16[v+12]=c,this.float32[_+7]=h,this.float32[_+8]=p,this.uint8[x+36]=f,this.uint8[x+37]=d,this.uint8[x+38]=g,this.uint32[_+10]=y,this.int16[v+22]=m,t},e}(Ci);qi.prototype.bytesPerElement=48,Bn("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",qi);var Gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P){var M=this.length;return this.resize(M+1),this.emplace(M,t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P)},e.prototype.emplace=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,E,I,S,C,P,M){var T=34*t,L=17*t;return this.int16[T+0]=e,this.int16[T+1]=r,this.int16[T+2]=n,this.int16[T+3]=i,this.int16[T+4]=o,this.int16[T+5]=a,this.int16[T+6]=s,this.int16[T+7]=u,this.uint16[T+8]=l,this.uint16[T+9]=c,this.uint16[T+10]=h,this.uint16[T+11]=p,this.uint16[T+12]=f,this.uint16[T+13]=d,this.uint16[T+14]=g,this.uint16[T+15]=y,this.uint16[T+16]=m,this.uint16[T+17]=v,this.uint16[T+18]=_,this.uint16[T+19]=x,this.uint16[T+20]=b,this.uint16[T+21]=w,this.uint16[T+22]=E,this.uint32[L+12]=I,this.float32[L+13]=S,this.float32[L+14]=C,this.float32[L+15]=P,this.float32[L+16]=M,t},e}(Ci);Gi.prototype.bytesPerElement=68,Bn("StructArrayLayout8i15ui1ul4f68",Gi);var Xi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.float32[1*t+0]=e,t},e}(Ci);Xi.prototype.bytesPerElement=4,Bn("StructArrayLayout1f4",Xi);var Zi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t},e}(Ci);Zi.prototype.bytesPerElement=6,Bn("StructArrayLayout3i6",Zi);var Yi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r){var n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)},e.prototype.emplace=function(t,e,r,n){var i=4*t;return this.uint32[2*t+0]=e,this.uint16[i+2]=r,this.uint16[i+3]=n,t},e}(Ci);Yi.prototype.bytesPerElement=8,Bn("StructArrayLayout1ul2ui8",Yi);var Wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e){var r=this.length;return this.resize(r+1),this.emplace(r,t,e)},e.prototype.emplace=function(t,e,r){var n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t},e}(Ci);Wi.prototype.bytesPerElement=4,Bn("StructArrayLayout2ui4",Wi);var Hi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t){var e=this.length;return this.resize(e+1),this.emplace(e,t)},e.prototype.emplace=function(t,e){return this.uint16[1*t+0]=e,t},e}(Ci);Hi.prototype.bytesPerElement=2,Bn("StructArrayLayout1ui2",Hi);var Ji=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._refreshViews=function(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)},e.prototype.emplaceBack=function(t,e,r,n){var i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)},e.prototype.emplace=function(t,e,r,n,i){var o=4*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,t},e}(Ci);Ji.prototype.bytesPerElement=16,Bn("StructArrayLayout4f16",Ji);var Ki=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorPointX:{configurable:!0},anchorPointY:{configurable:!0},x1:{configurable:!0},y1:{configurable:!0},x2:{configurable:!0},y2:{configurable:!0},featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0},anchorPoint:{configurable:!0}};return r.anchorPointX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorPointY.get=function(){return this._structArray.int16[this._pos2+1]},r.x1.get=function(){return this._structArray.int16[this._pos2+2]},r.y1.get=function(){return this._structArray.int16[this._pos2+3]},r.x2.get=function(){return this._structArray.int16[this._pos2+4]},r.y2.get=function(){return this._structArray.int16[this._pos2+5]},r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+8]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.anchorPoint.get=function(){return new i(this.anchorPointX,this.anchorPointY)},Object.defineProperties(e.prototype,r),e}(Si);Ki.prototype.size=20;var $i=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Ki(this,t)},e}(Fi);Bn("CollisionBoxArray",$i);var Qi=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},glyphStartIndex:{configurable:!0},numGlyphs:{configurable:!0},vertexStartIndex:{configurable:!0},lineStartIndex:{configurable:!0},lineLength:{configurable:!0},segment:{configurable:!0},lowerSize:{configurable:!0},upperSize:{configurable:!0},lineOffsetX:{configurable:!0},lineOffsetY:{configurable:!0},writingMode:{configurable:!0},placedOrientation:{configurable:!0},hidden:{configurable:!0},crossTileID:{configurable:!0},associatedIconIndex:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.glyphStartIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.numGlyphs.get=function(){return this._structArray.uint16[this._pos2+3]},r.vertexStartIndex.get=function(){return this._structArray.uint32[this._pos4+2]},r.lineStartIndex.get=function(){return this._structArray.uint32[this._pos4+3]},r.lineLength.get=function(){return this._structArray.uint32[this._pos4+4]},r.segment.get=function(){return this._structArray.uint16[this._pos2+10]},r.lowerSize.get=function(){return this._structArray.uint16[this._pos2+11]},r.upperSize.get=function(){return this._structArray.uint16[this._pos2+12]},r.lineOffsetX.get=function(){return this._structArray.float32[this._pos4+7]},r.lineOffsetY.get=function(){return this._structArray.float32[this._pos4+8]},r.writingMode.get=function(){return this._structArray.uint8[this._pos1+36]},r.placedOrientation.get=function(){return this._structArray.uint8[this._pos1+37]},r.placedOrientation.set=function(t){this._structArray.uint8[this._pos1+37]=t},r.hidden.get=function(){return this._structArray.uint8[this._pos1+38]},r.hidden.set=function(t){this._structArray.uint8[this._pos1+38]=t},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+10]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+10]=t},r.associatedIconIndex.get=function(){return this._structArray.int16[this._pos2+22]},Object.defineProperties(e.prototype,r),e}(Si);Qi.prototype.size=48;var to=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new Qi(this,t)},e}(qi);Bn("PlacedSymbolArray",to);var eo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={anchorX:{configurable:!0},anchorY:{configurable:!0},rightJustifiedTextSymbolIndex:{configurable:!0},centerJustifiedTextSymbolIndex:{configurable:!0},leftJustifiedTextSymbolIndex:{configurable:!0},verticalPlacedTextSymbolIndex:{configurable:!0},placedIconSymbolIndex:{configurable:!0},verticalPlacedIconSymbolIndex:{configurable:!0},key:{configurable:!0},textBoxStartIndex:{configurable:!0},textBoxEndIndex:{configurable:!0},verticalTextBoxStartIndex:{configurable:!0},verticalTextBoxEndIndex:{configurable:!0},iconBoxStartIndex:{configurable:!0},iconBoxEndIndex:{configurable:!0},verticalIconBoxStartIndex:{configurable:!0},verticalIconBoxEndIndex:{configurable:!0},featureIndex:{configurable:!0},numHorizontalGlyphVertices:{configurable:!0},numVerticalGlyphVertices:{configurable:!0},numIconVertices:{configurable:!0},numVerticalIconVertices:{configurable:!0},useRuntimeCollisionCircles:{configurable:!0},crossTileID:{configurable:!0},textBoxScale:{configurable:!0},textOffset0:{configurable:!0},textOffset1:{configurable:!0},collisionCircleDiameter:{configurable:!0}};return r.anchorX.get=function(){return this._structArray.int16[this._pos2+0]},r.anchorY.get=function(){return this._structArray.int16[this._pos2+1]},r.rightJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+2]},r.centerJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+3]},r.leftJustifiedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+4]},r.verticalPlacedTextSymbolIndex.get=function(){return this._structArray.int16[this._pos2+5]},r.placedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+6]},r.verticalPlacedIconSymbolIndex.get=function(){return this._structArray.int16[this._pos2+7]},r.key.get=function(){return this._structArray.uint16[this._pos2+8]},r.textBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+9]},r.textBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+10]},r.verticalTextBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+11]},r.verticalTextBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+12]},r.iconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+13]},r.iconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+14]},r.verticalIconBoxStartIndex.get=function(){return this._structArray.uint16[this._pos2+15]},r.verticalIconBoxEndIndex.get=function(){return this._structArray.uint16[this._pos2+16]},r.featureIndex.get=function(){return this._structArray.uint16[this._pos2+17]},r.numHorizontalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+18]},r.numVerticalGlyphVertices.get=function(){return this._structArray.uint16[this._pos2+19]},r.numIconVertices.get=function(){return this._structArray.uint16[this._pos2+20]},r.numVerticalIconVertices.get=function(){return this._structArray.uint16[this._pos2+21]},r.useRuntimeCollisionCircles.get=function(){return this._structArray.uint16[this._pos2+22]},r.crossTileID.get=function(){return this._structArray.uint32[this._pos4+12]},r.crossTileID.set=function(t){this._structArray.uint32[this._pos4+12]=t},r.textBoxScale.get=function(){return this._structArray.float32[this._pos4+13]},r.textOffset0.get=function(){return this._structArray.float32[this._pos4+14]},r.textOffset1.get=function(){return this._structArray.float32[this._pos4+15]},r.collisionCircleDiameter.get=function(){return this._structArray.float32[this._pos4+16]},Object.defineProperties(e.prototype,r),e}(Si);eo.prototype.size=68;var ro=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new eo(this,t)},e}(Gi);Bn("SymbolInstanceArray",ro);var no=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getoffsetX=function(t){return this.float32[1*t+0]},e}(Xi);Bn("GlyphOffsetArray",no);var io=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.getx=function(t){return this.int16[3*t+0]},e.prototype.gety=function(t){return this.int16[3*t+1]},e.prototype.gettileUnitDistanceFromAnchor=function(t){return this.int16[3*t+2]},e}(Zi);Bn("SymbolLineVertexArray",io);var oo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e;var r={featureIndex:{configurable:!0},sourceLayerIndex:{configurable:!0},bucketIndex:{configurable:!0}};return r.featureIndex.get=function(){return this._structArray.uint32[this._pos4+0]},r.sourceLayerIndex.get=function(){return this._structArray.uint16[this._pos2+2]},r.bucketIndex.get=function(){return this._structArray.uint16[this._pos2+3]},Object.defineProperties(e.prototype,r),e}(Si);oo.prototype.size=8;var ao=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.get=function(t){return new oo(this,t)},e}(Yi);Bn("FeatureIndexArray",ao);var so=Pi([{name:"a_pos",components:2,type:"Int16"}],4).members,uo=function(t){void 0===t&&(t=[]),this.segments=t};function lo(t,e){return 256*(t=c(Math.floor(t),0,255))+c(Math.floor(e),0,255)}uo.prototype.prepareSegment=function(t,e,r,n){var i=this.segments[this.segments.length-1];return t>uo.MAX_VERTEX_ARRAY_LENGTH&&E("Max vertices per segment is "+uo.MAX_VERTEX_ARRAY_LENGTH+": bucket requested "+t),(!i||i.vertexLength+t>uo.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i},uo.prototype.get=function(){return this.segments},uo.prototype.destroy=function(){for(var t=0,e=this.segments;t>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(o>>>16)&65535)<<16);switch(u=0,r){case 3:u^=(255&t.charCodeAt(l+2))<<16;case 2:u^=(255&t.charCodeAt(l+1))<<8;case 1:i^=u=(65535&(u=(u=(65535&(u^=255&t.charCodeAt(l)))*a+(((u>>>16)*a&65535)<<16)&4294967295)<<15|u>>>17))*s+(((u>>>16)*s&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}})),po=e((function(t){t.exports=function(t,e){for(var r,n=t.length,i=e^n,o=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(o)|(255&t.charCodeAt(++o))<<8|(255&t.charCodeAt(++o))<<16|(255&t.charCodeAt(++o))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++o;switch(n){case 3:i^=(255&t.charCodeAt(o+2))<<16;case 2:i^=(255&t.charCodeAt(o+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(o)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}})),fo=ho,go=po;fo.murmur3=ho,fo.murmur2=go;var yo=function(){this.ids=[],this.positions=[],this.indexed=!1};yo.prototype.add=function(t,e,r,n){this.ids.push(vo(t)),this.positions.push(e,r,n)},yo.prototype.getPositions=function(t){for(var e=vo(t),r=0,n=this.ids.length-1;r>1;this.ids[i]>=e?n=i:r=i+1}for(var o=[];this.ids[r]===e;)o.push({index:this.positions[3*r],start:this.positions[3*r+1],end:this.positions[3*r+2]}),r++;return o},yo.serialize=function(t,e){var r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return function t(e,r,n,i){for(;n>1],a=n-1,s=i+1;;){do{a++}while(e[a]o);if(a>=s)break;_o(e,a,s),_o(r,3*a,3*s),_o(r,3*a+1,3*s+1),_o(r,3*a+2,3*s+2)}s-na.x+1||ua.y+1)&&E("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Vo(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?jo(t):[]}}function qo(t,e,r,n,i){t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)}var Go=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ti,this.indexArray=new Vi,this.segments=new uo,this.programConfigurations=new Oo(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Xo(t,e){for(var r=0;r1){if(Ho(t,e))return!0;for(var n=0;n1?r:r.sub(e)._mult(i)._add(e))}function Qo(t,e){for(var r,n,i,o=!1,a=0;ae.y!=(i=r[u]).y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(o=!o);return o}function ta(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ea(t,e,r){var n=r[0],i=r[2];if(t.xi.x&&e.x>i.x||t.yi.y&&e.y>i.y)return!1;var o=I(t,e,r[0]);return o!==I(t,e,r[1])||o!==I(t,e,r[2])||o!==I(t,e,r[3])}function ra(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function na(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function ia(t,e,r,n,o){if(!e[0]&&!e[1])return t;var a=i.convert(e)._mult(o);"viewport"===r&&a._rotate(-n);for(var s=[],u=0;u=8192||c<0||c>=8192)){var h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=h.vertexLength;qo(this.layoutVertexArray,l,c,-1,-1),qo(this.layoutVertexArray,l,c,1,-1),qo(this.layoutVertexArray,l,c,1,1),qo(this.layoutVertexArray,l,c,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),h.vertexLength+=4,h.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n)},Bn("CircleBucket",Go,{omit:["layers"]});var oa=new wi({"circle-sort-key":new vi(Lt.layout_circle["circle-sort-key"])}),aa={paint:new wi({"circle-radius":new vi(Lt.paint_circle["circle-radius"]),"circle-color":new vi(Lt.paint_circle["circle-color"]),"circle-blur":new vi(Lt.paint_circle["circle-blur"]),"circle-opacity":new vi(Lt.paint_circle["circle-opacity"]),"circle-translate":new mi(Lt.paint_circle["circle-translate"]),"circle-translate-anchor":new mi(Lt.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new mi(Lt.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new mi(Lt.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new vi(Lt.paint_circle["circle-stroke-width"]),"circle-stroke-color":new vi(Lt.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new vi(Lt.paint_circle["circle-stroke-opacity"])}),layout:oa},sa="undefined"!=typeof Float32Array?Float32Array:Array;function ua(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function la(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],u=e[5],l=e[6],c=e[7],h=e[8],p=e[9],f=e[10],d=e[11],g=e[12],y=e[13],m=e[14],v=e[15],_=r[0],x=r[1],b=r[2],w=r[3];return t[0]=_*n+x*s+b*h+w*g,t[1]=_*i+x*u+b*p+w*y,t[2]=_*o+x*l+b*f+w*m,t[3]=_*a+x*c+b*d+w*v,t[4]=(_=r[4])*n+(x=r[5])*s+(b=r[6])*h+(w=r[7])*g,t[5]=_*i+x*u+b*p+w*y,t[6]=_*o+x*l+b*f+w*m,t[7]=_*a+x*c+b*d+w*v,t[8]=(_=r[8])*n+(x=r[9])*s+(b=r[10])*h+(w=r[11])*g,t[9]=_*i+x*u+b*p+w*y,t[10]=_*o+x*l+b*f+w*m,t[11]=_*a+x*c+b*d+w*v,t[12]=(_=r[12])*n+(x=r[13])*s+(b=r[14])*h+(w=r[15])*g,t[13]=_*i+x*u+b*p+w*y,t[14]=_*o+x*l+b*f+w*m,t[15]=_*a+x*c+b*d+w*v,t}Math.hypot||(Math.hypot=function(){for(var t=arguments,e=0,r=arguments.length;r--;)e+=t[r]*t[r];return Math.sqrt(e)});var ca,ha=la;function pa(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,t}ca=new sa(3),sa!=Float32Array&&(ca[0]=0,ca[1]=0,ca[2]=0),function(){var t=new sa(4);sa!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0)}();var fa=(function(){var t=new sa(2);sa!=Float32Array&&(t[0]=0,t[1]=0)}(),function(t){function e(e){t.call(this,e,aa)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.createBucket=function(t){return new Go(t)},e.prototype.queryRadius=function(t){var e=t;return ra("circle-radius",this,e)+ra("circle-stroke-width",this,e)+na(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o,a,s){for(var u=ia(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),o.angle,a),l=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?u:function(t,e){return t.map((function(t){return da(t,e)}))}(u,s),p=c?l*a:l,f=0,d=n;ft.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var a=t.data,s=e.data,u=0;u80*r){n=o=t[0],i=a=t[1];for(var d=r;do&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-n,a-i))?1/l:0}return ka(p,f,r,n,i,l),f}function La(t,e,r,n,i){var o,a;if(i===ts(t,e,r,n)>0)for(o=e;o=e;o-=n)a=Ka(o,t[o],t[o+1],a);return a&&Xa(a,a.next)&&($a(a),a=a.next),a}function Aa(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!Xa(n,n.next)&&0!==Ga(n.prev,n,n.next))n=n.next;else{if($a(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function ka(t,e,r,n,i,o,a){if(t){!a&&o&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=Ua(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,o,a,s,u,l=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e0||u>0&&n;)0!==s&&(0===u||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1)}(i)}(t,n,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?Da(t,n,i,o):Na(t))e.push(s.i/r),e.push(t.i/r),e.push(u.i/r),$a(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?ka(t=Ra(Aa(t),e,r),e,r,n,i,o,2):2===a&&Oa(t,e,r,n,i,o):ka(Aa(t),e,r,n,i,o,1);break}}}function Na(t){var e=t.prev,r=t,n=t.next;if(Ga(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(Va(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&Ga(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function Da(t,e,r,n){var i=t.prev,o=t,a=t.next;if(Ga(i,o,a)>=0)return!1;for(var s=i.x>o.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,l=Ua(i.x=l&&p&&p.z<=c;){if(h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;if(h=h.prevZ,p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;h&&h.z>=l;){if(h!==t.prev&&h!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,h.x,h.y)&&Ga(h.prev,h,h.next)>=0)return!1;h=h.prevZ}for(;p&&p.z<=c;){if(p!==t.prev&&p!==t.next&&Va(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&Ga(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Ra(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Xa(i,o)&&Za(i,n,n.next,o)&&Ha(i,o)&&Ha(o,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(o.i/r),$a(n),$a(n.next),n=t=o),n=n.next}while(n!==t);return Aa(n)}function Oa(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qa(a,s)){var u=Ja(a,s);return a=Aa(a,a.next),u=Aa(u,u.next),ka(a,e,r,n,i,o),void ka(u,e,r,n,i,o)}s=s.next}a=a.next}while(a!==t)}function za(t,e){return t.x-e.x}function Fa(t,e){if(e=function(t,e){var r,n=e,i=t.x,o=t.y,a=-1/0;do{if(o<=n.y&&o>=n.next.y&&n.next.y!==n.y){var s=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(o===n.y)return n;if(o===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&Va(or.x||n.x===r.x&&Ba(r,n)))&&(r=n,p=u)),n=n.next}while(n!==l);return r}(t,e)){var r=Ja(e,t);Aa(e,e.next),Aa(r,r.next)}}function Ba(t,e){return Ga(t.prev,t,e.prev)<0&&Ga(e.next,t,t.next)<0}function Ua(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ja(t){var e=t,r=t;do{(e.x=0&&(t-a)*(n-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(i-a)*(n-s)>=0}function qa(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Za(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Ha(t,e)&&Ha(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ga(t.prev,t,e.prev)||Ga(t,e.prev,e))||Xa(t,e)&&Ga(t.prev,t,t.next)>0&&Ga(e.prev,e,e.next)>0)}function Ga(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Xa(t,e){return t.x===e.x&&t.y===e.y}function Za(t,e,r,n){var i=Wa(Ga(t,e,r)),o=Wa(Ga(t,e,n)),a=Wa(Ga(r,n,t)),s=Wa(Ga(r,n,e));return i!==o&&a!==s||!(0!==i||!Ya(t,r,e))||!(0!==o||!Ya(t,n,e))||!(0!==a||!Ya(r,t,n))||!(0!==s||!Ya(r,e,n))}function Ya(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Wa(t){return t>0?1:t<0?-1:0}function Ha(t,e){return Ga(t.prev,t,t.next)<0?Ga(t,e,t.next)>=0&&Ga(t,t.prev,e)>=0:Ga(t,e,t.prev)<0||Ga(t,t.next,e)<0}function Ja(t,e){var r=new Qa(t.i,t.x,t.y),n=new Qa(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Ka(t,e,r,n){var i=new Qa(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function $a(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Qa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ts(t,e,r,n){for(var i=0,o=e,a=r-n;on;){if(i-n>600){var a=i-n+1,s=r-n+1,u=Math.log(a),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(a-l)/a)*(s-a/2<0?-1:1);t(e,r,Math.max(n,Math.floor(r-s*l/a+c)),Math.min(i,Math.floor(r+(a-s)*l/a+c)),o)}var h=e[r],p=n,f=i;for(rs(e,n,r),o(e[i],h)>0&&rs(e,n,i);p0;)f--}0===o(e[n],h)?rs(e,n,f):rs(e,++f,i),f<=r&&(n=f+1),r<=f&&(i=f-1)}}(t,e,r||0,n||t.length-1,i||ns)}function rs(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function ns(t,e){return te?1:0}function is(t,e){var r=t.length;if(r<=1)return[t];for(var n,i,o=[],a=0;a1)for(var u=0;u0&&r.holes.push(n+=t[i-1].length)}return r},Pa.default=Ma;var us=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ti,this.indexArray=new Vi,this.indexArray2=new Wi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new uo,this.segments2=new uo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};us.prototype.populate=function(t,e,r){this.hasPattern=as("fill",this.layers,e);for(var n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),o=[],a=0,s=t;a>3}if(o--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&u.push(e),e=[]),e.push(new i(a,s));else{if(7!==n)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&u.push(e),u},ds.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,u=1/0,l=-1/0;t.pos>3}if(n--,1===r||2===r)(i+=t.readSVarint())s&&(s=i),(o+=t.readSVarint())l&&(l=o);else if(7!==r)throw new Error("unknown command "+r)}return[a,u,s,l]},ds.prototype.toGeoJSON=function(t,e,r){var n,i,o=this.extent*Math.pow(2,r),a=this.extent*t,s=this.extent*e,u=this.loadGeometry(),l=ds.types[this.type];function c(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}function xs(t,e,r){if(3===t){var n=new ms(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}vs.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new fs(this._pbf,e,this.extent,this._keys,this._values)};var bs={VectorTile:function(t,e){this.layers=t.readFields(xs,{},e)},VectorTileFeature:fs,VectorTileLayer:ms},ws=bs.VectorTileFeature.types,Es=Math.pow(2,13);function Is(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,2*Math.floor(n*Es)+a,i*Es*2,o*Es*2,Math.round(s))}var Ss=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((function(t){return t.id})),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Ai,this.indexArray=new Vi,this.programConfigurations=new Oo(t.layers,t.zoom),this.segments=new uo,this.stateDependentLayerIds=this.layers.filter((function(t){return t.isStateDependent()})).map((function(t){return t.id}))};function Cs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}Ss.prototype.populate=function(t,e,r){this.features=[],this.hasPattern=as("fill-extrusion",this.layers,e);for(var n=0,i=t;n8192}))||k.every((function(t){return t.y<0}))||k.every((function(t){return t.y>8192}))))for(var g=0,y=0;y=1){var v=d[y-1];if(!Cs(m,v)){h.vertexLength+4>uo.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));var _=m.sub(v)._perp()._unit(),x=v.dist(m);g+x>32768&&(g=0),Is(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,0,g),Is(this.layoutVertexArray,m.x,m.y,_.x,_.y,0,1,g),Is(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,0,g+=x),Is(this.layoutVertexArray,v.x,v.y,_.x,_.y,0,1,g);var b=h.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),h.vertexLength+=4,h.primitiveLength+=2}}}}if(h.vertexLength+u>uo.MAX_VERTEX_ARRAY_LENGTH&&(h=this.segments.prepareSegment(u,this.layoutVertexArray,this.indexArray)),"Polygon"===ws[t.type]){for(var w=[],E=[],I=h.vertexLength,S=0,C=s;S=2&&t[u-1].equals(t[u-2]);)u--;for(var l=0;l0;if(E&&m>l){var S=c.dist(f);if(S>2*h){var C=c.sub(c.sub(f)._mult(h/S)._round());this.updateDistance(f,C),this.addCurrentVertex(C,g,0,0,p),f=C}}var P=f&&d,M=P?r:s?"butt":n;if(P&&"round"===M&&(bi&&(M="bevel"),"bevel"===M&&(b>2&&(M="flipbevel"),b100)v=y.mult(-1);else{var T=b*g.add(y).mag()/g.sub(y).mag();v._perp()._mult(T*(I?-1:1))}this.addCurrentVertex(c,v,0,0,p),this.addCurrentVertex(c,v.mult(-1),0,0,p)}else if("bevel"===M||"fakeround"===M){var L=-Math.sqrt(b*b-1),A=I?L:0,k=I?0:L;if(f&&this.addCurrentVertex(c,g,A,k,p),"fakeround"===M)for(var N=Math.round(180*w/Math.PI/20),D=1;D2*h){var U=c.add(d.sub(c)._mult(h/B)._round());this.updateDistance(c,U),this.addCurrentVertex(U,y,0,0,p),c=U}}}}},Os.prototype.addCurrentVertex=function(t,e,r,n,i,o){void 0===o&&(o=!1);var a=e.y*n-e.x,s=-e.y-e.x*n;this.addHalfVertex(t,e.x+e.y*r,e.y-e.x*r,o,!1,r,i),this.addHalfVertex(t,a,s,o,!0,-n,i),this.distance>Rs/2&&0===this.totalDistance&&(this.distance=0,this.addCurrentVertex(t,e,r,n,i,o))},Os.prototype.addHalfVertex=function(t,e,r,n,i,o,a){var s=.5*(this.lineClips?this.scaledDistance*(Rs-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t.x<<1)+(n?1:0),(t.y<<1)+(i?1:0),Math.round(63*e)+128,Math.round(63*r)+128,1+(0===o?0:o<0?-1:1)|(63&s)<<2,s>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);var u=a.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),i?this.e2=u:this.e1=u},Os.prototype.updateScaledDistance=function(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance},Os.prototype.updateDistance=function(t,e){this.distance+=t.dist(e),this.updateScaledDistance()},Bn("LineBucket",Os,{omit:["layers","patternFeatures"]});var zs=new wi({"line-cap":new mi(Lt.layout_line["line-cap"]),"line-join":new vi(Lt.layout_line["line-join"]),"line-miter-limit":new mi(Lt.layout_line["line-miter-limit"]),"line-round-limit":new mi(Lt.layout_line["line-round-limit"]),"line-sort-key":new vi(Lt.layout_line["line-sort-key"])}),Fs={paint:new wi({"line-opacity":new vi(Lt.paint_line["line-opacity"]),"line-color":new vi(Lt.paint_line["line-color"]),"line-translate":new mi(Lt.paint_line["line-translate"]),"line-translate-anchor":new mi(Lt.paint_line["line-translate-anchor"]),"line-width":new vi(Lt.paint_line["line-width"]),"line-gap-width":new vi(Lt.paint_line["line-gap-width"]),"line-offset":new vi(Lt.paint_line["line-offset"]),"line-blur":new vi(Lt.paint_line["line-blur"]),"line-dasharray":new xi(Lt.paint_line["line-dasharray"]),"line-pattern":new _i(Lt.paint_line["line-pattern"]),"line-gradient":new bi(Lt.paint_line["line-gradient"])}),layout:zs},Bs=new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new ui(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n,i){return r=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n,i)},e}(vi))(Fs.paint.properties["line-width"].specification);Bs.useIntegerZoom=!0;var Us=function(t){function e(e){t.call(this,e,Fs),this.gradientVersion=0}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype._handleSpecialPaintPropertyUpdate=function(t){"line-gradient"===t&&(this.stepInterpolant=this._transitionablePaint._values["line-gradient"].value.expression._styleExpression.expression instanceof Ge,this.gradientVersion=(this.gradientVersion+1)%s)},e.prototype.gradientExpression=function(){return this._transitionablePaint._values["line-gradient"].value.expression},e.prototype.recalculate=function(e,r){t.prototype.recalculate.call(this,e,r),this.paint._values["line-floorwidth"]=Bs.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new Os(t)},e.prototype.queryRadius=function(t){var e=t,r=js(ra("line-width",this,e),ra("line-gap-width",this,e)),n=ra("line-offset",this,e);return r/2+Math.abs(n)+na(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,o,a,s){var u=ia(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),l=s/2*js(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),c=this.paint.get("line-offset").evaluate(e,r);return c&&(n=function(t,e){for(var r=[],n=new i(0,0),o=0;o=3)for(var o=0;o0?e+2*t:t}var Vs=Pi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),qs=Pi([{name:"a_projected_pos",components:3,type:"Float32"}],4),Gs=(Pi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Pi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}])),Xs=(Pi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Pi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4)),Zs=Pi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Ys(t,e,r){return t.sections.forEach((function(t){t.text=function(t,e,r){var n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),si.applyArabicShaping&&(t=si.applyArabicShaping(t)),t}(t.text,e,r)})),t}Pi([{name:"triangle",components:3,type:"Uint16"}]),Pi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Pi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),Pi([{type:"Float32",name:"offsetX"}]),Pi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Ws={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},Hs=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,c=-7,h=r?i-1:0,p=r?-1:1,f=t[e+h];for(h+=p,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=p,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=p,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},Js=function(t,e,r,n,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?p/u:p*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+f]=255&s,f+=d,s/=256,i-=8);for(a=a<0;t[r+f]=255&a,f+=d,a/=256,l-=8);t[r+f-d]|=128*g},Ks=$s;function $s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}$s.Varint=0,$s.Fixed64=1,$s.Bytes=2,$s.Fixed32=5;var Qs="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function tu(t){return t.type===$s.Bytes?t.readVarint()+t.pos:t.pos+1}function eu(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function ru(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(var i=r.pos-1;i>=t;i--)r.buf[i+n]=r.buf[i]}function nu(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function du(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function gu(t,e,r){1===t&&r.readMessage(yu,e)}function yu(t,e,r){if(3===t){var n=r.readMessage(mu,{}),i=n.width,o=n.height,a=n.left,s=n.top,u=n.advance;e.push({id:n.id,bitmap:new _a({width:i+6,height:o+6},n.bitmap),metrics:{width:i,height:o,left:a,top:s,advance:u}})}}function mu(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}function vu(t){for(var e=0,r=0,n=0,i=t;n=0;p--){var f=a[p];if(!(h.w>f.w||h.h>f.h)){if(h.x=f.x,h.y=f.y,u=Math.max(u,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===f.w&&h.h===f.h){var d=a.pop();p>3,o=this.pos;this.type=7&n,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=pu(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=du(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*pu(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=pu(this.buf,this.pos)+4294967296*du(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=Hs(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Hs(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return eu(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return eu(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return eu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Qs?function(t,e,r){return Qs.decode(t.subarray(e,r))}(this.buf,e,t):function(t,e,r){for(var n="",i=e;i239?4:u>223?3:u>191?2:1;if(i+c>r)break;1===c?u<128&&(l=u):2===c?128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)<=127&&(l=null):3===c?(a=t[i+2],128==(192&(o=t[i+1]))&&128==(192&a)&&((l=(15&u)<<12|(63&o)<<6|63&a)<=2047||l>=55296&&l<=57343)&&(l=null)):4===c&&(a=t[i+2],s=t[i+3],128==(192&(o=t[i+1]))&&128==(192&a)&&128==(192&s)&&((l=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)<=65535||l>=1114112)&&(l=null)),null===l?(l=65533,c=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=c}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==$s.Bytes)return t.push(this.readVarint(e));var r=tu(this);for(t=t||[];this.pos127;);else if(e===$s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===$s.Fixed32)this.pos+=4;else{if(e!==$s.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,o=0;o55295&&n<57344){if(!i){n>56319||o+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&ru(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Js(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Js(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&ru(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,$s.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,nu,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,iu,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,su,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,ou,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,au,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,uu,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,lu,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,cu,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,hu,e)},writeBytesField:function(t,e){this.writeTag(t,$s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,$s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,$s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,$s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,$s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,$s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,$s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,$s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,$s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,$s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}};var _u=function(t,e){var r=e.pixelRatio,n=e.version,i=e.stretchX,o=e.stretchY,a=e.content;this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n},xu={tl:{configurable:!0},br:{configurable:!0},tlbr:{configurable:!0},displaySize:{configurable:!0}};xu.tl.get=function(){return[this.paddedRect.x+1,this.paddedRect.y+1]},xu.br.get=function(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]},xu.tlbr.get=function(){return this.tl.concat(this.br)},xu.displaySize.get=function(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]},Object.defineProperties(_u.prototype,xu);var bu=function(t,e){var r={},n={};this.haveRenderCallbacks=[];var i=[];this.addImages(t,r,i),this.addImages(e,n,i);var o=vu(i),a=new xa({width:o.w||1,height:o.h||1});for(var s in t){var u=t[s],l=r[s].paddedRect;xa.copy(u.data,a,{x:0,y:0},{x:l.x+1,y:l.y+1},u.data)}for(var c in e){var h=e[c],p=n[c].paddedRect,f=p.x+1,d=p.y+1,g=h.data.width,y=h.data.height;xa.copy(h.data,a,{x:0,y:0},{x:f,y:d},h.data),xa.copy(h.data,a,{x:0,y:y-1},{x:f,y:d-1},{width:g,height:1}),xa.copy(h.data,a,{x:0,y:0},{x:f,y:d+y},{width:g,height:1}),xa.copy(h.data,a,{x:g-1,y:0},{x:f-1,y:d},{width:1,height:y}),xa.copy(h.data,a,{x:0,y:0},{x:f+g,y:d},{width:1,height:y})}this.image=a,this.iconPositions=r,this.patternPositions=n};bu.prototype.addImages=function(t,e,r){for(var n in t){var i=t[n],o={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(o),e[n]=new _u(o,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}},bu.prototype.patchUpdatedImages=function(t,e){for(var r in t.dispatchRenderCallbacks(this.haveRenderCallbacks),t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)},bu.prototype.patchUpdatedImage=function(t,e,r){if(t&&e&&t.version!==e.version){t.version=e.version;var n=t.tl;r.update(e.data,void 0,{x:n[0],y:n[1]})}},Bn("ImagePosition",_u),Bn("ImageAtlas",bu);var wu={horizontal:1,vertical:2,horizontalOnly:3},Eu=function(){this.scale=1,this.fontStack="",this.imageName=null};Eu.forText=function(t,e){var r=new Eu;return r.scale=t||1,r.fontStack=e,r},Eu.forImage=function(t){var e=new Eu;return e.imageName=t,e};var Iu=function(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null};function Su(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g){var y,m=Iu.fromFeature(t,i);h===wu.vertical&&m.verticalizePunctuation();var v=si.processBidirectionalText,_=si.processStyledBidirectionalText;if(v&&1===m.sections.length){y=[];for(var x=0,b=v(m.toString(),ku(m,l,o,e,n,f,d));x0&&F>S&&(S=F)}else{var B=r[P.fontStack],U=B&&B[T];if(U&&U.rect)k=U.rect,A=U.metrics;else{var j=e[P.fontStack],V=j&&j[T];if(!V)continue;A=V.metrics}L=24*(b-P.scale)}R?(t.verticalizable=!0,I.push({glyph:T,imageName:N,x:p,y:f+L,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:M,metrics:A,rect:k}),p+=D*P.scale+l):(I.push({glyph:T,imageName:N,x:p,y:f+L,vertical:R,scale:P.scale,fontStack:P.fontStack,sectionIndex:M,metrics:A,rect:k}),p+=A.advance*P.scale+l)}0!==I.length&&(d=Math.max(p-l,d),Du(I,0,I.length-1,y,S)),p=0;var q=o*b+S;E.lineOffset=Math.max(S,w),f+=q,g=Math.max(q,g),++m}else f+=o,++m}var G,X=f- -17,Z=Nu(a),Y=Z.horizontalAlign,W=Z.verticalAlign;(function(t,e,r,n,i,o,a,s,u){var l,c=(e-r)*i;l=o!==a?-s*n- -17:(-n*u+.5)*a;for(var h=0,p=t;h=0&&n>=t&&Cu[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)},Iu.prototype.substring=function(t,e){var r=new Iu;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r},Iu.prototype.toString=function(){return this.text},Iu.prototype.getMaxScale=function(){var t=this;return this.sectionIndex.reduce((function(e,r){return Math.max(e,t.sections[r].scale)}),0)},Iu.prototype.addTextSection=function(t,e){this.text+=t.text,this.sections.push(Eu.forText(t.scale,t.fontStack||e));for(var r=this.sections.length-1,n=0;n=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)};var Cu={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Pu={};function Mu(t,e,r,n,i,o){if(e.imageName){var a=n[e.imageName];return a?a.displaySize[0]*e.scale*24/o+i:0}var s=r[e.fontStack],u=s&&s[t];return u?u.metrics.advance*e.scale+i:0}function Tu(t,e,r,n){var i=Math.pow(t-e,2);return n?t=0,h=0,p=0;p-r/2;){if(--a<0)return!1;s-=t[a].dist(o),o=t[a]}s+=t[a].dist(t[a+1]),a++;for(var u=[],l=0;sn;)l-=u.shift().angleDelta;if(l>i)return!1;a++,s+=c.dist(h)}return!0}function Vu(t){for(var e=0,r=0;rl){var d=(l-u)/f,g=Xe(h.x,p.x,d),y=Xe(h.y,p.y,d),m=new Ou(g,y,p.angleTo(h),c);return m._round(),!a||ju(t,m,s,a,e)?m:void 0}u+=f}}function Zu(t,e,r,n,i,o,a,s,u){var l=qu(n,o,a),c=Gu(n,i),h=c*a,p=0===t[0].x||t[0].x===u||0===t[0].y||t[0].y===u;return e-h=0&&b=0&&w=0&&f+c<=h){var E=new Ou(b,w,_,g);E._round(),i&&!ju(e,E,a,i,o)||d.push(E)}}p+=v}return u||d.length||s||(d=t(e,p/2,n,i,o,a,s,!0,l)),d}(t,p?e/2*s%e:(c/2+2*o)*a*s%e,e,l,r,h,p,!1,u)}function Yu(t,e,r,n,o){for(var a=[],s=0;s=n&&p.x>=n||(h.x>=n?h=new i(n,h.y+(n-h.x)/(p.x-h.x)*(p.y-h.y))._round():p.x>=n&&(p=new i(n,h.y+(n-h.x)/(p.x-h.x)*(p.y-h.y))._round()),h.y>=o&&p.y>=o||(h.y>=o?h=new i(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round():p.y>=o&&(p=new i(h.x+(o-h.y)/(p.y-h.y)*(p.x-h.x),o)._round()),l&&h.equals(l[l.length-1])||a.push(l=[h]),l.push(p)))))}return a}function Wu(t,e,r,n){var o=[],a=t.image,s=a.pixelRatio,u=a.paddedRect.w-2,l=a.paddedRect.h-2,c=t.right-t.left,h=t.bottom-t.top,p=a.stretchX||[[0,u]],f=a.stretchY||[[0,l]],d=function(t,e){return t+e[1]-e[0]},g=p.reduce(d,0),y=f.reduce(d,0),m=u-g,v=l-y,_=0,x=g,b=0,w=y,E=0,I=m,S=0,C=v;if(a.content&&n){var P=a.content;_=Hu(p,0,P[0]),b=Hu(f,0,P[1]),x=Hu(p,P[0],P[2]),w=Hu(f,P[1],P[3]),E=P[0]-_,S=P[1]-b,I=P[2]-P[0]-x,C=P[3]-P[1]-w}var M=function(n,o,u,l){var p=Ku(n.stretch-_,x,c,t.left),f=$u(n.fixed-E,I,n.stretch,g),d=Ku(o.stretch-b,w,h,t.top),m=$u(o.fixed-S,C,o.stretch,y),v=Ku(u.stretch-_,x,c,t.left),P=$u(u.fixed-E,I,u.stretch,g),M=Ku(l.stretch-b,w,h,t.top),T=$u(l.fixed-S,C,l.stretch,y),L=new i(p,d),A=new i(v,d),k=new i(v,M),N=new i(p,M),D=new i(f/s,m/s),R=new i(P/s,T/s),O=e*Math.PI/180;if(O){var z=Math.sin(O),F=Math.cos(O),B=[F,-z,z,F];L._matMult(B),A._matMult(B),N._matMult(B),k._matMult(B)}var U=n.stretch+n.fixed,j=o.stretch+o.fixed;return{tl:L,tr:A,bl:N,br:k,tex:{x:a.paddedRect.x+1+U,y:a.paddedRect.y+1+j,w:u.stretch+u.fixed-U,h:l.stretch+l.fixed-j},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:I/s/c,minFontScaleY:C/s/h,isSDF:r}};if(n&&(a.stretchX||a.stretchY))for(var T=Ju(p,m,g),L=Ju(f,v,y),A=0;A0&&(d=Math.max(10,d),this.circleDiameter=d)}else{var g=a.top*s-u,y=a.bottom*s+u,m=a.left*s-u,v=a.right*s+u,_=a.collisionPadding;if(_&&(m-=_[0]*s,g-=_[1]*s,v+=_[2]*s,y+=_[3]*s),c){var x=new i(m,g),b=new i(v,g),w=new i(m,y),E=new i(v,y),I=c*Math.PI/180;x._rotate(I),b._rotate(I),w._rotate(I),E._rotate(I),m=Math.min(x.x,b.x,w.x,E.x),v=Math.max(x.x,b.x,w.x,E.x),g=Math.min(x.y,b.y,w.y,E.y),y=Math.max(x.y,b.y,w.y,E.y)}t.emplaceBack(e.x,e.y,m,g,v,y,r,n,o)}this.boxEndIndex=t.length},tl=function(t,e){if(void 0===t&&(t=[]),void 0===e&&(e=el),this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)};function el(t,e){return te?1:0}function rl(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var n=1/0,o=1/0,a=-1/0,s=-1/0,u=t[0],l=0;la)&&(a=c.x),(!l||c.y>s)&&(s=c.y)}var h=Math.min(a-n,s-o),p=h/2,f=new tl([],nl);if(0===h)return new i(n,o);for(var d=n;dy.d||!y.d)&&(y=v,r&&console.log("found best %d after %d probes",Math.round(1e4*v.d)/1e4,m)),v.max-y.d<=e||(f.push(new il(v.p.x-(p=v.h/2),v.p.y-p,p,t)),f.push(new il(v.p.x+p,v.p.y-p,p,t)),f.push(new il(v.p.x-p,v.p.y+p,p,t)),f.push(new il(v.p.x+p,v.p.y+p,p,t)),m+=4)}return r&&(console.log("num probes: "+m),console.log("best distance: "+y.d)),y.p}function nl(t,e){return e.max-t.max}function il(t,e,r,n){this.p=new i(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=c.y>t.y&&t.x<(c.x-l.x)*(t.y-l.y)/(c.y-l.y)+l.x&&(r=!r),n=Math.min(n,$o(t,l,c))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}tl.prototype.push=function(t){this.data.push(t),this.length++,this._up(this.length-1)},tl.prototype.pop=function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}},tl.prototype.peek=function(){return this.data[0]},tl.prototype._up=function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,o=e[i];if(r(n,o)>=0)break;e[t]=o,t=i}e[t]=n},tl.prototype._down=function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t=0)break;e[t]=a,t=o}e[t]=i};var ol=Number.POSITIVE_INFINITY;function al(t,e){return e[1]!==ol?function(t,e,r){var n=0,i=0;switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}return[n,i]}(t,e[0],e[1]):function(t,e){var r=0,n=0;e<0&&(e=0);var i=e/Math.sqrt(2);switch(t){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-e;break;case"top":n=e-7}switch(t){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=e;break;case"right":r=-e}return[r,n]}(t,e[0])}function sl(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ul(t,e,r,n,o,a,s,u,l,c,h,p,f,d,g){var y=function(t,e,r,n,o,a,s,u){for(var l=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,c=[],h=0,p=e.positionedLines;h32640&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'):"composite"===m.kind&&((v=[128*d.compositeTextSizes[0].evaluate(s,{},g),128*d.compositeTextSizes[1].evaluate(s,{},g)])[0]>32640||v[1]>32640)&&E(t.layerIds[0]+': Value for "text-size" is >= 255. Reduce your "text-size".'),t.addSymbols(t.text,y,v,u,a,s,c,e,l.lineStartIndex,l.lineLength,f,g);for(var _=0,x=h;_=0;a--)if(n.dist(o[a])0)&&("constant"!==o.value.kind||o.value.value.length>0),l="constant"!==s.value.kind||!!s.value.value||Object.keys(s.parameters).length>0,c=i.get("symbol-sort-key");if(this.features=[],u||l){for(var h=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new ui(this.zoom),g=0,y=t;g=0;for(var k=0,N=I.sections;k=0;s--)o[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var u=0;u0},vl.prototype.hasIconData=function(){return this.icon.segments.get().length>0},vl.prototype.hasDebugData=function(){return this.textCollisionBox&&this.iconCollisionBox},vl.prototype.hasTextCollisionBoxData=function(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0},vl.prototype.hasIconCollisionBoxData=function(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0},vl.prototype.addIndicesForPlacedSymbol=function(t,e){for(var r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs,i=r.vertexStartIndex;i1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(var r=0,n=this.symbolInstanceIndexes;r=0&&n.indexOf(t)===r&&e.addIndicesForPlacedSymbol(e.text,t)})),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}},Bn("SymbolBucket",vl,{omit:["layers","collisionBoxArray","features","compareText"]}),vl.MAX_GLYPHS=65535,vl.addDynamicAttributes=dl;var _l=new wi({"symbol-placement":new mi(Lt.layout_symbol["symbol-placement"]),"symbol-spacing":new mi(Lt.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new mi(Lt.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new vi(Lt.layout_symbol["symbol-sort-key"]),"symbol-z-order":new mi(Lt.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new mi(Lt.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new mi(Lt.layout_symbol["icon-ignore-placement"]),"icon-optional":new mi(Lt.layout_symbol["icon-optional"]),"icon-rotation-alignment":new mi(Lt.layout_symbol["icon-rotation-alignment"]),"icon-size":new vi(Lt.layout_symbol["icon-size"]),"icon-text-fit":new mi(Lt.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new mi(Lt.layout_symbol["icon-text-fit-padding"]),"icon-image":new vi(Lt.layout_symbol["icon-image"]),"icon-rotate":new vi(Lt.layout_symbol["icon-rotate"]),"icon-padding":new mi(Lt.layout_symbol["icon-padding"]),"icon-keep-upright":new mi(Lt.layout_symbol["icon-keep-upright"]),"icon-offset":new vi(Lt.layout_symbol["icon-offset"]),"icon-anchor":new vi(Lt.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new mi(Lt.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new mi(Lt.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new mi(Lt.layout_symbol["text-rotation-alignment"]),"text-field":new vi(Lt.layout_symbol["text-field"]),"text-font":new vi(Lt.layout_symbol["text-font"]),"text-size":new vi(Lt.layout_symbol["text-size"]),"text-max-width":new vi(Lt.layout_symbol["text-max-width"]),"text-line-height":new mi(Lt.layout_symbol["text-line-height"]),"text-letter-spacing":new vi(Lt.layout_symbol["text-letter-spacing"]),"text-justify":new vi(Lt.layout_symbol["text-justify"]),"text-radial-offset":new vi(Lt.layout_symbol["text-radial-offset"]),"text-variable-anchor":new mi(Lt.layout_symbol["text-variable-anchor"]),"text-anchor":new vi(Lt.layout_symbol["text-anchor"]),"text-max-angle":new mi(Lt.layout_symbol["text-max-angle"]),"text-writing-mode":new mi(Lt.layout_symbol["text-writing-mode"]),"text-rotate":new vi(Lt.layout_symbol["text-rotate"]),"text-padding":new mi(Lt.layout_symbol["text-padding"]),"text-keep-upright":new mi(Lt.layout_symbol["text-keep-upright"]),"text-transform":new vi(Lt.layout_symbol["text-transform"]),"text-offset":new vi(Lt.layout_symbol["text-offset"]),"text-allow-overlap":new mi(Lt.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new mi(Lt.layout_symbol["text-ignore-placement"]),"text-optional":new mi(Lt.layout_symbol["text-optional"])}),xl={paint:new wi({"icon-opacity":new vi(Lt.paint_symbol["icon-opacity"]),"icon-color":new vi(Lt.paint_symbol["icon-color"]),"icon-halo-color":new vi(Lt.paint_symbol["icon-halo-color"]),"icon-halo-width":new vi(Lt.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vi(Lt.paint_symbol["icon-halo-blur"]),"icon-translate":new mi(Lt.paint_symbol["icon-translate"]),"icon-translate-anchor":new mi(Lt.paint_symbol["icon-translate-anchor"]),"text-opacity":new vi(Lt.paint_symbol["text-opacity"]),"text-color":new vi(Lt.paint_symbol["text-color"],{runtimeType:Vt,getOverride:function(t){return t.textColor},hasOverride:function(t){return!!t.textColor}}),"text-halo-color":new vi(Lt.paint_symbol["text-halo-color"]),"text-halo-width":new vi(Lt.paint_symbol["text-halo-width"]),"text-halo-blur":new vi(Lt.paint_symbol["text-halo-blur"]),"text-translate":new mi(Lt.paint_symbol["text-translate"]),"text-translate-anchor":new mi(Lt.paint_symbol["text-translate-anchor"])}),layout:_l},bl=function(t){this.type=t.property.overrides?t.property.overrides.runtimeType:Ft,this.defaultValue=t};bl.prototype.evaluate=function(t){if(t.formattedSection){var e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default},bl.prototype.eachChild=function(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)},bl.prototype.outputDefined=function(){return!1},bl.prototype.serialize=function(){return null},Bn("FormatSectionOverride",bl,{omit:["defaultValue"]});var wl=function(t){function e(e){t.call(this,e,xl)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.recalculate=function(e,r){if(t.prototype.recalculate.call(this,e,r),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){var n=this.layout.get("text-writing-mode");if(n){for(var i=[],o=0,a=n;o",targetMapId:n,sourceMapId:o.mapId})}}},Ol.prototype.receive=function(t){var e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(""===e.type){delete this.tasks[r];var n=this.cancelCallbacks[r];delete this.cancelCallbacks[r],n&&n()}else C()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},Ol.prototype.process=function(){if(this.taskQueue.length){var t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)}},Ol.prototype.processTask=function(t,e){var r=this;if(""===e.type){var n=this.callbacks[t];delete this.callbacks[t],n&&(e.error?n(Gn(e.error)):n(null,Gn(e.data)))}else{var i=!1,o=T(this.globalScope)?void 0:[],a=e.hasCallback?function(e,n){i=!0,delete r.cancelCallbacks[t],r.target.postMessage({id:t,type:"",sourceMapId:r.mapId,error:e?qn(e):null,data:qn(n,o)},o)}:function(t){i=!0},s=null,u=Gn(e.data);if(this.parent[e.type])s=this.parent[e.type](e.sourceMapId,u,a);else if(this.parent.getWorkerSource){var l=e.type.split(".");s=this.parent.getWorkerSource(e.sourceMapId,l[0],u.source)[l[1]](u,a)}else a(new Error("Could not find function "+e.type));!i&&s&&s.cancel&&(this.cancelCallbacks[t]=s.cancel)}},Ol.prototype.remove=function(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)};var Fl=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};Fl.prototype.setNorthEast=function(t){return this._ne=t instanceof Bl?new Bl(t.lng,t.lat):Bl.convert(t),this},Fl.prototype.setSouthWest=function(t){return this._sw=t instanceof Bl?new Bl(t.lng,t.lat):Bl.convert(t),this},Fl.prototype.extend=function(t){var e,r,n=this._sw,i=this._ne;if(t instanceof Bl)e=t,r=t;else{if(!(t instanceof Fl))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(Fl.convert(t)):this.extend(Bl.convert(t)):this;if(r=t._ne,!(e=t._sw)||!r)return this}return n||i?(n.lng=Math.min(e.lng,n.lng),n.lat=Math.min(e.lat,n.lat),i.lng=Math.max(r.lng,i.lng),i.lat=Math.max(r.lat,i.lat)):(this._sw=new Bl(e.lng,e.lat),this._ne=new Bl(r.lng,r.lat)),this},Fl.prototype.getCenter=function(){return new Bl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},Fl.prototype.getSouthWest=function(){return this._sw},Fl.prototype.getNorthEast=function(){return this._ne},Fl.prototype.getNorthWest=function(){return new Bl(this.getWest(),this.getNorth())},Fl.prototype.getSouthEast=function(){return new Bl(this.getEast(),this.getSouth())},Fl.prototype.getWest=function(){return this._sw.lng},Fl.prototype.getSouth=function(){return this._sw.lat},Fl.prototype.getEast=function(){return this._ne.lng},Fl.prototype.getNorth=function(){return this._ne.lat},Fl.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},Fl.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},Fl.prototype.isEmpty=function(){return!(this._sw&&this._ne)},Fl.prototype.contains=function(t){var e=Bl.convert(t),r=e.lng,n=e.lat,i=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(i=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&i},Fl.convert=function(t){return!t||t instanceof Fl?t:new Fl(t)};var Bl=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: ("+t+", "+e+")");if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};Bl.prototype.wrap=function(){return new Bl(h(this.lng,-180,180),this.lat)},Bl.prototype.toArray=function(){return[this.lng,this.lat]},Bl.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},Bl.prototype.distanceTo=function(t){var e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return 6371008.8*Math.acos(Math.min(i,1))},Bl.prototype.toBounds=function(t){void 0===t&&(t=0);var e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new Fl(new Bl(this.lng-r,this.lat-e),new Bl(this.lng+r,this.lat+e))},Bl.convert=function(t){if(t instanceof Bl)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new Bl(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new Bl(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")};var Ul=2*Math.PI*6371008.8;function jl(t){return Ul*Math.cos(t*Math.PI/180)}function Vl(t){return(180+t)/360}function ql(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Gl(t,e){return t/jl(e)}function Xl(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}var Zl=function(t,e,r){void 0===r&&(r=0),this.x=+t,this.y=+e,this.z=+r};Zl.fromLngLat=function(t,e){void 0===e&&(e=0);var r=Bl.convert(t);return new Zl(Vl(r.lng),ql(r.lat),Gl(e,r.lat))},Zl.prototype.toLngLat=function(){return new Bl(360*this.x-180,Xl(this.y))},Zl.prototype.toAltitude=function(){return this.z*jl(Xl(this.y))},Zl.prototype.meterInMercatorCoordinateUnits=function(){return 1/Ul*(t=Xl(this.y),1/Math.cos(t*Math.PI/180));var t};var Yl=function(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Jl(0,t,t,e,r)};Yl.prototype.equals=function(t){return this.z===t.z&&this.x===t.x&&this.y===t.y},Yl.prototype.url=function(t,e){var r,n,i,o,a,s=(n=this.y,i=this.z,o=zl(256*(r=this.x),256*(n=Math.pow(2,i)-n-1),i),a=zl(256*(r+1),256*(n+1),i),o[0]+","+o[1]+","+a[0]+","+a[1]),u=function(t,e,r){for(var n,i="",o=t;o>0;o--)i+=(e&(n=1<this.canonical.z?new Hl(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hl(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},Hl.prototype.calculateScaledKey=function(t,e){var r=this.canonical.z-t;return t>this.canonical.z?Jl(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):Jl(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)},Hl.prototype.isChildOf=function(t){if(t.wrap!==this.wrap)return!1;var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},Hl.prototype.children=function(t){if(this.overscaledZ>=t)return[new Hl(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Hl(e,this.wrap,e,r,n),new Hl(e,this.wrap,e,r+1,n),new Hl(e,this.wrap,e,r,n+1),new Hl(e,this.wrap,e,r+1,n+1)]},Hl.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)},Kl.prototype._unpackMapbox=function(t,e,r){return(256*t*256+256*e+r)/10-1e4},Kl.prototype._unpackTerrarium=function(t,e,r){return 256*t+e+r/256-32768},Kl.prototype.getPixels=function(){return new xa({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))},Kl.prototype.backfillBorder=function(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");var n=e*this.dim,i=e*this.dim+this.dim,o=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:o=a-1;break;case 1:a=o+1}for(var s=-e*this.dim,u=-r*this.dim,l=o;l=0&&c[3]>=0&&s.insert(a,c[0],c[1],c[2],c[3])}},rc.prototype.loadVTLayers=function(){return this.vtLayers||(this.vtLayers=new bs.VectorTile(new Ks(this.rawTileData)).layers,this.sourceLayerCoder=new $l(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers},rc.prototype.query=function(t,e,r,n){var o=this;this.loadVTLayers();for(var a=t.params||{},s=8192/t.tileSize/t.scale,u=sn(a.filter),l=t.queryGeometry,c=t.queryPadding*s,h=ic(l),p=this.grid.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c),f=ic(t.cameraQueryGeometry),d=this.grid3D.query(f.minX-c,f.minY-c,f.maxX+c,f.maxY+c,(function(e,r,n,o){return function(t,e,r,n,o){for(var a=0,s=t;a=u.x&&o>=u.y)return!0}var l=[new i(e,r),new i(e,o),new i(n,o),new i(n,r)];if(t.length>2)for(var c=0,h=l;c=0)return!0;return!1}(o,h)){var f=this.sourceLayerCoder.decode(r),d=this.vtLayers[f].feature(n);if(i.needGeometry){var g=Vo(d,!0);if(!i.filter(new ui(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!i.filter(new ui(this.tileID.overscaledZ),d))return;for(var y=this.getId(d,f),m=0;mn)i=!1;else if(e)if(this.expirationTimeut&&(t.getActor().send("enforceCacheSizeLimit",st),pt=0)},t.clamp=c,t.clearTileCache=function(t){var e=a.caches.delete("mapbox-tiles");t&&e.catch(t).then((function(){return t()}))},t.clipLine=Yu,t.clone=function(t){var e=new sa(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=b,t.clone$2=function(t){var e=new sa(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},t.collisionCircleLayout=Zs,t.config=B,t.create=function(){var t=new sa(16);return sa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=function(){var t=new sa(9);return sa!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},t.create$2=function(){var t=new sa(4);return sa!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},t.createCommonjsModule=e,t.createExpression=Yr,t.createLayout=Pi,t.createStyleLayer=function(t){return"custom"===t.type?new Pl(t):new Ml[t.type](t)},t.cross=function(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],u=r[2];return t[0]=i*u-o*s,t[1]=o*a-n*u,t[2]=n*s-i*a,t},t.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t},t.number=Xe,t.offscreenCanvasSupported=ft,t.ortho=function(t,e,r,n,i,o,a){var s=1/(e-r),u=1/(n-i),l=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*l,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*u,t[14]=(a+o)*l,t[15]=1,t},t.parseGlyphPBF=function(t){return new Ks(t).readFields(gu,[])},t.pbf=Ks,t.performSymbolLayout=function(t,e,r,n,i,o,a){t.createArrays(),t.tilePixelRatio=8192/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;var s=t.layers[0].layout,u=t.layers[0]._unevaluatedLayout._values,l={};if("composite"===t.textSizeData.kind){var c=t.textSizeData,h=c.maxZoom;l.compositeTextSizes=[u["text-size"].possiblyEvaluate(new ui(c.minZoom),a),u["text-size"].possiblyEvaluate(new ui(h),a)]}if("composite"===t.iconSizeData.kind){var p=t.iconSizeData,f=p.maxZoom;l.compositeIconSizes=[u["icon-size"].possiblyEvaluate(new ui(p.minZoom),a),u["icon-size"].possiblyEvaluate(new ui(f),a)]}l.layoutTextSize=u["text-size"].possiblyEvaluate(new ui(t.zoom+1),a),l.layoutIconSize=u["icon-size"].possiblyEvaluate(new ui(t.zoom+1),a),l.textMaxSize=u["text-size"].possiblyEvaluate(new ui(18));for(var d=24*s.get("text-line-height"),g="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement"),y=s.get("text-keep-upright"),m=s.get("text-size"),v=function(){var o=x[_],u=s.get("text-font").evaluate(o,{},a).join(","),c=m.evaluate(o,{},a),h=l.layoutTextSize.evaluate(o,{},a),p=l.layoutIconSize.evaluate(o,{},a),f={horizontal:{},vertical:void 0},v=o.text,b=[0,0];if(v){var w=v.toString(),I=24*s.get("text-letter-spacing").evaluate(o,{},a),S=function(t){for(var e=0,r=t;e=8192||h.y<0||h.y>=8192||function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g,y,m,v,_,x,b,w,I,S){var C,P,M,T,L,A=t.addToLineVertexArray(e,r),k=0,N=0,D=0,R=0,O=-1,z=-1,F={},B=fo(""),U=0,j=0;if(void 0===s._unevaluatedLayout.getValue("text-radial-offset")?(U=(C=s.layout.get("text-offset").evaluate(x,{},I).map((function(t){return 24*t})))[0],j=C[1]):(U=24*s.layout.get("text-radial-offset").evaluate(x,{},I),j=ol),t.allowVerticalPlacement&&n.vertical){var V=s.layout.get("text-rotate").evaluate(x,{},I)+90;T=new Qu(u,e,l,c,h,n.vertical,p,f,d,V),a&&(L=new Qu(u,e,l,c,h,a,y,m,d,V))}if(i){var q=s.layout.get("icon-rotate").evaluate(x,{}),G="none"!==s.layout.get("icon-text-fit"),X=Wu(i,q,w,G),Z=a?Wu(a,q,w,G):void 0;M=new Qu(u,e,l,c,h,i,y,m,!1,q),k=4*X.length;var Y=t.iconSizeData,W=null;"source"===Y.kind?(W=[128*s.layout.get("icon-size").evaluate(x,{})])[0]>32640&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'):"composite"===Y.kind&&((W=[128*b.compositeIconSizes[0].evaluate(x,{},I),128*b.compositeIconSizes[1].evaluate(x,{},I)])[0]>32640||W[1]>32640)&&E(t.layerIds[0]+': Value for "icon-size" is >= 255. Reduce your "icon-size".'),t.addSymbols(t.icon,X,W,_,v,x,!1,e,A.lineStartIndex,A.lineLength,-1,I),O=t.icon.placedSymbolArray.length-1,Z&&(N=4*Z.length,t.addSymbols(t.icon,Z,W,_,v,x,wu.vertical,e,A.lineStartIndex,A.lineLength,-1,I),z=t.icon.placedSymbolArray.length-1)}for(var H in n.horizontal){var J=n.horizontal[H];if(!P){B=fo(J.text);var K=s.layout.get("text-rotate").evaluate(x,{},I);P=new Qu(u,e,l,c,h,J,p,f,d,K)}var $=1===J.positionedLines.length;if(D+=ul(t,e,J,o,s,d,x,g,A,n.vertical?wu.horizontal:wu.horizontalOnly,$?Object.keys(n.horizontal):[H],F,O,b,I),$)break}n.vertical&&(R+=ul(t,e,n.vertical,o,s,d,x,g,A,wu.vertical,["vertical"],F,z,b,I));var Q=P?P.boxStartIndex:t.collisionBoxArray.length,tt=P?P.boxEndIndex:t.collisionBoxArray.length,et=T?T.boxStartIndex:t.collisionBoxArray.length,rt=T?T.boxEndIndex:t.collisionBoxArray.length,nt=M?M.boxStartIndex:t.collisionBoxArray.length,it=M?M.boxEndIndex:t.collisionBoxArray.length,ot=L?L.boxStartIndex:t.collisionBoxArray.length,at=L?L.boxEndIndex:t.collisionBoxArray.length,st=-1,ut=function(t,e){return t&&t.circleDiameter?Math.max(t.circleDiameter,e):e};st=ut(P,st),st=ut(T,st),st=ut(M,st);var lt=(st=ut(L,st))>-1?1:0;lt&&(st*=S/24),t.glyphOffsetArray.length>=vl.MAX_GLYPHS&&E("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==x.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,F.right>=0?F.right:-1,F.center>=0?F.center:-1,F.left>=0?F.left:-1,F.vertical||-1,O,z,B,Q,tt,et,rt,nt,it,ot,at,l,D,R,k,N,lt,0,p,U,j,st)}(t,h,s,r,n,i,p,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,m,b,S,u,_,w,C,d,e,o,l,c,a)};if("line"===P)for(var A=0,k=Yu(e.geometry,0,0,8192,8192);A1){var U=Xu(B,I,r.vertical||g,n,24,v);U&&L(B,U)}}else if("Polygon"===e.type)for(var j=0,V=is(e.geometry,0);j=M.maxzoom||"none"!==M.visibility&&(a(P,this.zoom,n),(g[M.id]=M.createBucket({index:c.bucketLayerIDs.length,layers:P,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:x,sourceID:this.source})).populate(b,y,this.tileID.canonical),c.bucketLayerIDs.push(P.map((function(t){return t.id}))))}}}var T=t.mapObject(y.glyphDependencies,(function(t){return Object.keys(t).map(Number)}));Object.keys(T).length?o.send("getGlyphs",{uid:this.uid,stacks:T},(function(t,e){h||(h=t,p=e,k.call(u))})):p={};var L=Object.keys(y.iconDependencies);L.length?o.send("getImages",{icons:L,source:this.source,tileID:this.tileID,type:"icons"},(function(t,e){h||(h=t,f=e,k.call(u))})):f={};var A=Object.keys(y.patternDependencies);function k(){if(h)return s(h);if(p&&f&&d){var e=new i(p),r=new t.ImageAtlas(f,d);for(var o in g){var u=g[o];u instanceof t.SymbolBucket?(a(u.layers,this.zoom,n),t.performSymbolLayout(u,p,e.positions,f,r.iconPositions,this.showCollisionBoxes,this.tileID.canonical)):u.hasPattern&&(u instanceof t.LineBucket||u instanceof t.FillBucket||u instanceof t.FillExtrusionBucket)&&(a(u.layers,this.zoom,n),u.addFeatures(y,this.tileID.canonical,r.patternPositions))}this.status="done",s(null,{buckets:t.values(g).filter((function(t){return!t.isEmpty()})),featureIndex:c,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:e.image,imageAtlas:r,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?e.positions:null})}}A.length?o.send("getImages",{icons:A,source:this.source,tileID:this.tileID,type:"patterns"},(function(t,e){h||(h=t,d=e,k.call(u))})):d={},k.call(this)};var u=function(t,e,r,n){this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=n||s,this.loading={},this.loaded={}};u.prototype.loadTile=function(e,r){var n=this,i=e.uid;this.loading||(this.loading={});var a=!!(e&&e.request&&e.request.collectResourceTiming)&&new t.RequestPerformance(e.request),s=this.loading[i]=new o(e);s.abort=this.loadVectorData(e,(function(e,o){if(delete n.loading[i],e||!o)return s.status="done",n.loaded[i]=s,r(e);var u=o.rawData,l={};o.expires&&(l.expires=o.expires),o.cacheControl&&(l.cacheControl=o.cacheControl);var c={};if(a){var h=a.finish();h&&(c.resourceTiming=JSON.parse(JSON.stringify(h)))}s.vectorTile=o.vectorTile,s.parse(o.vectorTile,n.layerIndex,n.availableImages,n.actor,(function(e,n){if(e||!n)return r(e);r(null,t.extend({rawTileData:u.slice(0)},n,l,c))})),n.loaded=n.loaded||{},n.loaded[i]=s}))},u.prototype.reloadTile=function(t,e){var r=this,n=this.loaded,i=t.uid,o=this;if(n&&n[i]){var a=n[i];a.showCollisionBoxes=t.showCollisionBoxes;var s=function(t,n){var i=a.reloadCallback;i&&(delete a.reloadCallback,a.parse(a.vectorTile,o.layerIndex,r.availableImages,o.actor,i)),e(t,n)};"parsing"===a.status?a.reloadCallback=s:"done"===a.status&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,s):s())}},u.prototype.abortTile=function(t,e){var r=this.loading,n=t.uid;r&&r[n]&&r[n].abort&&(r[n].abort(),delete r[n]),e()},u.prototype.removeTile=function(t,e){var r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e()};var l=t.window.ImageBitmap,c=function(){this.loaded={}};function h(t,e){if(0!==t.length){p(t[0],e);for(var r=1;r=0!=!!e&&t.reverse()}c.prototype.loadTile=function(e,r){var n=e.uid,i=e.encoding,o=e.rawImageData,a=l&&o instanceof l?this.getImageData(o):o,s=new t.DEMData(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)},c.prototype.getImageData=function(e){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);var r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new t.RGBAImage({width:r.width,height:r.height},r.data)},c.prototype.removeTile=function(t){var e=this.loaded,r=t.uid;e&&e[r]&&delete e[r]};var f=t.vectorTile.VectorTileFeature.prototype.toGeoJSON,d=function(e){this._feature=e,this.extent=t.EXTENT,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))};d.prototype.loadGeometry=function(){if(1===this._feature.type){for(var e=[],r=0,n=this._feature.geometry;r>31}function M(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,o=0,a=r.length,s=0;s>1;!function t(e,r,n,i,o,a){for(;o>i;){if(o-i>600){var s=o-i+1,u=n-i+1,l=Math.log(s),c=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*c*(s-c)/s)*(u-s/2<0?-1:1);t(e,r,n,Math.max(i,Math.floor(n-u*c/s+h)),Math.min(o,Math.floor(n+(s-u)*c/s+h)),a)}var p=r[2*n+a],f=i,d=o;for(L(e,r,i,n),r[2*o+a]>p&&L(e,r,i,o);fp;)d--}r[2*i+a]===p?L(e,r,i,d):L(e,r,++d,o),d<=n&&(i=d+1),n<=d&&(o=d-1)}}(e,r,s,i,o,a%2),t(e,r,n,i,s-1,a+1),t(e,r,n,s+1,o,a+1)}}(a,s,n,0,a.length-1,0)};R.prototype.range=function(t,e,r,n){return function(t,e,r,n,i,o,a){for(var s,u,l=[0,t.length-1,0],c=[];l.length;){var h=l.pop(),p=l.pop(),f=l.pop();if(p-f<=a)for(var d=f;d<=p;d++)u=e[2*d+1],(s=e[2*d])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[d]);else{var g=Math.floor((f+p)/2);u=e[2*g+1],(s=e[2*g])>=r&&s<=i&&u>=n&&u<=o&&c.push(t[g]);var y=(h+1)%2;(0===h?r<=s:n<=u)&&(l.push(f),l.push(g-1),l.push(y)),(0===h?i>=s:o>=u)&&(l.push(g+1),l.push(p),l.push(y))}}return c}(this.ids,this.coords,t,e,r,n,this.nodeSize)},R.prototype.within=function(t,e,r){return function(t,e,r,n,i,o){for(var a=[0,t.length-1,0],s=[],u=i*i;a.length;){var l=a.pop(),c=a.pop(),h=a.pop();if(c-h<=o)for(var p=h;p<=c;p++)k(e[2*p],e[2*p+1],r,n)<=u&&s.push(t[p]);else{var f=Math.floor((h+c)/2),d=e[2*f],g=e[2*f+1];k(d,g,r,n)<=u&&s.push(t[f]);var y=(l+1)%2;(0===l?r-i<=d:n-i<=g)&&(a.push(h),a.push(f-1),a.push(y)),(0===l?r+i>=d:n+i>=g)&&(a.push(f+1),a.push(c),a.push(y))}}return s}(this.ids,this.coords,t,e,r,this.nodeSize)};var O={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:function(t){return t}},z=function(t){this.options=G(Object.create(O),t),this.trees=new Array(this.options.maxZoom+1)};function F(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:r,parentId:-1,numPoints:n,properties:i}}function B(t,e){var r=t.geometry.coordinates,n=r[1];return{x:V(r[0]),y:q(n),zoom:1/0,index:e,parentId:-1}}function U(t){return{type:"Feature",id:t.id,properties:j(t),geometry:{type:"Point",coordinates:[(n=t.x,360*(n-.5)),(e=t.y,r=(180-360*e)*Math.PI/180,360*Math.atan(Math.exp(r))/Math.PI-90)]}};var e,r,n}function j(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return G(G({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function V(t){return t/360+.5}function q(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function G(t,e){for(var r in e)t[r]=e[r];return t}function X(t){return t.x}function Z(t){return t.y}function Y(t,e,r,n,i,o){var a=i-r,s=o-n;if(0!==a||0!==s){var u=((t-r)*a+(e-n)*s)/(a*a+s*s);u>1?(r=i,n=o):u>0&&(r+=a*u,n+=s*u)}return(a=t-r)*a+(s=e-n)*s}function W(t,e,r,n){var i={id:void 0===t?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(t){var e=t.geometry,r=t.type;if("Point"===r||"MultiPoint"===r||"LineString"===r)H(t,e);else if("Polygon"===r||"MultiLineString"===r)for(var n=0;n0&&(a+=n?(i*l-u*o)/2:Math.sqrt(Math.pow(u-i,2)+Math.pow(l-o,2))),i=u,o=l}var c=e.length-3;e[2]=1,function t(e,r,n,i){for(var o,a=i,s=n-r>>1,u=n-r,l=e[r],c=e[r+1],h=e[n],p=e[n+1],f=r+3;fa)o=f,a=d;else if(d===a){var g=Math.abs(f-s);gi&&(o-r>3&&t(e,r,o,i),e[o+2]=a,n-o>3&&t(e,o,n,i))}(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Q(t,e,r,n){for(var i=0;i1?1:r}function rt(t,e,r,n,i,o,a,s){if(n/=e,o>=(r/=e)&&a=n)return null;for(var u=[],l=0;l=r&&d=n)){var g=[];if("Point"===p||"MultiPoint"===p)nt(h,g,r,n,i);else if("LineString"===p)it(h,g,r,n,i,!1,s.lineMetrics);else if("MultiLineString"===p)at(h,g,r,n,i,!1);else if("Polygon"===p)at(h,g,r,n,i,!0);else if("MultiPolygon"===p)for(var y=0;y=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function it(t,e,r,n,i,o,a){for(var s,u,l=ot(t),c=0===i?ut:lt,h=t.start,p=0;pr&&(u=c(l,f,d,y,m,r),a&&(l.start=h+s*u)):v>n?_=r&&(u=c(l,f,d,y,m,r),x=!0),_>n&&v<=n&&(u=c(l,f,d,y,m,n),x=!0),!o&&x&&(a&&(l.end=h+s*u),e.push(l),l=ot(t)),a&&(h+=s)}var b=t.length-3;f=t[b],d=t[b+1],g=t[b+2],(v=0===i?f:d)>=r&&v<=n&&st(l,f,d,g),b=l.length-3,o&&b>=3&&(l[b]!==l[0]||l[b+1]!==l[1])&&st(l,l[0],l[1],l[2]),l.length&&e.push(l)}function ot(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function at(t,e,r,n,i,o){for(var a=0;aa.maxX&&(a.maxX=c),h>a.maxY&&(a.maxY=h)}return a}function gt(t,e,r,n){var i=e.geometry,o=e.type,a=[];if("Point"===o||"MultiPoint"===o)for(var s=0;s0&&e.size<(i?a:n))r.numPoints+=e.length/3;else{for(var s=[],u=0;ua)&&(r.numSimplified++,s.push(e[u]),s.push(e[u+1])),r.numPoints++;i&&function(t,e){for(var r=0,n=0,i=t.length,o=i-2;n0===e)for(n=0,i=t.length;n24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var n=0;n=n;l--){var c=+Date.now();s=this._cluster(s,l),this.trees[l]=new R(s,X,Z,o,Float32Array),r&&console.log("z%d: %d clusters in %dms",l,s.length,+Date.now()-c)}return r&&console.timeEnd("total time"),this},z.prototype.getClusters=function(t,e){var r=((t[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,t[1])),i=180===t[2]?180:((t[2]+180)%360+360)%360-180,o=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,i=180;else if(r>i){var a=this.getClusters([r,n,180,o],e),s=this.getClusters([-180,n,i,o],e);return a.concat(s)}for(var u=this.trees[this._limitZoom(e)],l=[],c=0,h=u.range(V(r),q(o),V(i),q(n));ce&&(p+=g.numPoints||1)}if(p>=o){for(var y=u.x*h,m=u.y*h,v=i&&h>1?this._map(u,!0):null,_=(s<<5)+(e+1)+this.points.length,x=0,b=c;x1)for(var I=0,S=c;I>5},z.prototype._getOriginZoom=function(t){return(t-this.points.length)%32},z.prototype._map=function(t,e){if(t.numPoints)return e?G({},t.properties):t.properties;var r=this.points[t.index].properties,n=this.options.map(r);return e&&n===r?G({},n):n},mt.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},mt.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],u=this.options,l=u.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<1&&console.time("creation"),p=this.tiles[h]=dt(t,e,r,n,u),this.tileCoords.push({z:e,x:r,y:n}),l)){l>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));var f="z"+e;this.stats[f]=(this.stats[f]||0)+1,this.total++}if(p.source=t,i){if(e===u.maxZoom||e===i)continue;var d=1<1&&console.time("clipping");var g,y,m,v,_,x,b=.5*u.buffer/u.extent,w=.5-b,E=.5+b,I=1+b;g=y=m=v=null,_=rt(t,c,r-b,r+E,0,p.minX,p.maxX,u),x=rt(t,c,r+w,r+I,0,p.minX,p.maxX,u),t=null,_&&(g=rt(_,c,n-b,n+E,1,p.minY,p.maxY,u),y=rt(_,c,n+w,n+I,1,p.minY,p.maxY,u),_=null),x&&(m=rt(x,c,n-b,n+E,1,p.minY,p.maxY,u),v=rt(x,c,n+w,n+I,1,p.minY,p.maxY,u),x=null),l>1&&console.timeEnd("clipping"),s.push(g||[],e+1,2*r,2*n),s.push(y||[],e+1,2*r,2*n+1),s.push(m||[],e+1,2*r+1,2*n),s.push(v||[],e+1,2*r+1,2*n+1)}}},mt.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var u,l=t,c=e,h=r;!u&&l>0;)l--,c=Math.floor(c/2),h=Math.floor(h/2),u=this.tiles[vt(l,c,h)];return u&&u.source?(o>1&&console.log("found parent tile z%d-%d-%d",l,c,h),o>1&&console.time("drilling down"),this.splitTile(u.source,l,c,h,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?pt(this.tiles[s],i):null):null};var xt=function(e){function r(t,r,n,i){e.call(this,t,r,n,_t),i&&(this.loadGeoJSON=i)}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.loadData=function(t,e){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),this._pendingCallback=e,this._pendingLoadDataParams=t,this._state&&"Idle"!==this._state?this._state="NeedsLoadData":(this._state="Coalescing",this._loadData())},r.prototype._loadData=function(){var e=this;if(this._pendingCallback&&this._pendingLoadDataParams){var r=this._pendingCallback,n=this._pendingLoadDataParams;delete this._pendingCallback,delete this._pendingLoadDataParams;var i=!!(n&&n.request&&n.request.collectResourceTiming)&&new t.RequestPerformance(n.request);this.loadGeoJSON(n,(function(o,a){if(o||!a)return r(o);if("object"!=typeof a)return r(new Error("Input data given to '"+n.source+"' is not a valid GeoJSON object."));!function t(e,r){var n,i=e&&e.type;if("FeatureCollection"===i)for(n=0;n=0?0:e.button},r.remove=function(t){t.parentNode&&t.parentNode.removeChild(t)};var p=function(e){function r(){e.call(this),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new t.RGBAImage({width:1,height:1}),this.dirty=!0}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.isLoaded=function(){return this.loaded},r.prototype.setLoaded=function(t){if(this.loaded!==t&&(this.loaded=t,t)){for(var e=0,r=this.requestors;e=0?1.2:1))}function m(t,e,r,n,i,o,a){for(var s=0;s65535)e(new Error("glyphs > 65535 not supported"));else if(o.ranges[s])e(null,{stack:r,id:i,glyph:a});else{var u=o.requests[s];u||(u=o.requests[s]=[],_.loadGlyphRange(r,s,n.url,n.requestManager,(function(t,e){if(e){for(var r in e)n._doesCharSupportLocalGlyph(+r)||(o.glyphs[+r]=e[+r]);o.ranges[s]=!0}for(var i=0,a=u;i1&&(s=t[++a]);var l=Math.abs(u-s.left),c=Math.abs(u-s.right),h=Math.min(l,c),p=void 0,f=i/r*(n+1);if(s.isDash){var d=n-Math.abs(f);p=Math.sqrt(h*h+d*d)}else p=n-Math.sqrt(h*h+f*f);this.data[o+u]=Math.max(0,Math.min(255,p+128))}},E.prototype.addRegularDash=function(t){for(var e=t.length-1;e>=0;--e){var r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}var i=t[0],o=t[t.length-1];i.isDash===o.isDash&&(i.left=o.left-this.width,o.right=i.right+this.width);for(var a=this.width*this.nextRow,s=0,u=t[s],l=0;l1&&(u=t[++s]);var c=Math.abs(l-u.left),h=Math.abs(l-u.right),p=Math.min(c,h);this.data[a+l]=Math.max(0,Math.min(255,(u.isDash?p:-p)+128))}},E.prototype.addDash=function(e,r){var n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return t.warnOnce("LineAtlas out of space"),null;for(var o=0,a=0;a=n&&e.x=i&&e.y0&&(u[new t.OverscaledTileID(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},u[new t.OverscaledTileID(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+10&&(n.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire(new t.Event("data",n))}}))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setData=function(e){var r=this;return this._data=e,this.fire(new t.Event("dataloading",{dataType:"source"})),this._updateWorkerData((function(e){if(e)r.fire(new t.ErrorEvent(e));else{var n={dataType:"source",sourceDataType:"content"};r._collectResourceTiming&&r._resourceTiming&&r._resourceTiming.length>0&&(n.resourceTiming=r._resourceTiming,r._resourceTiming=[]),r.fire(new t.Event("data",n))}})),this},r.prototype.getClusterExpansionZoom=function(t,e){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:t,source:this.id},e),this},r.prototype.getClusterChildren=function(t,e){return this.actor.send("geojson.getClusterChildren",{clusterId:t,source:this.id},e),this},r.prototype.getClusterLeaves=function(t,e,r,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:t,limit:e,offset:r},n),this},r.prototype._updateWorkerData=function(e){var r=this;this._loaded=!1;var n=t.extend({},this.workerOptions),i=this._data;"string"==typeof i?(n.request=this.map._requestManager.transformRequest(t.browser.resolveURL(i),t.ResourceType.Source),n.request.collectResourceTiming=this._collectResourceTiming):n.data=JSON.stringify(i),this.actor.send(this.type+".loadData",n,(function(t,i){r._removed||i&&i.abandoned||(r._loaded=!0,i&&i.resourceTiming&&i.resourceTiming[r.id]&&(r._resourceTiming=i.resourceTiming[r.id].slice(0)),r.actor.send(r.type+".coalesce",{source:n.source},null),e(t))}))},r.prototype.loaded=function(){return this._loaded},r.prototype.loadTile=function(e,r){var n=this,i=e.actor?"reloadTile":"loadTile";e.actor=this.actor,e.request=this.actor.send(i,{type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:t.browser.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId},(function(t,o){return delete e.request,e.unloadVectorData(),e.aborted?r(null):t?r(t):(e.loadVectorData(o,n.map.painter,"reloadTile"===i),r(null))}))},r.prototype.abortTile=function(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0},r.prototype.unloadTile=function(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})},r.prototype.onRemove=function(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})},r.prototype.serialize=function(){return t.extend({},this._options,{type:this.type,data:this._data})},r.prototype.hasTransition=function(){return!1},r}(t.Evented),A=t.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),k=function(e){function r(t,r,n,i){e.call(this),this.id=t,this.dispatcher=n,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=r}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(e,r){var n=this;this._loaded=!1,this.fire(new t.Event("dataloading",{dataType:"source"})),this.url=this.options.url,t.getImage(this.map._requestManager.transformRequest(this.url,t.ResourceType.Image),(function(i,o){n._loaded=!0,i?n.fire(new t.ErrorEvent(i)):o&&(n.image=o,e&&(n.coordinates=e),r&&r(),n._finishLoading())}))},r.prototype.loaded=function(){return this._loaded},r.prototype.updateImage=function(t){var e=this;return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,(function(){e.texture=null})),this):this},r.prototype._finishLoading=function(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new t.Event("data",{dataType:"source",sourceDataType:"metadata"})))},r.prototype.onAdd=function(t){this.map=t,this.load()},r.prototype.setCoordinates=function(e){var r=this;this.coordinates=e;var n=e.map(t.MercatorCoordinate.fromLngLat);this.tileID=function(e){for(var r=1/0,n=1/0,i=-1/0,o=-1/0,a=0,s=e;ar.end(0)?this.fire(new t.ErrorEvent(new t.ValidationError("sources."+this.id,null,"Playback for this video can be set only between the "+r.start(0)+" and "+r.end(0)+"-second mark."))):this.video.currentTime=e}},r.prototype.getVideo=function(){return this.video},r.prototype.onAdd=function(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},r.prototype.prepare=function(){if(!(0===Object.keys(this.tiles).length||this.video.readyState<2)){var e=this.map.painter.context,r=e.gl;for(var n in this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new t.Texture(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this.tiles){var i=this.tiles[n];"loaded"!==i.state&&(i.state="loaded",i.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this.video&&!this.video.paused},r}(k),D=function(e){function r(r,n,i,o){e.call(this,r,n,i,o),n.coordinates?Array.isArray(n.coordinates)&&4===n.coordinates.length&&!n.coordinates.some((function(t){return!Array.isArray(t)||2!==t.length||t.some((function(t){return"number"!=typeof t}))}))||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "coordinates"'))),n.animate&&"boolean"!=typeof n.animate&&this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'optional "animate" property must be a boolean value'))),n.canvas?"string"==typeof n.canvas||n.canvas instanceof t.window.HTMLCanvasElement||this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new t.ErrorEvent(new t.ValidationError("sources."+r,null,'missing required property "canvas"'))),this.options=n,this.animate=void 0===n.animate||n.animate}return e&&(r.__proto__=e),(r.prototype=Object.create(e&&e.prototype)).constructor=r,r.prototype.load=function(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof t.window.HTMLCanvasElement?this.options.canvas:t.window.document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new t.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},r.prototype.getCanvas=function(){return this.canvas},r.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},r.prototype.onRemove=function(){this.pause()},r.prototype.prepare=function(){var e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,A.members)),this.boundsSegments||(this.boundsSegments=t.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new t.Texture(r,this.canvas,n.RGBA,{premultiply:!0}),this.tiles){var o=this.tiles[i];"loaded"!==o.state&&(o.state="loaded",o.texture=this.texture)}}},r.prototype.serialize=function(){return{type:"canvas",coordinates:this.coordinates}},r.prototype.hasTransition=function(){return this._playing},r.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];tthis.max){var a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this},B.prototype.has=function(t){return t.wrapped().key in this.data},B.prototype.getAndRemove=function(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null},B.prototype._getAndRemoveByKey=function(t){var e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value},B.prototype.getByKey=function(t){var e=this.data[t];return e?e[0].value:null},B.prototype.get=function(t){return this.has(t)?this.data[t.wrapped().key][0].value:null},B.prototype.remove=function(t,e){if(!this.has(t))return this;var r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this},B.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this},B.prototype.filter=function(t){var e=[];for(var r in this.data)for(var n=0,i=this.data[r];n1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[o]&&(t.neighboringTiles[o].backfilled=!0)))}},r.prototype.getTile=function(t){return this.getTileByID(t.key)},r.prototype.getTileByID=function(t){return this._tiles[t]},r.prototype._retainLoadedChildren=function(t,e,r,n){for(var i in this._tiles){var o=this._tiles[i];if(!(n[i]||!o.hasData()||o.tileID.overscaledZ<=e||o.tileID.overscaledZ>r)){for(var a=o.tileID;o&&o.tileID.overscaledZ>e+1;){var s=o.tileID.scaledTo(o.tileID.overscaledZ-1);(o=this._tiles[s.key])&&o.hasData()&&(a=s)}for(var u=a;u.overscaledZ>e;)if(t[(u=u.scaledTo(u.overscaledZ-1)).key]){n[a.key]=a;break}}}},r.prototype.findLoadedParent=function(t,e){if(t.key in this._loadedParentTiles){var r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(var n=t.overscaledZ-1;n>=e;n--){var i=t.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}},r.prototype._getLoadedTile=function(t){var e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(t.wrapped().key)},r.prototype.updateCacheSize=function(t){var e=Math.ceil(t.width/this._source.tileSize)+1,r=Math.ceil(t.height/this._source.tileSize)+1,n=Math.floor(e*r*5),i="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(i)},r.prototype.handleWrapJump=function(t){var e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){var r={};for(var n in this._tiles){var i=this._tiles[n];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),r[i.tileID.key]=i}for(var o in this._tiles=r,this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(var a in this._tiles)this._setTileReloadTimer(a,this._tiles[a])}},r.prototype.update=function(e){var n=this;if(this.transform=e,this._sourceLoaded&&!this._paused){var i;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used?this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map((function(e){return new t.OverscaledTileID(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y)})):(i=e.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(i=i.filter((function(t){return n._source.hasTile(t)})))):i=[];var o=e.coveringZoomLevel(this._source),a=Math.max(o-r.maxOverzooming,this._source.minzoom),s=Math.max(o+r.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(i,o);if(kt(this._source.type)){for(var l={},c={},h=0,p=Object.keys(u);hthis._source.maxzoom){var y=d.children(this._source.maxzoom)[0],m=this.getTile(y);if(m&&m.hasData()){n[y.key]=y;continue}}else{var v=d.children(this._source.maxzoom);if(n[v[0].key]&&n[v[1].key]&&n[v[2].key]&&n[v[3].key])continue}for(var _=g.wasRequested(),x=d.overscaledZ-1;x>=o;--x){var b=d.scaledTo(x);if(i[b.key])break;if(i[b.key]=!0,!(g=this.getTile(b))&&_&&(g=this._addTile(b)),g&&(n[b.key]=b,_=g.wasRequested(),g.hasData()))break}}}return n},r.prototype._updateLoadedParentTileCache=function(){for(var t in this._loadedParentTiles={},this._tiles){for(var e=[],r=void 0,n=this._tiles[t].tileID;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);var i=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(i))break;n=i}for(var o=0,a=e;o0||(e.hasData()&&"reloading"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))))},r.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._cache.reset()},r.prototype.tilesIn=function(e,r,n){var i=this,o=[],a=this.transform;if(!a)return o;for(var s=n?a.getCameraQueryGeometry(e):e,u=e.map((function(t){return a.pointCoordinate(t)})),l=s.map((function(t){return a.pointCoordinate(t)})),c=this.getIds(),h=1/0,p=1/0,f=-1/0,d=-1/0,g=0,y=l;g=0&&m[1].y+y>=0){var v=u.map((function(t){return s.getTilePoint(t)})),_=l.map((function(t){return s.getTilePoint(t)}));o.push({tile:n,tileID:s,queryGeometry:v,cameraQueryGeometry:_,scale:g})}}},_=0;_=t.browser.now())return!0}return!1},r.prototype.setFeatureState=function(t,e,r){this._state.updateState(t=t||"_geojsonTileLayer",e,r)},r.prototype.removeFeatureState=function(t,e,r){this._state.removeFeatureState(t=t||"_geojsonTileLayer",e,r)},r.prototype.getFeatureState=function(t,e){return this._state.getState(t=t||"_geojsonTileLayer",e)},r.prototype.setDependencies=function(t,e,r){var n=this._tiles[t];n&&n.setDependencies(e,r)},r.prototype.reloadTilesForDependencies=function(t,e){for(var r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(r,"reloading");this._cache.filter((function(r){return!r.hasDependency(t,e)}))},r}(t.Evented);function At(t,e){var r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function kt(t){return"raster"===t||"image"===t||"video"===t}function Nt(){return new t.window.Worker(Hi.workerUrl)}Lt.maxOverzooming=10,Lt.maxUnderzooming=3;var Dt="mapboxgl_preloaded_worker_pool",Rt=function(){this.active={}};Rt.prototype.acquire=function(t){if(!this.workers)for(this.workers=[];this.workers.length0?(i-a)/s:0;return this.points[o].mult(1-u).add(this.points[r].mult(u))};var Jt=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var o=0;o=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function re(e,r,n,i,o,a,s,u){var l=i?e.textSizeData:e.iconSizeData,c=t.evaluateSizeForZoom(l,n.transform.zoom),h=[256/n.width*2+1,256/n.height*2+1],p=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;p.clear();for(var f=e.lineVertexArray,d=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,g=n.transform.width/n.transform.height,y=!1,m=0;mMath.abs(n.x-r.x)*i?{useVertical:!0}:(e===t.WritingMode.vertical?r.yn.x)?{needsFlipping:!0}:null}function oe(e,r,n,i,o,a,s,u,l,c,h,p,f,d){var g,y=r/24,m=e.lineOffsetX*y,v=e.lineOffsetY*y;if(e.numGlyphs>1){var _=e.glyphStartIndex+e.numGlyphs,x=e.lineStartIndex,b=e.lineStartIndex+e.lineLength,w=ne(y,u,m,v,n,h,p,e,l,a,f);if(!w)return{notEnoughRoom:!0};var E=Qt(w.first.point,s).point,I=Qt(w.last.point,s).point;if(i&&!n){var S=ie(e.writingMode,E,I,d);if(S)return S}g=[w.first];for(var C=e.glyphStartIndex+1;C<_-1;C++)g.push(se(y*u.getoffsetX(C),m,v,n,h,p,e.segment,x,b,l,a,f));g.push(w.last)}else{if(i&&!n){var P=Qt(p,o).point,M=e.lineStartIndex+e.segment+1,T=new t.Point(l.getx(M),l.gety(M)),L=Qt(T,o),A=L.signedDistanceFromCamera>0?L.point:ae(p,T,P,1,o),k=ie(e.writingMode,P,A,d);if(k)return k}var N=se(y*u.getoffsetX(e.glyphStartIndex),m,v,n,h,p,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,l,a,f);if(!N)return{notEnoughRoom:!0};g=[N]}for(var D=0,R=g;D0?1:-1,g=0;i&&(d*=-1,g=Math.PI),d<0&&(g+=Math.PI);for(var y=d>0?u+s:u+s+1,m=o,v=o,_=0,x=0,b=Math.abs(f),w=[];_+x<=b;){if((y+=d)=l)return null;if(v=m,w.push(m),void 0===(m=p[y])){var E=new t.Point(c.getx(y),c.gety(y)),I=Qt(E,h);if(I.signedDistanceFromCamera>0)m=p[y]=I.point;else{var S=y-d;m=ae(0===_?a:new t.Point(c.getx(S),c.gety(S)),E,v,b-_+1,h)}}_+=x,x=v.dist(m)}var C=(b-_)/x,P=m.sub(v),M=P.mult(C)._add(v);M._add(P._unit()._perp()._mult(n*d));var T=g+Math.atan2(m.y-v.y,m.x-v.x);return w.push(M),{point:M,angle:T,path:w}}Jt.prototype.keysLength=function(){return this.boxKeys.length+this.circleKeys.length},Jt.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},Jt.prototype.insertCircle=function(t,e,r,n){this._forEachCell(e-n,r-n,e+n,r+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(n)},Jt.prototype._insertBoxCell=function(t,e,r,n,i,o){this.boxCells[i].push(o)},Jt.prototype._insertCircleCell=function(t,e,r,n,i,o){this.circleCells[i].push(o)},Jt.prototype._query=function(t,e,r,n,i,o){if(r<0||t>this.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n){if(i)return!0;for(var s=0;s0:a},Jt.prototype._queryCircle=function(t,e,r,n,i){var o=t-r,a=t+r,s=e-r,u=e+r;if(a<0||o>this.width||u<0||s>this.height)return!n&&[];var l=[];return this._forEachCell(o,s,a,u,this._queryCellCircle,l,{hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}},i),n?l.length>0:l},Jt.prototype.query=function(t,e,r,n,i){return this._query(t,e,r,n,!1,i)},Jt.prototype.hitTest=function(t,e,r,n,i){return this._query(t,e,r,n,!0,i)},Jt.prototype.hitTestCircle=function(t,e,r,n){return this._queryCircle(t,e,r,!0,n)},Jt.prototype._queryCell=function(t,e,r,n,i,o,a,s){var u=a.seenUids,l=this.boxCells[i];if(null!==l)for(var c=this.bboxes,h=0,p=l;h=c[d+0]&&n>=c[d+1]&&(!s||s(this.boxKeys[f]))){if(a.hitTest)return o.push(!0),!0;o.push({key:this.boxKeys[f],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}var g=this.circleCells[i];if(null!==g)for(var y=this.circles,m=0,v=g;ma*a+s*s},Jt.prototype._circleAndRectCollide=function(t,e,r,n,i,o,a){var s=(o-n)/2,u=Math.abs(t-(n+s));if(u>s+r)return!1;var l=(a-i)/2,c=Math.abs(e-(i+l));if(c>l+r)return!1;if(u<=s||c<=l)return!0;var h=u-s,p=c-l;return h*h+p*p<=r*r};var ue=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function le(t,e){for(var r=0;r=1;A--)L.push(M.path[A]);for(var k=1;k0){for(var O=L[0].clone(),z=L[0].clone(),F=1;F=S.x&&z.x<=C.x&&O.y>=S.y&&z.y<=C.y?[L]:z.xC.x||z.yC.y?[]:t.clipLine([L],S.x,S.y,C.x,C.y)}for(var B=0,U=R;B=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},he.prototype.isInsideGrid=function(t,e,r,n){return r>=0&&t=0&&e0?(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(g=this.prevPlacement.variableOffsets[h.crossTileID].anchor),this.variableOffsets[h.crossTileID]={textOffset:y,width:r,height:n,anchor:t,textBoxScale:i,prevAnchor:g},this.markUsedJustification(p,t,h,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,h),this.placedOrientations[h.crossTileID]=f),{shift:m,placedGlyphBoxes:v}):void 0},be.prototype.placeLayerBucketPart=function(e,r,n){var i=this,o=e.parameters,a=o.bucket,s=o.layout,u=o.posMatrix,l=o.textLabelPlaneMatrix,c=o.labelToScreenMatrix,h=o.textPixelRatio,p=o.holdingForFade,f=o.collisionBoxArray,d=o.partiallyEvaluatedTextSize,g=o.collisionGroup,y=s.get("text-optional"),m=s.get("icon-optional"),v=s.get("text-allow-overlap"),_=s.get("icon-allow-overlap"),x="map"===s.get("text-rotation-alignment"),b="map"===s.get("text-pitch-alignment"),w="none"!==s.get("icon-text-fit"),E="viewport-y"===s.get("symbol-z-order"),I=v&&(_||!a.hasIconData()||m),S=_&&(v||!a.hasTextData()||y);!a.collisionArrays&&f&&a.deserializeCollisionBoxes(f);var C=function(e,o){if(!r[e.crossTileID])if(p)i.placements[e.crossTileID]=new ge(!1,!1,!1);else{var f,E=!1,C=!1,P=!0,M=null,T={box:null,offscreen:null},L={box:null,offscreen:null},A=null,k=null,N=0,D=0,R=0;o.textFeatureIndex?N=o.textFeatureIndex:e.useRuntimeCollisionCircles&&(N=e.featureIndex),o.verticalTextFeatureIndex&&(D=o.verticalTextFeatureIndex);var O=o.textBox;if(O){var z=function(r){var n=t.WritingMode.horizontal;if(a.allowVerticalPlacement&&!r&&i.prevPlacement){var o=i.prevPlacement.placedOrientations[e.crossTileID];o&&(i.placedOrientations[e.crossTileID]=o,i.markUsedOrientation(a,n=o,e))}return n},F=function(r,n){if(a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&o.verticalTextBox)for(var i=0,s=a.writingModes;i0&&(B=B.filter((function(t){return t!==U.anchor}))).unshift(U.anchor)}var j=function(t,r,n){for(var o=t.x2-t.x1,s=t.y2-t.y1,l=e.textBoxScale,c=w&&!_?r:null,p={box:[],offscreen:!1},f=v?2*B.length:B.length,d=0;d=B.length,e,a,n,c);if(y&&(p=y.placedGlyphBoxes)&&p.box&&p.box.length){E=!0,M=y.shift;break}}return p};F((function(){return j(O,o.iconBox,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&!(T&&T.box&&T.box.length)&&e.numVerticalGlyphVertices>0&&r?j(r,o.verticalIconBox,t.WritingMode.vertical):{box:null,offscreen:null}})),T&&(E=T.box,P=T.offscreen);var V=z(T&&T.box);if(!E&&i.prevPlacement){var q=i.prevPlacement.variableOffsets[e.crossTileID];q&&(i.variableOffsets[e.crossTileID]=q,i.markUsedJustification(a,q.anchor,e,V))}}else{var G=function(t,r){var n=i.collisionIndex.placeCollisionBox(t,v,h,u,g.predicate);return n&&n.box&&n.box.length&&(i.markUsedOrientation(a,r,e),i.placedOrientations[e.crossTileID]=r),n};F((function(){return G(O,t.WritingMode.horizontal)}),(function(){var r=o.verticalTextBox;return a.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&r?G(r,t.WritingMode.vertical):{box:null,offscreen:null}})),z(T&&T.box&&T.box.length)}}if(E=(f=T)&&f.box&&f.box.length>0,P=f&&f.offscreen,e.useRuntimeCollisionCircles){var X=a.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),Z=t.evaluateSizeForFeature(a.textSizeData,d,X),Y=s.get("text-padding");A=i.collisionIndex.placeCollisionCircles(v,X,a.lineVertexArray,a.glyphOffsetArray,Z,u,l,c,n,b,g.predicate,e.collisionCircleDiameter,Y),E=v||A.circles.length>0&&!A.collisionDetected,P=P&&A.offscreen}if(o.iconFeatureIndex&&(R=o.iconFeatureIndex),o.iconBox){var W=function(t){var e=w&&M?xe(t,M.x,M.y,x,b,i.transform.angle):t;return i.collisionIndex.placeCollisionBox(e,_,h,u,g.predicate)};C=L&&L.box&&L.box.length&&o.verticalIconBox?(k=W(o.verticalIconBox)).box.length>0:(k=W(o.iconBox)).box.length>0,P=P&&k.offscreen}var H=y||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,J=m||0===e.numIconVertices;if(H||J?J?H||(C=C&&E):E=C&&E:C=E=C&&E,E&&f&&f.box&&i.collisionIndex.insertCollisionBox(f.box,s.get("text-ignore-placement"),a.bucketInstanceId,L&&L.box&&D?D:N,g.ID),C&&k&&i.collisionIndex.insertCollisionBox(k.box,s.get("icon-ignore-placement"),a.bucketInstanceId,R,g.ID),A&&(E&&i.collisionIndex.insertCollisionCircles(A.circles,s.get("text-ignore-placement"),a.bucketInstanceId,N,g.ID),n)){var K=a.bucketInstanceId,$=i.collisionCircleArrays[K];void 0===$&&($=i.collisionCircleArrays[K]=new ye);for(var Q=0;Q=0;--M){var T=P[M];C(a.symbolInstances.get(T),a.collisionArrays[T])}else for(var L=e.symbolInstanceStart;L=0&&(e.text.placedSymbolArray.get(u).crossTileID=o>=0&&u!==o?0:n.crossTileID)}},be.prototype.markUsedOrientation=function(e,r,n){for(var i=r===t.WritingMode.horizontal||r===t.WritingMode.horizontalOnly?r:0,o=r===t.WritingMode.vertical?r:0,a=0,s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex];a0,v=i.placedOrientations[o.crossTileID],_=v===t.WritingMode.vertical,x=v===t.WritingMode.horizontal||v===t.WritingMode.horizontalOnly;if(s>0||u>0){var b=Le(y.text);d(e.text,s,_?Ae:b),d(e.text,u,x?Ae:b);var w=y.text.isHidden();[o.rightJustifiedTextSymbolIndex,o.centerJustifiedTextSymbolIndex,o.leftJustifiedTextSymbolIndex].forEach((function(t){t>=0&&(e.text.placedSymbolArray.get(t).hidden=w||_?1:0)})),o.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(o.verticalPlacedTextSymbolIndex).hidden=w||x?1:0);var E=i.variableOffsets[o.crossTileID];E&&i.markUsedJustification(e,E.anchor,o,v);var I=i.placedOrientations[o.crossTileID];I&&(i.markUsedJustification(e,"left",o,I),i.markUsedOrientation(e,I,o))}if(m){var S=Le(y.icon),C=!(p&&o.verticalPlacedIconSymbolIndex&&_);o.placedIconSymbolIndex>=0&&(d(e.icon,o.numIconVertices,C?S:Ae),e.icon.placedSymbolArray.get(o.placedIconSymbolIndex).hidden=y.icon.isHidden()),o.verticalPlacedIconSymbolIndex>=0&&(d(e.icon,o.numVerticalIconVertices,C?Ae:S),e.icon.placedSymbolArray.get(o.verticalPlacedIconSymbolIndex).hidden=y.icon.isHidden())}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){var P=e.collisionArrays[n];if(P){var M=new t.Point(0,0);if(P.textBox||P.verticalTextBox){var T=!0;if(l){var L=i.variableOffsets[g];L?(M=_e(L.anchor,L.width,L.height,L.textOffset,L.textBoxScale),c&&M._rotate(h?i.transform.angle:-i.transform.angle)):T=!1}P.textBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!T||_,M.x,M.y),P.verticalTextBox&&we(e.textCollisionBox.collisionVertexArray,y.text.placed,!T||x,M.x,M.y)}var A=Boolean(!x&&P.verticalIconBox);P.iconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,A,p?M.x:0,p?M.y:0),P.verticalIconBox&&we(e.iconCollisionBox.collisionVertexArray,y.icon.placed,!A,p?M.x:0,p?M.y:0)}}},y=0;yt},be.prototype.setStale=function(){this.stale=!0};var Ee=Math.pow(2,25),Ie=Math.pow(2,24),Se=Math.pow(2,17),Ce=Math.pow(2,16),Pe=Math.pow(2,9),Me=Math.pow(2,8),Te=Math.pow(2,1);function Le(t){if(0===t.opacity&&!t.placed)return 0;if(1===t.opacity&&t.placed)return 4294967295;var e=t.placed?1:0,r=Math.floor(127*t.opacity);return r*Ee+e*Ie+r*Se+e*Ce+r*Pe+e*Me+r*Te+e}var Ae=0,ke=function(t){this._sortAcrossTiles="viewport-y"!==t.layout.get("symbol-z-order")&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]};ke.prototype.continuePlacement=function(t,e,r,n,i){for(var o=this._bucketParts;this._currentTileIndex2};this._currentPlacementIndex>=0;){var s=r[e[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===s.type&&(!s.minzoom||s.minzoom<=u)&&(!s.maxzoom||s.maxzoom>u)){if(this._inProgressLayer||(this._inProgressLayer=new ke(s)),this._inProgressLayer.continuePlacement(n[s.source],this.placement,this._showCollisionBoxes,s,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0},Ne.prototype.commit=function(t){return this.placement.commit(t),this.placement};var De=512/t.EXTENT/2,Re=function(t,e,r){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var n=0;nt.overscaledZ)for(var s in a){var u=a[s];u.tileID.isChildOf(t)&&u.findMatches(e.symbolInstances,t,i)}else{var l=a[t.scaledTo(Number(o)).key];l&&l.findMatches(e.symbolInstances,t,i)}}for(var c=0;c1?"@2x":"",u=t.getJSON(r.transformRequest(r.normalizeSpriteURL(e,s,".json"),t.ResourceType.SpriteJSON),(function(t,e){u=null,a||(a=t,i=e,c())})),l=t.getImage(r.transformRequest(r.normalizeSpriteURL(e,s,".png"),t.ResourceType.SpriteImage),(function(t,e){l=null,a||(a=t,o=e,c())}));function c(){if(a)n(a);else if(i&&o){var e=t.browser.getImageData(o),r={};for(var s in i){var u=i[s],l=u.width,c=u.height,h=u.x,p=u.y,f=u.sdf,d=u.pixelRatio,g=u.stretchX,y=u.stretchY,m=u.content,v=new t.RGBAImage({width:l,height:c});t.RGBAImage.copy(e,v,{x:h,y:p},{x:0,y:0},{width:l,height:c}),r[s]={data:v,pixelRatio:d,sdf:f,stretchX:g,stretchY:y,content:m}}n(null,r)}}return{cancel:function(){u&&(u.cancel(),u=null),l&&(l.cancel(),l=null)}}}(e,this.map._requestManager,(function(e,n){if(r._spriteRequest=null,e)r.fire(new t.ErrorEvent(e));else if(n)for(var i in n)r.imageManager.addImage(i,n[i]);r.imageManager.setLoaded(!0),r._availableImages=r.imageManager.listImages(),r.dispatcher.broadcast("setImages",r._availableImages),r.fire(new t.Event("data",{dataType:"style"}))}))},r.prototype._validateLayer=function(e){var r=this.sourceCaches[e.source];if(r){var n=e.sourceLayer;if(n){var i=r.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(n))&&this.fire(new t.ErrorEvent(new Error('Source layer "'+n+'" does not exist on source "'+i.id+'" as specified by style layer "'+e.id+'"')))}}},r.prototype.loaded=function(){if(!this._loaded)return!1;if(Object.keys(this._updatedSources).length)return!1;for(var t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()},r.prototype._serializeLayers=function(t){for(var e=[],r=0,n=t;r0)throw new Error("Unimplemented: "+i.map((function(t){return t.command})).join(", ")+".");return n.forEach((function(t){"setTransition"!==t.command&&r[t.command].apply(r,t.args)})),this.stylesheet=e,!0},r.prototype.addImage=function(e,r){if(this.getImage(e))return this.fire(new t.ErrorEvent(new Error("An image with this name already exists.")));this.imageManager.addImage(e,r),this._afterImageUpdated(e)},r.prototype.updateImage=function(t,e){this.imageManager.updateImage(t,e)},r.prototype.getImage=function(t){return this.imageManager.getImage(t)},r.prototype.removeImage=function(e){if(!this.getImage(e))return this.fire(new t.ErrorEvent(new Error("No image with this name exists.")));this.imageManager.removeImage(e),this._afterImageUpdated(e)},r.prototype._afterImageUpdated=function(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new t.Event("data",{dataType:"style"}))},r.prototype.listImages=function(){return this._checkLoaded(),this.imageManager.listImages()},r.prototype.addSource=function(e,r,n){var i=this;if(void 0===n&&(n={}),this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error("There is already a source with this ID");if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: "+Object.keys(r).join(", ")+".");if(!(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(t.validateStyle.source,"sources."+e,r,null,n))){this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);var o=this.sourceCaches[e]=new Lt(e,r,this.dispatcher);o.style=this,o.setEventedParent(this,(function(){return{isSourceLoaded:i.loaded(),source:o.serialize(),sourceId:e}})),o.onAdd(this.map),this._changed=!0}},r.prototype.removeSource=function(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(var r in this._layers)if(this._layers[r].source===e)return this.fire(new t.ErrorEvent(new Error('Source "'+e+'" cannot be removed while layer "'+r+'" is using it.')));var n=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],n.fire(new t.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},r.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},r.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},r.prototype.addLayer=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=e.id;if(this.getLayer(i))this.fire(new t.ErrorEvent(new Error('Layer with id "'+i+'" already exists on this map')));else{var o;if("custom"===e.type){if(Be(this,t.validateCustomStyleLayer(e)))return;o=t.createStyleLayer(e)}else{if("object"==typeof e.source&&(this.addSource(i,e.source),e=t.clone$1(e),e=t.extend(e,{source:i})),this._validate(t.validateStyle.layer,"layers."+i,e,{arrayIndex:-1},n))return;o=t.createStyleLayer(e),this._validateLayer(o),o.setEventedParent(this,{layer:{id:i}}),this._serializedLayers[o.id]=o.serialize()}var a=r?this._order.indexOf(r):this._order.length;if(r&&-1===a)this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.')));else{if(this._order.splice(a,0,i),this._layerOrderChanged=!0,this._layers[i]=o,this._removedLayers[i]&&o.source&&"custom"!==o.type){var s=this._removedLayers[i];delete this._removedLayers[i],s.type!==o.type?this._updatedSources[o.source]="clear":(this._updatedSources[o.source]="reload",this.sourceCaches[o.source].pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map)}}},r.prototype.moveLayer=function(e,r){if(this._checkLoaded(),this._changed=!0,this._layers[e]){if(e!==r){var n=this._order.indexOf(e);this._order.splice(n,1);var i=r?this._order.indexOf(r):this._order.length;r&&-1===i?this.fire(new t.ErrorEvent(new Error('Layer with id "'+r+'" does not exist on this map.'))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be moved.")))},r.prototype.removeLayer=function(e){this._checkLoaded();var r=this._layers[e];if(r){r.setEventedParent(null);var n=this._order.indexOf(e);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be removed.")))},r.prototype.getLayer=function(t){return this._layers[t]},r.prototype.hasLayer=function(t){return t in this._layers},r.prototype.setLayerZoomRange=function(e,r,n){this._checkLoaded();var i=this.getLayer(e);i?i.minzoom===r&&i.maxzoom===n||(null!=r&&(i.minzoom=r),null!=n&&(i.maxzoom=n),this._updateLayer(i)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot have zoom extent.")))},r.prototype.setFilter=function(e,r,n){void 0===n&&(n={}),this._checkLoaded();var i=this.getLayer(e);if(i){if(!t.deepEqual(i.filter,r))return null==r?(i.filter=void 0,void this._updateLayer(i)):void(this._validate(t.validateStyle.filter,"layers."+i.id+".filter",r,null,n)||(i.filter=t.clone$1(r),this._updateLayer(i)))}else this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be filtered.")))},r.prototype.getFilter=function(e){return t.clone$1(this.getLayer(e).filter)},r.prototype.setLayoutProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getLayoutProperty(r),n)||(o.setLayoutProperty(r,n,i),this._updateLayer(o)):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getLayoutProperty=function(e,r){var n=this.getLayer(e);if(n)return n.getLayoutProperty(r);this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style.")))},r.prototype.setPaintProperty=function(e,r,n,i){void 0===i&&(i={}),this._checkLoaded();var o=this.getLayer(e);o?t.deepEqual(o.getPaintProperty(r),n)||(o.setPaintProperty(r,n,i)&&this._updateLayer(o),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new t.ErrorEvent(new Error("The layer '"+e+"' does not exist in the map's style and cannot be styled.")))},r.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},r.prototype.setFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=e.sourceLayer,o=this.sourceCaches[n];if(void 0!==o){var a=o.getSource().type;"geojson"===a&&i?this.fire(new t.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==a||i?(void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),o.setFeatureState(i,e.id,r)):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.removeFeatureState=function(e,r){this._checkLoaded();var n=e.source,i=this.sourceCaches[n];if(void 0!==i){var o=i.getSource().type,a="vector"===o?e.sourceLayer:void 0;"vector"!==o||a?r&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new t.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(a,e.id,r):this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+n+"' does not exist in the map's style.")))},r.prototype.getFeatureState=function(e){this._checkLoaded();var r=e.source,n=e.sourceLayer,i=this.sourceCaches[r];if(void 0!==i){if("vector"!==i.getSource().type||n)return void 0===e.id&&this.fire(new t.ErrorEvent(new Error("The feature id parameter must be provided."))),i.getFeatureState(n,e.id);this.fire(new t.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new t.ErrorEvent(new Error("The source '"+r+"' does not exist in the map's style.")))},r.prototype.getTransition=function(){return t.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},r.prototype.serialize=function(){return t.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:t.mapObject(this.sourceCaches,(function(t){return t.serialize()})),layers:this._serializeLayers(this._order)},(function(t){return void 0!==t}))},r.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.sourceCaches[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},r.prototype._flattenAndSortRenderedFeatures=function(t){for(var e=this,r=function(t){return"fill-extrusion"===e._layers[t].type},n={},i=[],o=this._order.length-1;o>=0;o--){var a=this._order[o];if(r(a)){n[a]=o;for(var s=0,u=t;s=0;f--){var d=this._order[f];if(r(d))for(var g=i.length-1;g>=0;g--){var y=i[g].feature;if(n[y.layer.id] 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}","attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,0.0,1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}"),Qe=mr("varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}","attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),tr=mr("uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}","attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,0,1);}"),er=mr("#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}"),rr=mr("varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),nr=mr("uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}"),ir=mr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}"),or=mr("varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}"),ar=mr("uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;base=max(0.0,base);height=max(0.0,height);float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}"),sr=mr("#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),ur=mr("uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}"),lr=mr("uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),cr=mr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_width2=vec2(outset,inset);}"),hr=mr("uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}"),pr=mr("uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}"),fr=mr("uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}"),dr=mr("uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),0.0,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;v_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));}"),gr=mr("#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}"),yr=mr("#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}","const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,0.0,1.0);gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),0.0,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(1.0,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}");function mr(t,e){var r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/attribute ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return{fragmentSource:t=t.replace(r,(function(t,e,r,n,i){return s[i]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),vertexSource:e=e.replace(r,(function(t,e,r,n,i){var o="float"===n?"vec2":"vec4",a=i.match(/color/)?"color":o;return s[i]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\nvarying "+r+" "+n+" "+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = a_"+i+";\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+i+"\nuniform lowp float u_"+i+"_t;\nattribute "+r+" "+o+" a_"+i+";\n#else\nuniform "+r+" "+n+" u_"+i+";\n#endif\n":"vec4"===a?"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = a_"+i+";\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+i+"\n "+r+" "+n+" "+i+" = unpack_mix_"+a+"(a_"+i+", u_"+i+"_t);\n#else\n "+r+" "+n+" "+i+" = u_"+i+";\n#endif\n"})),staticAttributes:n,staticUniforms:a}}var vr=Object.freeze({__proto__:null,prelude:Xe,background:Ze,backgroundPattern:Ye,circle:We,clippingMask:He,heatmap:Je,heatmapTexture:Ke,collisionBox:$e,collisionCircle:Qe,debug:tr,fill:er,fillOutline:rr,fillOutlinePattern:nr,fillPattern:ir,fillExtrusion:or,fillExtrusionPattern:ar,hillshadePrepare:sr,hillshade:ur,line:lr,lineGradient:cr,linePattern:hr,lineSDF:pr,raster:fr,symbolIcon:dr,symbolSDF:gr,symbolTextAndIcon:yr}),_r=function(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null};function xr(t){for(var e=[],r=0;r>16,s>>16],u_pixel_coord_lower:[65535&a,65535&s]}}br.prototype.draw=function(t,e,r,n,i,o,a,s,u,l,c,h,p,f,d,g){var y,m=t.gl;if(!this.failedToCreate){for(var v in t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(n),t.setColorMode(i),t.setCullFace(o),this.fixedUniforms)this.fixedUniforms[v].set(a[v]);f&&f.setUniforms(t,this.binderUniforms,h,{zoom:p});for(var _=(y={},y[m.LINES]=2,y[m.TRIANGLES]=3,y[m.LINE_STRIP]=1,y)[e],x=0,b=c.get();x0?1-1/(1.001-a):-a),u_contrast_factor:(o=i.paint.get("raster-contrast"),o>0?1/(1-o):1+o),u_spin_weights:Vr(i.paint.get("raster-hue-rotate"))};var o,a};function Vr(t){t*=Math.PI/180;var e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}var qr,Gr=function(t,e,r,n,i,o,a,s,u,l){var c=i.transform;return{u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+n,u_texsize:l,u_texture:0}},Xr=function(e,r,n,i,o,a,s,u,l,c,h){var p=o.transform;return t.extend(Gr(e,r,n,i,o,a,s,u,l,c),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:t.browser.devicePixelRatio,u_is_halo:+h})},Zr=function(e,r,n,i,o,a,s,u,l,c){return t.extend(Xr(e,r,n,i,o,a,s,u,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1})},Yr=function(t,e,r){return{u_matrix:t,u_opacity:e,u_color:r}},Wr=function(e,r,n,i,o,a){return t.extend(function(t,e,r,n){var i=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),a=r.imageManager.getPixelSize(),s=a.width,u=a.height,l=Math.pow(2,n.tileID.overscaledZ),c=n.tileSize*Math.pow(2,r.transform.tileZoom)/l,h=c*(n.tileID.canonical.x+n.tileID.wrap*l),p=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,u],u_mix:e.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/pe(n,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,p>>16],u_pixel_coord_lower:[65535&h,65535&p]}}(i,a,n,o),{u_matrix:e,u_opacity:r})},Hr={fillExtrusion:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fillExtrusionPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_lightpos:new t.Uniform3f(e,r.u_lightpos),u_lightintensity:new t.Uniform1f(e,r.u_lightintensity),u_lightcolor:new t.Uniform3f(e,r.u_lightcolor),u_vertical_gradient:new t.Uniform1f(e,r.u_vertical_gradient),u_height_factor:new t.Uniform1f(e,r.u_height_factor),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade),u_opacity:new t.Uniform1f(e,r.u_opacity)}},fill:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},fillPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},fillOutline:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world)}},fillOutlinePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_texsize:new t.Uniform2f(e,r.u_texsize),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},circle:function(e,r){return{u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_scale_with_map:new t.Uniform1i(e,r.u_scale_with_map),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},collisionBox:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pixels_to_tile_units:new t.Uniform1f(e,r.u_pixels_to_tile_units),u_extrude_scale:new t.Uniform2f(e,r.u_extrude_scale),u_overscale_factor:new t.Uniform1f(e,r.u_overscale_factor)}},collisionCircle:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_inv_matrix:new t.UniformMatrix4f(e,r.u_inv_matrix),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_viewport_size:new t.Uniform2f(e,r.u_viewport_size)}},debug:function(e,r){return{u_color:new t.UniformColor(e,r.u_color),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_overlay:new t.Uniform1i(e,r.u_overlay),u_overlay_scale:new t.Uniform1f(e,r.u_overlay_scale)}},clippingMask:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmap:function(e,r){return{u_extrude_scale:new t.Uniform1f(e,r.u_extrude_scale),u_intensity:new t.Uniform1f(e,r.u_intensity),u_matrix:new t.UniformMatrix4f(e,r.u_matrix)}},heatmapTexture:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_world:new t.Uniform2f(e,r.u_world),u_image:new t.Uniform1i(e,r.u_image),u_color_ramp:new t.Uniform1i(e,r.u_color_ramp),u_opacity:new t.Uniform1f(e,r.u_opacity)}},hillshade:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_latrange:new t.Uniform2f(e,r.u_latrange),u_light:new t.Uniform2f(e,r.u_light),u_shadow:new t.UniformColor(e,r.u_shadow),u_highlight:new t.UniformColor(e,r.u_highlight),u_accent:new t.UniformColor(e,r.u_accent)}},hillshadePrepare:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_image:new t.Uniform1i(e,r.u_image),u_dimension:new t.Uniform2f(e,r.u_dimension),u_zoom:new t.Uniform1f(e,r.u_zoom),u_unpack:new t.Uniform4f(e,r.u_unpack)}},line:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels)}},lineGradient:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_image:new t.Uniform1i(e,r.u_image),u_image_height:new t.Uniform1f(e,r.u_image_height)}},linePattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_texsize:new t.Uniform2f(e,r.u_texsize),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_image:new t.Uniform1i(e,r.u_image),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_scale:new t.Uniform3f(e,r.u_scale),u_fade:new t.Uniform1f(e,r.u_fade)}},lineSDF:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_ratio:new t.Uniform1f(e,r.u_ratio),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_units_to_pixels:new t.Uniform2f(e,r.u_units_to_pixels),u_patternscale_a:new t.Uniform2f(e,r.u_patternscale_a),u_patternscale_b:new t.Uniform2f(e,r.u_patternscale_b),u_sdfgamma:new t.Uniform1f(e,r.u_sdfgamma),u_image:new t.Uniform1i(e,r.u_image),u_tex_y_a:new t.Uniform1f(e,r.u_tex_y_a),u_tex_y_b:new t.Uniform1f(e,r.u_tex_y_b),u_mix:new t.Uniform1f(e,r.u_mix)}},raster:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_tl_parent:new t.Uniform2f(e,r.u_tl_parent),u_scale_parent:new t.Uniform1f(e,r.u_scale_parent),u_buffer_scale:new t.Uniform1f(e,r.u_buffer_scale),u_fade_t:new t.Uniform1f(e,r.u_fade_t),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image0:new t.Uniform1i(e,r.u_image0),u_image1:new t.Uniform1i(e,r.u_image1),u_brightness_low:new t.Uniform1f(e,r.u_brightness_low),u_brightness_high:new t.Uniform1f(e,r.u_brightness_high),u_saturation_factor:new t.Uniform1f(e,r.u_saturation_factor),u_contrast_factor:new t.Uniform1f(e,r.u_contrast_factor),u_spin_weights:new t.Uniform3f(e,r.u_spin_weights)}},symbolIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture)}},symbolSDF:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texture:new t.Uniform1i(e,r.u_texture),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},symbolTextAndIcon:function(e,r){return{u_is_size_zoom_constant:new t.Uniform1i(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new t.Uniform1i(e,r.u_is_size_feature_constant),u_size_t:new t.Uniform1f(e,r.u_size_t),u_size:new t.Uniform1f(e,r.u_size),u_camera_to_center_distance:new t.Uniform1f(e,r.u_camera_to_center_distance),u_pitch:new t.Uniform1f(e,r.u_pitch),u_rotate_symbol:new t.Uniform1i(e,r.u_rotate_symbol),u_aspect_ratio:new t.Uniform1f(e,r.u_aspect_ratio),u_fade_change:new t.Uniform1f(e,r.u_fade_change),u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_label_plane_matrix:new t.UniformMatrix4f(e,r.u_label_plane_matrix),u_coord_matrix:new t.UniformMatrix4f(e,r.u_coord_matrix),u_is_text:new t.Uniform1i(e,r.u_is_text),u_pitch_with_map:new t.Uniform1i(e,r.u_pitch_with_map),u_texsize:new t.Uniform2f(e,r.u_texsize),u_texsize_icon:new t.Uniform2f(e,r.u_texsize_icon),u_texture:new t.Uniform1i(e,r.u_texture),u_texture_icon:new t.Uniform1i(e,r.u_texture_icon),u_gamma_scale:new t.Uniform1f(e,r.u_gamma_scale),u_device_pixel_ratio:new t.Uniform1f(e,r.u_device_pixel_ratio),u_is_halo:new t.Uniform1i(e,r.u_is_halo)}},background:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_color:new t.UniformColor(e,r.u_color)}},backgroundPattern:function(e,r){return{u_matrix:new t.UniformMatrix4f(e,r.u_matrix),u_opacity:new t.Uniform1f(e,r.u_opacity),u_image:new t.Uniform1i(e,r.u_image),u_pattern_tl_a:new t.Uniform2f(e,r.u_pattern_tl_a),u_pattern_br_a:new t.Uniform2f(e,r.u_pattern_br_a),u_pattern_tl_b:new t.Uniform2f(e,r.u_pattern_tl_b),u_pattern_br_b:new t.Uniform2f(e,r.u_pattern_br_b),u_texsize:new t.Uniform2f(e,r.u_texsize),u_mix:new t.Uniform1f(e,r.u_mix),u_pattern_size_a:new t.Uniform2f(e,r.u_pattern_size_a),u_pattern_size_b:new t.Uniform2f(e,r.u_pattern_size_b),u_scale_a:new t.Uniform1f(e,r.u_scale_a),u_scale_b:new t.Uniform1f(e,r.u_scale_b),u_pixel_coord_upper:new t.Uniform2f(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new t.Uniform2f(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new t.Uniform1f(e,r.u_tile_units_to_pixels)}}};function Jr(e,r,n,i,o,a,s){for(var u=e.context,l=u.gl,c=e.useProgram("collisionBox"),h=[],p=0,f=0,d=0;d0){var b=t.create(),w=v;t.mul(b,m.placementInvProjMatrix,e.transform.glCoordMatrix),t.mul(b,b,m.placementViewportMatrix),h.push({circleArray:x,circleOffset:f,transform:w,invTransform:b}),f=p+=x.length/4}_&&c.draw(u,l.LINES,St.disabled,Ct.disabled,e.colorModeForRenderPass(),Mt.disabled,Lr(v,e.transform,y),n.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}}if(s&&h.length){var E=e.useProgram("collisionCircle"),I=new t.StructArrayLayout2f1f2i16;I.resize(4*p),I._trim();for(var S=0,C=0,P=h;C=0&&(g[m.associatedIconIndex]={shiftedAnchor:I,angle:S})}else le(m.numGlyphs,f)}if(h){d.clear();for(var P=e.icon.placedSymbolArray,M=0;M0){var s=t.browser.now(),u=(s-e.timeAdded)/a,l=r?(s-r.timeAdded)/a:-1,c=n.getSource(),h=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!r||Math.abs(r.tileID.overscaledZ-h)>Math.abs(e.tileID.overscaledZ-h),f=p&&e.refreshedUponExpiration?1:t.clamp(p?u:1-l,0,1);return e.refreshedUponExpiration&&u>=1&&(e.refreshedUponExpiration=!1),r?{opacity:1,mix:1-f}:{opacity:f,mix:0}}return{opacity:1,mix:0}}var ln=new t.Color(1,0,0,1),cn=new t.Color(0,1,0,1),hn=new t.Color(0,0,1,1),pn=new t.Color(1,0,1,1),fn=new t.Color(0,1,1,1);function dn(t,e,r,n){yn(t,0,e+r/2,t.transform.width,r,n)}function gn(t,e,r,n){yn(t,e-r/2,0,r,t.transform.height,n)}function yn(e,r,n,i,o,a){var s=e.context,u=s.gl;u.enable(u.SCISSOR_TEST),u.scissor(r*t.browser.devicePixelRatio,n*t.browser.devicePixelRatio,i*t.browser.devicePixelRatio,o*t.browser.devicePixelRatio),s.clear({color:a}),u.disable(u.SCISSOR_TEST)}function mn(e,r,n){var i=e.context,o=i.gl,a=n.posMatrix,s=e.useProgram("debug"),u=St.disabled,l=Ct.disabled,c=e.colorModeForRenderPass();i.activeTexture.set(o.TEXTURE0),e.emptyTexture.bind(o.LINEAR,o.CLAMP_TO_EDGE),s.draw(i,o.LINE_STRIP,u,l,c,Mt.disabled,kr(a,t.Color.red),"$debug",e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments);var h=r.getTileByID(n.key).latestRawTileData,p=Math.floor((h&&h.byteLength||0)/1024),f=r.getTile(n).tileSize,d=512/Math.min(f,512)*(n.overscaledZ/e.transform.zoom)*.5,g=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(g+=" => "+n.overscaledZ),function(t,e){t.initDebugOverlayCanvas();var r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(e,5,5),i.strokeText(e,5,5),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(e,g+" "+p+"kb"),s.draw(i,o.TRIANGLES,u,l,Pt.alphaBlended,Mt.disabled,kr(a,t.Color.transparent,d),"$debug",e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments)}var vn={symbol:function(e,r,n,i,o){if("translucent"===e.renderPass){var a=Ct.disabled,s=e.colorModeForRenderPass();n.layout.get("text-variable-anchor")&&function(e,r,n,i,o,a,s){for(var u=r.transform,l="map"===o,c="map"===a,h=0,p=e;h256&&this.clearStencil(),r.setColorMode(Pt.disabled),r.setDepthMode(St.disabled);var i=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(var o=0,a=e;o256&&this.clearStencil();var t=this.nextStencilID++,e=this.context.gl;return new Ct({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)},_n.prototype.stencilModeForClipping=function(t){var e=this.context.gl;return new Ct({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)},_n.prototype.stencilConfigForOverlap=function(t){var e,r=this.context.gl,n=t.sort((function(t,e){return e.overscaledZ-t.overscaledZ})),i=n[n.length-1].overscaledZ,o=n[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();for(var a={},s=0;s=0;this.currentLayer--){var x=this.style._layers[i[this.currentLayer]],b=o[x.source],w=c[x.source];this._renderTileClippingMasks(x,w),this.renderLayer(this,b,x,w)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer0?e.pop():null},_n.prototype.isPatternMissing=function(t){if(!t)return!1;if(!t.from||!t.to)return!0;var e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r},_n.prototype.useProgram=function(t,e){this.cache=this.cache||{};var r=""+t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new br(this.context,t,vr[t],e,Hr[t],this._showOverdrawInspector)),this.cache[r]},_n.prototype.setCustomLayerDefaults=function(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()},_n.prototype.setBaseState=function(){var t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)},_n.prototype.initDebugOverlayCanvas=function(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=t.window.document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new t.Texture(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))},_n.prototype.destroy=function(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()};var xn=function(t,e){this.points=t,this.planes=e};xn.fromInvProjectionMatrix=function(e,r,n){var i=Math.pow(2,n),o=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((function(r){return t.transformMat4([],r,e)})).map((function(e){return t.scale$1([],e,1/e[3]/r*i)})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((function(e){var r=t.sub([],o[e[0]],o[e[1]]),n=t.sub([],o[e[2]],o[e[1]]),i=t.normalize([],t.cross([],r,n)),a=-t.dot(i,o[e[1]]);return i.concat(a)}));return new xn(o,a)};var bn=function(e,r){this.min=e,this.max=r,this.center=t.scale$2([],t.add([],this.min,this.max),.5)};bn.prototype.quadrant=function(e){for(var r=[e%2==0,e<2],n=t.clone$2(this.min),i=t.clone$2(this.max),o=0;o=0;if(0===a)return 0;a!==r.length&&(n=!1)}if(n)return 2;for(var u=0;u<3;u++){for(var l=Number.MAX_VALUE,c=-Number.MAX_VALUE,h=0;hthis.max[u]-this.min[u])return 0}return 1};var wn=function(t,e,r,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===n&&(n=0),isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(n)||n<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=n};wn.prototype.interpolate=function(e,r,n){return null!=r.top&&null!=e.top&&(this.top=t.number(e.top,r.top,n)),null!=r.bottom&&null!=e.bottom&&(this.bottom=t.number(e.bottom,r.bottom,n)),null!=r.left&&null!=e.left&&(this.left=t.number(e.left,r.left,n)),null!=r.right&&null!=e.right&&(this.right=t.number(e.right,r.right,n)),this},wn.prototype.getCenter=function(e,r){var n=t.clamp((this.left+e-this.right)/2,0,e),i=t.clamp((this.top+r-this.bottom)/2,0,r);return new t.Point(n,i)},wn.prototype.equals=function(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right},wn.prototype.clone=function(){return new wn(this.top,this.bottom,this.left,this.right)},wn.prototype.toJSON=function(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}};var En=function(e,r,n,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=void 0===o||o,this._minZoom=e||0,this._maxZoom=r||22,this._minPitch=null==n?0:n,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new t.LngLat(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new wn,this._posMatrixCache={},this._alignedPosMatrixCache={}},In={minZoom:{configurable:!0},maxZoom:{configurable:!0},minPitch:{configurable:!0},maxPitch:{configurable:!0},renderWorldCopies:{configurable:!0},worldSize:{configurable:!0},centerOffset:{configurable:!0},size:{configurable:!0},bearing:{configurable:!0},pitch:{configurable:!0},fov:{configurable:!0},zoom:{configurable:!0},center:{configurable:!0},padding:{configurable:!0},centerPoint:{configurable:!0},unmodified:{configurable:!0},point:{configurable:!0}};En.prototype.clone=function(){var t=new En(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t},In.minZoom.get=function(){return this._minZoom},In.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},In.maxZoom.get=function(){return this._maxZoom},In.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},In.minPitch.get=function(){return this._minPitch},In.minPitch.set=function(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))},In.maxPitch.get=function(){return this._maxPitch},In.maxPitch.set=function(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))},In.renderWorldCopies.get=function(){return this._renderWorldCopies},In.renderWorldCopies.set=function(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t},In.worldSize.get=function(){return this.tileSize*this.scale},In.centerOffset.get=function(){return this.centerPoint._sub(this.size._div(2))},In.size.get=function(){return new t.Point(this.width,this.height)},In.bearing.get=function(){return-this.angle/Math.PI*180},In.bearing.set=function(e){var r=-t.wrap(e,-180,180)*Math.PI/180;this.angle!==r&&(this._unmodified=!1,this.angle=r,this._calcMatrices(),this.rotationMatrix=t.create$2(),t.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},In.pitch.get=function(){return this._pitch/Math.PI*180},In.pitch.set=function(e){var r=t.clamp(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())},In.fov.get=function(){return this._fov/Math.PI*180},In.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},In.zoom.get=function(){return this._zoom},In.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},In.center.get=function(){return this._center},In.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},In.padding.get=function(){return this._edgeInsets.toJSON()},In.padding.set=function(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())},In.centerPoint.get=function(){return this._edgeInsets.getCenter(this.width,this.height)},En.prototype.isPaddingEqual=function(t){return this._edgeInsets.equals(t)},En.prototype.interpolatePadding=function(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()},En.prototype.coveringZoomLevel=function(t){var e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)},En.prototype.getVisibleUnwrappedCoordinates=function(e){var r=[new t.UnwrappedTileID(0,e)];if(this._renderWorldCopies)for(var n=this.pointCoordinate(new t.Point(0,0)),i=this.pointCoordinate(new t.Point(this.width,0)),o=this.pointCoordinate(new t.Point(this.width,this.height)),a=this.pointCoordinate(new t.Point(0,this.height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),u=Math.floor(Math.max(n.x,i.x,o.x,a.x)),l=s-1;l<=u+1;l++)0!==l&&r.push(new t.UnwrappedTileID(l,e));return r},En.prototype.coveringTiles=function(e){var r=this.coveringZoomLevel(e),n=r;if(void 0!==e.minzoom&&re.maxzoom&&(r=e.maxzoom);var i=t.MercatorCoordinate.fromLngLat(this.center),o=Math.pow(2,r),a=[o*i.x,o*i.y,0],s=xn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r),u=e.minzoom||0;this.pitch<=60&&this._edgeInsets.top<.1&&(u=r);var l=function(t){return{aabb:new bn([t*o,0,0],[(t+1)*o,o,0]),zoom:0,x:0,y:0,wrap:t,fullyVisible:!1}},c=[],h=[],p=r,f=e.reparseOverscaled?n:r;if(this._renderWorldCopies)for(var d=1;d<=3;d++)c.push(l(-d)),c.push(l(d));for(c.push(l(0));c.length>0;){var g=c.pop(),y=g.x,m=g.y,v=g.fullyVisible;if(!v){var _=g.aabb.intersects(s);if(0===_)continue;v=2===_}var x=g.aabb.distanceX(a),b=g.aabb.distanceY(a),w=Math.max(Math.abs(x),Math.abs(b));if(g.zoom===p||w>3+(1<=u)h.push({tileID:new t.OverscaledTileID(g.zoom===p?f:g.zoom,g.wrap,g.zoom,y,m),distanceSq:t.sqrLen([a[0]-.5-y,a[1]-.5-m])});else for(var E=0;E<4;E++){var I=(y<<1)+E%2,S=(m<<1)+(E>>1);c.push({aabb:g.aabb.quadrant(E),zoom:g.zoom+1,x:I,y:S,wrap:g.wrap,fullyVisible:v})}}return h.sort((function(t,e){return t.distanceSq-e.distanceSq})).map((function(t){return t.tileID}))},En.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},In.unmodified.get=function(){return this._unmodified},En.prototype.zoomScale=function(t){return Math.pow(2,t)},En.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},En.prototype.project=function(e){var r=t.clamp(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new t.Point(t.mercatorXfromLng(e.lng)*this.worldSize,t.mercatorYfromLat(r)*this.worldSize)},En.prototype.unproject=function(e){return new t.MercatorCoordinate(e.x/this.worldSize,e.y/this.worldSize).toLngLat()},In.point.get=function(){return this.project(this.center)},En.prototype.setLocationAtPoint=function(e,r){var n=this.pointCoordinate(r),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new t.MercatorCoordinate(o.x-(n.x-i.x),o.y-(n.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())},En.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},En.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},En.prototype.locationCoordinate=function(e){return t.MercatorCoordinate.fromLngLat(e)},En.prototype.coordinateLocation=function(t){return t.toLngLat()},En.prototype.pointCoordinate=function(e){var r=[e.x,e.y,0,1],n=[e.x,e.y,1,1];t.transformMat4(r,r,this.pixelMatrixInverse),t.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],a=r[1]/i,s=n[1]/o,u=r[2]/i,l=n[2]/o,c=u===l?0:(0-u)/(l-u);return new t.MercatorCoordinate(t.number(r[0]/i,n[0]/o,c)/this.worldSize,t.number(a,s,c)/this.worldSize)},En.prototype.coordinatePoint=function(e){var r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix),new t.Point(r[0]/r[3],r[1]/r[3])},En.prototype.getBounds=function(){return(new t.LngLatBounds).extend(this.pointLocation(new t.Point(0,0))).extend(this.pointLocation(new t.Point(this.width,0))).extend(this.pointLocation(new t.Point(this.width,this.height))).extend(this.pointLocation(new t.Point(0,this.height)))},En.prototype.getMaxBounds=function(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new t.LngLatBounds([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null},En.prototype.setMaxBounds=function(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])},En.prototype.calculatePosMatrix=function(e,r){void 0===r&&(r=!1);var n=e.key,i=r?this._alignedPosMatrixCache:this._posMatrixCache;if(i[n])return i[n];var o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,u=t.identity(new Float64Array(16));return t.translate(u,u,[s*a,o.y*a,0]),t.scale(u,u,[a/t.EXTENT,a/t.EXTENT,1]),t.multiply(u,r?this.alignedProjMatrix:this.projMatrix,u),i[n]=new Float32Array(u),i[n]},En.prototype.customLayerMatrix=function(){return this.mercatorMatrix.slice()},En.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var e,r,n,i,o=-90,a=90,s=-180,u=180,l=this.size,c=this._unmodified;if(this.latRange){var h=this.latRange;o=t.mercatorYfromLat(h[1])*this.worldSize,e=(a=t.mercatorYfromLat(h[0])*this.worldSize)-oa&&(i=a-y)}if(this.lngRange){var m=f.x,v=l.x/2;m-vu&&(n=u-v)}void 0===n&&void 0===i||(this.center=this.unproject(new t.Point(void 0!==n?n:f.x,void 0!==i?i:f.y))),this._unmodified=c,this._constraining=!1}},En.prototype._calcMatrices=function(){if(this.height){var e=this.centerOffset;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var r=Math.PI/2+this._pitch,n=this._fov*(.5+e.y/this.height),i=Math.sin(n)*this.cameraToCenterDistance/Math.sin(t.clamp(Math.PI-r-n,.01,Math.PI-.01)),o=this.point,a=o.x,s=o.y,u=1.01*(Math.cos(Math.PI/2-this._pitch)*i+this.cameraToCenterDistance),l=this.height/50,c=new Float64Array(16);t.perspective(c,this._fov,this.width/this.height,l,u),c[8]=2*-e.x/this.width,c[9]=2*e.y/this.height,t.scale(c,c,[1,-1,1]),t.translate(c,c,[0,0,-this.cameraToCenterDistance]),t.rotateX(c,c,this._pitch),t.rotateZ(c,c,this.angle),t.translate(c,c,[-a,-s,0]),this.mercatorMatrix=t.scale([],c,[this.worldSize,this.worldSize,this.worldSize]),t.scale(c,c,[1,1,t.mercatorZfromAltitude(1,this.center.lat)*this.worldSize,1]),this.projMatrix=c,this.invProjMatrix=t.invert([],this.projMatrix);var h=this.width%2/2,p=this.height%2/2,f=Math.cos(this.angle),d=Math.sin(this.angle),g=a-Math.round(a)+f*h+d*p,y=s-Math.round(s)+f*p+d*h,m=new Float64Array(c);if(t.translate(m,m,[g>.5?g-1:g,y>.5?y-1:y,0]),this.alignedProjMatrix=m,c=t.create(),t.scale(c,c,[this.width/2,-this.height/2,1]),t.translate(c,c,[1,-1,0]),this.labelPlaneMatrix=c,c=t.create(),t.scale(c,c,[1,-1,1]),t.translate(c,c,[-1,-1,0]),t.scale(c,c,[2/this.width,2/this.height,1]),this.glCoordMatrix=c,this.pixelMatrix=t.multiply(new Float64Array(16),this.labelPlaneMatrix,this.projMatrix),!(c=t.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=c,this._posMatrixCache={},this._alignedPosMatrixCache={}}},En.prototype.maxPitchScaleFactor=function(){if(!this.pixelMatrixInverse)return 1;var e=this.pointCoordinate(new t.Point(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return t.transformMat4(r,r,this.pixelMatrix)[3]/this.cameraToCenterDistance},En.prototype.getCameraPoint=function(){var e=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new t.Point(0,e))},En.prototype.getCameraQueryGeometry=function(e){var r=this.getCameraPoint();if(1===e.length)return[e[0],r];for(var n=r.x,i=r.y,o=r.x,a=r.y,s=0,u=e;s=3&&!t.some((function(t){return isNaN(t)}))){var e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},Sn.prototype._updateHashUnthrottled=function(){var e=t.window.location.href.replace(/(#.+)?$/,this.getHashString());try{t.window.history.replaceState(t.window.history.state,null,e)}catch(t){}};var Cn={linearity:.3,easing:t.bezier(0,0,.3,1)},Pn=t.extend({deceleration:2500,maxSpeed:1400},Cn),Mn=t.extend({deceleration:20,maxSpeed:1400},Cn),Tn=t.extend({deceleration:1e3,maxSpeed:360},Cn),Ln=t.extend({deceleration:1e3,maxSpeed:90},Cn),An=function(t){this._map=t,this.clear()};function kn(t,e){(!t.duration||t.duration0&&r-e[0].time>160;)e.shift()},An.prototype._onMoveEnd=function(e){if(this._drainInertiaBuffer(),!(this._inertiaBuffer.length<2)){for(var r={zoom:0,bearing:0,pitch:0,pan:new t.Point(0,0),pinchAround:void 0,around:void 0},n=0,i=this._inertiaBuffer;n=this._clickTolerance||this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.dblclick=function(t){return this._firePreventable(new Dn(t.type,this._map,t))},zn.prototype.mouseover=function(t){this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.mouseout=function(t){this._map.fire(new Dn(t.type,this._map,t))},zn.prototype.touchstart=function(t){return this._firePreventable(new Rn(t.type,this._map,t))},zn.prototype.touchmove=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype.touchend=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype.touchcancel=function(t){this._map.fire(new Rn(t.type,this._map,t))},zn.prototype._firePreventable=function(t){if(this._map.fire(t),t.defaultPrevented)return{}},zn.prototype.isEnabled=function(){return!0},zn.prototype.isActive=function(){return!1},zn.prototype.enable=function(){},zn.prototype.disable=function(){};var Fn=function(t){this._map=t};Fn.prototype.reset=function(){this._delayContextMenu=!1,delete this._contextMenuEvent},Fn.prototype.mousemove=function(t){this._map.fire(new Dn(t.type,this._map,t))},Fn.prototype.mousedown=function(){this._delayContextMenu=!0},Fn.prototype.mouseup=function(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Dn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)},Fn.prototype.contextmenu=function(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Dn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()},Fn.prototype.isEnabled=function(){return!0},Fn.prototype.isActive=function(){return!1},Fn.prototype.enable=function(){},Fn.prototype.disable=function(){};var Bn=function(t,e){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=e.clickTolerance||1};function Un(t,e){for(var r={},n=0;nthis.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=e.timeStamp),n.length===this.numTouches&&(this.centroid=function(e){for(var r=new t.Point(0,0),n=0,i=e;n30)&&(this.aborted=!0)}}},jn.prototype.touchend=function(t,e,r){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===r.length){var n=!this.aborted&&this.centroid;if(this.reset(),n)return n}};var Vn=function(t){this.singleTap=new jn(t),this.numTaps=t.numTaps,this.reset()};Vn.prototype.reset=function(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()},Vn.prototype.touchstart=function(t,e,r){this.singleTap.touchstart(t,e,r)},Vn.prototype.touchmove=function(t,e,r){this.singleTap.touchmove(t,e,r)},Vn.prototype.touchend=function(t,e,r){var n=this.singleTap.touchend(t,e,r);if(n){var i=t.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(n)<30;if(i&&o||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}};var qn=function(){this._zoomIn=new Vn({numTouches:1,numTaps:2}),this._zoomOut=new Vn({numTouches:2,numTaps:1}),this.reset()};qn.prototype.reset=function(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()},qn.prototype.touchstart=function(t,e,r){this._zoomIn.touchstart(t,e,r),this._zoomOut.touchstart(t,e,r)},qn.prototype.touchmove=function(t,e,r){this._zoomIn.touchmove(t,e,r),this._zoomOut.touchmove(t,e,r)},qn.prototype.touchend=function(t,e,r){var n=this,i=this._zoomIn.touchend(t,e,r),o=this._zoomOut.touchend(t,e,r);return i?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()+1,around:e.unproject(i)},{originalEvent:t})}}):o?(this._active=!0,t.preventDefault(),setTimeout((function(){return n.reset()}),0),{cameraAnimation:function(e){return e.easeTo({duration:300,zoom:e.getZoom()-1,around:e.unproject(o)},{originalEvent:t})}}):void 0},qn.prototype.touchcancel=function(){this.reset()},qn.prototype.enable=function(){this._enabled=!0},qn.prototype.disable=function(){this._enabled=!1,this.reset()},qn.prototype.isEnabled=function(){return this._enabled},qn.prototype.isActive=function(){return this._active};var Gn={0:1,2:2},Xn=function(t){this.reset(),this._clickTolerance=t.clickTolerance||1};Xn.prototype.reset=function(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton},Xn.prototype._correctButton=function(t,e){return!1},Xn.prototype._move=function(t,e){return{}},Xn.prototype.mousedown=function(t,e){if(!this._lastPoint){var n=r.mouseButton(t);this._correctButton(t,n)&&(this._lastPoint=e,this._eventButton=n)}},Xn.prototype.mousemoveWindow=function(t,e){var r=this._lastPoint;if(r)if(t.preventDefault(),function(t,e){var r=Gn[e];return void 0===t.buttons||(t.buttons&r)!==r}(t,this._eventButton))this.reset();else if(this._moved||!(e.dist(r)0&&(this._active=!0);var i=Un(n,r),o=new t.Point(0,0),a=new t.Point(0,0),s=0;for(var u in i){var l=i[u],c=this._touches[u];c&&(o._add(l),a._add(l.sub(c)),s++,i[u]=l)}if(this._touches=i,!(sMath.abs(t.x)}var ni=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.reset=function(){t.prototype.reset.call(this),this._valid=void 0,delete this._firstMove,delete this._lastPoints},e.prototype._start=function(t){this._lastPoints=t,ri(t[0].sub(t[1]))&&(this._valid=!1)},e.prototype._move=function(t,e,r){var n=t[0].sub(this._lastPoints[0]),i=t[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(n,i,r.timeStamp),this._valid)return this._lastPoints=t,this._active=!0,{pitchDelta:(n.y+i.y)/2*-.5}},e.prototype.gestureBeginsVertically=function(t,e,r){if(void 0!==this._valid)return this._valid;var n=t.mag()>=2,i=e.mag()>=2;if(n||i){if(!n||!i)return void 0===this._firstMove&&(this._firstMove=r),r-this._firstMove<100&&void 0;var o=t.y>0==e.y>0;return ri(t)&&ri(e)&&o}},e}(Jn),ii={panStep:100,bearingStep:15,pitchStep:10},oi=function(){var t=ii;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1};function ai(t){return t*(2-t)}oi.prototype.reset=function(){this._active=!1},oi.prototype.keydown=function(t){var e=this;if(!(t.altKey||t.ctrlKey||t.metaKey)){var r=0,n=0,i=0,o=0,a=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?n=-1:(t.preventDefault(),o=-1);break;case 39:t.shiftKey?n=1:(t.preventDefault(),o=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),a=-1);break;case 40:t.shiftKey?i=-1:(t.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(n=0,i=0),{cameraAnimation:function(s){var u=s.getZoom();s.easeTo({duration:300,easeId:"keyboardHandler",easing:ai,zoom:r?Math.round(u)+r*(t.shiftKey?2:1):u,bearing:s.getBearing()+n*e._bearingStep,pitch:s.getPitch()+i*e._pitchStep,offset:[-o*e._panStep,-a*e._panStep],center:s.getCenter()},{originalEvent:t})}}}},oi.prototype.enable=function(){this._enabled=!0},oi.prototype.disable=function(){this._enabled=!1,this.reset()},oi.prototype.isEnabled=function(){return this._enabled},oi.prototype.isActive=function(){return this._active},oi.prototype.disableRotation=function(){this._rotationDisabled=!0},oi.prototype.enableRotation=function(){this._rotationDisabled=!1};var si=function(e,r){this._map=e,this._el=e.getCanvasContainer(),this._handler=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=1/450,t.bindAll(["_onTimeout"],this)};si.prototype.setZoomRate=function(t){this._defaultZoomRate=t},si.prototype.setWheelZoomRate=function(t){this._wheelZoomRate=t},si.prototype.isEnabled=function(){return!!this._enabled},si.prototype.isActive=function(){return!!this._active||void 0!==this._finishTimeout},si.prototype.isZooming=function(){return!!this._zooming},si.prototype.enable=function(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},si.prototype.disable=function(){this.isEnabled()&&(this._enabled=!1)},si.prototype.wheel=function(e){if(this.isEnabled()){var r=e.deltaMode===t.window.WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY,n=t.browser.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}},si.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},si.prototype._start=function(e){if(this._delta){this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);var n=r.mousePos(this._el,e);this._around=t.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(n)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}},si.prototype.renderFrame=function(){var e=this;if(this._frameId&&(this._frameId=null,this.isActive())){var r=this._map.transform;if(0!==this._delta){var n="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&0!==i&&(i=1/i);var o="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):r.scale;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(o*i))),"wheel"===this._type&&(this._startZoom=r.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}var a,s="number"==typeof this._targetZoom?this._targetZoom:r.zoom,u=this._startZoom,l=this._easing,c=!1;if("wheel"===this._type&&u&&l){var h=Math.min((t.browser.now()-this._lastWheelEventTime)/200,1),p=l(h);a=t.number(u,s,p),h<1?this._frameId||(this._frameId=!0):c=!0}else a=s,c=!0;return this._active=!0,c&&(this._active=!1,this._finishTimeout=setTimeout((function(){e._zooming=!1,e._handler._triggerRenderFrame(),delete e._targetZoom,delete e._finishTimeout}),200)),{noInertia:!0,needsRenderFrame:!c,zoomDelta:a-r.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}},si.prototype._smoothOutEasing=function(e){var r=t.ease;if(this._prevEase){var n=this._prevEase,i=(t.browser.now()-n.start)/n.duration,o=n.easing(i+.01)-n.easing(i),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.0729-a*a);r=t.bezier(a,s,.25,1)}return this._prevEase={start:t.browser.now(),duration:e,easing:r},r},si.prototype.reset=function(){this._active=!1};var ui=function(t,e){this._clickZoom=t,this._tapZoom=e};ui.prototype.enable=function(){this._clickZoom.enable(),this._tapZoom.enable()},ui.prototype.disable=function(){this._clickZoom.disable(),this._tapZoom.disable()},ui.prototype.isEnabled=function(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()},ui.prototype.isActive=function(){return this._clickZoom.isActive()||this._tapZoom.isActive()};var li=function(){this.reset()};li.prototype.reset=function(){this._active=!1},li.prototype.dblclick=function(t,e){return t.preventDefault(),{cameraAnimation:function(r){r.easeTo({duration:300,zoom:r.getZoom()+(t.shiftKey?-1:1),around:r.unproject(e)},{originalEvent:t})}}},li.prototype.enable=function(){this._enabled=!0},li.prototype.disable=function(){this._enabled=!1,this.reset()},li.prototype.isEnabled=function(){return this._enabled},li.prototype.isActive=function(){return this._active};var ci=function(){this._tap=new Vn({numTouches:1,numTaps:1}),this.reset()};ci.prototype.reset=function(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()},ci.prototype.touchstart=function(t,e,r){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?r.length>0&&(this._swipePoint=e[0],this._swipeTouch=r[0].identifier):this._tap.touchstart(t,e,r))},ci.prototype.touchmove=function(t,e,r){if(this._tapTime){if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;var n=e[0],i=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:i/128}}}else this._tap.touchmove(t,e,r)},ci.prototype.touchend=function(t,e,r){this._tapTime?this._swipePoint&&0===r.length&&this.reset():this._tap.touchend(t,e,r)&&(this._tapTime=t.timeStamp)},ci.prototype.touchcancel=function(){this.reset()},ci.prototype.enable=function(){this._enabled=!0},ci.prototype.disable=function(){this._enabled=!1,this.reset()},ci.prototype.isEnabled=function(){return this._enabled},ci.prototype.isActive=function(){return this._active};var hi=function(t,e,r){this._el=t,this._mousePan=e,this._touchPan=r};hi.prototype.enable=function(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},hi.prototype.disable=function(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")},hi.prototype.isEnabled=function(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()},hi.prototype.isActive=function(){return this._mousePan.isActive()||this._touchPan.isActive()};var pi=function(t,e,r){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=e,this._mousePitch=r};pi.prototype.enable=function(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()},pi.prototype.disable=function(){this._mouseRotate.disable(),this._mousePitch.disable()},pi.prototype.isEnabled=function(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())},pi.prototype.isActive=function(){return this._mouseRotate.isActive()||this._mousePitch.isActive()};var fi=function(t,e,r,n){this._el=t,this._touchZoom=e,this._touchRotate=r,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0};fi.prototype.enable=function(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},fi.prototype.disable=function(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")},fi.prototype.isEnabled=function(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()},fi.prototype.isActive=function(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()},fi.prototype.disableRotation=function(){this._rotationDisabled=!0,this._touchRotate.disable()},fi.prototype.enableRotation=function(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()};var di=function(t){return t.zoom||t.drag||t.pitch||t.rotate},gi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(t.Event);function yi(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta}var mi=function(e,n){this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new An(e),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n),t.bindAll(["handleEvent","handleWindowEvent"],this);var i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[t.window.document,"mousemove",{capture:!0}],[t.window.document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[t.window,"blur",void 0]];for(var o=0,a=this._listeners;oo?Math.min(2,b):Math.max(.5,b),w=Math.pow(y,1-e),E=i.unproject(_.add(x.mult(e*w)).mult(g));i.setLocationAtPoint(i.renderWorldCopies?E.wrap():E,d)}n._fireMoveEvents(r)}),(function(t){n._afterEase(r,t)}),e),this},r.prototype._prepareEase=function(e,r,n){void 0===n&&(n={}),this._moving=!0,r||n.moving||this.fire(new t.Event("movestart",e)),this._zooming&&!n.zooming&&this.fire(new t.Event("zoomstart",e)),this._rotating&&!n.rotating&&this.fire(new t.Event("rotatestart",e)),this._pitching&&!n.pitching&&this.fire(new t.Event("pitchstart",e))},r.prototype._fireMoveEvents=function(e){this.fire(new t.Event("move",e)),this._zooming&&this.fire(new t.Event("zoom",e)),this._rotating&&this.fire(new t.Event("rotate",e)),this._pitching&&this.fire(new t.Event("pitch",e))},r.prototype._afterEase=function(e,r){if(!this._easeId||!r||this._easeId!==r){delete this._easeId;var n=this._zooming,i=this._rotating,o=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new t.Event("zoomend",e)),i&&this.fire(new t.Event("rotateend",e)),o&&this.fire(new t.Event("pitchend",e)),this.fire(new t.Event("moveend",e))}},r.prototype.flyTo=function(e,r){var n=this;if(!e.essential&&t.browser.prefersReducedMotion){var i=t.pick(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(i,r)}this.stop(),e=t.extend({offset:[0,0],speed:1.2,curve:1.42,easing:t.ease},e);var o=this.transform,a=this.getZoom(),s=this.getBearing(),u=this.getPitch(),l=this.getPadding(),c="zoom"in e?t.clamp(+e.zoom,o.minZoom,o.maxZoom):a,h="bearing"in e?this._normalizeBearing(e.bearing,s):s,p="pitch"in e?+e.pitch:u,f="padding"in e?e.padding:o.padding,d=o.zoomScale(c-a),g=t.Point.convert(e.offset),y=o.centerPoint.add(g),m=o.pointLocation(y),v=t.LngLat.convert(e.center||m);this._normalizeCenter(v);var _=o.project(m),x=o.project(v).sub(_),b=e.curve,w=Math.max(o.width,o.height),E=w/d,I=x.mag();if("minZoom"in e){var S=t.clamp(Math.min(e.minZoom,a,c),o.minZoom,o.maxZoom),C=w/o.zoomScale(S-a);b=Math.sqrt(C/I*2)}var P=b*b;function M(t){var e=(E*E-w*w+(t?-1:1)*P*P*I*I)/(2*(t?E:w)*P*I);return Math.log(Math.sqrt(e*e+1)-e)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function L(t){return(Math.exp(t)+Math.exp(-t))/2}var A=M(0),k=function(t){return L(A)/L(A+b*t)},N=function(t){return w*((L(A)*(T(e=A+b*t)/L(e))-T(A))/P)/I;var e},D=(M(1)-A)/b;if(Math.abs(I)<1e-6||!isFinite(D)){if(Math.abs(w-E)<1e-6)return this.easeTo(e,r);var R=Ee.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=s!==h,this._pitching=p!==u,this._padding=!o.isPaddingEqual(f),this._prepareEase(r,!1),this._ease((function(e){var i=e*D,d=1/k(i);o.zoom=1===e?c:a+o.scaleZoom(d),n._rotating&&(o.bearing=t.number(s,h,e)),n._pitching&&(o.pitch=t.number(u,p,e)),n._padding&&(o.interpolatePadding(l,f,e),y=o.centerPoint.add(g));var m=1===e?v:o.unproject(_.add(x.mult(N(i))).mult(d));o.setLocationAtPoint(o.renderWorldCopies?m.wrap():m,y),n._fireMoveEvents(r)}),(function(){return n._afterEase(r)}),e),this},r.prototype.isEasing=function(){return!!this._easeFrameId},r.prototype.stop=function(){return this._stop()},r.prototype._stop=function(t,e){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){var r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,e)}if(!t){var n=this.handlers;n&&n.stop(!1)}return this},r.prototype._ease=function(e,r,n){!1===n.animate||0===n.duration?(e(1),r()):(this._easeStart=t.browser.now(),this._easeOptions=n,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))},r.prototype._renderFrameCallback=function(){var e=Math.min((t.browser.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},r.prototype._normalizeBearing=function(e,r){e=t.wrap(e,-180,180);var n=Math.abs(e-r);return Math.abs(e-360-r)180?-360:r<-180?360:0}},r}(t.Evented),_i=function(e){void 0===e&&(e={}),this.options=e,t.bindAll(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)};_i.prototype.getDefaultPosition=function(){return"bottom-right"},_i.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=r.create("button","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.type="button",this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=r.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._innerContainer.setAttribute("role","list"),e&&this._container.classList.add("maplibregl-compact","mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},_i.prototype.onRemove=function(){r.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0},_i.prototype._setElementTitle=function(t,e){var r=this._map._getUIString("AttributionControl."+e);t.title=r,t.setAttribute("aria-label",r)},_i.prototype._toggleAttribution=function(){this._container.classList.contains("maplibregl-compact-show")||this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","false")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._compactButton.setAttribute("aria-pressed","true"))},_i.prototype._updateEditLink=function(){var e=this._editLink;e||(e=this._editLink=this._container.querySelector(".mapbox-improve-map"));var r=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||t.config.ACCESS_TOKEN}];if(e){var n=r.reduce((function(t,e,n){return e.value&&(t+=e.key+"="+e.value+(n=0)return!1;return!0}))).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=a,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._editLink=null)}},_i.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("maplibregl-compact","mapboxgl-compact"):this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show")};var xi=function(){t.bindAll(["_updateLogo"],this),t.bindAll(["_updateCompact"],this)};xi.prototype.onAdd=function(t){this._map=t,this._container=r.create("div","maplibregl-ctrl mapboxgl-ctrl");var e=r.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container},xi.prototype.onRemove=function(){r.remove(this._container),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)},xi.prototype.getDefaultPosition=function(){return"bottom-left"},xi.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},xi.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},xi.prototype._updateCompact=function(){var t=this._container.children;if(t.length){var e=t[0];this._map.getCanvasContainer().offsetWidth<250?e.classList.add("maplibregl-compact","mapboxgl-compact"):e.classList.remove("maplibregl-compact","mapboxgl-compact")}};var bi=function(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1};bi.prototype.add=function(t){var e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e},bi.prototype.remove=function(t){for(var e=this._currentlyRunning,r=0,n=e?this._queue.concat(e):this._queue;re.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(null!=e.maxPitch&&e.maxPitch>60)throw new Error("maxPitch must be less than or equal to 60");var i=new En(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);if(n.call(this,i,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new bi,this._controls=[],this._mapId=t.uniqueId(),this._locale=t.extend({},wi,e.locale),this._clickTolerance=e.clickTolerance,this._requestManager=new t.RequestManager(e.transformRequest,e.accessToken),"string"==typeof e.container){if(this._container=t.window.document.getElementById(e.container),!this._container)throw new Error("Container '"+e.container+"' not found.")}else{if(!(e.container instanceof Ii))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.maxBounds),t.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw new Error("Failed to initialize WebGL.");this.on("move",(function(){return r._update(!1)})),this.on("moveend",(function(){return r._update(!1)})),this.on("zoom",(function(){return r._update(!0)})),void 0!==t.window&&(t.window.addEventListener("online",this._onWindowOnline,!1),t.window.addEventListener("resize",this._onWindowResize,!1),t.window.addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new mi(this,e),this._hash=e.hash&&new Sn("string"==typeof e.hash&&e.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,t.extend({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new _i({customAttribution:e.customAttribution})),this.addControl(new xi,e.logoPosition),this.on("style.load",(function(){r.transform.unmodified&&r.jumpTo(r.style.stylesheet)})),this.on("data",(function(e){r._update("style"===e.dataType),r.fire(new t.Event(e.dataType+"data",e))})),this.on("dataloading",(function(e){r.fire(new t.Event(e.dataType+"dataloading",e))}))}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var o={showTileBoundaries:{configurable:!0},showPadding:{configurable:!0},showCollisionBoxes:{configurable:!0},showOverdrawInspector:{configurable:!0},repaint:{configurable:!0},vertices:{configurable:!0},version:{configurable:!0}};return i.prototype._getMapId=function(){return this._mapId},i.prototype.addControl=function(e,r){if(void 0===r&&(r=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e||!e.onAdd)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));var n=e.onAdd(this);this._controls.push(e);var i=this._controlPositions[r];return-1!==r.indexOf("bottom")?i.insertBefore(n,i.firstChild):i.appendChild(n),this},i.prototype.removeControl=function(e){if(!e||!e.onRemove)return this.fire(new t.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));var r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this},i.prototype.hasControl=function(t){return this._controls.indexOf(t)>-1},i.prototype.resize=function(e){var r=this._containerDimensions(),n=r[0],i=r[1];this._resizeCanvas(n,i),this.transform.resize(n,i),this.painter.resize(n,i);var o=!this._moving;return o&&(this.stop(),this.fire(new t.Event("movestart",e)).fire(new t.Event("move",e))),this.fire(new t.Event("resize",e)),o&&this.fire(new t.Event("moveend",e)),this},i.prototype.getBounds=function(){return this.transform.getBounds()},i.prototype.getMaxBounds=function(){return this.transform.getMaxBounds()},i.prototype.setMaxBounds=function(e){return this.transform.setMaxBounds(t.LngLatBounds.convert(e)),this._update()},i.prototype.setMinZoom=function(t){if((t=null==t?-2:t)>=-2&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},i.prototype.getMaxZoom=function(){return this.transform.maxZoom},i.prototype.setMinPitch=function(t){if((t=null==t?0:t)<0)throw new Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()60)throw new Error("maxPitch must be less than or equal to 60");if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")},i.prototype.getMaxPitch=function(){return this.transform.maxPitch},i.prototype.getRenderWorldCopies=function(){return this.transform.renderWorldCopies},i.prototype.setRenderWorldCopies=function(t){return this.transform.renderWorldCopies=t,this._update()},i.prototype.project=function(e){return this.transform.locationPoint(t.LngLat.convert(e))},i.prototype.unproject=function(e){return this.transform.pointLocation(t.Point.convert(e))},i.prototype.isMoving=function(){return this._moving||this.handlers.isMoving()},i.prototype.isZooming=function(){return this._zooming||this.handlers.isZooming()},i.prototype.isRotating=function(){return this._rotating||this.handlers.isRotating()},i.prototype._createDelegatedListener=function(t,e,r){var n,i=this;if("mouseenter"===t||"mouseover"===t){var o=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){var a=i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[];a.length?o||(o=!0,r.call(i,new Dn(t,i,n.originalEvent,{features:a}))):o=!1},mouseout:function(){o=!1}}}}if("mouseleave"===t||"mouseout"===t){var a=!1;return{layer:e,listener:r,delegates:{mousemove:function(n){(i.getLayer(e)?i.queryRenderedFeatures(n.point,{layers:[e]}):[]).length?a=!0:a&&(a=!1,r.call(i,new Dn(t,i,n.originalEvent)))},mouseout:function(e){a&&(a=!1,r.call(i,new Dn(t,i,e.originalEvent)))}}}}return{layer:e,listener:r,delegates:(n={},n[t]=function(t){var n=i.getLayer(e)?i.queryRenderedFeatures(t.point,{layers:[e]}):[];n.length&&(t.features=n,r.call(i,t),delete t.features)},n)}},i.prototype.on=function(t,e,r){if(void 0===r)return n.prototype.on.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(i),i.delegates)this.on(o,i.delegates[o]);return this},i.prototype.once=function(t,e,r){if(void 0===r)return n.prototype.once.call(this,t,e);var i=this._createDelegatedListener(t,e,r);for(var o in i.delegates)this.once(o,i.delegates[o]);return this},i.prototype.off=function(t,e,r){var i=this;return void 0===r?n.prototype.off.call(this,t,e):(this._delegatedListeners&&this._delegatedListeners[t]&&function(n){for(var o=n[t],a=0;a180;){var s=n.locationPoint(e);if(s.x>=0&&s.y>=0&&s.x<=n.width&&s.y<=n.height)break;e.lng>n.center.lng?e.lng-=360:e.lng+=360}return e}Ai.prototype.down=function(t,e){this.mouseRotate.mousedown(t,e),this.mousePitch&&this.mousePitch.mousedown(t,e),r.disableDrag()},Ai.prototype.move=function(t,e){var r=this.map,n=this.mouseRotate.mousemoveWindow(t,e);if(n&&n.bearingDelta&&r.setBearing(r.getBearing()+n.bearingDelta),this.mousePitch){var i=this.mousePitch.mousemoveWindow(t,e);i&&i.pitchDelta&&r.setPitch(r.getPitch()+i.pitchDelta)}},Ai.prototype.off=function(){var t=this.element;r.removeEventListener(t,"mousedown",this.mousedown),r.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),r.removeEventListener(t,"touchmove",this.touchmove),r.removeEventListener(t,"touchend",this.touchend),r.removeEventListener(t,"touchcancel",this.reset),this.offTemp()},Ai.prototype.offTemp=function(){r.enableDrag(),r.removeEventListener(t.window,"mousemove",this.mousemove),r.removeEventListener(t.window,"mouseup",this.mouseup)},Ai.prototype.mousedown=function(e){this.down(t.extend({},e,{ctrlKey:!0,preventDefault:function(){return e.preventDefault()}}),r.mousePos(this.element,e)),r.addEventListener(t.window,"mousemove",this.mousemove),r.addEventListener(t.window,"mouseup",this.mouseup)},Ai.prototype.mousemove=function(t){this.move(t,r.mousePos(this.element,t))},Ai.prototype.mouseup=function(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()},Ai.prototype.touchstart=function(t){1!==t.targetTouches.length?this.reset():(this._startPos=this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:function(){return t.preventDefault()}},this._startPos))},Ai.prototype.touchmove=function(t){1!==t.targetTouches.length?this.reset():(this._lastPos=r.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:function(){return t.preventDefault()}},this._lastPos))},Ai.prototype.touchend=function(t){0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)=r}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new t.Event("dragstart"))),this.fire(new t.Event("drag")))},n.prototype._onUp=function(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new t.Event("dragend")),this._state="inactive"},n.prototype._addDragHandler=function(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},n.prototype.setDraggable=function(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this},n.prototype.isDraggable=function(){return this._draggable},n.prototype.setRotation=function(t){return this._rotation=t||0,this._update(),this},n.prototype.getRotation=function(){return this._rotation},n.prototype.setRotationAlignment=function(t){return this._rotationAlignment=t||"auto",this._update(),this},n.prototype.getRotationAlignment=function(){return this._rotationAlignment},n.prototype.setPitchAlignment=function(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this},n.prototype.getPitchAlignment=function(){return this._pitchAlignment},n}(t.Evented),zi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Fi=0,Bi=!1,Ui=function(e){function n(r){e.call(this),this.options=t.extend({},zi,r),t.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.onAdd=function(e){var n;return this._map=e,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),n=this._setupUI,void 0!==Ri?n(Ri):void 0!==t.window.navigator.permissions?t.window.navigator.permissions.query({name:"geolocation"}).then((function(t){n(Ri="denied"!==t.state)})):n(Ri=!!t.window.navigator.geolocation),this._container},n.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),r.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fi=0,Bi=!1},n.prototype._isOutOfMapMaxBounds=function(t){var e=this._map.getMaxBounds(),r=t.coords;return e&&(r.longitudee.getEast()||r.latitudee.getNorth())},n.prototype._setErrorState=function(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting")}},n.prototype._onSuccess=function(e){if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new t.Event("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("geolocate",e)),this._finish()}},n.prototype._updateCamera=function(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude),n=e.coords.accuracy,i=this._map.getBearing(),o=t.extend({bearing:i},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(n),o,{geolocateSource:!0})},n.prototype._updateMarker=function(e){if(e){var r=new t.LngLat(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},n.prototype._updateCircleRadius=function(){var t=this._map._container.clientHeight/2,e=this._map.unproject([0,t]),r=this._map.unproject([1,t]),n=e.distanceTo(r),i=Math.ceil(2*this._accuracy/n);this._circleElement.style.width=i+"px",this._circleElement.style.height=i+"px"},n.prototype._onZoom=function(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},n.prototype._onError=function(e){if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;var r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&Bi)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new t.Event("error",e)),this._finish()}},n.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},n.prototype._setupUI=function(e){var n=this;if(this._container.addEventListener("contextmenu",(function(t){return t.preventDefault()})),this._geolocateButton=r.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden",!0),this._geolocateButton.type="button",!1===e){t.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");var i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{var o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=r.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Oi(this._dotElement),this._circleElement=r.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Oi({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(function(e){e.geolocateSource||"ACTIVE_LOCK"!==n._watchState||e.originalEvent&&"resize"===e.originalEvent.type||(n._watchState="BACKGROUND",n._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),n._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),n.fire(new t.Event("trackuserlocationend")))}))},n.prototype.trigger=function(){if(!this._setup)return t.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new t.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fi--,Bi=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new t.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new t.Event("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){var e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++Fi>1?(e={maximumAge:6e5,timeout:0},Bi=!0):(e=this.options.positionOptions,Bi=!1),this._geolocationWatchID=t.window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else t.window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0},n.prototype._clearWatch=function(){t.window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},n}(t.Evented),ji={maxWidth:100,unit:"metric"},Vi=function(e){this.options=t.extend({},ji,e),t.bindAll(["_onMove","setUnit"],this)};function qi(t,e,r){var n=r&&r.maxWidth||100,i=t._container.clientHeight/2,o=t.unproject([0,i]),a=t.unproject([n,i]),s=o.distanceTo(a);if(r&&"imperial"===r.unit){var u=3.2808*s;u>5280?Gi(e,n,u/5280,t._getUIString("ScaleControl.Miles")):Gi(e,n,u,t._getUIString("ScaleControl.Feet"))}else r&&"nautical"===r.unit?Gi(e,n,s/1852,t._getUIString("ScaleControl.NauticalMiles")):s>=1e3?Gi(e,n,s/1e3,t._getUIString("ScaleControl.Kilometers")):Gi(e,n,s,t._getUIString("ScaleControl.Meters"))}function Gi(t,e,r,n){var i,o,a,s=(i=r,(o=Math.pow(10,(""+Math.floor(i)).length-1))*(a=(a=i/o)>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(t){var e=Math.pow(10,Math.ceil(-Math.log(t)/Math.LN10));return Math.round(t*e)/e}(a)));t.style.width=e*(s/r)+"px",t.innerHTML=s+" "+n}Vi.prototype.getDefaultPosition=function(){return"bottom-left"},Vi.prototype._onMove=function(){qi(this._map,this._container,this.options)},Vi.prototype.onAdd=function(t){return this._map=t,this._container=r.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},Vi.prototype.onRemove=function(){r.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},Vi.prototype.setUnit=function(t){this.options.unit=t,qi(this._map,this._container,this.options)};var Xi=function(e){this._fullscreen=!1,e&&e.container&&(e.container instanceof t.window.HTMLElement?this._container=e.container:t.warnOnce("Full screen control 'container' must be a DOM element.")),t.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in t.window.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in t.window.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in t.window.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in t.window.document&&(this._fullscreenchange="MSFullscreenChange")};Xi.prototype.onAdd=function(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=r.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",t.warnOnce("This device does not support fullscreen mode.")),this._controlContainer},Xi.prototype.onRemove=function(){r.remove(this._controlContainer),this._map=null,t.window.document.removeEventListener(this._fullscreenchange,this._changeIcon)},Xi.prototype._checkFullscreenSupport=function(){return!!(t.window.document.fullscreenEnabled||t.window.document.mozFullScreenEnabled||t.window.document.msFullscreenEnabled||t.window.document.webkitFullscreenEnabled)},Xi.prototype._setupUI=function(){var e=this._fullscreenButton=r.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);r.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",e).setAttribute("aria-hidden",!0),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),t.window.document.addEventListener(this._fullscreenchange,this._changeIcon)},Xi.prototype._updateTitle=function(){var t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t},Xi.prototype._getTitle=function(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")},Xi.prototype._isFullscreen=function(){return this._fullscreen},Xi.prototype._changeIcon=function(){(t.window.document.fullscreenElement||t.window.document.mozFullScreenElement||t.window.document.webkitFullscreenElement||t.window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())},Xi.prototype._onClickFullscreen=function(){this._isFullscreen()?t.window.document.exitFullscreen?t.window.document.exitFullscreen():t.window.document.mozCancelFullScreen?t.window.document.mozCancelFullScreen():t.window.document.msExitFullscreen?t.window.document.msExitFullscreen():t.window.document.webkitCancelFullScreen&&t.window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()};var Zi={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Yi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Wi=function(e){function n(r){e.call(this),this.options=t.extend(Object.create(Zi),r),t.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}return e&&(n.__proto__=e),(n.prototype=Object.create(e&&e.prototype)).constructor=n,n.prototype.addTo=function(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new t.Event("open")),this},n.prototype.isOpen=function(){return!!this._map},n.prototype.remove=function(){return this._content&&r.remove(this._content),this._container&&(r.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new t.Event("close")),this},n.prototype.getLngLat=function(){return this._lngLat},n.prototype.setLngLat=function(e){return this._lngLat=t.LngLat.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this},n.prototype.trackPointer=function(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this},n.prototype.getElement=function(){return this._container},n.prototype.setText=function(e){return this.setDOMContent(t.window.document.createTextNode(e))},n.prototype.setHTML=function(e){var r,n=t.window.document.createDocumentFragment(),i=t.window.document.createElement("body");for(i.innerHTML=e;r=i.firstChild;)n.appendChild(r);return this.setDOMContent(n)},n.prototype.getMaxWidth=function(){return this._container&&this._container.style.maxWidth},n.prototype.setMaxWidth=function(t){return this.options.maxWidth=t,this._update(),this},n.prototype.setDOMContent=function(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=r.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this},n.prototype.addClassName=function(t){this._container&&this._container.classList.add(t)},n.prototype.removeClassName=function(t){this._container&&this._container.classList.remove(t)},n.prototype.setOffset=function(t){return this.options.offset=t,this._update(),this},n.prototype.toggleClassName=function(t){if(this._container)return this._container.classList.toggle(t)},n.prototype._createCloseButton=function(){this.options.closeButton&&(this._closeButton=r.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))},n.prototype._onMouseUp=function(t){this._update(t.point)},n.prototype._onMouseMove=function(t){this._update(t.point)},n.prototype._onDrag=function(t){this._update(t.point)},n.prototype._update=function(e){var n=this;if(this._map&&(this._lngLat||this._trackPointer)&&this._content&&(this._container||(this._container=r.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=r.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach((function(t){return n._container.classList.add(t)})),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ki(this._lngLat,this._pos,this._map.transform)),!this._trackPointer||e)){var i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=function e(r){if(r){if("number"==typeof r){var n=Math.round(Math.sqrt(.5*Math.pow(r,2)));return{center:new t.Point(0,0),top:new t.Point(0,r),"top-left":new t.Point(n,n),"top-right":new t.Point(-n,n),bottom:new t.Point(0,-r),"bottom-left":new t.Point(n,-n),"bottom-right":new t.Point(-n,-n),left:new t.Point(r,0),right:new t.Point(-r,0)}}if(r instanceof t.Point||Array.isArray(r)){var i=t.Point.convert(r);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:t.Point.convert(r.center||[0,0]),top:t.Point.convert(r.top||[0,0]),"top-left":t.Point.convert(r["top-left"]||[0,0]),"top-right":t.Point.convert(r["top-right"]||[0,0]),bottom:t.Point.convert(r.bottom||[0,0]),"bottom-left":t.Point.convert(r["bottom-left"]||[0,0]),"bottom-right":t.Point.convert(r["bottom-right"]||[0,0]),left:t.Point.convert(r.left||[0,0]),right:t.Point.convert(r.right||[0,0])}}return e(new t.Point(0,0))}(this.options.offset);if(!o){var s,u=this._container.offsetWidth,l=this._container.offsetHeight;s=i.y+a.bottom.ythis._map.transform.height-l?["bottom"]:[],i.xthis._map.transform.width-u/2&&s.push("right"),o=0===s.length?"bottom":s.join("-")}var c=i.add(a[o]).round();r.setTransform(this._container,Ni[o]+" translate("+c.x+"px,"+c.y+"px)"),Di(this._container,o,"popup")}},n.prototype._focusFirstElement=function(){if(this.options.focusAfterOpen&&this._container){var t=this._container.querySelector(Yi);t&&t.focus()}},n.prototype._onClose=function(){this.remove()},n}(t.Evented),Hi={version:t.version,supported:e,setRTLTextPlugin:t.setRTLTextPlugin,getRTLTextPluginStatus:t.getRTLTextPluginStatus,Map:Pi,NavigationControl:Li,GeolocateControl:Ui,AttributionControl:_i,ScaleControl:Vi,FullscreenControl:Xi,Popup:Wi,Marker:Oi,Style:qe,LngLat:t.LngLat,LngLatBounds:t.LngLatBounds,Point:t.Point,MercatorCoordinate:t.MercatorCoordinate,Evented:t.Evented,config:t.config,prewarm:function(){Ft().acquire(Dt)},clearPrewarmedResources:function(){var t=Ot;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Dt),Ot=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return t.config.ACCESS_TOKEN},set accessToken(e){t.config.ACCESS_TOKEN=e},get baseApiUrl(){return t.config.API_URL},set baseApiUrl(e){t.config.API_URL=e},get workerCount(){return Rt.workerCount},set workerCount(t){Rt.workerCount=t},get maxParallelImageRequests(){return t.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(e){t.config.MAX_PARALLEL_IMAGE_REQUESTS=e},clearStorage:function(e){t.clearTileCache(e)},workerUrl:"",addProtocol:function(e,r){t.config.REGISTERED_PROTOCOLS[e]=r},removeProtocol:function(e){delete t.config.REGISTERED_PROTOCOLS[e]}};return Hi}));return r}));!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).MapboxDraw=e()}(this,(function(){"use strict";var t=function(t,e){var r={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},n={on:function(t,e,n){if(void 0===r[t])throw new Error("Invalid event type: "+t);r[t].push({selector:e,fn:n})},render:function(t){e.store.featureChanged(t)}},i=function(t,i){for(var o=r[t],a=o.length;a--;){var s=o[a];if(s.selector(i)){s.fn.call(n,i)||e.store.render(),e.ui.updateMapClasses();break}}};return t.start.call(n),{render:t.render,stop:function(){t.stop&&t.stop()},trash:function(){t.trash&&(t.trash(),e.store.render())},combineFeatures:function(){t.combineFeatures&&t.combineFeatures()},uncombineFeatures:function(){t.uncombineFeatures&&t.uncombineFeatures()},drag:function(t){i("drag",t)},click:function(t){i("click",t)},mousemove:function(t){i("mousemove",t)},mousedown:function(t){i("mousedown",t)},mouseup:function(t){i("mouseup",t)},mouseout:function(t){i("mouseout",t)},keydown:function(t){i("keydown",t)},keyup:function(t){i("keyup",t)},touchstart:function(t){i("touchstart",t)},touchmove:function(t){i("touchmove",t)},touchend:function(t){i("touchend",t)},tap:function(t){i("tap",t)}}},e=6378137;function r(t){var e=0;if(t&&t.length>0){e+=Math.abs(n(t[0]));for(var r=1;r2){for(u=0;u=Math.pow(2,t)?e(t,r):a};e.rack=function(t,r,n){var i=function(i){var a=0;do{if(a++>10){if(!n)throw new Error("too many ID collisions, use more bits");t+=n}var s=e(t,r)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(t){return i.hats[t]},i.set=function(t,e){return i.hats[t]=e,i},i.bits=t||128,i.base=r||16,i}})),G=function(t,e){this.ctx=t,this.properties=e.properties||{},this.coordinates=e.geometry.coordinates,this.id=e.id||q(),this.type=e.geometry.type};G.prototype.changed=function(){this.ctx.store.featureChanged(this.id)},G.prototype.incomingCoords=function(t){this.setCoordinates(t)},G.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},G.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))},G.prototype.setProperty=function(t,e){this.properties[t]=e},G.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:d,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))},G.prototype.internal=function(t){var e={id:this.id,meta:C,"meta:type":this.type,active:L,mode:t};if(this.ctx.options.userProperties)for(var r in this.properties)e["user_"+r]=this.properties[r];return{type:d,properties:e,geometry:{coordinates:this.getCoordinates(),type:this.type}}};var X=function(t,e){G.call(this,t,e)};(X.prototype=Object.create(G.prototype)).isValid=function(){return"number"==typeof this.coordinates[0]&&"number"==typeof this.coordinates[1]},X.prototype.updateCoordinate=function(t,e,r){this.coordinates=3===arguments.length?[e,r]:[t,e],this.changed()},X.prototype.getCoordinate=function(){return this.getCoordinates()};var Z=function(t,e){G.call(this,t,e)};(Z.prototype=Object.create(G.prototype)).isValid=function(){return this.coordinates.length>1},Z.prototype.addCoordinate=function(t,e,r){this.changed();var n=parseInt(t,10);this.coordinates.splice(n,0,[e,r])},Z.prototype.getCoordinate=function(t){var e=parseInt(t,10);return JSON.parse(JSON.stringify(this.coordinates[e]))},Z.prototype.removeCoordinate=function(t){this.changed(),this.coordinates.splice(parseInt(t,10),1)},Z.prototype.updateCoordinate=function(t,e,r){var n=parseInt(t,10);this.coordinates[n]=[e,r],this.changed()};var Y=function(t,e){G.call(this,t,e),this.coordinates=this.coordinates.map((function(t){return t.slice(0,-1)}))};(Y.prototype=Object.create(G.prototype)).isValid=function(){return 0!==this.coordinates.length&&this.coordinates.every((function(t){return t.length>2}))},Y.prototype.incomingCoords=function(t){this.coordinates=t.map((function(t){return t.slice(0,-1)})),this.changed()},Y.prototype.setCoordinates=function(t){this.coordinates=t,this.changed()},Y.prototype.addCoordinate=function(t,e,r){this.changed();var n=t.split(".").map((function(t){return parseInt(t,10)}));this.coordinates[n[0]].splice(n[1],0,[e,r])},Y.prototype.removeCoordinate=function(t){this.changed();var e=t.split(".").map((function(t){return parseInt(t,10)})),r=this.coordinates[e[0]];r&&(r.splice(e[1],1),r.length<3&&this.coordinates.splice(e[0],1))},Y.prototype.getCoordinate=function(t){var e=t.split(".").map((function(t){return parseInt(t,10)})),r=this.coordinates[e[0]];return JSON.parse(JSON.stringify(r[e[1]]))},Y.prototype.getCoordinates=function(){return this.coordinates.map((function(t){return t.concat([t[0]])}))},Y.prototype.updateCoordinate=function(t,e,r){this.changed();var n=t.split("."),i=parseInt(n[0],10),o=parseInt(n[1],10);void 0===this.coordinates[i]&&(this.coordinates[i]=[]),this.coordinates[i][o]=[e,r]};var W={MultiPoint:X,MultiLineString:Z,MultiPolygon:Y},H=function(t,e,r,n,i){var o=r.split("."),a=parseInt(o[0],10),s=o[1]?o.slice(1).join("."):null;return t[a][e](s,n,i)},J=function(t,e){if(G.call(this,t,e),delete this.coordinates,this.model=W[e.geometry.type],void 0===this.model)throw new TypeError(e.geometry.type+" is not a valid type");this.features=this._coordinatesToFeatures(e.geometry.coordinates)};function K(t){this.map=t.map,this.drawConfig=JSON.parse(JSON.stringify(t.options||{})),this._ctx=t}(J.prototype=Object.create(G.prototype))._coordinatesToFeatures=function(t){var e=this,r=this.model.bind(this);return t.map((function(t){return new r(e.ctx,{id:q(),type:d,properties:{},geometry:{coordinates:t,type:e.type.replace("Multi","")}})}))},J.prototype.isValid=function(){return this.features.every((function(t){return t.isValid()}))},J.prototype.setCoordinates=function(t){this.features=this._coordinatesToFeatures(t),this.changed()},J.prototype.getCoordinate=function(t){return H(this.features,"getCoordinate",t)},J.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map((function(t){return t.type===g?t.getCoordinates():t.coordinates}))))},J.prototype.updateCoordinate=function(t,e,r){H(this.features,"updateCoordinate",t,e,r),this.changed()},J.prototype.addCoordinate=function(t,e,r){H(this.features,"addCoordinate",t,e,r),this.changed()},J.prototype.removeCoordinate=function(t){H(this.features,"removeCoordinate",t),this.changed()},J.prototype.getFeatures=function(){return this.features},K.prototype.setSelected=function(t){return this._ctx.store.setSelected(t)},K.prototype.setSelectedCoordinates=function(t){var e=this;this._ctx.store.setSelectedCoordinates(t),t.reduce((function(t,r){return void 0===t[r.feature_id]&&(t[r.feature_id]=!0,e._ctx.store.get(r.feature_id).changed()),t}),{})},K.prototype.getSelected=function(){return this._ctx.store.getSelected()},K.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()},K.prototype.isSelected=function(t){return this._ctx.store.isSelected(t)},K.prototype.getFeature=function(t){return this._ctx.store.get(t)},K.prototype.select=function(t){return this._ctx.store.select(t)},K.prototype.deselect=function(t){return this._ctx.store.deselect(t)},K.prototype.deleteFeature=function(t,e){return void 0===e&&(e={}),this._ctx.store.delete(t,e)},K.prototype.addFeature=function(t){return this._ctx.store.add(t)},K.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()},K.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()},K.prototype.setActionableState=function(t){void 0===t&&(t={});var e={trash:t.trash||!1,combineFeatures:t.combineFeatures||!1,uncombineFeatures:t.uncombineFeatures||!1};return this._ctx.events.actionable(e)},K.prototype.changeMode=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r={}),this._ctx.events.changeMode(t,e,r)},K.prototype.updateUIClasses=function(t){return this._ctx.ui.queueMapClasses(t)},K.prototype.activateUIButton=function(t){return this._ctx.ui.setActiveButton(t)},K.prototype.featuresAt=function(t,e,r){if(void 0===r&&(r="click"),"click"!==r&&"touch"!==r)throw new Error("invalid buffer type");return O[r](t,e,this._ctx)},K.prototype.newFeature=function(t){var e=t.geometry.type;return e===m?new X(this._ctx,t):e===y?new Z(this._ctx,t):e===g?new Y(this._ctx,t):new J(this._ctx,t)},K.prototype.isInstanceOf=function(t,e){if(t===m)return e instanceof X;if(t===y)return e instanceof Z;if(t===g)return e instanceof Y;if("MultiFeature"===t)return e instanceof J;throw new Error("Unknown feature class: "+t)},K.prototype.doRender=function(t){return this._ctx.store.featureChanged(t)},K.prototype.onSetup=function(){},K.prototype.onDrag=function(){},K.prototype.onClick=function(){},K.prototype.onMouseMove=function(){},K.prototype.onMouseDown=function(){},K.prototype.onMouseUp=function(){},K.prototype.onMouseOut=function(){},K.prototype.onKeyUp=function(){},K.prototype.onKeyDown=function(){},K.prototype.onTouchStart=function(){},K.prototype.onTouchMove=function(){},K.prototype.onTouchEnd=function(){},K.prototype.onTap=function(){},K.prototype.onStop=function(){},K.prototype.onTrash=function(){},K.prototype.onCombineFeature=function(){},K.prototype.onUncombineFeature=function(){},K.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};var $={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},Q=Object.keys($);function tt(t){return[].concat(t).filter((function(t){return void 0!==t}))}function et(){var t=this;if(!t.ctx.map||void 0===t.ctx.map.getSource(s))return c();var e=t.ctx.events.currentModeName();t.ctx.ui.queueMapClasses({mode:e});var r=[],n=[];t.isDirty?n=t.getAllIds():(r=t.getChangedIds().filter((function(e){return void 0!==t.get(e)})),n=t.sources.hot.filter((function(e){return e.properties.id&&-1===r.indexOf(e.properties.id)&&void 0!==t.get(e.properties.id)})).map((function(t){return t.properties.id}))),t.sources.hot=[];var i=t.sources.cold.length;t.sources.cold=t.isDirty?[]:t.sources.cold.filter((function(t){var e=t.properties.id||t.properties.parent;return-1===r.indexOf(e)}));var o=i!==t.sources.cold.length||n.length>0;function a(r,n){var i=t.get(r).internal(e);t.ctx.events.currentModeRender(i,(function(e){t.sources[n].push(e)}))}if(r.forEach((function(t){return a(t,"hot")})),n.forEach((function(t){return a(t,"cold")})),o&&t.ctx.map.getSource(u).setData({type:v,features:t.sources.cold}),t.ctx.map.getSource(s).setData({type:v,features:t.sources.hot}),t._emitSelectionChange&&(t.ctx.map.fire(I,{features:t.getSelected().map((function(t){return t.toGeoJSON()})),points:t.getSelectedCoordinates().map((function(t){return{type:d,properties:{},geometry:{type:m,coordinates:t.coordinates}}}))}),t._emitSelectionChange=!1),t._deletedFeaturesToEmit.length){var l=t._deletedFeaturesToEmit.map((function(t){return t.toGeoJSON()}));t._deletedFeaturesToEmit=[],t.ctx.map.fire(w,{features:l})}function c(){t.isDirty=!1,t.clearChangedIds()}c(),t.ctx.map.fire(S,{})}function rt(t){var e,r=this;this._features={},this._featureIds=new D,this._selectedFeatureIds=new D,this._selectedCoordinates=[],this._changedFeatureIds=new D,this._deletedFeaturesToEmit=[],this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=t,this.sources={hot:[],cold:[]},this.render=function(){e||(e=requestAnimationFrame((function(){e=null,et.call(r)})))},this.isDirty=!1}function nt(t,e){var r=t._selectedCoordinates.filter((function(e){return t._selectedFeatureIds.has(e.feature_id)}));t._selectedCoordinates.length===r.length||e.silent||(t._emitSelectionChange=!0),t._selectedCoordinates=r}rt.prototype.createRenderBatch=function(){var t=this,e=this.render,r=0;return this.render=function(){r++},function(){t.render=e,r>0&&t.render()}},rt.prototype.setDirty=function(){return this.isDirty=!0,this},rt.prototype.featureChanged=function(t){return this._changedFeatureIds.add(t),this},rt.prototype.getChangedIds=function(){return this._changedFeatureIds.values()},rt.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this},rt.prototype.getAllIds=function(){return this._featureIds.values()},rt.prototype.add=function(t){return this.featureChanged(t.id),this._features[t.id]=t,this._featureIds.add(t.id),this},rt.prototype.delete=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._featureIds.has(t)&&(r._featureIds.delete(t),r._selectedFeatureIds.delete(t),e.silent||-1===r._deletedFeaturesToEmit.indexOf(r._features[t])&&r._deletedFeaturesToEmit.push(r._features[t]),delete r._features[t],r.isDirty=!0)})),nt(this,e),this},rt.prototype.get=function(t){return this._features[t]},rt.prototype.getAll=function(){var t=this;return Object.keys(this._features).map((function(e){return t._features[e]}))},rt.prototype.select=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._selectedFeatureIds.has(t)||(r._selectedFeatureIds.add(t),r._changedFeatureIds.add(t),e.silent||(r._emitSelectionChange=!0))})),this},rt.prototype.deselect=function(t,e){var r=this;return void 0===e&&(e={}),tt(t).forEach((function(t){r._selectedFeatureIds.has(t)&&(r._selectedFeatureIds.delete(t),r._changedFeatureIds.add(t),e.silent||(r._emitSelectionChange=!0))})),nt(this,e),this},rt.prototype.clearSelected=function(t){return void 0===t&&(t={}),this.deselect(this._selectedFeatureIds.values(),{silent:t.silent}),this},rt.prototype.setSelected=function(t,e){var r=this;return void 0===e&&(e={}),t=tt(t),this.deselect(this._selectedFeatureIds.values().filter((function(e){return-1===t.indexOf(e)})),{silent:e.silent}),this.select(t.filter((function(t){return!r._selectedFeatureIds.has(t)})),{silent:e.silent}),this},rt.prototype.setSelectedCoordinates=function(t){return this._selectedCoordinates=t,this._emitSelectionChange=!0,this},rt.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this},rt.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()},rt.prototype.getSelected=function(){var t=this;return this._selectedFeatureIds.values().map((function(e){return t.get(e)}))},rt.prototype.getSelectedCoordinates=function(){var t=this;return this._selectedCoordinates.map((function(e){return{coordinates:t.get(e.feature_id).getCoordinate(e.coord_path)}}))},rt.prototype.isSelected=function(t){return this._selectedFeatureIds.has(t)},rt.prototype.setFeatureProperty=function(t,e,r){this.get(t).setProperty(e,r),this.featureChanged(t)},rt.prototype.storeMapConfig=function(){var t=this;A.forEach((function(e){t.ctx.map[e]&&(t._mapInitialConfig[e]=t.ctx.map[e].isEnabled())}))},rt.prototype.restoreMapConfig=function(){var t=this;Object.keys(this._mapInitialConfig).forEach((function(e){t._mapInitialConfig[e]?t.ctx.map[e].enable():t.ctx.map[e].disable()}))},rt.prototype.getInitialConfigValue=function(t){return void 0===this._mapInitialConfig[t]||this._mapInitialConfig[t]};var it=function(){for(var t=arguments,e={},r=0;r=48&&t<=57)};function l(n,i,o){void 0===o&&(o={}),s.stop();var u=r[n];if(void 0===u)throw new Error(n+" is not valid");a=n;var l=u(e,i);s=t(l,e),o.silent||e.map.fire("draw.modechange",{mode:n}),e.store.setDirty(),e.store.render()}o.keydown=function(t){"mapboxgl-canvas"===(t.srcElement||t.target).classList[0]&&(8!==t.keyCode&&46!==t.keyCode||!e.options.controls.trash?u(t.keyCode)?s.keydown(t):49===t.keyCode&&e.options.controls.point?l(x.DRAW_POINT):50===t.keyCode&&e.options.controls.line_string?l(x.DRAW_LINE_STRING):51===t.keyCode&&e.options.controls.polygon&&l(x.DRAW_POLYGON):(t.preventDefault(),s.trash()))},o.keyup=function(t){u(t.keyCode)&&s.keyup(t)},o.zoomend=function(){e.store.changeZoom()},o.data=function(t){if("style"===t.dataType){var r=e.setup,n=e.map,i=e.options,o=e.store;i.styles.some((function(t){return n.getLayer(t.id)}))||(r.addLayers(),o.setDirty(),o.render())}};var c={trash:!1,combineFeatures:!1,uncombineFeatures:!1};return{start:function(){a=e.options.defaultMode,s=t(r[a](e),e)},changeMode:l,actionable:function(t){var r=!1;Object.keys(t).forEach((function(e){if(void 0===c[e])throw new Error("Invalid action type");c[e]!==t[e]&&(r=!0),c[e]=t[e]})),r&&e.map.fire("draw.actionable",{actions:c})},currentModeName:function(){return a},currentModeRender:function(t,e){return s.render(t,e)},fire:function(t,e){o[t]&&o[t](e)},addEventListeners:function(){e.map.on("mousemove",o.mousemove),e.map.on("mousedown",o.mousedown),e.map.on("mouseup",o.mouseup),e.map.on("data",o.data),e.map.on("touchmove",o.touchmove),e.map.on("touchstart",o.touchstart),e.map.on("touchend",o.touchend),e.container.addEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",o.keydown),e.container.addEventListener("keyup",o.keyup))},removeEventListeners:function(){e.map.off("mousemove",o.mousemove),e.map.off("mousedown",o.mousedown),e.map.off("mouseup",o.mouseup),e.map.off("data",o.data),e.map.off("touchmove",o.touchmove),e.map.off("touchstart",o.touchstart),e.map.off("touchend",o.touchend),e.container.removeEventListener("mouseout",o.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",o.keydown),e.container.removeEventListener("keyup",o.keyup))},trash:function(t){s.trash(t)},combineFeatures:function(){s.combineFeatures()},uncombineFeatures:function(){s.uncombineFeatures()},getMode:function(){return a}}}(e),e.ui=function(t){var e={},r=null,n={mode:null,feature:null,mouse:null},i={mode:null,feature:null,mouse:null};function o(t){i=it(i,t)}function s(){var e,r;if(t.container){var o=[],a=[];at.forEach((function(t){i[t]!==n[t]&&(o.push(t+"-"+n[t]),null!==i[t]&&a.push(t+"-"+i[t]))})),o.length>0&&(e=t.container.classList).remove.apply(e,o),a.length>0&&(r=t.container.classList).add.apply(r,a),n=it(n,i)}}function u(t,e){void 0===e&&(e={});var n=document.createElement("button");return n.className="mapbox-gl-draw_ctrl-draw-btn "+e.className,n.setAttribute("title",e.title),e.container.appendChild(n),n.addEventListener("click",(function(n){if(n.preventDefault(),n.stopPropagation(),n.target===r)return l(),void e.onDeactivate();c(t),e.onActivate()}),!0),n}function l(){r&&(r.classList.remove(a),r=null)}function c(t){l();var n=e[t];n&&n&&"trash"!==t&&(n.classList.add(a),r=n)}return{setActiveButton:c,queueMapClasses:o,updateMapClasses:s,clearMapClasses:function(){o({mode:null,feature:null,mouse:null}),s()},addButtons:function(){var r=t.options.controls,n=document.createElement("div");return n.className="mapboxgl-ctrl-group mapboxgl-ctrl",r?(r[f.LINE]&&(e[f.LINE]=u(f.LINE,{container:n,className:"mapbox-gl-draw_line",title:"LineString tool "+(t.options.keybindings?"(l)":""),onActivate:function(){return t.events.changeMode(x.DRAW_LINE_STRING)},onDeactivate:function(){return t.events.trash()}})),r[f.POLYGON]&&(e[f.POLYGON]=u(f.POLYGON,{container:n,className:"mapbox-gl-draw_polygon",title:"Polygon tool "+(t.options.keybindings?"(p)":""),onActivate:function(){return t.events.changeMode(x.DRAW_POLYGON)},onDeactivate:function(){return t.events.trash()}})),r[f.POINT]&&(e[f.POINT]=u(f.POINT,{container:n,className:"mapbox-gl-draw_point",title:"Marker tool "+(t.options.keybindings?"(m)":""),onActivate:function(){return t.events.changeMode(x.DRAW_POINT)},onDeactivate:function(){return t.events.trash()}})),r.trash&&(e.trash=u("trash",{container:n,className:"mapbox-gl-draw_trash",title:"Delete",onActivate:function(){t.events.trash()}})),r.combine_features&&(e.combine_features=u("combineFeatures",{container:n,className:"mapbox-gl-draw_combine",title:"Combine",onActivate:function(){t.events.combineFeatures()}})),r.uncombine_features&&(e.uncombine_features=u("uncombineFeatures",{container:n,className:"mapbox-gl-draw_uncombine",title:"Uncombine",onActivate:function(){t.events.uncombineFeatures()}})),n):n},removeButtons:function(){Object.keys(e).forEach((function(t){var r=e[t];r.parentNode&&r.parentNode.removeChild(r),delete e[t]}))}}}(e),e.container=o.getContainer(),e.store=new rt(e),r=e.ui.addButtons(),e.options.boxSelect&&(o.boxZoom.disable(),o.dragPan.disable(),o.dragPan.enable()),o.loaded()?i.connect():(o.on("load",i.connect),n=setInterval((function(){o.loaded()&&i.connect()}),16)),e.events.start(),r},addLayers:function(){e.map.addSource(u,{data:{type:v,features:[]},type:"geojson"}),e.map.addSource(s,{data:{type:v,features:[]},type:"geojson"}),e.options.styles.forEach((function(t){e.map.addLayer(t)})),e.store.setDirty(!0),e.store.render()},removeLayers:function(){e.options.styles.forEach((function(t){e.map.getLayer(t.id)&&e.map.removeLayer(t.id)})),e.map.getSource(u)&&e.map.removeSource(u),e.map.getSource(s)&&e.map.removeSource(s)}};return e.setup=i,i}function ut(t){return function(e){var r=e.featureTarget;return!!r&&!!r.properties&&r.properties.meta===t}}function lt(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===T&&t.featureTarget.properties.meta===C}function ct(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.active===L&&t.featureTarget.properties.meta===C}function ht(t){return void 0===t.featureTarget}function pt(t){var e=t.featureTarget;return!!e&&!!e.properties&&e.properties.meta===M}function ft(t){return!!t.originalEvent&&!0===t.originalEvent.shiftKey}function dt(t){return 27===t.keyCode}function gt(t){return 13===t.keyCode}var yt=mt;function mt(t,e){this.x=t,this.y=e}function vt(t,e){var r=e.getBoundingClientRect();return new yt(t.clientX-r.left-(e.clientLeft||0),t.clientY-r.top-(e.clientTop||0))}function _t(t,e,r,n){return{type:d,properties:{meta:M,parent:t,coord_path:r,active:n?T:L},geometry:{type:m,coordinates:e}}}function xt(t,e,r){void 0===e&&(e={}),void 0===r&&(r=null);var n,i=t.geometry,o=i.type,a=i.coordinates,s=t.properties&&t.properties.id,u=[];function l(t,r){var n="",i=null;t.forEach((function(t,o){var a=null!=r?r+"."+o:String(o),l=_t(s,t,a,c(a));if(e.midpoints&&i){var h=function(t,e,r){var n=e.geometry.coordinates,i=r.geometry.coordinates;if(n[1]>85||n[1]<-85||i[1]>85||i[1]<-85)return null;var o={lng:(n[0]+i[0])/2,lat:(n[1]+i[1])/2};return{type:d,properties:{meta:P,parent:t,lng:o.lng,lat:o.lat,coord_path:r.properties.coord_path},geometry:{type:m,coordinates:[o.lng,o.lat]}}}(s,i,l);h&&u.push(h)}i=l;var p=JSON.stringify(t);n!==p&&u.push(l),0===o&&(n=p)}))}function c(t){return!!e.selectedPaths&&-1!==e.selectedPaths.indexOf(t)}return o===m?u.push(_t(s,a,r,c(r))):o===g?a.forEach((function(t,e){l(t,null!==r?r+"."+e:String(e))})):o===y?l(a,r):0===o.indexOf(_)&&(n=o.replace(_,""),a.forEach((function(r,i){var o={type:d,properties:t.properties,geometry:{type:n,coordinates:r}};u=u.concat(xt(o,e,i))}))),u}mt.prototype={clone:function(){return new mt(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),r=Math.sin(t),n=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_rotateAround:function(t,e){var r=Math.cos(t),n=Math.sin(t),i=e.x+r*(this.x-e.x)-n*(this.y-e.y),o=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},mt.convert=function(t){return t instanceof mt?t:Array.isArray(t)?new mt(t[0],t[1]):t};var bt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t._ctx&&t._ctx.store&&t._ctx.store.getInitialConfigValue&&t._ctx.store.getInitialConfigValue("doubleClickZoom")&&t.map.doubleClickZoom.enable()}),0)},wt=function(t){setTimeout((function(){t.map&&t.map.doubleClickZoom&&t.map.doubleClickZoom.disable()}),0)},Et=function(t){if(!t||!t.type)return null;var e=It[t.type];return e?"geometry"===e?{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:t}]}:"feature"===e?{type:"FeatureCollection",features:[t]}:"featurecollection"===e?t:void 0:null},It={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function St(t){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.reduce((function(t,e){return t.concat(St(e))}),[]),t;case"Feature":return t.geometry?St(t.geometry).map((function(e){var r={type:"Feature",properties:JSON.parse(JSON.stringify(t.properties)),geometry:e};return void 0!==t.id&&(r.id=t.id),r})):[t];case"MultiPoint":return t.coordinates.map((function(t){return{type:"Point",coordinates:t}}));case"MultiPolygon":return t.coordinates.map((function(t){return{type:"Polygon",coordinates:t}}));case"MultiLineString":return t.coordinates.map((function(t){return{type:"LineString",coordinates:t}}));case"GeometryCollection":return t.geometries.map(St).reduce((function(t,e){return t.concat(e)}),[]);case"Point":case"Polygon":case"LineString":return[t]}}var Ct=V((function(t){var e=t.exports=function(t){return new r(t)};function r(t){this.value=t}function n(t,e,r){var n=[],a=[],c=!0;return function t(h){var p=r?i(h):h,f={},d=!0,g={node:p,node_:h,path:[].concat(n),parent:a[a.length-1],parents:a,key:n.slice(-1)[0],isRoot:0===n.length,level:n.length,circular:null,update:function(t,e){g.isRoot||(g.parent.node[g.key]=t),g.node=t,e&&(d=!1)},delete:function(t){delete g.parent.node[g.key],t&&(d=!1)},remove:function(t){s(g.parent.node)?g.parent.node.splice(g.key,1):delete g.parent.node[g.key],t&&(d=!1)},keys:null,before:function(t){f.before=t},after:function(t){f.after=t},pre:function(t){f.pre=t},post:function(t){f.post=t},stop:function(){c=!1},block:function(){d=!1}};if(!c)return g;function y(){if("object"==typeof g.node&&null!==g.node){g.keys&&g.node_===g.node||(g.keys=o(g.node)),g.isLeaf=0==g.keys.length;for(var t=0;t=e&&this._bbox[3]>=r},Mt.prototype.intersect=function(t){return this._valid?(e=t instanceof Mt?t.bbox():t,!(this._bbox[0]>e[2]||this._bbox[2]e[3])):null;var e},Mt.prototype._fastContains=function(){if(!this._valid)return new Function("return null;");var t="return "+this._bbox[0]+"<= ll[0] &&"+this._bbox[1]+"<= ll[1] &&"+this._bbox[2]+">= ll[0] &&"+this._bbox[3]+">= ll[1]";return new Function("ll",t)},Mt.prototype.polygon=function(){return this._valid?{type:"Polygon",coordinates:[[[this._bbox[0],this._bbox[1]],[this._bbox[2],this._bbox[1]],[this._bbox[2],this._bbox[3]],[this._bbox[0],this._bbox[3]],[this._bbox[0],this._bbox[1]]]]}:null};var Tt={features:["FeatureCollection"],coordinates:["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],geometry:["Feature"],geometries:["GeometryCollection"]},Lt=Object.keys(Tt),At=function(t){return kt(t).bbox()};function kt(t){for(var e=Pt(),r=function(t){if(!t)return[];var e=St(Et(t)),r=[];return e.features.forEach((function(t){t.geometry&&(r=r.concat(function t(e){return Array.isArray(e)&&e.length&&"number"==typeof e[0]?[e]:e.reduce((function(e,r){return Array.isArray(r)&&Array.isArray(r[0])?e.concat(t(r)):(e.push(r),e)}),[])}(t.geometry.coordinates)))})),r}(t),n=0;nr&&(r=u),li&&(i=l),us&&(s=h)}));var u=e;return r+u.lat>85&&(u.lat=85-r),i+u.lat>90&&(u.lat=90-i),n+u.lat<-85&&(u.lat=-85-n),o+u.lat<-90&&(u.lat=-90-o),a+u.lng<=-270&&(u.lng+=360*Math.ceil(Math.abs(u.lng)/360)),s+u.lng>=270&&(u.lng-=360*Math.ceil(Math.abs(u.lng)/360)),u}function Dt(t,e){var r=Nt(t.map((function(t){return t.toGeoJSON()})),e);t.forEach((function(t){var e,n=t.getCoordinates(),i=function(t){var e={lng:t[0]+r.lng,lat:t[1]+r.lat};return[e.lng,e.lat]},o=function(t){return t.map((function(t){return i(t)}))};t.type===m?e=i(n):t.type===y||"MultiPoint"===t.type?e=n.map(i):t.type===g||"MultiLineString"===t.type?e=n.map(o):"MultiPolygon"===t.type&&(e=n.map((function(t){return t.map((function(t){return o(t)}))}))),t.incomingCoords(e)}))}var Rt={onSetup:function(t){var e=this,r={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initiallySelectedFeatureIds:t.featureIds||[]};return this.setSelected(r.initiallySelectedFeatureIds.filter((function(t){return void 0!==e.getFeature(t)}))),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),r},fireUpdate:function(){this.map.fire(E,{action:"move",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(){var t=this,e=this.getSelected(),r=e.filter((function(e){return t.isInstanceOf("MultiFeature",e)})),n=!1;if(e.length>1){n=!0;var i=e[0].type.replace("Multi","");e.forEach((function(t){t.type.replace("Multi","")!==i&&(n=!1)}))}var o=r.length>0,a=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:o,trash:a})},getUniqueIds:function(t){return t.length?t.map((function(t){return t.properties.id})).filter((function(t){return void 0!==t})).reduce((function(t,e){return t.add(e),t}),new D).values():[]},stopExtendedInteractions:function(t){t.boxSelectElement&&(t.boxSelectElement.parentNode&&t.boxSelectElement.parentNode.removeChild(t.boxSelectElement),t.boxSelectElement=null),this.map.dragPan.enable(),t.boxSelecting=!1,t.canBoxSelect=!1,t.dragMoving=!1,t.canDragMove=!1},onStop:function(){bt(this)},onMouseMove:function(t){return this.stopExtendedInteractions(t),!0},onMouseOut:function(t){return!t.dragMoving||this.fireUpdate()}};Rt.onTap=Rt.onClick=function(t,e){return ht(e)?this.clickAnywhere(t,e):ut(M)(e)?this.clickOnVertex(t,e):function(t){return!!t.featureTarget&&!!t.featureTarget.properties&&t.featureTarget.properties.meta===C}(e)?this.clickOnFeature(t,e):void 0},Rt.clickAnywhere=function(t){var e=this,r=this.getSelectedIds();r.length&&(this.clearSelectedFeatures(),r.forEach((function(t){return e.doRender(t)}))),bt(this),this.stopExtendedInteractions(t)},Rt.clickOnVertex=function(t,e){this.changeMode(x.DIRECT_SELECT,{featureId:e.featureTarget.properties.parent,coordPath:e.featureTarget.properties.coord_path,startPos:e.lngLat}),this.updateUIClasses({mouse:c})},Rt.startOnActiveFeature=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),this.doRender(e.featureTarget.properties.id),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},Rt.clickOnFeature=function(t,e){var r=this;wt(this),this.stopExtendedInteractions(t);var n=ft(e),i=this.getSelectedIds(),o=e.featureTarget.properties.id,a=this.isSelected(o);if(!n&&a&&this.getFeature(o).type!==m)return this.changeMode(x.DIRECT_SELECT,{featureId:o});a&&n?(this.deselect(o),this.updateUIClasses({mouse:h}),1===i.length&&bt(this)):!a&&n?(this.select(o),this.updateUIClasses({mouse:c})):a||n||(i.forEach((function(t){return r.doRender(t)})),this.setSelected(o),this.updateUIClasses({mouse:c})),this.doRender(o)},Rt.onMouseDown=function(t,e){return lt(e)?this.startOnActiveFeature(t,e):this.drawConfig.boxSelect&&function(t){return!!t.originalEvent&&!!t.originalEvent.shiftKey&&0===t.originalEvent.button}(e)?this.startBoxSelect(t,e):void 0},Rt.startBoxSelect=function(t,e){this.stopExtendedInteractions(t),this.map.dragPan.disable(),t.boxSelectStartLocation=vt(e.originalEvent,this.map.getContainer()),t.canBoxSelect=!0},Rt.onTouchStart=function(t,e){if(lt(e))return this.startOnActiveFeature(t,e)},Rt.onDrag=function(t,e){return t.canDragMove?this.dragMove(t,e):this.drawConfig.boxSelect&&t.canBoxSelect?this.whileBoxSelect(t,e):void 0},Rt.whileBoxSelect=function(t,e){t.boxSelecting=!0,this.updateUIClasses({mouse:l}),t.boxSelectElement||(t.boxSelectElement=document.createElement("div"),t.boxSelectElement.classList.add("mapbox-gl-draw_boxselect"),this.map.getContainer().appendChild(t.boxSelectElement));var r=vt(e.originalEvent,this.map.getContainer()),n=Math.min(t.boxSelectStartLocation.x,r.x),i=Math.max(t.boxSelectStartLocation.x,r.x),o=Math.min(t.boxSelectStartLocation.y,r.y),a=Math.max(t.boxSelectStartLocation.y,r.y),s="translate("+n+"px, "+o+"px)";t.boxSelectElement.style.transform=s,t.boxSelectElement.style.WebkitTransform=s,t.boxSelectElement.style.width=i-n+"px",t.boxSelectElement.style.height=a-o+"px"},Rt.dragMove=function(t,e){t.dragMoving=!0,e.originalEvent.stopPropagation();var r={lng:e.lngLat.lng-t.dragMoveLocation.lng,lat:e.lngLat.lat-t.dragMoveLocation.lat};Dt(this.getSelected(),r),t.dragMoveLocation=e.lngLat},Rt.onTouchEnd=Rt.onMouseUp=function(t,e){var r=this;if(t.dragMoving)this.fireUpdate();else if(t.boxSelecting){var n=[t.boxSelectStartLocation,vt(e.originalEvent,this.map.getContainer())],i=this.featuresAt(null,n,"click"),o=this.getUniqueIds(i).filter((function(t){return!r.isSelected(t)}));o.length&&(this.select(o),o.forEach((function(t){return r.doRender(t)})),this.updateUIClasses({mouse:c}))}this.stopExtendedInteractions(t)},Rt.toDisplayFeatures=function(t,e,r){e.properties.active=this.isSelected(e.properties.id)?T:L,r(e),this.fireActionable(),e.properties.active===T&&e.geometry.type!==m&&xt(e).forEach(r)},Rt.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()},Rt.onCombineFeatures=function(){var t=this.getSelected();if(!(0===t.length||t.length<2)){for(var e=[],r=[],n=t[0].type.replace("Multi",""),i=0;i1){var a=this.newFeature({type:d,properties:r[0].properties,geometry:{type:"Multi"+n,coordinates:e}});this.addFeature(a),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([a.id]),this.map.fire("draw.combine",{createdFeatures:[a.toGeoJSON()],deletedFeatures:r})}this.fireActionable()}},Rt.onUncombineFeatures=function(){var t=this,e=this.getSelected();if(0!==e.length){for(var r=[],n=[],i=function(i){var o=e[i];t.isInstanceOf("MultiFeature",o)&&(o.getFeatures().forEach((function(e){t.addFeature(e),e.properties=o.properties,r.push(e.toGeoJSON()),t.select([e.id])})),t.deleteFeature(o.id,{silent:!0}),n.push(o.toGeoJSON()))},o=0;o1&&this.map.fire("draw.uncombine",{createdFeatures:r,deletedFeatures:n}),this.fireActionable()}};var Ot=ut(M),zt=ut(P),Ft={fireUpdate:function(){this.map.fire(E,{action:"change_coordinates",features:this.getSelected().map((function(t){return t.toGeoJSON()}))})},fireActionable:function(t){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:t.selectedCoordPaths.length>0})},startDragging:function(t,e){this.map.dragPan.disable(),t.canDragMove=!0,t.dragMoveLocation=e.lngLat},stopDragging:function(t){this.map.dragPan.enable(),t.dragMoving=!1,t.canDragMove=!1,t.dragMoveLocation=null},onVertex:function(t,e){this.startDragging(t,e);var r=e.featureTarget.properties,n=t.selectedCoordPaths.indexOf(r.coord_path);ft(e)||-1!==n?ft(e)&&-1===n&&t.selectedCoordPaths.push(r.coord_path):t.selectedCoordPaths=[r.coord_path];var i=this.pathsToCoordinates(t.featureId,t.selectedCoordPaths);this.setSelectedCoordinates(i)},onMidpoint:function(t,e){this.startDragging(t,e);var r=e.featureTarget.properties;t.feature.addCoordinate(r.coord_path,r.lng,r.lat),this.fireUpdate(),t.selectedCoordPaths=[r.coord_path]},pathsToCoordinates:function(t,e){return e.map((function(e){return{feature_id:t,coord_path:e}}))},onFeature:function(t,e){0===t.selectedCoordPaths.length?this.startDragging(t,e):this.stopDragging(t)},dragFeature:function(t,e,r){Dt(this.getSelected(),r),t.dragMoveLocation=e.lngLat},dragVertex:function(t,e,r){for(var n=t.selectedCoordPaths.map((function(e){return t.feature.getCoordinate(e)})),i=Nt(n.map((function(t){return{type:d,properties:{},geometry:{type:m,coordinates:t}}})),r),o=0;o0?this.dragVertex(t,e,r):this.dragFeature(t,e,r),t.dragMoveLocation=e.lngLat}},Ft.onClick=function(t,e){return ht(e)?this.clickNoTarget(t,e):lt(e)?this.clickActiveFeature(t,e):ct(e)?this.clickInactive(t,e):void this.stopDragging(t)},Ft.onTap=function(t,e){return ht(e)?this.clickNoTarget(t,e):lt(e)?this.clickActiveFeature(t,e):ct(e)?this.clickInactive(t,e):void 0},Ft.onTouchEnd=Ft.onMouseUp=function(t){t.dragMoving&&this.fireUpdate(),this.stopDragging(t)};var Bt={};function Ut(t,e){return!!t.lngLat&&t.lngLat.lng===e[0]&&t.lngLat.lat===e[1]}Bt.onSetup=function(){var t=this.newFeature({type:d,properties:{},geometry:{type:m,coordinates:[]}});return this.addFeature(t),this.clearSelectedFeatures(),this.updateUIClasses({mouse:l}),this.activateUIButton(f.POINT),this.setActionableState({trash:!0}),{point:t}},Bt.stopDrawingAndRemove=function(t){this.deleteFeature([t.point.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)},Bt.onTap=Bt.onClick=function(t,e){this.updateUIClasses({mouse:c}),t.point.updateCoordinate("",e.lngLat.lng,e.lngLat.lat),this.map.fire(b,{features:[t.point.toGeoJSON()]}),this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.point.id]})},Bt.onStop=function(t){this.activateUIButton(),t.point.getCoordinate().length||this.deleteFeature([t.point.id],{silent:!0})},Bt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.point.id;if(e.properties.active=n?T:L,!n)return r(e)},Bt.onTrash=Bt.stopDrawingAndRemove,Bt.onKeyUp=function(t,e){if(dt(e)||gt(e))return this.stopDrawingAndRemove(t,e)};var jt={onSetup:function(){var t=this.newFeature({type:d,properties:{},geometry:{type:g,coordinates:[[]]}});return this.addFeature(t),this.clearSelectedFeatures(),wt(this),this.updateUIClasses({mouse:l}),this.activateUIButton(f.POLYGON),this.setActionableState({trash:!0}),{polygon:t,currentVertexPosition:0}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Ut(e,t.polygon.coordinates[0][t.currentVertexPosition-1]))return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]});this.updateUIClasses({mouse:l}),t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),t.currentVertexPosition++,t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},onMouseMove:function(t,e){t.polygon.updateCoordinate("0."+t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),pt(e)&&this.updateUIClasses({mouse:h})}};jt.onTap=jt.onClick=function(t,e){return pt(e)?this.clickOnVertex(t,e):this.clickAnywhere(t,e)},jt.onKeyUp=function(t,e){dt(e)?(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)):gt(e)&&this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.polygon.id]})},jt.onStop=function(t){this.updateUIClasses({mouse:p}),bt(this),this.activateUIButton(),void 0!==this.getFeature(t.polygon.id)&&(t.polygon.removeCoordinate("0."+t.currentVertexPosition),t.polygon.isValid()?this.map.fire(b,{features:[t.polygon.toGeoJSON()]}):(this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT,{},{silent:!0})))},jt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.polygon.id;if(e.properties.active=n?T:L,!n)return r(e);if(0!==e.geometry.coordinates.length){var i=e.geometry.coordinates[0].length;if(!(i<3)){if(e.properties.meta=C,r(_t(t.polygon.id,e.geometry.coordinates[0][0],"0.0",!1)),i>3){var o=e.geometry.coordinates[0].length-3;r(_t(t.polygon.id,e.geometry.coordinates[0][o],"0."+o,!1))}if(i<=4){var a=[[e.geometry.coordinates[0][0][0],e.geometry.coordinates[0][0][1]],[e.geometry.coordinates[0][1][0],e.geometry.coordinates[0][1][1]]];if(r({type:d,properties:e.properties,geometry:{coordinates:a,type:y}}),3===i)return}return r(e)}}},jt.onTrash=function(t){this.deleteFeature([t.polygon.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)};var Vt={onSetup:function(t){var e,r,n=(t=t||{}).featureId,i="forward";if(n){if(!(e=this.getFeature(n)))throw new Error("Could not find a feature with the provided featureId");var o=t.from;if(o&&"Feature"===o.type&&o.geometry&&"Point"===o.geometry.type&&(o=o.geometry),o&&"Point"===o.type&&o.coordinates&&2===o.coordinates.length&&(o=o.coordinates),!o||!Array.isArray(o))throw new Error("Please use the `from` property to indicate which point to continue the line from");var a=e.coordinates.length-1;if(e.coordinates[a][0]===o[0]&&e.coordinates[a][1]===o[1])r=a+1,e.addCoordinate.apply(e,[r].concat(e.coordinates[a]));else{if(e.coordinates[0][0]!==o[0]||e.coordinates[0][1]!==o[1])throw new Error("`from` should match the point at either the start or the end of the provided LineString");i="backwards",r=0,e.addCoordinate.apply(e,[r].concat(e.coordinates[0]))}}else e=this.newFeature({type:d,properties:{},geometry:{type:y,coordinates:[]}}),r=0,this.addFeature(e);return this.clearSelectedFeatures(),wt(this),this.updateUIClasses({mouse:l}),this.activateUIButton(f.LINE),this.setActionableState({trash:!0}),{line:e,currentVertexPosition:r,direction:i}},clickAnywhere:function(t,e){if(t.currentVertexPosition>0&&Ut(e,t.line.coordinates[t.currentVertexPosition-1])||"backwards"===t.direction&&Ut(e,t.line.coordinates[t.currentVertexPosition+1]))return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]});this.updateUIClasses({mouse:l}),t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),"forward"===t.direction?(t.currentVertexPosition++,t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat)):t.line.addCoordinate(0,e.lngLat.lng,e.lngLat.lat)},clickOnVertex:function(t){return this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]})},onMouseMove:function(t,e){t.line.updateCoordinate(t.currentVertexPosition,e.lngLat.lng,e.lngLat.lat),pt(e)&&this.updateUIClasses({mouse:h})}};Vt.onTap=Vt.onClick=function(t,e){if(pt(e))return this.clickOnVertex(t,e);this.clickAnywhere(t,e)},Vt.onKeyUp=function(t,e){gt(e)?this.changeMode(x.SIMPLE_SELECT,{featureIds:[t.line.id]}):dt(e)&&(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT))},Vt.onStop=function(t){bt(this),this.activateUIButton(),void 0!==this.getFeature(t.line.id)&&(t.line.removeCoordinate(""+t.currentVertexPosition),t.line.isValid()?this.map.fire(b,{features:[t.line.toGeoJSON()]}):(this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT,{},{silent:!0})))},Vt.onTrash=function(t){this.deleteFeature([t.line.id],{silent:!0}),this.changeMode(x.SIMPLE_SELECT)},Vt.toDisplayFeatures=function(t,e,r){var n=e.properties.id===t.line.id;if(e.properties.active=n?T:L,!n)return r(e);e.geometry.coordinates.length<2||(e.properties.meta=C,r(_t(t.line.id,e.geometry.coordinates["forward"===t.direction?e.geometry.coordinates.length-2:1],""+("forward"===t.direction?e.geometry.coordinates.length-2:1),!1)),r(e))};var qt={simple_select:Rt,direct_select:Ft,draw_point:Bt,draw_polygon:jt,draw_line_string:Vt},Gt={defaultMode:x.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],paint:{"fill-color":"#3bb2d0","fill-outline-color":"#3bb2d0","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","active","true"],["==","$type","Polygon"]],paint:{"fill-color":"#fbb03b","fill-outline-color":"#fbb03b","fill-opacity":.1}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","$type","Point"],["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","Polygon"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","active","true"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-line-inactive",type:"line",filter:["all",["==","active","false"],["==","$type","LineString"],["!=","mode","static"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3bb2d0","line-width":2}},{id:"gl-draw-line-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#fbb03b","line-dasharray":[.2,2],"line-width":2}},{id:"gl-draw-polygon-and-line-vertex-stroke-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-inactive",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#fbb03b"}},{id:"gl-draw-point-point-stroke-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":5,"circle-opacity":1,"circle-color":"#fff"}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","active","false"],["==","$type","Point"],["==","meta","feature"],["!=","mode","static"]],paint:{"circle-radius":3,"circle-color":"#3bb2d0"}},{id:"gl-draw-point-stroke-active",type:"circle",filter:["all",["==","$type","Point"],["==","active","true"],["!=","meta","midpoint"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":5,"circle-color":"#fbb03b"}},{id:"gl-draw-polygon-fill-static",type:"fill",filter:["all",["==","mode","static"],["==","$type","Polygon"]],paint:{"fill-color":"#404040","fill-outline-color":"#404040","fill-opacity":.1}},{id:"gl-draw-polygon-stroke-static",type:"line",filter:["all",["==","mode","static"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-line-static",type:"line",filter:["all",["==","mode","static"],["==","$type","LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#404040","line-width":2}},{id:"gl-draw-point-static",type:"circle",filter:["all",["==","mode","static"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#404040"}}],modes:qt,controls:{},userProperties:!1},Xt={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},Zt={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Yt(t,e){return t.map((function(t){return t.source?t:it(t,{id:t.id+"."+e,source:"hot"===e?s:u})}))}var Wt=V((function(t,e){var r="[object Arguments]",n="[object Map]",i="[object Object]",o="[object Set]",a=/^\[object .+?Constructor\]$/,s=/^(?:0|[1-9]\d*)$/,u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u[r]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u[n]=u["[object Number]"]=u[i]=u["[object RegExp]"]=u[o]=u["[object String]"]=u["[object WeakMap]"]=!1;var l="object"==typeof global&&global&&global.Object===Object&&global,c="object"==typeof self&&self&&self.Object===Object&&self,h=l||c||Function("return this")(),p=e&&!e.nodeType&&e,f=p&&t&&!t.nodeType&&t,d=f&&f.exports===p,g=d&&l.process,y=function(){try{return g&&g.binding&&g.binding("util")}catch(t){}}(),m=y&&y.isTypedArray;function v(t,e){for(var r=-1,n=null==t?0:t.length;++rs))return!1;var l=o.get(t);if(l&&o.get(e))return l==e;var c=-1,h=!0,p=2&r?new it:void 0;for(o.set(t,e),o.set(e,t);++c-1},rt.prototype.set=function(t,e){var r=this.__data__,n=at(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},nt.prototype.clear=function(){this.size=0,this.__data__={hash:new et,map:new(q||rt),string:new et}},nt.prototype.delete=function(t){var e=pt(this,t).delete(t);return this.size-=e?1:0,e},nt.prototype.get=function(t){return pt(this,t).get(t)},nt.prototype.has=function(t){return pt(this,t).has(t)},nt.prototype.set=function(t,e){var r=pt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},it.prototype.add=it.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},it.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.clear=function(){this.__data__=new rt,this.size=0},ot.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},ot.prototype.get=function(t){return this.__data__.get(t)},ot.prototype.has=function(t){return this.__data__.has(t)},ot.prototype.set=function(t,e){var r=this.__data__;if(r instanceof rt){var n=r.__data__;if(!q||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new nt(n)}return r.set(t,e),this.size=r.size,this};var dt=B?function(t){return null==t?[]:(t=Object(t),function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991}function It(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function St(t){return null!=t&&"object"==typeof t}var Ct=m?function(t){return function(e){return t(e)}}(m):function(t){return St(t)&&Et(t.length)&&!!u[st(t)]};function Pt(t){return null!=(e=t)&&Et(e.length)&&!wt(e)?function(t,e){var r=xt(t),n=!r&&_t(t),i=!r&&!n&&bt(t),o=!r&&!n&&!i&&Ct(t),a=r||n||i||o,s=a?function(t,e){for(var r=-1,n=Array(t);++r0&&(l(this.container.parentElement,"open"),l(this.container,"active")),this.results=t},e.select=function(t){return Array.from(this.container.children).forEach((function(e,r){return r===t?l(e,"active"):c(e,"active")})),this.selected=t,this.results[t]},e.count=function(){return this.results?this.results.length:0},e.clear=function(){for(this.selected=-1;this.container.lastChild;)this.container.removeChild(this.container.lastChild);c(this.container.parentElement,"open"),c(this.container,"active")},t}(),v={position:"topleft",style:"button",showMarker:!0,showPopup:!1,popupFormat:function(t){return""+t.result.label},marker:{icon:e&&e.Icon?new e.Icon.Default:void 0,draggable:!1},maxMarkers:1,maxSuggestions:5,retainZoomLevel:!1,animateZoom:!0,searchLabel:"Enter address",notFoundMessage:"Sorry, that address could not be found.",messageHideDelay:3e3,zoomLevel:18,classNames:{container:"leaflet-bar leaflet-control leaflet-control-geosearch",button:"leaflet-bar-part leaflet-bar-part-single",resetButton:"reset",msgbox:"leaflet-bar message",form:"",input:""},autoComplete:!0,autoCompleteDelay:250,autoClose:!1,keepResult:!1},_={},x=["dragging","touchZoom","doubleClickZoom","scrollWheelZoom","boxZoom","keyboard"],b="Leaflet must be loaded before instantiating the GeoSearch control",w={options:r({},v),classNames:r({},v.classNames),initialize:function(t){var n,i,o,u,l=this;if(!e)throw new Error(b);if(!t.provider)throw new Error("Provider is missing from options");this.options=r({},this.options,{},t),this.classNames=r({},this.classNames,{},t.classNames),this.markers=new e.FeatureGroup,this.classNames.container+=" leaflet-geosearch-"+this.options.style,this.searchElement=new y({searchLabel:this.options.searchLabel,classNames:{container:this.classNames.container,form:this.classNames.form,input:this.classNames.input},handleSubmit:function(t){return l.onSubmit(t)}}),this.button=a("a",this.classNames.button,this.searchElement.container,{title:this.options.searchLabel,href:"#",onClick:function(t){return l.onClick(t)},onDblClick:function(t){return s(t)}}),this.resetButton=a("a",this.classNames.resetButton,this.searchElement.form,{text:"×",href:"#",onClick:function(){return l.clearResults(null,!0)}}),this.options.autoComplete&&(this.resultList=new m({handleClick:function(t){var e=t.result;l.searchElement.input.value=e.label,l.onSubmit({query:e.label,data:e})}}),this.searchElement.form.appendChild(this.resultList.container),this.searchElement.input.addEventListener("keyup",(n=function(t){return l.autoSearch(t)},void 0===(i=this.options.autoCompleteDelay)&&(i=250),void 0===o&&(o=!1),function(){for(var t=arguments.length,e=new Array(t),r=0;re?0:n);this.searchElement.input.value=i.label}}else{var o=this.resultList.select(this.resultList.selected);this.onSubmit({query:this.searchElement.input.value,data:o})}},clearResults:function(t,e){if(void 0===e&&(e=!1),!t||27===t.keyCode){var r=this.options,n=r.autoComplete;!e&&r.keepResult||(this.searchElement.input.value="",this.markers.clearLayers()),n&&this.resultList.clear()}},autoSearch:function(t){try{var e=this;if(g.indexOf(t.keyCode)>-1)return Promise.resolve();var r=t.target.value,n=e.options.provider,i=function(){if(r.length)return Promise.resolve(n.search({query:r})).then((function(t){t=t.slice(0,e.options.maxSuggestions),e.resultList.render(t)}));e.resultList.clear()}();return Promise.resolve(i&&i.then?i.then((function(){})):void 0)}catch(t){return Promise.reject(t)}},onSubmit:function(t){try{var e=this;return Promise.resolve(e.options.provider.search(t)).then((function(r){r&&r.length>0&&e.showResult(r[0],t)}))}catch(t){return Promise.reject(t)}},showResult:function(t,e){var r=this.options.autoClose,n=Object.keys(this.markers._layers);n.length>=this.options.maxMarkers&&this.markers.removeLayer(n[0]);var i=this.addMarker(t,e);this.centerMap(t),this.map.fireEvent("geosearch/showlocation",{location:t,marker:i}),r&&this.closeResults()},closeResults:function(){var t=this.searchElement.container;t.classList.contains("active")&&c(t,"active"),this.restoreHandlers(),this.clearResults()},addMarker:function(t,r){var n=this,i=this.options,o=i.marker,a=i.showPopup,s=i.popupFormat,u=new e.Marker([t.y,t.x],o),l=t.label;return"function"==typeof s&&(l=s({query:r,result:t})),u.bindPopup(l),this.markers.addLayer(u),a&&u.openPopup(),o.draggable&&u.on("dragend",(function(t){n.map.fireEvent("geosearch/marker/dragend",{location:u.getLatLng(),event:t})})),u},centerMap:function(t){var r=this.options,n=r.retainZoomLevel,i=r.animateZoom,o=t.bounds?new e.LatLngBounds(t.bounds):new e.LatLng(t.y,t.x).toBounds(10),a=o.isValid()?o:this.markers.getBounds();!n&&o.isValid()?this.map.fitBounds(a,{animate:i}):this.map.setView(a.getCenter(),this.getZoom(),{animate:i})},getZoom:function(){var t=this.options,e=t.zoomLevel;return t.retainZoomLevel?this.map.getZoom():e}};function E(){if(!e)throw new Error(b);for(var t=e.Control.extend(w),r=arguments.length,n=new Array(r),i=0;i3)return r.push({message:"position should not have more than 3 elements",level:"message",line:t.__line__||n});if(!u(t,"number"))return r.push({message:"each element in a position must be a number",line:t.__line__||n});if(e&&e.precisionWarning){if(i===o){i+=1;return r.push({message:"truncated warnings: we've encountered coordinate precision warning "+o+" times, no more warnings will be reported",level:"message",line:t.__line__||n})}ia){i+=1;return r.push({message:"precision of coordinates should be reduced",level:"message",line:t.__line__||n})}}))}}function h(t,e,n,i){void 0===i&&void 0!==t.__line__&&(i=t.__line__);if(0===n)return c(t,i);if(1===n&&e)if("LinearRing"===e){if(!Array.isArray(t[t.length-1])){r.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:i});return!0}t.length<4&&r.push({message:"a LinearRing of coordinates needs to have four or more positions",line:i});if(t.length&&(t[t.length-1].length!==t[0].length||!t[t.length-1].every((function(e,r){return t[0][r]===e})))){r.push({message:"the first and last positions in a LinearRing of coordinates must be the same",line:i});return!0}}else if("Line"===e&&t.length<2)return r.push({message:"a line needs to have two or more coordinates to be valid",line:i});if(Array.isArray(t)){return t.map((function(t){return h(t,e,n-1,t.__line__||i)})).some((function(t){return t}))}r.push({message:"a number was found where a coordinate array should have been found: this needs to be nested more deeply",line:i})}function p(t){if(t.crs){"object"==typeof t.crs&&t.crs.properties&&"urn:ogc:def:crs:OGC:1.3:CRS84"===t.crs.properties.name?r.push({message:"old-style crs member is not recommended, this object is equivalent to the default and should be removed",line:t.__line__}):r.push({message:"old-style crs member is not recommended",line:t.__line__})}}function f(t){if(t.bbox){if(Array.isArray(t.bbox)){u(t.bbox,"number")||r.push({message:"each element in a bbox member must be a number",line:t.bbox.__line__});4!==t.bbox.length&&6!==t.bbox.length&&r.push({message:"bbox must contain 4 elements (for 2D) or 6 elements (for 3D)",line:t.bbox.__line__});return r.length}r.push({message:"bbox member must be an array of numbers, but is a "+typeof t.bbox,line:t.__line__})}}function d(t){p(t);f(t);void 0!==t.id&&"string"!=typeof t.id&&"number"!=typeof t.id&&r.push({message:'Feature "id" member must have a string or number value',line:t.__line__});void 0!==t.features&&r.push({message:'Feature object cannot contain a "features" member',line:t.__line__});void 0!==t.coordinates&&r.push({message:'Feature object cannot contain a "coordinates" member',line:t.__line__});"Feature"!==t.type&&r.push({message:"GeoJSON features must have a type=feature member",line:t.__line__});l(t,"properties","object");l(t,"geometry","object")||t.geometry&&s(t.geometry)}var g={Point:function(t){p(t);f(t);!function(t){void 0!==t.properties&&r.push({message:'geometry object cannot contain a "properties" member',line:t.__line__});void 0!==t.geometry&&r.push({message:'geometry object cannot contain a "geometry" member',line:t.__line__});void 0!==t.features&&r.push({message:'geometry object cannot contain a "features" member',line:t.__line__})}(t);l(t,"coordinates","array")||c(t.coordinates)},Feature:d,MultiPoint:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"",1)},LineString:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"Line",1)},MultiLineString:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"Line",2)},FeatureCollection:function(t){p(t);f(t);void 0!==t.properties&&r.push({message:'FeatureCollection object cannot contain a "properties" member',line:t.__line__});void 0!==t.coordinates&&r.push({message:'FeatureCollection object cannot contain a "coordinates" member',line:t.__line__});if(!l(t,"features","array")){if(!u(t.features,"object"))return r.push({message:"Every feature must be an object",line:t.__line__});t.features.forEach(d)}},GeometryCollection:function(t){p(t);f(t);if(!l(t,"geometries","array")){u(t.geometries,"object")||r.push({message:"The geometries array in a GeometryCollection must contain only geometry objects",line:t.__line__});1===t.geometries.length&&r.push({message:"GeometryCollection with a single geometry should be avoided in favor of single part or a single object of multi-part type",line:t.geometries.__line__});t.geometries.forEach((function(e){if(e){"GeometryCollection"===e.type&&r.push({message:"GeometryCollection should avoid nested geometry collections",line:t.geometries.__line__});s(e)}}))}},Polygon:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"LinearRing",2)||n(t,r)},MultiPolygon:function(t){p(t);f(t);l(t,"coordinates","array")||h(t.coordinates,"LinearRing",3)||n(t,r)}},y=Object.keys(g).reduce((function(t,e){t[e.toLowerCase()]=e;return t}),{});if("object"!=typeof t||null==t){r.push({message:"The root of a GeoJSON object must be an object.",line:0});return r}s(t);r.forEach((function(t){({}).hasOwnProperty.call(t,"line")&&void 0===t.line&&delete t.line}));return r}},{"./rhr":2}],2:[function(t,e,r){function n(t){var e=0;if(t.length>2)for(var r,n,i=0;i=0}function i(t){if(t&&t.length>0){if(n(t[0]))return!1;if(!t.slice(1,t.length).every(n))return!1}return!0}e.exports=function(t,e){(function(t){return"Polygon"===t.type?i(t.coordinates):"MultiPolygon"===t.type?t.coordinates.every(i):void 0})(t)||e.push({message:"Polygons and MultiPolygons should follow the right-hand rule",level:"message",line:t.__line__})}},{}],3:[function(t,e,r){},{}],4:[function(t,e,r){(function(n){(function(){var i=function(){var t=function(t,e,r,n){for(r=r||{},n=t.length;n--;r[t[n]]=e);return r},e=[1,12],r=[1,13],n=[1,9],i=[1,10],o=[1,11],a=[1,14],s=[1,15],u=[14,18,22,24],l=[18,22],c=[22,24],h={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(t,e,r,n,i,o,a){var s=o.length-1;switch(i){case 1:this.$=t.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b");break;case 2:this.$=Number(t);break;case 3:this.$=null;break;case 4:this.$=!0;break;case 5:this.$=!1;break;case 6:return this.$=o[s-1];case 13:this.$={};Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 14:case 19:this.$=o[s-1];Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 15:this.$=[o[s-2],o[s]];break;case 16:this.$={};this.$[o[s][0]]=o[s][1];break;case 17:this.$=o[s-2];if(void 0!==o[s-2][o[s][0]]){this.$.__duplicateProperties__||Object.defineProperty(this.$,"__duplicateProperties__",{value:[],enumerable:!1});this.$.__duplicateProperties__.push(o[s][0])}o[s-2][o[s][0]]=o[s][1];break;case 18:this.$=[];Object.defineProperty(this.$,"__line__",{value:this._$.first_line,enumerable:!1});break;case 20:this.$=[o[s]];break;case 21:this.$=o[s-2];o[s-2].push(o[s])}},table:[{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,12:1,13:2,15:7,16:8,17:a,23:s},{1:[3]},{14:[1,16]},t(u,[2,7]),t(u,[2,8]),t(u,[2,9]),t(u,[2,10]),t(u,[2,11]),t(u,[2,12]),t(u,[2,3]),t(u,[2,4]),t(u,[2,5]),t([14,18,21,22,24],[2,1]),t(u,[2,2]),{3:20,4:e,18:[1,17],19:18,20:19},{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:23,15:7,16:8,17:a,23:s,24:[1,21],25:22},{1:[2,6]},t(u,[2,13]),{18:[1,24],22:[1,25]},t(l,[2,16]),{21:[1,26]},t(u,[2,18]),{22:[1,28],24:[1,27]},t(c,[2,20]),t(u,[2,14]),{3:20,4:e,20:29},{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:30,15:7,16:8,17:a,23:s},t(u,[2,19]),{3:5,4:e,5:6,6:r,7:3,8:n,9:4,10:i,11:o,13:31,15:7,16:8,17:a,23:s},t(l,[2,17]),t(l,[2,15]),t(c,[2,21])],defaultActions:{16:[2,6]},parseError:function(t,e){if(!e.recoverable){function r(t,e){this.message=t;this.hash=e}r.prototype=Error;throw new r(t,e)}this.trace(t)},parse:function(t){var e=this,r=[0],n=[null],i=[],o=this.table,a="",s=0,u=0,l=0,c=i.slice.call(arguments,1),h=Object.create(this.lexer),p={yy:{}};for(var f in this.yy)Object.prototype.hasOwnProperty.call(this.yy,f)&&(p.yy[f]=this.yy[f]);h.setInput(t,p.yy);p.yy.lexer=h;p.yy.parser=this;void 0===h.yylloc&&(h.yylloc={});var d=h.yylloc;i.push(d);var g=h.options&&h.options.ranges;"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var y,m,v,_,x,b,w,E,I,S=function(){var t;"number"!=typeof(t=h.lex()||1)&&(t=e.symbols_[t]||t);return t},C={};;){v=r[r.length-1];if(this.defaultActions[v])_=this.defaultActions[v];else{null==y&&(y=S());_=o[v]&&o[v][y]}if(void 0===_||!_.length||!_[0]){var P="";I=[];for(b in o[v])this.terminals_[b]&&b>2&&I.push("'"+this.terminals_[b]+"'");P=h.showPosition?"Parse error on line "+(s+1)+":\n"+h.showPosition()+"\nExpecting "+I.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'");this.parseError(P,{text:h.match,token:this.terminals_[y]||y,line:h.yylineno,loc:d,expected:I})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+y);switch(_[0]){case 1:r.push(y);n.push(h.yytext);i.push(h.yylloc);r.push(_[1]);y=null;if(m){y=m;m=null}else{u=h.yyleng;a=h.yytext;s=h.yylineno;d=h.yylloc;l>0&&l--}break;case 2:w=this.productions_[_[1]][1];C.$=n[n.length-w];C._$={first_line:i[i.length-(w||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(w||1)].first_column,last_column:i[i.length-1].last_column};g&&(C._$.range=[i[i.length-(w||1)].range[0],i[i.length-1].range[1]]);if(void 0!==(x=this.performAction.apply(C,[a,u,s,p.yy,_[1],n,i].concat(c))))return x;if(w){r=r.slice(0,-1*w*2);n=n.slice(0,-1*w);i=i.slice(0,-1*w)}r.push(this.productions_[_[1]][0]);n.push(C.$);i.push(C._$);E=o[r[r.length-2]][r[r.length-1]];r.push(E);break;case 3:return!0}}return!0}},p={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){this.yy=e||this.yy||{};this._input=t;this._more=this._backtrack=this.done=!1;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};this.options.ranges&&(this.yylloc.range=[0,0]);this.offset=0;return this},input:function(){var t=this._input[0];this.yytext+=t;this.yyleng++;this.offset++;this.match+=t;this.matched+=t;if(t.match(/(?:\r\n?|\n).*/g)){this.yylineno++;this.yylloc.last_line++}else this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;this._input=this._input.slice(1);return t},unput:function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-e);this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-e};this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]);this.yyleng=this.yytext.length;return this},more:function(){this._more=!0;return this},reject:function(){if(!this.options.backtrack_lexer)return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno});this._backtrack=!0;return this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;t.length<20&&(t+=this._input.substr(0,20-t.length));return(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var r,n,i;if(this.options.backtrack_lexer){i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))}(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length);this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length};this.yytext+=t[0];this.match+=t[0];this.matches=t;this.yyleng=this.yytext.length;this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]);this._more=!1;this._backtrack=!1;this._input=this._input.slice(t[0].length);this.matched+=t[0];r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]);this.done&&this._input&&(this.done=!1);if(r)return r;if(this._backtrack){for(var o in i)this[o]=i[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,r,n;if(!this._more){this.yytext="";this.match=""}for(var i=this._currentRules(),o=0;oe[0].length)){e=r;n=o;if(this.options.backtrack_lexer){if(!1!==(t=this.test_match(r,i[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[n]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,r,n){switch(r){case 0:break;case 1:return 6;case 2:e.yytext=e.yytext.substr(1,e.yyleng-2);return 4;case 3:return 17;case 4:return 18;case 5:return 23;case 6:return 24;case 7:return 22;case 8:return 21;case 9:return 10;case 10:return 11;case 11:return 8;case 12:return 14;case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt\/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}};h.lexer=p;function f(){this.yy={}}f.prototype=h;h.Parser=f;return new f}();if(void 0!==t&&void 0!==r){r.parser=i;r.Parser=i.Parser;r.parse=function(){return i.parse.apply(i,arguments)};r.main=function(e){if(!e[1]){console.log("Usage: "+e[0]+" FILE");n.exit(1)}var i=t("fs").readFileSync(t("path").normalize(e[1]),"utf8");return r.parser.parse(i)};void 0!==e&&t.main===e&&r.main(n.argv.slice(1))}}).call(this)}).call(this,t("_process"))},{_process:6,fs:3,path:5}],5:[function(t,e,r){(function(t){(function(){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];if("."===i)t.splice(n,1);else if(".."===i){t.splice(n,1);r++}else if(r){t.splice(n,1);r--}}if(e)for(;r--;r)t.unshift("..");return t}r.resolve=function(){for(var r="",i=!1,o=arguments.length-1;o>=-1&&!i;o--){var a=o>=0?arguments[o]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");if(a){r=a+"/"+r;i="/"===a.charAt(0)}}return(i?"/":"")+(r=e(n(r.split("/"),(function(t){return!!t})),!i).join("/"))||"."};r.normalize=function(t){var o=r.isAbsolute(t),a="/"===i(t,-1);(t=e(n(t.split("/"),(function(t){return!!t})),!o).join("/"))||o||(t=".");t&&a&&(t+="/");return(o?"/":"")+t};r.isAbsolute=function(t){return"/"===t.charAt(0)};r.join=function(){var t=Array.prototype.slice.call(arguments,0);return r.normalize(n(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))};r.relative=function(t,e){t=r.resolve(t).substr(1);e=r.resolve(e).substr(1);function n(t){for(var e=0;e=0&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}for(var i=n(t.split("/")),o=n(e.split("/")),a=Math.min(i.length,o.length),s=a,u=0;u=1;--o)if(47===(e=t.charCodeAt(o))){if(!i){n=o;break}}else i=!1;return-1===n?r?"/":".":r&&1===n?"/":t.slice(0,n)};r.basename=function(t,e){var r=function(t){"string"!=typeof t&&(t+="");var e,r=0,n=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){r=e+1;break}}else if(-1===n){i=!1;n=e+1}return-1===n?"":t.slice(r,n)}(t);e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length));return r};r.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,r=0,n=-1,i=!0,o=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s){if(-1===n){i=!1;n=a+1}46===s?-1===e?e=a:1!==o&&(o=1):-1!==e&&(o=-1)}else if(!i){r=a+1;break}}return-1===e||-1===n||0===o||1===o&&e===n-1&&e===r+1?"":t.slice(e,n)};function n(t,e){if(t.filter)return t.filter(e);for(var r=[],n=0;n1)for(var r=1;rOpenStreetMap contributors'}},layers:[{id:"simple-tiles",type:"raster",source:"raster-tiles",minzoom:0,maxzoom:22}]},center:r,zoom:n} let o=new maplibregl.Map(i);o.on("load",(()=>{o.resize();P();if(I().features.length>0){var t=turf.bbox(I());o.fitBounds(t,{padding:20,maxZoom:13,duration:0})}}));return o}function o(){if("location"===E()){"circle"===y()&&r.addLayer({id:"feature",type:"circle",source:"feature"});if("label"===y()||"marker"===y()){r.addLayer({id:"feature",type:"symbol",source:"feature"});"marker"===y()&&s()}}"line"===E()&&r.addLayer({id:"feature",type:"line",source:"feature"});"polygon"===E()&&"fill"===m()&&r.addLayer({id:"feature",type:"fill",source:"feature"});"polygon"===E()&&"fill-extrusion"===m()&&r.addLayer({id:"feature",type:"fill-extrusion",source:"feature"});c()}function a(){n&&n.remove()}function s(){if("location"===E()&&"marker"===y()){a();if(I().features.length>0){var t=v().marker,e=new maplibregl.Marker(t).setLngLat(I().features[0].geometry.coordinates);e.addTo(r);n=e}}}function u(){t('.acf-field[data-name="polygon_style"]').length&&t(document).on("change",'.acf-field[data-name="polygon_style"] :input',(function(){!function(){r.getLayer("feature")&&r.removeLayer("feature");o();h()}();c()}))}function l(){t('.acf-field[data-name="location_style"]').length&&t(document).on("change",'.acf-field[data-name="location_style"] :input',(function(){!function(){a();r.getLayer("feature")&&r.removeLayer("feature");o();h()}();c()}))}function c(){var t=v();if("location"===E()&&"marker"===y())s();else if("location"===E()&&"marker"!==y()&&"3d-model"!==y()||"line"===E()||"polygon"===E()){for(var e in t.paint)r.setPaintProperty("feature",`${_()}${e}`,t.paint[e]);for(var e in t.layout)r.setLayoutProperty("feature",`${_()}${e}`,t.layout[e])}else"location"===E()&&"3d-model"===y()&&x()}function h(){var e=v();for(var r in e)for(var n in e[r])t(document).on("change",`.acf-field[data-name="${n}"] :input`,(function(){c()}));if("line"===E()){["dashed_line","dash_length","gap_length"].forEach((e=>{t(document).on("change",`.acf-field[data-name="${e}"] :input`,(function(){c()}))}))}if("location"===E()&&"label"===y()){["label_on","icon_on","icon-image","icon-translate-x","icon-translate-y","text-translate-x","text-translate-y"].forEach((e=>{t(document).on("change",`.acf-field[data-name="${e}"] :input`,(function(){c()}))}))} }function p(){let e=!1;t(document).on("click",".open-multigeom",(function(){t(".open-multigeom-a").trigger("click");if(!e){"line"===E()?t("#draw-single-line").show():"polygon"===E()&&t("#draw-single-polygon").show();!function(e){ }(i(b().attr("id")+"-multi"));e=!0}}))}function f(n){e=n;r=i(b().attr("id"));!function(){jQuery(document).on("click",".mapster-edit-full-width",(()=>{if("flex"===jQuery(".mapster-map-container").css("display")){jQuery(".mapster-map-container").css("display","block");jQuery(".mapster-map-container > div").css("width","100%");jQuery(".mapster-map-container > div").css("marginBottom","15px");jQuery(".mapster-edit-full-width").text("Collapse Map");r.resize()}else{jQuery(".mapster-map-container").css("display","flex");jQuery(".mapster-map-container > div").css("width","50%");jQuery(".mapster-map-container > div").css("marginBottom","0px");jQuery(".mapster-edit-full-width").text("Expand Map");r.resize()}}));let t=!1;jQuery(document).on("click",".mapster-simplify-shape",(()=>{if(jQuery(".mapster-simplify-shape-slider").length){jQuery(".mapster-simplify-shape").html("Simplify Shape");jQuery(".mapster-simplify-container").remove();d(t)}else{jQuery(".mapster-simplify-shape").html("Cancel Simplify Shape");jQuery(".mapster-map-container > div:first-child").append('\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t');t=I()}}));jQuery(document).on("input",".mapster-simplify-shape-slider",(function(){let e=jQuery(this).val();d(turf.simplify(t,{tolerance:parseInt(e)/100}))}));jQuery(document).on("click",".mapster-download-geojson",(()=>{var t=document.createElement("a"),e=new Blob(["\ufeff",JSON.stringify(I())]),r=URL.createObjectURL(e);t.href=r;t.download="geojson-download.json";document.getElementById("acf-form-data").appendChild(t);t.click();document.getElementById("acf-form-data").removeChild(t)}));jQuery(document).on("click",".mapster-image-base",(()=>{ }))}();!function(){var e=S(),n=new MapboxDraw({displayControlsDefault:!1,controls:{point:e.pointAllowed,line_string:e.lineStringAllowed,polygon:e.polygonAllowed,trash:!0}});r.addControl(n,"top-left");r.on("draw.create",(e=>{var i=I();S().multipleAllowed?i.features.push(e.features[0]):i.features=[e.features[0]];r.setLayoutProperty("feature","visibility","visible");t("#finish-drawing div").fadeOut();n.deleteAll();d(i)}));r.on("draw.delete",(t=>{var e=I();e.features=[];r.setLayoutProperty("feature","visibility","visible");d(e)}));r.on("draw.update",(t=>{var e=I();e.features=[t.features[0]];d(e)}));r.on("load",(()=>{t(document).on("click","#draw-point",(()=>{r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();n.changeMode("draw_point")}));t(document).on("click","#draw-linestring",(()=>{r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();n.changeMode("draw_line_string")}));t(document).on("click","#edit-linestring",(()=>{if(I().features[0]){r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();var e=n.add(I());n.changeMode("direct_select",{featureId:e[0]})}}));t(document).on("click","#draw-polygon",(()=>{r.setLayoutProperty("feature","visibility","none");n.changeMode("draw_polygon")}));t(document).on("click","#edit-polygon",(()=>{if(I().features[0]){r.setLayoutProperty("feature","visibility","none");t("#finish-drawing div").fadeIn();var e=n.add(I());n.changeMode("direct_select",{featureId:e[0]})}}));t(document).on("click","#finish-drawing div",(()=>{var e=I(),i=n.getAll(),o=e.features.findIndex((t=>t.id===i.features[0].id));o>-1&&(e.features[o]=i.features[0]);r.setLayoutProperty("feature","visibility","visible");t("#finish-drawing div").fadeOut();n.deleteAll();d(e)}));t(document).on("click","#draw-delete",(()=>{n.deleteAll();r.setLayoutProperty("feature","visibility","none");d({type:"FeatureCollection",features:[]})}))}))}();!function(){"location"===E()&&C();v();r.on("load",(()=>{r.addSource("feature",{type:"geojson",data:I()});o()}))}();h();!function(){if(t("#mapster-map-geosearch").length){const e=new GeoSearch.OpenStreetMapProvider;t(document).on("click","#mapster-get-results",(async function(){var r=t("#mapster-map-geosearch").val();if(r.length>2){const o=await e.search({query:r});var i=n(o);t("#mapster-geocoder-results").empty().append(i)}else t("#mapster-geocoder-results").empty()}));t(document).on("keyup","#mapster-map-geosearch",(function(){t("#mapster-map-geosearch").val().length<=2&&t("#mapster-geocoder-results").empty()}));t(document).on("click","#mapster-geocoder-results li",(function(){var e=t(this).data("bounds");d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t(this).data("center")}}]});r.fitBounds(e.map((t=>t.slice().reverse())),{padding:20});t("#mapster-geocoder-results").empty()}));const n=t=>{var e="";t.slice(0,5).forEach((t=>{e+=`
  • ${t.label}
  • `}));return e}}if(t("#mapster-geocoder-mapbox").length){const e=t("#mapster-geocoder-mapbox").data("access_token"),n=new MapboxGeocoder({accessToken:e,mapboxgl:maplibregl,marker:!1});n.on("result",(t=>{d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:t.result.center}}]})}));document.getElementById("mapster-geocoder-mapbox").appendChild(n.onAdd(r))}}();p();"line"!==E()&&"polygon"!==E()||function(){t("#mapster-map-upload").change((function(t){e(t)}));const e=async t=>{const e=await new Response(t.target.files[0]).json();r(e)},r=e=>{if(e){const n=geojsonhint.hint(e);if(0===n.length){if(r=e.features.find((e=>t("#mapster-map-upload").data("type").indexOf(e.geometry.type)>-1))){if(window.confirm("Are you sure you want to upload this geoJSON? It will overwrite all existing features.")){r.id||(r.id=parseInt(Math.random()*Math.random()*1e7));d({type:"FeatureCollection",features:[r]})}}else window.alert("Please double-check that your geoJSON has the right geometry type for this post.")}else{var r;if(r=e.features.find((e=>t("#mapster-map-upload").data("type").indexOf(e.geometry.type)>-1))){if(window.confirm("There was an error with your upload: "+JSON.stringify(n)+". Are you sure you want to upload this geoJSON? It will overwrite all existing features.")){r.id||(r.id=parseInt(Math.random()*Math.random()*1e7));d({type:"FeatureCollection",features:[r]})}}else window.alert("GeoJSON error: "+JSON.stringify(n))}}else window.alert("Please upload a file.")}}();if("location"===E()){l();t(document).on("click","#set-manual-point",(function(){let e=t("#mapster-map-point-longitude").val(),r=t("#mapster-map-point-latitude").val();d({type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[parseFloat(e),parseFloat(r)]}}]})}))}"polygon"===E()&&u()}function d(e){!function(t){t.features.forEach((t=>{t.geometry.coordinates=t.geometry.coordinates.map(g)}))}(e);!function(e){t(`#mapster-map-geojson-${w()}`).attr("value",JSON.stringify(e))}(e);r.getSource("feature").setData(e);s();if("location"===E()){C();"3d-model"===y()&&x()}}function g(t){return isNaN(t)?t.map(g):Math.round(1e8*t)/1e8}function y(){return t(".mapster-map-submission-frontend").length?"marker":t('.acf-field[data-name="location_style"]').find("select").val()}function m(){return t('.acf-field[data-name="polygon_style"]').find("select").val()}function v(){if("location"===E()&&"circle"===y()){var e=t('.acf-field[data-name="circle"] .acf-field[data-name="color"]').find(":input").val(),n=t('.acf-field[data-name="circle"] .acf-field[data-name="opacity"]').find(":input").val(),i=t('.acf-field[data-name="circle"] .acf-field[data-name="radius"]').find(":input").val(),o=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-width"]').find(":input").val(),a=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-color"]').find(":input").val(),s=t('.acf-field[data-name="circle"] .acf-field[data-name="stroke-opacity"]').find(":input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,radius:""!==i?parseFloat(i):5,"stroke-width":""!==o?parseFloat(o):0,"stroke-color":""!==a?a:"#FFF","stroke-opacity":""!==s?parseFloat(s)/100:1}}}if("location"===E()&&"marker"===y()){e=t('.acf-field[data-name="marker"] .acf-field[data-name="color"]').find(":input").val();var u=t('.acf-field[data-name="marker"] .acf-field[data-name="scale"]').find(":input").val(),l=t('.acf-field[data-name="marker"] .acf-field[data-name="rotation"]').find(":input").val(),c=t('.acf-field[data-name="marker"] .acf-field[data-name="anchor"]').find(":input").val();return{marker:{color:""!==e?e:"#000",scale:""!==u?parseFloat(u)/100:1,rotation:""!==l?parseFloat(l):0,anchor:""!==c?c:"center"}}}if("location"===E()&&"label"===y()){var h=t('.acf-field[data-name="label"] .acf-field[data-name="label_on"]').find(":input").is(":checked"),p=t('.acf-field[data-name="label"] .acf-field[data-name="text-field"]').find(":input").val(),f=t('.acf-field[data-name="label"] .acf-field[data-name="text-font"]').find(":input").val(),d=t('.acf-field[data-name="label"] .acf-field[data-name="text-size"]').find(":input").val(),g=t('.acf-field[data-name="label"] .acf-field[data-name="text-color"]').find(":input").val(),v=t('.acf-field[data-name="label"] .acf-field[data-name="text-opacity"]').find(":input").val(),_=t('.acf-field[data-name="label"] .acf-field[data-name="text-rotate"]').find(":input").val(),x=t('.acf-field[data-name="label"] .acf-field[data-name="text-translate-x"]').find(":input").val(),b=t('.acf-field[data-name="label"] .acf-field[data-name="text-translate-y"]').find(":input").val(),w=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-width"]').find(":input").val(),I=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-color"]').find(":input").val(),S=t('.acf-field[data-name="label"] .acf-field[data-name="text-halo-blur"]').find(":input").val(),C=t('.acf-field[data-name="icon"] .acf-field[data-name="icon_on"]').find(":input").is(":checked"),P=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-image"] img').attr("src"),M=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-size"]').find(":input").val(),T=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-opacity"]').find(":input").val(),L=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-rotate"]').find(":input").val(),A=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-translate-x"]').find(":input").val(),k=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-translate-y"]').find(":input").val(),N=t('.acf-field[data-name="icon"] .acf-field[data-name="icon-anchor"]').find(":input").val();""!==P&&function(t,e){t||e();"https:"===window.location.protocol&&t.indexOf("http://")>-1&&(t=t.replace("http","https"));r.loadImage(t,((t,n)=>{if(r.loaded()){r.hasImage("icon-image-location")?r.updateImage("icon-image-location",n):r.addImage("icon-image-location",n);e()}else r.once("idle",(()=>{r.hasImage("icon-image-location")?r.updateImage("icon-image-location",n):r.addImage("icon-image-location",n);e()}))}))}(P,(()=>{r.setLayoutProperty("feature","icon-image","icon-image-location")}));const e={layout:{"text-field":""!==p?p:"","text-font":[f],"text-rotate":""!==_?parseFloat(_):0,"text-size":""!==d?parseFloat(d):16,"icon-size":""!==M?parseFloat(M)/100:1,"icon-rotate":""!==L?parseFloat(L):0,"icon-anchor":""!==N?N:"center","icon-offset":""!==A&&""!==k?[parseFloat(A),parseFloat(k)]:[0,0],"text-offset":""!==x&&""!==b?[parseFloat(x),parseFloat(b)]:[0,0]},paint:{"text-color":""!==g?g:"#000000","text-halo-width":""!==w?parseFloat(w):1,"text-halo-color":""!==I?I:"#FFFFFF","text-halo-blur":""!==S?parseFloat(S)/100:.5,"text-opacity":""!==v?parseFloat(v)/100:1,"icon-opacity":""!==T?parseFloat(T)/100:1}};h||(e.layout["text-size"]=0);C||(e.layout["icon-size"]=0);return e}if("line"===E()){e=t('.acf-field[data-name="color"]').find(":input").val(),n=t('.acf-field[data-name="opacity"]').find(":input").val();var D=t('.acf-field[data-name="width"]').find(":input").val(),R=t('.acf-field[data-name="dashed_line"]').find(":input").is(":checked"),O=t('.acf-field[data-name="dash_length"]').find(":input").val(),z=t('.acf-field[data-name="gap_length"]').find(":input").val();const r={paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,width:""!==D?parseFloat(D):5}};r.paint.dasharray=R?""!==O&&""!==z?[parseFloat(O),parseFloat(z)]:[1,1]:[1,0];return r}if("polygon"===E()&&"fill"===m()){e=t('.acf-field[data-name="color"]').find("input").val(),n=t('.acf-field[data-name="opacity"]').find("input").val();var F=t('.acf-field[data-name="outline-color"]').find("input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,"outline-color":""!==F?F:"rgba(0, 0, 0, 0)"}}}if("polygon"===E()&&"fill-extrusion"===m()){e=t('.acf-field[data-name="color"]').find("input").val(),n=t('.acf-field[data-name="opacity"]').find("input").val();var B=t('.acf-field[data-name="base"]').find("input").val(),U=t('.acf-field[data-name="height"]').find("input").val();return{paint:{color:""!==e?e:"#000",opacity:""!==n?parseFloat(n)/100:1,base:""!==B?parseFloat(B):0,height:""!==U?parseFloat(U):0}}}}function _(){return"location"===E()&&"circle"===y()?"circle-":"location"===E()&&"label"===y()?"":"line"===E()?"line-":"polygon"===E()&&"fill"===m()?"fill-":"polygon"===E()&&"fill-extrusion"===m()?"fill-extrusion-":void 0}function x(){ }function b(){return t(e).find(".mapster-map")}function w(){return b().attr("id").replace("mapster-map-","")}function E(){if(t(".mapster-map-submission-frontend").length){let e=1===t(".mapster-submission-map").data("linestring")?"line":"";e=1===t(".mapster-submission-map").data("point")?"location":e;e=1===t(".mapster-submission-map").data("polygon")?"polygon":e;return e}var e=t("body").attr("class").split(/\s+/).find((t=>t.indexOf("post-type-mapster-wp-")>-1)).replace("post-type-mapster-wp-","");return e="user-sub"===e?"location":e}function I(){var e=t(`#mapster-map-geojson-${w()}`).val();if(e&&""!==e){return JSON.parse(e)}return{type:"FeatureCollection",features:[]}}function S(){return{pointAllowed:1===b().data("point"),lineStringAllowed:1===b().data("linestring"),polygonAllowed:1===b().data("polygon"),multipleAllowed:1===b().data("multiple")}}function C(){if(I().features[0]){var e=I().features[0].geometry.coordinates;t("#mapster-map-point-longitude").val(e[0]);t("#mapster-map-point-latitude").val(e[1])}else{t("#mapster-map-point-longitude").val("");t("#mapster-map-point-latitude").val("")}}function P(){ }if(void 0!==acf.add_action){acf.add_action("ready_field/type=mapster-map",f);acf.add_action("append_field/type=mapster-map",f);acf.add_action("show_field/type=mapster-map",f)}else t(document).on("acf/setup_fields",(function(e,r){t(r).find('.field[data-field_type="mapster-map"]').each((function(){f(t(this))}))}))}(jQuery);