diff --git a/dist/en/main/apidoc/module-ol_transform.html b/dist/en/main/apidoc/module-ol_transform.html index d304a68f51..1c87e421c8 100644 --- a/dist/en/main/apidoc/module-ol_transform.html +++ b/dist/en/main/apidoc/module-ol_transform.html @@ -188,7 +188,7 @@

transform.js, - line 218 + line 217
diff --git a/dist/en/main/examples/common.js b/dist/en/main/examples/common.js index d28d148251..1007faf737 100644 --- a/dist/en/main/examples/common.js +++ b/dist/en/main/examples/common.js @@ -1,4 +1,4 @@ !function(){var t,e,i={49552:function(t){"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},61106:function(t){"use strict";function e(t,e,n){n=n||2;var s,o,a,l,c,d,g,p=e&&e.length,m=p?e[0]*n:t.length,_=i(t,0,m,n,!0),y=[];if(!_||_.next===_.prev)return y;if(p&&(_=function(t,e,n,r){var s,o,a,l=[];for(s=0,o=e.length;s80*n){s=a=t[0],o=l=t[1];for(var x=n;xa&&(a=c),d>l&&(l=d);g=0!==(g=Math.max(a-s,l-o))?32767/g:0}return r(_,y,n,s,o,g,0),y}function i(t,e,i,n,r){var s,o;if(r===T(t,e,i,n)>0)for(s=e;s=e;s-=n)o=w(s,t[s],t[s+1],o);return o&&_(o,o.next)&&(S(o),o=o.next),o}function n(t,e){if(!t)return t;e||(e=t);var i,n=t;do{if(i=!1,n.steiner||!_(n,n.next)&&0!==m(n.prev,n,n.next))n=n.next;else{if(S(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function r(t,e,i,h,u,c,f){if(t){!f&&c&&function(t,e,i,n){var r=t;do{0===r.z&&(r.z=d(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){var e,i,n,r,s,o,a,l,h=1;do{for(i=t,t=null,s=null,o=0;i;){for(o++,n=i,a=0,e=0;e0||l>0&&n;)0!==a&&(0===l||!n||i.z<=n.z)?(r=i,i=i.nextZ,a--):(r=n,n=n.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;i=n}s.nextZ=null,h*=2}while(o>1)}(r)}(t,h,u,c);for(var g,p,m=t;t.prev!==t.next;)if(g=t.prev,p=t.next,c?o(t,h,u,c):s(t))e.push(g.i/i|0),e.push(t.i/i|0),e.push(p.i/i|0),S(t),t=p.next,m=p.next;else if((t=p)===m){f?1===f?r(t=a(n(t),e,i),e,i,h,u,c,2):2===f&&l(t,e,i,h,u,c):r(n(t),e,i,h,u,c,1);break}}}function s(t){var e=t.prev,i=t,n=t.next;if(m(e,i,n)>=0)return!1;for(var r=e.x,s=i.x,o=n.x,a=e.y,l=i.y,h=n.y,u=rs?r>o?r:o:s>o?s:o,f=a>l?a>h?a:h:l>h?l:h,p=n.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&g(r,a,s,l,o,h,p.x,p.y)&&m(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function o(t,e,i,n){var r=t.prev,s=t,o=t.next;if(m(r,s,o)>=0)return!1;for(var a=r.x,l=s.x,h=o.x,u=r.y,c=s.y,f=o.y,p=al?a>h?a:h:l>h?l:h,x=u>c?u>f?u:f:c>f?c:f,v=d(p,_,e,i,n),E=d(y,x,e,i,n),b=t.prevZ,w=t.nextZ;b&&b.z>=v&&w&&w.z<=E;){if(b.x>=p&&b.x<=y&&b.y>=_&&b.y<=x&&b!==r&&b!==o&&g(a,u,l,c,h,f,b.x,b.y)&&m(b.prev,b,b.next)>=0)return!1;if(b=b.prevZ,w.x>=p&&w.x<=y&&w.y>=_&&w.y<=x&&w!==r&&w!==o&&g(a,u,l,c,h,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}for(;b&&b.z>=v;){if(b.x>=p&&b.x<=y&&b.y>=_&&b.y<=x&&b!==r&&b!==o&&g(a,u,l,c,h,f,b.x,b.y)&&m(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=E;){if(w.x>=p&&w.x<=y&&w.y>=_&&w.y<=x&&w!==r&&w!==o&&g(a,u,l,c,h,f,w.x,w.y)&&m(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function a(t,e,i){var r=t;do{var s=r.prev,o=r.next.next;!_(s,o)&&y(s,r,r.next,o)&&E(s,o)&&E(o,s)&&(e.push(s.i/i|0),e.push(r.i/i|0),e.push(o.i/i|0),S(r),S(r.next),r=t=o),r=r.next}while(r!==t);return n(r)}function l(t,e,i,s,o,a){var l=t;do{for(var h=l.next.next;h!==l.prev;){if(l.i!==h.i&&p(l,h)){var u=b(l,h);return l=n(l,l.next),u=n(u,u.next),r(l,e,i,s,o,a,0),void r(u,e,i,s,o,a,0)}h=h.next}l=l.next}while(l!==t)}function h(t,e){return t.x-e.x}function u(t,e){var i=function(t,e){var i,n=e,r=t.x,s=t.y,o=-1/0;do{if(s<=n.y&&s>=n.next.y&&n.next.y!==n.y){var a=n.x+(s-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(a<=r&&a>o&&(o=a,i=n.x=n.x&&n.x>=u&&r!==n.x&&g(si.x||n.x===i.x&&c(i,n)))&&(i=n,f=l)),n=n.next}while(n!==h);return i}(t,e);if(!i)return e;var r=b(i,t);return n(r,r.next),n(i,i.next)}function c(t,e){return m(t.prev,t,e.prev)<0&&m(e.next,t,t.next)<0}function d(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function f(t){var e=t,i=t;do{(e.x=(t-o)*(s-a)&&(t-o)*(n-a)>=(i-o)*(e-a)&&(i-o)*(s-a)>=(r-o)*(n-a)}function p(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&y(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(E(t,e)&&E(e,t)&&function(t,e){var i=t,n=!1,r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(m(t.prev,t,e.prev)||m(t,e.prev,e))||_(t,e)&&m(t.prev,t,t.next)>0&&m(e.prev,e,e.next)>0)}function m(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function _(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,i,n){var r=v(m(t,e,i)),s=v(m(t,e,n)),o=v(m(i,n,t)),a=v(m(i,n,e));return r!==s&&o!==a||(!(0!==r||!x(t,i,e))||(!(0!==s||!x(t,n,e))||(!(0!==o||!x(i,t,n))||!(0!==a||!x(i,e,n)))))}function x(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function v(t){return t>0?1:t<0?-1:0}function E(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function b(t,e){var i=new C(t.i,t.x,t.y),n=new C(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function w(t,e,i,n){var r=new C(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function S(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 C(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function T(t,e,i,n){for(var r=0,s=e,o=i-n;s0&&(n+=t[r-1].length,i.holes.push(n))}return i}},78898:function(t,e){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -e.read=function(t,e,i,n,r){var s,o,a=8*r-n-1,l=(1<>1,u=-7,c=i?r-1:0,d=i?-1:1,f=t[e+c];for(c+=d,s=f&(1<<-u)-1,f>>=-u,u+=a;u>0;s=256*s+t[e+c],c+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+t[e+c],c+=d,u-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=h}return(f?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,i,n,r,s){var o,a,l,h=8*s-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,g=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*l-1)*Math.pow(2,r),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+f]=255&a,f+=g,a/=256,r-=8);for(o=o<0;t[i+f]=255&o,f+=g,o/=256,h-=8);t[i+f-g]|=128*p}},58882:function(t,e,i){"use strict";t.exports=r;var n=i(78898);function r(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var s=4294967296,o=1/s,a="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function l(t){return t.type===r.Bytes?t.readVarint()+t.pos:t.pos+1}function h(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function c(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function b(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}r.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,s=this.pos;this.type=7&n,t(r,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=b(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=v(this.buf,this.pos)+v(this.buf,this.pos+4)*s;return this.pos+=8,t},readSFixed64:function(){var t=v(this.buf,this.pos)+b(this.buf,this.pos+4)*s;return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,s=i.buf;if(r=s[i.pos++],n=(112&r)>>4,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return h(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=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&&a?function(t,e,i){return a.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(h=l):2===u?128==(192&(s=t[r+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===u?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((h=(15&l)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((h=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=u}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!==r.Bytes)return t.push(this.readVarint(e));var i=l(this);for(t=t||[];this.pos127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.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 i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;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,i){for(var n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&u(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(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 i=0;i=128&&u(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,r.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,x,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},61840:function(t,e,i){"use strict";i.d(e,{Z:function(){return Fi}});var n=1,r=2,s=3,o=5,a=6378137,l=6356752.314,h=.0066943799901413165,u=484813681109536e-20,c=Math.PI/2,d=.16666666666666666,f=.04722222222222222,g=.022156084656084655,p=1e-10,m=.017453292519943295,_=57.29577951308232,y=Math.PI/4,x=2*Math.PI,v=3.14159265359,E={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},b={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},w=/[\s_\-\/\(\)]/g;function S(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(w,""),s=-1;++s=this.text.length)return;t=this.text[this.place++]}switch(this.state){case M:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},F.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(A.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},F.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=M)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=M,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},F.prototype.number=function(t){if(!L.test(t)){if(A.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},F.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},F.prototype.keyword=function(t){if(I.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=M)}if(!A.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},F.prototype.neutral=function(t){if(R.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(L.test(t))return this.word=t,void(this.state=3);if(!A.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},F.prototype.output=function(){for(;this.place0?90:-90)):(t.lat0=D(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(r),r}function G(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?G[t]=C(arguments[1]):G[t]=N(arguments[1]):G[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?G.apply(e,t):G(t)}));if("string"==typeof t){if(t in G)return G[t]}else"EPSG"in t?G["EPSG:"+t.EPSG]=t:"ESRI"in t?G["ESRI:"+t.ESRI]=t:"IAU2000"in t?G["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(G);var z=G;var j=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var U=["3857","900913","3785","102113"];var B=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in z}(t))return z[t];if(function(t){return j.some((function(e){return t.indexOf(e)>-1}))}(t)){var e=N(t);if(function(t){var e=S(t,"authority");if(e){var i=S(e,"epsg");return i&&U.indexOf(i)>-1}}(e))return z["EPSG:3857"];var i=function(t){var e=S(t,"extension");if(e)return S(e,"proj4")}(e);return i?C(i):e}return function(t){return"+"===t[0]}(t)?C(t):void 0};function q(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function V(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function X(t){return t<0?-1:1}function $(t){return Math.abs(t)<=v?t:t-X(t)*x}function W(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(c-e))/n}function Y(t,e){for(var i,n,r=.5*t,s=c-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=c-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function H(t){return t}var K=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,n=t.x,r=t.y;if(r*_>90&&r*_<-90&&n*_>180&&n*_<-180)return null;if(Math.abs(Math.abs(r)-c)<=p)return null;if(this.sphere)e=this.x0+this.a*this.k0*$(n-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(y+.5*r));else{var s=Math.sin(r),o=W(this.e,r,s);e=this.x0+this.a*this.k0*$(n-this.long0),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=c-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Y(this.e,s)))return null}return e=$(this.long0+n/(this.a*this.k0)),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:H,inverse:H,names:["longlat","identity"]}],J={},Q=[];function tt(t,e){var i=Q.length;return t.names?(Q[i]=t,t.names.forEach((function(t){J[t.toLowerCase()]=i})),this):(console.log(e),!0)}var et={start:function(){K.forEach(tt)},add:tt,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==J[e]&&Q[J[e]]?Q[J[e]]:void 0}},it={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},nt=it.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};it.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var rt={};rt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},rt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},rt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},rt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},rt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},rt.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},rt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},rt.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},rt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},rt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},rt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},rt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},rt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},rt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},rt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var st=function(t,e,i,a,l,h,c){var d={};return d.datum_type=void 0===t||"none"===t?o:4,e&&(d.datum_params=e.map(parseFloat),0===d.datum_params[0]&&0===d.datum_params[1]&&0===d.datum_params[2]||(d.datum_type=n),d.datum_params.length>3&&(0===d.datum_params[3]&&0===d.datum_params[4]&&0===d.datum_params[5]&&0===d.datum_params[6]||(d.datum_type=r,d.datum_params[3]*=u,d.datum_params[4]*=u,d.datum_params[5]*=u,d.datum_params[6]=d.datum_params[6]/1e6+1))),c&&(d.datum_type=s,d.grids=c),d.a=i,d.b=a,d.es=l,d.ep2=h,d},ot={};function at(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:ot[t]||null,isNull:!1}}function lt(t){return t/3600*Math.PI/180}function ht(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function ut(t){return t.map((function(t){return[lt(t.longitudeShift),lt(t.latitudeShift)]}))}function ct(t,e,i){return{name:ht(t,e+8,e+16).trim(),parent:ht(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function dt(t,e,i,n){for(var r=e+176,s=[],o=0;o-1.001*c)l=-c;else if(l>c&&l<1.001*c)l=c;else{if(l<-c)return{x:-1/0,y:-1/0,z:t.z};if(l>c)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function mt(t,e,i,n){var r,s,o,a,l,h,u,d,f,g,p,m,_,y,x,v=1e-12,E=t.x,b=t.y,w=t.z?t.z:0;if(r=Math.sqrt(E*E+b*b),s=Math.sqrt(E*E+b*b+w*w),r/i1e-24&&_<30);return{x:y,y:Math.atan(p/Math.abs(g)),z:x}}function _t(t){return t===n||t===r}function yt(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===n?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==r||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(t.datum_type===o||e.datum_type===o)return i;var u=t.a,c=t.es;if(t.datum_type===s){if(0!==xt(t,!1,i))return;u=a,c=h}var d=e.a,f=e.b,g=e.es;if(e.datum_type===s&&(d=a,f=l,g=h),c===g&&u===d&&!_t(t.datum_type)&&!_t(e.datum_type))return i;if((i=pt(i,c,u),_t(t.datum_type)&&(i=function(t,e,i){if(e===n)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===r){var s=i[0],o=i[1],a=i[2],l=i[3],h=i[4],u=i[5],c=i[6];return{x:c*(t.x-u*t.y+h*t.z)+s,y:c*(u*t.x+t.y-l*t.z)+o,z:c*(-h*t.x+l*t.y+t.z)+a}}}(i,t.datum_type,t.datum_params)),_t(e.datum_type)&&(i=function(t,e,i){if(e===n)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===r){var s=i[0],o=i[1],a=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=(t.x-s)/c,f=(t.y-o)/c,g=(t.z-a)/c;return{x:d+u*f-h*g,y:-u*d+f+l*g,z:h*d-l*f+g}}}(i,e.datum_type,e.datum_params)),i=mt(i,g,d,f),e.datum_type===s)&&0!==xt(e,!0,i))return;return i}function xt(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;on.y||f>n.x||m1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=$(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function Et(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],g=e.cvs[i][1];i--;var p=e.cvs[i][0],m=e.cvs[i][1],_=o*a,y=o*(1-a),x=(1-o)*(1-a),v=(1-o)*a;return l.x=x*h+y*c+v*p+_*f,l.y=x*u+y*d+v*m+_*g,l}function bt(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function wt(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function St(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Ct(t,e,i,o){var a,l=void 0!==(i=Array.isArray(i)?wt(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){St(t.x),St(t.y)}(i),t.datum&&e.datum&&function(t,e){return(t.datum.datum_type===n||t.datum.datum_type===r||t.datum.datum_type===s)&&"WGS84"!==e.datumCode||(e.datum.datum_type===n||e.datum.datum_type===r||e.datum.datum_type===s)&&"WGS84"!==t.datumCode}(t,e)&&(i=Ct(t,a=new gt("WGS84"),i,o),t=a),o&&"enu"!==t.axis&&(i=bt(t,!1,i)),"longlat"===t.projName)i={x:i.x*m,y:i.y*m,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=yt(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*_,y:i.y*_,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),o&&"enu"!==e.axis?bt(e,!0,i):(i&&!l&&delete i.z,i)}var Tt=gt("WGS84");function Mt(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=Ct(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.splice(3)):[r.x,r.y,i[2]].concat(i.splice(3)):[r.x,r.y].concat(i.splice(2)):[r.x,r.y]):(s=Ct(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach((function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]})),s)}function Pt(t){return t instanceof gt?t:t.oProj?t.oProj:gt(t)}var Rt=function(t,e,i){t=Pt(t);var n,r=!1;return void 0===e?(e=t,t=Tt,r=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=Tt,r=!0),e=Pt(e),i?Mt(t,e,i):(n={forward:function(i,n){return Mt(t,e,i,n)},inverse:function(i,n){return Mt(e,t,i,n)}},r&&(n.oProj=e),n)},It=6,At="AJSAJS",Lt="AFAFAF",Ft=65,Ot=73,Zt=79,kt=86,Dt=90,Nt={forward:Gt,inverse:function(t){var e=Bt(Xt(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:zt};function Gt(t,e){return e=e||5,function(t,e){var i="00000"+t.easting,n="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(f=t.easting,g=t.northing,p=t.zoneNumber,m=Vt(p),_=Math.floor(f/1e5),y=Math.floor(g/1e5)%20,r=_,s=y,o=m,a=o-1,l=At.charCodeAt(a),h=Lt.charCodeAt(a),u=l+r-1,c=h+s,d=!1,u>Dt&&(u=u-Dt+Ft-1,d=!0),(u===Ot||lOt||(u>Ot||lZt||(u>Zt||lDt&&(u=u-Dt+Ft-1),c>kt?(c=c-kt+Ft-1,d=!0):d=!1,(c===Ot||hOt||(c>Ot||hZt||(c>Zt||hkt&&(c=c-kt+Ft-1),String.fromCharCode(u)+String.fromCharCode(c))+i.substr(i.length-5,e)+n.substr(n.length-5,e);var r,s,o,a,l,h,u,c,d;var f,g,p,m,_,y}(function(t){var e,i,n,r,s,o,a,l,h=t.lat,u=t.lon,c=6378137,d=.00669438,f=.9996,g=jt(h),p=jt(u);l=Math.floor((u+180)/6)+1,180===u&&(l=60);h>=56&&h<64&&u>=3&&u<12&&(l=32);h>=72&&h<84&&(u>=0&&u<9?l=31:u>=9&&u<21?l=33:u>=21&&u<33?l=35:u>=33&&u<42&&(l=37));a=jt(6*(l-1)-180+3),e=d/(1-d),i=c/Math.sqrt(1-d*Math.sin(g)*Math.sin(g)),n=Math.tan(g)*Math.tan(g),r=e*Math.cos(g)*Math.cos(g),s=Math.cos(g)*(p-a),o=c*((1-d/4-3*d*d/64-5*d*d*d/256)*g-(3*d/8+3*d*d/32+45*d*d*d/1024)*Math.sin(2*g)+(15*d*d/256+45*d*d*d/1024)*Math.sin(4*g)-35*d*d*d/3072*Math.sin(6*g));var m=f*i*(s+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=f*(o+i*Math.tan(g)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-330*e)*s*s*s*s*s*s/720));h<0&&(_+=1e7);return{northing:Math.round(_),easting:Math.round(m),zoneNumber:l,zoneLetter:qt(h)}}({lat:t[1],lon:t[0]}),e)}function zt(t){var e=Bt(Xt(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function jt(t){return t*(Math.PI/180)}function Ut(t){return t/Math.PI*180}function Bt(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,g=.9996,p=6378137,m=.00669438,_=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=i-5e5,x=e;n<"N"&&(x-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=x/g/6367449.145945056)+(3*_/2-27*_*_*_/32)*Math.sin(2*d)+(21*_*_/16-55*_*_*_*_/32)*Math.sin(4*d)+151*_*_*_/96*Math.sin(6*d),o=p/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*p/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=y/(o*g);var v=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);v=Ut(v);var E,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+Ut(b),t.accuracy){var w=Bt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});E={top:w.lat,right:w.lon,bottom:v,left:b}}else E={lat:v,lon:b};return E}function qt(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Vt(t){var e=t%It;return 0===e&&(e=It),e}function Xt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=Vt(o),h=function(t,e){var i=At.charCodeAt(e-1),n=1e5,r=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===Zt&&i++,i>Dt){if(r)throw"Bad character: "+t;i=Ft,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Lt.charCodeAt(e-1),n=0,r=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===Zt&&i++,i>kt){if(r)throw"Bad character: "+t;i=Ft,r=!0}n+=1e5}return n}(n.charAt(1),l);u<$t(a);)u+=2e6;var c=i-s;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,f,g,p=c/2,m=0,_=0;return p>0&&(d=1e5/Math.pow(10,p),f=t.substring(s,s+p),m=parseFloat(f)*d,g=t.substring(s+p),_=parseFloat(g)*d),{easting:m+h,northing:_+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function $t(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Wt(t,e,i){if(!(this instanceof Wt))return new Wt(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0],10),this.y=parseFloat(n[1],10),this.z=parseFloat(n[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Wt.fromMGRS=function(t){return new Wt(zt(t))},Wt.prototype.toMGRS=function(t){return Gt([this.x,this.y],t)};var Yt=Wt,Ht=1,Kt=.25,Jt=.046875,Qt=.01953125,te=.01068115234375,ee=.75,ie=.46875,ne=.013020833333333334,re=.007120768229166667,se=.3645833333333333,oe=.005696614583333333,ae=.3076171875;function le(t){var e=[];e[0]=Ht-t*(Kt+t*(Jt+t*(Qt+t*te))),e[1]=t*(ee-t*(Jt+t*(Qt+t*te)));var i=t*t;return e[2]=i*(ie-t*(ne+t*re)),i*=t,e[3]=i*(se-t*oe),e[4]=i*t*ae,e}function he(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var ue=20;function ce(t,e,i){for(var n=1/(1-e),r=t,s=ue;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(he(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)p?Math.tan(s):0,g=Math.pow(f,2),m=Math.pow(g,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var _=he(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-g+c+u/20*(5-18*g+m+14*c-58*g*c+u/42*(61+179*m-m*g-479*g)))))+this.x0,n=this.a*(this.k0*(_-this.ml0+a*o*h/2*(1+u/12*(5-g+9*c+4*d+u/30*(61+m-58*g+270*c-330*g*c+u/56*(1385+543*m-m*g-3111*g))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)=1){if(y-1>p)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=ce(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)p?Math.tan(i):0,u=this.ep2*Math.pow(l,2),d=Math.pow(u,2),f=Math.pow(h,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2);var m=s*Math.sqrt(e)/this.k0,_=Math.pow(m,2);n=i-(e*=h)*_/(1-this.es)*.5*(1-_/12*(5+3*f-9*u*f+u-4*d-_/30*(61+90*f-252*u*f+45*g+46*u-_/56*(1385+3633*f+4095*g+1574*g*f)))),r=$(this.long0+m*(1-_/6*(1+2*f+u-_/20*(5+28*f+24*g+8*u*f+6*u-_/42*(61+662*f+1320*g+720*g*f))))/l)}else n=c*X(o),r=0;else{var y=Math.exp(s/this.k0),x=.5*(y-1/y),v=this.lat0+o/this.k0,E=Math.cos(v);e=Math.sqrt((1-Math.pow(E,2))/(1+Math.pow(x,2))),n=Math.asin(e),o<0&&(n=-n),r=0===x&&0===E?0:$(Math.atan2(x,E)+this.long0)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function fe(t){var e=Math.exp(t);return e=(e-1/e)/2}function ge(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function pe(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(ge(1,e)+1))),t<0?-e:e}function me(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function _e(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=fe(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,g=0,p=0;--c>=0;)n=g,r=f,d=h*(g=d)-n-u*(f=p)+t[c],p=u*g-r+h*f;return[(h=s*l)*d-(u=o*a)*p,h*p+u*d]}var ye={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(de.init.apply(this),this.forward=de.forward,this.inverse=de.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var n=me(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=$(t.x-this.long0),i=t.y;i=me(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,ge(n,r*o)),e=pe(Math.tan(e));var a,l,h=_e(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=_e(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(fe(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,ge(l,h*a)),e=$((n=Math.atan2(l,h*a))+this.long0),i=me(this.cgb,r)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var xe={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*($(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*m,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ye.init.apply(this),this.forward=ye.forward,this.inverse=ye.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function ve(t,e){return Math.pow((1-t)/(1+t),e)}var Ee={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+y)/(Math.pow(Math.tan(.5*this.lat0+y),this.C)*ve(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+y),this.C)*ve(this.e*Math.sin(i),this.ratexp))-c,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+y)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*ve(this.e*Math.sin(t.y),-.5*this.e))-c,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]};var be={init:function(){Ee.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,n,r;return t.x=$(t.x-this.long0),Ee.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,s=Math.sqrt(t.x*t.x+t.y*t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,Ee.inverse.apply(this,[t]),t.x=$(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var we={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*(1+X(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=p&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&Math.abs(Math.cos(this.lat_ts))>p&&(this.k0=.5*this.cons*V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/W(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=V(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-c,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),d=$(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=p&&Math.abs(l+this.lat0)<=p?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(d)),t.x=this.a*e*u*Math.sin(d)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(d))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-c,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=p?(s=W(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)0?$(this.long0+Math.atan2(t.x,-1*t.y)):$(this.long0+Math.atan2(t.x,t.y)):$(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=p){if(o<=p)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Y(this.e,n),e=this.con*$(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=p?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=$(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)))),i=-1*Y(this.e,Math.tan(.5*(c+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)","Polar_Stereographic"],ssfn_:function(t,e,i){return e*=i,Math.tan(.5*(c+t))*Math.pow((1-e)/(1+e),.5*i)}};var Se={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]},Ce=1e-7;var Te={init:function(){var t,e,i,n,r,s,o,a,l,h,u,d,f,g=0,_=0,v=0,E=0,b=0,w=0,S=0;this.no_off=(f="object"==typeof(d=this).PROJECTION?Object.keys(d.PROJECTION)[0]:d.PROJECTION,"no_uoff"in d||"no_off"in d||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(f)),this.no_rot="no_rot"in this;var C=!1;"alpha"in this&&(C=!0);var T=!1;if("rectified_grid_angle"in this&&(T=!0),C&&(S=this.alpha),T&&(g=this.rectified_grid_angle*m),C||T)_=this.longc;else if(v=this.long1,b=this.lat1,E=this.long2,w=this.lat2,Math.abs(b-w)<=Ce||(t=Math.abs(b))<=Ce||Math.abs(t-c)<=Ce||Math.abs(Math.abs(this.lat0)-c)<=Ce||Math.abs(Math.abs(w)-c)<=Ce)throw new Error;var M=1-this.es;e=Math.sqrt(M),Math.abs(this.lat0)>p?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/M),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(W(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),C||T?(C?(u=Math.asin(Math.sin(S)/n),T||(g=S)):(u=g,S=Math.asin(n*Math.sin(u))),this.lam0=_-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(W(this.e,b,Math.sin(b)),this.B),o=Math.pow(W(this.e,w,Math.sin(w)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=v-E)<-Math.pi?E-=x:t>Math.pi&&(E+=x),this.lam0=$(.5*(v+E)-Math.atan(h*Math.tan(.5*this.B*(v-E))/l)/this.B),u=Math.atan(2*Math.sin(this.B*$(v-this.lam0))/(r-1/r)),g=S=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(g),this.cosrot=Math.cos(g),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(S))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(y-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(y+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-c)>p){if(e=.5*((s=this.E/Math.pow(W(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)p?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=p&&(i=X(i)*(c-2*p));var n,r,s=Math.abs(Math.abs(i)-c);if(s>p)n=W(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*$(e-this.long0);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Y(this.e,n)))return null}else r=-c;return s=$(l/this.ns+this.long0),t.x=s,t.y=r,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var Pe={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y,u=$(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","krovak"]};function Re(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function Ie(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Ae(t){return.375*t*(1+.25*t*(1+.46875*t))}function Le(t){return.05859375*t*t*(1+.75*t)}function Fe(t){return t*t*t*(35/3072)}function Oe(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function Ze(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}var Ge=.3333333333333333,ze=.17222222222222222,je=.10257936507936508,Ue=.06388888888888888,Be=.0664021164021164,qe=.016415012942191543;var Ve={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-c)0)switch(this.qp=Ne(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=t*Ge,e=t*t,i[0]+=e*ze,i[1]=e*Ue,e*=t,i[0]+=e*je,i[1]+=e*Be,i[2]=e*qe,i}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Ne(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,d=t.x,f=t.y;if(d=$(d-this.long0),this.sphere){if(s=Math.sin(f),u=Math.cos(f),n=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=p)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(d),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(f+this.lat0)=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n,r,s,o,a,l,h,u,d=t.x/this.a,f=t.y/this.a;if(this.sphere){var g,m=0,_=0;if((i=.5*(g=Math.sqrt(d*d+f*f)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(_=Math.sin(i),m=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(g)<=p?0:Math.asin(f*_/g),d*=_,f=m*g;break;case this.OBLIQ:i=Math.abs(g)<=p?this.lat0:Math.asin(m*this.sinph0+f*_*this.cosph0/g),d*=_*this.cosph0,f=(m-Math.sin(i)*this.sinph0)*g;break;case this.N_POLE:f=-f,i=c-i;break;case this.S_POLE:i-=c}e=0!==f||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(d,f):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(d/=this.dd,f*=this.dd,(o=Math.sqrt(d*d+f*f))1&&(t=t>1?1:-1),Math.asin(t)}var $e={init:function(){Math.abs(this.lat1+this.lat2)p?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var n=Ne(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*$(e-this.long0),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=$(r/this.ns0+this.long0),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=Xe(.5*e);if(t0||Math.abs(s)<=p?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=Xe((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=$(this.long0+s)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]};var Ye={init:function(){this.sphere||(this.k0=V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=$(n-this.long0);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Ne(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=$(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*c:c;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=$(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t},names:["cea"]};var He={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,n=$(e-this.long0),r=Ze(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=$(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Ze(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var Ke={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ie(this.es),this.e1=Ae(this.es),this.e2=Le(this.es),this.e3=Fe(this.es),this.ml0=this.a*Re(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=$(r-this.long0);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=p?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(Ze(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=p)e=this.a*o,i=-1*this.ml0;else{var a=Oe(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*Re(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=p)e=$(n/this.a+this.long0),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=p){i=l;break}e=$(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(r+this.ml0)<=p)i=0,e=$(this.long0+n/this.a);else{var c,d,f,g,m;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(m=this.e*Math.sin(l),c=Math.sqrt(1-m*m)*Math.tan(l),d=this.a*Re(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(g=d/this.a)+1)-g-.5*c*(g*g+a))/(this.es*Math.sin(2*l)*(g*g+a-2*o*g)/(4*c)+(o-g)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=p){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=$(this.long0+Math.asin(n*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t},names:["Polyconic","poly"]};var Je={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,n=t.y-this.lat0,r=i-this.long0,s=n/u*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,c=l,d=o,f=1,g=0,p=0,m=0;for(e=1;e<=6;e++)h=g*c+f*d,f=f*c-g*d,g=h,p=p+this.B_re[e]*f-this.B_im[e]*g,m=m+this.B_im[e]*f+this.B_re[e]*g;return t.x=m*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,c=0,d=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,c=c+this.C_re[e]*l-this.C_im[e]*h,d=d+this.C_im[e]*l+this.C_re[e]*h;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var n=$(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]};var ii={init:function(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=$(this.long0+s/this.ns),n=Ze(this.g-i/this.a),t.x=r,t.y=n,t):(n=ke(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=$(this.long0+s/this.ns),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]};var ni={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=$(n-this.long0);Math.abs(r)<=p&&(e=this.x0+this.R*s,i=this.y0);var o=Xe(2*Math.abs(r/Math.PI));(Math.abs(s)<=p||Math.abs(Math.abs(r)-c)<=p)&&(e=this.x0,i=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),d=u/(h+u-1),f=d*d,g=d*(2/h-1),m=g*g,_=Math.PI*this.R*(a*(d-m)+Math.sqrt(l*(d-m)*(d-m)-(m+l)*(f-m)))/(m+l);s<0&&(_=-_),e=this.x0+_;var y=l+d;return _=Math.PI*this.R*(g*y-a*Math.sqrt((m+l)*(l+1)-y*y))/(m+l),i=r>=0?this.y0+_:this.y0-_,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)2*c*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=p?o=this.lat0:(o=Xe(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-c,s=Math.abs(a)<=p?this.lat0>=0?$(this.long0+Math.atan2(t.x,-t.y)):$(this.long0-Math.atan2(-t.x,t.y)):$(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n))),t.x=s,t.y=o,t}return l=Ie(this.es),h=Ae(this.es),u=Le(this.es),d=Fe(this.es),Math.abs(this.sin_p12-1)<=p?(o=ke(((f=this.a*Re(l,h,u,d,c))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,d),s=$(this.long0+Math.atan2(t.x,-1*t.y)),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=p?(f=this.a*Re(l,h,u,d,c),o=ke(((e=Math.sqrt(t.x*t.x+t.y*t.y))-f)/this.a,l,h,u,d),s=$(this.long0+Math.atan2(t.x,t.y)),t.x=s,t.y=o,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),_=Math.atan2(t.x,t.y),g=Oe(this.a,this.e,this.sin_p12),y=Math.cos(_),v=-(x=this.e*this.cos_p12*y)*x/(1-this.es),E=3*this.es*(1-v)*this.sin_p12*this.cos_p12*y/(1-this.es),S=1-v*(w=(b=e/g)-v*(1+v)*Math.pow(b,3)/6-E*(1+3*v)*Math.pow(b,4)/24)*w/2-b*w*w*w/6,m=Math.asin(this.sin_p12*Math.cos(w)+this.cos_p12*Math.sin(w)*y),s=$(this.long0+Math.asin(Math.sin(_)*Math.sin(w)/Math.cos(m))),C=Math.sin(m),o=Math.atan2((C-this.es*S*this.sin_p12)*Math.tan(m),C*(1-this.es)),t.x=s,t.y=o,t)},names:["Azimuthal_Equidistant","aeqd"]};var si={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=$(l-this.long0),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),1,((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=p)&&(o=1*this.a*i*Math.sin(n),a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a;return t.x-=this.x0,t.y-=this.y0,i=Xe((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),o=this.long0,Math.abs(e)<=p?(a=this.lat0,t.x=o,t.y=a,t):(a=Xe(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(this.lat0)-c,Math.abs(s)<=p?(o=this.lat0>=0?$(this.long0+Math.atan2(t.x,-t.y)):$(this.long0-Math.atan2(-t.x,t.y)),t.x=o,t.y=a,t):(o=$(this.long0+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n)),t.x=o,t.y=a,t))},names:["ortho"]},oi=1,ai=2,li=3,hi=4,ui=5,ci=6,di={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function fi(t,e,i,n){var r;return ty&&r<=c+y?(n.value=di.AREA_1,r-=c):r>c+y||r<=-(c+y)?(n.value=di.AREA_2,r=r>=0?r-v:r+v):(n.value=di.AREA_3,r+=c)),r}function gi(t,e){var i=t+e;return i<-v?i+=x:i>+v&&(i-=x),i}var pi={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=c-y/2?this.face=ui:this.lat0<=-(c-y/2)?this.face=ci:Math.abs(this.long0)<=y?this.face=oi:Math.abs(this.long0)<=c+y?this.face=this.long0>0?ai:hi:this.face=li,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,n,r,s,o,a={x:0,y:0},l={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===ui)r=c-e,i>=y&&i<=c+y?(l.value=di.AREA_0,n=i-c):i>c+y||i<=-(c+y)?(l.value=di.AREA_1,n=i>0?i-v:i+v):i>-(c+y)&&i<=-y?(l.value=di.AREA_2,n=i+c):(l.value=di.AREA_3,n=i);else if(this.face===ci)r=c+e,i>=y&&i<=c+y?(l.value=di.AREA_0,n=-i+c):i=-y?(l.value=di.AREA_1,n=-i):i<-y&&i>=-(c+y)?(l.value=di.AREA_2,n=-i-c):(l.value=di.AREA_3,n=i>0?-i+v:-i-v);else{var h,u,d,f,g,p;this.face===ai?i=gi(i,+c):this.face===li?i=gi(i,+v):this.face===hi&&(i=gi(i,-c)),f=Math.sin(e),g=Math.cos(e),p=Math.sin(i),h=g*Math.cos(i),u=g*p,d=f,this.face===oi?n=fi(r=Math.acos(h),d,u,l):this.face===ai?n=fi(r=Math.acos(u),d,-h,l):this.face===li?n=fi(r=Math.acos(-h),d,-u,l):this.face===hi?n=fi(r=Math.acos(-u),d,h,l):(r=n=0,l.value=di.AREA_0)}return o=Math.atan(12/v*(n+Math.acos(Math.sin(n)*Math.cos(y))-c)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),l.value===di.AREA_1?o+=c:l.value===di.AREA_2?o+=v:l.value===di.AREA_3&&(o+=1.5*v),a.x=s*Math.cos(o),a.y=s*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,d,f,g={lam:0,phi:0},p={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?p.value=di.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=di.AREA_1,e-=c):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=di.AREA_2,e=e<0?e+v:e-v):(p.value=di.AREA_3,e+=c),h=v/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),this.face===ui)l=Math.acos(a),g.phi=c-l,p.value===di.AREA_0?g.lam=o+c:p.value===di.AREA_1?g.lam=o<0?o+v:o-v:p.value===di.AREA_2?g.lam=o-c:g.lam=o;else if(this.face===ci)l=Math.acos(a),g.phi=l-c,p.value===di.AREA_0?g.lam=-o+c:p.value===di.AREA_1?g.lam=-o:p.value===di.AREA_2?g.lam=-o-c:g.lam=o<0?-o-v:-o+v;else{var m,_,y;h=(m=a)*m,_=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),p.value===di.AREA_1?(h=_,_=-y,y=h):p.value===di.AREA_2?(_=-_,y=-y):p.value===di.AREA_3&&(h=_,_=y,y=-h),this.face===ai?(h=m,m=-_,_=h):this.face===li?(m=-m,_=-_):this.face===hi&&(h=m,m=_,_=-h),g.phi=Math.acos(-y)-c,g.lam=Math.atan2(_,m),this.face===ai?g.lam=gi(g.lam,-c):this.face===li?g.lam=gi(g.lam,-v):this.face===hi&&(g.lam=gi(g.lam,+c))}return 0!==this.es&&(u=g.phi<0?1:0,d=Math.tan(g.phi),f=this.b/Math.sqrt(d*d+this.one_minus_f_squared),g.phi=Math.atan(Math.sqrt(this.a*this.a-f*f)/(this.one_minus_f*f)),u&&(g.phi=-g.phi)),g.lam+=this.long0,t.x=g.lam,t.y=g.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},mi=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],_i=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],yi=.8487,xi=1.3523,vi=_/5,Ei=1/vi,bi=18,wi=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};var Si={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=$(t.x-this.long0),i=Math.abs(t.y),n=Math.floor(i*vi);n<0?n=0:n>=bi&&(n=17);var r={x:wi(mi[n],i=_*(i-Ei*n))*e,y:wi(_i[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*yi+this.x0,r.y=r.y*this.a*xi+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*yi),y:Math.abs(t.y-this.y0)/(this.a*xi)};if(e.y>=1)e.x/=mi[18][0],e.y=t.y<0?-c:c;else{var i=Math.floor(e.y*bi);for(i<0?i=0:i>=bi&&(i=17);;)if(_i[i][0]>e.y)--i;else{if(!(_i[i+1][0]<=e.y))break;++i}var n=_i[i],r=5*(e.y-n[0])/(_i[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/ge(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/ge(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/ge(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/ge(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/ge(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*ge(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*ge(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};Rt.defaultDatum="WGS84",Rt.Proj=gt,Rt.WGS84=new Rt.Proj("WGS84"),Rt.Point=Yt,Rt.toPoint=wt,Rt.defs=z,Rt.nadgrid=function(t,e){var i=new DataView(e),n=function(t){var e=t.getInt32(8,!1);if(11===e)return!1;e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");return!0}(i),r=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:ht(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(i,n),s=function(t,e,i){for(var n=176,r=[],s=0;sr;){if(s-r>600){var a=s-r+1,l=n-r+1,h=Math.log(a),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(a-u)/a)*(l-a/2<0?-1:1);t(i,n,Math.max(r,Math.floor(n-l*u/a+c)),Math.min(s,Math.floor(n+(a-l)*u/a+c)),o)}var d=i[n],f=r,g=s;for(e(i,r,n),o(i[s],d)>0&&e(i,r,s);f0;)g--}0===o(i[r],d)?e(i,r,g):e(i,++g,s),g<=n&&(r=g+1),n<=g&&(s=g-1)}}(t,n,r||0,s||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p(e,i,n,r,s){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=r)){var a=i+Math.ceil((n-i)/r/2)*r;t(e,a,i,n,s),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!f(t,e))return i;for(var n=this.toBBox,r=[];e;){for(var s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var o=this._chooseSplitIndex(i,r,n),a=g(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,r,s,a,l,h,c,d=1/0,f=1/0,g=e;g<=i-e;g++){var p=o(t,0,g,this.toBBox),m=o(t,g,i,this.toBBox),_=(r=p,s=m,a=void 0,l=void 0,h=void 0,c=void 0,a=Math.max(r.minX,s.minX),l=Math.max(r.minY,s.minY),h=Math.min(r.maxX,s.maxX),c=Math.min(r.maxY,s.maxY),Math.max(0,h-a)*Math.max(0,c-l)),y=u(p)+u(m);_=e;f--){var g=t.children[f];a(l,t.leaf?r(g):g),h+=c(l)}return h},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():s(t[e],this.toBBox)},n}()},56069:function(t,e,i){const n=i(54990);t.exports=function(t,e,i){const r=i&&i.debug||!1,s=i&&i.startIndex||0;r&&console.log("starting findTagByName with",e," and ",i);const o=n(t,`<${e}[ >]`,s);if(r&&console.log("start:",o),-1===o)return;const a=t.slice(o+e.length);let l=n(a,"[ /]"+e+">",0);const h=-1===l;h&&(l=n(a,"[ /]>",0));const u=o+e.length+l+1+(h?0:e.length)+1;if(r&&console.log("end:",u),-1===u)return;const c=t.slice(o,u);let d;return d=h?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:d,outer:c,start:o,end:u}}},83299:function(t,e,i){const n=i(56069);t.exports=function(t,e,i){const r=[],s=i&&i.debug||!1;let o,a=i&&i.startIndex||0;for(;o=n(t,e,{debug:s,startIndex:a});)a=o.end,r.push(o);return s&&console.log("findTagsByName found",r.length,"tags"),r}},42135:function(t){t.exports=function(t,e,i){const n=i&&i.debug||!1;n&&console.log("getting "+e+" in "+t);const r="object"==typeof t?t.outer:t,s=`${e}\\="([^"]*)"`;n&&console.log("pattern:",s);const o=new RegExp(s).exec(r);if(n&&console.log("match:",o),o)return o[1]}},54990:function(t){t.exports=function(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index:-1}},47760:function(){},13090:function(){},19439:function(){},81275:function(t,e,i){"use strict";function n(){const t='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS";function r(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function x(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new Error(t)}(0!==n,"Transformation matrix cannot be inverted");const x=t[0],i=t[1],u=t[2],o=t[3],f=t[4],s=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-u/n,e[3]=x/n,e[4]=(u*s-o*f)/n,e[5]=-(x*s-i*f)/n,e}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var u={exports:{}};function o(e,t,n){n=n||2;var r,x,i,u,o,s,l,v=t&&t.length,h=v?t[0]*n:e.length,c=f(e,0,h,n,!0),g=[];if(!c||c.next===c.prev)return g;if(v&&(c=function(e,t,n,r){var x,i,u,o=[];for(x=0,i=t.length;x80*n){r=i=e[0],x=u=e[1];for(var b=n;bi&&(i=o),s>u&&(u=s);l=0!==(l=Math.max(i-r,u-x))?32767/l:0}return a(c,g,n,r,x,l,0),g}function f(e,t,n,r,x){var i,u;if(x===O(e,t,n,r)>0)for(i=t;i=t;i-=r)u=P(i,e[i],e[i+1],u);return u&&m(u,u.next)&&(B(u),u=u.next),u}function s(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!m(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(B(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,x,i,u){if(e){!u&&i&&function(e,t,n,r){var x=e;do{0===x.z&&(x.z=b(x.x,x.y,t,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==e);x.prevZ.nextZ=null,x.prevZ=null,function(e){var t,n,r,x,i,u,o,f,s=1;do{for(n=e,e=null,i=null,u=0;n;){for(u++,r=n,o=0,t=0;t0||f>0&&r;)0!==o&&(0===f||!r||n.z<=r.z)?(x=n,n=n.nextZ,o--):(x=r,r=r.nextZ,f--),i?i.nextZ=x:e=x,x.prevZ=i,i=x;n=r}i.nextZ=null,s*=2}while(u>1)}(x)}(e,r,x,i);for(var o,f,p=e;e.prev!==e.next;)if(o=e.prev,f=e.next,i?v(e,r,x,i):l(e))t.push(o.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),B(e),e=f.next,p=f.next;else if((e=f)===p){u?1===u?a(e=h(s(e),t,n),t,n,r,x,i,2):2===u&&c(e,t,n,r,x,i):a(s(e),t,n,r,x,i,1);break}}}function l(e){var t=e.prev,n=e,r=e.next;if(w(t,n,r)>=0)return!1;for(var x=t.x,i=n.x,u=r.x,o=t.y,f=n.y,s=r.y,a=xi?x>u?x:u:i>u?i:u,h=o>f?o>s?o:s:f>s?f:s,c=r.next;c!==t;){if(c.x>=a&&c.x<=v&&c.y>=l&&c.y<=h&&M(x,o,i,f,u,s,c.x,c.y)&&w(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function v(e,t,n,r){var x=e.prev,i=e,u=e.next;if(w(x,i,u)>=0)return!1;for(var o=x.x,f=i.x,s=u.x,a=x.y,l=i.y,v=u.y,h=of?o>s?o:s:f>s?f:s,y=a>l?a>v?a:v:l>v?l:v,g=b(h,c,t,n,r),d=b(p,y,t,n,r),Z=e.prevZ,m=e.nextZ;Z&&Z.z>=g&&m&&m.z<=d;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;Z&&Z.z>=g;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;m&&m.z<=d;){if(m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function h(e,t,n){var r=e;do{var x=r.prev,i=r.next.next;!m(x,i)&&A(x,r,r.next,i)&&z(x,i)&&z(i,x)&&(t.push(x.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),B(r),B(r.next),r=e=i),r=r.next}while(r!==e);return s(r)}function c(e,t,n,r,x,i){var u=e;do{for(var o=u.next.next;o!==u.prev;){if(u.i!==o.i&&Z(u,o)){var f=F(u,o);return u=s(u,u.next),f=s(f,f.next),a(u,t,n,r,x,i,0),void a(f,t,n,r,x,i,0)}o=o.next}u=u.next}while(u!==e)}function p(e,t){return e.x-t.x}function y(e,t){var n=function(e,t){var n,r=t,x=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=x&&o>u&&(u=o,n=r.x=r.x&&r.x>=a&&x!==r.x&&M(in.x||r.x===n.x&&g(n,r)))&&(n=r,v=f)),r=r.next}while(r!==s);return n}(e,t);if(!n)return t;var r=F(n,e);return s(r,r.next),s(n,n.next)}function g(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}function b(e,t,n,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=(e-u)*(i-o)&&(e-u)*(r-o)>=(n-u)*(t-o)&&(n-u)*(i-o)>=(x-u)*(r-o)}function Z(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&A(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(t,e)&&function(e,t){var n=e,r=!1,x=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&x<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||m(e,t)&&w(e.prev,e,e.next)>0&&w(t.prev,t,t.next)>0)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function A(e,t,n,r){var x=I(w(e,t,n)),i=I(w(e,t,r)),u=I(w(n,r,e)),o=I(w(n,r,t));return x!==i&&u!==o||(!(0!==x||!E(e,n,t))||(!(0!==i||!E(e,r,t))||(!(0!==u||!E(n,e,r))||!(0!==o||!E(n,t,r)))))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function z(e,t){return w(e.prev,e,e.next)<0?w(e,t,e.next)>=0&&w(e,e.prev,t)>=0:w(e,t,e.prev)<0||w(e,e.next,t)<0}function F(e,t){var n=new _(e.i,e.x,e.y),r=new _(t.i,t.x,t.y),x=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=x,x.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function P(e,t,n,r){var x=new _(e,t,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,t,n,r){for(var x=0,i=t,u=n-r;i0&&(r+=e[x-1].length,n.holes.push(r))}return n};var N=i(u.exports);const R=[],S={vertexPosition:0,indexPosition:0};function T(e,t,n,r,x){e[t+0]=n,e[t+1]=r,e[t+2]=x}function U(e,t,n,r,x,i){const u=3+x,o=e[t+0],f=e[t+1],s=R;s.length=x;for(let n=0;n0?f:2*Math.PI-f}let d=-1,M=-1,Z=l;const w=null!==i;if(null!==x){d=b(y,g,r(s,[...[e[x],e[x+1]]])),Math.cos(d)<=.985&&(Z+=Math.tan((d-Math.PI)/2))}if(w){M=b(g,y,r(s,[...[e[i],e[i+1]]])),Math.cos(M)<=.985&&(Z+=Math.tan((Math.PI-M)/2))}function m(e,t){return 0===t?1e4*e:Math.sign(t)*(1e4*e+Math.abs(t))}return u.push(c[0],c[1],p[0],p[1],d,M,a,m(0,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(1,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(2,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(3,l)),u.push(...f),o.push(h,h+1,h+2,h+1,h+3,h+2),{length:a+Math.sqrt((g[0]-y[0])*(g[0]-y[0])+(g[1]-y[1])*(g[1]-y[1])),angle:Z}}function G(e,t,n,r,x){const i=2+x;let u=t;const o=e.slice(u,u+x);u+=x;const f=e[u++];let s=0;const a=new Array(f-1);for(let t=0;t{const i=r.data;switch(i.type){case t:{const e=3,t=2,n=i.customAttributesSize,r=t+n,x=new Float32Array(i.renderInstructions),u=x.length/r,o=4*u*(n+e),f=new Uint32Array(6*u),s=new Float32Array(o);let a;for(let e=0;e0?c=o+(n-1)*r:l&&(c=i-r);let p=null;n255?255:t}function U(t){return t<0?0:t>1?1:t}function B(t){return"%"===t[t.length-1]?j(parseFloat(t)/100*255):j(parseInt(t))}function q(t){return"%"===t[t.length-1]?U(parseFloat(t)/100):U(parseFloat(t))}function V(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{G={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in z)return z[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.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===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var s=i.substr(0,n),o=i.substr(n+1,r-(n+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=q(o.pop());case"rgb":return 3!==o.length?null:[B(o[0]),B(o[1]),B(o[2]),a];case"hsla":if(4!==o.length)return null;a=q(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=q(o[1]),u=q(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[j(255*V(d,c,l+1/3)),j(255*V(d,c,l)),j(255*V(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class X{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof X)return t;if("string"!=typeof t)return;const e=G(t);return e?new X(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}toArray01(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:i,a:n}=this;return[t,e,i,n]}}X.black=new X(0,0,0,1),X.white=new X(1,1,1,1),X.transparent=new X(0,0,0,0),X.red=new X(1,0,0,1),X.blue=new X(0,0,1,1);var $=X;function W(t){return"object"==typeof t?["literal",t]:t}function Y(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,W(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],it(t[1])]:[t[0],W(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function et(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function it(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const xt=[at,lt,ht,ut,ct,pt,dt,_t(ft),mt];function vt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!vt(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(const t of xt)if(!vt(t,e))return null}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function Et(t,e){return e.some((e=>e.kind===t.kind))}function bt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class wt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class St{constructor(t,e,i,n,r){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Ct{constructor(t){this.sections=t}static fromString(t){return new Ct([new St(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Ct?t:Ct.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class Tt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Tt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Mt(t,e,i,n){if(!("number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255)){return`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}return void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`}function Pt(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 $)return!0;if(t instanceof wt)return!0;if(t instanceof Ct)return!0;if(t instanceof Tt)return!0;if(Array.isArray(t)){for(const e of t)if(!Pt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Pt(t[e]))return!1;return!0}return!1}function Rt(t){if(null===t)return at;if("string"==typeof t)return ht;if("boolean"==typeof t)return ut;if("number"==typeof t)return lt;if(t instanceof $)return ct;if(t instanceof wt)return gt;if(t instanceof Ct)return pt;if(t instanceof Tt)return mt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Rt(e);if(i){if(i===t)continue;i=ft;break}i=t}return _t(i||ft,e)}return dt}function It(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof $||t instanceof Ct||t instanceof Tt?t.toString():JSON.stringify(t)}class At{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Pt(t[1]))return e.error("invalid value");const i=t[1];let n=Rt(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new At(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof $?["rgba"].concat(this.value.toArray()):this.value instanceof Ct?this.value.serialize():this.value}}var Lt=At;var Ft=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ot={string:ht,number:lt,boolean:ut,object:dt};class Zt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Ot)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Ot[i],n++}else r=ft;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);s=t[2],n++}i=_t(r,s)}else i=Ot[r];const s=[];for(;nt.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}var kt=Zt;class Dt{constructor(t){this.type=pt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,lt),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,_t(ht)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,ct),!o))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=o}else{const s=e.parse(t[i],1,ft);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Dt(n)}evaluate(t){return new Ct(this.sections.map((e=>{const i=e.content.evaluate(t);return Rt(i)===mt?new St("",i,null,null,null):new St(It(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Nt{constructor(t){this.type=mt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ht);return i?new Nt(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Tt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Gt={"to-boolean":ut,"to-color":ct,"to-number":lt,"to-string":ht};class zt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=Gt[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Mt(e[0],e[1],e[2],e[3]),!i))return new $(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Ft(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Ft(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Ct.fromString(It(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Tt.fromString(It(this.args[0].evaluate(t))):It(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Dt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Nt(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var jt=zt;const Ut=["Unknown","Point","LineString","Polygon"];var Bt=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ut[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord,r=i*e-t[0],s=n*e-t[1];return this.featureDistanceData.bearing[0]*r+this.featureDistanceData.bearing[1]*s}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=$.parse(t)),e}};class qt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const i=t[0],n=qt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new ye(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(yt).join(", ")})`:`(${yt(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function Ht(t,e){const i=(180+t[0])/360;const n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*$t),Math.round(n*s*$t)]}function Kt(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function Jt(t,e){let i=!1;for(let o=0,a=e.length;on[1]!=s[1]>n[1]&&n[0]<(s[0]-r[0])*(n[1]-r[1])/(s[1]-r[1])+r[0]&&(i=!i)}}var n,r,s;return i}function Qt(t,e){for(let i=0;i0&&c<0||u<0&&c>0}function ee(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-i[0],n[1]-i[1]];return 0!=(o=s)[0]*(a=r)[1]-o[1]*a[0]&&!(!te(t,e,i,n)||!te(i,n,t,e));var o,a}function ie(t,e,i){for(const n of i)for(let i=0;ii[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Wt(e,t)}function le(t,e,i,n){const r=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],o=[];if(!t)return o;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];ae(n,e,i,r),o.push(n)}return o}function he(t,e,i,n){const r=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],o=[];if(!t)return o;for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Wt(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)ae(n,e,i,r)}var a;return o}class ue{constructor(t,e){this.type=ut,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Pt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!de(t)&&(e=!1)})),e}function fe(t){if(t instanceof Vt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!fe(t)&&(e=!1)})),e}function ge(t,e){if(t instanceof Vt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ge(t,e)&&(i=!1)})),i}class pe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new pe(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var me=pe;class _e{constructor(t,e=[],i,n=new ot,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new kt(e,[t]):"coerce"===i?new jt(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", []].');const 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;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof Lt)&&"resolvedImage"!==n.type.kind&&xe(n)){const t=new Bt;try{n=new Lt(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new _e(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new rt(i,t))}checkSubtype(t,e){const i=vt(t,e);return i&&this.error(i),i}}var ye=_e;function xe(t){if(t instanceof me)return xe(t.boundExpression);if(t instanceof Vt&&"error"===t.name)return!1;if(t instanceof Xt)return!1;if(t instanceof ce)return!1;const e=t instanceof jt||t instanceof kt;let i=!0;return t.eachChild((t=>{i=e?i&&xe(t):i&&t instanceof Lt})),!!i&&(de(t)&&ge(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function ve(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||ee))throw new Ft("Input is not a number.");o=a-1}return 0}class Ee{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){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.");const i=e.parse(t[1],1,lt);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Ee(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);return i[ve(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var be=Ee,we=Se;function Se(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=i,this.p2y=n}Se.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},Se.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},Se.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},Se.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},Se.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Ce=N(we);function Te(t,e,i){return t*(1-i)+e*i}var Me=Object.freeze({__proto__:null,number:Te,color:function(t,e,i){return new $(Te(t.r,e.r,i),Te(t.g,e.g,i),Te(t.b,e.b,i),Te(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>Te(t,e[n],i)))}});const Pe=.95047,Re=1,Ie=1.08883,Ae=4/29,Le=6/29,Fe=3*Le*Le,Oe=Le*Le*Le,Ze=Math.PI/180,ke=180/Math.PI;function De(t){return t>Oe?Math.pow(t,1/3):t/Fe+Ae}function Ne(t){return t>Le?t*t*t:Fe*(t-Ae)}function Ge(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ze(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function je(t){const e=ze(t.r),i=ze(t.g),n=ze(t.b),r=De((.4124564*e+.3575761*i+.1804375*n)/Pe),s=De((.2126729*e+.7151522*i+.072175*n)/Re);return{l:116*s-16,a:500*(r-s),b:200*(s-De((.0193339*e+.119192*i+.9503041*n)/Ie)),alpha:t.a}}function Ue(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=Re*Ne(e),i=Pe*Ne(i),n=Ie*Ne(n),new $(Ge(3.2404542*i-1.5371385*e-.4985314*n),Ge(-.969266*i+1.8760108*e+.041556*n),Ge(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Be(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const qe={forward:je,reverse:Ue,interpolate:function(t,e,i){return{l:Te(t.l,e.l,i),a:Te(t.a,e.a,i),b:Te(t.b,e.b,i),alpha:Te(t.alpha,e.alpha,i)}}},Ve={forward:function(t){const{l:e,a:i,b:n}=je(t),r=Math.atan2(n,i)*ke;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ze,i=t.c;return Ue({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Be(t.h,e.h,i),c:Te(t.c,e.c,i),l:Te(t.l,e.l,i),alpha:Te(t.alpha,e.alpha,i)}}};class Xe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=$e(e,t.base,i,n);else if("linear"===t.name)r=$e(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Ce(s[0],s[1],s[2],s[3]).solve($e(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}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(r=e.parse(r,2,lt),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=ct:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Xe(a,i,n,r,o):e.error(`Type ${yt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=ve(e,n),o=e[s],a=e[s+1],l=Xe.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?Me[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?Ve.reverse(Ve.interpolate(Ve.forward(h),Ve.forward(u),l)):qe.reverse(qe.interpolate(qe.forward(h),qe.forward(u),l))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tvt(n,t.type)));return new Ye(s?ft:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(t),i&&i instanceof Tt&&!i.available&&(e||(e=i),i=null,n===this.args.length))return e;if(null!==i)break}return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var He=Ye;class Ke{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Ft(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Ft(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var ti=Qe;class ei{constructor(t,e){this.type=ut,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,ft);return i&&n?Et(i.type,[ut,ht,lt,at,ft])?new ei(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!bt(e,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(Rt(e))} instead.`);if(!bt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${yt(Rt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var ii=ei;class ni{constructor(t,e,i){this.type=lt,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,ft);if(!i||!n)return null;if(!Et(i.type,[ut,ht,lt,at,ft]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,lt);return r?new ni(i,n,r):null}return new ni(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!bt(e,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(Rt(e))} instead.`);if(!bt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${yt(Rt(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var ri=ni;class si{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(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.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,Rt(t)))return null}else i=Rt(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,ft);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new si(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Rt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)1===n.length?t.push(r(n[0])):t.push(n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}var oi=si;class ai{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var li=ai;class hi{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,lt);if(!i||!n)return null;if(!Et(i.type,[_t(ft),ht,ft]))return e.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,lt);return r?new hi(i.type,i,n,r):null}return new hi(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!bt(e,["string","array"]))throw new Ft(`Expected first argument to be of type array or string, but found ${yt(Rt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var ui=hi;function ci(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function di(t,e,i,n){return 0===n.compare(e,i)}function fi(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=ut,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ft);if(!s)return null;if(!ci(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${yt(s.type)}'.`);let o=e.parse(t[2],2,ft);if(!o)return null;if(!ci(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${yt(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${yt(s.type)}' and '${yt(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new kt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new kt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,gt),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Rt(s),i=Rt(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Rt(s),i=Rt(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const gi=fi("==",(function(t,e,i){return e===i}),di),pi=fi("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!di(0,e,i,n)})),mi=fi("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),yi=fi("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),xi=fi(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class vi{constructor(t,e,i,n,r,s){this.type=ht,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,lt);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,ht),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,ht),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,ht),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,lt),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,lt),!l)?null:new vi(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.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]}}class Ei{constructor(t){this.type=lt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Ei(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Ft(`Expected value to be of type string or array, but found ${yt(Rt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const bi={"==":gi,"!=":pi,">":_i,"<":mi,">=":xi,"<=":yi,array:kt,at:ti,boolean:kt,case:li,coalesce:He,collator:Xt,format:Dt,image:Nt,in:ii,"index-of":ri,interpolate:We,"interpolate-hcl":We,"interpolate-lab":We,length:Ei,let:Je,literal:Lt,match:oi,number:kt,"number-format":vi,object:kt,slice:ui,step:be,string:kt,"to-boolean":jt,"to-color":jt,"to-number":jt,"to-string":jt,var:me,within:ce};function wi(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=Mt(e,i,n,s);if(o)throw new Ft(o);return new $(e/255*s,i/255*s,n/255*s,s)}function Si(t,e){return t in e}function Ci(t,e){const i=e[t];return void 0===i?null:i}function Ti(t){return{type:t}}Vt.register(bi,{error:[{kind:"error"},[ht],(t,[e])=>{throw new Ft(e.evaluate(t))}],typeof:[ht,[ft],(t,[e])=>yt(Rt(e.evaluate(t)))],"to-rgba":[_t(lt,4),[ct],(t,[e])=>e.evaluate(t).toArray()],rgb:[ct,[lt,lt,lt],wi],rgba:[ct,[lt,lt,lt,lt],wi],has:{type:ut,overloads:[[[ht],(t,[e])=>Si(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Si(e.evaluate(t),i.evaluate(t))]]},get:{type:ft,overloads:[[[ht],(t,[e])=>Ci(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Ci(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ft,[ht],(t,[e])=>Ci(e.evaluate(t),t.featureState||{})],properties:[dt,[],t=>t.properties()],"geometry-type":[ht,[],t=>t.geometryType()],id:[ft,[],t=>t.id()],zoom:[lt,[],t=>t.globals.zoom],pitch:[lt,[],t=>t.globals.pitch||0],"distance-from-center":[lt,[],t=>t.distanceFromCenter()],"heatmap-density":[lt,[],t=>t.globals.heatmapDensity||0],"line-progress":[lt,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[lt,[],t=>t.globals.skyRadialProgress||0],accumulated:[ft,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[lt,Ti(lt),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[lt,Ti(lt),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:lt,overloads:[[[lt,lt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[lt],(t,[e])=>-e.evaluate(t)]]},"/":[lt,[lt,lt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[lt,[lt,lt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[lt,[],()=>Math.LN2],pi:[lt,[],()=>Math.PI],e:[lt,[],()=>Math.E],"^":[lt,[lt,lt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[lt,[lt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))],log2:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[lt,[lt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[lt,[lt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[lt,[lt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[lt,[lt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[lt,[lt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[lt,[lt],(t,[e])=>Math.atan(e.evaluate(t))],min:[lt,Ti(lt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[lt,Ti(lt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[lt,[lt],(t,[e])=>Math.abs(e.evaluate(t))],round:[lt,[lt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[lt,[lt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[lt,[lt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ut,[ht,ft],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ut,[ft],(t,[e])=>t.id()===e.value],"filter-type-==":[ut,[ht],(t,[e])=>t.geometryType()===e.value],"filter-<":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[ut,[ft],(t,[e])=>e.value in t.properties()],"filter-has-id":[ut,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ut,[_t(ht)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ut,[_t(ft)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ut,[ht,_t(ft)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ut,[ht,_t(ft)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Ti(ut),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Ti(ut),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ut,[ut],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ut,[ht],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ht,[ht],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ht,[ht],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ht,Ti(ft),(t,e)=>e.map((e=>It(e.evaluate(t)))).join("")],"resolved-locale":[ht,[gt],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Mi=bi;function Pi(t){return{result:"success",value:t}}function Ri(t){return{result:"error",value:t}}function Ii(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class Ai{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Bt,this._defaultValue=e?function(t){return"color"===t.type&&(Ii(t.default)||Array.isArray(t.default))?new $(0,0,0,0):"color"===t.type?$.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Ft(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Li(t,e){const i=new ye(Mi,[],e?function(t){const e={color:ct,string:ht,number:lt,enum:ht,boolean:ut,formatted:pt,resolvedImage:mt};if("array"===t.type)return _t(e[t.value]||ft,t.length);return e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Pi(new Ai(n,e)):Ri(i.errors)}class Fi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!fe(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}}class Oi{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!fe(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?We.interpolationFactor(this.interpolationType,t,e,i):0}}function Zi(t,e){if("error"===(t=Li(t,e)).result)return t;const i=t.value.expression,n=de(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return Ri([new rt("","data expressions not supported")]);const r=ge(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Ri([new rt("","zoom expressions not supported")]);const s=ki(i);if(!s&&!r)return Ri([new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof rt)return Ri([s]);if(s instanceof We&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Ri([new rt("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Pi(new Fi(n?"constant":"source",t.value));const o=s instanceof We?s.interpolation:void 0;return Pi(new Oi(n?"camera":"composite",t.value,s.labels,o))}function ki(t){let e=null;if(t instanceof Je)e=ki(t.result);else if(t instanceof He){for(const i of t.args)if(e=ki(i),e)break}else(t instanceof be||t instanceof We)&&t.input instanceof Vt&&"zoom"===t.input.name&&(e=t);return e instanceof rt||t.eachChild((t=>{const i=ki(t);i instanceof rt?e=i:!e&&i?e=new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Di(t){if(Array.isArray(t))return t.map(Di);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Di(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var Ni={$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"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},projection:{type:"projection"},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:{},sky:{}},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_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{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"},"fill-extrusion-edge-radius":{type:"number",private:!0,default:0,minimum:0,maximum:1,"property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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",{"symbol-placement":["point"]}],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","feature"]},"property-type":"data-driven"},"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"],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_symbol:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature","pitch","distance-from-center"]}},filter_fill:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_line:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_circle:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},"filter_fill-extrusion":{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_heatmap:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},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},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,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},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},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}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant",type:"number",private:!0,default:0,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant",type:"number",private:!0,default:3,minimum:0,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["fill-extrusion-edge-radius"]}},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:!1,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},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:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-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"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function Gi(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=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(const e of t.slice(1))if(!Gi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function zi(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Gi(t)||(t=$i(t));const i=t;let n=!0;try{n=function(t){if(!Bi(t))return t;let e=Di(t);return Ui(e),e=ji(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const r=Ni[`filter_${e}`],s=Li(n,r);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,i)=>s.value.evaluate(t,e,{},i);let a=null,l=null;if(n!==i){const t=Li(i,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,i,n,r,s)=>t.value.evaluate(e,i,{},n,void 0,void 0,r,s),l=!de(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:Xi(n),needFeature:!!l}}function ji(t){if(!Array.isArray(t))return t;const e=function(t){if(qi.has(t[0]))for(let e=1;eji(t)))}function Ui(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Vi(t,e){return te?1:0}function Xi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Wi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map($i))):"all"===e?["all"].concat(t.slice(1).map($i)):"none"===e?["all"].concat(t.slice(1).map($i).map(Ki)):"in"===e?Yi(t[1],t.slice(2)):"!in"===e?Ki(Yi(t[1],t.slice(2))):"has"===e?Hi(t[1]):"!has"===e?Ki(Hi(t[1])):"within"!==e||t}function Wi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Yi(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((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Vi)]]:["filter-in-small",t,["literal",e]]}}function Hi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}var Ji=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Qi(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return Ji.forEach((t=>{t in e&&(i[t]=e[t])})),i}function tn(t){t=t.slice();const e=Object.create(null);for(let i=0;i1?h[h.length-2].toLowerCase():"";if(u==c||u==c.replace("-","")||d+"-"+u==c){r=en[c],h.pop(),d&&c.startsWith(d)&&h.pop();break}}"number"==typeof u&&(r=u);var f=h.join(nn).replace("Klokantech Noto Sans","Noto Sans");-1!==f.indexOf(nn)&&(f='"'+f+'"'),o.push(f)}n=sn[t]=[s,r,o]}return n[0]+nn+n[1]+nn+e+"px"+(i?"/"+i:"")+nn+n[2]}));const an="https://api.mapbox.com";function ln(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function hn(t,e){const i=ln(t);if(!i)return decodeURI(new URL(t,location.href).href);const n="styles/";if(0!==i.indexOf(n))throw new Error(`unexpected style url: ${t}`);const r=i.slice(7);return`${an}/styles/v1/${r}?&access_token=${e}`}function un(t,e,i,n){const r=new URL(t,n),s=ln(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),decodeURI(r.href)):decodeURI(r.href);if("mapbox.satellite"===s){return`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${e}`}return`https://{a-d}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`}const cn={},dn={};let fn=0;function gn(t){return t.id||(t.id=fn++),t.id}function pn(t,e){return gn(t)+"."+(0,p.sq)(e)}function mn(t){let e=cn[t.id];return e||(e={},cn[gn(t)]=e),e}function _n(t){let e=dn[t.id];return e||(e={},dn[gn(t)]=e),e}function yn(t){return t*Math.PI/180}const xn=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function vn(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function En(t,e){let i=0;const n=e.length;for(;ir)).then((t=>(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),n&&(n.request=t),fetch(t).then((function(t){return delete bn[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete bn[e],Promise.reject(new Error("Error fetching source "+e))})))));return bn[e]=[r,s],s}function Sn(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return wn("Style",t=hn(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const Cn={};function Tn(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=Cn[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof f.Z)t.setLoader(((e,i,r)=>{(0,u.Vi)((()=>n)).then((i=>{fetch(i).then((t=>t.arrayBuffer())).then((i=>{const n=t.getFormat().readFeatures(i,{extent:e,featureProjection:r});t.setFeatures(n)})).catch((e=>t.setState(d.Z.ERROR)))}))}));else{const e=t.getImage();(0,u.Vi)((()=>n)).then((i=>{i instanceof Request?fetch(i).then((t=>t.blob())).then((t=>{const i=URL.createObjectURL(t);e.addEventListener("load",(()=>URL.revokeObjectURL(i))),e.addEventListener("error",(()=>URL.revokeObjectURL(i))),e.src=i})).catch((e=>t.setState(d.Z.ERROR))):e.src=i}))}});const o=t.url;if(o&&!t.tiles){const n=un(o,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:(0,g.Gk)(n)}),tileLoadFunction:s});else{const t={};r=wn("Source",n,i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),un(n,i.accessToken,i.accessTokenParam||"access_token",t.request.url)})),Promise.resolve({tileJson:e,tileLoadFunction:s})}))}}else t=Object.assign({},t,{tiles:t.tiles.map((function(n){return"tms"===t.scheme&&(n=n.replace("{y}","{-y}")),un(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s});Cn[n]=r}return r}function Mn(t,e,i,n){const r=document.createElement("canvas"),s=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height];r.width=s[0],r.height=s[1];const o=r.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,s[0],s[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),r}function Pn(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Rn(t,e,i){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const In=Array(256).join(" ");function An(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=In.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Ln;function Fn(){return Ln||(Ln=vn(1,1).getContext("2d")),Ln}function On(t,e){return Fn().measureText(t).width+(t.length-1)*e}const Zn={};function kn(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=Fn();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(On(i,n)<.35*r){const r=t>0?On(l[t-1],n):1/0,s=t.7*r&&On(s,n)<.6*r){const o=i.split(" "),a=o.pop();On(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=An(s,n),Zn[r]=s}return s}const Dn=/font-family: ?([^;]*);/,Nn=/("|')/g;let Gn;function zn(t){if(!Gn){Gn={};const t=document.styleSheets;for(let e=0,i=t.length;e`${t.key}: ${t.message}`)).join(", "));return i.value},Xn={},$n={zoom:0};let Wn,Yn;function Hn(t,e,i,n,r,s,o){const a=t.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[a]||(s[a]={});const l=s[a];if(!l[i]){let n=(t[e]||Xn)[i];const r=Ni[`${e}_${t.type}`][i];void 0===n&&(n=r.default);let s=(h=n,Array.isArray(h)&&h.length>0&&"string"==typeof h[0]&&h[0]in Mi);if(!s&&Ii(n)&&(n=Y(n,r),s=!0),s){const t=Vn(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=$.parse(n)),l[i]=function(){return n}}var h;return $n.zoom=n,l[i]($n,r,o)}function Kn(t,e,i,n){if(!Hn(t,"layout","icon-allow-overlap",e,i,n))return"declutter";return Hn(t,"layout","icon-ignore-placement",e,i,n)?"none":"obstacle"}function Jn(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=zi(e).filter),$n.zoom=n,r[t]($n,i)}let Qn=!1;function tr(t,e){if(t){if(!Qn&&(0===t.a||0===e))return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const er=/\{[^{}}]*\}/g;function ir(t,e){return t.replace(er,(function(t){return e[t.slice(1,-1)]||""}))}let nr=!1;const rr={};function sr(t,e,i,c=xn,d=void 0,f=void 0,g=void 0,p=void 0){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");let m,_,y;if(rr[pn(e,t)]=Array.from(arguments),f)if("undefined"!=typeof Image){const e=new Image;let i;(0,u.Vi)((()=>f)).then((t=>{t instanceof Request?fetch(t).then((t=>t.blob())).then((t=>{i=URL.createObjectURL(t),e.src=i})).catch((()=>{})):(e.crossOrigin="anonymous",e.src=t,i&&URL.revokeObjectURL(i))})),e.onload=function(){m=e,_=[e.width,e.height],t.changed(),e.onload=null}}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:f}),t.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===f&&(m=t.data.image,_=[m.width,m.height])}))}const x=tn(e.layers),v={},E=[],b={},w={},S=mn(e),C=_n(e);let T;for(let t=0,n=x.length;t=Z.maxzoom)continue;const G=Z.filter;if(!G||Jn(k,G,A,T,C)){let c,f,E,C,k,G;F=Z;const z=v.index;if(3==I&&("fill"==Z.type||"fill-extrusion"==Z.type))if(f=Hn(Z,"paint",Z.type+"-opacity",T,A,S,L),Z.type+"-pattern"in N){const t=Hn(Z,"paint",Z.type+"-pattern",T,A,S,L);if(t){const e="string"==typeof t?ir(t,x):t.toString();if(m&&d&&d[e]){++O,G=R[O],G&&G.getFill()&&!G.getStroke()&&!G.getText()||(G=new l.ZP({fill:new r.Z}),R[O]=G),E=G.getFill(),G.setZIndex(z);const t=e+"."+f;let i=w[t];if(!i){const n=d[e],r=vn(n.width,n.height),s=r.getContext("2d");s.globalAlpha=f,s.drawImage(m,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i=s.createPattern(r,"repeat"),w[t]=i}E.setColor(i)}}}else c=tr(Hn(Z,"paint",Z.type+"-color",T,A,S,L),f),Z.type+"-outline-color"in N&&(k=tr(Hn(Z,"paint",Z.type+"-outline-color",T,A,S,L),f)),k||(k=c),(c||k)&&(++O,G=R[O],(!G||c&&!G.getFill()||!c&&G.getFill()||k&&!G.getStroke()||!k&&G.getStroke()||G.getText())&&(G=new l.ZP({fill:c?new r.Z:void 0,stroke:k?new a.Z:void 0}),R[O]=G),c&&(E=G.getFill(),E.setColor(c)),k&&(C=G.getStroke(),C.setColor(k),C.setWidth(.5)),G.setZIndex(z));if(1!=I&&"line"==Z.type){c=!("line-pattern"in N)&&"line-color"in N?tr(Hn(Z,"paint","line-color",T,A,S,L),Hn(Z,"paint","line-opacity",T,A,S,L)):void 0;const t=Hn(Z,"paint","line-width",T,A,S,L);c&&t>0&&(++O,G=R[O],G&&G.getStroke()&&!G.getFill()&&!G.getText()||(G=new l.ZP({stroke:new a.Z}),R[O]=G),C=G.getStroke(),C.setLineCap(Hn(Z,"layout","line-cap",T,A,S,L)),C.setLineJoin(Hn(Z,"layout","line-join",T,A,S,L)),C.setMiterLimit(Hn(Z,"layout","line-miter-limit",T,A,S,L)),C.setColor(c),C.setWidth(t),C.setLineDash(N["line-dasharray"]?Hn(Z,"paint","line-dasharray",T,A,S,L).map((function(e){return e*t})):null),G.setZIndex(z))}let j,U,B,q,V,X,$,W,Y,H=!1,K=null,J=0;if((1==I||2==I)&&"icon-image"in D){const e=Hn(Z,"layout","icon-image",T,A,S,L);if(e){let n;j="string"==typeof e?ir(e,x):e.toString();const r=p?p(t,j):void 0;if(m&&d&&d[j]||r){const t=Hn(Z,"layout","icon-rotation-alignment",T,A,S,L);if(2==I){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/u,2),Math.pow((i[3]-i[1])/u,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();Yn||(Wn=[NaN,NaN],Yn=new o.ZP("Point",Wn,[],{},null)),n=Yn,Wn[0]=i[0],Wn[1]=i[1];if("line"===Hn(Z,"layout","symbol-placement",T,A,S,L)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l&&i[0]<=u&&i[1]>=h&&i[1]<=c){J=Math.atan2(s-a,o-r);break}}}}}}if(2!==I||n){const e=Hn(Z,"layout","icon-size",T,A,S,L),i=void 0!==N["icon-color"]?Hn(Z,"paint","icon-color",T,A,S,L):null;if(!i||0!==i.a){const n=Hn(Z,"paint","icon-halo-color",T,A,S,L),o=Hn(Z,"paint","icon-halo-width",T,A,S,L);let a=`${j}.${e}.${o}.${n}`;if(null!==i&&(a+=`.${i}`),U=b[a],!U){const l=Kn(Z,T,A,S);let h;"icon-offset"in D&&(h=Hn(Z,"layout","icon-offset",T,A,S,L).slice(0),h[1]*=-1);let u=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(r){const e={color:u,rotateWithView:"map"===t,displacement:h,declutterMode:l};"string"==typeof r?e.src=r:(e.img=r,e.imgSize=[r.width,r.height]),U=new s.Z(e)}else{const r=d[j];let a,c,f;o?r.sdf?(a=Mn(Rn(m,r,i),{x:0,y:0,width:r.width,height:r.height,pixelRatio:r.pixelRatio},o,n),u=void 0):a=Mn(m,r,o,n):(r.sdf?(y||(y=Rn(m,{x:0,y:0,width:_[0],height:_[1]},{r:1,g:1,b:1,a:1})),a=y):a=m,c=[r.width,r.height],f=[r.x,r.y]),U=new s.Z({color:u,img:a,imgSize:_,size:c,offset:f,rotateWithView:"map"===t,scale:e/r.pixelRatio,displacement:h,declutterMode:l})}b[a]=U}}U&&(++O,G=R[O],G&&G.getImage()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G),G.setGeometry(n),U.setRotation(J+yn(Hn(Z,"layout","icon-rotate",T,A,S,L))),U.setOpacity(Hn(Z,"paint","icon-opacity",T,A,S,L)),U.setAnchor(qn[Hn(Z,"layout","icon-anchor",T,A,S,L)]),G.setImage(U),K=G.getText(),G.setText(void 0),G.setZIndex(z),H=!0,B=!1)}else B=!0}}}if(1==I&&"circle"===Z.type){++O,G=R[O],G&&G.getImage()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G);const t="circle-radius"in N?Hn(Z,"paint","circle-radius",T,A,S,L):5,e=tr(Hn(Z,"paint","circle-stroke-color",T,A,S,L),Hn(Z,"paint","circle-stroke-opacity",T,A,S,L)),i=tr(Hn(Z,"paint","circle-color",T,A,S,L),Hn(Z,"paint","circle-opacity",T,A,S,L)),s=Hn(Z,"paint","circle-stroke-width",T,A,S,L),o=t+"."+e+"."+i+"."+s;U=b[o],U||(U=new n.Z({radius:t,stroke:e&&s>0?new a.Z({width:s,color:e}):void 0,fill:i?new r.Z({color:i}):void 0,declutterMode:"none"}),b[o]=U),G.setImage(U),K=G.getText(),G.setText(void 0),G.setGeometry(void 0),G.setZIndex(z),H=!0}if("text-field"in D){$=Math.round(Hn(Z,"layout","text-size",T,A,S,L));const t=Hn(Z,"layout","text-font",T,A,S,L);X=Hn(Z,"layout","text-line-height",T,A,S,L),V=on(g?g(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,$,X),V.includes("sans-serif")||(V+=",sans-serif"),W=Hn(Z,"layout","text-letter-spacing",T,A,S,L),Y=Hn(Z,"layout","text-max-width",T,A,S,L);const i=Hn(Z,"layout","text-field",T,A,S,L);q="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce(((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=on(g?g(r):r,$*(i.scale||1),X);let o=i.text;if("\n"===o)return e.push("\n",""),e;if(2!=I){o=kn(o,s,Y,W).split("\n");for(let t=0,i=o.length;t0&&e.push("\n",""),e.push(o[t],s);return e}e.push(An(o,W),s)}),[]):ir(i,x).trim(),f=Hn(Z,"paint","text-opacity",T,A,S,L)}if(q&&f&&!B){H||(++O,G=R[O],G&&G.getText()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G),G.setImage(void 0),G.setGeometry(void 0)),G.getText()||G.setText(K||new h.Z({padding:[2,2,2,2]})),K=G.getText();const t=D["text-transform"];"uppercase"==t?q=Array.isArray(q)?q.map(((t,e)=>e%2?t:t.toUpperCase())):q.toUpperCase():"lowercase"==t&&(q=Array.isArray(q)?q.map(((t,e)=>e%2?t:t.toLowerCase())):q.toLowerCase());const e=Array.isArray(q)?q:2==I?An(q,W):kn(q,V,Y,W);K.setText(e),K.setFont(V),K.setRotation(yn(Hn(Z,"layout","text-rotate",T,A,S,L)));const i=Hn(Z,"layout","text-anchor",T,A,S,L),n=H||1==I?"point":Hn(Z,"layout","symbol-placement",T,A,S,L);let r;if("line-center"===n?(K.setPlacement("line"),r="center"):K.setPlacement(n),"line"===n&&"function"==typeof K.setRepeat){const t=Hn(Z,"layout","symbol-spacing",T,A,S,L);K.setRepeat(2*t)}K.setOverflow("point"===n);let s=Hn(Z,"paint","text-halo-width",T,A,S,L);const o=Hn(Z,"layout","text-offset",T,A,S,L),a=Hn(Z,"paint","text-translate",T,A,S,L);let u=0,c=0;if("point"==n){r="center",-1!==i.indexOf("left")?(r="left",c=s):-1!==i.indexOf("right")&&(r="right",c=-s);const t=Hn(Z,"layout","text-rotation-alignment",T,A,S,L);K.setRotateWithView("map"==t)}else K.setMaxAngle(yn(Hn(Z,"layout","text-max-angle",T,A,S,L))*q.length/e.length),K.setRotateWithView(!1);K.setTextAlign(r);let d="middle";0==i.indexOf("bottom")?(d="bottom",u=-s-.5*(X-1)*$):0==i.indexOf("top")&&(d="top",u=s+.5*(X-1)*$),K.setTextBaseline(d);const g=Hn(Z,"layout","text-justify",T,A,S,L);K.setJustify("auto"===g?void 0:g),K.setOffsetX(o[0]*$+c+a[0]),K.setOffsetY(o[1]*$+u+a[1]),P.setColor(tr(Hn(Z,"paint","text-color",T,A,S,L),f)),K.setFill(P);const p=tr(Hn(Z,"paint","text-halo-color",T,A,S,L),f);if(p){M.setColor(p),s*=2;const t=.5*$;M.setWidth(s<=t?s:t),K.setStroke(M)}else K.setStroke(void 0);const m=Hn(Z,"layout","text-padding",T,A,S,L),_=K.getPadding();m!==_[0]&&(_[0]=m,_[1]=m,_[2]=m,_[3]=m),G.setZIndex(z)}}}return O>-1?(R.length=O+1,nr&&("set"in i?i.set("mapbox-layer",F):i.getProperties()["mapbox-layer"]=F),R):void 0};return t.setStyle(I),t.set("mapbox-source",T),t.set("mapbox-layers",E),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),I}function or(t,e){const i=t[0],n=i.width,r=i.height,s=i.data,o=new Uint8ClampedArray(s.length),a=2*e.resolution,l=n-1,h=r-1,u=[0,0,0,0],c=2*Math.PI,d=Math.PI/2,f=Math.PI*e.sunEl/180,g=Math.PI*e.sunAz/180,p=Math.cos(f),m=Math.sin(f),_=e.highlightColor,y=e.shadowColor,x=e.accentColor,v=e.encoding;let E,b,w,S,C,T,M,P,R,I,A,L,F,O,Z,k,D,N,G,z,j,U;function B(t,e="mapbox"){return"mapbox"===e?.1*(256*t[0]*256+256*t[1]+t[2])-1e4:"terrarium"===e?256*t[0]+t[1]+t[2]/256-32768:void 0}for(b=0;b<=h;++b)for(C=0===b?0:b-1,T=b===h?h:b+1,E=0;E<=l;++E)w=0===E?0:E-1,S=E===l?l:E+1,M=4*(b*n+w),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],P=e.vert*B(u,v),M=4*(b*n+S),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],R=e.vert*B(u,v),I=(R-P)/a,M=4*(C*n+E),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],P=e.vert*B(u,v),M=4*(T*n+E),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],R=e.vert*B(u,v),A=(R-P)/a,F=Math.atan2(A,-I),F=F<0?d-F:F>d?c-F+d:d-F,L=Math.atan(Math.sqrt(I*I+A*A)),U=m*Math.cos(L)+p*Math.sin(L)*Math.cos(g-F),O=Math.cos(L),Z=255*U,G=Math.min(Math.max(2*e.sunEl,0),1),z=1.875-1.75*e.opacity,j=.5!==e.opacity?d*((Math.pow(z,L)-1)/(Math.pow(z,d)-1)):L,D={r:(1-O)*x.r*G*255,g:(1-O)*x.g*G*255,b:(1-O)*x.b*G*255,a:(1-O)*x.a*G*255},k=Math.abs(((F+g)/Math.PI+.5)%2-1),N={r:(_.r*(1-k)+y.r*k)*Z,g:(_.g*(1-k)+y.g*k)*Z,b:(_.b*(1-k)+y.b*k)*Z,a:(_.a*(1-k)+y.a*k)*Z},M=4*(b*n+E),o[M]=D.r*(1-k)+N.r,o[M+1]=D.g*(1-k)+N.g,o[M+2]=D.b*(1-k)+N.b,o[M+3]=s[M+3]*e.opacity*G*Math.sin(j);return new ImageData(o,n,r)}function ar(t,e=512){return t.getExtent()?(0,O.dl)({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():xn}function lr(t,e){if(!e.accessToken){e=Object.assign({},e);new URL(t).searchParams.forEach(((t,i)=>{e.accessToken=t,e.accessTokenParam=i}))}return e}function hr(t,e,i="",n={},r=void 0){let s,o,a,l,h=!0;return"string"==typeof i||Array.isArray(i)?l=i:(a=i,l=a.source||a.layers,n=a),"string"==typeof n?(s=n,a={}):(s=n.styleUrl,a=n),!1===a.updateSource&&(h=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:hn(s,a.accessToken),a=lr(s,a)),new Promise((function(i,n){Sn(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof M.Z||t instanceof R.Z))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof R.Z?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find((function(t){return t.id===l[0]})).source:l:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===u})),l=o),!o)return n(new Error(`No ${u} source found in the glStyle.`));function c(){if(!h)return Promise.resolve();if(t instanceof R.Z)return mr(e.sources[o],s,a).then((function(e){const i=t.getSource();if(i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof i.setUrls&&"function"==typeof e.getUrls&&i.setUrls(e.getUrls()),i.format_||(i.format_=e.format_),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===I.I&&i.setTileLoadFunction(e.getTileLoadFunction()),(0,L.OP)(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e),!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())){const e=t.getSource().getTileGrid();t.setMaxResolution(e.getResolution(e.getMinZoom()))}}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=vr(i,s,a));const r=t.getSource();return r?n!==r&&(r.getAttributions()||r.setAttributions(n.getAttributions()),r.format_||(r.format_=n.getFormat()),r.url_=n.getUrl()):t.setSource(n),Promise.resolve()}let d,f,g,p;function m(){if(p||e.sprite&&!f)p?(t.setStyle(p),c().then(i).catch(n)):n(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=(0,L.U2)(a.projection).getUnits();"m"!==t&&(r=xn.map((e=>e/L.Wm[t])))}p=sr(t,e,l,r,f,g,Un,a.getImage),t.getStyle()?c().then(i).catch(n):n(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=new URL(function(t,e,i){const n=ln(t);if(!n)return decodeURI(new URL(t,i).href);const r="sprites/";if(0!==n.indexOf(r))throw new Error(`unexpected sprites url: ${t}`);const s=n.slice(8);return`${an}/styles/v1/${s}/sprite?access_token=${e}`}(e.sprite,a.accessToken,s||location.href));d=window.devicePixelRatio>=1.5?.5:1;const i=.5==d?"@2x":"";let r=t.origin+t.pathname+i+".json"+t.search;new Promise((function(e,i){wn("Sprite",r,a).then(e).catch((function(n){r=t.origin+t.pathname+".json"+t.search,wn("Sprite",r,a).then(e).catch(i)}))})).then((function(e){if(void 0===e&&n(new Error("No sprites found.")),f=e,g=t.origin+t.pathname+i+".png"+t.search,a.transformRequest){const t=a.transformRequest(g,"SpriteImage")||g;(t instanceof Request||t instanceof Promise)&&(g=t)}m()})).catch((function(t){n(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))}))}else m()})).catch(n)}))}const ur={};function cr(t,e,i={}){return Sn(e,i).then((function(e){!function(t,e,i){e.layers.some((function(e){if("background"===e.type){if(t instanceof y.Z)return t.setBackground((function(t){return gr(e,t,i,{})})),!0;if(t instanceof E.Z||t instanceof x.Z)return t.getLayers().push(pr(e,i,{})),!0}}))}(t,e,i)}))}function dr(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function fr(t,e,i){const n=new C.Z({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=(0,L.U2)(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=(0,L.mi)([i[0],i[1]],e),n=(0,L.mi)([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return(0,L.U2)(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new S.Z({origin:l?(0,Z.rL)(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:ar(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?c.urls=r.tiles:c.url=r.tiles,c}function gr(t,e,i,n){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};r.paint=o;const a=En(e,i.resolutions||xn);let l,h;return void 0!==o["background-color"]&&(l=Hn(r,"paint","background-color",a,ur,n)),void 0!==o["background-opacity"]&&(h=Hn(r,"paint","background-opacity",a,ur,n)),"none"==s.visibility?void 0:tr(l,h)}function pr(t,e,i){const n=document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new y.Z({source:new w.Z({}),render(r){const s=gr(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function mr(t,e,i){return new Promise((function(n,r){Tn(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=fr(t,e,i);s.tileLoadFunction=r,s.format=new v.Z,n(new I.Z(s))})).catch(r)}))}function _r(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function yr(t,e,i){return new Promise((function(n,r){Tn(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new C.Z({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=fr(t,e,i).tileGrid,i.projection&&(s.projection=(0,L.U2)(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=_r(i);let r=o(t,e,i);if(-1!=r.indexOf(n)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(n,e.toString())}return r})),s.set("mapbox-source",t),n(s)})).catch((function(t){r(t)}))}))}function xr(t,e,i){const n=new T.Z;return yr(t,e,i).then((function(t){n.setSource(t)})).catch((function(){n.setSource(void 0)})),n}function vr(t,e,i){const n=i.projection?new m.Z({dataProjection:i.projection}):new m.Z,r=t.data,s={};if("string"==typeof r){const s=un(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=_r(i);return s.replace(n,`${t.join(",")}`)},r=new P.Z({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{wn("GeoJSON","function"==typeof e?e(t,n,s):e,i).then((t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)})).catch((e=>{r.removeLoadedExtent(t),a()}))},strategy:F.VW});return r.set("mapbox-source",t),r}const o=new P.Z({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{wn("GeoJSON",s,i).then((t=>{const e=o.getFormat().readFeatures(t,{featureProjection:n});o.addFeatures(e),r(e)})).catch((e=>{o.removeLoadedExtent(t),a()}))}});return o}s.features=n.readFeatures(r,{featureProjection:(0,L.Cs)()||"EPSG:3857"});const o=new P.Z(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function Er(t,e,i){let n=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==n&&(n=r.frameState.viewState.zoom,delete i[t.id],function(t,e,i,n){const r=Hn(t,"paint","raster-opacity",i,ur,n);e.setOpacity(r)}(t,e,n,i))}}function br(t,e,i,n){const r=mn(t),s=t.layers,o=i.type,a=i.source||dr(s,i.ref),l=t.sources[a];let h;if("background"==o)h=pr(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new R.Z({declutter:!0,visible:!1});return mr(t,e,i).then((function(e){e.set("mapbox-source",t),n.setSource(e)})).catch((function(t){n.setSource(void 0)})),n}(l,e,n);else if("raster"==l.type)h=xr(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",Er(i,h,r));else if("geojson"==l.type)h=function(t,e,i){return new M.Z({declutter:!0,source:vr(t,e,i),visible:!1})}(l,e,n);else if("raster-dem"==l.type&&"hillshade"==i.type){const t=function(t,e,i){const n=xr(t,e,i);return new _.Z({source:new b.ZP({operationType:"image",operation:or,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=t.resolution;const s=En(t.resolution,n.resolutions||xn);e.encoding=l.encoding,e.vert=5*Hn(i,"paint","hillshade-exaggeration",s,ur,r),e.sunAz=Hn(i,"paint","hillshade-illumination-direction",s,ur,r),e.sunEl=35,e.opacity=.3,e.highlightColor=Hn(i,"paint","hillshade-highlight-color",s,ur,r),e.shadowColor=Hn(i,"paint","hillshade-shadow-color",s,ur,r),e.accentColor=Hn(i,"paint","hillshade-accent-color",s,ur,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function wr(t,e,i,n){const r=[];let s=null;if(e instanceof E.Z){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=n.projection?(0,L.U2)(n.projection):s.getProjection();s=new A.ZP(Object.assign(s.getProperties(),{maxResolution:xn[0]/L.Wm[t.getUnits()],projection:n.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter((0,L.mi)(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(xn[0]/L.Wm[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:i,options:n});const o=t.layers;let a,l,h,u=[];for(let s=0,c=o.length;s0||i>0)&&t.setMaxResolution(Math.min(xn[o],e.getResolution(i))+1e-9),a<24&&t.setMinResolution(xn[a]+1e-9)}}else o>0&&t.setMaxResolution(xn[o]+1e-9);u instanceof P.Z||u instanceof I.Z?hr(t,i,e,Object.assign({styleUrl:n},s)).then((function(){!function(t,e){function i(){const i=e.get("mapbox-style");if(!i)return;const n=tn(i.layers),r=t.get("mapbox-layers"),s=n.filter((function(t){return r.includes(t.id)})).some((function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility}));t.get("visible")!==s&&t.setVisible(s)}t.on("change",i),i()}(t,r),l()})).catch(h):l()}else h(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const c=r.getLayers();-1===c.getArray().indexOf(t)&&c.push(t),t.getSource()?u():t.once("change:source",u)}))}class Tr extends k.ZP{constructor(t){super(D.Z.ERROR),this.error=t}}class Mr extends R.Z{constructor(t){const e=!("declutter"in t)||t.declutter,i=new I.Z({state:"loading",format:new v.Z});super({source:i,background:t.background,declutter:e,className:t.className,opacity:t.opacity,visible:t.visible,zIndex:t.zIndex,minResolution:t.minResolution,maxResolution:t.maxResolution,minZoom:t.minZoom,maxZoom:t.maxZoom,renderOrder:t.renderOrder,renderBuffer:t.renderBuffer,renderMode:t.renderMode,map:t.map,updateWhileAnimating:t.updateWhileAnimating,updateWhileInteracting:t.updateWhileInteracting,preload:t.preload,useInterimTilesOnError:t.useInterimTilesOnError,properties:t.properties}),t.accessToken&&(this.accessToken=t.accessToken);const n=[hr(this,t.styleUrl,t.layers||t.source,{accessToken:this.accessToken})];void 0===this.getBackground()&&n.push(cr(this,t.styleUrl,{accessToken:this.accessToken})),Promise.all(n).then((()=>{i.setState("ready")})).catch((t=>{this.dispatchEvent(new Tr(t));this.getSource().setState("error")}))}}},79638:function(t,e,i){"use strict";var n=i(38282),r=i(8651),s=i(6747);const o="length";class a extends s.ZP{constructor(t,e,i){super(t),this.element=e,this.index=i}}class l extends n.Z{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new a(r.Z.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new a(r.Z.REMOVE,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new a(r.Z.REMOVE,i,t)),this.dispatchEvent(new a(r.Z.ADD,e,t))}updateLength_(){this.set(o,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;ithis.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=s.Z.LOADED})).catch((t=>{this.state=s.Z.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function u(t,e,i){const n=t;let s=!0,l=!1,h=!1;const u=[(0,a.Vx)(n,r.Z.LOAD,(function(){h=!0,l||e()}))];return n.src&&o.Tp?(l=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(h?e():i())}))):u.push((0,a.Vx)(n,r.Z.ERROR,i)),function(){s=!1,u.forEach(a.bN)}}function c(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}function d(t,e){return e&&(t.src=e),t.src&&o.Tp?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):c(t)}function f(t,e){return e&&(t.src=e),t.src&&o.Tp&&o.et?t.decode().then((()=>createImageBitmap(t))).catch((e=>{if(t.complete&&t.width)return t;throw e})):d(t)}e.ZP=h},13617:function(t,e,i){"use strict";var n=i(13701),r=i(57419);class s extends r.ZP{constructor(t,e,i,r,s){super(t,e,i,void 0!==s?n.Z.IDLE:n.Z.LOADED),this.loader_=void 0!==s?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=n.Z.ERROR):this.state=n.Z.LOADED,this.changed()}load(){this.state==n.Z.IDLE&&(this.state=n.Z.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}e.Z=s},13701:function(t,e){"use strict";e.Z={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},27859:function(t,e,i){"use strict";var n=i(69319),r=i(74251),s=i(850),o=i(57419);class a extends n.Z{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=r.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=r.Z.ERROR,this.unlistenImage_(),this.image_=function(){const t=(0,s.E4)(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=r.Z.LOADED:this.state=r.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==r.Z.ERROR&&(this.state=r.Z.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==r.Z.IDLE&&(this.state=r.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=(0,o.Kp)(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}e.Z=a},1055:function(t,e,i){"use strict";i.d(e,{Z:function(){return H}});var n=i(38282),r=i(79638),s=i(8651),o=i(5929),a=i(79407),l=i(22765),h=i(44669),u=i(36117),c=i(47921),d=i(91462),f=i(19775);class g extends o.Z{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){(0,l.O3)()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;(0,h.qC)(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),(0,h.nb)(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function c(t,e,i,n){return r.call(s,e,t?i:null,n)}const g=h.projection,p=(0,f.Cf)(t.slice(),g),m=[[0,0]];if(g.canWrapX()&&n){const t=g.getExtent(),e=(0,u.dz)(t);m.push([-e,0],[e,0])}const _=e.layerStatesArray,y=_.length,x=[],v=[];for(let n=0;n=0;--r){const s=_[r],u=s.layer;if(u.hasRenderer()&&(0,d.j)(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?p:t,h=c.bind(null,s.managed);v[0]=a[0]+m[n][0],v[1]=a[1]+m[n][1],l=r.forEachFeatureAtCoordinate(v,e,i,h,x)}if(l)return l}}if(0===x.length)return;const E=1/x.length;return x.forEach(((t,e)=>t.distanceSq+=e*E)),x.sort(((t,e)=>t.distanceSq-e.distanceSq)),x.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,a.uX,this,r,s)}getMap(){return this.map_}renderFrame(t){(0,l.O3)()}flushDeclutterItems(t){}scheduleExpireIconCache(t){c.c1.canExpireCache()&&t.postRenderFunctions.push(p)}}function p(t,e){c.c1.expire()}var m=g,_=i(35323),y=i(44594),x=i(95474),v=i(49636),E=i(17955),b=i(41507),w=i(850);var S=class extends m{constructor(t){super(t),this.fontChangeListenerKey_=(0,b.oL)(E.sG,_.Z.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=v.XV+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new y.Z(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){(0,b.bN)(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(x.Z.PRECOMPOSE,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let r=null;for(let s=0,o=e.length;s=0;--i)e[i].renderDeclutter(t,t.layerStatesArray[i]);e.length=0}},C=i(92486),T=i(22664),M=i(84184),P=i(87556),R=i(64074),I=i(13804),A=i(14768);class L extends I.Z{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=(0,b.oL)(i,R.Z.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=(0,b.oL)(i,R.Z.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(C.Z.TOUCHMOVE,this.boundHandleTouchMove_,!!A.bM&&{passive:!1})}emulateClick_(t){let e=new M.Z(P.Z.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new M.Z(P.Z.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new M.Z(P.Z.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==P.Z.POINTERUP||e.type==P.Z.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=P.Z.POINTERDOWN&&e.type!=P.Z.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new M.Z(P.Z.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(b.bN),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new M.Z(P.Z.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push((0,b.oL)(t,P.Z.POINTERMOVE,this.handlePointerMove_,this),(0,b.oL)(t,P.Z.POINTERUP,this.handlePointerUp_,this),(0,b.oL)(this.element_,P.Z.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push((0,b.oL)(this.element_.getRootNode(),P.Z.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new M.Z(P.Z.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new M.Z(P.Z.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&((0,b.bN)(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(C.Z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&((0,b.bN)(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(b.bN),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var F=L,O=i(88222),Z=i(22222),k=i(96270),D=i(63947),N=i(40824),G=i(87334),z=i(23422),j=i(35777),U=i(55572),B=i(17367),q=i(81625),V=i(81898),X=i(37938);function $(t){t instanceof d.Z?t.setMapInternal(null):t instanceof T.Z&&t.getLayers().forEach($)}function W(t,e){if(t instanceof d.Z)t.setMapInternal(e);else if(t instanceof T.Z){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||(0,j.c)(),this.interactions=e.interactions||(0,U.c)({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new D.Z(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(k.Z.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(k.Z.VIEW,this.handleViewChanged_),this.addChangeListener(k.Z.SIZE,this.handleSizeChanged_),this.addChangeListener(k.Z.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof N.ZP||t.view.then((function(t){i.setView(new N.ZP(t))})),this.controls.addEventListener(s.Z.ADD,(t=>{t.element.setMap(this)})),this.controls.addEventListener(s.Z.REMOVE,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(s.Z.ADD,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(s.Z.REMOVE,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(s.Z.ADD,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(s.Z.REMOVE,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){W(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:a.uX,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof T.Z?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:a.uX,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(k.Z.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return(0,q.lO)(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?(0,h.nn)(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(k.Z.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof r.Z)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[G.Z.ANIMATING]||e[G.Z.INTERACTING]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new T.V("removelayer",e)),this.set(k.Z.LAYERGROUP,t)}setSize(t){this.set(k.Z.SIZE,t)}setTarget(t){this.set(k.Z.TARGET,t)}setView(t){if(!t||t instanceof N.ZP)return void this.set(k.Z.VIEW,t);this.set(k.Z.VIEW,new N.ZP);const e=this;t.then((function(t){e.setView(new N.ZP(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(r)||(e=[n,r],!(0,V.py)(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&(0,X.ZK)("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&(0,B.fS)(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}var H=Y},84184:function(t,e,i){"use strict";var n=i(88222);class r extends n.Z{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}e.Z=r},87556:function(t,e,i){"use strict";var n=i(92486);e.Z={SINGLECLICK:"singleclick",CLICK:n.Z.CLICK,DBLCLICK:n.Z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}},88222:function(t,e,i){"use strict";var n=i(6747);class r extends n.ZP{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}e.Z=r},22222:function(t,e){"use strict";e.Z={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"}},96270:function(t,e){"use strict";e.Z={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"}},38282:function(t,e,i){"use strict";var n=i(6747),r=i(35323),s=i(21320),o=i(22765),a=i(4891);class l extends n.ZP{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class h extends s.Z{constructor(t){super(),this.on,this.once,this.un,(0,o.sq)(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e)),i=r.Z.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],(0,a.x)(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}e.Z=h},35323:function(t,e){"use strict";e.Z={PROPERTYCHANGE:"propertychange"}},21320:function(t,e,i){"use strict";i.d(e,{B:function(){return a}});var n=i(13804),r=i(92486),s=i(41507);class o extends n.Z{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(r.Z.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;rt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){(0,o.O3)()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:(0,a.YQ)(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}e.Z=l},2145:function(t,e,i){"use strict";var n=i(80316),r=i(69649);class s extends n.Z{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey(),e=(0,r.Ul)(t)[0];this.forEach((t=>{t.tileCoord[0]!==e&&(this.remove((0,r.km)(t.tileCoord)),t.release())}))}}e.Z=s},63947:function(t,e,i){"use strict";i.d(e,{Z:function(){return h},R:function(){return u}});var n=i(92486),r=i(23422),s=i(4891);const o=1/0;var a=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,(0,s.Z)(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){(0,r.h)(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=o&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,a,l;for(a=0;a0;)n=this.dequeue()[0],r=n.getKey(),i=n.getState(),i!==l.Z.IDLE||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}};function u(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return o;if(!t.wantedTiles[i][e.getKey()])return o;const s=t.viewState.center,a=n[0]-s[0],l=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(a*a+l*l)/r}},51748:function(t,e,i){"use strict";i.d(e,{T:function(){return r}});class n{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function r(t,e,i,r,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=r,s):new n(t,e,i,r)}e.Z=n},74251:function(t,e){"use strict";e.Z={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},38264:function(t,e,i){"use strict";var n=i(69319),r=i(74251);class s extends n.Z{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==r.Z.IDLE&&(this.setState(r.Z.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(r.Z.ERROR)}setFeatures(t){this.features_=t,this.setState(r.Z.LOADED)}setLoader(t){this.loader_=t}}e.Z=s},40824:function(t,e,i){"use strict";i.d(e,{ZP:function(){return T}});var n=i(38282),r=i(87334),s=i(21800),o=i(36913),a=i(81625),l=i(79407),h=i(19775),u=i(23422),c=i(63312);function d(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,d=a?a[1]:0;let f=t[0]+l/2+u,g=t[2]-l/2+u,p=t[1]+h/2+d,m=t[3]-h/2+d;f>g&&(f=(g+f)/2,g=f),p>m&&(p=(m+p)/2,m=p);let _=(0,c.uZ)(n[0],f,g),y=(0,c.uZ)(n[1],p,m);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,f-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[_,y]}}function f(t){return t}var g=i(36117),p=i(17367);function m(t,e,i,n){const r=(0,g.dz)(e)/i[0],s=(0,g.Cr)(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function _(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),(0,c.uZ)(n,i/2,2*e)}function y(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?m(t,n,a,r):t;return i&&l?_(s,o,e):(0,c.uZ)(s,e,o)}}}var x=i(12338),v=i(70076),E=i(23814);class b extends n.Z{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=(0,a.UQ)(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&(0,a.h_)(),t.center&&(t.center=(0,a.Vs)(t.center,this.projection_)),t.extent&&(t.extent=(0,a.dY)(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in s.Z)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const r=28,s=2;let l=void 0!==t.minZoom?t.minZoom:0,h=void 0!==t.maxZoom?t.maxZoom:r;const u=void 0!==t.zoomFactor?t.zoomFactor:s,d=void 0!==t.multiWorld&&t.multiWorld,f=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,x=void 0!==t.showFullExtent&&t.showFullExtent,v=(0,a.UQ)(t.projection,"EPSG:3857"),E=v.getExtent();let b=t.constrainOnlyCenter,w=t.extent;d||w||!v.isGlobal()||(b=!1,w=E);if(void 0!==t.resolutions){const r=t.resolutions;i=r[l],n=void 0!==r[h]?r[h]:r[r.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?m(l,i,o,n):l;if(a)return e?_(r,u,h):(0,c.uZ)(r,h,u);const d=Math.min(u,r),f=Math.floor((0,p.h7)(t,d,s));return t[f]>u&&f1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[r.Z.INTERACTING]>0}cancelAnimations(){let t;this.setHint(r.Z.ANIMATING,-this.hints_[r.Z.ANIMATING]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?(0,c.$W)(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(r.Z.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&w(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],(0,h.U1)(i,t-this.getRotation()),(0,h.IH)(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?(0,a.lO)(t,this.getProjection()):t}getCenterInternal(){return this.get(s.Z.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return(0,a.Fj)(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();(0,u.h)(e,"The view center is not defined");const i=this.getResolution();(0,u.h)(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return(0,u.h)(void 0!==n,"The view rotation is not defined"),(0,g.p8)(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(s.Z.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal((0,a.dY)(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=(0,g.dz)(t)/e[0],n=(0,g.Cr)(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(s.Z.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=C(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=(0,p.h7)(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=(0,c.uZ)(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,(0,c.uZ)(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if((0,u.h)(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){(0,u.h)(!(0,g.xb)(t),"Cannot fit empty extent provided as `geometry`");const e=(0,a.dY)(t,this.getProjection());i=(0,E.oJ)(e)}else if("Circle"===t.getType()){const e=(0,a.dY)(t.getExtent(),this.getProjection());i=(0,E.oJ)(e),i.rotate(this.getRotation(),(0,g.qg)(e))}else{const e=(0,a.Cs)();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t>1),s=+i(t[n],e),s<0?o=n+1:(a=n,l=!s);return l?o:~o}function r(t,e){return t>e?1:te?-1:0}function o(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0||i&&0===s)}))}i.d(e,{$1:function(){return s},FZ:function(){return a},fS:function(){return h},h7:function(){return o},j2:function(){return r},l7:function(){return l},pT:function(){return u},ry:function(){return n}})},23422:function(t,e,i){"use strict";function n(t,e){if(!t)throw new Error(e)}i.d(e,{h:function(){return n}})},12185:function(t,e,i){"use strict";i.d(e,{_2:function(){return b},XC:function(){return g},mL:function(){return E},e1:function(){return C},TF:function(){return v},Fv:function(){return w},WV:function(){return x},BB:function(){return S},fG:function(){return y}});var n={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},r={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};r.max=r.whitepoint[2].D65,r.rgb=function(t,e){e=e||r.whitepoint[2].E;var i,n,s,o=t[0]/e[0],a=t[1]/e[1],l=t[2]/e[2];return n=-.96924363628087*o+1.87596750150772*a+.041555057407175*l,s=.055630079696993*o+-.20397695888897*a+1.056971514242878*l,i=(i=3.240969941904521*o+-1.537383177570093*a+-.498610760293*l)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(s=Math.min(Math.max(0,s),1))]},n.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,s=t[2]/255,o=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92),a=.019330818715591*i+.11919477979462*n+.95053215224966*s;return[(.41239079926595*i+.35758433938387*n+.18048078840183*s)*(e=e||r.whitepoint[2].E)[0],o*e[1],a*e[2]]};var s=r,o={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,r,o,a,l,h,u,c,d;if(o=t[0],a=t[1],l=t[2],0===o)return[0,0,0];return e=e||"D65",i=i||2,n=a/(13*o)+4*(u=s.whitepoint[i][e][0])/(u+15*(c=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2]))||0,r=l/(13*o)+9*c/(u+15*c+3*d)||0,[9*(h=o>8?c*Math.pow((o+16)/116,3):c*o*.0011070564598794539)*n/(4*r)||0,h,h*(12-3*n-20*r)/(4*r)||0]}};s.luv=function(t,e,i){var n,r,o,a,l,h,u,c,d,f,g;e=e||"D65",i=i||2,f=4*(u=s.whitepoint[i][e][0])/(u+15*(c=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2])),g=9*c/(u+15*c+3*d),n=4*(a=t[0])/(a+15*(l=t[1])+3*(h=t[2]))||0,r=9*l/(a+15*l+3*h)||0;var p=l/c;return[o=p<=.008856451679035631?903.2962962962961*p:116*Math.pow(p,1/3)-16,13*o*(n-f),13*o*(r-g)]};var a={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return o.xyz(a.luv(t))}},l=a;o.lchuv=function(t){var e=t[0],i=t[1],n=t[2],r=Math.sqrt(i*i+n*n),s=360*Math.atan2(n,i)/2/Math.PI;return s<0&&(s+=360),[e,r,s]},s.lchuv=function(t){return o.lchuv(s.luv(t))};var h=i(49552),u=function(t){var e,i,n=[],r=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),h[t])n=h[t].slice(),i="rgb";else if("transparent"===t)r=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var s=t.slice(1),o=s.length;r=1,o<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===o&&(r=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===o&&(r=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),r=(n=n.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==c[t])return c[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:r}},c={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};var d={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,r,s,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[s=255*l,s,s];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,s=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[h++]=255*s;return r}};n.hsl=function(t){var e,i,n=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(n,r,s),a=Math.max(n,r,s),l=a-o;return a===o?e=0:n===a?e=(r-s)/l:r===a?e=2+(s-n)/l:s===a&&(e=4+(n-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};var f=i(63312);function g(t){return"string"==typeof t?t:S(t)}const p=1024,m={};let _=0;function y(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function x(t){const e=s.lchuv(n.xyz(t));return e[3]=t[3],e}function v(t){const e=s.rgb(l.xyz(t));return e[3]=t[3],e}function E(t){if(m.hasOwnProperty(t))return m[t];if(_>=p){let t=0;for(const e in m)0==(3&t++)&&(delete m[e],--_)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=u(t);if(!i.space)return[];const r="h"===i.space[0]?d.min:n.min,s="h"===i.space[0]?d.max:n.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],r[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],r[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],r[2]),s[2]),"h"===i.space[0]&&(e=d.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return w(e),m[t]=e,++_,e}function b(t){return Array.isArray(t)?t:E(t)}function w(t){return t[0]=(0,f.uZ)(t[0]+.5|0,0,255),t[1]=(0,f.uZ)(t[1]+.5|0,0,255),t[2]=(0,f.uZ)(t[2]+.5|0,0,255),t[3]=(0,f.uZ)(t[3],0,1),t}function S(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function C(t){try{return E(t),!0}catch(t){return!1}}},52987:function(t,e,i){"use strict";i.d(e,{y:function(){return l}});var n=i(13701),r=i(850),s=i(72605),o=i(47921),a=i(12185);function l(t){return t?Array.isArray(t)?(0,a.BB)(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return o.c1.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=o.c1.getPattern(e,void 0,t.color);if(i)return i;const a=o.c1.get(t.src,"anonymous",null);if(a.getImageState()!==n.Z.LOADED)return null;const l=(0,r.E4)(t.size[0],t.size[1]);return l.drawImage(a.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),(0,s.U)(l.canvas,e,void 0,n.Z.LOADED,t.color,!0),o.c1.getPattern(e,void 0,t.color)}(t):t:null}},37938:function(t,e,i){"use strict";i.d(e,{ZK:function(){return s},vU:function(){return o}});const n={info:1,warn:2,error:3,none:4};let r=n.info;function s(...t){r>n.warn||console.warn(...t)}function o(...t){r>n.error||console.error(...t)}},55466:function(t,e,i){"use strict";var n=i(19870),r=i(92486),s=i(49636),o=i(17367),a=i(850);class l extends n.Z{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",o=void 0!==t.collapseLabel?t.collapseLabel:"›",a=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof o?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=a):this.collapseLabel_=o;const l=void 0!==t.label?t.label:"i";"string"==typeof l?(this.label_=document.createElement("span"),this.label_.textContent=l,this.label_.className=n):this.label_=l;const h=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(h),this.toggleButton_.addEventListener(r.Z.CLICK,this.handleClick_.bind(this),!1);const u=e+" "+s.XV+" "+s.hg+(this.collapsed_&&this.collapsible_?" "+s.hN:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=u,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap((e=>e.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!(0,o.fS)(e,this.renderedAttributions_)){(0,a.ep)(this.ulElement_);for(let t=0,i=e.length;tu*y||h>c*y?this.resetExtent_():(0,g.r4)(s,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2,o=1/(Math.pow(2,s/2)*x);(0,g.H9)(n,o),r.fitInternal((0,m.oJ)(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenterInternal(),h=n.getResolution(),u=r.getResolution(),c=i[0]*h/u,d=i[1]*h/u;if(o.setPosition(l),a){a.style.width=c+"px",a.style.height=d+"px";const t="rotate("+s+"rad)";a.style.transform=t}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=(0,p.Vx)(this.ovmap_,a.Z.POSTRENDER,(function(t){delete this.ovmapPostrenderKey_,this.updateBox_()}),this))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(f.hN),this.collapsed_?(0,_.$H)(this.collapseLabel_,this.label_):(0,_.$H)(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}}e.Z=v},1375:function(t,e,i){"use strict";var n=i(19870),r=i(49636),s=i(81625);const o="units",a=[1,2,5],l=25.4/.28;class h extends n.Z{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+r.XV,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(o,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(o)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(o,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let o=(0,s._Q)(i,t.resolution,e,r);const h=this.minWidth_*(this.dpi_||l)/l,u=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||l)/l:void 0;let c=h*o,d="";if("degrees"==n){const t=s.Wm.degrees;c*=t,c=u){f=m,g=_,p=y;break}if(g>=h)break;m=f,_=g,y=p,++x}const v=this.scaleBar_?this.createScaleBar(g,f,d):f.toFixed(p<0?-p:0)+" "+d;this.renderedHTML_!=v&&(this.innerElement_.innerHTML=v,this.renderedHTML_=v),this.renderedWidth_!=g&&(this.innerElement_.style.width=g+"px",this.renderedWidth_=g),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n
`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"")}a.push(this.createStepText(s,t,!0,e,i));return(this.scaleBarText_?`
`+r+"
":"")+a.join("")}createMarker(t){return`
`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`
`+s+"
"}getScaleForResolution(){return(0,s._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||l)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}}e.Z=h},86553:function(t,e,i){"use strict";var n=i(19870),r=i(92486),s=i(64074),o=i(49636),a=i(63312),l=i(70076),h=i(41507),u=i(6747);const c=0,d=1;class f extends n.Z{constructor(t){super({target:(t=t||{}).target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=c,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+o.XV;const n=this.element;n.className=e+" "+o.XV+" "+o.hg,n.appendChild(i),n.addEventListener(s.Z.POINTERDOWN,this.handleDraggerStart_.bind(this),!1),n.addEventListener(s.Z.POINTERMOVE,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(s.Z.POINTERUP,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(r.Z.CLICK,this.handleContainerClick_.bind(this),!1),i.addEventListener(r.Z.CLICK,u.UW,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=d,this.widthLimit_=e-o):(this.direction_=c,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:l.Vv})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push((0,h.oL)(i,s.Z.POINTERMOVE,t,this),(0,h.oL)(i,s.Z.POINTERUP,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){if(this.dragging_){this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(h.bN),this.dragListenerKeys_.length=0}}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==d?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=this.direction_===d?t/this.widthLimit_:e/this.heightLimit_,(0,a.uZ)(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){const e=this.getMap().getView().getValueForResolutionFunction();return(0,a.uZ)(1-e(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}e.Z=f},35777:function(t,e,i){"use strict";i.d(e,{c:function(){return f}});var n=i(55466),r=i(79638),s=i(19870),o=i(92486),a=i(49636),l=i(70076);class h extends s.Z{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(o.Z.CLICK,this.handleClick_.bind(this),!1);const l=e+" "+a.XV+" "+a.hg,h=this.element;h.className=l,h.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(a.oj)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:l.Vv}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(a.oj);t||0!==i?t&&0!==i&&this.element.classList.remove(a.oj):this.element.classList.add(a.oj)}this.label_.style.transform=t}this.rotation_=i}}var u=h;class c extends s.Z{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",l=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",h=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",u=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(o.Z.CLICK,this.handleClick_.bind(this,i),!1);const d=document.createElement("button");d.className=r,d.setAttribute("type","button"),d.title=u,d.appendChild("string"==typeof l?document.createTextNode(l):l),d.addEventListener(o.Z.CLICK,this.handleClick_.bind(this,-i),!1);const f=e+" "+a.XV+" "+a.hg,g=this.element;g.className=f,g.appendChild(c),g.appendChild(d),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:l.Vv})):e.setZoom(n)}}}var d=c;function f(t){t=t||{};const e=new r.Z;(void 0===t.zoom||t.zoom)&&e.push(new d(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new u(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new n.Z(t.attributionOptions)),e}},19775:function(t,e,i){"use strict";i.d(e,{Bs:function(){return m},Cf:function(){return y},Ed:function(){return a},Fj:function(){return h},I8:function(){return u},IH:function(){return o},TE:function(){return p},U1:function(){return d},V7:function(){return _},bA:function(){return f},bI:function(){return g},fS:function(){return c},jk:function(){return x},oL:function(){return l}});var n=i(36117),r=i(63312),s=i(84441);function o(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function a(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function l(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],u=l-o,c=h-a,d=0===u&&0===c?0:(u*(i-o)+c*(n-a))/(u*u+c*c||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=h):(f=o+d*u,g=a+d*c),[f,g]}function h(t){return function(e){return function(t,e){return function(t,e,i){if(t)return e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i));return""}(t,"{x}, {y}",e)}(e,t)}}function u(t,e,i){const n=(0,r.$W)(e+180,360)-180,o=Math.abs(3600*n),a=i||0;let l=Math.floor(o/3600),h=Math.floor((o-3600*l)/60),u=(0,r.FH)(o-3600*l-60*h,a);u>=60&&(u=0,h+=1),h>=60&&(h=0,l+=1);let c=l+"°";return 0===h&&0===u||(c+=" "+(0,s.v)(h,2)+"′"),0!==u&&(c+=" "+(0,s.v)(u,2,a)+"″"),0!==n&&(c+=" "+t.charAt(n<0?1:0)),c}function c(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function d(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function f(t,e){return t[0]*=e,t[1]*=e,t}function g(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function p(t,e){return Math.sqrt(g(t,e))}function m(t,e){return g(t,l(t,e))}function _(t,e){return t?u("NS",t[1],e)+" "+u("EW",t[0],e):""}function y(t,e){if(e.canWrapX()){const i=(0,n.dz)(e.getExtent()),r=x(t,e,i);r&&(t[0]-=r*i)}return t}function x(t,e,i){const r=e.getExtent();let s=0;return e.canWrapX()&&(t[0]r[2])&&(i=i||(0,n.dz)(r),s=Math.floor((t[0]-r[0])/i)),s}},49636:function(t,e,i){"use strict";i.d(e,{$A:function(){return r},Qi:function(){return o},XV:function(){return s},hN:function(){return l},hg:function(){return a},oj:function(){return n},p:function(){return c}});const n="ol-hidden",r="ol-selectable",s="ol-unselectable",o="ol-unsupported",a="ol-control",l="ol-collapsed",h=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),u=["style","variant","weight","size","lineHeight","family"],c=function(t){const e=t.match(h);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=u.length;t0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=s.Zn,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}e.Z=a},94142:function(t,e,i){"use strict";i.d(e,{$6:function(){return a},Bx:function(){return c},Fi:function(){return g},Kf:function(){return m},Ko:function(){return l},MJ:function(){return p},QC:function(){return y},QL:function(){return b},TN:function(){return E},V4:function(){return d},Xp:function(){return w},a5:function(){return x},aj:function(){return h},rM:function(){return _},v8:function(){return f},vY:function(){return v},yZ:function(){return u}});var n=i(87556),r=i(79407),s=i(14768),o=i(23422);function a(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette"},w={[b.Get]:R((([t,e])=>void 0!==e?function(t){switch(t){case"string":return h;case"color":return u;case"number":return l;case"boolean":return a;case"number[]":return c;default:throw new Error(`Unrecognized type hint: ${t}`)}}(e.value):d),C(1,2),(function(t,e){const i=E(t[1],e);if(!(i instanceof y))throw new Error("Expected a literal argument for get operation");if("string"!=typeof i.value)throw new Error("Expected a string argument for get operation");if(e.properties.add(i.value),3===t.length){return[i,E(t[2],e)]}return[i]})),[b.Var]:R((([t])=>t.type),C(1,1),(function(t,e,i,n){const r=t[1];if("string"!=typeof r)throw new Error("Expected a string argument for var operation");if(e.variables.add(r),!("variables"in e.style)||void 0===e.style.variables[r])return[new y(d,r)];const s=E(e.style.variables[r],e);if(s.value=r,n&&!m(n,s.type))throw new Error(`The variable ${r} has type ${p(s.type)} but the following type was expected: ${p(n)}`);return[s]})),[b.Id]:R(l|h,S,(function(t,e){e.featureId=!0})),[b.Concat]:R(h,C(2,1/0),T(d)),[b.GeometryType]:R(h,S),[b.Resolution]:R(l,S),[b.Zoom]:R(l,S),[b.Time]:R(l,S),[b.Any]:R(a,C(2,1/0),T(a)),[b.All]:R(a,C(2,1/0),T(a)),[b.Not]:R(a,C(1,1),T(a)),[b.Equal]:R(a,C(2,2),T(d),M),[b.NotEqual]:R(a,C(2,2),T(d),M),[b.GreaterThan]:R(a,C(2,2),T(d),M),[b.GreaterThanOrEqualTo]:R(a,C(2,2),T(d),M),[b.LessThan]:R(a,C(2,2),T(d),M),[b.LessThanOrEqualTo]:R(a,C(2,2),T(d),M),[b.Multiply]:R((t=>{let e=l|u;for(let i=0;i{let e=d;for(let i=2;i{let e=u|l;for(let i=3;i{let e=d;for(let i=1;i3===t.length||4===t.length?c|u:c),C(1,1/0),T(l)),[b.Color]:R(u,C(1,4),T(l)),[b.Band]:R(l,C(1,3),T(l)),[b.Palette]:R(u,C(2,2),(function(t,e){const i=E(t[1],e,l);if(i.type!==l)throw new Error(`The first argument of palette must be an number, got ${p(i.type)} instead`);const n=t[2];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const r=new Array(n.length);for(let t=0;te){throw new Error(`Expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${s}`)}}}function T(t){return function(e,i){const n=e[0],r=e.length-1,s=new Array(r);for(let o=0;o4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(a).join(", ")})`}function h(t){const e=(0,o._2)(t),i=e.length>3?e[3]:1;return l([e[0]/255*i,e[1]/255*i,e[2]/255*i,i])}const u={};let c=0;function d(t){return t in u||(u[t]=c++),u[t]}function f(t){return a(d(t))}function g(t){return"u_var_"+t}function p(){return{inFragmentShader:!1,variables:{},properties:{},functions:{},bandCount:0,style:{}}}const m="getBandValue",_="u_paletteTextures";function y(t,e,i,n){const s=(0,r.Qc)(t,i,e);if((0,r.P9)(s.type,r.Pq))throw new Error("No matching type was found");if(!(0,r.YM)(e,s.type)){const t=(0,r.hD)(e),i=(0,r.hD)(s.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return E(s,e,n)}function x(t){return(e,i,n)=>{const r=i.args.length,s=new Array(r);for(let t=0;t{const i=e.args[0].value;i in t.properties||(t.properties[i]={name:i,type:e.type});return(t.inFragmentShader?"v_prop_":"a_prop_")+i},[r.AP.GeometryType]:(t,e,i)=>{const n="geometryType",s=t=>{const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return s(t.getGeometries()[0])}};n in t.properties||(t.properties[n]={name:n,type:r.uW,evaluator:t=>s(t.getGeometry())});return(t.inFragmentShader?"v_prop_":"a_prop_")+n},[r.AP.Var]:(t,e)=>{const i=e.args[0].value;return i in t.variables||(t.variables[i]={name:i,type:e.type}),g(i)},[r.AP.Resolution]:()=>"u_resolution",[r.AP.Zoom]:()=>"u_zoom",[r.AP.Time]:()=>"u_time",[r.AP.Any]:x((t=>`(${t.join(" || ")})`)),[r.AP.All]:x((t=>`(${t.join(" && ")})`)),[r.AP.Not]:x((([t])=>`(!${t})`)),[r.AP.Equal]:x((([t,e])=>`(${t} == ${e})`)),[r.AP.NotEqual]:x((([t,e])=>`(${t} != ${e})`)),[r.AP.GreaterThan]:x((([t,e])=>`(${t} > ${e})`)),[r.AP.GreaterThanOrEqualTo]:x((([t,e])=>`(${t} >= ${e})`)),[r.AP.LessThan]:x((([t,e])=>`(${t} < ${e})`)),[r.AP.LessThanOrEqualTo]:x((([t,e])=>`(${t} <= ${e})`)),[r.AP.Multiply]:x((t=>`(${t.join(" * ")})`)),[r.AP.Divide]:x((([t,e])=>`(${t} / ${e})`)),[r.AP.Add]:x((t=>`(${t.join(" + ")})`)),[r.AP.Subtract]:x((([t,e])=>`(${t} - ${e})`)),[r.AP.Clamp]:x((([t,e,i])=>`clamp(${t}, ${e}, ${i})`)),[r.AP.Mod]:x((([t,e])=>`mod(${t}, ${e})`)),[r.AP.Pow]:x((([t,e])=>`pow(${t}, ${e})`)),[r.AP.Abs]:x((([t])=>`abs(${t})`)),[r.AP.Floor]:x((([t])=>`floor(${t})`)),[r.AP.Ceil]:x((([t])=>`ceil(${t})`)),[r.AP.Round]:x((([t])=>`floor(${t} + 0.5)`)),[r.AP.Sin]:x((([t])=>`sin(${t})`)),[r.AP.Cos]:x((([t])=>`cos(${t})`)),[r.AP.Atan]:x((([t,e])=>void 0!==e?`atan(${t}, ${e})`:`atan(${t})`)),[r.AP.Sqrt]:x((([t])=>`sqrt(${t})`)),[r.AP.Match]:x((t=>{const e=t[0],i=t[t.length-1];let n=null;for(let r=t.length-3;r>=1;r-=2){n=`(${e} == ${t[r]} ? ${t[r+1]} : ${n||i})`}return n})),[r.AP.Between]:x((([t,e,i])=>`(${t} >= ${e} && ${t} <= ${i})`)),[r.AP.Interpolate]:x((([t,e,...i])=>{let n="";for(let r=0;r{const e=t[t.length-1];let i=null;for(let n=t.length-3;n>=0;n-=2){i=`(${t[n]} ? ${t[n+1]} : ${i||e})`}return i})),[r.AP.In]:x((([t,...e],i)=>{const n=function(t,e){return`operator_${t}_${Object.keys(e.functions).length}`}("in",i),r=[];for(let t=0;t`vec${t.length}(${t.join(", ")})`)),[r.AP.Color]:x((t=>{if(1===t.length)return`vec4(vec3(${t[0]} / 255.0), 1.0)`;if(2===t.length)return`(${t[1]} * vec4(vec3(${t[0]} / 255.0), 1.0))`;const e=t.slice(0,3).map((t=>`${t} / 255.0`));if(3===t.length)return`vec4(${e.join(", ")}, 1.0)`;return`(${t[3]} * vec4(${e.join(", ")}, 1.0))`})),[r.AP.Band]:x((([t,e,i],n)=>{if(!(m in n.functions)){let t="";const e=n.bandCount||1;for(let i=0;i{const[i,...s]=e.args,a=s.length,l=new Uint8Array(4*a);for(let t=0;t0)return a(t.value);if((t.type&r.wy)>0)return t.value.toString();if((t.type&r.uW)>0)return f(t.value.toString());if((t.type&r.Mr)>0)return h(t.value);if((t.type&r.PA)>0)return l(t.value);throw new Error(`Unexpected expression ${t.value} (expected type ${(0,r.hD)(e)})`)}},36117:function(t,e,i){"use strict";i.d(e,{Cf:function(){return U},Cr:function(){return A},EO:function(){return N},Ed:function(){return L},GN:function(){return m},H6:function(){return w},H9:function(){return G},HK:function(){return p},I7:function(){return z},MV:function(){return B},Ne:function(){return j},T9:function(){return f},Wj:function(){return v},Xv:function(){return O},YN:function(){return g},b8:function(){return l},bg:function(){return S},d9:function(){return o},dY:function(){return I},dz:function(){return Z},f3:function(){return s},fS:function(){return _},g0:function(){return P},hC:function(){return C},hI:function(){return r},iW:function(){return y},jE:function(){return u},kK:function(){return k},l7:function(){return x},lJ:function(){return d},p8:function(){return R},pX:function(){return c},qP:function(){return E},qf:function(){return a},qg:function(){return M},r4:function(){return h},rL:function(){return F},w$:function(){return T},xb:function(){return D}});var n=i(24743);function r(t){const e=d();for(let i=0,n=t.length;is&&(h|=n.Z.RIGHT),lo&&(h|=n.Z.ABOVE),h===n.Z.UNKNOWN&&(h=n.Z.INTERSECTING),h}function d(){return[1/0,1/0,-1/0,-1/0]}function f(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function g(t){return f(1/0,1/0,-1/0,-1/0,t)}function p(t,e){const i=t[0],n=t[1];return f(i,n,i,n,e)}function m(t,e,i,n,r){return E(g(r),t,e,i,n)}function _(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function y(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function v(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function E(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function D(t){return t[2]=a&&m<=h),r||!(o&n.Z.RIGHT)||s&n.Z.RIGHT||(_=g-(f-h)*p,r=_>=l&&_<=u),r||!(o&n.Z.BELOW)||s&n.Z.BELOW||(m=f-(g-l)/p,r=m>=a&&m<=h),r||!(o&n.Z.LEFT)||s&n.Z.LEFT||(_=g-(f-a)*p,r=_>=l&&_<=u)}return r}function j(t,e,i,n){if(D(t))return g(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=Z(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function B(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];U(t,e);const n=Z(i);if(Z(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}},24743:function(t,e){"use strict";e.Z={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16}},41773:function(t,e,i){"use strict";i.d(e,{Be:function(){return o},ov:function(){return s}});var n=i(79407);let r=!1;function s(t,e,i,n,s,o,a){const l=new XMLHttpRequest;l.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(l.responseType="arraybuffer"),l.withCredentials=r,l.onload=function(t){if(!l.status||l.status>=200&&l.status<300){const t=e.getType();let n;"json"==t?n=JSON.parse(l.responseText):"text"==t?n=l.responseText:"xml"==t?(n=l.responseXML,n||(n=(new DOMParser).parseFromString(l.responseText,"application/xml"))):"arraybuffer"==t&&(n=l.response),n?o(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):a()}else a()},l.onerror=a,l.send()}function o(t,e){return function(i,r,o,a,l){const h=this;s(t,e,i,r,o,(function(t,e){h.addFeatures(t),void 0!==a&&a(t)}),l||n.Zn)}}},15240:function(t,e,i){"use strict";var n=i(79619),r=i(97261),s=i(15925),o=i(73479),a=i(54729),l=i(16667),h=i(58105),u=i(47051),c=i(23814),d=i(36117),f=i(61734),g=i(81625),p=i(4891),m=i(71313),_=i(15113);const y={Point:function(t){let e;e=void 0!==t.m&&void 0!==t.z?new u.Z([t.x,t.y,t.z,t.m],"XYZM"):void 0!==t.z?new u.Z([t.x,t.y,t.z],"XYZ"):void 0!==t.m?new u.Z([t.x,t.y,t.m],"XYM"):new u.Z([t.x,t.y]);return e},LineString:function(t){const e=b(t);return new s.Z(t.paths[0],e)},Polygon:function(t){const e=b(t);return new c.ZP(t.rings,e)},MultiPoint:function(t){const e=b(t);return new l.Z(t.points,e)},MultiLineString:function(t){const e=b(t);return new a.Z(t.paths,e)},MultiPolygon:function(t){const e=b(t);return new h.Z(t.rings,e)}},x={Point:function(t,e){const i=t.getCoordinates();let n;const r=t.getLayout();if("XYZ"===r)n={x:i[0],y:i[1],z:i[2]};else if("XYM"===r)n={x:i[0],y:i[1],m:i[2]};else if("XYZM"===r)n={x:i[0],y:i[1],z:i[2],m:i[3]};else{if("XY"!==r)throw new Error("Invalid geometry layout");n={x:i[0],y:i[1]}}return n},LineString:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){const i=w(t),n=t.getCoordinates(!1),r=[];for(let t=0;t=0;e--)r.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:r}}};class v extends r.Z{constructor(t){t=t||{},super(),this.geometryName_=t.geometryName}readFeatureFromObject(t,e,i){const r=t,s=E(r.geometry,e),o=new n.Z;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(s),r.attributes){o.setProperties(r.attributes,!0);const t=r.attributes[i];void 0!==t&&o.setId(t)}return o}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let r=0,s=n.length;r=0;s--){const i=n[s][0];if((0,d.r4)(new o.Z(i).getExtent(),new o.Z(t).getExtent())){n[s].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===r.length?(i="Polygon",t=Object.assign({},t,{rings:r[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:r}))}const n=y[i];return(0,_.fI)(n(t),!1,e)}function b(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function w(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function S(t,e){return(0,x[t.getType()])((0,_.fI)(t,!0,e),e)}e.Z=v},15113:function(t,e,i){"use strict";i.d(e,{YU:function(){return x},fI:function(){return p},lj:function(){return m},zg:function(){return y}});var n=i(79619),r=i(33321),s=i(47051),o=i(15925),a=i(23814),l=i(16667),h=i(54729),u=i(58105),c=i(54017),d=i(22765),f=i(81625),g=i(71313);function p(t,e,i){const n=i?(0,f.U2)(i.featureProjection):null,r=i?(0,f.U2)(i.dataProjection):null;let s=t;if(n&&r&&!(0,f.OP)(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform((0,f.Ck)(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;iy({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const s=i.layout.length;return p(new r.ZP(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?((0,g.Oj)(t,0,e,i)||(t=t.slice(),(0,g.dL)(t,0,e,i)),t):((0,g.$v)(t,0,e,i)||(t=t.slice(),(0,g.zX)(t,0,e,i)),t)}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat(),s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function x(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>x(t,e)));return new c.Z(i)}return p(new(0,_[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}},64944:function(t,e,i){"use strict";var n=i(65878),r=i(31990),s=i(36117),o=i(81625),a=i(15113),l=i(96683);const h=n.J+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",u={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class c extends n.Z{constructor(t){super(t=t||{}),this.FEATURE_COLLECTION_PARSERS[n.J].featureMember=(0,r.Ei)(this.readFeaturesInternal),this.schemaLocation=t.schemaLocation?t.schemaLocation:h}readFlatCoordinates(t,e){const i=(0,r.Ve)(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName;let s="enu";if(n){const t=(0,o.U2)(n);t&&(s=t.getAxisOrientation())}const a=i.trim().split(/\s+/),l=[];for(let t=0,e=a.length;t0&&!(t instanceof r.Z)){t={_content_:t};for(let e=0;e0;else{const e=t.getType();l="Point"===e||"MultiPoint"===e}}l&&(h=o.get("name"),l=l&&!!h,l&&/&[^&]+;/.test(h)&&(W||(W=document.createElement("textarea")),W.innerHTML=h,h=W.value));let c=i;if(t?c=t:e&&(c=Q(e,i,n)),l){const t=function(t,e){const i=[0,0];let n="start";const r=t.getImage();if(r){const t=r.getSize();if(t&&2==t.length){const e=r.getScaleArray(),s=r.getAnchor();i[0]=e[0]*(t[0]-s[0]),i[1]=e[1]*(t[1]/2-s[1]),n="left"}}let s=t.getText();s?(s=s.clone(),s.setFont(s.getFont()||X.getFont()),s.setScale(s.getScale()||X.getScale()),s.setFill(s.getFill()||X.getFill()),s.setStroke(s.getStroke()||q)):s=X.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);const o=new p.ZP({image:r,text:s});return o}(c[0],h);if(u.length>0){t.setGeometry(new s.Z(u));return[t,new p.ZP({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null})].concat(c.slice(1))}return t}return c}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);r.setStyle(t)}return delete i.Style,r.setProperties(i,!0),r}readSharedStyle_(t,e){const i=t.getAttribute("id");if(null!==i){const n=Pt.call(this,t,e);if(n){let e,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){e=new URL("#"+i,r).href}else e="#"+i;this.sharedStyles_[e]=n}}}readSharedStyleMap_(t,e){const i=t.getAttribute("id");if(null===i)return;const n=ot.call(this,t,e);if(!n)return;let r,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){r=new URL("#"+i,s).href}else r="#"+i;this.sharedStyles_[r]=n}readFeatureFromNode(t,e){if(!T.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!T.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&(0,v.l7)(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=(0,y.Qc)(t);return this.readNameFromDocument(e)}return(0,y.qk)(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(T.includes(e.namespaceURI)&&"name"==e.localName)return(0,b.s2)(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(T.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readNetworkLinksFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readNetworkLinksFromDocument(t)):(0,v.l7)(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&(0,v.l7)(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=(0,y.O)({},R,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||(0,v.l7)(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readRegionFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readRegionFromDocument(t)):(0,v.l7)(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&(0,v.l7)(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"Region"==i.localName){const t=(0,y.O)({},L,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||(0,v.l7)(e,this.readRegionFromNode(i))}return e}readCamera(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readCameraFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readCameraFromDocument(t)):(0,v.l7)(e,this.readCameraFromNode(t));return e}readCameraFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&(0,v.l7)(e,this.readCameraFromNode(i));return e}readCameraFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"Camera"===i.localName){const t=(0,y.O)({},A,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!==t&&"Folder"!==t&&"Placemark"!==t&&"kml"!==t||(0,v.l7)(e,this.readCameraFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=(0,y.c)(T[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",C[0]),i.setAttributeNS(n,"xmlns:xsi",y.fJ),i.setAttributeNS(y.fJ,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const r={node:i},s={};t.length>1?s.Document=t:1==t.length&&(s.Placemark=t[0]);const o=F[i.namespaceURI],a=(0,y.RA)(s,o);return(0,y.ZL)(r,O,y.hg,a,[e],o,this),i}}function Q(t,e,i){return Array.isArray(t)?t:"string"==typeof t?Q(i[t],e,i):e}function tt(t){const e=(0,y.Ve)(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){const t=i[1];return[parseInt(t.substr(6,2),16),parseInt(t.substr(4,2),16),parseInt(t.substr(2,2),16),parseInt(t.substr(0,2),16)/255]}}function et(t){let e=(0,y.Ve)(t,!1);const i=[];e=e.replace(/\s*,\s*/g,",");const n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;let r;for(;r=n.exec(e);){const t=parseFloat(r[1]),n=parseFloat(r[2]),s=r[3]?parseFloat(r[3]):0;i.push(t,n,s),e=e.substr(r[0].length)}if(""===e)return i}function it(t){const e=(0,y.Ve)(t,!1).trim();let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function nt(t){const e=(0,y.Ve)(t,!1).trim().replace(/^(?!.*#)/,"#");let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function rt(t){return(0,b.fy)(t)}const st=(0,y.C5)(T,{Pair:function(t,e){const i=(0,y.O)({},Ot,t,e,this);if(!i)return;const n=i.key;if(n&&"normal"==n){const t=i.styleUrl;t&&(e[e.length-1]=t);const n=i.Style;n&&(e[e.length-1]=n)}}});function ot(t,e){return(0,y.O)(void 0,st,t,e,this)}const at=(0,y.C5)(T,{Icon:(0,y.Pr)((function(t,e){const i=(0,y.O)({},mt,t,e);if(i)return i;return null})),color:(0,y.Pr)(tt),heading:(0,y.Pr)(b.fy),hotSpot:(0,y.Pr)((function(t){const e=t.getAttribute("xunits"),i=t.getAttribute("yunits");let n;return n="insetPixels"!==e?"insetPixels"!==i?"bottom-left":"top-left":"insetPixels"!==i?"bottom-right":"top-right",{x:parseFloat(t.getAttribute("x")),xunits:M[e],y:parseFloat(t.getAttribute("y")),yunits:M[i],origin:n}})),scale:(0,y.Pr)(rt)});const lt=(0,y.C5)(T,{color:(0,y.Pr)(tt),scale:(0,y.Pr)(rt)});const ht=(0,y.C5)(T,{color:(0,y.Pr)(tt),width:(0,y.Pr)(b.fy)});const ut=(0,y.C5)(T,{color:(0,y.Pr)(tt),fill:(0,y.Pr)(b.ud),outline:(0,y.Pr)(b.ud)});const ct=(0,y.C5)(T,{coordinates:(0,y.z)(et)});function dt(t,e){return(0,y.O)(null,ct,t,e)}const ft=(0,y.C5)(C,{Track:(0,y.Ei)(pt)});const gt=(0,y.C5)(T,{when:function(t,e){const i=e[e.length-1].whens,n=(0,y.Ve)(t,!1),r=Date.parse(n);i.push(isNaN(r)?0:r)}},(0,y.C5)(C,{coord:function(t,e){const i=e[e.length-1].coordinates,n=(0,y.Ve)(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(r){const t=parseFloat(r[1]),e=parseFloat(r[2]),n=parseFloat(r[3]);i.push([t,e,n])}else i.push([])}}));function pt(t,e){const i=(0,y.O)({coordinates:[],whens:[]},gt,t,e);if(!i)return;const n=[],r=i.coordinates,s=i.whens;for(let t=0,e=Math.min(r.length,s.length);t0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=(0,y.O)(void 0,Gt,t,e);if(i){e[e.length-1][0]=i}}});function Tt(t,e){const i=(0,y.O)({},xt,t,e),n=(0,y.O)([null],Ct,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i0;let l;const h=r.href;let u,c,d;h?l=h:s&&(l=z);let f="bottom-left";const g=i.hotSpot;let p;g?(u=[g.x,g.y],c=g.xunits,d=g.yunits,f=g.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(l)&&(l.includes("pushpin")?(u=k,c=D,d=N):l.includes("arrow-reverse")?(u=[54,42],c=D,d=N):l.includes("paddle")&&(u=[32,1],c=D,d=N));const m=r.x,_=r.y;let x;void 0!==m&&void 0!==_&&(p=[m,_]);const v=r.w,E=r.h;let b;void 0!==v&&void 0!==E&&(x=[v,E]);const S=i.heading;void 0!==S&&(b=(0,w.Yr)(S));const C=i.scale,T=i.color;if(s){l==z&&(x=G);const t=new o.Z({anchor:u,anchorOrigin:f,anchorXUnits:c,anchorYUnits:d,crossOrigin:this.crossOrigin_,offset:p,offsetOrigin:"bottom-left",rotation:b,scale:C,size:x,src:this.iconUrlFunction_(l),color:T}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===a.Z.IDLE||i===a.Z.LOADING){const n=function(){const i=t.getImageState();if(i!==a.Z.IDLE&&i!==a.Z.LOADING){const i=t.getSize();if(i&&2==i.length){const n=H(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===a.Z.IDLE&&t.load()}}else if(2==i.length){const n=H(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=U},LabelStyle:function(t,e){const i=(0,y.O)({},lt,t,e);if(!i)return;const n=e[e.length-1],s=new m.Z({fill:new r.Z({color:"color"in i?i.color:Z}),scale:i.scale});n.textStyle=s},LineStyle:function(t,e){const i=(0,y.O)({},ht,t,e);if(!i)return;const n=e[e.length-1],r=new g.Z({color:"color"in i?i.color:Z,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=(0,y.O)({},ut,t,e);if(!i)return;const n=e[e.length-1],s=new r.Z({color:"color"in i?i.color:Z});n.fillStyle=s;const o=i.fill;void 0!==o&&(n.fill=o);const a=i.outline;void 0!==a&&(n.outline=a)}});function Pt(t,e){const i=(0,y.O)({},Mt,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:j;const r=i.fill;let o;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=U&&(o=i.imageStyle):o=B;const a="textStyle"in i?i.textStyle:X,l="strokeStyle"in i?i.strokeStyle:V,h=i.outline;return void 0===h||h?[new p.ZP({fill:n,image:o,stroke:l,text:a,zIndex:void 0})]:[new p.ZP({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){const t=e;return new s.Z(t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:o,stroke:l,text:a,zIndex:void 0}),new p.ZP({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){const t=e;return new s.Z(t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function Rt(t,e){const i=e.length,n=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let t=0;t0){const t={names:o,values:(0,y.RA)(r,o)};(0,y.ZL)(n,ue,de,[t],i)}const c=i[0];let d=e.getGeometry();d&&(d=(0,S.fI)(d,!0,c)),(0,y.ZL)(n,ue,ee,[d],i)}const ge=(0,y.C5)(T,["extrude","tessellate","altitudeMode","coordinates"]),pe=(0,y.C5)(T,{extrude:(0,y.A4)(b.Vi),tessellate:(0,y.A4)(b.Vi),altitudeMode:(0,y.A4)(b.bZ),coordinates:(0,y.A4)((function(t,e,i){const n=i[i.length-1],r=n.layout,s=n.stride;let o;if("XY"==r||"XYM"==r)o=2;else{if("XYZ"!=r&&"XYZM"!=r)throw new Error("Invalid geometry layout");o=3}const a=e.length;let l="";if(a>0){l+=e[0];for(let t=1;t>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const l=e.type;if(0===l)return null;let c;const f=e.properties;let p;this.idProperty_?(p=f[this.idProperty_],delete f[this.idProperty_]):p=e.id,f[this.layerName_]=e.layer.name;const m=[],_=[];this.readRawGeometry_(t,e,m,_);const y=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(l,_.length);if(this.featureClass_===d.ZP)c=new this.featureClass_(y,m,_,2,f,p),c.transform(i.dataProjection);else{let t;if("Polygon"==y){const e=(0,g.Q3)(m,_);t=e.length>1?new a.Z(m,"XY",e):new u.ZP(m,"XY",_)}else t="Point"===y?new h.Z(m,"XY"):"LineString"===y?new r.Z(m,"XY"):"MultiPoint"===y?new o.Z(m,"XY"):"MultiLineString"===y?new s.Z(m,"XY",_):null;c=new(0,this.featureClass_),this.geometryName_&&c.setGeometryName(this.geometryName_);const e=(0,n.fI)(t,!1,i);c.setGeometry(e),void 0!==p&&c.setId(p),c.setProperties(f,!0)}return c}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const n=(0,f.U2)(e.dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new l(t),s=r.readFields(m,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function y(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e=0;--e)i.push(t[e].slice(0))}return i}function m(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=x;else if(","==t)i=b;else if(")"==t)i=v;else if(this.isNumeric_(t)||"-"==t)i=E,n=this.readNumber_();else if(this.isAlpha_(t))i=y,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=w}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class T{constructor(t){this.lexer_=t,this.token_={position:0,type:_},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(y)){const i=e.value;i===p?t="XYZ":i===m?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(x)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(b));if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(x)){const t=this.parsePoint_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(x)){const t=this.parsePointList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(x)){const t=this.parseLineStringTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(x)){let t;if(t=this.token_.type==x?this.parsePointTextList_():this.parsePointList_(),this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(x)){const t=this.parseLineStringTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(x)){const t=this.parsePolygonTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i0&&(n+=" "+e)}return 0===i.length?n+" "+g:n+"("+i+")"}e.Z=M},23120:function(t,e,i){"use strict";i.d(e,{Z:function(){return j}});var n=i(33799),r=i(31990),s=i(75125),o=i(96683);const a=[null,"http://www.opengis.net/ows/1.1"],l=(0,r.C5)(a,{ServiceIdentification:(0,r.Pr)((function(t,e){return(0,r.O)({},E,t,e)})),ServiceProvider:(0,r.Pr)((function(t,e){return(0,r.O)({},b,t,e)})),OperationsMetadata:(0,r.Pr)((function(t,e){return(0,r.O)({},_,t,e)}))});class h extends n.Z{constructor(){super()}readFromNode(t){const e=(0,r.O)({},l,t,[]);return e||null}}const u=(0,r.C5)(a,{DeliveryPoint:(0,r.Pr)(o.s2),City:(0,r.Pr)(o.s2),AdministrativeArea:(0,r.Pr)(o.s2),PostalCode:(0,r.Pr)(o.s2),Country:(0,r.Pr)(o.s2),ElectronicMailAddress:(0,r.Pr)(o.s2)}),c=(0,r.C5)(a,{Value:(0,r.ke)((function(t,e){return(0,o.s2)(t)}))}),d=(0,r.C5)(a,{AllowedValues:(0,r.Pr)((function(t,e){return(0,r.O)({},c,t,e)}))}),f=(0,r.C5)(a,{Phone:(0,r.Pr)((function(t,e){return(0,r.O)({},y,t,e)})),Address:(0,r.Pr)((function(t,e){return(0,r.O)({},u,t,e)}))}),g=(0,r.C5)(a,{HTTP:(0,r.Pr)((function(t,e){return(0,r.O)({},p,t,e)}))}),p=(0,r.C5)(a,{Get:(0,r.ke)((function(t,e){const i=(0,s.Q)(t);if(!i)return;return(0,r.O)({href:i},x,t,e)})),Post:void 0}),m=(0,r.C5)(a,{DCP:(0,r.Pr)((function(t,e){return(0,r.O)({},g,t,e)}))}),_=(0,r.C5)(a,{Operation:function(t,e){const i=t.getAttribute("name"),n=(0,r.O)({},m,t,e);if(!n)return;e[e.length-1][i]=n}}),y=(0,r.C5)(a,{Voice:(0,r.Pr)(o.s2),Facsimile:(0,r.Pr)(o.s2)}),x=(0,r.C5)(a,{Constraint:(0,r.ke)((function(t,e){const i=t.getAttribute("name");if(!i)return;return(0,r.O)({name:i},d,t,e)}))}),v=(0,r.C5)(a,{IndividualName:(0,r.Pr)(o.s2),PositionName:(0,r.Pr)(o.s2),ContactInfo:(0,r.Pr)((function(t,e){return(0,r.O)({},f,t,e)}))}),E=(0,r.C5)(a,{Abstract:(0,r.Pr)(o.s2),AccessConstraints:(0,r.Pr)(o.s2),Fees:(0,r.Pr)(o.s2),Title:(0,r.Pr)(o.s2),ServiceTypeVersion:(0,r.Pr)(o.s2),ServiceType:(0,r.Pr)(o.s2)}),b=(0,r.C5)(a,{ProviderName:(0,r.Pr)(o.s2),ProviderSite:(0,r.Pr)(s.Q),ServiceContact:(0,r.Pr)((function(t,e){return(0,r.O)({},v,t,e)}))});var w=h,S=i(36117);const C=[null,"http://www.opengis.net/wmts/1.0"],T=[null,"http://www.opengis.net/ows/1.1"],M=(0,r.C5)(C,{Contents:(0,r.Pr)((function(t,e){return(0,r.O)({},R,t,e)}))});class P extends n.Z{constructor(){super(),this.owsParser_=new w}readFromNode(t){let e=t.getAttribute("version");e&&(e=e.trim());let i=this.owsParser_.readFromNode(t);return i?(i.version=e,i=(0,r.O)(i,M,t,[]),i||null):null}}const R=(0,r.C5)(C,{Layer:(0,r.ke)((function(t,e){return(0,r.O)({},I,t,e)})),TileMatrixSet:(0,r.ke)((function(t,e){return(0,r.O)({},D,t,e)}))}),I=(0,r.C5)(C,{Style:(0,r.ke)((function(t,e){const i=(0,r.O)({},A,t,e);if(!i)return;const n="true"===t.getAttribute("isDefault");return i.isDefault=n,i})),Format:(0,r.ke)(o.s2),TileMatrixSetLink:(0,r.ke)((function(t,e){return(0,r.O)({},L,t,e)})),Dimension:(0,r.ke)((function(t,e){return(0,r.O)({},Z,t,e)})),ResourceURL:(0,r.ke)((function(t,e){const i=t.getAttribute("format"),n=t.getAttribute("template"),r=t.getAttribute("resourceType"),s={};i&&(s.format=i);n&&(s.template=n);r&&(s.resourceType=r);return s}))},(0,r.C5)(T,{Title:(0,r.Pr)(o.s2),Abstract:(0,r.Pr)(o.s2),WGS84BoundingBox:(0,r.Pr)(G),Identifier:(0,r.Pr)(o.s2)})),A=(0,r.C5)(C,{LegendURL:(0,r.ke)((function(t,e){const i={};return i.format=t.getAttribute("format"),i.href=(0,s.Q)(t),i}))},(0,r.C5)(T,{Title:(0,r.Pr)(o.s2),Identifier:(0,r.Pr)(o.s2)})),L=(0,r.C5)(C,{TileMatrixSet:(0,r.Pr)(o.s2),TileMatrixSetLimits:(0,r.Pr)((function(t,e){return(0,r.O)([],F,t,e)}))}),F=(0,r.C5)(C,{TileMatrixLimits:(0,r.Ei)((function(t,e){return(0,r.O)({},O,t,e)}))}),O=(0,r.C5)(C,{TileMatrix:(0,r.Pr)(o.s2),MinTileRow:(0,r.Pr)(o.$L),MaxTileRow:(0,r.Pr)(o.$L),MinTileCol:(0,r.Pr)(o.$L),MaxTileCol:(0,r.Pr)(o.$L)}),Z=(0,r.C5)(C,{Default:(0,r.Pr)(o.s2),Value:(0,r.ke)(o.s2)},(0,r.C5)(T,{Identifier:(0,r.Pr)(o.s2)})),k=(0,r.C5)(T,{LowerCorner:(0,r.Ei)(z),UpperCorner:(0,r.Ei)(z)}),D=(0,r.C5)(C,{WellKnownScaleSet:(0,r.Pr)(o.s2),TileMatrix:(0,r.ke)((function(t,e){return(0,r.O)({},N,t,e)}))},(0,r.C5)(T,{SupportedCRS:(0,r.Pr)(o.s2),Identifier:(0,r.Pr)(o.s2),BoundingBox:(0,r.Pr)(G)})),N=(0,r.C5)(C,{TopLeftCorner:(0,r.Pr)(z),ScaleDenominator:(0,r.Pr)(o.fy),TileWidth:(0,r.Pr)(o.$L),TileHeight:(0,r.Pr)(o.$L),MatrixWidth:(0,r.Pr)(o.$L),MatrixHeight:(0,r.Pr)(o.$L)},(0,r.C5)(T,{Identifier:(0,r.Pr)(o.s2)}));function G(t,e){const i=(0,r.O)([],k,t,e);if(2==i.length)return(0,S.hI)(i)}function z(t,e){const i=(0,o.s2)(t).split(/\s+/);if(!i||2!=i.length)return;const n=+i[0],r=+i[1];return isNaN(n)||isNaN(r)?void 0:[n,r]}var j=P},33799:function(t,e,i){"use strict";var n=i(22765),r=i(31990);e.Z=class{read(t){if(!t)return null;if("string"==typeof t){const e=(0,r.Qc)(t);return this.readFromDocument(e)}return(0,r.qk)(t)?this.readFromDocument(t):this.readFromNode(t)}readFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null}readFromNode(t){(0,n.O3)()}}},96148:function(t,e,i){"use strict";var n=i(15113),r=i(22765),s=i(17367),o=i(31990);class a extends n.ZP{constructor(){super(),this.xmlSerializer_=(0,o.xc)()}getType(){return"xml"}readFeature(t,e){if(!t)return null;if("string"==typeof t){const i=(0,o.Qc)(t);return this.readFeatureFromDocument(i,e)}return(0,o.qk)(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}readFeatureFromDocument(t,e){const i=this.readFeaturesFromDocument(t,e);return i.length>0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=(0,o.Qc)(t);return this.readFeaturesFromDocument(i,e)}return(0,o.qk)(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&(0,s.l7)(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return(0,r.O3)()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=(0,o.Qc)(t);return this.readGeometryFromDocument(i,e)}return(0,o.qk)(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(!t)return null;if("string"==typeof t){const e=(0,o.Qc)(t);return this.readProjectionFromDocument(e)}return(0,o.qk)(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(t,e){return null}}e.Z=a},75125:function(t,e,i){"use strict";i.d(e,{Q:function(){return r}});const n="http://www.w3.org/1999/xlink";function r(t){return t.getAttributeNS(n,"href")}},96683:function(t,e,i){"use strict";i.d(e,{$L:function(){return u},JD:function(){return _},Vi:function(){return f},_E:function(){return c},bZ:function(){return y},ej:function(){return h},f3:function(){return m},fy:function(){return l},hv:function(){return p},s2:function(){return d},ud:function(){return s},v$:function(){return o},x7:function(){return a},xO:function(){return g}});var n=i(31990),r=i(84441);function s(t){return o((0,n.Ve)(t,!1))}function o(t){const e=/^\s*(true|1)|(false|0)\s*$/.exec(t);if(e)return void 0!==e[1]||!1}function a(t){const e=(0,n.Ve)(t,!1),i=Date.parse(e);return isNaN(i)?void 0:i/1e3}function l(t){return h((0,n.Ve)(t,!1))}function h(t){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);if(e)return parseFloat(e[1])}function u(t){return c((0,n.Ve)(t,!1))}function c(t){const e=/^\s*(\d+)\s*$/.exec(t);if(e)return parseInt(e[1],10)}function d(t){return(0,n.Ve)(t,!1).trim()}function f(t,e){y(t,e?"1":"0")}function g(t,e){t.appendChild((0,n.Me)().createCDATASection(e))}function p(t,e){const i=new Date(1e3*e),s=i.getUTCFullYear()+"-"+(0,r.v)(i.getUTCMonth()+1,2)+"-"+(0,r.v)(i.getUTCDate(),2)+"T"+(0,r.v)(i.getUTCHours(),2)+":"+(0,r.v)(i.getUTCMinutes(),2)+":"+(0,r.v)(i.getUTCSeconds(),2)+"Z";t.appendChild((0,n.Me)().createTextNode(s))}function m(t,e){const i=e.toPrecision();t.appendChild((0,n.Me)().createTextNode(i))}function _(t,e){const i=e.toString();t.appendChild((0,n.Me)().createTextNode(i))}function y(t,e){t.appendChild((0,n.Me)().createTextNode(e))}},79407:function(t,e,i){"use strict";i.d(e,{Dv:function(){return s},Vi:function(){return l},Zn:function(){return o},qe:function(){return a},uX:function(){return r}});var n=i(17367);function r(){return!0}function s(){return!1}function o(){}function a(t){let e,i,r,s=!1;return function(){const o=Array.prototype.slice.call(arguments);return s&&this===r&&(0,n.fS)(o,i)||(s=!0,r=this,i=o,e=t.apply(this,arguments)),e}}function l(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}},83735:function(t,e,i){"use strict";var n=i(75531),r=i(36117),s=i(61734),o=i(11570);class a extends n.ZP{constructor(t,e,i){super(),void 0!==i&&void 0===e?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new a(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=t-r[0],o=e-r[1],a=s*s+o*o;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||(0,r.H6)(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return(0,r.O3)()}closestPointXY(t,e,i,n){return(0,r.O3)()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return(0,r.O3)()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&(0,o.YN)(t),this.extentRevision_=this.getRevision()}return(0,o.EO)(this.extent_,t)}rotate(t,e){(0,r.O3)()}scale(t,e,i){(0,r.O3)()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return(0,r.O3)()}getType(){return(0,r.O3)()}applyTransform(t){(0,r.O3)()}intersectsExtent(t){return(0,r.O3)()}translate(t,e){(0,r.O3)()}transform(t,e){const i=(0,a.U2)(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const l=i.getExtent(),c=i.getWorldExtent(),d=(0,o.Cr)(c)/(0,o.Cr)(l);return(0,s.qC)(u,c[0],c[3],d,-d,0,0,0),(0,h.vT)(t,0,t.length,r,u,n),(0,a.Ck)(i,e)(t,n,r)}:(0,a.Ck)(i,e);return this.applyTransform(n),this}}e.Z=c},54017:function(t,e,i){"use strict";var n=i(92486),r=i(2667),s=i(36117),o=i(41507);class a extends r.Z{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(o.bN),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;et.clone()))}e.Z=a},15925:function(t,e,i){"use strict";var n=i(75531),r=i(32150),s=i(36117),o=i(61734),a=i(67775),l=i(17367),h=i(47511),u=i(2083),c=i(74985),d=i(85473),f=i(14071);class g extends n.ZP{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){(0,l.l7)(this.flatCoordinates,t),this.changed()}clone(){const t=new g(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<(0,s.qf)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.Bv)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.H$)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return(0,h.E)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,(0,c.iJ)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return(0,u.Ml)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return(0,c.WW)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return(0,f.W)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.dt)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new g(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return(0,d.Kz)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.Sg)(this.flatCoordinates,0,t,this.stride),this.changed()}}e.Z=g},73479:function(t,e,i){"use strict";var n=i(75531),r=i(32150),s=i(36117),o=i(61734),a=i(67775),l=i(2083),h=i(85749);class u extends n.ZP{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new u(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<(0,s.qf)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.Bv)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.H$)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return(0,h.QQ)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return(0,l.Ml)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.dt)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new u(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.Sg)(this.flatCoordinates,0,t,this.stride),this.changed()}}e.Z=u},54729:function(t,e,i){"use strict";var n=i(15925),r=i(75531),s=i(32150),o=i(36117),a=i(61734),l=i(67775),h=i(17367),u=i(2083),c=i(74985),d=i(85473);class f extends r.ZP{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t1)d=i;else{if(f>0){for(let s=0;ss&&(s=l),o=i,a=r}return s}function o(t,e,i,n,r){for(let o=0,a=i.length;os&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function o(t,e,i,n,r,o){if(0===i.length)return!1;if(!s(t,e,i[0],n,r,o))return!1;for(let e=1,a=i.length;ex&&(c=(d+f)/2,(0,r.wY)(t,e,i,s,c,m)&&(y=c,x=n)),d=f}return isNaN(y)&&(y=o[a]),l?(l.push(y,m,x),l):[y,m,x]}function o(t,e,i,n,r){let o=[];for(let a=0,l=i.length;a1?l:2,a=a||new Array(l);for(let e=0;e>1;s=o[0]&&a[2]<=o[2]||(a[1]>=o[1]&&a[3]<=o[3]||(0,r.E)(t,e,i,s,(function(t,e){return(0,n.I7)(o,t,e)})))))}function a(t,e,i,n,r){for(let s=0,a=i.length;s0}function s(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,a=i.length;o0;){const i=u.pop(),o=u.pop();let a=0;const l=t[o],d=t[o+1],f=t[i],g=t[i+1];for(let e=o+r;ea&&(c=e,a=s)}a>s&&(h[(c-e)/r]=1,o+r0&&p>f)&&(g<0&&m0&&m>g)?(l=i,h=d):(s[a++]=l,s[a++]=h,u=l,c=h,l=i,h=d)}return s[a++]=l,s[a++]=h,a}function l(t,e,i,n,r,s,o,l){for(let h=0,u=i.length;h0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new u(h,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[(0,l.oL)(e,r.Z.DROP,this.handleDrop,this),(0,l.oL)(e,r.Z.DRAGENTER,this.handleStop,this),(0,l.oL)(e,r.Z.DRAGOVER,this.handleStop,this),(0,l.oL)(e,r.Z.DROP,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.registerListeners_(),this.getActive()&&!t&&this.unregisterListeners_(),super.setActive(t)}setMap(t){this.unregisterListeners_(),super.setMap(t),this.getActive()&&this.registerListeners_()}tryReadFeatures_(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(l.bN),this.dropListenKeys_=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new g(c,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new g(e?d:f,t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new g(u,t.coordinate,t)),!0)}onBoxEnd(t){}}var m=p},35688:function(t,e,i){"use strict";var n=i(53382),r=i(79407),s=i(94142),o=i(70076),a=i(19775);class l extends n.Z{constructor(t){super({stopDown:r.Dv}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:(0,s.$6)(s.rM,s.Xp);this.condition_=t.onFocusOnly?(0,s.$6)(s.yZ,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,r=e.getEventPixel((0,n.S)(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const e=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],i=t.map.getView();(0,a.bA)(e,i.getResolution()),(0,a.U1)(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),a=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(a),duration:500,easing:o.Vv})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}e.Z=l},18930:function(t,e,i){"use strict";var n=i(53382),r=i(94142);class s extends n.Z{constructor(t){super(t=t||{}),this.condition_=t.condition?t.condition:r.vY,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=void 0!==t.duration?t.duration:400}handleDragEvent(t){if(!(0,r.QL)(t))return;const e=t.map,i=e.getSize(),n=t.pixel,s=n[0]-i[0]/2,o=i[1]/2-n[1],a=Math.atan2(o,s),l=Math.sqrt(s*s+o*o),h=e.getView();if(void 0!==this.lastAngle_){const t=this.lastAngle_-a;h.adjustRotationInternal(t)}this.lastAngle_=a,void 0!==this.lastMagnitude_&&h.adjustResolutionInternal(this.lastMagnitude_/l),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/l),this.lastMagnitude_=l}handleUpEvent(t){if(!(0,r.QL)(t))return!0;const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1}handleDownEvent(t){return!!(0,r.QL)(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}}e.Z=s},59066:function(t,e,i){"use strict";i.d(e,{N_:function(){return B},dO:function(){return q}});var n=i(83735),r=i(6747),s=i(92486),o=i(79619),a=i(54017),l=i(1370),h=i(15925),u=i(84184),c=i(87556),d=i(54729),f=i(16667),g=i(58105),p=i(47051),m=i(53382),_=i(23814),y=i(1733),x=i(4711),v=i(79407),E=i(94142),b=i(36117),w=i(63312),S=i(80677),C=i(19775),T=i(81625),M=i(75531);const P="drawstart",R="drawend",I="drawabort";class A extends r.ZP{constructor(t,e){super(t),this.feature=e}}function L(t,e){return(0,w.bI)(t[0],t[1],e[0],e[1])}function F(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function O(t,e,i){let n,r;eo){return L(z(t,n),z(t,r))}let a=0;if(n=i?n-=i:n<0&&(n+=i);let s=n+1;s>=i&&(s-=i);const o=t[n],a=o[0],l=o[1],h=t[s];return[a+(h[0]-a)*r,l+(h[1]-l)*r]}class j extends m.Z{constructor(t){const e=t;e.stopDown||(e.stopDown=v.Dv),super(e),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:v.uX,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=function(t,e,i){const r=e||new n.Z([NaN,NaN]),s=(0,T.Vs)(t[0],i),o=(0,C.bI)(s,(0,T.Vs)(t[t.length-1],i));r.setCenterAndRadius(s,Math.sqrt(o),this.geometryLayout_);const a=(0,T.Cs)();return a&&r.transform(i,a),r};else{let e;"Point"===t?e=p.Z:"LineString"===t?e=h.Z:"Polygon"===t&&(e=_.ZP),i=function(i,n,r){return n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n}}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new y.Z({source:new x.Z({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:U(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:E.rM,this.freehandCondition_,t.freehand?this.freehandCondition_=E.Bx:this.freehandCondition_=t.freehandCondition?t.freehandCondition:E.vY,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(l.Z.ACTIVE,this.updateState_)}setTrace(t){let e;e=t?!0===t?E.Bx:t:E.Fi,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===s.Z.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===c.Z.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===c.Z.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===c.Z.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===c.Z.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===c.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===c.Z.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===c.Z.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout((()=>{this.handlePointerMove_(new u.Z(c.Z.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),n=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=(0,b.hI)([i,n]),s=this.traceSource_.getFeaturesInExtent(r);if(0===s.length)return;const o=function(t,e){const i=[];for(let n=0;nt.endIndex||!i&&et.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e=s;--e)n.push(F(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex&&(0,C.TE)(e.startPx,t.pixel)i.startIndex?hi.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let u=h.ring;if(e.targetIndex===a&&u){const t=z(h.coordinates,l),r=i.getPixelFromCoordinate(t);(0,C.TE)(r,e.startPx)>n&&(u=!1)}if(u){const t=h.coordinates,e=t.length,i=h.startIndex,n=l;if(ithis.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const s=this.mode_;if("Point"===s)i=!0;else if("Circle"===s)i=2===this.sketchCoords_.length;else if("LineString"===s)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===s){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,r=[t[0][0],t[0][t[0].length-2]],r=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,s=r.length;n=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):"Polygon"===s&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new f.Z([e])):"MultiLineString"===this.type_?t.setGeometry(new d.Z([e])):"MultiPolygon"===this.type_&&t.setGeometry(new g.Z([e])),this.dispatchEvent(new A(R,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new A(I,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;e(t[e]=!0,t)),{}),this.replace_=t.replace,this.prefix_=t.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this),this.trackedCallbacks_={},this.trackedValues_={}}getParamName_(t){return this.prefix_?this.prefix_+t:t}get_(t,e){return t.get(this.getParamName_(e))}set_(t,e,i){e in this.params_&&t.set(this.getParamName_(e),i)}delete_(t,e){e in this.params_&&t.delete(this.getParamName_(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.unregisterListeners_(e),t&&(this.initial_=!0,this.updateState_(),this.registerListeners_(t)))}registerListeners_(t){this.listenerKeys_.push((0,o.oL)(t,s.Z.MOVEEND,this.updateUrl_,this),(0,o.oL)(t.getLayerGroup(),n.Z.CHANGE,this.updateUrl_,this),(0,o.oL)(t,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(t){for(let t=0,e=this.listenerKeys_.length;t=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n=0;--t)this.insertVertex_(r[t],s)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n.getCenter(),r=i.featureSegments[0],s=i.featureSegments[1];r.segment[0]=e,r.segment[1]=e,s.segment[0]=e,s.segment[1]=e,this.rBush_.update((0,m.HK)(e),r);let o=n;const a=(0,E.Cs)();if(a){const e=t.map.getView().getProjection();o=o.clone().transform(a,e),o=(0,v.Bb)(o).transform(e,a)}this.rBush_.update(o.getExtent(),s)}else this.rBush_.update((0,m.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new M(T,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),s=function(t,e){return I(n,t,r)-I(n,e,r)};let o,l;if(this.hitDetection_){const i="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{i&&"Point"===i.getType()&&(i=new h.Z((0,E.lO)(i.getCoordinates(),r)));const n=i||t.getGeometry();if(t instanceof a.Z&&this.features_.getArray().includes(t)){l=n;const e=t.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:t,geometry:l,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!o){const t=(0,E.dY)((0,m.HK)(n,w),r),i=e.getView().getResolution()*this.pixelTolerance_,s=(0,E.Fj)((0,m.f3)(t,i,w),r);o=this.rBush_.getInExtent(s)}if(o&&o.length>0){const i=o.sort(s)[0],a=i.segment;let h=A(n,i,r);const u=e.getPixelFromCoordinate(h);let c=(0,_.TE)(t,u);if(l||c<=this.pixelTolerance_){const t={};if(t[(0,b.sq)(a)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-n[0],this.delta_[1]=h[1]-n[1]),"Circle"===i.geometry.getType()&&1===i.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(a[0]),r=e.getPixelFromCoordinate(a[1]),s=(0,_.bI)(u,n),l=(0,_.bI)(u,r);c=Math.sqrt(Math.min(s,l)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(h=s>l?a[1]:a[0]),this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);const d={};d[(0,b.sq)(i.geometry)]=!0;for(let e=1,i=o.length;e=0;--o)r=t[o],c=r[0],d=(0,b.sq)(c.feature),c.depth&&(d+="-"+c.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=c,e[d].index=c.index):1==r[1]&&(e[d].left=c,e[d].index=c.index+1);for(d in e){switch(u=e[d].right,l=e[d].left,a=e[d].index,h=a-1,c=void 0!==l?l:u,h<0&&(h=0),s=c.geometry,n=s.getCoordinates(),i=n,f=!1,s.getType()){case"MultiLineString":n[c.depth[0]].length>2&&(n[c.depth[0]].splice(a,1),f=!0);break;case"LineString":n.length>2&&(n.splice(a,1),f=!0);break;case"MultiPolygon":i=i[c.depth[1]];case"Polygon":i=i[c.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),f=!0,0===a&&(i.pop(),i.push(i[0]),h=i.length-1))}if(f){this.setGeometryCoordinates_(s,n);const e=[];if(void 0!==l&&(this.rBush_.remove(l),e.push(l.segment[0])),void 0!==u&&(this.rBush_.remove(u),e.push(u.segment[1])),void 0!==l&&void 0!==u){const t={depth:c.depth,feature:c.feature,geometry:c.geometry,index:h,segment:e};this.rBush_.insert((0,m.hI)(t.segment),t)}this.updateSegmentIndices_(s,a,c.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return f}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||(0,x.fS)(r.depth,i))&&r.index>e&&(r.index+=n)}))}}function R(t,e){return t.index-e.index}function I(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let r=n;if(1===e.index){const e=(0,E.Cs)();e&&(r=r.clone().transform(e,i));const n=(0,_.bI)(r.getCenter(),(0,E.Vs)(t,i)),s=Math.sqrt(n)-r.getRadius();return s*s}}const r=(0,E.Vs)(t,i);return S[0]=(0,E.Vs)(e.segment[0],i),S[1]=(0,E.Vs)(e.segment[1],i),(0,_.Bs)(r,S)}function A(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){let e=n;const r=(0,E.Cs)();return r&&(e=e.clone().transform(r,i)),(0,E.lO)(e.getClosestPoint((0,E.Vs)(t,i)),i)}const r=(0,E.Vs)(t,i);return S[0]=(0,E.Vs)(e.segment[0],i),S[1]=(0,E.Vs)(e.segment[1],i),(0,E.lO)((0,_.oL)(r,S),i)}function L(){const t=(0,y.Ly)();return function(e,i){return t.Point}}e.Z=P},89303:function(t,e,i){"use strict";var n=i(92486),r=i(58322),s=i(14768),o=i(94142),a=i(63312);class l extends r.ZP{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:o.Bx;this.condition_=t.onFocusOnly?(0,o.$6)(o.yZ,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==n.Z.WHEEL)return!0;const e=t.map,i=t.originalEvent;let r;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==n.Z.WHEEL&&(r=i.deltaY,s.V&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=s.MP),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),0===r)return!1;this.lastDelta_=r;const o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=e.getView();if("trackpad"===this.mode_&&!a.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-(0,a.uZ)(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),(0,r.FW)(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}e.Z=l},53382:function(t,e,i){"use strict";i.d(e,{S:function(){return o}});var n=i(58322),r=i(87556);class s extends n.ZP{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==r.Z.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==r.Z.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==r.Z.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==r.Z.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function o(t){const e=t.length;let i=0,n=0;for(let r=0;r=0;--i){const n=e[i];if(n!==this&&n instanceof y&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=(0,f.sq)(t);t.setStyle(_[i]),delete _[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[(0,f.sq)(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,a=this.getFeatures(),l=[],h=[];if(r){(0,u.Z)(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof o.Z&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),h.push(t),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.getLength()-1;t>=0;--t){const e=a.item(t),i=h.indexOf(e);i>-1?h.splice(i,1):(a.remove(e),l.push(e))}0!==h.length&&a.extend(h)}else{s.forEachFeatureAtPixel(t.pixel,((t,r)=>{if(t instanceof o.Z&&this.filter_(t,r))return!e&&!n||a.getArray().includes(t)?(i||n)&&a.getArray().includes(t)&&(l.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,r),h.push(t)),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=l.length-1;t>=0;--t)a.remove(l[t]);a.extend(h)}return(h.length>0||l.length>0)&&this.dispatchEvent(new m(p,h,l,t)),!0}}e.Z=y},62950:function(t,e,i){"use strict";i.d(e,{Z:function(){return E}});var n=i(8651),r=i(92486),s=i(53382),o=i(25626),a=i(70487),l=i(79407),h=i(6747);const u="snap";class c extends h.ZP{constructor(t,e){super(t),this.vertex=e.vertex,this.vertexPixel=e.vertexPixel,this.feature=e.feature,this.segment=e.segment}}var d=i(36117),f=i(19775),g=i(23814),p=i(81625),m=i(22765),_=i(41507);function y(t){return t.feature?t.feature:t.element?t.element:null}const x=[];class v extends s.Z{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=l.uX),e.stopDown||(e.stopDown=l.Dv),super(e),this.on,this.once,this.un,this.source_=t.source?t.source:null,this.vertex_=void 0===t.vertex||t.vertex,this.edge_=void 0===t.edge||t.edge,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.rBush_=new o.Z,this.GEOMETRY_SEGMENTERS_={Point:this.segmentPointGeometry_.bind(this),LineString:this.segmentLineStringGeometry_.bind(this),LinearRing:this.segmentLineStringGeometry_.bind(this),Polygon:this.segmentPolygonGeometry_.bind(this),MultiPoint:this.segmentMultiPointGeometry_.bind(this),MultiLineString:this.segmentMultiLineStringGeometry_.bind(this),MultiPolygon:this.segmentMultiPolygonGeometry_.bind(this),GeometryCollection:this.segmentGeometryCollectionGeometry_.bind(this),Circle:this.segmentCircleGeometry_.bind(this)}}addFeature(t,e){e=void 0===e||e;const i=(0,m.sq)(t),n=t.getGeometry();if(n){const e=this.GEOMETRY_SEGMENTERS_[n.getType()];if(e){this.indexedFeaturesExtents_[i]=n.getExtent((0,d.lJ)());const r=[];if(e(r,n),1===r.length)this.rBush_.insert((0,d.hI)(r[0]),{feature:t,segment:r[0]});else if(r.length>1){const e=r.map((t=>(0,d.hI)(t))),i=r.map((e=>({feature:t,segment:e})));this.rBush_.load(e,i)}}}e&&(this.featureChangeListenerKeys_[i]=(0,_.oL)(t,r.Z.CHANGE,this.handleFeatureChange_,this))}getFeatures_(){let t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e&&(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel,this.dispatchEvent(new c(u,{vertex:t.coordinate,vertexPixel:t.pixel,feature:e.feature,segment:e.segment}))),super.handleEvent(t)}handleFeatureAdd_(t){const e=y(t);e&&this.addFeature(e)}handleFeatureRemove_(t){const e=y(t);e&&this.removeFeature(e)}handleFeatureChange_(t){const e=t.target;if(this.handlingDownUpSequence){const t=(0,m.sq)(e);t in this.pendingFeatures_||(this.pendingFeatures_[t]=e)}else this.updateFeature_(e)}handleUpEvent(t){const e=Object.values(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1}removeFeature(t,e){const i=void 0===e||e,n=(0,m.sq)(t),r=this.indexedFeaturesExtents_[n];if(r){const e=this.rBush_,i=[];e.forEachInExtent(r,(function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t)e.remove(i[t])}i&&((0,_.bN)(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(t){const e=this.getMap(),i=this.featuresListenerKeys_,r=this.getFeatures_();e&&(i.forEach(_.bN),i.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(_.bN),this.featureChangeListenerKeys_={}),super.setMap(t),t&&(this.features_?i.push((0,_.oL)(this.features_,n.Z.ADD,this.handleFeatureAdd_,this),(0,_.oL)(this.features_,n.Z.REMOVE,this.handleFeatureRemove_,this)):this.source_&&i.push((0,_.oL)(this.source_,a.Z.ADDFEATURE,this.handleFeatureAdd_,this),(0,_.oL)(this.source_,a.Z.REMOVEFEATURE,this.handleFeatureRemove_,this)),r.forEach((t=>this.addFeature(t))))}snapTo(t,e,i){const n=i.getView().getProjection(),r=(0,p.Vs)(e,n),s=(0,p.Fj)((0,d.f3)((0,d.hI)([r]),i.getView().getResolution()*this.pixelTolerance_),n),o=this.rBush_.getInExtent(s),a=o.length;if(0===a)return null;let l,h,u=1/0,c=null;const g=this.pixelTolerance_*this.pixelTolerance_,m=()=>{if(l){const e=i.getPixelFromCoordinate(l);if((0,f.bI)(t,e)<=g)return{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])],feature:h,segment:c}}return null};if(this.vertex_){for(let t=0;t{const i=(0,p.Vs)(t,n),s=(0,f.bI)(r,i);s{t.push([e])}))}segmentMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e{if(t instanceof s.Z&&this.filter_(t,e)&&(!this.features_||this.features_.getArray().includes(t)))return t}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}}e.Z=p},55572:function(t,e,i){"use strict";i.d(e,{c:function(){return Z}});var n=i(79638),r=i(58322),s=i(87556);class o extends r.ZP{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==s.Z.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();(0,r.FW)(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}}var a=o,l=i(35688),h=i(53382),u=i(79407),c=i(94142),d=i(12338);class f extends h.Z{constructor(t){t=t||{},super({stopDown:u.Dv}),this.condition_=t.condition?t.condition:c.aj,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!(0,c.QL)(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===d.h$)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!(0,c.QL)(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!(0,c.QL)(t))return!1;if((0,c.v8)(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var g=f,p=i(22268),m=i(70076);class _ extends p.Z{constructor(t){super({condition:(t=t||{}).condition?t.condition:c.vY,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:m.Vv})}}var y=_,x=i(92486),v="ArrowLeft",E="ArrowUp",b="ArrowRight",w="ArrowDown",S=i(19775);class C extends r.ZP{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return(0,c.rM)(t)&&(0,c.TN)(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==x.Z.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==w||n==v||n==b||n==E)){const s=t.map.getView(),o=s.getResolution()*this.pixelDelta_;let a=0,l=0;n==w?l=-o:n==v?a=-o:n==b?a=o:l=o;const h=[a,l];(0,S.U1)(h,s.getRotation()),(0,r.Cv)(s,h,this.duration_),i.preventDefault(),e=!0}}return!e}}var T=C;class M extends r.ZP{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!(0,c.a5)(t)&&(0,c.TN)(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==x.Z.KEYDOWN||t.type==x.Z.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,o="+"===n?this.delta_:-this.delta_,a=s.getView();(0,r.FW)(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var P=M;var R=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},I=i(89303);class A extends h.Z{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=u.Dv),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==d.h$&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel((0,h.S)(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var L=A;class F extends h.Z{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=u.Dv),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel((0,h.S)(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var O=F;function Z(t){t=t||{};const e=new n.Z,i=new R(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new g);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new a({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new l.Z({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new L);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new O({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new T),e.push(new P({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new I.Z({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new y({duration:t.zoomDuration})),e}},29440:function(t,e,i){"use strict";var n=i(38282),r=i(40823),s=i(22765),o=i(23422),a=i(63312);class l extends n.Z{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[r.Z.OPACITY]=void 0!==t.opacity?t.opacity:1,(0,o.h)("number"==typeof e[r.Z.OPACITY],"Layer opacity must be a number"),e[r.Z.VISIBLE]=void 0===t.visible||t.visible,e[r.Z.Z_INDEX]=t.zIndex,e[r.Z.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[r.Z.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[r.Z.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[r.Z.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=(0,a.uZ)(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return(0,s.O3)()}getLayerStatesArray(t){return(0,s.O3)()}getExtent(){return this.get(r.Z.EXTENT)}getMaxResolution(){return this.get(r.Z.MAX_RESOLUTION)}getMinResolution(){return this.get(r.Z.MIN_RESOLUTION)}getMinZoom(){return this.get(r.Z.MIN_ZOOM)}getMaxZoom(){return this.get(r.Z.MAX_ZOOM)}getOpacity(){return this.get(r.Z.OPACITY)}getSourceState(){return(0,s.O3)()}getVisible(){return this.get(r.Z.VISIBLE)}getZIndex(){return this.get(r.Z.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(r.Z.EXTENT,t)}setMaxResolution(t){this.set(r.Z.MAX_RESOLUTION,t)}setMinResolution(t){this.set(r.Z.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(r.Z.MAX_ZOOM,t)}setMinZoom(t){this.set(r.Z.MIN_ZOOM,t)}setOpacity(t){(0,o.h)("number"==typeof t,"Layer opacity must be a number"),this.set(r.Z.OPACITY,t)}setVisible(t){this.set(r.Z.VISIBLE,t)}setZIndex(t){this.set(r.Z.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}e.Z=l},63584:function(t,e,i){"use strict";var n=i(91462),r=i(48818);class s extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(r.Z.PRELOAD)}setPreload(t){this.set(r.Z.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(r.Z.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(r.Z.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}e.Z=s},9050:function(t,e,i){"use strict";i.d(e,{Z:function(){return X}});var n=i(91462),r=i(78476),s=i(80677),o=i(64688),a=i(5002),l=i(43586),h=i(49243),u=i(82776),c=i(71976),d=i(57906),f=i(12185);function g(t,e,i){const n=(0,d.Qc)(t,i);if(!(0,d.YM)(e,n.type)){const t=(0,d.hD)(e),i=(0,d.hD)(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return p(n,i)}function p(t,e){if(t instanceof d.EM){if(t.type===d.Mr&&"string"==typeof t.value){const e=(0,f.mL)(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case d.AP.Number:case d.AP.String:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;et.properties[n];case d.AP.Var:return t=>t.variables[n];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case d.AP.Id:return t=>t.featureId;case d.AP.Concat:{const i=t.args.map((t=>p(t,e)));return t=>"".concat(...i.map((e=>e(t).toString())))}case d.AP.Resolution:return t=>t.resolution;case d.AP.Any:case d.AP.All:case d.AP.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;e{for(let e=0;e!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case d.AP.Equal:case d.AP.NotEqual:case d.AP.LessThan:case d.AP.LessThanOrEqualTo:case d.AP.GreaterThan:case d.AP.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=p(t.args[0],e),r=p(t.args[1],e);switch(i){case d.AP.Equal:return t=>n(t)===r(t);case d.AP.NotEqual:return t=>n(t)!==r(t);case d.AP.LessThan:return t=>n(t)n(t)<=r(t);case d.AP.GreaterThan:return t=>n(t)>r(t);case d.AP.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case d.AP.Multiply:case d.AP.Divide:case d.AP.Add:case d.AP.Subtract:case d.AP.Clamp:case d.AP.Mod:case d.AP.Pow:case d.AP.Abs:case d.AP.Floor:case d.AP.Ceil:case d.AP.Round:case d.AP.Sin:case d.AP.Cos:case d.AP.Atan:case d.AP.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{let e=1;for(let i=0;ir[0](t)/r[1](t);case d.AP.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case d.AP.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case d.AP.Mod:return t=>r[0](t)%r[1](t);case d.AP.Pow:return t=>Math.pow(r[0](t),r[1](t));case d.AP.Abs:return t=>Math.abs(r[0](t));case d.AP.Floor:return t=>Math.floor(r[0](t));case d.AP.Ceil:return t=>Math.ceil(r[0](t));case d.AP.Round:return t=>Math.round(r[0](t));case d.AP.Sin:return t=>Math.sin(r[0](t));case d.AP.Cos:return t=>Math.cos(r[0](t));case d.AP.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case d.AP.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case d.AP.Match:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?_(e,r,s,o,i,l):m(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function m(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function _(t,e,i,n,r,s){if(0===r-i)return n;const o=(0,f.WV)(n),a=(0,f.WV)(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);const h=[m(t,e,i,o[0],r,a[0]),m(t,e,i,o[1],r,a[1]),o[2]+m(t,e,i,0,r,l),m(t,e,i,n[3],r,s[3])];return(0,f.Fv)((0,f.TF)(h))}var y=i(4891),x=i(81898);function v(t){return!0}function E(t){const e=(0,d.Mj)(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function B(t,e){const i=G(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const q="renderOrder";class V extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=void 0!==t.declutter&&t.declutter,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(q)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){t.declutterTree||(t.declutterTree=new r(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(q,t)}setStyle(t){this.style_=function(t){if(void 0===t)return s.yF;if(!t)return null;if("function"==typeof t)return t;if(t instanceof s.ZP)return t;if(!Array.isArray(t))return b([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof s.ZP){const i=new Array(e);for(let n=0;n0&&u.length>0;)g=u.pop(),r=l.pop(),o=h.pop(),y=g.toString(),y in c||(n.push(o[0],o[1]),c[y]=!0),m=u.pop(),s=l.pop(),a=h.pop(),_=(g+m)/2,d=t(_),f=e(d),(0,p.rU)(f[0],f[1],o[0],o[1],a[0],a[1]){const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new u.ZP({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new c.Z({font:"12px Calibri,sans-serif",textAlign:"right",fill:new o.Z({color:"rgba(0,0,0,1)"}),stroke:new h.Z({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(r.Z.POSTRENDER,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:E,this.setSource(new f.Z({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new n.Z,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new u.ZP({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&(0,g.Cf)(i,this.projection_),this.loadedExtent_&&((0,g.iW)(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=this.getExtent()||[-1/0,-1/0,1/0,1/0],o=(0,g.Ed)(r,t);if(this.renderedExtent_&&(0,g.fS)(this.renderedExtent_,o)&&this.renderedResolution_===e)return;if(this.renderedExtent_=o,this.renderedResolution_=e,(0,g.xb)(o))return;const a=(0,g.qg)(o),l=e*e/4;(!this.projection_||!(0,_.OP)(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(o,a,e,l);let h,u=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(u+=this.meridians_.length),this.parallelsLabels_&&(u+=this.parallels_.length);u>this.featurePool_.length;)h=new s.Z,this.featurePool_.push(h);const c=n.getFeaturesCollection();c.clear();let d,f,p=0;for(d=0,f=this.meridians_.length;dMath.PI/2}const d=(0,y.u3)(t);for(let t=a;t<=l;++t){let i,n,u,f,g=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,u=this.meridiansLabels_.length;n=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[(0,p.uZ)(e[0],this.minX_,this.maxX_),(0,p.uZ)(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let u=(0,p.uZ)(h[0],this.minLon_,this.maxLon_),c=(0,p.uZ)(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let f,m,_,y,x=t;s||(x=[(0,p.uZ)(t[0],this.minX_,this.maxX_),(0,p.uZ)(t[1],this.minY_,this.maxY_),(0,p.uZ)(t[2],this.minX_,this.maxX_),(0,p.uZ)(t[3],this.minY_,this.maxY_)]);const v=(0,g.Ne)(x,this.toLonLatTransform_,void 0,8);let E=v[3],b=v[2],w=v[1],S=v[0];if(s||((0,g.b8)(x,this.bottomLeft_)&&(S=this.minLon_,w=this.minLat_),(0,g.b8)(x,this.bottomRight_)&&(b=this.maxLon_,w=this.minLat_),(0,g.b8)(x,this.topLeft_)&&(S=this.minLon_,E=this.maxLat_),(0,g.b8)(x,this.topRight_)&&(b=this.maxLon_,E=this.maxLat_),E=(0,p.uZ)(E,c,this.maxLat_),b=(0,p.uZ)(b,u,this.maxLon_),w=(0,p.uZ)(w,this.minLat_,c),S=(0,p.uZ)(S,this.minLon_,u)),u=Math.floor(u/r)*r,y=(0,p.uZ)(u,this.minLon_,this.maxLon_),m=this.addMeridian_(y,w,E,n,t,0),f=0,s)for(;(y-=r)>=S&&f++n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=(0,p.uZ)(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],u=this.meridiansLabels_[i].geom;return u.setCoordinates(h),u}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=function(t,e,i,n,r){const s=(0,_.U2)("EPSG:4326");return x((function(n){return[e+(i-e)*n,t]}),(0,_.Ck)(s,n),r)}(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new a.Z(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=(0,p.uZ)(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],u=this.parallelsLabels_[i].geom;return u.setCoordinates(h),u}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=(0,_.U2)("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=(0,_.Ck)(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}}var w=b},22664:function(t,e,i){"use strict";i.d(e,{V:function(){return g}});var n=i(29440),r=i(79638),s=i(8651),o=i(6747),a=i(92486),l=i(35323),h=i(23422),u=i(4891),c=i(36117),d=i(22765),f=i(41507);class g extends o.ZP{constructor(t,e){super(t),this.layer=e}}const p="layers";class m extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(p,this.handleLayersChanged_),i?Array.isArray(i)?i=new r.Z(i.slice(),{unique:!0}):(0,h.h)("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new r.Z(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(f.bN),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push((0,f.oL)(t,s.Z.ADD,this.handleLayersAdd_,this),(0,f.oL)(t,s.Z.REMOVE,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(f.bN);(0,u.Z)(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{const e=this.weightFunction_(t);return void 0!==e?(0,o.uZ)(e,0,1):1}}],uniforms:{u_size:()=>2*(this.get(u)+this.get(l)),u_blurSlope:()=>this.get(u)/Math.max(1,this.get(l))},hitDetectionEnabled:!0,vertexShader:t.getSymbolVertexShader(),fragmentShader:t.getSymbolFragmentShader(),postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}}e.Z=d},11802:function(t,e,i){"use strict";i.d(e,{Z:function(){return a}});var n=i(91462);class r extends n.Z{constructor(t){super(t=t||{})}}var s=r,o=i(89194);var a=class extends s{constructor(t){super(t)}createRenderer(){return new o.Z(this)}getData(t){return super.getData(t)}}},91462:function(t,e,i){"use strict";i.d(e,{j:function(){return d}});var n=i(29440),r=i(92486),s=i(40823),o=i(95474),a=i(40824),l=i(23422),h=i(36117),u=i(41507);class c extends n.Z{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(s.Z.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(s.Z.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&((0,u.bN)(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=(0,u.oL)(t,r.Z.CHANGE,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof a.ZP?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const r=this.getExtent();return d(n,e.viewState)&&(!r||(0,h.kK)(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof a.ZP?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(s.Z.MAP,t)}getMapInternal(){return this.get(s.Z.MAP)}setMap(t){this.mapPrecomposeKey_&&((0,u.bN)(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&((0,u.bN)(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=(0,u.oL)(t,o.Z.PRECOMPOSE,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);(0,l.h)(!e.some((function(t){return t.layer===i.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}),this),this.mapRenderKey_=(0,u.oL)(this,r.Z.CHANGE,t.render,t),this.changed())}setSource(t){this.set(s.Z.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function d(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}e.Z=c},40823:function(t,e){"use strict";e.Z={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"}},72893:function(t,e,i){"use strict";var n=i(63584),r=i(44235);class s extends n.Z{constructor(t){super(t)}createRenderer(){return new r.Z(this)}}e.Z=s},48818:function(t,e){"use strict";e.Z={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"}},1733:function(t,e,i){"use strict";var n=i(9050),r=i(56808);class s extends n.Z{constructor(t){super(t)}createRenderer(){return new r.Z(this)}}e.Z=s},16248:function(t,e,i){"use strict";i.d(e,{Z:function(){return _}});var n=i(9050),r=i(89194),s=i(56808),o=i(92486),a=i(13617),l=i(13701),h=i(78476),u=i(87334),c=i(44669),d=i(86374),f=i(36117);class g extends r.Z{constructor(t){super(t),this.vectorRenderer_=new s.Z(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=(0,c.Ue)(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=(0,c.nn)(this.coordinateToVectorPixelTransform_,(0,c.nn)(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,r=t.viewHints,s=this.vectorRenderer_;let g=t.extent;1!==this.layerImageRatio_&&(g=g.slice(0),(0,f.H9)(g,this.layerImageRatio_));const p=(0,f.dz)(g)/n,m=(0,f.Cr)(g)/n;if(!r[u.Z.ANIMATING]&&!r[u.Z.INTERACTING]&&!(0,f.xb)(g)){s.useContainer(null,null);const r=s.context,u=t.layerStatesArray[t.layerIndex],f=Object.assign({},u,{opacity:1}),_=Object.assign({},t,{declutterTree:new h(9),extent:g,size:[p,m],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0});let y=!0;const x=new a.Z(g,n,e,r.canvas,(function(t){s.prepareFrame(_)&&s.replayGroupChanged&&(s.clipping=!1,s.renderFrame(_,null)&&(s.renderDeclutter(_),y=!1),t())}));x.addEventListener(o.Z.CHANGE,(()=>{if(x.getState()!==l.Z.LOADED)return;this.image_=y?null:x;const t=x.getPixelRatio(),n=(0,d.D)(x.getResolution())*e/t;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=(0,c.qC)(this.coordinateToVectorPixelTransform_,p/2,m/2,1/n,-1/n,0,-i.center[0],-i.center[1])})),x.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}}var p=g;class m extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new p(this)}}var _=m},94613:function(t,e,i){"use strict";i.d(e,{Z:function(){return w}});var n=i(9050),r=i(63350),s=i(15970),o=i(44235),a=i(74251),l=i(87334),h=i(51196),u=i(44669),c=i(36117),d=i(23697),f=i(22765),g=i(81898),p=i(19775);const m={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},_={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class y extends o.Z{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.tmpTransform_=(0,u.Ue)()}prepareTile(t,e,i){let n;const r=t.getState();return r!==a.Z.LOADED&&r!==a.Z.ERROR||(this.updateExecutorGroup_(t,e,i),this.tileImageNeedsRender_(t)&&(n=!0)),n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState,o=s.resolution,a=s.projection,h=this.getLayer(),u=h.getSource().getTile(t,e,i,r,a),c=n.viewHints,d=!(c[l.Z.ANIMATING]||c[l.Z.INTERACTING]);!d&&u.wantedResolution||(u.wantedResolution=o);return this.prepareTile(u,r,a)&&(d||Date.now()-n.time<8)&&"vector"!==h.getRenderMode()&&this.renderTileImage_(u,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?(0,f.sq)(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),o=n.getRevision(),l=n.getRenderOrder()||null,h=t.wantedResolution,u=t.getReplayState(n);if(!u.dirty&&u.renderedResolution===h&&u.renderedRevision==o&&u.renderedRenderOrder==l)return;const g=n.getSource(),p=n.getDeclutter(),m=g.getTileGrid(),_=g.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),y=g.getSourceTiles(e,i,t),x=(0,f.sq)(n);delete t.hitDetectionImageData[x],t.executorGroups[x]=[],p&&(t.declutterExecutorGroups[x]=[]),u.dirty=!1;for(let i=0,o=y.length;i{const r=n===y?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,a=n.length;e{const n=this.getLayer(),r=(0,f.sq)(n),s=n.getSource(),o=this.renderedProjection,l=o.getExtent(),d=this.renderedResolution,m=s.getTileGridForProjection(o),_=(0,u.nn)(this.renderedPixelToCoordinateTransform_,t.slice()),y=m.getTileCoordForCoordAndResolution(_,d);let x;for(let t=0,e=this.renderedTiles.length;t0)return void e([]);const v=m.getTileCoordExtent(x.wrappedTileCoord),E=(0,c.rL)(v),b=[(_[0]-E[0])/d,(E[1]-_[1])/d],w=x.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let S=x.hitDetectionImageData[r];if(!S){const t=(0,g.Pq)(m.getTileSize(m.getZForResolution(d,s.zDirection))),e=this.renderedRotation_,i=[this.getRenderTransform(m.getTileCoordCenter(x.wrappedTileCoord),d,0,h.UN,t[0]*h.UN,t[1]*h.UN,0)];S=(0,h.TU)(t,i,w,n.getStyleFunction(),m.getTileCoordExtent(x.wrappedTileCoord),x.getReplayState(n).renderedResolution,e),x.hitDetectionImageData[r]=S}e((0,h.ix)(b,w,S))}))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[l.Z.ANIMATING]||r[l.Z.INTERACTING]),o=this.renderedTiles;for(let e=0,i=o.length;e=0;--e)n[e].execute(this.context,1,this.getTileRenderTransform(i,t),t.viewState.rotation,s,void 0,t.declutterTree)}i.globalAlpha=n}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),d=t.tileCoord,f=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(d,this.tmpExtent)[0]-f[0];return(0,u.Jp)((0,u.bA)(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[l.Z.ANIMATING]||i[l.Z.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=e.layerStatesArray[e.layerIndex].opacity;const a=_[s],h=e.viewState,u=h.rotation,d=r.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),p=this.renderedTiles,m=[],y=[];let x=!0;for(let i=p.length-1;i>=0;--i){const s=p[i];x=x&&!s.getReplayState(r).dirty;const o=s.executorGroups[(0,f.sq)(r)].filter((t=>t.hasExecutors(a)));if(0===o.length)continue;const l=this.getTileRenderTransform(s,e),h=s.tileCoord[0];let d=!1;const _=o[0].getClipCoords(l);if(_){for(let e=0,i=m.length;e({name:t,...this.parseResult_.attributes[t]})));return new r.Z(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:t})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}e.Z=o},50463:function(t,e,i){"use strict";var n=i(63584),r=i(40823),s=i(80128),o=i(57906),a=i(25638),l=i(31871);function h(t,e){const i=`\n attribute vec2 ${s.zj.TEXTURE_COORD};\n uniform mat4 ${s.XE.TILE_TRANSFORM};\n uniform float ${s.XE.TEXTURE_PIXEL_WIDTH};\n uniform float ${s.XE.TEXTURE_PIXEL_HEIGHT};\n uniform float ${s.XE.TEXTURE_RESOLUTION};\n uniform float ${s.XE.TEXTURE_ORIGIN_X};\n uniform float ${s.XE.TEXTURE_ORIGIN_Y};\n uniform float ${s.XE.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${s.zj.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${s.XE.TEXTURE_ORIGIN_X} + ${s.XE.TEXTURE_RESOLUTION} * ${s.XE.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${s.XE.TEXTURE_ORIGIN_Y} - ${s.XE.TEXTURE_RESOLUTION} * ${s.XE.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${s.XE.TILE_TRANSFORM} * vec4(${s.zj.TEXTURE_COORD}, ${s.XE.DEPTH}, 1.0);\n }\n `,n={...(0,a.xW)(),inFragmentShader:!0,bandCount:e,style:t},r=[];if(void 0!==t.color){const e=(0,l.CL)(n,t.color,o.Mr);r.push(`color = ${e};`)}if(void 0!==t.contrast){const e=(0,l.CL)(n,t.contrast,o.sw);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=(0,l.CL)(n,t.exposure,o.sw);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=(0,l.CL)(n,t.saturation,o.sw);r.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=(0,l.CL)(n,t.gamma,o.sw);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=(0,l.CL)(n,t.brightness,o.sw);r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const h={},u=Object.keys(n.variables).length;if(u>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${s.XE.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${s.XE.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${s.XE.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${s.XE.TRANSITION_ALPHA};\n }`,uniforms:h,paletteTextures:n.paletteTextures}}class u extends n.Z{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.cacheSize_=i,this.styleVariables_=this.style_.variables||{},this.addChangeListener(r.Z.SOURCE,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=h(this.style_,this.getSourceBandCount_());return new s.ZP(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.cacheSize_,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=h(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}u.prototype.dispose,e.Z=u},2896:function(t,e,i){"use strict";i.d(e,{$6:function(){return r},Gg:function(){return o},VW:function(){return s}});var n=i(81625);function r(t,e){return[[-1/0,-1/0,1/0,1/0]]}function s(t,e){return[t]}function o(t){return function(e,i,r){const s=t.getZForResolution((0,n.oK)(i,r)),o=t.getTileRangeForExtentAndZ((0,n.dY)(e,r),s),a=[],l=[s,0,0];for(l[1]=o.minX;l[1]<=o.maxX;++l[1])for(l[2]=o.minY;l[2]<=o.maxY;++l[2])a.push((0,n.Fj)(t.getTileCoordExtent(l),r));return a}}},63312:function(t,e,i){"use strict";function n(t,e,i){return Math.min(Math.max(t,e),i)}function r(t,e,i,n,r,o){const a=r-i,l=o-n;if(0!==a||0!==l){const s=((t-i)*a+(e-n)*l)/(a*a+l*l);s>1?(i=r,n=o):s>0&&(i+=a*s,n+=l*s)}return s(t,e,i,n)}function s(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function o(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function a(t){return 180*t/Math.PI}function l(t){return t*Math.PI/180}function h(t,e){const i=t%e;return i*e<0?i+e:i}function u(t,e,i){return t+i*(e-t)}function c(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function d(t,e){return Math.round(c(t,e))}function f(t,e){return Math.floor(c(t,e))}function g(t,e){return Math.ceil(c(t,e))}i.d(e,{$W:function(){return h},FH:function(){return c},GW:function(){return f},NM:function(){return d},SV:function(){return o},Ux:function(){return a},Yr:function(){return l},bI:function(){return s},mD:function(){return g},rU:function(){return r},t7:function(){return u},uZ:function(){return n}})},38760:function(t,e,i){"use strict";i.d(e,{Kk:function(){return l},R6:function(){return r},xA:function(){return a}});var n=i(22765);function r(t,e,i,r){const s=document.createElement("script"),o="olc_"+(0,n.sq)(e);function a(){delete window[o],s.parentNode.removeChild(s)}s.async=!0,s.src=t+(t.includes("?")?"&":"?")+(r||"callback")+"="+o;const l=setTimeout((function(){a(),i&&i()}),1e4);window[o]=function(t){clearTimeout(l),a(),e(t)},document.head.appendChild(s)}class s extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class o extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function a(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new s(n))})),n.addEventListener("error",(function(t){i(new o(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function l(t,e){return e.includes("://")?e:new URL(e,t).href}},4891:function(t,e,i){"use strict";function n(t){for(const e in t)delete t[e]}function r(t){let e;for(e in t)return!1;return!e}i.d(e,{Z:function(){return n},x:function(){return r}})},64074:function(t,e){"use strict";e.Z={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}},81625:function(t,e,i){"use strict";i.d(e,{Wm:function(){return _.W},kv:function(){return n.Z},zY:function(){return Z},rM:function(){return L},Sx:function(){return R},UQ:function(){return F},uA:function(){return J},h_:function(){return T},OP:function(){return N},mi:function(){return k},Vs:function(){return $},dY:function(){return Y},oK:function(){return K},U2:function(){return I},_Q:function(){return A},Ck:function(){return z},WO:function(){return G},Cs:function(){return q},gD:function(){return P},bU:function(){return D},lO:function(){return X},Fj:function(){return W},on:function(){return H},vs:function(){return j},$A:function(){return U},eL:function(){return V}});var n=i(36255);const r=6378137,s=Math.PI*r,o=[-s,-s,s,s],a=[-180,-85,180,85],l=r*Math.log(Math.tan(Math.PI/2));class h extends n.Z{constructor(t){super({code:t,units:"m",extent:o,global:!0,worldExtent:a,getPointResolution:function(t,e){return t/Math.cosh(e[1]/r)}})}}const u=[new h("EPSG:3857"),new h("EPSG:102100"),new h("EPSG:102113"),new h("EPSG:900913"),new h("http://www.opengis.net/def/crs/EPSG/0/3857"),new h("http://www.opengis.net/gml/srs/epsg.xml#3857")];function c(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;ol?i=l:i<-l&&(i=-l),e[o+1]=i}return e}function d(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;o=o?e[s+t]:r[t]}return i}}function Z(t,e,i,n){const r=I(t),s=I(e);(0,x.IH)(r,s,O(i)),(0,x.IH)(s,r,O(n))}function k(t,e){return T(),j(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function D(t,e){const i=j(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=(0,E.$W)(n+180,360)-180),i}function N(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return G(t,e)===M&&i}function G(t,e){const i=t.getCode(),n=e.getCode();let r=(0,x.U2)(i,n);return r||(r=P),r}function z(t,e){return G(I(t),I(e))}function j(t,e,i){return z(e,i)(t,void 0,t.length)}function U(t,e,i,n){const r=z(e,i);return(0,v.Ne)(t,r,void 0,n)}let B=null;function q(){return B}function V(){B=I("EPSG:4326")}function X(t,e){return B?j(t,e,B):t}function $(t,e){return B?j(t,B,e):(C&&!(0,b.fS)(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(C=!1,(0,S.ZK)("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function W(t,e){return B?U(t,e,B):t}function Y(t,e){return B?U(t,B,e):t}function H(t,e){if(!B)return t;const i=I(e).getMetersPerUnit(),n=B.getMetersPerUnit();return i&&n?t*i/n:t}function K(t,e){if(!B)return t;const i=I(e).getMetersPerUnit(),n=B.getMetersPerUnit();return i&&n?t*n/i:t}function J(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=(0,v.dz)(e);n=n.slice(0),s=(0,b.jk)(n,t,o),s&&(n[0]=n[0]-s*o),n[0]=(0,E.uZ)(n[0],e[0],e[2]),n[1]=(0,E.uZ)(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*(0,v.dz)(e.getExtent())),r}}var Q,tt,et;L(u),L(m),Q=u,tt=c,et=d,m.forEach((function(t){Q.forEach((function(e){(0,x.IH)(t,e,tt),(0,x.IH)(e,t,et)}))}))},36255:function(t,e,i){"use strict";var n=i(14684);e.Z=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||n.W[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}},14684:function(t,e,i){"use strict";i.d(e,{N:function(){return r},W:function(){return s}});const n={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function r(t){return n[t]}const s={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937}},35250:function(t,e,i){"use strict";i.d(e,{$m:function(){return u},d:function(){return d},pH:function(){return a},sM:function(){return c},z2:function(){return l}});var n=i(36255),r=i(81625),s=i(97189);let o=null;function a(){return!!o}function l(t){o=t;const e=Object.keys(t.defs),i=e.length;let a,l;for(a=0;a{const i=t.results;if(i?.length>0){const t=i.filter((t=>"EPSG"===t.id?.authority&&t.id?.code===e))[0];if(t){const e=t.transformations;if(e?.length>0){const i=t.default_transformation;if(e.filter((t=>t.id?.authority===i?.authority&&t.id?.code===i?.code&&0===t.grids?.length)).length>0)return t.exports?.proj4;const n=e.filter((t=>0===t.grids?.length&&"EPSG"===t.target_crs?.authority&&4326===t.target_crs?.code&&!1===t.deprecated&&!0===t.usable)).sort(((t,e)=>t.accuracy-e.accuracy))[0]?.exports?.proj4;if(n)return n}return t.exports?.proj4}}}))}}},97189:function(t,e,i){"use strict";i.d(e,{IH:function(){return r},U2:function(){return s}});let n={};function r(t,e,i){const r=t.getCode(),s=e.getCode();r in n||(n[r]={}),n[r][s]=i}function s(t,e){let i;return t in n&&e in n[t]&&(i=n[t][e]),i}},91027:function(t,e,i){"use strict";i.d(e,{CR:function(){return u},Pt:function(){return l},u3:function(){return h}});var n=i(58767),r=i(14768),s=i(44669),o=i(23697),a=i(81625);function l(t,e){const i=t.canvas,o=(e=e||{}).pixelRatio||r.MP,a=e.size;a&&(i.width=a[0]*o,i.height=a[1]*o,i.style.width=a[0]+"px",i.style.height=a[1]+"px");const l=[0,0,i.width,i.height],h=(0,s.bA)((0,s.Ue)(),o,o);return new n.Z(t,o,l,h,0)}function h(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=t.inversePixelTransform[0],i=t.inversePixelTransform[1],r=Math.sqrt(e*e+i*i),l=t.frameState,h=(0,s.Jp)(t.inversePixelTransform.slice(),l.coordinateToPixelTransform),u=(0,o.se)(l.viewState.resolution,r);let c;const d=(0,a.Cs)();return d&&(c=(0,a.WO)(d,l.viewState.projection)),new n.Z(t.context,r,l.extent,h,l.viewState.rotation,u,c)}function u(t,e){return(0,s.nn)(t.inversePixelTransform,e.slice(0))}},44594:function(t,e,i){"use strict";var n=i(6747);class r extends n.ZP{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}e.Z=r},95474:function(t,e){"use strict";e.Z={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"}},33321:function(t,e,i){"use strict";var n=i(44669),r=i(36117),s=i(67775),o=i(17367),a=i(37105),l=i(81625),h=i(71313),u=i(74985),c=i(31121),d=i(79407),f=i(11570);const g=(0,n.Ue)();class p{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?(0,r.HK)(this.flatCoordinates_):(0,r.GN)(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=(0,r.qg)(this.getExtent());this.flatInteriorPoints_=(0,a.X)(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=(0,h.Q3)(this.flatCoordinates_,this.ends_),e=(0,c.E)(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=(0,a.U)(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=(0,u.WW)(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=(0,s.dt)(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=(0,s.UJ)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=(0,s.Zh)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new p(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}p.prototype.getFlatCoordinates=p.prototype.getOrientedFlatCoordinates,e.ZP=p},46453:function(t,e){"use strict";e.Z=class{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}},17955:function(t,e,i){"use strict";i.d(e,{Df:function(){return l},He:function(){return d},Kd:function(){return P},PH:function(){return m},Qx:function(){return S},Tx:function(){return p},V4:function(){return g},X9:function(){return c},Zw:function(){return R},_f:function(){return I},bL:function(){return h},mb:function(){return u},oB:function(){return y},rc:function(){return f},ru:function(){return _},sG:function(){return v},yC:function(){return x}});var n=i(38282),r=i(14768),s=i(4891),o=i(850),a=i(49636);const l="10px sans-serif",h="#000",u="round",c=[],d=0,f="round",g=10,p="#000",m="center",_="middle",y=[0,0,0,0],x=1,v=new n.Z;let E,b=null;const w={},S=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let r,o;function l(r,s,a){let l=!0;for(let h=0;hMath.max(e,M(t,i))),0);return i[e]=n,n}function R(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l;continue}const d=e[h+1]||t.font,f=M(d,c);i.push(f),o+=f;const g=C(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function I(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;ta&&(this.instructions.push([n.ZP.CUSTOM,a,h,t,i,u.Ml]),this.hitDetectionInstructions.push([n.ZP.CUSTOM,a,h,t,r||i,u.Ml]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([n.ZP.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([n.ZP.CUSTOM,a,h,t,r||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[n.ZP.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[n.ZP.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let r,s,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[n.ZP.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[n.ZP.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!(0,h.fS)(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[n.ZP.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,a.d9)(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;(0,a.f3)(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}e.Z=c},63350:function(t,e,i){"use strict";i.d(e,{Z:function(){return p}});var n=i(4281),r=i(86161);class s extends n.Z{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([r.ZP.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([r.ZP.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}var o=s,a=i(17955);class l extends n.Z{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[r.ZP.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([r.ZP.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,a.X9,a.He],r.$O);const o=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(o,0,o.length,l),this.hitDetectionInstructions.push(r.Yc),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([r.ZP.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,a.X9,a.He],r.$O);const o=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=o.length;tt[2]}else R=b>M;const I=Math.PI,A=[],L=S+n===e;let F;if(y=0,x=C,g=t[e=S],p=t[e+1],L){v(),F=Math.atan2(p-_,g-m),R&&(F+=F>0?-I:I);const t=(M+b)/2,e=(P+w)/2;return A[0]=[t,e,(T-s)/2,F,r],A}for(let t=0,h=(r=r.replace(/\n/g," ")).length;t0?-I:I),void 0!==F){let t=f-F;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}F=f;const b=t;let w=0;for(;t0&&t.push("\n",""),t.push(e,""),t}var b=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,s.Ue)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,l=i?this.fillStates[i]:null,h=this.textStates[e],u=this.pixelRatio,c=[h.scale[0]*u,h.scale[1]*u],d=Array.isArray(t),f=h.justify?r.I[h.justify]:v(Array.isArray(t)?t[0]:t,h.textAlign||a.PH),g=n&&o.lineWidth?o.lineWidth:0,p=d?t:t.split("\n").reduce(E,[]),{width:m,height:_,widths:y,heights:x,lineWidths:b}=(0,a.Zw)(h,p),w=m+g,S=[],C=(w+2)*c[0],T=(_+g)*c[1],M={width:C<0?Math.floor(C):Math.ceil(C),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:S};1==c[0]&&1==c[1]||S.push("scale",c),n&&(S.push("strokeStyle",o.strokeStyle),S.push("lineWidth",g),S.push("lineCap",o.lineCap),S.push("lineJoin",o.lineJoin),S.push("miterLimit",o.miterLimit),S.push("setLineDash",[o.lineDash]),S.push("lineDashOffset",o.lineDashOffset)),i&&S.push("fillStyle",l.fillStyle),S.push("textBaseline","middle"),S.push("textAlign","center");const P=.5-f;let R=f*w+P*g;const I=[],A=[];let L,F=0,O=0,Z=0,k=0;for(let t=0,e=p.length;tt?t-u:r,T=a+c>e?e-c:a,M=v[3]+C*y[0]+v[1],P=v[0]+T*y[1]+v[2],R=w-v[3],I=S-v[0];let A;return(E||0!==d)&&(g[0]=R,_[0]=R,g[1]=I,p[1]=I,p[0]=R+M,m[0]=p[0],m[1]=I+P,_[1]=m[1]),0!==d?(A=(0,s.qC)((0,s.Ue)(),i,n,1,1,d,-i,-n),(0,s.nn)(A,g),(0,s.nn)(A,p),(0,s.nn)(A,m),(0,s.nn)(A,_),(0,o.T9)(Math.min(g[0],p[0],m[0],_[0]),Math.min(g[1],p[1],m[1],_[1]),Math.max(g[0],p[0],m[0],_[0]),Math.max(g[1],p[1],m[1],_[1]),f)):(0,o.T9)(Math.min(R,R+M),Math.min(I,I+P),Math.max(R,R+M),Math.max(I,I+P),f),x&&(w=Math.round(w),S=Math.round(S)),{drawImageX:w,drawImageY:S,drawImageW:C,drawImageH:T,originX:u,originY:c,declutterBox:{minX:f[0],minY:f[1],maxX:f[2],maxY:f[3],value:b},canvasTransform:A,scale:y}}replayImageOrLabel_(t,e,i,n,r,s,o){const l=!(!s&&!o),h=n.declutterBox,u=t.canvas,c=o?o[2]*n.scale[0]/2:0;return h.minX-c<=u.width/e&&h.maxX+c>=0&&h.minY-c<=u.height/e&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,g,p,m,_,s,o),(0,a._f)(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=(0,s.nn)(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],o=this.createLabel(t,e,n,i),l=this.strokeStates[i],h=this.pixelRatio,u=v(Array.isArray(t)?t[0]:t,s.textAlign||a.PH),c=r.I[s.textBaseline||a.ru],d=l&&l.lineWidth?l.lineWidth:0;return{label:o,anchorX:u*(o.width/h-2*s.scale[0])+2*(.5-u)*d,anchorY:c*o.height/h+2*(.5-c)*d}}execute_(t,e,i,r,l,f,g,p){let m;this.pixelCoordinates_&&(0,c.fS)(i,this.renderedTransform_)?m=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),m=(0,h.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,s.lk)(this.renderedTransform_,i));let _=0;const x=r.length;let E,b,w,S,C,T,M,P,R,I,A,L,F=0,O=0,Z=0,k=null,D=null;const N=this.coordinateCache_,G=this.viewRotation_,z=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:G},U=this.instructions!=r||this.overlaps?0:200;let B,q,V,X;for(;_U&&(this.fill_(t),O=0),Z>U&&(t.stroke(),Z=0),O||Z||(t.beginPath(),S=NaN,C=NaN),++_;break;case n.ZP.CIRCLE:F=i[1];const r=m[F],s=m[F+1],h=m[F+2]-r,c=m[F+3]-s,x=Math.sqrt(h*h+c*c);t.moveTo(r+x,s),t.arc(r,s,x,0,2*Math.PI,!0),++_;break;case n.ZP.CLOSE_PATH:t.closePath(),++_;break;case n.ZP.CUSTOM:F=i[1],E=i[2];const $=i[3],W=i[4],Y=6==i.length?i[5]:void 0;j.geometry=$,j.feature=B,_ in N||(N[_]=[]);const H=N[_];Y?Y(m,F,E,2,H):(H[0]=m[F],H[1]=m[F+1],H.length=2),W(H,j),++_;break;case n.ZP.DRAW_IMAGE:F=i[1],E=i[2],P=i[3],b=i[4],w=i[5];let K=i[6];const J=i[7],Q=i[8],tt=i[9],et=i[10];let it=i[11];const nt=i[12];let rt=i[13];const st=i[14],ot=i[15];if(!P&&i.length>=20){R=i[19],I=i[20],A=i[21],L=i[22];const t=this.drawLabelWithPointPlacement_(R,I,A,L);P=t.label,i[3]=P;const e=i[23];b=(t.anchorX-e)*this.pixelRatio,i[4]=b;const n=i[24];w=(t.anchorY-n)*this.pixelRatio,i[5]=w,K=P.height,i[6]=K,rt=P.width,i[13]=rt}let at,lt,ht,ut;i.length>25&&(at=i[25]),i.length>17?(lt=i[16],ht=i[17],ut=i[18]):(lt=a.oB,ht=!1,ut=!1),et&&z?it+=G:et||z||(it-=G);let ct=0;for(;Fi)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!a||"Image"!==p&&"Text"!==p||a.includes(t)){const i=(g[s]-3)/4,o=n-i%l,a=n-(i/l|0),h=r(t,e,o*o+a*a);if(h)return h}d.clearRect(0,0,l,l);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let y,x,v,E,b;for(_.sort(c.j2),y=_.length-1;y>=0;--y){const t=_[y].toString();for(v=this.executorsByZIndex_[t],x=C.length-1;x>=0;--x)if(p=C[x],E=v[p],void 0!==E&&(b=E.executeHitDetection(d,h,i,m,f),b))return b}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return(0,h.vT)(o,0,8,2,t,o),o}isEmpty(){return(0,S.x)(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let l,h,u,d,f,g;for(a.sort(c.j2),this.maxExtent_&&(t.save(),this.clip(t,i)),s=s||C,o&&a.reverse(),l=0,h=a.length;lt*this.pixelRatio_)),lineDashOffset:(s||o.He)*this.pixelRatio_,lineJoin:void 0!==a?a:o.rc,lineWidth:(void 0!==l?l:o.yC)*this.pixelRatio_,miterLimit:void 0!==h?h:o.V4,strokeStyle:(0,r.y)(t||o.Tx)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:(0,r.y)(t||o.bL)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),a=i.getLineJoin(),l=i.getWidth(),h=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:o.mb,lineDash:n||o.X9,lineDashOffset:s||o.He,lineJoin:void 0!==a?a:o.rc,lineWidth:void 0!==l?l:o.yC,miterLimit:void 0!==h?h:o.V4,strokeStyle:(0,r.y)(t||o.Tx)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),a=t.getOffsetY(),l=t.getRotateWithView(),h=t.getRotation(),u=t.getScaleArray(),c=t.getText(),d=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:void 0!==n?n:o.Df,textAlign:void 0!==d?d:o.PH,textBaseline:void 0!==f?f:o.ru},this.text_=void 0!==c?Array.isArray(c)?c.reduce(((t,e,i)=>t+(i%2?" ":e)),""):c:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==a?this.pixelRatio_*a:0,this.textRotateWithView_=void 0!==l&&l,this.textRotation_=void 0!==h?h:0,this.textScale_=[this.pixelRatio_*u[0],this.pixelRatio_*u[1]]}else this.text_=""}}e.Z=d},86161:function(t,e,i){"use strict";i.d(e,{$O:function(){return o},Yc:function(){return s},gO:function(){return r},s3:function(){return a}});const n={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},r=[n.FILL],s=[n.STROKE],o=[n.BEGIN_PATH],a=[n.CLOSE_PATH];e.ZP=n},48714:function(t,e,i){"use strict";i.d(e,{I:function(){return d},Z:function(){return g}});var n=i(4281),r=i(86161),s=i(52987),o=i(17955),a=i(22765),l=i(36117),h=i(63312);function u(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a=t){const e=(t-a+d)/d,f=(0,h.t7)(i,u,e),g=(0,h.t7)(n,c,e);l.push(f,g),s.push(l),l=[f,g],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function c(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,g,p=i,m=i,_=0,y=0,x=i;for(o=i;ot&&(y>_&&(_=y,p=x,m=o),y=0,x=o-r)),a=l,c=f,d=g),h=i,u=n}return y+=l,y>_?[x,o]:[p,m]}const d={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class f extends n.Z{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[o.bL]={fillStyle:o.bL},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const a=this.coordinates;let h=a.length;const d=t.getType();let f=null,g=t.getStride();if("line"!==s.placement||"LineString"!=d&&"MultiLineString"!=d&&"Polygon"!=d&&"MultiPolygon"!=d){let i=s.overflow?null:[];switch(d){case"Point":case"MultiPoint":f=t.getFlatCoordinates();break;case"LineString":f=t.getFlatMidpoint();break;case"Circle":f=t.getCenter();break;case"MultiLineString":f=t.getFlatMidpoints(),g=2;break;case"Polygon":f=t.getFlatInteriorPoint(),s.overflow||i.push(f[2]/this.resolution),g=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();f=[];for(let t=0,n=e.length;t{const n=a[2*(t+i)]===f[i*g]&&a[2*(t+i)+1]===f[i*g+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let l=s.padding;if(l!=o.oB&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),l=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([r.ZP.DRAW_IMAGE,h,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,l==o.oB?o.oB:l.map((function(t){return t*u})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const c=1/u,p=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=o.bL,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,h,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[c,c],NaN,void 0,this.declutterImageWithText_,l,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?o.bL:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=p,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!(0,l.kK)(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(f=t.getFlatCoordinates(),"LineString"==d)i=[f.length];else if("MultiLineString"==d)i=t.getEnds();else if("Polygon"==d)i=t.getEnds().slice(0,1);else if("MultiPolygon"==d){const e=t.getEndss();i=[];for(let t=0,n=e.length;ti%e<2))}e.Z=class{constructor(){this.globalCounter_=0,this.refToFeature_=new Map,this.uidToRef_=new Map,this.freeGlobalRef_=[],this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0},this.pointBatch={entries:{},geometriesCount:0},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0}}addFeatures(t,e){for(let i=0;i0?t[i-1]:null,o=s?s[s.length-1]:0,h=n[n.length-1];n=o>0?n.map((t=>t-o)):n,this.addCoordinates_("Polygon",e.slice(o,h),n,r,a,l)}break}case"MultiLineString":{const t=i;for(let i=0,n=t.length;i0?t[i-1]:0;this.addCoordinates_("LineString",e.slice(n,t[i]),null,r,a,l)}break}case"MultiPoint":for(let t=0,i=e.length;t1)return void this.addCoordinates_("MultiPolygon",e,i,r,a,l)}this.polygonBatch.entries[a]||(this.polygonBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]})),h=e.length/l;const u=i.length,c=i.map(((t,e,i)=>e>0?(t-i[e-1])/l:t/l));this.polygonBatch.verticesCount+=h,this.polygonBatch.ringsCount+=u,this.polygonBatch.geometriesCount++,this.polygonBatch.entries[a].flatCoordss.push(o(e,l)),this.polygonBatch.entries[a].ringsVerticesCounts.push(c),this.polygonBatch.entries[a].verticesCount+=h,this.polygonBatch.entries[a].ringsCount+=u;for(let i=0,n=t.length;i0?t[i-1]:0;this.addCoordinates_("LinearRing",e.slice(n,t[i]),null,r,a,l)}break}case"Point":this.pointBatch.entries[a]||(this.pointBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[]})),this.pointBatch.geometriesCount++,this.pointBatch.entries[a].flatCoordss.push(e);break;case"LineString":case"LinearRing":this.lineStringBatch.entries[a]||(this.lineStringBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[],verticesCount:0})),h=e.length/l,this.lineStringBatch.verticesCount+=h,this.lineStringBatch.geometriesCount++,this.lineStringBatch.entries[a].flatCoordss.push(o(e,l)),this.lineStringBatch.entries[a].verticesCount+=h}}addRefToEntry_(t,e){const i=this.uidToRef_.get(t),n=i||this.freeGlobalRef_.pop()||++this.globalCounter_;return e.ref=n,i||(this.refToFeature_.set(n,e.feature),this.uidToRef_.set(t,n)),e}returnRef_(t,e){if(!t)throw new Error("This feature has no ref: "+e);this.refToFeature_.delete(t),this.uidToRef_.delete(e),this.freeGlobalRef_.push(t)}changeFeature(t){this.removeFeature(t);const e=t.getGeometry();e&&this.addGeometry_(e,t)}removeFeature(t){let e;e=this.clearFeatureEntryInPointBatch_(t)||e,e=this.clearFeatureEntryInPolygonBatch_(t)||e,e=this.clearFeatureEntryInLineStringBatch_(t)||e,e&&this.returnRef_(e.ref,(0,r.sq)(e.feature))}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0,this.globalCounter_=0,this.freeGlobalRef_=[],this.refToFeature_.clear(),this.uidToRef_.clear()}getFeatureFromRef(t){return this.refToFeature_.get(t)}}},29346:function(t,e,i){"use strict";i.d(e,{Z:function(){return S}});var n=i(68001),r=i(91512),s=i(30439),o=i(95230),a=i(4082),l=i(44669),h=i(81275),u=i(11570);function c(t,e,i,n){let r=0;for(const s in e){const o=e[s],a=o.callback.call(i,i.feature);t[n+r++]=a[0]??a,o.size&&1!==o.size&&(t[n+r++]=a[1],o.size<3||(t[n+r++]=a[2],o.size<4||(t[n+r++]=a[3])))}return r}function d(t){return Object.keys(t).reduce(((e,i)=>e+(t[i].size||1)),0)}var f=i(31871);const g=[],p=(0,h.U)();let m=0;const _="a_position",y="a_index",x="a_segmentStart",v="a_segmentEnd",E="a_parameters",b="a_joinAngles",w="a_distance";var S=class{constructor(t,e,i){this.helper_=e,this.hitDetectionEnabled_=i;let n=t;if(!("builder"in t)){const e=(0,f.Zh)(t);n={builder:e.builder,attributes:e.attributes,uniforms:e.uniforms}}this.hasFill_=!!n.builder.getFillVertexShader(),this.hasFill_&&(this.fillVertexShader_=n.builder.getFillVertexShader(),this.fillFragmentShader_=n.builder.getFillFragmentShader(),this.fillProgram_=this.helper_.getProgram(this.fillFragmentShader_,this.fillVertexShader_)),this.hasStroke_=!!n.builder.getStrokeVertexShader(),this.hasStroke_&&(this.strokeVertexShader_=n.builder.getStrokeVertexShader(),this.strokeFragmentShader_=n.builder.getStrokeFragmentShader(),this.strokeProgram_=this.helper_.getProgram(this.strokeFragmentShader_,this.strokeVertexShader_)),this.hasSymbol_=!!n.builder.getSymbolVertexShader(),this.hasSymbol_&&(this.symbolVertexShader_=n.builder.getSymbolVertexShader(),this.symbolFragmentShader_=n.builder.getSymbolFragmentShader(),this.symbolProgram_=this.helper_.getProgram(this.symbolFragmentShader_,this.symbolVertexShader_));const r=this.hitDetectionEnabled_?{hitColor:{callback(){return(0,a.O$)(this.ref,g)},size:4}}:{};this.customAttributes_=Object.assign({},r,n.attributes),this.uniforms_=n.uniforms;const o=Object.entries(this.customAttributes_).map((([t,e])=>({name:`a_prop_${t}`,size:e.size||1,type:s.GC.FLOAT})));this.polygonAttributesDesc_=[{name:_,size:2,type:s.GC.FLOAT},...o],this.lineStringAttributesDesc_=[{name:x,size:2,type:s.GC.FLOAT},{name:v,size:2,type:s.GC.FLOAT},{name:b,size:2,type:s.GC.FLOAT},{name:w,size:1,type:s.GC.FLOAT},{name:E,size:1,type:s.GC.FLOAT},...o],this.pointAttributesDesc_=[{name:_,size:2,type:s.GC.FLOAT},{name:y,size:1,type:s.GC.FLOAT},...o],n.uniforms&&this.helper_.addUniforms(n.uniforms)}async generateBuffers(t,e){const i=this.generateRenderInstructions_(t,e),[n,r,s]=await Promise.all([this.generateBuffersForType_(i.polygonInstructions,"Polygon",e),this.generateBuffersForType_(i.lineStringInstructions,"LineString",e),this.generateBuffersForType_(i.pointInstructions,"Point",e)]);return{polygonBuffers:n,lineStringBuffers:r,pointBuffers:s,invertVerticesTransform:(0,l.nb)((0,l.Ue)(),e)}}generateRenderInstructions_(t,e){const i=this.hasFill_?function(t,e,i,n){const r=2*t.verticesCount+(1+d(i))*t.geometriesCount+t.ringsCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t{const e=i=>{const o=i.data;if(o.id!==s)return;if(p.removeEventListener("message",e),!this.helper_.getGL())return;const a=new n.ZP(r.qO,r.kd).fromArrayBuffer(o.vertexBuffer),l=new n.ZP(r.cX,r.kd).fromArrayBuffer(o.indexBuffer);this.helper_.flushBufferData(a),this.helper_.flushBufferData(l),t([l,a])};p.addEventListener("message",e)}))}render(t,e,i){this.hasFill_&&this.renderInternal_(t.polygonBuffers[0],t.polygonBuffers[1],this.fillProgram_,this.polygonAttributesDesc_,e,i),this.hasStroke_&&this.renderInternal_(t.lineStringBuffers[0],t.lineStringBuffers[1],this.strokeProgram_,this.lineStringAttributesDesc_,e,i),this.hasSymbol_&&this.renderInternal_(t.pointBuffers[0],t.pointBuffers[1],this.symbolProgram_,this.pointAttributesDesc_,e,i)}renderInternal_(t,e,i,n,r,s){const o=t.getSize();0!==o&&(this.helper_.useProgram(i,r),this.helper_.bindBuffer(e),this.helper_.bindBuffer(t),this.helper_.enableAttributes(n),s(),this.helper_.drawElements(0,o))}}},95230:function(t,e,i){"use strict";i.d(e,{S:function(){return n}});const n={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"}},4082:function(t,e,i){"use strict";i.d(e,{O$:function(){return r},Vm:function(){return n},il:function(){return s}});i(61106);const n=.985;function r(t,e){const i=256,n=255;return(e=e||[])[0]=Math.floor(t/i/i/i)/n,e[1]=Math.floor(t/i/i)%i/n,e[2]=Math.floor(t/i)%i/n,e[3]=t%i/n,e}function s(t){let e=0;const i=256,n=255;return e+=Math.round(t[0]*i*i*i*n),e+=Math.round(t[1]*i*i*n),e+=Math.round(t[2]*i*n),e+=Math.round(t[3]*n),e}},3656:function(t,e,i){"use strict";var n=i(92486),r=i(13701),s=i(21320),o=i(22765);class a extends s.Z{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return(0,o.O3)()}getData(t){return null}prepareFrame(t){return(0,o.O3)()}renderFrame(t,e){return(0,o.O3)()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const s=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,s)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==r.Z.LOADED&&e.getState()!==r.Z.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=r.Z.LOADED&&e!=r.Z.ERROR&&t.addEventListener(n.Z.CHANGE,this.boundHandleImageChange_),e==r.Z.IDLE&&(t.load(),e=t.getState()),e==r.Z.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}e.Z=a},89194:function(t,e,i){"use strict";var n=i(57913),r=i(13701),s=i(87334),o=i(44669),a=i(36117),l=i(81625);class h extends n.Z{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,o=n.resolution,h=this.getLayer().getSource(),u=t.viewHints;let c=t.extent;if(void 0!==e.extent&&(c=(0,a.Ed)(c,(0,l.dY)(e.extent,n.projection))),!u[s.Z.ANIMATING]&&!u[s.Z.INTERACTING]&&!(0,a.xb)(c))if(h){const t=n.projection,e=h.getImage(c,o,i,t);e&&(this.loadImage(e)?this.image_=e:e.getState()===r.Z.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,o.nn)(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!(0,a.b8)(r,n))return null;const s=this.image_.getExtent(),l=this.image_.getImage(),h=(0,a.dz)(s),u=Math.floor(l.width*((n[0]-s[0])/h));if(u<0||u>=l.width)return null;const c=(0,a.Cr)(s),d=Math.floor(l.height*((s[3]-n[1])/c));return d<0||d>=l.height?null:this.getImageData(l,u,d)}renderFrame(t,e){const i=this.image_,n=i.getExtent(),r=i.getResolution(),[s,h]=Array.isArray(r)?r:[r,r],u=i.getPixelRatio(),c=t.layerStatesArray[t.layerIndex],d=t.pixelRatio,f=t.viewState,g=f.center,p=f.resolution,m=d*s/(p*u),_=d*h/(p*u),y=t.extent,x=f.resolution,v=f.rotation,E=Math.round((0,a.dz)(y)/x*d),b=Math.round((0,a.Cr)(y)/x*d);(0,o.qC)(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/d,1/d,v,-E/2,-b/2),(0,o.nb)(this.inversePixelTransform,this.pixelTransform);const w=(0,o.BB)(this.pixelTransform);this.useContainer(e,w,this.getBackground(t));const S=this.context,C=S.canvas;C.width!=E||C.height!=b?(C.width=E,C.height=b):this.containerReused||S.clearRect(0,0,E,b);let T=!1,M=!0;if(c.extent){const e=(0,l.dY)(c.extent,f.projection);M=(0,a.kK)(e,t.extent),T=M&&!(0,a.r4)(e,t.extent),T&&this.clipUnrotated(S,t,e)}const P=i.getImage(),R=(0,o.qC)(this.tempTransform,E/2,b/2,m,_,0,u*(n[0]-g[0])/s,u*(g[1]-n[3])/h);this.renderedResolution=h*d/u;const I=P.width*R[0],A=P.height*R[3];if(this.getLayer().getSource().getInterpolate()||(S.imageSmoothingEnabled=!1),this.preRender(S,t),M&&I>=.5&&A>=.5){const t=R[4],e=R[5],i=c.opacity;let n;1!==i&&(n=S.globalAlpha,S.globalAlpha=i),S.drawImage(P,0,0,+P.width,+P.height,t,e,I,A),1!==i&&(S.globalAlpha=n)}return this.postRender(S,t),T&&S.restore(),S.imageSmoothingEnabled=!0,w!==C.style.transform&&(C.style.transform=w),this.container}}e.Z=h},57913:function(t,e,i){"use strict";i.d(e,{r:function(){return c}});var n=i(3656),r=i(44594),s=i(95474),o=i(44669),a=i(12185),l=i(850),h=i(17367),u=i(36117);const c=[];let d=null;class f extends n.Z{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=(0,o.Ue)(),this.pixelTransform=(0,o.Ue)(),this.inversePixelTransform=(0,o.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;d||(d=(0,l.E4)(1,1,void 0,{willReadFrequently:!0})),d.clearRect(0,0,1,1);try{d.drawImage(t,e,i,1,1,0,0,1,1),n=d.getImageData(0,0,1,1).data}catch(t){return d=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&(0,h.fS)((0,a._2)(t.style.backgroundColor),(0,a._2)(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(s=e.getContext("2d"))}if(s&&s.canvas.style.transform===e?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=(0,l.E4)();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=(0,u.rL)(i),r=(0,u.Xv)(i),s=(0,u.w$)(i),a=(0,u.hC)(i);(0,o.nn)(e.coordinateToPixelTransform,n),(0,o.nn)(e.coordinateToPixelTransform,r),(0,o.nn)(e.coordinateToPixelTransform,s),(0,o.nn)(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,o.nn)(l,n),(0,o.nn)(l,r),(0,o.nn)(l,s),(0,o.nn)(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new r.Z(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(s.Z.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(s.Z.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,s,a){const l=r/2,h=s/2,u=n/e,c=-u,d=-t[0]+a,f=-t[1];return(0,o.qC)(this.tempTransform,l,h,u,c,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}e.Z=f},44235:function(t,e,i){"use strict";var n=i(57913),r=i(27859),s=i(27139),o=i(51748),a=i(74251),l=i(44669),h=i(17367),u=i(36117),c=i(81625),d=i(22765),f=i(81898);class g extends n.Z{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,u.lJ)(),this.tmpTileRange_=new o.Z(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==a.Z.LOADED||i==a.Z.EMPTY||i==a.Z.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer();let l=o.getSource().getTile(t,e,i,r,s);return l.getState()==a.Z.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(l)||(l=l.getInterimTile()),l}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,l.nn)(e.pixelToCoordinateTransform,t.slice()),o=i.getExtent();if(o&&!(0,u.b8)(o,n))return null;const h=e.pixelRatio,c=e.viewState.projection,d=e.viewState,g=i.getRenderSource(),p=g.getTileGridForProjection(d.projection),m=g.getTilePixelRatio(e.pixelRatio);for(let t=p.getZForResolution(d.resolution);t>=p.getMinZoom();--t){const e=p.getTileCoordForCoordAndZ(n,t),i=g.getTile(t,e[1],e[2],h,c);if(!(i instanceof r.Z||i instanceof s.Z)||i instanceof s.Z&&i.getState()===a.Z.EMPTY)return null;if(i.getState()!==a.Z.LOADED)continue;const o=p.getOrigin(t),l=(0,f.Pq)(p.getTileSize(t)),u=p.getResolution(t),_=Math.floor(m*((n[0]-o[0])/u-e[1]*l[0])),y=Math.floor(m*((o[1]-n[1])/u-e[2]*l[1])),x=Math.round(m*g.getGutterForProjection(d.projection));return this.getImageData(i.getImage(),_+x,y+x)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,f=n.rotation,g=t.pixelRatio,p=this.getLayer(),m=p.getSource(),_=m.getRevision(),y=m.getTileGridForProjection(r),x=y.getZForResolution(s,m.zDirection),v=y.getResolution(x);let E=t.extent;const b=t.viewState.resolution,w=m.getTilePixelRatio(g),S=Math.round((0,u.dz)(E)/b*g),C=Math.round((0,u.Cr)(E)/b*g),T=i.extent&&(0,c.dY)(i.extent,r);T&&(E=(0,u.Ed)(E,(0,c.dY)(i.extent,r)));const M=v*S/2/w,P=v*C/2/w,R=[o[0]-M,o[1]-P,o[0]+M,o[1]+P],I=y.getTileRangeForExtentAndZ(E,x),A={};A[x]={};const L=this.createLoadedTileFinder(m,r,A),F=this.tmpExtent,O=this.tmpTileRange_;this.newTiles_=!1;const Z=f?(0,u.dY)(n.center,b,f,t.size):void 0;for(let e=I.minX;e<=I.maxX;++e)for(let n=I.minY;n<=I.maxY;++n){if(f&&!y.tileCoordIntersectsViewport([x,e,n],Z))continue;const r=this.getTile(x,e,n,t);if(this.isDrawableTile(r)){const e=(0,d.sq)(this);if(r.getState()==a.Z.LOADED){A[x][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==i.opacity&&(r.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(r)||(this.newTiles_=!0)}if(1===r.getAlpha(e,t.time))continue}const s=y.getTileCoordChildTileRange(r.tileCoord,O,F);let o=!1;s&&(o=L(x+1,s)),o||y.forEachTileCoordParentTileRange(r.tileCoord,L,O,F)}const k=v/s*g/w;(0,l.qC)(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/g,1/g,f,-S/2,-C/2);const D=(0,l.BB)(this.pixelTransform);this.useContainer(e,D,this.getBackground(t));const N=this.context,G=N.canvas;(0,l.nb)(this.inversePixelTransform,this.pixelTransform),(0,l.qC)(this.tempTransform,S/2,C/2,k,k,0,-S/2,-C/2),G.width!=S||G.height!=C?(G.width=S,G.height=C):this.containerReused||N.clearRect(0,0,S,C),T&&this.clipUnrotated(N,t,T),m.getInterpolate()||(N.imageSmoothingEnabled=!1),this.preRender(N,t),this.renderedTiles.length=0;let z,j,U,B=Object.keys(A).map(Number);B.sort(h.j2),1!==i.opacity||this.containerReused&&!m.getOpaque(t.viewState.projection)?(z=[],j=[]):B=B.reverse();for(let e=B.length-1;e>=0;--e){const i=B[e],n=m.getTilePixelSize(i,g,r),s=y.getResolution(i)/v,o=n[0]*s*k,a=n[1]*s*k,h=y.getTileCoordForCoordAndZ((0,u.rL)(R),i),c=y.getTileCoordExtent(h),f=(0,l.nn)(this.tempTransform,[w*(c[0]-R[0])/v,w*(R[3]-c[3])/v]),p=w*m.getGutterForProjection(r),_=A[i];for(const e in _){const n=_[e],r=n.tileCoord,s=h[1]-r[1],l=Math.round(f[0]-(s-1)*o),c=h[2]-r[2],g=Math.round(f[1]-(c-1)*a),y=Math.round(f[0]-s*o),v=Math.round(f[1]-c*a),E=l-y,b=g-v,w=x===i,S=w&&1!==n.getAlpha((0,d.sq)(this),t.time);let C=!1;if(!S)if(z){U=[y,v,y+E,v,y+E,v+b,y,v+b];for(let t=0,e=z.length;t{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];(0,h.nn)(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],c=t[0]*l.UN,d=t[1]*l.UN;a.push(this.getRenderTransform(e,i,n,l.UN,c,d,0).slice());const f=o.getSource(),g=r.getExtent();if(f.getWrapX()&&r.canWrapX()&&!(0,u.r4)(g,s)){let t=s[0];const r=(0,u.dz)(g);let o,h=0;for(;tg[2];)++h,o=r*h,a.push(this.getRenderTransform(e,i,n,l.UN,c,d,o).slice()),t-=r}this.hitDetectionImageData_=(0,l.TU)(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n)}e((0,l.ix)(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const s=(0,p.sq)(t),o=l[s];if(o){if(!0!==o&&iu=n.forEachFeatureAtCoordinate(t,s,o,i,h,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const r=t.viewHints[a.Z.ANIMATING],o=t.viewHints[a.Z.INTERACTING],l=e.getUpdateWhileAnimating(),h=e.getUpdateWhileInteracting();if(this.ready&&!l&&r||!h&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const c=t.extent,p=t.viewState,_=p.projection,y=p.resolution,x=t.pixelRatio,v=e.getRevision(),E=e.getRenderBuffer();let b=e.getRenderOrder();void 0===b&&(b=d.eR);const w=p.center.slice(),S=(0,u.f3)(c,E*y),C=S.slice(),T=[S.slice()],M=_.getExtent();if(i.getWrapX()&&_.canWrapX()&&!(0,u.r4)(M,t.extent)){const t=(0,u.dz)(M),e=Math.max((0,u.dz)(S)/2,t);S[0]=M[0]-e,S[2]=M[2]+e,(0,m.Cf)(w,_);const i=(0,u.Cf)(T[0],_);i[0]M[0]&&i[2]>M[2]&&T.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==y&&this.renderedRevision_==v&&this.renderedRenderOrder_==b&&(0,u.r4)(this.wrappedRenderedExtent_,S))return(0,f.fS)(this.renderedExtent_,C)||(this.hitDetectionImageData_=null,this.renderedExtent_=C),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const P=new n.Z((0,d.Qz)(y,x),S,y,x);let R;this.getLayer().getDeclutter()&&(R=new n.Z((0,d.Qz)(y,x),S,y,x));const I=(0,g.Cs)();let A;if(I){for(let t=0,e=T.length;t{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,y)),i){const e=this.renderFeature(t,L,i,P,A,R);F=F&&!e}},Z=(0,g.Fj)(S,_),k=i.getFeaturesInExtent(Z);b&&k.sort(b);for(let t=0,e=k.length;t0;return f&&Promise.all(h).then((()=>s(null))),function(t,e,i,n,r,s){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)c(t,l,i,e);else{(0,o[l.getType()])(t,l,i,e,s)}}(t,e,i,r,a,l),f}function c(t,e,i,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,s=r.length;e{const e=t.data;if(e.type===c.S.GENERATE_POINT_BUFFERS){const i=e.projectionTransform;this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,(0,d.nb)(this.invertRenderTransform_,this.renderTransform_),this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.id===this.lastSentId&&(this.ready=!0),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const a=this.getLayer().getSource();this.sourceListenKeys_=[(0,v.oL)(a,r.Z.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,v.oL)(a,r.Z.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,v.oL)(a,r.Z.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,v.oL)(a,r.Z.CLEAR,this.handleSourceFeatureClear_,this)],a.forEachFeature((t=>{this.featureCache_[(0,y.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new l.Z(this.helper))}handleSourceFeatureAdded_(t){const e=t.feature;this.featureCache_[(0,y.sq)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(t){const e=t.feature;this.featureCache_[(0,y.sq)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}handleSourceFeatureDelete_(t){const e=t.feature;delete this.featureCache_[(0,y.sq)(e)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=(0,x.X)(t,this.getLayer());this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t);return this.helper.getCanvas()}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),r=t.viewState,o=!t.viewHints[s.Z.ANIMATING]&&!t.viewHints[s.Z.INTERACTING],a=!(0,g.fS)(this.previousExtent_,t.extent),l=this.sourceRevision_0&&(x=a,(0,b.Ed)(x,n,x)),this.helper.setUniformFloatVec4(C.RENDER_EXTENT,x),this.helper.setUniformFloatValue(C.RESOLUTION,f.resolution),this.helper.setUniformFloatValue(C.ZOOM,f.zoom),this.helper.setUniformFloatValue(C.TEXTURE_PIXEL_WIDTH,g),this.helper.setUniformFloatValue(C.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(C.TEXTURE_RESOLUTION,r),this.helper.setUniformFloatValue(C.TEXTURE_ORIGIN_X,o[0]+_*s[0]*r-h*r),this.helper.setUniformFloatValue(C.TEXTURE_ORIGIN_Y,o[1]-y*s[1]*r+h*r),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const e=this.frameState;if(!e)return null;const i=this.getLayer(),o=(0,E.nn)(e.pixelToCoordinateTransform,t.slice()),a=e.viewState,l=i.getExtent();if(l&&!(0,b.b8)((0,w.dY)(l,a.projection),o))return null;const h=i.getSources((0,b.hI)([o]),a.resolution);let u,c,d;for(u=h.length-1;u>=0;--u)if(c=h[u],"ready"===c.getState()){if(d=c.getTileGridForProjection(a.projection),c.getWrapX())break;const t=d.getExtent();if(!t||(0,b.b8)(t,o))break}if(u<0)return null;const g=this.tileRepresentationCache;for(let t=d.getZForResolution(a.resolution);t>=d.getMinZoom();--t){const e=d.getTileCoordForCoordAndZ(o,t),i=(0,x.ah)(c,e);if(!g.containsKey(i))continue;const a=g.get(i),l=a.tile;if((l instanceof r.Z||l instanceof n.Z)&&l.getState()===s.Z.EMPTY)return null;if(!a.loaded)continue;const h=d.getOrigin(t),u=(0,f.Pq)(d.getTileSize(t)),p=d.getResolution(t),m=(o[0]-h[0])/p-e[1]*u[0],_=(h[1]-o[1])/p-e[2]*u[1];return a.getPixelData(m,_)}return null}disposeInternal(){const t=this.helper;if(t){t.getGL().deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}var R=P},83044:function(t,e,i){"use strict";i.d(e,{XE:function(){return _},ah:function(){return w}});var n=i(80316),r=i(40485),s=i(27139),o=i(51748),a=i(74251),l=i(29295),h=i(22765),u=i(94704),c=i(69649),d=i(44669),f=i(17367),g=i(81625),p=i(36117),m=i(81898);const _={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"},y={};function x(t){return 1/(t+2)}function v(t,e){return t.tileIds.has((0,h.sq)(e))}function E(t,e,i){const n=t.representationsByZ;i in n||(n[i]=new Set),n[i].add(e),t.tileIds.add((0,h.sq)(e.tile))}function b(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=(0,p.Ed)(e,(0,g.dY)(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=(0,p.Ed)(e,i))}return e}function w(t,e){return`${t.getKey()},${(0,c.km)(e)}`}class S extends l.Z{constructor(t,e){super(t,{uniforms:e.uniforms,postProcesses:e.postProcesses}),this.renderComplete=!1,this.tileTransform_=(0,d.Ue)(),this.tempMat4=(0,u.U)(),this.tempTileRange_=new o.Z(0,0,0,0),this.tempTileCoord_=(0,c.T9)(0,0,0),this.tempSize_=[0,0];const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileRepresentationCache=new n.Z(i),this.frameState=null,this.projection_=void 0}reset(t){super.reset({uniforms:t.uniforms})}isDrawableTile_(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==a.Z.LOADED||i==a.Z.EMPTY||i==a.Z.ERROR&&!n}prepareFrameInternal(t){this.projection_?t.viewState.projection!==this.projection_&&(this.clearCache(),this.projection_=t.viewState.projection):this.projection_=t.viewState.projection;const e=this.getLayer().getRenderSource();return!!e&&(!(0,p.xb)(b(t,t.extent))&&"ready"===e.getState())}createTileRepresentation(t){return(0,h.O3)()}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),l=o.getRenderSource(),u=l.getTileGridForProjection(s.projection),d=l.getGutterForProjection(s.projection),f=(0,h.sq)(l);f in t.wantedTiles||(t.wantedTiles[f]={});const g=t.wantedTiles[f],p=this.tileRepresentationCache,m=o.getMapInternal(),_=Math.max(i-r,u.getMinZoom(),u.getZForResolution(Math.min(o.getMaxResolution(),m?m.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):u.getResolution(0)),l.zDirection));for(let r=i;r>=_;--r){const i=u.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),o=u.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let h=i.minY;h<=i.maxY;++h){const i=(0,c.T9)(r,e,h,this.tempTileCoord_),m=w(l,i);let _,y;if(p.containsKey(m)&&(_=p.get(m),y=_.tile),_&&_.tile.key===l.getKey()||(y=l.getTile(r,e,h,t.pixelRatio,s.projection)),v(n,y))continue;if(_)if(this.isDrawableTile_(y))_.setTile(y);else{const t=y.getInterimTile();_.setTile(t)}else _=this.createTileRepresentation({tile:y,grid:u,helper:this.helper,gutter:d}),p.set(m,_);E(n,_,r);const x=y.getKey();g[x]=!0,y.getState()===a.Z.IDLE&&(t.tileQueue.isKeyQueued(x)||t.tileQueue.enqueue([y,f,u.getTileCoordCenter(i),o]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,n,r,s,o,a,l,h,u){}renderTileMask(t,e,i,n){}drawTile_(t,e,i,n,r,s,o){if(!e.ready)return;const a=e.tile.tileCoord,l=(0,c.km)(a),h=l in s?s[l]:1,u=o.getResolution(i),f=(0,m.Pq)(o.getTileSize(i),this.tempSize_),g=o.getOrigin(i),p=o.getTileCoordExtent(a),_=h<1?-1:x(i);h<1&&(t.animate=!0);const y=t.viewState,v=y.center[0],E=y.center[1],b=f[0]+2*n,w=f[1]+2*n,S=b/w,C=(v-g[0])/(f[0]*u),T=(g[1]-E)/(f[1]*u),M=y.resolution/u,P=a[1],R=a[2];(0,d.mc)(this.tileTransform_),(0,d.bA)(this.tileTransform_,2/(t.size[0]*M/b),-2/(t.size[1]*M/b)),(0,d.U1)(this.tileTransform_,y.rotation),(0,d.bA)(this.tileTransform_,1,1/S),(0,d.Iu)(this.tileTransform_,(f[0]*(P-C)-n)/b,(f[1]*(R-T)-n)/w),this.renderTile(e,this.tileTransform_,t,r,u,f,g,p,_,n,h)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,n=this.getLayer(),o=n.getRenderSource(),l=o.getTileGridForProjection(i.projection),u=o.getGutterForProjection(i.projection),d=b(t,t.extent),g=l.getZForResolution(i.resolution,o.zDirection),p={tileIds:new Set,representationsByZ:{}},m=n.getPreload();if(t.nextExtent){const e=l.getZForResolution(i.nextResolution,o.zDirection),n=b(t,t.nextExtent);this.enqueueTiles(t,n,e,p,m)}this.enqueueTiles(t,d,g,p,0),m>0&&setTimeout((()=>{this.enqueueTiles(t,d,g-1,p,m-1)}),0);const _={},v=(0,h.sq)(this),E=t.time;let w=!1;for(const t of p.representationsByZ[g]){const e=t.tile;if((e instanceof s.Z||e instanceof r.Z)&&e.getState()===a.Z.EMPTY)continue;const i=e.tileCoord;if(t.ready){const t=e.getAlpha(v,E);if(1===t){e.endTransition(v);continue}w=!0;_[(0,c.km)(i)]=t}this.renderComplete=!1;if(this.findAltTiles_(l,i,g+1,p))continue;const n=l.getMinZoom();for(let t=g-1;t>=n;--t){if(this.findAltTiles_(l,i,t,p))break}}const S=p.representationsByZ,C=Object.keys(S).map(Number).sort(f.$1);if(this.beforeTilesMaskRender(t))for(let t=0,e=C.length;tt.dispose())),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){super.disposeInternal(),delete this.frameState}}e.ZP=S},11395:function(t,e,i){"use strict";var n=i(9050),r=i(53214),s=i(70487),o=i(29346),a=i(87334),l=i(29295),h=i(67953),u=i(30439),c=i(44669),d=i(23422),f=i(36117),g=i(4082),p=i(94704),m=i(81625),_=i(59332),y=i(41507);const x={...u.ZC,RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",GLOBAL_ALPHA:"u_globalAlpha"};class v extends l.Z{constructor(t,e){super(t,{uniforms:{[x.RENDER_EXTENT]:[0,0,0,0],[x.PATTERN_ORIGIN]:[0,0],[x.GLOBAL_ALPHA]:1},postProcesses:e.postProcesses}),this.hitDetectionEnabled_=!e.disableHitDetection,this.hitRenderTarget_,this.sourceRevision_=-1,this.previousExtent_=(0,f.lJ)(),this.currentTransform_=(0,c.Ue)(),this.tmpCoords_=[0,0],this.tmpTransform_=(0,c.Ue)(),this.tmpMat4_=(0,p.U)(),this.currentFrameStateTransform_=(0,c.Ue)(),this.styles_=[],this.styleRenderers_=[],this.buffers_=[],this.applyOptions_(e),this.batch_=new r.Z,this.initialFeaturesAdded_=!1,this.sourceListenKeys_=null}addInitialFeatures_(t){const e=this.getLayer().getSource(),i=(0,m.Cs)();let n;i&&(n=(0,m.WO)(i,t.viewState.projection)),this.batch_.addFeatures(e.getFeatures(),n),this.sourceListenKeys_=[(0,y.oL)(e,s.Z.ADDFEATURE,this.handleSourceFeatureAdded_.bind(this,n),this),(0,y.oL)(e,s.Z.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,y.oL)(e,s.Z.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,y.oL)(e,s.Z.CLEAR,this.handleSourceFeatureClear_,this)]}applyOptions_(t){this.styles_=Array.isArray(t.style)?t.style:[t.style]}createRenderers_(){this.buffers_=[],this.styleRenderers_=this.styles_.map((t=>new o.Z(t,this.helper,this.hitDetectionEnabled_)))}reset(t){this.applyOptions_(t),this.helper&&this.createRenderers_(),super.reset(t)}afterHelperCreated(){this.createRenderers_(),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new h.Z(this.helper))}handleSourceFeatureAdded_(t,e){const i=e.feature;this.batch_.addFeature(i,t)}handleSourceFeatureChanged_(t){const e=t.feature;this.batch_.changeFeature(e)}handleSourceFeatureDelete_(t){const e=t.feature;this.batch_.removeFeature(e)}handleSourceFeatureClear_(){this.batch_.clear()}applyUniforms_(t){(0,c.lk)(this.tmpTransform_,this.currentFrameStateTransform_),(0,c.Jp)(this.tmpTransform_,t),this.helper.setUniformMatrixValue(x.PROJECTION_MATRIX,(0,p.u)(this.tmpMat4_,this.tmpTransform_)),(0,c.nb)(this.tmpTransform_,this.tmpTransform_),this.helper.setUniformMatrixValue(x.SCREEN_TO_WORLD_MATRIX,(0,p.u)(this.tmpMat4_,this.tmpTransform_)),this.tmpCoords_[0]=0,this.tmpCoords_[1]=0,(0,c.nb)(this.tmpTransform_,t),(0,c.nn)(this.tmpTransform_,this.tmpCoords_),this.helper.setUniformFloatVec2(x.PATTERN_ORIGIN,this.tmpCoords_)}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=(0,_.X)(t,this.getLayer());this.helper.prepareDraw(t),this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t);const s=this.helper.getCanvas(),o=t.layerStatesArray[t.layerIndex].opacity;return o!==parseFloat(s.style.opacity)&&(s.style.opacity=String(o)),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t),s}prepareFrameInternal(t){this.initialFeaturesAdded_||(this.addInitialFeatures_(t),this.initialFeaturesAdded_=!0);const e=this.getLayer(),i=e.getSource(),r=t.viewState,s=!t.viewHints[a.Z.ANIMATING]&&!t.viewHints[a.Z.INTERACTING],o=!(0,f.fS)(this.previousExtent_,t.extent),l=this.sourceRevision_t.generateBuffers(this.batch_,u).then((t=>{this.buffers_[e]=t}))));Promise.all(d).then((()=>{this.ready=!0,this.getLayer().changed()})),this.previousExtent_=t.extent.slice()}return!0}renderWorlds(t,e,i,n,r){let s=i;e&&(this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0)),this.currentFrameStateTransform_=this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_);do{for(let i=0,n=this.styleRenderers_.length;i{this.applyUniforms_(r.invertVerticesTransform),this.helper.applyHitDetectionUniform(e)}))}(0,c.Iu)(this.currentFrameStateTransform_,r,0)}while(++s2||Math.abs(t[4*e+3]-191.25)>2}function c(t,e,i,r){const o=(0,s.vs)(i,e,t);let a=(0,s._Q)(e,r,i);const l=e.getMetersPerUnit();void 0!==l&&(a*=l);const h=t.getMetersPerUnit();void 0!==h&&(a/=h);const u=t.getExtent();if(!u||(0,n.b8)(u,o)){const e=(0,s._Q)(t,a,o)/a;isFinite(e)&&e>0&&(a/=e)}return a}function d(t,e,i,r){const s=(0,n.qg)(i);let o=c(t,e,s,r);return(!isFinite(o)||o<=0)&&(0,n.H6)(i,(function(i){return o=c(t,e,i,r),isFinite(o)&&o>0})),o}function f(t,e,i,s,c,d,f,g,p,m,_,y,x){const v=(0,r.E4)(Math.round(i*t),Math.round(i*e),l);if(y||(v.imageSmoothingEnabled=!1),0===p.length)return v.canvas;function E(t){return Math.round(t*i)/i}v.scale(i,i),v.globalCompositeOperation="lighter";const b=(0,n.lJ)();let w;p.forEach((function(t,e,i){(0,n.l7)(b,t.extent)}));const S=i/s,C=(y?1:1+Math.pow(2,-24))/S;x&&1===p.length&&0===m||(w=(0,r.E4)(Math.round((0,n.dz)(b)*S),Math.round((0,n.Cr)(b)*S),l),y||(w.imageSmoothingEnabled=!1),p.forEach((function(t,e,i){const r=(t.extent[0]-b[0])*S,s=-(t.extent[3]-b[3])*S,o=(0,n.dz)(t.extent)*S,a=(0,n.Cr)(t.extent)*S;t.image.width>0&&t.image.height>0&&w.drawImage(t.image,m,m,t.image.width-2*m,t.image.height-2*m,y?r:Math.round(r),y?s:Math.round(s),y?o:Math.round(r+o)-Math.round(r),y?a:Math.round(s+a)-Math.round(s))})));const T=(0,n.rL)(f);return g.getTriangles().forEach((function(t,e,i){const s=t.source,c=t.target;let f=s[0][0],g=s[0][1],m=s[1][0],_=s[1][1],x=s[2][0],S=s[2][1];const M=E((c[0][0]-T[0])/d),P=E(-(c[0][1]-T[1])/d),R=E((c[1][0]-T[0])/d),I=E(-(c[1][1]-T[1])/d),A=E((c[2][0]-T[0])/d),L=E(-(c[2][1]-T[1])/d),F=f,O=g;f=0,g=0,m-=F,_-=O,x-=F,S-=O;const Z=[[m,_,0,0,R-M],[x,S,0,0,A-M],[0,0,m,_,I-P],[0,0,x,S,L-P]],k=(0,o.SV)(Z);if(!k)return;if(v.save(),v.beginPath(),function(){if(void 0===a){const t=(0,r.E4)(6,6,l);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",h(t,4,5,4,0),h(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;a=u(e,0)||u(e,4)||u(e,8),(0,r.jy)(t),l.push(t.canvas)}return a}()||!y){v.moveTo(R,I);const t=4,e=M-R,i=P-I;for(let n=0;nPromise.resolve(new Uint8Array(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),i=this.targetTileGrid_.getExtent();let r=this.sourceTileGrid_.getExtent();const s=i?(0,c.Ed)(e,i):e;if(0===(0,c.bg)(s))return void(this.state=o.Z.EMPTY);const u=t.sourceProj,d=u.getExtent();d&&(r=r?(0,c.Ed)(r,d):d);const f=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),g=t.targetProj,p=(0,l.Co)(u,g,s,f);if(!isFinite(p)||p<=0)return void(this.state=o.Z.EMPTY);const m=void 0!==t.errorThreshold?t.errorThreshold:n.m;if(this.triangulation_=new a.Z(u,g,s,r,p*m,f),0===this.triangulation_.getTriangles().length)return void(this.state=o.Z.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(p);let _=this.triangulation_.calculateSourceExtent();if(r&&(u.canWrapX()?(_[1]=(0,h.uZ)(_[1],r[1],r[3]),_[3]=(0,h.uZ)(_[3],r[1],r[3])):_=(0,c.Ed)(_,r)),(0,c.bg)(_)){const e=this.sourceTileGrid_.getTileRangeForExtentAndZ(_,this.sourceZ_),i=t.getTileFunction;for(let t=e.minX;t<=e.maxX;t++)for(let n=e.minY;n<=e.maxY;n++){const e=i(this.sourceZ_,t,n,this.pixelRatio_);e&&this.sourceTiles_.push(e)}0===this.sourceTiles_.length&&(this.state=o.Z.EMPTY)}else this.state=o.Z.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{if(!e||e.getState()!==o.Z.LOADED)return;const i=e.getSize(),n=this.gutter_;let s;const a=(0,r.px)(e.getData());s=a||(0,r.qo)((0,r.G0)(e.getData()));const l=[i[0]+2*n,i[1]+2*n],h=s instanceof Float32Array,u=l[0]*l[1],c=h?Float32Array:Uint8Array,d=new c(s.buffer),f=c.BYTES_PER_ELEMENT,g=f*d.length/u,p=d.byteLength/l[1],m=Math.floor(p/f/l[0]),_=u*m;let y=d;if(d.length!==_){y=new c(_);let t=0,e=0;const i=l[0]*m;for(let n=0;n=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==o.Z.IDLE&&i!==o.Z.LOADING)return;t++;const n=(0,d.oL)(e,s.Z.CHANGE,(function(){const i=e.getState();i!=o.Z.LOADED&&i!=o.Z.ERROR&&i!=o.Z.EMPTY||((0,d.bN)(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t){t.getState()==o.Z.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(d.bN),this.sourcesListenerKeys_=null}}e.Z=f},27139:function(t,e,i){"use strict";var n=i(41948),r=i(92486),s=i(69319),o=i(74251),a=i(76423),l=i(17708),h=i(63312),u=i(36117),c=i(41507),d=i(850);class f extends s.Z{constructor(t,e,i,r,s,c,d,f,g,p,m,_){super(s,o.Z.IDLE,_),this.renderEdges_=void 0!==m&&m,this.pixelRatio_=d,this.gutter_=f,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=c||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const y=r.getTileCoordExtent(this.wrappedTileCoord_),x=this.targetTileGrid_.getExtent();let v=this.sourceTileGrid_.getExtent();const E=x?(0,u.Ed)(y,x):y;if(0===(0,u.bg)(E))return void(this.state=o.Z.EMPTY);const b=t.getExtent();b&&(v=v?(0,u.Ed)(v,b):b);const w=r.getResolution(this.wrappedTileCoord_[0]),S=(0,l.Co)(t,i,E,w);if(!isFinite(S)||S<=0)return void(this.state=o.Z.EMPTY);const C=void 0!==p?p:n.m;if(this.triangulation_=new a.Z(t,i,E,v,S*C,w),0===this.triangulation_.getTriangles().length)return void(this.state=o.Z.EMPTY);this.sourceZ_=e.getZForResolution(S);let T=this.triangulation_.calculateSourceExtent();if(v&&(t.canWrapX()?(T[1]=(0,h.uZ)(T[1],v[1],v[3]),T[3]=(0,h.uZ)(T[3],v[1],v[3])):T=(0,u.Ed)(T,v)),(0,u.bg)(T)){const t=e.getTileRangeForExtentAndZ(T,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=g(this.sourceZ_,e,i,d);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=o.Z.EMPTY)}else this.state=o.Z.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==o.Z.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=o.Z.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),h=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=(0,l.sY)(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),s,h,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=o.Z.LOADED}this.changed()}load(){if(this.state==o.Z.IDLE){this.state=o.Z.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==o.Z.IDLE||i==o.Z.LOADING){t++;const i=(0,c.oL)(e,r.Z.CHANGE,(function(n){const r=e.getState();r!=o.Z.LOADED&&r!=o.Z.ERROR&&r!=o.Z.EMPTY||((0,c.bN)(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){t.getState()==o.Z.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(c.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,d.jy)(this.canvas_.getContext("2d")),l.rX.push(this.canvas_),this.canvas_=null),super.release()}}e.Z=f},76423:function(t,e,i){"use strict";var n=i(36117),r=i(81625),s=i(63312);e.Z=class{constructor(t,e,i,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=(0,r.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return l[e]||(l[e]=h(t)),l[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&(0,n.dz)(s)>=(0,n.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,n.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,n.dz)(this.targetProj_.getExtent()):null;const u=(0,n.rL)(i),c=(0,n.Xv)(i),d=(0,n.w$)(i),f=(0,n.hC)(i),g=this.transformInv_(u),p=this.transformInv_(c),m=this.transformInv_(d),_=this.transformInv_(f),y=10+(a?Math.max(0,Math.ceil(Math.log2((0,n.bg)(i)/(a*a*256*256)))):0);if(this.addQuad_(u,c,d,f,g,p,m,_,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&d<1;let p=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const s=(0,n.hI)([t,e,i,r]);p=(0,n.dz)(s)/this.targetWorldWidth_>.25||p}!g&&this.sourceProj_.isGlobal()&&d&&(p=d>.25||p)}if(!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,n.kK)(c,this.maxSourceExtent_))return;let m=0;if(!(p||isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(l[0])&&isFinite(l[1])&&isFinite(h[0])&&isFinite(h[1])))if(u>0)p=!0;else if(m=(isFinite(o[0])&&isFinite(o[1])?0:8)+(isFinite(a[0])&&isFinite(a[1])?0:4)+(isFinite(l[0])&&isFinite(l[1])?0:2)+(isFinite(h[0])&&isFinite(h[1])?0:1),1!=m&&2!=m&&4!=m&&8!=m)return;if(u>0){if(!p){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(g){r=((0,s.$W)(o[0],f)+(0,s.$W)(l[0],f))/2-(0,s.$W)(n[0],f)}else r=(o[0]+l[0])/2-n[0];const a=(o[1]+l[1])/2-n[1];p=r*r+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const n=[(e[0]+i[0])/2,(e[1]+i[1])/2],s=this.transformInv_(n),c=[(r[0]+t[0])/2,(r[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,n,c,o,a,s,d,u-1),this.addQuad_(c,n,i,r,d,s,l,h,u-1)}else{const n=[(t[0]+e[0])/2,(t[1]+e[1])/2],s=this.transformInv_(n),c=[(i[0]+r[0])/2,(i[1]+r[1])/2],d=this.transformInv_(c);this.addQuad_(t,n,c,r,o,s,d,h,u-1),this.addQuad_(n,e,i,c,s,a,l,d,u-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&m)&&this.addTriangle_(t,i,r,o,l,h),0==(14&m)&&this.addTriangle_(t,i,e,o,l,a),m&&(0==(13&m)&&this.addTriangle_(e,r,t,a,h,o),0==(7&m)&&this.addTriangle_(e,r,i,a,h,l))}calculateSourceExtent(){const t=(0,n.lJ)();return this.triangles_.forEach((function(e,i,r){const s=e.source;(0,n.Wj)(t,s[0]),(0,n.Wj)(t,s[1]),(0,n.Wj)(t,s[2])})),t}getTriangles(){return this.triangles_}}},41948:function(t,e,i){"use strict";i.d(e,{m:function(){return n}});const n=.5},86374:function(t,e,i){"use strict";function n(t){return Array.isArray(t)?Math.min(...t):t}i.d(e,{D:function(){return n}})},12338:function(t,e,i){"use strict";i.d(e,{Gw:function(){return a},YP:function(){return s},gE:function(){return o},h$:function(){return r}});var n=i(63312);function r(t){if(void 0!==t)return 0}function s(t){if(void 0!==t)return t}function o(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}function a(t){const e=void 0===t?(0,n.Yr)(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}},81898:function(t,e,i){"use strict";function n(t){return t[0]>0&&t[1]>0}function r(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function s(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}i.d(e,{Pq:function(){return s},bA:function(){return r},py:function(){return n}})},64254:function(t,e,i){"use strict";var n=i(28053),r=i(36117),s=i(61672),o=i(69649),a=i(70658),l=i(81625);class h extends n.Z{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:(0,l.U2)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet,this.placeholderTiles_=t.placeholderTiles;const i="https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(i).then((t=>t.json())).then((t=>this.handleImageryMetadataResponse(t)))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=this.getProjection(),h=(0,a.Tl)(n),u=this.hidpi_?2:1,c=e.imageWidth==e.imageHeight?e.imageWidth/u:[e.imageWidth/u,e.imageHeight/u],d=(0,a.dl)({extent:h,minZoom:e.zoomMin,maxZoom:i,tileSize:c});this.tileGrid=d;const f=this.culture_,g=this.hidpi_,p=this.placeholderTiles_;if(this.tileUrlFunction=(0,s.Un)(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",f);return function(t,e,r){if(!t)return;(0,o.T9)(t[0],t[1],t[2],i);const s=new URL(n.replace("{quadkey}",function(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}(i))),a=s.searchParams;return g&&(a.set("dpi","d1"),a.set("device","mobile")),!0===p?a.delete("n"):!1===p&&a.set("n","z"),s.toString()}}))),e.imageryProviders){const t=(0,l.WO)((0,l.U2)("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],s=i.viewState,o=this.getTileGrid(),a=o.getZForResolution(s.resolution,this.zDirection),l=o.getTileCoordForCoordAndZ(s.center,a)[0];return e.imageryProviders.map((function(e){let s=!1;const o=e.coverageAreas;for(let e=0,n=o.length;e=n.zoomMin&&l<=n.zoomMax){const e=n.bbox,o=[e[1],e[0],e[3],e[2]],a=(0,r.Ne)(o,t);if((0,r.kK)(a,i.extent)){s=!0;break}}}s&&n.push(e.attribution)})),n.push('Terms of Use'),n}))}this.setState("ready")}}e.Z=h},68111:function(t,e,i){"use strict";var n=i(92486),r=i(79619),s=i(47051),o=i(4711),a=i(19775),l=i(23422),h=i(36117),u=i(22765);class c extends o.Z{constructor(t){super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return(0,l.h)(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(n.Z.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(n.Z.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=(0,h.lJ)(),e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let r=0,s=i.length;r=0;--e){const n=this.geometryFunction(t[e]);n?(0,a.IH)(i,n.getCoordinates()):t.splice(e,1)}(0,a.bA)(i,1/t.length);const n=(0,h.qg)(e),o=this.interpolationRatio,l=new s.Z([i[0]*(1-o)+n[0]*o,i[1]*(1-o)+n[1]*o]);return this.createCustomCluster_?this.createCustomCluster_(l,t):new r.Z({geometry:l,features:t})}}e.Z=c},98993:function(t,e,i){"use strict";var n=i(53161),r=i(92486),s=i(40485),o=i(2145),a=i(30078),l=i(18489),h=i(74251),u=i(70658),c=i(81625),d=i(69649),f=i(22765),g=i(79407),p=i(81898);class m extends l.Z{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=(0,u.dl)({extent:(0,u.Tl)(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,opaque:t.opaque,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?(0,p.Pq)(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.tileCacheForProjection_={}}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?(0,p.Pq)(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return!e||(0,c.OP)(e,t)?this.gutter_:0}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r){const o=this.getTileCacheForProjection(n),a=(0,d.lg)(t,e,i);if(o.containsKey(a)){const t=o.get(a);if(t&&t.key==this.getKey())return t}const l=this.getTileGrid(),h=Math.max.apply(null,l.getResolutions().map(((t,e)=>{const i=(0,p.Pq)(l.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),u=this.getTileGridForProjection(r),c=this.getTileGridForProjection(n),f=[t,e,i],g=this.getTileCoordForTileUrlFunction(f,n),m=Object.assign({sourceProj:r,sourceTileGrid:u,targetProj:n,targetTileGrid:c,tileCoord:f,wrappedTileCoord:g,pixelRatio:h,gutter:this.getGutterForProjection(r),getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,r)},this.tileOptions),_=new s.Z(m);return _.key=this.getKey(),_}getTile(t,e,i,s,o){const a=this.getProjection();if(a&&o&&!(0,c.OP)(a,o))return this.getReprojTile_(t,e,i,o,a);const l=this.getTileSize(t),h=(0,d.lg)(t,e,i);if(this.tileCache.containsKey(h))return this.tileCache.get(h);const u=this.loader_;const f=Object.assign({tileCoord:[t,e,i],loader:function(){return(0,g.Vi)((function(){return u(t,e,i)}))},size:l},this.tileOptions),p=new n.ZP(f);return p.key=this.getKey(),p.addEventListener(r.Z.CHANGE,this.handleTileChange_),this.tileCache.set(h,p),p}handleTileChange_(t){const e=t.target,i=(0,f.sq)(e),n=e.getState();let r;n==h.Z.LOADING?(this.tileLoadingKeys_[i]=!0,r=a.Z.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==h.Z.ERROR?a.Z.TILELOADERROR:n==h.Z.LOADED?a.Z.TILELOADEND:void 0),r&&this.dispatchEvent(new l.s(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,c.OP)(e,t)))return this.tileGrid;const i=(0,f.sq)(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=(0,u.X$)(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=(0,c.U2)(t);if(i){const t=(0,f.sq)(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,c.OP)(e,t))return this.tileCache;const i=(0,f.sq)(t);return i in this.tileCacheForProjection_||(this.tileCacheForProjection_[i]=new o.Z(.1)),this.tileCacheForProjection_[i]}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection_){const n=this.tileCacheForProjection_[t];n.expireCache(n==i?e:{})}}clear(){super.clear();for(const t in this.tileCacheForProjection_)this.tileCacheForProjection_[t].clear()}}e.Z=m},22635:function(t,e,i){"use strict";i.d(e,{Z:function(){return Zt}});var n=i(98993),r=i(61931),s=i(49592);const o=new Map;function a(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>o.set(t,e)))}async function l(t){const e=o.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}a([void 0,1],(()=>i.e(5994).then(i.bind(i,45994)).then((t=>t.default)))),a(5,(()=>i.e(5690).then(i.bind(i,15690)).then((t=>t.default)))),a(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),a(7,(()=>i.e(6353).then(i.bind(i,66353)).then((t=>t.default)))),a([8,32946],(()=>i.e(2581).then(i.bind(i,92581)).then((t=>t.default)))),a(32773,(()=>i.e(263).then(i.bind(i,263)).then((t=>t.default)))),a(34887,(()=>i.e(5323).then(i.bind(i,15323)).then((async t=>(await t.zstd.init(),t))).then((t=>t.default)))),a(50001,(()=>i.e(1789).then(i.bind(i,41789)).then((t=>t.default))));const h="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2;var u=class{constructor(t=h,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{i.e(8030).then(i.bind(i,98030)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;ii.decode(t,e))):new Promise((i=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const r=this.messageId++,s=t=>{t.data.id===r&&(n.idle=!0,i(t.data.decoded),n.worker.removeEventListener("message",s))};n.worker.addEventListener("message",s),n.worker.postMessage({fileDirectory:t,buffer:e,id:r},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}};const c=new ArrayBuffer(4),d=new Float32Array(c),f=new Uint32Array(c),g=new Uint32Array(512),p=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(g[t]=0,g[256|t]=32768,p[t]=24,p[256|t]=24):e<-14?(g[t]=1024>>-e-14,g[256|t]=1024>>-e-14|32768,p[t]=-e-1,p[256|t]=-e-1):e<=15?(g[t]=e+15<<10,g[256|t]=e+15<<10|32768,p[t]=13,p[256|t]=13):e<128?(g[t]=31744,g[256|t]=64512,p[t]=24,p[256|t]=24):(g[t]=31744,g[256|t]=64512,p[t]=13,p[256|t]=13)}const m=new Uint32Array(2048),_=new Uint32Array(64),y=new Uint32Array(64);m[0]=0;for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)i-=8388608,e<<=1;e&=-8388609,i+=947912704,m[t]=e|i}for(let t=1024;t<2048;++t)m[t]=939524096+(t-1024<<13);_[0]=0;for(let t=1;t<31;++t)_[t]=t<<23;_[31]=1199570944,_[32]=2147483648;for(let t=33;t<63;++t)_[t]=2147483648+(t-32<<23);_[63]=3347054592,y[0]=0;for(let t=1;t<64;++t)y[t]=32===t?0:1024;const x=Reflect.getPrototypeOf(Uint8Array).prototype,v=Reflect.getOwnPropertyDescriptor(x,Symbol.toStringTag).get;function E(t){return void 0!==v.call(t)}const b=Object.prototype.toString;function w(t,e,...i){if(n=t,!ArrayBuffer.isView(n)||E(n)||"[object DataView]"!==b.call(n))throw new TypeError("First argument to getFloat16 function must be a DataView");var n;return function(t){const e=t>>10;return f[0]=m[y[e]+(1023&t)]+_[e],d[0]}(t.getUint16(e,...i))}var S=i(42135),C=i(83299);function T(t,e,i,n=1){return new(Object.getPrototypeOf(t).constructor)(e*i*n)}function M(t,e,i){return(1-i)*t+i*e}function P(t,e,i,n,r,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,i,n,r){const s=e/n,o=i/r;return t.map((t=>{const a=T(t,n,r);for(let l=0;l{const a=T(t,n,r);for(let l=0;l=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,i=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(t,e){return w(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return A(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,i,n,r){const s=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let h,u;1===this.planarConfiguration?a=e*s+t:2===this.planarConfiguration&&(a=i*s*o+e*s+t),this.isTiled?(h=this.fileDirectory.TileOffsets[a],u=this.fileDirectory.TileByteCounts[a]):(h=this.fileDirectory.StripOffsets[a],u=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:h,length:u}],r))[0];let d;return null!==l&&l[a]?d=l[a]:(d=(async()=>{let t=await n.decode(this.fileDirectory,c);const i=this.getSampleFormat(),r=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(i,r)&&(t=function(t,e,i,n,r,s,o){const a=new DataView(t),l=2===i?1:n,h=A(e,r,2===i?o*s:o*s*n),u=parseInt("1".repeat(r),2);if(1===e){let t;t=1===i?n*r:r;let e=s*t;0!=(7&e)&&(e=e+7&-8);for(let t=0;t>8-r-f&u;else if(f+r<=16)h[c]=a.getUint16(d)>>16-r-f&u;else if(f+r<=24){const t=a.getUint16(d)<<8|a.getUint8(d+2);h[c]=t>>24-r-f&u}else h[c]=a.getUint32(d)>>32-r-f&u}}}}return h.buffer}(t,i,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=d)),{x:t,y:e,sample:i,data:await d}}async _readRaster(t,e,i,n,r,s,o,a,l){const h=this.getTileWidth(),u=this.getTileHeight(),c=this.getWidth(),d=this.getHeight(),f=Math.max(Math.floor(t[0]/h),0),g=Math.min(Math.ceil(t[2]/h),Math.ceil(c/h)),p=Math.max(Math.floor(t[1]/u),0),m=Math.min(Math.ceil(t[3]/u),Math.ceil(d/u)),_=t[2]-t[0];let y=this.getBytesPerPixel();const x=[],v=[];for(let t=0;t{const s=r.data,o=new DataView(s),a=this.getBlockHeight(r.y),l=r.y*u,f=r.x*h,p=l+a,m=(r.x+1)*h,E=v[g],w=Math.min(a,a-(p-t[3]),d-l),S=Math.min(h,h-(m-t[2]),c-f);for(let r=Math.max(0,t[1]-l);ru[2]||u[1]>u[3])throw new Error("Invalid subsets");const c=(u[2]-u[0])*(u[3]-u[1]),d=this.getSamplesPerPixel();if(e&&e.length){for(let t=0;t=d)return Promise.reject(new RangeError(`Invalid sample index '${e[t]}'.`))}else for(let t=0;th[2]||h[1]>h[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(u===s.Ie.RGB){let h=[0,1,2];if(this.fileDirectory.ExtraSamples!==s.pd.Unspecified&&a){h=[];for(let t=0;t>24)/500+a,h=a-(t[e+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),h=1.08883*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),r=3.2406*l+-1.5372*a+-.4986*h,s=-.9689*l+1.8758*a+.0415*h,o=.0557*l+-.204*a+1.057*h,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n[i]=255*Math.max(0,Math.min(1,r)),n[i+1]=255*Math.max(0,Math.min(1,s)),n[i+2]=255*Math.max(0,Math.min(1,o))}return n}(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(m.length/3),e=new Uint8Array(m.length/3),i=new Uint8Array(m.length/3);for(let n=0,r=0;nvoid 0===S(t,"sample"))):n.filter((e=>Number(S(e,"sample"))===t));for(let t=0;t[s+i*t+n*e,h+o*t+a*e])),c=u.map((t=>t[0])),d=u.map((t=>t[1]));return[Math.min(...c),Math.min(...d),Math.max(...c),Math.max(...d)]}{const t=this.getOrigin(),e=this.getResolution(),i=t[0],n=t[1],r=i+e[0]*this.getWidth(),s=n+e[1]*this.getHeight();return[Math.min(i,r),Math.min(n,s),Math.max(i,r),Math.max(n,s)]}}};class F{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const i=this.getUint32(t,e),n=this.getUint32(t+4,e);let r;if(e){if(r=i+2**32*n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*i+n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(t,e){let i=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let r=!0;for(let s=0;s<8;s++){let o=this._dataView.getUint8(t+(e?s:7-s));n&&(r?0!==o&&(o=255&~(o-1),r=!1):o=255&~o),i+=o*256**s}return n&&(i=-i),i}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return w(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class O{constructor(t,e,i,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=i,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),i=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const i=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let r=0;r<8;r++){let s=this._dataView.getUint8(t+(this._littleEndian?r:7-r));i&&(n?0!==s&&(s=255&~(s-1),n=!1):s=255&~s),e+=s*256**r}return i&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const Z="\r\n\r\n";function k(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[i,n]of t)e[i.toLowerCase()]=n;return e}function D(t){return k(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function N(t){let e,i,n;return t&&([,e,i,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),i=parseInt(i,10),n=parseInt(n,10)),{start:e,end:i,total:n}}class G{async fetch(t,e=void 0){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}class z extends Map{constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof t.maxAge&&0===t.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=t.maxSize,this.maxAge=t.maxAge||Number.POSITIVE_INFINITY,this.onEviction=t.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(t){if("function"==typeof this.onEviction)for(const[e,i]of t)this.onEviction(e,i.value)}_deleteIfExpired(t,e){return"number"==typeof e.expiry&&e.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(t,e.value),this.delete(t))}_getOrDeleteIfExpired(t,e){if(!1===this._deleteIfExpired(t,e))return e.value}_getItemValue(t,e){return e.expiry?this._getOrDeleteIfExpired(t,e):e.value}_peek(t,e){const i=e.get(t);return this._getItemValue(t,i)}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(t,e){this.oldCache.delete(t),this._set(t,e)}*_entriesAscending(){for(const t of this.oldCache){const[e,i]=t;if(!this.cache.has(e)){!1===this._deleteIfExpired(e,i)&&(yield t)}}for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield t)}}get(t){if(this.cache.has(t)){const e=this.cache.get(t);return this._getItemValue(t,e)}if(this.oldCache.has(t)){const e=this.oldCache.get(t);if(!1===this._deleteIfExpired(t,e))return this._moveToRecent(t,e),e.value}}set(t,e,{maxAge:i=this.maxAge}={}){const n="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;this.cache.has(t)?this.cache.set(t,{value:e,expiry:n}):this._set(t,{value:e,expiry:n})}has(t){return this.cache.has(t)?!this._deleteIfExpired(t,this.cache.get(t)):!!this.oldCache.has(t)&&!this._deleteIfExpired(t,this.oldCache.get(t))}peek(t){return this.cache.has(t)?this._peek(t,this.cache):this.oldCache.has(t)?this._peek(t,this.oldCache):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");const e=[...this._entriesAscending()],i=e.length-t;i<0?(this.cache=new Map(e),this.oldCache=new Map,this._size=e.length):(i>0&&this._emitEvictions(e.slice(0,i)),this.oldCache=new Map(e.slice(i)),this.cache=new Map,this._size=0),this.maxSize=t}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}for(const t of this.oldCache){const[e,i]=t;if(!this.cache.has(e)){!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}}}*entriesDescending(){let t=[...this.cache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}t=[...this.oldCache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;if(!this.cache.has(n)){!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}}}*entriesAscending(){for(const[t,e]of this._entriesAscending())yield[t,e.value]}get size(){if(!this._size)return this.oldCache.size;let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return Math.min(this._size+t,this.maxSize)}entries(){return this.entriesAscending()}forEach(t,e=this){for(const[i,n]of this.entriesAscending())t.call(e,n,i,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class j extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,j),this.name="AbortError"}}class U extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const B=U;class q{constructor(t,e,i=null){this.offset=t,this.length=e,this.data=i}get top(){return this.offset+this.length}}class V{constructor(t,e,i){this.offset=t,this.length=e,this.blockIds=i}}class X extends G{constructor(t,{blockSize:e=65536,cacheSize:i=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new z({maxSize:i,onEviction:(t,e)=>{this.evictedBlocks.set(t,e)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const i=[],n=[],r=[];this.evictedBlocks.clear();for(const{offset:e,length:s}of t){let t=e+s;const{fileSize:o}=this;null!==o&&(t=Math.min(t,o));for(let s=Math.floor(e/this.blockSize)*this.blockSize;ssetTimeout(e,t)))}(),this.fetchBlocks(e);const s=[];for(const t of n)this.blockRequests.has(t)&&s.push(this.blockRequests.get(t));await Promise.allSettled(i),await Promise.allSettled(s);const o=[],a=r.filter((t=>this.abortedBlockIds.has(t)||!this.blockCache.has(t)));if(a.forEach((t=>this.blockIdsToFetch.add(t))),a.length>0&&e&&!e.aborted){this.fetchBlocks(null);for(const t of a){const e=this.blockRequests.get(t);if(!e)throw new Error(`Block ${t} is not in the block requests`);o.push(e)}await Promise.allSettled(o)}if(e&&e.aborted)throw new j("Request was aborted");const l=r.map((t=>this.blockCache.get(t)||this.evictedBlocks.get(t))),h=l.filter((t=>!t));if(h.length)throw new B(h,"Request failed");const u=new Map(function(t,e){const i=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return i.map(((t,e)=>[t,n[e]]))}(r,l));return this.readSliceData(t,u)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(e,t);for(let n=0;n{try{const t=(await i)[n],r=e*this.blockSize,s=r-t.offset,o=Math.min(s+this.blockSize,t.data.byteLength),a=t.data.slice(s,o),l=new q(r,a.byteLength,a,e);this.blockCache.set(e,l),this.abortedBlockIds.delete(e)}catch(i){if("AbortError"!==i.name)throw i;i.signal=t,this.blockCache.delete(e),this.abortedBlockIds.add(e)}finally{this.blockRequests.delete(e)}})())}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let i=[],n=null;const r=[];for(const t of e)null===n||n+1===t?(i.push(t),n=t):(r.push(new V(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[t],n=t);return r.push(new V(i[0]*this.blockSize,i.length*this.blockSize,i)),r}readSliceData(t,e){return t.map((t=>{let i=t.offset+t.length;null!==this.fileSize&&(i=Math.min(this.fileSize,i));const n=Math.floor(t.offset/this.blockSize),r=Math.floor(i/this.blockSize),s=new ArrayBuffer(t.length),o=new Uint8Array(s);for(let s=n;s<=r;++s){const n=e.get(s),r=n.offset-t.offset;let a,l=0,h=0;r<0?l=-r:r>0&&(h=r),a=n.top-i<0?n.length-l:i-n.offset-l;const u=new Uint8Array(n.data,l,a);o.set(u,h)}return s}))}}class ${get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class W{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:i}={}){throw new Error("request is not implemented")}}class Y extends ${constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class H extends W{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:i}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:i});return new Y(n)}}class K extends ${constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class J extends W{constructRequest(t,e){return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",this.url),r.responseType="arraybuffer";for(const[e,i]of Object.entries(t))r.setRequestHeader(e,i);r.onload=()=>{const t=r.response;i(new K(r,t))},r.onerror=n,r.onabort=()=>n(new j("Request aborted")),r.send(),e&&(e.aborted&&r.abort(),e.addEventListener("abort",(()=>r.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}var Q=i(47760),tt=i(13090),et=i(19439);class it extends ${constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class nt extends W{constructor(t){super(t),this.parsedUrl=et.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?Q:tt}constructRequest(t,e){return new Promise(((i,n)=>{const r=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const i=[];t.on("data",(t=>{i.push(t)})),t.on("end",(()=>{const t=Buffer.concat(i).buffer;e(t)})),t.on("error",n)}));i(new it(t,e))}));r.on("error",n),e&&(e.aborted&&r.destroy(new j("Request aborted")),e.addEventListener("abort",(()=>r.destroy(new j("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class rt extends G{constructor(t,e,i,n){super(),this.client=t,this.headers=e,this.maxRanges=i,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const i=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(i.ok){if(206===i.status){const{type:n,params:r}=function(t){const[e,...i]=t.split(";").map((t=>t.trim()));return{type:e,params:k(i.map((t=>t.split("="))))}}(i.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let i=null;const n=new TextDecoder("ascii"),r=[],s=`--${e}`,o=`${s}--`;for(let e=0;e<10;++e)n.decode(new Uint8Array(t,e,s.length))===s&&(i=e);if(null===i)throw new Error("Could not find initial boundary");for(;i1){const i=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return h.concat(i)}return h}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:i,length:n}=t,r=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+n}`},signal:e});if(r.ok){if(206===r.status){const t=await r.getData(),{total:e}=N(r.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:i,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function st(t,{blockSize:e,cacheSize:i}){return null===e?t:new X(t,{blockSize:e,cacheSize:i})}function ot(t,{forceXHR:e=!1,...i}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new J(t);return st(new rt(s,e,i,n),r)}(t,i):function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new nt(t);return st(new rt(s,e,i,n),r)}(t,i):function(t,{headers:e={},credentials:i,maxRanges:n=0,allowFullFile:r=!1,...s}={}){const o=new H(t,i);return st(new rt(o,e,n,r),s)}(t,i)}class at extends G{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((i,n)=>{const r=this.file.slice(t.offset,t.offset+t.length),s=new FileReader;s.onload=t=>i(t.target.result),s.onerror=n,s.onabort=n,s.readAsArrayBuffer(r),e&&e.addEventListener("abort",(()=>s.abort()))}))}}function lt(t){switch(t){case s.sf.BYTE:case s.sf.ASCII:case s.sf.SBYTE:case s.sf.UNDEFINED:return 1;case s.sf.SHORT:case s.sf.SSHORT:return 2;case s.sf.LONG:case s.sf.SLONG:case s.sf.FLOAT:case s.sf.IFD:return 4;case s.sf.RATIONAL:case s.sf.SRATIONAL:case s.sf.DOUBLE:case s.sf.LONG8:case s.sf.SLONG8:case s.sf.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function ht(t,e,i,n){let r=null,o=null;const a=lt(e);switch(e){case s.sf.BYTE:case s.sf.ASCII:case s.sf.UNDEFINED:r=new Uint8Array(i),o=t.readUint8;break;case s.sf.SBYTE:r=new Int8Array(i),o=t.readInt8;break;case s.sf.SHORT:r=new Uint16Array(i),o=t.readUint16;break;case s.sf.SSHORT:r=new Int16Array(i),o=t.readInt16;break;case s.sf.LONG:case s.sf.IFD:r=new Uint32Array(i),o=t.readUint32;break;case s.sf.SLONG:r=new Int32Array(i),o=t.readInt32;break;case s.sf.LONG8:case s.sf.IFD8:r=new Array(i),o=t.readUint64;break;case s.sf.SLONG8:r=new Array(i),o=t.readInt64;break;case s.sf.RATIONAL:r=new Uint32Array(2*i),o=t.readUint32;break;case s.sf.SRATIONAL:r=new Int32Array(2*i),o=t.readInt32;break;case s.sf.FLOAT:r=new Float32Array(i),o=t.readFloat32;break;case s.sf.DOUBLE:r=new Float64Array(i),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==s.sf.RATIONAL&&e!==s.sf.SRATIONAL)for(let e=0;et.getWidth()-e.getWidth()));for(let e=0;en||s&&s>o)break}}let c=e;if(o){const[t,e]=a.getOrigin(),[i,n]=l.getResolution(a);c=[Math.round((o[0]-t)/i),Math.round((o[1]-e)/n),Math.round((o[2]-t)/i),Math.round((o[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}class ft extends dt{constructor(t,e,i,n,r={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=i,this.firstIFDOffset=n,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const i=this.bigTiff?4048:1024;return new O((await this.source.fetch([{offset:t,length:void 0!==e?e:i}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,i=this.bigTiff?8:2;let n=await this.getSlice(t);const r=this.bigTiff?n.readUint64(t):n.readUint16(t),o=r*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const a={};let l=t+(this.bigTiff?8:2);for(let t=0;t{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new ct(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new L(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(t){if(!(t instanceof ct))throw t;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=";let i=await this.getSlice(t,130);if(e===ht(i,s.sf.ASCII,30,t)){const e=ht(i,s.sf.ASCII,130,t).split("\n")[0],n=Number(e.split("=")[1].split(" ")[0])+e.length;n>130&&(i=await this.getSlice(t,n));const r=ht(i,s.sf.ASCII,n,t);this.ghostValues={},r.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(t,e,i){const n=(await t.fetch([{offset:0,length:1024}],i))[0],r=new F(n),s=r.getUint16(0,0);let o;if(18761===s)o=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");o=!1}const a=r.getUint16(2,o);let l;if(42===a)l=!1;else{if(43!==a)throw new TypeError("Invalid magic number.");l=!0;if(8!==r.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const h=l?r.getUint64(8,o):r.getUint32(4,o);return new ft(t,o,l,h,e)}close(){return"function"==typeof this.source.close&&this.source.close()}}class gt extends dt{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,i=0;for(let n=0;nt.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}async function pt(t,e){return ft.fromSource(new at(t),e)}var mt=i(81625),_t=i(63312),yt=i(36117),xt=i(37938),vt=i(14684);function Et(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.PhotometricInterpretation,n=s.Ie;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const bt="STATISTICS_MAXIMUM",wt="STATISTICS_MINIMUM";let St;function Ct(){return St||(St=new u),St}function Tt(t){try{return t.getBoundingBox()}catch(e){return[0,0,t.getWidth(),t.getHeight()]}}function Mt(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.getHeight()]}}function Pt(t,e){try{return t.getResolution(e)}catch(i){return[e.getWidth()/t.getWidth(),e.getHeight()/t.getHeight()]}}function Rt(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=(0,mt.U2)(t);if(!i){const n=(0,vt.N)(e.ProjLinearUnitsGeoKey);n&&(i=new mt.kv({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=(0,mt.U2)(t);if(!i){const n=(0,vt.N)(e.GeogAngularUnitsGeoKey);n&&(i=new mt.kv({code:t,units:n}))}return i}return null}function It(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;nft.fromSource(ot(t,i)))));return new gt(r,s)}(t.url,t.overviews,e):async function(t,e={},i){return ft.fromSource(ot(t,e),i)}(t.url,e),i.then(It)}function Lt(t,e,i,n,r){if(Array.isArray(t)){const s=t.length;if(!Array.isArray(e)||s!=e.length){const t=new Error(n);throw r(t),t}for(let o=0;oi*t)throw new Error(n)}function Ft(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Ot extends n.Z{constructor(t){super({state:"loading",tileGrid:null,projection:t.projection||null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t=0;--t){const i=Rt(e[t]);if(i){this.projection=i;break}}}configure_(t){let e,i,n,s,o;const a=new Array(t.length),l=new Array(t.length),h=new Array(t.length);let u=0;const c=t.length;for(let r=0;r{4==(4&(t.fileDirectory.NewSubfileType||0))?d.push(t):c.push(t)}));const f=c.length;if(d.length>0&&d.length!==f)throw new Error(`Expected one mask per image found ${d.length} masks and ${f} images`);let g,p;const m=new Array(f),_=new Array(f),y=new Array(f);l[r]=new Array(f),h[r]=new Array(f);for(let t=0;ty.length&&(u=o.length-y.length);const t=o[o.length-1]/y[y.length-1];this.resolutionFactors_[r]=t;const e=y.map((e=>e*t)),i=`Resolution mismatch for source ${r}, got [${e}] but expected [${o}]`;Lt(o.slice(u,o.length),e,.02,i,this.viewRejector)}else o=y,this.resolutionFactors_[r]=1;n?Lt(n.slice(u,n.length),_,.01,`Tile size mismatch for source ${r}`,this.viewRejector):n=_,s?Lt(s.slice(u,s.length),m,0,`Tile size mismatch for source ${r}`,this.viewRejector):s=m,this.sourceImagery_[r]=c.reverse(),this.sourceMasks_[r]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;tthis.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const s=T(t,e,i,1),a=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&(0,c.r4)(this.wantedExtent_,s)||(0,c.r4)(this.image.getExtent(),s))&&(this.wantedResolution_&&(0,u.D)(this.wantedResolution_)===a||(0,u.D)(this.image.getResolution())===a)))return this.image;this.wantedProjection_=n,this.wantedExtent_=s,this.wantedResolution_=a,this.image=new o.ZP(s,a,i,this.loader),this.image.addEventListener(r.Z.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case s.Z.LOADING:this.loading=!0,i=v;break;case s.Z.LOADED:this.loading=!1,i=E;break;case s.Z.ERROR:this.loading=!1,i=b;break;default:return}this.hasListener(i)&&this.dispatchEvent(new w(i,e))}}function C(t,e){t.getImage().src=e}function T(t,e,i,n){const r=e/i,s=(0,c.qg)(t),o=(0,_.mD)((0,c.dz)(t)/r,m.L),a=(0,_.mD)((0,c.Cr)(t)/r,m.L),l=o+2*(0,_.mD)((n-1)*o/2,m.L),h=a+2*(0,_.mD)((n-1)*a/2,m.L);return(0,c.p8)(s,r,0,[l,h])}var M=S},46810:function(t,e,i){"use strict";i.d(e,{Z:function(){return h}});var n=i(92486),r=i(91531),s=i(57419),o=i(36117);var a=i(81625);class l extends r.ZP{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:r.r6;super({attributions:t.attributions,interpolate:t.interpolate,projection:(0,a.U2)(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new s.ZP(this.imageExtent_,void 0,1,function(t){const e=t.load||s.Jx,i=t.imageExtent,n=new Image;return null!==t.crossOrigin&&(n.crossOrigin=t.crossOrigin),()=>e(n,t.url).then((t=>{const e=(0,o.dz)(i)/t.width,n=(0,o.Cr)(i)/t.height;return{image:t,extent:i,resolution:e!==n?[e,n]:n,pixelRatio:1}}))}({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(t,e)=>(this.image.setImage(t),i(this.image,e),(0,s.Jx)(t))})),this.image.addEventListener(n.Z.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return(0,o.kK)(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}var h=l},39597:function(t,e,i){"use strict";var n=i(91531),r=i(17708),s=i(29142),o=i(57419),a=i(81625);class l extends n.ZP{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:n.r6,this.params_=t.params,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const o=(0,a.U2)(i),l=this.getProjection();l&&l!==o&&(e=(0,r.aA)(l,o,t,e),t=(0,a.vs)(t,o,l));const h={url:this.url_,params:{...this.params_,...n},projection:l||o};return(0,s.QL)(h,t,e)}getLegendUrl(t,e){return(0,s.YT)({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=(0,s.Ke)({crossOrigin:this.crossOrigin_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),(0,o.Jx)(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}}e.Z=l},2703:function(t,e,i){"use strict";var n=i(28053),r=i(16772),s=i(37938);class o extends n.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});const e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null};(0,r.X$)(e).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){(0,s.vU)(t),this.setState("error")}}e.Z=o},55117:function(t,e,i){"use strict";i.d(e,{h:function(){return r}});var n=i(64469);const r='© OpenStreetMap contributors.';class s extends n.Z{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[r];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,opaque:void 0===t.opaque||t.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}}e.Z=s},1940:function(t,e,i){"use strict";var n=i(5929),r=i(6747),s=i(92486),o=i(13617),a=i(11802),l=i(91531),h=i(27501),u=i(72893),c=i(63947),d=i(18489),f=i(850),g=i(44669),p=i(36117),m=i(22765);let _,y=!0;try{new ImageData(10,10)}catch(t){y=!1}function x(t){let e=!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,n){return e?new ImageData(t,i,n):{data:t,width:i,height:n}}return function(e){const n=e.buffers,r=e.meta,s=e.imageOps,o=e.width,a=e.height,l=n.length,h=n[0].byteLength;if(s){const e=new Array(l);for(let t=0;tthis._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this._workers.length;if(this._running=r,1===r)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sStadia Maps','© OpenMapTiles',r.h];t.layer.startsWith("stamen_")&&c.splice(1,0,'© Stamen Design'),super({attributions:c,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:n.maxZoom,minZoom:void 0!==t.minZoom?t.minZoom:n.minZoom,opaque:a.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:u,tilePixelRatio:h?2:1,wrapX:t.wrapX,zDirection:t.zDirection})}}e.Z=a},18489:function(t,e,i){"use strict";i.d(e,{s:function(){return g}});var n=i(6747),r=i(27501),s=i(2145),o=i(74251),a=i(22765),l=i(23422),h=i(81625),u=i(69649),c=i(70658),d=i(81898);class f extends r.Z{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&(0,d.Pq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new s.Z(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let s,a,l,h=!0;for(let t=i.minX;t<=i.maxX;++t)for(let c=i.minY;c<=i.maxY;++c)a=(0,u.lg)(e,t,c),l=!1,r.containsKey(a)&&(s=r.get(a),l=s.getState()===o.Z.LOADED,l&&(l=!1!==n(s))),l||(h=!1);return h}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return(0,a.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:(0,c.X$)(t)}getTileCacheForProjection(t){const e=this.getProjection();return(0,l.h)(null===e||(0,h.OP)(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=(0,d.Pq)(n.getTileSize(t),this.tmpSize);return 1==r?s:(0,d.bA)(s,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=(0,c.Cf)(i,t,e)),(0,u.tE)(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class g extends n.ZP{constructor(t,e){super(t),this.tile=e}}e.Z=f},96565:function(t,e,i){"use strict";var n=i(64469),r=i(850),s=i(81898);class o extends n.Z{constructor(t){super({opaque:!1,projection:(t=t||{}).projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection,url:t.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,e)=>{const i=t.getTileCoord()[0],n=(0,s.Pq)(this.tileGrid.getTileSize(i)),o=(0,r.E4)(n[0],n[1]);o.strokeStyle="grey",o.strokeRect(.5,.5,n[0]+.5,n[1]+.5),o.fillStyle="grey",o.strokeStyle="white",o.textAlign="center",o.textBaseline="middle",o.font="24px sans-serif",o.lineWidth=4,o.strokeText(e,n[0]/2,n[1]/2,n[0]),o.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(o.canvas)}})}}e.Z=o},30078:function(t,e){"use strict";e.Z={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"}},28053:function(t,e,i){"use strict";var n=i(92486),r=i(27859),s=i(27139),o=i(2145),a=i(74251),l=i(81876),h=i(81625),u=i(69649),c=i(70658),d=i(22765);class f extends l.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:g,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:r.Z,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!(0,h.OP)(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!(0,h.OP)(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,h.OP)(e,t)))return this.tileGrid;const i=(0,d.sq)(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=(0,c.X$)(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,h.OP)(e,t))return this.tileCache;const i=(0,d.sq)(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new o.Z(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,r,s,o){const l=[t,e,i],h=this.getTileCoordForTileUrlFunction(l,s),u=h?this.tileUrlFunction(h,r,s):void 0,c=new this.tileClass(l,void 0!==u?a.Z.IDLE:a.Z.EMPTY,void 0!==u?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(n.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||(0,h.OP)(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let c;const d=(0,u.km)(l);a.containsKey(d)&&(c=a.get(d));const f=this.getKey();if(c&&c.key==f)return c;const g=this.getTileGridForProjection(o),p=this.getTileGridForProjection(r),m=this.getTileCoordForTileUrlFunction(l,r),_=new s.Z(o,g,r,p,l,m,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,o)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return _.key=f,c?(_.interimTile=c,_.refreshInterimChain(),a.replace(d,_)):a.set(d,_),_}getTileInternal(t,e,i,n,r){let s=null;const o=(0,u.lg)(t,e,i),l=this.getKey();if(this.tileCache.containsKey(o)){if(s=this.tileCache.get(o),s.key!=l){const h=s;s=this.createTile_(t,e,i,n,r,l),h.getState()==a.Z.IDLE?s.interimTile=h.interimTile:s.interimTile=h,s.refreshInterimChain(),this.tileCache.replace(o,s)}}else s=this.createTile_(t,e,i,n,r,l),this.tileCache.set(o,s);return s}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=(0,h.U2)(t);if(i){const t=(0,d.sq)(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function g(t,e){t.getImage().src=e}e.Z=f},20171:function(t,e,i){"use strict";var n=i(28053),r=i(36117),s=i(61672),o=i(70658),a=i(81625),l=i(38760);class h extends n.Z{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:(0,a.U2)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)(0,l.R6)(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=(0,a.U2)("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=(0,a.WO)(e,i);n=(0,r.Ne)(t.bounds,s)}const l=(0,o.Tl)(i),h=t.minzoom||0,u=t.maxzoom||22,c=(0,o.dl)({extent:l,maxZoom:u,minZoom:h,tileSize:this.tileSize_});if(this.tileGrid=c,this.tileUrlFunction=(0,s.uR)(t.tiles,c),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:l;this.setAttributions((function(i){return(0,r.kK)(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}e.Z=h},78536:function(t,e,i){"use strict";var n=i(28053),r=i(29142),s=i(93172),o=i(36117),a=i(17708),l=i(84441),h=i(81625),u=i(63312),c=i(69649);class d extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t.params),i=!("TRANSPARENT"in e)||e.TRANSPARENT;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=(0,o.lJ)(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const s=(0,h.U2)(i),l=this.getProjection()||s;let u=this.getTileGrid();u||(u=this.getTileGridForProjection(l));const c=(0,h.vs)(t,s,l),d=(0,a.aA)(l,s,t,e),f=u.getZForResolution(d,this.zDirection),g=u.getResolution(f),p=u.getTileCoordForCoordAndZ(c,f);if(u.getResolutions().length<=p[0])return;let m=u.getTileCoordExtent(p,this.tmpExtent_);const _=this.gutter_;0!==_&&(m=(0,o.f3)(m,g*_,m));const y={QUERY_LAYERS:this.params_.LAYERS};Object.assign(y,(0,r.jt)(this.params_,"GetFeatureInfo"),n);const x=Math.floor((c[0]-m[0])/g),v=Math.floor((m[3]-c[1])/g);return y[this.v13_?"I":"X"]=x,y[this.v13_?"J":"Y"]=v,this.getRequestUrl_(p,m,1,l||s,y)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:r.eQ,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),(0,s.B)(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,s){const o=this.urls;if(!o)return;let a;if(1==o.length)a=o[0];else{a=o[(0,u.$W)((0,c.vp)(t),o.length)]}return(0,r.Q4)(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,a,s,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||r.eQ;this.v13_=(0,l.n)(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const s=n.getResolution(t[0]);let a=n.getTileCoordExtent(t,this.tmpExtent_);const l=this.gutter_;0!==l&&(a=(0,o.f3)(a,s*l,a));const h=Object.assign({},(0,r.jt)(this.params_,"GetMap"));return this.getRequestUrl_(t,a,e,i,h)}}e.Z=d},81876:function(t,e,i){"use strict";var n=i(30078),r=i(18489),s=i(74251),o=i(61672),a=i(69649),l=i(22765);class h extends r.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===h.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=(0,l.sq)(e),o=e.getState();let a;o==s.Z.LOADING?(this.tileLoadingKeys_[i]=!0,a=n.Z.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],a=o==s.Z.ERROR?n.Z.TILELOADERROR:o==s.Z.LOADED?n.Z.TILELOADEND:void 0),null!=a&&this.dispatchEvent(new r.s(a,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=(0,o.Gk)(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction((0,o.uR)(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=(0,a.lg)(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}e.Z=h},4711:function(t,e,i){"use strict";var n=i(79638),r=i(8651),s=i(6747),o=i(92486),a=i(35323),l=i(25626),h=i(33321),u=i(27501),c=i(70487),d=i(79407),f=i(2896),g=i(23422),p=i(36117),m=i(17367),_=i(22765),y=i(4891),x=i(41507),v=i(41773);class E extends s.ZP{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class b extends u.Z{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=d.Zn,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&((0,g.h)(this.format_,"`format` must be set when `url` is set"),this.loader_=(0,v.Be)(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:f.$6;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,r;this.featuresRtree_=e?new l.Z:null,this.loadedExtentsRtree_=new l.Z,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?r=t.features:t.features&&(i=t.features,r=i.getArray()),e||void 0!==i||(i=new n.Z(r)),void 0!==r&&this.addFeaturesInternal(r),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=(0,_.sq)(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new E(c.Z.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof h.ZP||(this.featureChangeKeys_[t]=[(0,x.oL)(e,o.Z.CHANGE,this.handleFeatureChange_,this),(0,x.oL)(e,a.Z.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof h.ZP){const n=this.idIndex_[t];n instanceof h.ZP?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&((0,g.h)(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(r.Z.REMOVE,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(x.bN)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new E(c.Z.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n instanceof h.ZP||n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n instanceof h.ZP||n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),(0,y.x)(this.nullGeometryFeatures_)||(0,m.l7)(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=(0,p.MV)(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||d.uX,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof h.ZP?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new E(c.Z.FEATURESLOADEND,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new E(c.Z.FEATURESLOADERROR))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if((0,p.fS)(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=(0,_.sq)(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=(0,_.sq)(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(x.bN),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new E(c.Z.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof h.ZP&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){(0,g.h)(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader((0,v.Be)(t,this.format_))}}e.Z=b},70487:function(t,e){"use strict";e.Z={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"}},19806:function(t,e,i){"use strict";i.d(e,{Z:function(){return w},I:function(){return S}});var n=i(92486),r=i(38264),s=i(2145),o=i(61931),a=i(74251),l=i(81876),h=i(69319),u=i(850),c=i(22765);const d=[];class f extends h.Z{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=(0,c.sq)(t);return e in this.context_||(this.context_[e]=(0,u.E4)(1,1,d)),this.context_[e]}hasContext(t){return(0,c.sq)(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=(0,c.sq)(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];(0,u.jy)(e),d.push(e.canvas),delete this.context_[t]}super.release()}}var g=f,p=i(36913),m=i(36117),_=i(70658),y=i(69649),x=i(4891),v=i(41773),E=i(81898);class b extends l.Z{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||(0,_.Tl)(e),n=t.tileGrid||(0,_.dl)({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:S,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new s.Z(this.tileCache.highWaterMark),this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:r.Z,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=(0,y.Ul)(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==a.Z.LOADED)return;const s=i.getSourceTiles();for(let i=0,n=s.length;i{const n=(0,y.MY)(e),r=i.peek(n);if(r){const e=r.sourceTiles;for(let i=0,n=e.length;i{const s=this.tileUrlFunction(r,t,e),o=this.sourceTileCache.containsKey(s)?this.sourceTileCache.get(s):new this.tileClass(r,s?a.Z.IDLE:a.Z.EMPTY,s,this.format_,this.tileLoadFunction);i.sourceTiles.push(o);const l=o.getState();if(l{this.handleTileChange(e);const r=o.getState();if(r===a.Z.LOADED||r===a.Z.ERROR){const e=o.getKey();e in i.errorTileKeys?o.getState()===a.Z.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,r===a.Z.ERROR?i.errorTileKeys[e]=!0:o.removeEventListener(n.Z.CHANGE,t),0===i.loadingSourceTiles&&i.setState((0,x.x)(i.errorTileKeys)?a.Z.LOADED:a.Z.ERROR)}};o.addEventListener(n.Z.CHANGE,t),i.loadingSourceTiles++}l===a.Z.IDLE&&(o.extent=u.getTileCoordExtent(r),o.projection=e,o.resolution=u.getResolution(r[0]),this.sourceTileCache.set(s,o),o.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===a.Z.ERROR))?a.Z.ERROR:a.Z.LOADED)}return i.sourceTiles}getTile(t,e,i,n,r){const s=(0,y.lg)(t,e,i),o=this.getKey();let l;if(this.tileCache.containsKey(s)&&(l=this.tileCache.get(s),l.key===o))return l;const h=[t,e,i];let u=this.getTileCoordForTileUrlFunction(h,r);const c=this.getTileGrid().getExtent(),d=this.getTileGridForProjection(r);if(u&&c){const e=d.getTileCoordExtent(u);(0,m.f3)(e,-d.getResolution(t),e),(0,m.kK)(c,e)||(u=null)}let f=!0;if(null!==u){const e=this.tileGrid,i=d.getResolution(t),s=e.getZForResolution(i,1),o=d.getTileCoordExtent(u);(0,m.f3)(o,-i,o),e.forEachTileCoord(o,s,(t=>{f=f&&!this.tileUrlFunction(t,n,r)}))}const p=new g(h,f?a.Z.EMPTY:a.Z.IDLE,u,this.getSourceTiles.bind(this,n,r));return p.key=o,l?(p.interimTile=l,p.refreshInterimChain(),this.tileCache.replace(s,p)):this.tileCache.set(s,p),p}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),r=n.map((function(e,i){return t.getOrigin(i)})),s=n.map((function(e,i){return t.getTileSize(i)})),a=p.e+1;for(let t=n.length;t0&&(this.tileUrlFunction=(0,a.Un)(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction((0,a.Un)(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?(0,r.B)(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,s=this.dimensions_;return function(i,o,a){if(!i)return;const l={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(l,s);let h=t;return h="KVP"==e?(0,r.B)(h,l):h.replace(/\{(\w+?)\}/g,(function(t,e){return l[e]})),h}}}function u(t,e){const i=t.Contents.Layer.find((function(t){return t.Identifier==e.layer}));if(!i)return null;const n=t.Contents.TileMatrixSet;let r;r=i.TileMatrixSetLink.length>1?"projection"in e?i.TileMatrixSetLink.findIndex((function(t){const i=n.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,r=(0,l.U2)(i),s=(0,l.U2)(e.projection);return r&&s?(0,l.OP)(r,s):i==e.projection})):i.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,r<0&&(r=0);const a=i.TileMatrixSetLink[r].TileMatrixSet,h=i.TileMatrixSetLink[r].TileMatrixSetLimits;let u=i.Format[0];"format"in e&&(u=e.format),r=i.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),r<0&&(r=0);const c=i.Style[r].Identifier,d={};"Dimension"in i&&i.Dimension.forEach((function(t,e,i){const n=t.Identifier;let r=t.Default;void 0===r&&(r=t.Value[0]),d[n]=r}));const f=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==a}));let g;const p=f.SupportedCRS;if(p&&(g=(0,l.U2)(p)),"projection"in e){const t=(0,l.U2)(e.projection);t&&(g&&!(0,l.OP)(t,g)||(g=t))}let m=!1;const _="ne"==g.getAxisOrientation().substr(0,2);let y=f.TileMatrix[0],x={MinTileCol:0,MinTileRow:0,MaxTileCol:y.MatrixWidth-1,MaxTileRow:y.MatrixHeight-1};if(h){x=h[h.length-1];const t=f.TileMatrix.find((t=>t.Identifier===x.TileMatrix||f.Identifier+":"+t.Identifier===x.TileMatrix));t&&(y=t)}const v=28e-5*y.ScaleDenominator/g.getMetersPerUnit(),E=_?[y.TopLeftCorner[1],y.TopLeftCorner[0]]:y.TopLeftCorner,b=y.TileWidth*v,w=y.TileHeight*v;let S=f.BoundingBox;S&&_&&(S=[S[1],S[0],S[3],S[2]]);let C=[E[0]+b*x.MinTileCol,E[1]-w*(1+x.MaxTileRow),E[0]+b*(1+x.MaxTileCol),E[1]-w*x.MinTileRow];if(void 0!==S&&!(0,s.r4)(S,C)){const t=i.WGS84BoundingBox,e=(0,l.U2)("EPSG:4326").getExtent();if(C=S,t)m=t[0]===e[0]&&t[2]===e[2];else{const t=(0,l.$A)(S,f.SupportedCRS,"EPSG:4326");m=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const T=(0,o.b)(f,C,h),M=[];let P=e.requestEncoding;if(P=void 0!==P?P:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;tg||a>g;)l.push([Math.ceil(o/g),Math.ceil(a/g)]),g+=g;break;case"truncated":let t=o,e=a;for(;t>g||e>g;)l.push([Math.ceil(t/g),Math.ceil(e/g)]),t>>=1,e>>=1;break;default:throw new Error("Unknown `tierSizeCalculation` configured")}l.push([1,1]),l.reverse();const p=[r],m=[0];for(let t=1,e=l.length;t{v=f,this.changed()})),S.src=w}}e.Z=f},18468:function(t,e,i){"use strict";i.d(e,{I:function(){return u},K:function(){return c}});var n=i(3532),r=i(93172),s=i(57419),o=i(36117),a=i(81625),l=i(91531),h=i(63312);function u(t,e,i,s,a,l){const u=a.getCode().split(/:(?=\d+$)/).pop(),c=i/s,d=[(0,h.NM)((0,o.dz)(e)/c,n.L),(0,h.NM)((0,o.Cr)(e)/c,n.L)];l.SIZE=d[0]+","+d[1],l.BBOX=e.join(","),l.BBOXSR=u,l.IMAGESR=u,l.DPI=Math.round(l.DPI?l.DPI*s:90*s);const f=t.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");if(f==t)throw new Error("`options.featureTypes` should be an Array");return(0,r.B)(f,l)}function c(t){const e=t.load?t.load:s.Jx,i=(0,a.U2)(t.projection||"EPSG:3857");return function(n,r,s){s=t.hidpi?s:1;const a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(a,t.params),n=(0,l.Ps)(n,r,s,t.ratio);const h=u(t.url,n,r,s,i,a),c=new Image;return null!==t.crossOrigin&&(c.crossOrigin=t.crossOrigin),e(c,h).then((t=>{const e=(0,o.dz)(n)/t.width*s;return{image:t,extent:n,resolution:e,pixelRatio:s}}))}}},3532:function(t,e,i){"use strict";i.d(e,{L:function(){return n}});const n=4},16772:function(t,e,i){"use strict";i.d(e,{X$:function(){return c}});var n=i(61931),r=i(38760),s=i(81625),o=i(36117);const a={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},l={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function h(t,e,i,a){let l=t.projection;if(!l&&(l=(0,s.U2)(e.crs),!l))throw new Error(`Unsupported CRS: ${e.crs}`);const h="en"!==l.getAxisOrientation().substr(0,2),u=e.tileMatrices,c={};for(let t=0;tt.maxTileCol||h.tileRowt.maxTileRow)return}Object.assign(h,E);const u=i.replace(/\{(\w+?)\}/g,(function(t,e){return h[e]}));return(0,r.Kk)(b,u)}}}function u(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e){let i,n;for(let r=0;r"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!s)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const o=s.href,u=(0,r.Kk)(t.url,o);return(0,r.xA)(u).then((function(e){return h(t,e,n,i)}))}function c(t){return(0,r.xA)(t.url).then((function(e){return u(t,e)}))}},29142:function(t,e,i){"use strict";i.d(e,{Ke:function(){return m},Q4:function(){return g},QL:function(){return _},YT:function(){return y},eQ:function(){return c},jt:function(){return p}});var n=i(3532),r=i(93172),s=i(84441),o=i(57419),a=i(63312),l=i(36117),h=i(81625),u=i(91531);const c="1.3.0",d=[101,101];function f(t,e,i,n,o){o.WIDTH=i[0],o.HEIGHT=i[1];const a=n.getAxisOrientation();let l;const h=(0,s.n)(o.VERSION,"1.3")>=0;return o[h?"CRS":"SRS"]=n.getCode(),l=h&&"ne"==a.substr(0,2)?[e[1],e[0],e[3],e[2]]:e,o.BBOX=l.join(","),(0,r.B)(t,o)}function g(t,e,i,r,s,o,h){o=Object.assign({REQUEST:"GetMap"},o);const u=e/i,c=[(0,a.NM)((0,l.dz)(t)/u,n.L),(0,a.NM)((0,l.Cr)(t)/u,n.L)];if(1!=i)switch(h){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+t:o.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":o.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":o.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return f(s,t,c,r,o)}function p(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:c,FORMAT:"image/png",STYLES:"",TRANSPARENT:!0},t)}function m(t){const e=void 0===t.hidpi||t.hidpi,i=(0,h.U2)(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||o.Jx;return(s,o,a)=>{s=(0,u.Ps)(s,o,a,n),1==a||e&&void 0!==t.serverType||(a=1);const l=g(s,o,a,i,t.url,p(t.params,"GetMap"),t.serverType),h=new Image;return null!==t.crossOrigin&&(h.crossOrigin=t.crossOrigin),r(h,l).then((t=>({image:t,extent:s,pixelRatio:a})))}}function _(t,e,i){if(void 0===t.url)return;const r=(0,h.U2)(t.projection||"EPSG:3857"),o=(0,l.p8)(e,i,0,d),u={QUERY_LAYERS:t.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(u,p(t.params,"GetFeatureInfo"),t.params);const c=(0,a.GW)((e[0]-o[0])/i,n.L),g=(0,a.GW)((o[3]-e[1])/i,n.L),m=(0,s.n)(u.VERSION,"1.3")>=0;return u[m?"I":"X"]=c,u[m?"J":"Y"]=g,f(t.url,o,d,r,u)}function y(t,e){if(void 0===t.url)return;const i={SERVICE:"WMS",VERSION:c,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===t.params||void 0===t.params.LAYER){const e=t.params.LAYERS;if(!(!Array.isArray(e)||1===e.length))return;i.LAYER=e}if(void 0!==e){const n=(0,h.U2)(t.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;i.SCALE=e*n/r}return Object.assign(i,t.params),(0,r.B)(t.url,i)}},38881:function(t,e,i){"use strict";i.d(e,{Sp:function(){return s},bg:function(){return h},cv:function(){return u},xA:function(){return a}});var n=i(63312);const r=6371008.8;function s(t,e,i){i=i||r;const s=(0,n.Yr)(t[1]),o=(0,n.Yr)(e[1]),a=(o-s)/2,l=(0,n.Yr)(e[0]-t[0])/2,h=Math.sin(a)*Math.sin(a)+Math.sin(l)*Math.sin(l)*Math.cos(s)*Math.cos(o);return 2*i*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function o(t,e){let i=0;for(let n=0,r=t.length;ne?n:new Array(1+e-r).join("0")+n}function r(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;tr)return 1;if(r>e)return-1}return 0}i.d(e,{n:function(){return r},v:function(){return n}})},80316:function(t,e,i){"use strict";var n=i(23422);e.Z=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return(0,n.h)(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return(0,n.h)(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){(0,n.h)(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}},25626:function(t,e,i){"use strict";var n=i(78476),r=i(36117),s=i(22765),o=i(4891);e.Z=class{constructor(t){this.rbush_=new n(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[(0,s.sq)(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n{this.patternImage_=null})),e.getImageState()===n.Z.IDLE&&e.load(),e.getImageState()===n.Z.LOADING&&(this.patternImage_=e)}this.color_=t}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}e.Z=s},43586:function(t,e,i){"use strict";var n=i(92486),r=i(13701),s=i(42718),o=i(12185),a=i(23422),l=i(72605),h=i(22765);function u(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class c extends s.Z{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const c=void 0!==t.img?t.img:null;let d,f=t.src;if((0,a.h)(!(void 0!==f&&c),"`image` and `src` cannot be provided at the same time"),void 0!==f&&0!==f.length||!c||(f=c.src||(0,h.sq)(c)),(0,a.h)(void 0!==f&&f.length>0,"A defined and non-empty `src` or `image` must be provided"),(0,a.h)(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?d=r.Z.IDLE:void 0!==c&&(d=c instanceof HTMLImageElement?c.complete?c.src?r.Z.LOADED:r.Z.IDLE:r.Z.LOADING:r.Z.LOADED),this.color_=void 0!==t.color?(0,o._2)(t.color):null,this.iconImage_=(0,l.U)(c,f,this.crossOrigin_,d,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(u(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(u(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new c({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==r.Z.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==r.Z.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(n.Z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(n.Z.CHANGE,t)}ready(){return this.iconImage_.ready()}}e.Z=c},72605:function(t,e,i){"use strict";i.d(e,{U:function(){return d}});var n=i(13804),r=i(92486),s=i(13701),o=i(12185),a=i(850),l=i(57419),h=i(47921);let u=null;class c extends n.Z{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=void 0===n?s.Z.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===s.Z.LOADED){u||(u=(0,a.E4)(1,1,void 0,{willReadFrequently:!0})),u.drawImage(this.image_,0,0);try{u.getImageData(0,0,1,1),this.tainted_=!1}catch(t){u=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(r.Z.CHANGE)}handleImageError_(){this.imageState_=s.Z.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=s.Z.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=(0,a.E4)(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===s.Z.IDLE){this.image_||this.initializeImage_(),this.imageState_=s.Z.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(0,l.Q9)(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==s.Z.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=(0,o.XC)(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise((t=>{this.imageState_===s.Z.LOADED||this.imageState_===s.Z.ERROR?t():this.addEventListener(r.Z.CHANGE,(function e(){this.imageState_!==s.Z.LOADED&&this.imageState_!==s.Z.ERROR||(this.removeEventListener(r.Z.CHANGE,e),t())}))}))),this.ready_}}function d(t,e,i,n,r,s){let o=void 0===e?void 0:h.c1.get(e,i,r);return o||(o=new c(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,r),h.c1.set(e,i,r,o,s)),s&&o&&!h.c1.getPattern(e,i,r)&&h.c1.set(e,i,r,o,s),o}},47921:function(t,e,i){"use strict";i.d(e,{c1:function(){return l}});var n=i(13701),r=i(12185),s=i(850);class o{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=a(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=a(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,r,o){const l=a(t,e,i),h=l in this.cache_;this.cache_[l]=r,o&&(r.getImageState()===n.Z.IDLE&&r.load(),r.getImageState()===n.Z.LOADING?r.ready().then((()=>{this.patternCache_[l]=(0,s.W8)().createPattern(r.getImage(1),"repeat")})):this.patternCache_[l]=(0,s.W8)().createPattern(r.getImage(1),"repeat")),h||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function a(t,e,i){return e+":"+t+":"+(i?(0,r._2)(i):"null")}const l=new o},42718:function(t,e,i){"use strict";var n=i(22765),r=i(81898);class s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=(0,r.Pq)(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new s({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return(0,n.O3)()}getImage(t){return(0,n.O3)()}getHitDetectionImage(){return(0,n.O3)()}getPixelRatio(t){return 1}getImageState(){return(0,n.O3)()}getImageSize(){return(0,n.O3)()}getOrigin(){return(0,n.O3)()}getSize(){return(0,n.O3)()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=(0,r.Pq)(t)}listenImageChange(t){(0,n.O3)()}load(){(0,n.O3)()}unlistenImageChange(t){(0,n.O3)()}ready(){return Promise.resolve()}}e.Z=s},49243:function(t,e,i){"use strict";var n=i(13701),r=i(42718),s=i(12185),o=i(52987),a=i(850),l=i(17955);class h extends r.Z{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?n.Z.LOADING:n.Z.LOADED,this.imageState_===n.Z.LOADING&&this.ready().then((()=>this.imageState_=n.Z.LOADED)),this.render()}clone(){const t=this.getScale(),e=new h({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=(0,a.E4)(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,r=void 0===this.radius2_?n:this.radius2_;if(ni||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}i.d(e,{MY:function(){return o},T9:function(){return n},Ul:function(){return a},km:function(){return s},lg:function(){return r},tE:function(){return h},vp:function(){return l}})},70658:function(t,e,i){"use strict";i.d(e,{Cf:function(){return h},Tl:function(){return d},X$:function(){return l},dl:function(){return u}});var n=i(61931),r=i(36913),s=i(81625),o=i(36117),a=i(81898);function l(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,r){const s=d(t);return function(t,e,i,r){r=void 0!==r?r:"top-left";const s=c(t,e,i);return new n.Z({extent:t,origin:(0,o.g0)(t,r),resolutions:s,tileSize:i})}(s,e,i,r)}(t),t.setDefaultTileGrid(e)),e}function h(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=d(i);if(!(0,o.b8)(s,r)){const e=(0,o.dz)(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function u(t){const e=t||{},i=e.extent||(0,s.U2)("EPSG:3857").getExtent(),r={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:c(i,e.maxZoom,e.tileSize,e.maxResolution)};return new n.Z(r)}function c(t,e,i,n){e=void 0!==e?e:r.e,i=(0,a.Pq)(void 0!==i?i:r.S);const s=(0,o.Cr)(t),l=(0,o.dz)(t);n=n>0?n:Math.max(l/i[0],s/i[1]);const h=e+1,u=new Array(h);for(let t=0;te-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const r=new n.Z(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);r.minX=Math.max(t.minX,r.minX),r.maxX=Math.min(t.maxX,r.maxX),r.minY=Math.max(t.minY,r.minY),r.maxY=Math.min(t.maxY,r.maxY)}return r})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,h=t[0]-1;for(2===this.zoomFactor_?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);h>=this.minZoom;){if(void 0!==o&&void 0!==a?(o=Math.floor(o/2),a=Math.floor(a/2),s=(0,n.T)(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0)||i.find((function(i){return e[c]==i[u]||!e[c].includes(":")&&t[c]+":"+e[c]===i[u]})),r){o.push(e[c]);const t=28e-5*e[d]/m,i=e.TileWidth,r=e.TileHeight;_?a.push([e[f][1],e[f][0]]):a.push(e[f]),n.push(t),l.push(i==r?i:[i,r]),h.push([e.MatrixWidth,e.MatrixHeight])}})),new s({extent:e,origins:a,resolutions:n,matrixIds:o,tileSizes:l,sizes:h})}e.Z=s},36913:function(t,e,i){"use strict";i.d(e,{S:function(){return r},e:function(){return n}});const n=42,r=256},61672:function(t,e,i){"use strict";i.d(e,{Gk:function(){return h},Un:function(){return a},uR:function(){return o},vU:function(){return l}});var n=i(63312),r=i(69649);function s(t,e){const i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){const t=o[0],i=e.getFullTileRange(t);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()}))}}function o(t,e){const i=t.length,n=new Array(i);for(let r=0;r{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=(0,o.sq)(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),t.renderTargets[e]=!0}}r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}},l=i(91512),h=i(4891),u=i(44669),c=i(94704);const d={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},f={UNSIGNED_BYTE:l.wg,UNSIGNED_SHORT:l.Ae,UNSIGNED_INT:l.r1,FLOAT:l.RF},g={};function p(t){return"shared/"+t}let m=0;class _ extends s.Z{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?p(t.canvasCacheKey):function(){const t="unique/"+m;return m+=1,t}(),this.gl_=function(t){let e=g[t];if(!e){const i=document.createElement("canvas");i.width=1,i.height=1,i.style.position="absolute",i.style.left="0",e={users:0,context:(0,l.fw)(i)},g[t]=e}return e.users+=1,e.context}(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(n,this.boundHandleWebGLContextLost_),e.addEventListener(r,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,u.Ue)(),this.offsetScaleMatrix_=(0,u.Ue)(),this.tmpMat4_=(0,c.U)(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map((t=>new a({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms}))):[new a({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===p(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.gl_,i=(0,o.sq)(t);let n=this.bufferCache_[i];if(!n){n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n}e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.gl_,i=(0,o.sq)(t),n=this.bufferCache_[i];n&&!e.isContextLost()&&e.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(n,this.boundHandleWebGLContextLost_),t.removeEventListener(r,this.boundHandleWebGLContextRestored_),function(t){const e=g[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=e.context,n=i.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=i.canvas;r.width=1,r.height=1,delete g[t]}(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const n=this.gl_,r=this.getCanvas(),s=t.size,o=t.pixelRatio;r.width===s[0]*o&&r.height===s[1]*o||(r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px");for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.depthRange(0,1),n.clearDepth(1),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),i?(n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL)):n.disable(n.DEPTH_TEST)}bindTexture(t,e,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,t),n.uniform1i(this.getUniformLocation(i),e)}prepareDrawToRenderTarget(t,e,i,n){const r=this.gl_,s=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.bindRenderbuffer(r.RENDERBUFFER,e.getDepthbuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}finalizeDraw(t,e,i){for(let n=0,r=this.postProcessPasses_.length;n{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!r.texture?(r.prevValue=void 0,r.texture=i):r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),this.bindTexture(r.texture,n,r.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const t=!(i instanceof HTMLImageElement)||i.complete;i instanceof WebGLTexture||!t||r.prevValue===i||(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),n++}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,(0,c.u)(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.gl_.useProgram(t),this.currentProgram_=t,this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.gl_,n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.gl_,n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getProgramInfoLog(s)}`;throw new Error(t)}return s}getUniformLocation(t){const e=(0,o.sq)(this.currentProgram_);return void 0===this.uniformLocationsByProgram_[e]&&(this.uniformLocationsByProgram_[e]={}),void 0===this.uniformLocationsByProgram_[e][t]&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=(0,o.sq)(this.currentProgram_);return void 0===this.attribLocationsByProgram_[e]&&(this.attribLocationsByProgram_[e]={}),void 0===this.attribLocationsByProgram_[e][t]&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return(0,u.qC)(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,i,n,r){const s=this.getAttributeLocation(t);s<0||(this.gl_.enableVertexAttribArray(s),this.gl_.vertexAttribPointer(s,e,i,!1,n,r))}enableAttributes(t){const e=function(t){let e=0;for(let i=0;ithis.size_[0]||e>=this.size_[1])return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return r[0]=this.data_[4*i],r[1]=this.data_[4*i+1],r[2]=this.data_[4*i+2],r[3]=this.data_[4*i+3],r}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),e.bindRenderbuffer(e.RENDERBUFFER,this.depthbuffer_),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t[0],t[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(t[0]*t[1]*4)}}},11587:function(t,e,i){"use strict";i.d(e,{k:function(){return a}});var n=i(4082),r=i(25638);const s="#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\n\n// this used to produce an alpha-premultiplied color from a texture\nvec4 samplePremultiplied(sampler2D sampler, vec2 texCoord) {\n vec4 color = texture2D(sampler, texCoord);\n return vec4(color.rgb * color.a, color.a);\n}\n",o={"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"};class a{constructor(){this.uniforms_=[],this.attributes_=[],this.varyings_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${(0,r.I2)(o["circle-radius"])} + ${(0,r.I2)(.5*o["circle-stroke-width"])})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=(0,r.g$)(o["circle-fill-color"]),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=(0,r.I2)(o["stroke-width"]),this.strokeColorExpression_=(0,r.g$)(o["stroke-color"]),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=(0,r.JB)("round"),this.strokeJoinExpression_=(0,r.JB)("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.hasFill_=!1,this.fillColorExpression_=(0,r.g$)(o["fill-color"]),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(t){return this.uniforms_.push(t),this}addAttribute(t){return this.attributes_.push(t),this}addVarying(t,e,i){return this.varyings_.push({name:t,type:e,expression:i}),this}setSymbolSizeExpression(t){return this.hasSymbol_=!0,this.symbolSizeExpression_=t,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(t){return this.symbolRotationExpression_=t,this}setSymbolOffsetExpression(t){return this.symbolOffsetExpression_=t,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(t){return this.hasSymbol_=!0,this.symbolColorExpression_=t,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(t){return this.texCoordExpression_=t,this}setFragmentDiscardExpression(t){return this.discardExpression_=t,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(t){return this.symbolRotateWithView_=t,this}setStrokeWidthExpression(t){return this.hasStroke_=!0,this.strokeWidthExpression_=t,this}setStrokeColorExpression(t){return this.hasStroke_=!0,this.strokeColorExpression_=t,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(t){return this.strokeOffsetExpression_=t,this}setStrokeCapExpression(t){return this.strokeCapExpression_=t,this}setStrokeJoinExpression(t){return this.strokeJoinExpression_=t,this}setStrokeMiterLimitExpression(t){return this.strokeMiterLimitExpression_=t,this}setStrokeDistanceFieldExpression(t){return this.strokeDistanceFieldExpression_=t,this}setFillColorExpression(t){return this.hasFill_=!0,this.fillColorExpression_=t,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(t){this.vertexShaderFunctions_.includes(t)||this.vertexShaderFunctions_.push(t)}addFragmentShaderFunction(t){this.fragmentShaderFunctions_.includes(t)||this.fragmentShaderFunctions_.push(t)}getSymbolVertexShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx;\n if (a_index == 0.0) {\n offsetPx -= halfSizePx;\n } else if (a_index == 1.0) {\n offsetPx += halfSizePx * vec2(1., -1.);\n } else if (a_index == 2.0) {\n offsetPx += halfSizePx;\n } else {\n offsetPx += halfSizePx * vec2(-1., 1.);\n }\n float angle = ${this.symbolRotationExpression_};\n ${this.symbolRotateWithView_?"angle += u_rotation;":""}\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n v_prop_hitColor = a_prop_hitColor;\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y); \n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getStrokeVertexShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute float a_parameters;\nattribute float a_distance;\nattribute vec2 a_joinAngles;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float vertexNumber = floor(abs(a_parameters) / 10000. + 0.5);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n float angleTangentSum = fract(abs(a_parameters) / 10000.) * 10000. * sign(a_parameters);\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n \n // compute current vertex position\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 joinDirection;\n vec2 positionPx = vertexNumber < 1.5 ? segmentStartPx : segmentEndPx;\n // if angle is too high, do not make a proper join\n if (cos(angle) > ${n.Vm} || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * lineWidth * 0.5;\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStart = segmentStartPx;\n v_segmentEnd = segmentEndPx;\n v_width = lineWidth;\n v_prop_hitColor = a_prop_hitColor;\n v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * angleTangentSum);\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getStrokeFragmentShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > ${n.Vm}) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${(0,r.JB)("butt")}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${(0,r.JB)("square")}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${(0,r.JB)("bevel")}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${(0,r.JB)("miter")}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nvoid main(void) {\n vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPoint);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n\n float segmentLength = length(v_segmentEnd - v_segmentStart);\n vec2 segmentTangent = (v_segmentEnd - v_segmentStart) / segmentLength;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPoint = currentPoint - v_segmentStart;\n float currentLengthPx = max(0., min(dot(segmentTangent, startToPoint), segmentLength)) + v_distanceOffsetPx; \n float currentRadiusPx = abs(dot(segmentNormal, startToPoint));\n float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;\n vec4 color = ${this.strokeColorExpression_} * u_globalAlpha;\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);\n float distance = max(\n segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distance = max(distance, ${this.strokeDistanceFieldExpression_});\n gl_FragColor = color * smoothstep(0., -1., distance);\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getFillVertexShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_prop_hitColor = a_prop_hitColor;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getFillFragmentShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_} * u_globalAlpha;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}}},31871:function(t,e,i){"use strict";i.d(e,{CL:function(){return a},Zh:function(){return _},zO:function(){return l}});var n=i(57906),r=i(11587),s=i(25638),o=i(12185);function a(t,e,i){const r=(0,n.Mj)();return r.style=t.style,(0,s.xA)(e,i,r,t)}function l(t){const e=(0,o._2)(t);return[256*e[0]+e[1],256*e[2]+Math.round(255*e[3])]}const h="vec4 unpackColor(vec2 packedColor) {\n return fract(packedColor[1] / 256.0) * vec4(\n fract(floor(packedColor[0] / 256.0) / 256.0),\n fract(packedColor[0] / 256.0),\n fract(floor(packedColor[1] / 256.0) / 256.0),\n 1.0\n );\n}";function u(t){return t===n.Mr?2:t===n.PA?4:1}function c(t){const e=u(t);return e>1?`vec${e}`:"float"}function d(t){return(JSON.stringify(t).split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)),0)>>>0).toString()}function f(t,e,i,r){if(`${r}radius`in t&&"icon-"!==r){let s=a(i,t[`${r}radius`],n.sw);if(`${r}radius2`in t){s=`max(${s}, ${a(i,t[`${r}radius2`],n.sw)})`}`${r}stroke-width`in t&&(s=`(${s} + ${a(i,t[`${r}stroke-width`],n.sw)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${s} * 2. + 0.5)`)}if(`${r}scale`in t){const s=a(i,t[`${r}scale`],n.sw|n.PA);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${s}`)}`${r}displacement`in t&&e.setSymbolOffsetExpression(a(i,t[`${r}displacement`],n.PA)),`${r}rotation`in t&&e.setSymbolRotationExpression(a(i,t[`${r}rotation`],n.sw)),`${r}rotate-with-view`in t&&e.setSymbolRotateWithView(!!t[`${r}rotate-with-view`])}function g(t,e,i,n,r){let s="vec4(0.)";if(null!==e&&(s=e),null!==i&&null!==n){s=`mix(${i}, ${s}, ${`smoothstep(-${n} + 0.63, -${n} - 0.58, ${t})`})`}let o=`${s} * ${`(1.0 - smoothstep(-0.63, 0.58, ${t}))`}`;return null!==r&&(o=`${o} * ${r}`),o}function p(t,e,i,n,r){const o=new Image;let a;return o.crossOrigin=void 0===t[`${n}cross-origin`]?"anonymous":t[`${n}cross-origin`],o.src=t[`${n}src`],o.complete&&o.width&&o.height?a=(0,s.ci)([o.width,o.height]):(i[`u_texture${r}_size`]=()=>o.complete?[o.width,o.height]:[0,0],e.addUniform(`vec2 u_texture${r}_size`),a=`u_texture${r}_size`),i[`u_texture${r}`]=o,e.addUniform(`sampler2D u_texture${r}`),a}function m(t,e,i,r,s){let o=a(i,t[`${e}offset`],n.PA);if(`${e}offset-origin`in t)switch(t[`${e}offset-origin`]){case"top-right":o=`vec2(${r}.x, 0.) + ${s} * vec2(-1., 0.) + ${o} * vec2(-1., 1.)`;break;case"bottom-left":o=`vec2(0., ${r}.y) + ${s} * vec2(0., -1.) + ${o} * vec2(1., -1.)`;break;case"bottom-right":o=`${r} - ${s} - ${o}`}return o}function _(t){const e={inFragmentShader:!1,properties:{},variables:{},functions:{},style:t},i={inFragmentShader:!0,variables:e.variables,properties:{},functions:{},style:t},_=new r.k,y={};if("icon-src"in t?function(t,e,i,r,s){let o="vec4(1.0)";"icon-color"in t&&(o=a(s,t["icon-color"],n.Mr)),"icon-opacity"in t&&(o=`${o} * ${a(s,t["icon-opacity"],n.sw)}`);const l=d(t["icon-src"]),h=p(t,e,i,"icon-",l);if(e.setSymbolColorExpression(`${o} * samplePremultiplied(u_texture${l}, v_texCoord)`).setSymbolSizeExpression(h),"icon-width"in t&&"icon-height"in t&&e.setSymbolSizeExpression(`vec2(${a(r,t["icon-width"],n.sw)}, ${a(r,t["icon-height"],n.sw)})`),"icon-offset"in t&&"icon-size"in t){const i=a(r,t["icon-size"],n.PA),s=e.getSymbolSizeExpression();e.setSymbolSizeExpression(i);const o=m(t,"icon-",r,"v_quadSizePx",i);e.setTextureCoordinateExpression(`(vec4((${o}).xyxy) + vec4(0., 0., ${i})) / (${s}).xyxy`)}if(f(t,e,r,"icon-"),"icon-anchor"in t){const i=a(r,t["icon-anchor"],n.PA);let s,o="1.0";"icon-scale"in t&&(o=a(r,t["icon-scale"],n.sw|n.PA)),s="pixels"===t["icon-anchor-x-units"]&&"pixels"===t["icon-anchor-y-units"]?`${i} * ${o}`:"pixels"===t["icon-anchor-x-units"]?`${i} * vec2(vec2(${o}).x, v_quadSizePx.y)`:"pixels"===t["icon-anchor-y-units"]?`${i} * vec2(v_quadSizePx.x, vec2(${o}).x)`:`${i} * v_quadSizePx`;let l=`v_quadSizePx * vec2(0.5, -0.5) + ${s} * vec2(-1., 1.)`;if("icon-anchor-origin"in t)switch(t["icon-anchor-origin"]){case"top-right":l=`v_quadSizePx * -0.5 + ${s}`;break;case"bottom-left":l=`v_quadSizePx * 0.5 - ${s}`;break;case"bottom-right":l=`v_quadSizePx * vec2(-0.5, 0.5) + ${s} * vec2(1., -1.)`}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${l}`)}}(t,_,y,e,i):"shape-points"in t?function(t,e,i,r,s){s.functions.round="float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}",s.functions.starDistanceField="float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}",s.functions.regularDistanceField="float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}",f(t,e,r,"shape-");let o=null;"shape-opacity"in t&&(o=a(s,t["shape-opacity"],n.sw));let l="coordsPx";"shape-scale"in t&&(l=`coordsPx / ${a(s,t["shape-scale"],n.sw|n.PA)}`);let h=null;"shape-fill-color"in t&&(h=a(s,t["shape-fill-color"],n.Mr));let u=null;"shape-stroke-color"in t&&(u=a(s,t["shape-stroke-color"],n.Mr));let c=null;"shape-stroke-width"in t&&(c=a(s,t["shape-stroke-width"],n.sw));const d=a(s,t["shape-points"],n.sw);let p,m="0.";"shape-angle"in t&&(m=a(s,t["shape-angle"],n.sw));let _=a(s,t["shape-radius"],n.sw);if(null!==c&&(_=`${_} + ${c} * 0.5`),"shape-radius2"in t){let e=a(s,t["shape-radius2"],n.sw);null!==c&&(e=`${e} + ${c} * 0.5`),p=`starDistanceField(${l}, ${d}, ${_}, ${e}, ${m})`}else p=`regularDistanceField(${l}, ${d}, ${_}, ${m})`;const y=g(p,h,u,c,o);e.setSymbolColorExpression(y)}(t,_,0,e,i):"circle-radius"in t&&function(t,e,i,r,s){s.functions.circleDistanceField="float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}",f(t,e,r,"circle-");let o=null;"circle-opacity"in t&&(o=a(s,t["circle-opacity"],n.sw));let l="coordsPx";"circle-scale"in t&&(l=`coordsPx / ${a(s,t["circle-scale"],n.sw|n.PA)}`);let h=null;"circle-fill-color"in t&&(h=a(s,t["circle-fill-color"],n.Mr));let u=null;"circle-stroke-color"in t&&(u=a(s,t["circle-stroke-color"],n.Mr));let c=a(s,t["circle-radius"],n.sw),d=null;"circle-stroke-width"in t&&(d=a(s,t["circle-stroke-width"],n.sw),c=`(${c} + ${d} * 0.5)`);const p=g(`circleDistanceField(${l}, ${c})`,h,u,d,o);e.setSymbolColorExpression(p)}(t,_,0,e,i),function(t,e,i,r,o){if("stroke-color"in t&&e.setStrokeColorExpression(a(o,t["stroke-color"],n.Mr)),"stroke-pattern-src"in t){const r=d(t["stroke-pattern-src"]),s=p(t,e,i,"stroke-pattern-",r);let l=s,h="vec2(0.)";"stroke-pattern-offset"in t&&"stroke-pattern-size"in t&&(l=a(o,t["stroke-pattern-size"],n.PA),h=m(t,"stroke-pattern-",o,s,l));let u="0.";"stroke-pattern-spacing"in t&&(u=a(o,t["stroke-pattern-spacing"],n.sw)),o.functions.sampleStrokePattern="vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = currentLengthPx * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return samplePremultiplied(texture, texCoord);\n}";const c=`u_texture${r}`;let f="1.";"stroke-color"in t&&(f=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${f} * sampleStrokePattern(${c}, ${s}, ${h}, ${l}, ${u}, currentLengthPx, currentRadiusRatio, v_width)`)}if("stroke-width"in t&&e.setStrokeWidthExpression(a(r,t["stroke-width"],n.sw)),"stroke-offset"in t&&e.setStrokeOffsetExpression(a(r,t["stroke-offset"],n.sw)),"stroke-line-cap"in t&&e.setStrokeCapExpression(a(r,t["stroke-line-cap"],n.uW)),"stroke-line-join"in t&&e.setStrokeJoinExpression(a(r,t["stroke-line-join"],n.uW)),"stroke-miter-limit"in t&&e.setStrokeMiterLimitExpression(a(r,t["stroke-miter-limit"],n.sw)),"stroke-line-dash"in t){o.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${(0,s.JB)("square")}) {\n distanceSegment -= v_width * 0.5;\n } else if (capType == ${(0,s.JB)("round")}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - v_width * 0.5);\n }\n return distanceSegment;\n}`;let i=t["stroke-line-dash"].map((t=>a(o,t,n.sw)));i.length%2==1&&(i=[...i,...i]);let l="0.";"stroke-line-dash-offset"in t&&(l=a(r,t["stroke-line-dash-offset"],n.sw));const h=`dashDistanceField_${d(t["stroke-line-dash"])}`,u=i.map(((t,e)=>`float dashLength${e} = ${t};`)),c=i.map(((t,e)=>`dashLength${e}`)).join(" + ");let f="0.",g=`getSingleDashDistance(distance, radius, ${f}, dashLength0, totalDashLength, capType)`;for(let t=2;t(0,s.Ce)(t.variables[r.name]):r.type===n.Mr?()=>l([...(0,o._2)(t.variables[r.name]||"#eee")]):r.type===n.wy?()=>t.variables[r.name]?1:0:()=>t.variables[r.name],y[a]=h})),Object.keys(i.properties).forEach((function(t){const r=i.properties[t];e.properties[t]||(e.properties[t]=r);let s=c(r.type),o=`a_prop_${r.name}`;r.type===n.Mr&&(s="vec4",o=`unpackColor(${o})`,_.addVertexShaderFunction(h)),_.addVarying(`v_prop_${r.name}`,s,o)})),Object.keys(e.properties).forEach((function(t){const i=e.properties[t];_.addAttribute(`${c(i.type)} a_prop_${i.name}`)}));const x=Object.keys(e.properties).map((function(t){const i=e.properties[t];let r;return r=i.evaluator?i.evaluator:i.type===n.uW?t=>(0,s.Ce)(t.get(i.name)):i.type===n.Mr?t=>l([...(0,o._2)(t.get(i.name)||"#eee")]):i.type===n.wy?t=>t.get(i.name)?1:0:t=>t.get(i.name),{name:i.name,size:u(i.type),callback:r}}));for(const t in e.functions)_.addVertexShaderFunction(e.functions[t]);for(const t in i.functions)_.addFragmentShaderFunction(i.functions[t]);return{builder:_,attributes:x.reduce(((t,e)=>({...t,[e.name]:{callback:e.callback,size:e.size}})),{}),uniforms:y}}},31990:function(t,e,i){"use strict";i.d(e,{A4:function(){return m},As:function(){return h},C5:function(){return E},Ei:function(){return d},G3:function(){return y},JO:function(){return _},Me:function(){return R},O:function(){return w},Pr:function(){return p},Qc:function(){return u},RA:function(){return v},T3:function(){return b},Ve:function(){return o},ZL:function(){return C},c:function(){return s},fJ:function(){return r},hg:function(){return x},ke:function(){return g},pc:function(){return c},qk:function(){return l},xc:function(){return P},z:function(){return f}});var n=i(17367);const r="http://www.w3.org/2001/XMLSchema-instance";function s(t,e){return R().createElementNS(t,e)}function o(t,e){return a(t,e,[]).join("")}function a(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):i.push(t.nodeValue);else{let n;for(n=t.firstChild;n;n=n.nextSibling)a(n,e,i)}return i}function l(t){return"documentElement"in t}function h(t,e,i){return t.getAttributeNS(e,i)||""}function u(t){return(new DOMParser).parseFromString(t,"application/xml")}function c(t,e){return function(i,r){const s=t.call(void 0!==e?e:this,i,r);if(void 0!==s){const t=r[r.length-1];(0,n.l7)(t,s)}}}function d(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);if(void 0!==r){n[n.length-1].push(r)}}}function f(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);void 0!==r&&(n[n.length-1]=r)}}function g(t,e,i){return function(n,r){const s=t.call(void 0!==i?i:this,n,r);if(void 0!==s){const t=r[r.length-1],i=void 0!==e?e:n.localName;let o;i in t?o=t[i]:(o=[],t[i]=o),o.push(s)}}}function p(t,e,i){return function(n,r){const s=t.call(void 0!==i?i:this,n,r);if(void 0!==s){r[r.length-1][void 0!==e?e:n.localName]=s}}}function m(t,e){return function(i,n,r){t.call(void 0!==e?e:this,i,n,r);r[r.length-1].node.appendChild(i)}}function _(t,e){let i,n;return function(e,r,s){if(void 0===i){i={};const r={};r[e.localName]=t,i[e.namespaceURI]=r,n=y(e.localName)}S(i,n,r,s)}}function y(t,e){return function(i,n,r){const o=n[n.length-1].node;let a=t;void 0===a&&(a=r);return s(void 0!==e?e:o.namespaceURI,a)}}const x=y();function v(t,e){const i=e.length,n=new Array(i);for(let r=0;r=s)&&Object.keys(r.O).every((function(t){return r.O[t](i[l])}))?i.splice(l--,1):(a=!1,s0&&t[u-1][2]>s;u--)t[u]=t[u-1];t[u]=[i,n,s]},r.d=function(t,e){for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.f={},r.e=function(t){return Promise.all(Object.keys(r.f).reduce((function(e,i){return r.f[i](t,e),e}),[]))},r.u=function(t){return t+".js"},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e={},r.l=function(t,i,n,s){if(e[t])e[t].push(i);else{var o,a;if(void 0!==n)for(var l=document.getElementsByTagName("script"),h=0;h-1&&!t;)t=i[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t}(),function(){var t={8592:0};r.f.j=function(e,i){var n=r.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var s=new Promise((function(i,r){n=t[e]=[i,r]}));i.push(n[2]=s);var o=r.p+r.u(e),a=new Error;r.l(o,(function(i){if(r.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var s=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+o+")",a.name="ChunkLoadError",a.type=s,a.request=o,n[1](a)}}),"chunk-"+e,e)}},r.O.j=function(e){return 0===t[e]};var e=function(e,i){var n,s,o=i[0],a=i[1],l=i[2],h=0;if(o.some((function(e){return 0!==t[e]}))){for(n in a)r.o(a,n)&&(r.m[n]=a[n]);if(l)var u=l(r)}for(e&&e(i);h>1,u=-7,c=i?r-1:0,d=i?-1:1,f=t[e+c];for(c+=d,s=f&(1<<-u)-1,f>>=-u,u+=a;u>0;s=256*s+t[e+c],c+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+t[e+c],c+=d,u-=8);if(0===s)s=1-h;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),s-=h}return(f?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,i,n,r,s){var o,a,l,h=8*s-r-1,u=(1<>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:s-1,g=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+c>=1?d/l:d*Math.pow(2,1-c))*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*l-1)*Math.pow(2,r),o+=c):(a=e*Math.pow(2,c-1)*Math.pow(2,r),o=0));r>=8;t[i+f]=255&a,f+=g,a/=256,r-=8);for(o=o<0;t[i+f]=255&o,f+=g,o/=256,h-=8);t[i+f-g]|=128*p}},58882:function(t,e,i){"use strict";t.exports=r;var n=i(78898);function r(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}r.Varint=0,r.Fixed64=1,r.Bytes=2,r.Fixed32=5;var s=4294967296,o=1/s,a="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function l(t){return t.type===r.Bytes?t.readVarint()+t.pos:t.pos+1}function h(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function u(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var r=i.pos-1;r>=t;r--)i.buf[r+n]=i.buf[r]}function c(t,e){for(var i=0;i>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function b(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}r.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos>3,s=this.pos;this.type=7&n,t(r,e,this),this.pos===s&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=b(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=v(this.buf,this.pos)+v(this.buf,this.pos+4)*s;return this.pos+=8,t},readSFixed64:function(){var t=v(this.buf,this.pos)+b(this.buf,this.pos+4)*s;return this.pos+=8,t},readFloat:function(){var t=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(t,e,i){var n,r,s=i.buf;if(r=s[i.pos++],n=(112&r)>>4,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return h(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return h(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=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&&a?function(t,e,i){return a.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",r=e;for(;r239?4:l>223?3:l>191?2:1;if(r+u>i)break;1===u?l<128&&(h=l):2===u?128==(192&(s=t[r+1]))&&(h=(31&l)<<6|63&s)<=127&&(h=null):3===u?(s=t[r+1],o=t[r+2],128==(192&s)&&128==(192&o)&&((h=(15&l)<<12|(63&s)<<6|63&o)<=2047||h>=55296&&h<=57343)&&(h=null)):4===u&&(s=t[r+1],o=t[r+2],a=t[r+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&((h=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)<=65535||h>=1114112)&&(h=null)),null===h?(h=65533,u=1):h>65535&&(h-=65536,n+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),n+=String.fromCharCode(h),r+=u}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!==r.Bytes)return t.push(this.readVarint(e));var i=l(this);for(t=t||[];this.pos127;);else if(e===r.Bytes)this.pos=this.readVarint()+this.pos;else if(e===r.Fixed32)this.pos+=4;else{if(e!==r.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 i,n;t>=0?(i=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(i=~(-t%4294967296))?i=i+1|0:(i=0,n=n+1|0));if(t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,i){i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos++]=127&t|128,t>>>=7,i.buf[i.pos]=127&t}(i,0,e),function(t,e){var i=(7&t)<<4;if(e.buf[e.pos++]|=i|((t>>>=3)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;if(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),!t)return;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,i){for(var n,r,s=0;s55295&&n<57344){if(!r){n>56319||s+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):r=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,r=n;continue}n=r-55296<<10|n-56320|65536,r=null}else r&&(t[i++]=239,t[i++]=191,t[i++]=189,r=null);n<128?t[i++]=n:(n<2048?t[i++]=n>>6|192:(n<65536?t[i++]=n>>12|224:(t[i++]=n>>18|240,t[i++]=n>>12&63|128),t[i++]=n>>6&63|128),t[i++]=63&n|128)}return i}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&u(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),n.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),n.write(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 i=0;i=128&&u(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,r.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,c,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,f,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,_,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,x,e)},writeBytesField:function(t,e){this.writeTag(t,r.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,r.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,r.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,r.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,r.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,r.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,r.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},61840:function(t,e,i){"use strict";i.d(e,{Z:function(){return Fi}});var n=1,r=2,s=3,o=5,a=6378137,l=6356752.314,h=.0066943799901413165,u=484813681109536e-20,c=Math.PI/2,d=.16666666666666666,f=.04722222222222222,g=.022156084656084655,p=1e-10,m=.017453292519943295,_=57.29577951308232,y=Math.PI/4,x=2*Math.PI,v=3.14159265359,E={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},b={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}},w=/[\s_\-\/\(\)]/g;function S(t,e){if(t[e])return t[e];for(var i,n=Object.keys(t),r=e.toLowerCase().replace(w,""),s=-1;++s=this.text.length)return;t=this.text[this.place++]}switch(this.state){case M:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},F.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(A.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},F.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=M)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=M,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},F.prototype.number=function(t){if(!L.test(t)){if(A.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},F.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},F.prototype.keyword=function(t){if(I.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=M)}if(!A.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},F.prototype.neutral=function(t){if(R.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(L.test(t))return this.word=t,void(this.state=3);if(!A.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},F.prototype.output=function(){for(;this.place0?90:-90)):(t.lat0=D(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(r),r}function G(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?G[t]=C(arguments[1]):G[t]=N(arguments[1]):G[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?G.apply(e,t):G(t)}));if("string"==typeof t){if(t in G)return G[t]}else"EPSG"in t?G["EPSG:"+t.EPSG]=t:"ESRI"in t?G["ESRI:"+t.ESRI]=t:"IAU2000"in t?G["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}(G);var z=G;var j=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var U=["3857","900913","3785","102113"];var B=function(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in z}(t))return z[t];if(function(t){return j.some((function(e){return t.indexOf(e)>-1}))}(t)){var e=N(t);if(function(t){var e=S(t,"authority");if(e){var i=S(e,"epsg");return i&&U.indexOf(i)>-1}}(e))return z["EPSG:3857"];var i=function(t){var e=S(t,"extension");if(e)return S(e,"proj4")}(e);return i?C(i):e}return function(t){return"+"===t[0]}(t)?C(t):void 0};function q(t,e){var i,n;if(t=t||{},!e)return t;for(n in e)void 0!==(i=e[n])&&(t[n]=i);return t}function V(t,e,i){var n=t*e;return i/Math.sqrt(1-n*n)}function X(t){return t<0?-1:1}function $(t){return Math.abs(t)<=v?t:t-X(t)*x}function W(t,e,i){var n=t*i,r=.5*t;return n=Math.pow((1-n)/(1+n),r),Math.tan(.5*(c-e))/n}function Y(t,e){for(var i,n,r=.5*t,s=c-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(s),s+=n=c-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-s,Math.abs(n)<=1e-10)return s;return-9999}function H(t){return t}var K=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,n=t.x,r=t.y;if(r*_>90&&r*_<-90&&n*_>180&&n*_<-180)return null;if(Math.abs(Math.abs(r)-c)<=p)return null;if(this.sphere)e=this.x0+this.a*this.k0*$(n-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(y+.5*r));else{var s=Math.sin(r),o=W(this.e,r,s);e=this.x0+this.a*this.k0*$(n-this.long0),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,n=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=c-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var s=Math.exp(-r/(this.a*this.k0));if(-9999===(i=Y(this.e,s)))return null}return e=$(this.long0+n/(this.a*this.k0)),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:H,inverse:H,names:["longlat","identity"]}],J={},Q=[];function tt(t,e){var i=Q.length;return t.names?(Q[i]=t,t.names.forEach((function(t){J[t.toLowerCase()]=i})),this):(console.log(e),!0)}var et={start:function(){K.forEach(tt)},add:tt,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==J[e]&&Q[J[e]]?Q[J[e]]:void 0}},it={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},nt=it.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};it.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var rt={};rt.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},rt.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},rt.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},rt.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},rt.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},rt.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},rt.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},rt.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},rt.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},rt.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rt.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},rt.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},rt.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},rt.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},rt.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},rt.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rt.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var st=function(t,e,i,a,l,h,c){var d={};return d.datum_type=void 0===t||"none"===t?o:4,e&&(d.datum_params=e.map(parseFloat),0===d.datum_params[0]&&0===d.datum_params[1]&&0===d.datum_params[2]||(d.datum_type=n),d.datum_params.length>3&&(0===d.datum_params[3]&&0===d.datum_params[4]&&0===d.datum_params[5]&&0===d.datum_params[6]||(d.datum_type=r,d.datum_params[3]*=u,d.datum_params[4]*=u,d.datum_params[5]*=u,d.datum_params[6]=d.datum_params[6]/1e6+1))),c&&(d.datum_type=s,d.grids=c),d.a=i,d.b=a,d.es=l,d.ep2=h,d},ot={};function at(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:ot[t]||null,isNull:!1}}function lt(t){return t/3600*Math.PI/180}function ht(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function ut(t){return t.map((function(t){return[lt(t.longitudeShift),lt(t.latitudeShift)]}))}function ct(t,e,i){return{name:ht(t,e+8,e+16).trim(),parent:ht(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function dt(t,e,i,n){for(var r=e+176,s=[],o=0;o-1.001*c)l=-c;else if(l>c&&l<1.001*c)l=c;else{if(l<-c)return{x:-1/0,y:-1/0,z:t.z};if(l>c)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),r=Math.sin(l),o=Math.cos(l),s=r*r,{x:((n=i/Math.sqrt(1-e*s))+h)*o*Math.cos(a),y:(n+h)*o*Math.sin(a),z:(n*(1-e)+h)*r}}function mt(t,e,i,n){var r,s,o,a,l,h,u,d,f,g,p,m,_,y,x,v=1e-12,E=t.x,b=t.y,w=t.z?t.z:0;if(r=Math.sqrt(E*E+b*b),s=Math.sqrt(E*E+b*b+w*w),r/i1e-24&&_<30);return{x:y,y:Math.atan(p/Math.abs(g)),z:x}}function _t(t){return t===n||t===r}function yt(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===n?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==r||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(t.datum_type===o||e.datum_type===o)return i;var u=t.a,c=t.es;if(t.datum_type===s){if(0!==xt(t,!1,i))return;u=a,c=h}var d=e.a,f=e.b,g=e.es;if(e.datum_type===s&&(d=a,f=l,g=h),c===g&&u===d&&!_t(t.datum_type)&&!_t(e.datum_type))return i;if((i=pt(i,c,u),_t(t.datum_type)&&(i=function(t,e,i){if(e===n)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===r){var s=i[0],o=i[1],a=i[2],l=i[3],h=i[4],u=i[5],c=i[6];return{x:c*(t.x-u*t.y+h*t.z)+s,y:c*(u*t.x+t.y-l*t.z)+o,z:c*(-h*t.x+l*t.y+t.z)+a}}}(i,t.datum_type,t.datum_params)),_t(e.datum_type)&&(i=function(t,e,i){if(e===n)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===r){var s=i[0],o=i[1],a=i[2],l=i[3],h=i[4],u=i[5],c=i[6],d=(t.x-s)/c,f=(t.y-o)/c,g=(t.z-a)/c;return{x:d+u*f-h*g,y:-u*d+f+l*g,z:h*d-l*f+g}}}(i,e.datum_type,e.datum_params)),i=mt(i,g,d,f),e.datum_type===s)&&0!==xt(e,!0,i))return;return i}function xt(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var n={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},s=[];t:for(var o=0;on.y||f>n.x||m1e-12&&Math.abs(o.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),n;n.x=$(s.x+i.ll[0]),n.y=s.y+i.ll[1]}else isNaN(s.x)||(n.x=t.x+s.x,n.y=t.y+s.y);return n}function Et(t,e){var i,n={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(n.x),s=Math.floor(n.y),o=n.x-1*r,a=n.y-1*s,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(s<0||s>=e.lim[1])return l;i=s*e.lim[0]+r;var h=e.cvs[i][0],u=e.cvs[i][1];i++;var c=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],g=e.cvs[i][1];i--;var p=e.cvs[i][0],m=e.cvs[i][1],_=o*a,y=o*(1-a),x=(1-o)*(1-a),v=(1-o)*a;return l.x=x*h+y*c+v*p+_*f,l.y=x*u+y*d+v*m+_*g,l}function bt(t,e,i){var n,r,s,o=i.x,a=i.y,l=i.z||0,h={};for(s=0;s<3;s++)if(!e||2!==s||void 0!==i.z)switch(0===s?(n=o,r=-1!=="ew".indexOf(t.axis[s])?"x":"y"):1===s?(n=a,r=-1!=="ns".indexOf(t.axis[s])?"y":"x"):(n=l,r="z"),t.axis[s]){case"e":case"n":h[r]=n;break;case"w":case"s":h[r]=-n;break;case"u":void 0!==i[r]&&(h.z=n);break;case"d":void 0!==i[r]&&(h.z=-n);break;default:return null}return h}function wt(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function St(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function Ct(t,e,i,o){var a,l=void 0!==(i=Array.isArray(i)?wt(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){St(t.x),St(t.y)}(i),t.datum&&e.datum&&function(t,e){return(t.datum.datum_type===n||t.datum.datum_type===r||t.datum.datum_type===s)&&"WGS84"!==e.datumCode||(e.datum.datum_type===n||e.datum.datum_type===r||e.datum.datum_type===s)&&"WGS84"!==t.datumCode}(t,e)&&(i=Ct(t,a=new gt("WGS84"),i,o),t=a),o&&"enu"!==t.axis&&(i=bt(t,!1,i)),"longlat"===t.projName)i={x:i.x*m,y:i.y*m,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=yt(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*_,y:i.y*_,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),o&&"enu"!==e.axis?bt(e,!0,i):(i&&!l&&delete i.z,i)}var Tt=gt("WGS84");function Mt(t,e,i,n){var r,s,o;return Array.isArray(i)?(r=Ct(t,e,i,n)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.splice(3)):[r.x,r.y,i[2]].concat(i.splice(3)):[r.x,r.y].concat(i.splice(2)):[r.x,r.y]):(s=Ct(t,e,i,n),2===(o=Object.keys(i)).length||o.forEach((function(n){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===n||"y"===n||"z"===n)return}else if("x"===n||"y"===n)return;s[n]=i[n]})),s)}function Pt(t){return t instanceof gt?t:t.oProj?t.oProj:gt(t)}var Rt=function(t,e,i){t=Pt(t);var n,r=!1;return void 0===e?(e=t,t=Tt,r=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=Tt,r=!0),e=Pt(e),i?Mt(t,e,i):(n={forward:function(i,n){return Mt(t,e,i,n)},inverse:function(i,n){return Mt(e,t,i,n)}},r&&(n.oProj=e),n)},It=6,At="AJSAJS",Lt="AFAFAF",Ft=65,Ot=73,Zt=79,kt=86,Dt=90,Nt={forward:Gt,inverse:function(t){var e=Bt(Xt(t.toUpperCase()));if(e.lat&&e.lon)return[e.lon,e.lat,e.lon,e.lat];return[e.left,e.bottom,e.right,e.top]},toPoint:zt};function Gt(t,e){return e=e||5,function(t,e){var i="00000"+t.easting,n="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(f=t.easting,g=t.northing,p=t.zoneNumber,m=Vt(p),_=Math.floor(f/1e5),y=Math.floor(g/1e5)%20,r=_,s=y,o=m,a=o-1,l=At.charCodeAt(a),h=Lt.charCodeAt(a),u=l+r-1,c=h+s,d=!1,u>Dt&&(u=u-Dt+Ft-1,d=!0),(u===Ot||lOt||(u>Ot||lZt||(u>Zt||lDt&&(u=u-Dt+Ft-1),c>kt?(c=c-kt+Ft-1,d=!0):d=!1,(c===Ot||hOt||(c>Ot||hZt||(c>Zt||hkt&&(c=c-kt+Ft-1),String.fromCharCode(u)+String.fromCharCode(c))+i.substr(i.length-5,e)+n.substr(n.length-5,e);var r,s,o,a,l,h,u,c,d;var f,g,p,m,_,y}(function(t){var e,i,n,r,s,o,a,l,h=t.lat,u=t.lon,c=6378137,d=.00669438,f=.9996,g=jt(h),p=jt(u);l=Math.floor((u+180)/6)+1,180===u&&(l=60);h>=56&&h<64&&u>=3&&u<12&&(l=32);h>=72&&h<84&&(u>=0&&u<9?l=31:u>=9&&u<21?l=33:u>=21&&u<33?l=35:u>=33&&u<42&&(l=37));a=jt(6*(l-1)-180+3),e=d/(1-d),i=c/Math.sqrt(1-d*Math.sin(g)*Math.sin(g)),n=Math.tan(g)*Math.tan(g),r=e*Math.cos(g)*Math.cos(g),s=Math.cos(g)*(p-a),o=c*((1-d/4-3*d*d/64-5*d*d*d/256)*g-(3*d/8+3*d*d/32+45*d*d*d/1024)*Math.sin(2*g)+(15*d*d/256+45*d*d*d/1024)*Math.sin(4*g)-35*d*d*d/3072*Math.sin(6*g));var m=f*i*(s+(1-n+r)*s*s*s/6+(5-18*n+n*n+72*r-58*e)*s*s*s*s*s/120)+5e5,_=f*(o+i*Math.tan(g)*(s*s/2+(5-n+9*r+4*r*r)*s*s*s*s/24+(61-58*n+n*n+600*r-330*e)*s*s*s*s*s*s/720));h<0&&(_+=1e7);return{northing:Math.round(_),easting:Math.round(m),zoneNumber:l,zoneLetter:qt(h)}}({lat:t[1],lon:t[0]}),e)}function zt(t){var e=Bt(Xt(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function jt(t){return t*(Math.PI/180)}function Ut(t){return t/Math.PI*180}function Bt(t){var e=t.northing,i=t.easting,n=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var s,o,a,l,h,u,c,d,f,g=.9996,p=6378137,m=.00669438,_=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=i-5e5,x=e;n<"N"&&(x-=1e7),c=6*(r-1)-180+3,s=.006739496752268451,f=(d=x/g/6367449.145945056)+(3*_/2-27*_*_*_/32)*Math.sin(2*d)+(21*_*_/16-55*_*_*_*_/32)*Math.sin(4*d)+151*_*_*_/96*Math.sin(6*d),o=p/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),l=s*Math.cos(f)*Math.cos(f),h=.99330562*p/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),u=y/(o*g);var v=f-o*Math.tan(f)/h*(u*u/2-(5+3*a+10*l-4*l*l-9*s)*u*u*u*u/24+(61+90*a+298*l+45*a*a-1.6983531815716497-3*l*l)*u*u*u*u*u*u/720);v=Ut(v);var E,b=(u-(1+2*a+l)*u*u*u/6+(5-2*l+28*a-3*l*l+8*s+24*a*a)*u*u*u*u*u/120)/Math.cos(f);if(b=c+Ut(b),t.accuracy){var w=Bt({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});E={top:w.lat,right:w.lon,bottom:v,left:b}}else E={lat:v,lon:b};return E}function qt(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Vt(t){var e=t%It;return 0===e&&(e=It),e}function Xt(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,n=null,r="",s=0;!/[A-Z]/.test(e=t.charAt(s));){if(s>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,s++}var o=parseInt(r,10);if(0===s||s+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(s++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;n=t.substring(s,s+=2);for(var l=Vt(o),h=function(t,e){var i=At.charCodeAt(e-1),n=1e5,r=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===Zt&&i++,i>Dt){if(r)throw"Bad character: "+t;i=Ft,r=!0}n+=1e5}return n}(n.charAt(0),l),u=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Lt.charCodeAt(e-1),n=0,r=!1;for(;i!==t.charCodeAt(0);){if(++i===Ot&&i++,i===Zt&&i++,i>kt){if(r)throw"Bad character: "+t;i=Ft,r=!0}n+=1e5}return n}(n.charAt(1),l);u<$t(a);)u+=2e6;var c=i-s;if(c%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,f,g,p=c/2,m=0,_=0;return p>0&&(d=1e5/Math.pow(10,p),f=t.substring(s,s+p),m=parseFloat(f)*d,g=t.substring(s+p),_=parseFloat(g)*d),{easting:m+h,northing:_+u,zoneLetter:a,zoneNumber:o,accuracy:d}}function $t(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Wt(t,e,i){if(!(this instanceof Wt))return new Wt(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var n=t.split(",");this.x=parseFloat(n[0],10),this.y=parseFloat(n[1],10),this.z=parseFloat(n[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Wt.fromMGRS=function(t){return new Wt(zt(t))},Wt.prototype.toMGRS=function(t){return Gt([this.x,this.y],t)};var Yt=Wt,Ht=1,Kt=.25,Jt=.046875,Qt=.01953125,te=.01068115234375,ee=.75,ie=.46875,ne=.013020833333333334,re=.007120768229166667,se=.3645833333333333,oe=.005696614583333333,ae=.3076171875;function le(t){var e=[];e[0]=Ht-t*(Kt+t*(Jt+t*(Qt+t*te))),e[1]=t*(ee-t*(Jt+t*(Qt+t*te)));var i=t*t;return e[2]=i*(ie-t*(ne+t*re)),i*=t,e[3]=i*(se-t*oe),e[4]=i*t*ae,e}function he(t,e,i,n){return i*=e,e*=e,n[0]*t-i*(n[1]+e*(n[2]+e*(n[3]+e*n[4])))}var ue=20;function ce(t,e,i){for(var n=1/(1-e),r=t,s=ue;s;--s){var o=Math.sin(r),a=1-e*o*o;if(r-=a=(he(r,o,Math.cos(r),i)-t)*(a*Math.sqrt(a))*n,Math.abs(a)p?Math.tan(s):0,g=Math.pow(f,2),m=Math.pow(g,2);e=1-this.es*Math.pow(a,2),h/=Math.sqrt(e);var _=he(s,a,l,this.en);i=this.a*(this.k0*h*(1+u/6*(1-g+c+u/20*(5-18*g+m+14*c-58*g*c+u/42*(61+179*m-m*g-479*g)))))+this.x0,n=this.a*(this.k0*(_-this.ml0+a*o*h/2*(1+u/12*(5-g+9*c+4*d+u/30*(61+m-58*g+270*c-330*g*c+u/56*(1385+543*m-m*g-3111*g))))))+this.y0}else{var y=l*Math.sin(o);if(Math.abs(Math.abs(y)-1)=1){if(y-1>p)return 93;n=0}else n=Math.acos(n);s<0&&(n=-n),n=this.a*this.k0*(n-this.lat0)+this.y0}return t.x=i,t.y=n,t},inverse:function(t){var e,i,n,r,s=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(i=ce(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)p?Math.tan(i):0,u=this.ep2*Math.pow(l,2),d=Math.pow(u,2),f=Math.pow(h,2),g=Math.pow(f,2);e=1-this.es*Math.pow(a,2);var m=s*Math.sqrt(e)/this.k0,_=Math.pow(m,2);n=i-(e*=h)*_/(1-this.es)*.5*(1-_/12*(5+3*f-9*u*f+u-4*d-_/30*(61+90*f-252*u*f+45*g+46*u-_/56*(1385+3633*f+4095*g+1574*g*f)))),r=$(this.long0+m*(1-_/6*(1+2*f+u-_/20*(5+28*f+24*g+8*u*f+6*u-_/42*(61+662*f+1320*g+720*g*f))))/l)}else n=c*X(o),r=0;else{var y=Math.exp(s/this.k0),x=.5*(y-1/y),v=this.lat0+o/this.k0,E=Math.cos(v);e=Math.sqrt((1-Math.pow(E,2))/(1+Math.pow(x,2))),n=Math.asin(e),o<0&&(n=-n),r=0===x&&0===E?0:$(Math.atan2(x,E)+this.long0)}return t.x=r,t.y=n,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function fe(t){var e=Math.exp(t);return e=(e-1/e)/2}function ge(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),n=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(n,2))}function pe(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(ge(1,e)+1))),t<0?-e:e}function me(t,e){for(var i,n=2*Math.cos(2*e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return e+i*Math.sin(2*e)}function _e(t,e,i){for(var n,r,s=Math.sin(e),o=Math.cos(e),a=fe(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*o*l,u=-2*s*a,c=t.length-1,d=t[c],f=0,g=0,p=0;--c>=0;)n=g,r=f,d=h*(g=d)-n-u*(f=p)+t[c],p=u*g-r+h*f;return[(h=s*l)*d-(u=o*a)*p,h*p+u*d]}var ye={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(de.init.apply(this),this.forward=de.forward,this.inverse=de.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var n=me(this.cbg,this.lat0);this.Zb=-this.Qn*(n+function(t,e){for(var i,n=2*Math.cos(e),r=t.length-1,s=t[r],o=0;--r>=0;)i=n*s-o+t[r],o=s,s=i;return Math.sin(e)*i}(this.gtu,2*n))},forward:function(t){var e=$(t.x-this.long0),i=t.y;i=me(this.cbg,i);var n=Math.sin(i),r=Math.cos(i),s=Math.sin(e),o=Math.cos(e);i=Math.atan2(n,o*r),e=Math.atan2(s*r,ge(n,r*o)),e=pe(Math.tan(e));var a,l,h=_e(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,l=1/0),t.x=a,t.y=l,t},inverse:function(t){var e,i,n=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,n/=this.Qn,Math.abs(n)<=2.623395162778){var s=_e(this.utg,2*r,2*n);r+=s[0],n+=s[1],n=Math.atan(fe(n));var o=Math.sin(r),a=Math.cos(r),l=Math.sin(n),h=Math.cos(n);r=Math.atan2(o*h,ge(l,h*a)),e=$((n=Math.atan2(l,h*a))+this.long0),i=me(this.cgb,r)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","tmerc"]};var xe={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*($(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*m,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,ye.init.apply(this),this.forward=ye.forward,this.inverse=ye.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function ve(t,e){return Math.pow((1-t)/(1+t),e)}var Ee={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+y)/(Math.pow(Math.tan(.5*this.lat0+y),this.C)*ve(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+y),this.C)*ve(this.e*Math.sin(i),this.ratexp))-c,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,n=Math.pow(Math.tan(.5*i+y)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(n*ve(this.e*Math.sin(t.y),-.5*this.e))-c,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]};var be={init:function(){Ee.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,n,r;return t.x=$(t.x-this.long0),Ee.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),n=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*n),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*n),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,n,r,s;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,s=Math.sqrt(t.x*t.x+t.y*t.y)){var o=2*Math.atan2(s,this.R2);e=Math.sin(o),i=Math.cos(o),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/s),n=Math.atan2(t.x*e,s*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,n=0;return t.x=n,t.y=r,Ee.inverse.apply(this,[t]),t.x=$(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};var we={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&(this.k0=.5*(1+X(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=p&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=p&&Math.abs(Math.cos(this.lat_ts))>p&&(this.k0=.5*this.cons*V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/W(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=V(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-c,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,n,r,s,o,a=t.x,l=t.y,h=Math.sin(l),u=Math.cos(l),d=$(a-this.long0);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=p&&Math.abs(l+this.lat0)<=p?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*u*Math.cos(d)),t.x=this.a*e*u*Math.sin(d)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*u*Math.cos(d))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-c,r=Math.cos(i),n=Math.sin(i),Math.abs(this.coslat0)<=p?(s=W(this.e,l*this.con,this.con*h),o=2*this.a*this.k0*s/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)0?$(this.long0+Math.atan2(t.x,-1*t.y)):$(this.long0+Math.atan2(t.x,t.y)):$(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=p){if(o<=p)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,n=o*this.cons/(2*this.a*this.k0),i=this.con*Y(this.e,n),e=this.con*$(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else r=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=p?s=this.X0:(s=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/o),e=$(this.long0+Math.atan2(t.x*Math.sin(r),o*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)))),i=-1*Y(this.e,Math.tan(.5*(c+s)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)","Polar_Stereographic"],ssfn_:function(t,e,i){return e*=i,Math.tan(.5*(c+t))*Math.pow((1-e)/(1+e),.5*i)}};var Se={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,n=1/this.rf,r=2*n-Math.pow(n,2),s=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+s*e)/(1-s*e));this.K=o-this.alpha*a+this.alpha*s/2*l},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),n=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(n))-Math.PI/4),s=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(s)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(s))),a=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(s));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,n=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),s=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(n)),o=Math.atan(Math.sin(n)/(Math.cos(this.b0)*Math.cos(n)-Math.sin(this.b0)*Math.tan(r))),a=this.lambda0+o/this.alpha,l=0,h=s,u=-1e3,c=0;Math.abs(h-u)>1e-7;){if(++c>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+s/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),u=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=a,t.y=h,t},names:["somerc"]},Ce=1e-7;var Te={init:function(){var t,e,i,n,r,s,o,a,l,h,u,d,f,g=0,_=0,v=0,E=0,b=0,w=0,S=0;this.no_off=(f="object"==typeof(d=this).PROJECTION?Object.keys(d.PROJECTION)[0]:d.PROJECTION,"no_uoff"in d||"no_off"in d||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(f)),this.no_rot="no_rot"in this;var C=!1;"alpha"in this&&(C=!0);var T=!1;if("rectified_grid_angle"in this&&(T=!0),C&&(S=this.alpha),T&&(g=this.rectified_grid_angle*m),C||T)_=this.longc;else if(v=this.long1,b=this.lat1,E=this.long2,w=this.lat2,Math.abs(b-w)<=Ce||(t=Math.abs(b))<=Ce||Math.abs(t-c)<=Ce||Math.abs(Math.abs(this.lat0)-c)<=Ce||Math.abs(Math.abs(w)-c)<=Ce)throw new Error;var M=1-this.es;e=Math.sqrt(M),Math.abs(this.lat0)>p?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/M),this.A=this.B*this.k0*e/t,(r=(n=this.B*e/(i*Math.sqrt(t)))*n-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=n,this.E*=Math.pow(W(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=n=r=1),C||T?(C?(u=Math.asin(Math.sin(S)/n),T||(g=S)):(u=g,S=Math.asin(n*Math.sin(u))),this.lam0=_-Math.asin(.5*(r-1/r)*Math.tan(u))/this.B):(s=Math.pow(W(this.e,b,Math.sin(b)),this.B),o=Math.pow(W(this.e,w,Math.sin(w)),this.B),r=this.E/s,l=(o-s)/(o+s),h=((h=this.E*this.E)-o*s)/(h+o*s),(t=v-E)<-Math.pi?E-=x:t>Math.pi&&(E+=x),this.lam0=$(.5*(v+E)-Math.atan(h*Math.tan(.5*this.B*(v-E))/l)/this.B),u=Math.atan(2*Math.sin(this.B*$(v-this.lam0))/(r-1/r)),g=S=Math.asin(n*Math.sin(u))),this.singam=Math.sin(u),this.cosgam=Math.cos(u),this.sinrot=Math.sin(g),this.cosrot=Math.cos(g),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(n*n-1)/Math.cos(S))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*u,this.v_pole_n=this.ArB*Math.log(Math.tan(y-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(y+r))},forward:function(t){var e,i,n,r,s,o,a,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-c)>p){if(e=.5*((s=this.E/Math.pow(W(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/s)),i=.5*(s+o),r=Math.sin(this.B*t.x),n=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(n)-1)0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(h.x=a,h.y=l):(a-=this.u_0,h.x=l*this.cosrot+a*this.sinrot,h.y=a*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,n,r,s,o,a,l={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),r=.5*((n=Math.exp(-this.BrA*i))-1/n),s=.5*(n+1/n),a=((o=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/s,Math.abs(Math.abs(a)-1)p?this.ns=Math.log(n/a)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=n/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=p&&(i=X(i)*(c-2*p));var n,r,s=Math.abs(Math.abs(i)-c);if(s>p)n=W(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(n,this.ns);else{if((s=i*this.ns)<=0)return null;r=0}var o=this.ns*$(e-this.long0);return t.x=this.k0*(r*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(o))+this.y0,t},inverse:function(t){var e,i,n,r,s,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,n=Math.pow(e/(this.a*this.f0),i),-9999===(r=Y(this.e,n)))return null}else r=-c;return s=$(l/this.ns+this.long0),t.x=s,t.y=r,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};var Pe={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y,u=$(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),n=-u*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(n)),s=Math.asin(Math.cos(i)*Math.sin(n)/Math.cos(r)),o=this.n*s,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,n,r,s,o,a,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),s=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),n=2*(Math.atan(Math.pow(this.ro0/s,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(n)-Math.sin(this.ad)*Math.cos(n)*Math.cos(r)),i=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,o=e,a=0;var h=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,h+=1}while(0===a&&h<15);return h>=15?null:t},names:["Krovak","krovak"]};function Re(t,e,i,n,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-n*Math.sin(6*r)}function Ie(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Ae(t){return.375*t*(1+.25*t*(1+.46875*t))}function Le(t){return.05859375*t*t*(1+.75*t)}function Fe(t){return t*t*t*(35/3072)}function Oe(t,e,i){var n=e*i;return t/Math.sqrt(1-n*n)}function Ze(t){return Math.abs(t)1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}var Ge=.3333333333333333,ze=.17222222222222222,je=.10257936507936508,Ue=.06388888888888888,Be=.0664021164021164,qe=.016415012942191543;var Ve={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-c)0)switch(this.qp=Ne(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=t*Ge,e=t*t,i[0]+=e*ze,i[1]=e*Ue,e*=t,i[0]+=e*je,i[1]+=e*Be,i[2]=e*qe,i}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Ne(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,n,r,s,o,a,l,h,u,d=t.x,f=t.y;if(d=$(d-this.long0),this.sphere){if(s=Math.sin(f),u=Math.cos(f),n=Math.cos(d),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+u*n:1+this.sinph0*s+this.cosph0*u*n)<=p)return null;e=(i=Math.sqrt(2/i))*u*Math.sin(d),i*=this.mode===this.EQUIT?s:this.cosph0*s-this.sinph0*u*n}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(n=-n),Math.abs(f+this.lat0)=0?(e=(h=Math.sqrt(o))*r,i=n*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,n,r,s,o,a,l,h,u,d=t.x/this.a,f=t.y/this.a;if(this.sphere){var g,m=0,_=0;if((i=.5*(g=Math.sqrt(d*d+f*f)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(_=Math.sin(i),m=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(g)<=p?0:Math.asin(f*_/g),d*=_,f=m*g;break;case this.OBLIQ:i=Math.abs(g)<=p?this.lat0:Math.asin(m*this.sinph0+f*_*this.cosph0/g),d*=_*this.cosph0,f=(m-Math.sin(i)*this.sinph0)*g;break;case this.N_POLE:f=-f,i=c-i;break;case this.S_POLE:i-=c}e=0!==f||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(d,f):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(d/=this.dd,f*=this.dd,(o=Math.sqrt(d*d+f*f))1&&(t=t>1?1:-1),Math.asin(t)}var $e={init:function(){Math.abs(this.lat1+this.lat2)p?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var n=Ne(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*n)/this.ns0,s=this.ns0*$(e-this.long0),o=r*Math.sin(s)+this.x0,a=this.rh-r*Math.cos(s)+this.y0;return t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),n=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),n=-1),r=0,0!==e&&(r=Math.atan2(n*t.x,n*t.y)),n=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-n*n)/(2*this.ns0)):(i=(this.c-n*n)/this.ns0,o=this.phi1z(this.e3,i)),s=$(r/this.ns0+this.long0),t.x=s,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,n,r,s,o=Xe(.5*e);if(t0||Math.abs(s)<=p?(o=this.x0+1*this.a*i*Math.sin(n)/s,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/s):(o=this.x0+this.infinity_dist*i*Math.sin(n),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),i=Math.sin(r),o=Xe((n=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),s=Math.atan2(t.x*i,e*this.cos_p14*n-t.y*this.sin_p14*i),s=$(this.long0+s)):(o=this.phic0,s=0),t.x=s,t.y=o,t},names:["gnom"]};var Ye={init:function(){this.sphere||(this.k0=V(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,n=t.x,r=t.y,s=$(n-this.long0);if(this.sphere)e=this.x0+this.a*s*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var o=Ne(this.e,Math.sin(r));e=this.x0+this.a*this.k0*s,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=$(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*c:c;for(var n,r,s,o,a=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(a),s=Math.cos(a),o=t*r,a+=n=Math.pow(1-o*o,2)/(2*s)*(e/(1-t*t)-r/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),Math.abs(n)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=$(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t},names:["cea"]};var He={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,n=$(e-this.long0),r=Ze(i-this.lat0);return t.x=this.x0+this.a*n*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=$(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=Ze(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};var Ke={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=Ie(this.es),this.e1=Ae(this.es),this.e2=Le(this.es),this.e3=Fe(this.es),this.ml0=this.a*Re(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,n,r=t.x,s=t.y,o=$(r-this.long0);if(n=o*Math.sin(s),this.sphere)Math.abs(s)<=p?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(n)/Math.tan(s),i=this.a*(Ze(s-this.lat0)+(1-Math.cos(n))/Math.tan(s)));else if(Math.abs(s)<=p)e=this.a*o,i=-1*this.ml0;else{var a=Oe(this.a,this.e,Math.sin(s))/Math.tan(s);e=a*Math.sin(n),i=this.a*Re(this.e0,this.e1,this.e2,this.e3,s)-this.ml0+a*(1-Math.cos(n))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,n,r,s,o,a,l,h;if(n=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=p)e=$(n/this.a+this.long0),i=0;else{var u;for(o=this.lat0+r/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(l+=h=-1*(o*(l*(u=Math.tan(l))+1)-l-.5*(l*l+a)*u)/((l-o)/u-1),Math.abs(h)<=p){i=l;break}e=$(this.long0+Math.asin(n*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(r+this.ml0)<=p)i=0,e=$(this.long0+n/this.a);else{var c,d,f,g,m;for(o=(this.ml0+r)/this.a,a=n*n/this.a/this.a+o*o,l=o,s=20;s;--s)if(m=this.e*Math.sin(l),c=Math.sqrt(1-m*m)*Math.tan(l),d=this.a*Re(this.e0,this.e1,this.e2,this.e3,l),f=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(o*(c*(g=d/this.a)+1)-g-.5*c*(g*g+a))/(this.es*Math.sin(2*l)*(g*g+a-2*o*g)/(4*c)+(o-g)*(c*f-2/Math.sin(2*l))-f),Math.abs(h)<=p){i=l;break}c=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=$(this.long0+Math.asin(n*c/this.a)/Math.sin(i))}return t.x=e,t.y=i,t},names:["Polyconic","poly"]};var Je={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,n=t.y-this.lat0,r=i-this.long0,s=n/u*1e-5,o=r,a=1,l=0;for(e=1;e<=10;e++)a*=s,l+=this.A[e]*a;var h,c=l,d=o,f=1,g=0,p=0,m=0;for(e=1;e<=6;e++)h=g*c+f*d,f=f*c-g*d,g=h,p=p+this.B_re[e]*f-this.B_im[e]*g,m=m+this.B_im[e]*f+this.B_re[e]*g;return t.x=m*this.a+this.x0,t.y=p*this.a+this.y0,t},inverse:function(t){var e,i,n=t.x,r=t.y,s=n-this.x0,o=(r-this.y0)/this.a,a=s/this.a,l=1,h=0,c=0,d=0;for(e=1;e<=6;e++)i=h*o+l*a,l=l*o-h*a,h=i,c=c+this.C_re[e]*l-this.C_im[e]*h,d=d+this.C_im[e]*l+this.C_re[e]*h;for(var f=0;f.999999999999&&(i=.999999999999),e=Math.asin(i);var n=$(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));n<-Math.PI&&(n=-Math.PI),n>Math.PI&&(n=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=n,t.y=r,t},names:["Mollweide","moll"]};var ii={init:function(){Math.abs(this.lat1+this.lat2)=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var s=0;return 0!==i&&(s=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=$(this.long0+s/this.ns),n=Ze(this.g-i/this.a),t.x=r,t.y=n,t):(n=ke(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=$(this.long0+s/this.ns),t.x=r,t.y=n,t)},names:["Equidistant_Conic","eqdc"]};var ni={init:function(){this.R=this.a},forward:function(t){var e,i,n=t.x,r=t.y,s=$(n-this.long0);Math.abs(r)<=p&&(e=this.x0+this.R*s,i=this.y0);var o=Xe(2*Math.abs(r/Math.PI));(Math.abs(s)<=p||Math.abs(Math.abs(r)-c)<=p)&&(e=this.x0,i=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o));var a=.5*Math.abs(Math.PI/s-s/Math.PI),l=a*a,h=Math.sin(o),u=Math.cos(o),d=u/(h+u-1),f=d*d,g=d*(2/h-1),m=g*g,_=Math.PI*this.R*(a*(d-m)+Math.sqrt(l*(d-m)*(d-m)-(m+l)*(f-m)))/(m+l);s<0&&(_=-_),e=this.x0+_;var y=l+d;return _=Math.PI*this.R*(g*y-a*Math.sqrt((m+l)*(l+1)-y*y))/(m+l),i=r>=0?this.y0+_:this.y0-_,t.x=e,t.y=i,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,c,d;return t.x-=this.x0,t.y-=this.y0,c=Math.PI*this.R,s=(n=t.x/c)*n+(r=t.y/c)*r,c=3*(r*r/(l=-2*(o=-Math.abs(r)*(1+s))+1+2*r*r+s*s)+(2*(a=o-2*r*r+n*n)*a*a/l/l/l-9*o*a/l/l)/27)/(h=(o-a*a/3/l)/l)/(u=2*Math.sqrt(-h/3)),Math.abs(c)>1&&(c=c>=0?1:-1),d=Math.acos(c)/3,i=t.y>=0?(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI:-(-u*Math.cos(d+Math.PI/3)-a/3/l)*Math.PI,e=Math.abs(n)2*c*this.a)return;return i=e/this.a,n=Math.sin(i),r=Math.cos(i),s=this.long0,Math.abs(e)<=p?o=this.lat0:(o=Xe(r*this.sin_p12+t.y*n*this.cos_p12/e),a=Math.abs(this.lat0)-c,s=Math.abs(a)<=p?this.lat0>=0?$(this.long0+Math.atan2(t.x,-t.y)):$(this.long0-Math.atan2(-t.x,t.y)):$(this.long0+Math.atan2(t.x*n,e*this.cos_p12*r-t.y*this.sin_p12*n))),t.x=s,t.y=o,t}return l=Ie(this.es),h=Ae(this.es),u=Le(this.es),d=Fe(this.es),Math.abs(this.sin_p12-1)<=p?(o=ke(((f=this.a*Re(l,h,u,d,c))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,u,d),s=$(this.long0+Math.atan2(t.x,-1*t.y)),t.x=s,t.y=o,t):Math.abs(this.sin_p12+1)<=p?(f=this.a*Re(l,h,u,d,c),o=ke(((e=Math.sqrt(t.x*t.x+t.y*t.y))-f)/this.a,l,h,u,d),s=$(this.long0+Math.atan2(t.x,t.y)),t.x=s,t.y=o,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),_=Math.atan2(t.x,t.y),g=Oe(this.a,this.e,this.sin_p12),y=Math.cos(_),v=-(x=this.e*this.cos_p12*y)*x/(1-this.es),E=3*this.es*(1-v)*this.sin_p12*this.cos_p12*y/(1-this.es),S=1-v*(w=(b=e/g)-v*(1+v)*Math.pow(b,3)/6-E*(1+3*v)*Math.pow(b,4)/24)*w/2-b*w*w*w/6,m=Math.asin(this.sin_p12*Math.cos(w)+this.cos_p12*Math.sin(w)*y),s=$(this.long0+Math.asin(Math.sin(_)*Math.sin(w)/Math.cos(m))),C=Math.sin(m),o=Math.atan2((C-this.es*S*this.sin_p12)*Math.tan(m),C*(1-this.es)),t.x=s,t.y=o,t)},names:["Azimuthal_Equidistant","aeqd"]};var si={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,i,n,r,s,o,a,l=t.x,h=t.y;return n=$(l-this.long0),e=Math.sin(h),i=Math.cos(h),r=Math.cos(n),1,((s=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(s)<=p)&&(o=1*this.a*i*Math.sin(n),a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=o,t.y=a,t},inverse:function(t){var e,i,n,r,s,o,a;return t.x-=this.x0,t.y-=this.y0,i=Xe((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),n=Math.sin(i),r=Math.cos(i),o=this.long0,Math.abs(e)<=p?(a=this.lat0,t.x=o,t.y=a,t):(a=Xe(r*this.sin_p14+t.y*n*this.cos_p14/e),s=Math.abs(this.lat0)-c,Math.abs(s)<=p?(o=this.lat0>=0?$(this.long0+Math.atan2(t.x,-t.y)):$(this.long0-Math.atan2(-t.x,t.y)),t.x=o,t.y=a,t):(o=$(this.long0+Math.atan2(t.x*n,e*this.cos_p14*r-t.y*this.sin_p14*n)),t.x=o,t.y=a,t))},names:["ortho"]},oi=1,ai=2,li=3,hi=4,ui=5,ci=6,di={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function fi(t,e,i,n){var r;return ty&&r<=c+y?(n.value=di.AREA_1,r-=c):r>c+y||r<=-(c+y)?(n.value=di.AREA_2,r=r>=0?r-v:r+v):(n.value=di.AREA_3,r+=c)),r}function gi(t,e){var i=t+e;return i<-v?i+=x:i>+v&&(i-=x),i}var pi={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=c-y/2?this.face=ui:this.lat0<=-(c-y/2)?this.face=ci:Math.abs(this.long0)<=y?this.face=oi:Math.abs(this.long0)<=c+y?this.face=this.long0>0?ai:hi:this.face=li,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,n,r,s,o,a={x:0,y:0},l={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===ui)r=c-e,i>=y&&i<=c+y?(l.value=di.AREA_0,n=i-c):i>c+y||i<=-(c+y)?(l.value=di.AREA_1,n=i>0?i-v:i+v):i>-(c+y)&&i<=-y?(l.value=di.AREA_2,n=i+c):(l.value=di.AREA_3,n=i);else if(this.face===ci)r=c+e,i>=y&&i<=c+y?(l.value=di.AREA_0,n=-i+c):i=-y?(l.value=di.AREA_1,n=-i):i<-y&&i>=-(c+y)?(l.value=di.AREA_2,n=-i-c):(l.value=di.AREA_3,n=i>0?-i+v:-i-v);else{var h,u,d,f,g,p;this.face===ai?i=gi(i,+c):this.face===li?i=gi(i,+v):this.face===hi&&(i=gi(i,-c)),f=Math.sin(e),g=Math.cos(e),p=Math.sin(i),h=g*Math.cos(i),u=g*p,d=f,this.face===oi?n=fi(r=Math.acos(h),d,u,l):this.face===ai?n=fi(r=Math.acos(u),d,-h,l):this.face===li?n=fi(r=Math.acos(-h),d,-u,l):this.face===hi?n=fi(r=Math.acos(-u),d,h,l):(r=n=0,l.value=di.AREA_0)}return o=Math.atan(12/v*(n+Math.acos(Math.sin(n)*Math.cos(y))-c)),s=Math.sqrt((1-Math.cos(r))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(n))))),l.value===di.AREA_1?o+=c:l.value===di.AREA_2?o+=v:l.value===di.AREA_3&&(o+=1.5*v),a.x=s*Math.cos(o),a.y=s*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t},inverse:function(t){var e,i,n,r,s,o,a,l,h,u,d,f,g={lam:0,phi:0},p={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?p.value=di.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(p.value=di.AREA_1,e-=c):t.x<0&&-t.x>=Math.abs(t.y)?(p.value=di.AREA_2,e=e<0?e+v:e-v):(p.value=di.AREA_3,e+=c),h=v/12*Math.tan(e),s=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),o=Math.atan(s),(a=1-(n=Math.cos(e))*n*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),this.face===ui)l=Math.acos(a),g.phi=c-l,p.value===di.AREA_0?g.lam=o+c:p.value===di.AREA_1?g.lam=o<0?o+v:o-v:p.value===di.AREA_2?g.lam=o-c:g.lam=o;else if(this.face===ci)l=Math.acos(a),g.phi=l-c,p.value===di.AREA_0?g.lam=-o+c:p.value===di.AREA_1?g.lam=-o:p.value===di.AREA_2?g.lam=-o-c:g.lam=o<0?-o-v:-o+v;else{var m,_,y;h=(m=a)*m,_=(h+=(y=h>=1?0:Math.sqrt(1-h)*Math.sin(o))*y)>=1?0:Math.sqrt(1-h),p.value===di.AREA_1?(h=_,_=-y,y=h):p.value===di.AREA_2?(_=-_,y=-y):p.value===di.AREA_3&&(h=_,_=y,y=-h),this.face===ai?(h=m,m=-_,_=h):this.face===li?(m=-m,_=-_):this.face===hi&&(h=m,m=_,_=-h),g.phi=Math.acos(-y)-c,g.lam=Math.atan2(_,m),this.face===ai?g.lam=gi(g.lam,-c):this.face===li?g.lam=gi(g.lam,-v):this.face===hi&&(g.lam=gi(g.lam,+c))}return 0!==this.es&&(u=g.phi<0?1:0,d=Math.tan(g.phi),f=this.b/Math.sqrt(d*d+this.one_minus_f_squared),g.phi=Math.atan(Math.sqrt(this.a*this.a-f*f)/(this.one_minus_f*f)),u&&(g.phi=-g.phi)),g.lam+=this.long0,t.x=g.lam,t.y=g.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]},mi=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],_i=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],yi=.8487,xi=1.3523,vi=_/5,Ei=1/vi,bi=18,wi=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};var Si={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=$(t.x-this.long0),i=Math.abs(t.y),n=Math.floor(i*vi);n<0?n=0:n>=bi&&(n=17);var r={x:wi(mi[n],i=_*(i-Ei*n))*e,y:wi(_i[n],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*yi+this.x0,r.y=r.y*this.a*xi+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*yi),y:Math.abs(t.y-this.y0)/(this.a*xi)};if(e.y>=1)e.x/=mi[18][0],e.y=t.y<0?-c:c;else{var i=Math.floor(e.y*bi);for(i<0?i=0:i>=bi&&(i=17);;)if(_i[i][0]>e.y)--i;else{if(!(_i[i+1][0]<=e.y))break;++i}var n=_i[i],r=5*(e.y-n[0])/(_i[i+1][0]-n[0]);r=function(t,e,i,n){for(var r=e;n;--n){var s=t(r);if(r-=s,Math.abs(s)1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")},forward:function(t){var e,i,n,r,s=t.x,o=t.y;if(s-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/ge(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(s)*Math.cos(o),n=a*Math.sin(s)*Math.cos(o),r=a*Math.sin(o),(this.radius_g-i)*i-n*n-r*r*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/ge(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/ge(n,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(s)*e,n=Math.sin(s)*e,r=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(n/ge(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(n/e),t.y=this.radius_g_1*Math.atan(r/ge(n,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,n,r,s=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*ge(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*ge(1,o));var l=a/this.radius_p;if(e=o*o+l*l+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+s*s,(n=(i=2*this.radius_g*s)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(n))/(2*e),s=this.radius_g+r*s,o*=r,a*=r,t.x=Math.atan2(o,s),t.y=Math.atan(a*Math.cos(t.x)/s)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};Rt.defaultDatum="WGS84",Rt.Proj=gt,Rt.WGS84=new Rt.Proj("WGS84"),Rt.Point=Yt,Rt.toPoint=wt,Rt.defs=z,Rt.nadgrid=function(t,e){var i=new DataView(e),n=function(t){var e=t.getInt32(8,!1);if(11===e)return!1;e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian");return!0}(i),r=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:ht(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(i,n),s=function(t,e,i){for(var n=176,r=[],s=0;sr;){if(s-r>600){var a=s-r+1,l=n-r+1,h=Math.log(a),u=.5*Math.exp(2*h/3),c=.5*Math.sqrt(h*u*(a-u)/a)*(l-a/2<0?-1:1);t(i,n,Math.max(r,Math.floor(n-l*u/a+c)),Math.min(s,Math.floor(n+(a-l)*u/a+c)),o)}var d=i[n],f=r,g=s;for(e(i,r,n),o(i[s],d)>0&&e(i,r,s);f0;)g--}0===o(i[r],d)?e(i,r,g):e(i,++g,s),g<=n&&(r=g+1),n<=g&&(s=g-1)}}(t,n,r||0,s||t.length-1,o||i)}function e(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function i(t,e){return te?1:0}var n=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function r(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n=t.minX&&e.maxY>=t.minY}function g(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function p(e,i,n,r,s){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=r)){var a=i+Math.ceil((n-i)/r/2)*r;t(e,a,i,n,s),o.push(i,a,a,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!f(t,e))return i;for(var n=this.toBBox,r=[];e;){for(var s=0;s=0&&r[e].children.length>this._maxEntries;)this._split(r,e),e--;this._adjustParentBBoxes(n,r,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,r=this._minEntries;this._chooseSplitAxis(i,r,n);var o=this._chooseSplitIndex(i,r,n),a=g(i.children.splice(o,i.children.length-o));a.height=i.height,a.leaf=i.leaf,s(i,this.toBBox),s(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(i,a)},n.prototype._splitRoot=function(t,e){this.data=g([t,e]),this.data.height=t.height+1,this.data.leaf=!1,s(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,r,s,a,l,h,c,d=1/0,f=1/0,g=e;g<=i-e;g++){var p=o(t,0,g,this.toBBox),m=o(t,g,i,this.toBBox),_=(r=p,s=m,a=void 0,l=void 0,h=void 0,c=void 0,a=Math.max(r.minX,s.minX),l=Math.max(r.minY,s.minY),h=Math.min(r.maxX,s.maxX),c=Math.min(r.maxY,s.maxY),Math.max(0,h-a)*Math.max(0,c-l)),y=u(p)+u(m);_=e;f--){var g=t.children[f];a(l,t.leaf?r(g):g),h+=c(l)}return h},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)a(e[n],t)},n.prototype._condense=function(t){for(var e=t.length-1,i=void 0;e>=0;e--)0===t[e].children.length?e>0?(i=t[e-1].children).splice(i.indexOf(t[e]),1):this.clear():s(t[e],this.toBBox)},n}()},56069:function(t,e,i){const n=i(54990);t.exports=function(t,e,i){const r=i&&i.debug||!1,s=i&&i.startIndex||0;r&&console.log("starting findTagByName with",e," and ",i);const o=n(t,`<${e}[ >]`,s);if(r&&console.log("start:",o),-1===o)return;const a=t.slice(o+e.length);let l=n(a,"[ /]"+e+">",0);const h=-1===l;h&&(l=n(a,"[ /]>",0));const u=o+e.length+l+1+(h?0:e.length)+1;if(r&&console.log("end:",u),-1===u)return;const c=t.slice(o,u);let d;return d=h?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:d,outer:c,start:o,end:u}}},83299:function(t,e,i){const n=i(56069);t.exports=function(t,e,i){const r=[],s=i&&i.debug||!1;let o,a=i&&i.startIndex||0;for(;o=n(t,e,{debug:s,startIndex:a});)a=o.end,r.push(o);return s&&console.log("findTagsByName found",r.length,"tags"),r}},42135:function(t){t.exports=function(t,e,i){const n=i&&i.debug||!1;n&&console.log("getting "+e+" in "+t);const r="object"==typeof t?t.outer:t,s=`${e}\\="([^"]*)"`;n&&console.log("pattern:",s);const o=new RegExp(s).exec(r);if(n&&console.log("match:",o),o)return o[1]}},54990:function(t){t.exports=function(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index:-1}},47760:function(){},13090:function(){},19439:function(){},81275:function(t,e,i){"use strict";function n(){const t='const e="GENERATE_POLYGON_BUFFERS",t="GENERATE_POINT_BUFFERS",n="GENERATE_LINE_STRING_BUFFERS";function r(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function x(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new Error(t)}(0!==n,"Transformation matrix cannot be inverted");const x=t[0],i=t[1],u=t[2],o=t[3],f=t[4],s=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-u/n,e[3]=x/n,e[4]=(u*s-o*f)/n,e[5]=-(x*s-i*f)/n,e}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}new Array(6);var u={exports:{}};function o(e,t,n){n=n||2;var r,x,i,u,o,s,l,v=t&&t.length,h=v?t[0]*n:e.length,c=f(e,0,h,n,!0),g=[];if(!c||c.next===c.prev)return g;if(v&&(c=function(e,t,n,r){var x,i,u,o=[];for(x=0,i=t.length;x80*n){r=i=e[0],x=u=e[1];for(var b=n;bi&&(i=o),s>u&&(u=s);l=0!==(l=Math.max(i-r,u-x))?32767/l:0}return a(c,g,n,r,x,l,0),g}function f(e,t,n,r,x){var i,u;if(x===O(e,t,n,r)>0)for(i=t;i=t;i-=r)u=P(i,e[i],e[i+1],u);return u&&m(u,u.next)&&(B(u),u=u.next),u}function s(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!m(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(B(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,x,i,u){if(e){!u&&i&&function(e,t,n,r){var x=e;do{0===x.z&&(x.z=b(x.x,x.y,t,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==e);x.prevZ.nextZ=null,x.prevZ=null,function(e){var t,n,r,x,i,u,o,f,s=1;do{for(n=e,e=null,i=null,u=0;n;){for(u++,r=n,o=0,t=0;t0||f>0&&r;)0!==o&&(0===f||!r||n.z<=r.z)?(x=n,n=n.nextZ,o--):(x=r,r=r.nextZ,f--),i?i.nextZ=x:e=x,x.prevZ=i,i=x;n=r}i.nextZ=null,s*=2}while(u>1)}(x)}(e,r,x,i);for(var o,f,p=e;e.prev!==e.next;)if(o=e.prev,f=e.next,i?v(e,r,x,i):l(e))t.push(o.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),B(e),e=f.next,p=f.next;else if((e=f)===p){u?1===u?a(e=h(s(e),t,n),t,n,r,x,i,2):2===u&&c(e,t,n,r,x,i):a(s(e),t,n,r,x,i,1);break}}}function l(e){var t=e.prev,n=e,r=e.next;if(w(t,n,r)>=0)return!1;for(var x=t.x,i=n.x,u=r.x,o=t.y,f=n.y,s=r.y,a=xi?x>u?x:u:i>u?i:u,h=o>f?o>s?o:s:f>s?f:s,c=r.next;c!==t;){if(c.x>=a&&c.x<=v&&c.y>=l&&c.y<=h&&M(x,o,i,f,u,s,c.x,c.y)&&w(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function v(e,t,n,r){var x=e.prev,i=e,u=e.next;if(w(x,i,u)>=0)return!1;for(var o=x.x,f=i.x,s=u.x,a=x.y,l=i.y,v=u.y,h=of?o>s?o:s:f>s?f:s,y=a>l?a>v?a:v:l>v?l:v,g=b(h,c,t,n,r),d=b(p,y,t,n,r),Z=e.prevZ,m=e.nextZ;Z&&Z.z>=g&&m&&m.z<=d;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;Z&&Z.z>=g;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;m&&m.z<=d;){if(m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function h(e,t,n){var r=e;do{var x=r.prev,i=r.next.next;!m(x,i)&&A(x,r,r.next,i)&&z(x,i)&&z(i,x)&&(t.push(x.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),B(r),B(r.next),r=e=i),r=r.next}while(r!==e);return s(r)}function c(e,t,n,r,x,i){var u=e;do{for(var o=u.next.next;o!==u.prev;){if(u.i!==o.i&&Z(u,o)){var f=F(u,o);return u=s(u,u.next),f=s(f,f.next),a(u,t,n,r,x,i,0),void a(f,t,n,r,x,i,0)}o=o.next}u=u.next}while(u!==e)}function p(e,t){return e.x-t.x}function y(e,t){var n=function(e,t){var n,r=t,x=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=x&&o>u&&(u=o,n=r.x=r.x&&r.x>=a&&x!==r.x&&M(in.x||r.x===n.x&&g(n,r)))&&(n=r,v=f)),r=r.next}while(r!==s);return n}(e,t);if(!n)return t;var r=F(n,e);return s(r,r.next),s(n,n.next)}function g(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}function b(e,t,n,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=(e-u)*(i-o)&&(e-u)*(r-o)>=(n-u)*(t-o)&&(n-u)*(i-o)>=(x-u)*(r-o)}function Z(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&A(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(t,e)&&function(e,t){var n=e,r=!1,x=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&x<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||m(e,t)&&w(e.prev,e,e.next)>0&&w(t.prev,t,t.next)>0)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function A(e,t,n,r){var x=I(w(e,t,n)),i=I(w(e,t,r)),u=I(w(n,r,e)),o=I(w(n,r,t));return x!==i&&u!==o||(!(0!==x||!E(e,n,t))||(!(0!==i||!E(e,r,t))||(!(0!==u||!E(n,e,r))||!(0!==o||!E(n,t,r)))))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function z(e,t){return w(e.prev,e,e.next)<0?w(e,t,e.next)>=0&&w(e,e.prev,t)>=0:w(e,t,e.prev)<0||w(e,e.next,t)<0}function F(e,t){var n=new _(e.i,e.x,e.y),r=new _(t.i,t.x,t.y),x=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=x,x.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function P(e,t,n,r){var x=new _(e,t,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,t,n,r){for(var x=0,i=t,u=n-r;i0&&(r+=e[x-1].length,n.holes.push(r))}return n};var N=i(u.exports);const R=[],S={vertexPosition:0,indexPosition:0};function T(e,t,n,r,x){e[t+0]=n,e[t+1]=r,e[t+2]=x}function U(e,t,n,r,x,i){const u=3+x,o=e[t+0],f=e[t+1],s=R;s.length=x;for(let n=0;n0?f:2*Math.PI-f}let d=-1,M=-1,Z=l;const w=null!==i;if(null!==x){d=b(y,g,r(s,[...[e[x],e[x+1]]])),Math.cos(d)<=.985&&(Z+=Math.tan((d-Math.PI)/2))}if(w){M=b(g,y,r(s,[...[e[i],e[i+1]]])),Math.cos(M)<=.985&&(Z+=Math.tan((Math.PI-M)/2))}function m(e,t){return 0===t?1e4*e:Math.sign(t)*(1e4*e+Math.abs(t))}return u.push(c[0],c[1],p[0],p[1],d,M,a,m(0,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(1,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(2,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(3,l)),u.push(...f),o.push(h,h+1,h+2,h+1,h+3,h+2),{length:a+Math.sqrt((g[0]-y[0])*(g[0]-y[0])+(g[1]-y[1])*(g[1]-y[1])),angle:Z}}function G(e,t,n,r,x){const i=2+x;let u=t;const o=e.slice(u,u+x);u+=x;const f=e[u++];let s=0;const a=new Array(f-1);for(let t=0;t{const i=r.data;switch(i.type){case t:{const e=3,t=2,n=i.customAttributesSize,r=t+n,x=new Float32Array(i.renderInstructions),u=x.length/r,o=4*u*(n+e),f=new Uint32Array(6*u),s=new Float32Array(o);let a;for(let e=0;e0?c=o+(n-1)*r:l&&(c=i-r);let p=null;n255?255:t}function U(t){return t<0?0:t>1?1:t}function B(t){return"%"===t[t.length-1]?j(parseFloat(t)/100*255):j(parseInt(t))}function q(t){return"%"===t[t.length-1]?U(parseFloat(t)/100):U(parseFloat(t))}function V(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{G={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in z)return z[i].slice();if("#"===i[0])return 4===i.length?(e=parseInt(i.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===i.length&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),r=i.indexOf(")");if(-1!==n&&r+1===i.length){var s=i.substr(0,n),o=i.substr(n+1,r-(n+1)).split(","),a=1;switch(s){case"rgba":if(4!==o.length)return null;a=q(o.pop());case"rgb":return 3!==o.length?null:[B(o[0]),B(o[1]),B(o[2]),a];case"hsla":if(4!==o.length)return null;a=q(o.pop());case"hsl":if(3!==o.length)return null;var l=(parseFloat(o[0])%360+360)%360/360,h=q(o[1]),u=q(o[2]),c=u<=.5?u*(h+1):u+h-u*h,d=2*u-c;return[j(255*V(d,c,l+1/3)),j(255*V(d,c,l)),j(255*V(d,c,l-1/3)),a];default:return null}}return null}}catch(t){}class X{constructor(t,e,i,n=1){this.r=t,this.g=e,this.b=i,this.a=n}static parse(t){if(!t)return;if(t instanceof X)return t;if("string"!=typeof t)return;const e=G(t);return e?new X(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3]):void 0}toString(){const[t,e,i,n]=this.toArray();return`rgba(${Math.round(t)},${Math.round(e)},${Math.round(i)},${n})`}toArray(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[255*t/n,255*e/n,255*i/n,n]}toArray01(){const{r:t,g:e,b:i,a:n}=this;return 0===n?[0,0,0,0]:[t/n,e/n,i/n,n]}toArray01PremultipliedAlpha(){const{r:t,g:e,b:i,a:n}=this;return[t,e,i,n]}}X.black=new X(0,0,0,1),X.white=new X(1,1,1,1),X.transparent=new X(0,0,0,0),X.red=new X(1,0,0,1),X.blue=new X(0,0,1,1);var $=X;function W(t){return"object"==typeof t?["literal",t]:t}function Y(t,e){let i=t.stops;if(!i)return function(t,e){const i=["get",t.property];if(void 0===t.default)return"string"===e.type?["string",i]:i;if("enum"===e.type)return["match",i,Object.keys(e.values),i,t.default];{const n=["color"===e.type?"to-color":e.type,i,W(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}}(t,e);const n=i&&"object"==typeof i[0][0],r=n||void 0!==t.property,s=n||!r;return i=i.map((t=>!r&&e.tokens&&"string"==typeof t[1]?[t[0],it(t[1])]:[t[0],W(t[1])])),n?function(t,e,i){const n={},r={},s=[];for(let e=0;e3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function et(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function it(t){const e=["concat"],i=/{([^{}]+)}/g;let n=0;for(let r=i.exec(t);null!==r;r=i.exec(t)){const s=t.slice(n,i.lastIndex-r[0].length);n=i.lastIndex,s.length>0&&e.push(s),e.push(["get",r[1]])}if(1===e.length)return t;if(n`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const xt=[at,lt,ht,ut,ct,pt,dt,_t(ft),mt];function vt(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!vt(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(const t of xt)if(!vt(t,e))return null}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function Et(t,e){return e.some((e=>e.kind===t.kind))}function bt(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}class wt{constructor(t,e,i){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=i,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class St{constructor(t,e,i,n,r){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=r}}class Ct{constructor(t){this.sections=t}static fromString(t){return new Ct([new St(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||t.image&&0!==t.image.name.length))}static factory(t){return t instanceof Ct?t:Ct.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){t.push(["image",e.image.name]);continue}t.push(e.text);const i={};e.fontStack&&(i["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(i["font-scale"]=e.scale),e.textColor&&(i["text-color"]=["rgba"].concat(e.textColor.toArray())),t.push(i)}return t}}class Tt{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Tt({name:t,available:!1}):null}serialize(){return["image",this.name]}}function Mt(t,e,i,n){if(!("number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255)){return`Invalid rgba value [${("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}return void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`}function Pt(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 $)return!0;if(t instanceof wt)return!0;if(t instanceof Ct)return!0;if(t instanceof Tt)return!0;if(Array.isArray(t)){for(const e of t)if(!Pt(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Pt(t[e]))return!1;return!0}return!1}function Rt(t){if(null===t)return at;if("string"==typeof t)return ht;if("boolean"==typeof t)return ut;if("number"==typeof t)return lt;if(t instanceof $)return ct;if(t instanceof wt)return gt;if(t instanceof Ct)return pt;if(t instanceof Tt)return mt;if(Array.isArray(t)){const e=t.length;let i;for(const e of t){const t=Rt(e);if(i){if(i===t)continue;i=ft;break}i=t}return _t(i||ft,e)}return dt}function It(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof $||t instanceof Ct||t instanceof Tt?t.toString():JSON.stringify(t)}class At{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Pt(t[1]))return e.error("invalid value");const i=t[1];let n=Rt(i);const r=e.expectedType;return"array"!==n.kind||0!==n.N||!r||"array"!==r.kind||"number"==typeof r.N&&0!==r.N||(n=r),new At(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof $?["rgba"].concat(this.value.toArray()):this.value instanceof Ct?this.value.serialize():this.value}}var Lt=At;var Ft=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}};const Ot={string:ht,number:lt,boolean:ut,object:dt};class Zt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let i,n=1;const r=t[0];if("array"===r){let r,s;if(t.length>2){const i=t[1];if("string"!=typeof i||!(i in Ot)||"object"===i)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=Ot[i],n++}else r=ft;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);s=t[2],n++}i=_t(r,s)}else i=Ot[r];const s=[];for(;nt.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}var kt=Zt;class Dt{constructor(t){this.type=pt,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");const n=[];let r=!1;for(let i=1;i<=t.length-1;++i){const s=t[i];if(r&&"object"==typeof s&&!Array.isArray(s)){r=!1;let t=null;if(s["font-scale"]&&(t=e.parse(s["font-scale"],1,lt),!t))return null;let i=null;if(s["text-font"]&&(i=e.parse(s["text-font"],1,_t(ht)),!i))return null;let o=null;if(s["text-color"]&&(o=e.parse(s["text-color"],1,ct),!o))return null;const a=n[n.length-1];a.scale=t,a.font=i,a.textColor=o}else{const s=e.parse(t[i],1,ft);if(!s)return null;const o=s.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");r=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Dt(n)}evaluate(t){return new Ct(this.sections.map((e=>{const i=e.content.evaluate(t);return Rt(i)===mt?new St("",i,null,null,null):new St(It(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const i={};e.scale&&(i["font-scale"]=e.scale.serialize()),e.font&&(i["text-font"]=e.font.serialize()),e.textColor&&(i["text-color"]=e.textColor.serialize()),t.push(i)}return t}}class Nt{constructor(t){this.type=mt,this.input=t}static parse(t,e){if(2!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,ht);return i?new Nt(i):e.error("No image name provided.")}evaluate(t){const e=this.input.evaluate(t),i=Tt.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){return["image",this.input.serialize()]}}const Gt={"to-boolean":ut,"to-color":ct,"to-number":lt,"to-string":ht};class zt{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");const n=Gt[i],r=[];for(let i=1;i4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Mt(e[0],e[1],e[2],e[3]),!i))return new $(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new Ft(i||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const i of this.args){if(e=i.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new Ft(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Ct.fromString(It(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?Tt.fromString(It(this.args[0].evaluate(t))):It(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Dt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Nt(this.args[0]).serialize();const t=[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}var jt=zt;const Ut=["Unknown","Point","LineString","Polygon"];var Bt=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?Ut[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:i,y:n}=this.featureTileCoord,r=i*e-t[0],s=n*e-t[1];return this.featureDistanceData.bearing[0]*r+this.featureDistanceData.bearing[1]*s}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=$.parse(t)),e}};class qt{constructor(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const i=t[0],n=qt.definitions[i];if(!n)return e.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);const r=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1));let a=null;for(const[n,s]of o){a=new ye(e.registry,e.path,null,e.scope);const o=[];let l=!1;for(let e=1;e{return e=t,Array.isArray(e)?`(${e.map(yt).join(", ")})`:`(${yt(e.type)}...)`;var e})).join(" | "),n=[];for(let i=1;i=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function Ht(t,e){const i=(180+t[0])/360;const n=(r=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360);var r;const s=Math.pow(2,e.z);return[Math.round(i*s*$t),Math.round(n*s*$t)]}function Kt(t,e,i){const n=t[0]-e[0],r=t[1]-e[1],s=t[0]-i[0],o=t[1]-i[1];return n*o-s*r==0&&n*s<=0&&r*o<=0}function Jt(t,e){let i=!1;for(let o=0,a=e.length;on[1]!=s[1]>n[1]&&n[0]<(s[0]-r[0])*(n[1]-r[1])/(s[1]-r[1])+r[0]&&(i=!i)}}var n,r,s;return i}function Qt(t,e){for(let i=0;i0&&c<0||u<0&&c>0}function ee(t,e,i,n){const r=[e[0]-t[0],e[1]-t[1]],s=[n[0]-i[0],n[1]-i[1]];return 0!=(o=s)[0]*(a=r)[1]-o[1]*a[0]&&!(!te(t,e,i,n)||!te(i,n,t,e));var o,a}function ie(t,e,i){for(const n of i)for(let i=0;ii[2]){const e=.5*n;let r=t[0]-i[0]>e?-n:i[0]-t[0]>e?n:0;0===r&&(r=t[0]-i[2]>e?-n:i[2]-t[0]>e?n:0),t[0]+=r}Wt(e,t)}function le(t,e,i,n){const r=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],o=[];if(!t)return o;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];ae(n,e,i,r),o.push(n)}return o}function he(t,e,i,n){const r=Math.pow(2,n.z)*$t,s=[n.x*$t,n.y*$t],o=[];if(!t)return o;for(const i of t){const t=[];for(const n of i){const i=[n.x+s[0],n.y+s[1]];Wt(e,i),t.push(i)}o.push(t)}if(e[2]-e[0]<=r/2){(a=e)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const t of o)for(const n of t)ae(n,e,i,r)}var a;return o}class ue{constructor(t,e){this.type=ut,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Pt(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t{e&&!de(t)&&(e=!1)})),e}function fe(t){if(t instanceof Vt&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!fe(t)&&(e=!1)})),e}function ge(t,e){if(t instanceof Vt&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild((t=>{i&&!ge(t,e)&&(i=!1)})),i}class pe{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const i=t[1];return e.scope.has(i)?new pe(i,e.scope.get(i)):e.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}var me=pe;class _e{constructor(t,e=[],i,n=new ot,r=[]){this.registry=t,this.path=e,this.key=e.map((t=>`[${t}]`)).join(""),this.scope=n,this.errors=r,this.expectedType=i}parse(t,e,i,n,r={}){return e?this.concat(e,i,n)._parse(t,r):this._parse(t,r)}_parse(t,e){function i(t,e,i){return"assert"===i?new kt(e,[t]):"coerce"===i?new jt(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", []].');const 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;const r=this.registry[n];if(r){let n=r.parse(t,this);if(!n)return null;if(this.expectedType){const t=this.expectedType,r=n.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==r.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==r.kind&&"string"!==r.kind){if(this.checkSubtype(t,r))return null}else n=i(n,t,e.typeAnnotation||"coerce");else n=i(n,t,e.typeAnnotation||"assert")}if(!(n instanceof Lt)&&"resolvedImage"!==n.type.kind&&xe(n)){const t=new Bt;try{n=new Lt(n.type,n.evaluate(t))}catch(t){return this.error(t.message),null}}return n}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===t?this.error("'undefined' value invalid. Use null instead."):"object"==typeof t?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,e,i){const n="number"==typeof t?this.path.concat(t):this.path,r=i?this.scope.concat(i):this.scope;return new _e(this.registry,n,e||null,r,this.errors)}error(t,...e){const i=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new rt(i,t))}checkSubtype(t,e){const i=vt(t,e);return i&&this.error(i),i}}var ye=_e;function xe(t){if(t instanceof me)return xe(t.boundExpression);if(t instanceof Vt&&"error"===t.name)return!1;if(t instanceof Xt)return!1;if(t instanceof ce)return!1;const e=t instanceof jt||t instanceof kt;let i=!0;return t.eachChild((t=>{i=e?i&&xe(t):i&&t instanceof Lt})),!!i&&(de(t)&&ge(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function ve(t,e){const i=t.length-1;let n,r,s=0,o=i,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=t[a],r=t[a+1],n<=e){if(a===i||ee))throw new Ft("Input is not a number.");o=a-1}return 0}class Ee{constructor(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static parse(t,e){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.");const i=e.parse(t[1],1,lt);if(!i)return null;const n=[];let r=null;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(let i=1;i=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const h=e.parse(o,l,r);if(!h)return null;r=r||h.type,n.push([s,h])}return new Ee(r,i,n)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);return i[ve(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}var be=Ee,we=Se;function Se(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=i,this.p2y=n}Se.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},Se.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},Se.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},Se.prototype.solveCurveX=function(t,e){var i,n,r,s,o;for(void 0===e&&(e=1e-6),r=t,o=0;o<8;o++){if(s=this.sampleCurveX(r)-t,Math.abs(s)(n=1))return n;for(;is?i=r:n=r,r=.5*(n-i)+i}return r},Se.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var Ce=N(we);function Te(t,e,i){return t*(1-i)+e*i}var Me=Object.freeze({__proto__:null,number:Te,color:function(t,e,i){return new $(Te(t.r,e.r,i),Te(t.g,e.g,i),Te(t.b,e.b,i),Te(t.a,e.a,i))},array:function(t,e,i){return t.map(((t,n)=>Te(t,e[n],i)))}});const Pe=.95047,Re=1,Ie=1.08883,Ae=4/29,Le=6/29,Fe=3*Le*Le,Oe=Le*Le*Le,Ze=Math.PI/180,ke=180/Math.PI;function De(t){return t>Oe?Math.pow(t,1/3):t/Fe+Ae}function Ne(t){return t>Le?t*t*t:Fe*(t-Ae)}function Ge(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ze(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function je(t){const e=ze(t.r),i=ze(t.g),n=ze(t.b),r=De((.4124564*e+.3575761*i+.1804375*n)/Pe),s=De((.2126729*e+.7151522*i+.072175*n)/Re);return{l:116*s-16,a:500*(r-s),b:200*(s-De((.0193339*e+.119192*i+.9503041*n)/Ie)),alpha:t.a}}function Ue(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=Re*Ne(e),i=Pe*Ne(i),n=Ie*Ne(n),new $(Ge(3.2404542*i-1.5371385*e-.4985314*n),Ge(-.969266*i+1.8760108*e+.041556*n),Ge(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Be(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const qe={forward:je,reverse:Ue,interpolate:function(t,e,i){return{l:Te(t.l,e.l,i),a:Te(t.a,e.a,i),b:Te(t.b,e.b,i),alpha:Te(t.alpha,e.alpha,i)}}},Ve={forward:function(t){const{l:e,a:i,b:n}=je(t),r=Math.atan2(n,i)*ke;return{h:r<0?r+360:r,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Ze,i=t.c;return Ue({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Be(t.h,e.h,i),c:Te(t.c,e.c,i),l:Te(t.l,e.l,i),alpha:Te(t.alpha,e.alpha,i)}}};class Xe{constructor(t,e,i,n,r){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,i,n){let r=0;if("exponential"===t.name)r=$e(e,t.base,i,n);else if("linear"===t.name)r=$e(e,1,i,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;r=new Ce(s[0],s[1],s[2],s[3]).solve($e(e,1,i,n))}return r}static parse(t,e){let[i,n,r,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}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(r=e.parse(r,2,lt),!r)return null;const o=[];let a=null;"interpolate-hcl"===i||"interpolate-lab"===i?a=ct:e.expectedType&&"value"!==e.expectedType.kind&&(a=e.expectedType);for(let t=0;t=i)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',r);const h=e.parse(n,l,a);if(!h)return null;a=a||h.type,o.push([i,h])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new Xe(a,i,n,r,o):e.error(`Type ${yt(a)} is not interpolatable.`)}evaluate(t){const e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);const r=e.length;if(n>=e[r-1])return i[r-1].evaluate(t);const s=ve(e,n),o=e[s],a=e[s+1],l=Xe.interpolationFactor(this.interpolation,n,o,a),h=i[s].evaluate(t),u=i[s+1].evaluate(t);return"interpolate"===this.operator?Me[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?Ve.reverse(Ve.interpolate(Ve.forward(h),Ve.forward(u),l)):qe.reverse(qe.interpolate(qe.forward(h),qe.forward(u),l))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier"].concat(this.interpolation.controlPoints);const e=[this.operator,t,this.input.serialize()];for(let t=0;tvt(n,t.type)));return new Ye(s?ft:i,r)}evaluate(t){let e,i=null,n=0;for(const r of this.args){if(n++,i=r.evaluate(t),i&&i instanceof Tt&&!i.available&&(e||(e=i),i=null,n===this.args.length))return e;if(null!==i)break}return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var He=Ye;class Ke{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const i=[];for(let n=1;n=i.length)throw new Ft(`Array index out of bounds: ${e} > ${i.length-1}.`);if(e!==Math.floor(e))throw new Ft(`Array index must be an integer, but found ${e} instead.`);return i[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}var ti=Qe;class ei{constructor(t,e){this.type=ut,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,ft);return i&&n?Et(i.type,[ut,ht,lt,at,ft])?new ei(i,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!bt(e,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(Rt(e))} instead.`);if(!bt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${yt(Rt(i))} instead.`);return i.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}var ii=ei;class ni{constructor(t,e,i){this.type=lt,this.needle=t,this.haystack=e,this.fromIndex=i}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,ft);if(!i||!n)return null;if(!Et(i.type,[ut,ht,lt,at,ft]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,lt);return r?new ni(i,n,r):null}return new ni(i,n)}evaluate(t){const e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!bt(e,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(Rt(e))} instead.`);if(!bt(i,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${yt(Rt(i))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}var ri=ni;class si{constructor(t,e,i,n,r,s){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=r,this.otherwise=s}static parse(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.");let i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const r={},s=[];for(let o=2;oNumber.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return h.error("Numeric branch labels must be integer values.");if(i){if(h.checkSubtype(i,Rt(t)))return null}else i=Rt(t);if(void 0!==r[String(t)])return h.error("Branch labels must be unique.");r[String(t)]=s.length}const u=e.parse(l,o,n);if(!u)return null;n=n||u.type,s.push(u)}const o=e.parse(t[1],1,ft);if(!o)return null;const a=e.parse(t[t.length-1],t.length-1,n);return a?"value"!==o.type.kind&&e.concat(1).checkSubtype(i,o.type)?null:new si(i,n,o,r,s,a):null}evaluate(t){const e=this.input.evaluate(t);return(Rt(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),i=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=i.length,i.push([this.cases[t],[t]])):i[e][1].push(t)}const r=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of i)1===n.length?t.push(r(n[0])):t.push(n.map(r)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}var oi=si;class ai{constructor(t,e,i){this.type=t,this.branches=e,this.otherwise=i}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);const n=[];for(let r=1;re.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}var li=ai;class hi{constructor(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const i=e.parse(t[1],1,ft),n=e.parse(t[2],2,lt);if(!i||!n)return null;if(!Et(i.type,[_t(ft),ht,ft]))return e.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(4===t.length){const r=e.parse(t[3],3,lt);return r?new hi(i.type,i,n,r):null}return new hi(i.type,i,n)}evaluate(t){const e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!bt(e,["string","array"]))throw new Ft(`Expected first argument to be of type array or string, but found ${yt(Rt(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}var ui=hi;function ci(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function di(t,e,i,n){return 0===n.compare(e,i)}function fi(t,e,i){const n="=="!==t&&"!="!==t;return class r{constructor(t,e,i){this.type=ut,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const i=t[0];let s=e.parse(t[1],1,ft);if(!s)return null;if(!ci(i,s.type))return e.concat(1).error(`"${i}" comparisons are not supported for type '${yt(s.type)}'.`);let o=e.parse(t[2],2,ft);if(!o)return null;if(!ci(i,o.type))return e.concat(2).error(`"${i}" comparisons are not supported for type '${yt(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error(`Cannot compare types '${yt(s.type)}' and '${yt(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new kt(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new kt(s.type,[o])));let a=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(a=e.parse(t[3],3,gt),!a)return null}return new r(s,o,a)}evaluate(r){const s=this.lhs.evaluate(r),o=this.rhs.evaluate(r);if(n&&this.hasUntypedArgument){const e=Rt(s),i=Rt(o);if(e.kind!==i.kind||"string"!==e.kind&&"number"!==e.kind)throw new Ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${i.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=Rt(s),i=Rt(o);if("string"!==t.kind||"string"!==i.kind)return e(r,s,o)}return this.collator?i(r,s,o,this.collator.evaluate(r)):e(r,s,o)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const gi=fi("==",(function(t,e,i){return e===i}),di),pi=fi("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!di(0,e,i,n)})),mi=fi("<",(function(t,e,i){return e",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),yi=fi("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),xi=fi(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0}));class vi{constructor(t,e,i,n,r,s){this.type=ht,this.number=t,this.locale=e,this.currency=i,this.unit=n,this.minFractionDigits=r,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const i=e.parse(t[1],1,lt);if(!i)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let r=null;if(n.locale&&(r=e.parse(n.locale,1,ht),!r))return null;let s=null;if(n.currency&&(s=e.parse(n.currency,1,ht),!s))return null;let o=null;if(n.unit&&(o=e.parse(n.unit,1,ht),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=e.parse(n["min-fraction-digits"],1,lt),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parse(n["max-fraction-digits"],1,lt),!l)?null:new vi(i,r,s,o,a,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.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))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.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]}}class Ei{constructor(t){this.type=lt,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const i=e.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?e.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Ei(i):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new Ft(`Expected value to be of type string or array, but found ${yt(Rt(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}const bi={"==":gi,"!=":pi,">":_i,"<":mi,">=":xi,"<=":yi,array:kt,at:ti,boolean:kt,case:li,coalesce:He,collator:Xt,format:Dt,image:Nt,in:ii,"index-of":ri,interpolate:We,"interpolate-hcl":We,"interpolate-lab":We,length:Ei,let:Je,literal:Lt,match:oi,number:kt,"number-format":vi,object:kt,slice:ui,step:be,string:kt,"to-boolean":jt,"to-color":jt,"to-number":jt,"to-string":jt,var:me,within:ce};function wi(t,[e,i,n,r]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const s=r?r.evaluate(t):1,o=Mt(e,i,n,s);if(o)throw new Ft(o);return new $(e/255*s,i/255*s,n/255*s,s)}function Si(t,e){return t in e}function Ci(t,e){const i=e[t];return void 0===i?null:i}function Ti(t){return{type:t}}Vt.register(bi,{error:[{kind:"error"},[ht],(t,[e])=>{throw new Ft(e.evaluate(t))}],typeof:[ht,[ft],(t,[e])=>yt(Rt(e.evaluate(t)))],"to-rgba":[_t(lt,4),[ct],(t,[e])=>e.evaluate(t).toArray()],rgb:[ct,[lt,lt,lt],wi],rgba:[ct,[lt,lt,lt,lt],wi],has:{type:ut,overloads:[[[ht],(t,[e])=>Si(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Si(e.evaluate(t),i.evaluate(t))]]},get:{type:ft,overloads:[[[ht],(t,[e])=>Ci(e.evaluate(t),t.properties())],[[ht,dt],(t,[e,i])=>Ci(e.evaluate(t),i.evaluate(t))]]},"feature-state":[ft,[ht],(t,[e])=>Ci(e.evaluate(t),t.featureState||{})],properties:[dt,[],t=>t.properties()],"geometry-type":[ht,[],t=>t.geometryType()],id:[ft,[],t=>t.id()],zoom:[lt,[],t=>t.globals.zoom],pitch:[lt,[],t=>t.globals.pitch||0],"distance-from-center":[lt,[],t=>t.distanceFromCenter()],"heatmap-density":[lt,[],t=>t.globals.heatmapDensity||0],"line-progress":[lt,[],t=>t.globals.lineProgress||0],"sky-radial-progress":[lt,[],t=>t.globals.skyRadialProgress||0],accumulated:[ft,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[lt,Ti(lt),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[lt,Ti(lt),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:lt,overloads:[[[lt,lt],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[lt],(t,[e])=>-e.evaluate(t)]]},"/":[lt,[lt,lt],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[lt,[lt,lt],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[lt,[],()=>Math.LN2],pi:[lt,[],()=>Math.PI],e:[lt,[],()=>Math.E],"^":[lt,[lt,lt],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[lt,[lt],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))],log2:[lt,[lt],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[lt,[lt],(t,[e])=>Math.sin(e.evaluate(t))],cos:[lt,[lt],(t,[e])=>Math.cos(e.evaluate(t))],tan:[lt,[lt],(t,[e])=>Math.tan(e.evaluate(t))],asin:[lt,[lt],(t,[e])=>Math.asin(e.evaluate(t))],acos:[lt,[lt],(t,[e])=>Math.acos(e.evaluate(t))],atan:[lt,[lt],(t,[e])=>Math.atan(e.evaluate(t))],min:[lt,Ti(lt),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[lt,Ti(lt),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[lt,[lt],(t,[e])=>Math.abs(e.evaluate(t))],round:[lt,[lt],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[lt,[lt],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[lt,[lt],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ut,[ht,ft],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[ut,[ft],(t,[e])=>t.id()===e.value],"filter-type-==":[ut,[ht],(t,[e])=>t.geometryType()===e.value],"filter-<":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n{const i=t.id(),n=e.value;return typeof i==typeof n&&i":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>r}],"filter-id->":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n<=r}],"filter-id-<=":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[ut,[ht,ft],(t,[e,i])=>{const n=t.properties()[e.value],r=i.value;return typeof n==typeof r&&n>=r}],"filter-id->=":[ut,[ft],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[ut,[ft],(t,[e])=>e.value in t.properties()],"filter-has-id":[ut,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[ut,[_t(ht)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ut,[_t(ft)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ut,[ht,_t(ft)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ut,[ht,_t(ft)],(t,[e,i])=>function(t,e,i,n){for(;i<=n;){const r=i+n>>1;if(e[r]===t)return!0;e[r]>t?n=r-1:i=r+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[Ti(ut),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:ut,overloads:[[[ut,ut],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[Ti(ut),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[ut,[ut],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ut,[ht],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[ht,[ht],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[ht,[ht],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[ht,Ti(ft),(t,e)=>e.map((e=>It(e.evaluate(t)))).join("")],"resolved-locale":[ht,[gt],(t,[e])=>e.evaluate(t).resolvedLocale()]});var Mi=bi;function Pi(t){return{result:"success",value:t}}function Ri(t){return{result:"error",value:t}}function Ii(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}class Ai{constructor(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Bt,this._defaultValue=e?function(t){return"color"===t.type&&(Ii(t.default)||Array.isArray(t.default))?new $(0,0,0,0):"color"===t.type?$.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null}evaluateWithoutErrorHandling(t,e,i,n,r,s,o,a){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,i,n,r,s,o,a){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=r||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new Ft(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}}}function Li(t,e){const i=new ye(Mi,[],e?function(t){const e={color:ct,string:ht,number:lt,enum:ht,boolean:ut,formatted:pt,resolvedImage:mt};if("array"===t.type)return _t(e[t.value]||ft,t.length);return e[t.type]}(e):void 0),n=i.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return n?Pi(new Ai(n,e)):Ri(i.errors)}class Fi{constructor(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!fe(e.expression)}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}}class Oi{constructor(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!fe(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,i,n,r,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,r,s)}evaluate(t,e,i,n,r,s){return this._styleExpression.evaluate(t,e,i,n,r,s)}interpolationFactor(t,e,i){return this.interpolationType?We.interpolationFactor(this.interpolationType,t,e,i):0}}function Zi(t,e){if("error"===(t=Li(t,e)).result)return t;const i=t.value.expression,n=de(i);if(!n&&!function(t){return"data-driven"===t["property-type"]}(e))return Ri([new rt("","data expressions not supported")]);const r=ge(i,["zoom","pitch","distance-from-center"]);if(!r&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Ri([new rt("","zoom expressions not supported")]);const s=ki(i);if(!s&&!r)return Ri([new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof rt)return Ri([s]);if(s instanceof We&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Ri([new rt("",'"interpolate" expressions cannot be used with this property')]);if(!s)return Pi(new Fi(n?"constant":"source",t.value));const o=s instanceof We?s.interpolation:void 0;return Pi(new Oi(n?"camera":"composite",t.value,s.labels,o))}function ki(t){let e=null;if(t instanceof Je)e=ki(t.result);else if(t instanceof He){for(const i of t.args)if(e=ki(i),e)break}else(t instanceof be||t instanceof We)&&t.input instanceof Vt&&"zoom"===t.input.name&&(e=t);return e instanceof rt||t.eachChild((t=>{const i=ki(t);i instanceof rt?e=i:!e&&i?e=new rt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new rt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function Di(t){if(Array.isArray(t))return t.map(Di);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=Di(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}var Ni={$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"},terrain:{type:"terrain"},fog:{type:"fog"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},projection:{type:"projection"},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:{},sky:{}},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_sky"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_sky:{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"},"fill-extrusion-edge-radius":{type:"number",private:!0,default:0,minimum:0,maximum:1,"property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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",{"symbol-placement":["point"]}],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","feature"]},"property-type":"data-driven"},"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"],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_symbol:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature","pitch","distance-from-center"]}},filter_fill:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_line:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_circle:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},"filter_fill-extrusion":{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},filter_heatmap:{type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}},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},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},in:{group:"Lookup"},"index-of":{group:"Lookup"},slice:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},"interpolate-hcl":{group:"Ramps, scales, curves"},"interpolate-lab":{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},collator:{group:"Types"},format:{group:"Types"},image:{group:"Types"},"number-format":{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"feature-state":{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Camera"},pitch:{group:"Camera"},"distance-from-center":{group:"Camera"},"heatmap-density":{group:"Heatmap"},"line-progress":{group:"Feature data"},"sky-radial-progress":{group:"sky"},accumulated:{group:"Feature data"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},round:{group:"Math"},abs:{group:"Math"},ceil:{group:"Math"},floor:{group:"Math"},distance:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},within:{group:"Decision"},"is-supported-script":{group:"String"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"},"resolved-locale":{group:"String"}}},fog:{range:{type:"array",default:[.5,10],minimum:-20,maximum:20,length:2,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},"high-color":{type:"color","property-type":"data-constant",default:"#245cdf",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"space-color":{type:"color","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-blend":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],4,.2,7,.1],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"star-intensity":{type:"number","property-type":"data-constant",default:["interpolate",["linear"],["zoom"],5,.35,6,0],minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},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}},projection:{name:{type:"enum",values:{albers:{},equalEarth:{},equirectangular:{},lambertConformalConic:{},mercator:{},naturalEarth:{},winkelTripel:{},globe:{}},default:"mercator",required:!0},center:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-180,-90],maximum:[180,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]},parallels:{type:"array",length:2,value:"number","property-type":"data-constant",minimum:[-90,-90],maximum:[90,90],transition:!1,requires:[{name:["albers","lambertConformalConic"]}]}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number","property-type":"data-constant",default:1,minimum:0,maximum:1e3,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["source"]}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background","paint_sky"],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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"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"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant",type:"number",private:!0,default:0,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant",type:"number",private:!0,default:3,minimum:0,expression:{interpolated:!0,parameters:["zoom"]},transition:!0,requires:["fill-extrusion-edge-radius"]}},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:!1,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{type:"resolvedImage",transition:!1,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{type:"array",value:"number",length:2,default:[0,0],minimum:[0,0],maximum:[1,1],transition:!1,requires:[{source:"geojson",has:{lineMetrics:!0}}],"property-type":"constant"}},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:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_sky:{"sky-type":{type:"enum",values:{gradient:{},atmosphere:{}},default:"atmosphere",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{type:"array",value:"number",length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,requires:[{"sky-type":"atmosphere"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{type:"number",requires:[{"sky-type":"atmosphere"}],default:10,minimum:0,maximum:100,transition:!1,"property-type":"data-constant"},"sky-gradient-center":{type:"array",requires:[{"sky-type":"gradient"}],value:"number",default:[0,0],length:2,units:"degrees",minimum:[0,0],maximum:[360,180],transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{type:"number",requires:[{"sky-type":"gradient"}],default:90,minimum:0,maximum:180,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"sky-gradient":{type:"color",default:["interpolate",["linear"],["sky-radial-progress"],.8,"#87ceeb",1,"white"],transition:!1,requires:[{"sky-type":"gradient"}],expression:{interpolated:!0,parameters:["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-atmosphere-color":{type:"color",default:"white",transition:!1,requires:[{"sky-type":"atmosphere"}],"property-type":"data-constant"},"sky-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"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function Gi(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=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(const e of t.slice(1))if(!Gi(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function zi(t,e="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Gi(t)||(t=$i(t));const i=t;let n=!0;try{n=function(t){if(!Bi(t))return t;let e=Di(t);return Ui(e),e=ji(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}const r=Ni[`filter_${e}`],s=Li(n,r);let o=null;if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));o=(t,e,i)=>s.value.evaluate(t,e,{},i);let a=null,l=null;if(n!==i){const t=Li(i,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,i,n,r,s)=>t.value.evaluate(e,i,{},n,void 0,void 0,r,s),l=!de(t.value.expression)}return{filter:o,dynamicFilter:a||void 0,needGeometry:Xi(n),needFeature:!!l}}function ji(t){if(!Array.isArray(t))return t;const e=function(t){if(qi.has(t[0]))for(let e=1;eji(t)))}function Ui(t){let e=!1;const i=[];if("case"===t[0]){for(let n=1;n",">=","<","<=","to-boolean"]);function Vi(t,e){return te?1:0}function Xi(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(let e=1;e"===e||"<="===e||">="===e?Wi(t[1],t[2],e):"any"===e?(i=t.slice(1),["any"].concat(i.map($i))):"all"===e?["all"].concat(t.slice(1).map($i)):"none"===e?["all"].concat(t.slice(1).map($i).map(Ki)):"in"===e?Yi(t[1],t.slice(2)):"!in"===e?Ki(Yi(t[1],t.slice(2))):"has"===e?Hi(t[1]):"!has"===e?Ki(Hi(t[1])):"within"!==e||t}function Wi(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function Yi(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((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Vi)]]:["filter-in-small",t,["literal",e]]}}function Hi(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}var Ji=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Qi(t,e){const i={};for(const e in t)"ref"!==e&&(i[e]=t[e]);return Ji.forEach((t=>{t in e&&(i[t]=e[t])})),i}function tn(t){t=t.slice();const e=Object.create(null);for(let i=0;i1?h[h.length-2].toLowerCase():"";if(u==c||u==c.replace("-","")||d+"-"+u==c){r=en[c],h.pop(),d&&c.startsWith(d)&&h.pop();break}}"number"==typeof u&&(r=u);var f=h.join(nn).replace("Klokantech Noto Sans","Noto Sans");-1!==f.indexOf(nn)&&(f='"'+f+'"'),o.push(f)}n=sn[t]=[s,r,o]}return n[0]+nn+n[1]+nn+e+"px"+(i?"/"+i:"")+nn+n[2]}));const an="https://api.mapbox.com";function ln(t){const e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(9)}function hn(t,e){const i=ln(t);if(!i)return decodeURI(new URL(t,location.href).href);const n="styles/";if(0!==i.indexOf(n))throw new Error(`unexpected style url: ${t}`);const r=i.slice(7);return`${an}/styles/v1/${r}?&access_token=${e}`}function un(t,e,i,n){const r=new URL(t,n),s=ln(t);if(!s)return e?(r.searchParams.has(i)||r.searchParams.set(i,e),decodeURI(r.href)):decodeURI(r.href);if("mapbox.satellite"===s){return`https://api.mapbox.com/v4/${s}/{z}/{x}/{y}${window.devicePixelRatio>=1.5?"@2x":""}.webp?access_token=${e}`}return`https://{a-d}.tiles.mapbox.com/v4/${s}/{z}/{x}/{y}.vector.pbf?access_token=${e}`}const cn={},dn={};let fn=0;function gn(t){return t.id||(t.id=fn++),t.id}function pn(t,e){return gn(t)+"."+(0,p.sq)(e)}function mn(t){let e=cn[t.id];return e||(e={},cn[gn(t)]=e),e}function _n(t){let e=dn[t.id];return e||(e={},dn[gn(t)]=e),e}function yn(t){return t*Math.PI/180}const xn=function(){const t=[];for(let e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function vn(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);const i=document.createElement("canvas");return i.width=t,i.height=e,i}function En(t,e){let i=0;const n=e.length;for(;ir)).then((t=>(t instanceof Request||(t=new Request(t)),t.headers.get("Accept")||t.headers.set("Accept","application/json"),n&&(n.request=t),fetch(t).then((function(t){return delete bn[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete bn[e],Promise.reject(new Error("Error fetching source "+e))})))));return bn[e]=[r,s],s}function Sn(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return wn("Style",t=hn(t,e.accessToken),e);try{const e=JSON.parse(t);return Promise.resolve(e)}catch(t){return Promise.reject(t)}}const Cn={};function Tn(t,e,i={}){const n=[e,JSON.stringify(t)].toString();let r=Cn[n];if(!r||i.transformRequest){let s;i.transformRequest&&(s=(t,e)=>{const n=i.transformRequest&&i.transformRequest(e,"Tiles")||e;if(t instanceof f.Z)t.setLoader(((e,i,r)=>{(0,u.Vi)((()=>n)).then((i=>{fetch(i).then((t=>t.arrayBuffer())).then((i=>{const n=t.getFormat().readFeatures(i,{extent:e,featureProjection:r});t.setFeatures(n)})).catch((e=>t.setState(d.Z.ERROR)))}))}));else{const e=t.getImage();(0,u.Vi)((()=>n)).then((i=>{i instanceof Request?fetch(i).then((t=>t.blob())).then((t=>{const i=URL.createObjectURL(t);e.addEventListener("load",(()=>URL.revokeObjectURL(i))),e.addEventListener("error",(()=>URL.revokeObjectURL(i))),e.src=i})).catch((e=>t.setState(d.Z.ERROR))):e.src=i}))}});const o=t.url;if(o&&!t.tiles){const n=un(o,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(o.startsWith("mapbox://"))r=Promise.resolve({tileJson:Object.assign({},t,{url:void 0,tiles:(0,g.Gk)(n)}),tileLoadFunction:s});else{const t={};r=wn("Source",n,i,t).then((function(e){return e.tiles=e.tiles.map((function(n){return"tms"===e.scheme&&(n=n.replace("{y}","{-y}")),un(n,i.accessToken,i.accessTokenParam||"access_token",t.request.url)})),Promise.resolve({tileJson:e,tileLoadFunction:s})}))}}else t=Object.assign({},t,{tiles:t.tiles.map((function(n){return"tms"===t.scheme&&(n=n.replace("{y}","{-y}")),un(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href)}))}),r=Promise.resolve({tileJson:Object.assign({},t),tileLoadFunction:s});Cn[n]=r}return r}function Mn(t,e,i,n){const r=document.createElement("canvas"),s=[2*i*e.pixelRatio+e.width,2*i*e.pixelRatio+e.height];r.width=s[0],r.height=s[1];const o=r.getContext("2d");o.drawImage(t,e.x,e.y,e.width,e.height,i*e.pixelRatio,i*e.pixelRatio,e.width,e.height);const a=o.getImageData(0,0,s[0],s[1]);o.globalCompositeOperation="destination-over",o.fillStyle=`rgba(${255*n.r},${255*n.g},${255*n.b},${n.a})`;const l=a.data;for(let t=0,n=a.width;t0&&o.arc(t,r,i*e.pixelRatio,0,2*Math.PI)}return o.fill(),r}function Pn(t,e,i){const n=Math.max(0,Math.min(1,(i-t)/(e-t)));return n*n*(3-2*n)}function Rn(t,e,i){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(t,e.x,e.y,e.width,e.height,0,0,e.width,e.height);const s=r.getImageData(0,0,e.width,e.height),o=s.data;for(let t=0,e=s.width;t0?(o[r+0]=Math.round(255*i.r*l),o[r+1]=Math.round(255*i.g*l),o[r+2]=Math.round(255*i.b*l),o[r+3]=Math.round(255*l)):o[r+3]=0}return r.putImageData(s,0,0),n}const In=Array(256).join(" ");function An(t,e){if(e>=.05){let i="";const n=t.split("\n"),r=In.slice(0,Math.round(e/.1));for(let t=0,e=n.length;t0&&(i+="\n"),i+=n[t].split("").join(r);return i}return t}let Ln;function Fn(){return Ln||(Ln=vn(1,1).getContext("2d")),Ln}function On(t,e){return Fn().measureText(t).width+(t.length-1)*e}const Zn={};function kn(t,e,i,n){if(-1!==t.indexOf("\n")){const r=t.split("\n"),s=[];for(let t=0,o=r.length;t1){const t=Fn();t.font=e;const r=t.measureText("M").width*i;let a="";const l=[];for(let t=0,e=o.length;t1;++t){const i=l[t];if(On(i,n)<.35*r){const r=t>0?On(l[t-1],n):1/0,s=t.7*r&&On(s,n)<.6*r){const o=i.split(" "),a=o.pop();On(a,n)<.2*r&&(l[t]=o.join(" "),l[t+1]=a+" "+s),e-=1}}s=l.join("\n")}else s=t;s=An(s,n),Zn[r]=s}return s}const Dn=/font-family: ?([^;]*);/,Nn=/("|')/g;let Gn;function zn(t){if(!Gn){Gn={};const t=document.styleSheets;for(let e=0,i=t.length;e`${t.key}: ${t.message}`)).join(", "));return i.value},Xn={},$n={zoom:0};let Wn,Yn;function Hn(t,e,i,n,r,s,o){const a=t.id;s||(s={},console.warn("No functionCache provided to getValue()")),s[a]||(s[a]={});const l=s[a];if(!l[i]){let n=(t[e]||Xn)[i];const r=Ni[`${e}_${t.type}`][i];void 0===n&&(n=r.default);let s=(h=n,Array.isArray(h)&&h.length>0&&"string"==typeof h[0]&&h[0]in Mi);if(!s&&Ii(n)&&(n=Y(n,r),s=!0),s){const t=Vn(n,r);l[i]=t.evaluate.bind(t)}else"color"==r.type&&(n=$.parse(n)),l[i]=function(){return n}}var h;return $n.zoom=n,l[i]($n,r,o)}function Kn(t,e,i,n){if(!Hn(t,"layout","icon-allow-overlap",e,i,n))return"declutter";return Hn(t,"layout","icon-ignore-placement",e,i,n)?"none":"obstacle"}function Jn(t,e,i,n,r){return r||console.warn("No filterCache provided to evaluateFilter()"),t in r||(r[t]=zi(e).filter),$n.zoom=n,r[t]($n,i)}let Qn=!1;function tr(t,e){if(t){if(!Qn&&(0===t.a||0===e))return;const i=t.a;return e=void 0===e?1:e,0===i?"transparent":"rgba("+Math.round(255*t.r/i)+","+Math.round(255*t.g/i)+","+Math.round(255*t.b/i)+","+i*e+")"}return t}const er=/\{[^{}}]*\}/g;function ir(t,e){return t.replace(er,(function(t){return e[t.slice(1,-1)]||""}))}let nr=!1;const rr={};function sr(t,e,i,c=xn,d=void 0,f=void 0,g=void 0,p=void 0){if("string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");let m,_,y;if(rr[pn(e,t)]=Array.from(arguments),f)if("undefined"!=typeof Image){const e=new Image;let i;(0,u.Vi)((()=>f)).then((t=>{t instanceof Request?fetch(t).then((t=>t.blob())).then((t=>{i=URL.createObjectURL(t),e.src=i})).catch((()=>{})):(e.crossOrigin="anonymous",e.src=t,i&&URL.revokeObjectURL(i))})),e.onload=function(){m=e,_=[e.width,e.height],t.changed(),e.onload=null}}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){const t=self;t.postMessage({action:"loadImage",src:f}),t.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===f&&(m=t.data.image,_=[m.width,m.height])}))}const x=tn(e.layers),v={},E=[],b={},w={},S=mn(e),C=_n(e);let T;for(let t=0,n=x.length;t=Z.maxzoom)continue;const G=Z.filter;if(!G||Jn(k,G,A,T,C)){let c,f,E,C,k,G;F=Z;const z=v.index;if(3==I&&("fill"==Z.type||"fill-extrusion"==Z.type))if(f=Hn(Z,"paint",Z.type+"-opacity",T,A,S,L),Z.type+"-pattern"in N){const t=Hn(Z,"paint",Z.type+"-pattern",T,A,S,L);if(t){const e="string"==typeof t?ir(t,x):t.toString();if(m&&d&&d[e]){++O,G=R[O],G&&G.getFill()&&!G.getStroke()&&!G.getText()||(G=new l.ZP({fill:new r.Z}),R[O]=G),E=G.getFill(),G.setZIndex(z);const t=e+"."+f;let i=w[t];if(!i){const n=d[e],r=vn(n.width,n.height),s=r.getContext("2d");s.globalAlpha=f,s.drawImage(m,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i=s.createPattern(r,"repeat"),w[t]=i}E.setColor(i)}}}else c=tr(Hn(Z,"paint",Z.type+"-color",T,A,S,L),f),Z.type+"-outline-color"in N&&(k=tr(Hn(Z,"paint",Z.type+"-outline-color",T,A,S,L),f)),k||(k=c),(c||k)&&(++O,G=R[O],(!G||c&&!G.getFill()||!c&&G.getFill()||k&&!G.getStroke()||!k&&G.getStroke()||G.getText())&&(G=new l.ZP({fill:c?new r.Z:void 0,stroke:k?new a.Z:void 0}),R[O]=G),c&&(E=G.getFill(),E.setColor(c)),k&&(C=G.getStroke(),C.setColor(k),C.setWidth(.5)),G.setZIndex(z));if(1!=I&&"line"==Z.type){c=!("line-pattern"in N)&&"line-color"in N?tr(Hn(Z,"paint","line-color",T,A,S,L),Hn(Z,"paint","line-opacity",T,A,S,L)):void 0;const t=Hn(Z,"paint","line-width",T,A,S,L);c&&t>0&&(++O,G=R[O],G&&G.getStroke()&&!G.getFill()&&!G.getText()||(G=new l.ZP({stroke:new a.Z}),R[O]=G),C=G.getStroke(),C.setLineCap(Hn(Z,"layout","line-cap",T,A,S,L)),C.setLineJoin(Hn(Z,"layout","line-join",T,A,S,L)),C.setMiterLimit(Hn(Z,"layout","line-miter-limit",T,A,S,L)),C.setColor(c),C.setWidth(t),C.setLineDash(N["line-dasharray"]?Hn(Z,"paint","line-dasharray",T,A,S,L).map((function(e){return e*t})):null),G.setZIndex(z))}let j,U,B,q,V,X,$,W,Y,H=!1,K=null,J=0;if((1==I||2==I)&&"icon-image"in D){const e=Hn(Z,"layout","icon-image",T,A,S,L);if(e){let n;j="string"==typeof e?ir(e,x):e.toString();const r=p?p(t,j):void 0;if(m&&d&&d[j]||r){const t=Hn(Z,"layout","icon-rotation-alignment",T,A,S,L);if(2==I){const e=i.getGeometry();if(e.getFlatMidpoint||e.getFlatMidpoints){const i=e.getExtent();if(Math.sqrt(Math.max(Math.pow((i[2]-i[0])/u,2),Math.pow((i[3]-i[1])/u,2)))>150){const i="MultiLineString"===e.getType()?e.getFlatMidpoints():e.getFlatMidpoint();Yn||(Wn=[NaN,NaN],Yn=new o.ZP("Point",Wn,[],{},null)),n=Yn,Wn[0]=i[0],Wn[1]=i[1];if("line"===Hn(Z,"layout","symbol-placement",T,A,S,L)&&"map"===t){const t=e.getStride(),n=e.getFlatCoordinates();for(let e=0,r=n.length-t;e=l&&i[0]<=u&&i[1]>=h&&i[1]<=c){J=Math.atan2(s-a,o-r);break}}}}}}if(2!==I||n){const e=Hn(Z,"layout","icon-size",T,A,S,L),i=void 0!==N["icon-color"]?Hn(Z,"paint","icon-color",T,A,S,L):null;if(!i||0!==i.a){const n=Hn(Z,"paint","icon-halo-color",T,A,S,L),o=Hn(Z,"paint","icon-halo-width",T,A,S,L);let a=`${j}.${e}.${o}.${n}`;if(null!==i&&(a+=`.${i}`),U=b[a],!U){const l=Kn(Z,T,A,S);let h;"icon-offset"in D&&(h=Hn(Z,"layout","icon-offset",T,A,S,L).slice(0),h[1]*=-1);let u=i?[255*i.r,255*i.g,255*i.b,i.a]:void 0;if(r){const e={color:u,rotateWithView:"map"===t,displacement:h,declutterMode:l};"string"==typeof r?e.src=r:(e.img=r,e.imgSize=[r.width,r.height]),U=new s.Z(e)}else{const r=d[j];let a,c,f;o?r.sdf?(a=Mn(Rn(m,r,i),{x:0,y:0,width:r.width,height:r.height,pixelRatio:r.pixelRatio},o,n),u=void 0):a=Mn(m,r,o,n):(r.sdf?(y||(y=Rn(m,{x:0,y:0,width:_[0],height:_[1]},{r:1,g:1,b:1,a:1})),a=y):a=m,c=[r.width,r.height],f=[r.x,r.y]),U=new s.Z({color:u,img:a,imgSize:_,size:c,offset:f,rotateWithView:"map"===t,scale:e/r.pixelRatio,displacement:h,declutterMode:l})}b[a]=U}}U&&(++O,G=R[O],G&&G.getImage()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G),G.setGeometry(n),U.setRotation(J+yn(Hn(Z,"layout","icon-rotate",T,A,S,L))),U.setOpacity(Hn(Z,"paint","icon-opacity",T,A,S,L)),U.setAnchor(qn[Hn(Z,"layout","icon-anchor",T,A,S,L)]),G.setImage(U),K=G.getText(),G.setText(void 0),G.setZIndex(z),H=!0,B=!1)}else B=!0}}}if(1==I&&"circle"===Z.type){++O,G=R[O],G&&G.getImage()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G);const t="circle-radius"in N?Hn(Z,"paint","circle-radius",T,A,S,L):5,e=tr(Hn(Z,"paint","circle-stroke-color",T,A,S,L),Hn(Z,"paint","circle-stroke-opacity",T,A,S,L)),i=tr(Hn(Z,"paint","circle-color",T,A,S,L),Hn(Z,"paint","circle-opacity",T,A,S,L)),s=Hn(Z,"paint","circle-stroke-width",T,A,S,L),o=t+"."+e+"."+i+"."+s;U=b[o],U||(U=new n.Z({radius:t,stroke:e&&s>0?new a.Z({width:s,color:e}):void 0,fill:i?new r.Z({color:i}):void 0,declutterMode:"none"}),b[o]=U),G.setImage(U),K=G.getText(),G.setText(void 0),G.setGeometry(void 0),G.setZIndex(z),H=!0}if("text-field"in D){$=Math.round(Hn(Z,"layout","text-size",T,A,S,L));const t=Hn(Z,"layout","text-font",T,A,S,L);X=Hn(Z,"layout","text-line-height",T,A,S,L),V=on(g?g(t,e.metadata?e.metadata["ol:webfonts"]:void 0):t,$,X),V.includes("sans-serif")||(V+=",sans-serif"),W=Hn(Z,"layout","text-letter-spacing",T,A,S,L),Y=Hn(Z,"layout","text-max-width",T,A,S,L);const i=Hn(Z,"layout","text-field",T,A,S,L);q="object"==typeof i&&i.sections?1===i.sections.length?i.toString():i.sections.reduce(((e,i,n)=>{const r=i.fontStack?i.fontStack.split(","):t,s=on(g?g(r):r,$*(i.scale||1),X);let o=i.text;if("\n"===o)return e.push("\n",""),e;if(2!=I){o=kn(o,s,Y,W).split("\n");for(let t=0,i=o.length;t0&&e.push("\n",""),e.push(o[t],s);return e}e.push(An(o,W),s)}),[]):ir(i,x).trim(),f=Hn(Z,"paint","text-opacity",T,A,S,L)}if(q&&f&&!B){H||(++O,G=R[O],G&&G.getText()&&!G.getFill()&&!G.getStroke()||(G=new l.ZP,R[O]=G),G.setImage(void 0),G.setGeometry(void 0)),G.getText()||G.setText(K||new h.Z({padding:[2,2,2,2]})),K=G.getText();const t=D["text-transform"];"uppercase"==t?q=Array.isArray(q)?q.map(((t,e)=>e%2?t:t.toUpperCase())):q.toUpperCase():"lowercase"==t&&(q=Array.isArray(q)?q.map(((t,e)=>e%2?t:t.toLowerCase())):q.toLowerCase());const e=Array.isArray(q)?q:2==I?An(q,W):kn(q,V,Y,W);K.setText(e),K.setFont(V),K.setRotation(yn(Hn(Z,"layout","text-rotate",T,A,S,L)));const i=Hn(Z,"layout","text-anchor",T,A,S,L),n=H||1==I?"point":Hn(Z,"layout","symbol-placement",T,A,S,L);let r;if("line-center"===n?(K.setPlacement("line"),r="center"):K.setPlacement(n),"line"===n&&"function"==typeof K.setRepeat){const t=Hn(Z,"layout","symbol-spacing",T,A,S,L);K.setRepeat(2*t)}K.setOverflow("point"===n);let s=Hn(Z,"paint","text-halo-width",T,A,S,L);const o=Hn(Z,"layout","text-offset",T,A,S,L),a=Hn(Z,"paint","text-translate",T,A,S,L);let u=0,c=0;if("point"==n){r="center",-1!==i.indexOf("left")?(r="left",c=s):-1!==i.indexOf("right")&&(r="right",c=-s);const t=Hn(Z,"layout","text-rotation-alignment",T,A,S,L);K.setRotateWithView("map"==t)}else K.setMaxAngle(yn(Hn(Z,"layout","text-max-angle",T,A,S,L))*q.length/e.length),K.setRotateWithView(!1);K.setTextAlign(r);let d="middle";0==i.indexOf("bottom")?(d="bottom",u=-s-.5*(X-1)*$):0==i.indexOf("top")&&(d="top",u=s+.5*(X-1)*$),K.setTextBaseline(d);const g=Hn(Z,"layout","text-justify",T,A,S,L);K.setJustify("auto"===g?void 0:g),K.setOffsetX(o[0]*$+c+a[0]),K.setOffsetY(o[1]*$+u+a[1]),P.setColor(tr(Hn(Z,"paint","text-color",T,A,S,L),f)),K.setFill(P);const p=tr(Hn(Z,"paint","text-halo-color",T,A,S,L),f);if(p){M.setColor(p),s*=2;const t=.5*$;M.setWidth(s<=t?s:t),K.setStroke(M)}else K.setStroke(void 0);const m=Hn(Z,"layout","text-padding",T,A,S,L),_=K.getPadding();m!==_[0]&&(_[0]=m,_[1]=m,_[2]=m,_[3]=m),G.setZIndex(z)}}}return O>-1?(R.length=O+1,nr&&("set"in i?i.set("mapbox-layer",F):i.getProperties()["mapbox-layer"]=F),R):void 0};return t.setStyle(I),t.set("mapbox-source",T),t.set("mapbox-layers",E),t.set("mapbox-featurestate",t.get("mapbox-featurestate")||{}),I}function or(t,e){const i=t[0],n=i.width,r=i.height,s=i.data,o=new Uint8ClampedArray(s.length),a=2*e.resolution,l=n-1,h=r-1,u=[0,0,0,0],c=2*Math.PI,d=Math.PI/2,f=Math.PI*e.sunEl/180,g=Math.PI*e.sunAz/180,p=Math.cos(f),m=Math.sin(f),_=e.highlightColor,y=e.shadowColor,x=e.accentColor,v=e.encoding;let E,b,w,S,C,T,M,P,R,I,A,L,F,O,Z,k,D,N,G,z,j,U;function B(t,e="mapbox"){return"mapbox"===e?.1*(256*t[0]*256+256*t[1]+t[2])-1e4:"terrarium"===e?256*t[0]+t[1]+t[2]/256-32768:void 0}for(b=0;b<=h;++b)for(C=0===b?0:b-1,T=b===h?h:b+1,E=0;E<=l;++E)w=0===E?0:E-1,S=E===l?l:E+1,M=4*(b*n+w),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],P=e.vert*B(u,v),M=4*(b*n+S),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],R=e.vert*B(u,v),I=(R-P)/a,M=4*(C*n+E),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],P=e.vert*B(u,v),M=4*(T*n+E),u[0]=s[M],u[1]=s[M+1],u[2]=s[M+2],u[3]=s[M+3],R=e.vert*B(u,v),A=(R-P)/a,F=Math.atan2(A,-I),F=F<0?d-F:F>d?c-F+d:d-F,L=Math.atan(Math.sqrt(I*I+A*A)),U=m*Math.cos(L)+p*Math.sin(L)*Math.cos(g-F),O=Math.cos(L),Z=255*U,G=Math.min(Math.max(2*e.sunEl,0),1),z=1.875-1.75*e.opacity,j=.5!==e.opacity?d*((Math.pow(z,L)-1)/(Math.pow(z,d)-1)):L,D={r:(1-O)*x.r*G*255,g:(1-O)*x.g*G*255,b:(1-O)*x.b*G*255,a:(1-O)*x.a*G*255},k=Math.abs(((F+g)/Math.PI+.5)%2-1),N={r:(_.r*(1-k)+y.r*k)*Z,g:(_.g*(1-k)+y.g*k)*Z,b:(_.b*(1-k)+y.b*k)*Z,a:(_.a*(1-k)+y.a*k)*Z},M=4*(b*n+E),o[M]=D.r*(1-k)+N.r,o[M+1]=D.g*(1-k)+N.g,o[M+2]=D.b*(1-k)+N.b,o[M+3]=s[M+3]*e.opacity*G*Math.sin(j);return new ImageData(o,n,r)}function ar(t,e=512){return t.getExtent()?(0,O.dl)({extent:t.getExtent(),tileSize:e,maxZoom:22}).getResolutions():xn}function lr(t,e){if(!e.accessToken){e=Object.assign({},e);new URL(t).searchParams.forEach(((t,i)=>{e.accessToken=t,e.accessTokenParam=i}))}return e}function hr(t,e,i="",n={},r=void 0){let s,o,a,l,h=!0;return"string"==typeof i||Array.isArray(i)?l=i:(a=i,l=a.source||a.layers,n=a),"string"==typeof n?(s=n,a={}):(s=n.styleUrl,a=n),!1===a.updateSource&&(h=!1),r||(r=a.resolutions),s||"string"!=typeof e||e.trim().startsWith("{")||(s=e),s&&(s=s.startsWith("data:")?location.href:hn(s,a.accessToken),a=lr(s,a)),new Promise((function(i,n){Sn(e,a).then((function(e){if(8!=e.version)return n(new Error("glStyle version 8 required."));if(!(t instanceof M.Z||t instanceof R.Z))return n(new Error("Can only apply to VectorLayer or VectorTileLayer"));const u=t instanceof R.Z?"vector":"geojson";if(l?o=Array.isArray(l)?e.layers.find((function(t){return t.id===l[0]})).source:l:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===u})),l=o),!o)return n(new Error(`No ${u} source found in the glStyle.`));function c(){if(!h)return Promise.resolve();if(t instanceof R.Z)return mr(e.sources[o],s,a).then((function(e){const i=t.getSource();if(i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),"function"==typeof i.setUrls&&"function"==typeof e.getUrls&&i.setUrls(e.getUrls()),i.format_||(i.format_=e.format_),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===I.I&&i.setTileLoadFunction(e.getTileLoadFunction()),(0,L.OP)(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e),!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())){const e=t.getSource().getTileGrid();t.setMaxResolution(e.getResolution(e.getMinZoom()))}}));const i=e.sources[o];let n=t.getSource();n&&n.get("mapbox-source")===i||(n=vr(i,s,a));const r=t.getSource();return r?n!==r&&(r.getAttributions()||r.setAttributions(n.getAttributions()),r.format_||(r.format_=n.getFormat()),r.url_=n.getUrl()):t.setSource(n),Promise.resolve()}let d,f,g,p;function m(){if(p||e.sprite&&!f)p?(t.setStyle(p),c().then(i).catch(n)):n(new Error("Something went wrong trying to apply style."));else{if(a.projection&&!r){const t=(0,L.U2)(a.projection).getUnits();"m"!==t&&(r=xn.map((e=>e/L.Wm[t])))}p=sr(t,e,l,r,f,g,Un,a.getImage),t.getStyle()?c().then(i).catch(n):n(new Error(`Nothing to show for source [${o}]`))}}if(e.sprite){const t=new URL(function(t,e,i){const n=ln(t);if(!n)return decodeURI(new URL(t,i).href);const r="sprites/";if(0!==n.indexOf(r))throw new Error(`unexpected sprites url: ${t}`);const s=n.slice(8);return`${an}/styles/v1/${s}/sprite?access_token=${e}`}(e.sprite,a.accessToken,s||location.href));d=window.devicePixelRatio>=1.5?.5:1;const i=.5==d?"@2x":"";let r=t.origin+t.pathname+i+".json"+t.search;new Promise((function(e,i){wn("Sprite",r,a).then(e).catch((function(n){r=t.origin+t.pathname+".json"+t.search,wn("Sprite",r,a).then(e).catch(i)}))})).then((function(e){if(void 0===e&&n(new Error("No sprites found.")),f=e,g=t.origin+t.pathname+i+".png"+t.search,a.transformRequest){const t=a.transformRequest(g,"SpriteImage")||g;(t instanceof Request||t instanceof Promise)&&(g=t)}m()})).catch((function(t){n(new Error(`Sprites cannot be loaded: ${r}: ${t.message}`))}))}else m()})).catch(n)}))}const ur={};function cr(t,e,i={}){return Sn(e,i).then((function(e){!function(t,e,i){e.layers.some((function(e){if("background"===e.type){if(t instanceof y.Z)return t.setBackground((function(t){return gr(e,t,i,{})})),!0;if(t instanceof E.Z||t instanceof x.Z)return t.getLayers().push(pr(e,i,{})),!0}}))}(t,e,i)}))}function dr(t,e){let i;return t.some((function(t){if(t.id==e)return i=t.source,!0})),i}function fr(t,e,i){const n=new C.Z({tileJSON:e,tileSize:t.tileSize||e.tileSize||512}),r=n.getTileJSON(),s=n.getTileGrid(),o=(0,L.U2)(i.projection||"EPSG:3857"),a=function(t,e){const i=t.bounds;if(i){const t=(0,L.mi)([i[0],i[1]],e),n=(0,L.mi)([i[2],i[3]],e);return[t[0],t[1],n[0],n[1]]}return(0,L.U2)(e).getExtent()}(r,o),l=o.getExtent(),h=r.minzoom||0,u=r.maxzoom||22,c={attributions:n.getAttributions(),projection:o,tileGrid:new S.Z({origin:l?(0,Z.rL)(l):s.getOrigin(0),extent:a||s.getExtent(),minZoom:h,resolutions:ar(o,e.tileSize).slice(0,u+1),tileSize:s.getTileSize(0)})};return Array.isArray(r.tiles)?c.urls=r.tiles:c.url=r.tiles,c}function gr(t,e,i,n){const r={id:t.id,type:t.type},s=t.layout||{},o=t.paint||{};r.paint=o;const a=En(e,i.resolutions||xn);let l,h;return void 0!==o["background-color"]&&(l=Hn(r,"paint","background-color",a,ur,n)),void 0!==o["background-opacity"]&&(h=Hn(r,"paint","background-opacity",a,ur,n)),"none"==s.visibility?void 0:tr(l,h)}function pr(t,e,i){const n=document.createElement("div");return n.className="ol-mapbox-style-background",n.style.position="absolute",n.style.width="100%",n.style.height="100%",new y.Z({source:new w.Z({}),render(r){const s=gr(t,r.viewState.resolution,e,i);return n.style.backgroundColor=s,n}})}function mr(t,e,i){return new Promise((function(n,r){Tn(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=fr(t,e,i);s.tileLoadFunction=r,s.format=new v.Z,n(new I.Z(s))})).catch(r)}))}function _r(t){return`{bbox-${(t?t.getCode():"EPSG:3857").toLowerCase().replace(/[^a-z0-9]/g,"-")}}`}function yr(t,e,i){return new Promise((function(n,r){Tn(t,e,i).then((function({tileJson:e,tileLoadFunction:r}){const s=new C.Z({interpolate:void 0===i.interpolate||i.interpolate,transition:0,crossOrigin:"anonymous",tileJSON:e});s.tileGrid=fr(t,e,i).tileGrid,i.projection&&(s.projection=(0,L.U2)(i.projection));const o=s.getTileUrlFunction();r&&s.setTileLoadFunction(r),s.setTileUrlFunction((function(t,e,i){const n=_r(i);let r=o(t,e,i);if(-1!=r.indexOf(n)){const e=s.getTileGrid().getTileCoordExtent(t);r=r.replace(n,e.toString())}return r})),s.set("mapbox-source",t),n(s)})).catch((function(t){r(t)}))}))}function xr(t,e,i){const n=new T.Z;return yr(t,e,i).then((function(t){n.setSource(t)})).catch((function(){n.setSource(void 0)})),n}function vr(t,e,i){const n=i.projection?new m.Z({dataProjection:i.projection}):new m.Z,r=t.data,s={};if("string"==typeof r){const s=un(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(s)){const e=(t,e,i)=>{const n=_r(i);return s.replace(n,`${t.join(",")}`)},r=new P.Z({attributions:t.attribution,format:n,loader:(t,n,s,o,a)=>{wn("GeoJSON","function"==typeof e?e(t,n,s):e,i).then((t=>{const e=r.getFormat().readFeatures(t,{featureProjection:s});r.addFeatures(e),o(e)})).catch((e=>{r.removeLoadedExtent(t),a()}))},strategy:F.VW});return r.set("mapbox-source",t),r}const o=new P.Z({attributions:t.attribution,format:n,url:s,loader:(t,e,n,r,a)=>{wn("GeoJSON",s,i).then((t=>{const e=o.getFormat().readFeatures(t,{featureProjection:n});o.addFeatures(e),r(e)})).catch((e=>{o.removeLoadedExtent(t),a()}))}});return o}s.features=n.readFeatures(r,{featureProjection:(0,L.Cs)()||"EPSG:3857"});const o=new P.Z(Object.assign({attributions:t.attribution,format:n},s));return o.set("mapbox-source",t),o}function Er(t,e,i){let n=null;return function(r){t.paint&&"raster-opacity"in t.paint&&r.frameState.viewState.zoom!==n&&(n=r.frameState.viewState.zoom,delete i[t.id],function(t,e,i,n){const r=Hn(t,"paint","raster-opacity",i,ur,n);e.setOpacity(r)}(t,e,n,i))}}function br(t,e,i,n){const r=mn(t),s=t.layers,o=i.type,a=i.source||dr(s,i.ref),l=t.sources[a];let h;if("background"==o)h=pr(i,n,r);else if("vector"==l.type)h=function(t,e,i){const n=new R.Z({declutter:!0,visible:!1});return mr(t,e,i).then((function(e){e.set("mapbox-source",t),n.setSource(e)})).catch((function(t){n.setSource(void 0)})),n}(l,e,n);else if("raster"==l.type)h=xr(l,e,n),h.setVisible(!i.layout||"none"!==i.layout.visibility),h.on("prerender",Er(i,h,r));else if("geojson"==l.type)h=function(t,e,i){return new M.Z({declutter:!0,source:vr(t,e,i),visible:!1})}(l,e,n);else if("raster-dem"==l.type&&"hillshade"==i.type){const t=function(t,e,i){const n=xr(t,e,i);return new _.Z({source:new b.ZP({operationType:"image",operation:or,sources:[n]})})}(l,e,n);h=t,t.getSource().on("beforeoperations",(function(t){const e=t.data;e.resolution=t.resolution;const s=En(t.resolution,n.resolutions||xn);e.encoding=l.encoding,e.vert=5*Hn(i,"paint","hillshade-exaggeration",s,ur,r),e.sunAz=Hn(i,"paint","hillshade-illumination-direction",s,ur,r),e.sunEl=35,e.opacity=.3,e.highlightColor=Hn(i,"paint","hillshade-highlight-color",s,ur,r),e.shadowColor=Hn(i,"paint","hillshade-shadow-color",s,ur,r),e.accentColor=Hn(i,"paint","hillshade-accent-color",s,ur,r)})),h.setVisible(!i.layout||"none"!==i.layout.visibility)}const u=a;return h&&h.set("mapbox-source",u),h}function wr(t,e,i,n){const r=[];let s=null;if(e instanceof E.Z){if(s=e.getView(),!s.isDef()&&!s.getRotation()&&!s.getResolutions()){const t=n.projection?(0,L.U2)(n.projection):s.getProjection();s=new A.ZP(Object.assign(s.getProperties(),{maxResolution:xn[0]/L.Wm[t.getUnits()],projection:n.projection||s.getProjection()})),e.setView(s)}"center"in t&&!s.getCenter()&&s.setCenter((0,L.mi)(t.center,s.getProjection())),"zoom"in t&&void 0===s.getZoom()&&s.setResolution(xn[0]/L.Wm[s.getProjection().getUnits()]/Math.pow(2,t.zoom)),s.getCenter()&&void 0!==s.getZoom()||s.fit(s.getProjection().getExtent(),{nearest:!0,size:e.getSize()})}e.set("mapbox-style",t),e.set("mapbox-metadata",{styleUrl:i,options:n});const o=t.layers;let a,l,h,u=[];for(let s=0,c=o.length;s0||i>0)&&t.setMaxResolution(Math.min(xn[o],e.getResolution(i))+1e-9),a<24&&t.setMinResolution(xn[a]+1e-9)}}else o>0&&t.setMaxResolution(xn[o]+1e-9);u instanceof P.Z||u instanceof I.Z?hr(t,i,e,Object.assign({styleUrl:n},s)).then((function(){!function(t,e){function i(){const i=e.get("mapbox-style");if(!i)return;const n=tn(i.layers),r=t.get("mapbox-layers"),s=n.filter((function(t){return r.includes(t.id)})).some((function(t){return!t.layout||!t.layout.visibility||"visible"===t.layout.visibility}));t.get("visible")!==s&&t.setVisible(s)}t.on("change",i),i()}(t,r),l()})).catch(h):l()}else h(new Error("Error accessing data for source "+t.get("mapbox-source")))};t.set("mapbox-layers",e);const c=r.getLayers();-1===c.getArray().indexOf(t)&&c.push(t),t.getSource()?u():t.once("change:source",u)}))}class Tr extends k.ZP{constructor(t){super(D.Z.ERROR),this.error=t}}class Mr extends R.Z{constructor(t){const e=!("declutter"in t)||t.declutter,i=new I.Z({state:"loading",format:new v.Z});super({source:i,background:t.background,declutter:e,className:t.className,opacity:t.opacity,visible:t.visible,zIndex:t.zIndex,minResolution:t.minResolution,maxResolution:t.maxResolution,minZoom:t.minZoom,maxZoom:t.maxZoom,renderOrder:t.renderOrder,renderBuffer:t.renderBuffer,renderMode:t.renderMode,map:t.map,updateWhileAnimating:t.updateWhileAnimating,updateWhileInteracting:t.updateWhileInteracting,preload:t.preload,useInterimTilesOnError:t.useInterimTilesOnError,properties:t.properties}),t.accessToken&&(this.accessToken=t.accessToken);const n=[hr(this,t.styleUrl,t.layers||t.source,{accessToken:this.accessToken})];void 0===this.getBackground()&&n.push(cr(this,t.styleUrl,{accessToken:this.accessToken})),Promise.all(n).then((()=>{i.setState("ready")})).catch((t=>{this.dispatchEvent(new Tr(t));this.getSource().setState("error")}))}}},79638:function(t,e,i){"use strict";var n=i(38282),r=i(8651),s=i(6747);const o="length";class a extends s.ZP{constructor(t,e,i){super(t),this.element=e,this.index=i}}class l extends n.Z{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t||[],this.unique_)for(let t=0,e=this.array_.length;t0;)this.pop()}extend(t){for(let e=0,i=t.length;ethis.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new a(r.Z.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.unique_&&this.assertUnique_(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,n=e.length;i=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new a(r.Z.REMOVE,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new a(r.Z.REMOVE,i,t)),this.dispatchEvent(new a(r.Z.ADD,e,t))}updateLength_(){this.set(o,this.array_.length)}assertUnique_(t,e){for(let i=0,n=this.array_.length;ithis.loader(this.getExtent(),e,this.getPixelRatio()))).then((t=>{"image"in t&&(this.image_=t.image),"extent"in t&&(this.extent=t.extent),"resolution"in t&&(this.resolution=t.resolution),"pixelRatio"in t&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=s.Z.LOADED})).catch((t=>{this.state=s.Z.ERROR,console.error(t)})).finally((()=>this.changed()))}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function u(t,e,i){const n=t;let s=!0,l=!1,h=!1;const u=[(0,a.Vx)(n,r.Z.LOAD,(function(){h=!0,l||e()}))];return n.src&&o.Tp?(l=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(h?e():i())}))):u.push((0,a.Vx)(n,r.Z.ERROR,i)),function(){s=!1,u.forEach(a.bN)}}function c(t,e){return new Promise(((i,n)=>{function r(){o(),i(t)}function s(){o(),n(new Error("Image load error"))}function o(){t.removeEventListener("load",r),t.removeEventListener("error",s)}t.addEventListener("load",r),t.addEventListener("error",s),e&&(t.src=e)}))}function d(t,e){return e&&(t.src=e),t.src&&o.Tp?new Promise(((e,i)=>t.decode().then((()=>e(t))).catch((n=>t.complete&&t.width?e(t):i(n))))):c(t)}function f(t,e){return e&&(t.src=e),t.src&&o.Tp&&o.et?t.decode().then((()=>createImageBitmap(t))).catch((e=>{if(t.complete&&t.width)return t;throw e})):d(t)}e.ZP=h},13617:function(t,e,i){"use strict";var n=i(13701),r=i(57419);class s extends r.ZP{constructor(t,e,i,r,s){super(t,e,i,void 0!==s?n.Z.IDLE:n.Z.LOADED),this.loader_=void 0!==s?s:null,this.canvas_=r,this.error_=null}getError(){return this.error_}handleLoad_(t){t?(this.error_=t,this.state=n.Z.ERROR):this.state=n.Z.LOADED,this.changed()}load(){this.state==n.Z.IDLE&&(this.state=n.Z.LOADING,this.changed(),this.loader_(this.handleLoad_.bind(this)))}getImage(){return this.canvas_}}e.Z=s},13701:function(t,e){"use strict";e.Z={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},27859:function(t,e,i){"use strict";var n=i(69319),r=i(74251),s=i(850),o=i(57419);class a extends n.Z{constructor(t,e,i,n,r,s){super(t,e,s),this.crossOrigin_=n,this.src_=i,this.key=i,this.image_=new Image,null!==n&&(this.image_.crossOrigin=n),this.unlisten_=null,this.tileLoadFunction_=r}getImage(){return this.image_}setImage(t){this.image_=t,this.state=r.Z.LOADED,this.unlistenImage_(),this.changed()}handleImageError_(){this.state=r.Z.ERROR,this.unlistenImage_(),this.image_=function(){const t=(0,s.E4)(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=r.Z.LOADED:this.state=r.Z.EMPTY,this.unlistenImage_(),this.changed()}load(){this.state==r.Z.ERROR&&(this.state=r.Z.IDLE,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==r.Z.IDLE&&(this.state=r.Z.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=(0,o.Kp)(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}}e.Z=a},1055:function(t,e,i){"use strict";i.d(e,{Z:function(){return H}});var n=i(38282),r=i(79638),s=i(8651),o=i(5929),a=i(79407),l=i(22765),h=i(44669),u=i(36117),c=i(47921),d=i(91462),f=i(19775);class g extends o.Z{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){(0,l.O3)()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;(0,h.qC)(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),(0,h.nb)(n,i)}forEachFeatureAtCoordinate(t,e,i,n,r,s,o,a){let l;const h=e.viewState;function c(t,e,i,n){return r.call(s,e,t?i:null,n)}const g=h.projection,p=(0,f.Cf)(t.slice(),g),m=[[0,0]];if(g.canWrapX()&&n){const t=g.getExtent(),e=(0,u.dz)(t);m.push([-e,0],[e,0])}const _=e.layerStatesArray,y=_.length,x=[],v=[];for(let n=0;n=0;--r){const s=_[r],u=s.layer;if(u.hasRenderer()&&(0,d.j)(s,h)&&o.call(a,u)){const r=u.getRenderer(),o=u.getSource();if(r&&o){const a=o.getWrapX()?p:t,h=c.bind(null,s.managed);v[0]=a[0]+m[n][0],v[1]=a[1]+m[n][1],l=r.forEachFeatureAtCoordinate(v,e,i,h,x)}if(l)return l}}if(0===x.length)return;const E=1/x.length;return x.forEach(((t,e)=>t.distanceSq+=e*E)),x.sort(((t,e)=>t.distanceSq-e.distanceSq)),x.some((t=>l=t.callback(t.feature,t.layer,t.geometry))),l}hasFeatureAtCoordinate(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,a.uX,this,r,s)}getMap(){return this.map_}renderFrame(t){(0,l.O3)()}flushDeclutterItems(t){}scheduleExpireIconCache(t){c.c1.canExpireCache()&&t.postRenderFunctions.push(p)}}function p(t,e){c.c1.expire()}var m=g,_=i(35323),y=i(44594),x=i(95474),v=i(49636),E=i(17955),b=i(41507),w=i(850);var S=class extends m{constructor(t){super(t),this.fontChangeListenerKey_=(0,b.oL)(E.sG,_.Z.PROPERTYCHANGE,t.redrawText.bind(t)),this.element_=document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=v.XV+" ol-layers";const i=t.getViewport();i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0,this.declutterLayers_=[]}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new y.Z(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){(0,b.bN)(this.fontChangeListenerKey_),this.element_.parentNode.removeChild(this.element_),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(x.Z.PRECOMPOSE,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.children_.length=0;const n=this.declutterLayers_;n.length=0;let r=null;for(let s=0,o=e.length;s=0;--i)e[i].renderDeclutter(t,t.layerStatesArray[i]);e.length=0}},C=i(92486),T=i(22664),M=i(84184),P=i(87556),R=i(64074),I=i(13804),A=i(14768);class L extends I.Z{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=(0,b.oL)(i,R.Z.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=(0,b.oL)(i,R.Z.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(C.Z.TOUCHMOVE,this.boundHandleTouchMove_,!!A.bM&&{passive:!1})}emulateClick_(t){let e=new M.Z(P.Z.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new M.Z(P.Z.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout((()=>{this.clickTimeoutId_=void 0;const e=new M.Z(P.Z.SINGLECLICK,this.map_,t);this.dispatchEvent(e)}),250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==P.Z.POINTERUP||e.type==P.Z.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=P.Z.POINTERDOWN&&e.type!=P.Z.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new M.Z(P.Z.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(b.bN),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new M.Z(P.Z.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument();this.dragListenerKeys_.push((0,b.oL)(t,P.Z.POINTERMOVE,this.handlePointerMove_,this),(0,b.oL)(t,P.Z.POINTERUP,this.handlePointerUp_,this),(0,b.oL)(this.element_,P.Z.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==t&&this.dragListenerKeys_.push((0,b.oL)(this.element_.getRootNode(),P.Z.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new M.Z(P.Z.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new M.Z(P.Z.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){return this.dragging_||Math.abs(t.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&((0,b.bN)(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(C.Z.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&((0,b.bN)(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(b.bN),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}}var F=L,O=i(88222),Z=i(22222),k=i(96270),D=i(63947),N=i(40824),G=i(87334),z=i(23422),j=i(35777),U=i(55572),B=i(17367),q=i(81625),V=i(81898),X=i(37938);function $(t){t instanceof d.Z?t.setMapInternal(null):t instanceof T.Z&&t.getLayers().forEach($)}function W(t,e){if(t instanceof d.Z)t.setMapInternal(e);else if(t instanceof T.Z){const i=t.getLayers().getArray();for(let t=0,n=i.length;tthis.updateSize())),this.controls=e.controls||(0,j.c)(),this.interactions=e.interactions||(0,U.c)({onFocusOnly:!0}),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new D.Z(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(k.Z.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(k.Z.VIEW,this.handleViewChanged_),this.addChangeListener(k.Z.SIZE,this.handleSizeChanged_),this.addChangeListener(k.Z.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof N.ZP||t.view.then((function(t){i.setView(new N.ZP(t))})),this.controls.addEventListener(s.Z.ADD,(t=>{t.element.setMap(this)})),this.controls.addEventListener(s.Z.REMOVE,(t=>{t.element.setMap(null)})),this.interactions.addEventListener(s.Z.ADD,(t=>{t.element.setMap(this)})),this.interactions.addEventListener(s.Z.REMOVE,(t=>{t.element.setMap(null)})),this.overlays_.addEventListener(s.Z.ADD,(t=>{this.addOverlayInternal_(t.element)})),this.overlays_.addEventListener(s.Z.REMOVE,(t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)})),this.controls.forEach((t=>{t.setMap(this)})),this.interactions.forEach((t=>{t.setMap(this)})),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}handleLayerAdd_(t){W(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,s=void 0!==i.layerFilter?i.layerFilter:a.uX,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i}getAllLayers(){const t=[];return function e(i){i.forEach((function(i){i instanceof T.Z?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:a.uX,r=void 0!==e.hitTolerance?e.hitTolerance:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_.getBoundingClientRect(),i=this.getSize(),n=e.width/i[0],r=e.height/i[1],s="changedTouches"in t?t.changedTouches[0]:t;return[(s.clientX-e.left)/n,(s.clientY-e.top)/r]}getTarget(){return this.get(k.Z.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t){return(0,q.lO)(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?(0,h.nn)(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(k.Z.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof r.Z)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e=0;i--){const n=e[i];if(n.getMap()!==this||!n.getActive()||!this.getTargetElement())continue;if(!n.handleEvent(t)||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,n=i;if(t){const e=t.viewHints;if(e[G.Z.ANIMATING]||e[G.Z.INTERACTING]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading(){this.postRenderTimeoutHandle_=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new T.V("removelayer",e)),this.set(k.Z.LAYERGROUP,t)}setSize(t){this.set(k.Z.SIZE,t)}setTarget(t){this.set(k.Z.TARGET,t)}setView(t){if(!t||t instanceof N.ZP)return void this.set(k.Z.VIEW,t);this.set(k.Z.VIEW,new N.ZP);const e=this;t.then((function(t){e.setView(new N.ZP(t))}))}updateSize(){const t=this.getTargetElement();let e;if(t){const i=getComputedStyle(t),n=t.offsetWidth-parseFloat(i.borderLeftWidth)-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight)-parseFloat(i.borderRightWidth),r=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(r)||(e=[n,r],!(0,V.py)(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&(0,X.ZK)("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&(0,B.fS)(e,i)||(this.setSize(e),this.updateViewportSize_(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}var H=Y},84184:function(t,e,i){"use strict";var n=i(88222);class r extends n.Z{constructor(t,e,i,n,r,s){super(t,e,r),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==n&&n,this.activePointers=s}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}e.Z=r},87556:function(t,e,i){"use strict";var n=i(92486);e.Z={SINGLECLICK:"singleclick",CLICK:n.Z.CLICK,DBLCLICK:n.Z.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}},88222:function(t,e,i){"use strict";var n=i(6747);class r extends n.ZP{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}e.Z=r},22222:function(t,e){"use strict";e.Z={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"}},96270:function(t,e){"use strict";e.Z={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"}},38282:function(t,e,i){"use strict";var n=i(6747),r=i(35323),s=i(21320),o=i(22765),a=i(4891);class l extends n.ZP{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class h extends s.Z{constructor(t){super(),this.on,this.once,this.un,(0,o.sq)(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e)),i=r.Z.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new l(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const n=this.values_||(this.values_={});if(i)n[t]=e;else{const i=n[t];n[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],(0,a.x)(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}e.Z=h},35323:function(t,e){"use strict";e.Z={PROPERTYCHANGE:"propertychange"}},21320:function(t,e,i){"use strict";i.d(e,{B:function(){return a}});var n=i(13804),r=i(92486),s=i(41507);class o extends n.Z{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(r.Z.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let r=0;rt)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){(0,o.O3)()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const n=e-i+1e3/60;return n>=this.transition_?1:(0,a.YQ)(n/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}}e.Z=l},2145:function(t,e,i){"use strict";var n=i(80316),r=i(69649);class s extends n.Z{clear(){for(;this.getCount()>0;)this.pop().release();super.clear()}expireCache(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}}pruneExceptNewestZ(){if(0===this.getCount())return;const t=this.peekFirstKey(),e=(0,r.Ul)(t)[0];this.forEach((t=>{t.tileCoord[0]!==e&&(this.remove((0,r.km)(t.tileCoord)),t.release())}))}}e.Z=s},63947:function(t,e,i){"use strict";i.d(e,{Z:function(){return h},R:function(){return u}});var n=i(92486),r=i(23422),s=i(4891);const o=1/0;var a=class{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,(0,s.Z)(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const n=this.keyFunction_(i);return delete this.queuedElements_[n],i}enqueue(t){(0,r.h)(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=o&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;for(;t>1;){const r=this.getLeftChildIndex_(t),s=this.getRightChildIndex_(t),o=st;){const t=this.getParentIndex_(e);if(!(n[t]>s))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=r,n[e]=s}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let n=0;const r=e.length;let s,a,l;for(a=0;a0;)n=this.dequeue()[0],r=n.getKey(),i=n.getState(),i!==l.Z.IDLE||r in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[r]=!0,++this.tilesLoading_,++s,n.load())}};function u(t,e,i,n,r){if(!t||!(i in t.wantedTiles))return o;if(!t.wantedTiles[i][e.getKey()])return o;const s=t.viewState.center,a=n[0]-s[0],l=n[1]-s[1];return 65536*Math.log(r)+Math.sqrt(a*a+l*l)/r}},51748:function(t,e,i){"use strict";i.d(e,{T:function(){return r}});class n{constructor(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}contains(t){return this.containsXY(t[1],t[2])}containsTileRange(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY}containsXY(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY}equals(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY}extend(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)}getHeight(){return this.maxY-this.minY+1}getSize(){return[this.getWidth(),this.getHeight()]}getWidth(){return this.maxX-this.minX+1}intersects(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY}}function r(t,e,i,r,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=r,s):new n(t,e,i,r)}e.Z=n},74251:function(t,e){"use strict";e.Z={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4}},38264:function(t,e,i){"use strict";var n=i(69319),r=i(74251);class s extends n.Z{constructor(t,e,i,n,r,s){super(t,e,s),this.extent=null,this.format_=n,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=r,this.url_=i,this.key=i}getFormat(){return this.format_}getFeatures(){return this.features_}load(){this.state==r.Z.IDLE&&(this.setState(r.Z.LOADING),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(r.Z.ERROR)}setFeatures(t){this.features_=t,this.setState(r.Z.LOADED)}setLoader(t){this.loader_=t}}e.Z=s},40824:function(t,e,i){"use strict";i.d(e,{ZP:function(){return T}});var n=i(38282),r=i(87334),s=i(21800),o=i(36913),a=i(81625),l=i(79407),h=i(19775),u=i(23422),c=i(63312);function d(t,e,i){return function(n,r,s,o,a){if(!n)return;if(!r&&!e)return n;const l=e?0:s[0]*r,h=e?0:s[1]*r,u=a?a[0]:0,d=a?a[1]:0;let f=t[0]+l/2+u,g=t[2]-l/2+u,p=t[1]+h/2+d,m=t[3]-h/2+d;f>g&&(f=(g+f)/2,g=f),p>m&&(p=(m+p)/2,m=p);let _=(0,c.uZ)(n[0],f,g),y=(0,c.uZ)(n[1],p,m);if(o&&i&&r){const t=30*r;_+=-t*Math.log(1+Math.max(0,f-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-g)/t),y+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[_,y]}}function f(t){return t}var g=i(36117),p=i(17367);function m(t,e,i,n){const r=(0,g.dz)(e)/i[0],s=(0,g.Cr)(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function _(t,e,i){let n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),(0,c.uZ)(n,i/2,2*e)}function y(t,e,i,n,r){return i=void 0===i||i,function(s,o,a,l){if(void 0!==s){const o=n?m(t,n,a,r):t;return i&&l?_(s,o,e):(0,c.uZ)(s,e,o)}}}var x=i(12338),v=i(70076),E=i(23814);class b extends n.Z{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=(0,a.UQ)(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&(0,a.h_)(),t.center&&(t.center=(0,a.Vs)(t.center,this.projection_)),t.extent&&(t.extent=(0,a.dY)(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in s.Z)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,n;const r=28,s=2;let l=void 0!==t.minZoom?t.minZoom:0,h=void 0!==t.maxZoom?t.maxZoom:r;const u=void 0!==t.zoomFactor?t.zoomFactor:s,d=void 0!==t.multiWorld&&t.multiWorld,f=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,x=void 0!==t.showFullExtent&&t.showFullExtent,v=(0,a.UQ)(t.projection,"EPSG:3857"),E=v.getExtent();let b=t.constrainOnlyCenter,w=t.extent;d||w||!v.isGlobal()||(b=!1,w=E);if(void 0!==t.resolutions){const r=t.resolutions;i=r[l],n=void 0!==r[h]?r[h]:r[r.length-1],e=t.constrainResolution?function(t,e,i,n){return e=void 0===e||e,function(r,s,o,a){if(void 0!==r){const l=t[0],h=t[t.length-1],u=i?m(l,i,o,n):l;if(a)return e?_(r,u,h):(0,c.uZ)(r,h,u);const d=Math.min(u,r),f=Math.floor((0,p.h7)(t,d,s));return t[f]>u&&f1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n0}getInteracting(){return this.hints_[r.Z.INTERACTING]>0}cancelAnimations(){let t;this.setHint(r.Z.ANIMATING,-this.hints_[r.Z.ANIMATING]);for(let e=0,i=this.animations_.length;e=0;--i){const n=this.animations_[i];let s=!0;for(let i=0,r=n.length;i0?o/r.duration:1;a>=1?(r.complete=!0,a=1):s=!1;const l=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.nextCenter_=r.targetCenter;const s=t+l*(i-t),o=e+l*(n-e);this.targetCenter_=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===l?r.targetResolution:r.sourceResolution+l*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===l?(0,c.$W)(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+l*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(s){this.animations_[i]=null,this.setHint(r.Z.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=n[0].callback;t&&w(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],(0,h.U1)(i,t-this.getRotation()),(0,h.IH)(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),r=this.getResolution();if(void 0!==n&&void 0!==r){i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?(0,a.lO)(t,this.getProjection()):t}getCenterInternal(){return this.get(s.Z.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return(0,a.Fj)(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();(0,u.h)(e,"The view center is not defined");const i=this.getResolution();(0,u.h)(void 0!==i,"The view resolution is not defined");const n=this.getRotation();return(0,u.h)(void 0!==n,"The view rotation is not defined"),(0,g.p8)(e,i,n,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(s.Z.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal((0,a.dY)(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=(0,g.dz)(t)/e[0],n=(0,g.Cr)(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(s.Z.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let n=this.getCenterInternal();const r=this.padding_;if(r){const t=this.getViewportSizeMinusPadding_();n=C(n,this.getViewportSize_(),[t[0]/2+r[3],t[1]/2+r[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.minZoom_||0;if(this.resolutions_){const r=(0,p.h7)(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;const e=(0,c.uZ)(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,(0,c.uZ)(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if((0,u.h)(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){(0,u.h)(!(0,g.xb)(t),"Cannot fit empty extent provided as `geometry`");const e=(0,a.dY)(t,this.getProjection());i=(0,E.oJ)(e)}else if("Circle"===t.getType()){const e=(0,a.dY)(t.getExtent(),this.getProjection());i=(0,E.oJ)(e),i.rotate(this.getRotation(),(0,g.qg)(e))}else{const e=(0,a.Cs)();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),n=Math.sin(-e),r=t.getFlatCoordinates(),s=t.getStride();let o=1/0,a=1/0,l=-1/0,h=-1/0;for(let t=0,e=r.length;t>1),s=+i(t[n],e),s<0?o=n+1:(a=n,l=!s);return l?o:~o}function r(t,e){return t>e?1:te?-1:0}function o(t,e,i){if(t[0]<=e)return 0;const n=t.length;if(e<=t[n-1])return n-1;if("function"==typeof i){for(let r=1;r0?r-1:r}return n-1}if(i>0){for(let i=1;i0||i&&0===s)}))}i.d(e,{$1:function(){return s},FZ:function(){return a},fS:function(){return h},h7:function(){return o},j2:function(){return r},l7:function(){return l},pT:function(){return u},ry:function(){return n}})},23422:function(t,e,i){"use strict";function n(t,e){if(!t)throw new Error(e)}i.d(e,{h:function(){return n}})},12185:function(t,e,i){"use strict";i.d(e,{_2:function(){return b},XC:function(){return g},mL:function(){return E},e1:function(){return C},TF:function(){return v},Fv:function(){return w},WV:function(){return x},BB:function(){return S},fG:function(){return y}});var n={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]},r={name:"xyz",min:[0,0,0],channel:["X","Y","Z"],alias:["XYZ","ciexyz","cie1931"],whitepoint:{2:{A:[109.85,100,35.585],C:[98.074,100,118.232],D50:[96.422,100,82.521],D55:[95.682,100,92.149],D65:[95.045592705167,100,108.9057750759878],D75:[94.972,100,122.638],F2:[99.187,100,67.395],F7:[95.044,100,108.755],F11:[100.966,100,64.37],E:[100,100,100]},10:{A:[111.144,100,35.2],C:[97.285,100,116.145],D50:[96.72,100,81.427],D55:[95.799,100,90.926],D65:[94.811,100,107.304],D75:[94.416,100,120.641],F2:[103.28,100,69.026],F7:[95.792,100,107.687],F11:[103.866,100,65.627],E:[100,100,100]}}};r.max=r.whitepoint[2].D65,r.rgb=function(t,e){e=e||r.whitepoint[2].E;var i,n,s,o=t[0]/e[0],a=t[1]/e[1],l=t[2]/e[2];return n=-.96924363628087*o+1.87596750150772*a+.041555057407175*l,s=.055630079696993*o+-.20397695888897*a+1.056971514242878*l,i=(i=3.240969941904521*o+-1.537383177570093*a+-.498610760293*l)>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*=12.92,[255*(i=Math.min(Math.max(0,i),1)),255*(n=Math.min(Math.max(0,n),1)),255*(s=Math.min(Math.max(0,s),1))]},n.xyz=function(t,e){var i=t[0]/255,n=t[1]/255,s=t[2]/255,o=.21263900587151*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)+.71516867876775*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.072192315360733*(s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92),a=.019330818715591*i+.11919477979462*n+.95053215224966*s;return[(.41239079926595*i+.35758433938387*n+.18048078840183*s)*(e=e||r.whitepoint[2].E)[0],o*e[1],a*e[2]]};var s=r,o={name:"luv",min:[0,-134,-140],max:[100,224,122],channel:["lightness","u","v"],alias:["LUV","cieluv","cie1976"],xyz:function(t,e,i){var n,r,o,a,l,h,u,c,d;if(o=t[0],a=t[1],l=t[2],0===o)return[0,0,0];return e=e||"D65",i=i||2,n=a/(13*o)+4*(u=s.whitepoint[i][e][0])/(u+15*(c=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2]))||0,r=l/(13*o)+9*c/(u+15*c+3*d)||0,[9*(h=o>8?c*Math.pow((o+16)/116,3):c*o*.0011070564598794539)*n/(4*r)||0,h,h*(12-3*n-20*r)/(4*r)||0]}};s.luv=function(t,e,i){var n,r,o,a,l,h,u,c,d,f,g;e=e||"D65",i=i||2,f=4*(u=s.whitepoint[i][e][0])/(u+15*(c=s.whitepoint[i][e][1])+3*(d=s.whitepoint[i][e][2])),g=9*c/(u+15*c+3*d),n=4*(a=t[0])/(a+15*(l=t[1])+3*(h=t[2]))||0,r=9*l/(a+15*l+3*h)||0;var p=l/c;return[o=p<=.008856451679035631?903.2962962962961*p:116*Math.pow(p,1/3)-16,13*o*(n-f),13*o*(r-g)]};var a={name:"lchuv",channel:["lightness","chroma","hue"],alias:["LCHuv","cielchuv"],min:[0,0,0],max:[100,100,360],luv:function(t){var e,i=t[0],n=t[1];return e=t[2]/360*2*Math.PI,[i,n*Math.cos(e),n*Math.sin(e)]},xyz:function(t){return o.xyz(a.luv(t))}},l=a;o.lchuv=function(t){var e=t[0],i=t[1],n=t[2],r=Math.sqrt(i*i+n*n),s=360*Math.atan2(n,i)/2/Math.PI;return s<0&&(s+=360),[e,r,s]},s.lchuv=function(t){return o.lchuv(s.luv(t))};var h=i(49552),u=function(t){var e,i,n=[],r=1;if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if("number"==typeof t)return{space:"rgb",values:[t>>>16,(65280&t)>>>8,255&t],alpha:1};if(t=String(t).toLowerCase(),h[t])n=h[t].slice(),i="rgb";else if("transparent"===t)r=0,i="rgb",n=[0,0,0];else if("#"===t[0]){var s=t.slice(1),o=s.length;r=1,o<=4?(n=[parseInt(s[0]+s[0],16),parseInt(s[1]+s[1],16),parseInt(s[2]+s[2],16)],4===o&&(r=parseInt(s[3]+s[3],16)/255)):(n=[parseInt(s[0]+s[1],16),parseInt(s[2]+s[3],16),parseInt(s[4]+s[5],16)],8===o&&(r=parseInt(s[6]+s[7],16)/255)),n[0]||(n[0]=0),n[1]||(n[1]=0),n[2]||(n[2]=0),i="rgb"}else if(e=/^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\s*\(([^\)]*)\)/.exec(t)){var a=e[1],l="cmyk"===(i=a.replace(/a$/,""))?4:"gray"===i?1:3;n=e[2].trim().split(/\s*[,\/]\s*|\s+/),"color"===i&&(i=n.shift()),r=(n=n.map((function(t,e){if("%"===t[t.length-1])return t=parseFloat(t)/100,3===e?t:"rgb"===i?255*t:"h"===i[0]?100*t:"l"!==i[0]||e?"lab"===i?125*t:"lch"===i?e<2?150*t:360*t:"o"!==i[0]||e?"oklab"===i?.4*t:"oklch"===i?e<2?.4*t:360*t:t:t:100*t;if("h"===i[e]||2===e&&"h"===i[i.length-1]){if(void 0!==c[t])return c[t];if(t.endsWith("deg"))return parseFloat(t);if(t.endsWith("turn"))return 360*parseFloat(t);if(t.endsWith("grad"))return 360*parseFloat(t)/400;if(t.endsWith("rad"))return 180*parseFloat(t)/Math.PI}return"none"===t?0:parseFloat(t)}))).length>l?n.pop():1}else/[0-9](?:\s|\/|,)/.test(t)&&(n=t.match(/([0-9]+)/g).map((function(t){return parseFloat(t)})),i=t.match(/([a-z])/gi)?.join("")?.toLowerCase()||"rgb");return{space:i,values:n,alpha:r}},c={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};var d={name:"hsl",min:[0,0,0],max:[360,100,100],channel:["hue","saturation","lightness"],alias:["HSL"],rgb:function(t){var e,i,n,r,s,o=t[0]/360,a=t[1]/100,l=t[2]/100,h=0;if(0===a)return[s=255*l,s,s];for(e=2*l-(i=l<.5?l*(1+a):l+a-l*a),r=[0,0,0];h<3;)(n=o+1/3*-(h-1))<0?n++:n>1&&n--,s=6*n<1?e+6*(i-e)*n:2*n<1?i:3*n<2?e+(i-e)*(2/3-n)*6:e,r[h++]=255*s;return r}};n.hsl=function(t){var e,i,n=t[0]/255,r=t[1]/255,s=t[2]/255,o=Math.min(n,r,s),a=Math.max(n,r,s),l=a-o;return a===o?e=0:n===a?e=(r-s)/l:r===a?e=2+(s-n)/l:s===a&&(e=4+(n-r)/l),(e=Math.min(60*e,360))<0&&(e+=360),i=(o+a)/2,[e,100*(a===o?0:i<=.5?l/(a+o):l/(2-a-o)),100*i]};var f=i(63312);function g(t){return"string"==typeof t?t:S(t)}const p=1024,m={};let _=0;function y(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function x(t){const e=s.lchuv(n.xyz(t));return e[3]=t[3],e}function v(t){const e=s.rgb(l.xyz(t));return e[3]=t[3],e}function E(t){if(m.hasOwnProperty(t))return m[t];if(_>=p){let t=0;for(const e in m)0==(3&t++)&&(delete m[e],--_)}const e=function(t){var e;Array.isArray(t)&&t.raw&&(t=String.raw(...arguments)),t instanceof Number&&(t=+t);var i=u(t);if(!i.space)return[];const r="h"===i.space[0]?d.min:n.min,s="h"===i.space[0]?d.max:n.max;return(e=Array(3))[0]=Math.min(Math.max(i.values[0],r[0]),s[0]),e[1]=Math.min(Math.max(i.values[1],r[1]),s[1]),e[2]=Math.min(Math.max(i.values[2],r[2]),s[2]),"h"===i.space[0]&&(e=d.rgb(e)),e.push(Math.min(Math.max(i.alpha,0),1)),e}(t);if(4!==e.length)throw new Error('Failed to parse "'+t+'" as color');for(const i of e)if(isNaN(i))throw new Error('Failed to parse "'+t+'" as color');return w(e),m[t]=e,++_,e}function b(t){return Array.isArray(t)?t:E(t)}function w(t){return t[0]=(0,f.uZ)(t[0]+.5|0,0,255),t[1]=(0,f.uZ)(t[1]+.5|0,0,255),t[2]=(0,f.uZ)(t[2]+.5|0,0,255),t[3]=(0,f.uZ)(t[3],0,1),t}function S(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let n=t[2];n!=(0|n)&&(n=n+.5|0);return"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function C(t){try{return E(t),!0}catch(t){return!1}}},52987:function(t,e,i){"use strict";i.d(e,{y:function(){return l}});var n=i(13701),r=i(850),s=i(72605),o=i(47921),a=i(12185);function l(t){return t?Array.isArray(t)?(0,a.BB)(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return o.c1.getPattern(t.src,"anonymous",t.color);const e=t.src+":"+t.offset,i=o.c1.getPattern(e,void 0,t.color);if(i)return i;const a=o.c1.get(t.src,"anonymous",null);if(a.getImageState()!==n.Z.LOADED)return null;const l=(0,r.E4)(t.size[0],t.size[1]);return l.drawImage(a.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),(0,s.U)(l.canvas,e,void 0,n.Z.LOADED,t.color,!0),o.c1.getPattern(e,void 0,t.color)}(t):t:null}},37938:function(t,e,i){"use strict";i.d(e,{ZK:function(){return s},vU:function(){return o}});const n={info:1,warn:2,error:3,none:4};let r=n.info;function s(...t){r>n.warn||console.warn(...t)}function o(...t){r>n.error||console.error(...t)}},55466:function(t,e,i){"use strict";var n=i(19870),r=i(92486),s=i(49636),o=i(17367),a=i(850);class l extends n.Z{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1);const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",n=void 0!==t.expandClassName?t.expandClassName:e+"-expand",o=void 0!==t.collapseLabel?t.collapseLabel:"›",a=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof o?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=o,this.collapseLabel_.className=a):this.collapseLabel_=o;const l=void 0!==t.label?t.label:"i";"string"==typeof l?(this.label_=document.createElement("span"),this.label_.textContent=l,this.label_.className=n):this.label_=l;const h=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(h),this.toggleButton_.addEventListener(r.Z.CLICK,this.handleClick_.bind(this),!1);const u=e+" "+s.XV+" "+s.hg+(this.collapsed_&&this.collapsible_?" "+s.hN:"")+(this.collapsible_?"":" ol-uncollapsible"),c=this.element;c.className=u,c.appendChild(this.toggleButton_),c.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=Array.from(new Set(this.getMap().getAllLayers().flatMap((e=>e.getAttributions(t))))),i=!this.getMap().getAllLayers().some((t=>t.getSource()&&!1===t.getSource().getAttributionsCollapsible()));return this.overrideCollapsible_||this.setCollapsible(i),e}updateElement_(t){if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=this.collectSourceAttributions_(t),i=e.length>0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!(0,o.fS)(e,this.renderedAttributions_)){(0,a.ep)(this.ulElement_);for(let t=0,i=e.length;tu*y||h>c*y?this.resetExtent_():(0,g.r4)(s,n)||this.recenter_()}resetExtent_(){const t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2,o=1/(Math.pow(2,s/2)*x);(0,g.H9)(n,o),r.fitInternal((0,m.oJ)(n))}recenter_(){const t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}updateBox_(){const t=this.getMap(),e=this.ovmap_;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenterInternal(),h=n.getResolution(),u=r.getResolution(),c=i[0]*h/u,d=i[1]*h/u;if(o.setPosition(l),a){a.style.width=c+"px",a.style.height=d+"px";const t="rotate("+s+"rad)";a.style.transform=t}}updateBoxAfterOvmapIsRendered_(){this.ovmapPostrenderKey_||(this.ovmapPostrenderKey_=(0,p.Vx)(this.ovmap_,a.Z.POSTRENDER,(function(t){delete this.ovmapPostrenderKey_,this.updateBox_()}),this))}handleClick_(t){t.preventDefault(),this.handleToggle_()}handleToggle_(){this.element.classList.toggle(f.hN),this.collapsed_?(0,_.$H)(this.collapseLabel_,this.label_):(0,_.$H)(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;const t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),this.updateBoxAfterOvmapIsRendered_()}}getCollapsible(){return this.collapsible_}setCollapsible(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())}setCollapsed(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}getRotateWithView(){return this.rotateWithView_}setRotateWithView(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))}getOverviewMap(){return this.ovmap_}render(t){this.validateExtent_(),this.updateBox_()}}e.Z=v},1375:function(t,e,i){"use strict";var n=i(19870),r=i(49636),s=i(81625);const o="units",a=[1,2,5],l=25.4/.28;class h extends n.Z{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+r.XV,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(o,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(o)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(o,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t)return void(this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1));const e=t.center,i=t.projection,n=this.getUnits(),r="degrees"==n?"degrees":"m";let o=(0,s._Q)(i,t.resolution,e,r);const h=this.minWidth_*(this.dpi_||l)/l,u=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||l)/l:void 0;let c=h*o,d="";if("degrees"==n){const t=s.Wm.degrees;c*=t,c=u){f=m,g=_,p=y;break}if(g>=h)break;m=f,_=g,y=p,++x}const v=this.scaleBar_?this.createScaleBar(g,f,d):f.toFixed(p<0?-p:0)+" "+d;this.renderedHTML_!=v&&(this.innerElement_.innerHTML=v,this.renderedHTML_=v),this.renderedWidth_!=g&&(this.innerElement_.style.width=g+"px",this.renderedWidth_=g),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),r=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),s=this.scaleBarSteps_,o=t/s,a=[this.createMarker("absolute")];for(let n=0;n
`+this.createMarker("relative")+(n%2==0||2===s?this.createStepText(n,t,!1,e,i):"")+"")}a.push(this.createStepText(s,t,!0,e,i));return(this.scaleBarText_?`
`+r+"
":"")+a.join("")}createMarker(t){return`
`}createStepText(t,e,i,n,r){const s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return`
`+s+"
"}getScaleForResolution(){return(0,s._Q)(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center,"m")*(1e3/25.4)*(this.dpi_||l)}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}}e.Z=h},86553:function(t,e,i){"use strict";var n=i(19870),r=i(92486),s=i(64074),o=i(49636),a=i(63312),l=i(70076),h=i(41507),u=i(6747);const c=0,d=1;class f extends n.Z{constructor(t){super({target:(t=t||{}).target,element:document.createElement("div"),render:t.render}),this.dragListenerKeys_=[],this.currentResolution_=void 0,this.direction_=c,this.dragging_,this.heightLimit_=0,this.widthLimit_=0,this.startX_,this.startY_,this.thumbSize_=null,this.sliderInitialized_=!1,this.duration_=void 0!==t.duration?t.duration:200;const e=void 0!==t.className?t.className:"ol-zoomslider",i=document.createElement("button");i.setAttribute("type","button"),i.className=e+"-thumb "+o.XV;const n=this.element;n.className=e+" "+o.XV+" "+o.hg,n.appendChild(i),n.addEventListener(s.Z.POINTERDOWN,this.handleDraggerStart_.bind(this),!1),n.addEventListener(s.Z.POINTERMOVE,this.handleDraggerDrag_.bind(this),!1),n.addEventListener(s.Z.POINTERUP,this.handleDraggerEnd_.bind(this),!1),n.addEventListener(r.Z.CLICK,this.handleContainerClick_.bind(this),!1),i.addEventListener(r.Z.CLICK,u.UW,!1)}setMap(t){super.setMap(t),t&&t.render()}initSlider_(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.sliderInitialized_=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const r=t.firstElementChild,s=getComputedStyle(r),o=r.offsetWidth+parseFloat(s.marginRight)+parseFloat(s.marginLeft),a=r.offsetHeight+parseFloat(s.marginTop)+parseFloat(s.marginBottom);return this.thumbSize_=[o,a],e>i?(this.direction_=d,this.widthLimit_=e-o):(this.direction_=c,this.heightLimit_=i-a),this.sliderInitialized_=!0}handleContainerClick_(t){const e=this.getMap().getView(),i=this.getRelativePosition_(t.offsetX-this.thumbSize_[0]/2,t.offsetY-this.thumbSize_[1]/2),n=this.getResolutionForPosition_(i),r=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:r,duration:this.duration_,easing:l.Vv})}handleDraggerStart_(t){if(!this.dragging_&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.startX_=t.clientX-parseFloat(e.style.left),this.startY_=t.clientY-parseFloat(e.style.top),this.dragging_=!0,0===this.dragListenerKeys_.length){const t=this.handleDraggerDrag_,e=this.handleDraggerEnd_,i=this.getMap().getOwnerDocument();this.dragListenerKeys_.push((0,h.oL)(i,s.Z.POINTERMOVE,t,this),(0,h.oL)(i,s.Z.POINTERUP,e,this))}}}handleDraggerDrag_(t){if(this.dragging_){const e=t.clientX-this.startX_,i=t.clientY-this.startY_,n=this.getRelativePosition_(e,i);this.currentResolution_=this.getResolutionForPosition_(n),this.getMap().getView().setResolution(this.currentResolution_)}}handleDraggerEnd_(t){if(this.dragging_){this.getMap().getView().endInteraction(),this.dragging_=!1,this.startX_=void 0,this.startY_=void 0,this.dragListenerKeys_.forEach(h.bN),this.dragListenerKeys_.length=0}}setThumbPosition_(t){const e=this.getPositionForResolution_(t),i=this.element.firstElementChild;this.direction_==d?i.style.left=this.widthLimit_*e+"px":i.style.top=this.heightLimit_*e+"px"}getRelativePosition_(t,e){let i;return i=this.direction_===d?t/this.widthLimit_:e/this.heightLimit_,(0,a.uZ)(i,0,1)}getResolutionForPosition_(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}getPositionForResolution_(t){const e=this.getMap().getView().getValueForResolutionFunction();return(0,a.uZ)(1-e(t),0,1)}render(t){if(!t.frameState)return;if(!this.sliderInitialized_&&!this.initSlider_())return;const e=t.frameState.viewState.resolution;this.currentResolution_=e,this.setThumbPosition_(e)}}e.Z=f},35777:function(t,e,i){"use strict";i.d(e,{c:function(){return f}});var n=i(55466),r=i(79638),s=i(19870),o=i(92486),a=i(49636),l=i(70076);class h extends s.Z{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target});const e=void 0!==t.className?t.className:"ol-rotate",i=void 0!==t.label?t.label:"⇧",n=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_=null,"string"==typeof i?(this.label_=document.createElement("span"),this.label_.className=n,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(n));const r=t.tipLabel?t.tipLabel:"Reset rotation",s=document.createElement("button");s.className=e+"-reset",s.setAttribute("type","button"),s.title=r,s.appendChild(this.label_),s.addEventListener(o.Z.CLICK,this.handleClick_.bind(this),!1);const l=e+" "+a.XV+" "+a.hg,h=this.element;h.className=l,h.appendChild(s),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(a.oj)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:l.Vv}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)";if(this.autoHide_){const t=this.element.classList.contains(a.oj);t||0!==i?t&&0!==i&&this.element.classList.remove(a.oj):this.element.classList.add(a.oj)}this.label_.style.transform=t}this.rotation_=i}}var u=h;class c extends s.Z{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target});const e=void 0!==t.className?t.className:"ol-zoom",i=void 0!==t.delta?t.delta:1,n=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",r=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",s=void 0!==t.zoomInLabel?t.zoomInLabel:"+",l=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",h=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",u=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"==typeof s?document.createTextNode(s):s),c.addEventListener(o.Z.CLICK,this.handleClick_.bind(this,i),!1);const d=document.createElement("button");d.className=r,d.setAttribute("type","button"),d.title=u,d.appendChild("string"==typeof l?document.createTextNode(l):l),d.addEventListener(o.Z.CLICK,this.handleClick_.bind(this,-i),!1);const f=e+" "+a.XV+" "+a.hg,g=this.element;g.className=f,g.appendChild(c),g.appendChild(d),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.duration_>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:l.Vv})):e.setZoom(n)}}}var d=c;function f(t){t=t||{};const e=new r.Z;(void 0===t.zoom||t.zoom)&&e.push(new d(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new u(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new n.Z(t.attributionOptions)),e}},19775:function(t,e,i){"use strict";i.d(e,{Bs:function(){return m},Cf:function(){return y},Ed:function(){return a},Fj:function(){return h},I8:function(){return u},IH:function(){return o},TE:function(){return p},U1:function(){return d},V7:function(){return _},bA:function(){return f},bI:function(){return g},fS:function(){return c},jk:function(){return x},oL:function(){return l}});var n=i(36117),r=i(63312),s=i(84441);function o(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function a(t,e){const i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1];let o=t[0]-r;const a=t[1]-s;0===o&&0===a&&(o=1);const l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}function l(t,e){const i=t[0],n=t[1],r=e[0],s=e[1],o=r[0],a=r[1],l=s[0],h=s[1],u=l-o,c=h-a,d=0===u&&0===c?0:(u*(i-o)+c*(n-a))/(u*u+c*c||0);let f,g;return d<=0?(f=o,g=a):d>=1?(f=l,g=h):(f=o+d*u,g=a+d*c),[f,g]}function h(t){return function(e){return function(t,e){return function(t,e,i){if(t)return e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i));return""}(t,"{x}, {y}",e)}(e,t)}}function u(t,e,i){const n=(0,r.$W)(e+180,360)-180,o=Math.abs(3600*n),a=i||0;let l=Math.floor(o/3600),h=Math.floor((o-3600*l)/60),u=(0,r.FH)(o-3600*l-60*h,a);u>=60&&(u=0,h+=1),h>=60&&(h=0,l+=1);let c=l+"°";return 0===h&&0===u||(c+=" "+(0,s.v)(h,2)+"′"),0!==u&&(c+=" "+(0,s.v)(u,2,a)+"″"),0!==n&&(c+=" "+t.charAt(n<0?1:0)),c}function c(t,e){let i=!0;for(let n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function d(t,e){const i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function f(t,e){return t[0]*=e,t[1]*=e,t}function g(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function p(t,e){return Math.sqrt(g(t,e))}function m(t,e){return g(t,l(t,e))}function _(t,e){return t?u("NS",t[1],e)+" "+u("EW",t[0],e):""}function y(t,e){if(e.canWrapX()){const i=(0,n.dz)(e.getExtent()),r=x(t,e,i);r&&(t[0]-=r*i)}return t}function x(t,e,i){const r=e.getExtent();let s=0;return e.canWrapX()&&(t[0]r[2])&&(i=i||(0,n.dz)(r),s=Math.floor((t[0]-r[0])/i)),s}},49636:function(t,e,i){"use strict";i.d(e,{$A:function(){return r},Qi:function(){return o},XV:function(){return s},hN:function(){return l},hg:function(){return a},oj:function(){return n},p:function(){return c}});const n="ol-hidden",r="ol-selectable",s="ol-unselectable",o="ol-unsupported",a="ol-control",l="ol-collapsed",h=new RegExp(["^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)","(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)","(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?","(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))","(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))","?\\s*([-,\\\"\\'\\sa-z]+?)\\s*$"].join(""),"i"),u=["style","variant","weight","size","lineHeight","family"],c=function(t){const e=t.match(h);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=u.length;t0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=s.Zn,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}}e.Z=a},94142:function(t,e,i){"use strict";i.d(e,{$6:function(){return a},Bx:function(){return c},Fi:function(){return g},Kf:function(){return m},Ko:function(){return l},MJ:function(){return p},QC:function(){return y},QL:function(){return b},TN:function(){return E},V4:function(){return d},Xp:function(){return w},a5:function(){return x},aj:function(){return h},rM:function(){return _},v8:function(){return f},vY:function(){return v},yZ:function(){return u}});var n=i(87556),r=i(79407),s=i(14768),o=i(23422);function a(t){const e=arguments;return function(t){let i=!0;for(let n=0,r=e.length;n",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette"},w={[b.Get]:R((([t,e])=>void 0!==e?function(t){switch(t){case"string":return h;case"color":return u;case"number":return l;case"boolean":return a;case"number[]":return c;default:throw new Error(`Unrecognized type hint: ${t}`)}}(e.value):d),C(1,2),(function(t,e){const i=E(t[1],e);if(!(i instanceof y))throw new Error("Expected a literal argument for get operation");if("string"!=typeof i.value)throw new Error("Expected a string argument for get operation");if(e.properties.add(i.value),3===t.length){return[i,E(t[2],e)]}return[i]})),[b.Var]:R((([t])=>t.type),C(1,1),(function(t,e,i,n){const r=t[1];if("string"!=typeof r)throw new Error("Expected a string argument for var operation");if(e.variables.add(r),!("variables"in e.style)||void 0===e.style.variables[r])return[new y(d,r)];const s=E(e.style.variables[r],e);if(s.value=r,n&&!m(n,s.type))throw new Error(`The variable ${r} has type ${p(s.type)} but the following type was expected: ${p(n)}`);return[s]})),[b.Id]:R(l|h,S,(function(t,e){e.featureId=!0})),[b.Concat]:R(h,C(2,1/0),T(d)),[b.GeometryType]:R(h,S),[b.Resolution]:R(l,S),[b.Zoom]:R(l,S),[b.Time]:R(l,S),[b.Any]:R(a,C(2,1/0),T(a)),[b.All]:R(a,C(2,1/0),T(a)),[b.Not]:R(a,C(1,1),T(a)),[b.Equal]:R(a,C(2,2),T(d),M),[b.NotEqual]:R(a,C(2,2),T(d),M),[b.GreaterThan]:R(a,C(2,2),T(d),M),[b.GreaterThanOrEqualTo]:R(a,C(2,2),T(d),M),[b.LessThan]:R(a,C(2,2),T(d),M),[b.LessThanOrEqualTo]:R(a,C(2,2),T(d),M),[b.Multiply]:R((t=>{let e=l|u;for(let i=0;i{let e=d;for(let i=2;i{let e=u|l;for(let i=3;i{let e=d;for(let i=1;i3===t.length||4===t.length?c|u:c),C(1,1/0),T(l)),[b.Color]:R(u,C(1,4),T(l)),[b.Band]:R(l,C(1,3),T(l)),[b.Palette]:R(u,C(2,2),(function(t,e){const i=E(t[1],e,l);if(i.type!==l)throw new Error(`The first argument of palette must be an number, got ${p(i.type)} instead`);const n=t[2];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const r=new Array(n.length);for(let t=0;te){throw new Error(`Expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${s}`)}}}function T(t){return function(e,i){const n=e[0],r=e.length-1,s=new Array(r);for(let o=0;o4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(a).join(", ")})`}function h(t){const e=(0,o._2)(t),i=e.length>3?e[3]:1;return l([e[0]/255*i,e[1]/255*i,e[2]/255*i,i])}const u={};let c=0;function d(t){return t in u||(u[t]=c++),u[t]}function f(t){return a(d(t))}function g(t){return"u_var_"+t}function p(){return{inFragmentShader:!1,variables:{},properties:{},functions:{},bandCount:0,style:{}}}const m="getBandValue",_="u_paletteTextures";function y(t,e,i,n){const s=(0,r.Qc)(t,i,e);if((0,r.P9)(s.type,r.Pq))throw new Error("No matching type was found");if(!(0,r.YM)(e,s.type)){const t=(0,r.hD)(e),i=(0,r.hD)(s.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return E(s,e,n)}function x(t){return(e,i,n)=>{const r=i.args.length,s=new Array(r);for(let t=0;t{const i=e.args[0].value;i in t.properties||(t.properties[i]={name:i,type:e.type});return(t.inFragmentShader?"v_prop_":"a_prop_")+i},[r.AP.GeometryType]:(t,e,i)=>{const n="geometryType",s=t=>{const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return s(t.getGeometries()[0])}};n in t.properties||(t.properties[n]={name:n,type:r.uW,evaluator:t=>s(t.getGeometry())});return(t.inFragmentShader?"v_prop_":"a_prop_")+n},[r.AP.Var]:(t,e)=>{const i=e.args[0].value;return i in t.variables||(t.variables[i]={name:i,type:e.type}),g(i)},[r.AP.Resolution]:()=>"u_resolution",[r.AP.Zoom]:()=>"u_zoom",[r.AP.Time]:()=>"u_time",[r.AP.Any]:x((t=>`(${t.join(" || ")})`)),[r.AP.All]:x((t=>`(${t.join(" && ")})`)),[r.AP.Not]:x((([t])=>`(!${t})`)),[r.AP.Equal]:x((([t,e])=>`(${t} == ${e})`)),[r.AP.NotEqual]:x((([t,e])=>`(${t} != ${e})`)),[r.AP.GreaterThan]:x((([t,e])=>`(${t} > ${e})`)),[r.AP.GreaterThanOrEqualTo]:x((([t,e])=>`(${t} >= ${e})`)),[r.AP.LessThan]:x((([t,e])=>`(${t} < ${e})`)),[r.AP.LessThanOrEqualTo]:x((([t,e])=>`(${t} <= ${e})`)),[r.AP.Multiply]:x((t=>`(${t.join(" * ")})`)),[r.AP.Divide]:x((([t,e])=>`(${t} / ${e})`)),[r.AP.Add]:x((t=>`(${t.join(" + ")})`)),[r.AP.Subtract]:x((([t,e])=>`(${t} - ${e})`)),[r.AP.Clamp]:x((([t,e,i])=>`clamp(${t}, ${e}, ${i})`)),[r.AP.Mod]:x((([t,e])=>`mod(${t}, ${e})`)),[r.AP.Pow]:x((([t,e])=>`pow(${t}, ${e})`)),[r.AP.Abs]:x((([t])=>`abs(${t})`)),[r.AP.Floor]:x((([t])=>`floor(${t})`)),[r.AP.Ceil]:x((([t])=>`ceil(${t})`)),[r.AP.Round]:x((([t])=>`floor(${t} + 0.5)`)),[r.AP.Sin]:x((([t])=>`sin(${t})`)),[r.AP.Cos]:x((([t])=>`cos(${t})`)),[r.AP.Atan]:x((([t,e])=>void 0!==e?`atan(${t}, ${e})`:`atan(${t})`)),[r.AP.Sqrt]:x((([t])=>`sqrt(${t})`)),[r.AP.Match]:x((t=>{const e=t[0],i=t[t.length-1];let n=null;for(let r=t.length-3;r>=1;r-=2){n=`(${e} == ${t[r]} ? ${t[r+1]} : ${n||i})`}return n})),[r.AP.Between]:x((([t,e,i])=>`(${t} >= ${e} && ${t} <= ${i})`)),[r.AP.Interpolate]:x((([t,e,...i])=>{let n="";for(let r=0;r{const e=t[t.length-1];let i=null;for(let n=t.length-3;n>=0;n-=2){i=`(${t[n]} ? ${t[n+1]} : ${i||e})`}return i})),[r.AP.In]:x((([t,...e],i)=>{const n=function(t,e){return`operator_${t}_${Object.keys(e.functions).length}`}("in",i),r=[];for(let t=0;t`vec${t.length}(${t.join(", ")})`)),[r.AP.Color]:x((t=>{if(1===t.length)return`vec4(vec3(${t[0]} / 255.0), 1.0)`;if(2===t.length)return`(${t[1]} * vec4(vec3(${t[0]} / 255.0), 1.0))`;const e=t.slice(0,3).map((t=>`${t} / 255.0`));if(3===t.length)return`vec4(${e.join(", ")}, 1.0)`;return`(${t[3]} * vec4(${e.join(", ")}, 1.0))`})),[r.AP.Band]:x((([t,e,i],n)=>{if(!(m in n.functions)){let t="";const e=n.bandCount||1;for(let i=0;i{const[i,...s]=e.args,a=s.length,l=new Uint8Array(4*a);for(let t=0;t0)return a(t.value);if((t.type&r.wy)>0)return t.value.toString();if((t.type&r.uW)>0)return f(t.value.toString());if((t.type&r.Mr)>0)return h(t.value);if((t.type&r.PA)>0)return l(t.value);throw new Error(`Unexpected expression ${t.value} (expected type ${(0,r.hD)(e)})`)}},36117:function(t,e,i){"use strict";i.d(e,{Cf:function(){return U},Cr:function(){return A},EO:function(){return N},Ed:function(){return L},GN:function(){return m},H6:function(){return w},H9:function(){return G},HK:function(){return p},I7:function(){return z},MV:function(){return B},Ne:function(){return j},T9:function(){return f},Wj:function(){return v},Xv:function(){return O},YN:function(){return g},b8:function(){return l},bg:function(){return S},d9:function(){return o},dY:function(){return I},dz:function(){return Z},f3:function(){return s},fS:function(){return _},g0:function(){return P},hC:function(){return C},hI:function(){return r},iW:function(){return y},jE:function(){return u},kK:function(){return k},l7:function(){return x},lJ:function(){return d},p8:function(){return R},pX:function(){return c},qP:function(){return E},qf:function(){return a},qg:function(){return M},r4:function(){return h},rL:function(){return F},w$:function(){return T},xb:function(){return D}});var n=i(24743);function r(t){const e=d();for(let i=0,n=t.length;is&&(h|=n.Z.RIGHT),lo&&(h|=n.Z.ABOVE),h===n.Z.UNKNOWN&&(h=n.Z.INTERSECTING),h}function d(){return[1/0,1/0,-1/0,-1/0]}function f(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function g(t){return f(1/0,1/0,-1/0,-1/0,t)}function p(t,e){const i=t[0],n=t[1];return f(i,n,i,n,e)}function m(t,e,i,n,r){return E(g(r),t,e,i,n)}function _(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function y(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function v(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function E(t,e,i,n,r){for(;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function D(t){return t[2]=a&&m<=h),r||!(o&n.Z.RIGHT)||s&n.Z.RIGHT||(_=g-(f-h)*p,r=_>=l&&_<=u),r||!(o&n.Z.BELOW)||s&n.Z.BELOW||(m=f-(g-l)/p,r=m>=a&&m<=h),r||!(o&n.Z.LEFT)||s&n.Z.LEFT||(_=g-(f-a)*p,r=_>=l&&_<=u)}return r}function j(t,e,i,n){if(D(t))return g(i);let r=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let s=0;s=i[2])){const e=Z(i),r=Math.floor((n[0]-i[0])/e)*e;t[0]-=r,t[2]-=r}return t}function B(t,e){if(e.canWrapX()){const i=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[i[0],t[1],i[2],t[3]]];U(t,e);const n=Z(i);if(Z(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}},24743:function(t,e){"use strict";e.Z={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16}},41773:function(t,e,i){"use strict";i.d(e,{Be:function(){return o},ov:function(){return s}});var n=i(79407);let r=!1;function s(t,e,i,n,s,o,a){const l=new XMLHttpRequest;l.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(l.responseType="arraybuffer"),l.withCredentials=r,l.onload=function(t){if(!l.status||l.status>=200&&l.status<300){const t=e.getType();let n;"json"==t?n=JSON.parse(l.responseText):"text"==t?n=l.responseText:"xml"==t?(n=l.responseXML,n||(n=(new DOMParser).parseFromString(l.responseText,"application/xml"))):"arraybuffer"==t&&(n=l.response),n?o(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):a()}else a()},l.onerror=a,l.send()}function o(t,e){return function(i,r,o,a,l){const h=this;s(t,e,i,r,o,(function(t,e){h.addFeatures(t),void 0!==a&&a(t)}),l||n.Zn)}}},15240:function(t,e,i){"use strict";var n=i(79619),r=i(97261),s=i(15925),o=i(73479),a=i(54729),l=i(16667),h=i(58105),u=i(47051),c=i(23814),d=i(36117),f=i(61734),g=i(81625),p=i(4891),m=i(71313),_=i(15113);const y={Point:function(t){let e;e=void 0!==t.m&&void 0!==t.z?new u.Z([t.x,t.y,t.z,t.m],"XYZM"):void 0!==t.z?new u.Z([t.x,t.y,t.z],"XYZ"):void 0!==t.m?new u.Z([t.x,t.y,t.m],"XYM"):new u.Z([t.x,t.y]);return e},LineString:function(t){const e=b(t);return new s.Z(t.paths[0],e)},Polygon:function(t){const e=b(t);return new c.ZP(t.rings,e)},MultiPoint:function(t){const e=b(t);return new l.Z(t.points,e)},MultiLineString:function(t){const e=b(t);return new a.Z(t.paths,e)},MultiPolygon:function(t){const e=b(t);return new h.Z(t.rings,e)}},x={Point:function(t,e){const i=t.getCoordinates();let n;const r=t.getLayout();if("XYZ"===r)n={x:i[0],y:i[1],z:i[2]};else if("XYM"===r)n={x:i[0],y:i[1],m:i[2]};else if("XYZM"===r)n={x:i[0],y:i[1],z:i[2],m:i[3]};else{if("XY"!==r)throw new Error("Invalid geometry layout");n={x:i[0],y:i[1]}}return n},LineString:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){const i=w(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){const i=w(t),n=t.getCoordinates(!1),r=[];for(let t=0;t=0;e--)r.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:r}}};class v extends r.Z{constructor(t){t=t||{},super(),this.geometryName_=t.geometryName}readFeatureFromObject(t,e,i){const r=t,s=E(r.geometry,e),o=new n.Z;if(this.geometryName_&&o.setGeometryName(this.geometryName_),o.setGeometry(s),r.attributes){o.setProperties(r.attributes,!0);const t=r.attributes[i];void 0!==t&&o.setId(t)}return o}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let r=0,s=n.length;r=0;s--){const i=n[s][0];if((0,d.r4)(new o.Z(i).getExtent(),new o.Z(t).getExtent())){n[s].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===r.length?(i="Polygon",t=Object.assign({},t,{rings:r[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:r}))}const n=y[i];return(0,_.fI)(n(t),!1,e)}function b(t){let e="XY";return!0===t.hasZ&&!0===t.hasM?e="XYZM":!0===t.hasZ?e="XYZ":!0===t.hasM&&(e="XYM"),e}function w(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function S(t,e){return(0,x[t.getType()])((0,_.fI)(t,!0,e),e)}e.Z=v},15113:function(t,e,i){"use strict";i.d(e,{YU:function(){return x},fI:function(){return p},lj:function(){return m},zg:function(){return y}});var n=i(79619),r=i(33321),s=i(47051),o=i(15925),a=i(23814),l=i(16667),h=i(54729),u=i(58105),c=i(54017),d=i(22765),f=i(81625),g=i(71313);function p(t,e,i){const n=i?(0,f.U2)(i.featureProjection):null,r=i?(0,f.U2)(i.dataProjection):null;let s=t;if(n&&r&&!(0,f.OP)(n,r)){e&&(s=t.clone());const i=e?n:r,o=e?r:n;"tile-pixels"===i.getUnits()?s.transform(i,o):s.applyTransform((0,f.Ck)(i,o))}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;iy({...t,geometry:e}))).flat();const n="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===n||"Circle"===n)throw new Error("Unsupported geometry type: "+n);const s=i.layout.length;return p(new r.ZP(n,"Polygon"===n?function(t,e,i){return Array.isArray(e[0])?((0,g.Oj)(t,0,e,i)||(t=t.slice(),(0,g.dL)(t,0,e,i)),t):((0,g.$v)(t,0,e,i)||(t=t.slice(),(0,g.zX)(t,0,e,i)),t)}(i.flatCoordinates,i.ends,s):i.flatCoordinates,i.ends?.flat(),s,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function x(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map((t=>x(t,e)));return new c.Z(i)}return p(new(0,_[t.type])(t.flatCoordinates,t.layout,t.ends),!1,e)}},64944:function(t,e,i){"use strict";var n=i(65878),r=i(31990),s=i(36117),o=i(81625),a=i(15113),l=i(96683);const h=n.J+" http://schemas.opengis.net/gml/2.1.2/feature.xsd",u={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class c extends n.Z{constructor(t){super(t=t||{}),this.FEATURE_COLLECTION_PARSERS[n.J].featureMember=(0,r.Ei)(this.readFeaturesInternal),this.schemaLocation=t.schemaLocation?t.schemaLocation:h}readFlatCoordinates(t,e){const i=(0,r.Ve)(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName;let s="enu";if(n){const t=(0,o.U2)(n);t&&(s=t.getAxisOrientation())}const a=i.trim().split(/\s+/),l=[];for(let t=0,e=a.length;t0&&!(t instanceof r.Z)){t={_content_:t};for(let e=0;e0;else{const e=t.getType();l="Point"===e||"MultiPoint"===e}}l&&(h=o.get("name"),l=l&&!!h,l&&/&[^&]+;/.test(h)&&(W||(W=document.createElement("textarea")),W.innerHTML=h,h=W.value));let c=i;if(t?c=t:e&&(c=Q(e,i,n)),l){const t=function(t,e){const i=[0,0];let n="start";const r=t.getImage();if(r){const t=r.getSize();if(t&&2==t.length){const e=r.getScaleArray(),s=r.getAnchor();i[0]=e[0]*(t[0]-s[0]),i[1]=e[1]*(t[1]/2-s[1]),n="left"}}let s=t.getText();s?(s=s.clone(),s.setFont(s.getFont()||X.getFont()),s.setScale(s.getScale()||X.getScale()),s.setFill(s.getFill()||X.getFill()),s.setStroke(s.getStroke()||q)):s=X.clone();s.setText(e),s.setOffsetX(i[0]),s.setOffsetY(i[1]),s.setTextAlign(n);const o=new p.ZP({image:r,text:s});return o}(c[0],h);if(u.length>0){t.setGeometry(new s.Z(u));return[t,new p.ZP({geometry:c[0].getGeometry(),image:null,fill:c[0].getFill(),stroke:c[0].getStroke(),text:null})].concat(c.slice(1))}return t}return c}}(i.Style,i.styleUrl,this.defaultStyle_,this.sharedStyles_,this.showPointNames_);r.setStyle(t)}return delete i.Style,r.setProperties(i,!0),r}readSharedStyle_(t,e){const i=t.getAttribute("id");if(null!==i){const n=Pt.call(this,t,e);if(n){let e,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){e=new URL("#"+i,r).href}else e="#"+i;this.sharedStyles_[e]=n}}}readSharedStyleMap_(t,e){const i=t.getAttribute("id");if(null===i)return;const n=ot.call(this,t,e);if(!n)return;let r,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){r=new URL("#"+i,s).href}else r="#"+i;this.sharedStyles_[r]=n}readFeatureFromNode(t,e){if(!T.includes(t.namespaceURI))return null;const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!T.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.readDocumentOrFolder_(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.readPlacemark_(t,[this.getReadOptions(t,e)]);return i?[i]:[]}if("kml"==n){i=[];for(let n=t.firstElementChild;n;n=n.nextElementSibling){const t=this.readFeaturesFromNode(n,e);t&&(0,v.l7)(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=(0,y.Qc)(t);return this.readNameFromDocument(e)}return(0,y.qk)(t)?this.readNameFromDocument(t):this.readNameFromNode(t)}}readNameFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE){const t=this.readNameFromNode(e);if(t)return t}}readNameFromNode(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(T.includes(e.namespaceURI)&&"name"==e.localName)return(0,b.s2)(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(T.includes(e.namespaceURI)&&("Document"==t||"Folder"==t||"Placemark"==t||"kml"==t)){const t=this.readNameFromNode(e);if(t)return t}}}readNetworkLinks(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readNetworkLinksFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readNetworkLinksFromDocument(t)):(0,v.l7)(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&(0,v.l7)(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=(0,y.O)({},R,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||(0,v.l7)(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readRegionFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readRegionFromDocument(t)):(0,v.l7)(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&(0,v.l7)(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"Region"==i.localName){const t=(0,y.O)({},L,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||(0,v.l7)(e,this.readRegionFromNode(i))}return e}readCamera(t){const e=[];if("string"==typeof t){const i=(0,y.Qc)(t);(0,v.l7)(e,this.readCameraFromDocument(i))}else(0,y.qk)(t)?(0,v.l7)(e,this.readCameraFromDocument(t)):(0,v.l7)(e,this.readCameraFromNode(t));return e}readCameraFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType===Node.ELEMENT_NODE&&(0,v.l7)(e,this.readCameraFromNode(i));return e}readCameraFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(T.includes(i.namespaceURI)&&"Camera"===i.localName){const t=(0,y.O)({},A,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!T.includes(i.namespaceURI)||"Document"!==t&&"Folder"!==t&&"Placemark"!==t&&"kml"!==t||(0,v.l7)(e,this.readCameraFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=(0,y.c)(T[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",C[0]),i.setAttributeNS(n,"xmlns:xsi",y.fJ),i.setAttributeNS(y.fJ,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const r={node:i},s={};t.length>1?s.Document=t:1==t.length&&(s.Placemark=t[0]);const o=F[i.namespaceURI],a=(0,y.RA)(s,o);return(0,y.ZL)(r,O,y.hg,a,[e],o,this),i}}function Q(t,e,i){return Array.isArray(t)?t:"string"==typeof t?Q(i[t],e,i):e}function tt(t){const e=(0,y.Ve)(t,!1),i=/^\s*#?\s*([0-9A-Fa-f]{8})\s*$/.exec(e);if(i){const t=i[1];return[parseInt(t.substr(6,2),16),parseInt(t.substr(4,2),16),parseInt(t.substr(2,2),16),parseInt(t.substr(0,2),16)/255]}}function et(t){let e=(0,y.Ve)(t,!1);const i=[];e=e.replace(/\s*,\s*/g,",");const n=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?),([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|,|$)(?:([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)(?:\s+|$))?\s*/i;let r;for(;r=n.exec(e);){const t=parseFloat(r[1]),n=parseFloat(r[2]),s=r[3]?parseFloat(r[3]):0;i.push(t,n,s),e=e.substr(r[0].length)}if(""===e)return i}function it(t){const e=(0,y.Ve)(t,!1).trim();let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function nt(t){const e=(0,y.Ve)(t,!1).trim().replace(/^(?!.*#)/,"#");let i=t.baseURI;if(i&&"about:blank"!=i||(i=window.location.href),i){return new URL(e,i).href}return e}function rt(t){return(0,b.fy)(t)}const st=(0,y.C5)(T,{Pair:function(t,e){const i=(0,y.O)({},Ot,t,e,this);if(!i)return;const n=i.key;if(n&&"normal"==n){const t=i.styleUrl;t&&(e[e.length-1]=t);const n=i.Style;n&&(e[e.length-1]=n)}}});function ot(t,e){return(0,y.O)(void 0,st,t,e,this)}const at=(0,y.C5)(T,{Icon:(0,y.Pr)((function(t,e){const i=(0,y.O)({},mt,t,e);if(i)return i;return null})),color:(0,y.Pr)(tt),heading:(0,y.Pr)(b.fy),hotSpot:(0,y.Pr)((function(t){const e=t.getAttribute("xunits"),i=t.getAttribute("yunits");let n;return n="insetPixels"!==e?"insetPixels"!==i?"bottom-left":"top-left":"insetPixels"!==i?"bottom-right":"top-right",{x:parseFloat(t.getAttribute("x")),xunits:M[e],y:parseFloat(t.getAttribute("y")),yunits:M[i],origin:n}})),scale:(0,y.Pr)(rt)});const lt=(0,y.C5)(T,{color:(0,y.Pr)(tt),scale:(0,y.Pr)(rt)});const ht=(0,y.C5)(T,{color:(0,y.Pr)(tt),width:(0,y.Pr)(b.fy)});const ut=(0,y.C5)(T,{color:(0,y.Pr)(tt),fill:(0,y.Pr)(b.ud),outline:(0,y.Pr)(b.ud)});const ct=(0,y.C5)(T,{coordinates:(0,y.z)(et)});function dt(t,e){return(0,y.O)(null,ct,t,e)}const ft=(0,y.C5)(C,{Track:(0,y.Ei)(pt)});const gt=(0,y.C5)(T,{when:function(t,e){const i=e[e.length-1].whens,n=(0,y.Ve)(t,!1),r=Date.parse(n);i.push(isNaN(r)?0:r)}},(0,y.C5)(C,{coord:function(t,e){const i=e[e.length-1].coordinates,n=(0,y.Ve)(t,!1),r=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(r){const t=parseFloat(r[1]),e=parseFloat(r[2]),n=parseFloat(r[3]);i.push([t,e,n])}else i.push([])}}));function pt(t,e){const i=(0,y.O)({coordinates:[],whens:[]},gt,t,e);if(!i)return;const n=[],r=i.coordinates,s=i.whens;for(let t=0,e=Math.min(r.length,s.length);t0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=(0,y.O)(void 0,Gt,t,e);if(i){e[e.length-1][0]=i}}});function Tt(t,e){const i=(0,y.O)({},xt,t,e),n=(0,y.O)([null],Ct,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,r=n.length;i0;let l;const h=r.href;let u,c,d;h?l=h:s&&(l=z);let f="bottom-left";const g=i.hotSpot;let p;g?(u=[g.x,g.y],c=g.xunits,d=g.yunits,f=g.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(l)&&(l.includes("pushpin")?(u=k,c=D,d=N):l.includes("arrow-reverse")?(u=[54,42],c=D,d=N):l.includes("paddle")&&(u=[32,1],c=D,d=N));const m=r.x,_=r.y;let x;void 0!==m&&void 0!==_&&(p=[m,_]);const v=r.w,E=r.h;let b;void 0!==v&&void 0!==E&&(x=[v,E]);const S=i.heading;void 0!==S&&(b=(0,w.Yr)(S));const C=i.scale,T=i.color;if(s){l==z&&(x=G);const t=new o.Z({anchor:u,anchorOrigin:f,anchorXUnits:c,anchorYUnits:d,crossOrigin:this.crossOrigin_,offset:p,offsetOrigin:"bottom-left",rotation:b,scale:C,size:x,src:this.iconUrlFunction_(l),color:T}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===a.Z.IDLE||i===a.Z.LOADING){const n=function(){const i=t.getImageState();if(i!==a.Z.IDLE&&i!==a.Z.LOADING){const i=t.getSize();if(i&&2==i.length){const n=H(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===a.Z.IDLE&&t.load()}}else if(2==i.length){const n=H(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=U},LabelStyle:function(t,e){const i=(0,y.O)({},lt,t,e);if(!i)return;const n=e[e.length-1],s=new m.Z({fill:new r.Z({color:"color"in i?i.color:Z}),scale:i.scale});n.textStyle=s},LineStyle:function(t,e){const i=(0,y.O)({},ht,t,e);if(!i)return;const n=e[e.length-1],r=new g.Z({color:"color"in i?i.color:Z,width:"width"in i?i.width:1});n.strokeStyle=r},PolyStyle:function(t,e){const i=(0,y.O)({},ut,t,e);if(!i)return;const n=e[e.length-1],s=new r.Z({color:"color"in i?i.color:Z});n.fillStyle=s;const o=i.fill;void 0!==o&&(n.fill=o);const a=i.outline;void 0!==a&&(n.outline=a)}});function Pt(t,e){const i=(0,y.O)({},Mt,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:j;const r=i.fill;let o;void 0===r||r||(n=null),"imageStyle"in i?i.imageStyle!=U&&(o=i.imageStyle):o=B;const a="textStyle"in i?i.textStyle:X,l="strokeStyle"in i?i.strokeStyle:V,h=i.outline;return void 0===h||h?[new p.ZP({fill:n,image:o,stroke:l,text:a,zIndex:void 0})]:[new p.ZP({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){const t=e;return new s.Z(t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:o,stroke:l,text:a,zIndex:void 0}),new p.ZP({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){const t=e;return new s.Z(t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})))}if("Polygon"===i||"MultiPolygon"===i)return e},fill:n,stroke:null,zIndex:void 0})]}function Rt(t,e){const i=e.length,n=new Array(e.length),r=new Array(e.length),s=new Array(e.length);let o,a,l;o=!1,a=!1,l=!1;for(let t=0;t0){const t={names:o,values:(0,y.RA)(r,o)};(0,y.ZL)(n,ue,de,[t],i)}const c=i[0];let d=e.getGeometry();d&&(d=(0,S.fI)(d,!0,c)),(0,y.ZL)(n,ue,ee,[d],i)}const ge=(0,y.C5)(T,["extrude","tessellate","altitudeMode","coordinates"]),pe=(0,y.C5)(T,{extrude:(0,y.A4)(b.Vi),tessellate:(0,y.A4)(b.Vi),altitudeMode:(0,y.A4)(b.bZ),coordinates:(0,y.A4)((function(t,e,i){const n=i[i.length-1],r=n.layout,s=n.stride;let o;if("XY"==r||"XYM"==r)o=2;else{if("XYZ"!=r&&"XYZM"!=r)throw new Error("Invalid geometry layout");o=3}const a=e.length;let l="";if(a>0){l+=e[0];for(let t=1;t>3}if(o--,1===s||2===s)a+=t.readSVarint(),l+=t.readSVarint(),1===s&&h>u&&(n.push(h),u=h),i.push(a,l),h+=2;else{if(7!==s)throw new Error("Invalid command found in the PBF");h>u&&(i.push(i[u],i[u+1]),h+=2)}}h>u&&(n.push(h),u=h)}createFeature_(t,e,i){const l=e.type;if(0===l)return null;let c;const f=e.properties;let p;this.idProperty_?(p=f[this.idProperty_],delete f[this.idProperty_]):p=e.id,f[this.layerName_]=e.layer.name;const m=[],_=[];this.readRawGeometry_(t,e,m,_);const y=function(t,e){let i;1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon");return i}(l,_.length);if(this.featureClass_===d.ZP)c=new this.featureClass_(y,m,_,2,f,p),c.transform(i.dataProjection);else{let t;if("Polygon"==y){const e=(0,g.Q3)(m,_);t=e.length>1?new a.Z(m,"XY",e):new u.ZP(m,"XY",_)}else t="Point"===y?new h.Z(m,"XY"):"LineString"===y?new r.Z(m,"XY"):"MultiPoint"===y?new o.Z(m,"XY"):"MultiLineString"===y?new s.Z(m,"XY",_):null;c=new(0,this.featureClass_),this.geometryName_&&c.setGeometryName(this.geometryName_);const e=(0,n.fI)(t,!1,i);c.setGeometry(e),void 0!==p&&c.setId(p),c.setProperties(f,!0)}return c}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_;e=this.adaptOptions(e);const n=(0,f.U2)(e.dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const r=new l(t),s=r.readFields(m,{}),o=[];for(const t in s){if(i&&!i.includes(t))continue;const a=s[t],l=a?[0,0,a.extent,a.extent]:null;n.setExtent(l);for(let t=0,i=a.length;t>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint64():5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(n)}}function y(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e=0;--e)i.push(t[e].slice(0))}return i}function m(t,e,i,n,r,s,o){const a=t.geometries,l=[];for(let t=0,h=a.length;t="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=x;else if(","==t)i=b;else if(")"==t)i=v;else if(this.isNumeric_(t)||"-"==t)i=E,n=this.readNumber_();else if(this.isAlpha_(t))i=y,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=w}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class T{constructor(t){this.lexer_=t,this.token_={position:0,type:_},this.layout_="XY"}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(y)){const i=e.value;i===p?t="XYZ":i===m?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(x)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(b));if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(x)){const t=this.parsePoint_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(x)){const t=this.parsePointList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(x)){const t=this.parseLineStringTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(x)){let t;if(t=this.token_.type==x?this.parsePointTextList_():this.parsePointList_(),this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(x)){const t=this.parseLineStringTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(x)){const t=this.parsePolygonTextList_();if(this.match(v))return t}throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;i0&&(n+=" "+e)}return 0===i.length?n+" "+g:n+"("+i+")"}e.Z=M},23120:function(t,e,i){"use strict";i.d(e,{Z:function(){return j}});var n=i(33799),r=i(31990),s=i(75125),o=i(96683);const a=[null,"http://www.opengis.net/ows/1.1"],l=(0,r.C5)(a,{ServiceIdentification:(0,r.Pr)((function(t,e){return(0,r.O)({},E,t,e)})),ServiceProvider:(0,r.Pr)((function(t,e){return(0,r.O)({},b,t,e)})),OperationsMetadata:(0,r.Pr)((function(t,e){return(0,r.O)({},_,t,e)}))});class h extends n.Z{constructor(){super()}readFromNode(t){const e=(0,r.O)({},l,t,[]);return e||null}}const u=(0,r.C5)(a,{DeliveryPoint:(0,r.Pr)(o.s2),City:(0,r.Pr)(o.s2),AdministrativeArea:(0,r.Pr)(o.s2),PostalCode:(0,r.Pr)(o.s2),Country:(0,r.Pr)(o.s2),ElectronicMailAddress:(0,r.Pr)(o.s2)}),c=(0,r.C5)(a,{Value:(0,r.ke)((function(t,e){return(0,o.s2)(t)}))}),d=(0,r.C5)(a,{AllowedValues:(0,r.Pr)((function(t,e){return(0,r.O)({},c,t,e)}))}),f=(0,r.C5)(a,{Phone:(0,r.Pr)((function(t,e){return(0,r.O)({},y,t,e)})),Address:(0,r.Pr)((function(t,e){return(0,r.O)({},u,t,e)}))}),g=(0,r.C5)(a,{HTTP:(0,r.Pr)((function(t,e){return(0,r.O)({},p,t,e)}))}),p=(0,r.C5)(a,{Get:(0,r.ke)((function(t,e){const i=(0,s.Q)(t);if(!i)return;return(0,r.O)({href:i},x,t,e)})),Post:void 0}),m=(0,r.C5)(a,{DCP:(0,r.Pr)((function(t,e){return(0,r.O)({},g,t,e)}))}),_=(0,r.C5)(a,{Operation:function(t,e){const i=t.getAttribute("name"),n=(0,r.O)({},m,t,e);if(!n)return;e[e.length-1][i]=n}}),y=(0,r.C5)(a,{Voice:(0,r.Pr)(o.s2),Facsimile:(0,r.Pr)(o.s2)}),x=(0,r.C5)(a,{Constraint:(0,r.ke)((function(t,e){const i=t.getAttribute("name");if(!i)return;return(0,r.O)({name:i},d,t,e)}))}),v=(0,r.C5)(a,{IndividualName:(0,r.Pr)(o.s2),PositionName:(0,r.Pr)(o.s2),ContactInfo:(0,r.Pr)((function(t,e){return(0,r.O)({},f,t,e)}))}),E=(0,r.C5)(a,{Abstract:(0,r.Pr)(o.s2),AccessConstraints:(0,r.Pr)(o.s2),Fees:(0,r.Pr)(o.s2),Title:(0,r.Pr)(o.s2),ServiceTypeVersion:(0,r.Pr)(o.s2),ServiceType:(0,r.Pr)(o.s2)}),b=(0,r.C5)(a,{ProviderName:(0,r.Pr)(o.s2),ProviderSite:(0,r.Pr)(s.Q),ServiceContact:(0,r.Pr)((function(t,e){return(0,r.O)({},v,t,e)}))});var w=h,S=i(36117);const C=[null,"http://www.opengis.net/wmts/1.0"],T=[null,"http://www.opengis.net/ows/1.1"],M=(0,r.C5)(C,{Contents:(0,r.Pr)((function(t,e){return(0,r.O)({},R,t,e)}))});class P extends n.Z{constructor(){super(),this.owsParser_=new w}readFromNode(t){let e=t.getAttribute("version");e&&(e=e.trim());let i=this.owsParser_.readFromNode(t);return i?(i.version=e,i=(0,r.O)(i,M,t,[]),i||null):null}}const R=(0,r.C5)(C,{Layer:(0,r.ke)((function(t,e){return(0,r.O)({},I,t,e)})),TileMatrixSet:(0,r.ke)((function(t,e){return(0,r.O)({},D,t,e)}))}),I=(0,r.C5)(C,{Style:(0,r.ke)((function(t,e){const i=(0,r.O)({},A,t,e);if(!i)return;const n="true"===t.getAttribute("isDefault");return i.isDefault=n,i})),Format:(0,r.ke)(o.s2),TileMatrixSetLink:(0,r.ke)((function(t,e){return(0,r.O)({},L,t,e)})),Dimension:(0,r.ke)((function(t,e){return(0,r.O)({},Z,t,e)})),ResourceURL:(0,r.ke)((function(t,e){const i=t.getAttribute("format"),n=t.getAttribute("template"),r=t.getAttribute("resourceType"),s={};i&&(s.format=i);n&&(s.template=n);r&&(s.resourceType=r);return s}))},(0,r.C5)(T,{Title:(0,r.Pr)(o.s2),Abstract:(0,r.Pr)(o.s2),WGS84BoundingBox:(0,r.Pr)(G),Identifier:(0,r.Pr)(o.s2)})),A=(0,r.C5)(C,{LegendURL:(0,r.ke)((function(t,e){const i={};return i.format=t.getAttribute("format"),i.href=(0,s.Q)(t),i}))},(0,r.C5)(T,{Title:(0,r.Pr)(o.s2),Identifier:(0,r.Pr)(o.s2)})),L=(0,r.C5)(C,{TileMatrixSet:(0,r.Pr)(o.s2),TileMatrixSetLimits:(0,r.Pr)((function(t,e){return(0,r.O)([],F,t,e)}))}),F=(0,r.C5)(C,{TileMatrixLimits:(0,r.Ei)((function(t,e){return(0,r.O)({},O,t,e)}))}),O=(0,r.C5)(C,{TileMatrix:(0,r.Pr)(o.s2),MinTileRow:(0,r.Pr)(o.$L),MaxTileRow:(0,r.Pr)(o.$L),MinTileCol:(0,r.Pr)(o.$L),MaxTileCol:(0,r.Pr)(o.$L)}),Z=(0,r.C5)(C,{Default:(0,r.Pr)(o.s2),Value:(0,r.ke)(o.s2)},(0,r.C5)(T,{Identifier:(0,r.Pr)(o.s2)})),k=(0,r.C5)(T,{LowerCorner:(0,r.Ei)(z),UpperCorner:(0,r.Ei)(z)}),D=(0,r.C5)(C,{WellKnownScaleSet:(0,r.Pr)(o.s2),TileMatrix:(0,r.ke)((function(t,e){return(0,r.O)({},N,t,e)}))},(0,r.C5)(T,{SupportedCRS:(0,r.Pr)(o.s2),Identifier:(0,r.Pr)(o.s2),BoundingBox:(0,r.Pr)(G)})),N=(0,r.C5)(C,{TopLeftCorner:(0,r.Pr)(z),ScaleDenominator:(0,r.Pr)(o.fy),TileWidth:(0,r.Pr)(o.$L),TileHeight:(0,r.Pr)(o.$L),MatrixWidth:(0,r.Pr)(o.$L),MatrixHeight:(0,r.Pr)(o.$L)},(0,r.C5)(T,{Identifier:(0,r.Pr)(o.s2)}));function G(t,e){const i=(0,r.O)([],k,t,e);if(2==i.length)return(0,S.hI)(i)}function z(t,e){const i=(0,o.s2)(t).split(/\s+/);if(!i||2!=i.length)return;const n=+i[0],r=+i[1];return isNaN(n)||isNaN(r)?void 0:[n,r]}var j=P},33799:function(t,e,i){"use strict";var n=i(22765),r=i(31990);e.Z=class{read(t){if(!t)return null;if("string"==typeof t){const e=(0,r.Qc)(t);return this.readFromDocument(e)}return(0,r.qk)(t)?this.readFromDocument(t):this.readFromNode(t)}readFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFromNode(e);return null}readFromNode(t){(0,n.O3)()}}},96148:function(t,e,i){"use strict";var n=i(15113),r=i(22765),s=i(17367),o=i(31990);class a extends n.ZP{constructor(){super(),this.xmlSerializer_=(0,o.xc)()}getType(){return"xml"}readFeature(t,e){if(!t)return null;if("string"==typeof t){const i=(0,o.Qc)(t);return this.readFeatureFromDocument(i,e)}return(0,o.qk)(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}readFeatureFromDocument(t,e){const i=this.readFeaturesFromDocument(t,e);return i.length>0?i[0]:null}readFeatureFromNode(t,e){return null}readFeatures(t,e){if(!t)return[];if("string"==typeof t){const i=(0,o.Qc)(t);return this.readFeaturesFromDocument(i,e)}return(0,o.qk)(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&(0,s.l7)(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(t,e){return(0,r.O3)()}readGeometry(t,e){if(!t)return null;if("string"==typeof t){const i=(0,o.Qc)(t);return this.readGeometryFromDocument(i,e)}return(0,o.qk)(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(!t)return null;if("string"==typeof t){const e=(0,o.Qc)(t);return this.readProjectionFromDocument(e)}return(0,o.qk)(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.xmlSerializer_.serializeToString(i)}writeGeometryNode(t,e){return null}}e.Z=a},75125:function(t,e,i){"use strict";i.d(e,{Q:function(){return r}});const n="http://www.w3.org/1999/xlink";function r(t){return t.getAttributeNS(n,"href")}},96683:function(t,e,i){"use strict";i.d(e,{$L:function(){return u},JD:function(){return _},Vi:function(){return f},_E:function(){return c},bZ:function(){return y},ej:function(){return h},f3:function(){return m},fy:function(){return l},hv:function(){return p},s2:function(){return d},ud:function(){return s},v$:function(){return o},x7:function(){return a},xO:function(){return g}});var n=i(31990),r=i(84441);function s(t){return o((0,n.Ve)(t,!1))}function o(t){const e=/^\s*(true|1)|(false|0)\s*$/.exec(t);if(e)return void 0!==e[1]||!1}function a(t){const e=(0,n.Ve)(t,!1),i=Date.parse(e);return isNaN(i)?void 0:i/1e3}function l(t){return h((0,n.Ve)(t,!1))}function h(t){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);if(e)return parseFloat(e[1])}function u(t){return c((0,n.Ve)(t,!1))}function c(t){const e=/^\s*(\d+)\s*$/.exec(t);if(e)return parseInt(e[1],10)}function d(t){return(0,n.Ve)(t,!1).trim()}function f(t,e){y(t,e?"1":"0")}function g(t,e){t.appendChild((0,n.Me)().createCDATASection(e))}function p(t,e){const i=new Date(1e3*e),s=i.getUTCFullYear()+"-"+(0,r.v)(i.getUTCMonth()+1,2)+"-"+(0,r.v)(i.getUTCDate(),2)+"T"+(0,r.v)(i.getUTCHours(),2)+":"+(0,r.v)(i.getUTCMinutes(),2)+":"+(0,r.v)(i.getUTCSeconds(),2)+"Z";t.appendChild((0,n.Me)().createTextNode(s))}function m(t,e){const i=e.toPrecision();t.appendChild((0,n.Me)().createTextNode(i))}function _(t,e){const i=e.toString();t.appendChild((0,n.Me)().createTextNode(i))}function y(t,e){t.appendChild((0,n.Me)().createTextNode(e))}},79407:function(t,e,i){"use strict";i.d(e,{Dv:function(){return s},Vi:function(){return l},Zn:function(){return o},qe:function(){return a},uX:function(){return r}});var n=i(17367);function r(){return!0}function s(){return!1}function o(){}function a(t){let e,i,r,s=!1;return function(){const o=Array.prototype.slice.call(arguments);return s&&this===r&&(0,n.fS)(o,i)||(s=!0,r=this,i=o,e=t.apply(this,arguments)),e}}function l(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}},83735:function(t,e,i){"use strict";var n=i(75531),r=i(36117),s=i(61734),o=i(11570);class a extends n.ZP{constructor(t,e,i){super(),void 0!==i&&void 0===e?this.setFlatCoordinates(i,t):(e=e||0,this.setCenterAndRadius(t,e,i))}clone(){const t=new a(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const r=this.flatCoordinates,s=t-r[0],o=e-r[1],a=s*s+o*o;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||(0,r.H6)(t,this.intersectsCoordinate.bind(this)))}return!1}setCenter(t){const e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(let i=1;i{if(!i)return this.getSimplifiedGeometry(e);const n=this.clone();return n.applyTransform(i),n.getSimplifiedGeometry(e)}))}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return(0,r.O3)()}closestPointXY(t,e,i,n){return(0,r.O3)()}containsXY(t,e){const i=this.getClosestPoint([t,e]);return i[0]===t&&i[1]===e}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return(0,r.O3)()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&(0,o.YN)(t),this.extentRevision_=this.getRevision()}return(0,o.EO)(this.extent_,t)}rotate(t,e){(0,r.O3)()}scale(t,e,i){(0,r.O3)()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return(0,r.O3)()}getType(){return(0,r.O3)()}applyTransform(t){(0,r.O3)()}intersectsExtent(t){return(0,r.O3)()}translate(t,e){(0,r.O3)()}transform(t,e){const i=(0,a.U2)(t),n="tile-pixels"==i.getUnits()?function(t,n,r){const l=i.getExtent(),c=i.getWorldExtent(),d=(0,o.Cr)(c)/(0,o.Cr)(l);return(0,s.qC)(u,c[0],c[3],d,-d,0,0,0),(0,h.vT)(t,0,t.length,r,u,n),(0,a.Ck)(i,e)(t,n,r)}:(0,a.Ck)(i,e);return this.applyTransform(n),this}}e.Z=c},54017:function(t,e,i){"use strict";var n=i(92486),r=i(2667),s=i(36117),o=i(41507);class a extends r.Z{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(o.bN),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;et.clone()))}e.Z=a},15925:function(t,e,i){"use strict";var n=i(75531),r=i(32150),s=i(36117),o=i(61734),a=i(67775),l=i(17367),h=i(47511),u=i(2083),c=i(74985),d=i(85473),f=i(14071);class g extends n.ZP{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){(0,l.l7)(this.flatCoordinates,t),this.changed()}clone(){const t=new g(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<(0,s.qf)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.Bv)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.H$)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,n))}forEachSegment(t){return(0,h.E)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinateAtM(t,e){return"XYM"!=this.layout&&"XYZM"!=this.layout?null:(e=void 0!==e&&e,(0,c.iJ)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return(0,u.Ml)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return(0,c.WW)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return(0,f.W)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.dt)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new g(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return(0,d.Kz)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.Sg)(this.flatCoordinates,0,t,this.stride),this.changed()}}e.Z=g},73479:function(t,e,i){"use strict";var n=i(75531),r=i(32150),s=i(36117),o=i(61734),a=i(67775),l=i(2083),h=i(85749);class u extends n.ZP{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new u(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<(0,s.qf)(this.getExtent(),t,e)?n:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt((0,r.Bv)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),(0,r.H$)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,n))}getArea(){return(0,h.QQ)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return(0,l.Ml)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=(0,a.dt)(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new u(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=(0,o.Sg)(this.flatCoordinates,0,t,this.stride),this.changed()}}e.Z=u},54729:function(t,e,i){"use strict";var n=i(15925),r=i(75531),s=i(32150),o=i(36117),a=i(61734),l=i(67775),h=i(17367),u=i(2083),c=i(74985),d=i(85473);class f extends r.ZP{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],n=[];for(let t=0,r=e.length;t1)d=i;else{if(f>0){for(let s=0;ss&&(s=l),o=i,a=r}return s}function o(t,e,i,n,r){for(let o=0,a=i.length;os&&(i-a)*(s-l)-(r-a)*(n-l)>0&&o++:n<=s&&(i-a)*(s-l)-(r-a)*(n-l)<0&&o--,a=i,l=n}return 0!==o}function o(t,e,i,n,r,o){if(0===i.length)return!1;if(!s(t,e,i[0],n,r,o))return!1;for(let e=1,a=i.length;ex&&(c=(d+f)/2,(0,r.wY)(t,e,i,s,c,m)&&(y=c,x=n)),d=f}return isNaN(y)&&(y=o[a]),l?(l.push(y,m,x),l):[y,m,x]}function o(t,e,i,n,r){let o=[];for(let a=0,l=i.length;a1?l:2,a=a||new Array(l);for(let e=0;e>1;s=o[0]&&a[2]<=o[2]||(a[1]>=o[1]&&a[3]<=o[3]||(0,r.E)(t,e,i,s,(function(t,e){return(0,n.I7)(o,t,e)})))))}function a(t,e,i,n,r){for(let s=0,a=i.length;s0}function s(t,e,i,n,s){s=void 0!==s&&s;for(let o=0,a=i.length;o0;){const i=u.pop(),o=u.pop();let a=0;const l=t[o],d=t[o+1],f=t[i],g=t[i+1];for(let e=o+r;ea&&(c=e,a=s)}a>s&&(h[(c-e)/r]=1,o+r0&&p>f)&&(g<0&&m0&&m>g)?(l=i,h=d):(s[a++]=l,s[a++]=h,u=l,c=h,l=i,h=d)}return s[a++]=l,s[a++]=h,a}function l(t,e,i,n,r,s,o,l){for(let h=0,u=i.length;h0){this.source_&&(this.source_.clear(),this.source_.addFeatures(l)),this.dispatchEvent(new u(h,t,l,s));break}}}registerListeners_(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.dropListenKeys_=[(0,l.oL)(e,r.Z.DROP,this.handleDrop,this),(0,l.oL)(e,r.Z.DRAGENTER,this.handleStop,this),(0,l.oL)(e,r.Z.DRAGOVER,this.handleStop,this),(0,l.oL)(e,r.Z.DROP,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.registerListeners_(),this.getActive()&&!t&&this.unregisterListeners_(),super.setActive(t)}setMap(t){this.unregisterListeners_(),super.setMap(t),this.getActive()&&this.registerListeners_()}tryReadFeatures_(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}}unregisterListeners_(){this.dropListenKeys_&&(this.dropListenKeys_.forEach(l.bN),this.dropListenKeys_=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new g(c,t.coordinate,t))}handleUpEvent(t){this.box_.setMap(null);const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new g(e?d:f,t.coordinate,t)),!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new g(u,t.coordinate,t)),!0)}onBoxEnd(t){}}var m=p},35688:function(t,e,i){"use strict";var n=i(53382),r=i(79407),s=i(94142),o=i(70076),a=i(19775);class l extends n.Z{constructor(t){super({stopDown:r.Dv}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:(0,s.$6)(s.rM,s.Xp);this.condition_=t.onFocusOnly?(0,s.$6)(s.yZ,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,r=e.getEventPixel((0,n.S)(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){const e=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],i=t.map.getView();(0,a.bA)(e,i.getResolution()),(0,a.U1)(e,i.getRotation()),i.adjustCenterInternal(e)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),n=this.kinetic_.getAngle(),r=i.getCenterInternal(),s=e.getPixelFromCoordinateInternal(r),a=e.getCoordinateFromPixelInternal([s[0]-t*Math.cos(n),s[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(a),duration:500,easing:o.Vv})}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}e.Z=l},18930:function(t,e,i){"use strict";var n=i(53382),r=i(94142);class s extends n.Z{constructor(t){super(t=t||{}),this.condition_=t.condition?t.condition:r.vY,this.lastAngle_=void 0,this.lastMagnitude_=void 0,this.lastScaleDelta_=0,this.duration_=void 0!==t.duration?t.duration:400}handleDragEvent(t){if(!(0,r.QL)(t))return;const e=t.map,i=e.getSize(),n=t.pixel,s=n[0]-i[0]/2,o=i[1]/2-n[1],a=Math.atan2(o,s),l=Math.sqrt(s*s+o*o),h=e.getView();if(void 0!==this.lastAngle_){const t=this.lastAngle_-a;h.adjustRotationInternal(t)}this.lastAngle_=a,void 0!==this.lastMagnitude_&&h.adjustResolutionInternal(this.lastMagnitude_/l),void 0!==this.lastMagnitude_&&(this.lastScaleDelta_=this.lastMagnitude_/l),this.lastMagnitude_=l}handleUpEvent(t){if(!(0,r.QL)(t))return!0;const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),this.lastScaleDelta_=0,!1}handleDownEvent(t){return!!(0,r.QL)(t)&&(!!this.condition_(t)&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,this.lastMagnitude_=void 0,!0))}}e.Z=s},59066:function(t,e,i){"use strict";i.d(e,{N_:function(){return B},dO:function(){return q}});var n=i(83735),r=i(6747),s=i(92486),o=i(79619),a=i(54017),l=i(1370),h=i(15925),u=i(84184),c=i(87556),d=i(54729),f=i(16667),g=i(58105),p=i(47051),m=i(53382),_=i(23814),y=i(1733),x=i(4711),v=i(79407),E=i(94142),b=i(36117),w=i(63312),S=i(80677),C=i(19775),T=i(81625),M=i(75531);const P="drawstart",R="drawend",I="drawabort";class A extends r.ZP{constructor(t,e){super(t),this.feature=e}}function L(t,e){return(0,w.bI)(t[0],t[1],e[0],e[1])}function F(t,e){const i=t.length;return e<0?t[e+i]:e>=i?t[e-i]:t[e]}function O(t,e,i){let n,r;eo){return L(z(t,n),z(t,r))}let a=0;if(n=i?n-=i:n<0&&(n+=i);let s=n+1;s>=i&&(s-=i);const o=t[n],a=o[0],l=o[1],h=t[s];return[a+(h[0]-a)*r,l+(h[1]-l)*r]}class j extends m.Z{constructor(t){const e=t;e.stopDown||(e.stopDown=v.Dv),super(e),this.on,this.once,this.un,this.shouldHandle_=!1,this.downPx_=null,this.downTimeout_,this.lastDragTime_,this.pointerType_,this.freehand_=!1,this.source_=t.source?t.source:null,this.features_=t.features?t.features:null,this.snapTolerance_=t.snapTolerance?t.snapTolerance:12,this.type_=t.type,this.mode_=function(t){switch(t){case"Point":case"MultiPoint":return"Point";case"LineString":case"MultiLineString":return"LineString";case"Polygon":case"MultiPolygon":return"Polygon";case"Circle":return"Circle";default:throw new Error("Invalid type: "+t)}}(this.type_),this.stopClick_=!!t.stopClick,this.minPoints_=t.minPoints?t.minPoints:"Polygon"===this.mode_?3:2,this.maxPoints_="Circle"===this.mode_?2:t.maxPoints?t.maxPoints:1/0,this.finishCondition_=t.finishCondition?t.finishCondition:v.uX,this.geometryLayout_=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.mode_;if("Circle"===t)i=function(t,e,i){const r=e||new n.Z([NaN,NaN]),s=(0,T.Vs)(t[0],i),o=(0,C.bI)(s,(0,T.Vs)(t[t.length-1],i));r.setCenterAndRadius(s,Math.sqrt(o),this.geometryLayout_);const a=(0,T.Cs)();return a&&r.transform(i,a),r};else{let e;"Point"===t?e=p.Z:"LineString"===t?e=h.Z:"Polygon"===t&&(e=_.ZP),i=function(i,n,r){return n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.geometryLayout_):n.setCoordinates([],this.geometryLayout_):n.setCoordinates(i,this.geometryLayout_):n=new e(i,this.geometryLayout_),n}}}this.geometryFunction_=i,this.dragVertexDelay_=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.finishCoordinate_=null,this.sketchFeature_=null,this.sketchPoint_=null,this.sketchCoords_=null,this.sketchLine_=null,this.sketchLineCoords_=null,this.squaredClickTolerance_=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.overlay_=new y.Z({source:new x.Z({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:U(),updateWhileInteracting:!0}),this.geometryName_=t.geometryName,this.condition_=t.condition?t.condition:E.rM,this.freehandCondition_,t.freehand?this.freehandCondition_=E.Bx:this.freehandCondition_=t.freehandCondition?t.freehandCondition:E.vY,this.traceCondition_,this.setTrace(t.trace||!1),this.traceState_={active:!1},this.traceSource_=t.traceSource||t.source||null,this.addChangeListener(l.Z.ACTIVE,this.updateState_)}setTrace(t){let e;e=t?!0===t?E.Bx:t:E.Fi,this.traceCondition_=e}setMap(t){super.setMap(t),this.updateState_()}getOverlay(){return this.overlay_}handleEvent(t){t.originalEvent.type===s.Z.CONTEXTMENU&&t.originalEvent.preventDefault(),this.freehand_="Point"!==this.mode_&&this.freehandCondition_(t);let e=t.type===c.Z.POINTERMOVE,i=!0;if(!this.freehand_&&this.lastDragTime_&&t.type===c.Z.POINTERDRAG){Date.now()-this.lastDragTime_>=this.dragVertexDelay_?(this.downPx_=t.pixel,this.shouldHandle_=!this.freehand_,e=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0)}return this.freehand_&&t.type===c.Z.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(t.coordinate),i=!1):this.freehand_&&t.type===c.Z.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===c.Z.POINTERMOVE,i&&this.freehand_?(this.handlePointerMove_(t),this.shouldHandle_&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===c.Z.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(t)):t.type===c.Z.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t.coordinate),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout((()=>{this.handlePointerMove_(new u.Z(c.Z.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)}deactivateTrace_(){this.traceState_={active:!1}}toggleTraceState_(t){if(!this.traceSource_||!this.traceCondition_(t))return;if(this.traceState_.active)return void this.deactivateTrace_();const e=this.getMap(),i=e.getCoordinateFromPixel([t.pixel[0]-this.snapTolerance_,t.pixel[1]+this.snapTolerance_]),n=e.getCoordinateFromPixel([t.pixel[0]+this.snapTolerance_,t.pixel[1]-this.snapTolerance_]),r=(0,b.hI)([i,n]),s=this.traceSource_.getFeaturesInExtent(r);if(0===s.length)return;const o=function(t,e){const i=[];for(let n=0;nt.endIndex||!i&&et.endIndex)&&this.removeTracedCoordinates_(e,t.endIndex):(this.removeTracedCoordinates_(t.startIndex,t.endIndex),this.addTracedCoordinates_(t,t.startIndex,e))}removeTracedCoordinates_(t,e){if(t===e)return;let i=0;if(t0&&this.removeLastPoints_(i)}addTracedCoordinates_(t,e,i){if(e===i)return;const n=[];if(e=s;--e)n.push(F(t.coordinates,e))}n.length&&this.appendCoordinates(n)}updateTrace_(t){const e=this.traceState_;if(!e.active)return;if(-1===e.targetIndex&&(0,C.TE)(e.startPx,t.pixel)i.startIndex?hi.startIndex&&(h-=n.length)),l=h,a=t)}const h=e.targets[a];let u=h.ring;if(e.targetIndex===a&&u){const t=z(h.coordinates,l),r=i.getPixelFromCoordinate(t);(0,C.TE)(r,e.startPx)>n&&(u=!1)}if(u){const t=h.coordinates,e=t.length,i=h.startIndex,n=l;if(ithis.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?(this.updateTrace_(t),this.modifyDrawing_(t.coordinate)):this.createOrUpdateSketchPoint_(t.coordinate.slice())}atFinish_(t,e){let i=!1;if(this.sketchFeature_){let n=!1,r=[this.finishCoordinate_];const s=this.mode_;if("Point"===s)i=!0;else if("Circle"===s)i=2===this.sketchCoords_.length;else if("LineString"===s)n=!e&&this.sketchCoords_.length>this.minPoints_;else if("Polygon"===s){const t=this.sketchCoords_;n=t[0].length>this.minPoints_,r=[t[0][0],t[0][t[0].length-2]],r=e?[t[0][0]]:[t[0][0],t[0][t[0].length-2]]}if(n){const e=this.getMap();for(let n=0,s=r.length;n=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),this.geometryFunction_(r,e,i)):"Polygon"===s&&(r=this.sketchCoords_[0],r.length>=this.maxPoints_&&(this.freehand_?r.pop():n=!0),r.push(t.slice()),n&&(this.finishCoordinate_=r[0]),this.geometryFunction_(this.sketchCoords_,e,i)),this.createOrUpdateSketchPoint_(t.slice()),this.updateSketchFeatures_(),n&&this.finishDrawing()}removeLastPoints_(t){if(!this.sketchFeature_)return;const e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection(),n=this.mode_;for(let r=0;r=2){this.finishCoordinate_=t[t.length-2].slice();const e=this.finishCoordinate_.slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}this.geometryFunction_(t,e,i),"Polygon"===e.getType()&&this.sketchLine_&&this.createOrUpdateCustomSketchLine_(e)}else if("Polygon"===n){t=this.sketchCoords_[0],t.splice(-2,1);const n=this.sketchLine_.getGeometry();if(t.length>=2){const e=t[t.length-2].slice();t[t.length-1]=e,this.createOrUpdateSketchPoint_(e)}n.setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)}if(1===t.length){this.abortDrawing();break}}this.updateSketchFeatures_()}removeLastPoint(){this.removeLastPoints_(1)}finishDrawing(){const t=this.abortDrawing_();if(!t)return;let e=this.sketchCoords_;const i=t.getGeometry(),n=this.getMap().getView().getProjection();"LineString"===this.mode_?(e.pop(),this.geometryFunction_(e,i,n)):"Polygon"===this.mode_&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.type_?t.setGeometry(new f.Z([e])):"MultiLineString"===this.type_?t.setGeometry(new d.Z([e])):"MultiPolygon"===this.type_&&t.setGeometry(new g.Z([e])),this.dispatchEvent(new A(R,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}abortDrawing_(){this.finishCoordinate_=null;const t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),this.deactivateTrace_(),t}abortDrawing(){const t=this.abortDrawing_();t&&this.dispatchEvent(new A(I,t))}appendCoordinates(t){const e=this.mode_,i=!this.sketchFeature_;let n;if(i&&this.startDrawing_(t[0]),"LineString"===e||"Circle"===e)n=this.sketchCoords_;else{if("Polygon"!==e)return;n=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]}i&&n.shift(),n.pop();for(let e=0;e(t[e]=!0,t)),{}),this.replace_=t.replace,this.prefix_=t.prefix,this.listenerKeys_=[],this.initial_=!0,this.updateState_=this.updateState_.bind(this),this.trackedCallbacks_={},this.trackedValues_={}}getParamName_(t){return this.prefix_?this.prefix_+t:t}get_(t,e){return t.get(this.getParamName_(e))}set_(t,e,i){e in this.params_&&t.set(this.getParamName_(e),i)}delete_(t,e){e in this.params_&&t.delete(this.getParamName_(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.unregisterListeners_(e),t&&(this.initial_=!0,this.updateState_(),this.registerListeners_(t)))}registerListeners_(t){this.listenerKeys_.push((0,o.oL)(t,s.Z.MOVEEND,this.updateUrl_,this),(0,o.oL)(t.getLayerGroup(),n.Z.CHANGE,this.updateUrl_,this),(0,o.oL)(t,"change:layergroup",this.handleChangeLayerGroup_,this)),this.replace_||addEventListener("popstate",this.updateState_)}unregisterListeners_(t){for(let t=0,e=this.listenerKeys_.length;t=0;--t){const n=i[t];for(let t=this.dragSegments_.length-1;t>=0;--t)this.dragSegments_[t][0]===n&&this.dragSegments_.splice(t,1);e.remove(n)}}setActive(t){this.vertexFeature_&&!t&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),super.setActive(t)}setMap(t){this.overlay_.setMap(t),super.setMap(t)}getOverlay(){return this.overlay_}handleSourceAdd_(t){t.feature&&this.features_.push(t.feature)}handleSourceRemove_(t){t.feature&&this.features_.remove(t.feature)}handleFeatureAdd_(t){this.addFeature_(t.element)}handleFeatureChange_(t){if(!this.changingFeature_){const e=t.target;this.removeFeature_(e),this.addFeature_(e)}}handleFeatureRemove_(t){this.removeFeature_(t.element)}writePointGeometry_(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)}writeMultiPointGeometry_(t,e){const i=e.getCoordinates();for(let n=0,r=i.length;n=0;--t)this.insertVertex_(r[t],s)}return!!this.vertexFeature_}handleUpEvent(t){for(let e=this.dragSegments_.length-1;e>=0;--e){const i=this.dragSegments_[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n.getCenter(),r=i.featureSegments[0],s=i.featureSegments[1];r.segment[0]=e,r.segment[1]=e,s.segment[0]=e,s.segment[1]=e,this.rBush_.update((0,m.HK)(e),r);let o=n;const a=(0,E.Cs)();if(a){const e=t.map.getView().getProjection();o=o.clone().transform(a,e),o=(0,v.Bb)(o).transform(e,a)}this.rBush_.update(o.getExtent(),s)}else this.rBush_.update((0,m.hI)(i.segment),i)}return this.featuresBeingModified_&&(this.dispatchEvent(new M(T,this.featuresBeingModified_,t)),this.featuresBeingModified_=null),!1}handlePointerMove_(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)}handlePointerAtPixel_(t,e,i){const n=i||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),s=function(t,e){return I(n,t,r)-I(n,e,r)};let o,l;if(this.hitDetection_){const i="object"==typeof this.hitDetection_?t=>t===this.hitDetection_:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{i&&"Point"===i.getType()&&(i=new h.Z((0,E.lO)(i.getCoordinates(),r)));const n=i||t.getGeometry();if(t instanceof a.Z&&this.features_.getArray().includes(t)){l=n;const e=t.getGeometry().getFlatCoordinates().slice(0,2);o=[{feature:t,geometry:l,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!o){const t=(0,E.dY)((0,m.HK)(n,w),r),i=e.getView().getResolution()*this.pixelTolerance_,s=(0,E.Fj)((0,m.f3)(t,i,w),r);o=this.rBush_.getInExtent(s)}if(o&&o.length>0){const i=o.sort(s)[0],a=i.segment;let h=A(n,i,r);const u=e.getPixelFromCoordinate(h);let c=(0,_.TE)(t,u);if(l||c<=this.pixelTolerance_){const t={};if(t[(0,b.sq)(a)]=!0,this.snapToPointer_||(this.delta_[0]=h[0]-n[0],this.delta_[1]=h[1]-n[1]),"Circle"===i.geometry.getType()&&1===i.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);else{const n=e.getPixelFromCoordinate(a[0]),r=e.getPixelFromCoordinate(a[1]),s=(0,_.bI)(u,n),l=(0,_.bI)(u,r);c=Math.sqrt(Math.min(s,l)),this.snappedToVertex_=c<=this.pixelTolerance_,this.snappedToVertex_&&(h=s>l?a[1]:a[0]),this.createOrUpdateVertexFeature_(h,[i.feature],[i.geometry]);const d={};d[(0,b.sq)(i.geometry)]=!0;for(let e=1,i=o.length;e=0;--o)r=t[o],c=r[0],d=(0,b.sq)(c.feature),c.depth&&(d+="-"+c.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=c,e[d].index=c.index):1==r[1]&&(e[d].left=c,e[d].index=c.index+1);for(d in e){switch(u=e[d].right,l=e[d].left,a=e[d].index,h=a-1,c=void 0!==l?l:u,h<0&&(h=0),s=c.geometry,n=s.getCoordinates(),i=n,f=!1,s.getType()){case"MultiLineString":n[c.depth[0]].length>2&&(n[c.depth[0]].splice(a,1),f=!0);break;case"LineString":n.length>2&&(n.splice(a,1),f=!0);break;case"MultiPolygon":i=i[c.depth[1]];case"Polygon":i=i[c.depth[0]],i.length>4&&(a==i.length-1&&(a=0),i.splice(a,1),f=!0,0===a&&(i.pop(),i.push(i[0]),h=i.length-1))}if(f){this.setGeometryCoordinates_(s,n);const e=[];if(void 0!==l&&(this.rBush_.remove(l),e.push(l.segment[0])),void 0!==u&&(this.rBush_.remove(u),e.push(u.segment[1])),void 0!==l&&void 0!==u){const t={depth:c.depth,feature:c.feature,geometry:c.geometry,index:h,segment:e};this.rBush_.insert((0,m.hI)(t.segment),t)}this.updateSegmentIndices_(s,a,c.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.length=0}}return f}setGeometryCoordinates_(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1}updateSegmentIndices_(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||(0,x.fS)(r.depth,i))&&r.index>e&&(r.index+=n)}))}}function R(t,e){return t.index-e.index}function I(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let r=n;if(1===e.index){const e=(0,E.Cs)();e&&(r=r.clone().transform(e,i));const n=(0,_.bI)(r.getCenter(),(0,E.Vs)(t,i)),s=Math.sqrt(n)-r.getRadius();return s*s}}const r=(0,E.Vs)(t,i);return S[0]=(0,E.Vs)(e.segment[0],i),S[1]=(0,E.Vs)(e.segment[1],i),(0,_.Bs)(r,S)}function A(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){let e=n;const r=(0,E.Cs)();return r&&(e=e.clone().transform(r,i)),(0,E.lO)(e.getClosestPoint((0,E.Vs)(t,i)),i)}const r=(0,E.Vs)(t,i);return S[0]=(0,E.Vs)(e.segment[0],i),S[1]=(0,E.Vs)(e.segment[1],i),(0,E.lO)((0,_.oL)(r,S),i)}function L(){const t=(0,y.Ly)();return function(e,i){return t.Point}}e.Z=P},89303:function(t,e,i){"use strict";var n=i(92486),r=i(58322),s=i(14768),o=i(94142),a=i(63312);class l extends r.ZP{constructor(t){super(t=t||{}),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:o.Bx;this.condition_=t.onFocusOnly?(0,o.$6)(o.yZ,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)}handleEvent(t){if(!this.condition_(t))return!0;if(t.type!==n.Z.WHEEL)return!0;const e=t.map,i=t.originalEvent;let r;if(i.preventDefault(),this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==n.Z.WHEEL&&(r=i.deltaY,s.V&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(r/=s.MP),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(r*=40)),0===r)return!1;this.lastDelta_=r;const o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=e.getView();if("trackpad"===this.mode_&&!a.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=o,!1;this.totalDelta_+=r;const l=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,e),l),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-(0,a.uZ)(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),(0,r.FW)(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}e.Z=l},53382:function(t,e,i){"use strict";i.d(e,{S:function(){return o}});var n=i(58322),r=i(87556);class s extends n.ZP{constructor(t){super(t=t||{}),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==r.Z.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==r.Z.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==r.Z.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==r.Z.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function o(t){const e=t.length;let i=0,n=0;for(let r=0;r=0;--i){const n=e[i];if(n!==this&&n instanceof y&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const i=(0,f.sq)(t);t.setStyle(_[i]),delete _[i]}removeFeatureLayerAssociation_(t){delete this.featureLayerAssociation_[(0,f.sq)(t)]}handleEvent(t){if(!this.condition_(t))return!0;const e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,a=this.getFeatures(),l=[],h=[];if(r){(0,u.Z)(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,((t,e)=>{if(t instanceof o.Z&&this.filter_(t,e))return this.addFeatureLayerAssociation_(t,e),h.push(t),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=a.getLength()-1;t>=0;--t){const e=a.item(t),i=h.indexOf(e);i>-1?h.splice(i,1):(a.remove(e),l.push(e))}0!==h.length&&a.extend(h)}else{s.forEachFeatureAtPixel(t.pixel,((t,r)=>{if(t instanceof o.Z&&this.filter_(t,r))return!e&&!n||a.getArray().includes(t)?(i||n)&&a.getArray().includes(t)&&(l.push(t),this.removeFeatureLayerAssociation_(t)):(this.addFeatureLayerAssociation_(t,r),h.push(t)),!this.multi_}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(let t=l.length-1;t>=0;--t)a.remove(l[t]);a.extend(h)}return(h.length>0||l.length>0)&&this.dispatchEvent(new m(p,h,l,t)),!0}}e.Z=y},62950:function(t,e,i){"use strict";i.d(e,{Z:function(){return E}});var n=i(8651),r=i(92486),s=i(53382),o=i(25626),a=i(70487),l=i(79407),h=i(6747);const u="snap";class c extends h.ZP{constructor(t,e){super(t),this.vertex=e.vertex,this.vertexPixel=e.vertexPixel,this.feature=e.feature,this.segment=e.segment}}var d=i(36117),f=i(19775),g=i(23814),p=i(81625),m=i(22765),_=i(41507);function y(t){return t.feature?t.feature:t.element?t.element:null}const x=[];class v extends s.Z{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=l.uX),e.stopDown||(e.stopDown=l.Dv),super(e),this.on,this.once,this.un,this.source_=t.source?t.source:null,this.vertex_=void 0===t.vertex||t.vertex,this.edge_=void 0===t.edge||t.edge,this.features_=t.features?t.features:null,this.featuresListenerKeys_=[],this.featureChangeListenerKeys_={},this.indexedFeaturesExtents_={},this.pendingFeatures_={},this.pixelTolerance_=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.rBush_=new o.Z,this.GEOMETRY_SEGMENTERS_={Point:this.segmentPointGeometry_.bind(this),LineString:this.segmentLineStringGeometry_.bind(this),LinearRing:this.segmentLineStringGeometry_.bind(this),Polygon:this.segmentPolygonGeometry_.bind(this),MultiPoint:this.segmentMultiPointGeometry_.bind(this),MultiLineString:this.segmentMultiLineStringGeometry_.bind(this),MultiPolygon:this.segmentMultiPolygonGeometry_.bind(this),GeometryCollection:this.segmentGeometryCollectionGeometry_.bind(this),Circle:this.segmentCircleGeometry_.bind(this)}}addFeature(t,e){e=void 0===e||e;const i=(0,m.sq)(t),n=t.getGeometry();if(n){const e=this.GEOMETRY_SEGMENTERS_[n.getType()];if(e){this.indexedFeaturesExtents_[i]=n.getExtent((0,d.lJ)());const r=[];if(e(r,n),1===r.length)this.rBush_.insert((0,d.hI)(r[0]),{feature:t,segment:r[0]});else if(r.length>1){const e=r.map((t=>(0,d.hI)(t))),i=r.map((e=>({feature:t,segment:e})));this.rBush_.load(e,i)}}}e&&(this.featureChangeListenerKeys_[i]=(0,_.oL)(t,r.Z.CHANGE,this.handleFeatureChange_,this))}getFeatures_(){let t;return this.features_?t=this.features_:this.source_&&(t=this.source_.getFeatures()),t}handleEvent(t){const e=this.snapTo(t.pixel,t.coordinate,t.map);return e&&(t.coordinate=e.vertex.slice(0,2),t.pixel=e.vertexPixel,this.dispatchEvent(new c(u,{vertex:t.coordinate,vertexPixel:t.pixel,feature:e.feature,segment:e.segment}))),super.handleEvent(t)}handleFeatureAdd_(t){const e=y(t);e&&this.addFeature(e)}handleFeatureRemove_(t){const e=y(t);e&&this.removeFeature(e)}handleFeatureChange_(t){const e=t.target;if(this.handlingDownUpSequence){const t=(0,m.sq)(e);t in this.pendingFeatures_||(this.pendingFeatures_[t]=e)}else this.updateFeature_(e)}handleUpEvent(t){const e=Object.values(this.pendingFeatures_);return e.length&&(e.forEach(this.updateFeature_.bind(this)),this.pendingFeatures_={}),!1}removeFeature(t,e){const i=void 0===e||e,n=(0,m.sq)(t),r=this.indexedFeaturesExtents_[n];if(r){const e=this.rBush_,i=[];e.forEachInExtent(r,(function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t)e.remove(i[t])}i&&((0,_.bN)(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])}setMap(t){const e=this.getMap(),i=this.featuresListenerKeys_,r=this.getFeatures_();e&&(i.forEach(_.bN),i.length=0,this.rBush_.clear(),Object.values(this.featureChangeListenerKeys_).forEach(_.bN),this.featureChangeListenerKeys_={}),super.setMap(t),t&&(this.features_?i.push((0,_.oL)(this.features_,n.Z.ADD,this.handleFeatureAdd_,this),(0,_.oL)(this.features_,n.Z.REMOVE,this.handleFeatureRemove_,this)):this.source_&&i.push((0,_.oL)(this.source_,a.Z.ADDFEATURE,this.handleFeatureAdd_,this),(0,_.oL)(this.source_,a.Z.REMOVEFEATURE,this.handleFeatureRemove_,this)),r.forEach((t=>this.addFeature(t))))}snapTo(t,e,i){const n=i.getView().getProjection(),r=(0,p.Vs)(e,n),s=(0,p.Fj)((0,d.f3)((0,d.hI)([r]),i.getView().getResolution()*this.pixelTolerance_),n),o=this.rBush_.getInExtent(s),a=o.length;if(0===a)return null;let l,h,u=1/0,c=null;const g=this.pixelTolerance_*this.pixelTolerance_,m=()=>{if(l){const e=i.getPixelFromCoordinate(l);if((0,f.bI)(t,e)<=g)return{vertex:l,vertexPixel:[Math.round(e[0]),Math.round(e[1])],feature:h,segment:c}}return null};if(this.vertex_){for(let t=0;t{const i=(0,p.Vs)(t,n),s=(0,f.bI)(r,i);s{t.push([e])}))}segmentMultiPolygonGeometry_(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e{if(t instanceof s.Z&&this.filter_(t,e)&&(!this.features_||this.features_.getArray().includes(t)))return t}),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})}getHitTolerance(){return this.hitTolerance_}setHitTolerance(t){this.hitTolerance_=t}setMap(t){const e=this.getMap();super.setMap(t),this.updateState_(e)}handleActiveChanged_(){this.updateState_(null)}updateState_(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}}e.Z=p},55572:function(t,e,i){"use strict";i.d(e,{c:function(){return Z}});var n=i(79638),r=i(58322),s=i(87556);class o extends r.ZP{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==s.Z.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,o=i.shiftKey?-this.delta_:this.delta_,a=n.getView();(0,r.FW)(a,o,s,this.duration_),i.preventDefault(),e=!0}return!e}}var a=o,l=i(35688),h=i(53382),u=i(79407),c=i(94142),d=i(12338);class f extends h.Z{constructor(t){t=t||{},super({stopDown:u.Dv}),this.condition_=t.condition?t.condition:c.aj,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!(0,c.QL)(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===d.h$)return;const n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){const t=s-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=s}handleUpEvent(t){if(!(0,c.QL)(t))return!0;return t.map.getView().endInteraction(this.duration_),!1}handleDownEvent(t){if(!(0,c.QL)(t))return!1;if((0,c.v8)(t)&&this.condition_(t)){return t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var g=f,p=i(22268),m=i(70076);class _ extends p.Z{constructor(t){super({condition:(t=t||{}).condition?t.condition:c.vY,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.out_){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),r=e.getResolution()/n;i=i.clone(),i.scale(r*r)}e.fitInternal(i,{duration:this.duration_,easing:m.Vv})}}var y=_,x=i(92486),v="ArrowLeft",E="ArrowUp",b="ArrowRight",w="ArrowDown",S=i(19775);class C extends r.ZP{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return(0,c.rM)(t)&&(0,c.TN)(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==x.Z.KEYDOWN){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&(n==w||n==v||n==b||n==E)){const s=t.map.getView(),o=s.getResolution()*this.pixelDelta_;let a=0,l=0;n==w?l=-o:n==v?a=-o:n==b?a=o:l=o;const h=[a,l];(0,S.U1)(h,s.getRotation()),(0,r.Cv)(s,h,this.duration_),i.preventDefault(),e=!0}}return!e}}var T=C;class M extends r.ZP{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!(0,c.a5)(t)&&(0,c.TN)(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==x.Z.KEYDOWN||t.type==x.Z.KEYPRESS){const i=t.originalEvent,n=i.key;if(this.condition_(t)&&("+"===n||"-"===n)){const s=t.map,o="+"===n?this.delta_:-this.delta_,a=s.getView();(0,r.FW)(a,o,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var P=M;var R=class{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;const n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;const r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},I=i(89303);class A extends h.Z{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=u.Dv),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=r;const s=t.map,o=s.getView();o.getConstraints().rotation!==d.h$&&(this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel((0,h.S)(this.targetPointers))),this.rotating_&&(s.render(),o.adjustRotationInternal(e,this.anchor_)))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var L=A;class F extends h.Z{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=u.Dv),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel((0,h.S)(this.targetPointers))),a.render(),l.adjustResolutionInternal(e,this.anchor_)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var O=F;function Z(t){t=t||{};const e=new n.Z,i=new R(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new g);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new a({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new l.Z({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new L);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new O({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new T),e.push(new P({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new I.Z({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new y({duration:t.zoomDuration})),e}},29440:function(t,e,i){"use strict";var n=i(38282),r=i(40823),s=i(22765),o=i(23422),a=i(63312);class l extends n.Z{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[r.Z.OPACITY]=void 0!==t.opacity?t.opacity:1,(0,o.h)("number"==typeof e[r.Z.OPACITY],"Layer opacity must be a number"),e[r.Z.VISIBLE]=void 0===t.visible||t.visible,e[r.Z.Z_INDEX]=t.zIndex,e[r.Z.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[r.Z.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[r.Z.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[r.Z.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=(0,a.uZ)(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return(0,s.O3)()}getLayerStatesArray(t){return(0,s.O3)()}getExtent(){return this.get(r.Z.EXTENT)}getMaxResolution(){return this.get(r.Z.MAX_RESOLUTION)}getMinResolution(){return this.get(r.Z.MIN_RESOLUTION)}getMinZoom(){return this.get(r.Z.MIN_ZOOM)}getMaxZoom(){return this.get(r.Z.MAX_ZOOM)}getOpacity(){return this.get(r.Z.OPACITY)}getSourceState(){return(0,s.O3)()}getVisible(){return this.get(r.Z.VISIBLE)}getZIndex(){return this.get(r.Z.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(r.Z.EXTENT,t)}setMaxResolution(t){this.set(r.Z.MAX_RESOLUTION,t)}setMinResolution(t){this.set(r.Z.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(r.Z.MAX_ZOOM,t)}setMinZoom(t){this.set(r.Z.MIN_ZOOM,t)}setOpacity(t){(0,o.h)("number"==typeof t,"Layer opacity must be a number"),this.set(r.Z.OPACITY,t)}setVisible(t){this.set(r.Z.VISIBLE,t)}setZIndex(t){this.set(r.Z.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}e.Z=l},63584:function(t,e,i){"use strict";var n=i(91462),r=i(48818);class s extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getPreload(){return this.get(r.Z.PRELOAD)}setPreload(t){this.set(r.Z.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(r.Z.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(r.Z.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}e.Z=s},9050:function(t,e,i){"use strict";i.d(e,{Z:function(){return X}});var n=i(91462),r=i(78476),s=i(80677),o=i(64688),a=i(5002),l=i(43586),h=i(49243),u=i(82776),c=i(71976),d=i(57906),f=i(12185);function g(t,e,i){const n=(0,d.Qc)(t,i);if(!(0,d.YM)(e,n.type)){const t=(0,d.hD)(e),i=(0,d.hD)(n.type);throw new Error(`Expected expression to be of type ${t}, got ${i}`)}return p(n,i)}function p(t,e){if(t instanceof d.EM){if(t.type===d.Mr&&"string"==typeof t.value){const e=(0,f.mL)(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case d.AP.Number:case d.AP.String:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;et.properties[n];case d.AP.Var:return t=>t.variables[n];default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case d.AP.Id:return t=>t.featureId;case d.AP.Concat:{const i=t.args.map((t=>p(t,e)));return t=>"".concat(...i.map((e=>e(t).toString())))}case d.AP.Resolution:return t=>t.resolution;case d.AP.Any:case d.AP.All:case d.AP.Not:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{for(let e=0;e{for(let e=0;e!r[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case d.AP.Equal:case d.AP.NotEqual:case d.AP.LessThan:case d.AP.LessThanOrEqualTo:case d.AP.GreaterThan:case d.AP.GreaterThanOrEqualTo:return function(t,e){const i=t.operator,n=p(t.args[0],e),r=p(t.args[1],e);switch(i){case d.AP.Equal:return t=>n(t)===r(t);case d.AP.NotEqual:return t=>n(t)!==r(t);case d.AP.LessThan:return t=>n(t)n(t)<=r(t);case d.AP.GreaterThan:return t=>n(t)>r(t);case d.AP.GreaterThanOrEqualTo:return t=>n(t)>=r(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case d.AP.Multiply:case d.AP.Divide:case d.AP.Add:case d.AP.Subtract:case d.AP.Clamp:case d.AP.Mod:case d.AP.Pow:case d.AP.Abs:case d.AP.Floor:case d.AP.Ceil:case d.AP.Round:case d.AP.Sin:case d.AP.Cos:case d.AP.Atan:case d.AP.Sqrt:return function(t,e){const i=t.operator,n=t.args.length,r=new Array(n);for(let i=0;i{let e=1;for(let i=0;ir[0](t)/r[1](t);case d.AP.Add:return t=>{let e=0;for(let i=0;ir[0](t)-r[1](t);case d.AP.Clamp:return t=>{const e=r[0](t),i=r[1](t);if(en?n:e};case d.AP.Mod:return t=>r[0](t)%r[1](t);case d.AP.Pow:return t=>Math.pow(r[0](t),r[1](t));case d.AP.Abs:return t=>Math.abs(r[0](t));case d.AP.Floor:return t=>Math.floor(r[0](t));case d.AP.Ceil:return t=>Math.ceil(r[0](t));case d.AP.Round:return t=>Math.round(r[0](t));case d.AP.Sin:return t=>Math.sin(r[0](t));case d.AP.Cos:return t=>Math.cos(r[0](t));case d.AP.Atan:return 2===n?t=>Math.atan2(r[0](t),r[1](t)):t=>Math.atan(r[0](t));case d.AP.Sqrt:return t=>Math.sqrt(r[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case d.AP.Match:return function(t,e){const i=t.args.length,n=new Array(i);for(let r=0;r{const e=n[0](t);for(let r=1;r{const e=n[0](t),r=n[1](t);let s,o;for(let a=2;a=r)return 2===a?l:h?_(e,r,s,o,i,l):m(e,r,s,o,i,l);s=i,o=l}return o}}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function m(t,e,i,n,r,s){const o=r-i;if(0===o)return n;const a=e-i;return n+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(s-n)}function _(t,e,i,n,r,s){if(0===r-i)return n;const o=(0,f.WV)(n),a=(0,f.WV)(s);let l=a[2]-o[2];l>180?l-=360:l<-180&&(l+=360);const h=[m(t,e,i,o[0],r,a[0]),m(t,e,i,o[1],r,a[1]),o[2]+m(t,e,i,0,r,l),m(t,e,i,n[3],r,s[3])];return(0,f.Fv)((0,f.TF)(h))}var y=i(4891),x=i(81898);function v(t){return!0}function E(t){const e=(0,d.Mj)(),i=function(t,e){const i=t.length,n=new Array(i);for(let r=0;r4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function B(t,e){const i=G(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const q="renderOrder";class V extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=void 0!==t.declutter&&t.declutter,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(q)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){t.declutterTree||(t.declutterTree=new r(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(q,t)}setStyle(t){this.style_=function(t){if(void 0===t)return s.yF;if(!t)return null;if("function"==typeof t)return t;if(t instanceof s.ZP)return t;if(!Array.isArray(t))return b([t]);if(0===t.length)return[];const e=t.length,i=t[0];if(i instanceof s.ZP){const i=new Array(e);for(let n=0;n0&&u.length>0;)g=u.pop(),r=l.pop(),o=h.pop(),y=g.toString(),y in c||(n.push(o[0],o[1]),c[y]=!0),m=u.pop(),s=l.pop(),a=h.pop(),_=(g+m)/2,d=t(_),f=e(d),(0,p.rU)(f[0],f[1],o[0],o[1],a[0],a[1]){const e=t.get("graticule_label");return this.lonLabelStyleBase_.getText().setText(e),this.lonLabelStyleBase_},this.latLabelStyleBase_=new u.ZP({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new c.Z({font:"12px Calibri,sans-serif",textAlign:"right",fill:new o.Z({color:"rgba(0,0,0,1)"}),stroke:new h.Z({color:"rgba(255,255,255,1)",width:3})})}),this.latLabelStyle_=t=>{const e=t.get("graticule_label");return this.latLabelStyleBase_.getText().setText(e),this.latLabelStyleBase_},this.meridiansLabels_=[],this.parallelsLabels_=[],this.addEventListener(r.Z.POSTRENDER,this.drawLabels_.bind(this))),this.intervals_=void 0!==t.intervals?t.intervals:E,this.setSource(new f.Z({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new n.Z,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.featurePool_=[],this.lineStyle_=new u.ZP({stroke:this.strokeStyle_}),this.loadedExtent_=null,this.renderedExtent_=null,this.renderedResolution_=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.projection_&&this.getSource().getWrapX()&&(0,g.Cf)(i,this.projection_),this.loadedExtent_&&((0,g.iW)(this.loadedExtent_,i,e)?i=this.loadedExtent_.slice():this.getSource().removeLoadedExtent(this.loadedExtent_)),[i]}loaderFunction(t,e,i){this.loadedExtent_=t;const n=this.getSource(),r=this.getExtent()||[-1/0,-1/0,1/0,1/0],o=(0,g.Ed)(r,t);if(this.renderedExtent_&&(0,g.fS)(this.renderedExtent_,o)&&this.renderedResolution_===e)return;if(this.renderedExtent_=o,this.renderedResolution_=e,(0,g.xb)(o))return;const a=(0,g.qg)(o),l=e*e/4;(!this.projection_||!(0,_.OP)(this.projection_,i))&&this.updateProjectionInfo_(i),this.createGraticule_(o,a,e,l);let h,u=this.meridians_.length+this.parallels_.length;for(this.meridiansLabels_&&(u+=this.meridians_.length),this.parallelsLabels_&&(u+=this.parallels_.length);u>this.featurePool_.length;)h=new s.Z,this.featurePool_.push(h);const c=n.getFeaturesCollection();c.clear();let d,f,p=0;for(d=0,f=this.meridians_.length;dMath.PI/2}const d=(0,y.u3)(t);for(let t=a;t<=l;++t){let i,n,u,f,g=this.meridians_.length+this.parallels_.length;if(this.meridiansLabels_)for(n=0,u=this.meridiansLabels_.length;n=a?(t[0]=o[0],t[2]=o[2]):s=!0);const l=[(0,p.uZ)(e[0],this.minX_,this.maxX_),(0,p.uZ)(e[1],this.minY_,this.maxY_)],h=this.toLonLatTransform_(l);isNaN(h[1])&&(h[1]=Math.abs(this.maxLat_)>=Math.abs(this.minLat_)?this.maxLat_:this.minLat_);let u=(0,p.uZ)(h[0],this.minLon_,this.maxLon_),c=(0,p.uZ)(h[1],this.minLat_,this.maxLat_);const d=this.maxLines_;let f,m,_,y,x=t;s||(x=[(0,p.uZ)(t[0],this.minX_,this.maxX_),(0,p.uZ)(t[1],this.minY_,this.maxY_),(0,p.uZ)(t[2],this.minX_,this.maxX_),(0,p.uZ)(t[3],this.minY_,this.maxY_)]);const v=(0,g.Ne)(x,this.toLonLatTransform_,void 0,8);let E=v[3],b=v[2],w=v[1],S=v[0];if(s||((0,g.b8)(x,this.bottomLeft_)&&(S=this.minLon_,w=this.minLat_),(0,g.b8)(x,this.bottomRight_)&&(b=this.maxLon_,w=this.minLat_),(0,g.b8)(x,this.topLeft_)&&(S=this.minLon_,E=this.maxLat_),(0,g.b8)(x,this.topRight_)&&(b=this.maxLon_,E=this.maxLat_),E=(0,p.uZ)(E,c,this.maxLat_),b=(0,p.uZ)(b,u,this.maxLon_),w=(0,p.uZ)(w,this.minLat_,c),S=(0,p.uZ)(S,this.minLon_,u)),u=Math.floor(u/r)*r,y=(0,p.uZ)(u,this.minLon_,this.maxLon_),m=this.addMeridian_(y,w,E,n,t,0),f=0,s)for(;(y-=r)>=S&&f++n[s]&&(r=s,s=1);const o=Math.max(e[1],n[r]),a=Math.min(e[3],n[s]),l=(0,p.uZ)(e[1]+Math.abs(e[1]-e[3])*this.lonLabelPosition_,o,a),h=[n[r-1]+(n[s-1]-n[r-1])*(l-n[r])/(n[s]-n[r]),l],u=this.meridiansLabels_[i].geom;return u.setCoordinates(h),u}getMeridians(){return this.meridians_}getParallel_(t,e,i,n,r){const s=function(t,e,i,n,r){const s=(0,_.U2)("EPSG:4326");return x((function(n){return[e+(i-e)*n,t]}),(0,_.Ck)(s,n),r)}(t,e,i,this.projection_,n);let o=this.parallels_[r];return o?(o.setFlatCoordinates("XY",s),o.changed()):o=new a.Z(s,"XY"),o}getParallelPoint_(t,e,i){const n=t.getFlatCoordinates();let r=0,s=n.length-2;n[r]>n[s]&&(r=s,s=0);const o=Math.max(e[0],n[r]),a=Math.min(e[2],n[s]),l=(0,p.uZ)(e[0]+Math.abs(e[0]-e[2])*this.latLabelPosition_,o,a),h=[l,n[r+1]+(n[s+1]-n[r+1])*(l-n[r])/(n[s]-n[r])],u=this.parallelsLabels_[i].geom;return u.setCoordinates(h),u}getParallels(){return this.parallels_}updateProjectionInfo_(t){const e=(0,_.U2)("EPSG:4326"),i=t.getWorldExtent();this.maxLat_=i[3],this.maxLon_=i[2],this.minLat_=i[1],this.minLon_=i[0];const n=(0,_.Ck)(t,e);if(this.minLon_=Math.abs(this.minLat_)?this.maxLat_:this.minLat_),this.projection_=t}}var w=b},22664:function(t,e,i){"use strict";i.d(e,{V:function(){return g}});var n=i(29440),r=i(79638),s=i(8651),o=i(6747),a=i(92486),l=i(35323),h=i(23422),u=i(4891),c=i(36117),d=i(22765),f=i(41507);class g extends o.ZP{constructor(t,e){super(t),this.layer=e}}const p="layers";class m extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(p,this.handleLayersChanged_),i?Array.isArray(i)?i=new r.Z(i.slice(),{unique:!0}):(0,h.h)("function"==typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new r.Z(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(f.bN),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push((0,f.oL)(t,s.Z.ADD,this.handleLayersAdd_,this),(0,f.oL)(t,s.Z.REMOVE,this.handleLayersRemove_,this));for(const t in this.listenerKeys_)this.listenerKeys_[t].forEach(f.bN);(0,u.Z)(this.listenerKeys_);const e=t.getArray();for(let t=0,i=e.length;t{const e=this.weightFunction_(t);return void 0!==e?(0,o.uZ)(e,0,1):1}}],uniforms:{u_size:()=>2*(this.get(u)+this.get(l)),u_blurSlope:()=>this.get(u)/Math.max(1,this.get(l))},hitDetectionEnabled:!0,vertexShader:t.getSymbolVertexShader(),fragmentShader:t.getSymbolFragmentShader(),postProcesses:[{fragmentShader:"\n precision mediump float;\n\n uniform sampler2D u_image;\n uniform sampler2D u_gradientTexture;\n uniform float u_opacity;\n\n varying vec2 v_texCoord;\n\n void main() {\n vec4 color = texture2D(u_image, v_texCoord);\n gl_FragColor.a = color.a * u_opacity;\n gl_FragColor.rgb = texture2D(u_gradientTexture, vec2(0.5, color.a)).rgb;\n gl_FragColor.rgb *= gl_FragColor.a;\n }",uniforms:{u_gradientTexture:()=>this.gradient_,u_opacity:()=>this.getOpacity()}}]})}renderDeclutter(){}}e.Z=d},11802:function(t,e,i){"use strict";i.d(e,{Z:function(){return a}});var n=i(91462);class r extends n.Z{constructor(t){super(t=t||{})}}var s=r,o=i(89194);var a=class extends s{constructor(t){super(t)}createRenderer(){return new o.Z(this)}getData(t){return super.getData(t)}}},91462:function(t,e,i){"use strict";i.d(e,{j:function(){return d}});var n=i(29440),r=i(92486),s=i(40823),o=i(95474),a=i(40824),l=i(23422),h=i(36117),u=i(41507);class c extends n.Z{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(s.Z.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(s.Z.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&((0,u.bN)(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=(0,u.oL)(t,r.Z.CHANGE,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout((()=>{this.dispatchEvent("sourceready")}),0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let n;!t&&i&&(t=i.getView()),e=t instanceof a.ZP?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),n=e.layerStatesArray?e.layerStatesArray.find((t=>t.layer===this)):this.getLayerState();const r=this.getExtent();return d(n,e.viewState)&&(!r||(0,h.kK)(r,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];let e;const i=this.getSource();if(i&&(e=i.getAttributions()),!e)return[];let n=e(t instanceof a.ZP?t.getViewStateAndExtent():t);return Array.isArray(n)||(n=[n]),n}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(s.Z.MAP,t)}getMapInternal(){return this.get(s.Z.MAP)}setMap(t){this.mapPrecomposeKey_&&((0,u.bN)(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&((0,u.bN)(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=(0,u.oL)(t,o.Z.PRECOMPOSE,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);(0,l.h)(!e.some((function(t){return t.layer===i.layer})),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}),this),this.mapRenderKey_=(0,u.oL)(this,r.Z.CHANGE,t.render,t),this.changed())}setSource(t){this.set(s.Z.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}disposeInternal(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_),this.setSource(null),super.disposeInternal()}}function d(t,e){if(!t.visible)return!1;const i=e.resolution;if(i=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}e.Z=c},40823:function(t,e){"use strict";e.Z={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"}},72893:function(t,e,i){"use strict";var n=i(63584),r=i(44235);class s extends n.Z{constructor(t){super(t)}createRenderer(){return new r.Z(this)}}e.Z=s},48818:function(t,e){"use strict";e.Z={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"}},1733:function(t,e,i){"use strict";var n=i(9050),r=i(56808);class s extends n.Z{constructor(t){super(t)}createRenderer(){return new r.Z(this)}}e.Z=s},16248:function(t,e,i){"use strict";i.d(e,{Z:function(){return _}});var n=i(9050),r=i(89194),s=i(56808),o=i(92486),a=i(13617),l=i(13701),h=i(78476),u=i(87334),c=i(44669),d=i(86374),f=i(36117);class g extends r.Z{constructor(t){super(t),this.vectorRenderer_=new s.Z(t),this.layerImageRatio_=t.getImageRatio(),this.coordinateToVectorPixelTransform_=(0,c.Ue)(),this.renderedPixelToCoordinateTransform_=null}disposeInternal(){this.vectorRenderer_.dispose(),super.disposeInternal()}getFeatures(t){if(!this.vectorRenderer_)return Promise.resolve([]);const e=(0,c.nn)(this.coordinateToVectorPixelTransform_,(0,c.nn)(this.renderedPixelToCoordinateTransform_,t.slice()));return this.vectorRenderer_.getFeatures(e)}handleFontsChanged(){this.vectorRenderer_.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,r=t.viewHints,s=this.vectorRenderer_;let g=t.extent;1!==this.layerImageRatio_&&(g=g.slice(0),(0,f.H9)(g,this.layerImageRatio_));const p=(0,f.dz)(g)/n,m=(0,f.Cr)(g)/n;if(!r[u.Z.ANIMATING]&&!r[u.Z.INTERACTING]&&!(0,f.xb)(g)){s.useContainer(null,null);const r=s.context,u=t.layerStatesArray[t.layerIndex],f=Object.assign({},u,{opacity:1}),_=Object.assign({},t,{declutterTree:new h(9),extent:g,size:[p,m],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[f],layerIndex:0});let y=!0;const x=new a.Z(g,n,e,r.canvas,(function(t){s.prepareFrame(_)&&s.replayGroupChanged&&(s.clipping=!1,s.renderFrame(_,null)&&(s.renderDeclutter(_),y=!1),t())}));x.addEventListener(o.Z.CHANGE,(()=>{if(x.getState()!==l.Z.LOADED)return;this.image_=y?null:x;const t=x.getPixelRatio(),n=(0,d.D)(x.getResolution())*e/t;this.renderedResolution=n,this.coordinateToVectorPixelTransform_=(0,c.qC)(this.coordinateToVectorPixelTransform_,p/2,m/2,1/n,-1/n,0,-i.center[0],-i.center[1])})),x.load()}return this.image_&&(this.renderedPixelToCoordinateTransform_=t.pixelToCoordinateTransform.slice()),!!this.image_}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,r){return this.vectorRenderer_?this.vectorRenderer_.forEachFeatureAtCoordinate(t,e,i,n,r):super.forEachFeatureAtCoordinate(t,e,i,n,r)}}var p=g;class m extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.imageRatio_=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.imageRatio_}createRenderer(){return new p(this)}}var _=m},94613:function(t,e,i){"use strict";i.d(e,{Z:function(){return w}});var n=i(9050),r=i(63350),s=i(15970),o=i(44235),a=i(74251),l=i(87334),h=i(51196),u=i(44669),c=i(36117),d=i(23697),f=i(22765),g=i(81898),p=i(19775);const m={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},_={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};class y extends o.Z{constructor(t){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.tmpTransform_=(0,u.Ue)()}prepareTile(t,e,i){let n;const r=t.getState();return r!==a.Z.LOADED&&r!==a.Z.ERROR||(this.updateExecutorGroup_(t,e,i),this.tileImageNeedsRender_(t)&&(n=!0)),n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState,o=s.resolution,a=s.projection,h=this.getLayer(),u=h.getSource().getTile(t,e,i,r,a),c=n.viewHints,d=!(c[l.Z.ANIMATING]||c[l.Z.INTERACTING]);!d&&u.wantedResolution||(u.wantedResolution=o);return this.prepareTile(u,r,a)&&(d||Date.now()-n.time<8)&&"vector"!==h.getRenderMode()&&this.renderTileImage_(u,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?(0,f.sq)(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const n=this.getLayer(),o=n.getRevision(),l=n.getRenderOrder()||null,h=t.wantedResolution,u=t.getReplayState(n);if(!u.dirty&&u.renderedResolution===h&&u.renderedRevision==o&&u.renderedRenderOrder==l)return;const g=n.getSource(),p=n.getDeclutter(),m=g.getTileGrid(),_=g.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),y=g.getSourceTiles(e,i,t),x=(0,f.sq)(n);delete t.hitDetectionImageData[x],t.executorGroups[x]=[],p&&(t.declutterExecutorGroups[x]=[]),u.dirty=!1;for(let i=0,o=y.length;i{const r=n===y?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,a=n.length;e{const n=this.getLayer(),r=(0,f.sq)(n),s=n.getSource(),o=this.renderedProjection,l=o.getExtent(),d=this.renderedResolution,m=s.getTileGridForProjection(o),_=(0,u.nn)(this.renderedPixelToCoordinateTransform_,t.slice()),y=m.getTileCoordForCoordAndResolution(_,d);let x;for(let t=0,e=this.renderedTiles.length;t0)return void e([]);const v=m.getTileCoordExtent(x.wrappedTileCoord),E=(0,c.rL)(v),b=[(_[0]-E[0])/d,(E[1]-_[1])/d],w=x.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let S=x.hitDetectionImageData[r];if(!S){const t=(0,g.Pq)(m.getTileSize(m.getZForResolution(d,s.zDirection))),e=this.renderedRotation_,i=[this.getRenderTransform(m.getTileCoordCenter(x.wrappedTileCoord),d,0,h.UN,t[0]*h.UN,t[1]*h.UN,0)];S=(0,h.TU)(t,i,w,n.getStyleFunction(),m.getTileCoordExtent(x.wrappedTileCoord),x.getReplayState(n).renderedResolution,e),x.hitDetectionImageData[r]=S}e((0,h.ix)(b,w,S))}))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,n=i.globalAlpha;i.globalAlpha=e.opacity;const r=t.viewHints,s=!(r[l.Z.ANIMATING]||r[l.Z.INTERACTING]),o=this.renderedTiles;for(let e=0,i=o.length;e=0;--e)n[e].execute(this.context,1,this.getTileRenderTransform(i,t),t.viewState.rotation,s,void 0,t.declutterTree)}i.globalAlpha=n}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,r=n.center,s=n.resolution,o=n.rotation,a=e.size,l=Math.round(a[0]*i),h=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),d=t.tileCoord,f=c.getTileCoordExtent(t.wrappedTileCoord),g=c.getTileCoordExtent(d,this.tmpExtent)[0]-f[0];return(0,u.Jp)((0,u.bA)(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(r,s,o,i,l,h,g))}postRender(t,e){const i=e.viewHints,n=!(i[l.Z.ANIMATING]||i[l.Z.INTERACTING]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation;const r=this.getLayer(),s=r.getRenderMode(),o=t.globalAlpha;t.globalAlpha=e.layerStatesArray[e.layerIndex].opacity;const a=_[s],h=e.viewState,u=h.rotation,d=r.getSource(),g=d.getTileGridForProjection(h.projection).getZForResolution(h.resolution,d.zDirection),p=this.renderedTiles,m=[],y=[];let x=!0;for(let i=p.length-1;i>=0;--i){const s=p[i];x=x&&!s.getReplayState(r).dirty;const o=s.executorGroups[(0,f.sq)(r)].filter((t=>t.hasExecutors(a)));if(0===o.length)continue;const l=this.getTileRenderTransform(s,e),h=s.tileCoord[0];let d=!1;const _=o[0].getClipCoords(l);if(_){for(let e=0,i=m.length;e({name:t,...this.parseResult_.attributes[t]})));return new r.Z(this,{vertexShader:this.parseResult_.builder.getSymbolVertexShader(),fragmentShader:this.parseResult_.builder.getSymbolFragmentShader(),hitDetectionEnabled:!this.hitDetectionDisabled_,uniforms:this.parseResult_.uniforms,attributes:t})}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}e.Z=o},50463:function(t,e,i){"use strict";var n=i(63584),r=i(40823),s=i(80128),o=i(57906),a=i(25638),l=i(31871);function h(t,e){const i=`\n attribute vec2 ${s.zj.TEXTURE_COORD};\n uniform mat4 ${s.XE.TILE_TRANSFORM};\n uniform float ${s.XE.TEXTURE_PIXEL_WIDTH};\n uniform float ${s.XE.TEXTURE_PIXEL_HEIGHT};\n uniform float ${s.XE.TEXTURE_RESOLUTION};\n uniform float ${s.XE.TEXTURE_ORIGIN_X};\n uniform float ${s.XE.TEXTURE_ORIGIN_Y};\n uniform float ${s.XE.DEPTH};\n\n varying vec2 v_textureCoord;\n varying vec2 v_mapCoord;\n\n void main() {\n v_textureCoord = ${s.zj.TEXTURE_COORD};\n v_mapCoord = vec2(\n ${s.XE.TEXTURE_ORIGIN_X} + ${s.XE.TEXTURE_RESOLUTION} * ${s.XE.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n ${s.XE.TEXTURE_ORIGIN_Y} - ${s.XE.TEXTURE_RESOLUTION} * ${s.XE.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n );\n gl_Position = ${s.XE.TILE_TRANSFORM} * vec4(${s.zj.TEXTURE_COORD}, ${s.XE.DEPTH}, 1.0);\n }\n `,n={...(0,a.xW)(),inFragmentShader:!0,bandCount:e,style:t},r=[];if(void 0!==t.color){const e=(0,l.CL)(n,t.color,o.Mr);r.push(`color = ${e};`)}if(void 0!==t.contrast){const e=(0,l.CL)(n,t.contrast,o.sw);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb - (${e} / 2.0), vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.exposure){const e=(0,l.CL)(n,t.exposure,o.sw);r.push(`color.rgb = clamp((${e} + 1.0) * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}if(void 0!==t.saturation){const e=(0,l.CL)(n,t.saturation,o.sw);r.push(`\n float saturation = ${e} + 1.0;\n float sr = (1.0 - saturation) * 0.2126;\n float sg = (1.0 - saturation) * 0.7152;\n float sb = (1.0 - saturation) * 0.0722;\n mat3 saturationMatrix = mat3(\n sr + saturation, sr, sr,\n sg, sg + saturation, sg,\n sb, sb, sb + saturation\n );\n color.rgb = clamp(saturationMatrix * color.rgb, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));\n `)}if(void 0!==t.gamma){const e=(0,l.CL)(n,t.gamma,o.sw);r.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=(0,l.CL)(n,t.brightness,o.sw);r.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const h={},u=Object.keys(n.variables).length;if(u>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e ${s.XE.RENDER_EXTENT}[2] ||\n v_mapCoord[1] > ${s.XE.RENDER_EXTENT}[3]\n ) {\n discard;\n }\n\n vec4 color = texture2D(${s.XE.TILE_TEXTURE_ARRAY}[0], v_textureCoord);\n\n ${r.join("\n")}\n\n gl_FragColor = color;\n gl_FragColor.rgb *= gl_FragColor.a;\n gl_FragColor *= ${s.XE.TRANSITION_ALPHA};\n }`,uniforms:h,paletteTextures:n.paletteTextures}}class u extends n.Z{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.sources_=t.sources,this.renderedSource_=null,this.renderedResolution_=NaN,this.style_=e,this.cacheSize_=i,this.styleVariables_=this.style_.variables||{},this.addChangeListener(r.Z.SOURCE,this.handleSourceUpdate_)}getSources(t,e){const i=this.getSource();return this.sources_?"function"==typeof this.sources_?this.sources_(t,e):this.sources_:i?[i]:[]}getRenderSource(){return this.renderedSource_||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}handleSourceUpdate_(){this.hasRenderer()&&this.getRenderer().clearCache(),this.getSource()&&this.setStyle(this.style_)}getSourceBandCount_(){const t=Number.MAX_SAFE_INTEGER,e=this.getSources([-t,-t,t,t],t);return e&&e.length&&"bandCount"in e[0]?e[0].bandCount:4}createRenderer(){const t=h(this.style_,this.getSourceBandCount_());return new s.ZP(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.cacheSize_,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let r=0,s=e.length;r{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}r=r&&"ready"==i}const s=this.renderSources(t,n);if(this.getRenderer().renderComplete&&r)return this.renderedResolution_=i.resolution,s;if(this.renderedResolution_>.5*i.resolution){const e=this.getSources(t.extent,this.renderedResolution_).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return s}setStyle(t){this.styleVariables_=t.variables||{},this.style_=t;const e=h(this.style_,this.getSourceBandCount_());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.styleVariables_,t),this.changed()}}u.prototype.dispose,e.Z=u},2896:function(t,e,i){"use strict";i.d(e,{$6:function(){return r},Gg:function(){return o},VW:function(){return s}});var n=i(81625);function r(t,e){return[[-1/0,-1/0,1/0,1/0]]}function s(t,e){return[t]}function o(t){return function(e,i,r){const s=t.getZForResolution((0,n.oK)(i,r)),o=t.getTileRangeForExtentAndZ((0,n.dY)(e,r),s),a=[],l=[s,0,0];for(l[1]=o.minX;l[1]<=o.maxX;++l[1])for(l[2]=o.minY;l[2]<=o.maxY;++l[2])a.push((0,n.Fj)(t.getTileCoordExtent(l),r));return a}}},63312:function(t,e,i){"use strict";function n(t,e,i){return Math.min(Math.max(t,e),i)}function r(t,e,i,n,r,o){const a=r-i,l=o-n;if(0!==a||0!==l){const s=((t-i)*a+(e-n)*l)/(a*a+l*l);s>1?(i=r,n=o):s>0&&(i+=a*s,n+=l*s)}return s(t,e,i,n)}function s(t,e,i,n){const r=i-t,s=n-e;return r*r+s*s}function o(t){const e=t.length;for(let i=0;ir&&(r=e,n=s)}if(0===r)return null;const s=t[n];t[n]=t[i],t[i]=s;for(let n=i+1;n=0;n--){i[n]=t[n][e]/t[n][n];for(let r=n-1;r>=0;r--)t[r][e]-=t[r][n]*i[n]}return i}function a(t){return 180*t/Math.PI}function l(t){return t*Math.PI/180}function h(t,e){const i=t%e;return i*e<0?i+e:i}function u(t,e,i){return t+i*(e-t)}function c(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function d(t,e){return Math.round(c(t,e))}function f(t,e){return Math.floor(c(t,e))}function g(t,e){return Math.ceil(c(t,e))}i.d(e,{$W:function(){return h},FH:function(){return c},GW:function(){return f},NM:function(){return d},SV:function(){return o},Ux:function(){return a},Yr:function(){return l},bI:function(){return s},mD:function(){return g},rU:function(){return r},t7:function(){return u},uZ:function(){return n}})},38760:function(t,e,i){"use strict";i.d(e,{Kk:function(){return l},R6:function(){return r},xA:function(){return a}});var n=i(22765);function r(t,e,i,r){const s=document.createElement("script"),o="olc_"+(0,n.sq)(e);function a(){delete window[o],s.parentNode.removeChild(s)}s.async=!0,s.src=t+(t.includes("?")?"&":"?")+(r||"callback")+"="+o;const l=setTimeout((function(){a(),i&&i()}),1e4);window[o]=function(t){clearTimeout(l),a(),e(t)},document.head.appendChild(s)}class s extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class o extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function a(t){return new Promise((function(e,i){const n=new XMLHttpRequest;n.addEventListener("load",(function(t){const n=t.target;if(!n.status||n.status>=200&&n.status<300){let t;try{t=JSON.parse(n.responseText)}catch(t){const e="Error parsing response text as JSON: "+t.message;return void i(new Error(e))}e(t)}else i(new s(n))})),n.addEventListener("error",(function(t){i(new o(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function l(t,e){return e.includes("://")?e:new URL(e,t).href}},4891:function(t,e,i){"use strict";function n(t){for(const e in t)delete t[e]}function r(t){let e;for(e in t)return!1;return!e}i.d(e,{Z:function(){return n},x:function(){return r}})},64074:function(t,e){"use strict";e.Z={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"}},81625:function(t,e,i){"use strict";i.d(e,{Wm:function(){return _.W},kv:function(){return n.Z},zY:function(){return Z},rM:function(){return L},Sx:function(){return R},UQ:function(){return F},uA:function(){return J},h_:function(){return T},OP:function(){return N},mi:function(){return k},Vs:function(){return $},dY:function(){return Y},oK:function(){return K},U2:function(){return I},_Q:function(){return A},Ck:function(){return z},WO:function(){return G},Cs:function(){return q},gD:function(){return P},bU:function(){return D},lO:function(){return X},Fj:function(){return W},on:function(){return H},vs:function(){return j},$A:function(){return U},eL:function(){return V}});var n=i(36255);const r=6378137,s=Math.PI*r,o=[-s,-s,s,s],a=[-180,-85,180,85],l=r*Math.log(Math.tan(Math.PI/2));class h extends n.Z{constructor(t){super({code:t,units:"m",extent:o,global:!0,worldExtent:a,getPointResolution:function(t,e){return t/Math.cosh(e[1]/r)}})}}const u=[new h("EPSG:3857"),new h("EPSG:102100"),new h("EPSG:102113"),new h("EPSG:900913"),new h("http://www.opengis.net/def/crs/EPSG/0/3857"),new h("http://www.opengis.net/gml/srs/epsg.xml#3857")];function c(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;ol?i=l:i<-l&&(i=-l),e[o+1]=i}return e}function d(t,e,i){const n=t.length;i=i>1?i:2,void 0===e&&(e=i>2?t.slice():new Array(n));for(let o=0;o=o?e[s+t]:r[t]}return i}}function Z(t,e,i,n){const r=I(t),s=I(e);(0,x.IH)(r,s,O(i)),(0,x.IH)(s,r,O(n))}function k(t,e){return T(),j(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function D(t,e){const i=j(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=(0,E.$W)(n+180,360)-180),i}function N(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return G(t,e)===M&&i}function G(t,e){const i=t.getCode(),n=e.getCode();let r=(0,x.U2)(i,n);return r||(r=P),r}function z(t,e){return G(I(t),I(e))}function j(t,e,i){return z(e,i)(t,void 0,t.length)}function U(t,e,i,n){const r=z(e,i);return(0,v.Ne)(t,r,void 0,n)}let B=null;function q(){return B}function V(){B=I("EPSG:4326")}function X(t,e){return B?j(t,e,B):t}function $(t,e){return B?j(t,B,e):(C&&!(0,b.fS)(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(C=!1,(0,S.ZK)("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function W(t,e){return B?U(t,e,B):t}function Y(t,e){return B?U(t,B,e):t}function H(t,e){if(!B)return t;const i=I(e).getMetersPerUnit(),n=B.getMetersPerUnit();return i&&n?t*i/n:t}function K(t,e){if(!B)return t;const i=I(e).getMetersPerUnit(),n=B.getMetersPerUnit();return i&&n?t*n/i:t}function J(t,e,i){return function(n){let r,s;if(t.canWrapX()){const e=t.getExtent(),o=(0,v.dz)(e);n=n.slice(0),s=(0,b.jk)(n,t,o),s&&(n[0]=n[0]-s*o),n[0]=(0,E.uZ)(n[0],e[0],e[2]),n[1]=(0,E.uZ)(n[1],e[1],e[3]),r=i(n)}else r=i(n);return s&&e.canWrapX()&&(r[0]+=s*(0,v.dz)(e.getExtent())),r}}var Q,tt,et;L(u),L(m),Q=u,tt=c,et=d,m.forEach((function(t){Q.forEach((function(e){(0,x.IH)(t,e,tt),(0,x.IH)(e,t,et)}))}))},36255:function(t,e,i){"use strict";var n=i(14684);e.Z=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||n.W[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}},14684:function(t,e,i){"use strict";i.d(e,{N:function(){return r},W:function(){return s}});const n={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function r(t){return n[t]}const s={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937}},35250:function(t,e,i){"use strict";i.d(e,{$m:function(){return u},d:function(){return d},pH:function(){return a},sM:function(){return c},z2:function(){return l}});var n=i(36255),r=i(81625),s=i(97189);let o=null;function a(){return!!o}function l(t){o=t;const e=Object.keys(t.defs),i=e.length;let a,l;for(a=0;a{const i=t.results;if(i?.length>0){const t=i.filter((t=>"EPSG"===t.id?.authority&&t.id?.code===e))[0];if(t){const e=t.transformations;if(e?.length>0){const i=t.default_transformation;if(e.filter((t=>t.id?.authority===i?.authority&&t.id?.code===i?.code&&0===t.grids?.length)).length>0)return t.exports?.proj4;const n=e.filter((t=>0===t.grids?.length&&"EPSG"===t.target_crs?.authority&&4326===t.target_crs?.code&&!1===t.deprecated&&!0===t.usable)).sort(((t,e)=>t.accuracy-e.accuracy))[0]?.exports?.proj4;if(n)return n}return t.exports?.proj4}}}))}}},97189:function(t,e,i){"use strict";i.d(e,{IH:function(){return r},U2:function(){return s}});let n={};function r(t,e,i){const r=t.getCode(),s=e.getCode();r in n||(n[r]={}),n[r][s]=i}function s(t,e){let i;return t in n&&e in n[t]&&(i=n[t][e]),i}},91027:function(t,e,i){"use strict";i.d(e,{CR:function(){return u},Pt:function(){return l},u3:function(){return h}});var n=i(58767),r=i(14768),s=i(44669),o=i(23697),a=i(81625);function l(t,e){const i=t.canvas,o=(e=e||{}).pixelRatio||r.MP,a=e.size;a&&(i.width=a[0]*o,i.height=a[1]*o,i.style.width=a[0]+"px",i.style.height=a[1]+"px");const l=[0,0,i.width,i.height],h=(0,s.bA)((0,s.Ue)(),o,o);return new n.Z(t,o,l,h,0)}function h(t){if(!(t.context instanceof CanvasRenderingContext2D))throw new Error("Only works for render events from Canvas 2D layers");const e=t.inversePixelTransform[0],i=t.inversePixelTransform[1],r=Math.sqrt(e*e+i*i),l=t.frameState,h=(0,s.Jp)(t.inversePixelTransform.slice(),l.coordinateToPixelTransform),u=(0,o.se)(l.viewState.resolution,r);let c;const d=(0,a.Cs)();return d&&(c=(0,a.WO)(d,l.viewState.projection)),new n.Z(t.context,r,l.extent,h,l.viewState.rotation,u,c)}function u(t,e){return(0,s.nn)(t.inversePixelTransform,e.slice(0))}},44594:function(t,e,i){"use strict";var n=i(6747);class r extends n.ZP{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}}e.Z=r},95474:function(t,e){"use strict";e.Z={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"}},33321:function(t,e,i){"use strict";var n=i(44669),r=i(36117),s=i(67775),o=i(17367),a=i(37105),l=i(81625),h=i(71313),u=i(74985),c=i(31121),d=i(79407),f=i(11570);const g=(0,n.Ue)();class p{constructor(t,e,i,n,r,s){this.styleFunction,this.extent_,this.id_=s,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i,this.properties_=r,this.squaredTolerance_,this.stride_=n,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?(0,r.HK)(this.flatCoordinates_):(0,r.GN)(this.flatCoordinates_,0,this.flatCoordinates_.length,2)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=(0,r.qg)(this.getExtent());this.flatInteriorPoints_=(0,a.X)(this.flatCoordinates_,0,this.ends_,2,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=(0,h.Q3)(this.flatCoordinates_,this.ends_),e=(0,c.E)(this.flatCoordinates_,0,t,2);this.flatInteriorPoints_=(0,a.U)(this.flatCoordinates_,0,t,2,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=(0,u.WW)(this.flatCoordinates_,0,this.flatCoordinates_.length,2,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let n=0,r=i.length;n{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let n;switch(this.type_){case"LineString":i.length=(0,s.dt)(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),n=[i.length];break;case"MultiLineString":n=[],i.length=(0,s.UJ)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,n);break;case"Polygon":n=[],i.length=(0,s.Zh)(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,n)}return n&&(this.simplifiedGeometry_=new p(this.type_,i,n,2,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_})),this}}p.prototype.getFlatCoordinates=p.prototype.getOrientedFlatCoordinates,e.ZP=p},46453:function(t,e){"use strict";e.Z=class{drawCustom(t,e,i,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e){}drawFeature(t,e){}drawGeometryCollection(t,e){}drawLineString(t,e){}drawMultiLineString(t,e){}drawMultiPoint(t,e){}drawMultiPolygon(t,e){}drawPoint(t,e){}drawPolygon(t,e){}drawText(t,e){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}},17955:function(t,e,i){"use strict";i.d(e,{Df:function(){return l},He:function(){return d},Kd:function(){return P},PH:function(){return m},Qx:function(){return S},Tx:function(){return p},V4:function(){return g},X9:function(){return c},Zw:function(){return R},_f:function(){return I},bL:function(){return h},mb:function(){return u},oB:function(){return y},rc:function(){return f},ru:function(){return _},sG:function(){return v},yC:function(){return x}});var n=i(38282),r=i(14768),s=i(4891),o=i(850),a=i(49636);const l="10px sans-serif",h="#000",u="round",c=[],d=0,f="round",g=10,p="#000",m="center",_="middle",y=[0,0,0,0],x=1,v=new n.Z;let E,b=null;const w={},S=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let r,o;function l(r,s,a){let l=!0;for(let h=0;hMath.max(e,M(t,i))),0);return i[e]=n,n}function R(t,e){const i=[],n=[],r=[];let s=0,o=0,a=0,l=0;for(let h=0,u=e.length;h<=u;h+=2){const c=e[h];if("\n"===c||h===u){s=Math.max(s,o),r.push(o),o=0,a+=l;continue}const d=e[h+1]||t.font,f=M(d,c);i.push(f),o+=f;const g=C(d);n.push(g),l=Math.max(l,g)}return{width:s,height:a,widths:i,heights:n,lineWidths:r}}function I(t,e,i,n,r,s,o,a,l,h,u){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.transform.apply(t,e),n.contextInstructions?(t.translate(l,h),t.scale(u[0],u[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;ta&&(this.instructions.push([n.ZP.CUSTOM,a,h,t,i,u.Ml]),this.hitDetectionInstructions.push([n.ZP.CUSTOM,a,h,t,r||i,u.Ml]));break;case"Point":l=t.getFlatCoordinates(),this.coordinates.push(l[0],l[1]),h=this.coordinates.length,this.instructions.push([n.ZP.CUSTOM,a,h,t,i]),this.hitDetectionInstructions.push([n.ZP.CUSTOM,a,h,t,r||i])}this.endGeometry(e)}beginGeometry(t,e){this.beginGeometryInstruction1_=[n.ZP.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[n.ZP.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let r,s,o=-1;for(e=0;ethis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0}createFill(t){const e=t.fillStyle,i=[n.ZP.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[n.ZP.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!(0,h.fS)(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[n.ZP.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=(0,a.d9)(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;(0,a.f3)(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}e.Z=c},63350:function(t,e,i){"use strict";i.d(e,{Z:function(){return p}});var n=i(4281),r=i(86161);class s extends n.Z{constructor(t,e,i,n){super(t,e,i,n),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([r.ZP.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.image_)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,o=this.appendFlatPointCoordinates(i,n);this.instructions.push([r.ZP.DRAW_IMAGE,s,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,s,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),r=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=r[0],this.originY_=r[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}var o=s,a=i(17955);class l extends n.Z{constructor(t,e,i,n){super(t,e,i,n)}drawFlatCoordinates_(t,e,i,n){const s=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),a=[r.ZP.MOVE_TO_LINE_TO,s,o];return this.instructions.push(a),this.hitDetectionInstructions.push(a),i}drawLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([r.ZP.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,a.X9,a.He],r.$O);const o=t.getFlatCoordinates(),l=t.getStride();this.drawFlatCoordinates_(o,0,o.length,l),this.hitDetectionInstructions.push(r.Yc),this.endGeometry(e)}drawMultiLineString(t,e){const i=this.state,n=i.strokeStyle,s=i.lineWidth;if(void 0===n||void 0===s)return;this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([r.ZP.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,a.X9,a.He],r.$O);const o=t.getEnds(),l=t.getFlatCoordinates(),h=t.getStride();let u=0;for(let t=0,e=o.length;tt[2]}else R=b>M;const I=Math.PI,A=[],L=S+n===e;let F;if(y=0,x=C,g=t[e=S],p=t[e+1],L){v(),F=Math.atan2(p-_,g-m),R&&(F+=F>0?-I:I);const t=(M+b)/2,e=(P+w)/2;return A[0]=[t,e,(T-s)/2,F,r],A}for(let t=0,h=(r=r.replace(/\n/g," ")).length;t0?-I:I),void 0!==F){let t=f-F;if(t+=t>I?-2*I:t<-I?2*I:0,Math.abs(t)>o)return null}F=f;const b=t;let w=0;for(;t0&&t.push("\n",""),t.push(e,""),t}var b=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderedTransform_=(0,s.Ue)(),this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.labels_[s])return this.labels_[s];const o=n?this.strokeStates[n]:null,l=i?this.fillStates[i]:null,h=this.textStates[e],u=this.pixelRatio,c=[h.scale[0]*u,h.scale[1]*u],d=Array.isArray(t),f=h.justify?r.I[h.justify]:v(Array.isArray(t)?t[0]:t,h.textAlign||a.PH),g=n&&o.lineWidth?o.lineWidth:0,p=d?t:t.split("\n").reduce(E,[]),{width:m,height:_,widths:y,heights:x,lineWidths:b}=(0,a.Zw)(h,p),w=m+g,S=[],C=(w+2)*c[0],T=(_+g)*c[1],M={width:C<0?Math.floor(C):Math.ceil(C),height:T<0?Math.floor(T):Math.ceil(T),contextInstructions:S};1==c[0]&&1==c[1]||S.push("scale",c),n&&(S.push("strokeStyle",o.strokeStyle),S.push("lineWidth",g),S.push("lineCap",o.lineCap),S.push("lineJoin",o.lineJoin),S.push("miterLimit",o.miterLimit),S.push("setLineDash",[o.lineDash]),S.push("lineDashOffset",o.lineDashOffset)),i&&S.push("fillStyle",l.fillStyle),S.push("textBaseline","middle"),S.push("textAlign","center");const P=.5-f;let R=f*w+P*g;const I=[],A=[];let L,F=0,O=0,Z=0,k=0;for(let t=0,e=p.length;tt?t-u:r,T=a+c>e?e-c:a,M=v[3]+C*y[0]+v[1],P=v[0]+T*y[1]+v[2],R=w-v[3],I=S-v[0];let A;return(E||0!==d)&&(g[0]=R,_[0]=R,g[1]=I,p[1]=I,p[0]=R+M,m[0]=p[0],m[1]=I+P,_[1]=m[1]),0!==d?(A=(0,s.qC)((0,s.Ue)(),i,n,1,1,d,-i,-n),(0,s.nn)(A,g),(0,s.nn)(A,p),(0,s.nn)(A,m),(0,s.nn)(A,_),(0,o.T9)(Math.min(g[0],p[0],m[0],_[0]),Math.min(g[1],p[1],m[1],_[1]),Math.max(g[0],p[0],m[0],_[0]),Math.max(g[1],p[1],m[1],_[1]),f)):(0,o.T9)(Math.min(R,R+M),Math.min(I,I+P),Math.max(R,R+M),Math.max(I,I+P),f),x&&(w=Math.round(w),S=Math.round(S)),{drawImageX:w,drawImageY:S,drawImageW:C,drawImageH:T,originX:u,originY:c,declutterBox:{minX:f[0],minY:f[1],maxX:f[2],maxY:f[3],value:b},canvasTransform:A,scale:y}}replayImageOrLabel_(t,e,i,n,r,s,o){const l=!(!s&&!o),h=n.declutterBox,u=t.canvas,c=o?o[2]*n.scale[0]/2:0;return h.minX-c<=u.width/e&&h.maxX+c>=0&&h.minY-c<=u.height/e&&h.maxY+c>=0&&(l&&this.replayTextBackground_(t,g,p,m,_,s,o),(0,a._f)(t,n.canvasTransform,r,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=(0,s.nn)(this.renderedTransform_,[0,0]),n=512*this.pixelRatio;t.save(),t.translate(i[0]%n,i[1]%n),1!==e&&t.scale(e,e),t.rotate(this.viewRotation_)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6])}drawLabelWithPointPlacement_(t,e,i,n){const s=this.textStates[e],o=this.createLabel(t,e,n,i),l=this.strokeStates[i],h=this.pixelRatio,u=v(Array.isArray(t)?t[0]:t,s.textAlign||a.PH),c=r.I[s.textBaseline||a.ru],d=l&&l.lineWidth?l.lineWidth:0;return{label:o,anchorX:u*(o.width/h-2*s.scale[0])+2*(.5-u)*d,anchorY:c*o.height/h+2*(.5-c)*d}}execute_(t,e,i,r,l,f,g,p){let m;this.pixelCoordinates_&&(0,c.fS)(i,this.renderedTransform_)?m=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),m=(0,h.vT)(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),(0,s.lk)(this.renderedTransform_,i));let _=0;const x=r.length;let E,b,w,S,C,T,M,P,R,I,A,L,F=0,O=0,Z=0,k=null,D=null;const N=this.coordinateCache_,G=this.viewRotation_,z=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,j={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:G},U=this.instructions!=r||this.overlaps?0:200;let B,q,V,X;for(;_U&&(this.fill_(t),O=0),Z>U&&(t.stroke(),Z=0),O||Z||(t.beginPath(),S=NaN,C=NaN),++_;break;case n.ZP.CIRCLE:F=i[1];const r=m[F],s=m[F+1],h=m[F+2]-r,c=m[F+3]-s,x=Math.sqrt(h*h+c*c);t.moveTo(r+x,s),t.arc(r,s,x,0,2*Math.PI,!0),++_;break;case n.ZP.CLOSE_PATH:t.closePath(),++_;break;case n.ZP.CUSTOM:F=i[1],E=i[2];const $=i[3],W=i[4],Y=6==i.length?i[5]:void 0;j.geometry=$,j.feature=B,_ in N||(N[_]=[]);const H=N[_];Y?Y(m,F,E,2,H):(H[0]=m[F],H[1]=m[F+1],H.length=2),W(H,j),++_;break;case n.ZP.DRAW_IMAGE:F=i[1],E=i[2],P=i[3],b=i[4],w=i[5];let K=i[6];const J=i[7],Q=i[8],tt=i[9],et=i[10];let it=i[11];const nt=i[12];let rt=i[13];const st=i[14],ot=i[15];if(!P&&i.length>=20){R=i[19],I=i[20],A=i[21],L=i[22];const t=this.drawLabelWithPointPlacement_(R,I,A,L);P=t.label,i[3]=P;const e=i[23];b=(t.anchorX-e)*this.pixelRatio,i[4]=b;const n=i[24];w=(t.anchorY-n)*this.pixelRatio,i[5]=w,K=P.height,i[6]=K,rt=P.width,i[13]=rt}let at,lt,ht,ut;i.length>25&&(at=i[25]),i.length>17?(lt=i[16],ht=i[17],ut=i[18]):(lt=a.oB,ht=!1,ut=!1),et&&z?it+=G:et||z||(it-=G);let ct=0;for(;Fi)break;let a=n[o];a||(a=[],n[o]=a),a.push(4*((t+r)*e+(t+s))+3),r>0&&a.push(4*((t-r)*e+(t+s))+3),s>0&&(a.push(4*((t+r)*e+(t-s))+3),r>0&&a.push(4*((t-r)*e+(t-s))+3))}const r=[];for(let t=0,e=n.length;t0){if(!a||"Image"!==p&&"Text"!==p||a.includes(t)){const i=(g[s]-3)/4,o=n-i%l,a=n-(i/l|0),h=r(t,e,o*o+a*a);if(h)return h}d.clearRect(0,0,l,l);break}}const _=Object.keys(this.executorsByZIndex_).map(Number);let y,x,v,E,b;for(_.sort(c.j2),y=_.length-1;y>=0;--y){const t=_[y].toString();for(v=this.executorsByZIndex_[t],x=C.length-1;x>=0;--x)if(p=C[x],E=v[p],void 0!==E&&(b=E.executeHitDetection(d,h,i,m,f),b))return b}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return(0,h.vT)(o,0,8,2,t,o),o}isEmpty(){return(0,S.x)(this.executorsByZIndex_)}execute(t,e,i,n,r,s,o){const a=Object.keys(this.executorsByZIndex_).map(Number);let l,h,u,d,f,g;for(a.sort(c.j2),this.maxExtent_&&(t.save(),this.clip(t,i)),s=s||C,o&&a.reverse(),l=0,h=a.length;lt*this.pixelRatio_)),lineDashOffset:(s||o.He)*this.pixelRatio_,lineJoin:void 0!==a?a:o.rc,lineWidth:(void 0!==l?l:o.yC)*this.pixelRatio_,miterLimit:void 0!==h?h:o.V4,strokeStyle:(0,r.y)(t||o.Tx)}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),n=t.getAnchor(),r=t.getOrigin();this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=n[0]*i,this.imageAnchorY_=n[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=r[0],this.imageOriginY_=r[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const s=t.getScaleArray();this.imageScale_=[s[0]*this.pixelRatio_/i,s[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:(0,r.y)(t||o.bL)}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),a=i.getLineJoin(),l=i.getWidth(),h=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:o.mb,lineDash:n||o.X9,lineDashOffset:s||o.He,lineJoin:void 0!==a?a:o.rc,lineWidth:void 0!==l?l:o.yC,miterLimit:void 0!==h?h:o.V4,strokeStyle:(0,r.y)(t||o.Tx)}}else this.textStrokeState_=null;const n=t.getFont(),s=t.getOffsetX(),a=t.getOffsetY(),l=t.getRotateWithView(),h=t.getRotation(),u=t.getScaleArray(),c=t.getText(),d=t.getTextAlign(),f=t.getTextBaseline();this.textState_={font:void 0!==n?n:o.Df,textAlign:void 0!==d?d:o.PH,textBaseline:void 0!==f?f:o.ru},this.text_=void 0!==c?Array.isArray(c)?c.reduce(((t,e,i)=>t+(i%2?" ":e)),""):c:"",this.textOffsetX_=void 0!==s?this.pixelRatio_*s:0,this.textOffsetY_=void 0!==a?this.pixelRatio_*a:0,this.textRotateWithView_=void 0!==l&&l,this.textRotation_=void 0!==h?h:0,this.textScale_=[this.pixelRatio_*u[0],this.pixelRatio_*u[1]]}else this.text_=""}}e.Z=d},86161:function(t,e,i){"use strict";i.d(e,{$O:function(){return o},Yc:function(){return s},gO:function(){return r},s3:function(){return a}});const n={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},r=[n.FILL],s=[n.STROKE],o=[n.BEGIN_PATH],a=[n.CLOSE_PATH];e.ZP=n},48714:function(t,e,i){"use strict";i.d(e,{I:function(){return d},Z:function(){return g}});var n=i(4281),r=i(86161),s=i(52987),o=i(17955),a=i(22765),l=i(36117),h=i(63312);function u(t,e,i,n,r){const s=[];let o=i,a=0,l=e.slice(i,2);for(;a=t){const e=(t-a+d)/d,f=(0,h.t7)(i,u,e),g=(0,h.t7)(n,c,e);l.push(f,g),s.push(l),l=[f,g],a==t&&(o+=r),a=0}else if(a0&&s.push(l),s}function c(t,e,i,n,r){let s,o,a,l,h,u,c,d,f,g,p=i,m=i,_=0,y=0,x=i;for(o=i;ot&&(y>_&&(_=y,p=x,m=o),y=0,x=o-r)),a=l,c=f,d=g),h=i,u=n}return y+=l,y>_?[x,o]:[p,m]}const d={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class f extends n.Z{constructor(t,e,i,n){super(t,e,i,n),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[o.bL]={fillStyle:o.bL},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e){const i=this.textFillState_,n=this.textStrokeState_,s=this.textState_;if(""===this.text_||!s||!i&&!n)return;const a=this.coordinates;let h=a.length;const d=t.getType();let f=null,g=t.getStride();if("line"!==s.placement||"LineString"!=d&&"MultiLineString"!=d&&"Polygon"!=d&&"MultiPolygon"!=d){let i=s.overflow?null:[];switch(d){case"Point":case"MultiPoint":f=t.getFlatCoordinates();break;case"LineString":f=t.getFlatMidpoint();break;case"Circle":f=t.getCenter();break;case"MultiLineString":f=t.getFlatMidpoints(),g=2;break;case"Polygon":f=t.getFlatInteriorPoint(),s.overflow||i.push(f[2]/this.resolution),g=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();f=[];for(let t=0,n=e.length;t{const n=a[2*(t+i)]===f[i*g]&&a[2*(t+i)+1]===f[i*g+1];return n||--t,n}))}this.saveTextStates_(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&this.updateFillStyle(this.state,this.createFill),s.backgroundStroke&&(this.updateStrokeStyle(this.state,this.applyStroke),this.hitDetectionInstructions.push(this.createStroke(this.state)))),this.beginGeometry(t,e);let l=s.padding;if(l!=o.oB&&(s.scale[0]<0||s.scale[1]<0)){let t=s.padding[0],e=s.padding[1],i=s.padding[2],n=s.padding[3];s.scale[0]<0&&(e=-e,n=-n),s.scale[1]<0&&(t=-t,i=-i),l=[t,e,i,n]}const u=this.pixelRatio;this.instructions.push([r.ZP.DRAW_IMAGE,h,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,void 0,this.declutterImageWithText_,l==o.oB?o.oB:l.map((function(t){return t*u})),!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]);const c=1/u,p=this.state.fillStyle;s.backgroundFill&&(this.state.fillStyle=o.bL,this.hitDetectionInstructions.push(this.createFill(this.state))),this.hitDetectionInstructions.push([r.ZP.DRAW_IMAGE,h,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[c,c],NaN,void 0,this.declutterImageWithText_,l,!!s.backgroundFill,!!s.backgroundStroke,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?o.bL:this.fillKey_,this.textOffsetX_,this.textOffsetY_,i]),s.backgroundFill&&(this.state.fillStyle=p,this.hitDetectionInstructions.push(this.createFill(this.state))),this.endGeometry(e)}else{if(!(0,l.kK)(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(f=t.getFlatCoordinates(),"LineString"==d)i=[f.length];else if("MultiLineString"==d)i=t.getEnds();else if("Polygon"==d)i=t.getEnds().slice(0,1);else if("MultiPolygon"==d){const e=t.getEndss();i=[];for(let t=0,n=e.length;ti%e<2))}e.Z=class{constructor(){this.globalCounter_=0,this.refToFeature_=new Map,this.uidToRef_=new Map,this.freeGlobalRef_=[],this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0},this.pointBatch={entries:{},geometriesCount:0},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0}}addFeatures(t,e){for(let i=0;i0?t[i-1]:null,o=s?s[s.length-1]:0,h=n[n.length-1];n=o>0?n.map((t=>t-o)):n,this.addCoordinates_("Polygon",e.slice(o,h),n,r,a,l)}break}case"MultiLineString":{const t=i;for(let i=0,n=t.length;i0?t[i-1]:0;this.addCoordinates_("LineString",e.slice(n,t[i]),null,r,a,l)}break}case"MultiPoint":for(let t=0,i=e.length;t1)return void this.addCoordinates_("MultiPolygon",e,i,r,a,l)}this.polygonBatch.entries[a]||(this.polygonBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]})),h=e.length/l;const u=i.length,c=i.map(((t,e,i)=>e>0?(t-i[e-1])/l:t/l));this.polygonBatch.verticesCount+=h,this.polygonBatch.ringsCount+=u,this.polygonBatch.geometriesCount++,this.polygonBatch.entries[a].flatCoordss.push(o(e,l)),this.polygonBatch.entries[a].ringsVerticesCounts.push(c),this.polygonBatch.entries[a].verticesCount+=h,this.polygonBatch.entries[a].ringsCount+=u;for(let i=0,n=t.length;i0?t[i-1]:0;this.addCoordinates_("LinearRing",e.slice(n,t[i]),null,r,a,l)}break}case"Point":this.pointBatch.entries[a]||(this.pointBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[]})),this.pointBatch.geometriesCount++,this.pointBatch.entries[a].flatCoordss.push(e);break;case"LineString":case"LinearRing":this.lineStringBatch.entries[a]||(this.lineStringBatch.entries[a]=this.addRefToEntry_(a,{feature:r,flatCoordss:[],verticesCount:0})),h=e.length/l,this.lineStringBatch.verticesCount+=h,this.lineStringBatch.geometriesCount++,this.lineStringBatch.entries[a].flatCoordss.push(o(e,l)),this.lineStringBatch.entries[a].verticesCount+=h}}addRefToEntry_(t,e){const i=this.uidToRef_.get(t),n=i||this.freeGlobalRef_.pop()||++this.globalCounter_;return e.ref=n,i||(this.refToFeature_.set(n,e.feature),this.uidToRef_.set(t,n)),e}returnRef_(t,e){if(!t)throw new Error("This feature has no ref: "+e);this.refToFeature_.delete(t),this.uidToRef_.delete(e),this.freeGlobalRef_.push(t)}changeFeature(t){this.removeFeature(t);const e=t.getGeometry();e&&this.addGeometry_(e,t)}removeFeature(t){let e;e=this.clearFeatureEntryInPointBatch_(t)||e,e=this.clearFeatureEntryInPolygonBatch_(t)||e,e=this.clearFeatureEntryInLineStringBatch_(t)||e,e&&this.returnRef_(e.ref,(0,r.sq)(e.feature))}clear(){this.polygonBatch.entries={},this.polygonBatch.geometriesCount=0,this.polygonBatch.verticesCount=0,this.polygonBatch.ringsCount=0,this.lineStringBatch.entries={},this.lineStringBatch.geometriesCount=0,this.lineStringBatch.verticesCount=0,this.pointBatch.entries={},this.pointBatch.geometriesCount=0,this.globalCounter_=0,this.freeGlobalRef_=[],this.refToFeature_.clear(),this.uidToRef_.clear()}getFeatureFromRef(t){return this.refToFeature_.get(t)}}},29346:function(t,e,i){"use strict";i.d(e,{Z:function(){return S}});var n=i(68001),r=i(91512),s=i(30439),o=i(95230),a=i(4082),l=i(44669),h=i(81275),u=i(11570);function c(t,e,i,n){let r=0;for(const s in e){const o=e[s],a=o.callback.call(i,i.feature);t[n+r++]=a[0]??a,o.size&&1!==o.size&&(t[n+r++]=a[1],o.size<3||(t[n+r++]=a[2],o.size<4||(t[n+r++]=a[3])))}return r}function d(t){return Object.keys(t).reduce(((e,i)=>e+(t[i].size||1)),0)}var f=i(31871);const g=[],p=(0,h.U)();let m=0;const _="a_position",y="a_index",x="a_segmentStart",v="a_segmentEnd",E="a_parameters",b="a_joinAngles",w="a_distance";var S=class{constructor(t,e,i){this.helper_=e,this.hitDetectionEnabled_=i;let n=t;if(!("builder"in t)){const e=(0,f.Zh)(t);n={builder:e.builder,attributes:e.attributes,uniforms:e.uniforms}}this.hasFill_=!!n.builder.getFillVertexShader(),this.hasFill_&&(this.fillVertexShader_=n.builder.getFillVertexShader(),this.fillFragmentShader_=n.builder.getFillFragmentShader(),this.fillProgram_=this.helper_.getProgram(this.fillFragmentShader_,this.fillVertexShader_)),this.hasStroke_=!!n.builder.getStrokeVertexShader(),this.hasStroke_&&(this.strokeVertexShader_=n.builder.getStrokeVertexShader(),this.strokeFragmentShader_=n.builder.getStrokeFragmentShader(),this.strokeProgram_=this.helper_.getProgram(this.strokeFragmentShader_,this.strokeVertexShader_)),this.hasSymbol_=!!n.builder.getSymbolVertexShader(),this.hasSymbol_&&(this.symbolVertexShader_=n.builder.getSymbolVertexShader(),this.symbolFragmentShader_=n.builder.getSymbolFragmentShader(),this.symbolProgram_=this.helper_.getProgram(this.symbolFragmentShader_,this.symbolVertexShader_));const r=this.hitDetectionEnabled_?{hitColor:{callback(){return(0,a.O$)(this.ref,g)},size:4}}:{};this.customAttributes_=Object.assign({},r,n.attributes),this.uniforms_=n.uniforms;const o=Object.entries(this.customAttributes_).map((([t,e])=>({name:`a_prop_${t}`,size:e.size||1,type:s.GC.FLOAT})));this.polygonAttributesDesc_=[{name:_,size:2,type:s.GC.FLOAT},...o],this.lineStringAttributesDesc_=[{name:x,size:2,type:s.GC.FLOAT},{name:v,size:2,type:s.GC.FLOAT},{name:b,size:2,type:s.GC.FLOAT},{name:w,size:1,type:s.GC.FLOAT},{name:E,size:1,type:s.GC.FLOAT},...o],this.pointAttributesDesc_=[{name:_,size:2,type:s.GC.FLOAT},{name:y,size:1,type:s.GC.FLOAT},...o],n.uniforms&&this.helper_.addUniforms(n.uniforms)}async generateBuffers(t,e){const i=this.generateRenderInstructions_(t,e),[n,r,s]=await Promise.all([this.generateBuffersForType_(i.polygonInstructions,"Polygon",e),this.generateBuffersForType_(i.lineStringInstructions,"LineString",e),this.generateBuffersForType_(i.pointInstructions,"Point",e)]);return{polygonBuffers:n,lineStringBuffers:r,pointBuffers:s,invertVerticesTransform:(0,l.nb)((0,l.Ue)(),e)}}generateRenderInstructions_(t,e){const i=this.hasFill_?function(t,e,i,n){const r=2*t.verticesCount+(1+d(i))*t.geometriesCount+t.ringsCount;e&&e.length===r||(e=new Float32Array(r));const s=[];let o=0;for(const r in t.entries){const a=t.entries[r];for(let t=0,r=a.flatCoordss.length;t{const e=i=>{const o=i.data;if(o.id!==s)return;if(p.removeEventListener("message",e),!this.helper_.getGL())return;const a=new n.ZP(r.qO,r.kd).fromArrayBuffer(o.vertexBuffer),l=new n.ZP(r.cX,r.kd).fromArrayBuffer(o.indexBuffer);this.helper_.flushBufferData(a),this.helper_.flushBufferData(l),t([l,a])};p.addEventListener("message",e)}))}render(t,e,i){this.hasFill_&&this.renderInternal_(t.polygonBuffers[0],t.polygonBuffers[1],this.fillProgram_,this.polygonAttributesDesc_,e,i),this.hasStroke_&&this.renderInternal_(t.lineStringBuffers[0],t.lineStringBuffers[1],this.strokeProgram_,this.lineStringAttributesDesc_,e,i),this.hasSymbol_&&this.renderInternal_(t.pointBuffers[0],t.pointBuffers[1],this.symbolProgram_,this.pointAttributesDesc_,e,i)}renderInternal_(t,e,i,n,r,s){const o=t.getSize();0!==o&&(this.helper_.useProgram(i,r),this.helper_.bindBuffer(e),this.helper_.bindBuffer(t),this.helper_.enableAttributes(n),s(),this.helper_.drawElements(0,o))}}},95230:function(t,e,i){"use strict";i.d(e,{S:function(){return n}});const n={GENERATE_POLYGON_BUFFERS:"GENERATE_POLYGON_BUFFERS",GENERATE_POINT_BUFFERS:"GENERATE_POINT_BUFFERS",GENERATE_LINE_STRING_BUFFERS:"GENERATE_LINE_STRING_BUFFERS"}},4082:function(t,e,i){"use strict";i.d(e,{O$:function(){return r},Vm:function(){return n},il:function(){return s}});i(61106);const n=.985;function r(t,e){const i=256,n=255;return(e=e||[])[0]=Math.floor(t/i/i/i)/n,e[1]=Math.floor(t/i/i)%i/n,e[2]=Math.floor(t/i)%i/n,e[3]=t%i/n,e}function s(t){let e=0;const i=256,n=255;return e+=Math.round(t[0]*i*i*i*n),e+=Math.round(t[1]*i*i*n),e+=Math.round(t[2]*i*n),e+=Math.round(t[3]*n),e}},3656:function(t,e,i){"use strict";var n=i(92486),r=i(13701),s=i(21320),o=i(22765);class a extends s.Z{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.declutterExecutorGroup=null}getFeatures(t){return(0,o.O3)()}getData(t){return null}prepareFrame(t){return(0,o.O3)()}renderFrame(t,e){return(0,o.O3)()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return(n,r)=>{const s=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,r,s)}}forEachFeatureAtCoordinate(t,e,i,n,r){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==r.Z.LOADED&&e.getState()!==r.Z.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=r.Z.LOADED&&e!=r.Z.ERROR&&t.addEventListener(n.Z.CHANGE,this.boundHandleImageChange_),e==r.Z.IDLE&&(t.load(),e=t.getState()),e==r.Z.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.layer_,super.disposeInternal()}}e.Z=a},89194:function(t,e,i){"use strict";var n=i(57913),r=i(13701),s=i(87334),o=i(44669),a=i(36117),l=i(81625);class h extends n.Z{constructor(t){super(t),this.image_=null}getImage(){return this.image_?this.image_.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,o=n.resolution,h=this.getLayer().getSource(),u=t.viewHints;let c=t.extent;if(void 0!==e.extent&&(c=(0,a.Ed)(c,(0,l.dY)(e.extent,n.projection))),!u[s.Z.ANIMATING]&&!u[s.Z.INTERACTING]&&!(0,a.xb)(c))if(h){const t=n.projection,e=h.getImage(c,o,i,t);e&&(this.loadImage(e)?this.image_=e:e.getState()===r.Z.EMPTY&&(this.image_=null))}else this.image_=null;return!!this.image_}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,o.nn)(e.pixelToCoordinateTransform,t.slice()),r=i.getExtent();if(r&&!(0,a.b8)(r,n))return null;const s=this.image_.getExtent(),l=this.image_.getImage(),h=(0,a.dz)(s),u=Math.floor(l.width*((n[0]-s[0])/h));if(u<0||u>=l.width)return null;const c=(0,a.Cr)(s),d=Math.floor(l.height*((s[3]-n[1])/c));return d<0||d>=l.height?null:this.getImageData(l,u,d)}renderFrame(t,e){const i=this.image_,n=i.getExtent(),r=i.getResolution(),[s,h]=Array.isArray(r)?r:[r,r],u=i.getPixelRatio(),c=t.layerStatesArray[t.layerIndex],d=t.pixelRatio,f=t.viewState,g=f.center,p=f.resolution,m=d*s/(p*u),_=d*h/(p*u),y=t.extent,x=f.resolution,v=f.rotation,E=Math.round((0,a.dz)(y)/x*d),b=Math.round((0,a.Cr)(y)/x*d);(0,o.qC)(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/d,1/d,v,-E/2,-b/2),(0,o.nb)(this.inversePixelTransform,this.pixelTransform);const w=(0,o.BB)(this.pixelTransform);this.useContainer(e,w,this.getBackground(t));const S=this.context,C=S.canvas;C.width!=E||C.height!=b?(C.width=E,C.height=b):this.containerReused||S.clearRect(0,0,E,b);let T=!1,M=!0;if(c.extent){const e=(0,l.dY)(c.extent,f.projection);M=(0,a.kK)(e,t.extent),T=M&&!(0,a.r4)(e,t.extent),T&&this.clipUnrotated(S,t,e)}const P=i.getImage(),R=(0,o.qC)(this.tempTransform,E/2,b/2,m,_,0,u*(n[0]-g[0])/s,u*(g[1]-n[3])/h);this.renderedResolution=h*d/u;const I=P.width*R[0],A=P.height*R[3];if(this.getLayer().getSource().getInterpolate()||(S.imageSmoothingEnabled=!1),this.preRender(S,t),M&&I>=.5&&A>=.5){const t=R[4],e=R[5],i=c.opacity;let n;1!==i&&(n=S.globalAlpha,S.globalAlpha=i),S.drawImage(P,0,0,+P.width,+P.height,t,e,I,A),1!==i&&(S.globalAlpha=n)}return this.postRender(S,t),T&&S.restore(),S.imageSmoothingEnabled=!0,w!==C.style.transform&&(C.style.transform=w),this.container}}e.Z=h},57913:function(t,e,i){"use strict";i.d(e,{r:function(){return c}});var n=i(3656),r=i(44594),s=i(95474),o=i(44669),a=i(12185),l=i(850),h=i(17367),u=i(36117);const c=[];let d=null;class f extends n.Z{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=(0,o.Ue)(),this.pixelTransform=(0,o.Ue)(),this.inversePixelTransform=(0,o.Ue)(),this.context=null,this.containerReused=!1,this.pixelContext_=null,this.frameState=null}getImageData(t,e,i){let n;d||(d=(0,l.E4)(1,1,void 0,{willReadFrequently:!0})),d.clearRect(0,0,1,1);try{d.drawImage(t,e,i,1,1,0,0,1,1),n=d.getImageData(0,0,1,1).data}catch(t){return d=null,null}return n}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i){const n=this.getLayer().getClassName();let r,s;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&(0,h.fS)((0,a._2)(t.style.backgroundColor),(0,a._2)(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(s=e.getContext("2d"))}if(s&&s.canvas.style.transform===e?(this.container=t,this.context=s,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){r=document.createElement("div"),r.className=n;let t=r.style;t.position="absolute",t.width="100%",t.height="100%",s=(0,l.E4)();const e=s.canvas;r.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=r,this.context=s}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=(0,u.rL)(i),r=(0,u.Xv)(i),s=(0,u.w$)(i),a=(0,u.hC)(i);(0,o.nn)(e.coordinateToPixelTransform,n),(0,o.nn)(e.coordinateToPixelTransform,r),(0,o.nn)(e.coordinateToPixelTransform,s),(0,o.nn)(e.coordinateToPixelTransform,a);const l=this.inversePixelTransform;(0,o.nn)(l,n),(0,o.nn)(l,r),(0,o.nn)(l,s),(0,o.nn)(l,a),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(a[0]),Math.round(a[1])),t.clip()}dispatchRenderEvent_(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new r.Z(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.dispatchRenderEvent_(s.Z.PRERENDER,t,e)}postRender(t,e){this.dispatchRenderEvent_(s.Z.POSTRENDER,t,e)}getRenderTransform(t,e,i,n,r,s,a){const l=r/2,h=s/2,u=n/e,c=-u,d=-t[0]+a,f=-t[1];return(0,o.qC)(this.tempTransform,l,h,u,c,-i,d,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}}e.Z=f},44235:function(t,e,i){"use strict";var n=i(57913),r=i(27859),s=i(27139),o=i(51748),a=i(74251),l=i(44669),h=i(17367),u=i(36117),c=i(81625),d=i(22765),f=i(81898);class g extends n.Z{constructor(t){super(t),this.extentChanged=!0,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.newTiles_=!1,this.tmpExtent=(0,u.lJ)(),this.tmpTileRange_=new o.Z(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==a.Z.LOADED||i==a.Z.EMPTY||i==a.Z.ERROR&&!n}getTile(t,e,i,n){const r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer();let l=o.getSource().getTile(t,e,i,r,s);return l.getState()==a.Z.ERROR&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.newTiles_=!0),this.isDrawableTile(l)||(l=l.getInterimTile()),l}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=(0,l.nn)(e.pixelToCoordinateTransform,t.slice()),o=i.getExtent();if(o&&!(0,u.b8)(o,n))return null;const h=e.pixelRatio,c=e.viewState.projection,d=e.viewState,g=i.getRenderSource(),p=g.getTileGridForProjection(d.projection),m=g.getTilePixelRatio(e.pixelRatio);for(let t=p.getZForResolution(d.resolution);t>=p.getMinZoom();--t){const e=p.getTileCoordForCoordAndZ(n,t),i=g.getTile(t,e[1],e[2],h,c);if(!(i instanceof r.Z||i instanceof s.Z)||i instanceof s.Z&&i.getState()===a.Z.EMPTY)return null;if(i.getState()!==a.Z.LOADED)continue;const o=p.getOrigin(t),l=(0,f.Pq)(p.getTileSize(t)),u=p.getResolution(t),_=Math.floor(m*((n[0]-o[0])/u-e[1]*l[0])),y=Math.floor(m*((o[1]-n[1])/u-e[2]*l[1])),x=Math.round(m*g.getGutterForProjection(d.projection));return this.getImageData(i.getImage(),_+x,y+x)}return null}loadedTileCallback(t,e,i){return!!this.isDrawableTile(i)&&super.loadedTileCallback(t,e,i)}prepareFrame(t){return!!this.getLayer().getSource()}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,f=n.rotation,g=t.pixelRatio,p=this.getLayer(),m=p.getSource(),_=m.getRevision(),y=m.getTileGridForProjection(r),x=y.getZForResolution(s,m.zDirection),v=y.getResolution(x);let E=t.extent;const b=t.viewState.resolution,w=m.getTilePixelRatio(g),S=Math.round((0,u.dz)(E)/b*g),C=Math.round((0,u.Cr)(E)/b*g),T=i.extent&&(0,c.dY)(i.extent,r);T&&(E=(0,u.Ed)(E,(0,c.dY)(i.extent,r)));const M=v*S/2/w,P=v*C/2/w,R=[o[0]-M,o[1]-P,o[0]+M,o[1]+P],I=y.getTileRangeForExtentAndZ(E,x),A={};A[x]={};const L=this.createLoadedTileFinder(m,r,A),F=this.tmpExtent,O=this.tmpTileRange_;this.newTiles_=!1;const Z=f?(0,u.dY)(n.center,b,f,t.size):void 0;for(let e=I.minX;e<=I.maxX;++e)for(let n=I.minY;n<=I.maxY;++n){if(f&&!y.tileCoordIntersectsViewport([x,e,n],Z))continue;const r=this.getTile(x,e,n,t);if(this.isDrawableTile(r)){const e=(0,d.sq)(this);if(r.getState()==a.Z.LOADED){A[x][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==i.opacity&&(r.endTransition(e),t=!1),this.newTiles_||!t&&this.renderedTiles.includes(r)||(this.newTiles_=!0)}if(1===r.getAlpha(e,t.time))continue}const s=y.getTileCoordChildTileRange(r.tileCoord,O,F);let o=!1;s&&(o=L(x+1,s)),o||y.forEachTileCoordParentTileRange(r.tileCoord,L,O,F)}const k=v/s*g/w;(0,l.qC)(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/g,1/g,f,-S/2,-C/2);const D=(0,l.BB)(this.pixelTransform);this.useContainer(e,D,this.getBackground(t));const N=this.context,G=N.canvas;(0,l.nb)(this.inversePixelTransform,this.pixelTransform),(0,l.qC)(this.tempTransform,S/2,C/2,k,k,0,-S/2,-C/2),G.width!=S||G.height!=C?(G.width=S,G.height=C):this.containerReused||N.clearRect(0,0,S,C),T&&this.clipUnrotated(N,t,T),m.getInterpolate()||(N.imageSmoothingEnabled=!1),this.preRender(N,t),this.renderedTiles.length=0;let z,j,U,B=Object.keys(A).map(Number);B.sort(h.j2),1!==i.opacity||this.containerReused&&!m.getOpaque(t.viewState.projection)?(z=[],j=[]):B=B.reverse();for(let e=B.length-1;e>=0;--e){const i=B[e],n=m.getTilePixelSize(i,g,r),s=y.getResolution(i)/v,o=n[0]*s*k,a=n[1]*s*k,h=y.getTileCoordForCoordAndZ((0,u.rL)(R),i),c=y.getTileCoordExtent(h),f=(0,l.nn)(this.tempTransform,[w*(c[0]-R[0])/v,w*(R[3]-c[3])/v]),p=w*m.getGutterForProjection(r),_=A[i];for(const e in _){const n=_[e],r=n.tileCoord,s=h[1]-r[1],l=Math.round(f[0]-(s-1)*o),c=h[2]-r[2],g=Math.round(f[1]-(c-1)*a),y=Math.round(f[0]-s*o),v=Math.round(f[1]-c*a),E=l-y,b=g-v,w=x===i,S=w&&1!==n.getAlpha((0,d.sq)(this),t.time);let C=!1;if(!S)if(z){U=[y,v,y+E,v,y+E,v+b,y,v+b];for(let t=0,e=z.length;t{if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=[this.context.canvas.width,this.context.canvas.height];(0,h.nn)(this.pixelTransform,t);const e=this.renderedCenter_,i=this.renderedResolution_,n=this.renderedRotation_,r=this.renderedProjection_,s=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],c=t[0]*l.UN,d=t[1]*l.UN;a.push(this.getRenderTransform(e,i,n,l.UN,c,d,0).slice());const f=o.getSource(),g=r.getExtent();if(f.getWrapX()&&r.canWrapX()&&!(0,u.r4)(g,s)){let t=s[0];const r=(0,u.dz)(g);let o,h=0;for(;tg[2];)++h,o=r*h,a.push(this.getRenderTransform(e,i,n,l.UN,c,d,o).slice()),t-=r}this.hitDetectionImageData_=(0,l.TU)(t,a,this.renderedFeatures_,o.getStyleFunction(),s,i,n)}e((0,l.ix)(t,this.renderedFeatures_,this.hitDetectionImageData_))}))}forEachFeatureAtCoordinate(t,e,i,n,r){if(!this.replayGroup_)return;const s=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),l={},h=function(t,e,i){const s=(0,p.sq)(t),o=l[s];if(o){if(!0!==o&&iu=n.forEachFeatureAtCoordinate(t,s,o,i,h,n===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),u}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const r=t.viewHints[a.Z.ANIMATING],o=t.viewHints[a.Z.INTERACTING],l=e.getUpdateWhileAnimating(),h=e.getUpdateWhileInteracting();if(this.ready&&!l&&r||!h&&o)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const c=t.extent,p=t.viewState,_=p.projection,y=p.resolution,x=t.pixelRatio,v=e.getRevision(),E=e.getRenderBuffer();let b=e.getRenderOrder();void 0===b&&(b=d.eR);const w=p.center.slice(),S=(0,u.f3)(c,E*y),C=S.slice(),T=[S.slice()],M=_.getExtent();if(i.getWrapX()&&_.canWrapX()&&!(0,u.r4)(M,t.extent)){const t=(0,u.dz)(M),e=Math.max((0,u.dz)(S)/2,t);S[0]=M[0]-e,S[2]=M[2]+e,(0,m.Cf)(w,_);const i=(0,u.Cf)(T[0],_);i[0]M[0]&&i[2]>M[2]&&T.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.renderedResolution_==y&&this.renderedRevision_==v&&this.renderedRenderOrder_==b&&(0,u.r4)(this.wrappedRenderedExtent_,S))return(0,f.fS)(this.renderedExtent_,C)||(this.hitDetectionImageData_=null,this.renderedExtent_=C),this.renderedCenter_=w,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const P=new n.Z((0,d.Qz)(y,x),S,y,x);let R;this.getLayer().getDeclutter()&&(R=new n.Z((0,d.Qz)(y,x),S,y,x));const I=(0,g.Cs)();let A;if(I){for(let t=0,e=T.length;t{let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,y)),i){const e=this.renderFeature(t,L,i,P,A,R);F=F&&!e}},Z=(0,g.Fj)(S,_),k=i.getFeaturesInExtent(Z);b&&k.sort(b);for(let t=0,e=k.length;t0;return f&&Promise.all(h).then((()=>s(null))),function(t,e,i,n,r,s){const a=i.getGeometryFunction()(e);if(!a)return;const l=a.simplifyTransformed(n,r),h=i.getRenderer();if(h)c(t,l,i,e);else{(0,o[l.getType()])(t,l,i,e,s)}}(t,e,i,r,a,l),f}function c(t,e,i,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,s=r.length;e{const e=t.data;if(e.type===c.S.GENERATE_POINT_BUFFERS){const i=e.projectionTransform;this.verticesBuffer_.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.verticesBuffer_),this.indicesBuffer_.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.indicesBuffer_),this.renderTransform_=i,(0,d.nb)(this.invertRenderTransform_,this.renderTransform_),this.renderInstructions_=new Float32Array(t.data.renderInstructions),e.id===this.lastSentId&&(this.ready=!0),this.getLayer().changed()}})),this.featureCache_={},this.featureCount_=0;const a=this.getLayer().getSource();this.sourceListenKeys_=[(0,v.oL)(a,r.Z.ADDFEATURE,this.handleSourceFeatureAdded_,this),(0,v.oL)(a,r.Z.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,v.oL)(a,r.Z.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,v.oL)(a,r.Z.CLEAR,this.handleSourceFeatureClear_,this)],a.forEachFeature((t=>{this.featureCache_[(0,y.sq)(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.featureCount_++}))}afterHelperCreated(){this.program_=this.helper.getProgram(this.fragmentShader_,this.vertexShader_),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new l.Z(this.helper))}handleSourceFeatureAdded_(t){const e=t.feature;this.featureCache_[(0,y.sq)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.featureCount_++}handleSourceFeatureChanged_(t){const e=t.feature;this.featureCache_[(0,y.sq)(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}handleSourceFeatureDelete_(t){const e=t.feature;delete this.featureCache_[(0,y.sq)(e)],this.featureCount_--}handleSourceFeatureClear_(){this.featureCache_={},this.featureCount_=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=(0,x.X)(t,this.getLayer());this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t);return this.helper.getCanvas()}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),r=t.viewState,o=!t.viewHints[s.Z.ANIMATING]&&!t.viewHints[s.Z.INTERACTING],a=!(0,g.fS)(this.previousExtent_,t.extent),l=this.sourceRevision_0&&(x=a,(0,b.Ed)(x,n,x)),this.helper.setUniformFloatVec4(C.RENDER_EXTENT,x),this.helper.setUniformFloatValue(C.RESOLUTION,f.resolution),this.helper.setUniformFloatValue(C.ZOOM,f.zoom),this.helper.setUniformFloatValue(C.TEXTURE_PIXEL_WIDTH,g),this.helper.setUniformFloatValue(C.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(C.TEXTURE_RESOLUTION,r),this.helper.setUniformFloatValue(C.TEXTURE_ORIGIN_X,o[0]+_*s[0]*r-h*r),this.helper.setUniformFloatValue(C.TEXTURE_ORIGIN_Y,o[1]-y*s[1]*r+h*r),this.helper.drawElements(0,this.indices_.getSize())}getData(t){if(!this.helper.getGL())return null;const e=this.frameState;if(!e)return null;const i=this.getLayer(),o=(0,E.nn)(e.pixelToCoordinateTransform,t.slice()),a=e.viewState,l=i.getExtent();if(l&&!(0,b.b8)((0,w.dY)(l,a.projection),o))return null;const h=i.getSources((0,b.hI)([o]),a.resolution);let u,c,d;for(u=h.length-1;u>=0;--u)if(c=h[u],"ready"===c.getState()){if(d=c.getTileGridForProjection(a.projection),c.getWrapX())break;const t=d.getExtent();if(!t||(0,b.b8)(t,o))break}if(u<0)return null;const g=this.tileRepresentationCache;for(let t=d.getZForResolution(a.resolution);t>=d.getMinZoom();--t){const e=d.getTileCoordForCoordAndZ(o,t),i=(0,x.ah)(c,e);if(!g.containsKey(i))continue;const a=g.get(i),l=a.tile;if((l instanceof r.Z||l instanceof n.Z)&&l.getState()===s.Z.EMPTY)return null;if(!a.loaded)continue;const h=d.getOrigin(t),u=(0,f.Pq)(d.getTileSize(t)),p=d.getResolution(t),m=(o[0]-h[0])/p-e[1]*u[0],_=(h[1]-o[1])/p-e[2]*u[1];return a.getPixelData(m,_)}return null}disposeInternal(){const t=this.helper;if(t){t.getGL().deleteProgram(this.program_),delete this.program_,t.deleteBuffer(this.indices_)}super.disposeInternal(),delete this.indices_}}var R=P},83044:function(t,e,i){"use strict";i.d(e,{XE:function(){return _},ah:function(){return w}});var n=i(80316),r=i(40485),s=i(27139),o=i(51748),a=i(74251),l=i(29295),h=i(22765),u=i(94704),c=i(69649),d=i(44669),f=i(17367),g=i(81625),p=i(36117),m=i(81898);const _={TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",RESOLUTION:"u_resolution",ZOOM:"u_zoom",GLOBAL_ALPHA:"u_globalAlpha",PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix"},y={};function x(t){return 1/(t+2)}function v(t,e){return t.tileIds.has((0,h.sq)(e))}function E(t,e,i){const n=t.representationsByZ;i in n||(n[i]=new Set),n[i].add(e),t.tileIds.add((0,h.sq)(e.tile))}function b(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=(0,p.Ed)(e,(0,g.dY)(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=(0,p.Ed)(e,i))}return e}function w(t,e){return`${t.getKey()},${(0,c.km)(e)}`}class S extends l.Z{constructor(t,e){super(t,{uniforms:e.uniforms,postProcesses:e.postProcesses}),this.renderComplete=!1,this.tileTransform_=(0,d.Ue)(),this.tempMat4=(0,u.U)(),this.tempTileRange_=new o.Z(0,0,0,0),this.tempTileCoord_=(0,c.T9)(0,0,0),this.tempSize_=[0,0];const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileRepresentationCache=new n.Z(i),this.frameState=null,this.projection_=void 0}reset(t){super.reset({uniforms:t.uniforms})}isDrawableTile_(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==a.Z.LOADED||i==a.Z.EMPTY||i==a.Z.ERROR&&!n}prepareFrameInternal(t){this.projection_?t.viewState.projection!==this.projection_&&(this.clearCache(),this.projection_=t.viewState.projection):this.projection_=t.viewState.projection;const e=this.getLayer().getRenderSource();return!!e&&(!(0,p.xb)(b(t,t.extent))&&"ready"===e.getState())}createTileRepresentation(t){return(0,h.O3)()}enqueueTiles(t,e,i,n,r){const s=t.viewState,o=this.getLayer(),l=o.getRenderSource(),u=l.getTileGridForProjection(s.projection),d=l.getGutterForProjection(s.projection),f=(0,h.sq)(l);f in t.wantedTiles||(t.wantedTiles[f]={});const g=t.wantedTiles[f],p=this.tileRepresentationCache,m=o.getMapInternal(),_=Math.max(i-r,u.getMinZoom(),u.getZForResolution(Math.min(o.getMaxResolution(),m?m.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):u.getResolution(0)),l.zDirection));for(let r=i;r>=_;--r){const i=u.getTileRangeForExtentAndZ(e,r,this.tempTileRange_),o=u.getResolution(r);for(let e=i.minX;e<=i.maxX;++e)for(let h=i.minY;h<=i.maxY;++h){const i=(0,c.T9)(r,e,h,this.tempTileCoord_),m=w(l,i);let _,y;if(p.containsKey(m)&&(_=p.get(m),y=_.tile),_&&_.tile.key===l.getKey()||(y=l.getTile(r,e,h,t.pixelRatio,s.projection)),v(n,y))continue;if(_)if(this.isDrawableTile_(y))_.setTile(y);else{const t=y.getInterimTile();_.setTile(t)}else _=this.createTileRepresentation({tile:y,grid:u,helper:this.helper,gutter:d}),p.set(m,_);E(n,_,r);const x=y.getKey();g[x]=!0,y.getState()===a.Z.IDLE&&(t.tileQueue.isKeyQueued(x)||t.tileQueue.enqueue([y,f,u.getTileCoordCenter(i),o]))}}}beforeTilesRender(t,e){this.helper.prepareDraw(this.frameState,!e,!0)}beforeTilesMaskRender(t){return!1}renderTile(t,e,i,n,r,s,o,a,l,h,u){}renderTileMask(t,e,i,n){}drawTile_(t,e,i,n,r,s,o){if(!e.ready)return;const a=e.tile.tileCoord,l=(0,c.km)(a),h=l in s?s[l]:1,u=o.getResolution(i),f=(0,m.Pq)(o.getTileSize(i),this.tempSize_),g=o.getOrigin(i),p=o.getTileCoordExtent(a),_=h<1?-1:x(i);h<1&&(t.animate=!0);const y=t.viewState,v=y.center[0],E=y.center[1],b=f[0]+2*n,w=f[1]+2*n,S=b/w,C=(v-g[0])/(f[0]*u),T=(g[1]-E)/(f[1]*u),M=y.resolution/u,P=a[1],R=a[2];(0,d.mc)(this.tileTransform_),(0,d.bA)(this.tileTransform_,2/(t.size[0]*M/b),-2/(t.size[1]*M/b)),(0,d.U1)(this.tileTransform_,y.rotation),(0,d.bA)(this.tileTransform_,1,1/S),(0,d.Iu)(this.tileTransform_,(f[0]*(P-C)-n)/b,(f[1]*(R-T)-n)/w),this.renderTile(e,this.tileTransform_,t,r,u,f,g,p,_,n,h)}renderFrame(t){this.frameState=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState,n=this.getLayer(),o=n.getRenderSource(),l=o.getTileGridForProjection(i.projection),u=o.getGutterForProjection(i.projection),d=b(t,t.extent),g=l.getZForResolution(i.resolution,o.zDirection),p={tileIds:new Set,representationsByZ:{}},m=n.getPreload();if(t.nextExtent){const e=l.getZForResolution(i.nextResolution,o.zDirection),n=b(t,t.nextExtent);this.enqueueTiles(t,n,e,p,m)}this.enqueueTiles(t,d,g,p,0),m>0&&setTimeout((()=>{this.enqueueTiles(t,d,g-1,p,m-1)}),0);const _={},v=(0,h.sq)(this),E=t.time;let w=!1;for(const t of p.representationsByZ[g]){const e=t.tile;if((e instanceof s.Z||e instanceof r.Z)&&e.getState()===a.Z.EMPTY)continue;const i=e.tileCoord;if(t.ready){const t=e.getAlpha(v,E);if(1===t){e.endTransition(v);continue}w=!0;_[(0,c.km)(i)]=t}this.renderComplete=!1;if(this.findAltTiles_(l,i,g+1,p))continue;const n=l.getMinZoom();for(let t=g-1;t>=n;--t){if(this.findAltTiles_(l,i,t,p))break}}const S=p.representationsByZ,C=Object.keys(S).map(Number).sort(f.$1);if(this.beforeTilesMaskRender(t))for(let t=0,e=C.length;tt.dispose())),t.clear()}removeHelper(){this.helper&&this.clearCache(),super.removeHelper()}disposeInternal(){super.disposeInternal(),delete this.frameState}}e.ZP=S},11395:function(t,e,i){"use strict";var n=i(9050),r=i(53214),s=i(70487),o=i(29346),a=i(87334),l=i(29295),h=i(67953),u=i(30439),c=i(44669),d=i(23422),f=i(36117),g=i(4082),p=i(94704),m=i(81625),_=i(59332),y=i(41507);const x={...u.ZC,RENDER_EXTENT:"u_renderExtent",PATTERN_ORIGIN:"u_patternOrigin",GLOBAL_ALPHA:"u_globalAlpha"};class v extends l.Z{constructor(t,e){super(t,{uniforms:{[x.RENDER_EXTENT]:[0,0,0,0],[x.PATTERN_ORIGIN]:[0,0],[x.GLOBAL_ALPHA]:1},postProcesses:e.postProcesses}),this.hitDetectionEnabled_=!e.disableHitDetection,this.hitRenderTarget_,this.sourceRevision_=-1,this.previousExtent_=(0,f.lJ)(),this.currentTransform_=(0,c.Ue)(),this.tmpCoords_=[0,0],this.tmpTransform_=(0,c.Ue)(),this.tmpMat4_=(0,p.U)(),this.currentFrameStateTransform_=(0,c.Ue)(),this.styles_=[],this.styleRenderers_=[],this.buffers_=[],this.applyOptions_(e),this.batch_=new r.Z,this.initialFeaturesAdded_=!1,this.sourceListenKeys_=null}addInitialFeatures_(t){const e=this.getLayer().getSource(),i=(0,m.Cs)();let n;i&&(n=(0,m.WO)(i,t.viewState.projection)),this.batch_.addFeatures(e.getFeatures(),n),this.sourceListenKeys_=[(0,y.oL)(e,s.Z.ADDFEATURE,this.handleSourceFeatureAdded_.bind(this,n),this),(0,y.oL)(e,s.Z.CHANGEFEATURE,this.handleSourceFeatureChanged_,this),(0,y.oL)(e,s.Z.REMOVEFEATURE,this.handleSourceFeatureDelete_,this),(0,y.oL)(e,s.Z.CLEAR,this.handleSourceFeatureClear_,this)]}applyOptions_(t){this.styles_=Array.isArray(t.style)?t.style:[t.style]}createRenderers_(){this.buffers_=[],this.styleRenderers_=this.styles_.map((t=>new o.Z(t,this.helper,this.hitDetectionEnabled_)))}reset(t){this.applyOptions_(t),this.helper&&this.createRenderers_(),super.reset(t)}afterHelperCreated(){this.createRenderers_(),this.hitDetectionEnabled_&&(this.hitRenderTarget_=new h.Z(this.helper))}handleSourceFeatureAdded_(t,e){const i=e.feature;this.batch_.addFeature(i,t)}handleSourceFeatureChanged_(t){const e=t.feature;this.batch_.changeFeature(e)}handleSourceFeatureDelete_(t){const e=t.feature;this.batch_.removeFeature(e)}handleSourceFeatureClear_(){this.batch_.clear()}applyUniforms_(t){(0,c.lk)(this.tmpTransform_,this.currentFrameStateTransform_),(0,c.Jp)(this.tmpTransform_,t),this.helper.setUniformMatrixValue(x.PROJECTION_MATRIX,(0,p.u)(this.tmpMat4_,this.tmpTransform_)),(0,c.nb)(this.tmpTransform_,this.tmpTransform_),this.helper.setUniformMatrixValue(x.SCREEN_TO_WORLD_MATRIX,(0,p.u)(this.tmpMat4_,this.tmpTransform_)),this.tmpCoords_[0]=0,this.tmpCoords_[1]=0,(0,c.nb)(this.tmpTransform_,t),(0,c.nn)(this.tmpTransform_,this.tmpCoords_),this.helper.setUniformFloatVec2(x.PATTERN_ORIGIN,this.tmpCoords_)}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const[i,n,r]=(0,_.X)(t,this.getLayer());this.helper.prepareDraw(t),this.renderWorlds(t,!1,i,n,r),this.helper.finalizeDraw(t);const s=this.helper.getCanvas(),o=t.layerStatesArray[t.layerIndex].opacity;return o!==parseFloat(s.style.opacity)&&(s.style.opacity=String(o)),this.hitDetectionEnabled_&&(this.renderWorlds(t,!0,i,n,r),this.hitRenderTarget_.clearCachedData()),this.postRender(e,t),s}prepareFrameInternal(t){this.initialFeaturesAdded_||(this.addInitialFeatures_(t),this.initialFeaturesAdded_=!0);const e=this.getLayer(),i=e.getSource(),r=t.viewState,s=!t.viewHints[a.Z.ANIMATING]&&!t.viewHints[a.Z.INTERACTING],o=!(0,f.fS)(this.previousExtent_,t.extent),l=this.sourceRevision_t.generateBuffers(this.batch_,u).then((t=>{this.buffers_[e]=t}))));Promise.all(d).then((()=>{this.ready=!0,this.getLayer().changed()})),this.previousExtent_=t.extent.slice()}return!0}renderWorlds(t,e,i,n,r){let s=i;e&&(this.hitRenderTarget_.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.prepareDrawToRenderTarget(t,this.hitRenderTarget_,!0)),this.currentFrameStateTransform_=this.helper.makeProjectionTransform(t,this.currentFrameStateTransform_);do{for(let i=0,n=this.styleRenderers_.length;i{this.applyUniforms_(r.invertVerticesTransform),this.helper.applyHitDetectionUniform(e)}))}(0,c.Iu)(this.currentFrameStateTransform_,r,0)}while(++s2||Math.abs(t[4*e+3]-191.25)>2}function c(t,e,i,r){const o=(0,s.vs)(i,e,t);let a=(0,s._Q)(e,r,i);const l=e.getMetersPerUnit();void 0!==l&&(a*=l);const h=t.getMetersPerUnit();void 0!==h&&(a/=h);const u=t.getExtent();if(!u||(0,n.b8)(u,o)){const e=(0,s._Q)(t,a,o)/a;isFinite(e)&&e>0&&(a/=e)}return a}function d(t,e,i,r){const s=(0,n.qg)(i);let o=c(t,e,s,r);return(!isFinite(o)||o<=0)&&(0,n.H6)(i,(function(i){return o=c(t,e,i,r),isFinite(o)&&o>0})),o}function f(t,e,i,s,c,d,f,g,p,m,_,y,x){const v=(0,r.E4)(Math.round(i*t),Math.round(i*e),l);if(y||(v.imageSmoothingEnabled=!1),0===p.length)return v.canvas;function E(t){return Math.round(t*i)/i}v.scale(i,i),v.globalCompositeOperation="lighter";const b=(0,n.lJ)();let w;p.forEach((function(t,e,i){(0,n.l7)(b,t.extent)}));const S=i/s,C=(y?1:1+Math.pow(2,-24))/S;x&&1===p.length&&0===m||(w=(0,r.E4)(Math.round((0,n.dz)(b)*S),Math.round((0,n.Cr)(b)*S),l),y||(w.imageSmoothingEnabled=!1),p.forEach((function(t,e,i){const r=(t.extent[0]-b[0])*S,s=-(t.extent[3]-b[3])*S,o=(0,n.dz)(t.extent)*S,a=(0,n.Cr)(t.extent)*S;t.image.width>0&&t.image.height>0&&w.drawImage(t.image,m,m,t.image.width-2*m,t.image.height-2*m,y?r:Math.round(r),y?s:Math.round(s),y?o:Math.round(r+o)-Math.round(r),y?a:Math.round(s+a)-Math.round(s))})));const T=(0,n.rL)(f);return g.getTriangles().forEach((function(t,e,i){const s=t.source,c=t.target;let f=s[0][0],g=s[0][1],m=s[1][0],_=s[1][1],x=s[2][0],S=s[2][1];const M=E((c[0][0]-T[0])/d),P=E(-(c[0][1]-T[1])/d),R=E((c[1][0]-T[0])/d),I=E(-(c[1][1]-T[1])/d),A=E((c[2][0]-T[0])/d),L=E(-(c[2][1]-T[1])/d),F=f,O=g;f=0,g=0,m-=F,_-=O,x-=F,S-=O;const Z=[[m,_,0,0,R-M],[x,S,0,0,A-M],[0,0,m,_,I-P],[0,0,x,S,L-P]],k=(0,o.SV)(Z);if(!k)return;if(v.save(),v.beginPath(),function(){if(void 0===a){const t=(0,r.E4)(6,6,l);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",h(t,4,5,4,0),h(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;a=u(e,0)||u(e,4)||u(e,8),(0,r.jy)(t),l.push(t.canvas)}return a}()||!y){v.moveTo(R,I);const t=4,e=M-R,i=P-I;for(let n=0;nPromise.resolve(new Uint8Array(4)),interpolate:t.interpolate,transition:t.transition}),this.pixelRatio_=t.pixelRatio,this.gutter_=t.gutter,this.reprojData_=null,this.reprojError_=null,this.reprojSize_=void 0,this.sourceTileGrid_=t.sourceTileGrid,this.targetTileGrid_=t.targetTileGrid,this.wrappedTileCoord_=t.wrappedTileCoord||t.tileCoord,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const e=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_),i=this.targetTileGrid_.getExtent();let r=this.sourceTileGrid_.getExtent();const s=i?(0,c.Ed)(e,i):e;if(0===(0,c.bg)(s))return void(this.state=o.Z.EMPTY);const u=t.sourceProj,d=u.getExtent();d&&(r=r?(0,c.Ed)(r,d):d);const f=this.targetTileGrid_.getResolution(this.wrappedTileCoord_[0]),g=t.targetProj,p=(0,l.Co)(u,g,s,f);if(!isFinite(p)||p<=0)return void(this.state=o.Z.EMPTY);const m=void 0!==t.errorThreshold?t.errorThreshold:n.m;if(this.triangulation_=new a.Z(u,g,s,r,p*m,f),0===this.triangulation_.getTriangles().length)return void(this.state=o.Z.EMPTY);this.sourceZ_=this.sourceTileGrid_.getZForResolution(p);let _=this.triangulation_.calculateSourceExtent();if(r&&(u.canWrapX()?(_[1]=(0,h.uZ)(_[1],r[1],r[3]),_[3]=(0,h.uZ)(_[3],r[1],r[3])):_=(0,c.Ed)(_,r)),(0,c.bg)(_)){const e=this.sourceTileGrid_.getTileRangeForExtentAndZ(_,this.sourceZ_),i=t.getTileFunction;for(let t=e.minX;t<=e.maxX;t++)for(let n=e.minY;n<=e.maxY;n++){const e=i(this.sourceZ_,t,n,this.pixelRatio_);e&&this.sourceTiles_.push(e)}0===this.sourceTiles_.length&&(this.state=o.Z.EMPTY)}else this.state=o.Z.EMPTY}getSize(){return this.reprojSize_}getData(){return this.reprojData_}getError(){return this.reprojError_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{if(!e||e.getState()!==o.Z.LOADED)return;const i=e.getSize(),n=this.gutter_;let s;const a=(0,r.px)(e.getData());s=a||(0,r.qo)((0,r.G0)(e.getData()));const l=[i[0]+2*n,i[1]+2*n],h=s instanceof Float32Array,u=l[0]*l[1],c=h?Float32Array:Uint8Array,d=new c(s.buffer),f=c.BYTES_PER_ELEMENT,g=f*d.length/u,p=d.byteLength/l[1],m=Math.floor(p/f/l[0]),_=u*m;let y=d;if(d.length!==_){y=new c(_);let t=0,e=0;const i=l[0]*m;for(let n=0;n=0;--e){const i=[];for(let n=0,r=t.length;n{const i=e.getState();if(i!==o.Z.IDLE&&i!==o.Z.LOADING)return;t++;const n=(0,d.oL)(e,s.Z.CHANGE,(function(){const i=e.getState();i!=o.Z.LOADED&&i!=o.Z.ERROR&&i!=o.Z.EMPTY||((0,d.bN)(n),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(n)})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t){t.getState()==o.Z.IDLE&&t.load()}))}unlistenSources_(){this.sourcesListenerKeys_.forEach(d.bN),this.sourcesListenerKeys_=null}}e.Z=f},27139:function(t,e,i){"use strict";var n=i(41948),r=i(92486),s=i(69319),o=i(74251),a=i(76423),l=i(17708),h=i(63312),u=i(36117),c=i(41507),d=i(850);class f extends s.Z{constructor(t,e,i,r,s,c,d,f,g,p,m,_){super(s,o.Z.IDLE,_),this.renderEdges_=void 0!==m&&m,this.pixelRatio_=d,this.gutter_=f,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=r,this.wrappedTileCoord_=c||s,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0;const y=r.getTileCoordExtent(this.wrappedTileCoord_),x=this.targetTileGrid_.getExtent();let v=this.sourceTileGrid_.getExtent();const E=x?(0,u.Ed)(y,x):y;if(0===(0,u.bg)(E))return void(this.state=o.Z.EMPTY);const b=t.getExtent();b&&(v=v?(0,u.Ed)(v,b):b);const w=r.getResolution(this.wrappedTileCoord_[0]),S=(0,l.Co)(t,i,E,w);if(!isFinite(S)||S<=0)return void(this.state=o.Z.EMPTY);const C=void 0!==p?p:n.m;if(this.triangulation_=new a.Z(t,i,E,v,S*C,w),0===this.triangulation_.getTriangles().length)return void(this.state=o.Z.EMPTY);this.sourceZ_=e.getZForResolution(S);let T=this.triangulation_.calculateSourceExtent();if(v&&(t.canWrapX()?(T[1]=(0,h.uZ)(T[1],v[1],v[3]),T[3]=(0,h.uZ)(T[3],v[1],v[3])):T=(0,u.Ed)(T,v)),(0,u.bg)(T)){const t=e.getTileRangeForExtentAndZ(T,this.sourceZ_);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=g(this.sourceZ_,e,i,d);t&&this.sourceTiles_.push(t)}0===this.sourceTiles_.length&&(this.state=o.Z.EMPTY)}else this.state=o.Z.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach((e=>{e&&e.getState()==o.Z.LOADED&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})})),this.sourceTiles_.length=0,0===t.length)this.state=o.Z.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),a=this.sourceTileGrid_.getResolution(this.sourceZ_),h=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=(0,l.sY)(n,r,this.pixelRatio_,a,this.sourceTileGrid_.getExtent(),s,h,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=o.Z.LOADED}this.changed()}load(){if(this.state==o.Z.IDLE){this.state=o.Z.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach((e=>{const i=e.getState();if(i==o.Z.IDLE||i==o.Z.LOADING){t++;const i=(0,c.oL)(e,r.Z.CHANGE,(function(n){const r=e.getState();r!=o.Z.LOADED&&r!=o.Z.ERROR&&r!=o.Z.EMPTY||((0,c.bN)(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(i)}})),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach((function(t,e,i){t.getState()==o.Z.IDLE&&t.load()}))}}unlistenSources_(){this.sourcesListenerKeys_.forEach(c.bN),this.sourcesListenerKeys_=null}release(){this.canvas_&&((0,d.jy)(this.canvas_.getContext("2d")),l.rX.push(this.canvas_),this.canvas_=null),super.release()}}e.Z=f},76423:function(t,e,i){"use strict";var n=i(36117),r=i(81625),s=i(63312);e.Z=class{constructor(t,e,i,s,o,a){this.sourceProj_=t,this.targetProj_=e;let l={};const h=(0,r.Ck)(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return l[e]||(l[e]=h(t)),l[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=o*o,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&(0,n.dz)(s)>=(0,n.dz)(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?(0,n.dz)(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?(0,n.dz)(this.targetProj_.getExtent()):null;const u=(0,n.rL)(i),c=(0,n.Xv)(i),d=(0,n.w$)(i),f=(0,n.hC)(i),g=this.transformInv_(u),p=this.transformInv_(c),m=this.transformInv_(d),_=this.transformInv_(f),y=10+(a?Math.max(0,Math.ceil(Math.log2((0,n.bg)(i)/(a*a*256*256)))):0);if(this.addQuad_(u,c,d,f,g,p,m,_,y),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.triangles_.forEach((e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const n=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-n.5&&d<1;let p=!1;if(u>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const s=(0,n.hI)([t,e,i,r]);p=(0,n.dz)(s)/this.targetWorldWidth_>.25||p}!g&&this.sourceProj_.isGlobal()&&d&&(p=d>.25||p)}if(!p&&this.maxSourceExtent_&&isFinite(c[0])&&isFinite(c[1])&&isFinite(c[2])&&isFinite(c[3])&&!(0,n.kK)(c,this.maxSourceExtent_))return;let m=0;if(!(p||isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])&&isFinite(l[0])&&isFinite(l[1])&&isFinite(h[0])&&isFinite(h[1])))if(u>0)p=!0;else if(m=(isFinite(o[0])&&isFinite(o[1])?0:8)+(isFinite(a[0])&&isFinite(a[1])?0:4)+(isFinite(l[0])&&isFinite(l[1])?0:2)+(isFinite(h[0])&&isFinite(h[1])?0:1),1!=m&&2!=m&&4!=m&&8!=m)return;if(u>0){if(!p){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.transformInv_(e);let r;if(g){r=((0,s.$W)(o[0],f)+(0,s.$W)(l[0],f))/2-(0,s.$W)(n[0],f)}else r=(o[0]+l[0])/2-n[0];const a=(o[1]+l[1])/2-n[1];p=r*r+a*a>this.errorThresholdSquared_}if(p){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const n=[(e[0]+i[0])/2,(e[1]+i[1])/2],s=this.transformInv_(n),c=[(r[0]+t[0])/2,(r[1]+t[1])/2],d=this.transformInv_(c);this.addQuad_(t,e,n,c,o,a,s,d,u-1),this.addQuad_(c,n,i,r,d,s,l,h,u-1)}else{const n=[(t[0]+e[0])/2,(t[1]+e[1])/2],s=this.transformInv_(n),c=[(i[0]+r[0])/2,(i[1]+r[1])/2],d=this.transformInv_(c);this.addQuad_(t,n,c,r,o,s,d,h,u-1),this.addQuad_(n,e,i,c,s,a,l,d,u-1)}return}}if(g){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&m)&&this.addTriangle_(t,i,r,o,l,h),0==(14&m)&&this.addTriangle_(t,i,e,o,l,a),m&&(0==(13&m)&&this.addTriangle_(e,r,t,a,h,o),0==(7&m)&&this.addTriangle_(e,r,i,a,h,l))}calculateSourceExtent(){const t=(0,n.lJ)();return this.triangles_.forEach((function(e,i,r){const s=e.source;(0,n.Wj)(t,s[0]),(0,n.Wj)(t,s[1]),(0,n.Wj)(t,s[2])})),t}getTriangles(){return this.triangles_}}},41948:function(t,e,i){"use strict";i.d(e,{m:function(){return n}});const n=.5},86374:function(t,e,i){"use strict";function n(t){return Array.isArray(t)?Math.min(...t):t}i.d(e,{D:function(){return n}})},12338:function(t,e,i){"use strict";i.d(e,{Gw:function(){return a},YP:function(){return s},gE:function(){return o},h$:function(){return r}});var n=i(63312);function r(t){if(void 0!==t)return 0}function s(t){if(void 0!==t)return t}function o(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}function a(t){const e=void 0===t?(0,n.Yr)(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}},81898:function(t,e,i){"use strict";function n(t){return t[0]>0&&t[1]>0}function r(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]*e+.5|0,i[1]=t[1]*e+.5|0,i}function s(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}i.d(e,{Pq:function(){return s},bA:function(){return r},py:function(){return n}})},64254:function(t,e,i){"use strict";var n=i(28053),r=i(36117),s=i(61672),o=i(69649),a=i(70658),l=i(81625);class h extends n.Z{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:(0,l.U2)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,tilePixelRatio:e?2:1,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.hidpi_=e,this.culture_=void 0!==t.culture?t.culture:"en-us",this.maxZoom_=void 0!==t.maxZoom?t.maxZoom:-1,this.apiKey_=t.key,this.imagerySet_=t.imagerySet,this.placeholderTiles_=t.placeholderTiles;const i="https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.imagerySet_+"?uriScheme=https&include=ImageryProviders&key="+this.apiKey_+"&c="+this.culture_;fetch(i).then((t=>t.json())).then((t=>this.handleImageryMetadataResponse(t)))}getApiKey(){return this.apiKey_}getImagerySet(){return this.imagerySet_}handleImageryMetadataResponse(t){if(200!=t.statusCode||"OK"!=t.statusDescription||"ValidCredentials"!=t.authenticationResultCode||1!=t.resourceSets.length||1!=t.resourceSets[0].resources.length)return void this.setState("error");const e=t.resourceSets[0].resources[0],i=-1==this.maxZoom_?e.zoomMax:this.maxZoom_,n=this.getProjection(),h=(0,a.Tl)(n),u=this.hidpi_?2:1,c=e.imageWidth==e.imageHeight?e.imageWidth/u:[e.imageWidth/u,e.imageHeight/u],d=(0,a.dl)({extent:h,minZoom:e.zoomMin,maxZoom:i,tileSize:c});this.tileGrid=d;const f=this.culture_,g=this.hidpi_,p=this.placeholderTiles_;if(this.tileUrlFunction=(0,s.Un)(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",f);return function(t,e,r){if(!t)return;(0,o.T9)(t[0],t[1],t[2],i);const s=new URL(n.replace("{quadkey}",function(t){const e=t[0],i=new Array(e);let n,r,s=1<>=1;return i.join("")}(i))),a=s.searchParams;return g&&(a.set("dpi","d1"),a.set("device","mobile")),!0===p?a.delete("n"):!1===p&&a.set("n","z"),s.toString()}}))),e.imageryProviders){const t=(0,l.WO)((0,l.U2)("EPSG:4326"),this.getProjection());this.setAttributions((i=>{const n=[],s=i.viewState,o=this.getTileGrid(),a=o.getZForResolution(s.resolution,this.zDirection),l=o.getTileCoordForCoordAndZ(s.center,a)[0];return e.imageryProviders.map((function(e){let s=!1;const o=e.coverageAreas;for(let e=0,n=o.length;e=n.zoomMin&&l<=n.zoomMax){const e=n.bbox,o=[e[1],e[0],e[3],e[2]],a=(0,r.Ne)(o,t);if((0,r.kK)(a,i.extent)){s=!0;break}}}s&&n.push(e.attribution)})),n.push('Terms of Use'),n}))}this.setState("ready")}}e.Z=h},68111:function(t,e,i){"use strict";var n=i(92486),r=i(79619),s=i(47051),o=i(4711),a=i(19775),l=i(23422),h=i(36117),u=i(22765);class c extends o.Z{constructor(t){super({attributions:t.attributions,wrapX:t.wrapX}),this.resolution=void 0,this.distance=void 0!==t.distance?t.distance:20,this.minDistance=t.minDistance||0,this.interpolationRatio=0,this.features=[],this.geometryFunction=t.geometryFunction||function(t){const e=t.getGeometry();return(0,l.h)(!e||"Point"===e.getType(),"The default `geometryFunction` can only handle `Point` or null geometries"),e},this.createCustomCluster_=t.createCluster,this.source=null,this.boundRefresh_=this.refresh.bind(this),this.updateDistance(this.distance,this.minDistance),this.setSource(t.source||null)}clear(t){this.features.length=0,super.clear(t)}getDistance(){return this.distance}getSource(){return this.source}loadFeatures(t,e,i){this.source.loadFeatures(t,e,i),e!==this.resolution&&(this.resolution=e,this.refresh())}setDistance(t){this.updateDistance(t,this.minDistance)}setMinDistance(t){this.updateDistance(this.distance,t)}getMinDistance(){return this.minDistance}setSource(t){this.source&&this.source.removeEventListener(n.Z.CHANGE,this.boundRefresh_),this.source=t,t&&t.addEventListener(n.Z.CHANGE,this.boundRefresh_),this.refresh()}refresh(){this.clear(),this.cluster(),this.addFeatures(this.features)}updateDistance(t,e){const i=0===t?0:Math.min(e,t)/t,n=t!==this.distance||this.interpolationRatio!==i;this.distance=t,this.minDistance=e,this.interpolationRatio=i,n&&this.refresh()}cluster(){if(void 0===this.resolution||!this.source)return;const t=(0,h.lJ)(),e=this.distance*this.resolution,i=this.source.getFeatures(),n={};for(let r=0,s=i.length;r=0;--e){const n=this.geometryFunction(t[e]);n?(0,a.IH)(i,n.getCoordinates()):t.splice(e,1)}(0,a.bA)(i,1/t.length);const n=(0,h.qg)(e),o=this.interpolationRatio,l=new s.Z([i[0]*(1-o)+n[0]*o,i[1]*(1-o)+n[1]*o]);return this.createCustomCluster_?this.createCustomCluster_(l,t):new r.Z({geometry:l,features:t})}}e.Z=c},98993:function(t,e,i){"use strict";var n=i(53161),r=i(92486),s=i(40485),o=i(2145),a=i(30078),l=i(18489),h=i(74251),u=i(70658),c=i(81625),d=i(69649),f=i(22765),g=i(79407),p=i(81898);class m extends l.Z{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=(0,u.dl)({extent:(0,u.Tl)(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize})),super({cacheSize:.1,attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:e,tileGrid:i,opaque:t.opaque,state:t.state,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.tileSize_=t.tileSize?(0,p.Pq)(t.tileSize):null,this.tileSizes_=null,this.tileLoadingKeys_={},this.loader_=t.loader,this.handleTileChange_=this.handleTileChange_.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount,this.tileGridForProjection_={},this.tileCacheForProjection_={}}setTileSizes(t){this.tileSizes_=t}getTileSize(t){if(this.tileSizes_)return this.tileSizes_[t];if(this.tileSize_)return this.tileSize_;const e=this.getTileGrid();return e?(0,p.Pq)(e.getTileSize(t)):[256,256]}getGutterForProjection(t){const e=this.getProjection();return!e||(0,c.OP)(e,t)?this.gutter_:0}setLoader(t){this.loader_=t}getReprojTile_(t,e,i,n,r){const o=this.getTileCacheForProjection(n),a=(0,d.lg)(t,e,i);if(o.containsKey(a)){const t=o.get(a);if(t&&t.key==this.getKey())return t}const l=this.getTileGrid(),h=Math.max.apply(null,l.getResolutions().map(((t,e)=>{const i=(0,p.Pq)(l.getTileSize(e)),n=this.getTileSize(e);return Math.max(n[0]/i[0],n[1]/i[1])}))),u=this.getTileGridForProjection(r),c=this.getTileGridForProjection(n),f=[t,e,i],g=this.getTileCoordForTileUrlFunction(f,n),m=Object.assign({sourceProj:r,sourceTileGrid:u,targetProj:n,targetTileGrid:c,tileCoord:f,wrappedTileCoord:g,pixelRatio:h,gutter:this.getGutterForProjection(r),getTileFunction:(t,e,i,n)=>this.getTile(t,e,i,n,r)},this.tileOptions),_=new s.Z(m);return _.key=this.getKey(),_}getTile(t,e,i,s,o){const a=this.getProjection();if(a&&o&&!(0,c.OP)(a,o))return this.getReprojTile_(t,e,i,o,a);const l=this.getTileSize(t),h=(0,d.lg)(t,e,i);if(this.tileCache.containsKey(h))return this.tileCache.get(h);const u=this.loader_;const f=Object.assign({tileCoord:[t,e,i],loader:function(){return(0,g.Vi)((function(){return u(t,e,i)}))},size:l},this.tileOptions),p=new n.ZP(f);return p.key=this.getKey(),p.addEventListener(r.Z.CHANGE,this.handleTileChange_),this.tileCache.set(h,p),p}handleTileChange_(t){const e=t.target,i=(0,f.sq)(e),n=e.getState();let r;n==h.Z.LOADING?(this.tileLoadingKeys_[i]=!0,r=a.Z.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],r=n==h.Z.ERROR?a.Z.TILELOADERROR:n==h.Z.LOADED?a.Z.TILELOADEND:void 0),r&&this.dispatchEvent(new l.s(r,e))}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,c.OP)(e,t)))return this.tileGrid;const i=(0,f.sq)(t);return i in this.tileGridForProjection_||(this.tileGridForProjection_[i]=(0,u.X$)(t)),this.tileGridForProjection_[i]}setTileGridForProjection(t,e){const i=(0,c.U2)(t);if(i){const t=(0,f.sq)(i);t in this.tileGridForProjection_||(this.tileGridForProjection_[t]=e)}}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,c.OP)(e,t))return this.tileCache;const i=(0,f.sq)(t);return i in this.tileCacheForProjection_||(this.tileCacheForProjection_[i]=new o.Z(.1)),this.tileCacheForProjection_[i]}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection_){const n=this.tileCacheForProjection_[t];n.expireCache(n==i?e:{})}}clear(){super.clear();for(const t in this.tileCacheForProjection_)this.tileCacheForProjection_[t].clear()}}e.Z=m},22635:function(t,e,i){"use strict";i.d(e,{Z:function(){return Zt}});var n=i(98993),r=i(61931),s=i(49592);const o=new Map;function a(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>o.set(t,e)))}async function l(t){const e=o.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}a([void 0,1],(()=>i.e(5994).then(i.bind(i,45994)).then((t=>t.default)))),a(5,(()=>i.e(5690).then(i.bind(i,15690)).then((t=>t.default)))),a(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),a(7,(()=>i.e(6353).then(i.bind(i,66353)).then((t=>t.default)))),a([8,32946],(()=>i.e(2581).then(i.bind(i,92581)).then((t=>t.default)))),a(32773,(()=>i.e(263).then(i.bind(i,263)).then((t=>t.default)))),a(34887,(()=>i.e(5323).then(i.bind(i,15323)).then((async t=>(await t.zstd.init(),t))).then((t=>t.default)))),a(50001,(()=>i.e(1789).then(i.bind(i,41789)).then((t=>t.default))));const h="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2;var u=class{constructor(t=h,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{i.e(8030).then(i.bind(i,98030)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;ii.decode(t,e))):new Promise((i=>{const n=this.workers.find((t=>t.idle))||this.workers[Math.floor(Math.random()*this.size)];n.idle=!1;const r=this.messageId++,s=t=>{t.data.id===r&&(n.idle=!0,i(t.data.decoded),n.worker.removeEventListener("message",s))};n.worker.addEventListener("message",s),n.worker.postMessage({fileDirectory:t,buffer:e,id:r},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}};const c=new ArrayBuffer(4),d=new Float32Array(c),f=new Uint32Array(c),g=new Uint32Array(512),p=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(g[t]=0,g[256|t]=32768,p[t]=24,p[256|t]=24):e<-14?(g[t]=1024>>-e-14,g[256|t]=1024>>-e-14|32768,p[t]=-e-1,p[256|t]=-e-1):e<=15?(g[t]=e+15<<10,g[256|t]=e+15<<10|32768,p[t]=13,p[256|t]=13):e<128?(g[t]=31744,g[256|t]=64512,p[t]=24,p[256|t]=24):(g[t]=31744,g[256|t]=64512,p[t]=13,p[256|t]=13)}const m=new Uint32Array(2048),_=new Uint32Array(64),y=new Uint32Array(64);m[0]=0;for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)i-=8388608,e<<=1;e&=-8388609,i+=947912704,m[t]=e|i}for(let t=1024;t<2048;++t)m[t]=939524096+(t-1024<<13);_[0]=0;for(let t=1;t<31;++t)_[t]=t<<23;_[31]=1199570944,_[32]=2147483648;for(let t=33;t<63;++t)_[t]=2147483648+(t-32<<23);_[63]=3347054592,y[0]=0;for(let t=1;t<64;++t)y[t]=32===t?0:1024;const x=Reflect.getPrototypeOf(Uint8Array).prototype,v=Reflect.getOwnPropertyDescriptor(x,Symbol.toStringTag).get;function E(t){return void 0!==v.call(t)}const b=Object.prototype.toString;function w(t,e,...i){if(n=t,!ArrayBuffer.isView(n)||E(n)||"[object DataView]"!==b.call(n))throw new TypeError("First argument to getFloat16 function must be a DataView");var n;return function(t){const e=t>>10;return f[0]=m[y[e]+(1023&t)]+_[e],d[0]}(t.getUint16(e,...i))}var S=i(42135),C=i(83299);function T(t,e,i,n=1){return new(Object.getPrototypeOf(t).constructor)(e*i*n)}function M(t,e,i){return(1-i)*t+i*e}function P(t,e,i,n,r,s="nearest"){switch(s.toLowerCase()){case"nearest":return function(t,e,i,n,r){const s=e/n,o=i/r;return t.map((t=>{const a=T(t,n,r);for(let l=0;l{const a=T(t,n,r);for(let l=0;l=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${t} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[t]/8)}getReaderForSample(t){const e=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1,i=this.fileDirectory.BitsPerSample[t];switch(e){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(t,e){return w(this,t,e)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(t=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[t]:1}getBitsPerSample(t=0){return this.fileDirectory.BitsPerSample[t]}getArrayForSample(t,e){return A(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,i,n,r){const s=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let h,u;1===this.planarConfiguration?a=e*s+t:2===this.planarConfiguration&&(a=i*s*o+e*s+t),this.isTiled?(h=this.fileDirectory.TileOffsets[a],u=this.fileDirectory.TileByteCounts[a]):(h=this.fileDirectory.StripOffsets[a],u=this.fileDirectory.StripByteCounts[a]);const c=(await this.source.fetch([{offset:h,length:u}],r))[0];let d;return null!==l&&l[a]?d=l[a]:(d=(async()=>{let t=await n.decode(this.fileDirectory,c);const i=this.getSampleFormat(),r=this.getBitsPerSample();return function(t,e){return(1!==t&&2!==t||!(e<=32)||e%8!=0)&&(3!==t||16!==e&&32!==e&&64!==e)}(i,r)&&(t=function(t,e,i,n,r,s,o){const a=new DataView(t),l=2===i?1:n,h=A(e,r,2===i?o*s:o*s*n),u=parseInt("1".repeat(r),2);if(1===e){let t;t=1===i?n*r:r;let e=s*t;0!=(7&e)&&(e=e+7&-8);for(let t=0;t>8-r-f&u;else if(f+r<=16)h[c]=a.getUint16(d)>>16-r-f&u;else if(f+r<=24){const t=a.getUint16(d)<<8|a.getUint8(d+2);h[c]=t>>24-r-f&u}else h[c]=a.getUint32(d)>>32-r-f&u}}}}return h.buffer}(t,i,this.planarConfiguration,this.getSamplesPerPixel(),r,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==l&&(l[a]=d)),{x:t,y:e,sample:i,data:await d}}async _readRaster(t,e,i,n,r,s,o,a,l){const h=this.getTileWidth(),u=this.getTileHeight(),c=this.getWidth(),d=this.getHeight(),f=Math.max(Math.floor(t[0]/h),0),g=Math.min(Math.ceil(t[2]/h),Math.ceil(c/h)),p=Math.max(Math.floor(t[1]/u),0),m=Math.min(Math.ceil(t[3]/u),Math.ceil(d/u)),_=t[2]-t[0];let y=this.getBytesPerPixel();const x=[],v=[];for(let t=0;t{const s=r.data,o=new DataView(s),a=this.getBlockHeight(r.y),l=r.y*u,f=r.x*h,p=l+a,m=(r.x+1)*h,E=v[g],w=Math.min(a,a-(p-t[3]),d-l),S=Math.min(h,h-(m-t[2]),c-f);for(let r=Math.max(0,t[1]-l);ru[2]||u[1]>u[3])throw new Error("Invalid subsets");const c=(u[2]-u[0])*(u[3]-u[1]),d=this.getSamplesPerPixel();if(e&&e.length){for(let t=0;t=d)return Promise.reject(new RangeError(`Invalid sample index '${e[t]}'.`))}else for(let t=0;th[2]||h[1]>h[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(u===s.Ie.RGB){let h=[0,1,2];if(this.fileDirectory.ExtraSamples!==s.pd.Unspecified&&a){h=[];for(let t=0;t>24)/500+a,h=a-(t[e+2]<<24>>24)/200;l=.95047*(l*l*l>.008856?l*l*l:(l-16/116)/7.787),a=1*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),h=1.08883*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),r=3.2406*l+-1.5372*a+-.4986*h,s=-.9689*l+1.8758*a+.0415*h,o=.0557*l+-.204*a+1.057*h,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n[i]=255*Math.max(0,Math.min(1,r)),n[i+1]=255*Math.max(0,Math.min(1,s)),n[i+2]=255*Math.max(0,Math.min(1,o))}return n}(g);break;default:throw new Error("Unsupported photometric interpretation.")}if(!e){const t=new Uint8Array(m.length/3),e=new Uint8Array(m.length/3),i=new Uint8Array(m.length/3);for(let n=0,r=0;nvoid 0===S(t,"sample"))):n.filter((e=>Number(S(e,"sample"))===t));for(let t=0;t[s+i*t+n*e,h+o*t+a*e])),c=u.map((t=>t[0])),d=u.map((t=>t[1]));return[Math.min(...c),Math.min(...d),Math.max(...c),Math.max(...d)]}{const t=this.getOrigin(),e=this.getResolution(),i=t[0],n=t[1],r=i+e[0]*this.getWidth(),s=n+e[1]*this.getHeight();return[Math.min(i,r),Math.min(n,s),Math.max(i,r),Math.max(n,s)]}}};class F{constructor(t){this._dataView=new DataView(t)}get buffer(){return this._dataView.buffer}getUint64(t,e){const i=this.getUint32(t,e),n=this.getUint32(t+4,e);let r;if(e){if(r=i+2**32*n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*i+n,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}getInt64(t,e){let i=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let r=!0;for(let s=0;s<8;s++){let o=this._dataView.getUint8(t+(e?s:7-s));n&&(r?0!==o&&(o=255&~(o-1),r=!1):o=255&~o),i+=o*256**s}return n&&(i=-i),i}getUint8(t,e){return this._dataView.getUint8(t,e)}getInt8(t,e){return this._dataView.getInt8(t,e)}getUint16(t,e){return this._dataView.getUint16(t,e)}getInt16(t,e){return this._dataView.getInt16(t,e)}getUint32(t,e){return this._dataView.getUint32(t,e)}getInt32(t,e){return this._dataView.getInt32(t,e)}getFloat16(t,e){return w(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class O{constructor(t,e,i,n){this._dataView=new DataView(t),this._sliceOffset=e,this._littleEndian=i,this._bigTiff=n}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(t,e){return this.sliceOffset<=t&&this.sliceTop>=t+e}readUint8(t){return this._dataView.getUint8(t-this._sliceOffset,this._littleEndian)}readInt8(t){return this._dataView.getInt8(t-this._sliceOffset,this._littleEndian)}readUint16(t){return this._dataView.getUint16(t-this._sliceOffset,this._littleEndian)}readInt16(t){return this._dataView.getInt16(t-this._sliceOffset,this._littleEndian)}readUint32(t){return this._dataView.getUint32(t-this._sliceOffset,this._littleEndian)}readInt32(t){return this._dataView.getInt32(t-this._sliceOffset,this._littleEndian)}readFloat32(t){return this._dataView.getFloat32(t-this._sliceOffset,this._littleEndian)}readFloat64(t){return this._dataView.getFloat64(t-this._sliceOffset,this._littleEndian)}readUint64(t){const e=this.readUint32(t),i=this.readUint32(t+4);let n;if(this._littleEndian){if(n=e+2**32*i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}if(n=2**32*e+i,!Number.isSafeInteger(n))throw new Error(`${n} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return n}readInt64(t){let e=0;const i=(128&this._dataView.getUint8(t+(this._littleEndian?7:0)))>0;let n=!0;for(let r=0;r<8;r++){let s=this._dataView.getUint8(t+(this._littleEndian?r:7-r));i&&(n?0!==s&&(s=255&~(s-1),n=!1):s=255&~s),e+=s*256**r}return i&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const Z="\r\n\r\n";function k(t){if(void 0!==Object.fromEntries)return Object.fromEntries(t);const e={};for(const[i,n]of t)e[i.toLowerCase()]=n;return e}function D(t){return k(t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e})))}function N(t){let e,i,n;return t&&([,e,i,n]=t.match(/bytes (\d+)-(\d+)\/(\d+)/),e=parseInt(e,10),i=parseInt(i,10),n=parseInt(n,10)),{start:e,end:i,total:n}}class G{async fetch(t,e=void 0){return Promise.all(t.map((t=>this.fetchSlice(t,e))))}async fetchSlice(t){throw new Error(`fetching of slice ${t} not possible, not implemented`)}get fileSize(){return null}async close(){}}class z extends Map{constructor(t={}){if(super(),!(t.maxSize&&t.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof t.maxAge&&0===t.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=t.maxSize,this.maxAge=t.maxAge||Number.POSITIVE_INFINITY,this.onEviction=t.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(t){if("function"==typeof this.onEviction)for(const[e,i]of t)this.onEviction(e,i.value)}_deleteIfExpired(t,e){return"number"==typeof e.expiry&&e.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(t,e.value),this.delete(t))}_getOrDeleteIfExpired(t,e){if(!1===this._deleteIfExpired(t,e))return e.value}_getItemValue(t,e){return e.expiry?this._getOrDeleteIfExpired(t,e):e.value}_peek(t,e){const i=e.get(t);return this._getItemValue(t,i)}_set(t,e){this.cache.set(t,e),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(t,e){this.oldCache.delete(t),this._set(t,e)}*_entriesAscending(){for(const t of this.oldCache){const[e,i]=t;if(!this.cache.has(e)){!1===this._deleteIfExpired(e,i)&&(yield t)}}for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield t)}}get(t){if(this.cache.has(t)){const e=this.cache.get(t);return this._getItemValue(t,e)}if(this.oldCache.has(t)){const e=this.oldCache.get(t);if(!1===this._deleteIfExpired(t,e))return this._moveToRecent(t,e),e.value}}set(t,e,{maxAge:i=this.maxAge}={}){const n="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;this.cache.has(t)?this.cache.set(t,{value:e,expiry:n}):this._set(t,{value:e,expiry:n})}has(t){return this.cache.has(t)?!this._deleteIfExpired(t,this.cache.get(t)):!!this.oldCache.has(t)&&!this._deleteIfExpired(t,this.oldCache.get(t))}peek(t){return this.cache.has(t)?this._peek(t,this.cache):this.oldCache.has(t)?this._peek(t,this.oldCache):void 0}delete(t){const e=this.cache.delete(t);return e&&this._size--,this.oldCache.delete(t)||e}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(t){if(!(t&&t>0))throw new TypeError("`maxSize` must be a number greater than 0");const e=[...this._entriesAscending()],i=e.length-t;i<0?(this.cache=new Map(e),this.oldCache=new Map,this._size=e.length):(i>0&&this._emitEvictions(e.slice(0,i)),this.oldCache=new Map(e.slice(i)),this.cache=new Map,this._size=0),this.maxSize=t}*keys(){for(const[t]of this)yield t}*values(){for(const[,t]of this)yield t}*[Symbol.iterator](){for(const t of this.cache){const[e,i]=t;!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}for(const t of this.oldCache){const[e,i]=t;if(!this.cache.has(e)){!1===this._deleteIfExpired(e,i)&&(yield[e,i.value])}}}*entriesDescending(){let t=[...this.cache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}t=[...this.oldCache];for(let e=t.length-1;e>=0;--e){const i=t[e],[n,r]=i;if(!this.cache.has(n)){!1===this._deleteIfExpired(n,r)&&(yield[n,r.value])}}}*entriesAscending(){for(const[t,e]of this._entriesAscending())yield[t,e.value]}get size(){if(!this._size)return this.oldCache.size;let t=0;for(const e of this.oldCache.keys())this.cache.has(e)||t++;return Math.min(this._size+t,this.maxSize)}entries(){return this.entriesAscending()}forEach(t,e=this){for(const[i,n]of this.entriesAscending())t.call(e,n,i,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}class j extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,j),this.name="AbortError"}}class U extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const B=U;class q{constructor(t,e,i=null){this.offset=t,this.length=e,this.data=i}get top(){return this.offset+this.length}}class V{constructor(t,e,i){this.offset=t,this.length=e,this.blockIds=i}}class X extends G{constructor(t,{blockSize:e=65536,cacheSize:i=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new z({maxSize:i,onEviction:(t,e)=>{this.evictedBlocks.set(t,e)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const i=[],n=[],r=[];this.evictedBlocks.clear();for(const{offset:e,length:s}of t){let t=e+s;const{fileSize:o}=this;null!==o&&(t=Math.min(t,o));for(let s=Math.floor(e/this.blockSize)*this.blockSize;ssetTimeout(e,t)))}(),this.fetchBlocks(e);const s=[];for(const t of n)this.blockRequests.has(t)&&s.push(this.blockRequests.get(t));await Promise.allSettled(i),await Promise.allSettled(s);const o=[],a=r.filter((t=>this.abortedBlockIds.has(t)||!this.blockCache.has(t)));if(a.forEach((t=>this.blockIdsToFetch.add(t))),a.length>0&&e&&!e.aborted){this.fetchBlocks(null);for(const t of a){const e=this.blockRequests.get(t);if(!e)throw new Error(`Block ${t} is not in the block requests`);o.push(e)}await Promise.allSettled(o)}if(e&&e.aborted)throw new j("Request was aborted");const l=r.map((t=>this.blockCache.get(t)||this.evictedBlocks.get(t))),h=l.filter((t=>!t));if(h.length)throw new B(h,"Request failed");const u=new Map(function(t,e){const i=Array.isArray(t)?t:Array.from(t),n=Array.isArray(e)?e:Array.from(e);return i.map(((t,e)=>[t,n[e]]))}(r,l));return this.readSliceData(t,u)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(e,t);for(let n=0;n{try{const t=(await i)[n],r=e*this.blockSize,s=r-t.offset,o=Math.min(s+this.blockSize,t.data.byteLength),a=t.data.slice(s,o),l=new q(r,a.byteLength,a,e);this.blockCache.set(e,l),this.abortedBlockIds.delete(e)}catch(i){if("AbortError"!==i.name)throw i;i.signal=t,this.blockCache.delete(e),this.abortedBlockIds.add(e)}finally{this.blockRequests.delete(e)}})())}this.blockIdsToFetch.clear()}}groupBlocks(t){const e=Array.from(t).sort(((t,e)=>t-e));if(0===e.length)return[];let i=[],n=null;const r=[];for(const t of e)null===n||n+1===t?(i.push(t),n=t):(r.push(new V(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[t],n=t);return r.push(new V(i[0]*this.blockSize,i.length*this.blockSize,i)),r}readSliceData(t,e){return t.map((t=>{let i=t.offset+t.length;null!==this.fileSize&&(i=Math.min(this.fileSize,i));const n=Math.floor(t.offset/this.blockSize),r=Math.floor(i/this.blockSize),s=new ArrayBuffer(t.length),o=new Uint8Array(s);for(let s=n;s<=r;++s){const n=e.get(s),r=n.offset-t.offset;let a,l=0,h=0;r<0?l=-r:r>0&&(h=r),a=n.top-i<0?n.length-l:i-n.offset-l;const u=new Uint8Array(n.data,l,a);o.set(u,h)}return s}))}}class ${get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(t){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class W{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:i}={}){throw new Error("request is not implemented")}}class Y extends ${constructor(t){super(),this.response=t}get status(){return this.response.status}getHeader(t){return this.response.headers.get(t)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class H extends W{constructor(t,e){super(t),this.credentials=e}async request({headers:t,credentials:e,signal:i}={}){const n=await fetch(this.url,{headers:t,credentials:e,signal:i});return new Y(n)}}class K extends ${constructor(t,e){super(),this.xhr=t,this.data=e}get status(){return this.xhr.status}getHeader(t){return this.xhr.getResponseHeader(t)}async getData(){return this.data}}class J extends W{constructRequest(t,e){return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",this.url),r.responseType="arraybuffer";for(const[e,i]of Object.entries(t))r.setRequestHeader(e,i);r.onload=()=>{const t=r.response;i(new K(r,t))},r.onerror=n,r.onabort=()=>n(new j("Request aborted")),r.send(),e&&(e.aborted&&r.abort(),e.addEventListener("abort",(()=>r.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}var Q=i(47760),tt=i(13090),et=i(19439);class it extends ${constructor(t,e){super(),this.response=t,this.dataPromise=e}get status(){return this.response.statusCode}getHeader(t){return this.response.headers[t]}async getData(){return await this.dataPromise}}class nt extends W{constructor(t){super(t),this.parsedUrl=et.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?Q:tt}constructRequest(t,e){return new Promise(((i,n)=>{const r=this.httpApi.get({...this.parsedUrl,headers:t},(t=>{const e=new Promise((e=>{const i=[];t.on("data",(t=>{i.push(t)})),t.on("end",(()=>{const t=Buffer.concat(i).buffer;e(t)})),t.on("error",n)}));i(new it(t,e))}));r.on("error",n),e&&(e.aborted&&r.destroy(new j("Request aborted")),e.addEventListener("abort",(()=>r.destroy(new j("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class rt extends G{constructor(t,e,i,n){super(),this.client=t,this.headers=e,this.maxRanges=i,this.allowFullFile=n,this._fileSize=null}async fetch(t,e){return this.maxRanges>=t.length?this.fetchSlices(t,e):(this.maxRanges>0&&t.length,Promise.all(t.map((t=>this.fetchSlice(t,e)))))}async fetchSlices(t,e){const i=await this.client.request({headers:{...this.headers,Range:`bytes=${t.map((({offset:t,length:e})=>`${t}-${t+e}`)).join(",")}`},signal:e});if(i.ok){if(206===i.status){const{type:n,params:r}=function(t){const[e,...i]=t.split(";").map((t=>t.trim()));return{type:e,params:k(i.map((t=>t.split("="))))}}(i.getHeader("content-type"));if("multipart/byteranges"===n){const t=function(t,e){let i=null;const n=new TextDecoder("ascii"),r=[],s=`--${e}`,o=`${s}--`;for(let e=0;e<10;++e)n.decode(new Uint8Array(t,e,s.length))===s&&(i=e);if(null===i)throw new Error("Could not find initial boundary");for(;i1){const i=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return h.concat(i)}return h}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await i.getData();return this._fileSize=t.byteLength,[{data:t,offset:0,length:t.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(t,e){const{offset:i,length:n}=t,r=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+n}`},signal:e});if(r.ok){if(206===r.status){const t=await r.getData(),{total:e}=N(r.getHeader("content-range"));return this._fileSize=e||null,{data:t,offset:i,length:n}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const t=await r.getData();return this._fileSize=t.byteLength,{data:t,offset:0,length:t.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function st(t,{blockSize:e,cacheSize:i}){return null===e?t:new X(t,{blockSize:e,cacheSize:i})}function ot(t,{forceXHR:e=!1,...i}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new J(t);return st(new rt(s,e,i,n),r)}(t,i):function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...r}={}){const s=new nt(t);return st(new rt(s,e,i,n),r)}(t,i):function(t,{headers:e={},credentials:i,maxRanges:n=0,allowFullFile:r=!1,...s}={}){const o=new H(t,i);return st(new rt(o,e,n,r),s)}(t,i)}class at extends G{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((i,n)=>{const r=this.file.slice(t.offset,t.offset+t.length),s=new FileReader;s.onload=t=>i(t.target.result),s.onerror=n,s.onabort=n,s.readAsArrayBuffer(r),e&&e.addEventListener("abort",(()=>s.abort()))}))}}function lt(t){switch(t){case s.sf.BYTE:case s.sf.ASCII:case s.sf.SBYTE:case s.sf.UNDEFINED:return 1;case s.sf.SHORT:case s.sf.SSHORT:return 2;case s.sf.LONG:case s.sf.SLONG:case s.sf.FLOAT:case s.sf.IFD:return 4;case s.sf.RATIONAL:case s.sf.SRATIONAL:case s.sf.DOUBLE:case s.sf.LONG8:case s.sf.SLONG8:case s.sf.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function ht(t,e,i,n){let r=null,o=null;const a=lt(e);switch(e){case s.sf.BYTE:case s.sf.ASCII:case s.sf.UNDEFINED:r=new Uint8Array(i),o=t.readUint8;break;case s.sf.SBYTE:r=new Int8Array(i),o=t.readInt8;break;case s.sf.SHORT:r=new Uint16Array(i),o=t.readUint16;break;case s.sf.SSHORT:r=new Int16Array(i),o=t.readInt16;break;case s.sf.LONG:case s.sf.IFD:r=new Uint32Array(i),o=t.readUint32;break;case s.sf.SLONG:r=new Int32Array(i),o=t.readInt32;break;case s.sf.LONG8:case s.sf.IFD8:r=new Array(i),o=t.readUint64;break;case s.sf.SLONG8:r=new Array(i),o=t.readInt64;break;case s.sf.RATIONAL:r=new Uint32Array(2*i),o=t.readUint32;break;case s.sf.SRATIONAL:r=new Int32Array(2*i),o=t.readInt32;break;case s.sf.FLOAT:r=new Float32Array(i),o=t.readFloat32;break;case s.sf.DOUBLE:r=new Float64Array(i),o=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==s.sf.RATIONAL&&e!==s.sf.SRATIONAL)for(let e=0;et.getWidth()-e.getWidth()));for(let e=0;en||s&&s>o)break}}let c=e;if(o){const[t,e]=a.getOrigin(),[i,n]=l.getResolution(a);c=[Math.round((o[0]-t)/i),Math.round((o[1]-e)/n),Math.round((o[2]-t)/i),Math.round((o[3]-e)/n)],c=[Math.min(c[0],c[2]),Math.min(c[1],c[3]),Math.max(c[0],c[2]),Math.max(c[1],c[3])]}return l.readRasters({...t,window:c})}}class ft extends dt{constructor(t,e,i,n,r={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=i,this.firstIFDOffset=n,this.cache=r.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const i=this.bigTiff?4048:1024;return new O((await this.source.fetch([{offset:t,length:void 0!==e?e:i}]))[0],t,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(t){const e=this.bigTiff?20:12,i=this.bigTiff?8:2;let n=await this.getSlice(t);const r=this.bigTiff?n.readUint64(t):n.readUint16(t),o=r*e+(this.bigTiff?16:6);n.covers(t,o)||(n=await this.getSlice(t,o));const a={};let l=t+(this.bigTiff?8:2);for(let t=0;t{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new ct(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new L(e.fileDirectory,e.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let t=0,e=!0;for(;e;)try{await this.requestIFD(t),++t}catch(t){if(!(t instanceof ct))throw t;e=!1}return t}async getGhostValues(){const t=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;const e="GDAL_STRUCTURAL_METADATA_SIZE=";let i=await this.getSlice(t,130);if(e===ht(i,s.sf.ASCII,30,t)){const e=ht(i,s.sf.ASCII,130,t).split("\n")[0],n=Number(e.split("=")[1].split(" ")[0])+e.length;n>130&&(i=await this.getSlice(t,n));const r=ht(i,s.sf.ASCII,n,t);this.ghostValues={},r.split("\n").filter((t=>t.length>0)).map((t=>t.split("="))).forEach((([t,e])=>{this.ghostValues[t]=e}))}return this.ghostValues}static async fromSource(t,e,i){const n=(await t.fetch([{offset:0,length:1024}],i))[0],r=new F(n),s=r.getUint16(0,0);let o;if(18761===s)o=!0;else{if(19789!==s)throw new TypeError("Invalid byte order value.");o=!1}const a=r.getUint16(2,o);let l;if(42===a)l=!1;else{if(43!==a)throw new TypeError("Invalid magic number.");l=!0;if(8!==r.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const h=l?r.getUint64(8,o):r.getUint32(4,o);return new ft(t,o,l,h,e)}close(){return"function"==typeof this.source.close&&this.source.close()}}class gt extends dt{constructor(t,e){super(),this.mainFile=t,this.overviewFiles=e,this.imageFiles=[t].concat(e),this.fileDirectoriesPerFile=null,this.fileDirectoriesPerFileParsing=null,this.imageCount=null}async parseFileDirectoriesPerFile(){const t=[this.mainFile.parseFileDirectoryAt(this.mainFile.firstIFDOffset)].concat(this.overviewFiles.map((t=>t.parseFileDirectoryAt(t.firstIFDOffset))));return this.fileDirectoriesPerFile=await Promise.all(t),this.fileDirectoriesPerFile}async getImage(t=0){await this.getImageCount(),await this.parseFileDirectoriesPerFile();let e=0,i=0;for(let n=0;nt.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}async function pt(t,e){return ft.fromSource(new at(t),e)}var mt=i(81625),_t=i(63312),yt=i(36117),xt=i(37938),vt=i(14684);function Et(t,e){if(!t)return!1;if(!0===t)return!0;if(3!==e.getSamplesPerPixel())return!1;const i=e.fileDirectory.PhotometricInterpretation,n=s.Ie;return i===n.CMYK||i===n.YCbCr||i===n.CIELab||i===n.ICCLab}const bt="STATISTICS_MAXIMUM",wt="STATISTICS_MINIMUM";let St;function Ct(){return St||(St=new u),St}function Tt(t){try{return t.getBoundingBox()}catch(e){return[0,0,t.getWidth(),t.getHeight()]}}function Mt(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.getHeight()]}}function Pt(t,e){try{return t.getResolution(e)}catch(i){return[e.getWidth()/t.getWidth(),e.getHeight()/t.getHeight()]}}function Rt(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey&&32767!==e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=(0,mt.U2)(t);if(!i){const n=(0,vt.N)(e.ProjLinearUnitsGeoKey);n&&(i=new mt.kv({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey&&32767!==e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=(0,mt.U2)(t);if(!i){const n=(0,vt.N)(e.GeogAngularUnitsGeoKey);n&&(i=new mt.kv({code:t,units:n}))}return i}return null}function It(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;nft.fromSource(ot(t,i)))));return new gt(r,s)}(t.url,t.overviews,e):async function(t,e={},i){return ft.fromSource(ot(t,e),i)}(t.url,e),i.then(It)}function Lt(t,e,i,n,r){if(Array.isArray(t)){const s=t.length;if(!Array.isArray(e)||s!=e.length){const t=new Error(n);throw r(t),t}for(let o=0;oi*t)throw new Error(n)}function Ft(t){return t instanceof Int8Array?127:t instanceof Uint8Array||t instanceof Uint8ClampedArray?255:t instanceof Int16Array?32767:t instanceof Uint16Array?65535:t instanceof Int32Array?2147483647:t instanceof Uint32Array?4294967295:t instanceof Float32Array?34e37:255}class Ot extends n.Z{constructor(t){super({state:"loading",tileGrid:null,projection:t.projection||null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.sourceInfo_=t.sources;const e=this.sourceInfo_.length;this.sourceOptions_=t.sourceOptions,this.sourceImagery_=new Array(e),this.sourceMasks_=new Array(e),this.resolutionFactors_=new Array(e),this.samplesPerPixel_,this.nodataValues_,this.metadata_,this.normalize_=!1!==t.normalize,this.addAlpha_=!1,this.error_=null,this.convertToRGB_=t.convertToRGB||!1,this.setKey(this.sourceInfo_.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t=0;--t){const i=Rt(e[t]);if(i){this.projection=i;break}}}configure_(t){let e,i,n,s,o;const a=new Array(t.length),l=new Array(t.length),h=new Array(t.length);let u=0;const c=t.length;for(let r=0;r{4==(4&(t.fileDirectory.NewSubfileType||0))?d.push(t):c.push(t)}));const f=c.length;if(d.length>0&&d.length!==f)throw new Error(`Expected one mask per image found ${d.length} masks and ${f} images`);let g,p;const m=new Array(f),_=new Array(f),y=new Array(f);l[r]=new Array(f),h[r]=new Array(f);for(let t=0;ty.length&&(u=o.length-y.length);const t=o[o.length-1]/y[y.length-1];this.resolutionFactors_[r]=t;const e=y.map((e=>e*t)),i=`Resolution mismatch for source ${r}, got [${e}] but expected [${o}]`;Lt(o.slice(u,o.length),e,.02,i,this.viewRejector)}else o=y,this.resolutionFactors_[r]=1;n?Lt(n.slice(u,n.length),_,.01,`Tile size mismatch for source ${r}`,this.viewRejector):n=_,s?Lt(s.slice(u,s.length),m,0,`Tile size mismatch for source ${r}`,this.viewRejector):s=m,this.sourceImagery_[r]=c.reverse(),this.sourceMasks_[r]=d.reverse()}for(let t=0,e=this.sourceImagery_.length;tthis.getImageInternal(t,e,i,r)),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,n){if(this.loader){const s=T(t,e,i,1),a=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===n&&(this.wantedExtent_&&(0,c.r4)(this.wantedExtent_,s)||(0,c.r4)(this.image.getExtent(),s))&&(this.wantedResolution_&&(0,u.D)(this.wantedResolution_)===a||(0,u.D)(this.image.getResolution())===a)))return this.image;this.wantedProjection_=n,this.wantedExtent_=s,this.wantedResolution_=a,this.image=new o.ZP(s,a,i,this.loader),this.image.addEventListener(r.Z.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case s.Z.LOADING:this.loading=!0,i=v;break;case s.Z.LOADED:this.loading=!1,i=E;break;case s.Z.ERROR:this.loading=!1,i=b;break;default:return}this.hasListener(i)&&this.dispatchEvent(new w(i,e))}}function C(t,e){t.getImage().src=e}function T(t,e,i,n){const r=e/i,s=(0,c.qg)(t),o=(0,_.mD)((0,c.dz)(t)/r,m.L),a=(0,_.mD)((0,c.Cr)(t)/r,m.L),l=o+2*(0,_.mD)((n-1)*o/2,m.L),h=a+2*(0,_.mD)((n-1)*a/2,m.L);return(0,c.p8)(s,r,0,[l,h])}var M=S},46810:function(t,e,i){"use strict";i.d(e,{Z:function(){return h}});var n=i(92486),r=i(91531),s=i(57419),o=i(36117);var a=i(81625);class l extends r.ZP{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:r.r6;super({attributions:t.attributions,interpolate:t.interpolate,projection:(0,a.U2)(t.projection)}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new s.ZP(this.imageExtent_,void 0,1,function(t){const e=t.load||s.Jx,i=t.imageExtent,n=new Image;return null!==t.crossOrigin&&(n.crossOrigin=t.crossOrigin),()=>e(n,t.url).then((t=>{const e=(0,o.dz)(i)/t.width,n=(0,o.Cr)(i)/t.height;return{image:t,extent:i,resolution:e!==n?[e,n]:n,pixelRatio:1}}))}({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,load:(t,e)=>(this.image.setImage(t),i(this.image,e),(0,s.Jx)(t))})),this.image.addEventListener(n.Z.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,n){return(0,o.kK)(t,this.image.getExtent())?this.image:null}getUrl(){return this.url_}}var h=l},39597:function(t,e,i){"use strict";var n=i(91531),r=i(17708),s=i(29142),o=i(57419),a=i(81625);class l extends n.ZP{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.url_=t.url,this.imageLoadFunction_=void 0!==t.imageLoadFunction?t.imageLoadFunction:n.r6,this.params_=t.params,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.renderedRevision_=0,this.ratio_=void 0!==t.ratio?t.ratio:1.5,this.loaderProjection_=null}getFeatureInfoUrl(t,e,i,n){const o=(0,a.U2)(i),l=this.getProjection();l&&l!==o&&(e=(0,r.aA)(l,o,t,e),t=(0,a.vs)(t,o,l));const h={url:this.url_,params:{...this.params_,...n},projection:l||o};return(0,s.QL)(h,t,e)}getLegendUrl(t,e){return(0,s.YT)({url:this.url_,params:{...this.params_,...e}},t)}getParams(){return this.params_}getImageInternal(t,e,i,n){return void 0===this.url_?null:(this.loader&&this.loaderProjection_===n||(this.loaderProjection_=n,this.loader=(0,s.Ke)({crossOrigin:this.crossOrigin_,params:this.params_,projection:n,serverType:this.serverType_,hidpi:this.hidpi_,url:this.url_,ratio:this.ratio_,load:(t,e)=>(this.image.setImage(t),this.imageLoadFunction_(this.image,e),(0,o.Jx)(t))})),super.getImageInternal(t,e,i,n))}getImageLoadFunction(){return this.imageLoadFunction_}getUrl(){return this.url_}setImageLoadFunction(t){this.imageLoadFunction_=t,this.changed()}setUrl(t){t!=this.url_&&(this.url_=t,this.loader=null,this.changed())}updateParams(t){Object.assign(this.params_,t),this.changed()}changed(){this.image=null,super.changed()}}e.Z=l},2703:function(t,e,i){"use strict";var n=i(28053),r=i(16772),s=i(37938);class o extends n.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition});const e={url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null};(0,r.X$)(e).then(this.handleTileSetInfo_.bind(this)).catch(this.handleError_.bind(this))}handleTileSetInfo_(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}handleError_(t){(0,s.vU)(t),this.setState("error")}}e.Z=o},55117:function(t,e,i){"use strict";i.d(e,{h:function(){return r}});var n=i(64469);const r='© OpenStreetMap contributors.';class s extends n.Z{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[r];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://tile.openstreetmap.org/{z}/{x}/{y}.png";super({attributions:e,attributionsCollapsible:!1,cacheSize:t.cacheSize,crossOrigin:i,interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:19,opaque:void 0===t.opaque||t.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:n,wrapX:t.wrapX,zDirection:t.zDirection})}}e.Z=s},1940:function(t,e,i){"use strict";var n=i(5929),r=i(6747),s=i(92486),o=i(13617),a=i(11802),l=i(91531),h=i(27501),u=i(72893),c=i(63947),d=i(18489),f=i(850),g=i(44669),p=i(36117),m=i(22765);let _,y=!0;try{new ImageData(10,10)}catch(t){y=!1}function x(t){let e=!0;try{new ImageData(10,10)}catch(t){e=!1}function i(t,i,n){return e?new ImageData(t,i,n):{data:t,width:i,height:n}}return function(e){const n=e.buffers,r=e.meta,s=e.imageOps,o=e.width,a=e.height,l=n.length,h=n[0].byteLength;if(s){const e=new Array(l);for(let t=0;tthis._maxQueueLength;)this._queue.shift().callback(null,null)}_dispatch(){if(this._running||0===this._queue.length)return;const t=this._queue.shift();this._job=t;const e=t.inputs[0].width,i=t.inputs[0].height,n=t.inputs.map((function(t){return t.data.buffer})),r=this._workers.length;if(this._running=r,1===r)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const s=t.inputs[0].data.length,o=4*Math.ceil(s/4/r);for(let s=0;sStadia Maps','© OpenMapTiles',r.h];t.layer.startsWith("stamen_")&&c.splice(1,0,'© Stamen Design'),super({attributions:c,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:void 0!==t.maxZoom?t.maxZoom:n.maxZoom,minZoom:void 0!==t.minZoom?t.minZoom:n.minZoom,opaque:a.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:u,tilePixelRatio:h?2:1,wrapX:t.wrapX,zDirection:t.zDirection})}}e.Z=a},18489:function(t,e,i){"use strict";i.d(e,{s:function(){return g}});var n=i(6747),r=i(27501),s=i(2145),o=i(74251),a=i(22765),l=i(23422),h=i(81625),u=i(69649),c=i(70658),d=i(81898);class f extends r.Z{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,projection:t.projection,state:t.state,wrapX:t.wrapX,interpolate:t.interpolate}),this.on,this.once,this.un,this.opaque_=void 0!==t.opaque&&t.opaque,this.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&(0,d.Pq)(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new s.Z(t.cacheSize||0),this.tmpSize=[0,0],this.key_=t.key||"",this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}canExpireCache(){return this.tileCache.canExpireCache()}expireCache(t,e){const i=this.getTileCacheForProjection(t);i&&i.expireCache(e)}forEachLoadedTile(t,e,i,n){const r=this.getTileCacheForProjection(t);if(!r)return!1;let s,a,l,h=!0;for(let t=i.minX;t<=i.maxX;++t)for(let c=i.minY;c<=i.maxY;++c)a=(0,u.lg)(e,t,c),l=!1,r.containsKey(a)&&(s=r.get(a),l=s.getState()===o.Z.LOADED,l&&(l=!1!==n(s))),l||(h=!1);return h}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getOpaque(t){return this.opaque_}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,n,r){return(0,a.O3)()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:(0,c.X$)(t)}getTileCacheForProjection(t){const e=this.getProjection();return(0,l.h)(null===e||(0,h.OP)(e,t),"A VectorTile source can only be rendered if it has a projection compatible with the view projection."),this.tileCache}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),r=this.getTilePixelRatio(e),s=(0,d.Pq)(n.getTileSize(t),this.tmpSize);return 1==r?s:(0,d.bA)(s,r,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=(0,c.Cf)(i,t,e)),(0,u.tE)(t,i)?t:null}clear(){this.tileCache.clear()}refresh(){this.clear(),super.refresh()}updateCacheSize(t,e){const i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)}useTile(t,e,i,n){}}class g extends n.ZP{constructor(t,e){super(t),this.tile=e}}e.Z=f},96565:function(t,e,i){"use strict";var n=i(64469),r=i(850),s=i(81898);class o extends n.Z{constructor(t){super({opaque:!1,projection:(t=t||{}).projection,tileGrid:t.tileGrid,wrapX:void 0===t.wrapX||t.wrapX,zDirection:t.zDirection,url:t.template||"z:{z} x:{x} y:{y}",tileLoadFunction:(t,e)=>{const i=t.getTileCoord()[0],n=(0,s.Pq)(this.tileGrid.getTileSize(i)),o=(0,r.E4)(n[0],n[1]);o.strokeStyle="grey",o.strokeRect(.5,.5,n[0]+.5,n[1]+.5),o.fillStyle="grey",o.strokeStyle="white",o.textAlign="center",o.textBaseline="middle",o.font="24px sans-serif",o.lineWidth=4,o.strokeText(e,n[0]/2,n[1]/2,n[0]),o.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(o.canvas)}})}}e.Z=o},30078:function(t,e){"use strict";e.Z={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"}},28053:function(t,e,i){"use strict";var n=i(92486),r=i(27859),s=i(27139),o=i(2145),a=i(74251),l=i(81876),h=i(81625),u=i(69649),c=i(70658),d=i(22765);class f extends l.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:g,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:t.wrapX,transition:t.transition,interpolate:void 0===t.interpolate||t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.crossOrigin=void 0!==t.crossOrigin?t.crossOrigin:null,this.tileClass=void 0!==t.tileClass?t.tileClass:r.Z,this.tileCacheForProjection={},this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}canExpireCache(){if(this.tileCache.canExpireCache())return!0;for(const t in this.tileCacheForProjection)if(this.tileCacheForProjection[t].canExpireCache())return!0;return!1}expireCache(t,e){const i=this.getTileCacheForProjection(t);this.tileCache.expireCache(this.tileCache==i?e:{});for(const t in this.tileCacheForProjection){const n=this.tileCacheForProjection[t];n.expireCache(n==i?e:{})}}getGutterForProjection(t){return this.getProjection()&&t&&!(0,h.OP)(this.getProjection(),t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getOpaque(t){return!(this.getProjection()&&t&&!(0,h.OP)(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||(0,h.OP)(e,t)))return this.tileGrid;const i=(0,d.sq)(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=(0,c.X$)(t)),this.tileGridForProjection[i]}getTileCacheForProjection(t){const e=this.getProjection();if(!e||(0,h.OP)(e,t))return this.tileCache;const i=(0,d.sq)(t);return i in this.tileCacheForProjection||(this.tileCacheForProjection[i]=new o.Z(this.tileCache.highWaterMark)),this.tileCacheForProjection[i]}createTile_(t,e,i,r,s,o){const l=[t,e,i],h=this.getTileCoordForTileUrlFunction(l,s),u=h?this.tileUrlFunction(h,r,s):void 0,c=new this.tileClass(l,void 0!==u?a.Z.IDLE:a.Z.EMPTY,void 0!==u?u:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return c.key=o,c.addEventListener(n.Z.CHANGE,this.handleTileChange.bind(this)),c}getTile(t,e,i,n,r){const o=this.getProjection();if(!o||!r||(0,h.OP)(o,r))return this.getTileInternal(t,e,i,n,o||r);const a=this.getTileCacheForProjection(r),l=[t,e,i];let c;const d=(0,u.km)(l);a.containsKey(d)&&(c=a.get(d));const f=this.getKey();if(c&&c.key==f)return c;const g=this.getTileGridForProjection(o),p=this.getTileGridForProjection(r),m=this.getTileCoordForTileUrlFunction(l,r),_=new s.Z(o,g,r,p,l,m,this.getTilePixelRatio(n),this.getGutter(),((t,e,i,n)=>this.getTileInternal(t,e,i,n,o)),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return _.key=f,c?(_.interimTile=c,_.refreshInterimChain(),a.replace(d,_)):a.set(d,_),_}getTileInternal(t,e,i,n,r){let s=null;const o=(0,u.lg)(t,e,i),l=this.getKey();if(this.tileCache.containsKey(o)){if(s=this.tileCache.get(o),s.key!=l){const h=s;s=this.createTile_(t,e,i,n,r,l),h.getState()==a.Z.IDLE?s.interimTile=h.interimTile:s.interimTile=h,s.refreshInterimChain(),this.tileCache.replace(o,s)}}else s=this.createTile_(t,e,i,n,r,l),this.tileCache.set(o,s);return s}setRenderReprojectionEdges(t){if(this.renderReprojectionEdges_!=t){this.renderReprojectionEdges_=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const i=(0,h.U2)(t);if(i){const t=(0,d.sq)(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}}function g(t,e){t.getImage().src=e}e.Z=f},20171:function(t,e,i){"use strict";var n=i(28053),r=i(36117),s=i(61672),o=i(70658),a=i(81625),l=i(38760);class h extends n.Z{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:(0,a.U2)("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.tileJSON_=null,this.tileSize_=t.tileSize,t.url)if(t.jsonp)(0,l.R6)(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.onXHRLoad_.bind(this)),e.addEventListener("error",this.onXHRError_.bind(this)),e.open("GET",t.url),e.send()}else{if(!t.tileJSON)throw new Error("Either `url` or `tileJSON` options must be provided");this.handleTileJSONResponse(t.tileJSON)}}onXHRLoad_(t){const e=t.target;if(!e.status||e.status>=200&&e.status<300){let t;try{t=JSON.parse(e.responseText)}catch(t){return void this.handleTileJSONError()}this.handleTileJSONResponse(t)}else this.handleTileJSONError()}onXHRError_(t){this.handleTileJSONError()}getTileJSON(){return this.tileJSON_}handleTileJSONResponse(t){const e=(0,a.U2)("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=(0,a.WO)(e,i);n=(0,r.Ne)(t.bounds,s)}const l=(0,o.Tl)(i),h=t.minzoom||0,u=t.maxzoom||22,c=(0,o.dl)({extent:l,maxZoom:u,minZoom:h,tileSize:this.tileSize_});if(this.tileGrid=c,this.tileUrlFunction=(0,s.uR)(t.tiles,c),t.attribution&&!this.getAttributions()){const e=void 0!==n?n:l;this.setAttributions((function(i){return(0,r.kK)(e,i.extent)?[t.attribution]:null}))}this.tileJSON_=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}}e.Z=h},78536:function(t,e,i){"use strict";var n=i(28053),r=i(29142),s=i(93172),o=i(36117),a=i(17708),l=i(84441),h=i(81625),u=i(63312),c=i(69649);class d extends n.Z{constructor(t){t=t||{};const e=Object.assign({},t.params),i=!("TRANSPARENT"in e)||e.TRANSPARENT;super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:!i,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.gutter_=void 0!==t.gutter?t.gutter:0,this.params_=e,this.v13_=!0,this.serverType_=t.serverType,this.hidpi_=void 0===t.hidpi||t.hidpi,this.tmpExtent_=(0,o.lJ)(),this.updateV13_(),this.setKey(this.getKeyForParams_())}getFeatureInfoUrl(t,e,i,n){const s=(0,h.U2)(i),l=this.getProjection()||s;let u=this.getTileGrid();u||(u=this.getTileGridForProjection(l));const c=(0,h.vs)(t,s,l),d=(0,a.aA)(l,s,t,e),f=u.getZForResolution(d,this.zDirection),g=u.getResolution(f),p=u.getTileCoordForCoordAndZ(c,f);if(u.getResolutions().length<=p[0])return;let m=u.getTileCoordExtent(p,this.tmpExtent_);const _=this.gutter_;0!==_&&(m=(0,o.f3)(m,g*_,m));const y={QUERY_LAYERS:this.params_.LAYERS};Object.assign(y,(0,r.jt)(this.params_,"GetFeatureInfo"),n);const x=Math.floor((c[0]-m[0])/g),v=Math.floor((m[3]-c[1])/g);return y[this.v13_?"I":"X"]=x,y[this.v13_?"J":"Y"]=v,this.getRequestUrl_(p,m,1,l||s,y)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:r.eQ,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.params_.LAYERS;if(!(!Array.isArray(t)||1===t.length))return;i.LAYER=t}if(void 0!==t){const e=this.getProjection()?this.getProjection().getMetersPerUnit():1,n=28e-5;i.SCALE=t*e/n}return Object.assign(i,e),(0,s.B)(this.urls[0],i)}getGutter(){return this.gutter_}getParams(){return this.params_}getRequestUrl_(t,e,i,n,s){const o=this.urls;if(!o)return;let a;if(1==o.length)a=o[0];else{a=o[(0,u.$W)((0,c.vp)(t),o.length)]}return(0,r.Q4)(e,(this.tileGrid||this.getTileGridForProjection(n)).getResolution(t[0]),i,n,a,s,this.serverType_)}getTilePixelRatio(t){return this.hidpi_&&void 0!==this.serverType_?t:1}getKeyForParams_(){let t=0;const e=[];for(const i in this.params_)e[t++]=i+"-"+this.params_[i];return e.join("/")}updateParams(t){Object.assign(this.params_,t),this.updateV13_(),this.setKey(this.getKeyForParams_())}updateV13_(){const t=this.params_.VERSION||r.eQ;this.v13_=(0,l.n)(t,"1.3")>=0}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.hidpi_&&void 0!==this.serverType_||(e=1);const s=n.getResolution(t[0]);let a=n.getTileCoordExtent(t,this.tmpExtent_);const l=this.gutter_;0!==l&&(a=(0,o.f3)(a,s*l,a));const h=Object.assign({},(0,r.jt)(this.params_,"GetMap"));return this.getRequestUrl_(t,a,e,i,h)}}e.Z=d},81876:function(t,e,i){"use strict";var n=i(30078),r=i(18489),s=i(74251),o=i(61672),a=i(69649),l=i(22765);class h extends r.Z{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,opaque:t.opaque,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===h.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=(0,l.sq)(e),o=e.getState();let a;o==s.Z.LOADING?(this.tileLoadingKeys_[i]=!0,a=n.Z.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],a=o==s.Z.ERROR?n.Z.TILELOADERROR:o==s.Z.LOADED?n.Z.TILELOADEND:void 0),null!=a&&this.dispatchEvent(new r.s(a,e))}setTileLoadFunction(t){this.tileCache.clear(),this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,this.tileCache.pruneExceptNewestZ(),void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=(0,o.Gk)(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction((0,o.uR)(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=(0,a.lg)(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}e.Z=h},4711:function(t,e,i){"use strict";var n=i(79638),r=i(8651),s=i(6747),o=i(92486),a=i(35323),l=i(25626),h=i(33321),u=i(27501),c=i(70487),d=i(79407),f=i(2896),g=i(23422),p=i(36117),m=i(17367),_=i(22765),y=i(4891),x=i(41507),v=i(41773);class E extends s.ZP{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class b extends u.Z{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=d.Zn,this.format_=t.format,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&((0,g.h)(this.format_,"`format` must be set when `url` is set"),this.loader_=(0,v.Be)(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:f.$6;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,r;this.featuresRtree_=e?new l.Z:null,this.loadedExtentsRtree_=new l.Z,this.loadingExtentsCount_=0,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?r=t.features:t.features&&(i=t.features,r=i.getArray()),e||void 0!==i||(i=new n.Z(r)),void 0!==r&&this.addFeaturesInternal(r),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=(0,_.sq)(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new E(c.Z.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof h.ZP||(this.featureChangeKeys_[t]=[(0,x.oL)(e,o.Z.CHANGE,this.handleFeatureChange_,this),(0,x.oL)(e,a.Z.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof h.ZP){const n=this.idIndex_[t];n instanceof h.ZP?Array.isArray(n)?n.push(e):this.idIndex_[t]=[n,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&((0,g.h)(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],n=[];for(let e=0,n=t.length;e{e||(e=!0,this.addFeature(t.element),e=!1)})),t.addEventListener(r.Z.REMOVE,(t=>{e||(e=!0,this.removeFeature(t.element),e=!1)})),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){this.featureChangeKeys_[t].forEach(x.bN)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){const t=t=>{this.removeFeatureInternal(t)};this.featuresRtree_.forEach(t);for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new E(c.Z.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){const n=i.getGeometry();if(n instanceof h.ZP||n.intersectsCoordinate(t))return e(i)}))}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){const n=i.getGeometry();if(n instanceof h.ZP||n.intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),(0,y.x)(this.nullGeometryFeatures_)||(0,m.l7)(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=(0,p.MV)(t,e);return[].concat(...i.map((t=>this.featuresRtree_.getInExtent(t))))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let r=null;const s=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||d.uX,this.featuresRtree_.forEachInExtent(a,(function(t){if(e(t)){const e=t.getGeometry(),l=o;if(o=e instanceof h.ZP?0:e.closestPointXY(i,n,s,o),o{--this.loadingExtentsCount_,this.dispatchEvent(new E(c.Z.FEATURESLOADEND,void 0,t))}),(()=>{--this.loadingExtentsCount_,this.dispatchEvent(new E(c.Z.FEATURESLOADERROR))})),n.insert(s,{extent:s.slice()}))}this.loading=!(this.loader_.length<4)&&this.loadingExtentsCount_>0}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_;let i;e.forEachInExtent(t,(function(e){if((0,p.fS)(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=(0,_.sq)(t);e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=(0,_.sq)(t),i=this.featureChangeKeys_[e];if(!i)return;i.forEach(x.bN),delete this.featureChangeKeys_[e];const n=t.getId();return void 0!==n&&delete this.idIndex_[n.toString()],delete this.uidIndex_[e],this.dispatchEvent(new E(c.Z.REMOVEFEATURE,t)),t}removeFromIdIndex_(t){let e=!1;for(const i in this.idIndex_){const n=this.idIndex_[i];if(t instanceof h.ZP&&Array.isArray(n)&&n.includes(t))n.splice(n.indexOf(t),1);else if(this.idIndex_[i]===t){delete this.idIndex_[i],e=!0;break}}return e}setLoader(t){this.loader_=t}setUrl(t){(0,g.h)(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader((0,v.Be)(t,this.format_))}}e.Z=b},70487:function(t,e){"use strict";e.Z={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"}},19806:function(t,e,i){"use strict";i.d(e,{Z:function(){return w},I:function(){return S}});var n=i(92486),r=i(38264),s=i(2145),o=i(61931),a=i(74251),l=i(81876),h=i(69319),u=i(850),c=i(22765);const d=[];class f extends h.Z{constructor(t,e,i,n){super(t,e,{transition:0}),this.context_={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=(0,c.sq)(t);return e in this.context_||(this.context_[e]=(0,u.E4)(1,1,d)),this.context_[e]}hasContext(t){return(0,c.sq)(t)in this.context_}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=(0,c.sq)(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){for(const t in this.context_){const e=this.context_[t];(0,u.jy)(e),d.push(e.canvas),delete this.context_[t]}super.release()}}var g=f,p=i(36913),m=i(36117),_=i(70658),y=i(69649),x=i(4891),v=i(41773),E=i(81898);class b extends l.Z{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||(0,_.Tl)(e),n=t.tileGrid||(0,_.dl)({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,opaque:!1,projection:e,state:t.state,tileGrid:n,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:S,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.sourceTileCache=new s.Z(this.tileCache.highWaterMark),this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:r.Z,this.tileGrids_={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=(0,y.Ul)(i.peekFirstKey())[0],r=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==a.Z.LOADED)return;const s=i.getSourceTiles();for(let i=0,n=s.length;i{const n=(0,y.MY)(e),r=i.peek(n);if(r){const e=r.sourceTiles;for(let i=0,n=e.length;i{const s=this.tileUrlFunction(r,t,e),o=this.sourceTileCache.containsKey(s)?this.sourceTileCache.get(s):new this.tileClass(r,s?a.Z.IDLE:a.Z.EMPTY,s,this.format_,this.tileLoadFunction);i.sourceTiles.push(o);const l=o.getState();if(l{this.handleTileChange(e);const r=o.getState();if(r===a.Z.LOADED||r===a.Z.ERROR){const e=o.getKey();e in i.errorTileKeys?o.getState()===a.Z.LOADED&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,r===a.Z.ERROR?i.errorTileKeys[e]=!0:o.removeEventListener(n.Z.CHANGE,t),0===i.loadingSourceTiles&&i.setState((0,x.x)(i.errorTileKeys)?a.Z.LOADED:a.Z.ERROR)}};o.addEventListener(n.Z.CHANGE,t),i.loadingSourceTiles++}l===a.Z.IDLE&&(o.extent=u.getTileCoordExtent(r),o.projection=e,o.resolution=u.getResolution(r[0]),this.sourceTileCache.set(s,o),o.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===a.Z.ERROR))?a.Z.ERROR:a.Z.LOADED)}return i.sourceTiles}getTile(t,e,i,n,r){const s=(0,y.lg)(t,e,i),o=this.getKey();let l;if(this.tileCache.containsKey(s)&&(l=this.tileCache.get(s),l.key===o))return l;const h=[t,e,i];let u=this.getTileCoordForTileUrlFunction(h,r);const c=this.getTileGrid().getExtent(),d=this.getTileGridForProjection(r);if(u&&c){const e=d.getTileCoordExtent(u);(0,m.f3)(e,-d.getResolution(t),e),(0,m.kK)(c,e)||(u=null)}let f=!0;if(null!==u){const e=this.tileGrid,i=d.getResolution(t),s=e.getZForResolution(i,1),o=d.getTileCoordExtent(u);(0,m.f3)(o,-i,o),e.forEachTileCoord(o,s,(t=>{f=f&&!this.tileUrlFunction(t,n,r)}))}const p=new g(h,f?a.Z.EMPTY:a.Z.IDLE,u,this.getSourceTiles.bind(this,n,r));return p.key=o,l?(p.interimTile=l,p.refreshInterimChain(),this.tileCache.replace(s,p)):this.tileCache.set(s,p),p}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),r=n.map((function(e,i){return t.getOrigin(i)})),s=n.map((function(e,i){return t.getTileSize(i)})),a=p.e+1;for(let t=n.length;t0&&(this.tileUrlFunction=(0,a.Un)(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction((0,a.Un)(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.dimensions_}getFormat(){return this.format_}getLayer(){return this.layer_}getMatrixSet(){return this.matrixSet_}getRequestEncoding(){return this.requestEncoding_}getStyle(){return this.style_}getVersion(){return this.version_}getKeyForDimensions_(){const t=this.urls?this.urls.slice(0):[];for(const e in this.dimensions_)t.push(e+"-"+this.dimensions_[e]);return t.join("/")}updateDimensions(t){Object.assign(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())}createFromWMTSTemplate(t){const e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t="KVP"==e?(0,r.B)(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,s=this.dimensions_;return function(i,o,a){if(!i)return;const l={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(l,s);let h=t;return h="KVP"==e?(0,r.B)(h,l):h.replace(/\{(\w+?)\}/g,(function(t,e){return l[e]})),h}}}function u(t,e){const i=t.Contents.Layer.find((function(t){return t.Identifier==e.layer}));if(!i)return null;const n=t.Contents.TileMatrixSet;let r;r=i.TileMatrixSetLink.length>1?"projection"in e?i.TileMatrixSetLink.findIndex((function(t){const i=n.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,r=(0,l.U2)(i),s=(0,l.U2)(e.projection);return r&&s?(0,l.OP)(r,s):i==e.projection})):i.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,r<0&&(r=0);const a=i.TileMatrixSetLink[r].TileMatrixSet,h=i.TileMatrixSetLink[r].TileMatrixSetLimits;let u=i.Format[0];"format"in e&&(u=e.format),r=i.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),r<0&&(r=0);const c=i.Style[r].Identifier,d={};"Dimension"in i&&i.Dimension.forEach((function(t,e,i){const n=t.Identifier;let r=t.Default;void 0===r&&(r=t.Value[0]),d[n]=r}));const f=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==a}));let g;const p=f.SupportedCRS;if(p&&(g=(0,l.U2)(p)),"projection"in e){const t=(0,l.U2)(e.projection);t&&(g&&!(0,l.OP)(t,g)||(g=t))}let m=!1;const _="ne"==g.getAxisOrientation().substr(0,2);let y=f.TileMatrix[0],x={MinTileCol:0,MinTileRow:0,MaxTileCol:y.MatrixWidth-1,MaxTileRow:y.MatrixHeight-1};if(h){x=h[h.length-1];const t=f.TileMatrix.find((t=>t.Identifier===x.TileMatrix||f.Identifier+":"+t.Identifier===x.TileMatrix));t&&(y=t)}const v=28e-5*y.ScaleDenominator/g.getMetersPerUnit(),E=_?[y.TopLeftCorner[1],y.TopLeftCorner[0]]:y.TopLeftCorner,b=y.TileWidth*v,w=y.TileHeight*v;let S=f.BoundingBox;S&&_&&(S=[S[1],S[0],S[3],S[2]]);let C=[E[0]+b*x.MinTileCol,E[1]-w*(1+x.MaxTileRow),E[0]+b*(1+x.MaxTileCol),E[1]-w*x.MinTileRow];if(void 0!==S&&!(0,s.r4)(S,C)){const t=i.WGS84BoundingBox,e=(0,l.U2)("EPSG:4326").getExtent();if(C=S,t)m=t[0]===e[0]&&t[2]===e[2];else{const t=(0,l.$A)(S,f.SupportedCRS,"EPSG:4326");m=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const T=(0,o.b)(f,C,h),M=[];let P=e.requestEncoding;if(P=void 0!==P?P:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;tg||a>g;)l.push([Math.ceil(o/g),Math.ceil(a/g)]),g+=g;break;case"truncated":let t=o,e=a;for(;t>g||e>g;)l.push([Math.ceil(t/g),Math.ceil(e/g)]),t>>=1,e>>=1;break;default:throw new Error("Unknown `tierSizeCalculation` configured")}l.push([1,1]),l.reverse();const p=[r],m=[0];for(let t=1,e=l.length;t{v=f,this.changed()})),S.src=w}}e.Z=f},18468:function(t,e,i){"use strict";i.d(e,{I:function(){return u},K:function(){return c}});var n=i(3532),r=i(93172),s=i(57419),o=i(36117),a=i(81625),l=i(91531),h=i(63312);function u(t,e,i,s,a,l){const u=a.getCode().split(/:(?=\d+$)/).pop(),c=i/s,d=[(0,h.NM)((0,o.dz)(e)/c,n.L),(0,h.NM)((0,o.Cr)(e)/c,n.L)];l.SIZE=d[0]+","+d[1],l.BBOX=e.join(","),l.BBOXSR=u,l.IMAGESR=u,l.DPI=Math.round(l.DPI?l.DPI*s:90*s);const f=t.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");if(f==t)throw new Error("`options.featureTypes` should be an Array");return(0,r.B)(f,l)}function c(t){const e=t.load?t.load:s.Jx,i=(0,a.U2)(t.projection||"EPSG:3857");return function(n,r,s){s=t.hidpi?s:1;const a={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(a,t.params),n=(0,l.Ps)(n,r,s,t.ratio);const h=u(t.url,n,r,s,i,a),c=new Image;return null!==t.crossOrigin&&(c.crossOrigin=t.crossOrigin),e(c,h).then((t=>{const e=(0,o.dz)(n)/t.width*s;return{image:t,extent:n,resolution:e,pixelRatio:s}}))}}},3532:function(t,e,i){"use strict";i.d(e,{L:function(){return n}});const n=4},16772:function(t,e,i){"use strict";i.d(e,{X$:function(){return c}});var n=i(61931),r=i(38760),s=i(81625),o=i(36117);const a={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},l={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function h(t,e,i,a){let l=t.projection;if(!l&&(l=(0,s.U2)(e.crs),!l))throw new Error(`Unsupported CRS: ${e.crs}`);const h="en"!==l.getAxisOrientation().substr(0,2),u=e.tileMatrices,c={};for(let t=0;tt.maxTileCol||h.tileRowt.maxTileRow)return}Object.assign(h,E);const u=i.replace(/\{(\w+?)\}/g,(function(t,e){return h[e]}));return(0,r.Kk)(b,u)}}}function u(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=function(t,e){let i,n;for(let r=0;r"http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme"===t.rel));if(!s)throw new Error("Expected http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme link or tileMatrixSet");const o=s.href,u=(0,r.Kk)(t.url,o);return(0,r.xA)(u).then((function(e){return h(t,e,n,i)}))}function c(t){return(0,r.xA)(t.url).then((function(e){return u(t,e)}))}},29142:function(t,e,i){"use strict";i.d(e,{Ke:function(){return m},Q4:function(){return g},QL:function(){return _},YT:function(){return y},eQ:function(){return c},jt:function(){return p}});var n=i(3532),r=i(93172),s=i(84441),o=i(57419),a=i(63312),l=i(36117),h=i(81625),u=i(91531);const c="1.3.0",d=[101,101];function f(t,e,i,n,o){o.WIDTH=i[0],o.HEIGHT=i[1];const a=n.getAxisOrientation();let l;const h=(0,s.n)(o.VERSION,"1.3")>=0;return o[h?"CRS":"SRS"]=n.getCode(),l=h&&"ne"==a.substr(0,2)?[e[1],e[0],e[3],e[2]]:e,o.BBOX=l.join(","),(0,r.B)(t,o)}function g(t,e,i,r,s,o,h){o=Object.assign({REQUEST:"GetMap"},o);const u=e/i,c=[(0,a.NM)((0,l.dz)(t)/u,n.L),(0,a.NM)((0,l.Cr)(t)/u,n.L)];if(1!=i)switch(h){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in o?o.FORMAT_OPTIONS+=";dpi:"+t:o.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":o.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":o.DPI=90*i;break;default:throw new Error("Unknown `serverType` configured")}return f(s,t,c,r,o)}function p(t,e){return Object.assign({REQUEST:e,SERVICE:"WMS",VERSION:c,FORMAT:"image/png",STYLES:"",TRANSPARENT:!0},t)}function m(t){const e=void 0===t.hidpi||t.hidpi,i=(0,h.U2)(t.projection||"EPSG:3857"),n=t.ratio||1.5,r=t.load||o.Jx;return(s,o,a)=>{s=(0,u.Ps)(s,o,a,n),1==a||e&&void 0!==t.serverType||(a=1);const l=g(s,o,a,i,t.url,p(t.params,"GetMap"),t.serverType),h=new Image;return null!==t.crossOrigin&&(h.crossOrigin=t.crossOrigin),r(h,l).then((t=>({image:t,extent:s,pixelRatio:a})))}}function _(t,e,i){if(void 0===t.url)return;const r=(0,h.U2)(t.projection||"EPSG:3857"),o=(0,l.p8)(e,i,0,d),u={QUERY_LAYERS:t.params.LAYERS,INFO_FORMAT:"application/json"};Object.assign(u,p(t.params,"GetFeatureInfo"),t.params);const c=(0,a.GW)((e[0]-o[0])/i,n.L),g=(0,a.GW)((o[3]-e[1])/i,n.L),m=(0,s.n)(u.VERSION,"1.3")>=0;return u[m?"I":"X"]=c,u[m?"J":"Y"]=g,f(t.url,o,d,r,u)}function y(t,e){if(void 0===t.url)return;const i={SERVICE:"WMS",VERSION:c,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===t.params||void 0===t.params.LAYER){const e=t.params.LAYERS;if(!(!Array.isArray(e)||1===e.length))return;i.LAYER=e}if(void 0!==e){const n=(0,h.U2)(t.projection||"EPSG:3857").getMetersPerUnit()||1,r=28e-5;i.SCALE=e*n/r}return Object.assign(i,t.params),(0,r.B)(t.url,i)}},38881:function(t,e,i){"use strict";i.d(e,{Sp:function(){return s},bg:function(){return h},cv:function(){return u},xA:function(){return a}});var n=i(63312);const r=6371008.8;function s(t,e,i){i=i||r;const s=(0,n.Yr)(t[1]),o=(0,n.Yr)(e[1]),a=(o-s)/2,l=(0,n.Yr)(e[0]-t[0])/2,h=Math.sin(a)*Math.sin(a)+Math.sin(l)*Math.sin(l)*Math.cos(s)*Math.cos(o);return 2*i*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function o(t,e){let i=0;for(let n=0,r=t.length;ne?n:new Array(1+e-r).join("0")+n}function r(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;tr)return 1;if(r>e)return-1}return 0}i.d(e,{n:function(){return r},v:function(){return n}})},80316:function(t,e,i){"use strict";var n=i(23422);e.Z=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return(0,n.h)(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return(0,n.h)(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){(0,n.h)(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}},25626:function(t,e,i){"use strict";var n=i(78476),r=i(36117),s=i(22765),o=i(4891);e.Z=class{constructor(t){this.rbush_=new n(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[(0,s.sq)(e)]=i}load(t,e){const i=new Array(e.length);for(let n=0,r=e.length;n{this.patternImage_=null})),e.getImageState()===n.Z.IDLE&&e.load(),e.getImageState()===n.Z.LOADING&&(this.patternImage_=e)}this.color_=t}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}e.Z=s},43586:function(t,e,i){"use strict";var n=i(92486),r=i(13701),s=i(42718),o=i(12185),a=i(23422),l=i(72605),h=i(22765);function u(t,e,i,n){return void 0!==i&&void 0!==n?[i/t,n/e]:void 0!==i?i/t:void 0!==n?n/e:1}class c extends s.Z{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,n=void 0!==t.scale?t.scale:1,s=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:n,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:s,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null;const c=void 0!==t.img?t.img:null;let d,f=t.src;if((0,a.h)(!(void 0!==f&&c),"`image` and `src` cannot be provided at the same time"),void 0!==f&&0!==f.length||!c||(f=c.src||(0,h.sq)(c)),(0,a.h)(void 0!==f&&f.length>0,"A defined and non-empty `src` or `image` must be provided"),(0,a.h)(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?d=r.Z.IDLE:void 0!==c&&(d=c instanceof HTMLImageElement?c.complete?c.src?r.Z.LOADED:r.Z.IDLE:r.Z.LOADING:r.Z.LOADED),this.color_=void 0!==t.color?(0,o._2)(t.color):null,this.iconImage_=(0,l.U)(c,f,this.crossOrigin_,d,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const n=this.getImage(1);if(n.width&&n.height)e=n.width,i=n.height;else if(n instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();this.setScale(u(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(u(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new c({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:this.iconImage_.getImageState()==r.Z.LOADED?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:this.iconImage_.getImageState()==r.Z.LOADED?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(n.Z.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(n.Z.CHANGE,t)}ready(){return this.iconImage_.ready()}}e.Z=c},72605:function(t,e,i){"use strict";i.d(e,{U:function(){return d}});var n=i(13804),r=i(92486),s=i(13701),o=i(12185),a=i(850),l=i(57419),h=i(47921);let u=null;class c extends n.Z{constructor(t,e,i,n,r){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i,this.canvas_={},this.color_=r,this.imageState_=void 0===n?s.Z.IDLE:n,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===s.Z.LOADED){u||(u=(0,a.E4)(1,1,void 0,{willReadFrequently:!0})),u.drawImage(this.image_,0,0);try{u.getImageData(0,0,1,1),this.tainted_=!1}catch(t){u=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(r.Z.CHANGE)}handleImageError_(){this.imageState_=s.Z.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=s.Z.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_[0],e=this.size_[1],i=(0,a.E4)(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===s.Z.IDLE){this.image_||this.initializeImage_(),this.imageState_=s.Z.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch(t){this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(0,l.Q9)(this.image_,this.src_).then((t=>{this.image_=t,this.handleImageLoad_()})).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==s.Z.LOADED)return;const e=this.image_,i=document.createElement("canvas");i.width=Math.ceil(e.width*t),i.height=Math.ceil(e.height*t);const n=i.getContext("2d");n.scale(t,t),n.drawImage(e,0,0),n.globalCompositeOperation="multiply",n.fillStyle=(0,o.XC)(this.color_),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.canvas_[t]=i}ready(){return this.ready_||(this.ready_=new Promise((t=>{this.imageState_===s.Z.LOADED||this.imageState_===s.Z.ERROR?t():this.addEventListener(r.Z.CHANGE,(function e(){this.imageState_!==s.Z.LOADED&&this.imageState_!==s.Z.ERROR||(this.removeEventListener(r.Z.CHANGE,e),t())}))}))),this.ready_}}function d(t,e,i,n,r,s){let o=void 0===e?void 0:h.c1.get(e,i,r);return o||(o=new c(t,t instanceof HTMLImageElement?t.src||void 0:e,i,n,r),h.c1.set(e,i,r,o,s)),s&&o&&!h.c1.getPattern(e,i,r)&&h.c1.set(e,i,r,o,s),o}},47921:function(t,e,i){"use strict";i.d(e,{c1:function(){return l}});var n=i(13701),r=i(12185),s=i(850);class o{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=32}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e,i){const n=a(t,e,i);return n in this.cache_?this.cache_[n]:null}getPattern(t,e,i){const n=a(t,e,i);return n in this.patternCache_?this.patternCache_[n]:null}set(t,e,i,r,o){const l=a(t,e,i),h=l in this.cache_;this.cache_[l]=r,o&&(r.getImageState()===n.Z.IDLE&&r.load(),r.getImageState()===n.Z.LOADING?r.ready().then((()=>{this.patternCache_[l]=(0,s.W8)().createPattern(r.getImage(1),"repeat")})):this.patternCache_[l]=(0,s.W8)().createPattern(r.getImage(1),"repeat")),h||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function a(t,e,i){return e+":"+t+":"+(i?(0,r._2)(i):"null")}const l=new o},42718:function(t,e,i){"use strict";var n=i(22765),r=i(81898);class s{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=(0,r.Pq)(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new s({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return(0,n.O3)()}getImage(t){return(0,n.O3)()}getHitDetectionImage(){return(0,n.O3)()}getPixelRatio(t){return 1}getImageState(){return(0,n.O3)()}getImageSize(){return(0,n.O3)()}getOrigin(){return(0,n.O3)()}getSize(){return(0,n.O3)()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=(0,r.Pq)(t)}listenImageChange(t){(0,n.O3)()}load(){(0,n.O3)()}unlistenImageChange(t){(0,n.O3)()}ready(){return Promise.resolve()}}e.Z=s},49243:function(t,e,i){"use strict";var n=i(13701),r=i(42718),s=i(12185),o=i(52987),a=i(850),l=i(17955);class h extends r.Z{constructor(t){super({opacity:1,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,rotation:void 0!==t.rotation?t.rotation:0,scale:void 0!==t.scale?t.scale:1,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode}),this.canvases_,this.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius_=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?n.Z.LOADING:n.Z.LOADED,this.imageState_===n.Z.LOADING&&this.ready().then((()=>this.imageState_=n.Z.LOADED)),this.render()}clone(){const t=this.getScale(),e=new h({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){let e=this.canvases_[t];if(!e){const i=this.renderOptions_,n=(0,a.E4)(i.size*t,i.size*t);this.draw_(i,n,t),e=n.canvas,this.canvases_[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius_}getRadius2(){return this.radius2_}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.radius_,r=void 0===this.radius2_?n:this.radius2_;if(ni||i>e.getMaxZoom())return!1;const s=e.getFullTileRange(i);return!s||s.containsXY(n,r)}i.d(e,{MY:function(){return o},T9:function(){return n},Ul:function(){return a},km:function(){return s},lg:function(){return r},tE:function(){return h},vp:function(){return l}})},70658:function(t,e,i){"use strict";i.d(e,{Cf:function(){return h},Tl:function(){return d},X$:function(){return l},dl:function(){return u}});var n=i(61931),r=i(36913),s=i(81625),o=i(36117),a=i(81898);function l(t){let e=t.getDefaultTileGrid();return e||(e=function(t,e,i,r){const s=d(t);return function(t,e,i,r){r=void 0!==r?r:"top-left";const s=c(t,e,i);return new n.Z({extent:t,origin:(0,o.g0)(t,r),resolutions:s,tileSize:i})}(s,e,i,r)}(t),t.setDefaultTileGrid(e)),e}function h(t,e,i){const n=e[0],r=t.getTileCoordCenter(e),s=d(i);if(!(0,o.b8)(s,r)){const e=(0,o.dz)(s),i=Math.ceil((s[0]-r[0])/e);return r[0]+=e*i,t.getTileCoordForCoordAndZ(r,n)}return e}function u(t){const e=t||{},i=e.extent||(0,s.U2)("EPSG:3857").getExtent(),r={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:c(i,e.maxZoom,e.tileSize,e.maxResolution)};return new n.Z(r)}function c(t,e,i,n){e=void 0!==e?e:r.e,i=(0,a.Pq)(void 0!==i?i:r.S);const s=(0,o.Cr)(t),l=(0,o.dz)(t);n=n>0?n:Math.max(l/i[0],s/i[1]);const h=e+1,u=new Array(h);for(let t=0;te-t),!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,i=this.resolutions_.length-1;t{const r=new n.Z(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(i){const t=this.getTileRangeForExtentAndZ(i,e);r.minX=Math.max(t.minX,r.minX),r.maxX=Math.min(t.maxX,r.maxX),r.minY=Math.max(t.minY,r.minY),r.maxY=Math.min(t.maxY,r.maxY)}return r})):i&&this.calculateTileRanges_(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,r=n.maxX;t<=r;++t)for(let r=n.minY,s=n.maxY;r<=s;++r)i([e,t,r])}forEachTileCoordParentTileRange(t,e,i,r){let s,o,a,l=null,h=t[0]-1;for(2===this.zoomFactor_?(o=t[1],a=t[2]):l=this.getTileCoordExtent(t,r);h>=this.minZoom;){if(void 0!==o&&void 0!==a?(o=Math.floor(o/2),a=Math.floor(a/2),s=(0,n.T)(o,o,a,a,i)):s=this.getTileRangeForExtentAndZ(l,h,i),e(h,s))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_[t]}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]this.maxZoom||e0)||i.find((function(i){return e[c]==i[u]||!e[c].includes(":")&&t[c]+":"+e[c]===i[u]})),r){o.push(e[c]);const t=28e-5*e[d]/m,i=e.TileWidth,r=e.TileHeight;_?a.push([e[f][1],e[f][0]]):a.push(e[f]),n.push(t),l.push(i==r?i:[i,r]),h.push([e.MatrixWidth,e.MatrixHeight])}})),new s({extent:e,origins:a,resolutions:n,matrixIds:o,tileSizes:l,sizes:h})}e.Z=s},36913:function(t,e,i){"use strict";i.d(e,{S:function(){return r},e:function(){return n}});const n=42,r=256},61672:function(t,e,i){"use strict";i.d(e,{Gk:function(){return h},Un:function(){return a},uR:function(){return o},vU:function(){return l}});var n=i(63312),r=i(69649);function s(t,e){const i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){if(o)return t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){const t=o[0],i=e.getFullTileRange(t);if(!i)throw new Error("The {-y} placeholder requires a tile grid with extent");return(i.getHeight()-o[2]-1).toString()}))}}function o(t,e){const i=t.length,n=new Array(i);for(let r=0;rMath.round(t*y[e])/y[e])).join(", ")+")"}},93172:function(t,e,i){"use strict";function n(t,e){const i=[];Object.keys(e).forEach((function(t){null!==e[t]&&void 0!==e[t]&&i.push(t+"="+encodeURIComponent(e[t]))}));const n=i.join("&");return t=t.replace(/[?&]$/,""),(t+=t.includes("?")?"&":"?")+n}i.d(e,{B:function(){return n}})},22765:function(t,e,i){"use strict";function n(){throw new Error("Unimplemented abstract method.")}i.d(e,{O3:function(){return n},sq:function(){return s}});let r=0;function s(t){return t.ol_uid||(t.ol_uid=String(++r))}},94704:function(t,e,i){"use strict";function n(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function r(t,e){return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}i.d(e,{U:function(){return n},u:function(){return r}})},91512:function(t,e,i){"use strict";i.d(e,{Ae:function(){return u},F_:function(){return o},MB:function(){return a},RF:function(){return d},cX:function(){return s},fw:function(){return g},kd:function(){return l},qO:function(){return r},r1:function(){return c},wg:function(){return h}});var n=i(14768);const r=34962,s=34963,o=35040,a=35044,l=35048,h=5121,u=5123,c=5125,d=5126,f=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function g(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!n.ME},e);const i=f.length;for(let n=0;n{this.uniforms_.push({value:t.uniforms[i],location:e.getUniformLocation(this.renderTargetProgram_,i)})}))}getGL(){return this.gl_}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.scaleRatio_,e.drawingBufferHeight*this.scaleRatio_];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.bindRenderbuffer(e.RENDERBUFFER,this.getDepthBuffer()),e.viewport(0,0,i[0],i[1]),!this.renderTargetTextureSize_||this.renderTargetTextureSize_[0]!==i[0]||this.renderTargetTextureSize_[1]!==i[1]){this.renderTargetTextureSize_=i;const t=0,n=e.RGBA,r=0,s=e.RGBA,o=e.UNSIGNED_BYTE,a=null;e.bindTexture(e.TEXTURE_2D,this.renderTargetTexture_),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],r,s,o,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.renderTargetTexture_,0),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,i[0],i[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthBuffer_)}}apply(t,e,i,n){const r=this.getGL(),s=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.renderTargetTexture_),!e){const e=(0,o.sq)(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)),t.renderTargets[e]=!0}}r.disable(r.DEPTH_TEST),r.enable(r.BLEND),r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.viewport(0,0,r.drawingBufferWidth,r.drawingBufferHeight),r.bindBuffer(r.ARRAY_BUFFER,this.renderTargetVerticesBuffer_),r.useProgram(this.renderTargetProgram_),r.enableVertexAttribArray(this.renderTargetAttribLocation_),r.vertexAttribPointer(this.renderTargetAttribLocation_,2,r.FLOAT,!1,0,0),r.uniform2f(this.renderTargetUniformLocation_,s[0],s[1]),r.uniform1i(this.renderTargetTextureLocation_,0);const a=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.renderTargetOpacityLocation_,a),this.applyUniforms(t),i&&i(r,t),r.drawArrays(r.TRIANGLES,0,6),n&&n(r,t)}getFrameBuffer(){return this.frameBuffer_}getDepthBuffer(){return this.depthBuffer_}applyUniforms(t){const e=this.getGL();let i,n=1;this.uniforms_.forEach((function(r){if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof ImageData)r.texture||(r.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,r.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),i instanceof ImageData?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,i.width,i.height,0,e.UNSIGNED_BYTE,new Uint8Array(i.data)):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),e.uniform1i(r.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(r.location,i[0],i[1]);case 3:return void e.uniform3f(r.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(r.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(r.location,i)}))}},l=i(91512),h=i(4891),u=i(44669),c=i(94704);const d={PROJECTION_MATRIX:"u_projectionMatrix",SCREEN_TO_WORLD_MATRIX:"u_screenToWorldMatrix",TIME:"u_time",ZOOM:"u_zoom",RESOLUTION:"u_resolution",ROTATION:"u_rotation",VIEWPORT_SIZE_PX:"u_viewportSizePx",PIXEL_RATIO:"u_pixelRatio",HIT_DETECTION:"u_hitDetection"},f={UNSIGNED_BYTE:l.wg,UNSIGNED_SHORT:l.Ae,UNSIGNED_INT:l.r1,FLOAT:l.RF},g={};function p(t){return"shared/"+t}let m=0;class _ extends s.Z{constructor(t){super(),t=t||{},this.boundHandleWebGLContextLost_=this.handleWebGLContextLost.bind(this),this.boundHandleWebGLContextRestored_=this.handleWebGLContextRestored.bind(this),this.canvasCacheKey_=t.canvasCacheKey?p(t.canvasCacheKey):function(){const t="unique/"+m;return m+=1,t}(),this.gl_=function(t){let e=g[t];if(!e){const i=document.createElement("canvas");i.width=1,i.height=1,i.style.position="absolute",i.style.left="0",e={users:0,context:(0,l.fw)(i)},g[t]=e}return e.users+=1,e.context}(this.canvasCacheKey_),this.bufferCache_={},this.extensionCache_={},this.currentProgram_=null,this.needsToBeRecreated_=!1;const e=this.gl_.canvas;e.addEventListener(n,this.boundHandleWebGLContextLost_),e.addEventListener(r,this.boundHandleWebGLContextRestored_),this.offsetRotateMatrix_=(0,u.Ue)(),this.offsetScaleMatrix_=(0,u.Ue)(),this.tmpMat4_=(0,c.U)(),this.uniformLocationsByProgram_={},this.attribLocationsByProgram_={},this.uniforms_=[],t.uniforms&&this.setUniforms(t.uniforms),this.postProcessPasses_=t.postProcesses?t.postProcesses.map((t=>new a({webGlContext:this.gl_,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms}))):[new a({webGlContext:this.gl_})],this.shaderCompileErrors_=null,this.startTime_=Date.now()}setUniforms(t){this.uniforms_=[],this.addUniforms(t)}addUniforms(t){for(const e in t)this.uniforms_.push({name:e,value:t[e]})}canvasCacheKeyMatches(t){return this.canvasCacheKey_===p(t)}getExtension(t){if(t in this.extensionCache_)return this.extensionCache_[t];const e=this.gl_.getExtension(t);return this.extensionCache_[t]=e,e}bindBuffer(t){const e=this.gl_,i=(0,o.sq)(t);let n=this.bufferCache_[i];if(!n){n={buffer:t,webGlBuffer:e.createBuffer()},this.bufferCache_[i]=n}e.bindBuffer(t.getType(),n.webGlBuffer)}flushBufferData(t){const e=this.gl_;this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.gl_,i=(0,o.sq)(t),n=this.bufferCache_[i];n&&!e.isContextLost()&&e.deleteBuffer(n.webGlBuffer),delete this.bufferCache_[i]}disposeInternal(){const t=this.gl_.canvas;t.removeEventListener(n,this.boundHandleWebGLContextLost_),t.removeEventListener(r,this.boundHandleWebGLContextRestored_),function(t){const e=g[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=e.context,n=i.getExtension("WEBGL_lose_context");n&&n.loseContext();const r=i.canvas;r.width=1,r.height=1,delete g[t]}(this.canvasCacheKey_),delete this.gl_}prepareDraw(t,e,i){const n=this.gl_,r=this.getCanvas(),s=t.size,o=t.pixelRatio;r.width===s[0]*o&&r.height===s[1]*o||(r.width=s[0]*o,r.height=s[1]*o,r.style.width=s[0]+"px",r.style.height=s[1]+"px");for(let e=this.postProcessPasses_.length-1;e>=0;e--)this.postProcessPasses_[e].init(t);n.bindTexture(n.TEXTURE_2D,null),n.clearColor(0,0,0,0),n.depthRange(0,1),n.clearDepth(1),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,e?n.ZERO:n.ONE_MINUS_SRC_ALPHA),i?(n.enable(n.DEPTH_TEST),n.depthFunc(n.LEQUAL)):n.disable(n.DEPTH_TEST)}bindTexture(t,e,i){const n=this.gl_;n.activeTexture(n.TEXTURE0+e),n.bindTexture(n.TEXTURE_2D,t),n.uniform1i(this.getUniformLocation(i),e)}prepareDrawToRenderTarget(t,e,i,n){const r=this.gl_,s=e.getSize();r.bindFramebuffer(r.FRAMEBUFFER,e.getFramebuffer()),r.bindRenderbuffer(r.RENDERBUFFER,e.getDepthbuffer()),r.viewport(0,0,s[0],s[1]),r.bindTexture(r.TEXTURE_2D,e.getTexture()),r.clearColor(0,0,0,0),r.depthRange(0,1),r.clearDepth(1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT),r.enable(r.BLEND),r.blendFunc(r.ONE,i?r.ZERO:r.ONE_MINUS_SRC_ALPHA),n?(r.enable(r.DEPTH_TEST),r.depthFunc(r.LEQUAL)):r.disable(r.DEPTH_TEST)}drawElements(t,e){const i=this.gl_;this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,r=e-t,s=4*t;i.drawElements(i.TRIANGLES,r,n,s)}finalizeDraw(t,e,i){for(let n=0,r=this.postProcessPasses_.length;n{if(i="function"==typeof r.value?r.value(t):r.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData||i instanceof WebGLTexture){i instanceof WebGLTexture&&!r.texture?(r.prevValue=void 0,r.texture=i):r.texture||(r.prevValue=void 0,r.texture=e.createTexture()),this.bindTexture(r.texture,n,r.name),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const t=!(i instanceof HTMLImageElement)||i.complete;i instanceof WebGLTexture||!t||r.prevValue===i||(r.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),n++}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(r.name,(0,c.u)(this.tmpMat4_,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(r.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(r.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(r.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(r.name),i)}))}useProgram(t,e){this.gl_.useProgram(t),this.currentProgram_=t,this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.gl_,n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.gl_,n=this.compileShader(t,i.FRAGMENT_SHADER),r=this.compileShader(e,i.VERTEX_SHADER),s=i.createProgram();if(i.attachShader(s,n),i.attachShader(s,r),i.linkProgram(s),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compilation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(r,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(r)}`;throw new Error(t)}if(i.deleteShader(r),!i.getProgramParameter(s,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getProgramInfoLog(s)}`;throw new Error(t)}return s}getUniformLocation(t){const e=(0,o.sq)(this.currentProgram_);return void 0===this.uniformLocationsByProgram_[e]&&(this.uniformLocationsByProgram_[e]={}),void 0===this.uniformLocationsByProgram_[e][t]&&(this.uniformLocationsByProgram_[e][t]=this.gl_.getUniformLocation(this.currentProgram_,t)),this.uniformLocationsByProgram_[e][t]}getAttributeLocation(t){const e=(0,o.sq)(this.currentProgram_);return void 0===this.attribLocationsByProgram_[e]&&(this.attribLocationsByProgram_[e]={}),void 0===this.attribLocationsByProgram_[e][t]&&(this.attribLocationsByProgram_[e][t]=this.gl_.getAttribLocation(this.currentProgram_,t)),this.attribLocationsByProgram_[e][t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,r=t.viewState.resolution,s=t.viewState.center;return(0,u.qC)(e,0,0,2/(r*i[0]),2/(r*i[1]),-n,-s[0],-s[1]),e}setUniformFloatValue(t,e){this.gl_.uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.gl_.uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.gl_.uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.gl_.uniformMatrix4fv(this.getUniformLocation(t),!1,e)}enableAttributeArray_(t,e,i,n,r){const s=this.getAttributeLocation(t);s<0||(this.gl_.enableVertexAttribArray(s),this.gl_.vertexAttribPointer(s,e,i,!1,n,r))}enableAttributes(t){const e=function(t){let e=0;for(let i=0;ithis.size_[0]||e>=this.size_[1])return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r;this.readAll();const i=Math.floor(t)+(this.size_[1]-Math.floor(e)-1)*this.size_[0];return r[0]=this.data_[4*i],r[1]=this.data_[4*i+1],r[2]=this.data_[4*i+2],r[3]=this.data_[4*i+3],r}getTexture(){return this.texture_}getFramebuffer(){return this.framebuffer_}getDepthbuffer(){return this.depthbuffer_}updateSize_(){const t=this.size_,e=this.helper_.getGL();this.texture_=this.helper_.createTexture(t,null,this.texture_),e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer_),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture_,0),e.bindRenderbuffer(e.RENDERBUFFER,this.depthbuffer_),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,t[0],t[1]),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthbuffer_),this.data_=new Uint8Array(t[0]*t[1]*4)}}},11587:function(t,e,i){"use strict";i.d(e,{k:function(){return a}});var n=i(4082),r=i(25638);const s="#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\n\n// this used to produce an alpha-premultiplied color from a texture\nvec4 samplePremultiplied(sampler2D sampler, vec2 texCoord) {\n vec4 color = texture2D(sampler, texCoord);\n return vec4(color.rgb * color.a, color.a);\n}\n",o={"fill-color":"rgba(255,255,255,0.4)","stroke-color":"#3399CC","stroke-width":1.25,"circle-radius":5,"circle-fill-color":"rgba(255,255,255,0.4)","circle-stroke-width":1.25,"circle-stroke-color":"#3399CC"};class a{constructor(){this.uniforms_=[],this.attributes_=[],this.varyings_=[],this.hasSymbol_=!1,this.symbolSizeExpression_=`vec2(${(0,r.I2)(o["circle-radius"])} + ${(0,r.I2)(.5*o["circle-stroke-width"])})`,this.symbolRotationExpression_="0.0",this.symbolOffsetExpression_="vec2(0.0)",this.symbolColorExpression_=(0,r.g$)(o["circle-fill-color"]),this.texCoordExpression_="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression_="false",this.symbolRotateWithView_=!1,this.hasStroke_=!1,this.strokeWidthExpression_=(0,r.I2)(o["stroke-width"]),this.strokeColorExpression_=(0,r.g$)(o["stroke-color"]),this.strokeOffsetExpression_="0.",this.strokeCapExpression_=(0,r.JB)("round"),this.strokeJoinExpression_=(0,r.JB)("round"),this.strokeMiterLimitExpression_="10.",this.strokeDistanceFieldExpression_="-1000.",this.hasFill_=!1,this.fillColorExpression_=(0,r.g$)(o["fill-color"]),this.vertexShaderFunctions_=[],this.fragmentShaderFunctions_=[]}addUniform(t){return this.uniforms_.push(t),this}addAttribute(t){return this.attributes_.push(t),this}addVarying(t,e,i){return this.varyings_.push({name:t,type:e,expression:i}),this}setSymbolSizeExpression(t){return this.hasSymbol_=!0,this.symbolSizeExpression_=t,this}getSymbolSizeExpression(){return this.symbolSizeExpression_}setSymbolRotationExpression(t){return this.symbolRotationExpression_=t,this}setSymbolOffsetExpression(t){return this.symbolOffsetExpression_=t,this}getSymbolOffsetExpression(){return this.symbolOffsetExpression_}setSymbolColorExpression(t){return this.hasSymbol_=!0,this.symbolColorExpression_=t,this}getSymbolColorExpression(){return this.symbolColorExpression_}setTextureCoordinateExpression(t){return this.texCoordExpression_=t,this}setFragmentDiscardExpression(t){return this.discardExpression_=t,this}getFragmentDiscardExpression(){return this.discardExpression_}setSymbolRotateWithView(t){return this.symbolRotateWithView_=t,this}setStrokeWidthExpression(t){return this.hasStroke_=!0,this.strokeWidthExpression_=t,this}setStrokeColorExpression(t){return this.hasStroke_=!0,this.strokeColorExpression_=t,this}getStrokeColorExpression(){return this.strokeColorExpression_}setStrokeOffsetExpression(t){return this.strokeOffsetExpression_=t,this}setStrokeCapExpression(t){return this.strokeCapExpression_=t,this}setStrokeJoinExpression(t){return this.strokeJoinExpression_=t,this}setStrokeMiterLimitExpression(t){return this.strokeMiterLimitExpression_=t,this}setStrokeDistanceFieldExpression(t){return this.strokeDistanceFieldExpression_=t,this}setFillColorExpression(t){return this.hasFill_=!0,this.fillColorExpression_=t,this}getFillColorExpression(){return this.fillColorExpression_}addVertexShaderFunction(t){this.vertexShaderFunctions_.includes(t)||this.vertexShaderFunctions_.push(t)}addFragmentShaderFunction(t){this.fragmentShaderFunctions_.includes(t)||this.fragmentShaderFunctions_.push(t)}getSymbolVertexShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 pxToScreen(vec2 coordPx) {\n vec2 scaled = coordPx / u_viewportSizePx / 0.5;\n return scaled;\n}\n\nvec2 screenToPx(vec2 coordScreen) {\n return (coordScreen * 0.5 + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n v_quadSizePx = ${this.symbolSizeExpression_};\n vec2 halfSizePx = v_quadSizePx * 0.5;\n vec2 centerOffsetPx = ${this.symbolOffsetExpression_};\n vec2 offsetPx = centerOffsetPx;\n if (a_index == 0.0) {\n offsetPx -= halfSizePx;\n } else if (a_index == 1.0) {\n offsetPx += halfSizePx * vec2(1., -1.);\n } else if (a_index == 2.0) {\n offsetPx += halfSizePx;\n } else {\n offsetPx += halfSizePx * vec2(-1., 1.);\n }\n float angle = ${this.symbolRotationExpression_};\n ${this.symbolRotateWithView_?"angle += u_rotation;":""}\n float c = cos(-angle);\n float s = sin(-angle);\n offsetPx = vec2(c * offsetPx.x - s * offsetPx.y, s * offsetPx.x + c * offsetPx.y);\n vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);\n vec4 texCoord = ${this.texCoordExpression_};\n float u = a_index == 0.0 || a_index == 3.0 ? texCoord.s : texCoord.p;\n float v = a_index == 2.0 || a_index == 3.0 ? texCoord.t : texCoord.q;\n v_texCoord = vec2(u, v);\n v_prop_hitColor = a_prop_hitColor;\n v_angle = angle;\n c = cos(-v_angle);\n s = sin(-v_angle);\n centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y); \n v_centerPx = screenToPx(center.xy) + centerOffsetPx;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getSymbolFragmentShader(){return this.hasSymbol_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec4 v_prop_hitColor;\nvarying vec2 v_centerPx;\nvarying float v_angle;\nvarying vec2 v_quadSizePx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvoid main(void) {\n if (${this.discardExpression_}) { discard; }\n vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center\n float c = cos(v_angle);\n float s = sin(v_angle);\n coordsPx = vec2(c * coordsPx.x - s * coordsPx.y, s * coordsPx.x + c * coordsPx.y);\n gl_FragColor = ${this.symbolColorExpression_};\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.05) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getStrokeVertexShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\nattribute vec2 a_segmentStart;\nattribute vec2 a_segmentEnd;\nattribute float a_parameters;\nattribute float a_distance;\nattribute vec2 a_joinAngles;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvec4 pxToScreen(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return vec4(screenPos, u_depth, 1.0);\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nvec2 getJoinOffsetDirection(vec2 normalPx, float joinAngle) {\n float halfAngle = joinAngle / 2.0;\n float c = cos(halfAngle);\n float s = sin(halfAngle);\n vec2 angleBisectorNormal = vec2(s * normalPx.x + c * normalPx.y, -c * normalPx.x + s * normalPx.y);\n float length = 1.0 / s;\n return angleBisectorNormal * length;\n}\n\nvec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {\n // if on a cap or the join angle is too high, offset the line along the segment normal\n if (cos(joinAngle) > 0.998 || isCap(joinAngle)) {\n return point - normal * offsetPx;\n }\n // offset is applied along the inverted normal (positive offset goes "right" relative to line direction)\n return point - getJoinOffsetDirection(normal, joinAngle) * offsetPx;\n}\n\nvoid main(void) {\n v_angleStart = a_joinAngles.x;\n v_angleEnd = a_joinAngles.y;\n float vertexNumber = floor(abs(a_parameters) / 10000. + 0.5);\n // we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)\n float angleTangentSum = fract(abs(a_parameters) / 10000.) * 10000. * sign(a_parameters);\n\n float lineWidth = ${this.strokeWidthExpression_};\n float lineOffsetPx = ${this.strokeOffsetExpression_};\n\n // compute segment start/end in px with offset\n vec2 segmentStartPx = worldToPx(a_segmentStart);\n vec2 segmentEndPx = worldToPx(a_segmentEnd);\n vec2 tangentPx = normalize(segmentEndPx - segmentStartPx);\n vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\n segmentStartPx = getOffsetPoint(segmentStartPx, normalPx, v_angleStart, lineOffsetPx),\n segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);\n \n // compute current vertex position\n float normalDir = vertexNumber < 0.5 || (vertexNumber > 1.5 && vertexNumber < 2.5) ? 1.0 : -1.0;\n float tangentDir = vertexNumber < 1.5 ? 1.0 : -1.0;\n float angle = vertexNumber < 1.5 ? v_angleStart : v_angleEnd;\n vec2 joinDirection;\n vec2 positionPx = vertexNumber < 1.5 ? segmentStartPx : segmentEndPx;\n // if angle is too high, do not make a proper join\n if (cos(angle) > ${n.Vm} || isCap(angle)) {\n joinDirection = normalPx * normalDir - tangentPx * tangentDir;\n } else {\n joinDirection = getJoinOffsetDirection(normalPx * normalDir, angle);\n }\n positionPx = positionPx + joinDirection * lineWidth * 0.5;\n gl_Position = pxToScreen(positionPx);\n\n v_segmentStart = segmentStartPx;\n v_segmentEnd = segmentEndPx;\n v_width = lineWidth;\n v_prop_hitColor = a_prop_hitColor;\n v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * angleTangentSum);\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getStrokeFragmentShader(){return this.hasStroke_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_segmentStart;\nvarying vec2 v_segmentEnd;\nvarying float v_angleStart;\nvarying float v_angleEnd;\nvarying float v_width;\nvarying vec4 v_prop_hitColor;\nvarying float v_distanceOffsetPx;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\n\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nbool isCap(float joinAngle) {\n return joinAngle < -0.1;\n}\n\nfloat segmentDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n vec2 tangent = normalize(end - start);\n vec2 normal = vec2(-tangent.y, tangent.x);\n vec2 startToPoint = point - start;\n return abs(dot(startToPoint, normal)) - width * 0.5;\n}\n\nfloat buttCapDistanceField(vec2 point, vec2 start, vec2 end) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n return dot(startToPoint, -tangent);\n}\n\nfloat squareCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return buttCapDistanceField(point, start, end) - width * 0.5;\n}\n\nfloat roundCapDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n float onSegment = max(0., 1000. * dot(point - start, end - start)); // this is very high when inside the segment\n return length(point - start) - width * 0.5 - onSegment;\n}\n\nfloat roundJoinDistanceField(vec2 point, vec2 start, vec2 end, float width) {\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat bevelJoinField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n vec2 startToPoint = point - start;\n vec2 tangent = normalize(end - start);\n float c = cos(joinAngle * 0.5);\n float s = sin(joinAngle * 0.5);\n float direction = -sign(sin(joinAngle));\n vec2 bisector = vec2(c * tangent.x - s * tangent.y, s * tangent.x + c * tangent.y);\n float radius = width * 0.5 * s;\n return dot(startToPoint, bisector * direction) - radius;\n}\n\nfloat miterJoinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle) {\n if (cos(joinAngle) > ${n.Vm}) { // avoid risking a division by zero\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n float miterLength = 1. / sin(joinAngle * 0.5);\n float miterLimit = ${this.strokeMiterLimitExpression_};\n if (miterLength > miterLimit) {\n return bevelJoinField(point, start, end, width, joinAngle);\n }\n return -1000.;\n}\n\nfloat capDistanceField(vec2 point, vec2 start, vec2 end, float width, float capType) {\n if (capType == ${(0,r.JB)("butt")}) {\n return buttCapDistanceField(point, start, end);\n } else if (capType == ${(0,r.JB)("square")}) {\n return squareCapDistanceField(point, start, end, width);\n }\n return roundCapDistanceField(point, start, end, width);\n}\n\nfloat joinDistanceField(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float joinType) {\n if (joinType == ${(0,r.JB)("bevel")}) {\n return bevelJoinField(point, start, end, width, joinAngle);\n } else if (joinType == ${(0,r.JB)("miter")}) {\n return miterJoinDistanceField(point, start, end, width, joinAngle);\n }\n return roundJoinDistanceField(point, start, end, width);\n}\n\nfloat computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width, float joinAngle, float capType, float joinType) {\n if (isCap(joinAngle)) {\n return capDistanceField(point, start, end, width, capType);\n }\n return joinDistanceField(point, start, end, width, joinAngle, joinType);\n}\n\nvoid main(void) {\n vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(currentPoint);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n\n float segmentLength = length(v_segmentEnd - v_segmentStart);\n vec2 segmentTangent = (v_segmentEnd - v_segmentStart) / segmentLength;\n vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);\n vec2 startToPoint = currentPoint - v_segmentStart;\n float currentLengthPx = max(0., min(dot(segmentTangent, startToPoint), segmentLength)) + v_distanceOffsetPx; \n float currentRadiusPx = abs(dot(segmentNormal, startToPoint));\n float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;\n vec4 color = ${this.strokeColorExpression_} * u_globalAlpha;\n float capType = ${this.strokeCapExpression_};\n float joinType = ${this.strokeJoinExpression_};\n float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);\n float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);\n float distance = max(\n segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),\n max(segmentStartDistance, segmentEndDistance)\n );\n distance = max(distance, ${this.strokeDistanceFieldExpression_});\n gl_FragColor = color * smoothstep(0., -1., distance);\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}getFillVertexShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute vec4 a_prop_hitColor;\n${this.attributes_.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.vertexShaderFunctions_.join("\n")}\nvoid main(void) {\n gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);\n v_prop_hitColor = a_prop_hitColor;\n${this.varyings_.map((function(t){return" "+t.name+" = "+t.expression+";"})).join("\n")}\n}`:null}getFillFragmentShader(){return this.hasFill_?`${s}\n${this.uniforms_.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec4 v_prop_hitColor;\n${this.varyings_.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\n${this.fragmentShaderFunctions_.join("\n")}\nvec2 pxToWorld(vec2 pxPos) {\n vec2 screenPos = 2.0 * pxPos / u_viewportSizePx - 1.0;\n return (u_screenToWorldMatrix * vec4(screenPos, 0.0, 1.0)).xy;\n}\n\nvec2 worldToPx(vec2 worldPos) {\n vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n return (0.5 * screenPos.xy + 0.5) * u_viewportSizePx;\n}\n\nvoid main(void) {\n vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;\n vec2 pxOrigin = worldToPx(u_patternOrigin);\n #ifdef GL_FRAGMENT_PRECISION_HIGH\n vec2 worldPos = pxToWorld(pxPos);\n if (\n abs(u_renderExtent[0] - u_renderExtent[2]) > 0.0 && (\n worldPos[0] < u_renderExtent[0] ||\n worldPos[1] < u_renderExtent[1] ||\n worldPos[0] > u_renderExtent[2] ||\n worldPos[1] > u_renderExtent[3]\n )\n ) {\n discard;\n }\n #endif\n if (${this.discardExpression_}) { discard; }\n gl_FragColor = ${this.fillColorExpression_} * u_globalAlpha;\n if (u_hitDetection > 0) {\n if (gl_FragColor.a < 0.1) { discard; };\n gl_FragColor = v_prop_hitColor;\n }\n}`:null}}},31871:function(t,e,i){"use strict";i.d(e,{CL:function(){return a},Zh:function(){return _},zO:function(){return l}});var n=i(57906),r=i(11587),s=i(25638),o=i(12185);function a(t,e,i){const r=(0,n.Mj)();return r.style=t.style,(0,s.xA)(e,i,r,t)}function l(t){const e=(0,o._2)(t);return[256*e[0]+e[1],256*e[2]+Math.round(255*e[3])]}const h="vec4 unpackColor(vec2 packedColor) {\n return fract(packedColor[1] / 256.0) * vec4(\n fract(floor(packedColor[0] / 256.0) / 256.0),\n fract(packedColor[0] / 256.0),\n fract(floor(packedColor[1] / 256.0) / 256.0),\n 1.0\n );\n}";function u(t){return t===n.Mr?2:t===n.PA?4:1}function c(t){const e=u(t);return e>1?`vec${e}`:"float"}function d(t){return(JSON.stringify(t).split("").reduce(((t,e)=>(t<<5)-t+e.charCodeAt(0)),0)>>>0).toString()}function f(t,e,i,r){if(`${r}radius`in t&&"icon-"!==r){let s=a(i,t[`${r}radius`],n.sw);if(`${r}radius2`in t){s=`max(${s}, ${a(i,t[`${r}radius2`],n.sw)})`}`${r}stroke-width`in t&&(s=`(${s} + ${a(i,t[`${r}stroke-width`],n.sw)} * 0.5)`),e.setSymbolSizeExpression(`vec2(${s} * 2. + 0.5)`)}if(`${r}scale`in t){const s=a(i,t[`${r}scale`],n.sw|n.PA);e.setSymbolSizeExpression(`${e.getSymbolSizeExpression()} * ${s}`)}`${r}displacement`in t&&e.setSymbolOffsetExpression(a(i,t[`${r}displacement`],n.PA)),`${r}rotation`in t&&e.setSymbolRotationExpression(a(i,t[`${r}rotation`],n.sw)),`${r}rotate-with-view`in t&&e.setSymbolRotateWithView(!!t[`${r}rotate-with-view`])}function g(t,e,i,n,r){let s="vec4(0.)";if(null!==e&&(s=e),null!==i&&null!==n){s=`mix(${i}, ${s}, ${`smoothstep(-${n} + 0.63, -${n} - 0.58, ${t})`})`}let o=`${s} * ${`(1.0 - smoothstep(-0.63, 0.58, ${t}))`}`;return null!==r&&(o=`${o} * ${r}`),o}function p(t,e,i,n,r){const o=new Image;let a;return o.crossOrigin=void 0===t[`${n}cross-origin`]?"anonymous":t[`${n}cross-origin`],o.src=t[`${n}src`],o.complete&&o.width&&o.height?a=(0,s.ci)([o.width,o.height]):(i[`u_texture${r}_size`]=()=>o.complete?[o.width,o.height]:[0,0],e.addUniform(`vec2 u_texture${r}_size`),a=`u_texture${r}_size`),i[`u_texture${r}`]=o,e.addUniform(`sampler2D u_texture${r}`),a}function m(t,e,i,r,s){let o=a(i,t[`${e}offset`],n.PA);if(`${e}offset-origin`in t)switch(t[`${e}offset-origin`]){case"top-right":o=`vec2(${r}.x, 0.) + ${s} * vec2(-1., 0.) + ${o} * vec2(-1., 1.)`;break;case"bottom-left":o=`vec2(0., ${r}.y) + ${s} * vec2(0., -1.) + ${o} * vec2(1., -1.)`;break;case"bottom-right":o=`${r} - ${s} - ${o}`}return o}function _(t){const e={inFragmentShader:!1,properties:{},variables:{},functions:{},style:t},i={inFragmentShader:!0,variables:e.variables,properties:{},functions:{},style:t},_=new r.k,y={};if("icon-src"in t?function(t,e,i,r,s){let o="vec4(1.0)";"icon-color"in t&&(o=a(s,t["icon-color"],n.Mr)),"icon-opacity"in t&&(o=`${o} * ${a(s,t["icon-opacity"],n.sw)}`);const l=d(t["icon-src"]),h=p(t,e,i,"icon-",l);if(e.setSymbolColorExpression(`${o} * samplePremultiplied(u_texture${l}, v_texCoord)`).setSymbolSizeExpression(h),"icon-width"in t&&"icon-height"in t&&e.setSymbolSizeExpression(`vec2(${a(r,t["icon-width"],n.sw)}, ${a(r,t["icon-height"],n.sw)})`),"icon-offset"in t&&"icon-size"in t){const i=a(r,t["icon-size"],n.PA),s=e.getSymbolSizeExpression();e.setSymbolSizeExpression(i);const o=m(t,"icon-",r,"v_quadSizePx",i);e.setTextureCoordinateExpression(`(vec4((${o}).xyxy) + vec4(0., 0., ${i})) / (${s}).xyxy`)}if(f(t,e,r,"icon-"),"icon-anchor"in t){const i=a(r,t["icon-anchor"],n.PA);let s,o="1.0";"icon-scale"in t&&(o=a(r,t["icon-scale"],n.sw|n.PA)),s="pixels"===t["icon-anchor-x-units"]&&"pixels"===t["icon-anchor-y-units"]?`${i} * ${o}`:"pixels"===t["icon-anchor-x-units"]?`${i} * vec2(vec2(${o}).x, v_quadSizePx.y)`:"pixels"===t["icon-anchor-y-units"]?`${i} * vec2(v_quadSizePx.x, vec2(${o}).x)`:`${i} * v_quadSizePx`;let l=`v_quadSizePx * vec2(0.5, -0.5) + ${s} * vec2(-1., 1.)`;if("icon-anchor-origin"in t)switch(t["icon-anchor-origin"]){case"top-right":l=`v_quadSizePx * -0.5 + ${s}`;break;case"bottom-left":l=`v_quadSizePx * 0.5 - ${s}`;break;case"bottom-right":l=`v_quadSizePx * vec2(-0.5, 0.5) + ${s} * vec2(1., -1.)`}e.setSymbolOffsetExpression(`${e.getSymbolOffsetExpression()} + ${l}`)}}(t,_,y,e,i):"shape-points"in t?function(t,e,i,r,s){s.functions.round="float round(float v) {\n return sign(v) * floor(abs(v) + 0.5);\n}",s.functions.starDistanceField="float starDistanceField(vec2 point, float numPoints, float radius, float radius2, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round(beta / alpha) * alpha; // angle in sector\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n vec2 tipToPoint = inSector + vec2(-radius, 0.);\n vec2 edgeNormal = vec2(radius2 * sin(alpha * 0.5), -radius2 * cos(alpha * 0.5) + radius);\n return dot(normalize(edgeNormal), tipToPoint);\n}",s.functions.regularDistanceField="float regularDistanceField(vec2 point, float numPoints, float radius, float angle) {\n float startAngle = -PI * 0.5 + angle; // tip starts upwards and rotates clockwise with angle\n float c = cos(startAngle);\n float s = sin(startAngle);\n vec2 pointRotated = vec2(c * point.x - s * point.y, s * point.x + c * point.y);\n float alpha = TWO_PI / numPoints; // the angle of one sector\n float radiusIn = radius * cos(PI / numPoints);\n float beta = atan(pointRotated.y, pointRotated.x);\n float gamma = round((beta - alpha * 0.5) / alpha) * alpha + alpha * 0.5; // angle in sector from mid\n c = cos(-gamma);\n s = sin(-gamma);\n vec2 inSector = vec2(c * pointRotated.x - s * pointRotated.y, abs(s * pointRotated.x + c * pointRotated.y));\n return inSector.x - radiusIn;\n}",f(t,e,r,"shape-");let o=null;"shape-opacity"in t&&(o=a(s,t["shape-opacity"],n.sw));let l="coordsPx";"shape-scale"in t&&(l=`coordsPx / ${a(s,t["shape-scale"],n.sw|n.PA)}`);let h=null;"shape-fill-color"in t&&(h=a(s,t["shape-fill-color"],n.Mr));let u=null;"shape-stroke-color"in t&&(u=a(s,t["shape-stroke-color"],n.Mr));let c=null;"shape-stroke-width"in t&&(c=a(s,t["shape-stroke-width"],n.sw));const d=a(s,t["shape-points"],n.sw);let p,m="0.";"shape-angle"in t&&(m=a(s,t["shape-angle"],n.sw));let _=a(s,t["shape-radius"],n.sw);if(null!==c&&(_=`${_} + ${c} * 0.5`),"shape-radius2"in t){let e=a(s,t["shape-radius2"],n.sw);null!==c&&(e=`${e} + ${c} * 0.5`),p=`starDistanceField(${l}, ${d}, ${_}, ${e}, ${m})`}else p=`regularDistanceField(${l}, ${d}, ${_}, ${m})`;const y=g(p,h,u,c,o);e.setSymbolColorExpression(y)}(t,_,0,e,i):"circle-radius"in t&&function(t,e,i,r,s){s.functions.circleDistanceField="float circleDistanceField(vec2 point, float radius) {\n return length(point) - radius;\n}",f(t,e,r,"circle-");let o=null;"circle-opacity"in t&&(o=a(s,t["circle-opacity"],n.sw));let l="coordsPx";"circle-scale"in t&&(l=`coordsPx / ${a(s,t["circle-scale"],n.sw|n.PA)}`);let h=null;"circle-fill-color"in t&&(h=a(s,t["circle-fill-color"],n.Mr));let u=null;"circle-stroke-color"in t&&(u=a(s,t["circle-stroke-color"],n.Mr));let c=a(s,t["circle-radius"],n.sw),d=null;"circle-stroke-width"in t&&(d=a(s,t["circle-stroke-width"],n.sw),c=`(${c} + ${d} * 0.5)`);const p=g(`circleDistanceField(${l}, ${c})`,h,u,d,o);e.setSymbolColorExpression(p)}(t,_,0,e,i),function(t,e,i,r,o){if("stroke-color"in t&&e.setStrokeColorExpression(a(o,t["stroke-color"],n.Mr)),"stroke-pattern-src"in t){const r=d(t["stroke-pattern-src"]),s=p(t,e,i,"stroke-pattern-",r);let l=s,h="vec2(0.)";"stroke-pattern-offset"in t&&"stroke-pattern-size"in t&&(l=a(o,t["stroke-pattern-size"],n.PA),h=m(t,"stroke-pattern-",o,s,l));let u="0.";"stroke-pattern-spacing"in t&&(u=a(o,t["stroke-pattern-spacing"],n.sw)),o.functions.sampleStrokePattern="vec4 sampleStrokePattern(sampler2D texture, vec2 textureSize, vec2 textureOffset, vec2 sampleSize, float spacingPx, float currentLengthPx, float currentRadiusRatio, float lineWidth) {\n float currentLengthScaled = currentLengthPx * sampleSize.y / lineWidth;\n float spacingScaled = spacingPx * sampleSize.y / lineWidth;\n float uCoordPx = mod(currentLengthScaled, (sampleSize.x + spacingScaled));\n // make sure that we're not sampling too close to the borders to avoid interpolation with outside pixels\n uCoordPx = clamp(uCoordPx, 0.5, sampleSize.x - 0.5);\n float vCoordPx = (-currentRadiusRatio * 0.5 + 0.5) * sampleSize.y;\n vec2 texCoord = (vec2(uCoordPx, vCoordPx) + textureOffset) / textureSize;\n return samplePremultiplied(texture, texCoord);\n}";const c=`u_texture${r}`;let f="1.";"stroke-color"in t&&(f=e.getStrokeColorExpression()),e.setStrokeColorExpression(`${f} * sampleStrokePattern(${c}, ${s}, ${h}, ${l}, ${u}, currentLengthPx, currentRadiusRatio, v_width)`)}if("stroke-width"in t&&e.setStrokeWidthExpression(a(r,t["stroke-width"],n.sw)),"stroke-offset"in t&&e.setStrokeOffsetExpression(a(r,t["stroke-offset"],n.sw)),"stroke-line-cap"in t&&e.setStrokeCapExpression(a(r,t["stroke-line-cap"],n.uW)),"stroke-line-join"in t&&e.setStrokeJoinExpression(a(r,t["stroke-line-join"],n.uW)),"stroke-miter-limit"in t&&e.setStrokeMiterLimitExpression(a(r,t["stroke-miter-limit"],n.sw)),"stroke-line-dash"in t){o.functions.getSingleDashDistance=`float getSingleDashDistance(float distance, float radius, float dashOffset, float dashLength, float dashLengthTotal, float capType) {\n float localDistance = mod(distance, dashLengthTotal);\n float distanceSegment = abs(localDistance - dashOffset - dashLength * 0.5) - dashLength * 0.5;\n distanceSegment = min(distanceSegment, dashLengthTotal - localDistance);\n if (capType == ${(0,s.JB)("square")}) {\n distanceSegment -= v_width * 0.5;\n } else if (capType == ${(0,s.JB)("round")}) {\n distanceSegment = min(distanceSegment, sqrt(distanceSegment * distanceSegment + radius * radius) - v_width * 0.5);\n }\n return distanceSegment;\n}`;let i=t["stroke-line-dash"].map((t=>a(o,t,n.sw)));i.length%2==1&&(i=[...i,...i]);let l="0.";"stroke-line-dash-offset"in t&&(l=a(r,t["stroke-line-dash-offset"],n.sw));const h=`dashDistanceField_${d(t["stroke-line-dash"])}`,u=i.map(((t,e)=>`float dashLength${e} = ${t};`)),c=i.map(((t,e)=>`dashLength${e}`)).join(" + ");let f="0.",g=`getSingleDashDistance(distance, radius, ${f}, dashLength0, totalDashLength, capType)`;for(let t=2;t(0,s.Ce)(t.variables[r.name]):r.type===n.Mr?()=>l([...(0,o._2)(t.variables[r.name]||"#eee")]):r.type===n.wy?()=>t.variables[r.name]?1:0:()=>t.variables[r.name],y[a]=h})),Object.keys(i.properties).forEach((function(t){const r=i.properties[t];e.properties[t]||(e.properties[t]=r);let s=c(r.type),o=`a_prop_${r.name}`;r.type===n.Mr&&(s="vec4",o=`unpackColor(${o})`,_.addVertexShaderFunction(h)),_.addVarying(`v_prop_${r.name}`,s,o)})),Object.keys(e.properties).forEach((function(t){const i=e.properties[t];_.addAttribute(`${c(i.type)} a_prop_${i.name}`)}));const x=Object.keys(e.properties).map((function(t){const i=e.properties[t];let r;return r=i.evaluator?i.evaluator:i.type===n.uW?t=>(0,s.Ce)(t.get(i.name)):i.type===n.Mr?t=>l([...(0,o._2)(t.get(i.name)||"#eee")]):i.type===n.wy?t=>t.get(i.name)?1:0:t=>t.get(i.name),{name:i.name,size:u(i.type),callback:r}}));for(const t in e.functions)_.addVertexShaderFunction(e.functions[t]);for(const t in i.functions)_.addFragmentShaderFunction(i.functions[t]);return{builder:_,attributes:x.reduce(((t,e)=>({...t,[e.name]:{callback:e.callback,size:e.size}})),{}),uniforms:y}}},31990:function(t,e,i){"use strict";i.d(e,{A4:function(){return m},As:function(){return h},C5:function(){return E},Ei:function(){return d},G3:function(){return y},JO:function(){return _},Me:function(){return R},O:function(){return w},Pr:function(){return p},Qc:function(){return u},RA:function(){return v},T3:function(){return b},Ve:function(){return o},ZL:function(){return C},c:function(){return s},fJ:function(){return r},hg:function(){return x},ke:function(){return g},pc:function(){return c},qk:function(){return l},xc:function(){return P},z:function(){return f}});var n=i(17367);const r="http://www.w3.org/2001/XMLSchema-instance";function s(t,e){return R().createElementNS(t,e)}function o(t,e){return a(t,e,[]).join("")}function a(t,e,i){if(t.nodeType==Node.CDATA_SECTION_NODE||t.nodeType==Node.TEXT_NODE)e?i.push(String(t.nodeValue).replace(/(\r\n|\r|\n)/g,"")):i.push(t.nodeValue);else{let n;for(n=t.firstChild;n;n=n.nextSibling)a(n,e,i)}return i}function l(t){return"documentElement"in t}function h(t,e,i){return t.getAttributeNS(e,i)||""}function u(t){return(new DOMParser).parseFromString(t,"application/xml")}function c(t,e){return function(i,r){const s=t.call(void 0!==e?e:this,i,r);if(void 0!==s){const t=r[r.length-1];(0,n.l7)(t,s)}}}function d(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);if(void 0!==r){n[n.length-1].push(r)}}}function f(t,e){return function(i,n){const r=t.call(void 0!==e?e:this,i,n);void 0!==r&&(n[n.length-1]=r)}}function g(t,e,i){return function(n,r){const s=t.call(void 0!==i?i:this,n,r);if(void 0!==s){const t=r[r.length-1],i=void 0!==e?e:n.localName;let o;i in t?o=t[i]:(o=[],t[i]=o),o.push(s)}}}function p(t,e,i){return function(n,r){const s=t.call(void 0!==i?i:this,n,r);if(void 0!==s){r[r.length-1][void 0!==e?e:n.localName]=s}}}function m(t,e){return function(i,n,r){t.call(void 0!==e?e:this,i,n,r);r[r.length-1].node.appendChild(i)}}function _(t,e){let i,n;return function(e,r,s){if(void 0===i){i={};const r={};r[e.localName]=t,i[e.namespaceURI]=r,n=y(e.localName)}S(i,n,r,s)}}function y(t,e){return function(i,n,r){const o=n[n.length-1].node;let a=t;void 0===a&&(a=r);return s(void 0!==e?e:o.namespaceURI,a)}}const x=y();function v(t,e){const i=e.length,n=new Array(i);for(let r=0;r=s)&&Object.keys(r.O).every((function(t){return r.O[t](i[l])}))?i.splice(l--,1):(a=!1,s0&&t[u-1][2]>s;u--)t[u]=t[u-1];t[u]=[i,n,s]},r.d=function(t,e){for(var i in e)r.o(e,i)&&!r.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},r.f={},r.e=function(t){return Promise.all(Object.keys(r.f).reduce((function(e,i){return r.f[i](t,e),e}),[]))},r.u=function(t){return t+".js"},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e={},r.l=function(t,i,n,s){if(e[t])e[t].push(i);else{var o,a;if(void 0!==n)for(var l=document.getElementsByTagName("script"),h=0;h-1&&!t;)t=i[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=t}(),function(){var t={8592:0};r.f.j=function(e,i){var n=r.o(t,e)?t[e]:void 0;if(0!==n)if(n)i.push(n[2]);else{var s=new Promise((function(i,r){n=t[e]=[i,r]}));i.push(n[2]=s);var o=r.p+r.u(e),a=new Error;r.l(o,(function(i){if(r.o(t,e)&&(0!==(n=t[e])&&(t[e]=void 0),n)){var s=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;a.message="Loading chunk "+e+" failed.\n("+s+": "+o+")",a.name="ChunkLoadError",a.type=s,a.request=o,n[1](a)}}),"chunk-"+e,e)}},r.O.j=function(e){return 0===t[e]};var e=function(e,i){var n,s,o=i[0],a=i[1],l=i[2],h=0;if(o.some((function(e){return 0!==t[e]}))){for(n in a)r.o(a,n)&&(r.m[n]=a[n]);if(l)var u=l(r)}for(e&&e(i);h 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var inProgress = {};\n// data-webpack is not used as build has no uniqueName\n// loadScript function to load a script via script tag\n__webpack_require__.l = function(url, done, key, chunkId) {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = function(prev, event) {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach(function(fn) { return fn(event); });\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 32767 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim | 0);\n triangles.push(ear.i / dim | 0);\n triangles.push(next.i / dim | 0);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n var p = c.next;\n while (p !== a) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n var ax = a.x, bx = b.x, cx = c.x, ay = a.y, by = b.y, cy = c.y;\n\n // triangle bbox; min & max are calculated like this for speed\n var x0 = ax < bx ? (ax < cx ? ax : cx) : (bx < cx ? bx : cx),\n y0 = ay < by ? (ay < cy ? ay : cy) : (by < cy ? by : cy),\n x1 = ax > bx ? (ax > cx ? ax : cx) : (bx > cx ? bx : cx),\n y1 = ay > by ? (ay > cy ? ay : cy) : (by > cy ? by : cy);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(x0, y0, minX, minY, invSize),\n maxZ = zOrder(x1, y1, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c &&\n pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim | 0);\n triangles.push(p.i / dim | 0);\n triangles.push(b.i / dim | 0);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize, 0);\n earcutLinked(c, triangles, dim, minX, minY, invSize, 0);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n filterPoints(bridgeReverse, bridgeReverse.next);\n return filterPoints(bridge, bridge.next);\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n m = p.x < p.next.x ? p : p.next;\n if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = (x - minX) * invSize | 0;\n y = (y - minY) * invSize | 0;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) >= (ax - px) * (cy - py) &&\n (ax - px) * (by - py) >= (bx - px) * (ay - py) &&\n (bx - px) * (cy - py) >= (cx - px) * (by - py);\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = 0;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\n\nmodule.exports = Pbf;\n\nvar ieee754 = require('ieee754');\n\nfunction Pbf(buf) {\n this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);\n this.pos = 0;\n this.type = 0;\n this.length = this.buf.length;\n}\n\nPbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum\nPbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64\nPbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields\nPbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32\n\nvar SHIFT_LEFT_32 = (1 << 16) * (1 << 16),\n SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;\n\n// Threshold chosen based on both benchmarking and knowledge about browser string\n// data structures (which currently switch structure types at 12 bytes or more)\nvar TEXT_DECODER_MIN_LENGTH = 12;\nvar utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');\n\nPbf.prototype = {\n\n destroy: function() {\n this.buf = null;\n },\n\n // === READING =================================================================\n\n readFields: function(readField, result, end) {\n end = end || this.length;\n\n while (this.pos < end) {\n var val = this.readVarint(),\n tag = val >> 3,\n startPos = this.pos;\n\n this.type = val & 0x7;\n readField(tag, result, this);\n\n if (this.pos === startPos) this.skip(val);\n }\n return result;\n },\n\n readMessage: function(readField, result) {\n return this.readFields(readField, result, this.readVarint() + this.pos);\n },\n\n readFixed32: function() {\n var val = readUInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n readSFixed32: function() {\n var val = readInt32(this.buf, this.pos);\n this.pos += 4;\n return val;\n },\n\n // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)\n\n readFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readSFixed64: function() {\n var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;\n this.pos += 8;\n return val;\n },\n\n readFloat: function() {\n var val = ieee754.read(this.buf, this.pos, true, 23, 4);\n this.pos += 4;\n return val;\n },\n\n readDouble: function() {\n var val = ieee754.read(this.buf, this.pos, true, 52, 8);\n this.pos += 8;\n return val;\n },\n\n readVarint: function(isSigned) {\n var buf = this.buf,\n val, b;\n\n b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;\n b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;\n b = buf[this.pos]; val |= (b & 0x0f) << 28;\n\n return readVarintRemainder(val, isSigned, this);\n },\n\n readVarint64: function() { // for compatibility with v2.0.1\n return this.readVarint(true);\n },\n\n readSVarint: function() {\n var num = this.readVarint();\n return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding\n },\n\n readBoolean: function() {\n return Boolean(this.readVarint());\n },\n\n readString: function() {\n var end = this.readVarint() + this.pos;\n var pos = this.pos;\n this.pos = end;\n\n if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {\n // longer strings are fast with the built-in browser TextDecoder API\n return readUtf8TextDecoder(this.buf, pos, end);\n }\n // short strings are fast with our custom implementation\n return readUtf8(this.buf, pos, end);\n },\n\n readBytes: function() {\n var end = this.readVarint() + this.pos,\n buffer = this.buf.subarray(this.pos, end);\n this.pos = end;\n return buffer;\n },\n\n // verbose for performance reasons; doesn't affect gzipped size\n\n readPackedVarint: function(arr, isSigned) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readVarint(isSigned));\n return arr;\n },\n readPackedSVarint: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSVarint());\n return arr;\n },\n readPackedBoolean: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readBoolean());\n return arr;\n },\n readPackedFloat: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFloat());\n return arr;\n },\n readPackedDouble: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readDouble());\n return arr;\n },\n readPackedFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed32());\n return arr;\n },\n readPackedSFixed32: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed32());\n return arr;\n },\n readPackedFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readFixed64());\n return arr;\n },\n readPackedSFixed64: function(arr) {\n if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());\n var end = readPackedEnd(this);\n arr = arr || [];\n while (this.pos < end) arr.push(this.readSFixed64());\n return arr;\n },\n\n skip: function(val) {\n var type = val & 0x7;\n if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}\n else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;\n else if (type === Pbf.Fixed32) this.pos += 4;\n else if (type === Pbf.Fixed64) this.pos += 8;\n else throw new Error('Unimplemented type: ' + type);\n },\n\n // === WRITING =================================================================\n\n writeTag: function(tag, type) {\n this.writeVarint((tag << 3) | type);\n },\n\n realloc: function(min) {\n var length = this.length || 16;\n\n while (length < this.pos + min) length *= 2;\n\n if (length !== this.length) {\n var buf = new Uint8Array(length);\n buf.set(this.buf);\n this.buf = buf;\n this.length = length;\n }\n },\n\n finish: function() {\n this.length = this.pos;\n this.pos = 0;\n return this.buf.subarray(0, this.length);\n },\n\n writeFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeSFixed32: function(val) {\n this.realloc(4);\n writeInt32(this.buf, val, this.pos);\n this.pos += 4;\n },\n\n writeFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeSFixed64: function(val) {\n this.realloc(8);\n writeInt32(this.buf, val & -1, this.pos);\n writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);\n this.pos += 8;\n },\n\n writeVarint: function(val) {\n val = +val || 0;\n\n if (val > 0xfffffff || val < 0) {\n writeBigVarint(val, this);\n return;\n }\n\n this.realloc(4);\n\n this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;\n this.buf[this.pos++] = (val >>> 7) & 0x7f;\n },\n\n writeSVarint: function(val) {\n this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);\n },\n\n writeBoolean: function(val) {\n this.writeVarint(Boolean(val));\n },\n\n writeString: function(str) {\n str = String(str);\n this.realloc(str.length * 4);\n\n this.pos++; // reserve 1 byte for short string length\n\n var startPos = this.pos;\n // write the string directly to the buffer and see how much was written\n this.pos = writeUtf8(this.buf, str, this.pos);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeFloat: function(val) {\n this.realloc(4);\n ieee754.write(this.buf, val, this.pos, true, 23, 4);\n this.pos += 4;\n },\n\n writeDouble: function(val) {\n this.realloc(8);\n ieee754.write(this.buf, val, this.pos, true, 52, 8);\n this.pos += 8;\n },\n\n writeBytes: function(buffer) {\n var len = buffer.length;\n this.writeVarint(len);\n this.realloc(len);\n for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];\n },\n\n writeRawMessage: function(fn, obj) {\n this.pos++; // reserve 1 byte for short message length\n\n // write the message directly to the buffer and see how much was written\n var startPos = this.pos;\n fn(obj, this);\n var len = this.pos - startPos;\n\n if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);\n\n // finally, write the message length in the reserved place and restore the position\n this.pos = startPos - 1;\n this.writeVarint(len);\n this.pos += len;\n },\n\n writeMessage: function(tag, fn, obj) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeRawMessage(fn, obj);\n },\n\n writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },\n writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },\n writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },\n writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },\n writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },\n writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },\n writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },\n writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },\n writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },\n\n writeBytesField: function(tag, buffer) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeBytes(buffer);\n },\n writeFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFixed32(val);\n },\n writeSFixed32Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeSFixed32(val);\n },\n writeFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeFixed64(val);\n },\n writeSFixed64Field: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeSFixed64(val);\n },\n writeVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeVarint(val);\n },\n writeSVarintField: function(tag, val) {\n this.writeTag(tag, Pbf.Varint);\n this.writeSVarint(val);\n },\n writeStringField: function(tag, str) {\n this.writeTag(tag, Pbf.Bytes);\n this.writeString(str);\n },\n writeFloatField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed32);\n this.writeFloat(val);\n },\n writeDoubleField: function(tag, val) {\n this.writeTag(tag, Pbf.Fixed64);\n this.writeDouble(val);\n },\n writeBooleanField: function(tag, val) {\n this.writeVarintField(tag, Boolean(val));\n }\n};\n\nfunction readVarintRemainder(l, s, p) {\n var buf = p.buf,\n h, b;\n\n b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);\n b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);\n\n throw new Error('Expected varint not more than 10 bytes');\n}\n\nfunction readPackedEnd(pbf) {\n return pbf.type === Pbf.Bytes ?\n pbf.readVarint() + pbf.pos : pbf.pos + 1;\n}\n\nfunction toNum(low, high, isSigned) {\n if (isSigned) {\n return high * 0x100000000 + (low >>> 0);\n }\n\n return ((high >>> 0) * 0x100000000) + (low >>> 0);\n}\n\nfunction writeBigVarint(val, pbf) {\n var low, high;\n\n if (val >= 0) {\n low = (val % 0x100000000) | 0;\n high = (val / 0x100000000) | 0;\n } else {\n low = ~(-val % 0x100000000);\n high = ~(-val / 0x100000000);\n\n if (low ^ 0xffffffff) {\n low = (low + 1) | 0;\n } else {\n low = 0;\n high = (high + 1) | 0;\n }\n }\n\n if (val >= 0x10000000000000000 || val < -0x10000000000000000) {\n throw new Error('Given varint doesn\\'t fit into 10 bytes');\n }\n\n pbf.realloc(10);\n\n writeBigVarintLow(low, high, pbf);\n writeBigVarintHigh(high, pbf);\n}\n\nfunction writeBigVarintLow(low, high, pbf) {\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;\n pbf.buf[pbf.pos] = low & 0x7f;\n}\n\nfunction writeBigVarintHigh(high, pbf) {\n var lsb = (high & 0x07) << 4;\n\n pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;\n pbf.buf[pbf.pos++] = high & 0x7f;\n}\n\nfunction makeRoomForExtraLength(startPos, len, pbf) {\n var extraLen =\n len <= 0x3fff ? 1 :\n len <= 0x1fffff ? 2 :\n len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));\n\n // if 1 byte isn't enough for encoding message length, shift the data to the right\n pbf.realloc(extraLen);\n for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];\n}\n\nfunction writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }\nfunction writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }\nfunction writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }\nfunction writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }\nfunction writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }\nfunction writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }\nfunction writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }\nfunction writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }\nfunction writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }\n\n// Buffer code below from https://github.com/feross/buffer, MIT-licensed\n\nfunction readUInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] * 0x1000000);\n}\n\nfunction writeInt32(buf, val, pos) {\n buf[pos] = val;\n buf[pos + 1] = (val >>> 8);\n buf[pos + 2] = (val >>> 16);\n buf[pos + 3] = (val >>> 24);\n}\n\nfunction readInt32(buf, pos) {\n return ((buf[pos]) |\n (buf[pos + 1] << 8) |\n (buf[pos + 2] << 16)) +\n (buf[pos + 3] << 24);\n}\n\nfunction readUtf8(buf, pos, end) {\n var str = '';\n var i = pos;\n\n while (i < end) {\n var b0 = buf[i];\n var c = null; // codepoint\n var bytesPerSequence =\n b0 > 0xEF ? 4 :\n b0 > 0xDF ? 3 :\n b0 > 0xBF ? 2 : 1;\n\n if (i + bytesPerSequence > end) break;\n\n var b1, b2, b3;\n\n if (bytesPerSequence === 1) {\n if (b0 < 0x80) {\n c = b0;\n }\n } else if (bytesPerSequence === 2) {\n b1 = buf[i + 1];\n if ((b1 & 0xC0) === 0x80) {\n c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);\n if (c <= 0x7F) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 3) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);\n if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {\n c = null;\n }\n }\n } else if (bytesPerSequence === 4) {\n b1 = buf[i + 1];\n b2 = buf[i + 2];\n b3 = buf[i + 3];\n if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {\n c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);\n if (c <= 0xFFFF || c >= 0x110000) {\n c = null;\n }\n }\n }\n\n if (c === null) {\n c = 0xFFFD;\n bytesPerSequence = 1;\n\n } else if (c > 0xFFFF) {\n c -= 0x10000;\n str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);\n c = 0xDC00 | c & 0x3FF;\n }\n\n str += String.fromCharCode(c);\n i += bytesPerSequence;\n }\n\n return str;\n}\n\nfunction readUtf8TextDecoder(buf, pos, end) {\n return utf8TextDecoder.decode(buf.subarray(pos, end));\n}\n\nfunction writeUtf8(buf, str, pos) {\n for (var i = 0, c, lead; i < str.length; i++) {\n c = str.charCodeAt(i); // code point\n\n if (c > 0xD7FF && c < 0xE000) {\n if (lead) {\n if (c < 0xDC00) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = c;\n continue;\n } else {\n c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;\n lead = null;\n }\n } else {\n if (c > 0xDBFF || (i + 1 === str.length)) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n } else {\n lead = c;\n }\n continue;\n }\n } else if (lead) {\n buf[pos++] = 0xEF;\n buf[pos++] = 0xBF;\n buf[pos++] = 0xBD;\n lead = null;\n }\n\n if (c < 0x80) {\n buf[pos++] = c;\n } else {\n if (c < 0x800) {\n buf[pos++] = c >> 0x6 | 0xC0;\n } else {\n if (c < 0x10000) {\n buf[pos++] = c >> 0xC | 0xE0;\n } else {\n buf[pos++] = c >> 0x12 | 0xF0;\n buf[pos++] = c >> 0xC & 0x3F | 0x80;\n }\n buf[pos++] = c >> 0x6 & 0x3F | 0x80;\n }\n buf[pos++] = c & 0x3F | 0x80;\n }\n }\n return pos;\n}\n","export var PJD_3PARAM = 1;\nexport var PJD_7PARAM = 2;\nexport var PJD_GRIDSHIFT = 3;\nexport var PJD_WGS84 = 4; // WGS84 or equivalent\nexport var PJD_NODATUM = 5; // WGS84 or equivalent\nexport var SRS_WGS84_SEMIMAJOR = 6378137.0; // only used in grid shift transforms\nexport var SRS_WGS84_SEMIMINOR = 6356752.314; // only used in grid shift transforms\nexport var SRS_WGS84_ESQUARED = 0.0066943799901413165; // only used in grid shift transforms\nexport var SEC_TO_RAD = 4.84813681109535993589914102357e-6;\nexport var HALF_PI = Math.PI/2;\n// ellipoid pj_set_ell.c\nexport var SIXTH = 0.1666666666666666667;\n/* 1/6 */\nexport var RA4 = 0.04722222222222222222;\n/* 17/360 */\nexport var RA6 = 0.02215608465608465608;\nexport var EPSLN = 1.0e-10;\n// you'd think you could use Number.EPSILON above but that makes\n// Mollweide get into an infinate loop.\n\nexport var D2R = 0.01745329251994329577;\nexport var R2D = 57.29577951308232088;\nexport var FORTPI = Math.PI/4;\nexport var TWO_PI = Math.PI * 2;\n// SPI is slightly greater than Math.PI, so values that exceed the -180..180\n// degree range by a tiny amount don't get wrapped. This prevents points that\n// have drifted from their original location along the 180th meridian (due to\n// floating point error) from changing their sign.\nexport var SPI = 3.14159265359;\n","var exports = {};\nexport {exports as default};\n\nexports.greenwich = 0.0; //\"0dE\",\nexports.lisbon = -9.131906111111; //\"9d07'54.862\\\"W\",\nexports.paris = 2.337229166667; //\"2d20'14.025\\\"E\",\nexports.bogota = -74.080916666667; //\"74d04'51.3\\\"W\",\nexports.madrid = -3.687938888889; //\"3d41'16.58\\\"W\",\nexports.rome = 12.452333333333; //\"12d27'8.4\\\"E\",\nexports.bern = 7.439583333333; //\"7d26'22.5\\\"E\",\nexports.jakarta = 106.807719444444; //\"106d48'27.79\\\"E\",\nexports.ferro = -17.666666666667; //\"17d40'W\",\nexports.brussels = 4.367975; //\"4d22'4.71\\\"E\",\nexports.stockholm = 18.058277777778; //\"18d3'29.8\\\"E\",\nexports.athens = 23.7163375; //\"23d42'58.815\\\"E\",\nexports.oslo = 10.722916666667; //\"10d43'22.5\\\"E\"\n","export default {\n ft: {to_meter: 0.3048},\n 'us-ft': {to_meter: 1200 / 3937}\n};\n","var ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nexport default function match(obj, key) {\n if (obj[key]) {\n return obj[key];\n }\n var keys = Object.keys(obj);\n var lkey = key.toLowerCase().replace(ignoredChar, '');\n var i = -1;\n var testkey, processedKey;\n while (++i < keys.length) {\n testkey = keys[i];\n processedKey = testkey.toLowerCase().replace(ignoredChar, '');\n if (processedKey === lkey) {\n return obj[testkey];\n }\n }\n}\n","import {D2R} from './constants/values';\nimport PrimeMeridian from './constants/PrimeMeridian';\nimport units from './constants/units';\nimport match from './match';\n\nexport default function(defData) {\n var self = {};\n var paramObj = defData.split('+').map(function(v) {\n return v.trim();\n }).filter(function(a) {\n return a;\n }).reduce(function(p, a) {\n var split = a.split('=');\n split.push(true);\n p[split[0].toLowerCase()] = split[1];\n return p;\n }, {});\n var paramName, paramVal, paramOutname;\n var params = {\n proj: 'projName',\n datum: 'datumCode',\n rf: function(v) {\n self.rf = parseFloat(v);\n },\n lat_0: function(v) {\n self.lat0 = v * D2R;\n },\n lat_1: function(v) {\n self.lat1 = v * D2R;\n },\n lat_2: function(v) {\n self.lat2 = v * D2R;\n },\n lat_ts: function(v) {\n self.lat_ts = v * D2R;\n },\n lon_0: function(v) {\n self.long0 = v * D2R;\n },\n lon_1: function(v) {\n self.long1 = v * D2R;\n },\n lon_2: function(v) {\n self.long2 = v * D2R;\n },\n alpha: function(v) {\n self.alpha = parseFloat(v) * D2R;\n },\n gamma: function(v) {\n self.rectified_grid_angle = parseFloat(v);\n },\n lonc: function(v) {\n self.longc = v * D2R;\n },\n x_0: function(v) {\n self.x0 = parseFloat(v);\n },\n y_0: function(v) {\n self.y0 = parseFloat(v);\n },\n k_0: function(v) {\n self.k0 = parseFloat(v);\n },\n k: function(v) {\n self.k0 = parseFloat(v);\n },\n a: function(v) {\n self.a = parseFloat(v);\n },\n b: function(v) {\n self.b = parseFloat(v);\n },\n r_a: function() {\n self.R_A = true;\n },\n zone: function(v) {\n self.zone = parseInt(v, 10);\n },\n south: function() {\n self.utmSouth = true;\n },\n towgs84: function(v) {\n self.datum_params = v.split(\",\").map(function(a) {\n return parseFloat(a);\n });\n },\n to_meter: function(v) {\n self.to_meter = parseFloat(v);\n },\n units: function(v) {\n self.units = v;\n var unit = match(units, v);\n if (unit) {\n self.to_meter = unit.to_meter;\n }\n },\n from_greenwich: function(v) {\n self.from_greenwich = v * D2R;\n },\n pm: function(v) {\n var pm = match(PrimeMeridian, v);\n self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;\n },\n nadgrids: function(v) {\n if (v === '@null') {\n self.datumCode = 'none';\n }\n else {\n self.nadgrids = v;\n }\n },\n axis: function(v) {\n var legalAxis = \"ewnsud\";\n if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n self.axis = v;\n }\n },\n approx: function() {\n self.approx = true;\n }\n };\n for (paramName in paramObj) {\n paramVal = paramObj[paramName];\n if (paramName in params) {\n paramOutname = params[paramName];\n if (typeof paramOutname === 'function') {\n paramOutname(paramVal);\n }\n else {\n self[paramOutname] = paramVal;\n }\n }\n else {\n self[paramName] = paramVal;\n }\n }\n if(typeof self.datumCode === 'string' && self.datumCode !== \"WGS84\"){\n self.datumCode = self.datumCode.toLowerCase();\n }\n return self;\n}\n","export default parseString;\n\nvar NEUTRAL = 1;\nvar KEYWORD = 2;\nvar NUMBER = 3;\nvar QUOTED = 4;\nvar AFTERQUOTE = 5;\nvar ENDED = -1;\nvar whitespace = /\\s/;\nvar latin = /[A-Za-z]/;\nvar keyword = /[A-Za-z84_]/;\nvar endThings = /[,\\]]/;\nvar digets = /[\\d\\.E\\-\\+]/;\n// const ignoredChar = /[\\s_\\-\\/\\(\\)]/g;\nfunction Parser(text) {\n if (typeof text !== 'string') {\n throw new Error('not a string');\n }\n this.text = text.trim();\n this.level = 0;\n this.place = 0;\n this.root = null;\n this.stack = [];\n this.currentObject = null;\n this.state = NEUTRAL;\n}\nParser.prototype.readCharicter = function() {\n var char = this.text[this.place++];\n if (this.state !== QUOTED) {\n while (whitespace.test(char)) {\n if (this.place >= this.text.length) {\n return;\n }\n char = this.text[this.place++];\n }\n }\n switch (this.state) {\n case NEUTRAL:\n return this.neutral(char);\n case KEYWORD:\n return this.keyword(char)\n case QUOTED:\n return this.quoted(char);\n case AFTERQUOTE:\n return this.afterquote(char);\n case NUMBER:\n return this.number(char);\n case ENDED:\n return;\n }\n};\nParser.prototype.afterquote = function(char) {\n if (char === '\"') {\n this.word += '\"';\n this.state = QUOTED;\n return;\n }\n if (endThings.test(char)) {\n this.word = this.word.trim();\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in afterquote yet, index ' + this.place);\n};\nParser.prototype.afterItem = function(char) {\n if (char === ',') {\n if (this.word !== null) {\n this.currentObject.push(this.word);\n }\n this.word = null;\n this.state = NEUTRAL;\n return;\n }\n if (char === ']') {\n this.level--;\n if (this.word !== null) {\n this.currentObject.push(this.word);\n this.word = null;\n }\n this.state = NEUTRAL;\n this.currentObject = this.stack.pop();\n if (!this.currentObject) {\n this.state = ENDED;\n }\n\n return;\n }\n};\nParser.prototype.number = function(char) {\n if (digets.test(char)) {\n this.word += char;\n return;\n }\n if (endThings.test(char)) {\n this.word = parseFloat(this.word);\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in number yet, index ' + this.place);\n};\nParser.prototype.quoted = function(char) {\n if (char === '\"') {\n this.state = AFTERQUOTE;\n return;\n }\n this.word += char;\n return;\n};\nParser.prototype.keyword = function(char) {\n if (keyword.test(char)) {\n this.word += char;\n return;\n }\n if (char === '[') {\n var newObjects = [];\n newObjects.push(this.word);\n this.level++;\n if (this.root === null) {\n this.root = newObjects;\n } else {\n this.currentObject.push(newObjects);\n }\n this.stack.push(this.currentObject);\n this.currentObject = newObjects;\n this.state = NEUTRAL;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in keyword yet, index ' + this.place);\n};\nParser.prototype.neutral = function(char) {\n if (latin.test(char)) {\n this.word = char;\n this.state = KEYWORD;\n return;\n }\n if (char === '\"') {\n this.word = '';\n this.state = QUOTED;\n return;\n }\n if (digets.test(char)) {\n this.word = char;\n this.state = NUMBER;\n return;\n }\n if (endThings.test(char)) {\n this.afterItem(char);\n return;\n }\n throw new Error('havn\\'t handled \"' +char + '\" in neutral yet, index ' + this.place);\n};\nParser.prototype.output = function() {\n while (this.place < this.text.length) {\n this.readCharicter();\n }\n if (this.state === ENDED) {\n return this.root;\n }\n throw new Error('unable to parse string \"' +this.text + '\". State is ' + this.state);\n};\n\nfunction parseString(txt) {\n var parser = new Parser(txt);\n return parser.output();\n}\n","\n\nfunction mapit(obj, key, value) {\n if (Array.isArray(key)) {\n value.unshift(key);\n key = null;\n }\n var thing = key ? {} : obj;\n\n var out = value.reduce(function(newObj, item) {\n sExpr(item, newObj);\n return newObj\n }, thing);\n if (key) {\n obj[key] = out;\n }\n}\n\nexport function sExpr(v, obj) {\n if (!Array.isArray(v)) {\n obj[v] = true;\n return;\n }\n var key = v.shift();\n if (key === 'PARAMETER') {\n key = v.shift();\n }\n if (v.length === 1) {\n if (Array.isArray(v[0])) {\n obj[key] = {};\n sExpr(v[0], obj[key]);\n return;\n }\n obj[key] = v[0];\n return;\n }\n if (!v.length) {\n obj[key] = true;\n return;\n }\n if (key === 'TOWGS84') {\n obj[key] = v;\n return;\n }\n if (key === 'AXIS') {\n if (!(key in obj)) {\n obj[key] = [];\n }\n obj[key].push(v);\n return;\n }\n if (!Array.isArray(key)) {\n obj[key] = {};\n }\n\n var i;\n switch (key) {\n case 'UNIT':\n case 'PRIMEM':\n case 'VERT_DATUM':\n obj[key] = {\n name: v[0].toLowerCase(),\n convert: v[1]\n };\n if (v.length === 3) {\n sExpr(v[2], obj[key]);\n }\n return;\n case 'SPHEROID':\n case 'ELLIPSOID':\n obj[key] = {\n name: v[0],\n a: v[1],\n rf: v[2]\n };\n if (v.length === 4) {\n sExpr(v[3], obj[key]);\n }\n return;\n case 'PROJECTEDCRS':\n case 'PROJCRS':\n case 'GEOGCS':\n case 'GEOCCS':\n case 'PROJCS':\n case 'LOCAL_CS':\n case 'GEODCRS':\n case 'GEODETICCRS':\n case 'GEODETICDATUM':\n case 'EDATUM':\n case 'ENGINEERINGDATUM':\n case 'VERT_CS':\n case 'VERTCRS':\n case 'VERTICALCRS':\n case 'COMPD_CS':\n case 'COMPOUNDCRS':\n case 'ENGINEERINGCRS':\n case 'ENGCRS':\n case 'FITTED_CS':\n case 'LOCAL_DATUM':\n case 'DATUM':\n v[0] = ['name', v[0]];\n mapit(obj, key, v);\n return;\n default:\n i = -1;\n while (++i < v.length) {\n if (!Array.isArray(v[i])) {\n return sExpr(v, obj[key]);\n }\n }\n return mapit(obj, key, v);\n }\n}\n","var D2R = 0.01745329251994329577;\nimport parser from './parser';\nimport {sExpr} from './process';\n\n\n\nfunction rename(obj, params) {\n var outName = params[0];\n var inName = params[1];\n if (!(outName in obj) && (inName in obj)) {\n obj[outName] = obj[inName];\n if (params.length === 3) {\n obj[outName] = params[2](obj[outName]);\n }\n }\n}\n\nfunction d2r(input) {\n return input * D2R;\n}\n\nfunction cleanWKT(wkt) {\n if (wkt.type === 'GEOGCS') {\n wkt.projName = 'longlat';\n } else if (wkt.type === 'LOCAL_CS') {\n wkt.projName = 'identity';\n wkt.local = true;\n } else {\n if (typeof wkt.PROJECTION === 'object') {\n wkt.projName = Object.keys(wkt.PROJECTION)[0];\n } else {\n wkt.projName = wkt.PROJECTION;\n }\n }\n if (wkt.AXIS) {\n var axisOrder = '';\n for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {\n var axis = [wkt.AXIS[i][0].toLowerCase(), wkt.AXIS[i][1].toLowerCase()];\n if (axis[0].indexOf('north') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'north')) {\n axisOrder += 'n';\n } else if (axis[0].indexOf('south') !== -1 || ((axis[0] === 'y' || axis[0] === 'lat') && axis[1] === 'south')) {\n axisOrder += 's';\n } else if (axis[0].indexOf('east') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'east')) {\n axisOrder += 'e';\n } else if (axis[0].indexOf('west') !== -1 || ((axis[0] === 'x' || axis[0] === 'lon') && axis[1] === 'west')) {\n axisOrder += 'w';\n }\n }\n if (axisOrder.length === 2) {\n axisOrder += 'u';\n }\n if (axisOrder.length === 3) {\n wkt.axis = axisOrder;\n }\n }\n if (wkt.UNIT) {\n wkt.units = wkt.UNIT.name.toLowerCase();\n if (wkt.units === 'metre') {\n wkt.units = 'meter';\n }\n if (wkt.UNIT.convert) {\n if (wkt.type === 'GEOGCS') {\n if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;\n }\n } else {\n wkt.to_meter = wkt.UNIT.convert;\n }\n }\n }\n var geogcs = wkt.GEOGCS;\n if (wkt.type === 'GEOGCS') {\n geogcs = wkt;\n }\n if (geogcs) {\n //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){\n // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;\n //}\n if (geogcs.DATUM) {\n wkt.datumCode = geogcs.DATUM.name.toLowerCase();\n } else {\n wkt.datumCode = geogcs.name.toLowerCase();\n }\n if (wkt.datumCode.slice(0, 2) === 'd_') {\n wkt.datumCode = wkt.datumCode.slice(2);\n }\n if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {\n wkt.datumCode = 'nzgd49';\n }\n if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {\n if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n wkt.sphere = true;\n }\n wkt.datumCode = 'wgs84';\n }\n if (wkt.datumCode.slice(-6) === '_ferro') {\n wkt.datumCode = wkt.datumCode.slice(0, - 6);\n }\n if (wkt.datumCode.slice(-8) === '_jakarta') {\n wkt.datumCode = wkt.datumCode.slice(0, - 8);\n }\n if (~wkt.datumCode.indexOf('belge')) {\n wkt.datumCode = 'rnb72';\n }\n if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {\n wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {\n wkt.ellps = 'intl';\n }\n\n wkt.a = geogcs.DATUM.SPHEROID.a;\n wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);\n }\n\n if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {\n wkt.datum_params = geogcs.DATUM.TOWGS84;\n }\n if (~wkt.datumCode.indexOf('osgb_1936')) {\n wkt.datumCode = 'osgb36';\n }\n if (~wkt.datumCode.indexOf('osni_1952')) {\n wkt.datumCode = 'osni52';\n }\n if (~wkt.datumCode.indexOf('tm65')\n || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {\n wkt.datumCode = 'ire65';\n }\n if (wkt.datumCode === 'ch1903+') {\n wkt.datumCode = 'ch1903';\n }\n if (~wkt.datumCode.indexOf('israel')) {\n wkt.datumCode = 'isr93';\n }\n }\n if (wkt.b && !isFinite(wkt.b)) {\n wkt.b = wkt.a;\n }\n\n function toMeter(input) {\n var ratio = wkt.to_meter || 1;\n return input * ratio;\n }\n var renamer = function(a) {\n return rename(wkt, a);\n };\n var list = [\n ['standard_parallel_1', 'Standard_Parallel_1'],\n ['standard_parallel_1', 'Latitude of 1st standard parallel'],\n ['standard_parallel_2', 'Standard_Parallel_2'],\n ['standard_parallel_2', 'Latitude of 2nd standard parallel'],\n ['false_easting', 'False_Easting'],\n ['false_easting', 'False easting'],\n ['false-easting', 'Easting at false origin'],\n ['false_northing', 'False_Northing'],\n ['false_northing', 'False northing'],\n ['false_northing', 'Northing at false origin'],\n ['central_meridian', 'Central_Meridian'],\n ['central_meridian', 'Longitude of natural origin'],\n ['central_meridian', 'Longitude of false origin'],\n ['latitude_of_origin', 'Latitude_Of_Origin'],\n ['latitude_of_origin', 'Central_Parallel'],\n ['latitude_of_origin', 'Latitude of natural origin'],\n ['latitude_of_origin', 'Latitude of false origin'],\n ['scale_factor', 'Scale_Factor'],\n ['k0', 'scale_factor'],\n ['latitude_of_center', 'Latitude_Of_Center'],\n ['latitude_of_center', 'Latitude_of_center'],\n ['lat0', 'latitude_of_center', d2r],\n ['longitude_of_center', 'Longitude_Of_Center'],\n ['longitude_of_center', 'Longitude_of_center'],\n ['longc', 'longitude_of_center', d2r],\n ['x0', 'false_easting', toMeter],\n ['y0', 'false_northing', toMeter],\n ['long0', 'central_meridian', d2r],\n ['lat0', 'latitude_of_origin', d2r],\n ['lat0', 'standard_parallel_1', d2r],\n ['lat1', 'standard_parallel_1', d2r],\n ['lat2', 'standard_parallel_2', d2r],\n ['azimuth', 'Azimuth'],\n ['alpha', 'azimuth', d2r],\n ['srsCode', 'name']\n ];\n list.forEach(renamer);\n if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {\n wkt.long0 = wkt.longc;\n }\n if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {\n wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n wkt.lat_ts = wkt.lat1;\n } else if (!wkt.lat_ts && wkt.lat0 && wkt.projName === 'Polar_Stereographic') {\n wkt.lat_ts = wkt.lat0;\n wkt.lat0 = d2r(wkt.lat0 > 0 ? 90 : -90);\n }\n}\nexport default function(wkt) {\n var lisp = parser(wkt);\n var type = lisp.shift();\n var name = lisp.shift();\n lisp.unshift(['name', name]);\n lisp.unshift(['type', type]);\n var obj = {};\n sExpr(lisp, obj);\n cleanWKT(obj);\n return obj;\n}\n","import globals from './global';\nimport parseProj from './projString';\nimport wkt from 'wkt-parser';\n\nfunction defs(name) {\n /*global console*/\n var that = this;\n if (arguments.length === 2) {\n var def = arguments[1];\n if (typeof def === 'string') {\n if (def.charAt(0) === '+') {\n defs[name] = parseProj(arguments[1]);\n }\n else {\n defs[name] = wkt(arguments[1]);\n }\n } else {\n defs[name] = def;\n }\n }\n else if (arguments.length === 1) {\n if (Array.isArray(name)) {\n return name.map(function(v) {\n if (Array.isArray(v)) {\n defs.apply(that, v);\n }\n else {\n defs(v);\n }\n });\n }\n else if (typeof name === 'string') {\n if (name in defs) {\n return defs[name];\n }\n }\n else if ('EPSG' in name) {\n defs['EPSG:' + name.EPSG] = name;\n }\n else if ('ESRI' in name) {\n defs['ESRI:' + name.ESRI] = name;\n }\n else if ('IAU2000' in name) {\n defs['IAU2000:' + name.IAU2000] = name;\n }\n else {\n console.log(name);\n }\n return;\n }\n\n\n}\nglobals(defs);\nexport default defs;\n","export default function(defs) {\n defs('EPSG:4326', \"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\");\n defs('EPSG:4269', \"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\");\n defs('EPSG:3857', \"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\");\n\n defs.WGS84 = defs['EPSG:4326'];\n defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n defs.GOOGLE = defs['EPSG:3857'];\n defs['EPSG:900913'] = defs['EPSG:3857'];\n defs['EPSG:102113'] = defs['EPSG:3857'];\n}\n","import defs from './defs';\nimport wkt from 'wkt-parser';\nimport projStr from './projString';\nimport match from './match';\nfunction testObj(code){\n return typeof code === 'string';\n}\nfunction testDef(code){\n return code in defs;\n}\nvar codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];\nfunction testWKT(code){\n return codeWords.some(function (word) {\n return code.indexOf(word) > -1;\n });\n}\nvar codes = ['3857', '900913', '3785', '102113'];\nfunction checkMercator(item) {\n var auth = match(item, 'authority');\n if (!auth) {\n return;\n }\n var code = match(auth, 'epsg');\n return code && codes.indexOf(code) > -1;\n}\nfunction checkProjStr(item) {\n var ext = match(item, 'extension');\n if (!ext) {\n return;\n }\n return match(ext, 'proj4');\n}\nfunction testProj(code){\n return code[0] === '+';\n}\nfunction parse(code){\n if (testObj(code)) {\n //check to see if this is a WKT string\n if (testDef(code)) {\n return defs[code];\n }\n if (testWKT(code)) {\n var out = wkt(code);\n // test of spetial case, due to this being a very common and often malformed\n if (checkMercator(out)) {\n return defs['EPSG:3857'];\n }\n var maybeProjStr = checkProjStr(out);\n if (maybeProjStr) {\n return projStr(maybeProjStr);\n }\n return out;\n }\n if (testProj(code)) {\n return projStr(code);\n }\n }else{\n return code;\n }\n}\n\nexport default parse;\n","export default function(destination, source) {\n destination = destination || {};\n var value, property;\n if (!source) {\n return destination;\n }\n for (property in source) {\n value = source[property];\n if (value !== undefined) {\n destination[property] = value;\n }\n }\n return destination;\n}\n","export default function(eccent, sinphi, cosphi) {\n var con = eccent * sinphi;\n return cosphi / (Math.sqrt(1 - con * con));\n}","export default function(x) {\n return x<0 ? -1 : 1;\n}","\nimport {TWO_PI, SPI} from '../constants/values';\nimport sign from './sign';\n\nexport default function(x) {\n return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));\n}\n","import {HALF_PI} from '../constants/values';\n\nexport default function(eccent, phi, sinphi) {\n var con = eccent * sinphi;\n var com = 0.5 * eccent;\n con = Math.pow(((1 - con) / (1 + con)), com);\n return (Math.tan(0.5 * (HALF_PI - phi)) / con);\n}\n","import {HALF_PI} from '../constants/values';\n\nexport default function(eccent, ts) {\n var eccnth = 0.5 * eccent;\n var con, dphi;\n var phi = HALF_PI - 2 * Math.atan(ts);\n for (var i = 0; i <= 15; i++) {\n con = eccent * Math.sin(phi);\n dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n //console.log(\"phi2z has NoConvergence\");\n return -9999;\n}\n","export function init() {\n //no-op for longlat\n}\n\nfunction identity(pt) {\n return pt;\n}\nexport {identity as forward};\nexport {identity as inverse};\nexport var names = [\"longlat\", \"identity\"];\nexport default {\n init: init,\n forward: identity,\n inverse: identity,\n names: names\n};\n","import merc from \"./projections/merc\";\nimport longlat from \"./projections/longlat\";\nvar projs = [merc, longlat];\nvar names = {};\nvar projStore = [];\n\nfunction add(proj, i) {\n var len = projStore.length;\n if (!proj.names) {\n console.log(i);\n return true;\n }\n projStore[len] = proj;\n proj.names.forEach(function(n) {\n names[n.toLowerCase()] = len;\n });\n return this;\n}\n\nexport {add};\n\nexport function get(name) {\n if (!name) {\n return false;\n }\n var n = name.toLowerCase();\n if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n return projStore[names[n]];\n }\n}\n\nexport function start() {\n projs.forEach(add);\n}\nexport default {\n start: start,\n add: add,\n get: get\n};\n","import msfnz from '../common/msfnz';\n\nimport adjust_lon from '../common/adjust_lon';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport {FORTPI, R2D, EPSLN, HALF_PI} from '../constants/values';\nexport function init() {\n var con = this.b / this.a;\n this.es = 1 - con * con;\n if(!('x0' in this)){\n this.x0 = 0;\n }\n if(!('y0' in this)){\n this.y0 = 0;\n }\n this.e = Math.sqrt(this.es);\n if (this.lat_ts) {\n if (this.sphere) {\n this.k0 = Math.cos(this.lat_ts);\n }\n else {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n }\n else {\n if (!this.k0) {\n if (this.k) {\n this.k0 = this.k;\n }\n else {\n this.k0 = 1;\n }\n }\n }\n}\n\n/* Mercator forward equations--mapping lat,long to x,y\n --------------------------------------------------*/\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n // convert to radians\n if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {\n return null;\n }\n\n var x, y;\n if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {\n return null;\n }\n else {\n if (this.sphere) {\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));\n }\n else {\n var sinphi = Math.sin(lat);\n var ts = tsfnz(this.e, lat, sinphi);\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 - this.a * this.k0 * Math.log(ts);\n }\n p.x = x;\n p.y = y;\n return p;\n }\n}\n\n/* Mercator inverse equations--mapping x,y to lat/long\n --------------------------------------------------*/\nexport function inverse(p) {\n\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Mercator\", \"Popular Visualisation Pseudo Mercator\", \"Mercator_1SP\", \"Mercator_Auxiliary_Sphere\", \"merc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","var exports = {};\nexport {exports as default};\nexports.MERIT = {\n a: 6378137.0,\n rf: 298.257,\n ellipseName: \"MERIT 1983\"\n};\n\nexports.SGS85 = {\n a: 6378136.0,\n rf: 298.257,\n ellipseName: \"Soviet Geodetic System 85\"\n};\n\nexports.GRS80 = {\n a: 6378137.0,\n rf: 298.257222101,\n ellipseName: \"GRS 1980(IUGG, 1980)\"\n};\n\nexports.IAU76 = {\n a: 6378140.0,\n rf: 298.257,\n ellipseName: \"IAU 1976\"\n};\n\nexports.airy = {\n a: 6377563.396,\n b: 6356256.910,\n ellipseName: \"Airy 1830\"\n};\n\nexports.APL4 = {\n a: 6378137,\n rf: 298.25,\n ellipseName: \"Appl. Physics. 1965\"\n};\n\nexports.NWL9D = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"Naval Weapons Lab., 1965\"\n};\n\nexports.mod_airy = {\n a: 6377340.189,\n b: 6356034.446,\n ellipseName: \"Modified Airy\"\n};\n\nexports.andrae = {\n a: 6377104.43,\n rf: 300.0,\n ellipseName: \"Andrae 1876 (Den., Iclnd.)\"\n};\n\nexports.aust_SA = {\n a: 6378160.0,\n rf: 298.25,\n ellipseName: \"Australian Natl & S. Amer. 1969\"\n};\n\nexports.GRS67 = {\n a: 6378160.0,\n rf: 298.2471674270,\n ellipseName: \"GRS 67(IUGG 1967)\"\n};\n\nexports.bessel = {\n a: 6377397.155,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841\"\n};\n\nexports.bess_nam = {\n a: 6377483.865,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841 (Namibia)\"\n};\n\nexports.clrk66 = {\n a: 6378206.4,\n b: 6356583.8,\n ellipseName: \"Clarke 1866\"\n};\n\nexports.clrk80 = {\n a: 6378249.145,\n rf: 293.4663,\n ellipseName: \"Clarke 1880 mod.\"\n};\n\nexports.clrk80ign = {\n a: 6378249.2,\n b: 6356515,\n rf: 293.4660213,\n ellipseName: \"Clarke 1880 (IGN)\"\n};\n\nexports.clrk58 = {\n a: 6378293.645208759,\n rf: 294.2606763692654,\n ellipseName: \"Clarke 1858\"\n};\n\nexports.CPM = {\n a: 6375738.7,\n rf: 334.29,\n ellipseName: \"Comm. des Poids et Mesures 1799\"\n};\n\nexports.delmbr = {\n a: 6376428.0,\n rf: 311.5,\n ellipseName: \"Delambre 1810 (Belgium)\"\n};\n\nexports.engelis = {\n a: 6378136.05,\n rf: 298.2566,\n ellipseName: \"Engelis 1985\"\n};\n\nexports.evrst30 = {\n a: 6377276.345,\n rf: 300.8017,\n ellipseName: \"Everest 1830\"\n};\n\nexports.evrst48 = {\n a: 6377304.063,\n rf: 300.8017,\n ellipseName: \"Everest 1948\"\n};\n\nexports.evrst56 = {\n a: 6377301.243,\n rf: 300.8017,\n ellipseName: \"Everest 1956\"\n};\n\nexports.evrst69 = {\n a: 6377295.664,\n rf: 300.8017,\n ellipseName: \"Everest 1969\"\n};\n\nexports.evrstSS = {\n a: 6377298.556,\n rf: 300.8017,\n ellipseName: \"Everest (Sabah & Sarawak)\"\n};\n\nexports.fschr60 = {\n a: 6378166.0,\n rf: 298.3,\n ellipseName: \"Fischer (Mercury Datum) 1960\"\n};\n\nexports.fschr60m = {\n a: 6378155.0,\n rf: 298.3,\n ellipseName: \"Fischer 1960\"\n};\n\nexports.fschr68 = {\n a: 6378150.0,\n rf: 298.3,\n ellipseName: \"Fischer 1968\"\n};\n\nexports.helmert = {\n a: 6378200.0,\n rf: 298.3,\n ellipseName: \"Helmert 1906\"\n};\n\nexports.hough = {\n a: 6378270.0,\n rf: 297.0,\n ellipseName: \"Hough\"\n};\n\nexports.intl = {\n a: 6378388.0,\n rf: 297.0,\n ellipseName: \"International 1909 (Hayford)\"\n};\n\nexports.kaula = {\n a: 6378163.0,\n rf: 298.24,\n ellipseName: \"Kaula 1961\"\n};\n\nexports.lerch = {\n a: 6378139.0,\n rf: 298.257,\n ellipseName: \"Lerch 1979\"\n};\n\nexports.mprts = {\n a: 6397300.0,\n rf: 191.0,\n ellipseName: \"Maupertius 1738\"\n};\n\nexports.new_intl = {\n a: 6378157.5,\n b: 6356772.2,\n ellipseName: \"New International 1967\"\n};\n\nexports.plessis = {\n a: 6376523.0,\n rf: 6355863.0,\n ellipseName: \"Plessis 1817 (France)\"\n};\n\nexports.krass = {\n a: 6378245.0,\n rf: 298.3,\n ellipseName: \"Krassovsky, 1942\"\n};\n\nexports.SEasia = {\n a: 6378155.0,\n b: 6356773.3205,\n ellipseName: \"Southeast Asia\"\n};\n\nexports.walbeck = {\n a: 6376896.0,\n b: 6355834.8467,\n ellipseName: \"Walbeck\"\n};\n\nexports.WGS60 = {\n a: 6378165.0,\n rf: 298.3,\n ellipseName: \"WGS 60\"\n};\n\nexports.WGS66 = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"WGS 66\"\n};\n\nexports.WGS7 = {\n a: 6378135.0,\n rf: 298.26,\n ellipseName: \"WGS 72\"\n};\n\nexport var WGS84 = exports.WGS84 = {\n a: 6378137.0,\n rf: 298.257223563,\n ellipseName: \"WGS 84\"\n};\n\nexports.sphere = {\n a: 6370997.0,\n b: 6370997.0,\n ellipseName: \"Normal Sphere (r=6370997)\"\n};\n","var exports = {};\nexport {exports as default};\nexports.wgs84 = {\n towgs84: \"0,0,0\",\n ellipse: \"WGS84\",\n datumName: \"WGS84\"\n};\n\nexports.ch1903 = {\n towgs84: \"674.374,15.056,405.346\",\n ellipse: \"bessel\",\n datumName: \"swiss\"\n};\n\nexports.ggrs87 = {\n towgs84: \"-199.87,74.79,246.62\",\n ellipse: \"GRS80\",\n datumName: \"Greek_Geodetic_Reference_System_1987\"\n};\n\nexports.nad83 = {\n towgs84: \"0,0,0\",\n ellipse: \"GRS80\",\n datumName: \"North_American_Datum_1983\"\n};\n\nexports.nad27 = {\n nadgrids: \"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat\",\n ellipse: \"clrk66\",\n datumName: \"North_American_Datum_1927\"\n};\n\nexports.potsdam = {\n towgs84: \"598.1,73.7,418.2,0.202,0.045,-2.455,6.7\",\n ellipse: \"bessel\",\n datumName: \"Potsdam Rauenberg 1950 DHDN\"\n};\n\nexports.carthage = {\n towgs84: \"-263.0,6.0,431.0\",\n ellipse: \"clark80\",\n datumName: \"Carthage 1934 Tunisia\"\n};\n\nexports.hermannskogel = {\n towgs84: \"577.326,90.129,463.919,5.137,1.474,5.297,2.4232\",\n ellipse: \"bessel\",\n datumName: \"Hermannskogel\"\n};\n\nexports.osni52 = {\n towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n ellipse: \"airy\",\n datumName: \"Irish National\"\n};\n\nexports.ire65 = {\n towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n ellipse: \"mod_airy\",\n datumName: \"Ireland 1965\"\n};\n\nexports.rassadiran = {\n towgs84: \"-133.63,-157.5,-158.62\",\n ellipse: \"intl\",\n datumName: \"Rassadiran\"\n};\n\nexports.nzgd49 = {\n towgs84: \"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993\",\n ellipse: \"intl\",\n datumName: \"New Zealand Geodetic Datum 1949\"\n};\n\nexports.osgb36 = {\n towgs84: \"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894\",\n ellipse: \"airy\",\n datumName: \"Airy 1830\"\n};\n\nexports.s_jtsk = {\n towgs84: \"589,76,480\",\n ellipse: 'bessel',\n datumName: 'S-JTSK (Ferro)'\n};\n\nexports.beduaram = {\n towgs84: '-106,-87,188',\n ellipse: 'clrk80',\n datumName: 'Beduaram'\n};\n\nexports.gunung_segara = {\n towgs84: '-403,684,41',\n ellipse: 'bessel',\n datumName: 'Gunung Segara Jakarta'\n};\n\nexports.rnb72 = {\n towgs84: \"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1\",\n ellipse: \"intl\",\n datumName: \"Reseau National Belge 1972\"\n};\n","import {PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT, PJD_WGS84, PJD_NODATUM, SEC_TO_RAD} from './constants/values';\n\nfunction datum(datumCode, datum_params, a, b, es, ep2, nadgrids) {\n var out = {};\n\n if (datumCode === undefined || datumCode === 'none') {\n out.datum_type = PJD_NODATUM;\n } else {\n out.datum_type = PJD_WGS84;\n }\n\n if (datum_params) {\n out.datum_params = datum_params.map(parseFloat);\n if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n out.datum_type = PJD_3PARAM;\n }\n if (out.datum_params.length > 3) {\n if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n out.datum_type = PJD_7PARAM;\n out.datum_params[3] *= SEC_TO_RAD;\n out.datum_params[4] *= SEC_TO_RAD;\n out.datum_params[5] *= SEC_TO_RAD;\n out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;\n }\n }\n }\n\n if (nadgrids) {\n out.datum_type = PJD_GRIDSHIFT;\n out.grids = nadgrids;\n }\n out.a = a; //datum object also uses these values\n out.b = b;\n out.es = es;\n out.ep2 = ep2;\n return out;\n}\n\nexport default datum;\n","/**\n * Resources for details of NTv2 file formats:\n * - https://web.archive.org/web/20140127204822if_/http://www.mgs.gov.on.ca:80/stdprodconsume/groups/content/@mgs/@iandit/documents/resourcelist/stel02_047447.pdf\n * - http://mimaka.com/help/gs/html/004_NTV2%20Data%20Format.htm\n */\n\nvar loadedNadgrids = {};\n\n/**\n * Load a binary NTv2 file (.gsb) to a key that can be used in a proj string like +nadgrids=. Pass the NTv2 file\n * as an ArrayBuffer.\n */\nexport default function nadgrid(key, data) {\n var view = new DataView(data);\n var isLittleEndian = detectLittleEndian(view);\n var header = readHeader(view, isLittleEndian);\n var subgrids = readSubgrids(view, header, isLittleEndian);\n var nadgrid = {header: header, subgrids: subgrids};\n loadedNadgrids[key] = nadgrid;\n return nadgrid;\n}\n\n/**\n * Given a proj4 value for nadgrids, return an array of loaded grids\n */\nexport function getNadgrids(nadgrids) {\n // Format details: http://proj.maptools.org/gen_parms.html\n if (nadgrids === undefined) { return null; }\n var grids = nadgrids.split(',');\n return grids.map(parseNadgridString);\n}\n\nfunction parseNadgridString(value) {\n if (value.length === 0) {\n return null;\n }\n var optional = value[0] === '@';\n if (optional) {\n value = value.slice(1);\n }\n if (value === 'null') {\n return {name: 'null', mandatory: !optional, grid: null, isNull: true};\n }\n return {\n name: value,\n mandatory: !optional,\n grid: loadedNadgrids[value] || null,\n isNull: false\n };\n}\n\nfunction secondsToRadians(seconds) {\n return (seconds / 3600) * Math.PI / 180;\n}\n\nfunction detectLittleEndian(view) {\n var nFields = view.getInt32(8, false);\n if (nFields === 11) {\n return false;\n }\n nFields = view.getInt32(8, true);\n if (nFields !== 11) {\n console.warn('Failed to detect nadgrid endian-ness, defaulting to little-endian');\n }\n return true;\n}\n\nfunction readHeader(view, isLittleEndian) {\n return {\n nFields: view.getInt32(8, isLittleEndian),\n nSubgridFields: view.getInt32(24, isLittleEndian),\n nSubgrids: view.getInt32(40, isLittleEndian),\n shiftType: decodeString(view, 56, 56 + 8).trim(),\n fromSemiMajorAxis: view.getFloat64(120, isLittleEndian),\n fromSemiMinorAxis: view.getFloat64(136, isLittleEndian),\n toSemiMajorAxis: view.getFloat64(152, isLittleEndian),\n toSemiMinorAxis: view.getFloat64(168, isLittleEndian),\n };\n}\n\nfunction decodeString(view, start, end) {\n return String.fromCharCode.apply(null, new Uint8Array(view.buffer.slice(start, end)));\n}\n\nfunction readSubgrids(view, header, isLittleEndian) {\n var gridOffset = 176;\n var grids = [];\n for (var i = 0; i < header.nSubgrids; i++) {\n var subHeader = readGridHeader(view, gridOffset, isLittleEndian);\n var nodes = readGridNodes(view, gridOffset, subHeader, isLittleEndian);\n var lngColumnCount = Math.round(\n 1 + (subHeader.upperLongitude - subHeader.lowerLongitude) / subHeader.longitudeInterval);\n var latColumnCount = Math.round(\n 1 + (subHeader.upperLatitude - subHeader.lowerLatitude) / subHeader.latitudeInterval);\n // Proj4 operates on radians whereas the coordinates are in seconds in the grid\n grids.push({\n ll: [secondsToRadians(subHeader.lowerLongitude), secondsToRadians(subHeader.lowerLatitude)],\n del: [secondsToRadians(subHeader.longitudeInterval), secondsToRadians(subHeader.latitudeInterval)],\n lim: [lngColumnCount, latColumnCount],\n count: subHeader.gridNodeCount,\n cvs: mapNodes(nodes)\n });\n gridOffset += 176 + subHeader.gridNodeCount * 16;\n }\n return grids;\n}\n\nfunction mapNodes(nodes) {\n return nodes.map(function (r) {return [secondsToRadians(r.longitudeShift), secondsToRadians(r.latitudeShift)];});\n}\n\nfunction readGridHeader(view, offset, isLittleEndian) {\n return {\n name: decodeString(view, offset + 8, offset + 16).trim(),\n parent: decodeString(view, offset + 24, offset + 24 + 8).trim(),\n lowerLatitude: view.getFloat64(offset + 72, isLittleEndian),\n upperLatitude: view.getFloat64(offset + 88, isLittleEndian),\n lowerLongitude: view.getFloat64(offset + 104, isLittleEndian),\n upperLongitude: view.getFloat64(offset + 120, isLittleEndian),\n latitudeInterval: view.getFloat64(offset + 136, isLittleEndian),\n longitudeInterval: view.getFloat64(offset + 152, isLittleEndian),\n gridNodeCount: view.getInt32(offset + 168, isLittleEndian)\n };\n}\n\nfunction readGridNodes(view, offset, gridHeader, isLittleEndian) {\n var nodesOffset = offset + 176;\n var gridRecordLength = 16;\n var gridShiftRecords = [];\n for (var i = 0; i < gridHeader.gridNodeCount; i++) {\n var record = {\n latitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength, isLittleEndian),\n longitudeShift: view.getFloat32(nodesOffset + i * gridRecordLength + 4, isLittleEndian),\n latitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 8, isLittleEndian),\n longitudeAccuracy: view.getFloat32(nodesOffset + i * gridRecordLength + 12, isLittleEndian),\n };\n gridShiftRecords.push(record);\n }\n return gridShiftRecords;\n}\n","import parseCode from './parseCode';\nimport extend from './extend';\nimport projections from './projections';\nimport {sphere as dc_sphere, eccentricity as dc_eccentricity} from './deriveConstants';\nimport Datum from './constants/Datum';\nimport datum from './datum';\nimport match from './match';\nimport {getNadgrids} from \"./nadgrid\";\n\nfunction Projection(srsCode,callback) {\n if (!(this instanceof Projection)) {\n return new Projection(srsCode);\n }\n callback = callback || function(error){\n if(error){\n throw error;\n }\n };\n var json = parseCode(srsCode);\n if(typeof json !== 'object'){\n callback(srsCode);\n return;\n }\n var ourProj = Projection.projections.get(json.projName);\n if(!ourProj){\n callback(srsCode);\n return;\n }\n if (json.datumCode && json.datumCode !== 'none') {\n var datumDef = match(Datum, json.datumCode);\n if (datumDef) {\n json.datum_params = json.datum_params || (datumDef.towgs84 ? datumDef.towgs84.split(',') : null);\n json.ellps = datumDef.ellipse;\n json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n }\n }\n json.k0 = json.k0 || 1.0;\n json.axis = json.axis || 'enu';\n json.ellps = json.ellps || 'wgs84';\n json.lat1 = json.lat1 || json.lat0; // Lambert_Conformal_Conic_1SP, for example, needs this\n\n var sphere_ = dc_sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n var ecc = dc_eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);\n var nadgrids = getNadgrids(json.nadgrids);\n var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2,\n nadgrids);\n\n extend(this, json); // transfer everything over from the projection because we don't know what we'll need\n extend(this, ourProj); // transfer all the methods from the projection\n\n // copy the 4 things over we calculated in deriveConstants.sphere\n this.a = sphere_.a;\n this.b = sphere_.b;\n this.rf = sphere_.rf;\n this.sphere = sphere_.sphere;\n\n // copy the 3 things we calculated in deriveConstants.eccentricity\n this.es = ecc.es;\n this.e = ecc.e;\n this.ep2 = ecc.ep2;\n\n // add in the datum object\n this.datum = datumObj;\n\n // init the projection\n this.init();\n\n // legecy callback from back in the day when it went to spatialreference.org\n callback(null, this);\n\n}\nProjection.projections = projections;\nProjection.projections.start();\nexport default Projection;\n","import {SIXTH, RA4, RA6, EPSLN} from './constants/values';\nimport {default as Ellipsoid, WGS84} from './constants/Ellipsoid';\nimport match from './match';\n\nexport function eccentricity(a, b, rf, R_A) {\n var a2 = a * a; // used in geocentric\n var b2 = b * b; // used in geocentric\n var es = (a2 - b2) / a2; // e ^ 2\n var e = 0;\n if (R_A) {\n a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));\n a2 = a * a;\n es = 0;\n } else {\n e = Math.sqrt(es); // eccentricity\n }\n var ep2 = (a2 - b2) / b2; // used in geocentric\n return {\n es: es,\n e: e,\n ep2: ep2\n };\n}\nexport function sphere(a, b, rf, ellps, sphere) {\n if (!a) { // do we have an ellipsoid?\n var ellipse = match(Ellipsoid, ellps);\n if (!ellipse) {\n ellipse = WGS84;\n }\n a = ellipse.a;\n b = ellipse.b;\n rf = ellipse.rf;\n }\n\n if (rf && !b) {\n b = (1.0 - 1.0 / rf) * a;\n }\n if (rf === 0 || Math.abs(a - b) < EPSLN) {\n sphere = true;\n b = a;\n }\n return {\n a: a,\n b: b,\n rf: rf,\n sphere: sphere\n };\n}\n","'use strict';\nimport {PJD_3PARAM, PJD_7PARAM, HALF_PI} from './constants/values';\nexport function compareDatums(source, dest) {\n if (source.datum_type !== dest.datum_type) {\n return false; // false, datums are not equal\n } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {\n // the tolerance for es is to ensure that GRS80 and WGS84\n // are considered identical\n return false;\n } else if (source.datum_type === PJD_3PARAM) {\n return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);\n } else if (source.datum_type === PJD_7PARAM) {\n return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);\n } else {\n return true; // datums are equal\n }\n} // cs_compare_datums()\n\n/*\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n * according to the current ellipsoid parameters.\n *\n * Latitude : Geodetic latitude in radians (input)\n * Longitude : Geodetic longitude in radians (input)\n * Height : Geodetic height, in meters (input)\n * X : Calculated Geocentric X coordinate, in meters (output)\n * Y : Calculated Geocentric Y coordinate, in meters (output)\n * Z : Calculated Geocentric Z coordinate, in meters (output)\n *\n */\nexport function geodeticToGeocentric(p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; //Z value not always supplied\n\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {\n Latitude = -HALF_PI;\n } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {\n Latitude = HALF_PI;\n } else if (Latitude < -HALF_PI) {\n /* Latitude out of range */\n //..reportError('geocent:lat out of range:' + Latitude);\n return { x: -Infinity, y: -Infinity, z: p.z };\n } else if (Latitude > HALF_PI) {\n /* Latitude out of range */\n return { x: Infinity, y: Infinity, z: p.z };\n }\n\n if (Longitude > Math.PI) {\n Longitude -= (2 * Math.PI);\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: ((Rn * (1 - es)) + Height) * Sin_Lat\n };\n} // cs_geodetic_to_geocentric()\n\nexport function geocentricToGeodetic(p, es, a, b) {\n /* local defintions and variables */\n /* end-criterium of loop, accuracy of sin(Latitude) */\n var genau = 1e-12;\n var genau2 = (genau * genau);\n var maxiter = 30;\n\n var P; /* distance between semi-minor axis and location */\n var RR; /* distance between center and location */\n var CT; /* sin of geocentric latitude */\n var ST; /* cos of geocentric latitude */\n var RX;\n var RK;\n var RN; /* Earth radius at location */\n var CPHI0; /* cos of start or old geodetic latitude in iterations */\n var SPHI0; /* sin of start or old geodetic latitude in iterations */\n var CPHI; /* cos of searched geodetic latitude */\n var SPHI; /* sin of searched geodetic latitude */\n var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n\n var X = p.x;\n var Y = p.y;\n var Z = p.z ? p.z : 0.0; //Z value not always supplied\n var Longitude;\n var Latitude;\n var Height;\n\n P = Math.sqrt(X * X + Y * Y);\n RR = Math.sqrt(X * X + Y * Y + Z * Z);\n\n /* special cases for latitude and longitude */\n if (P / a < genau) {\n\n /* special case, if P=0. (X=0., Y=0.) */\n Longitude = 0.0;\n\n /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n if (RR / a < genau) {\n Latitude = HALF_PI;\n Height = -b;\n return {\n x: p.x,\n y: p.y,\n z: p.z\n };\n }\n } else {\n /* ellipsoidal (geodetic) longitude\n * interval: -PI < Longitude <= +PI */\n Longitude = Math.atan2(Y, X);\n }\n\n /* --------------------------------------------------------------\n * Following iterative algorithm was developped by\n * \"Institut for Erdmessung\", University of Hannover, July 1988.\n * Internet: www.ife.uni-hannover.de\n * Iterative computation of CPHI,SPHI and Height.\n * Iteration of CPHI and SPHI to 10**-12 radian resp.\n * 2*10**-7 arcsec.\n * --------------------------------------------------------------\n */\n CT = Z / RR;\n ST = P / RR;\n RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n CPHI0 = ST * (1.0 - es) * RX;\n SPHI0 = CT * RX;\n iter = 0;\n\n /* loop to find sin(Latitude) resp. Latitude\n * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n do {\n iter++;\n RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n\n /* ellipsoidal (geodetic) height */\n Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n\n RK = es * RN / (RN + Height);\n RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n CPHI = ST * (1.0 - RK) * RX;\n SPHI = CT * RX;\n SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n CPHI0 = CPHI;\n SPHI0 = SPHI;\n }\n while (SDPHI * SDPHI > genau2 && iter < maxiter);\n\n /* ellipsoidal (geodetic) latitude */\n Latitude = Math.atan(SPHI / Math.abs(CPHI));\n return {\n x: Longitude,\n y: Latitude,\n z: Height\n };\n} // cs_geocentric_to_geodetic()\n\n/****************************************************************/\n// pj_geocentic_to_wgs84( p )\n// p = point to transform in geocentric coordinates (x,y,z)\n\n\n/** point object, nothing fancy, just allows values to be\n passed back and forth by reference rather than by value.\n Other point classes may be used as long as they have\n x and y properties, which will get modified in the transform method.\n*/\nexport function geocentricToWgs84(p, datum_type, datum_params) {\n\n if (datum_type === PJD_3PARAM) {\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x + datum_params[0],\n y: p.y + datum_params[1],\n z: p.z + datum_params[2],\n };\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n };\n }\n} // cs_geocentric_to_wgs84\n\n/****************************************************************/\n// pj_geocentic_from_wgs84()\n// coordinate system definition,\n// point to transform in geocentric coordinates (x,y,z)\nexport function geocentricFromWgs84(p, datum_type, datum_params) {\n\n if (datum_type === PJD_3PARAM) {\n //if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x - datum_params[0],\n y: p.y - datum_params[1],\n z: p.z - datum_params[2],\n };\n\n } else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n var x_tmp = (p.x - Dx_BF) / M_BF;\n var y_tmp = (p.y - Dy_BF) / M_BF;\n var z_tmp = (p.z - Dz_BF) / M_BF;\n //if( x[io] === HUGE_VAL )\n // continue;\n\n return {\n x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n };\n } //cs_geocentric_from_wgs84()\n}\n","import {\n PJD_3PARAM,\n PJD_7PARAM,\n PJD_GRIDSHIFT,\n PJD_NODATUM,\n R2D,\n SRS_WGS84_ESQUARED,\n SRS_WGS84_SEMIMAJOR, SRS_WGS84_SEMIMINOR\n} from './constants/values';\n\nimport {geodeticToGeocentric, geocentricToGeodetic, geocentricToWgs84, geocentricFromWgs84, compareDatums} from './datumUtils';\nimport adjust_lon from \"./common/adjust_lon\";\nfunction checkParams(type) {\n return (type === PJD_3PARAM || type === PJD_7PARAM);\n}\n\nexport default function(source, dest, point) {\n // Short cut if the datums are identical.\n if (compareDatums(source, dest)) {\n return point; // in this case, zero is sucess,\n // whereas cs_compare_datums returns 1 to indicate TRUE\n // confusing, should fix this\n }\n\n // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {\n return point;\n }\n\n // If this datum requires grid shifts, then apply it to geodetic coordinates.\n var source_a = source.a;\n var source_es = source.es;\n if (source.datum_type === PJD_GRIDSHIFT) {\n var gridShiftCode = applyGridShift(source, false, point);\n if (gridShiftCode !== 0) {\n return undefined;\n }\n source_a = SRS_WGS84_SEMIMAJOR;\n source_es = SRS_WGS84_ESQUARED;\n }\n\n var dest_a = dest.a;\n var dest_b = dest.b;\n var dest_es = dest.es;\n if (dest.datum_type === PJD_GRIDSHIFT) {\n dest_a = SRS_WGS84_SEMIMAJOR;\n dest_b = SRS_WGS84_SEMIMINOR;\n dest_es = SRS_WGS84_ESQUARED;\n }\n\n // Do we need to go through geocentric coordinates?\n if (source_es === dest_es && source_a === dest_a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n return point;\n }\n\n // Convert to geocentric coordinates.\n point = geodeticToGeocentric(point, source_es, source_a);\n // Convert between datums\n if (checkParams(source.datum_type)) {\n point = geocentricToWgs84(point, source.datum_type, source.datum_params);\n }\n if (checkParams(dest.datum_type)) {\n point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n }\n point = geocentricToGeodetic(point, dest_es, dest_a, dest_b);\n\n if (dest.datum_type === PJD_GRIDSHIFT) {\n var destGridShiftResult = applyGridShift(dest, true, point);\n if (destGridShiftResult !== 0) {\n return undefined;\n }\n }\n\n return point;\n}\n\nexport function applyGridShift(source, inverse, point) {\n if (source.grids === null || source.grids.length === 0) {\n console.log('Grid shift grids not found');\n return -1;\n }\n var input = {x: -point.x, y: point.y};\n var output = {x: Number.NaN, y: Number.NaN};\n var onlyMandatoryGrids = false;\n var attemptedGrids = [];\n outer:\n for (var i = 0; i < source.grids.length; i++) {\n var grid = source.grids[i];\n attemptedGrids.push(grid.name);\n if (grid.isNull) {\n output = input;\n break;\n }\n onlyMandatoryGrids = grid.mandatory;\n if (grid.grid === null) {\n if (grid.mandatory) {\n console.log(\"Unable to find mandatory grid '\" + grid.name + \"'\");\n return -1;\n }\n continue;\n }\n var subgrids = grid.grid.subgrids;\n for (var j = 0, jj = subgrids.length; j < jj; j++) {\n var subgrid = subgrids[j];\n // skip tables that don't match our point at all\n var epsilon = (Math.abs(subgrid.del[1]) + Math.abs(subgrid.del[0])) / 10000.0;\n var minX = subgrid.ll[0] - epsilon;\n var minY = subgrid.ll[1] - epsilon;\n var maxX = subgrid.ll[0] + (subgrid.lim[0] - 1) * subgrid.del[0] + epsilon;\n var maxY = subgrid.ll[1] + (subgrid.lim[1] - 1) * subgrid.del[1] + epsilon;\n if (minY > input.y || minX > input.x || maxY < input.y || maxX < input.x ) {\n continue;\n }\n output = applySubgridShift(input, inverse, subgrid);\n if (!isNaN(output.x)) {\n break outer;\n }\n }\n }\n if (isNaN(output.x)) {\n console.log(\"Failed to find a grid shift table for location '\"+\n -input.x * R2D + \" \" + input.y * R2D + \" tried: '\" + attemptedGrids + \"'\");\n return -1;\n }\n point.x = -output.x;\n point.y = output.y;\n return 0;\n}\n\nfunction applySubgridShift(pin, inverse, ct) {\n var val = {x: Number.NaN, y: Number.NaN};\n if (isNaN(pin.x)) { return val; }\n var tb = {x: pin.x, y: pin.y};\n tb.x -= ct.ll[0];\n tb.y -= ct.ll[1];\n tb.x = adjust_lon(tb.x - Math.PI) + Math.PI;\n var t = nadInterpolate(tb, ct);\n if (inverse) {\n if (isNaN(t.x)) {\n return val;\n }\n t.x = tb.x - t.x;\n t.y = tb.y - t.y;\n var i = 9, tol = 1e-12;\n var dif, del;\n do {\n del = nadInterpolate(t, ct);\n if (isNaN(del.x)) {\n console.log(\"Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.\");\n break;\n }\n dif = {x: tb.x - (del.x + t.x), y: tb.y - (del.y + t.y)};\n t.x += dif.x;\n t.y += dif.y;\n } while (i-- && Math.abs(dif.x) > tol && Math.abs(dif.y) > tol);\n if (i < 0) {\n console.log(\"Inverse grid shift iterator failed to converge.\");\n return val;\n }\n val.x = adjust_lon(t.x + ct.ll[0]);\n val.y = t.y + ct.ll[1];\n } else {\n if (!isNaN(t.x)) {\n val.x = pin.x + t.x;\n val.y = pin.y + t.y;\n }\n }\n return val;\n}\n\nfunction nadInterpolate(pin, ct) {\n var t = {x: pin.x / ct.del[0], y: pin.y / ct.del[1]};\n var indx = {x: Math.floor(t.x), y: Math.floor(t.y)};\n var frct = {x: t.x - 1.0 * indx.x, y: t.y - 1.0 * indx.y};\n var val= {x: Number.NaN, y: Number.NaN};\n var inx;\n if (indx.x < 0 || indx.x >= ct.lim[0]) {\n return val;\n }\n if (indx.y < 0 || indx.y >= ct.lim[1]) {\n return val;\n }\n inx = (indx.y * ct.lim[0]) + indx.x;\n var f00 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};\n inx++;\n var f10= {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};\n inx += ct.lim[0];\n var f11 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};\n inx--;\n var f01 = {x: ct.cvs[inx][0], y: ct.cvs[inx][1]};\n var m11 = frct.x * frct.y, m10 = frct.x * (1.0 - frct.y),\n m00 = (1.0 - frct.x) * (1.0 - frct.y), m01 = (1.0 - frct.x) * frct.y;\n val.x = (m00 * f00.x + m10 * f10.x + m01 * f01.x + m11 * f11.x);\n val.y = (m00 * f00.y + m10 * f10.y + m01 * f01.y + m11 * f11.y);\n return val;\n}\n","export default function(crs, denorm, point) {\n var xin = point.x,\n yin = point.y,\n zin = point.z || 0.0;\n var v, t, i;\n var out = {};\n for (i = 0; i < 3; i++) {\n if (denorm && i === 2 && point.z === undefined) {\n continue;\n }\n if (i === 0) {\n v = xin;\n if (\"ew\".indexOf(crs.axis[i]) !== -1) {\n t = 'x';\n } else {\n t = 'y';\n }\n\n }\n else if (i === 1) {\n v = yin;\n if (\"ns\".indexOf(crs.axis[i]) !== -1) {\n t = 'y';\n } else {\n t = 'x';\n }\n }\n else {\n v = zin;\n t = 'z';\n }\n switch (crs.axis[i]) {\n case 'e':\n out[t] = v;\n break;\n case 'w':\n out[t] = -v;\n break;\n case 'n':\n out[t] = v;\n break;\n case 's':\n out[t] = -v;\n break;\n case 'u':\n if (point[t] !== undefined) {\n out.z = v;\n }\n break;\n case 'd':\n if (point[t] !== undefined) {\n out.z = -v;\n }\n break;\n default:\n //console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n return null;\n }\n }\n return out;\n}\n","export default function (array){\n var out = {\n x: array[0],\n y: array[1]\n };\n if (array.length>2) {\n out.z = array[2];\n }\n if (array.length>3) {\n out.m = array[3];\n }\n return out;\n}","export default function (point) {\n checkCoord(point.x);\n checkCoord(point.y);\n}\nfunction checkCoord(num) {\n if (typeof Number.isFinite === 'function') {\n if (Number.isFinite(num)) {\n return;\n }\n throw new TypeError('coordinates must be finite numbers');\n }\n if (typeof num !== 'number' || num !== num || !isFinite(num)) {\n throw new TypeError('coordinates must be finite numbers');\n }\n}\n","import {D2R, R2D, PJD_3PARAM, PJD_7PARAM, PJD_GRIDSHIFT} from './constants/values';\nimport datum_transform from './datum_transform';\nimport adjust_axis from './adjust_axis';\nimport proj from './Proj';\nimport toPoint from './common/toPoint';\nimport checkSanity from './checkSanity';\n\nfunction checkNotWGS(source, dest) {\n return (\n (source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM || source.datum.datum_type === PJD_GRIDSHIFT) && dest.datumCode !== 'WGS84') ||\n ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM || dest.datum.datum_type === PJD_GRIDSHIFT) && source.datumCode !== 'WGS84');\n}\n\nexport default function transform(source, dest, point, enforceAxis) {\n var wgs84;\n if (Array.isArray(point)) {\n point = toPoint(point);\n } else {\n // Clone the point object so inputs don't get modified\n point = {\n x: point.x,\n y: point.y,\n z: point.z,\n m: point.m\n };\n }\n var hasZ = point.z !== undefined;\n checkSanity(point);\n // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n wgs84 = new proj('WGS84');\n point = transform(source, wgs84, point, enforceAxis);\n source = wgs84;\n }\n // DGR, 2010/11/12\n if (enforceAxis && source.axis !== 'enu') {\n point = adjust_axis(source, false, point);\n }\n // Transform source points to long/lat, if they aren't already.\n if (source.projName === 'longlat') {\n point = {\n x: point.x * D2R,\n y: point.y * D2R,\n z: point.z || 0\n };\n } else {\n if (source.to_meter) {\n point = {\n x: point.x * source.to_meter,\n y: point.y * source.to_meter,\n z: point.z || 0\n };\n }\n point = source.inverse(point); // Convert Cartesian to longlat\n if (!point) {\n return;\n }\n }\n // Adjust for the prime meridian if necessary\n if (source.from_greenwich) {\n point.x += source.from_greenwich;\n }\n\n // Convert datums if needed, and if possible.\n point = datum_transform(source.datum, dest.datum, point);\n if (!point) {\n return;\n }\n\n // Adjust for the prime meridian if necessary\n if (dest.from_greenwich) {\n point = {\n x: point.x - dest.from_greenwich,\n y: point.y,\n z: point.z || 0\n };\n }\n\n if (dest.projName === 'longlat') {\n // convert radians to decimal degrees\n point = {\n x: point.x * R2D,\n y: point.y * R2D,\n z: point.z || 0\n };\n } else { // else project\n point = dest.forward(point);\n if (dest.to_meter) {\n point = {\n x: point.x / dest.to_meter,\n y: point.y / dest.to_meter,\n z: point.z || 0\n };\n }\n }\n\n // DGR, 2010/11/12\n if (enforceAxis && dest.axis !== 'enu') {\n return adjust_axis(dest, true, point);\n }\n\n if (point && !hasZ) {\n delete point.z;\n }\n return point;\n}\n","import proj from './Proj';\nimport transform from './transform';\nvar wgs84 = proj('WGS84');\n\nfunction transformer(from, to, coords, enforceAxis) {\n var transformedArray, out, keys;\n if (Array.isArray(coords)) {\n transformedArray = transform(from, to, coords, enforceAxis) || {x: NaN, y: NaN};\n if (coords.length > 2) {\n if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n if (typeof transformedArray.z === 'number') {\n return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));\n } else {\n return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));\n }\n } else {\n return [transformedArray.x, transformedArray.y].concat(coords.splice(2));\n }\n } else {\n return [transformedArray.x, transformedArray.y];\n }\n } else {\n out = transform(from, to, coords, enforceAxis);\n keys = Object.keys(coords);\n if (keys.length === 2) {\n return out;\n }\n keys.forEach(function (key) {\n if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {\n if (key === 'x' || key === 'y' || key === 'z') {\n return;\n }\n } else {\n if (key === 'x' || key === 'y') {\n return;\n }\n }\n out[key] = coords[key];\n });\n return out;\n }\n}\n\nfunction checkProj(item) {\n if (item instanceof proj) {\n return item;\n }\n if (item.oProj) {\n return item.oProj;\n }\n return proj(item);\n}\n\nfunction proj4(fromProj, toProj, coord) {\n fromProj = checkProj(fromProj);\n var single = false;\n var obj;\n if (typeof toProj === 'undefined') {\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {\n coord = toProj;\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n }\n toProj = checkProj(toProj);\n if (coord) {\n return transformer(fromProj, toProj, coord);\n } else {\n obj = {\n forward: function (coords, enforceAxis) {\n return transformer(fromProj, toProj, coords, enforceAxis);\n },\n inverse: function (coords, enforceAxis) {\n return transformer(toProj, fromProj, coords, enforceAxis);\n }\n };\n if (single) {\n obj.oProj = toProj;\n }\n return obj;\n }\n}\nexport default proj4;","\n\n\n/**\n * UTM zones are grouped, and assigned to one of a group of 6\n * sets.\n *\n * {int} @private\n */\nvar NUM_100K_SETS = 6;\n\n/**\n * The column letters (for easting) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';\n\n/**\n * The row letters (for northing) of the lower left value, per\n * set.\n *\n * {string} @private\n */\nvar SET_ORIGIN_ROW_LETTERS = 'AFAFAF';\n\nvar A = 65; // A\nvar I = 73; // I\nvar O = 79; // O\nvar V = 86; // V\nvar Z = 90; // Z\nexport default {\n forward: forward,\n inverse: inverse,\n toPoint: toPoint\n};\n/**\n * Conversion of lat/lon to MGRS.\n *\n * @param {object} ll Object literal with lat and lon properties on a\n * WGS84 ellipsoid.\n * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for\n * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.\n * @return {string} the MGRS string for the given location and accuracy.\n */\nexport function forward(ll, accuracy) {\n accuracy = accuracy || 5; // default accuracy 1m\n return encode(LLtoUTM({\n lat: ll[1],\n lon: ll[0]\n }), accuracy);\n};\n\n/**\n * Conversion of MGRS to lat/lon.\n *\n * @param {string} mgrs MGRS string.\n * @return {array} An array with left (longitude), bottom (latitude), right\n * (longitude) and top (latitude) values in WGS84, representing the\n * bounding box for the provided MGRS reference.\n */\nexport function inverse(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];\n }\n return [bbox.left, bbox.bottom, bbox.right, bbox.top];\n};\n\nexport function toPoint(mgrs) {\n var bbox = UTMtoLL(decode(mgrs.toUpperCase()));\n if (bbox.lat && bbox.lon) {\n return [bbox.lon, bbox.lat];\n }\n return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];\n};\n/**\n * Conversion from degrees to radians.\n *\n * @private\n * @param {number} deg the angle in degrees.\n * @return {number} the angle in radians.\n */\nfunction degToRad(deg) {\n return (deg * (Math.PI / 180.0));\n}\n\n/**\n * Conversion from radians to degrees.\n *\n * @private\n * @param {number} rad the angle in radians.\n * @return {number} the angle in degrees.\n */\nfunction radToDeg(rad) {\n return (180.0 * (rad / Math.PI));\n}\n\n/**\n * Converts a set of Longitude and Latitude co-ordinates to UTM\n * using the WGS84 ellipsoid.\n *\n * @private\n * @param {object} ll Object literal with lat and lon properties\n * representing the WGS84 coordinate to be converted.\n * @return {object} Object literal containing the UTM value with easting,\n * northing, zoneNumber and zoneLetter properties, and an optional\n * accuracy property in digits. Returns null if the conversion failed.\n */\nfunction LLtoUTM(ll) {\n var Lat = ll.lat;\n var Long = ll.lon;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var k0 = 0.9996;\n var LongOrigin;\n var eccPrimeSquared;\n var N, T, C, A, M;\n var LatRad = degToRad(Lat);\n var LongRad = degToRad(Long);\n var LongOriginRad;\n var ZoneNumber;\n // (int)\n ZoneNumber = Math.floor((Long + 180) / 6) + 1;\n\n //Make sure the longitude 180.00 is in Zone 60\n if (Long === 180) {\n ZoneNumber = 60;\n }\n\n // Special zone for Norway\n if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {\n ZoneNumber = 32;\n }\n\n // Special zones for Svalbard\n if (Lat >= 72.0 && Lat < 84.0) {\n if (Long >= 0.0 && Long < 9.0) {\n ZoneNumber = 31;\n }\n else if (Long >= 9.0 && Long < 21.0) {\n ZoneNumber = 33;\n }\n else if (Long >= 21.0 && Long < 33.0) {\n ZoneNumber = 35;\n }\n else if (Long >= 33.0 && Long < 42.0) {\n ZoneNumber = 37;\n }\n }\n\n LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin\n // in middle of\n // zone\n LongOriginRad = degToRad(LongOrigin);\n\n eccPrimeSquared = (eccSquared) / (1 - eccSquared);\n\n N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));\n T = Math.tan(LatRad) * Math.tan(LatRad);\n C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);\n A = Math.cos(LatRad) * (LongRad - LongOriginRad);\n\n M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));\n\n var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);\n\n var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));\n if (Lat < 0.0) {\n UTMNorthing += 10000000.0; //10000000 meter offset for\n // southern hemisphere\n }\n\n return {\n northing: Math.round(UTMNorthing),\n easting: Math.round(UTMEasting),\n zoneNumber: ZoneNumber,\n zoneLetter: getLetterDesignator(Lat)\n };\n}\n\n/**\n * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience\n * class where the Zone can be specified as a single string eg.\"60N\" which\n * is then broken down into the ZoneNumber and ZoneLetter.\n *\n * @private\n * @param {object} utm An object literal with northing, easting, zoneNumber\n * and zoneLetter properties. If an optional accuracy property is\n * provided (in meters), a bounding box will be returned instead of\n * latitude and longitude.\n * @return {object} An object literal containing either lat and lon values\n * (if no accuracy was provided), or top, right, bottom and left values\n * for the bounding box calculated according to the provided accuracy.\n * Returns null if the conversion failed.\n */\nfunction UTMtoLL(utm) {\n\n var UTMNorthing = utm.northing;\n var UTMEasting = utm.easting;\n var zoneLetter = utm.zoneLetter;\n var zoneNumber = utm.zoneNumber;\n // check the ZoneNummber is valid\n if (zoneNumber < 0 || zoneNumber > 60) {\n return null;\n }\n\n var k0 = 0.9996;\n var a = 6378137.0; //ellip.radius;\n var eccSquared = 0.00669438; //ellip.eccsq;\n var eccPrimeSquared;\n var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));\n var N1, T1, C1, R1, D, M;\n var LongOrigin;\n var mu, phi1Rad;\n\n // remove 500,000 meter offset for longitude\n var x = UTMEasting - 500000.0;\n var y = UTMNorthing;\n\n // We must know somehow if we are in the Northern or Southern\n // hemisphere, this is the only time we use the letter So even\n // if the Zone letter isn't exactly correct it should indicate\n // the hemisphere correctly\n if (zoneLetter < 'N') {\n y -= 10000000.0; // remove 10,000,000 meter offset used\n // for southern hemisphere\n }\n\n // There are 60 zones with zone 1 being at West -180 to -174\n LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin\n // in middle of\n // zone\n\n eccPrimeSquared = (eccSquared) / (1 - eccSquared);\n\n M = y / k0;\n mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));\n\n phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);\n // double phi1 = ProjMath.radToDeg(phi1Rad);\n\n N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));\n T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);\n C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);\n R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);\n D = x / (N1 * k0);\n\n var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);\n lat = radToDeg(lat);\n\n var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);\n lon = LongOrigin + radToDeg(lon);\n\n var result;\n if (utm.accuracy) {\n var topRight = UTMtoLL({\n northing: utm.northing + utm.accuracy,\n easting: utm.easting + utm.accuracy,\n zoneLetter: utm.zoneLetter,\n zoneNumber: utm.zoneNumber\n });\n result = {\n top: topRight.lat,\n right: topRight.lon,\n bottom: lat,\n left: lon\n };\n }\n else {\n result = {\n lat: lat,\n lon: lon\n };\n }\n return result;\n}\n\n/**\n * Calculates the MGRS letter designator for the given latitude.\n *\n * @private\n * @param {number} lat The latitude in WGS84 to get the letter designator\n * for.\n * @return {char} The letter designator.\n */\nfunction getLetterDesignator(lat) {\n //This is here as an error flag to show that the Latitude is\n //outside MGRS limits\n var LetterDesignator = 'Z';\n\n if ((84 >= lat) && (lat >= 72)) {\n LetterDesignator = 'X';\n }\n else if ((72 > lat) && (lat >= 64)) {\n LetterDesignator = 'W';\n }\n else if ((64 > lat) && (lat >= 56)) {\n LetterDesignator = 'V';\n }\n else if ((56 > lat) && (lat >= 48)) {\n LetterDesignator = 'U';\n }\n else if ((48 > lat) && (lat >= 40)) {\n LetterDesignator = 'T';\n }\n else if ((40 > lat) && (lat >= 32)) {\n LetterDesignator = 'S';\n }\n else if ((32 > lat) && (lat >= 24)) {\n LetterDesignator = 'R';\n }\n else if ((24 > lat) && (lat >= 16)) {\n LetterDesignator = 'Q';\n }\n else if ((16 > lat) && (lat >= 8)) {\n LetterDesignator = 'P';\n }\n else if ((8 > lat) && (lat >= 0)) {\n LetterDesignator = 'N';\n }\n else if ((0 > lat) && (lat >= -8)) {\n LetterDesignator = 'M';\n }\n else if ((-8 > lat) && (lat >= -16)) {\n LetterDesignator = 'L';\n }\n else if ((-16 > lat) && (lat >= -24)) {\n LetterDesignator = 'K';\n }\n else if ((-24 > lat) && (lat >= -32)) {\n LetterDesignator = 'J';\n }\n else if ((-32 > lat) && (lat >= -40)) {\n LetterDesignator = 'H';\n }\n else if ((-40 > lat) && (lat >= -48)) {\n LetterDesignator = 'G';\n }\n else if ((-48 > lat) && (lat >= -56)) {\n LetterDesignator = 'F';\n }\n else if ((-56 > lat) && (lat >= -64)) {\n LetterDesignator = 'E';\n }\n else if ((-64 > lat) && (lat >= -72)) {\n LetterDesignator = 'D';\n }\n else if ((-72 > lat) && (lat >= -80)) {\n LetterDesignator = 'C';\n }\n return LetterDesignator;\n}\n\n/**\n * Encodes a UTM location as MGRS string.\n *\n * @private\n * @param {object} utm An object literal with easting, northing,\n * zoneLetter, zoneNumber\n * @param {number} accuracy Accuracy in digits (1-5).\n * @return {string} MGRS string for the given UTM location.\n */\nfunction encode(utm, accuracy) {\n // prepend with leading zeroes\n var seasting = \"00000\" + utm.easting,\n snorthing = \"00000\" + utm.northing;\n\n return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);\n}\n\n/**\n * Get the two letter 100k designator for a given UTM easting,\n * northing and zone number value.\n *\n * @private\n * @param {number} easting\n * @param {number} northing\n * @param {number} zoneNumber\n * @return the two letter 100k designator for the given UTM location.\n */\nfunction get100kID(easting, northing, zoneNumber) {\n var setParm = get100kSetForZone(zoneNumber);\n var setColumn = Math.floor(easting / 100000);\n var setRow = Math.floor(northing / 100000) % 20;\n return getLetter100kID(setColumn, setRow, setParm);\n}\n\n/**\n * Given a UTM zone number, figure out the MGRS 100K set it is in.\n *\n * @private\n * @param {number} i An UTM zone number.\n * @return {number} the 100k set the UTM zone is in.\n */\nfunction get100kSetForZone(i) {\n var setParm = i % NUM_100K_SETS;\n if (setParm === 0) {\n setParm = NUM_100K_SETS;\n }\n\n return setParm;\n}\n\n/**\n * Get the two-letter MGRS 100k designator given information\n * translated from the UTM northing, easting and zone number.\n *\n * @private\n * @param {number} column the column index as it relates to the MGRS\n * 100k set spreadsheet, created from the UTM easting.\n * Values are 1-8.\n * @param {number} row the row index as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM northing value. Values\n * are from 0-19.\n * @param {number} parm the set block, as it relates to the MGRS 100k set\n * spreadsheet, created from the UTM zone. Values are from\n * 1-60.\n * @return two letter MGRS 100k code.\n */\nfunction getLetter100kID(column, row, parm) {\n // colOrigin and rowOrigin are the letters at the origin of the set\n var index = parm - 1;\n var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);\n var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);\n\n // colInt and rowInt are the letters to build to return\n var colInt = colOrigin + column - 1;\n var rowInt = rowOrigin + row;\n var rollover = false;\n\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n rollover = true;\n }\n\n if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {\n colInt++;\n }\n\n if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {\n colInt++;\n\n if (colInt === I) {\n colInt++;\n }\n }\n\n if (colInt > Z) {\n colInt = colInt - Z + A - 1;\n }\n\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n rollover = true;\n }\n else {\n rollover = false;\n }\n\n if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {\n rowInt++;\n }\n\n if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {\n rowInt++;\n\n if (rowInt === I) {\n rowInt++;\n }\n }\n\n if (rowInt > V) {\n rowInt = rowInt - V + A - 1;\n }\n\n var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);\n return twoLetter;\n}\n\n/**\n * Decode the UTM parameters from a MGRS string.\n *\n * @private\n * @param {string} mgrsString an UPPERCASE coordinate string is expected.\n * @return {object} An object literal with easting, northing, zoneLetter,\n * zoneNumber and accuracy (in meters) properties.\n */\nfunction decode(mgrsString) {\n\n if (mgrsString && mgrsString.length === 0) {\n throw (\"MGRSPoint coverting from nothing\");\n }\n\n var length = mgrsString.length;\n\n var hunK = null;\n var sb = \"\";\n var testChar;\n var i = 0;\n\n // get Zone number\n while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {\n if (i >= 2) {\n throw (\"MGRSPoint bad conversion from: \" + mgrsString);\n }\n sb += testChar;\n i++;\n }\n\n var zoneNumber = parseInt(sb, 10);\n\n if (i === 0 || i + 3 > length) {\n // A good MGRS string has to be 4-5 digits long,\n // ##AAA/#AAA at least.\n throw (\"MGRSPoint bad conversion from: \" + mgrsString);\n }\n\n var zoneLetter = mgrsString.charAt(i++);\n\n // Should we check the zone letter here? Why not.\n if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {\n throw (\"MGRSPoint zone letter \" + zoneLetter + \" not handled: \" + mgrsString);\n }\n\n hunK = mgrsString.substring(i, i += 2);\n\n var set = get100kSetForZone(zoneNumber);\n\n var east100k = getEastingFromChar(hunK.charAt(0), set);\n var north100k = getNorthingFromChar(hunK.charAt(1), set);\n\n // We have a bug where the northing may be 2000000 too low.\n // How\n // do we know when to roll over?\n\n while (north100k < getMinNorthing(zoneLetter)) {\n north100k += 2000000;\n }\n\n // calculate the char index for easting/northing separator\n var remainder = length - i;\n\n if (remainder % 2 !== 0) {\n throw (\"MGRSPoint has to have an even number \\nof digits after the zone letter and two 100km letters - front \\nhalf for easting meters, second half for \\nnorthing meters\" + mgrsString);\n }\n\n var sep = remainder / 2;\n\n var sepEasting = 0.0;\n var sepNorthing = 0.0;\n var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;\n if (sep > 0) {\n accuracyBonus = 100000.0 / Math.pow(10, sep);\n sepEastingString = mgrsString.substring(i, i + sep);\n sepEasting = parseFloat(sepEastingString) * accuracyBonus;\n sepNorthingString = mgrsString.substring(i + sep);\n sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;\n }\n\n easting = sepEasting + east100k;\n northing = sepNorthing + north100k;\n\n return {\n easting: easting,\n northing: northing,\n zoneLetter: zoneLetter,\n zoneNumber: zoneNumber,\n accuracy: accuracyBonus\n };\n}\n\n/**\n * Given the first letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the easting value that\n * should be added to the other, secondary easting value.\n *\n * @private\n * @param {char} e The first letter from a two-letter MGRS 100´k zone.\n * @param {number} set The MGRS table set for the zone number.\n * @return {number} The easting value for the given letter and set.\n */\nfunction getEastingFromChar(e, set) {\n // colOrigin is the letter at the origin of the set for the\n // column\n var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);\n var eastingValue = 100000.0;\n var rewindMarker = false;\n\n while (curCol !== e.charCodeAt(0)) {\n curCol++;\n if (curCol === I) {\n curCol++;\n }\n if (curCol === O) {\n curCol++;\n }\n if (curCol > Z) {\n if (rewindMarker) {\n throw (\"Bad character: \" + e);\n }\n curCol = A;\n rewindMarker = true;\n }\n eastingValue += 100000.0;\n }\n\n return eastingValue;\n}\n\n/**\n * Given the second letter from a two-letter MGRS 100k zone, and given the\n * MGRS table set for the zone number, figure out the northing value that\n * should be added to the other, secondary northing value. You have to\n * remember that Northings are determined from the equator, and the vertical\n * cycle of letters mean a 2000000 additional northing meters. This happens\n * approx. every 18 degrees of latitude. This method does *NOT* count any\n * additional northings. You have to figure out how many 2000000 meters need\n * to be added for the zone letter of the MGRS coordinate.\n *\n * @private\n * @param {char} n Second letter of the MGRS 100k zone\n * @param {number} set The MGRS table set number, which is dependent on the\n * UTM zone number.\n * @return {number} The northing value for the given letter and set.\n */\nfunction getNorthingFromChar(n, set) {\n\n if (n > 'V') {\n throw (\"MGRSPoint given invalid Northing \" + n);\n }\n\n // rowOrigin is the letter at the origin of the set for the\n // column\n var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);\n var northingValue = 0.0;\n var rewindMarker = false;\n\n while (curRow !== n.charCodeAt(0)) {\n curRow++;\n if (curRow === I) {\n curRow++;\n }\n if (curRow === O) {\n curRow++;\n }\n // fixing a bug making whole application hang in this loop\n // when 'n' is a wrong character\n if (curRow > V) {\n if (rewindMarker) { // making sure that this loop ends\n throw (\"Bad character: \" + n);\n }\n curRow = A;\n rewindMarker = true;\n }\n northingValue += 100000.0;\n }\n\n return northingValue;\n}\n\n/**\n * The function getMinNorthing returns the minimum northing value of a MGRS\n * zone.\n *\n * Ported from Geotrans' c Lattitude_Band_Value structure table.\n *\n * @private\n * @param {char} zoneLetter The MGRS zone to get the min northing for.\n * @return {number}\n */\nfunction getMinNorthing(zoneLetter) {\n var northing;\n switch (zoneLetter) {\n case 'C':\n northing = 1100000.0;\n break;\n case 'D':\n northing = 2000000.0;\n break;\n case 'E':\n northing = 2800000.0;\n break;\n case 'F':\n northing = 3700000.0;\n break;\n case 'G':\n northing = 4600000.0;\n break;\n case 'H':\n northing = 5500000.0;\n break;\n case 'J':\n northing = 6400000.0;\n break;\n case 'K':\n northing = 7300000.0;\n break;\n case 'L':\n northing = 8200000.0;\n break;\n case 'M':\n northing = 9100000.0;\n break;\n case 'N':\n northing = 0.0;\n break;\n case 'P':\n northing = 800000.0;\n break;\n case 'Q':\n northing = 1700000.0;\n break;\n case 'R':\n northing = 2600000.0;\n break;\n case 'S':\n northing = 3500000.0;\n break;\n case 'T':\n northing = 4400000.0;\n break;\n case 'U':\n northing = 5300000.0;\n break;\n case 'V':\n northing = 6200000.0;\n break;\n case 'W':\n northing = 7000000.0;\n break;\n case 'X':\n northing = 7900000.0;\n break;\n default:\n northing = -1.0;\n }\n if (northing >= 0.0) {\n return northing;\n }\n else {\n throw (\"Invalid zone letter: \" + zoneLetter);\n }\n\n}\n","import {toPoint, forward} from 'mgrs';\n\nfunction Point(x, y, z) {\n if (!(this instanceof Point)) {\n return new Point(x, y, z);\n }\n if (Array.isArray(x)) {\n this.x = x[0];\n this.y = x[1];\n this.z = x[2] || 0.0;\n } else if(typeof x === 'object') {\n this.x = x.x;\n this.y = x.y;\n this.z = x.z || 0.0;\n } else if (typeof x === 'string' && typeof y === 'undefined') {\n var coords = x.split(',');\n this.x = parseFloat(coords[0], 10);\n this.y = parseFloat(coords[1], 10);\n this.z = parseFloat(coords[2], 10) || 0.0;\n } else {\n this.x = x;\n this.y = y;\n this.z = z || 0.0;\n }\n console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');\n}\n\nPoint.fromMGRS = function(mgrsStr) {\n return new Point(toPoint(mgrsStr));\n};\nPoint.prototype.toMGRS = function(accuracy) {\n return forward([this.x, this.y], accuracy);\n};\nexport default Point;\n","var C00 = 1;\nvar C02 = 0.25;\nvar C04 = 0.046875;\nvar C06 = 0.01953125;\nvar C08 = 0.01068115234375;\nvar C22 = 0.75;\nvar C44 = 0.46875;\nvar C46 = 0.01302083333333333333;\nvar C48 = 0.00712076822916666666;\nvar C66 = 0.36458333333333333333;\nvar C68 = 0.00569661458333333333;\nvar C88 = 0.3076171875;\n\nexport default function(es) {\n var en = [];\n en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));\n en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));\n var t = es * es;\n en[2] = t * (C44 - es * (C46 + es * C48));\n t *= es;\n en[3] = t * (C66 - es * C68);\n en[4] = t * es * C88;\n return en;\n}","export default function(phi, sphi, cphi, en) {\n cphi *= sphi;\n sphi *= sphi;\n return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));\n}","import pj_mlfn from \"./pj_mlfn\";\nimport {EPSLN} from '../constants/values';\n\nvar MAX_ITER = 20;\n\nexport default function(arg, es, en) {\n var k = 1 / (1 - es);\n var phi = arg;\n for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */\n var s = Math.sin(phi);\n var t = 1 - es * s * s;\n //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;\n //phi -= t * (t * Math.sqrt(t)) * k;\n t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;\n phi -= t;\n if (Math.abs(t) < EPSLN) {\n return phi;\n }\n }\n //..reportError(\"cass:pj_inv_mlfn: Convergence error\");\n return phi;\n}\n","// Heavily based on this tmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js\n\nimport pj_enfn from '../common/pj_enfn';\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport adjust_lon from '../common/adjust_lon';\n\nimport {EPSLN, HALF_PI} from '../constants/values';\nimport sign from '../common/sign';\n\nexport function init() {\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n\n if (this.es) {\n this.en = pj_enfn(this.es);\n this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);\n }\n}\n\n/**\n Transverse Mercator Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n var delta_lon = adjust_lon(lon - this.long0);\n var con;\n var x, y;\n var sin_phi = Math.sin(lat);\n var cos_phi = Math.cos(lat);\n\n if (!this.es) {\n var b = cos_phi * Math.sin(delta_lon);\n\n if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {\n return (93);\n }\n else {\n x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;\n y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));\n b = Math.abs(y);\n\n if (b >= 1) {\n if ((b - 1) > EPSLN) {\n return (93);\n }\n else {\n y = 0;\n }\n }\n else {\n y = Math.acos(y);\n }\n\n if (lat < 0) {\n y = -y;\n }\n\n y = this.a * this.k0 * (y - this.lat0) + this.y0;\n }\n }\n else {\n var al = cos_phi * delta_lon;\n var als = Math.pow(al, 2);\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;\n var t = Math.pow(tq, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n al = al / Math.sqrt(con);\n var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);\n\n x = this.a * (this.k0 * al * (1 +\n als / 6 * (1 - t + c +\n als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +\n als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +\n this.x0;\n\n y = this.a * (this.k0 * (ml - this.ml0 +\n sin_phi * delta_lon * al / 2 * (1 +\n als / 12 * (5 - t + 9 * c + 4 * cs +\n als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +\n als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +\n this.y0;\n }\n\n p.x = x;\n p.y = y;\n\n return p;\n}\n\n/**\n Transverse Mercator Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var con, phi;\n var lat, lon;\n var x = (p.x - this.x0) * (1 / this.a);\n var y = (p.y - this.y0) * (1 / this.a);\n\n if (!this.es) {\n var f = Math.exp(x / this.k0);\n var g = 0.5 * (f - 1 / f);\n var temp = this.lat0 + y / this.k0;\n var h = Math.cos(temp);\n con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));\n lat = Math.asin(con);\n\n if (y < 0) {\n lat = -lat;\n }\n\n if ((g === 0) && (h === 0)) {\n lon = 0;\n }\n else {\n lon = adjust_lon(Math.atan2(g, h) + this.long0);\n }\n }\n else { // ellipsoidal form\n con = this.ml0 + y / this.k0;\n phi = pj_inv_mlfn(con, this.es, this.en);\n\n if (Math.abs(phi) < HALF_PI) {\n var sin_phi = Math.sin(phi);\n var cos_phi = Math.cos(phi);\n var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;\n var c = this.ep2 * Math.pow(cos_phi, 2);\n var cs = Math.pow(c, 2);\n var t = Math.pow(tan_phi, 2);\n var ts = Math.pow(t, 2);\n con = 1 - this.es * Math.pow(sin_phi, 2);\n var d = x * Math.sqrt(con) / this.k0;\n var ds = Math.pow(d, 2);\n con = con * tan_phi;\n\n lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -\n ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -\n ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -\n ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));\n\n lon = adjust_lon(this.long0 + (d * (1 -\n ds / 6 * (1 + 2 * t + c -\n ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -\n ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));\n }\n else {\n lat = HALF_PI * sign(y);\n lon = 0;\n }\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = [\"Fast_Transverse_Mercator\", \"Fast Transverse Mercator\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function(x) {\n var r = Math.exp(x);\n r = (r - 1 / r) / 2;\n return r;\n}","export default function(x, y) {\n x = Math.abs(x);\n y = Math.abs(y);\n var a = Math.max(x, y);\n var b = Math.min(x, y) / (a ? a : 1);\n\n return a * Math.sqrt(1 + Math.pow(b, 2));\n}\n","import hypot from './hypot';\nimport log1py from './log1py';\n\nexport default function(x) {\n var y = Math.abs(x);\n y = log1py(y * (1 + y / (hypot(1, y) + 1)));\n\n return x < 0 ? -y : y;\n}\n","export default function(x) {\n var y = 1 + x;\n var z = y - 1;\n\n return z === 0 ? x : x * Math.log(y) / z;\n}\n","export default function(pp, B) {\n var cos_2B = 2 * Math.cos(2 * B);\n var i = pp.length - 1;\n var h1 = pp[i];\n var h2 = 0;\n var h;\n\n while (--i >= 0) {\n h = -h2 + cos_2B * h1 + pp[i];\n h2 = h1;\n h1 = h;\n }\n\n return (B + h * Math.sin(2 * B));\n}\n","import sinh from './sinh';\nimport cosh from './cosh';\n\nexport default function(pp, arg_r, arg_i) {\n var sin_arg_r = Math.sin(arg_r);\n var cos_arg_r = Math.cos(arg_r);\n var sinh_arg_i = sinh(arg_i);\n var cosh_arg_i = cosh(arg_i);\n var r = 2 * cos_arg_r * cosh_arg_i;\n var i = -2 * sin_arg_r * sinh_arg_i;\n var j = pp.length - 1;\n var hr = pp[j];\n var hi1 = 0;\n var hr1 = 0;\n var hi = 0;\n var hr2;\n var hi2;\n\n while (--j >= 0) {\n hr2 = hr1;\n hi2 = hi1;\n hr1 = hr;\n hi1 = hi;\n hr = -hr2 + r * hr1 - i * hi1 + pp[j];\n hi = -hi2 + i * hr1 + r * hi1;\n }\n\n r = sin_arg_r * cosh_arg_i;\n i = cos_arg_r * sinh_arg_i;\n\n return [r * hr - i * hi, r * hi + i * hr];\n}\n","export default function(x) {\n var r = Math.exp(x);\n r = (r + 1 / r) / 2;\n return r;\n}","// Heavily based on this etmerc projection implementation\n// https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js\n\nimport tmerc from '../projections/tmerc';\nimport sinh from '../common/sinh';\nimport hypot from '../common/hypot';\nimport asinhy from '../common/asinhy';\nimport gatg from '../common/gatg';\nimport clens from '../common/clens';\nimport clens_cmplx from '../common/clens_cmplx';\nimport adjust_lon from '../common/adjust_lon';\n\nexport function init() {\n if (!this.approx && (isNaN(this.es) || this.es <= 0)) {\n throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION[\"Fast_Transverse_Mercator\"] in the WKT.');\n }\n if (this.approx) {\n // When '+approx' is set, use tmerc instead\n tmerc.init.apply(this);\n this.forward = tmerc.forward;\n this.inverse = tmerc.inverse;\n }\n\n this.x0 = this.x0 !== undefined ? this.x0 : 0;\n this.y0 = this.y0 !== undefined ? this.y0 : 0;\n this.long0 = this.long0 !== undefined ? this.long0 : 0;\n this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;\n\n this.cgb = [];\n this.cbg = [];\n this.utg = [];\n this.gtu = [];\n\n var f = this.es / (1 + Math.sqrt(1 - this.es));\n var n = f / (2 - f);\n var np = n;\n\n this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));\n this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));\n\n np = np * n;\n this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));\n this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));\n\n np = np * n;\n this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));\n this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));\n\n np = np * n;\n this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));\n this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));\n\n np = np * n;\n this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));\n this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));\n\n np = np * n;\n this.cgb[5] = np * (601676 / 22275);\n this.cbg[5] = np * (444337 / 155925);\n\n np = Math.pow(n, 2);\n this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));\n\n this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));\n this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));\n\n this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));\n this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));\n\n np = np * n;\n this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));\n this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));\n\n np = np * n;\n this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));\n this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));\n\n np = np * n;\n this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));\n this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));\n\n np = np * n;\n this.utg[5] = np * (-20648693 / 638668800);\n this.gtu[5] = np * (212378941 / 319334400);\n\n var Z = gatg(this.cbg, this.lat0);\n this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));\n}\n\nexport function forward(p) {\n var Ce = adjust_lon(p.x - this.long0);\n var Cn = p.y;\n\n Cn = gatg(this.cbg, Cn);\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n\n Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);\n Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));\n Ce = asinhy(Math.tan(Ce));\n\n var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);\n\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n\n var x;\n var y;\n\n if (Math.abs(Ce) <= 2.623395162778) {\n x = this.a * (this.Qn * Ce) + this.x0;\n y = this.a * (this.Qn * Cn + this.Zb) + this.y0;\n }\n else {\n x = Infinity;\n y = Infinity;\n }\n\n p.x = x;\n p.y = y;\n\n return p;\n}\n\nexport function inverse(p) {\n var Ce = (p.x - this.x0) * (1 / this.a);\n var Cn = (p.y - this.y0) * (1 / this.a);\n\n Cn = (Cn - this.Zb) / this.Qn;\n Ce = Ce / this.Qn;\n\n var lon;\n var lat;\n\n if (Math.abs(Ce) <= 2.623395162778) {\n var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);\n\n Cn = Cn + tmp[0];\n Ce = Ce + tmp[1];\n Ce = Math.atan(sinh(Ce));\n\n var sin_Cn = Math.sin(Cn);\n var cos_Cn = Math.cos(Cn);\n var sin_Ce = Math.sin(Ce);\n var cos_Ce = Math.cos(Ce);\n\n Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));\n Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);\n\n lon = adjust_lon(Ce + this.long0);\n lat = gatg(this.cgb, Cn);\n }\n else {\n lon = Infinity;\n lat = Infinity;\n }\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = [\"Extended_Transverse_Mercator\", \"Extended Transverse Mercator\", \"etmerc\", \"Transverse_Mercator\", \"Transverse Mercator\", \"tmerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function(pp, arg_r) {\n var r = 2 * Math.cos(arg_r);\n var i = pp.length - 1;\n var hr1 = pp[i];\n var hr2 = 0;\n var hr;\n\n while (--i >= 0) {\n hr = -hr2 + r * hr1 + pp[i];\n hr2 = hr1;\n hr1 = hr;\n }\n\n return Math.sin(arg_r) * hr;\n}\n","import adjust_zone from '../common/adjust_zone';\nimport etmerc from './etmerc';\nexport var dependsOn = 'etmerc';\nimport {D2R} from '../constants/values';\n\n\nexport function init() {\n var zone = adjust_zone(this.zone, this.long0);\n if (zone === undefined) {\n throw new Error('unknown utm zone');\n }\n this.lat0 = 0;\n this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;\n this.x0 = 500000;\n this.y0 = this.utmSouth ? 10000000 : 0;\n this.k0 = 0.9996;\n\n etmerc.init.apply(this);\n this.forward = etmerc.forward;\n this.inverse = etmerc.inverse;\n}\n\nexport var names = [\"Universal Transverse Mercator System\", \"utm\"];\nexport default {\n init: init,\n names: names,\n dependsOn: dependsOn\n};\n","import adjust_lon from './adjust_lon';\n\nexport default function(zone, lon) {\n if (zone === undefined) {\n zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;\n\n if (zone < 0) {\n return 0;\n } else if (zone > 60) {\n return 60;\n }\n }\n return zone;\n}\n","export default function(esinp, exp) {\n return (Math.pow((1 - esinp) / (1 + esinp), exp));\n}","import srat from '../common/srat';\nvar MAX_ITER = 20;\nimport {HALF_PI, FORTPI} from '../constants/values';\n\nexport function init() {\n var sphi = Math.sin(this.lat0);\n var cphi = Math.cos(this.lat0);\n cphi *= cphi;\n this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);\n this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));\n this.phic0 = Math.asin(sphi / this.C);\n this.ratexp = 0.5 * this.C * this.e;\n this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));\n}\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n\n p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;\n p.x = this.C * lon;\n return p;\n}\n\nexport function inverse(p) {\n var DEL_TOL = 1e-14;\n var lon = p.x / this.C;\n var lat = p.y;\n var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);\n for (var i = MAX_ITER; i > 0; --i) {\n lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;\n if (Math.abs(lat - p.y) < DEL_TOL) {\n break;\n }\n p.y = lat;\n }\n /* convergence failed */\n if (!i) {\n return null;\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"gauss\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import gauss from './gauss';\nimport adjust_lon from '../common/adjust_lon';\n\nexport function init() {\n gauss.init.apply(this);\n if (!this.rc) {\n return;\n }\n this.sinc0 = Math.sin(this.phic0);\n this.cosc0 = Math.cos(this.phic0);\n this.R2 = 2 * this.rc;\n if (!this.title) {\n this.title = \"Oblique Stereographic Alternative\";\n }\n}\n\nexport function forward(p) {\n var sinc, cosc, cosl, k;\n p.x = adjust_lon(p.x - this.long0);\n gauss.forward.apply(this, [p]);\n sinc = Math.sin(p.y);\n cosc = Math.cos(p.y);\n cosl = Math.cos(p.x);\n k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);\n p.x = k * cosc * Math.sin(p.x);\n p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);\n p.x = this.a * p.x + this.x0;\n p.y = this.a * p.y + this.y0;\n return p;\n}\n\nexport function inverse(p) {\n var sinc, cosc, lon, lat, rho;\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n p.x /= this.k0;\n p.y /= this.k0;\n if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {\n var c = 2 * Math.atan2(rho, this.R2);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);\n lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);\n }\n else {\n lat = this.phic0;\n lon = 0;\n }\n\n p.x = lon;\n p.y = lat;\n gauss.inverse.apply(this, [p]);\n p.x = adjust_lon(p.x + this.long0);\n return p;\n}\n\nexport var names = [\"Stereographic_North_Pole\", \"Oblique_Stereographic\", \"sterea\",\"Oblique Stereographic Alternative\",\"Double_Stereographic\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import {EPSLN, HALF_PI} from '../constants/values';\n\nimport sign from '../common/sign';\nimport msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport phi2z from '../common/phi2z';\nimport adjust_lon from '../common/adjust_lon';\n\nexport function ssfn_(phit, sinphi, eccen) {\n sinphi *= eccen;\n return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));\n}\n\nexport function init() {\n\n // setting default parameters\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n\n this.coslat0 = Math.cos(this.lat0);\n this.sinlat0 = Math.sin(this.lat0);\n if (this.sphere) {\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {\n this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));\n }\n }\n else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (this.lat0 > 0) {\n //North pole\n //trace('stere:north pole');\n this.con = 1;\n }\n else {\n //South pole\n //trace('stere:south pole');\n this.con = -1;\n }\n }\n this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));\n if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN && Math.abs(Math.cos(this.lat_ts)) > EPSLN) {\n // When k0 is 1 (default value) and lat_ts is a vaild number and lat0 is at a pole and lat_ts is not at a pole\n // Recalculate k0 using formula 21-35 from p161 of Snyder, 1987\n this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));\n }\n this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);\n this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;\n this.cosX0 = Math.cos(this.X0);\n this.sinX0 = Math.sin(this.X0);\n }\n}\n\n// Stereographic forward equations--mapping lat,long to x,y\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinlat = Math.sin(lat);\n var coslat = Math.cos(lat);\n var A, X, sinX, cosX, ts, rh;\n var dlon = adjust_lon(lon - this.long0);\n\n if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {\n //case of the origine point\n //trace('stere:this is the origin point');\n p.x = NaN;\n p.y = NaN;\n return p;\n }\n if (this.sphere) {\n //trace('stere:sphere case');\n A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));\n p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;\n p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;\n return p;\n }\n else {\n X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;\n cosX = Math.cos(X);\n sinX = Math.sin(X);\n if (Math.abs(this.coslat0) <= EPSLN) {\n ts = tsfnz(this.e, lat * this.con, this.con * sinlat);\n rh = 2 * this.a * this.k0 * ts / this.cons;\n p.x = this.x0 + rh * Math.sin(lon - this.long0);\n p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);\n //trace(p.toString());\n return p;\n }\n else if (Math.abs(this.sinlat0) < EPSLN) {\n //Eq\n //trace('stere:equateur');\n A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));\n p.y = A * sinX;\n }\n else {\n //other case\n //trace('stere:normal case');\n A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));\n p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;\n }\n p.x = A * cosX * Math.sin(dlon) + this.x0;\n }\n //trace(p.toString());\n return p;\n}\n\n//* Stereographic inverse equations--mapping x,y to lat/long\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat, ts, ce, Chi;\n var rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (this.sphere) {\n var c = 2 * Math.atan(rh / (2 * this.a * this.k0));\n lon = this.long0;\n lat = this.lat0;\n if (rh <= EPSLN) {\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);\n if (Math.abs(this.coslat0) < EPSLN) {\n if (this.lat0 > 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n }\n }\n else {\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n if (Math.abs(this.coslat0) <= EPSLN) {\n if (rh <= EPSLN) {\n lat = this.lat0;\n lon = this.long0;\n p.x = lon;\n p.y = lat;\n //trace(p.toString());\n return p;\n }\n p.x *= this.con;\n p.y *= this.con;\n ts = rh * this.cons / (2 * this.a * this.k0);\n lat = this.con * phi2z(this.e, ts);\n lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));\n }\n else {\n ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));\n lon = this.long0;\n if (rh <= EPSLN) {\n Chi = this.X0;\n }\n else {\n Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);\n lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));\n }\n lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));\n }\n }\n p.x = lon;\n p.y = lat;\n\n //trace(p.toString());\n return p;\n\n}\n\nexport var names = [\"stere\", \"Stereographic_South_Pole\", \"Polar Stereographic (variant B)\", \"Polar_Stereographic\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n ssfn_: ssfn_\n};\n","/*\n references:\n Formules et constantes pour le Calcul pour la\n projection cylindrique conforme à axe oblique et pour la transformation entre\n des systèmes de référence.\n http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf\n */\n\nexport function init() {\n var phy0 = this.lat0;\n this.lambda0 = this.long0;\n var sinPhy0 = Math.sin(phy0);\n var semiMajorAxis = this.a;\n var invF = this.rf;\n var flattening = 1 / invF;\n var e2 = 2 * flattening - Math.pow(flattening, 2);\n var e = this.e = Math.sqrt(e2);\n this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));\n this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));\n this.b0 = Math.asin(sinPhy0 / this.alpha);\n var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));\n var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));\n var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));\n this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;\n}\n\nexport function forward(p) {\n var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));\n var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));\n var S = -this.alpha * (Sa1 + Sa2) + this.K;\n\n // spheric latitude\n var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);\n\n // spheric longitude\n var I = this.alpha * (p.x - this.lambda0);\n\n // psoeudo equatorial rotation\n var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));\n\n var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));\n\n p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;\n p.x = this.R * rotI + this.x0;\n return p;\n}\n\nexport function inverse(p) {\n var Y = p.x - this.x0;\n var X = p.y - this.y0;\n\n var rotI = Y / this.R;\n var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);\n\n var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));\n var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));\n\n var lambda = this.lambda0 + I / this.alpha;\n\n var S = 0;\n var phy = b;\n var prevPhy = -1000;\n var iteration = 0;\n while (Math.abs(phy - prevPhy) > 0.0000001) {\n if (++iteration > 20) {\n //...reportError(\"omercFwdInfinity\");\n return;\n }\n //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));\n S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));\n prevPhy = phy;\n phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;\n }\n\n p.x = lambda;\n p.y = phy;\n return p;\n}\n\nexport var names = [\"somerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import tsfnz from '../common/tsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport { D2R, EPSLN, HALF_PI, TWO_PI, FORTPI } from '../constants/values';\n\nvar TOL = 1e-7;\n\nfunction isTypeA(P) {\n var typeAProjections = ['Hotine_Oblique_Mercator','Hotine_Oblique_Mercator_Azimuth_Natural_Origin'];\n var projectionName = typeof P.PROJECTION === \"object\" ? Object.keys(P.PROJECTION)[0] : P.PROJECTION;\n \n return 'no_uoff' in P || 'no_off' in P || typeAProjections.indexOf(projectionName) !== -1;\n}\n\n\n/* Initialize the Oblique Mercator projection\n ------------------------------------------*/\nexport function init() { \n var con, com, cosph0, D, F, H, L, sinph0, p, J, gamma = 0,\n gamma0, lamc = 0, lam1 = 0, lam2 = 0, phi1 = 0, phi2 = 0, alpha_c = 0, AB;\n \n // only Type A uses the no_off or no_uoff property\n // https://github.com/OSGeo/proj.4/issues/104\n this.no_off = isTypeA(this);\n this.no_rot = 'no_rot' in this;\n \n var alp = false;\n if (\"alpha\" in this) {\n alp = true;\n }\n\n var gam = false;\n if (\"rectified_grid_angle\" in this) {\n gam = true;\n }\n\n if (alp) {\n alpha_c = this.alpha;\n }\n \n if (gam) {\n gamma = (this.rectified_grid_angle * D2R);\n }\n \n if (alp || gam) {\n lamc = this.longc;\n } else {\n lam1 = this.long1;\n phi1 = this.lat1;\n lam2 = this.long2;\n phi2 = this.lat2;\n \n if (Math.abs(phi1 - phi2) <= TOL || (con = Math.abs(phi1)) <= TOL ||\n Math.abs(con - HALF_PI) <= TOL || Math.abs(Math.abs(this.lat0) - HALF_PI) <= TOL ||\n Math.abs(Math.abs(phi2) - HALF_PI) <= TOL) {\n throw new Error();\n }\n }\n \n var one_es = 1.0 - this.es;\n com = Math.sqrt(one_es);\n \n if (Math.abs(this.lat0) > EPSLN) {\n sinph0 = Math.sin(this.lat0);\n cosph0 = Math.cos(this.lat0);\n con = 1 - this.es * sinph0 * sinph0;\n this.B = cosph0 * cosph0;\n this.B = Math.sqrt(1 + this.es * this.B * this.B / one_es);\n this.A = this.B * this.k0 * com / con;\n D = this.B * com / (cosph0 * Math.sqrt(con));\n F = D * D -1;\n \n if (F <= 0) {\n F = 0;\n } else {\n F = Math.sqrt(F);\n if (this.lat0 < 0) {\n F = -F;\n }\n }\n \n this.E = F += D;\n this.E *= Math.pow(tsfnz(this.e, this.lat0, sinph0), this.B);\n } else {\n this.B = 1 / com;\n this.A = this.k0;\n this.E = D = F = 1;\n }\n \n if (alp || gam) {\n if (alp) {\n gamma0 = Math.asin(Math.sin(alpha_c) / D);\n if (!gam) {\n gamma = alpha_c;\n }\n } else {\n gamma0 = gamma;\n alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n this.lam0 = lamc - Math.asin(0.5 * (F - 1 / F) * Math.tan(gamma0)) / this.B;\n } else {\n H = Math.pow(tsfnz(this.e, phi1, Math.sin(phi1)), this.B);\n L = Math.pow(tsfnz(this.e, phi2, Math.sin(phi2)), this.B);\n F = this.E / H;\n p = (L - H) / (L + H);\n J = this.E * this.E;\n J = (J - L * H) / (J + L * H);\n con = lam1 - lam2;\n \n if (con < -Math.pi) {\n lam2 -=TWO_PI;\n } else if (con > Math.pi) {\n lam2 += TWO_PI;\n }\n \n this.lam0 = adjust_lon(0.5 * (lam1 + lam2) - Math.atan(J * Math.tan(0.5 * this.B * (lam1 - lam2)) / p) / this.B);\n gamma0 = Math.atan(2 * Math.sin(this.B * adjust_lon(lam1 - this.lam0)) / (F - 1 / F));\n gamma = alpha_c = Math.asin(D * Math.sin(gamma0));\n }\n \n this.singam = Math.sin(gamma0);\n this.cosgam = Math.cos(gamma0);\n this.sinrot = Math.sin(gamma);\n this.cosrot = Math.cos(gamma);\n \n this.rB = 1 / this.B;\n this.ArB = this.A * this.rB;\n this.BrA = 1 / this.ArB;\n AB = this.A * this.B;\n \n if (this.no_off) {\n this.u_0 = 0;\n } else {\n this.u_0 = Math.abs(this.ArB * Math.atan(Math.sqrt(D * D - 1) / Math.cos(alpha_c)));\n \n if (this.lat0 < 0) {\n this.u_0 = - this.u_0;\n } \n }\n \n F = 0.5 * gamma0;\n this.v_pole_n = this.ArB * Math.log(Math.tan(FORTPI - F));\n this.v_pole_s = this.ArB * Math.log(Math.tan(FORTPI + F));\n}\n\n\n/* Oblique Mercator forward equations--mapping lat,long to x,y\n ----------------------------------------------------------*/\nexport function forward(p) {\n var coords = {};\n var S, T, U, V, W, temp, u, v;\n p.x = p.x - this.lam0;\n \n if (Math.abs(Math.abs(p.y) - HALF_PI) > EPSLN) {\n W = this.E / Math.pow(tsfnz(this.e, p.y, Math.sin(p.y)), this.B);\n \n temp = 1 / W;\n S = 0.5 * (W - temp);\n T = 0.5 * (W + temp);\n V = Math.sin(this.B * p.x);\n U = (S * this.singam - V * this.cosgam) / T;\n \n if (Math.abs(Math.abs(U) - 1.0) < EPSLN) {\n throw new Error();\n }\n \n v = 0.5 * this.ArB * Math.log((1 - U)/(1 + U));\n temp = Math.cos(this.B * p.x);\n \n if (Math.abs(temp) < TOL) {\n u = this.A * p.x;\n } else {\n u = this.ArB * Math.atan2((S * this.cosgam + V * this.singam), temp);\n } \n } else {\n v = p.y > 0 ? this.v_pole_n : this.v_pole_s;\n u = this.ArB * p.y;\n }\n \n if (this.no_rot) {\n coords.x = u;\n coords.y = v;\n } else {\n u -= this.u_0;\n coords.x = v * this.cosrot + u * this.sinrot;\n coords.y = u * this.cosrot - v * this.sinrot;\n }\n \n coords.x = (this.a * coords.x + this.x0);\n coords.y = (this.a * coords.y + this.y0);\n \n return coords;\n}\n\nexport function inverse(p) {\n var u, v, Qp, Sp, Tp, Vp, Up;\n var coords = {};\n \n p.x = (p.x - this.x0) * (1.0 / this.a);\n p.y = (p.y - this.y0) * (1.0 / this.a);\n\n if (this.no_rot) {\n v = p.y;\n u = p.x;\n } else {\n v = p.x * this.cosrot - p.y * this.sinrot;\n u = p.y * this.cosrot + p.x * this.sinrot + this.u_0;\n }\n \n Qp = Math.exp(-this.BrA * v);\n Sp = 0.5 * (Qp - 1 / Qp);\n Tp = 0.5 * (Qp + 1 / Qp);\n Vp = Math.sin(this.BrA * u);\n Up = (Vp * this.cosgam + Sp * this.singam) / Tp;\n \n if (Math.abs(Math.abs(Up) - 1) < EPSLN) {\n coords.x = 0;\n coords.y = Up < 0 ? -HALF_PI : HALF_PI;\n } else {\n coords.y = this.E / Math.sqrt((1 + Up) / (1 - Up));\n coords.y = phi2z(this.e, Math.pow(coords.y, 1 / this.B));\n \n if (coords.y === Infinity) {\n throw new Error();\n }\n \n coords.x = -this.rB * Math.atan2((Sp * this.cosgam - Vp * this.singam), Math.cos(this.BrA * u));\n }\n \n coords.x += this.lam0;\n \n return coords;\n}\n\nexport var names = [\"Hotine_Oblique_Mercator\", \"Hotine Oblique Mercator\", \"Hotine_Oblique_Mercator_Azimuth_Natural_Origin\", \"Hotine_Oblique_Mercator_Two_Point_Natural_Origin\", \"Hotine_Oblique_Mercator_Azimuth_Center\", \"Oblique_Mercator\", \"omerc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import msfnz from '../common/msfnz';\nimport tsfnz from '../common/tsfnz';\nimport sign from '../common/sign';\nimport adjust_lon from '../common/adjust_lon';\nimport phi2z from '../common/phi2z';\nimport {HALF_PI, EPSLN} from '../constants/values';\nexport function init() {\n \n //double lat0; /* the reference latitude */\n //double long0; /* the reference longitude */\n //double lat1; /* first standard parallel */\n //double lat2; /* second standard parallel */\n //double r_maj; /* major axis */\n //double r_min; /* minor axis */\n //double false_east; /* x offset in meters */\n //double false_north; /* y offset in meters */\n \n //the above value can be set with proj4.defs\n //example: proj4.defs(\"EPSG:2154\",\"+proj=lcc +lat_1=49 +lat_2=44 +lat_0=46.5 +lon_0=3 +x_0=700000 +y_0=6600000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs\");\n\n if (!this.lat2) {\n this.lat2 = this.lat1;\n } //if lat2 is not defined\n if (!this.k0) {\n this.k0 = 1;\n }\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n\n var temp = this.b / this.a;\n this.e = Math.sqrt(1 - temp * temp);\n\n var sin1 = Math.sin(this.lat1);\n var cos1 = Math.cos(this.lat1);\n var ms1 = msfnz(this.e, sin1, cos1);\n var ts1 = tsfnz(this.e, this.lat1, sin1);\n\n var sin2 = Math.sin(this.lat2);\n var cos2 = Math.cos(this.lat2);\n var ms2 = msfnz(this.e, sin2, cos2);\n var ts2 = tsfnz(this.e, this.lat2, sin2);\n\n var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));\n\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);\n }\n else {\n this.ns = sin1;\n }\n if (isNaN(this.ns)) {\n this.ns = sin1;\n }\n this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));\n this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);\n if (!this.title) {\n this.title = \"Lambert Conformal Conic\";\n }\n}\n\n// Lambert Conformal conic forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n\n var lon = p.x;\n var lat = p.y;\n\n // singular cases :\n if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {\n lat = sign(lat) * (HALF_PI - 2 * EPSLN);\n }\n\n var con = Math.abs(Math.abs(lat) - HALF_PI);\n var ts, rh1;\n if (con > EPSLN) {\n ts = tsfnz(this.e, lat, Math.sin(lat));\n rh1 = this.a * this.f0 * Math.pow(ts, this.ns);\n }\n else {\n con = lat * this.ns;\n if (con <= 0) {\n return null;\n }\n rh1 = 0;\n }\n var theta = this.ns * adjust_lon(lon - this.long0);\n p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;\n p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;\n\n return p;\n}\n\n// Lambert Conformal Conic inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n\n var rh1, con, ts;\n var lat, lon;\n var x = (p.x - this.x0) / this.k0;\n var y = (this.rh - (p.y - this.y0) / this.k0);\n if (this.ns > 0) {\n rh1 = Math.sqrt(x * x + y * y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(x * x + y * y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2((con * x), (con * y));\n }\n if ((rh1 !== 0) || (this.ns > 0)) {\n con = 1 / this.ns;\n ts = Math.pow((rh1 / (this.a * this.f0)), con);\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n else {\n lat = -HALF_PI;\n }\n lon = adjust_lon(theta / this.ns + this.long0);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\n \"Lambert Tangential Conformal Conic Projection\",\n \"Lambert_Conformal_Conic\",\n \"Lambert_Conformal_Conic_1SP\",\n \"Lambert_Conformal_Conic_2SP\",\n \"lcc\",\n \"Lambert Conic Conformal (1SP)\",\n \"Lambert Conic Conformal (2SP)\"\n];\n\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\nexport function init() {\n this.a = 6377397.155;\n this.es = 0.006674372230614;\n this.e = Math.sqrt(this.es);\n if (!this.lat0) {\n this.lat0 = 0.863937979737193;\n }\n if (!this.long0) {\n this.long0 = 0.7417649320975901 - 0.308341501185665;\n }\n /* if scale not set default to 0.9999 */\n if (!this.k0) {\n this.k0 = 0.9999;\n }\n this.s45 = 0.785398163397448; /* 45 */\n this.s90 = 2 * this.s45;\n this.fi0 = this.lat0;\n this.e2 = this.es;\n this.e = Math.sqrt(this.e2);\n this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));\n this.uq = 1.04216856380474;\n this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);\n this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);\n this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;\n this.k1 = this.k0;\n this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));\n this.s0 = 1.37008346281555;\n this.n = Math.sin(this.s0);\n this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);\n this.ad = this.s90 - this.uq;\n}\n\n/* ellipsoid */\n/* calculate xy from lat/lon */\n/* Constants, identical to inverse transform function */\nexport function forward(p) {\n var gfi, u, deltav, s, d, eps, ro;\n var lon = p.x;\n var lat = p.y;\n var delta_lon = adjust_lon(lon - this.long0);\n /* Transformation */\n gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));\n u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);\n deltav = -delta_lon * this.alfa;\n s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));\n d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));\n eps = this.n * d;\n ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);\n p.y = ro * Math.cos(eps) / 1;\n p.x = ro * Math.sin(eps) / 1;\n\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n return (p);\n}\n\n/* calculate lat/lon from xy */\nexport function inverse(p) {\n var u, deltav, s, d, eps, ro, fi1;\n var ok;\n\n /* Transformation */\n /* revert y, x*/\n var tmp = p.x;\n p.x = p.y;\n p.y = tmp;\n if (!this.czech) {\n p.y *= -1;\n p.x *= -1;\n }\n ro = Math.sqrt(p.x * p.x + p.y * p.y);\n eps = Math.atan2(p.y, p.x);\n d = eps / Math.sin(this.s0);\n s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);\n u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));\n deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));\n p.x = this.long0 - deltav / this.alfa;\n fi1 = u;\n ok = 0;\n var iter = 0;\n do {\n p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);\n if (Math.abs(fi1 - p.y) < 0.0000000001) {\n ok = 1;\n }\n fi1 = p.y;\n iter += 1;\n } while (ok === 0 && iter < 15);\n if (iter >= 15) {\n return null;\n }\n\n return (p);\n}\n\nexport var names = [\"Krovak\", \"krovak\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function(e0, e1, e2, e3, phi) {\n return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));\n}","export default function(x) {\n return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));\n}","export default function(x) {\n return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));\n}","export default function(x) {\n return (0.05859375 * x * x * (1 + 0.75 * x));\n}","export default function(x) {\n return (x * x * x * (35 / 3072));\n}","export default function(a, e, sinphi) {\n var temp = e * sinphi;\n return a / Math.sqrt(1 - temp * temp);\n}","import {HALF_PI} from '../constants/values';\nimport sign from './sign';\n\nexport default function(x) {\n return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));\n}\n","export default function(ml, e0, e1, e2, e3) {\n var phi;\n var dphi;\n\n phi = ml / e0;\n for (var i = 0; i < 15; i++) {\n dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n //..reportError(\"IMLFN-CONV:Latitude failed to converge after 15 iterations\");\n return NaN;\n}","import mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport gN from '../common/gN';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport {HALF_PI, EPSLN} from '../constants/values';\n\nexport function init() {\n if (!this.sphere) {\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n }\n}\n\n/* Cassini forward equations--mapping lat,long to x,y\n -----------------------------------------------------------------------*/\nexport function forward(p) {\n\n /* Forward equations\n -----------------*/\n var x, y;\n var lam = p.x;\n var phi = p.y;\n lam = adjust_lon(lam - this.long0);\n\n if (this.sphere) {\n x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));\n y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);\n }\n else {\n //ellipsoid\n var sinphi = Math.sin(phi);\n var cosphi = Math.cos(phi);\n var nl = gN(this.a, this.e, sinphi);\n var tl = Math.tan(phi) * Math.tan(phi);\n var al = lam * Math.cos(phi);\n var asq = al * al;\n var cl = this.es * cosphi * cosphi / (1 - this.es);\n var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n\n x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));\n y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);\n\n\n }\n\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var phi, lam;\n\n if (this.sphere) {\n var dd = y + this.lat0;\n phi = Math.asin(Math.sin(dd) * Math.cos(x));\n lam = Math.atan2(Math.tan(x), Math.cos(dd));\n }\n else {\n /* ellipsoid */\n var ml1 = this.ml0 / this.a + y;\n var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);\n if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {\n p.x = this.long0;\n p.y = HALF_PI;\n if (y < 0) {\n p.y *= -1;\n }\n return p;\n }\n var nl1 = gN(this.a, this.e, Math.sin(phi1));\n\n var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);\n var tl1 = Math.pow(Math.tan(phi1), 2);\n var dl = x * this.a / nl1;\n var dsq = dl * dl;\n phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);\n lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);\n\n }\n\n p.x = adjust_lon(lam + this.long0);\n p.y = adjust_lat(phi);\n return p;\n\n}\n\nexport var names = [\"Cassini\", \"Cassini_Soldner\", \"cass\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","export default function(eccent, sinphi) {\n var con;\n if (eccent > 1.0e-7) {\n con = eccent * sinphi;\n return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));\n }\n else {\n return (2 * sinphi);\n }\n}","\nimport {HALF_PI, EPSLN, FORTPI} from '../constants/values';\n\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\nexport var S_POLE = 1;\n\nexport var N_POLE = 2;\nexport var EQUIT = 3;\nexport var OBLIQ = 4;\n\n/* Initialize the Lambert Azimuthal Equal Area projection\n ------------------------------------------------------*/\nexport function init() {\n var t = Math.abs(this.lat0);\n if (Math.abs(t - HALF_PI) < EPSLN) {\n this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;\n }\n else if (Math.abs(t) < EPSLN) {\n this.mode = this.EQUIT;\n }\n else {\n this.mode = this.OBLIQ;\n }\n if (this.es > 0) {\n var sinphi;\n\n this.qp = qsfnz(this.e, 1);\n this.mmf = 0.5 / (1 - this.es);\n this.apa = authset(this.es);\n switch (this.mode) {\n case this.N_POLE:\n this.dd = 1;\n break;\n case this.S_POLE:\n this.dd = 1;\n break;\n case this.EQUIT:\n this.rq = Math.sqrt(0.5 * this.qp);\n this.dd = 1 / this.rq;\n this.xmf = 1;\n this.ymf = 0.5 * this.qp;\n break;\n case this.OBLIQ:\n this.rq = Math.sqrt(0.5 * this.qp);\n sinphi = Math.sin(this.lat0);\n this.sinb1 = qsfnz(this.e, sinphi) / this.qp;\n this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);\n this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);\n this.ymf = (this.xmf = this.rq) / this.dd;\n this.xmf *= this.dd;\n break;\n }\n }\n else {\n if (this.mode === this.OBLIQ) {\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n }\n}\n\n/* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y\n -----------------------------------------------------------------------*/\nexport function forward(p) {\n\n /* Forward equations\n -----------------*/\n var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;\n var lam = p.x;\n var phi = p.y;\n\n lam = adjust_lon(lam - this.long0);\n if (this.sphere) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n coslam = Math.cos(lam);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n if (y <= EPSLN) {\n return null;\n }\n y = Math.sqrt(2 / y);\n x = y * cosphi * Math.sin(lam);\n y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n }\n else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n coslam = -coslam;\n }\n if (Math.abs(phi + this.lat0) < EPSLN) {\n return null;\n }\n y = FORTPI - phi * 0.5;\n y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));\n x = y * Math.sin(lam);\n y *= coslam;\n }\n }\n else {\n sinb = 0;\n cosb = 0;\n b = 0;\n coslam = Math.cos(lam);\n sinlam = Math.sin(lam);\n sinphi = Math.sin(phi);\n q = qsfnz(this.e, sinphi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinb = q / this.qp;\n cosb = Math.sqrt(1 - sinb * sinb);\n }\n switch (this.mode) {\n case this.OBLIQ:\n b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;\n break;\n case this.EQUIT:\n b = 1 + cosb * coslam;\n break;\n case this.N_POLE:\n b = HALF_PI + phi;\n q = this.qp - q;\n break;\n case this.S_POLE:\n b = phi - HALF_PI;\n q = this.qp + q;\n break;\n }\n if (Math.abs(b) < EPSLN) {\n return null;\n }\n switch (this.mode) {\n case this.OBLIQ:\n case this.EQUIT:\n b = Math.sqrt(2 / b);\n if (this.mode === this.OBLIQ) {\n y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);\n }\n else {\n y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;\n }\n x = this.xmf * b * cosb * sinlam;\n break;\n case this.N_POLE:\n case this.S_POLE:\n if (q >= 0) {\n x = (b = Math.sqrt(q)) * sinlam;\n y = coslam * ((this.mode === this.S_POLE) ? b : -b);\n }\n else {\n x = y = 0;\n }\n break;\n }\n }\n\n p.x = this.a * x + this.x0;\n p.y = this.a * y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var x = p.x / this.a;\n var y = p.y / this.a;\n var lam, phi, cCe, sCe, q, rho, ab;\n if (this.sphere) {\n var cosz = 0,\n rh, sinz = 0;\n\n rh = Math.sqrt(x * x + y * y);\n phi = rh * 0.5;\n if (phi > 1) {\n return null;\n }\n phi = 2 * Math.asin(phi);\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n sinz = Math.sin(phi);\n cosz = Math.cos(phi);\n }\n switch (this.mode) {\n case this.EQUIT:\n phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);\n x *= sinz;\n y = cosz * rh;\n break;\n case this.OBLIQ:\n phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);\n x *= sinz * this.cosph0;\n y = (cosz - Math.sin(phi) * this.sinph0) * rh;\n break;\n case this.N_POLE:\n y = -y;\n phi = HALF_PI - phi;\n break;\n case this.S_POLE:\n phi -= HALF_PI;\n break;\n }\n lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);\n }\n else {\n ab = 0;\n if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {\n x /= this.dd;\n y *= this.dd;\n rho = Math.sqrt(x * x + y * y);\n if (rho < EPSLN) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n sCe = 2 * Math.asin(0.5 * rho / this.rq);\n cCe = Math.cos(sCe);\n x *= (sCe = Math.sin(sCe));\n if (this.mode === this.OBLIQ) {\n ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;\n q = this.qp * ab;\n y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;\n }\n else {\n ab = y * sCe / rho;\n q = this.qp * ab;\n y = rho * cCe;\n }\n }\n else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {\n if (this.mode === this.N_POLE) {\n y = -y;\n }\n q = (x * x + y * y);\n if (!q) {\n p.x = this.long0;\n p.y = this.lat0;\n return p;\n }\n ab = 1 - q / this.qp;\n if (this.mode === this.S_POLE) {\n ab = -ab;\n }\n }\n lam = Math.atan2(x, y);\n phi = authlat(Math.asin(ab), this.apa);\n }\n\n p.x = adjust_lon(this.long0 + lam);\n p.y = phi;\n return p;\n}\n\n/* determine latitude from authalic latitude */\nvar P00 = 0.33333333333333333333;\n\nvar P01 = 0.17222222222222222222;\nvar P02 = 0.10257936507936507936;\nvar P10 = 0.06388888888888888888;\nvar P11 = 0.06640211640211640211;\nvar P20 = 0.01641501294219154443;\n\nfunction authset(es) {\n var t;\n var APA = [];\n APA[0] = es * P00;\n t = es * es;\n APA[0] += t * P01;\n APA[1] = t * P10;\n t *= es;\n APA[0] += t * P02;\n APA[1] += t * P11;\n APA[2] = t * P20;\n return APA;\n}\n\nfunction authlat(beta, APA) {\n var t = beta + beta;\n return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));\n}\n\nexport var names = [\"Lambert Azimuthal Equal Area\", \"Lambert_Azimuthal_Equal_Area\", \"laea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n S_POLE: S_POLE,\n N_POLE: N_POLE,\n EQUIT: EQUIT,\n OBLIQ: OBLIQ\n};\n","export default function(x) {\n if (Math.abs(x) > 1) {\n x = (x > 1) ? 1 : -1;\n }\n return Math.asin(x);\n}","import msfnz from '../common/msfnz';\nimport qsfnz from '../common/qsfnz';\nimport adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport {EPSLN} from '../constants/values';\n\nexport function init() {\n\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e3 = Math.sqrt(this.es);\n\n this.sin_po = Math.sin(this.lat1);\n this.cos_po = Math.cos(this.lat1);\n this.t1 = this.sin_po;\n this.con = this.sin_po;\n this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs1 = qsfnz(this.e3, this.sin_po);\n\n this.sin_po = Math.sin(this.lat2);\n this.cos_po = Math.cos(this.lat2);\n this.t2 = this.sin_po;\n this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);\n this.qs2 = qsfnz(this.e3, this.sin_po);\n\n this.sin_po = Math.sin(this.lat0);\n this.cos_po = Math.cos(this.lat0);\n this.t3 = this.sin_po;\n this.qs0 = qsfnz(this.e3, this.sin_po);\n\n if (Math.abs(this.lat1 - this.lat2) > EPSLN) {\n this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);\n }\n else {\n this.ns0 = this.con;\n }\n this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;\n this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;\n}\n\n/* Albers Conical Equal Area forward equations--mapping lat,long to x,y\n -------------------------------------------------------------------*/\nexport function forward(p) {\n\n var lon = p.x;\n var lat = p.y;\n\n this.sin_phi = Math.sin(lat);\n this.cos_phi = Math.cos(lat);\n\n var qs = qsfnz(this.e3, this.sin_phi);\n var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;\n var theta = this.ns0 * adjust_lon(lon - this.long0);\n var x = rh1 * Math.sin(theta) + this.x0;\n var y = this.rh - rh1 * Math.cos(theta) + this.y0;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh1, qs, con, theta, lon, lat;\n\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n if (this.ns0 >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n con = rh1 * this.ns0 / this.a;\n if (this.sphere) {\n lat = Math.asin((this.c - con * con) / (2 * this.ns0));\n }\n else {\n qs = (this.c - con * con) / this.ns0;\n lat = this.phi1z(this.e3, qs);\n }\n\n lon = adjust_lon(theta / this.ns0 + this.long0);\n p.x = lon;\n p.y = lat;\n return p;\n}\n\n/* Function to compute phi1, the latitude for the inverse of the\n Albers Conical Equal-Area projection.\n-------------------------------------------*/\nexport function phi1z(eccent, qs) {\n var sinphi, cosphi, con, com, dphi;\n var phi = asinz(0.5 * qs);\n if (eccent < EPSLN) {\n return phi;\n }\n\n var eccnts = eccent * eccent;\n for (var i = 1; i <= 25; i++) {\n sinphi = Math.sin(phi);\n cosphi = Math.cos(phi);\n con = eccent * sinphi;\n com = 1 - con * con;\n dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi = phi + dphi;\n if (Math.abs(dphi) <= 1e-7) {\n return phi;\n }\n }\n return null;\n}\n\nexport var names = [\"Albers_Conic_Equal_Area\", \"Albers\", \"aea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n phi1z: phi1z\n};\n","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport {EPSLN} from '../constants/values';\n\n/*\n reference:\n Wolfram Mathworld \"Gnomonic Projection\"\n http://mathworld.wolfram.com/GnomonicProjection.html\n Accessed: 12th November 2009\n */\nexport function init() {\n\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.sin_p14 = Math.sin(this.lat0);\n this.cos_p14 = Math.cos(this.lat0);\n // Approximation for projecting points to the horizon (infinity)\n this.infinity_dist = 1000 * this.a;\n this.rc = 1;\n}\n\n/* Gnomonic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g;\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n dlon = adjust_lon(lon - this.long0);\n\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if ((g > 0) || (Math.abs(g) <= EPSLN)) {\n x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;\n y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;\n }\n else {\n\n // Point is in the opposing hemisphere and is unprojectable\n // We still need to return a reasonable point, so we project\n // to infinity, on a bearing\n // equivalent to the northern hemisphere equivalent\n // This is a reasonable approximation for short shapes and lines that\n // straddle the horizon.\n\n x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);\n y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh; /* Rho */\n var sinc, cosc;\n var c;\n var lon, lat;\n\n /* Inverse equations\n -----------------*/\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n p.x /= this.k0;\n p.y /= this.k0;\n\n if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {\n c = Math.atan2(rh, this.rc);\n sinc = Math.sin(c);\n cosc = Math.cos(c);\n\n lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);\n lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);\n lon = adjust_lon(this.long0 + lon);\n }\n else {\n lat = this.phic0;\n lon = 0;\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"gnom\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport qsfnz from '../common/qsfnz';\nimport msfnz from '../common/msfnz';\nimport iqsfnz from '../common/iqsfnz';\n\n/*\n reference:\n \"Cartographic Projection Procedures for the UNIX Environment-\n A User's Manual\" by Gerald I. Evenden,\n USGS Open File Report 90-284and Release 4 Interim Reports (2003)\n*/\nexport function init() {\n //no-op\n if (!this.sphere) {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n}\n\n/* Cylindrical Equal Area forward equations--mapping lat,long to x,y\n ------------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y;\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n if (this.sphere) {\n x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);\n y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);\n }\n else {\n var qs = qsfnz(this.e, Math.sin(lat));\n x = this.x0 + this.a * this.k0 * dlon;\n y = this.y0 + this.a * qs * 0.5 / this.k0;\n }\n\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Cylindrical Equal Area inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var lon, lat;\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));\n lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));\n }\n else {\n lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);\n lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"cea\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import {HALF_PI} from '../constants/values';\n\nexport default function(eccent, q) {\n var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));\n if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {\n if (q < 0) {\n return (-1 * HALF_PI);\n }\n else {\n return HALF_PI;\n }\n }\n //var phi = 0.5* q/(1-eccent*eccent);\n var phi = Math.asin(0.5 * q);\n var dphi;\n var sin_phi;\n var cos_phi;\n var con;\n for (var i = 0; i < 30; i++) {\n sin_phi = Math.sin(phi);\n cos_phi = Math.cos(phi);\n con = eccent * sin_phi;\n dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n\n //console.log(\"IQSFN-CONV:Latitude failed to converge after 30 iterations\");\n return NaN;\n}\n","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\n\nexport function init() {\n\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || \"Equidistant Cylindrical (Plate Carre)\";\n\n this.rc = Math.cos(this.lat_ts);\n}\n\n// forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n\n var lon = p.x;\n var lat = p.y;\n\n var dlon = adjust_lon(lon - this.long0);\n var dlat = adjust_lat(lat - this.lat0);\n p.x = this.x0 + (this.a * dlon * this.rc);\n p.y = this.y0 + (this.a * dlat);\n return p;\n}\n\n// inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n\n var x = p.x;\n var y = p.y;\n\n p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));\n p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));\n return p;\n}\n\nexport var names = [\"Equirectangular\", \"Equidistant_Cylindrical\", \"eqc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport mlfn from '../common/mlfn';\nimport {EPSLN} from '../constants/values';\n\nimport gN from '../common/gN';\nvar MAX_ITER = 20;\n\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas\n}\n\n/* Polyconic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var x, y, el;\n var dlon = adjust_lon(lon - this.long0);\n el = dlon * Math.sin(lat);\n if (this.sphere) {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.a * this.lat0;\n }\n else {\n x = this.a * Math.sin(el) / Math.tan(lat);\n y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));\n }\n }\n else {\n if (Math.abs(lat) <= EPSLN) {\n x = this.a * dlon;\n y = -1 * this.ml0;\n }\n else {\n var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);\n x = nl * Math.sin(el);\n y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));\n }\n\n }\n p.x = x + this.x0;\n p.y = y + this.y0;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n var lon, lat, x, y, i;\n var al, bl;\n var phi, dphi;\n x = p.x - this.x0;\n y = p.y - this.y0;\n\n if (this.sphere) {\n if (Math.abs(y + this.a * this.lat0) <= EPSLN) {\n lon = adjust_lon(x / this.a + this.long0);\n lat = 0;\n }\n else {\n al = this.lat0 + y / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var tanphi;\n for (i = MAX_ITER; i; --i) {\n tanphi = Math.tan(phi);\n dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);\n phi += dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));\n }\n }\n else {\n if (Math.abs(y + this.ml0) <= EPSLN) {\n lat = 0;\n lon = adjust_lon(this.long0 + x / this.a);\n }\n else {\n\n al = (this.ml0 + y) / this.a;\n bl = x * x / this.a / this.a + al * al;\n phi = al;\n var cl, mln, mlnp, ma;\n var con;\n for (i = MAX_ITER; i; --i) {\n con = this.e * Math.sin(phi);\n cl = Math.sqrt(1 - con * con) * Math.tan(phi);\n mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);\n mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);\n ma = mln / this.a;\n dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);\n phi -= dphi;\n if (Math.abs(dphi) <= EPSLN) {\n lat = phi;\n break;\n }\n }\n\n //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);\n cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);\n lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));\n }\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Polyconic\", \"poly\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import {SEC_TO_RAD} from '../constants/values';\n\n/*\n reference\n Department of Land and Survey Technical Circular 1973/32\n http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf\n OSG Technical Report 4.1\n http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf\n */\n\n/**\n * iterations: Number of iterations to refine inverse transform.\n * 0 -> km accuracy\n * 1 -> m accuracy -- suitable for most mapping applications\n * 2 -> mm accuracy\n */\nexport var iterations = 1;\n\nexport function init() {\n this.A = [];\n this.A[1] = 0.6399175073;\n this.A[2] = -0.1358797613;\n this.A[3] = 0.063294409;\n this.A[4] = -0.02526853;\n this.A[5] = 0.0117879;\n this.A[6] = -0.0055161;\n this.A[7] = 0.0026906;\n this.A[8] = -0.001333;\n this.A[9] = 0.00067;\n this.A[10] = -0.00034;\n\n this.B_re = [];\n this.B_im = [];\n this.B_re[1] = 0.7557853228;\n this.B_im[1] = 0;\n this.B_re[2] = 0.249204646;\n this.B_im[2] = 0.003371507;\n this.B_re[3] = -0.001541739;\n this.B_im[3] = 0.041058560;\n this.B_re[4] = -0.10162907;\n this.B_im[4] = 0.01727609;\n this.B_re[5] = -0.26623489;\n this.B_im[5] = -0.36249218;\n this.B_re[6] = -0.6870983;\n this.B_im[6] = -1.1651967;\n\n this.C_re = [];\n this.C_im = [];\n this.C_re[1] = 1.3231270439;\n this.C_im[1] = 0;\n this.C_re[2] = -0.577245789;\n this.C_im[2] = -0.007809598;\n this.C_re[3] = 0.508307513;\n this.C_im[3] = -0.112208952;\n this.C_re[4] = -0.15094762;\n this.C_im[4] = 0.18200602;\n this.C_re[5] = 1.01418179;\n this.C_im[5] = 1.64497696;\n this.C_re[6] = 1.9660549;\n this.C_im[6] = 2.5127645;\n\n this.D = [];\n this.D[1] = 1.5627014243;\n this.D[2] = 0.5185406398;\n this.D[3] = -0.03333098;\n this.D[4] = -0.1052906;\n this.D[5] = -0.0368594;\n this.D[6] = 0.007317;\n this.D[7] = 0.01220;\n this.D[8] = 0.00394;\n this.D[9] = -0.0013;\n}\n\n/**\n New Zealand Map Grid Forward - long/lat to x/y\n long/lat in radians\n */\nexport function forward(p) {\n var n;\n var lon = p.x;\n var lat = p.y;\n\n var delta_lat = lat - this.lat0;\n var delta_lon = lon - this.long0;\n\n // 1. Calculate d_phi and d_psi ... // and d_lambda\n // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.\n var d_phi = delta_lat / SEC_TO_RAD * 1E-5;\n var d_lambda = delta_lon;\n var d_phi_n = 1; // d_phi^0\n\n var d_psi = 0;\n for (n = 1; n <= 10; n++) {\n d_phi_n = d_phi_n * d_phi;\n d_psi = d_psi + this.A[n] * d_phi_n;\n }\n\n // 2. Calculate theta\n var th_re = d_psi;\n var th_im = d_lambda;\n\n // 3. Calculate z\n var th_n_re = 1;\n var th_n_im = 0; // theta^0\n var th_n_re1;\n var th_n_im1;\n\n var z_re = 0;\n var z_im = 0;\n for (n = 1; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;\n z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;\n }\n\n // 4. Calculate easting and northing\n p.x = (z_im * this.a) + this.x0;\n p.y = (z_re * this.a) + this.y0;\n\n return p;\n}\n\n/**\n New Zealand Map Grid Inverse - x/y to long/lat\n */\nexport function inverse(p) {\n var n;\n var x = p.x;\n var y = p.y;\n\n var delta_x = x - this.x0;\n var delta_y = y - this.y0;\n\n // 1. Calculate z\n var z_re = delta_y / this.a;\n var z_im = delta_x / this.a;\n\n // 2a. Calculate theta - first approximation gives km accuracy\n var z_n_re = 1;\n var z_n_im = 0; // z^0\n var z_n_re1;\n var z_n_im1;\n\n var th_re = 0;\n var th_im = 0;\n for (n = 1; n <= 6; n++) {\n z_n_re1 = z_n_re * z_re - z_n_im * z_im;\n z_n_im1 = z_n_im * z_re + z_n_re * z_im;\n z_n_re = z_n_re1;\n z_n_im = z_n_im1;\n th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;\n th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;\n }\n\n // 2b. Iterate to refine the accuracy of the calculation\n // 0 iterations gives km accuracy\n // 1 iteration gives m accuracy -- good enough for most mapping applications\n // 2 iterations bives mm accuracy\n for (var i = 0; i < this.iterations; i++) {\n var th_n_re = th_re;\n var th_n_im = th_im;\n var th_n_re1;\n var th_n_im1;\n\n var num_re = z_re;\n var num_im = z_im;\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n th_n_re = 1;\n th_n_im = 0;\n var den_re = this.B_re[1];\n var den_im = this.B_im[1];\n for (n = 2; n <= 6; n++) {\n th_n_re1 = th_n_re * th_re - th_n_im * th_im;\n th_n_im1 = th_n_im * th_re + th_n_re * th_im;\n th_n_re = th_n_re1;\n th_n_im = th_n_im1;\n den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);\n den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);\n }\n\n // Complex division\n var den2 = den_re * den_re + den_im * den_im;\n th_re = (num_re * den_re + num_im * den_im) / den2;\n th_im = (num_im * den_re - num_re * den_im) / den2;\n }\n\n // 3. Calculate d_phi ... // and d_lambda\n var d_psi = th_re;\n var d_lambda = th_im;\n var d_psi_n = 1; // d_psi^0\n\n var d_phi = 0;\n for (n = 1; n <= 9; n++) {\n d_psi_n = d_psi_n * d_psi;\n d_phi = d_phi + this.D[n] * d_psi_n;\n }\n\n // 4. Calculate latitude and longitude\n // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.\n var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);\n var lon = this.long0 + d_lambda;\n\n p.x = lon;\n p.y = lat;\n\n return p;\n}\n\nexport var names = [\"New_Zealand_Map_Grid\", \"nzmg\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\n/*\n reference\n \"New Equal-Area Map Projections for Noncircular Regions\", John P. Snyder,\n The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.\n */\n\n\n/* Initialize the Miller Cylindrical projection\n -------------------------------------------*/\nexport function init() {\n //no-op\n}\n\n/* Miller Cylindrical forward equations--mapping lat,long to x,y\n ------------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n var x = this.x0 + this.a * dlon;\n var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Miller Cylindrical inverse equations--mapping x,y to lat/long\n ------------------------------------------------------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n\n var lon = adjust_lon(this.long0 + p.x / this.a);\n var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Miller_Cylindrical\", \"mill\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport pj_enfn from '../common/pj_enfn';\nvar MAX_ITER = 20;\nimport pj_mlfn from '../common/pj_mlfn';\nimport pj_inv_mlfn from '../common/pj_inv_mlfn';\nimport {EPSLN, HALF_PI} from '../constants/values';\n\nimport asinz from '../common/asinz';\n\n\nexport function init() {\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n\n\n if (!this.sphere) {\n this.en = pj_enfn(this.es);\n }\n else {\n this.n = 1;\n this.m = 0;\n this.es = 0;\n this.C_y = Math.sqrt((this.m + 1) / this.n);\n this.C_x = this.C_y / (this.m + 1);\n }\n\n}\n\n/* Sinusoidal forward equations--mapping lat,long to x,y\n -----------------------------------------------------*/\nexport function forward(p) {\n var x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n lon = adjust_lon(lon - this.long0);\n\n if (this.sphere) {\n if (!this.m) {\n lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;\n }\n else {\n var k = this.n * Math.sin(lat);\n for (var i = MAX_ITER; i; --i) {\n var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));\n lat -= V;\n if (Math.abs(V) < EPSLN) {\n break;\n }\n }\n }\n x = this.a * this.C_x * lon * (this.m + Math.cos(lat));\n y = this.a * this.C_y * lat;\n\n }\n else {\n\n var s = Math.sin(lat);\n var c = Math.cos(lat);\n y = this.a * pj_mlfn(lat, s, c, this.en);\n x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);\n }\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var lat, temp, lon, s;\n\n p.x -= this.x0;\n lon = p.x / this.a;\n p.y -= this.y0;\n lat = p.y / this.a;\n\n if (this.sphere) {\n lat /= this.C_y;\n lon = lon / (this.C_x * (this.m + Math.cos(lat)));\n if (this.m) {\n lat = asinz((this.m * lat + Math.sin(lat)) / this.n);\n }\n else if (this.n !== 1) {\n lat = asinz(Math.sin(lat) / this.n);\n }\n lon = adjust_lon(lon + this.long0);\n lat = adjust_lat(lat);\n }\n else {\n lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);\n s = Math.abs(lat);\n if (s < HALF_PI) {\n s = Math.sin(lat);\n temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));\n //temp = this.long0 + p.x / (this.a * Math.cos(lat));\n lon = adjust_lon(temp);\n }\n else if ((s - EPSLN) < HALF_PI) {\n lon = this.long0;\n }\n }\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Sinusoidal\", \"sinu\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nexport function init() {}\nimport {EPSLN} from '../constants/values';\n/* Mollweide forward equations--mapping lat,long to x,y\n ----------------------------------------------------*/\nexport function forward(p) {\n\n /* Forward equations\n -----------------*/\n var lon = p.x;\n var lat = p.y;\n\n var delta_lon = adjust_lon(lon - this.long0);\n var theta = lat;\n var con = Math.PI * Math.sin(lat);\n\n /* Iterate using the Newton-Raphson method to find theta\n -----------------------------------------------------*/\n while (true) {\n var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));\n theta += delta_theta;\n if (Math.abs(delta_theta) < EPSLN) {\n break;\n }\n }\n theta /= 2;\n\n /* If the latitude is 90 deg, force the x coordinate to be \"0 + false easting\"\n this is done here because of precision problems with \"cos(theta)\"\n --------------------------------------------------------------------------*/\n if (Math.PI / 2 - Math.abs(lat) < EPSLN) {\n delta_lon = 0;\n }\n var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;\n var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;\n\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var theta;\n var arg;\n\n /* Inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n arg = p.y / (1.4142135623731 * this.a);\n\n /* Because of division by zero problems, 'arg' can not be 1. Therefore\n a number very close to one is used instead.\n -------------------------------------------------------------------*/\n if (Math.abs(arg) > 0.999999999999) {\n arg = 0.999999999999;\n }\n theta = Math.asin(arg);\n var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));\n if (lon < (-Math.PI)) {\n lon = -Math.PI;\n }\n if (lon > Math.PI) {\n lon = Math.PI;\n }\n arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;\n if (Math.abs(arg) > 1) {\n arg = 1;\n }\n var lat = Math.asin(arg);\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Mollweide\", \"moll\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport msfnz from '../common/msfnz';\nimport mlfn from '../common/mlfn';\nimport adjust_lon from '../common/adjust_lon';\nimport adjust_lat from '../common/adjust_lat';\nimport imlfn from '../common/imlfn';\nimport {EPSLN} from '../constants/values';\n\nexport function init() {\n\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n // Standard Parallels cannot be equal and on opposite sides of the equator\n if (Math.abs(this.lat1 + this.lat2) < EPSLN) {\n return;\n }\n this.lat2 = this.lat2 || this.lat1;\n this.temp = this.b / this.a;\n this.es = 1 - Math.pow(this.temp, 2);\n this.e = Math.sqrt(this.es);\n this.e0 = e0fn(this.es);\n this.e1 = e1fn(this.es);\n this.e2 = e2fn(this.es);\n this.e3 = e3fn(this.es);\n\n this.sinphi = Math.sin(this.lat1);\n this.cosphi = Math.cos(this.lat1);\n\n this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);\n this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);\n\n if (Math.abs(this.lat1 - this.lat2) < EPSLN) {\n this.ns = this.sinphi;\n }\n else {\n this.sinphi = Math.sin(this.lat2);\n this.cosphi = Math.cos(this.lat2);\n this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);\n this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);\n this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);\n }\n this.g = this.ml1 + this.ms1 / this.ns;\n this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);\n this.rh = this.a * (this.g - this.ml0);\n}\n\n/* Equidistant Conic forward equations--mapping lat,long to x,y\n -----------------------------------------------------------*/\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var rh1;\n\n /* Forward equations\n -----------------*/\n if (this.sphere) {\n rh1 = this.a * (this.g - lat);\n }\n else {\n var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);\n rh1 = this.a * (this.g - ml);\n }\n var theta = this.ns * adjust_lon(lon - this.long0);\n var x = this.x0 + rh1 * Math.sin(theta);\n var y = this.y0 + this.rh - rh1 * Math.cos(theta);\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Inverse equations\n -----------------*/\nexport function inverse(p) {\n p.x -= this.x0;\n p.y = this.rh - p.y + this.y0;\n var con, rh1, lat, lon;\n if (this.ns >= 0) {\n rh1 = Math.sqrt(p.x * p.x + p.y * p.y);\n con = 1;\n }\n else {\n rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);\n con = -1;\n }\n var theta = 0;\n if (rh1 !== 0) {\n theta = Math.atan2(con * p.x, con * p.y);\n }\n\n if (this.sphere) {\n lon = adjust_lon(this.long0 + theta / this.ns);\n lat = adjust_lat(this.g - rh1 / this.a);\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n var ml = this.g - rh1 / this.a;\n lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);\n lon = adjust_lon(this.long0 + theta / this.ns);\n p.x = lon;\n p.y = lat;\n return p;\n }\n\n}\n\nexport var names = [\"Equidistant_Conic\", \"eqdc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\n\nimport {HALF_PI, EPSLN} from '../constants/values';\n\nimport asinz from '../common/asinz';\n\n/* Initialize the Van Der Grinten projection\n ----------------------------------------*/\nexport function init() {\n //this.R = 6370997; //Radius of earth\n this.R = this.a;\n}\n\nexport function forward(p) {\n\n var lon = p.x;\n var lat = p.y;\n\n /* Forward equations\n -----------------*/\n var dlon = adjust_lon(lon - this.long0);\n var x, y;\n\n if (Math.abs(lat) <= EPSLN) {\n x = this.x0 + this.R * dlon;\n y = this.y0;\n }\n var theta = asinz(2 * Math.abs(lat / Math.PI));\n if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {\n x = this.x0;\n if (lat >= 0) {\n y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);\n }\n else {\n y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);\n }\n // return(OK);\n }\n var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));\n var asq = al * al;\n var sinth = Math.sin(theta);\n var costh = Math.cos(theta);\n\n var g = costh / (sinth + costh - 1);\n var gsq = g * g;\n var m = g * (2 / sinth - 1);\n var msq = m * m;\n var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);\n if (dlon < 0) {\n con = -con;\n }\n x = this.x0 + con;\n //con = Math.abs(con / (Math.PI * this.R));\n var q = asq + g;\n con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);\n if (lat >= 0) {\n //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 + con;\n }\n else {\n //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);\n y = this.y0 - con;\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\n/* Van Der Grinten inverse equations--mapping x,y to lat/long\n ---------------------------------------------------------*/\nexport function inverse(p) {\n var lon, lat;\n var xx, yy, xys, c1, c2, c3;\n var a1;\n var m1;\n var con;\n var th1;\n var d;\n\n /* inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n con = Math.PI * this.R;\n xx = p.x / con;\n yy = p.y / con;\n xys = xx * xx + yy * yy;\n c1 = -Math.abs(yy) * (1 + xys);\n c2 = c1 - 2 * yy * yy + xx * xx;\n c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;\n d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;\n a1 = (c1 - c2 * c2 / 3 / c3) / c3;\n m1 = 2 * Math.sqrt(-a1 / 3);\n con = ((3 * d) / a1) / m1;\n if (Math.abs(con) > 1) {\n if (con >= 0) {\n con = 1;\n }\n else {\n con = -1;\n }\n }\n th1 = Math.acos(con) / 3;\n if (p.y >= 0) {\n lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n else {\n lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;\n }\n\n if (Math.abs(xx) < EPSLN) {\n lon = this.long0;\n }\n else {\n lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"Van_der_Grinten_I\", \"VanDerGrinten\", \"vandg\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport {HALF_PI, EPSLN} from '../constants/values';\n\nimport mlfn from '../common/mlfn';\nimport e0fn from '../common/e0fn';\nimport e1fn from '../common/e1fn';\nimport e2fn from '../common/e2fn';\nimport e3fn from '../common/e3fn';\nimport gN from '../common/gN';\nimport asinz from '../common/asinz';\nimport imlfn from '../common/imlfn';\n\n\n\nexport function init() {\n this.sin_p12 = Math.sin(this.lat0);\n this.cos_p12 = Math.cos(this.lat0);\n}\n\nexport function forward(p) {\n var lon = p.x;\n var lat = p.y;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var dlon = adjust_lon(lon - this.long0);\n var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;\n if (this.sphere) {\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North Pole case\n p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);\n p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);\n return p;\n }\n else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South Pole case\n p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);\n p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);\n return p;\n }\n else {\n //default case\n cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);\n c = Math.acos(cos_c);\n kp = c ? c / Math.sin(c) : 1;\n p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);\n p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));\n return p;\n }\n }\n else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);\n p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);\n return p;\n }\n else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South Pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n Ml = this.a * mlfn(e0, e1, e2, e3, lat);\n p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);\n p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);\n return p;\n }\n else {\n //Default case\n tanphi = sinphi / cosphi;\n Nl1 = gN(this.a, this.e, this.sin_p12);\n Nl = gN(this.a, this.e, sinphi);\n psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));\n Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));\n if (Az === 0) {\n s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));\n }\n else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {\n s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));\n }\n else {\n s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));\n }\n G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);\n H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);\n GH = G * H;\n Hs = H * H;\n s2 = s * s;\n s3 = s2 * s;\n s4 = s3 * s;\n s5 = s4 * s;\n c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);\n p.x = this.x0 + c * Math.sin(Az);\n p.y = this.y0 + c * Math.cos(Az);\n return p;\n }\n }\n\n\n}\n\nexport function inverse(p) {\n p.x -= this.x0;\n p.y -= this.y0;\n var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;\n if (this.sphere) {\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n if (rh > (2 * HALF_PI * this.a)) {\n return;\n }\n z = rh / this.a;\n\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n\n lon = this.long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = this.lat0;\n }\n else {\n lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);\n con = Math.abs(this.lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (this.lat0 >= 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));\n }\n else {\n lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));\n }\n }\n else {\n /*con = cosz - this.sin_p12 * Math.sin(lat);\n if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {\n //no-op, just keep the lon value as is\n } else {\n var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));\n lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));\n }*/\n lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));\n }\n }\n\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n e0 = e0fn(this.es);\n e1 = e1fn(this.es);\n e2 = e2fn(this.es);\n e3 = e3fn(this.es);\n if (Math.abs(this.sin_p12 - 1) <= EPSLN) {\n //North pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = Mlp - rh;\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));\n p.x = lon;\n p.y = lat;\n return p;\n }\n else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {\n //South pole case\n Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n M = rh - Mlp;\n\n lat = imlfn(M / this.a, e0, e1, e2, e3);\n lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));\n p.x = lon;\n p.y = lat;\n return p;\n }\n else {\n //default case\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n Az = Math.atan2(p.x, p.y);\n N1 = gN(this.a, this.e, this.sin_p12);\n cosAz = Math.cos(Az);\n tmp = this.e * this.cos_p12 * cosAz;\n A = -tmp * tmp / (1 - this.es);\n B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);\n D = rh / N1;\n Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;\n F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;\n psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);\n lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));\n sinpsi = Math.sin(psi);\n lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));\n p.x = lon;\n p.y = lat;\n return p;\n }\n }\n\n}\n\nexport var names = [\"Azimuthal_Equidistant\", \"aeqd\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import adjust_lon from '../common/adjust_lon';\nimport asinz from '../common/asinz';\nimport {EPSLN, HALF_PI} from '../constants/values';\n\nexport function init() {\n //double temp; /* temporary variable */\n\n /* Place parameters in static storage for common use\n -------------------------------------------------*/\n this.sin_p14 = Math.sin(this.lat0);\n this.cos_p14 = Math.cos(this.lat0);\n}\n\n/* Orthographic forward equations--mapping lat,long to x,y\n ---------------------------------------------------*/\nexport function forward(p) {\n var sinphi, cosphi; /* sin and cos value */\n var dlon; /* delta longitude value */\n var coslon; /* cos of longitude */\n var ksp; /* scale factor */\n var g, x, y;\n var lon = p.x;\n var lat = p.y;\n /* Forward equations\n -----------------*/\n dlon = adjust_lon(lon - this.long0);\n\n sinphi = Math.sin(lat);\n cosphi = Math.cos(lat);\n\n coslon = Math.cos(dlon);\n g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;\n ksp = 1;\n if ((g > 0) || (Math.abs(g) <= EPSLN)) {\n x = this.a * ksp * cosphi * Math.sin(dlon);\n y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);\n }\n p.x = x;\n p.y = y;\n return p;\n}\n\nexport function inverse(p) {\n var rh; /* height above ellipsoid */\n var z; /* angle */\n var sinz, cosz; /* sin of z and cos of z */\n var con;\n var lon, lat;\n /* Inverse equations\n -----------------*/\n p.x -= this.x0;\n p.y -= this.y0;\n rh = Math.sqrt(p.x * p.x + p.y * p.y);\n z = asinz(rh / this.a);\n\n sinz = Math.sin(z);\n cosz = Math.cos(z);\n\n lon = this.long0;\n if (Math.abs(rh) <= EPSLN) {\n lat = this.lat0;\n p.x = lon;\n p.y = lat;\n return p;\n }\n lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);\n con = Math.abs(this.lat0) - HALF_PI;\n if (Math.abs(con) <= EPSLN) {\n if (this.lat0 >= 0) {\n lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));\n }\n else {\n lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));\n }\n p.x = lon;\n p.y = lat;\n return p;\n }\n lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));\n p.x = lon;\n p.y = lat;\n return p;\n}\n\nexport var names = [\"ortho\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","// QSC projection rewritten from the original PROJ4\n// https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c\n\nimport {EPSLN, TWO_PI, SPI, HALF_PI, FORTPI} from '../constants/values';\n\n/* constants */\nvar FACE_ENUM = {\n FRONT: 1,\n RIGHT: 2,\n BACK: 3,\n LEFT: 4,\n TOP: 5,\n BOTTOM: 6\n};\n\nvar AREA_ENUM = {\n AREA_0: 1,\n AREA_1: 2,\n AREA_2: 3,\n AREA_3: 4\n};\n\nexport function init() {\n\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.lat0 = this.lat0 || 0;\n this.long0 = this.long0 || 0;\n this.lat_ts = this.lat_ts || 0;\n this.title = this.title || \"Quadrilateralized Spherical Cube\";\n\n /* Determine the cube face from the center of projection. */\n if (this.lat0 >= HALF_PI - FORTPI / 2.0) {\n this.face = FACE_ENUM.TOP;\n } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {\n this.face = FACE_ENUM.BOTTOM;\n } else if (Math.abs(this.long0) <= FORTPI) {\n this.face = FACE_ENUM.FRONT;\n } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {\n this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;\n } else {\n this.face = FACE_ENUM.BACK;\n }\n\n /* Fill in useful values for the ellipsoid <-> sphere shift\n * described in [LK12]. */\n if (this.es !== 0) {\n this.one_minus_f = 1 - (this.a - this.b) / this.a;\n this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;\n }\n}\n\n// QSC forward equations--mapping lat,long to x,y\n// -----------------------------------------------------------------\nexport function forward(p) {\n var xy = {x: 0, y: 0};\n var lat, lon;\n var theta, phi;\n var t, mu;\n /* nu; */\n var area = {value: 0};\n\n // move lon according to projection's lon\n p.x -= this.long0;\n\n /* Convert the geodetic latitude to a geocentric latitude.\n * This corresponds to the shift from the ellipsoid to the sphere\n * described in [LK12]. */\n if (this.es !== 0) {//if (P->es != 0) {\n lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));\n } else {\n lat = p.y;\n }\n\n /* Convert the input lat, lon into theta, phi as used by QSC.\n * This depends on the cube face and the area on it.\n * For the top and bottom face, we can compute theta and phi\n * directly from phi, lam. For the other faces, we must use\n * unit sphere cartesian coordinates as an intermediate step. */\n lon = p.x; //lon = lp.lam;\n if (this.face === FACE_ENUM.TOP) {\n phi = HALF_PI - lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = lon - HALF_PI;\n } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_1;\n theta = (lon > 0.0 ? lon - SPI : lon + SPI);\n } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {\n area.value = AREA_ENUM.AREA_2;\n theta = lon + HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = lon;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = HALF_PI + lat;\n if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n theta = -lon + HALF_PI;\n } else if (lon < FORTPI && lon >= -FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta = -lon;\n } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = -lon - HALF_PI;\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);\n }\n } else {\n var q, r, s;\n var sinlat, coslat;\n var sinlon, coslon;\n\n if (this.face === FACE_ENUM.RIGHT) {\n lon = qsc_shift_lon_origin(lon, +HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lon = qsc_shift_lon_origin(lon, +SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lon = qsc_shift_lon_origin(lon, -HALF_PI);\n }\n sinlat = Math.sin(lat);\n coslat = Math.cos(lat);\n sinlon = Math.sin(lon);\n coslon = Math.cos(lon);\n q = coslat * coslon;\n r = coslat * sinlon;\n s = sinlat;\n\n if (this.face === FACE_ENUM.FRONT) {\n phi = Math.acos(q);\n theta = qsc_fwd_equat_face_theta(phi, s, r, area);\n } else if (this.face === FACE_ENUM.RIGHT) {\n phi = Math.acos(r);\n theta = qsc_fwd_equat_face_theta(phi, s, -q, area);\n } else if (this.face === FACE_ENUM.BACK) {\n phi = Math.acos(-q);\n theta = qsc_fwd_equat_face_theta(phi, s, -r, area);\n } else if (this.face === FACE_ENUM.LEFT) {\n phi = Math.acos(-r);\n theta = qsc_fwd_equat_face_theta(phi, s, q, area);\n } else {\n /* Impossible */\n phi = theta = 0;\n area.value = AREA_ENUM.AREA_0;\n }\n }\n\n /* Compute mu and nu for the area of definition.\n * For mu, see Eq. (3-21) in [OL76], but note the typos:\n * compare with Eq. (3-14). For nu, see Eq. (3-38). */\n mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));\n t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));\n\n /* Apply the result to the real area. */\n if (area.value === AREA_ENUM.AREA_1) {\n mu += HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_2) {\n mu += SPI;\n } else if (area.value === AREA_ENUM.AREA_3) {\n mu += 1.5 * SPI;\n }\n\n /* Now compute x, y from mu and nu */\n xy.x = t * Math.cos(mu);\n xy.y = t * Math.sin(mu);\n xy.x = xy.x * this.a + this.x0;\n xy.y = xy.y * this.a + this.y0;\n\n p.x = xy.x;\n p.y = xy.y;\n return p;\n}\n\n// QSC inverse equations--mapping x,y to lat/long\n// -----------------------------------------------------------------\nexport function inverse(p) {\n var lp = {lam: 0, phi: 0};\n var mu, nu, cosmu, tannu;\n var tantheta, theta, cosphi, phi;\n var t;\n var area = {value: 0};\n\n /* de-offset */\n p.x = (p.x - this.x0) / this.a;\n p.y = (p.y - this.y0) / this.a;\n\n /* Convert the input x, y to the mu and nu angles as used by QSC.\n * This depends on the area of the cube face. */\n nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));\n mu = Math.atan2(p.y, p.x);\n if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_0;\n } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {\n area.value = AREA_ENUM.AREA_1;\n mu -= HALF_PI;\n } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {\n area.value = AREA_ENUM.AREA_2;\n mu = (mu < 0.0 ? mu + SPI : mu - SPI);\n } else {\n area.value = AREA_ENUM.AREA_3;\n mu += HALF_PI;\n }\n\n /* Compute phi and theta for the area of definition.\n * The inverse projection is not described in the original paper, but some\n * good hints can be found here (as of 2011-12-14):\n * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302\n * (search for \"Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>\") */\n t = (SPI / 12) * Math.tan(mu);\n tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));\n theta = Math.atan(tantheta);\n cosmu = Math.cos(mu);\n tannu = Math.tan(nu);\n cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));\n if (cosphi < -1) {\n cosphi = -1;\n } else if (cosphi > +1) {\n cosphi = +1;\n }\n\n /* Apply the result to the real area on the cube face.\n * For the top and bottom face, we can compute phi and lam directly.\n * For the other faces, we must use unit sphere cartesian coordinates\n * as an intermediate step. */\n if (this.face === FACE_ENUM.TOP) {\n phi = Math.acos(cosphi);\n lp.phi = HALF_PI - phi;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */ {\n lp.lam = theta;\n }\n } else if (this.face === FACE_ENUM.BOTTOM) {\n phi = Math.acos(cosphi);\n lp.phi = phi - HALF_PI;\n if (area.value === AREA_ENUM.AREA_0) {\n lp.lam = -theta + HALF_PI;\n } else if (area.value === AREA_ENUM.AREA_1) {\n lp.lam = -theta;\n } else if (area.value === AREA_ENUM.AREA_2) {\n lp.lam = -theta - HALF_PI;\n } else /* area.value == AREA_ENUM.AREA_3 */ {\n lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);\n }\n } else {\n /* Compute phi and lam via cartesian unit sphere coordinates. */\n var q, r, s;\n q = cosphi;\n t = q * q;\n if (t >= 1) {\n s = 0;\n } else {\n s = Math.sqrt(1 - t) * Math.sin(theta);\n }\n t += s * s;\n if (t >= 1) {\n r = 0;\n } else {\n r = Math.sqrt(1 - t);\n }\n /* Rotate q,r,s into the correct area. */\n if (area.value === AREA_ENUM.AREA_1) {\n t = r;\n r = -s;\n s = t;\n } else if (area.value === AREA_ENUM.AREA_2) {\n r = -r;\n s = -s;\n } else if (area.value === AREA_ENUM.AREA_3) {\n t = r;\n r = s;\n s = -t;\n }\n /* Rotate q,r,s into the correct cube face. */\n if (this.face === FACE_ENUM.RIGHT) {\n t = q;\n q = -r;\n r = t;\n } else if (this.face === FACE_ENUM.BACK) {\n q = -q;\n r = -r;\n } else if (this.face === FACE_ENUM.LEFT) {\n t = q;\n q = r;\n r = -t;\n }\n /* Now compute phi and lam from the unit sphere coordinates. */\n lp.phi = Math.acos(-s) - HALF_PI;\n lp.lam = Math.atan2(r, q);\n if (this.face === FACE_ENUM.RIGHT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);\n } else if (this.face === FACE_ENUM.BACK) {\n lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);\n } else if (this.face === FACE_ENUM.LEFT) {\n lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);\n }\n }\n\n /* Apply the shift from the sphere to the ellipsoid as described\n * in [LK12]. */\n if (this.es !== 0) {\n var invert_sign;\n var tanphi, xa;\n invert_sign = (lp.phi < 0 ? 1 : 0);\n tanphi = Math.tan(lp.phi);\n xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);\n lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));\n if (invert_sign) {\n lp.phi = -lp.phi;\n }\n }\n\n lp.lam += this.long0;\n p.x = lp.lam;\n p.y = lp.phi;\n return p;\n}\n\n/* Helper function for forward projection: compute the theta angle\n * and determine the area number. */\nfunction qsc_fwd_equat_face_theta(phi, y, x, area) {\n var theta;\n if (phi < EPSLN) {\n area.value = AREA_ENUM.AREA_0;\n theta = 0.0;\n } else {\n theta = Math.atan2(y, x);\n if (Math.abs(theta) <= FORTPI) {\n area.value = AREA_ENUM.AREA_0;\n } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {\n area.value = AREA_ENUM.AREA_1;\n theta -= HALF_PI;\n } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {\n area.value = AREA_ENUM.AREA_2;\n theta = (theta >= 0.0 ? theta - SPI : theta + SPI);\n } else {\n area.value = AREA_ENUM.AREA_3;\n theta += HALF_PI;\n }\n }\n return theta;\n}\n\n/* Helper function: shift the longitude. */\nfunction qsc_shift_lon_origin(lon, offset) {\n var slon = lon + offset;\n if (slon < -SPI) {\n slon += TWO_PI;\n } else if (slon > +SPI) {\n slon -= TWO_PI;\n }\n return slon;\n}\n\nexport var names = [\"Quadrilateralized Spherical Cube\", \"Quadrilateralized_Spherical_Cube\", \"qsc\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n\n","// Robinson projection\n// Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c\n// Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039\n\nimport {HALF_PI, D2R, R2D, EPSLN} from '../constants/values';\nimport adjust_lon from '../common/adjust_lon';\n\nvar COEFS_X = [\n [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],\n [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],\n [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],\n [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],\n [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],\n [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],\n [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],\n [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],\n [0.9216, -0.00467746, -0.00010457, 4.81243e-06],\n [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],\n [0.8679, -0.00609363, -0.000113898, 3.32484e-06],\n [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],\n [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],\n [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],\n [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],\n [0.6732, -0.00986209, -0.000199569, 1.91974e-05],\n [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],\n [0.5722, -0.00906601, 0.000182, 6.24051e-06],\n [0.5322, -0.00677797, 0.000275608, 6.24051e-06]\n];\n\nvar COEFS_Y = [\n [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],\n [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],\n [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],\n [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],\n [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],\n [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],\n [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],\n [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],\n [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],\n [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],\n [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],\n [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],\n [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],\n [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],\n [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],\n [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],\n [0.9394, 0.00840947, -0.000192841, -4.2106e-06],\n [0.9761, 0.00616527, -0.000256, -4.2106e-06],\n [1.0000, 0.00328947, -0.000319159, -4.2106e-06]\n];\n\nvar FXC = 0.8487;\nvar FYC = 1.3523;\nvar C1 = R2D/5; // rad to 5-degree interval\nvar RC1 = 1/C1;\nvar NODES = 18;\n\nvar poly3_val = function(coefs, x) {\n return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));\n};\n\nvar poly3_der = function(coefs, x) {\n return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);\n};\n\nfunction newton_rapshon(f_df, start, max_err, iters) {\n var x = start;\n for (; iters; --iters) {\n var upd = f_df(x);\n x -= upd;\n if (Math.abs(upd) < max_err) {\n break;\n }\n }\n return x;\n}\n\nexport function init() {\n this.x0 = this.x0 || 0;\n this.y0 = this.y0 || 0;\n this.long0 = this.long0 || 0;\n this.es = 0;\n this.title = this.title || \"Robinson\";\n}\n\nexport function forward(ll) {\n var lon = adjust_lon(ll.x - this.long0);\n\n var dphi = Math.abs(ll.y);\n var i = Math.floor(dphi * C1);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n dphi = R2D * (dphi - RC1 * i);\n var xy = {\n x: poly3_val(COEFS_X[i], dphi) * lon,\n y: poly3_val(COEFS_Y[i], dphi)\n };\n if (ll.y < 0) {\n xy.y = -xy.y;\n }\n\n xy.x = xy.x * this.a * FXC + this.x0;\n xy.y = xy.y * this.a * FYC + this.y0;\n return xy;\n}\n\nexport function inverse(xy) {\n var ll = {\n x: (xy.x - this.x0) / (this.a * FXC),\n y: Math.abs(xy.y - this.y0) / (this.a * FYC)\n };\n\n if (ll.y >= 1) { // pathologic case\n ll.x /= COEFS_X[NODES][0];\n ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;\n } else {\n // find table interval\n var i = Math.floor(ll.y * NODES);\n if (i < 0) {\n i = 0;\n } else if (i >= NODES) {\n i = NODES - 1;\n }\n for (;;) {\n if (COEFS_Y[i][0] > ll.y) {\n --i;\n } else if (COEFS_Y[i+1][0] <= ll.y) {\n ++i;\n } else {\n break;\n }\n }\n // linear interpolation in 5 degree interval\n var coefs = COEFS_Y[i];\n var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);\n // find t so that poly3_val(coefs, t) = ll.y\n t = newton_rapshon(function(x) {\n return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);\n }, t, EPSLN, 100);\n\n ll.x /= poly3_val(COEFS_X[i], t);\n ll.y = (5 * i + t) * D2R;\n if (xy.y < 0) {\n ll.y = -ll.y;\n }\n }\n\n ll.x = adjust_lon(ll.x + this.long0);\n return ll;\n}\n\nexport var names = [\"Robinson\", \"robin\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import {\n geodeticToGeocentric,\n geocentricToGeodetic\n} from '../datumUtils';\n\nexport function init() {\n this.name = 'geocent';\n\n}\n\nexport function forward(p) {\n var point = geodeticToGeocentric(p, this.es, this.a);\n return point;\n}\n\nexport function inverse(p) {\n var point = geocentricToGeodetic(p, this.es, this.a, this.b);\n return point;\n}\n\nexport var names = [\"Geocentric\", 'geocentric', \"geocent\", \"Geocent\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};","\nvar mode = {\n N_POLE: 0,\n S_POLE: 1,\n EQUIT: 2,\n OBLIQ: 3\n};\n\nimport { D2R, HALF_PI, EPSLN } from \"../constants/values\";\nimport hypot from \"../common/hypot\";\n\nvar params = {\n h: { def: 100000, num: true }, // default is Karman line, no default in PROJ.7\n azi: { def: 0, num: true, degrees: true }, // default is North\n tilt: { def: 0, num: true, degrees: true }, // default is Nadir\n long0: { def: 0, num: true }, // default is Greenwich, conversion to rad is automatic\n lat0: { def: 0, num: true } // default is Equator, conversion to rad is automatic\n};\n\nexport function init() {\n Object.keys(params).forEach(function (p) {\n if (typeof this[p] === \"undefined\") {\n this[p] = params[p].def;\n } else if (params[p].num && isNaN(this[p])) {\n throw new Error(\"Invalid parameter value, must be numeric \" + p + \" = \" + this[p]);\n } else if (params[p].num) {\n this[p] = parseFloat(this[p]);\n }\n if (params[p].degrees) {\n this[p] = this[p] * D2R;\n }\n }.bind(this));\n\n if (Math.abs((Math.abs(this.lat0) - HALF_PI)) < EPSLN) {\n this.mode = this.lat0 < 0 ? mode.S_POLE : mode.N_POLE;\n } else if (Math.abs(this.lat0) < EPSLN) {\n this.mode = mode.EQUIT;\n } else {\n this.mode = mode.OBLIQ;\n this.sinph0 = Math.sin(this.lat0);\n this.cosph0 = Math.cos(this.lat0);\n }\n\n this.pn1 = this.h / this.a; // Normalize relative to the Earth's radius\n\n if (this.pn1 <= 0 || this.pn1 > 1e10) {\n throw new Error(\"Invalid height\");\n }\n \n this.p = 1 + this.pn1;\n this.rp = 1 / this.p;\n this.h1 = 1 / this.pn1;\n this.pfact = (this.p + 1) * this.h1;\n this.es = 0;\n\n var omega = this.tilt;\n var gamma = this.azi;\n this.cg = Math.cos(gamma);\n this.sg = Math.sin(gamma);\n this.cw = Math.cos(omega);\n this.sw = Math.sin(omega);\n}\n\nexport function forward(p) {\n p.x -= this.long0;\n var sinphi = Math.sin(p.y);\n var cosphi = Math.cos(p.y);\n var coslam = Math.cos(p.x);\n var x, y;\n switch (this.mode) {\n case mode.OBLIQ:\n y = this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y = cosphi * coslam;\n break;\n case mode.S_POLE:\n y = -sinphi;\n break;\n case mode.N_POLE:\n y = sinphi;\n break;\n }\n y = this.pn1 / (this.p - y);\n x = y * cosphi * Math.sin(p.x);\n\n switch (this.mode) {\n case mode.OBLIQ:\n y *= this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;\n break;\n case mode.EQUIT:\n y *= sinphi;\n break;\n case mode.N_POLE:\n y *= -(cosphi * coslam);\n break;\n case mode.S_POLE:\n y *= cosphi * coslam;\n break;\n }\n\n // Tilt \n var yt, ba;\n yt = y * this.cg + x * this.sg;\n ba = 1 / (yt * this.sw * this.h1 + this.cw);\n x = (x * this.cg - y * this.sg) * this.cw * ba;\n y = yt * ba;\n\n p.x = x * this.a;\n p.y = y * this.a;\n return p;\n}\n\nexport function inverse(p) {\n p.x /= this.a;\n p.y /= this.a;\n var r = { x: p.x, y: p.y };\n\n // Un-Tilt\n var bm, bq, yt;\n yt = 1 / (this.pn1 - p.y * this.sw);\n bm = this.pn1 * p.x * yt;\n bq = this.pn1 * p.y * this.cw * yt;\n p.x = bm * this.cg + bq * this.sg;\n p.y = bq * this.cg - bm * this.sg;\n\n var rh = hypot(p.x, p.y);\n if (Math.abs(rh) < EPSLN) {\n r.x = 0;\n r.y = p.y;\n } else {\n var cosz, sinz;\n sinz = 1 - rh * rh * this.pfact;\n sinz = (this.p - Math.sqrt(sinz)) / (this.pn1 / rh + rh / this.pn1);\n cosz = Math.sqrt(1 - sinz * sinz);\n switch (this.mode) {\n case mode.OBLIQ:\n r.y = Math.asin(cosz * this.sinph0 + p.y * sinz * this.cosph0 / rh);\n p.y = (cosz - this.sinph0 * Math.sin(r.y)) * rh;\n p.x *= sinz * this.cosph0;\n break;\n case mode.EQUIT:\n r.y = Math.asin(p.y * sinz / rh);\n p.y = cosz * rh;\n p.x *= sinz;\n break;\n case mode.N_POLE:\n r.y = Math.asin(cosz);\n p.y = -p.y;\n break;\n case mode.S_POLE:\n r.y = -Math.asin(cosz);\n break;\n }\n r.x = Math.atan2(p.x, p.y);\n }\n\n p.x = r.x + this.long0;\n p.y = r.y;\n return p;\n}\n\nexport var names = [\"Tilted_Perspective\", \"tpers\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names\n};\n","import hypot from '../common/hypot';\n\nexport function init() {\n this.flip_axis = (this.sweep === 'x' ? 1 : 0);\n this.h = Number(this.h);\n this.radius_g_1 = this.h / this.a;\n\n if (this.radius_g_1 <= 0 || this.radius_g_1 > 1e10) {\n throw new Error();\n }\n\n this.radius_g = 1.0 + this.radius_g_1;\n this.C = this.radius_g * this.radius_g - 1.0;\n\n if (this.es !== 0.0) {\n var one_es = 1.0 - this.es;\n var rone_es = 1 / one_es;\n\n this.radius_p = Math.sqrt(one_es);\n this.radius_p2 = one_es;\n this.radius_p_inv2 = rone_es;\n\n this.shape = 'ellipse'; // Use as a condition in the forward and inverse functions.\n } else {\n this.radius_p = 1.0;\n this.radius_p2 = 1.0;\n this.radius_p_inv2 = 1.0;\n\n this.shape = 'sphere'; // Use as a condition in the forward and inverse functions.\n }\n\n if (!this.title) {\n this.title = \"Geostationary Satellite View\";\n }\n}\n\nfunction forward(p) {\n var lon = p.x;\n var lat = p.y;\n var tmp, v_x, v_y, v_z;\n lon = lon - this.long0;\n\n if (this.shape === 'ellipse') {\n lat = Math.atan(this.radius_p2 * Math.tan(lat));\n var r = this.radius_p / hypot(this.radius_p * Math.cos(lat), Math.sin(lat));\n\n v_x = r * Math.cos(lon) * Math.cos(lat);\n v_y = r * Math.sin(lon) * Math.cos(lat);\n v_z = r * Math.sin(lat);\n\n if (((this.radius_g - v_x) * v_x - v_y * v_y - v_z * v_z * this.radius_p_inv2) < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n tmp = this.radius_g - v_x;\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n } else if (this.shape === 'sphere') {\n tmp = Math.cos(lat);\n v_x = Math.cos(lon) * tmp;\n v_y = Math.sin(lon) * tmp;\n v_z = Math.sin(lat);\n tmp = this.radius_g - v_x;\n\n if (this.flip_axis) {\n p.x = this.radius_g_1 * Math.atan(v_y / hypot(v_z, tmp));\n p.y = this.radius_g_1 * Math.atan(v_z / tmp);\n } else {\n p.x = this.radius_g_1 * Math.atan(v_y / tmp);\n p.y = this.radius_g_1 * Math.atan(v_z / hypot(v_y, tmp));\n }\n }\n p.x = p.x * this.a;\n p.y = p.y * this.a;\n return p;\n}\n\nfunction inverse(p) {\n var v_x = -1.0;\n var v_y = 0.0;\n var v_z = 0.0;\n var a, b, det, k;\n\n p.x = p.x / this.a;\n p.y = p.y / this.a;\n\n if (this.shape === 'ellipse') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * hypot(1.0, v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * hypot(1.0, v_y);\n }\n\n var v_zp = v_z / this.radius_p;\n a = v_y * v_y + v_zp * v_zp + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = (b * b) - 4 * a * this.C;\n\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n p.y = Math.atan(this.radius_p_inv2 * Math.tan(p.y));\n } else if (this.shape === 'sphere') {\n if (this.flip_axis) {\n v_z = Math.tan(p.y / this.radius_g_1);\n v_y = Math.tan(p.x / this.radius_g_1) * Math.sqrt(1.0 + v_z * v_z);\n } else {\n v_y = Math.tan(p.x / this.radius_g_1);\n v_z = Math.tan(p.y / this.radius_g_1) * Math.sqrt(1.0 + v_y * v_y);\n }\n\n a = v_y * v_y + v_z * v_z + v_x * v_x;\n b = 2 * this.radius_g * v_x;\n det = (b * b) - 4 * a * this.C;\n if (det < 0.0) {\n p.x = Number.NaN;\n p.y = Number.NaN;\n return p;\n }\n\n k = (-b - Math.sqrt(det)) / (2.0 * a);\n v_x = this.radius_g + k * v_x;\n v_y *= k;\n v_z *= k;\n\n p.x = Math.atan2(v_y, v_x);\n p.y = Math.atan(v_z * Math.cos(p.x) / v_x);\n }\n p.x = p.x + this.long0;\n return p;\n}\n\nexport var names = [\"Geostationary Satellite View\", \"Geostationary_Satellite\", \"geos\"];\nexport default {\n init: init,\n forward: forward,\n inverse: inverse,\n names: names,\n};\n\n","import proj4 from './core';\nimport Proj from \"./Proj\";\nimport Point from \"./Point\";\nimport common from \"./common/toPoint\";\nimport defs from \"./defs\";\nimport nadgrid from \"./nadgrid\";\nimport transform from \"./transform\";\nimport mgrs from \"mgrs\";\nimport includedProjections from \"../projs\";\n\nproj4.defaultDatum = 'WGS84'; //default datum\nproj4.Proj = Proj;\nproj4.WGS84 = new proj4.Proj('WGS84');\nproj4.Point = Point;\nproj4.toPoint = common;\nproj4.defs = defs;\nproj4.nadgrid = nadgrid;\nproj4.transform = transform;\nproj4.mgrs = mgrs;\nproj4.version = '__VERSION__';\nincludedProjections(proj4);\nexport default proj4;\n","import tmerc from './lib/projections/tmerc';\nimport etmerc from './lib/projections/etmerc';\nimport utm from './lib/projections/utm';\nimport sterea from './lib/projections/sterea';\nimport stere from './lib/projections/stere';\nimport somerc from './lib/projections/somerc';\nimport omerc from './lib/projections/omerc';\nimport lcc from './lib/projections/lcc';\nimport krovak from './lib/projections/krovak';\nimport cass from './lib/projections/cass';\nimport laea from './lib/projections/laea';\nimport aea from './lib/projections/aea';\nimport gnom from './lib/projections/gnom';\nimport cea from './lib/projections/cea';\nimport eqc from './lib/projections/eqc';\nimport poly from './lib/projections/poly';\nimport nzmg from './lib/projections/nzmg';\nimport mill from './lib/projections/mill';\nimport sinu from './lib/projections/sinu';\nimport moll from './lib/projections/moll';\nimport eqdc from './lib/projections/eqdc';\nimport vandg from './lib/projections/vandg';\nimport aeqd from './lib/projections/aeqd';\nimport ortho from './lib/projections/ortho';\nimport qsc from './lib/projections/qsc';\nimport robin from './lib/projections/robin';\nimport geocent from './lib/projections/geocent';\nimport tpers from './lib/projections/tpers';\nimport geos from './lib/projections/geos';\nexport default function(proj4){\n proj4.Proj.projections.add(tmerc);\n proj4.Proj.projections.add(etmerc);\n proj4.Proj.projections.add(utm);\n proj4.Proj.projections.add(sterea);\n proj4.Proj.projections.add(stere);\n proj4.Proj.projections.add(somerc);\n proj4.Proj.projections.add(omerc);\n proj4.Proj.projections.add(lcc);\n proj4.Proj.projections.add(krovak);\n proj4.Proj.projections.add(cass);\n proj4.Proj.projections.add(laea);\n proj4.Proj.projections.add(aea);\n proj4.Proj.projections.add(gnom);\n proj4.Proj.projections.add(cea);\n proj4.Proj.projections.add(eqc);\n proj4.Proj.projections.add(poly);\n proj4.Proj.projections.add(nzmg);\n proj4.Proj.projections.add(mill);\n proj4.Proj.projections.add(sinu);\n proj4.Proj.projections.add(moll);\n proj4.Proj.projections.add(eqdc);\n proj4.Proj.projections.add(vandg);\n proj4.Proj.projections.add(aeqd);\n proj4.Proj.projections.add(ortho);\n proj4.Proj.projections.add(qsc);\n proj4.Proj.projections.add(robin);\n proj4.Proj.projections.add(geocent);\n proj4.Proj.projections.add(tpers);\n proj4.Proj.projections.add(geos);\n}","!function(t,i){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=i():\"function\"==typeof define&&define.amd?define(i):(t=t||self).RBush=i()}(this,function(){\"use strict\";function t(t,r,e,a,h){!function t(n,r,e,a,h){for(;a>e;){if(a-e>600){var o=a-e+1,s=r-e+1,l=Math.log(o),f=.5*Math.exp(2*l/3),u=.5*Math.sqrt(l*f*(o-f)/o)*(s-o/2<0?-1:1),m=Math.max(e,Math.floor(r-s*f/o+u)),c=Math.min(a,Math.floor(r+(o-s)*f/o+u));t(n,r,m,c,h)}var p=n[r],d=e,x=a;for(i(n,e,r),h(n[a],p)>0&&i(n,e,a);d0;)x--}0===h(n[e],p)?i(n,e,x):i(n,++x,a),x<=r&&(e=x+1),r<=x&&(a=x-1)}}(t,r,e||0,a||t.length-1,h||n)}function i(t,i,n){var r=t[i];t[i]=t[n],t[n]=r}function n(t,i){return ti?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function e(t,i,n){if(!n)return i.indexOf(t);for(var r=0;r=t.minX&&i.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(i,n,r,e,a){for(var h=[n,r];h.length;)if(!((r=h.pop())-(n=h.pop())<=e)){var o=n+Math.ceil((r-n)/e/2)*e;t(i,o,n,r,a),h.push(n,o,o,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var i=this.data,n=[];if(!c(t,i))return n;for(var r=this.toBBox,e=[];i;){for(var a=0;a=0&&e[i].children.length>this._maxEntries;)this._split(e,i),i--;this._adjustParentBBoxes(r,e,i)},r.prototype._split=function(t,i){var n=t[i],r=n.children.length,e=this._minEntries;this._chooseSplitAxis(n,e,r);var h=this._chooseSplitIndex(n,e,r),o=p(n.children.splice(h,n.children.length-h));o.height=n.height,o.leaf=n.leaf,a(n,this.toBBox),a(o,this.toBBox),i?t[i-1].children.push(o):this._splitRoot(n,o)},r.prototype._splitRoot=function(t,i){this.data=p([t,i]),this.data.height=t.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,i,n){for(var r,e,a,o,s,l,u,m=1/0,c=1/0,p=i;p<=n-i;p++){var d=h(t,0,p,this.toBBox),x=h(t,p,n,this.toBBox),v=(e=d,a=x,o=void 0,s=void 0,l=void 0,u=void 0,o=Math.max(e.minX,a.minX),s=Math.max(e.minY,a.minY),l=Math.min(e.maxX,a.maxX),u=Math.min(e.maxY,a.maxY),Math.max(0,l-o)*Math.max(0,u-s)),M=f(d)+f(x);v=i;c--){var p=t.children[c];o(s,t.leaf?e(p):p),l+=u(s)}return l},r.prototype._adjustParentBBoxes=function(t,i,n){for(var r=n;r>=0;r--)o(i[r],t)},r.prototype._condense=function(t){for(var i=t.length-1,n=void 0;i>=0;i--)0===t[i].children.length?i>0?(n=t[i-1].children).splice(n.indexOf(t[i]),1):this.clear():a(t[i],this.toBBox)},r});\n","const indexOfMatch = require(\"./index-of-match.js\");\n\nfunction findTagByName(xml, tagName, options) {\n const debug = (options && options.debug) || false;\n\n const startIndex = (options && options.startIndex) || 0;\n\n if (debug) console.log(\"starting findTagByName with\", tagName, \" and \", options);\n\n const start = indexOfMatch(xml, `\\<${tagName}[ \\>]`, startIndex);\n if (debug) console.log(\"start:\", start);\n if (start === -1) return undefined;\n\n const afterStart = xml.slice(start + tagName.length);\n let relativeEnd = indexOfMatch(afterStart, \"[ /]\" + tagName + \">\", 0);\n const selfClosing = relativeEnd === -1;\n\n if (selfClosing) {\n relativeEnd = indexOfMatch(afterStart, \"[ /]>\", 0);\n }\n\n const end = start + tagName.length + relativeEnd + 1 + (selfClosing ? 0 : tagName.length) + 1;\n if (debug) console.log(\"end:\", end);\n if (end === -1) return undefined;\n\n const outer = xml.slice(start, end);\n // tag is like urn:ogc:def:crs:EPSG::32617\n\n let inner;\n if (selfClosing) {\n inner = null;\n } else {\n inner = outer.slice(outer.indexOf(\">\") + 1, outer.lastIndexOf(\"<\"));\n }\n\n return { inner, outer, start, end };\n}\n\nmodule.exports = findTagByName;\n","const findTagByName = require(\"./find-tag-by-name.js\");\n\nfunction findTagsByName(xml, tagName, options) {\n const tags = [];\n const debug = (options && options.debug) || false;\n let startIndex = (options && options.startIndex) || 0;\n let tag;\n while ((tag = findTagByName(xml, tagName, { debug, startIndex }))) {\n startIndex = tag.end;\n tags.push(tag);\n }\n if (debug) console.log(\"findTagsByName found\", tags.length, \"tags\");\n return tags;\n}\n\nmodule.exports = findTagsByName;\n","function getAttribute(tag, attributeName, options) {\n const debug = (options && options.debug) || false;\n if (debug) console.log(\"getting \" + attributeName + \" in \" + tag);\n\n const xml = typeof tag === \"object\" ? tag.outer : tag;\n\n const pattern = `${attributeName}\\\\=\"\\([^\"]*\\)\"`;\n if (debug) console.log(\"pattern:\", pattern);\n\n const re = new RegExp(pattern);\n const match = re.exec(xml);\n if (debug) console.log(\"match:\", match);\n if (match) return match[1];\n}\n\nmodule.exports = getAttribute;\n","function indexOfMatch(xml, pattern, startIndex) {\n const re = new RegExp(pattern);\n const match = re.exec(xml.slice(startIndex));\n if (match) return startIndex + match.index;\n else return -1;\n}\n\nmodule.exports = indexOfMatch;\n","\n export function create() {\n const source = \"const e=\\\"GENERATE_POLYGON_BUFFERS\\\",t=\\\"GENERATE_POINT_BUFFERS\\\",n=\\\"GENERATE_LINE_STRING_BUFFERS\\\";function r(e,t){const n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function x(e,t){const n=(r=t)[0]*r[3]-r[1]*r[2];var r;!function(e,t){if(!e)throw new Error(t)}(0!==n,\\\"Transformation matrix cannot be inverted\\\");const x=t[0],i=t[1],u=t[2],o=t[3],f=t[4],s=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-u/n,e[3]=x/n,e[4]=(u*s-o*f)/n,e[5]=-(x*s-i*f)/n,e}function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,\\\"default\\\")?e.default:e}new Array(6);var u={exports:{}};function o(e,t,n){n=n||2;var r,x,i,u,o,s,l,v=t&&t.length,h=v?t[0]*n:e.length,c=f(e,0,h,n,!0),g=[];if(!c||c.next===c.prev)return g;if(v&&(c=function(e,t,n,r){var x,i,u,o=[];for(x=0,i=t.length;x80*n){r=i=e[0],x=u=e[1];for(var b=n;bi&&(i=o),s>u&&(u=s);l=0!==(l=Math.max(i-r,u-x))?32767/l:0}return a(c,g,n,r,x,l,0),g}function f(e,t,n,r,x){var i,u;if(x===O(e,t,n,r)>0)for(i=t;i=t;i-=r)u=P(i,e[i],e[i+1],u);return u&&m(u,u.next)&&(B(u),u=u.next),u}function s(e,t){if(!e)return e;t||(t=e);var n,r=e;do{if(n=!1,r.steiner||!m(r,r.next)&&0!==w(r.prev,r,r.next))r=r.next;else{if(B(r),(r=t=r.prev)===r.next)break;n=!0}}while(n||r!==t);return t}function a(e,t,n,r,x,i,u){if(e){!u&&i&&function(e,t,n,r){var x=e;do{0===x.z&&(x.z=b(x.x,x.y,t,n,r)),x.prevZ=x.prev,x.nextZ=x.next,x=x.next}while(x!==e);x.prevZ.nextZ=null,x.prevZ=null,function(e){var t,n,r,x,i,u,o,f,s=1;do{for(n=e,e=null,i=null,u=0;n;){for(u++,r=n,o=0,t=0;t0||f>0&&r;)0!==o&&(0===f||!r||n.z<=r.z)?(x=n,n=n.nextZ,o--):(x=r,r=r.nextZ,f--),i?i.nextZ=x:e=x,x.prevZ=i,i=x;n=r}i.nextZ=null,s*=2}while(u>1)}(x)}(e,r,x,i);for(var o,f,p=e;e.prev!==e.next;)if(o=e.prev,f=e.next,i?v(e,r,x,i):l(e))t.push(o.i/n|0),t.push(e.i/n|0),t.push(f.i/n|0),B(e),e=f.next,p=f.next;else if((e=f)===p){u?1===u?a(e=h(s(e),t,n),t,n,r,x,i,2):2===u&&c(e,t,n,r,x,i):a(s(e),t,n,r,x,i,1);break}}}function l(e){var t=e.prev,n=e,r=e.next;if(w(t,n,r)>=0)return!1;for(var x=t.x,i=n.x,u=r.x,o=t.y,f=n.y,s=r.y,a=xi?x>u?x:u:i>u?i:u,h=o>f?o>s?o:s:f>s?f:s,c=r.next;c!==t;){if(c.x>=a&&c.x<=v&&c.y>=l&&c.y<=h&&M(x,o,i,f,u,s,c.x,c.y)&&w(c.prev,c,c.next)>=0)return!1;c=c.next}return!0}function v(e,t,n,r){var x=e.prev,i=e,u=e.next;if(w(x,i,u)>=0)return!1;for(var o=x.x,f=i.x,s=u.x,a=x.y,l=i.y,v=u.y,h=of?o>s?o:s:f>s?f:s,y=a>l?a>v?a:v:l>v?l:v,g=b(h,c,t,n,r),d=b(p,y,t,n,r),Z=e.prevZ,m=e.nextZ;Z&&Z.z>=g&&m&&m.z<=d;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;if(Z=Z.prevZ,m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;Z&&Z.z>=g;){if(Z.x>=h&&Z.x<=p&&Z.y>=c&&Z.y<=y&&Z!==x&&Z!==u&&M(o,a,f,l,s,v,Z.x,Z.y)&&w(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;m&&m.z<=d;){if(m.x>=h&&m.x<=p&&m.y>=c&&m.y<=y&&m!==x&&m!==u&&M(o,a,f,l,s,v,m.x,m.y)&&w(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function h(e,t,n){var r=e;do{var x=r.prev,i=r.next.next;!m(x,i)&&A(x,r,r.next,i)&&z(x,i)&&z(i,x)&&(t.push(x.i/n|0),t.push(r.i/n|0),t.push(i.i/n|0),B(r),B(r.next),r=e=i),r=r.next}while(r!==e);return s(r)}function c(e,t,n,r,x,i){var u=e;do{for(var o=u.next.next;o!==u.prev;){if(u.i!==o.i&&Z(u,o)){var f=F(u,o);return u=s(u,u.next),f=s(f,f.next),a(u,t,n,r,x,i,0),void a(f,t,n,r,x,i,0)}o=o.next}u=u.next}while(u!==e)}function p(e,t){return e.x-t.x}function y(e,t){var n=function(e,t){var n,r=t,x=e.x,i=e.y,u=-1/0;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var o=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(o<=x&&o>u&&(u=o,n=r.x=r.x&&r.x>=a&&x!==r.x&&M(in.x||r.x===n.x&&g(n,r)))&&(n=r,v=f)),r=r.next}while(r!==s);return n}(e,t);if(!n)return t;var r=F(n,e);return s(r,r.next),s(n,n.next)}function g(e,t){return w(e.prev,e,t.prev)<0&&w(t.next,e,e.next)<0}function b(e,t,n,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*x|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*x|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function d(e){var t=e,n=e;do{(t.x=(e-u)*(i-o)&&(e-u)*(r-o)>=(n-u)*(t-o)&&(n-u)*(i-o)>=(x-u)*(r-o)}function Z(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&A(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(z(e,t)&&z(t,e)&&function(e,t){var n=e,r=!1,x=(e.x+t.x)/2,i=(e.y+t.y)/2;do{n.y>i!=n.next.y>i&&n.next.y!==n.y&&x<(n.next.x-n.x)*(i-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==e);return r}(e,t)&&(w(e.prev,e,t.prev)||w(e,t.prev,t))||m(e,t)&&w(e.prev,e,e.next)>0&&w(t.prev,t,t.next)>0)}function w(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function m(e,t){return e.x===t.x&&e.y===t.y}function A(e,t,n,r){var x=I(w(e,t,n)),i=I(w(e,t,r)),u=I(w(n,r,e)),o=I(w(n,r,t));return x!==i&&u!==o||(!(0!==x||!E(e,n,t))||(!(0!==i||!E(e,r,t))||(!(0!==u||!E(n,e,r))||!(0!==o||!E(n,t,r)))))}function E(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function I(e){return e>0?1:e<0?-1:0}function z(e,t){return w(e.prev,e,e.next)<0?w(e,t,e.next)>=0&&w(e,e.prev,t)>=0:w(e,t,e.prev)<0||w(e,e.next,t)<0}function F(e,t){var n=new _(e.i,e.x,e.y),r=new _(t.i,t.x,t.y),x=e.next,i=t.prev;return e.next=t,t.prev=e,n.next=x,x.prev=n,r.next=n,n.prev=r,i.next=r,r.prev=i,r}function P(e,t,n,r){var x=new _(e,t,n);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function B(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function _(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,t,n,r){for(var x=0,i=t,u=n-r;i0&&(r+=e[x-1].length,n.holes.push(r))}return n};var N=i(u.exports);const R=[],S={vertexPosition:0,indexPosition:0};function T(e,t,n,r,x){e[t+0]=n,e[t+1]=r,e[t+2]=x}function U(e,t,n,r,x,i){const u=3+x,o=e[t+0],f=e[t+1],s=R;s.length=x;for(let n=0;n0?f:2*Math.PI-f}let d=-1,M=-1,Z=l;const w=null!==i;if(null!==x){d=b(y,g,r(s,[...[e[x],e[x+1]]])),Math.cos(d)<=.985&&(Z+=Math.tan((d-Math.PI)/2))}if(w){M=b(g,y,r(s,[...[e[i],e[i+1]]])),Math.cos(M)<=.985&&(Z+=Math.tan((Math.PI-M)/2))}function m(e,t){return 0===t?1e4*e:Math.sign(t)*(1e4*e+Math.abs(t))}return u.push(c[0],c[1],p[0],p[1],d,M,a,m(0,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(1,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(2,l)),u.push(...f),u.push(c[0],c[1],p[0],p[1],d,M,a,m(3,l)),u.push(...f),o.push(h,h+1,h+2,h+1,h+3,h+2),{length:a+Math.sqrt((g[0]-y[0])*(g[0]-y[0])+(g[1]-y[1])*(g[1]-y[1])),angle:Z}}function G(e,t,n,r,x){const i=2+x;let u=t;const o=e.slice(u,u+x);u+=x;const f=e[u++];let s=0;const a=new Array(f-1);for(let t=0;t{const i=r.data;switch(i.type){case t:{const e=3,t=2,n=i.customAttributesSize,r=t+n,x=new Float32Array(i.renderInstructions),u=x.length/r,o=4*u*(n+e),f=new Uint32Array(6*u),s=new Float32Array(o);let a;for(let e=0;e0?c=o+(n-1)*r:l&&(c=i-r);let p=null;n, 2012.\n//\n// https://github.com/deanm/css-color-parser-js\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to\n// deal in the Software without restriction, including without limitation the\n// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or\n// sell copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n// IN THE SOFTWARE.\n// http://www.w3.org/TR/css3-color/\nvar kCSSColorTable = {\n 'transparent': [\n 0,\n 0,\n 0,\n 0\n ],\n 'aliceblue': [\n 240,\n 248,\n 255,\n 1\n ],\n 'antiquewhite': [\n 250,\n 235,\n 215,\n 1\n ],\n 'aqua': [\n 0,\n 255,\n 255,\n 1\n ],\n 'aquamarine': [\n 127,\n 255,\n 212,\n 1\n ],\n 'azure': [\n 240,\n 255,\n 255,\n 1\n ],\n 'beige': [\n 245,\n 245,\n 220,\n 1\n ],\n 'bisque': [\n 255,\n 228,\n 196,\n 1\n ],\n 'black': [\n 0,\n 0,\n 0,\n 1\n ],\n 'blanchedalmond': [\n 255,\n 235,\n 205,\n 1\n ],\n 'blue': [\n 0,\n 0,\n 255,\n 1\n ],\n 'blueviolet': [\n 138,\n 43,\n 226,\n 1\n ],\n 'brown': [\n 165,\n 42,\n 42,\n 1\n ],\n 'burlywood': [\n 222,\n 184,\n 135,\n 1\n ],\n 'cadetblue': [\n 95,\n 158,\n 160,\n 1\n ],\n 'chartreuse': [\n 127,\n 255,\n 0,\n 1\n ],\n 'chocolate': [\n 210,\n 105,\n 30,\n 1\n ],\n 'coral': [\n 255,\n 127,\n 80,\n 1\n ],\n 'cornflowerblue': [\n 100,\n 149,\n 237,\n 1\n ],\n 'cornsilk': [\n 255,\n 248,\n 220,\n 1\n ],\n 'crimson': [\n 220,\n 20,\n 60,\n 1\n ],\n 'cyan': [\n 0,\n 255,\n 255,\n 1\n ],\n 'darkblue': [\n 0,\n 0,\n 139,\n 1\n ],\n 'darkcyan': [\n 0,\n 139,\n 139,\n 1\n ],\n 'darkgoldenrod': [\n 184,\n 134,\n 11,\n 1\n ],\n 'darkgray': [\n 169,\n 169,\n 169,\n 1\n ],\n 'darkgreen': [\n 0,\n 100,\n 0,\n 1\n ],\n 'darkgrey': [\n 169,\n 169,\n 169,\n 1\n ],\n 'darkkhaki': [\n 189,\n 183,\n 107,\n 1\n ],\n 'darkmagenta': [\n 139,\n 0,\n 139,\n 1\n ],\n 'darkolivegreen': [\n 85,\n 107,\n 47,\n 1\n ],\n 'darkorange': [\n 255,\n 140,\n 0,\n 1\n ],\n 'darkorchid': [\n 153,\n 50,\n 204,\n 1\n ],\n 'darkred': [\n 139,\n 0,\n 0,\n 1\n ],\n 'darksalmon': [\n 233,\n 150,\n 122,\n 1\n ],\n 'darkseagreen': [\n 143,\n 188,\n 143,\n 1\n ],\n 'darkslateblue': [\n 72,\n 61,\n 139,\n 1\n ],\n 'darkslategray': [\n 47,\n 79,\n 79,\n 1\n ],\n 'darkslategrey': [\n 47,\n 79,\n 79,\n 1\n ],\n 'darkturquoise': [\n 0,\n 206,\n 209,\n 1\n ],\n 'darkviolet': [\n 148,\n 0,\n 211,\n 1\n ],\n 'deeppink': [\n 255,\n 20,\n 147,\n 1\n ],\n 'deepskyblue': [\n 0,\n 191,\n 255,\n 1\n ],\n 'dimgray': [\n 105,\n 105,\n 105,\n 1\n ],\n 'dimgrey': [\n 105,\n 105,\n 105,\n 1\n ],\n 'dodgerblue': [\n 30,\n 144,\n 255,\n 1\n ],\n 'firebrick': [\n 178,\n 34,\n 34,\n 1\n ],\n 'floralwhite': [\n 255,\n 250,\n 240,\n 1\n ],\n 'forestgreen': [\n 34,\n 139,\n 34,\n 1\n ],\n 'fuchsia': [\n 255,\n 0,\n 255,\n 1\n ],\n 'gainsboro': [\n 220,\n 220,\n 220,\n 1\n ],\n 'ghostwhite': [\n 248,\n 248,\n 255,\n 1\n ],\n 'gold': [\n 255,\n 215,\n 0,\n 1\n ],\n 'goldenrod': [\n 218,\n 165,\n 32,\n 1\n ],\n 'gray': [\n 128,\n 128,\n 128,\n 1\n ],\n 'green': [\n 0,\n 128,\n 0,\n 1\n ],\n 'greenyellow': [\n 173,\n 255,\n 47,\n 1\n ],\n 'grey': [\n 128,\n 128,\n 128,\n 1\n ],\n 'honeydew': [\n 240,\n 255,\n 240,\n 1\n ],\n 'hotpink': [\n 255,\n 105,\n 180,\n 1\n ],\n 'indianred': [\n 205,\n 92,\n 92,\n 1\n ],\n 'indigo': [\n 75,\n 0,\n 130,\n 1\n ],\n 'ivory': [\n 255,\n 255,\n 240,\n 1\n ],\n 'khaki': [\n 240,\n 230,\n 140,\n 1\n ],\n 'lavender': [\n 230,\n 230,\n 250,\n 1\n ],\n 'lavenderblush': [\n 255,\n 240,\n 245,\n 1\n ],\n 'lawngreen': [\n 124,\n 252,\n 0,\n 1\n ],\n 'lemonchiffon': [\n 255,\n 250,\n 205,\n 1\n ],\n 'lightblue': [\n 173,\n 216,\n 230,\n 1\n ],\n 'lightcoral': [\n 240,\n 128,\n 128,\n 1\n ],\n 'lightcyan': [\n 224,\n 255,\n 255,\n 1\n ],\n 'lightgoldenrodyellow': [\n 250,\n 250,\n 210,\n 1\n ],\n 'lightgray': [\n 211,\n 211,\n 211,\n 1\n ],\n 'lightgreen': [\n 144,\n 238,\n 144,\n 1\n ],\n 'lightgrey': [\n 211,\n 211,\n 211,\n 1\n ],\n 'lightpink': [\n 255,\n 182,\n 193,\n 1\n ],\n 'lightsalmon': [\n 255,\n 160,\n 122,\n 1\n ],\n 'lightseagreen': [\n 32,\n 178,\n 170,\n 1\n ],\n 'lightskyblue': [\n 135,\n 206,\n 250,\n 1\n ],\n 'lightslategray': [\n 119,\n 136,\n 153,\n 1\n ],\n 'lightslategrey': [\n 119,\n 136,\n 153,\n 1\n ],\n 'lightsteelblue': [\n 176,\n 196,\n 222,\n 1\n ],\n 'lightyellow': [\n 255,\n 255,\n 224,\n 1\n ],\n 'lime': [\n 0,\n 255,\n 0,\n 1\n ],\n 'limegreen': [\n 50,\n 205,\n 50,\n 1\n ],\n 'linen': [\n 250,\n 240,\n 230,\n 1\n ],\n 'magenta': [\n 255,\n 0,\n 255,\n 1\n ],\n 'maroon': [\n 128,\n 0,\n 0,\n 1\n ],\n 'mediumaquamarine': [\n 102,\n 205,\n 170,\n 1\n ],\n 'mediumblue': [\n 0,\n 0,\n 205,\n 1\n ],\n 'mediumorchid': [\n 186,\n 85,\n 211,\n 1\n ],\n 'mediumpurple': [\n 147,\n 112,\n 219,\n 1\n ],\n 'mediumseagreen': [\n 60,\n 179,\n 113,\n 1\n ],\n 'mediumslateblue': [\n 123,\n 104,\n 238,\n 1\n ],\n 'mediumspringgreen': [\n 0,\n 250,\n 154,\n 1\n ],\n 'mediumturquoise': [\n 72,\n 209,\n 204,\n 1\n ],\n 'mediumvioletred': [\n 199,\n 21,\n 133,\n 1\n ],\n 'midnightblue': [\n 25,\n 25,\n 112,\n 1\n ],\n 'mintcream': [\n 245,\n 255,\n 250,\n 1\n ],\n 'mistyrose': [\n 255,\n 228,\n 225,\n 1\n ],\n 'moccasin': [\n 255,\n 228,\n 181,\n 1\n ],\n 'navajowhite': [\n 255,\n 222,\n 173,\n 1\n ],\n 'navy': [\n 0,\n 0,\n 128,\n 1\n ],\n 'oldlace': [\n 253,\n 245,\n 230,\n 1\n ],\n 'olive': [\n 128,\n 128,\n 0,\n 1\n ],\n 'olivedrab': [\n 107,\n 142,\n 35,\n 1\n ],\n 'orange': [\n 255,\n 165,\n 0,\n 1\n ],\n 'orangered': [\n 255,\n 69,\n 0,\n 1\n ],\n 'orchid': [\n 218,\n 112,\n 214,\n 1\n ],\n 'palegoldenrod': [\n 238,\n 232,\n 170,\n 1\n ],\n 'palegreen': [\n 152,\n 251,\n 152,\n 1\n ],\n 'paleturquoise': [\n 175,\n 238,\n 238,\n 1\n ],\n 'palevioletred': [\n 219,\n 112,\n 147,\n 1\n ],\n 'papayawhip': [\n 255,\n 239,\n 213,\n 1\n ],\n 'peachpuff': [\n 255,\n 218,\n 185,\n 1\n ],\n 'peru': [\n 205,\n 133,\n 63,\n 1\n ],\n 'pink': [\n 255,\n 192,\n 203,\n 1\n ],\n 'plum': [\n 221,\n 160,\n 221,\n 1\n ],\n 'powderblue': [\n 176,\n 224,\n 230,\n 1\n ],\n 'purple': [\n 128,\n 0,\n 128,\n 1\n ],\n 'rebeccapurple': [\n 102,\n 51,\n 153,\n 1\n ],\n 'red': [\n 255,\n 0,\n 0,\n 1\n ],\n 'rosybrown': [\n 188,\n 143,\n 143,\n 1\n ],\n 'royalblue': [\n 65,\n 105,\n 225,\n 1\n ],\n 'saddlebrown': [\n 139,\n 69,\n 19,\n 1\n ],\n 'salmon': [\n 250,\n 128,\n 114,\n 1\n ],\n 'sandybrown': [\n 244,\n 164,\n 96,\n 1\n ],\n 'seagreen': [\n 46,\n 139,\n 87,\n 1\n ],\n 'seashell': [\n 255,\n 245,\n 238,\n 1\n ],\n 'sienna': [\n 160,\n 82,\n 45,\n 1\n ],\n 'silver': [\n 192,\n 192,\n 192,\n 1\n ],\n 'skyblue': [\n 135,\n 206,\n 235,\n 1\n ],\n 'slateblue': [\n 106,\n 90,\n 205,\n 1\n ],\n 'slategray': [\n 112,\n 128,\n 144,\n 1\n ],\n 'slategrey': [\n 112,\n 128,\n 144,\n 1\n ],\n 'snow': [\n 255,\n 250,\n 250,\n 1\n ],\n 'springgreen': [\n 0,\n 255,\n 127,\n 1\n ],\n 'steelblue': [\n 70,\n 130,\n 180,\n 1\n ],\n 'tan': [\n 210,\n 180,\n 140,\n 1\n ],\n 'teal': [\n 0,\n 128,\n 128,\n 1\n ],\n 'thistle': [\n 216,\n 191,\n 216,\n 1\n ],\n 'tomato': [\n 255,\n 99,\n 71,\n 1\n ],\n 'turquoise': [\n 64,\n 224,\n 208,\n 1\n ],\n 'violet': [\n 238,\n 130,\n 238,\n 1\n ],\n 'wheat': [\n 245,\n 222,\n 179,\n 1\n ],\n 'white': [\n 255,\n 255,\n 255,\n 1\n ],\n 'whitesmoke': [\n 245,\n 245,\n 245,\n 1\n ],\n 'yellow': [\n 255,\n 255,\n 0,\n 1\n ],\n 'yellowgreen': [\n 154,\n 205,\n 50,\n 1\n ]\n};\nfunction clamp_css_byte(i) {\n // Clamp to integer 0 .. 255.\n i = Math.round(i);\n // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\nfunction clamp_css_float(f) {\n // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\nfunction parse_css_int(str) {\n // int or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_byte(parseFloat(str) / 100 * 255);\n return clamp_css_byte(parseInt(str));\n}\nfunction parse_css_float(str) {\n // float or percentage.\n if (str[str.length - 1] === '%')\n return clamp_css_float(parseFloat(str) / 100);\n return clamp_css_float(parseFloat(str));\n}\nfunction css_hue_to_rgb(m1, m2, h) {\n if (h < 0)\n h += 1;\n else if (h > 1)\n h -= 1;\n if (h * 6 < 1)\n return m1 + (m2 - m1) * h * 6;\n if (h * 2 < 1)\n return m2;\n if (h * 3 < 2)\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n return m1;\n}\nfunction parseCSSColor(css_str) {\n // Remove all whitespace, not compliant, but should just be more accepting.\n var str = css_str.replace(/ /g, '').toLowerCase();\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable)\n return kCSSColorTable[str].slice();\n // dup.\n // #abc and #abc123 syntax.\n if (str[0] === '#') {\n if (str.length === 4) {\n var iv = parseInt(str.substr(1), 16);\n // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 4095))\n return null;\n // Covers NaN.\n return [\n (iv & 3840) >> 4 | (iv & 3840) >> 8,\n iv & 240 | (iv & 240) >> 4,\n iv & 15 | (iv & 15) << 4,\n 1\n ];\n } else if (str.length === 7) {\n var iv = parseInt(str.substr(1), 16);\n // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 16777215))\n return null;\n // Covers NaN.\n return [\n (iv & 16711680) >> 16,\n (iv & 65280) >> 8,\n iv & 255,\n 1\n ];\n }\n return null;\n }\n var op = str.indexOf('('), ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === str.length) {\n var fname = str.substr(0, op);\n var params = str.substr(op + 1, ep - (op + 1)).split(',');\n var alpha = 1;\n // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4)\n return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'rgb':\n if (params.length !== 3)\n return null;\n return [\n parse_css_int(params[0]),\n parse_css_int(params[1]),\n parse_css_int(params[2]),\n alpha\n ];\n case 'hsla':\n if (params.length !== 4)\n return null;\n alpha = parse_css_float(params.pop());\n // Fall through.\n case 'hsl':\n if (params.length !== 3)\n return null;\n var h = (parseFloat(params[0]) % 360 + 360) % 360 / 360;\n // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n var s = parse_css_float(params[1]);\n var l = parse_css_float(params[2]);\n var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n var m1 = l * 2 - m2;\n return [\n clamp_css_byte(css_hue_to_rgb(m1, m2, h + 1 / 3) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255),\n clamp_css_byte(css_hue_to_rgb(m1, m2, h - 1 / 3) * 255),\n alpha\n ];\n default:\n return null;\n }\n }\n return null;\n}\ntry {\n parseCSSColor_1 = csscolorparser.parseCSSColor = parseCSSColor;\n} catch (e) {\n}\n\n// \n/**\n * An RGBA color value. Create instances from color strings using the static\n * method `Color.parse`. The constructor accepts RGB channel values in the range\n * `[0, 1]`, premultiplied by A.\n *\n * @param {number} r The red channel.\n * @param {number} g The green channel.\n * @param {number} b The blue channel.\n * @param {number} a The alpha channel.\n * @private\n */\nclass Color {\n constructor(r, g, b, a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }\n /**\n * Parses valid CSS color strings and returns a `Color` instance.\n * @returns A `Color` instance, or `undefined` if the input is not a valid color string.\n */\n static parse(input) {\n if (!input) {\n return undefined;\n }\n if (input instanceof Color) {\n return input;\n }\n if (typeof input !== 'string') {\n return undefined;\n }\n const rgba = parseCSSColor_1(input);\n if (!rgba) {\n return undefined;\n }\n return new Color(rgba[0] / 255 * rgba[3], rgba[1] / 255 * rgba[3], rgba[2] / 255 * rgba[3], rgba[3]);\n }\n /**\n * Returns an RGBA string representing the color value.\n *\n * @returns An RGBA string.\n * @example\n * var purple = new Color.parse('purple');\n * purple.toString; // = \"rgba(128,0,128,1)\"\n * var translucentGreen = new Color.parse('rgba(26, 207, 26, .73)');\n * translucentGreen.toString(); // = \"rgba(26,207,26,0.73)\"\n */\n toString() {\n const [r, g, b, a] = this.toArray();\n return `rgba(${ Math.round(r) },${ Math.round(g) },${ Math.round(b) },${ a })`;\n }\n /**\n * Returns an RGBA array of values representing the color, unpremultiplied by A.\n *\n * @returns An array of RGBA color values in the range [0, 255].\n */\n toArray() {\n const {r, g, b, a} = this;\n return a === 0 ? [\n 0,\n 0,\n 0,\n 0\n ] : [\n r * 255 / a,\n g * 255 / a,\n b * 255 / a,\n a\n ];\n }\n /**\n * Returns a RGBA array of float values representing the color, unpremultiplied by A.\n *\n * @returns An array of RGBA color values in the range [0, 1].\n */\n toArray01() {\n const {r, g, b, a} = this;\n return a === 0 ? [\n 0,\n 0,\n 0,\n 0\n ] : [\n r / a,\n g / a,\n b / a,\n a\n ];\n }\n /**\n * Returns an RGBA array of values representing the color, premultiplied by A.\n *\n * @returns An array of RGBA color values in the range [0, 1].\n */\n toArray01PremultipliedAlpha() {\n const {r, g, b, a} = this;\n return [\n r,\n g,\n b,\n a\n ];\n }\n}\nColor.black = new Color(0, 0, 0, 1);\nColor.white = new Color(1, 1, 1, 1);\nColor.transparent = new Color(0, 0, 0, 0);\nColor.red = new Color(1, 0, 0, 1);\nColor.blue = new Color(0, 0, 1, 1);\nvar Color$1 = Color;\n\nfunction convertLiteral(value) {\n return typeof value === 'object' ? [\n 'literal',\n value\n ] : value;\n}\nfunction convertFunction(parameters, propertySpec) {\n let stops = parameters.stops;\n if (!stops) {\n // identity function\n return convertIdentityFunction(parameters, propertySpec);\n }\n const zoomAndFeatureDependent = stops && typeof stops[0][0] === 'object';\n const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined;\n const zoomDependent = zoomAndFeatureDependent || !featureDependent;\n stops = stops.map(stop => {\n if (!featureDependent && propertySpec.tokens && typeof stop[1] === 'string') {\n return [\n stop[0],\n convertTokenString(stop[1])\n ];\n }\n return [\n stop[0],\n convertLiteral(stop[1])\n ];\n });\n if (zoomAndFeatureDependent) {\n return convertZoomAndPropertyFunction(parameters, propertySpec, stops);\n } else if (zoomDependent) {\n return convertZoomFunction(parameters, propertySpec, stops);\n } else {\n return convertPropertyFunction(parameters, propertySpec, stops);\n }\n}\nfunction convertIdentityFunction(parameters, propertySpec) {\n const get = [\n 'get',\n parameters.property\n ];\n if (parameters.default === undefined) {\n // By default, expressions for string-valued properties get coerced. To preserve\n // legacy function semantics, insert an explicit assertion instead.\n return propertySpec.type === 'string' ? [\n 'string',\n get\n ] : get;\n } else if (propertySpec.type === 'enum') {\n return [\n 'match',\n get,\n Object.keys(propertySpec.values),\n get,\n parameters.default\n ];\n } else {\n const expression = [\n propertySpec.type === 'color' ? 'to-color' : propertySpec.type,\n get,\n convertLiteral(parameters.default)\n ];\n if (propertySpec.type === 'array') {\n expression.splice(1, 0, propertySpec.value, propertySpec.length || null);\n }\n return expression;\n }\n}\nfunction getInterpolateOperator(parameters) {\n switch (parameters.colorSpace) {\n case 'hcl':\n return 'interpolate-hcl';\n case 'lab':\n return 'interpolate-lab';\n default:\n return 'interpolate';\n }\n}\nfunction convertZoomAndPropertyFunction(parameters, propertySpec, stops) {\n const featureFunctionParameters = {};\n const featureFunctionStops = {};\n const zoomStops = [];\n for (let s = 0; s < stops.length; s++) {\n const stop = stops[s];\n const zoom = stop[0].zoom;\n if (featureFunctionParameters[zoom] === undefined) {\n featureFunctionParameters[zoom] = {\n zoom,\n type: parameters.type,\n property: parameters.property,\n default: parameters.default\n };\n featureFunctionStops[zoom] = [];\n zoomStops.push(zoom);\n }\n featureFunctionStops[zoom].push([\n stop[0].value,\n stop[1]\n ]);\n }\n // the interpolation type for the zoom dimension of a zoom-and-property\n // function is determined directly from the style property specification\n // for which it's being used: linear for interpolatable properties, step\n // otherwise.\n const functionType = getFunctionType({}, propertySpec);\n if (functionType === 'exponential') {\n const expression = [\n getInterpolateOperator(parameters),\n ['linear'],\n ['zoom']\n ];\n for (const z of zoomStops) {\n const output = convertPropertyFunction(featureFunctionParameters[z], propertySpec, featureFunctionStops[z]);\n appendStopPair(expression, z, output, false);\n }\n return expression;\n } else {\n const expression = [\n 'step',\n ['zoom']\n ];\n for (const z of zoomStops) {\n const output = convertPropertyFunction(featureFunctionParameters[z], propertySpec, featureFunctionStops[z]);\n appendStopPair(expression, z, output, true);\n }\n fixupDegenerateStepCurve(expression);\n return expression;\n }\n}\nfunction coalesce(a, b) {\n if (a !== undefined)\n return a;\n if (b !== undefined)\n return b;\n}\nfunction getFallback(parameters, propertySpec) {\n const defaultValue = convertLiteral(coalesce(parameters.default, propertySpec.default));\n /*\n * Some fields with type: resolvedImage have an undefined default.\n * Because undefined is an invalid value for resolvedImage, set fallback to\n * an empty string instead of undefined to ensure output\n * passes validation.\n */\n if (defaultValue === undefined && propertySpec.type === 'resolvedImage') {\n return '';\n }\n return defaultValue;\n}\nfunction convertPropertyFunction(parameters, propertySpec, stops) {\n const type = getFunctionType(parameters, propertySpec);\n const get = [\n 'get',\n parameters.property\n ];\n if (type === 'categorical' && typeof stops[0][0] === 'boolean') {\n const expression = ['case'];\n for (const stop of stops) {\n expression.push([\n '==',\n get,\n stop[0]\n ], stop[1]);\n }\n expression.push(getFallback(parameters, propertySpec));\n return expression;\n } else if (type === 'categorical') {\n const expression = [\n 'match',\n get\n ];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], false);\n }\n expression.push(getFallback(parameters, propertySpec));\n return expression;\n } else if (type === 'interval') {\n const expression = [\n 'step',\n [\n 'number',\n get\n ]\n ];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], true);\n }\n fixupDegenerateStepCurve(expression);\n return parameters.default === undefined ? expression : [\n 'case',\n [\n '==',\n [\n 'typeof',\n get\n ],\n 'number'\n ],\n expression,\n convertLiteral(parameters.default)\n ];\n } else if (type === 'exponential') {\n const base = parameters.base !== undefined ? parameters.base : 1;\n const expression = [\n getInterpolateOperator(parameters),\n base === 1 ? ['linear'] : [\n 'exponential',\n base\n ],\n [\n 'number',\n get\n ]\n ];\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], false);\n }\n return parameters.default === undefined ? expression : [\n 'case',\n [\n '==',\n [\n 'typeof',\n get\n ],\n 'number'\n ],\n expression,\n convertLiteral(parameters.default)\n ];\n } else {\n throw new Error(`Unknown property function type ${ type }`);\n }\n}\nfunction convertZoomFunction(parameters, propertySpec, stops, input = ['zoom']) {\n const type = getFunctionType(parameters, propertySpec);\n let expression;\n let isStep = false;\n if (type === 'interval') {\n expression = [\n 'step',\n input\n ];\n isStep = true;\n } else if (type === 'exponential') {\n const base = parameters.base !== undefined ? parameters.base : 1;\n expression = [\n getInterpolateOperator(parameters),\n base === 1 ? ['linear'] : [\n 'exponential',\n base\n ],\n input\n ];\n } else {\n throw new Error(`Unknown zoom function type \"${ type }\"`);\n }\n for (const stop of stops) {\n appendStopPair(expression, stop[0], stop[1], isStep);\n }\n fixupDegenerateStepCurve(expression);\n return expression;\n}\nfunction fixupDegenerateStepCurve(expression) {\n // degenerate step curve (i.e. a constant function): add a noop stop\n if (expression[0] === 'step' && expression.length === 3) {\n expression.push(0);\n expression.push(expression[3]);\n }\n}\nfunction appendStopPair(curve, input, output, isStep) {\n // Skip duplicate stop values. They were not validated for functions, but they are for expressions.\n // https://github.com/mapbox/mapbox-gl-js/issues/4107\n if (curve.length > 3 && input === curve[curve.length - 2]) {\n return;\n }\n // step curves don't get the first input value, as it is redundant.\n if (!(isStep && curve.length === 2)) {\n curve.push(input);\n }\n curve.push(output);\n}\nfunction getFunctionType(parameters, propertySpec) {\n if (parameters.type) {\n return parameters.type;\n } else {\n return propertySpec.expression.interpolated ? 'exponential' : 'interval';\n }\n}\n// \"String with {name} token\" => [\"concat\", \"String with \", [\"get\", \"name\"], \" token\"]\nfunction convertTokenString(s) {\n const result = ['concat'];\n const re = /{([^{}]+)}/g;\n let pos = 0;\n for (let match = re.exec(s); match !== null; match = re.exec(s)) {\n const literal = s.slice(pos, re.lastIndex - match[0].length);\n pos = re.lastIndex;\n if (literal.length > 0)\n result.push(literal);\n result.push([\n 'get',\n match[1]\n ]);\n }\n if (result.length === 1) {\n return s;\n }\n if (pos < s.length) {\n result.push(s.slice(pos));\n } else if (result.length === 2) {\n return [\n 'to-string',\n result[1]\n ];\n }\n return result;\n}\n\n// \nclass ParsingError extends Error {\n constructor(key, message) {\n super(message);\n this.message = message;\n this.key = key;\n }\n}\nvar ParsingError$1 = ParsingError;\n\n// \n/**\n * Tracks `let` bindings during expression parsing.\n * @private\n */\nclass Scope {\n constructor(parent, bindings = []) {\n this.parent = parent;\n this.bindings = {};\n for (const [name, expression] of bindings) {\n this.bindings[name] = expression;\n }\n }\n concat(bindings) {\n return new Scope(this, bindings);\n }\n get(name) {\n if (this.bindings[name]) {\n return this.bindings[name];\n }\n if (this.parent) {\n return this.parent.get(name);\n }\n throw new Error(`${ name } not found in scope.`);\n }\n has(name) {\n if (this.bindings[name])\n return true;\n return this.parent ? this.parent.has(name) : false;\n }\n}\nvar Scope$1 = Scope;\n\n// \nconst NullType = { kind: 'null' };\nconst NumberType = { kind: 'number' };\nconst StringType = { kind: 'string' };\nconst BooleanType = { kind: 'boolean' };\nconst ColorType = { kind: 'color' };\nconst ObjectType = { kind: 'object' };\nconst ValueType = { kind: 'value' };\nconst ErrorType = { kind: 'error' };\nconst CollatorType = { kind: 'collator' };\nconst FormattedType = { kind: 'formatted' };\nconst ResolvedImageType = { kind: 'resolvedImage' };\nfunction array$1(itemType, N) {\n return {\n kind: 'array',\n itemType,\n N\n };\n}\nfunction toString$1(type) {\n if (type.kind === 'array') {\n const itemType = toString$1(type.itemType);\n return typeof type.N === 'number' ? `array<${ itemType }, ${ type.N }>` : type.itemType.kind === 'value' ? 'array' : `array<${ itemType }>`;\n } else {\n return type.kind;\n }\n}\nconst valueMemberTypes = [\n NullType,\n NumberType,\n StringType,\n BooleanType,\n ColorType,\n FormattedType,\n ObjectType,\n array$1(ValueType),\n ResolvedImageType\n];\n/**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message.\n * @private\n */\nfunction checkSubtype(expected, t) {\n if (t.kind === 'error') {\n // Error is a subtype of every type\n return null;\n } else if (expected.kind === 'array') {\n if (t.kind === 'array' && (t.N === 0 && t.itemType.kind === 'value' || !checkSubtype(expected.itemType, t.itemType)) && (typeof expected.N !== 'number' || expected.N === t.N)) {\n return null;\n }\n } else if (expected.kind === t.kind) {\n return null;\n } else if (expected.kind === 'value') {\n for (const memberType of valueMemberTypes) {\n if (!checkSubtype(memberType, t)) {\n return null;\n }\n }\n }\n return `Expected ${ toString$1(expected) } but found ${ toString$1(t) } instead.`;\n}\nfunction isValidType(provided, allowedTypes) {\n return allowedTypes.some(t => t.kind === provided.kind);\n}\nfunction isValidNativeType(provided, allowedTypes) {\n return allowedTypes.some(t => {\n if (t === 'null') {\n return provided === null;\n } else if (t === 'array') {\n return Array.isArray(provided);\n } else if (t === 'object') {\n return provided && !Array.isArray(provided) && typeof provided === 'object';\n } else {\n return t === typeof provided;\n }\n });\n}\n\n// \n// Flow type declarations for Intl cribbed from\n// https://github.com/facebook/flow/issues/1270\nclass Collator {\n constructor(caseSensitive, diacriticSensitive, locale) {\n if (caseSensitive)\n this.sensitivity = diacriticSensitive ? 'variant' : 'case';\n else\n this.sensitivity = diacriticSensitive ? 'accent' : 'base';\n this.locale = locale;\n this.collator = new Intl.Collator(this.locale ? this.locale : [], {\n sensitivity: this.sensitivity,\n usage: 'search'\n });\n }\n compare(lhs, rhs) {\n return this.collator.compare(lhs, rhs);\n }\n resolvedLocale() {\n // We create a Collator without \"usage: search\" because we don't want\n // the search options encoded in our result (e.g. \"en-u-co-search\")\n return new Intl.Collator(this.locale ? this.locale : []).resolvedOptions().locale;\n }\n}\n\n// \nclass FormattedSection {\n constructor(text, image, scale, fontStack, textColor) {\n // combine characters so that diacritic marks are not separate code points\n this.text = text.normalize ? text.normalize() : text;\n this.image = image;\n this.scale = scale;\n this.fontStack = fontStack;\n this.textColor = textColor;\n }\n}\nclass Formatted {\n constructor(sections) {\n this.sections = sections;\n }\n static fromString(unformatted) {\n return new Formatted([new FormattedSection(unformatted, null, null, null, null)]);\n }\n isEmpty() {\n if (this.sections.length === 0)\n return true;\n return !this.sections.some(section => section.text.length !== 0 || section.image && section.image.name.length !== 0);\n }\n static factory(text) {\n if (text instanceof Formatted) {\n return text;\n } else {\n return Formatted.fromString(text);\n }\n }\n toString() {\n if (this.sections.length === 0)\n return '';\n return this.sections.map(section => section.text).join('');\n }\n serialize() {\n const serialized = ['format'];\n for (const section of this.sections) {\n if (section.image) {\n serialized.push([\n 'image',\n section.image.name\n ]);\n continue;\n }\n serialized.push(section.text);\n const options = {};\n if (section.fontStack) {\n options['text-font'] = [\n 'literal',\n section.fontStack.split(',')\n ];\n }\n if (section.scale) {\n options['font-scale'] = section.scale;\n }\n if (section.textColor) {\n options['text-color'] = ['rgba'].concat(section.textColor.toArray());\n }\n serialized.push(options);\n }\n return serialized;\n }\n}\n\n// \nclass ResolvedImage {\n constructor(options) {\n this.name = options.name;\n this.available = options.available;\n }\n toString() {\n return this.name;\n }\n static fromString(name) {\n if (!name)\n return null;\n // treat empty values as no image\n return new ResolvedImage({\n name,\n available: false\n });\n }\n serialize() {\n return [\n 'image',\n this.name\n ];\n }\n}\n\nfunction validateRGBA(r, g, b, a) {\n if (!(typeof r === 'number' && r >= 0 && r <= 255 && typeof g === 'number' && g >= 0 && g <= 255 && typeof b === 'number' && b >= 0 && b <= 255)) {\n const value = typeof a === 'number' ? [\n r,\n g,\n b,\n a\n ] : [\n r,\n g,\n b\n ];\n return `Invalid rgba value [${ value.join(', ') }]: 'r', 'g', and 'b' must be between 0 and 255.`;\n }\n if (!(typeof a === 'undefined' || typeof a === 'number' && a >= 0 && a <= 1)) {\n return `Invalid rgba value [${ [\n r,\n g,\n b,\n a\n ].join(', ') }]: 'a' must be between 0 and 1.`;\n }\n return null;\n}\nfunction isValue(mixed) {\n if (mixed === null) {\n return true;\n } else if (typeof mixed === 'string') {\n return true;\n } else if (typeof mixed === 'boolean') {\n return true;\n } else if (typeof mixed === 'number') {\n return true;\n } else if (mixed instanceof Color$1) {\n return true;\n } else if (mixed instanceof Collator) {\n return true;\n } else if (mixed instanceof Formatted) {\n return true;\n } else if (mixed instanceof ResolvedImage) {\n return true;\n } else if (Array.isArray(mixed)) {\n for (const item of mixed) {\n if (!isValue(item)) {\n return false;\n }\n }\n return true;\n } else if (typeof mixed === 'object') {\n for (const key in mixed) {\n if (!isValue(mixed[key])) {\n return false;\n }\n }\n return true;\n } else {\n return false;\n }\n}\nfunction typeOf(value) {\n if (value === null) {\n return NullType;\n } else if (typeof value === 'string') {\n return StringType;\n } else if (typeof value === 'boolean') {\n return BooleanType;\n } else if (typeof value === 'number') {\n return NumberType;\n } else if (value instanceof Color$1) {\n return ColorType;\n } else if (value instanceof Collator) {\n return CollatorType;\n } else if (value instanceof Formatted) {\n return FormattedType;\n } else if (value instanceof ResolvedImage) {\n return ResolvedImageType;\n } else if (Array.isArray(value)) {\n const length = value.length;\n let itemType;\n for (const item of value) {\n const t = typeOf(item);\n if (!itemType) {\n itemType = t;\n } else if (itemType === t) {\n continue;\n } else {\n itemType = ValueType;\n break;\n }\n }\n return array$1(itemType || ValueType, length);\n } else {\n return ObjectType;\n }\n}\nfunction toString(value) {\n const type = typeof value;\n if (value === null) {\n return '';\n } else if (type === 'string' || type === 'number' || type === 'boolean') {\n return String(value);\n } else if (value instanceof Color$1 || value instanceof Formatted || value instanceof ResolvedImage) {\n return value.toString();\n } else {\n return JSON.stringify(value);\n }\n}\n\nclass Literal {\n constructor(type, value) {\n this.type = type;\n this.value = value;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`'literal' expression requires exactly one argument, but found ${ args.length - 1 } instead.`);\n if (!isValue(args[1]))\n return context.error(`invalid value`);\n const value = args[1];\n let type = typeOf(value);\n // special case: infer the item type if possible for zero-length arrays\n const expected = context.expectedType;\n if (type.kind === 'array' && type.N === 0 && expected && expected.kind === 'array' && (typeof expected.N !== 'number' || expected.N === 0)) {\n type = expected;\n }\n return new Literal(type, value);\n }\n evaluate() {\n return this.value;\n }\n eachChild() {\n }\n outputDefined() {\n return true;\n }\n serialize() {\n if (this.type.kind === 'array' || this.type.kind === 'object') {\n return [\n 'literal',\n this.value\n ];\n } else if (this.value instanceof Color$1) {\n // Constant-folding can generate Literal expressions that you\n // couldn't actually generate with a \"literal\" expression,\n // so we have to implement an equivalent serialization here\n return ['rgba'].concat(this.value.toArray());\n } else if (this.value instanceof Formatted) {\n // Same as Color\n return this.value.serialize();\n } else {\n return this.value;\n }\n }\n}\nvar Literal$1 = Literal;\n\n// \nclass RuntimeError {\n constructor(message) {\n this.name = 'ExpressionEvaluationError';\n this.message = message;\n }\n toJSON() {\n return this.message;\n }\n}\nvar RuntimeError$1 = RuntimeError;\n\nconst types$2 = {\n string: StringType,\n number: NumberType,\n boolean: BooleanType,\n object: ObjectType\n};\nclass Assertion {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n let i = 1;\n let type;\n const name = args[0];\n if (name === 'array') {\n let itemType;\n if (args.length > 2) {\n const type = args[1];\n if (typeof type !== 'string' || !(type in types$2) || type === 'object')\n return context.error('The item type argument of \"array\" must be one of string, number, boolean', 1);\n itemType = types$2[type];\n i++;\n } else {\n itemType = ValueType;\n }\n let N;\n if (args.length > 3) {\n if (args[2] !== null && (typeof args[2] !== 'number' || args[2] < 0 || args[2] !== Math.floor(args[2]))) {\n return context.error('The length argument to \"array\" must be a positive integer literal', 2);\n }\n N = args[2];\n i++;\n }\n type = array$1(itemType, N);\n } else {\n type = types$2[name];\n }\n const parsed = [];\n for (; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input)\n return null;\n parsed.push(input);\n }\n return new Assertion(type, parsed);\n }\n evaluate(ctx) {\n for (let i = 0; i < this.args.length; i++) {\n const value = this.args[i].evaluate(ctx);\n const error = checkSubtype(this.type, typeOf(value));\n if (!error) {\n return value;\n } else if (i === this.args.length - 1) {\n throw new RuntimeError$1(`Expected value to be of type ${ toString$1(this.type) }, but found ${ toString$1(typeOf(value)) } instead.`);\n }\n }\n return null;\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n serialize() {\n const type = this.type;\n const serialized = [type.kind];\n if (type.kind === 'array') {\n const itemType = type.itemType;\n if (itemType.kind === 'string' || itemType.kind === 'number' || itemType.kind === 'boolean') {\n serialized.push(itemType.kind);\n const N = type.N;\n if (typeof N === 'number' || this.args.length > 1) {\n serialized.push(N);\n }\n }\n }\n return serialized.concat(this.args.map(arg => arg.serialize()));\n }\n}\nvar Assertion$1 = Assertion;\n\n// \nclass FormatExpression {\n constructor(sections) {\n this.type = FormattedType;\n this.sections = sections;\n }\n static parse(args, context) {\n if (args.length < 2) {\n return context.error(`Expected at least one argument.`);\n }\n const firstArg = args[1];\n if (!Array.isArray(firstArg) && typeof firstArg === 'object') {\n return context.error(`First argument must be an image or text section.`);\n }\n const sections = [];\n let nextTokenMayBeObject = false;\n for (let i = 1; i <= args.length - 1; ++i) {\n const arg = args[i];\n if (nextTokenMayBeObject && typeof arg === 'object' && !Array.isArray(arg)) {\n nextTokenMayBeObject = false;\n let scale = null;\n if (arg['font-scale']) {\n scale = context.parse(arg['font-scale'], 1, NumberType);\n if (!scale)\n return null;\n }\n let font = null;\n if (arg['text-font']) {\n font = context.parse(arg['text-font'], 1, array$1(StringType));\n if (!font)\n return null;\n }\n let textColor = null;\n if (arg['text-color']) {\n textColor = context.parse(arg['text-color'], 1, ColorType);\n if (!textColor)\n return null;\n }\n const lastExpression = sections[sections.length - 1];\n lastExpression.scale = scale;\n lastExpression.font = font;\n lastExpression.textColor = textColor;\n } else {\n const content = context.parse(args[i], 1, ValueType);\n if (!content)\n return null;\n const kind = content.type.kind;\n if (kind !== 'string' && kind !== 'value' && kind !== 'null' && kind !== 'resolvedImage')\n return context.error(`Formatted text type must be 'string', 'value', 'image' or 'null'.`);\n nextTokenMayBeObject = true;\n sections.push({\n content,\n scale: null,\n font: null,\n textColor: null\n });\n }\n }\n return new FormatExpression(sections);\n }\n evaluate(ctx) {\n const evaluateSection = section => {\n const evaluatedContent = section.content.evaluate(ctx);\n if (typeOf(evaluatedContent) === ResolvedImageType) {\n return new FormattedSection('', evaluatedContent, null, null, null);\n }\n return new FormattedSection(toString(evaluatedContent), null, section.scale ? section.scale.evaluate(ctx) : null, section.font ? section.font.evaluate(ctx).join(',') : null, section.textColor ? section.textColor.evaluate(ctx) : null);\n };\n return new Formatted(this.sections.map(evaluateSection));\n }\n eachChild(fn) {\n for (const section of this.sections) {\n fn(section.content);\n if (section.scale) {\n fn(section.scale);\n }\n if (section.font) {\n fn(section.font);\n }\n if (section.textColor) {\n fn(section.textColor);\n }\n }\n }\n outputDefined() {\n // Technically the combinatoric set of all children\n // Usually, this.text will be undefined anyway\n return false;\n }\n serialize() {\n const serialized = ['format'];\n for (const section of this.sections) {\n serialized.push(section.content.serialize());\n const options = {};\n if (section.scale) {\n options['font-scale'] = section.scale.serialize();\n }\n if (section.font) {\n options['text-font'] = section.font.serialize();\n }\n if (section.textColor) {\n options['text-color'] = section.textColor.serialize();\n }\n serialized.push(options);\n }\n return serialized;\n }\n}\n\n// \nclass ImageExpression {\n constructor(input) {\n this.type = ResolvedImageType;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 2) {\n return context.error(`Expected two arguments.`);\n }\n const name = context.parse(args[1], 1, StringType);\n if (!name)\n return context.error(`No image name provided.`);\n return new ImageExpression(name);\n }\n evaluate(ctx) {\n const evaluatedImageName = this.input.evaluate(ctx);\n const value = ResolvedImage.fromString(evaluatedImageName);\n if (value && ctx.availableImages)\n value.available = ctx.availableImages.indexOf(evaluatedImageName) > -1;\n return value;\n }\n eachChild(fn) {\n fn(this.input);\n }\n outputDefined() {\n // The output of image is determined by the list of available images in the evaluation context\n return false;\n }\n serialize() {\n return [\n 'image',\n this.input.serialize()\n ];\n }\n}\n\nconst types$1 = {\n 'to-boolean': BooleanType,\n 'to-color': ColorType,\n 'to-number': NumberType,\n 'to-string': StringType\n};\n/**\n * Special form for error-coalescing coercion expressions \"to-number\",\n * \"to-color\". Since these coercions can fail at runtime, they accept multiple\n * arguments, only evaluating one at a time until one succeeds.\n *\n * @private\n */\nclass Coercion {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2)\n return context.error(`Expected at least one argument.`);\n const name = args[0];\n if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)\n return context.error(`Expected one argument.`);\n const type = types$1[name];\n const parsed = [];\n for (let i = 1; i < args.length; i++) {\n const input = context.parse(args[i], i, ValueType);\n if (!input)\n return null;\n parsed.push(input);\n }\n return new Coercion(type, parsed);\n }\n evaluate(ctx) {\n if (this.type.kind === 'boolean') {\n return Boolean(this.args[0].evaluate(ctx));\n } else if (this.type.kind === 'color') {\n let input;\n let error;\n for (const arg of this.args) {\n input = arg.evaluate(ctx);\n error = null;\n if (input instanceof Color$1) {\n return input;\n } else if (typeof input === 'string') {\n const c = ctx.parseColor(input);\n if (c)\n return c;\n } else if (Array.isArray(input)) {\n if (input.length < 3 || input.length > 4) {\n error = `Invalid rbga value ${ JSON.stringify(input) }: expected an array containing either three or four numeric values.`;\n } else {\n error = validateRGBA(input[0], input[1], input[2], input[3]);\n }\n if (!error) {\n return new Color$1(input[0] / 255, input[1] / 255, input[2] / 255, input[3]);\n }\n }\n }\n throw new RuntimeError$1(error || `Could not parse color from value '${ typeof input === 'string' ? input : String(JSON.stringify(input)) }'`);\n } else if (this.type.kind === 'number') {\n let value = null;\n for (const arg of this.args) {\n value = arg.evaluate(ctx);\n if (value === null)\n return 0;\n const num = Number(value);\n if (isNaN(num))\n continue;\n return num;\n }\n throw new RuntimeError$1(`Could not convert ${ JSON.stringify(value) } to number.`);\n } else if (this.type.kind === 'formatted') {\n // There is no explicit 'to-formatted' but this coercion can be implicitly\n // created by properties that expect the 'formatted' type.\n return Formatted.fromString(toString(this.args[0].evaluate(ctx)));\n } else if (this.type.kind === 'resolvedImage') {\n return ResolvedImage.fromString(toString(this.args[0].evaluate(ctx)));\n } else {\n return toString(this.args[0].evaluate(ctx));\n }\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n serialize() {\n if (this.type.kind === 'formatted') {\n return new FormatExpression([{\n content: this.args[0],\n scale: null,\n font: null,\n textColor: null\n }]).serialize();\n }\n if (this.type.kind === 'resolvedImage') {\n return new ImageExpression(this.args[0]).serialize();\n }\n const serialized = [`to-${ this.type.kind }`];\n this.eachChild(child => {\n serialized.push(child.serialize());\n });\n return serialized;\n }\n}\nvar Coercion$1 = Coercion;\n\n// \nconst geometryTypes = [\n 'Unknown',\n 'Point',\n 'LineString',\n 'Polygon'\n];\nclass EvaluationContext {\n constructor() {\n this.globals = null;\n this.feature = null;\n this.featureState = null;\n this.formattedSection = null;\n this._parseColorCache = {};\n this.availableImages = null;\n this.canonical = null;\n this.featureTileCoord = null;\n this.featureDistanceData = null;\n }\n id() {\n return this.feature && this.feature.id !== undefined ? this.feature.id : null;\n }\n geometryType() {\n return this.feature ? typeof this.feature.type === 'number' ? geometryTypes[this.feature.type] : this.feature.type : null;\n }\n geometry() {\n return this.feature && 'geometry' in this.feature ? this.feature.geometry : null;\n }\n canonicalID() {\n return this.canonical;\n }\n properties() {\n return this.feature && this.feature.properties || {};\n }\n distanceFromCenter() {\n if (this.featureTileCoord && this.featureDistanceData) {\n const c = this.featureDistanceData.center;\n const scale = this.featureDistanceData.scale;\n const {x, y} = this.featureTileCoord;\n // Calculate the distance vector `d` (left handed)\n const dX = x * scale - c[0];\n const dY = y * scale - c[1];\n // The bearing vector `b` (left handed)\n const bX = this.featureDistanceData.bearing[0];\n const bY = this.featureDistanceData.bearing[1];\n // Distance is calculated as `dot(d, v)`\n const dist = bX * dX + bY * dY;\n return dist;\n }\n return 0;\n }\n parseColor(input) {\n let cached = this._parseColorCache[input];\n if (!cached) {\n cached = this._parseColorCache[input] = Color$1.parse(input);\n }\n return cached;\n }\n}\nvar EvaluationContext$1 = EvaluationContext;\n\n// \nclass CompoundExpression {\n constructor(name, type, evaluate, args) {\n this.name = name;\n this.type = type;\n this._evaluate = evaluate;\n this.args = args;\n }\n evaluate(ctx) {\n return this._evaluate(ctx, this.args);\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return false;\n }\n serialize() {\n return [this.name].concat(this.args.map(arg => arg.serialize()));\n }\n static parse(args, context) {\n const op = args[0];\n const definition = CompoundExpression.definitions[op];\n if (!definition) {\n return context.error(`Unknown expression \"${ op }\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n }\n // Now check argument types against each signature\n const type = Array.isArray(definition) ? definition[0] : definition.type;\n const availableOverloads = Array.isArray(definition) ? [[\n definition[1],\n definition[2]\n ]] : definition.overloads;\n const overloads = availableOverloads.filter(([signature]) => !Array.isArray(signature) || // varags\n signature.length === args.length - 1 // correct param count\n);\n let signatureContext = null;\n for (const [params, evaluate] of overloads) {\n // Use a fresh context for each attempted signature so that, if\n // we eventually succeed, we haven't polluted `context.errors`.\n signatureContext = new ParsingContext$1(context.registry, context.path, null, context.scope);\n // First parse all the args, potentially coercing to the\n // types expected by this overload.\n const parsedArgs = [];\n let argParseFailed = false;\n for (let i = 1; i < args.length; i++) {\n const arg = args[i];\n const expectedType = Array.isArray(params) ? params[i - 1] : params.type;\n const parsed = signatureContext.parse(arg, 1 + parsedArgs.length, expectedType);\n if (!parsed) {\n argParseFailed = true;\n break;\n }\n parsedArgs.push(parsed);\n }\n if (argParseFailed) {\n // Couldn't coerce args of this overload to expected type, move\n // on to next one.\n continue;\n }\n if (Array.isArray(params)) {\n if (params.length !== parsedArgs.length) {\n signatureContext.error(`Expected ${ params.length } arguments, but found ${ parsedArgs.length } instead.`);\n continue;\n }\n }\n for (let i = 0; i < parsedArgs.length; i++) {\n const expected = Array.isArray(params) ? params[i] : params.type;\n const arg = parsedArgs[i];\n signatureContext.concat(i + 1).checkSubtype(expected, arg.type);\n }\n if (signatureContext.errors.length === 0) {\n return new CompoundExpression(op, type, evaluate, parsedArgs);\n }\n }\n if (overloads.length === 1) {\n context.errors.push(...signatureContext.errors);\n } else {\n const expected = overloads.length ? overloads : availableOverloads;\n const signatures = expected.map(([params]) => stringifySignature(params)).join(' | ');\n const actualTypes = [];\n // For error message, re-parse arguments without trying to\n // apply any coercions\n for (let i = 1; i < args.length; i++) {\n const parsed = context.parse(args[i], 1 + actualTypes.length);\n if (!parsed)\n return null;\n actualTypes.push(toString$1(parsed.type));\n }\n context.error(`Expected arguments of type ${ signatures }, but found (${ actualTypes.join(', ') }) instead.`);\n }\n return null;\n }\n static register(registry, definitions) {\n CompoundExpression.definitions = definitions;\n for (const name in definitions) {\n registry[name] = CompoundExpression;\n }\n }\n}\nfunction stringifySignature(signature) {\n if (Array.isArray(signature)) {\n return `(${ signature.map(toString$1).join(', ') })`;\n } else {\n return `(${ toString$1(signature.type) }...)`;\n }\n}\nvar CompoundExpression$1 = CompoundExpression;\n\n// \nclass CollatorExpression {\n constructor(caseSensitive, diacriticSensitive, locale) {\n this.type = CollatorType;\n this.locale = locale;\n this.caseSensitive = caseSensitive;\n this.diacriticSensitive = diacriticSensitive;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`Expected one argument.`);\n const options = args[1];\n if (typeof options !== 'object' || Array.isArray(options))\n return context.error(`Collator options argument must be an object.`);\n const caseSensitive = context.parse(options['case-sensitive'] === undefined ? false : options['case-sensitive'], 1, BooleanType);\n if (!caseSensitive)\n return null;\n const diacriticSensitive = context.parse(options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'], 1, BooleanType);\n if (!diacriticSensitive)\n return null;\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale)\n return null;\n }\n return new CollatorExpression(caseSensitive, diacriticSensitive, locale);\n }\n evaluate(ctx) {\n return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);\n }\n eachChild(fn) {\n fn(this.caseSensitive);\n fn(this.diacriticSensitive);\n if (this.locale) {\n fn(this.locale);\n }\n }\n outputDefined() {\n // Technically the set of possible outputs is the combinatoric set of Collators produced\n // by all possible outputs of locale/caseSensitive/diacriticSensitive\n // But for the primary use of Collators in comparison operators, we ignore the Collator's\n // possible outputs anyway, so we can get away with leaving this false for now.\n return false;\n }\n serialize() {\n const options = {};\n options['case-sensitive'] = this.caseSensitive.serialize();\n options['diacritic-sensitive'] = this.diacriticSensitive.serialize();\n if (this.locale) {\n options['locale'] = this.locale.serialize();\n }\n return [\n 'collator',\n options\n ];\n }\n}\n\n// \n// minX, minY, maxX, maxY\nconst EXTENT = 8192;\nfunction updateBBox(bbox, coord) {\n bbox[0] = Math.min(bbox[0], coord[0]);\n bbox[1] = Math.min(bbox[1], coord[1]);\n bbox[2] = Math.max(bbox[2], coord[0]);\n bbox[3] = Math.max(bbox[3], coord[1]);\n}\nfunction mercatorXfromLng(lng) {\n return (180 + lng) / 360;\n}\nfunction mercatorYfromLat(lat) {\n return (180 - 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360))) / 360;\n}\nfunction boxWithinBox(bbox1, bbox2) {\n if (bbox1[0] <= bbox2[0])\n return false;\n if (bbox1[2] >= bbox2[2])\n return false;\n if (bbox1[1] <= bbox2[1])\n return false;\n if (bbox1[3] >= bbox2[3])\n return false;\n return true;\n}\nfunction getTileCoordinates(p, canonical) {\n const x = mercatorXfromLng(p[0]);\n const y = mercatorYfromLat(p[1]);\n const tilesAtZoom = Math.pow(2, canonical.z);\n return [\n Math.round(x * tilesAtZoom * EXTENT),\n Math.round(y * tilesAtZoom * EXTENT)\n ];\n}\nfunction onBoundary(p, p1, p2) {\n const x1 = p[0] - p1[0];\n const y1 = p[1] - p1[1];\n const x2 = p[0] - p2[0];\n const y2 = p[1] - p2[1];\n return x1 * y2 - x2 * y1 === 0 && x1 * x2 <= 0 && y1 * y2 <= 0;\n}\nfunction rayIntersect(p, p1, p2) {\n return p1[1] > p[1] !== p2[1] > p[1] && p[0] < (p2[0] - p1[0]) * (p[1] - p1[1]) / (p2[1] - p1[1]) + p1[0];\n}\n// ray casting algorithm for detecting if point is in polygon\nfunction pointWithinPolygon(point, rings) {\n let inside = false;\n for (let i = 0, len = rings.length; i < len; i++) {\n const ring = rings[i];\n for (let j = 0, len2 = ring.length; j < len2 - 1; j++) {\n if (onBoundary(point, ring[j], ring[j + 1]))\n return false;\n if (rayIntersect(point, ring[j], ring[j + 1]))\n inside = !inside;\n }\n }\n return inside;\n}\nfunction pointWithinPolygons(point, polygons) {\n for (let i = 0; i < polygons.length; i++) {\n if (pointWithinPolygon(point, polygons[i]))\n return true;\n }\n return false;\n}\nfunction perp(v1, v2) {\n return v1[0] * v2[1] - v1[1] * v2[0];\n}\n// check if p1 and p2 are in different sides of line segment q1->q2\nfunction twoSided(p1, p2, q1, q2) {\n // q1->p1 (x1, y1), q1->p2 (x2, y2), q1->q2 (x3, y3)\n const x1 = p1[0] - q1[0];\n const y1 = p1[1] - q1[1];\n const x2 = p2[0] - q1[0];\n const y2 = p2[1] - q1[1];\n const x3 = q2[0] - q1[0];\n const y3 = q2[1] - q1[1];\n const det1 = x1 * y3 - x3 * y1;\n const det2 = x2 * y3 - x3 * y2;\n if (det1 > 0 && det2 < 0 || det1 < 0 && det2 > 0)\n return true;\n return false;\n}\n// a, b are end points for line segment1, c and d are end points for line segment2\nfunction lineIntersectLine(a, b, c, d) {\n // check if two segments are parallel or not\n // precondition is end point a, b is inside polygon, if line a->b is\n // parallel to polygon edge c->d, then a->b won't intersect with c->d\n const vectorP = [\n b[0] - a[0],\n b[1] - a[1]\n ];\n const vectorQ = [\n d[0] - c[0],\n d[1] - c[1]\n ];\n if (perp(vectorQ, vectorP) === 0)\n return false;\n // If lines are intersecting with each other, the relative location should be:\n // a and b lie in different sides of segment c->d\n // c and d lie in different sides of segment a->b\n if (twoSided(a, b, c, d) && twoSided(c, d, a, b))\n return true;\n return false;\n}\nfunction lineIntersectPolygon(p1, p2, polygon) {\n for (const ring of polygon) {\n // loop through every edge of the ring\n for (let j = 0; j < ring.length - 1; ++j) {\n if (lineIntersectLine(p1, p2, ring[j], ring[j + 1])) {\n return true;\n }\n }\n }\n return false;\n}\nfunction lineStringWithinPolygon(line, polygon) {\n // First, check if geometry points of line segments are all inside polygon\n for (let i = 0; i < line.length; ++i) {\n if (!pointWithinPolygon(line[i], polygon)) {\n return false;\n }\n }\n // Second, check if there is line segment intersecting polygon edge\n for (let i = 0; i < line.length - 1; ++i) {\n if (lineIntersectPolygon(line[i], line[i + 1], polygon)) {\n return false;\n }\n }\n return true;\n}\nfunction lineStringWithinPolygons(line, polygons) {\n for (let i = 0; i < polygons.length; i++) {\n if (lineStringWithinPolygon(line, polygons[i]))\n return true;\n }\n return false;\n}\nfunction getTilePolygon(coordinates, bbox, canonical) {\n const polygon = [];\n for (let i = 0; i < coordinates.length; i++) {\n const ring = [];\n for (let j = 0; j < coordinates[i].length; j++) {\n const coord = getTileCoordinates(coordinates[i][j], canonical);\n updateBBox(bbox, coord);\n ring.push(coord);\n }\n polygon.push(ring);\n }\n return polygon;\n}\nfunction getTilePolygons(coordinates, bbox, canonical) {\n const polygons = [];\n for (let i = 0; i < coordinates.length; i++) {\n const polygon = getTilePolygon(coordinates[i], bbox, canonical);\n polygons.push(polygon);\n }\n return polygons;\n}\nfunction updatePoint(p, bbox, polyBBox, worldSize) {\n if (p[0] < polyBBox[0] || p[0] > polyBBox[2]) {\n const halfWorldSize = worldSize * 0.5;\n let shift = p[0] - polyBBox[0] > halfWorldSize ? -worldSize : polyBBox[0] - p[0] > halfWorldSize ? worldSize : 0;\n if (shift === 0) {\n shift = p[0] - polyBBox[2] > halfWorldSize ? -worldSize : polyBBox[2] - p[0] > halfWorldSize ? worldSize : 0;\n }\n p[0] += shift;\n }\n updateBBox(bbox, p);\n}\nfunction resetBBox(bbox) {\n bbox[0] = bbox[1] = Infinity;\n bbox[2] = bbox[3] = -Infinity;\n}\nfunction getTilePoints(geometry, pointBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [\n canonical.x * EXTENT,\n canonical.y * EXTENT\n ];\n const tilePoints = [];\n if (!geometry)\n return tilePoints;\n for (const points of geometry) {\n for (const point of points) {\n const p = [\n point.x + shifts[0],\n point.y + shifts[1]\n ];\n updatePoint(p, pointBBox, polyBBox, worldSize);\n tilePoints.push(p);\n }\n }\n return tilePoints;\n}\nfunction getTileLines(geometry, lineBBox, polyBBox, canonical) {\n const worldSize = Math.pow(2, canonical.z) * EXTENT;\n const shifts = [\n canonical.x * EXTENT,\n canonical.y * EXTENT\n ];\n const tileLines = [];\n if (!geometry)\n return tileLines;\n for (const line of geometry) {\n const tileLine = [];\n for (const point of line) {\n const p = [\n point.x + shifts[0],\n point.y + shifts[1]\n ];\n updateBBox(lineBBox, p);\n tileLine.push(p);\n }\n tileLines.push(tileLine);\n }\n if (lineBBox[2] - lineBBox[0] <= worldSize / 2) {\n resetBBox(lineBBox);\n for (const line of tileLines) {\n for (const p of line) {\n updatePoint(p, lineBBox, polyBBox, worldSize);\n }\n }\n }\n return tileLines;\n}\nfunction pointsWithinPolygons(ctx, polygonGeometry) {\n const pointBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n const polyBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n const canonical = ctx.canonicalID();\n if (!canonical) {\n return false;\n }\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox))\n return false;\n for (const point of tilePoints) {\n if (!pointWithinPolygon(point, tilePolygon))\n return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tilePoints = getTilePoints(ctx.geometry(), pointBBox, polyBBox, canonical);\n if (!boxWithinBox(pointBBox, polyBBox))\n return false;\n for (const point of tilePoints) {\n if (!pointWithinPolygons(point, tilePolygons))\n return false;\n }\n }\n return true;\n}\nfunction linesWithinPolygons(ctx, polygonGeometry) {\n const lineBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n const polyBBox = [\n Infinity,\n Infinity,\n -Infinity,\n -Infinity\n ];\n const canonical = ctx.canonicalID();\n if (!canonical) {\n return false;\n }\n if (polygonGeometry.type === 'Polygon') {\n const tilePolygon = getTilePolygon(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox))\n return false;\n for (const line of tileLines) {\n if (!lineStringWithinPolygon(line, tilePolygon))\n return false;\n }\n }\n if (polygonGeometry.type === 'MultiPolygon') {\n const tilePolygons = getTilePolygons(polygonGeometry.coordinates, polyBBox, canonical);\n const tileLines = getTileLines(ctx.geometry(), lineBBox, polyBBox, canonical);\n if (!boxWithinBox(lineBBox, polyBBox))\n return false;\n for (const line of tileLines) {\n if (!lineStringWithinPolygons(line, tilePolygons))\n return false;\n }\n }\n return true;\n}\nclass Within {\n constructor(geojson, geometries) {\n this.type = BooleanType;\n this.geojson = geojson;\n this.geometries = geometries;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`'within' expression requires exactly one argument, but found ${ args.length - 1 } instead.`);\n if (isValue(args[1])) {\n const geojson = args[1];\n if (geojson.type === 'FeatureCollection') {\n for (let i = 0; i < geojson.features.length; ++i) {\n const type = geojson.features[i].geometry.type;\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return new Within(geojson, geojson.features[i].geometry);\n }\n }\n } else if (geojson.type === 'Feature') {\n const type = geojson.geometry.type;\n if (type === 'Polygon' || type === 'MultiPolygon') {\n return new Within(geojson, geojson.geometry);\n }\n } else if (geojson.type === 'Polygon' || geojson.type === 'MultiPolygon') {\n return new Within(geojson, geojson);\n }\n }\n return context.error(`'within' expression requires valid geojson object that contains polygon geometry type.`);\n }\n evaluate(ctx) {\n if (ctx.geometry() != null && ctx.canonicalID() != null) {\n if (ctx.geometryType() === 'Point') {\n return pointsWithinPolygons(ctx, this.geometries);\n } else if (ctx.geometryType() === 'LineString') {\n return linesWithinPolygons(ctx, this.geometries);\n }\n }\n return false;\n }\n eachChild() {\n }\n outputDefined() {\n return true;\n }\n serialize() {\n return [\n 'within',\n this.geojson\n ];\n }\n}\nvar Within$1 = Within;\n\n// \nfunction isFeatureConstant(e) {\n if (e instanceof CompoundExpression$1) {\n if (e.name === 'get' && e.args.length === 1) {\n return false;\n } else if (e.name === 'feature-state') {\n return false;\n } else if (e.name === 'has' && e.args.length === 1) {\n return false;\n } else if (e.name === 'properties' || e.name === 'geometry-type' || e.name === 'id') {\n return false;\n } else if (/^filter-/.test(e.name)) {\n return false;\n }\n }\n if (e instanceof Within$1) {\n return false;\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isFeatureConstant(arg)) {\n result = false;\n }\n });\n return result;\n}\nfunction isStateConstant(e) {\n if (e instanceof CompoundExpression$1) {\n if (e.name === 'feature-state') {\n return false;\n }\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isStateConstant(arg)) {\n result = false;\n }\n });\n return result;\n}\nfunction isGlobalPropertyConstant(e, properties) {\n if (e instanceof CompoundExpression$1 && properties.indexOf(e.name) >= 0) {\n return false;\n }\n let result = true;\n e.eachChild(arg => {\n if (result && !isGlobalPropertyConstant(arg, properties)) {\n result = false;\n }\n });\n return result;\n}\n\n// \nclass Var {\n constructor(name, boundExpression) {\n this.type = boundExpression.type;\n this.name = name;\n this.boundExpression = boundExpression;\n }\n static parse(args, context) {\n if (args.length !== 2 || typeof args[1] !== 'string')\n return context.error(`'var' expression requires exactly one string literal argument.`);\n const name = args[1];\n if (!context.scope.has(name)) {\n return context.error(`Unknown variable \"${ name }\". Make sure \"${ name }\" has been bound in an enclosing \"let\" expression before using it.`, 1);\n }\n return new Var(name, context.scope.get(name));\n }\n evaluate(ctx) {\n return this.boundExpression.evaluate(ctx);\n }\n eachChild() {\n }\n outputDefined() {\n return false;\n }\n serialize() {\n return [\n 'var',\n this.name\n ];\n }\n}\nvar Var$1 = Var;\n\n// \n/**\n * State associated parsing at a given point in an expression tree.\n * @private\n */\nclass ParsingContext {\n // The expected type of this expression. Provided only to allow Expression\n // implementations to infer argument types: Expression#parse() need not\n // check that the output type of the parsed expression matches\n // `expectedType`.\n constructor(registry, path = [], expectedType, scope = new Scope$1(), errors = []) {\n this.registry = registry;\n this.path = path;\n this.key = path.map(part => `[${ part }]`).join('');\n this.scope = scope;\n this.errors = errors;\n this.expectedType = expectedType;\n }\n /**\n * @param expr the JSON expression to parse\n * @param index the optional argument index if this expression is an argument of a parent expression that's being parsed\n * @param options\n * @param options.omitTypeAnnotations set true to omit inferred type annotations. Caller beware: with this option set, the parsed expression's type will NOT satisfy `expectedType` if it would normally be wrapped in an inferred annotation.\n * @private\n */\n parse(expr, index, expectedType, bindings, options = {}) {\n if (index) {\n return this.concat(index, expectedType, bindings)._parse(expr, options);\n }\n return this._parse(expr, options);\n }\n _parse(expr, options) {\n if (expr === null || typeof expr === 'string' || typeof expr === 'boolean' || typeof expr === 'number') {\n expr = [\n 'literal',\n expr\n ];\n }\n function annotate(parsed, type, typeAnnotation) {\n if (typeAnnotation === 'assert') {\n return new Assertion$1(type, [parsed]);\n } else if (typeAnnotation === 'coerce') {\n return new Coercion$1(type, [parsed]);\n } else {\n return parsed;\n }\n }\n if (Array.isArray(expr)) {\n if (expr.length === 0) {\n return this.error(`Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].`);\n }\n const op = expr[0];\n if (typeof op !== 'string') {\n this.error(`Expression name must be a string, but found ${ typeof op } instead. If you wanted a literal array, use [\"literal\", [...]].`, 0);\n return null;\n }\n const Expr = this.registry[op];\n if (Expr) {\n let parsed = Expr.parse(expr, this);\n if (!parsed)\n return null;\n if (this.expectedType) {\n const expected = this.expectedType;\n const actual = parsed.type;\n // When we expect a number, string, boolean, or array but have a value, wrap it in an assertion.\n // When we expect a color or formatted string, but have a string or value, wrap it in a coercion.\n // Otherwise, we do static type-checking.\n //\n // These behaviors are overridable for:\n // * The \"coalesce\" operator, which needs to omit type annotations.\n // * String-valued properties (e.g. `text-field`), where coercion is more convenient than assertion.\n //\n if ((expected.kind === 'string' || expected.kind === 'number' || expected.kind === 'boolean' || expected.kind === 'object' || expected.kind === 'array') && actual.kind === 'value') {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'assert');\n } else if ((expected.kind === 'color' || expected.kind === 'formatted' || expected.kind === 'resolvedImage') && (actual.kind === 'value' || actual.kind === 'string')) {\n parsed = annotate(parsed, expected, options.typeAnnotation || 'coerce');\n } else if (this.checkSubtype(expected, actual)) {\n return null;\n }\n }\n // If an expression's arguments are all literals, we can evaluate\n // it immediately and replace it with a literal value in the\n // parsed/compiled result. Expressions that expect an image should\n // not be resolved here so we can later get the available images.\n if (!(parsed instanceof Literal$1) && parsed.type.kind !== 'resolvedImage' && isConstant(parsed)) {\n const ec = new EvaluationContext$1();\n try {\n parsed = new Literal$1(parsed.type, parsed.evaluate(ec));\n } catch (e) {\n this.error(e.message);\n return null;\n }\n }\n return parsed;\n }\n return this.error(`Unknown expression \"${ op }\". If you wanted a literal array, use [\"literal\", [...]].`, 0);\n } else if (typeof expr === 'undefined') {\n return this.error(`'undefined' value invalid. Use null instead.`);\n } else if (typeof expr === 'object') {\n return this.error(`Bare objects invalid. Use [\"literal\", {...}] instead.`);\n } else {\n return this.error(`Expected an array, but found ${ typeof expr } instead.`);\n }\n }\n /**\n * Returns a copy of this context suitable for parsing the subexpression at\n * index `index`, optionally appending to 'let' binding map.\n *\n * Note that `errors` property, intended for collecting errors while\n * parsing, is copied by reference rather than cloned.\n * @private\n */\n concat(index, expectedType, bindings) {\n const path = typeof index === 'number' ? this.path.concat(index) : this.path;\n const scope = bindings ? this.scope.concat(bindings) : this.scope;\n return new ParsingContext(this.registry, path, expectedType || null, scope, this.errors);\n }\n /**\n * Push a parsing (or type checking) error into the `this.errors`\n * @param error The message\n * @param keys Optionally specify the source of the error at a child\n * of the current expression at `this.key`.\n * @private\n */\n error(error, ...keys) {\n const key = `${ this.key }${ keys.map(k => `[${ k }]`).join('') }`;\n this.errors.push(new ParsingError$1(key, error));\n }\n /**\n * Returns null if `t` is a subtype of `expected`; otherwise returns an\n * error message and also pushes it to `this.errors`.\n */\n checkSubtype(expected, t) {\n const error = checkSubtype(expected, t);\n if (error)\n this.error(error);\n return error;\n }\n}\nvar ParsingContext$1 = ParsingContext;\nfunction isConstant(expression) {\n if (expression instanceof Var$1) {\n return isConstant(expression.boundExpression);\n } else if (expression instanceof CompoundExpression$1 && expression.name === 'error') {\n return false;\n } else if (expression instanceof CollatorExpression) {\n // Although the results of a Collator expression with fixed arguments\n // generally shouldn't change between executions, we can't serialize them\n // as constant expressions because results change based on environment.\n return false;\n } else if (expression instanceof Within$1) {\n return false;\n }\n const isTypeAnnotation = expression instanceof Coercion$1 || expression instanceof Assertion$1;\n let childrenConstant = true;\n expression.eachChild(child => {\n // We can _almost_ assume that if `expressions` children are constant,\n // they would already have been evaluated to Literal values when they\n // were parsed. Type annotations are the exception, because they might\n // have been inferred and added after a child was parsed.\n // So we recurse into isConstant() for the children of type annotations,\n // but otherwise simply check whether they are Literals.\n if (isTypeAnnotation) {\n childrenConstant = childrenConstant && isConstant(child);\n } else {\n childrenConstant = childrenConstant && child instanceof Literal$1;\n }\n });\n if (!childrenConstant) {\n return false;\n }\n return isFeatureConstant(expression) && isGlobalPropertyConstant(expression, [\n 'zoom',\n 'heatmap-density',\n 'line-progress',\n 'sky-radial-progress',\n 'accumulated',\n 'is-supported-script',\n 'pitch',\n 'distance-from-center'\n ]);\n}\n\n// \n/**\n * Returns the index of the last stop <= input, or 0 if it doesn't exist.\n * @private\n */\nfunction findStopLessThanOrEqualTo(stops, input) {\n const lastIndex = stops.length - 1;\n let lowerIndex = 0;\n let upperIndex = lastIndex;\n let currentIndex = 0;\n let currentValue, nextValue;\n while (lowerIndex <= upperIndex) {\n currentIndex = Math.floor((lowerIndex + upperIndex) / 2);\n currentValue = stops[currentIndex];\n nextValue = stops[currentIndex + 1];\n if (currentValue <= input) {\n if (currentIndex === lastIndex || input < nextValue) {\n // Search complete\n return currentIndex;\n }\n lowerIndex = currentIndex + 1;\n } else if (currentValue > input) {\n upperIndex = currentIndex - 1;\n } else {\n throw new RuntimeError$1('Input is not a number.');\n }\n }\n return 0;\n}\n\n// \nclass Step {\n constructor(type, input, stops) {\n this.type = type;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n static parse(args, context) {\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${ args.length - 1 }.`);\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n const input = context.parse(args[1], 1, NumberType);\n if (!input)\n return null;\n const stops = [];\n let outputType = null;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n for (let i = 1; i < args.length; i += 2) {\n const label = i === 1 ? -Infinity : args[i];\n const value = args[i + 1];\n const labelKey = i;\n const valueKey = i + 1;\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n stops.push([\n label,\n parsed\n ]);\n }\n return new Step(outputType, input, stops);\n }\n evaluate(ctx) {\n const labels = this.labels;\n const outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n const value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n const index = findStopLessThanOrEqualTo(labels, value);\n return outputs[index].evaluate(ctx);\n }\n eachChild(fn) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined());\n }\n serialize() {\n const serialized = [\n 'step',\n this.input.serialize()\n ];\n for (let i = 0; i < this.labels.length; i++) {\n if (i > 0) {\n serialized.push(this.labels[i]);\n }\n serialized.push(this.outputs[i].serialize());\n }\n return serialized;\n }\n}\nvar Step$1 = Step;\n\n/*\n * Copyright (C) 2008 Apple Inc. All Rights Reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * Ported from Webkit\n * http://svn.webkit.org/repository/webkit/trunk/Source/WebCore/platform/graphics/UnitBezier.h\n */\n\nvar unitbezier = UnitBezier;\nfunction UnitBezier(p1x, p1y, p2x, p2y) {\n // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1).\n this.cx = 3 * p1x;\n this.bx = 3 * (p2x - p1x) - this.cx;\n this.ax = 1 - this.cx - this.bx;\n this.cy = 3 * p1y;\n this.by = 3 * (p2y - p1y) - this.cy;\n this.ay = 1 - this.cy - this.by;\n this.p1x = p1x;\n this.p1y = p2y;\n this.p2x = p2x;\n this.p2y = p2y;\n}\nUnitBezier.prototype.sampleCurveX = function (t) {\n // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule.\n return ((this.ax * t + this.bx) * t + this.cx) * t;\n};\nUnitBezier.prototype.sampleCurveY = function (t) {\n return ((this.ay * t + this.by) * t + this.cy) * t;\n};\nUnitBezier.prototype.sampleCurveDerivativeX = function (t) {\n return (3 * this.ax * t + 2 * this.bx) * t + this.cx;\n};\nUnitBezier.prototype.solveCurveX = function (x, epsilon) {\n if (typeof epsilon === 'undefined')\n epsilon = 0.000001;\n var t0, t1, t2, x2, i;\n // First try a few iterations of Newton's method -- normally very fast.\n for (t2 = x, i = 0; i < 8; i++) {\n x2 = this.sampleCurveX(t2) - x;\n if (Math.abs(x2) < epsilon)\n return t2;\n var d2 = this.sampleCurveDerivativeX(t2);\n if (Math.abs(d2) < 0.000001)\n break;\n t2 = t2 - x2 / d2;\n }\n // Fall back to the bisection method for reliability.\n t0 = 0;\n t1 = 1;\n t2 = x;\n if (t2 < t0)\n return t0;\n if (t2 > t1)\n return t1;\n while (t0 < t1) {\n x2 = this.sampleCurveX(t2);\n if (Math.abs(x2 - x) < epsilon)\n return t2;\n if (x > x2) {\n t0 = t2;\n } else {\n t1 = t2;\n }\n t2 = (t1 - t0) * 0.5 + t0;\n }\n // Failure.\n return t2;\n};\nUnitBezier.prototype.solve = function (x, epsilon) {\n return this.sampleCurveY(this.solveCurveX(x, epsilon));\n};\n\nvar UnitBezier$1 = /*@__PURE__*/getDefaultExportFromCjs(unitbezier);\n\n// \nfunction number(a, b, t) {\n return a * (1 - t) + b * t;\n}\nfunction color(from, to, t) {\n return new Color$1(number(from.r, to.r, t), number(from.g, to.g, t), number(from.b, to.b, t), number(from.a, to.a, t));\n}\nfunction array(from, to, t) {\n return from.map((d, i) => {\n return number(d, to[i], t);\n });\n}\n\nvar interpolate = /*#__PURE__*/Object.freeze({\n\t__proto__: null,\n\tnumber: number,\n\tcolor: color,\n\tarray: array\n});\n\n// \n// Constants\nconst Xn = 0.95047,\n // D65 standard referent\n Yn = 1, Zn = 1.08883, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1, deg2rad$1 = Math.PI / 180, rad2deg = 180 / Math.PI;\n// Utilities\nfunction xyz2lab(t) {\n return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;\n}\nfunction lab2xyz(t) {\n return t > t1 ? t * t * t : t2 * (t - t0);\n}\nfunction xyz2rgb(x) {\n return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);\n}\nfunction rgb2xyz(x) {\n x /= 255;\n return x <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);\n}\n// LAB\nfunction rgbToLab(rgbColor) {\n const b = rgb2xyz(rgbColor.r), a = rgb2xyz(rgbColor.g), l = rgb2xyz(rgbColor.b), x = xyz2lab((0.4124564 * b + 0.3575761 * a + 0.1804375 * l) / Xn), y = xyz2lab((0.2126729 * b + 0.7151522 * a + 0.072175 * l) / Yn), z = xyz2lab((0.0193339 * b + 0.119192 * a + 0.9503041 * l) / Zn);\n return {\n l: 116 * y - 16,\n a: 500 * (x - y),\n b: 200 * (y - z),\n alpha: rgbColor.a\n };\n}\nfunction labToRgb(labColor) {\n let y = (labColor.l + 16) / 116, x = isNaN(labColor.a) ? y : y + labColor.a / 500, z = isNaN(labColor.b) ? y : y - labColor.b / 200;\n y = Yn * lab2xyz(y);\n x = Xn * lab2xyz(x);\n z = Zn * lab2xyz(z);\n return new Color$1(xyz2rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z), // D65 -> sRGB\n xyz2rgb(-0.969266 * x + 1.8760108 * y + 0.041556 * z), xyz2rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z), labColor.alpha);\n}\nfunction interpolateLab(from, to, t) {\n return {\n l: number(from.l, to.l, t),\n a: number(from.a, to.a, t),\n b: number(from.b, to.b, t),\n alpha: number(from.alpha, to.alpha, t)\n };\n}\n// HCL\nfunction rgbToHcl(rgbColor) {\n const {l, a, b} = rgbToLab(rgbColor);\n const h = Math.atan2(b, a) * rad2deg;\n return {\n h: h < 0 ? h + 360 : h,\n c: Math.sqrt(a * a + b * b),\n l,\n alpha: rgbColor.a\n };\n}\nfunction hclToRgb(hclColor) {\n const h = hclColor.h * deg2rad$1, c = hclColor.c, l = hclColor.l;\n return labToRgb({\n l,\n a: Math.cos(h) * c,\n b: Math.sin(h) * c,\n alpha: hclColor.alpha\n });\n}\nfunction interpolateHue(a, b, t) {\n const d = b - a;\n return a + t * (d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d);\n}\nfunction interpolateHcl(from, to, t) {\n return {\n h: interpolateHue(from.h, to.h, t),\n c: number(from.c, to.c, t),\n l: number(from.l, to.l, t),\n alpha: number(from.alpha, to.alpha, t)\n };\n}\nconst lab = {\n forward: rgbToLab,\n reverse: labToRgb,\n interpolate: interpolateLab\n};\nconst hcl = {\n forward: rgbToHcl,\n reverse: hclToRgb,\n interpolate: interpolateHcl\n};\n\n// \nclass Interpolate {\n constructor(type, operator, interpolation, input, stops) {\n this.type = type;\n this.operator = operator;\n this.interpolation = interpolation;\n this.input = input;\n this.labels = [];\n this.outputs = [];\n for (const [label, expression] of stops) {\n this.labels.push(label);\n this.outputs.push(expression);\n }\n }\n static interpolationFactor(interpolation, input, lower, upper) {\n let t = 0;\n if (interpolation.name === 'exponential') {\n t = exponentialInterpolation(input, interpolation.base, lower, upper);\n } else if (interpolation.name === 'linear') {\n t = exponentialInterpolation(input, 1, lower, upper);\n } else if (interpolation.name === 'cubic-bezier') {\n const c = interpolation.controlPoints;\n const ub = new UnitBezier$1(c[0], c[1], c[2], c[3]);\n t = ub.solve(exponentialInterpolation(input, 1, lower, upper));\n }\n return t;\n }\n static parse(args, context) {\n let [operator, interpolation, input, ...rest] = args;\n if (!Array.isArray(interpolation) || interpolation.length === 0) {\n return context.error(`Expected an interpolation type expression.`, 1);\n }\n if (interpolation[0] === 'linear') {\n interpolation = { name: 'linear' };\n } else if (interpolation[0] === 'exponential') {\n const base = interpolation[1];\n if (typeof base !== 'number')\n return context.error(`Exponential interpolation requires a numeric base.`, 1, 1);\n interpolation = {\n name: 'exponential',\n base\n };\n } else if (interpolation[0] === 'cubic-bezier') {\n const controlPoints = interpolation.slice(1);\n if (controlPoints.length !== 4 || controlPoints.some(t => typeof t !== 'number' || t < 0 || t > 1)) {\n return context.error('Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.', 1);\n }\n interpolation = {\n name: 'cubic-bezier',\n controlPoints: controlPoints\n };\n } else {\n return context.error(`Unknown interpolation type ${ String(interpolation[0]) }`, 1, 0);\n }\n if (args.length - 1 < 4) {\n return context.error(`Expected at least 4 arguments, but found only ${ args.length - 1 }.`);\n }\n if ((args.length - 1) % 2 !== 0) {\n return context.error(`Expected an even number of arguments.`);\n }\n input = context.parse(input, 2, NumberType);\n if (!input)\n return null;\n const stops = [];\n let outputType = null;\n if (operator === 'interpolate-hcl' || operator === 'interpolate-lab') {\n outputType = ColorType;\n } else if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n for (let i = 0; i < rest.length; i += 2) {\n const label = rest[i];\n const value = rest[i + 1];\n const labelKey = i + 3;\n const valueKey = i + 4;\n if (typeof label !== 'number') {\n return context.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);\n }\n if (stops.length && stops[stops.length - 1][0] >= label) {\n return context.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.', labelKey);\n }\n const parsed = context.parse(value, valueKey, outputType);\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n stops.push([\n label,\n parsed\n ]);\n }\n if (outputType.kind !== 'number' && outputType.kind !== 'color' && !(outputType.kind === 'array' && outputType.itemType.kind === 'number' && typeof outputType.N === 'number')) {\n return context.error(`Type ${ toString$1(outputType) } is not interpolatable.`);\n }\n return new Interpolate(outputType, operator, interpolation, input, stops);\n }\n evaluate(ctx) {\n const labels = this.labels;\n const outputs = this.outputs;\n if (labels.length === 1) {\n return outputs[0].evaluate(ctx);\n }\n const value = this.input.evaluate(ctx);\n if (value <= labels[0]) {\n return outputs[0].evaluate(ctx);\n }\n const stopCount = labels.length;\n if (value >= labels[stopCount - 1]) {\n return outputs[stopCount - 1].evaluate(ctx);\n }\n const index = findStopLessThanOrEqualTo(labels, value);\n const lower = labels[index];\n const upper = labels[index + 1];\n const t = Interpolate.interpolationFactor(this.interpolation, value, lower, upper);\n const outputLower = outputs[index].evaluate(ctx);\n const outputUpper = outputs[index + 1].evaluate(ctx);\n if (this.operator === 'interpolate') {\n return interpolate[this.type.kind.toLowerCase()](outputLower, outputUpper, t); // eslint-disable-line import/namespace\n } else if (this.operator === 'interpolate-hcl') {\n return hcl.reverse(hcl.interpolate(hcl.forward(outputLower), hcl.forward(outputUpper), t));\n } else {\n return lab.reverse(lab.interpolate(lab.forward(outputLower), lab.forward(outputUpper), t));\n }\n }\n eachChild(fn) {\n fn(this.input);\n for (const expression of this.outputs) {\n fn(expression);\n }\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined());\n }\n serialize() {\n let interpolation;\n if (this.interpolation.name === 'linear') {\n interpolation = ['linear'];\n } else if (this.interpolation.name === 'exponential') {\n if (this.interpolation.base === 1) {\n interpolation = ['linear'];\n } else {\n interpolation = [\n 'exponential',\n this.interpolation.base\n ];\n }\n } else {\n interpolation = ['cubic-bezier'].concat(this.interpolation.controlPoints);\n }\n const serialized = [\n this.operator,\n interpolation,\n this.input.serialize()\n ];\n for (let i = 0; i < this.labels.length; i++) {\n serialized.push(this.labels[i], this.outputs[i].serialize());\n }\n return serialized;\n }\n}\n/**\n * Returns a ratio that can be used to interpolate between exponential function\n * stops.\n * How it works: Two consecutive stop values define a (scaled and shifted) exponential function `f(x) = a * base^x + b`, where `base` is the user-specified base,\n * and `a` and `b` are constants affording sufficient degrees of freedom to fit\n * the function to the given stops.\n *\n * Here's a bit of algebra that lets us compute `f(x)` directly from the stop\n * values without explicitly solving for `a` and `b`:\n *\n * First stop value: `f(x0) = y0 = a * base^x0 + b`\n * Second stop value: `f(x1) = y1 = a * base^x1 + b`\n * => `y1 - y0 = a(base^x1 - base^x0)`\n * => `a = (y1 - y0)/(base^x1 - base^x0)`\n *\n * Desired value: `f(x) = y = a * base^x + b`\n * => `f(x) = y0 + a * (base^x - base^x0)`\n *\n * From the above, we can replace the `a` in `a * (base^x - base^x0)` and do a\n * little algebra:\n * ```\n * a * (base^x - base^x0) = (y1 - y0)/(base^x1 - base^x0) * (base^x - base^x0)\n * = (y1 - y0) * (base^x - base^x0) / (base^x1 - base^x0)\n * ```\n *\n * If we let `(base^x - base^x0) / (base^x1 base^x0)`, then we have\n * `f(x) = y0 + (y1 - y0) * ratio`. In other words, `ratio` may be treated as\n * an interpolation factor between the two stops' output values.\n *\n * (Note: a slightly different form for `ratio`,\n * `(base^(x-x0) - 1) / (base^(x1-x0) - 1) `, is equivalent, but requires fewer\n * expensive `Math.pow()` operations.)\n *\n * @private\n*/\nfunction exponentialInterpolation(input, base, lowerValue, upperValue) {\n const difference = upperValue - lowerValue;\n const progress = input - lowerValue;\n if (difference === 0) {\n return 0;\n } else if (base === 1) {\n return progress / difference;\n } else {\n return (Math.pow(base, progress) - 1) / (Math.pow(base, difference) - 1);\n }\n}\nvar Interpolate$1 = Interpolate;\n\nclass Coalesce {\n constructor(type, args) {\n this.type = type;\n this.args = args;\n }\n static parse(args, context) {\n if (args.length < 2) {\n return context.error('Expectected at least one argument.');\n }\n let outputType = null;\n const expectedType = context.expectedType;\n if (expectedType && expectedType.kind !== 'value') {\n outputType = expectedType;\n }\n const parsedArgs = [];\n for (const arg of args.slice(1)) {\n const parsed = context.parse(arg, 1 + parsedArgs.length, outputType, undefined, { typeAnnotation: 'omit' });\n if (!parsed)\n return null;\n outputType = outputType || parsed.type;\n parsedArgs.push(parsed);\n }\n // Above, we parse arguments without inferred type annotation so that\n // they don't produce a runtime error for `null` input, which would\n // preempt the desired null-coalescing behavior.\n // Thus, if any of our arguments would have needed an annotation, we\n // need to wrap the enclosing coalesce expression with it instead.\n const needsAnnotation = expectedType && parsedArgs.some(arg => checkSubtype(expectedType, arg.type));\n return needsAnnotation ? new Coalesce(ValueType, parsedArgs) : new Coalesce(outputType, parsedArgs);\n }\n evaluate(ctx) {\n let result = null;\n let argCount = 0;\n let firstImage;\n for (const arg of this.args) {\n argCount++;\n result = arg.evaluate(ctx);\n // we need to keep track of the first requested image in a coalesce statement\n // if coalesce can't find a valid image, we return the first image so styleimagemissing can fire\n if (result && result instanceof ResolvedImage && !result.available) {\n // set to first image\n if (!firstImage) {\n firstImage = result;\n }\n result = null;\n // if we reach the end, return the first image\n if (argCount === this.args.length) {\n return firstImage;\n }\n }\n if (result !== null)\n break;\n }\n return result;\n }\n eachChild(fn) {\n this.args.forEach(fn);\n }\n outputDefined() {\n return this.args.every(arg => arg.outputDefined());\n }\n serialize() {\n const serialized = ['coalesce'];\n this.eachChild(child => {\n serialized.push(child.serialize());\n });\n return serialized;\n }\n}\nvar Coalesce$1 = Coalesce;\n\n// \nclass Let {\n constructor(bindings, result) {\n this.type = result.type;\n this.bindings = [].concat(bindings);\n this.result = result;\n }\n evaluate(ctx) {\n return this.result.evaluate(ctx);\n }\n eachChild(fn) {\n for (const binding of this.bindings) {\n fn(binding[1]);\n }\n fn(this.result);\n }\n static parse(args, context) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found ${ args.length - 1 } instead.`);\n const bindings = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const name = args[i];\n if (typeof name !== 'string') {\n return context.error(`Expected string, but found ${ typeof name } instead.`, i);\n }\n if (/[^a-zA-Z0-9_]/.test(name)) {\n return context.error(`Variable names must contain only alphanumeric characters or '_'.`, i);\n }\n const value = context.parse(args[i + 1], i + 1);\n if (!value)\n return null;\n bindings.push([\n name,\n value\n ]);\n }\n const result = context.parse(args[args.length - 1], args.length - 1, context.expectedType, bindings);\n if (!result)\n return null;\n return new Let(bindings, result);\n }\n outputDefined() {\n return this.result.outputDefined();\n }\n serialize() {\n const serialized = ['let'];\n for (const [name, expr] of this.bindings) {\n serialized.push(name, expr.serialize());\n }\n serialized.push(this.result.serialize());\n return serialized;\n }\n}\nvar Let$1 = Let;\n\n// \nclass At {\n constructor(type, index, input) {\n this.type = type;\n this.index = index;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 3)\n return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);\n const index = context.parse(args[1], 1, NumberType);\n const input = context.parse(args[2], 2, array$1(context.expectedType || ValueType));\n if (!index || !input)\n return null;\n const t = input.type;\n return new At(t.itemType, index, input);\n }\n evaluate(ctx) {\n const index = this.index.evaluate(ctx);\n const array = this.input.evaluate(ctx);\n if (index < 0) {\n throw new RuntimeError$1(`Array index out of bounds: ${ index } < 0.`);\n }\n if (index >= array.length) {\n throw new RuntimeError$1(`Array index out of bounds: ${ index } > ${ array.length - 1 }.`);\n }\n if (index !== Math.floor(index)) {\n throw new RuntimeError$1(`Array index must be an integer, but found ${ index } instead.`);\n }\n return array[index];\n }\n eachChild(fn) {\n fn(this.index);\n fn(this.input);\n }\n outputDefined() {\n return false;\n }\n serialize() {\n return [\n 'at',\n this.index.serialize(),\n this.input.serialize()\n ];\n }\n}\nvar At$1 = At;\n\n// \nclass In {\n constructor(needle, haystack) {\n this.type = BooleanType;\n this.needle = needle;\n this.haystack = haystack;\n }\n static parse(args, context) {\n if (args.length !== 3) {\n return context.error(`Expected 2 arguments, but found ${ args.length - 1 } instead.`);\n }\n const needle = context.parse(args[1], 1, ValueType);\n const haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack)\n return null;\n if (!isValidType(needle.type, [\n BooleanType,\n StringType,\n NumberType,\n NullType,\n ValueType\n ])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);\n }\n return new In(needle, haystack);\n }\n evaluate(ctx) {\n const needle = this.needle.evaluate(ctx);\n const haystack = this.haystack.evaluate(ctx);\n if (haystack == null)\n return false;\n if (!isValidNativeType(needle, [\n 'boolean',\n 'string',\n 'number',\n 'null'\n ])) {\n throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);\n }\n if (!isValidNativeType(haystack, [\n 'string',\n 'array'\n ])) {\n throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);\n }\n return haystack.indexOf(needle) >= 0;\n }\n eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n }\n outputDefined() {\n return true;\n }\n serialize() {\n return [\n 'in',\n this.needle.serialize(),\n this.haystack.serialize()\n ];\n }\n}\nvar In$1 = In;\n\n// \nclass IndexOf {\n constructor(needle, haystack, fromIndex) {\n this.type = NumberType;\n this.needle = needle;\n this.haystack = haystack;\n this.fromIndex = fromIndex;\n }\n static parse(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 3 or 4 arguments, but found ${ args.length - 1 } instead.`);\n }\n const needle = context.parse(args[1], 1, ValueType);\n const haystack = context.parse(args[2], 2, ValueType);\n if (!needle || !haystack)\n return null;\n if (!isValidType(needle.type, [\n BooleanType,\n StringType,\n NumberType,\n NullType,\n ValueType\n ])) {\n return context.error(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(needle.type) } instead`);\n }\n if (args.length === 4) {\n const fromIndex = context.parse(args[3], 3, NumberType);\n if (!fromIndex)\n return null;\n return new IndexOf(needle, haystack, fromIndex);\n } else {\n return new IndexOf(needle, haystack);\n }\n }\n evaluate(ctx) {\n const needle = this.needle.evaluate(ctx);\n const haystack = this.haystack.evaluate(ctx);\n if (!isValidNativeType(needle, [\n 'boolean',\n 'string',\n 'number',\n 'null'\n ])) {\n throw new RuntimeError$1(`Expected first argument to be of type boolean, string, number or null, but found ${ toString$1(typeOf(needle)) } instead.`);\n }\n if (!isValidNativeType(haystack, [\n 'string',\n 'array'\n ])) {\n throw new RuntimeError$1(`Expected second argument to be of type array or string, but found ${ toString$1(typeOf(haystack)) } instead.`);\n }\n if (this.fromIndex) {\n const fromIndex = this.fromIndex.evaluate(ctx);\n return haystack.indexOf(needle, fromIndex);\n }\n return haystack.indexOf(needle);\n }\n eachChild(fn) {\n fn(this.needle);\n fn(this.haystack);\n if (this.fromIndex) {\n fn(this.fromIndex);\n }\n }\n outputDefined() {\n return false;\n }\n serialize() {\n if (this.fromIndex != null && this.fromIndex !== undefined) {\n const fromIndex = this.fromIndex.serialize();\n return [\n 'index-of',\n this.needle.serialize(),\n this.haystack.serialize(),\n fromIndex\n ];\n }\n return [\n 'index-of',\n this.needle.serialize(),\n this.haystack.serialize()\n ];\n }\n}\nvar IndexOf$1 = IndexOf;\n\n// Map input label values to output expression index\nclass Match {\n constructor(inputType, outputType, input, cases, outputs, otherwise) {\n this.inputType = inputType;\n this.type = outputType;\n this.input = input;\n this.cases = cases;\n this.outputs = outputs;\n this.otherwise = otherwise;\n }\n static parse(args, context) {\n if (args.length < 5)\n return context.error(`Expected at least 4 arguments, but found only ${ args.length - 1 }.`);\n if (args.length % 2 !== 1)\n return context.error(`Expected an even number of arguments.`);\n let inputType;\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const cases = {};\n const outputs = [];\n for (let i = 2; i < args.length - 1; i += 2) {\n let labels = args[i];\n const value = args[i + 1];\n if (!Array.isArray(labels)) {\n labels = [labels];\n }\n const labelContext = context.concat(i);\n if (labels.length === 0) {\n return labelContext.error('Expected at least one branch label.');\n }\n for (const label of labels) {\n if (typeof label !== 'number' && typeof label !== 'string') {\n return labelContext.error(`Branch labels must be numbers or strings.`);\n } else if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {\n return labelContext.error(`Branch labels must be integers no larger than ${ Number.MAX_SAFE_INTEGER }.`);\n } else if (typeof label === 'number' && Math.floor(label) !== label) {\n return labelContext.error(`Numeric branch labels must be integer values.`);\n } else if (!inputType) {\n inputType = typeOf(label);\n } else if (labelContext.checkSubtype(inputType, typeOf(label))) {\n return null;\n }\n if (typeof cases[String(label)] !== 'undefined') {\n return labelContext.error('Branch labels must be unique.');\n }\n cases[String(label)] = outputs.length;\n }\n const result = context.parse(value, i, outputType);\n if (!result)\n return null;\n outputType = outputType || result.type;\n outputs.push(result);\n }\n const input = context.parse(args[1], 1, ValueType);\n if (!input)\n return null;\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise)\n return null;\n if (input.type.kind !== 'value' && context.concat(1).checkSubtype(inputType, input.type)) {\n return null;\n }\n return new Match(inputType, outputType, input, cases, outputs, otherwise);\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n const output = typeOf(input) === this.inputType && this.outputs[this.cases[input]] || this.otherwise;\n return output.evaluate(ctx);\n }\n eachChild(fn) {\n fn(this.input);\n this.outputs.forEach(fn);\n fn(this.otherwise);\n }\n outputDefined() {\n return this.outputs.every(out => out.outputDefined()) && this.otherwise.outputDefined();\n }\n serialize() {\n const serialized = [\n 'match',\n this.input.serialize()\n ];\n // Sort so serialization has an arbitrary defined order, even though\n // branch order doesn't affect evaluation\n const sortedLabels = Object.keys(this.cases).sort();\n // Group branches by unique match expression to support condensed\n // serializations of the form [case1, case2, ...] -> matchExpression\n const groupedByOutput = [];\n const outputLookup = {};\n // lookup index into groupedByOutput for a given output expression\n for (const label of sortedLabels) {\n const outputIndex = outputLookup[this.cases[label]];\n if (outputIndex === undefined) {\n // First time seeing this output, add it to the end of the grouped list\n outputLookup[this.cases[label]] = groupedByOutput.length;\n groupedByOutput.push([\n this.cases[label],\n [label]\n ]);\n } else {\n // We've seen this expression before, add the label to that output's group\n groupedByOutput[outputIndex][1].push(label);\n }\n }\n const coerceLabel = label => this.inputType.kind === 'number' ? Number(label) : label;\n for (const [outputIndex, labels] of groupedByOutput) {\n if (labels.length === 1) {\n // Only a single label matches this output expression\n serialized.push(coerceLabel(labels[0]));\n } else {\n // Array of literal labels pointing to this output expression\n serialized.push(labels.map(coerceLabel));\n }\n serialized.push(this.outputs[outputIndex].serialize());\n }\n serialized.push(this.otherwise.serialize());\n return serialized;\n }\n}\nvar Match$1 = Match;\n\nclass Case {\n constructor(type, branches, otherwise) {\n this.type = type;\n this.branches = branches;\n this.otherwise = otherwise;\n }\n static parse(args, context) {\n if (args.length < 4)\n return context.error(`Expected at least 3 arguments, but found only ${ args.length - 1 }.`);\n if (args.length % 2 !== 0)\n return context.error(`Expected an odd number of arguments.`);\n let outputType;\n if (context.expectedType && context.expectedType.kind !== 'value') {\n outputType = context.expectedType;\n }\n const branches = [];\n for (let i = 1; i < args.length - 1; i += 2) {\n const test = context.parse(args[i], i, BooleanType);\n if (!test)\n return null;\n const result = context.parse(args[i + 1], i + 1, outputType);\n if (!result)\n return null;\n branches.push([\n test,\n result\n ]);\n outputType = outputType || result.type;\n }\n const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);\n if (!otherwise)\n return null;\n return new Case(outputType, branches, otherwise);\n }\n evaluate(ctx) {\n for (const [test, expression] of this.branches) {\n if (test.evaluate(ctx)) {\n return expression.evaluate(ctx);\n }\n }\n return this.otherwise.evaluate(ctx);\n }\n eachChild(fn) {\n for (const [test, expression] of this.branches) {\n fn(test);\n fn(expression);\n }\n fn(this.otherwise);\n }\n outputDefined() {\n return this.branches.every(([_, out]) => out.outputDefined()) && this.otherwise.outputDefined();\n }\n serialize() {\n const serialized = ['case'];\n this.eachChild(child => {\n serialized.push(child.serialize());\n });\n return serialized;\n }\n}\nvar Case$1 = Case;\n\n// \nclass Slice {\n constructor(type, input, beginIndex, endIndex) {\n this.type = type;\n this.input = input;\n this.beginIndex = beginIndex;\n this.endIndex = endIndex;\n }\n static parse(args, context) {\n if (args.length <= 2 || args.length >= 5) {\n return context.error(`Expected 3 or 4 arguments, but found ${ args.length - 1 } instead.`);\n }\n const input = context.parse(args[1], 1, ValueType);\n const beginIndex = context.parse(args[2], 2, NumberType);\n if (!input || !beginIndex)\n return null;\n if (!isValidType(input.type, [\n array$1(ValueType),\n StringType,\n ValueType\n ])) {\n return context.error(`Expected first argument to be of type array or string, but found ${ toString$1(input.type) } instead`);\n }\n if (args.length === 4) {\n const endIndex = context.parse(args[3], 3, NumberType);\n if (!endIndex)\n return null;\n return new Slice(input.type, input, beginIndex, endIndex);\n } else {\n return new Slice(input.type, input, beginIndex);\n }\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n const beginIndex = this.beginIndex.evaluate(ctx);\n if (!isValidNativeType(input, [\n 'string',\n 'array'\n ])) {\n throw new RuntimeError$1(`Expected first argument to be of type array or string, but found ${ toString$1(typeOf(input)) } instead.`);\n }\n if (this.endIndex) {\n const endIndex = this.endIndex.evaluate(ctx);\n return input.slice(beginIndex, endIndex);\n }\n return input.slice(beginIndex);\n }\n eachChild(fn) {\n fn(this.input);\n fn(this.beginIndex);\n if (this.endIndex) {\n fn(this.endIndex);\n }\n }\n outputDefined() {\n return false;\n }\n serialize() {\n if (this.endIndex != null && this.endIndex !== undefined) {\n const endIndex = this.endIndex.serialize();\n return [\n 'slice',\n this.input.serialize(),\n this.beginIndex.serialize(),\n endIndex\n ];\n }\n return [\n 'slice',\n this.input.serialize(),\n this.beginIndex.serialize()\n ];\n }\n}\nvar Slice$1 = Slice;\n\n// \nfunction isComparableType(op, type) {\n if (op === '==' || op === '!=') {\n // equality operator\n return type.kind === 'boolean' || type.kind === 'string' || type.kind === 'number' || type.kind === 'null' || type.kind === 'value';\n } else {\n // ordering operator\n return type.kind === 'string' || type.kind === 'number' || type.kind === 'value';\n }\n}\nfunction eq(ctx, a, b) {\n return a === b;\n}\nfunction neq(ctx, a, b) {\n return a !== b;\n}\nfunction lt(ctx, a, b) {\n return a < b;\n}\nfunction gt(ctx, a, b) {\n return a > b;\n}\nfunction lteq(ctx, a, b) {\n return a <= b;\n}\nfunction gteq(ctx, a, b) {\n return a >= b;\n}\nfunction eqCollate(ctx, a, b, c) {\n return c.compare(a, b) === 0;\n}\nfunction neqCollate(ctx, a, b, c) {\n return !eqCollate(ctx, a, b, c);\n}\nfunction ltCollate(ctx, a, b, c) {\n return c.compare(a, b) < 0;\n}\nfunction gtCollate(ctx, a, b, c) {\n return c.compare(a, b) > 0;\n}\nfunction lteqCollate(ctx, a, b, c) {\n return c.compare(a, b) <= 0;\n}\nfunction gteqCollate(ctx, a, b, c) {\n return c.compare(a, b) >= 0;\n}\n/**\n * Special form for comparison operators, implementing the signatures:\n * - (T, T, ?Collator) => boolean\n * - (T, value, ?Collator) => boolean\n * - (value, T, ?Collator) => boolean\n *\n * For inequalities, T must be either value, string, or number. For ==/!=, it\n * can also be boolean or null.\n *\n * Equality semantics are equivalent to Javascript's strict equality (===/!==)\n * -- i.e., when the arguments' types don't match, == evaluates to false, != to\n * true.\n *\n * When types don't match in an ordering comparison, a runtime error is thrown.\n *\n * @private\n */\nfunction makeComparison(op, compareBasic, compareWithCollator) {\n const isOrderComparison = op !== '==' && op !== '!=';\n return class Comparison {\n constructor(lhs, rhs, collator) {\n this.type = BooleanType;\n this.lhs = lhs;\n this.rhs = rhs;\n this.collator = collator;\n this.hasUntypedArgument = lhs.type.kind === 'value' || rhs.type.kind === 'value';\n }\n static parse(args, context) {\n if (args.length !== 3 && args.length !== 4)\n return context.error(`Expected two or three arguments.`);\n const op = args[0];\n let lhs = context.parse(args[1], 1, ValueType);\n if (!lhs)\n return null;\n if (!isComparableType(op, lhs.type)) {\n return context.concat(1).error(`\"${ op }\" comparisons are not supported for type '${ toString$1(lhs.type) }'.`);\n }\n let rhs = context.parse(args[2], 2, ValueType);\n if (!rhs)\n return null;\n if (!isComparableType(op, rhs.type)) {\n return context.concat(2).error(`\"${ op }\" comparisons are not supported for type '${ toString$1(rhs.type) }'.`);\n }\n if (lhs.type.kind !== rhs.type.kind && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {\n return context.error(`Cannot compare types '${ toString$1(lhs.type) }' and '${ toString$1(rhs.type) }'.`);\n }\n if (isOrderComparison) {\n // typing rules specific to less/greater than operators\n if (lhs.type.kind === 'value' && rhs.type.kind !== 'value') {\n // (value, T)\n lhs = new Assertion$1(rhs.type, [lhs]);\n } else if (lhs.type.kind !== 'value' && rhs.type.kind === 'value') {\n // (T, value)\n rhs = new Assertion$1(lhs.type, [rhs]);\n }\n }\n let collator = null;\n if (args.length === 4) {\n if (lhs.type.kind !== 'string' && rhs.type.kind !== 'string' && lhs.type.kind !== 'value' && rhs.type.kind !== 'value') {\n return context.error(`Cannot use collator to compare non-string types.`);\n }\n collator = context.parse(args[3], 3, CollatorType);\n if (!collator)\n return null;\n }\n return new Comparison(lhs, rhs, collator);\n }\n evaluate(ctx) {\n const lhs = this.lhs.evaluate(ctx);\n const rhs = this.rhs.evaluate(ctx);\n if (isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n // check that type is string or number, and equal\n if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {\n throw new RuntimeError$1(`Expected arguments for \"${ op }\" to be (string, string) or (number, number), but found (${ lt.kind }, ${ rt.kind }) instead.`);\n }\n }\n if (this.collator && !isOrderComparison && this.hasUntypedArgument) {\n const lt = typeOf(lhs);\n const rt = typeOf(rhs);\n if (lt.kind !== 'string' || rt.kind !== 'string') {\n return compareBasic(ctx, lhs, rhs);\n }\n }\n return this.collator ? compareWithCollator(ctx, lhs, rhs, this.collator.evaluate(ctx)) : compareBasic(ctx, lhs, rhs);\n }\n eachChild(fn) {\n fn(this.lhs);\n fn(this.rhs);\n if (this.collator) {\n fn(this.collator);\n }\n }\n outputDefined() {\n return true;\n }\n serialize() {\n const serialized = [op];\n this.eachChild(child => {\n serialized.push(child.serialize());\n });\n return serialized;\n }\n };\n}\nconst Equals = makeComparison('==', eq, eqCollate);\nconst NotEquals = makeComparison('!=', neq, neqCollate);\nconst LessThan = makeComparison('<', lt, ltCollate);\nconst GreaterThan = makeComparison('>', gt, gtCollate);\nconst LessThanOrEqual = makeComparison('<=', lteq, lteqCollate);\nconst GreaterThanOrEqual = makeComparison('>=', gteq, gteqCollate);\n\n// \nclass NumberFormat {\n // BCP 47 language tag\n // ISO 4217 currency code, required if style=currency\n // Simple units sanctioned for use in ECMAScript, required if style=unit. https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier\n // Default 0\n // Default 3\n constructor(number, locale, currency, unit, minFractionDigits, maxFractionDigits) {\n this.type = StringType;\n this.number = number;\n this.locale = locale;\n this.currency = currency;\n this.unit = unit;\n this.minFractionDigits = minFractionDigits;\n this.maxFractionDigits = maxFractionDigits;\n }\n static parse(args, context) {\n if (args.length !== 3)\n return context.error(`Expected two arguments.`);\n const number = context.parse(args[1], 1, NumberType);\n if (!number)\n return null;\n const options = args[2];\n if (typeof options !== 'object' || Array.isArray(options))\n return context.error(`NumberFormat options argument must be an object.`);\n let locale = null;\n if (options['locale']) {\n locale = context.parse(options['locale'], 1, StringType);\n if (!locale)\n return null;\n }\n let currency = null;\n if (options['currency']) {\n currency = context.parse(options['currency'], 1, StringType);\n if (!currency)\n return null;\n }\n let unit = null;\n if (options['unit']) {\n unit = context.parse(options['unit'], 1, StringType);\n if (!unit)\n return null;\n }\n let minFractionDigits = null;\n if (options['min-fraction-digits']) {\n minFractionDigits = context.parse(options['min-fraction-digits'], 1, NumberType);\n if (!minFractionDigits)\n return null;\n }\n let maxFractionDigits = null;\n if (options['max-fraction-digits']) {\n maxFractionDigits = context.parse(options['max-fraction-digits'], 1, NumberType);\n if (!maxFractionDigits)\n return null;\n }\n return new NumberFormat(number, locale, currency, unit, minFractionDigits, maxFractionDigits);\n }\n evaluate(ctx) {\n return new Intl.NumberFormat(this.locale ? this.locale.evaluate(ctx) : [], {\n style: this.currency && 'currency' || this.unit && 'unit' || 'decimal',\n currency: this.currency ? this.currency.evaluate(ctx) : undefined,\n unit: this.unit ? this.unit.evaluate(ctx) : undefined,\n minimumFractionDigits: this.minFractionDigits ? this.minFractionDigits.evaluate(ctx) : undefined,\n maximumFractionDigits: this.maxFractionDigits ? this.maxFractionDigits.evaluate(ctx) : undefined\n }).format(this.number.evaluate(ctx));\n }\n eachChild(fn) {\n fn(this.number);\n if (this.locale) {\n fn(this.locale);\n }\n if (this.currency) {\n fn(this.currency);\n }\n if (this.unit) {\n fn(this.unit);\n }\n if (this.minFractionDigits) {\n fn(this.minFractionDigits);\n }\n if (this.maxFractionDigits) {\n fn(this.maxFractionDigits);\n }\n }\n outputDefined() {\n return false;\n }\n serialize() {\n const options = {};\n if (this.locale) {\n options['locale'] = this.locale.serialize();\n }\n if (this.currency) {\n options['currency'] = this.currency.serialize();\n }\n if (this.unit) {\n options['unit'] = this.unit.serialize();\n }\n if (this.minFractionDigits) {\n options['min-fraction-digits'] = this.minFractionDigits.serialize();\n }\n if (this.maxFractionDigits) {\n options['max-fraction-digits'] = this.maxFractionDigits.serialize();\n }\n return [\n 'number-format',\n this.number.serialize(),\n options\n ];\n }\n}\n\n// \nclass Length {\n constructor(input) {\n this.type = NumberType;\n this.input = input;\n }\n static parse(args, context) {\n if (args.length !== 2)\n return context.error(`Expected 1 argument, but found ${ args.length - 1 } instead.`);\n const input = context.parse(args[1], 1);\n if (!input)\n return null;\n if (input.type.kind !== 'array' && input.type.kind !== 'string' && input.type.kind !== 'value')\n return context.error(`Expected argument of type string or array, but found ${ toString$1(input.type) } instead.`);\n return new Length(input);\n }\n evaluate(ctx) {\n const input = this.input.evaluate(ctx);\n if (typeof input === 'string') {\n return input.length;\n } else if (Array.isArray(input)) {\n return input.length;\n } else {\n throw new RuntimeError$1(`Expected value to be of type string or array, but found ${ toString$1(typeOf(input)) } instead.`);\n }\n }\n eachChild(fn) {\n fn(this.input);\n }\n outputDefined() {\n return false;\n }\n serialize() {\n const serialized = ['length'];\n this.eachChild(child => {\n serialized.push(child.serialize());\n });\n return serialized;\n }\n}\nvar Length$1 = Length;\n\n// \nconst expressions = {\n // special forms\n '==': Equals,\n '!=': NotEquals,\n '>': GreaterThan,\n '<': LessThan,\n '>=': GreaterThanOrEqual,\n '<=': LessThanOrEqual,\n 'array': Assertion$1,\n 'at': At$1,\n 'boolean': Assertion$1,\n 'case': Case$1,\n 'coalesce': Coalesce$1,\n 'collator': CollatorExpression,\n 'format': FormatExpression,\n 'image': ImageExpression,\n 'in': In$1,\n 'index-of': IndexOf$1,\n 'interpolate': Interpolate$1,\n 'interpolate-hcl': Interpolate$1,\n 'interpolate-lab': Interpolate$1,\n 'length': Length$1,\n 'let': Let$1,\n 'literal': Literal$1,\n 'match': Match$1,\n 'number': Assertion$1,\n 'number-format': NumberFormat,\n 'object': Assertion$1,\n 'slice': Slice$1,\n 'step': Step$1,\n 'string': Assertion$1,\n 'to-boolean': Coercion$1,\n 'to-color': Coercion$1,\n 'to-number': Coercion$1,\n 'to-string': Coercion$1,\n 'var': Var$1,\n 'within': Within$1\n};\nfunction rgba(ctx, [r, g, b, a]) {\n r = r.evaluate(ctx);\n g = g.evaluate(ctx);\n b = b.evaluate(ctx);\n const alpha = a ? a.evaluate(ctx) : 1;\n const error = validateRGBA(r, g, b, alpha);\n if (error)\n throw new RuntimeError$1(error);\n return new Color$1(r / 255 * alpha, g / 255 * alpha, b / 255 * alpha, alpha);\n}\nfunction has(key, obj) {\n return key in obj;\n}\nfunction get(key, obj) {\n const v = obj[key];\n return typeof v === 'undefined' ? null : v;\n}\nfunction binarySearch(v, a, i, j) {\n while (i <= j) {\n const m = i + j >> 1;\n if (a[m] === v)\n return true;\n if (a[m] > v)\n j = m - 1;\n else\n i = m + 1;\n }\n return false;\n}\nfunction varargs(type) {\n return { type };\n}\nCompoundExpression$1.register(expressions, {\n 'error': [\n ErrorType,\n [StringType],\n (ctx, [v]) => {\n throw new RuntimeError$1(v.evaluate(ctx));\n }\n ],\n 'typeof': [\n StringType,\n [ValueType],\n (ctx, [v]) => toString$1(typeOf(v.evaluate(ctx)))\n ],\n 'to-rgba': [\n array$1(NumberType, 4),\n [ColorType],\n (ctx, [v]) => {\n return v.evaluate(ctx).toArray();\n }\n ],\n 'rgb': [\n ColorType,\n [\n NumberType,\n NumberType,\n NumberType\n ],\n rgba\n ],\n 'rgba': [\n ColorType,\n [\n NumberType,\n NumberType,\n NumberType,\n NumberType\n ],\n rgba\n ],\n 'has': {\n type: BooleanType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => has(key.evaluate(ctx), ctx.properties())\n ],\n [\n [\n StringType,\n ObjectType\n ],\n (ctx, [key, obj]) => has(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'get': {\n type: ValueType,\n overloads: [\n [\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())\n ],\n [\n [\n StringType,\n ObjectType\n ],\n (ctx, [key, obj]) => get(key.evaluate(ctx), obj.evaluate(ctx))\n ]\n ]\n },\n 'feature-state': [\n ValueType,\n [StringType],\n (ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {})\n ],\n 'properties': [\n ObjectType,\n [],\n ctx => ctx.properties()\n ],\n 'geometry-type': [\n StringType,\n [],\n ctx => ctx.geometryType()\n ],\n 'id': [\n ValueType,\n [],\n ctx => ctx.id()\n ],\n 'zoom': [\n NumberType,\n [],\n ctx => ctx.globals.zoom\n ],\n 'pitch': [\n NumberType,\n [],\n ctx => ctx.globals.pitch || 0\n ],\n 'distance-from-center': [\n NumberType,\n [],\n ctx => ctx.distanceFromCenter()\n ],\n 'heatmap-density': [\n NumberType,\n [],\n ctx => ctx.globals.heatmapDensity || 0\n ],\n 'line-progress': [\n NumberType,\n [],\n ctx => ctx.globals.lineProgress || 0\n ],\n 'sky-radial-progress': [\n NumberType,\n [],\n ctx => ctx.globals.skyRadialProgress || 0\n ],\n 'accumulated': [\n ValueType,\n [],\n ctx => ctx.globals.accumulated === undefined ? null : ctx.globals.accumulated\n ],\n '+': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 0;\n for (const arg of args) {\n result += arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '*': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => {\n let result = 1;\n for (const arg of args) {\n result *= arg.evaluate(ctx);\n }\n return result;\n }\n ],\n '-': {\n type: NumberType,\n overloads: [\n [\n [\n NumberType,\n NumberType\n ],\n (ctx, [a, b]) => a.evaluate(ctx) - b.evaluate(ctx)\n ],\n [\n [NumberType],\n (ctx, [a]) => -a.evaluate(ctx)\n ]\n ]\n },\n '/': [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n (ctx, [a, b]) => a.evaluate(ctx) / b.evaluate(ctx)\n ],\n '%': [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n (ctx, [a, b]) => a.evaluate(ctx) % b.evaluate(ctx)\n ],\n 'ln2': [\n NumberType,\n [],\n () => Math.LN2\n ],\n 'pi': [\n NumberType,\n [],\n () => Math.PI\n ],\n 'e': [\n NumberType,\n [],\n () => Math.E\n ],\n '^': [\n NumberType,\n [\n NumberType,\n NumberType\n ],\n (ctx, [b, e]) => Math.pow(b.evaluate(ctx), e.evaluate(ctx))\n ],\n 'sqrt': [\n NumberType,\n [NumberType],\n (ctx, [x]) => Math.sqrt(x.evaluate(ctx))\n ],\n 'log10': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN10\n ],\n 'ln': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx))\n ],\n 'log2': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN2\n ],\n 'sin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.sin(n.evaluate(ctx))\n ],\n 'cos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.cos(n.evaluate(ctx))\n ],\n 'tan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.tan(n.evaluate(ctx))\n ],\n 'asin': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.asin(n.evaluate(ctx))\n ],\n 'acos': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.acos(n.evaluate(ctx))\n ],\n 'atan': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.atan(n.evaluate(ctx))\n ],\n 'min': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.min(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'max': [\n NumberType,\n varargs(NumberType),\n (ctx, args) => Math.max(...args.map(arg => arg.evaluate(ctx)))\n ],\n 'abs': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.abs(n.evaluate(ctx))\n ],\n 'round': [\n NumberType,\n [NumberType],\n (ctx, [n]) => {\n const v = n.evaluate(ctx);\n // Javascript's Math.round() rounds towards +Infinity for halfway\n // values, even when they're negative. It's more common to round\n // away from 0 (e.g., this is what python and C++ do)\n return v < 0 ? -Math.round(-v) : Math.round(v);\n }\n ],\n 'floor': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.floor(n.evaluate(ctx))\n ],\n 'ceil': [\n NumberType,\n [NumberType],\n (ctx, [n]) => Math.ceil(n.evaluate(ctx))\n ],\n 'filter-==': [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n (ctx, [k, v]) => ctx.properties()[k.value] === v.value\n ],\n 'filter-id-==': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => ctx.id() === v.value\n ],\n 'filter-type-==': [\n BooleanType,\n [StringType],\n (ctx, [v]) => ctx.geometryType() === v.value\n ],\n 'filter-<': [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter-id-<': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a < b;\n }\n ],\n 'filter->': [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-id->': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a > b;\n }\n ],\n 'filter-<=': [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter-id-<=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a <= b;\n }\n ],\n 'filter->=': [\n BooleanType,\n [\n StringType,\n ValueType\n ],\n (ctx, [k, v]) => {\n const a = ctx.properties()[k.value];\n const b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-id->=': [\n BooleanType,\n [ValueType],\n (ctx, [v]) => {\n const a = ctx.id();\n const b = v.value;\n return typeof a === typeof b && a >= b;\n }\n ],\n 'filter-has': [\n BooleanType,\n [ValueType],\n (ctx, [k]) => k.value in ctx.properties()\n ],\n 'filter-has-id': [\n BooleanType,\n [],\n ctx => ctx.id() !== null && ctx.id() !== undefined\n ],\n 'filter-type-in': [\n BooleanType,\n [array$1(StringType)],\n (ctx, [v]) => v.value.indexOf(ctx.geometryType()) >= 0\n ],\n 'filter-id-in': [\n BooleanType,\n [array$1(ValueType)],\n (ctx, [v]) => v.value.indexOf(ctx.id()) >= 0\n ],\n 'filter-in-small': [\n BooleanType,\n [\n StringType,\n array$1(ValueType)\n ],\n // assumes v is an array literal\n (ctx, [k, v]) => v.value.indexOf(ctx.properties()[k.value]) >= 0\n ],\n 'filter-in-large': [\n BooleanType,\n [\n StringType,\n array$1(ValueType)\n ],\n // assumes v is a array literal with values sorted in ascending order and of a single type\n (ctx, [k, v]) => binarySearch(ctx.properties()[k.value], v.value, 0, v.value.length - 1)\n ],\n 'all': {\n type: BooleanType,\n overloads: [\n [\n [\n BooleanType,\n BooleanType\n ],\n (ctx, [a, b]) => a.evaluate(ctx) && b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (!arg.evaluate(ctx))\n return false;\n }\n return true;\n }\n ]\n ]\n },\n 'any': {\n type: BooleanType,\n overloads: [\n [\n [\n BooleanType,\n BooleanType\n ],\n (ctx, [a, b]) => a.evaluate(ctx) || b.evaluate(ctx)\n ],\n [\n varargs(BooleanType),\n (ctx, args) => {\n for (const arg of args) {\n if (arg.evaluate(ctx))\n return true;\n }\n return false;\n }\n ]\n ]\n },\n '!': [\n BooleanType,\n [BooleanType],\n (ctx, [b]) => !b.evaluate(ctx)\n ],\n 'is-supported-script': [\n BooleanType,\n [StringType],\n // At parse time this will always return true, so we need to exclude this expression with isGlobalPropertyConstant\n (ctx, [s]) => {\n const isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;\n if (isSupportedScript) {\n return isSupportedScript(s.evaluate(ctx));\n }\n return true;\n }\n ],\n 'upcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toUpperCase()\n ],\n 'downcase': [\n StringType,\n [StringType],\n (ctx, [s]) => s.evaluate(ctx).toLowerCase()\n ],\n 'concat': [\n StringType,\n varargs(ValueType),\n (ctx, args) => args.map(arg => toString(arg.evaluate(ctx))).join('')\n ],\n 'resolved-locale': [\n StringType,\n [CollatorType],\n (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()\n ]\n});\nvar definitions = expressions;\n\n// \n/**\n * A type used for returning and propagating errors. The first element of the union\n * represents success and contains a value, and the second represents an error and\n * contains an error value.\n * @private\n */\nfunction success(value) {\n return {\n result: 'success',\n value\n };\n}\nfunction error(value) {\n return {\n result: 'error',\n value\n };\n}\n\n// \nfunction supportsPropertyExpression(spec) {\n return spec['property-type'] === 'data-driven';\n}\nfunction supportsZoomExpression(spec) {\n return !!spec.expression && spec.expression.parameters.indexOf('zoom') > -1;\n}\nfunction supportsInterpolation(spec) {\n return !!spec.expression && spec.expression.interpolated;\n}\n\nfunction isFunction(value) {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nclass StyleExpression {\n constructor(expression, propertySpec) {\n this.expression = expression;\n this._warningHistory = {};\n this._evaluator = new EvaluationContext$1();\n this._defaultValue = propertySpec ? getDefaultValue(propertySpec) : null;\n this._enumValues = propertySpec && propertySpec.type === 'enum' ? propertySpec.values : null;\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature;\n this._evaluator.featureState = featureState;\n this._evaluator.canonical = canonical || null;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection;\n this._evaluator.featureTileCoord = featureTileCoord || null;\n this._evaluator.featureDistanceData = featureDistanceData || null;\n return this.expression.evaluate(this._evaluator);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection, featureTileCoord, featureDistanceData) {\n this._evaluator.globals = globals;\n this._evaluator.feature = feature || null;\n this._evaluator.featureState = featureState || null;\n this._evaluator.canonical = canonical || null;\n this._evaluator.availableImages = availableImages || null;\n this._evaluator.formattedSection = formattedSection || null;\n this._evaluator.featureTileCoord = featureTileCoord || null;\n this._evaluator.featureDistanceData = featureDistanceData || null;\n try {\n const val = this.expression.evaluate(this._evaluator);\n // eslint-disable-next-line no-self-compare\n if (val === null || val === undefined || typeof val === 'number' && val !== val) {\n return this._defaultValue;\n }\n if (this._enumValues && !(val in this._enumValues)) {\n throw new RuntimeError$1(`Expected value to be one of ${ Object.keys(this._enumValues).map(v => JSON.stringify(v)).join(', ') }, but found ${ JSON.stringify(val) } instead.`);\n }\n return val;\n } catch (e) {\n if (!this._warningHistory[e.message]) {\n this._warningHistory[e.message] = true;\n if (typeof console !== 'undefined') {\n console.warn(e.message);\n }\n }\n return this._defaultValue;\n }\n }\n}\nfunction isExpression(expression) {\n return Array.isArray(expression) && expression.length > 0 && typeof expression[0] === 'string' && expression[0] in definitions;\n}\n/**\n * Parse and typecheck the given style spec JSON expression. If\n * options.defaultValue is provided, then the resulting StyleExpression's\n * `evaluate()` method will handle errors by logging a warning (once per\n * message) and returning the default value. Otherwise, it will throw\n * evaluation errors.\n *\n * @private\n */\nfunction createExpression(expression, propertySpec) {\n const parser = new ParsingContext$1(definitions, [], propertySpec ? getExpectedType(propertySpec) : undefined);\n // For string-valued properties, coerce to string at the top level rather than asserting.\n const parsed = parser.parse(expression, undefined, undefined, undefined, propertySpec && propertySpec.type === 'string' ? { typeAnnotation: 'coerce' } : undefined);\n if (!parsed) {\n return error(parser.errors);\n }\n return success(new StyleExpression(parsed, propertySpec));\n}\nclass ZoomConstantExpression {\n constructor(kind, expression) {\n this.kind = kind;\n this._styleExpression = expression;\n this.isStateDependent = kind !== 'constant' && !isStateConstant(expression.expression);\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n}\nclass ZoomDependentExpression {\n constructor(kind, expression, zoomStops, interpolationType) {\n this.kind = kind;\n this.zoomStops = zoomStops;\n this._styleExpression = expression;\n this.isStateDependent = kind !== 'camera' && !isStateConstant(expression.expression);\n this.interpolationType = interpolationType;\n }\n evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluateWithoutErrorHandling(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n evaluate(globals, feature, featureState, canonical, availableImages, formattedSection) {\n return this._styleExpression.evaluate(globals, feature, featureState, canonical, availableImages, formattedSection);\n }\n interpolationFactor(input, lower, upper) {\n if (this.interpolationType) {\n return Interpolate$1.interpolationFactor(this.interpolationType, input, lower, upper);\n } else {\n return 0;\n }\n }\n}\nfunction createPropertyExpression(expression, propertySpec) {\n expression = createExpression(expression, propertySpec);\n if (expression.result === 'error') {\n return expression;\n }\n const parsed = expression.value.expression;\n const isFeatureConstant$1 = isFeatureConstant(parsed);\n if (!isFeatureConstant$1 && !supportsPropertyExpression(propertySpec)) {\n return error([new ParsingError$1('', 'data expressions not supported')]);\n }\n const isZoomConstant = isGlobalPropertyConstant(parsed, [\n 'zoom',\n 'pitch',\n 'distance-from-center'\n ]);\n if (!isZoomConstant && !supportsZoomExpression(propertySpec)) {\n return error([new ParsingError$1('', 'zoom expressions not supported')]);\n }\n const zoomCurve = findZoomCurve(parsed);\n if (!zoomCurve && !isZoomConstant) {\n return error([new ParsingError$1('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);\n } else if (zoomCurve instanceof ParsingError$1) {\n return error([zoomCurve]);\n } else if (zoomCurve instanceof Interpolate$1 && !supportsInterpolation(propertySpec)) {\n return error([new ParsingError$1('', '\"interpolate\" expressions cannot be used with this property')]);\n }\n if (!zoomCurve) {\n return success(isFeatureConstant$1 ? new ZoomConstantExpression('constant', expression.value) : new ZoomConstantExpression('source', expression.value));\n }\n const interpolationType = zoomCurve instanceof Interpolate$1 ? zoomCurve.interpolation : undefined;\n return success(isFeatureConstant$1 ? new ZoomDependentExpression('camera', expression.value, zoomCurve.labels, interpolationType) : new ZoomDependentExpression('composite', expression.value, zoomCurve.labels, interpolationType));\n}\n// Zoom-dependent expressions may only use [\"zoom\"] as the input to a top-level \"step\" or \"interpolate\"\n// expression (collectively referred to as a \"curve\"). The curve may be wrapped in one or more \"let\" or\n// \"coalesce\" expressions.\nfunction findZoomCurve(expression) {\n let result = null;\n if (expression instanceof Let$1) {\n result = findZoomCurve(expression.result);\n } else if (expression instanceof Coalesce$1) {\n for (const arg of expression.args) {\n result = findZoomCurve(arg);\n if (result) {\n break;\n }\n }\n } else if ((expression instanceof Step$1 || expression instanceof Interpolate$1) && expression.input instanceof CompoundExpression$1 && expression.input.name === 'zoom') {\n result = expression;\n }\n if (result instanceof ParsingError$1) {\n return result;\n }\n expression.eachChild(child => {\n const childResult = findZoomCurve(child);\n if (childResult instanceof ParsingError$1) {\n result = childResult;\n } else if (!result && childResult) {\n result = new ParsingError$1('', '\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.');\n } else if (result && childResult && result !== childResult) {\n result = new ParsingError$1('', 'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.');\n }\n });\n return result;\n}\nfunction getExpectedType(spec) {\n const types = {\n color: ColorType,\n string: StringType,\n number: NumberType,\n enum: StringType,\n boolean: BooleanType,\n formatted: FormattedType,\n resolvedImage: ResolvedImageType\n };\n if (spec.type === 'array') {\n return array$1(types[spec.value] || ValueType, spec.length);\n }\n return types[spec.type];\n}\nfunction getDefaultValue(spec) {\n if (spec.type === 'color' && (isFunction(spec.default) || Array.isArray(spec.default))) {\n // Special case for heatmap-color: it uses the 'default:' to define a\n // default color ramp, but createExpression expects a simple value to fall\n // back to in case of runtime errors\n return new Color$1(0, 0, 0, 0);\n } else if (spec.type === 'color') {\n return Color$1.parse(spec.default) || null;\n } else if (spec.default === undefined) {\n return null;\n } else {\n return spec.default;\n }\n}\n\n// \n// Turn jsonlint-lines-primitives objects into primitive objects\nfunction unbundle(value) {\n if (value instanceof Number || value instanceof String || value instanceof Boolean) {\n return value.valueOf();\n } else {\n return value;\n }\n}\nfunction deepUnbundle(value) {\n if (Array.isArray(value)) {\n return value.map(deepUnbundle);\n } else if (value instanceof Object && !(value instanceof Number || value instanceof String || value instanceof Boolean)) {\n const unbundledValue = {};\n for (const key in value) {\n unbundledValue[key] = deepUnbundle(value[key]);\n }\n return unbundledValue;\n }\n return unbundle(value);\n}\n\nvar spec = {\"$version\":8,\"$root\":{\"version\":{\"required\":true,\"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\"},\"terrain\":{\"type\":\"terrain\"},\"fog\":{\"type\":\"fog\"},\"sources\":{\"required\":true,\"type\":\"sources\"},\"sprite\":{\"type\":\"string\"},\"glyphs\":{\"type\":\"string\"},\"transition\":{\"type\":\"transition\"},\"projection\":{\"type\":\"projection\"},\"layers\":{\"required\":true,\"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\":true,\"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\":false},\"*\":{\"type\":\"*\"}},\"source_raster\":{\"type\":{\"required\":true,\"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\":false},\"*\":{\"type\":\"*\"}},\"source_raster_dem\":{\"type\":{\"required\":true,\"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\":false},\"*\":{\"type\":\"*\"}},\"source_geojson\":{\"type\":{\"required\":true,\"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\":0.375},\"cluster\":{\"type\":\"boolean\",\"default\":false},\"clusterRadius\":{\"type\":\"number\",\"default\":50,\"minimum\":0},\"clusterMaxZoom\":{\"type\":\"number\"},\"clusterMinPoints\":{\"type\":\"number\"},\"clusterProperties\":{\"type\":\"*\"},\"lineMetrics\":{\"type\":\"boolean\",\"default\":false},\"generateId\":{\"type\":\"boolean\",\"default\":false},\"promoteId\":{\"type\":\"promoteId\"}},\"source_video\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"video\":{}}},\"urls\":{\"required\":true,\"type\":\"array\",\"value\":\"string\"},\"coordinates\":{\"required\":true,\"type\":\"array\",\"length\":4,\"value\":{\"type\":\"array\",\"length\":2,\"value\":\"number\"}}},\"source_image\":{\"type\":{\"required\":true,\"type\":\"enum\",\"values\":{\"image\":{}}},\"url\":{\"required\":true,\"type\":\"string\"},\"coordinates\":{\"required\":true,\"type\":\"array\",\"length\":4,\"value\":{\"type\":\"array\",\"length\":2,\"value\":\"number\"}}},\"layer\":{\"id\":{\"type\":\"string\",\"required\":true},\"type\":{\"type\":\"enum\",\"values\":{\"fill\":{},\"line\":{},\"symbol\":{},\"circle\":{},\"heatmap\":{},\"fill-extrusion\":{},\"raster\":{},\"hillshade\":{},\"background\":{},\"sky\":{}},\"required\":true},\"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_sky\"],\"layout_background\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":{},\"none\":{}},\"default\":\"visible\",\"property-type\":\"constant\"}},\"layout_sky\":{\"visibility\":{\"type\":\"enum\",\"values\":{\"visible\":{},\"none\":{}},\"default\":\"visible\",\"property-type\":\"constant\"}},\"layout_fill\":{\"fill-sort-key\":{\"type\":\"number\",\"expression\":{\"interpolated\":false,\"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\":false,\"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\"},\"fill-extrusion-edge-radius\":{\"type\":\"number\",\"private\":true,\"default\":0,\"minimum\":0,\"maximum\":1,\"property-type\":\"constant\"}},\"layout_line\":{\"line-cap\":{\"type\":\"enum\",\"values\":{\"butt\":{},\"round\":{},\"square\":{}},\"default\":\"butt\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-join\":{\"type\":\"enum\",\"values\":{\"bevel\":{},\"round\":{},\"miter\":{}},\"default\":\"miter\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{\"type\":\"number\",\"default\":2,\"requires\":[{\"line-join\":\"miter\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-round-limit\":{\"type\":\"number\",\"default\":1.05,\"requires\":[{\"line-join\":\"round\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-sort-key\":{\"type\":\"number\",\"expression\":{\"interpolated\":false,\"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\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{\"type\":\"number\",\"default\":250,\"minimum\":1,\"units\":\"pixels\",\"requires\":[{\"symbol-placement\":\"line\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{\"type\":\"boolean\",\"default\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{\"type\":\"number\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{\"type\":\"enum\",\"values\":{\"auto\":{},\"viewport-y\":{},\"source\":{}},\"default\":\"auto\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"icon-image\",\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{},\"auto\":{}},\"default\":\"auto\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":false,\"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\":true,\"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\":false,\"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\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{\"type\":\"resolvedImage\",\"tokens\":true,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"units\":\"degrees\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{\"type\":\"number\",\"default\":2,\"minimum\":0,\"units\":\"pixels\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-keep-upright\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"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\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{},\"auto\":{}},\"default\":\"auto\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{},\"auto\":{}},\"default\":\"auto\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{},\"auto\":{}},\"default\":\"auto\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{\"type\":\"formatted\",\"default\":\"\",\"tokens\":true,\"expression\":{\"interpolated\":false,\"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\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{\"type\":\"number\",\"default\":16,\"minimum\":0,\"units\":\"pixels\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{\"type\":\"number\",\"default\":10,\"minimum\":0,\"units\":\"ems\",\"requires\":[\"text-field\",{\"symbol-placement\":[\"point\"]}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{\"type\":\"number\",\"default\":1.2,\"units\":\"ems\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-letter-spacing\":{\"type\":\"number\",\"default\":0,\"units\":\"ems\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{\"type\":\"enum\",\"values\":{\"auto\":{},\"left\":{},\"center\":{},\"right\":{}},\"default\":\"center\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"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\":true,\"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\":false,\"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\":false,\"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\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{\"type\":\"array\",\"value\":\"enum\",\"values\":{\"horizontal\":{},\"vertical\":{}},\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"units\":\"degrees\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{\"type\":\"number\",\"default\":2,\"minimum\":0,\"units\":\"pixels\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{\"type\":\"boolean\",\"default\":true,\"requires\":[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{\"type\":\"enum\",\"values\":{\"none\":{},\"uppercase\":{},\"lowercase\":{}},\"default\":\"none\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"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\":true,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{\"type\":\"boolean\",\"default\":false,\"requires\":[\"text-field\",\"icon-image\"],\"expression\":{\"interpolated\":false,\"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_symbol\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\",\"pitch\",\"distance-from-center\"]}},\"filter_fill\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]}},\"filter_line\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]}},\"filter_circle\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]}},\"filter_fill-extrusion\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]}},\"filter_heatmap\":{\"type\":\"boolean\",\"default\":false,\"transition\":false,\"property-type\":\"data-driven\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]}},\"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\":false}},\"function_stop\":{\"type\":\"array\",\"minimum\":0,\"maximum\":24,\"value\":[\"number\",\"color\"],\"length\":2},\"expression\":{\"type\":\"array\",\"value\":\"*\",\"minimum\":1},\"expression_name\":{\"type\":\"enum\",\"values\":{\"let\":{\"group\":\"Variable binding\"},\"var\":{\"group\":\"Variable binding\"},\"literal\":{\"group\":\"Types\"},\"array\":{\"group\":\"Types\"},\"at\":{\"group\":\"Lookup\"},\"in\":{\"group\":\"Lookup\"},\"index-of\":{\"group\":\"Lookup\"},\"slice\":{\"group\":\"Lookup\"},\"case\":{\"group\":\"Decision\"},\"match\":{\"group\":\"Decision\"},\"coalesce\":{\"group\":\"Decision\"},\"step\":{\"group\":\"Ramps, scales, curves\"},\"interpolate\":{\"group\":\"Ramps, scales, curves\"},\"interpolate-hcl\":{\"group\":\"Ramps, scales, curves\"},\"interpolate-lab\":{\"group\":\"Ramps, scales, curves\"},\"ln2\":{\"group\":\"Math\"},\"pi\":{\"group\":\"Math\"},\"e\":{\"group\":\"Math\"},\"typeof\":{\"group\":\"Types\"},\"string\":{\"group\":\"Types\"},\"number\":{\"group\":\"Types\"},\"boolean\":{\"group\":\"Types\"},\"object\":{\"group\":\"Types\"},\"collator\":{\"group\":\"Types\"},\"format\":{\"group\":\"Types\"},\"image\":{\"group\":\"Types\"},\"number-format\":{\"group\":\"Types\"},\"to-string\":{\"group\":\"Types\"},\"to-number\":{\"group\":\"Types\"},\"to-boolean\":{\"group\":\"Types\"},\"to-rgba\":{\"group\":\"Color\"},\"to-color\":{\"group\":\"Types\"},\"rgb\":{\"group\":\"Color\"},\"rgba\":{\"group\":\"Color\"},\"get\":{\"group\":\"Lookup\"},\"has\":{\"group\":\"Lookup\"},\"length\":{\"group\":\"Lookup\"},\"properties\":{\"group\":\"Feature data\"},\"feature-state\":{\"group\":\"Feature data\"},\"geometry-type\":{\"group\":\"Feature data\"},\"id\":{\"group\":\"Feature data\"},\"zoom\":{\"group\":\"Camera\"},\"pitch\":{\"group\":\"Camera\"},\"distance-from-center\":{\"group\":\"Camera\"},\"heatmap-density\":{\"group\":\"Heatmap\"},\"line-progress\":{\"group\":\"Feature data\"},\"sky-radial-progress\":{\"group\":\"sky\"},\"accumulated\":{\"group\":\"Feature data\"},\"+\":{\"group\":\"Math\"},\"*\":{\"group\":\"Math\"},\"-\":{\"group\":\"Math\"},\"/\":{\"group\":\"Math\"},\"%\":{\"group\":\"Math\"},\"^\":{\"group\":\"Math\"},\"sqrt\":{\"group\":\"Math\"},\"log10\":{\"group\":\"Math\"},\"ln\":{\"group\":\"Math\"},\"log2\":{\"group\":\"Math\"},\"sin\":{\"group\":\"Math\"},\"cos\":{\"group\":\"Math\"},\"tan\":{\"group\":\"Math\"},\"asin\":{\"group\":\"Math\"},\"acos\":{\"group\":\"Math\"},\"atan\":{\"group\":\"Math\"},\"min\":{\"group\":\"Math\"},\"max\":{\"group\":\"Math\"},\"round\":{\"group\":\"Math\"},\"abs\":{\"group\":\"Math\"},\"ceil\":{\"group\":\"Math\"},\"floor\":{\"group\":\"Math\"},\"distance\":{\"group\":\"Math\"},\"==\":{\"group\":\"Decision\"},\"!=\":{\"group\":\"Decision\"},\">\":{\"group\":\"Decision\"},\"<\":{\"group\":\"Decision\"},\">=\":{\"group\":\"Decision\"},\"<=\":{\"group\":\"Decision\"},\"all\":{\"group\":\"Decision\"},\"any\":{\"group\":\"Decision\"},\"!\":{\"group\":\"Decision\"},\"within\":{\"group\":\"Decision\"},\"is-supported-script\":{\"group\":\"String\"},\"upcase\":{\"group\":\"String\"},\"downcase\":{\"group\":\"String\"},\"concat\":{\"group\":\"String\"},\"resolved-locale\":{\"group\":\"String\"}}},\"fog\":{\"range\":{\"type\":\"array\",\"default\":[0.5,10],\"minimum\":-20,\"maximum\":20,\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"high-color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#245cdf\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"space-color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],4,\"#010b19\",7,\"#367ab9\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"horizon-blend\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],4,0.2,7,0.1],\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"star-intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":[\"interpolate\",[\"linear\"],[\"zoom\"],5,0.35,6,0],\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"light\":{\"anchor\":{\"type\":\"enum\",\"default\":\"viewport\",\"values\":{\"map\":{},\"viewport\":{}},\"property-type\":\"data-constant\",\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]}},\"position\":{\"type\":\"array\",\"default\":[1.15,210,30],\"length\":3,\"value\":\"number\",\"property-type\":\"data-constant\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]}},\"color\":{\"type\":\"color\",\"property-type\":\"data-constant\",\"default\":\"#ffffff\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"intensity\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true}},\"projection\":{\"name\":{\"type\":\"enum\",\"values\":{\"albers\":{},\"equalEarth\":{},\"equirectangular\":{},\"lambertConformalConic\":{},\"mercator\":{},\"naturalEarth\":{},\"winkelTripel\":{},\"globe\":{}},\"default\":\"mercator\",\"required\":true},\"center\":{\"type\":\"array\",\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"minimum\":[-180,-90],\"maximum\":[180,90],\"transition\":false,\"requires\":[{\"name\":[\"albers\",\"lambertConformalConic\"]}]},\"parallels\":{\"type\":\"array\",\"length\":2,\"value\":\"number\",\"property-type\":\"data-constant\",\"minimum\":[-90,-90],\"maximum\":[90,90],\"transition\":false,\"requires\":[{\"name\":[\"albers\",\"lambertConformalConic\"]}]}},\"terrain\":{\"source\":{\"type\":\"string\",\"required\":true},\"exaggeration\":{\"type\":\"number\",\"property-type\":\"data-constant\",\"default\":1,\"minimum\":0,\"maximum\":1000,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true,\"requires\":[\"source\"]}},\"paint\":[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_background\",\"paint_sky\"],\"paint_fill\":{\"fill-antialias\":{\"type\":\"boolean\",\"default\":true,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"requires\":[{\"!\":\"fill-pattern\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{\"type\":\"color\",\"transition\":true,\"requires\":[{\"!\":\"fill-pattern\"},{\"fill-antialias\":true}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"fill-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{\"type\":\"resolvedImage\",\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"requires\":[{\"!\":\"fill-extrusion-pattern\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"fill-extrusion-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{\"type\":\"resolvedImage\",\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-height\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"units\":\"meters\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"units\":\"meters\",\"transition\":true,\"requires\":[\"fill-extrusion-height\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{\"type\":\"boolean\",\"default\":true,\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-ambient-occlusion-intensity\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"private\":true,\"default\":0,\"minimum\":0,\"maximum\":1,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true},\"fill-extrusion-ambient-occlusion-radius\":{\"property-type\":\"data-constant\",\"type\":\"number\",\"private\":true,\"default\":3,\"minimum\":0,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"transition\":true,\"requires\":[\"fill-extrusion-edge-radius\"]}},\"paint_line\":{\"line-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"requires\":[{\"!\":\"line-pattern\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"line-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{\"type\":\"number\",\"default\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{\"type\":\"array\",\"value\":\"number\",\"minimum\":0,\"transition\":false,\"units\":\"line widths\",\"requires\":[{\"!\":\"line-pattern\"}],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-pattern\":{\"type\":\"resolvedImage\",\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-gradient\":{\"type\":\"color\",\"transition\":false,\"requires\":[{\"!\":\"line-pattern\"},{\"source\":\"geojson\",\"has\":{\"lineMetrics\":true}}],\"expression\":{\"interpolated\":true,\"parameters\":[\"line-progress\"]},\"property-type\":\"color-ramp\"},\"line-trim-offset\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"minimum\":[0,0],\"maximum\":[1,1],\"transition\":false,\"requires\":[{\"source\":\"geojson\",\"has\":{\"lineMetrics\":true}}],\"property-type\":\"constant\"}},\"paint_circle\":{\"circle-radius\":{\"type\":\"number\",\"default\":5,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{\"type\":\"number\",\"default\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"circle-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"viewport\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},\"paint_heatmap\":{\"heatmap-radius\":{\"type\":\"number\",\"default\":30,\"minimum\":1,\"transition\":true,\"units\":\"pixels\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":false,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{\"type\":\"color\",\"default\":[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",0.1,\"royalblue\",0.3,\"cyan\",0.5,\"lime\",0.7,\"yellow\",1,\"red\"],\"transition\":false,\"expression\":{\"interpolated\":true,\"parameters\":[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_symbol\":{\"icon-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{\"type\":\"color\",\"default\":\"rgba(0, 0, 0, 0)\",\"transition\":true,\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"requires\":[\"icon-image\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"icon-image\",\"icon-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"overridable\":true,\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{\"type\":\"color\",\"default\":\"rgba(0, 0, 0, 0)\",\"transition\":true,\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"transition\":true,\"units\":\"pixels\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"default\":[0,0],\"transition\":true,\"units\":\"pixels\",\"requires\":[\"text-field\"],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"map\",\"requires\":[\"text-field\",\"text-translate\"],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_raster\":{\"raster-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{\"type\":\"number\",\"default\":0,\"period\":360,\"transition\":true,\"units\":\"degrees\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{\"type\":\"number\",\"default\":0,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{\"type\":\"number\",\"default\":0,\"minimum\":-1,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{\"type\":\"enum\",\"values\":{\"linear\":{},\"nearest\":{}},\"default\":\"linear\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{\"type\":\"number\",\"default\":300,\"minimum\":0,\"transition\":false,\"units\":\"milliseconds\",\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_hillshade\":{\"hillshade-illumination-direction\":{\"type\":\"number\",\"default\":335,\"minimum\":0,\"maximum\":359,\"transition\":false,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{\"type\":\"enum\",\"values\":{\"map\":{},\"viewport\":{}},\"default\":\"viewport\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{\"type\":\"number\",\"default\":0.5,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{\"type\":\"color\",\"default\":\"#FFFFFF\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_background\":{\"background-color\":{\"type\":\"color\",\"default\":\"#000000\",\"transition\":true,\"requires\":[{\"!\":\"background-pattern\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{\"type\":\"resolvedImage\",\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_sky\":{\"sky-type\":{\"type\":\"enum\",\"values\":{\"gradient\":{},\"atmosphere\":{}},\"default\":\"atmosphere\",\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-atmosphere-sun\":{\"type\":\"array\",\"value\":\"number\",\"length\":2,\"units\":\"degrees\",\"minimum\":[0,0],\"maximum\":[360,180],\"transition\":false,\"requires\":[{\"sky-type\":\"atmosphere\"}],\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-atmosphere-sun-intensity\":{\"type\":\"number\",\"requires\":[{\"sky-type\":\"atmosphere\"}],\"default\":10,\"minimum\":0,\"maximum\":100,\"transition\":false,\"property-type\":\"data-constant\"},\"sky-gradient-center\":{\"type\":\"array\",\"requires\":[{\"sky-type\":\"gradient\"}],\"value\":\"number\",\"default\":[0,0],\"length\":2,\"units\":\"degrees\",\"minimum\":[0,0],\"maximum\":[360,180],\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-gradient-radius\":{\"type\":\"number\",\"requires\":[{\"sky-type\":\"gradient\"}],\"default\":90,\"minimum\":0,\"maximum\":180,\"transition\":false,\"expression\":{\"interpolated\":false,\"parameters\":[\"zoom\"]},\"property-type\":\"data-constant\"},\"sky-gradient\":{\"type\":\"color\",\"default\":[\"interpolate\",[\"linear\"],[\"sky-radial-progress\"],0.8,\"#87ceeb\",1,\"white\"],\"transition\":false,\"requires\":[{\"sky-type\":\"gradient\"}],\"expression\":{\"interpolated\":true,\"parameters\":[\"sky-radial-progress\"]},\"property-type\":\"color-ramp\"},\"sky-atmosphere-halo-color\":{\"type\":\"color\",\"default\":\"white\",\"transition\":false,\"requires\":[{\"sky-type\":\"atmosphere\"}],\"property-type\":\"data-constant\"},\"sky-atmosphere-color\":{\"type\":\"color\",\"default\":\"white\",\"transition\":false,\"requires\":[{\"sky-type\":\"atmosphere\"}],\"property-type\":\"data-constant\"},\"sky-opacity\":{\"type\":\"number\",\"default\":1,\"minimum\":0,\"maximum\":1,\"transition\":true,\"expression\":{\"interpolated\":true,\"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\"},\"color-ramp\":{\"type\":\"property-type\"},\"data-constant\":{\"type\":\"property-type\"},\"constant\":{\"type\":\"property-type\"}},\"promoteId\":{\"*\":{\"type\":\"string\"}}};\n\n// \nfunction isExpressionFilter(filter) {\n if (filter === true || filter === false) {\n return true;\n }\n if (!Array.isArray(filter) || filter.length === 0) {\n return false;\n }\n switch (filter[0]) {\n case 'has':\n return filter.length >= 2 && filter[1] !== '$id' && filter[1] !== '$type';\n case 'in':\n return filter.length >= 3 && (typeof filter[1] !== 'string' || Array.isArray(filter[2]));\n case '!in':\n case '!has':\n case 'none':\n return false;\n case '==':\n case '!=':\n case '>':\n case '>=':\n case '<':\n case '<=':\n return filter.length !== 3 || (Array.isArray(filter[1]) || Array.isArray(filter[2]));\n case 'any':\n case 'all':\n for (const f of filter.slice(1)) {\n if (!isExpressionFilter(f) && typeof f !== 'boolean') {\n return false;\n }\n }\n return true;\n default:\n return true;\n }\n}\n/**\n * Given a filter expressed as nested arrays, return a new function\n * that evaluates whether a given feature (with a .properties or .tags property)\n * passes its test.\n *\n * @private\n * @param {Array} filter mapbox gl filter\n * @param {string} layerType the type of the layer this filter will be applied to.\n * @returns {Function} filter-evaluating function\n */\nfunction createFilter(filter, layerType = 'fill') {\n if (filter === null || filter === undefined) {\n return {\n filter: () => true,\n needGeometry: false,\n needFeature: false\n };\n }\n if (!isExpressionFilter(filter)) {\n filter = convertFilter(filter);\n }\n const filterExp = filter;\n let staticFilter = true;\n try {\n staticFilter = extractStaticFilter(filterExp);\n } catch (e) {\n console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${ JSON.stringify(filterExp, null, 2) }\n `);\n }\n // Compile the static component of the filter\n const filterSpec = spec[`filter_${ layerType }`];\n const compiledStaticFilter = createExpression(staticFilter, filterSpec);\n let filterFunc = null;\n if (compiledStaticFilter.result === 'error') {\n throw new Error(compiledStaticFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));\n } else {\n filterFunc = (globalProperties, feature, canonical) => compiledStaticFilter.value.evaluate(globalProperties, feature, {}, canonical);\n }\n // If the static component is not equal to the entire filter then we have a dynamic component\n // Compile the dynamic component separately\n let dynamicFilterFunc = null;\n let needFeature = null;\n if (staticFilter !== filterExp) {\n const compiledDynamicFilter = createExpression(filterExp, filterSpec);\n if (compiledDynamicFilter.result === 'error') {\n throw new Error(compiledDynamicFilter.value.map(err => `${ err.key }: ${ err.message }`).join(', '));\n } else {\n dynamicFilterFunc = (globalProperties, feature, canonical, featureTileCoord, featureDistanceData) => compiledDynamicFilter.value.evaluate(globalProperties, feature, {}, canonical, undefined, undefined, featureTileCoord, featureDistanceData);\n needFeature = !isFeatureConstant(compiledDynamicFilter.value.expression);\n }\n }\n filterFunc = filterFunc;\n const needGeometry = geometryNeeded(staticFilter);\n return {\n filter: filterFunc,\n dynamicFilter: dynamicFilterFunc ? dynamicFilterFunc : undefined,\n needGeometry,\n needFeature: !!needFeature\n };\n}\nfunction extractStaticFilter(filter) {\n if (!isDynamicFilter(filter)) {\n return filter;\n }\n // Shallow copy so we can replace expressions in-place\n let result = deepUnbundle(filter);\n // 1. Union branches\n unionDynamicBranches(result);\n // 2. Collapse dynamic conditions to `true`\n result = collapseDynamicBooleanExpressions(result);\n return result;\n}\nfunction collapseDynamicBooleanExpressions(expression) {\n if (!Array.isArray(expression)) {\n return expression;\n }\n const collapsed = collapsedExpression(expression);\n if (collapsed === true) {\n return collapsed;\n } else {\n return collapsed.map(subExpression => collapseDynamicBooleanExpressions(subExpression));\n }\n}\n/**\n * Traverses the expression and replaces all instances of branching on a\n * `dynamic` conditional (such as `['pitch']` or `['distance-from-center']`)\n * into an `any` expression.\n * This ensures that all possible outcomes of a `dynamic` branch are considered\n * when evaluating the expression upfront during filtering.\n *\n * @param {Array} filter the filter expression mutated in-place.\n */\nfunction unionDynamicBranches(filter) {\n let isBranchingDynamically = false;\n const branches = [];\n if (filter[0] === 'case') {\n for (let i = 1; i < filter.length - 1; i += 2) {\n isBranchingDynamically = isBranchingDynamically || isDynamicFilter(filter[i]);\n branches.push(filter[i + 1]);\n }\n branches.push(filter[filter.length - 1]);\n } else if (filter[0] === 'match') {\n isBranchingDynamically = isBranchingDynamically || isDynamicFilter(filter[1]);\n for (let i = 2; i < filter.length - 1; i += 2) {\n branches.push(filter[i + 1]);\n }\n branches.push(filter[filter.length - 1]);\n } else if (filter[0] === 'step') {\n isBranchingDynamically = isBranchingDynamically || isDynamicFilter(filter[1]);\n for (let i = 1; i < filter.length - 1; i += 2) {\n branches.push(filter[i + 1]);\n }\n }\n if (isBranchingDynamically) {\n filter.length = 0;\n filter.push('any', ...branches);\n }\n // traverse and recurse into children\n for (let i = 1; i < filter.length; i++) {\n unionDynamicBranches(filter[i]);\n }\n}\nfunction isDynamicFilter(filter) {\n // Base Cases\n if (!Array.isArray(filter)) {\n return false;\n }\n if (isRootExpressionDynamic(filter[0])) {\n return true;\n }\n for (let i = 1; i < filter.length; i++) {\n const child = filter[i];\n if (isDynamicFilter(child)) {\n return true;\n }\n }\n return false;\n}\nfunction isRootExpressionDynamic(expression) {\n return expression === 'pitch' || expression === 'distance-from-center';\n}\nconst dynamicConditionExpressions = new Set([\n 'in',\n '==',\n '!=',\n '>',\n '>=',\n '<',\n '<=',\n 'to-boolean'\n]);\nfunction collapsedExpression(expression) {\n if (dynamicConditionExpressions.has(expression[0])) {\n for (let i = 1; i < expression.length; i++) {\n const param = expression[i];\n if (isDynamicFilter(param)) {\n return true;\n }\n }\n }\n return expression;\n}\n// Comparison function to sort numbers and strings\nfunction compare(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n}\nfunction geometryNeeded(filter) {\n if (!Array.isArray(filter))\n return false;\n if (filter[0] === 'within')\n return true;\n for (let index = 1; index < filter.length; index++) {\n if (geometryNeeded(filter[index]))\n return true;\n }\n return false;\n}\nfunction convertFilter(filter) {\n if (!filter)\n return true;\n const op = filter[0];\n if (filter.length <= 1)\n return op !== 'any';\n const converted = op === '==' ? convertComparisonOp(filter[1], filter[2], '==') : op === '!=' ? convertNegation(convertComparisonOp(filter[1], filter[2], '==')) : op === '<' || op === '>' || op === '<=' || op === '>=' ? convertComparisonOp(filter[1], filter[2], op) : op === 'any' ? convertDisjunctionOp(filter.slice(1)) : op === 'all' ? ['all'].concat(filter.slice(1).map(convertFilter)) : op === 'none' ? ['all'].concat(filter.slice(1).map(convertFilter).map(convertNegation)) : op === 'in' ? convertInOp(filter[1], filter.slice(2)) : op === '!in' ? convertNegation(convertInOp(filter[1], filter.slice(2))) : op === 'has' ? convertHasOp(filter[1]) : op === '!has' ? convertNegation(convertHasOp(filter[1])) : op === 'within' ? filter : true;\n return converted;\n}\nfunction convertComparisonOp(property, value, op) {\n switch (property) {\n case '$type':\n return [\n `filter-type-${ op }`,\n value\n ];\n case '$id':\n return [\n `filter-id-${ op }`,\n value\n ];\n default:\n return [\n `filter-${ op }`,\n property,\n value\n ];\n }\n}\nfunction convertDisjunctionOp(filters) {\n return ['any'].concat(filters.map(convertFilter));\n}\nfunction convertInOp(property, values) {\n if (values.length === 0) {\n return false;\n }\n switch (property) {\n case '$type':\n return [\n `filter-type-in`,\n [\n 'literal',\n values\n ]\n ];\n case '$id':\n return [\n `filter-id-in`,\n [\n 'literal',\n values\n ]\n ];\n default:\n if (values.length > 200 && !values.some(v => typeof v !== typeof values[0])) {\n return [\n 'filter-in-large',\n property,\n [\n 'literal',\n values.sort(compare)\n ]\n ];\n } else {\n return [\n 'filter-in-small',\n property,\n [\n 'literal',\n values\n ]\n ];\n }\n }\n}\nfunction convertHasOp(property) {\n switch (property) {\n case '$type':\n return true;\n case '$id':\n return [`filter-has-id`];\n default:\n return [\n `filter-has`,\n property\n ];\n }\n}\nfunction convertNegation(filter) {\n return [\n '!',\n filter\n ];\n}\n\n// \nvar refProperties = [\n 'type',\n 'source',\n 'source-layer',\n 'minzoom',\n 'maxzoom',\n 'filter',\n 'layout'\n];\n\n// \nfunction deref(layer, parent) {\n const result = {};\n for (const k in layer) {\n if (k !== 'ref') {\n result[k] = layer[k];\n }\n }\n refProperties.forEach(k => {\n if (k in parent) {\n result[k] = parent[k];\n }\n });\n return result;\n}\n/**\n * Given an array of layers, some of which may contain `ref` properties\n * whose value is the `id` of another property, return a new array where\n * such layers have been augmented with the 'type', 'source', etc. properties\n * from the parent layer, and the `ref` property has been removed.\n *\n * The input is not modified. The output may contain references to portions\n * of the input.\n *\n * @private\n * @param {Array} layers\n * @returns {Array}\n */\nfunction derefLayers(layers) {\n layers = layers.slice();\n const map = Object.create(null);\n for (let i = 0; i < layers.length; i++) {\n map[layers[i].id] = layers[i];\n }\n for (let i = 0; i < layers.length; i++) {\n if ('ref' in layers[i]) {\n layers[i] = deref(layers[i], map[layers[i].ref]);\n }\n }\n return layers;\n}\n\nvar fontWeights = {\n thin: 100,\n hairline: 100,\n 'ultra-light': 100,\n 'extra-light': 100,\n light: 200,\n book: 300,\n regular: 400,\n normal: 400,\n plain: 400,\n roman: 400,\n standard: 400,\n medium: 500,\n 'semi-bold': 600,\n 'demi-bold': 600,\n bold: 700,\n heavy: 800,\n black: 800,\n 'extra-bold': 800,\n 'ultra-black': 900,\n 'extra-black': 900,\n 'ultra-bold': 900,\n 'heavy-black': 900,\n fat: 900,\n poster: 900\n};\nvar sp = ' ';\nvar italicRE = /(italic|oblique)$/i;\nvar fontCache = {};\nvar mapboxToCssFont = function (fonts, size, lineHeight) {\n var cssData = fontCache[fonts];\n if (!cssData) {\n if (!Array.isArray(fonts)) {\n fonts = [fonts];\n }\n var weight = 400;\n var style = 'normal';\n var fontFamilies = [];\n var haveWeight, haveStyle;\n for (var i = 0, ii = fonts.length; i < ii; ++i) {\n var font = fonts[i];\n var parts = font.split(' ');\n var maybeWeight = parts[parts.length - 1].toLowerCase();\n if (maybeWeight == 'normal' || maybeWeight == 'italic' || maybeWeight == 'oblique') {\n style = haveStyle ? style : maybeWeight;\n parts.pop();\n maybeWeight = parts[parts.length - 1].toLowerCase();\n } else if (italicRE.test(maybeWeight)) {\n maybeWeight = maybeWeight.replace(italicRE, '');\n style = haveStyle ? style : parts[parts.length - 1].replace(maybeWeight, '');\n }\n for (var w in fontWeights) {\n var previousPart = parts.length > 1 ? parts[parts.length - 2].toLowerCase() : '';\n if (maybeWeight == w || maybeWeight == w.replace('-', '') || previousPart + '-' + maybeWeight == w) {\n weight = haveWeight ? weight : fontWeights[w];\n parts.pop();\n if (previousPart && w.startsWith(previousPart)) {\n parts.pop();\n }\n break;\n }\n }\n if (!haveWeight && typeof maybeWeight == 'number') {\n weight = maybeWeight;\n }\n var fontFamily = parts.join(sp).replace('Klokantech Noto Sans', 'Noto Sans');\n if (fontFamily.indexOf(sp) !== -1) {\n fontFamily = '\"' + fontFamily + '\"';\n }\n fontFamilies.push(fontFamily);\n }\n // CSS font property: font-style font-weight font-size/line-height font-family\n cssData = fontCache[fonts] = [\n style,\n weight,\n fontFamilies\n ];\n }\n return cssData[0] + sp + cssData[1] + sp + size + 'px' + (lineHeight ? '/' + lineHeight : '') + sp + cssData[2];\n};\n\nvar mb2css = /*@__PURE__*/getDefaultExportFromCjs(mapboxToCssFont);\n\nconst mapboxBaseUrl = 'https://api.mapbox.com';\n/**\n * Gets the path from a mapbox:// URL.\n * @param {string} url The Mapbox URL.\n * @return {string} The path.\n * @private\n */\nfunction getMapboxPath(url) {\n const startsWith = 'mapbox://';\n if (url.indexOf(startsWith) !== 0) {\n return '';\n }\n return url.slice(startsWith.length);\n}\n/**\n * Turns mapbox:// sprite URLs into resolvable URLs.\n * @param {string} url The sprite URL.\n * @param {string} token The access token.\n * @param {string} styleUrl The style URL.\n * @return {string} A resolvable URL.\n * @private\n */\nfunction normalizeSpriteUrl(url, token, styleUrl) {\n const mapboxPath = getMapboxPath(url);\n if (!mapboxPath) {\n return decodeURI(new URL(url, styleUrl).href);\n }\n const startsWith = 'sprites/';\n if (mapboxPath.indexOf(startsWith) !== 0) {\n throw new Error(`unexpected sprites url: ${ url }`);\n }\n const sprite = mapboxPath.slice(startsWith.length);\n return `${ mapboxBaseUrl }/styles/v1/${ sprite }/sprite?access_token=${ token }`;\n}\n/**\n * Turns mapbox:// style URLs into resolvable URLs.\n * @param {string} url The style URL.\n * @param {string} token The access token.\n * @return {string} A resolvable URL.\n * @private\n */\nfunction normalizeStyleUrl(url, token) {\n const mapboxPath = getMapboxPath(url);\n if (!mapboxPath) {\n return decodeURI(new URL(url, location.href).href);\n }\n const startsWith = 'styles/';\n if (mapboxPath.indexOf(startsWith) !== 0) {\n throw new Error(`unexpected style url: ${ url }`);\n }\n const style = mapboxPath.slice(startsWith.length);\n return `${ mapboxBaseUrl }/styles/v1/${ style }?&access_token=${ token }`;\n}\n/**\n * Turns mapbox:// source URLs into vector tile URL templates.\n * @param {string} url The source URL.\n * @param {string} token The access token.\n * @param {string} tokenParam The access token key.\n * @param {string} styleUrl The style URL.\n * @return {string} A vector tile template.\n * @private\n */\nfunction normalizeSourceUrl(url, token, tokenParam, styleUrl) {\n const urlObject = new URL(url, styleUrl);\n const mapboxPath = getMapboxPath(url);\n if (!mapboxPath) {\n if (!token) {\n return decodeURI(urlObject.href);\n }\n if (!urlObject.searchParams.has(tokenParam)) {\n urlObject.searchParams.set(tokenParam, token);\n }\n return decodeURI(urlObject.href);\n }\n if (mapboxPath === 'mapbox.satellite') {\n const sizeFactor = window.devicePixelRatio >= 1.5 ? '@2x' : '';\n return `https://api.mapbox.com/v4/${ mapboxPath }/{z}/{x}/{y}${ sizeFactor }.webp?access_token=${ token }`;\n }\n return `https://{a-d}.tiles.mapbox.com/v4/${ mapboxPath }/{z}/{x}/{y}.vector.pbf?access_token=${ token }`;\n}\n\n/** @typedef {'Style'|'Source'|'Sprite'|'SpriteImage'|'Tiles'|'GeoJSON'} ResourceType */\n/** @typedef {import(\"ol\").Map} Map */\n/** @typedef {import(\"ol/layer\").Layer} Layer */\n/** @typedef {import(\"ol/layer\").Group} LayerGroup */\n/** @typedef {import(\"ol/layer\").Vector} VectorLayer */\n/** @typedef {import(\"ol/layer\").VectorTile} VectorTileLayer */\n/** @typedef {import(\"ol/source\").Source} Source */\nconst functionCacheByStyleId = {};\nconst filterCacheByStyleId = {};\nlet styleId = 0;\nfunction getStyleId(glStyle) {\n if (!glStyle.id) {\n glStyle.id = styleId++;\n }\n return glStyle.id;\n}\nfunction getStyleFunctionKey(glStyle, olLayer) {\n return getStyleId(glStyle) + '.' + getUid(olLayer);\n}\n/**\n * @param {Object} glStyle Mapboox style object.\n * @return {Object} Function cache.\n */\nfunction getFunctionCache(glStyle) {\n let functionCache = functionCacheByStyleId[glStyle.id];\n if (!functionCache) {\n functionCache = {};\n functionCacheByStyleId[getStyleId(glStyle)] = functionCache;\n }\n return functionCache;\n}\nfunction clearFunctionCache() {\n for (const key in functionCacheByStyleId) {\n delete functionCacheByStyleId[key];\n }\n}\n/**\n * @param {Object} glStyle Mapboox style object.\n * @return {Object} Filter cache.\n */\nfunction getFilterCache(glStyle) {\n let filterCache = filterCacheByStyleId[glStyle.id];\n if (!filterCache) {\n filterCache = {};\n filterCacheByStyleId[getStyleId(glStyle)] = filterCache;\n }\n return filterCache;\n}\nfunction deg2rad(degrees) {\n return degrees * Math.PI / 180;\n}\nconst defaultResolutions = (function () {\n const resolutions = [];\n for (let res = 78271.51696402048; resolutions.length <= 24; res /= 2) {\n resolutions.push(res);\n }\n return resolutions;\n}());\n/**\n * @param {number} width Width of the canvas.\n * @param {number} height Height of the canvas.\n * @return {HTMLCanvasElement} Canvas.\n */\nfunction createCanvas(width, height) {\n if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && typeof OffscreenCanvas !== 'undefined') {\n // eslint-disable-line\n return new OffscreenCanvas(width, height);\n }\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n return canvas;\n}\nfunction getZoomForResolution(resolution, resolutions) {\n let i = 0;\n const ii = resolutions.length;\n for (; i < ii; ++i) {\n const candidate = resolutions[i];\n if (candidate < resolution && i + 1 < ii) {\n const zoomFactor = resolutions[i] / resolutions[i + 1];\n return i + Math.log(resolutions[i] / resolution) / Math.log(zoomFactor);\n }\n }\n return ii - 1;\n}\nconst pendingRequests = {};\n/**\n * @param {ResourceType} resourceType Type of resource to load.\n * @param {string} url Url of the resource.\n * @param {Options} [options={}] Options.\n * @param {{request?: Request}} [metadata] Object to be filled with the request.\n * @return {Promise} Promise that resolves with the loaded resource\n * or rejects with the Response object.\n * @private\n */\nfunction fetchResource(resourceType, url, options = {}, metadata) {\n if (url in pendingRequests) {\n if (metadata) {\n metadata.request = pendingRequests[url][0];\n }\n return pendingRequests[url][1];\n }\n const transformedRequest = options.transformRequest ? options.transformRequest(url, resourceType) || url : url;\n const pendingRequest = toPromise(() => transformedRequest).then(transformedRequest => {\n if (!(transformedRequest instanceof Request)) {\n transformedRequest = new Request(transformedRequest);\n }\n if (!transformedRequest.headers.get('Accept')) {\n transformedRequest.headers.set('Accept', 'application/json');\n }\n if (metadata) {\n metadata.request = transformedRequest;\n }\n return fetch(transformedRequest).then(function (response) {\n delete pendingRequests[url];\n return response.ok ? response.json() : Promise.reject(new Error('Error fetching source ' + url));\n }).catch(function (error) {\n delete pendingRequests[url];\n return Promise.reject(new Error('Error fetching source ' + url));\n });\n });\n pendingRequests[url] = [\n transformedRequest,\n pendingRequest\n ];\n return pendingRequest;\n}\nfunction getGlStyle(glStyleOrUrl, options) {\n if (typeof glStyleOrUrl === 'string') {\n if (glStyleOrUrl.trim().startsWith('{')) {\n try {\n const glStyle = JSON.parse(glStyleOrUrl);\n return Promise.resolve(glStyle);\n } catch (error) {\n return Promise.reject(error);\n }\n } else {\n glStyleOrUrl = normalizeStyleUrl(glStyleOrUrl, options.accessToken);\n return fetchResource('Style', glStyleOrUrl, options);\n }\n } else {\n return Promise.resolve(glStyleOrUrl);\n }\n}\nconst tilejsonCache = {};\n/**\n * @param {Object} glSource glStyle source object.\n * @param {string} styleUrl Style URL.\n * @param {Options} options Options.\n * @return {Promise<{tileJson: Object, tileLoadFunction: import('ol/Tile.js').LoadFunction}?>} TileJson and load function\n */\nfunction getTileJson(glSource, styleUrl, options = {}) {\n const cacheKey = [\n styleUrl,\n JSON.stringify(glSource)\n ].toString();\n let promise = tilejsonCache[cacheKey];\n if (!promise || options.transformRequest) {\n let tileLoadFunction;\n if (options.transformRequest) {\n tileLoadFunction = (tile, src) => {\n const transformedRequest = options.transformRequest ? options.transformRequest(src, 'Tiles') || src : src;\n if (tile instanceof VectorTile) {\n tile.setLoader((extent, resolution, projection) => {\n toPromise(() => transformedRequest).then(transformedRequest => {\n fetch(transformedRequest).then(response => response.arrayBuffer()).then(data => {\n const format = tile.getFormat();\n const features = format.readFeatures(data, {\n extent: extent,\n featureProjection: projection\n });\n // @ts-ignore\n tile.setFeatures(features);\n }).catch(e => tile.setState(TileState.ERROR));\n });\n });\n } else {\n const img = tile.getImage();\n toPromise(() => transformedRequest).then(transformedRequest => {\n if (transformedRequest instanceof Request) {\n fetch(transformedRequest).then(response => response.blob()).then(blob => {\n const url = URL.createObjectURL(blob);\n img.addEventListener('load', () => URL.revokeObjectURL(url));\n img.addEventListener('error', () => URL.revokeObjectURL(url));\n img.src = url;\n }).catch(e => tile.setState(TileState.ERROR));\n } else {\n img.src = transformedRequest;\n }\n });\n }\n };\n }\n const url = glSource.url;\n if (url && !glSource.tiles) {\n const normalizedSourceUrl = normalizeSourceUrl(url, options.accessToken, options.accessTokenParam || 'access_token', styleUrl || location.href);\n if (url.startsWith('mapbox://')) {\n promise = Promise.resolve({\n tileJson: Object.assign({}, glSource, {\n url: undefined,\n tiles: expandUrl(normalizedSourceUrl)\n }),\n tileLoadFunction\n });\n } else {\n const metadata = {};\n promise = fetchResource('Source', normalizedSourceUrl, options, metadata).then(function (tileJson) {\n tileJson.tiles = tileJson.tiles.map(function (tileUrl) {\n if (tileJson.scheme === 'tms') {\n tileUrl = tileUrl.replace('{y}', '{-y}');\n }\n return normalizeSourceUrl(tileUrl, options.accessToken, options.accessTokenParam || 'access_token', metadata.request.url);\n });\n return Promise.resolve({\n tileJson,\n tileLoadFunction\n });\n });\n }\n } else {\n glSource = Object.assign({}, glSource, {\n tiles: glSource.tiles.map(function (tileUrl) {\n if (glSource.scheme === 'tms') {\n tileUrl = tileUrl.replace('{y}', '{-y}');\n }\n return normalizeSourceUrl(tileUrl, options.accessToken, options.accessTokenParam || 'access_token', styleUrl || location.href);\n })\n });\n promise = Promise.resolve({\n tileJson: Object.assign({}, glSource),\n tileLoadFunction\n });\n }\n tilejsonCache[cacheKey] = promise;\n }\n return promise;\n}\n/**\n * @param {HTMLImageElement|HTMLCanvasElement} spriteImage Sprite image id.\n * @param {{x: number, y: number, width: number, height: number, pixelRatio: number}} spriteImageData Sprite image data.\n * @param {number} haloWidth Halo width.\n * @param {{r: number, g: number, b: number, a: number}} haloColor Halo color.\n * @return {HTMLCanvasElement} Canvas element with the halo.\n */\nfunction drawIconHalo(spriteImage, spriteImageData, haloWidth, haloColor) {\n const imageCanvas = document.createElement('canvas');\n const imgSize = [\n 2 * haloWidth * spriteImageData.pixelRatio + spriteImageData.width,\n 2 * haloWidth * spriteImageData.pixelRatio + spriteImageData.height\n ];\n imageCanvas.width = imgSize[0];\n imageCanvas.height = imgSize[1];\n const imageContext = imageCanvas.getContext('2d');\n imageContext.drawImage(spriteImage, spriteImageData.x, spriteImageData.y, spriteImageData.width, spriteImageData.height, haloWidth * spriteImageData.pixelRatio, haloWidth * spriteImageData.pixelRatio, spriteImageData.width, spriteImageData.height);\n const imageData = imageContext.getImageData(0, 0, imgSize[0], imgSize[1]);\n imageContext.globalCompositeOperation = 'destination-over';\n imageContext.fillStyle = `rgba(${ haloColor.r * 255 },${ haloColor.g * 255 },${ haloColor.b * 255 },${ haloColor.a })`;\n const data = imageData.data;\n for (let i = 0, ii = imageData.width; i < ii; ++i) {\n for (let j = 0, jj = imageData.height; j < jj; ++j) {\n const index = (j * ii + i) * 4;\n const alpha = data[index + 3];\n if (alpha > 0) {\n imageContext.arc(i, j, haloWidth * spriteImageData.pixelRatio, 0, 2 * Math.PI);\n }\n }\n }\n imageContext.fill();\n return imageCanvas;\n}\nfunction smoothstep(min, max, value) {\n const x = Math.max(0, Math.min(1, (value - min) / (max - min)));\n return x * x * (3 - 2 * x);\n}\n/**\n * @param {HTMLImageElement} image SDF image\n * @param {{x: number, y: number, width: number, height: number}} area Area to unSDF\n * @param {{r: number, g: number, b: number, a: number}} color Color to use\n * @return {HTMLCanvasElement} Regular image\n */\nfunction drawSDF(image, area, color) {\n const imageCanvas = document.createElement('canvas');\n imageCanvas.width = area.width;\n imageCanvas.height = area.height;\n const imageContext = imageCanvas.getContext('2d');\n imageContext.drawImage(image, area.x, area.y, area.width, area.height, 0, 0, area.width, area.height);\n const imageData = imageContext.getImageData(0, 0, area.width, area.height);\n const data = imageData.data;\n for (let i = 0, ii = imageData.width; i < ii; ++i) {\n for (let j = 0, jj = imageData.height; j < jj; ++j) {\n const index = (j * ii + i) * 4;\n const dist = data[index + 3] / 255;\n const buffer = 0.75;\n const gamma = 0.1;\n const alpha = smoothstep(buffer - gamma, buffer + gamma, dist);\n if (alpha > 0) {\n data[index + 0] = Math.round(255 * color.r * alpha);\n data[index + 1] = Math.round(255 * color.g * alpha);\n data[index + 2] = Math.round(255 * color.b * alpha);\n data[index + 3] = Math.round(255 * alpha);\n } else {\n data[index + 3] = 0;\n }\n }\n }\n imageContext.putImageData(imageData, 0, 0);\n return imageCanvas;\n} /**\n * @typedef {import(\"./apply.js\").Options} Options\n * @private\n */\n\nconst hairSpacePool = Array(256).join('\\u200A');\nfunction applyLetterSpacing(text, letterSpacing) {\n if (letterSpacing >= 0.05) {\n let textWithLetterSpacing = '';\n const lines = text.split('\\n');\n const joinSpaceString = hairSpacePool.slice(0, Math.round(letterSpacing / 0.1));\n for (let l = 0, ll = lines.length; l < ll; ++l) {\n if (l > 0) {\n textWithLetterSpacing += '\\n';\n }\n textWithLetterSpacing += lines[l].split('').join(joinSpaceString);\n }\n return textWithLetterSpacing;\n }\n return text;\n}\nlet measureContext;\nfunction getMeasureContext() {\n if (!measureContext) {\n measureContext = createCanvas(1, 1).getContext('2d');\n }\n return measureContext;\n}\nfunction measureText(text, letterSpacing) {\n return getMeasureContext().measureText(text).width + (text.length - 1) * letterSpacing;\n}\nconst measureCache = {};\nfunction wrapText(text, font, em, letterSpacing) {\n if (text.indexOf('\\n') !== -1) {\n const hardLines = text.split('\\n');\n const lines = [];\n for (let i = 0, ii = hardLines.length; i < ii; ++i) {\n lines.push(wrapText(hardLines[i], font, em, letterSpacing));\n }\n return lines.join('\\n');\n }\n const key = em + ',' + font + ',' + text + ',' + letterSpacing;\n let wrappedText = measureCache[key];\n if (!wrappedText) {\n const words = text.split(' ');\n if (words.length > 1) {\n const ctx = getMeasureContext();\n ctx.font = font;\n const oneEm = ctx.measureText('M').width;\n const maxWidth = oneEm * em;\n let line = '';\n const lines = [];\n // Pass 1 - wrap lines to not exceed maxWidth\n for (let i = 0, ii = words.length; i < ii; ++i) {\n const word = words[i];\n const testLine = line + (line ? ' ' : '') + word;\n if (measureText(testLine, letterSpacing) <= maxWidth) {\n line = testLine;\n } else {\n if (line) {\n lines.push(line);\n }\n line = word;\n }\n }\n if (line) {\n lines.push(line);\n }\n // Pass 2 - add lines with a width of less than 30% of maxWidth to the previous or next line\n for (let i = 0, ii = lines.length; i < ii && ii > 1; ++i) {\n const line = lines[i];\n if (measureText(line, letterSpacing) < maxWidth * 0.35) {\n const prevWidth = i > 0 ? measureText(lines[i - 1], letterSpacing) : Infinity;\n const nextWidth = i < ii - 1 ? measureText(lines[i + 1], letterSpacing) : Infinity;\n lines.splice(i, 1);\n ii -= 1;\n if (prevWidth < nextWidth) {\n lines[i - 1] += ' ' + line;\n i -= 1;\n } else {\n lines[i] = line + ' ' + lines[i];\n }\n }\n }\n // Pass 3 - try to fill 80% of maxWidth for each line\n for (let i = 0, ii = lines.length - 1; i < ii; ++i) {\n const line = lines[i];\n const next = lines[i + 1];\n if (measureText(line, letterSpacing) > maxWidth * 0.7 && measureText(next, letterSpacing) < maxWidth * 0.6) {\n const lineWords = line.split(' ');\n const lastWord = lineWords.pop();\n if (measureText(lastWord, letterSpacing) < maxWidth * 0.2) {\n lines[i] = lineWords.join(' ');\n lines[i + 1] = lastWord + ' ' + next;\n }\n ii -= 1;\n }\n }\n wrappedText = lines.join('\\n');\n } else {\n wrappedText = text;\n }\n wrappedText = applyLetterSpacing(wrappedText, letterSpacing);\n measureCache[key] = wrappedText;\n }\n return wrappedText;\n}\nconst fontFamilyRegEx = /font-family: ?([^;]*);/;\nconst stripQuotesRegEx = /(\"|')/g;\nlet loadedFontFamilies;\nfunction hasFontFamily(family) {\n if (!loadedFontFamilies) {\n loadedFontFamilies = {};\n const styleSheets = document.styleSheets;\n for (let i = 0, ii = styleSheets.length; i < ii; ++i) {\n const styleSheet = styleSheets[i];\n try {\n const cssRules = styleSheet.rules || styleSheet.cssRules;\n if (cssRules) {\n for (let j = 0, jj = cssRules.length; j < jj; ++j) {\n const cssRule = cssRules[j];\n if (cssRule.type == 5) {\n const match = cssRule.cssText.match(fontFamilyRegEx);\n loadedFontFamilies[match[1].replace(stripQuotesRegEx, '')] = true;\n }\n }\n }\n } catch (e) {\n }\n }\n }\n return family in loadedFontFamilies;\n}\nconst processedFontFamilies = {};\n/**\n * @param {Array} fonts Fonts.\n * @param {string} [templateUrl] Template URL.\n * @return {Array} Processed fonts.\n * @private\n */\nfunction getFonts(fonts, templateUrl = 'https://cdn.jsdelivr.net/npm/@fontsource/{font-family}/{fontweight}{-fontstyle}.css') {\n const fontsKey = fonts.toString();\n if (fontsKey in processedFontFamilies) {\n return processedFontFamilies[fontsKey];\n }\n const fontDescriptions = [];\n for (let i = 0, ii = fonts.length; i < ii; ++i) {\n fonts[i] = fonts[i].replace('Arial Unicode MS', 'Arial');\n const font = fonts[i];\n const cssFont = mb2css(font, 1);\n registerFont(cssFont);\n const parts = cssFont.split(' ');\n fontDescriptions.push([\n parts.slice(3).join(' ').replace(/\"/g, ''),\n parts[1],\n parts[0]\n ]);\n }\n for (let i = 0, ii = fontDescriptions.length; i < ii; ++i) {\n const fontDescription = fontDescriptions[i];\n const family = fontDescription[0];\n if (!hasFontFamily(family)) {\n if (checkedFonts.get(`${ fontDescription[2] }\\n${ fontDescription[1] } \\n${ family }`) !== 100) {\n const fontUrl = templateUrl.replace('{font-family}', family.replace(/ /g, '-').toLowerCase()).replace('{Font+Family}', family.replace(/ /g, '+')).replace('{fontweight}', fontDescription[1]).replace('{-fontstyle}', fontDescription[2].replace('normal', '').replace(/(.+)/, '-$1')).replace('{fontstyle}', fontDescription[2]);\n if (!document.querySelector('link[href=\"' + fontUrl + '\"]')) {\n const markup = document.createElement('link');\n markup.href = fontUrl;\n markup.rel = 'stylesheet';\n document.head.appendChild(markup);\n }\n }\n }\n }\n processedFontFamilies[fontsKey] = fonts;\n return fonts;\n}\n\n/*\nol-mapbox-style - Use Mapbox Style objects with OpenLayers\nCopyright 2016-present ol-mapbox-style contributors\nLicense: https://raw.githubusercontent.com/openlayers/ol-mapbox-style/master/LICENSE\n*/\n/**\n * @typedef {import(\"ol/layer/Vector\").default} VectorLayer\n * @typedef {import(\"ol/layer/VectorTile\").default} VectorTileLayer\n * @typedef {import(\"ol/style/Style\").StyleFunction} StyleFunction\n * @typedef {import('./util.js').ResourceType} ResourceType\n */\nconst types = {\n 'Point': 1,\n 'MultiPoint': 1,\n 'LineString': 2,\n 'MultiLineString': 2,\n 'Polygon': 3,\n 'MultiPolygon': 3\n};\nconst anchor = {\n 'center': [\n 0.5,\n 0.5\n ],\n 'left': [\n 0,\n 0.5\n ],\n 'right': [\n 1,\n 0.5\n ],\n 'top': [\n 0.5,\n 0\n ],\n 'bottom': [\n 0.5,\n 1\n ],\n 'top-left': [\n 0,\n 0\n ],\n 'top-right': [\n 1,\n 0\n ],\n 'bottom-left': [\n 0,\n 1\n ],\n 'bottom-right': [\n 1,\n 1\n ]\n};\nconst expressionData = function (rawExpression, propertySpec) {\n const compiledExpression = createPropertyExpression(rawExpression, propertySpec);\n if (compiledExpression.result === 'error') {\n throw new Error(compiledExpression.value.map(err => `${ err.key }: ${ err.message }`).join(', '));\n }\n return compiledExpression.value;\n};\nconst emptyObj$1 = {};\nconst zoomObj = { zoom: 0 };\nlet renderFeatureCoordinates, renderFeature;\n/**\n * @private\n * @param {Object} layer Gl object layer.\n * @param {string} layoutOrPaint 'layout' or 'paint'.\n * @param {string} property Feature property.\n * @param {number} zoom Zoom.\n * @param {Object} feature Gl feature.\n * @param {Object} [functionCache] Function cache.\n * @param {Object} [featureState] Feature state.\n * @return {?} Value.\n */\nfunction getValue(layer, layoutOrPaint, property, zoom, feature, functionCache, featureState) {\n const layerId = layer.id;\n if (!functionCache) {\n functionCache = {};\n console.warn('No functionCache provided to getValue()'); //eslint-disable-line no-console\n }\n if (!functionCache[layerId]) {\n functionCache[layerId] = {};\n }\n const functions = functionCache[layerId];\n if (!functions[property]) {\n let value = (layer[layoutOrPaint] || emptyObj$1)[property];\n const propertySpec = spec[`${ layoutOrPaint }_${ layer.type }`][property];\n if (value === undefined) {\n value = propertySpec.default;\n }\n let isExpr = isExpression(value);\n if (!isExpr && isFunction(value)) {\n value = convertFunction(value, propertySpec);\n isExpr = true;\n }\n if (isExpr) {\n const compiledExpression = expressionData(value, propertySpec);\n functions[property] = compiledExpression.evaluate.bind(compiledExpression);\n } else {\n if (propertySpec.type == 'color') {\n value = Color$1.parse(value);\n }\n functions[property] = function () {\n return value;\n };\n }\n }\n zoomObj.zoom = zoom;\n return functions[property](zoomObj, feature, featureState);\n}\n/**\n * @private\n * @param {Object} layer Gl object layer.\n * @param {number} zoom Zoom.\n * @param {Object} feature Gl feature.\n * @param {Object} [functionCache] Function cache.\n * @return {\"declutter\"|\"obstacle\"|\"none\"} Value.\n */\nfunction getIconDeclutterMode(layer, zoom, feature, functionCache) {\n const allowOverlap = getValue(layer, 'layout', 'icon-allow-overlap', zoom, feature, functionCache);\n if (!allowOverlap) {\n return 'declutter';\n }\n const ignorePlacement = getValue(layer, 'layout', 'icon-ignore-placement', zoom, feature, functionCache);\n if (!ignorePlacement) {\n return 'obstacle';\n }\n return 'none';\n}\n/**\n * @private\n * @param {string} layerId Layer id.\n * @param {?} filter Filter.\n * @param {Object} feature Feature.\n * @param {number} zoom Zoom.\n * @param {Object} [filterCache] Filter cache.\n * @return {boolean} Filter result.\n */\nfunction evaluateFilter(layerId, filter, feature, zoom, filterCache) {\n if (!filterCache) {\n console.warn('No filterCache provided to evaluateFilter()'); //eslint-disable-line no-console\n }\n if (!(layerId in filterCache)) {\n filterCache[layerId] = createFilter(filter).filter;\n }\n zoomObj.zoom = zoom;\n return filterCache[layerId](zoomObj, feature);\n}\nlet renderTransparentEnabled = false;\n/**\n * Configure whether features with a transparent style should be rendered. When\n * set to `true`, it will be possible to hit detect content that is not visible,\n * like transparent fills of polygons, using `ol/layer/Layer#getFeatures()` or\n * `ol/Map#getFeaturesAtPixel()`\n * @param {boolean} enabled Rendering of transparent elements is enabled.\n * Default is `false`.\n */\nfunction renderTransparent(enabled) {\n if (enabled !== renderTransparentEnabled) {\n clearFunctionCache();\n renderTransparentEnabled = enabled;\n }\n}\n/**\n * @private\n * @param {?} color Color.\n * @param {number} [opacity] Opacity.\n * @return {string} Color.\n */\nfunction colorWithOpacity(color, opacity) {\n if (color) {\n if (!renderTransparentEnabled && (color.a === 0 || opacity === 0)) {\n return undefined;\n }\n const a = color.a;\n opacity = opacity === undefined ? 1 : opacity;\n return a === 0 ? 'transparent' : 'rgba(' + Math.round(color.r * 255 / a) + ',' + Math.round(color.g * 255 / a) + ',' + Math.round(color.b * 255 / a) + ',' + a * opacity + ')';\n }\n return color;\n}\nconst templateRegEx = /\\{[^{}}]*\\}/g;\n/**\n * @private\n * @param {string} text Text.\n * @param {Object} properties Properties.\n * @return {string} Text.\n */\nfunction fromTemplate(text, properties) {\n return text.replace(templateRegEx, function (match) {\n return properties[match.slice(1, -1)] || '';\n });\n}\nlet recordLayer = false;\n/**\n * Turns recording of the Mapbox Style's `layer` on and off. When turned on,\n * the layer that a rendered feature belongs to will be set as the feature's\n * `mapbox-layer` property.\n * @param {boolean} record Recording of the style layer is on.\n */\nfunction recordStyleLayer(record = false) {\n recordLayer = record;\n}\nconst styleFunctionArgs = {};\n/**\n * Creates a style function from the `glStyle` object for all layers that use\n * the specified `source`, which needs to be a `\"type\": \"vector\"` or\n * `\"type\": \"geojson\"` source and applies it to the specified OpenLayers layer.\n *\n * Two additional properties will be set on the provided layer:\n *\n * * `mapbox-source`: The `id` of the Mapbox Style document's source that the\n * OpenLayers layer was created from. Usually `apply()` creates one\n * OpenLayers layer per Mapbox Style source, unless the layer stack has\n * layers from different sources in between.\n * * `mapbox-layers`: The `id`s of the Mapbox Style document's layers that are\n * included in the OpenLayers layer.\n *\n * This function also works in a web worker. In worker mode, the main thread needs\n * to listen to messages from the worker and respond with another message to make\n * sure that sprite image loading works:\n *\n * ```js\n * worker.addEventListener('message', event => {\n * if (event.data.action === 'loadImage') {\n * const image = new Image();\n * image.crossOrigin = 'anonymous';\n * image.addEventListener('load', function() {\n * createImageBitmap(image, 0, 0, image.width, image.height).then(imageBitmap => {\n * worker.postMessage({\n * action: 'imageLoaded',\n * image: imageBitmap,\n * src: event.data.src\n * }, [imageBitmap]);\n * });\n * });\n * image.src = event.data.src;\n * }\n * });\n * ```\n *\n * @param {VectorLayer|VectorTileLayer} olLayer OpenLayers layer to\n * apply the style to. In addition to the style, the layer will get two\n * properties: `mapbox-source` will be the `id` of the `glStyle`'s source used\n * for the layer, and `mapbox-layers` will be an array of the `id`s of the\n * `glStyle`'s layers.\n * @param {string|Object} glStyle Mapbox Style object.\n * @param {string|Array} sourceOrLayers `source` key or an array of layer `id`s\n * from the Mapbox Style object. When a `source` key is provided, all layers for\n * the specified source will be included in the style function. When layer `id`s\n * are provided, they must be from layers that use the same source.\n * @param {Array} resolutions\n * Resolutions for mapping resolution to zoom level.\n * @param {Object} spriteData Sprite data from the url specified in\n * the Mapbox Style object's `sprite` property. Only required if a `sprite`\n * property is specified in the Mapbox Style object.\n * @param {string|Request|Promise} spriteImageUrl Sprite image url for the sprite\n * specified in the Mapbox Style object's `sprite` property. Only required if a\n * `sprite` property is specified in the Mapbox Style object.\n * @param {function(Array, string=):Array} getFonts Function that\n * receives a font stack and the url template from the GL style's `metadata['ol:webfonts']`\n * property (if set) as arguments, and returns a (modified) font stack that\n * is available. Font names are the names used in the Mapbox Style object. If\n * not provided, the font stack will be used as-is. This function can also be\n * used for loading web fonts.\n * @param {function(VectorLayer|VectorTileLayer, string):HTMLImageElement|HTMLCanvasElement|string|undefined} [getImage=undefined]\n * Function that returns an image or a URL for an image name. If the result is an HTMLImageElement, it must already be\n * loaded. The layer can be used to call layer.changed() when the loading and processing of the image has finished.\n * This function can be used for icons not in the sprite or to override sprite icons.\n * @return {StyleFunction} Style function for use in\n * `ol.layer.Vector` or `ol.layer.VectorTile`.\n */\nfunction stylefunction(olLayer, glStyle, sourceOrLayers, resolutions = defaultResolutions, spriteData = undefined, spriteImageUrl = undefined, getFonts = undefined, getImage = undefined) {\n if (typeof glStyle == 'string') {\n glStyle = JSON.parse(glStyle);\n }\n if (glStyle.version != 8) {\n throw new Error('glStyle version 8 required.');\n }\n styleFunctionArgs[getStyleFunctionKey(glStyle, olLayer)] = Array.from(arguments);\n let spriteImage, spriteImageSize;\n let spriteImageUnSDFed;\n if (spriteImageUrl) {\n if (typeof Image !== 'undefined') {\n const img = new Image();\n let blobUrl;\n toPromise(() => spriteImageUrl).then(spriteImageUrl => {\n if (spriteImageUrl instanceof Request) {\n fetch(spriteImageUrl).then(response => response.blob()).then(blob => {\n blobUrl = URL.createObjectURL(blob);\n img.src = blobUrl;\n }).catch(() => {\n });\n } else {\n img.crossOrigin = 'anonymous';\n img.src = spriteImageUrl;\n if (blobUrl) {\n URL.revokeObjectURL(blobUrl);\n }\n }\n });\n img.onload = function () {\n spriteImage = img;\n spriteImageSize = [\n img.width,\n img.height\n ];\n olLayer.changed();\n img.onload = null;\n };\n } else if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {\n //eslint-disable-line\n const worker = self;\n // Main thread needs to handle 'loadImage' and dispatch 'imageLoaded'\n worker.postMessage({\n action: 'loadImage',\n src: spriteImageUrl\n });\n worker.addEventListener('message', function handler(event) {\n if (event.data.action === 'imageLoaded' && event.data.src === spriteImageUrl) {\n spriteImage = event.data.image;\n spriteImageSize = [\n spriteImage.width,\n spriteImage.height\n ];\n }\n });\n }\n }\n const allLayers = derefLayers(glStyle.layers);\n const layersBySourceLayer = {};\n const mapboxLayers = [];\n const iconImageCache = {};\n const patternCache = {};\n const functionCache = getFunctionCache(glStyle);\n const filterCache = getFilterCache(glStyle);\n let mapboxSource;\n for (let i = 0, ii = allLayers.length; i < ii; ++i) {\n const layer = allLayers[i];\n const layerId = layer.id;\n if (typeof sourceOrLayers == 'string' && layer.source == sourceOrLayers || sourceOrLayers.indexOf(layerId) !== -1) {\n const sourceLayer = layer['source-layer'];\n if (!mapboxSource) {\n mapboxSource = layer.source;\n const source = glStyle.sources[mapboxSource];\n if (!source) {\n throw new Error(`Source \"${ mapboxSource }\" is not defined`);\n }\n const type = source.type;\n if (type !== 'vector' && type !== 'geojson') {\n throw new Error(`Source \"${ mapboxSource }\" is not of type \"vector\" or \"geojson\", but \"${ type }\"`);\n }\n } else if (layer.source !== mapboxSource) {\n throw new Error(`Layer \"${ layerId }\" does not use source \"${ mapboxSource }`);\n }\n let layers = layersBySourceLayer[sourceLayer];\n if (!layers) {\n layers = [];\n layersBySourceLayer[sourceLayer] = layers;\n }\n layers.push({\n layer: layer,\n index: i\n });\n mapboxLayers.push(layerId);\n }\n }\n const textHalo = new Stroke();\n const textColor = new Fill();\n const styles = [];\n /**\n * @param {import(\"ol/Feature\").default|import(\"ol/render/Feature\").default} feature Feature.\n * @param {number} resolution Resolution.\n * @param {string} [onlyLayer] Calculate style for this layer only.\n * @return {Array} Style.\n */\n const styleFunction = function (feature, resolution, onlyLayer) {\n const properties = feature.getProperties();\n const layers = layersBySourceLayer[properties.layer];\n if (!layers) {\n return undefined;\n }\n let zoom = resolutions.indexOf(resolution);\n if (zoom == -1) {\n zoom = getZoomForResolution(resolution, resolutions);\n }\n const type = types[feature.getGeometry().getType()];\n const f = {\n id: feature.getId(),\n properties: properties,\n type: type\n };\n const featureState = olLayer.get('mapbox-featurestate')[feature.getId()];\n let stylesLength = -1;\n let featureBelongsToLayer;\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const layerData = layers[i];\n const layer = layerData.layer;\n const layerId = layer.id;\n if (onlyLayer !== undefined && onlyLayer !== layerId) {\n continue;\n }\n const layout = layer.layout || emptyObj$1;\n const paint = layer.paint || emptyObj$1;\n if (layout.visibility === 'none' || 'minzoom' in layer && zoom < layer.minzoom || 'maxzoom' in layer && zoom >= layer.maxzoom) {\n continue;\n }\n const filter = layer.filter;\n if (!filter || evaluateFilter(layerId, filter, f, zoom, filterCache)) {\n featureBelongsToLayer = layer;\n let color, opacity, fill, stroke, strokeColor, style;\n const index = layerData.index;\n if (type == 3 && (layer.type == 'fill' || layer.type == 'fill-extrusion')) {\n opacity = getValue(layer, 'paint', layer.type + '-opacity', zoom, f, functionCache, featureState);\n if (layer.type + '-pattern' in paint) {\n const fillIcon = getValue(layer, 'paint', layer.type + '-pattern', zoom, f, functionCache, featureState);\n if (fillIcon) {\n const icon = typeof fillIcon === 'string' ? fromTemplate(fillIcon, properties) : fillIcon.toString();\n if (spriteImage && spriteData && spriteData[icon]) {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || !style.getFill() || style.getStroke() || style.getText()) {\n style = new Style({ fill: new Fill() });\n styles[stylesLength] = style;\n }\n fill = style.getFill();\n style.setZIndex(index);\n const icon_cache_key = icon + '.' + opacity;\n let pattern = patternCache[icon_cache_key];\n if (!pattern) {\n const spriteImageData = spriteData[icon];\n const canvas = createCanvas(spriteImageData.width, spriteImageData.height);\n const ctx = canvas.getContext('2d');\n ctx.globalAlpha = opacity;\n ctx.drawImage(spriteImage, spriteImageData.x, spriteImageData.y, spriteImageData.width, spriteImageData.height, 0, 0, spriteImageData.width, spriteImageData.height);\n pattern = ctx.createPattern(canvas, 'repeat');\n patternCache[icon_cache_key] = pattern;\n }\n fill.setColor(pattern);\n }\n }\n } else {\n color = colorWithOpacity(getValue(layer, 'paint', layer.type + '-color', zoom, f, functionCache, featureState), opacity);\n if (layer.type + '-outline-color' in paint) {\n strokeColor = colorWithOpacity(getValue(layer, 'paint', layer.type + '-outline-color', zoom, f, functionCache, featureState), opacity);\n }\n if (!strokeColor) {\n strokeColor = color;\n }\n if (color || strokeColor) {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || color && !style.getFill() || !color && style.getFill() || strokeColor && !style.getStroke() || !strokeColor && style.getStroke() || style.getText()) {\n style = new Style({\n fill: color ? new Fill() : undefined,\n stroke: strokeColor ? new Stroke() : undefined\n });\n styles[stylesLength] = style;\n }\n if (color) {\n fill = style.getFill();\n fill.setColor(color);\n }\n if (strokeColor) {\n stroke = style.getStroke();\n stroke.setColor(strokeColor);\n stroke.setWidth(0.5);\n }\n style.setZIndex(index);\n }\n }\n }\n if (type != 1 && layer.type == 'line') {\n color = !('line-pattern' in paint) && 'line-color' in paint ? colorWithOpacity(getValue(layer, 'paint', 'line-color', zoom, f, functionCache, featureState), getValue(layer, 'paint', 'line-opacity', zoom, f, functionCache, featureState)) : undefined;\n const width = getValue(layer, 'paint', 'line-width', zoom, f, functionCache, featureState);\n if (color && width > 0) {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || !style.getStroke() || style.getFill() || style.getText()) {\n style = new Style({ stroke: new Stroke() });\n styles[stylesLength] = style;\n }\n stroke = style.getStroke();\n stroke.setLineCap(getValue(layer, 'layout', 'line-cap', zoom, f, functionCache, featureState));\n stroke.setLineJoin(getValue(layer, 'layout', 'line-join', zoom, f, functionCache, featureState));\n stroke.setMiterLimit(getValue(layer, 'layout', 'line-miter-limit', zoom, f, functionCache, featureState));\n stroke.setColor(color);\n stroke.setWidth(width);\n stroke.setLineDash(paint['line-dasharray'] ? getValue(layer, 'paint', 'line-dasharray', zoom, f, functionCache, featureState).map(function (x) {\n return x * width;\n }) : null);\n style.setZIndex(index);\n }\n }\n let hasImage = false;\n let text = null;\n let placementAngle = 0;\n let icon, iconImg, skipLabel;\n if ((type == 1 || type == 2) && 'icon-image' in layout) {\n const iconImage = getValue(layer, 'layout', 'icon-image', zoom, f, functionCache, featureState);\n if (iconImage) {\n icon = typeof iconImage === 'string' ? fromTemplate(iconImage, properties) : iconImage.toString();\n let styleGeom = undefined;\n const imageElement = getImage ? getImage(olLayer, icon) : undefined;\n if (spriteImage && spriteData && spriteData[icon] || imageElement) {\n const iconRotationAlignment = getValue(layer, 'layout', 'icon-rotation-alignment', zoom, f, functionCache, featureState);\n if (type == 2) {\n const geom = feature.getGeometry();\n // ol package and ol-debug.js only\n if (geom.getFlatMidpoint || geom.getFlatMidpoints) {\n const extent = geom.getExtent();\n const size = Math.sqrt(Math.max(Math.pow((extent[2] - extent[0]) / resolution, 2), Math.pow((extent[3] - extent[1]) / resolution, 2)));\n if (size > 150) {\n //FIXME Do not hard-code a size of 150\n const midpoint = geom.getType() === 'MultiLineString' ? geom.getFlatMidpoints() : geom.getFlatMidpoint();\n if (!renderFeature) {\n renderFeatureCoordinates = [\n NaN,\n NaN\n ];\n renderFeature = new RenderFeature('Point', renderFeatureCoordinates, [], {}, null);\n }\n styleGeom = renderFeature;\n renderFeatureCoordinates[0] = midpoint[0];\n renderFeatureCoordinates[1] = midpoint[1];\n const placement = getValue(layer, 'layout', 'symbol-placement', zoom, f, functionCache, featureState);\n if (placement === 'line' && iconRotationAlignment === 'map') {\n const stride = geom.getStride();\n const coordinates = geom.getFlatCoordinates();\n for (let i = 0, ii = coordinates.length - stride; i < ii; i += stride) {\n const x1 = coordinates[i];\n const y1 = coordinates[i + 1];\n const x2 = coordinates[i + stride];\n const y2 = coordinates[i + stride + 1];\n const minX = Math.min(x1, x2);\n const minY = Math.min(y1, y2);\n const maxX = Math.max(x1, x2);\n const maxY = Math.max(y1, y2);\n if (midpoint[0] >= minX && midpoint[0] <= maxX && midpoint[1] >= minY && midpoint[1] <= maxY) {\n placementAngle = Math.atan2(y1 - y2, x2 - x1);\n break;\n }\n }\n }\n }\n }\n }\n if (type !== 2 || styleGeom) {\n const iconSize = getValue(layer, 'layout', 'icon-size', zoom, f, functionCache, featureState);\n const iconColor = paint['icon-color'] !== undefined ? getValue(layer, 'paint', 'icon-color', zoom, f, functionCache, featureState) : null;\n if (!iconColor || iconColor.a !== 0) {\n const haloColor = getValue(layer, 'paint', 'icon-halo-color', zoom, f, functionCache, featureState);\n const haloWidth = getValue(layer, 'paint', 'icon-halo-width', zoom, f, functionCache, featureState);\n let iconCacheKey = `${ icon }.${ iconSize }.${ haloWidth }.${ haloColor }`;\n if (iconColor !== null) {\n iconCacheKey += `.${ iconColor }`;\n }\n iconImg = iconImageCache[iconCacheKey];\n if (!iconImg) {\n const declutterMode = getIconDeclutterMode(layer, zoom, f, functionCache);\n let displacement;\n if ('icon-offset' in layout) {\n displacement = getValue(layer, 'layout', 'icon-offset', zoom, f, functionCache, featureState).slice(0);\n displacement[1] *= -1;\n }\n let color = iconColor ? [\n iconColor.r * 255,\n iconColor.g * 255,\n iconColor.b * 255,\n iconColor.a\n ] : undefined;\n if (imageElement) {\n const iconOptions = {\n color: color,\n rotateWithView: iconRotationAlignment === 'map',\n displacement: displacement,\n declutterMode: declutterMode\n };\n if (typeof imageElement === 'string') {\n // it is a src URL\n iconOptions.src = imageElement;\n } else {\n iconOptions.img = imageElement;\n iconOptions.imgSize = [\n imageElement.width,\n imageElement.height\n ];\n }\n iconImg = new Icon(iconOptions);\n } else {\n const spriteImageData = spriteData[icon];\n let img, size, offset;\n if (haloWidth) {\n if (spriteImageData.sdf) {\n img = drawIconHalo(drawSDF(spriteImage, spriteImageData, iconColor), {\n x: 0,\n y: 0,\n width: spriteImageData.width,\n height: spriteImageData.height,\n pixelRatio: spriteImageData.pixelRatio\n }, haloWidth, haloColor);\n color = undefined; // do not tint haloed icons\n } else {\n img = drawIconHalo(spriteImage, spriteImageData, haloWidth, haloColor);\n }\n } else {\n if (spriteImageData.sdf) {\n if (!spriteImageUnSDFed) {\n spriteImageUnSDFed = drawSDF(spriteImage, {\n x: 0,\n y: 0,\n width: spriteImageSize[0],\n height: spriteImageSize[1]\n }, {\n r: 1,\n g: 1,\n b: 1,\n a: 1\n });\n }\n img = spriteImageUnSDFed;\n } else {\n img = spriteImage;\n }\n size = [\n spriteImageData.width,\n spriteImageData.height\n ];\n offset = [\n spriteImageData.x,\n spriteImageData.y\n ];\n }\n iconImg = new Icon({\n color: color,\n img: img,\n // @ts-ignore\n imgSize: spriteImageSize,\n size: size,\n offset: offset,\n rotateWithView: iconRotationAlignment === 'map',\n scale: iconSize / spriteImageData.pixelRatio,\n displacement: displacement,\n declutterMode: declutterMode\n });\n }\n iconImageCache[iconCacheKey] = iconImg;\n }\n }\n if (iconImg) {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || !style.getImage() || style.getFill() || style.getStroke()) {\n style = new Style();\n styles[stylesLength] = style;\n }\n style.setGeometry(styleGeom);\n iconImg.setRotation(placementAngle + deg2rad(getValue(layer, 'layout', 'icon-rotate', zoom, f, functionCache, featureState)));\n iconImg.setOpacity(getValue(layer, 'paint', 'icon-opacity', zoom, f, functionCache, featureState));\n iconImg.setAnchor(anchor[getValue(layer, 'layout', 'icon-anchor', zoom, f, functionCache, featureState)]);\n style.setImage(iconImg);\n text = style.getText();\n style.setText(undefined);\n style.setZIndex(index);\n hasImage = true;\n skipLabel = false;\n }\n } else {\n skipLabel = true;\n }\n }\n }\n }\n if (type == 1 && layer.type === 'circle') {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || !style.getImage() || style.getFill() || style.getStroke()) {\n style = new Style();\n styles[stylesLength] = style;\n }\n const circleRadius = 'circle-radius' in paint ? getValue(layer, 'paint', 'circle-radius', zoom, f, functionCache, featureState) : 5;\n const circleStrokeColor = colorWithOpacity(getValue(layer, 'paint', 'circle-stroke-color', zoom, f, functionCache, featureState), getValue(layer, 'paint', 'circle-stroke-opacity', zoom, f, functionCache, featureState));\n const circleColor = colorWithOpacity(getValue(layer, 'paint', 'circle-color', zoom, f, functionCache, featureState), getValue(layer, 'paint', 'circle-opacity', zoom, f, functionCache, featureState));\n const circleStrokeWidth = getValue(layer, 'paint', 'circle-stroke-width', zoom, f, functionCache, featureState);\n const cache_key = circleRadius + '.' + circleStrokeColor + '.' + circleColor + '.' + circleStrokeWidth;\n iconImg = iconImageCache[cache_key];\n if (!iconImg) {\n iconImg = new Circle({\n radius: circleRadius,\n stroke: circleStrokeColor && circleStrokeWidth > 0 ? new Stroke({\n width: circleStrokeWidth,\n color: circleStrokeColor\n }) : undefined,\n fill: circleColor ? new Fill({ color: circleColor }) : undefined,\n declutterMode: 'none'\n });\n iconImageCache[cache_key] = iconImg;\n }\n style.setImage(iconImg);\n text = style.getText();\n style.setText(undefined);\n style.setGeometry(undefined);\n style.setZIndex(index);\n hasImage = true;\n }\n let label, font, textLineHeight, textSize, letterSpacing, maxTextWidth;\n if ('text-field' in layout) {\n textSize = Math.round(getValue(layer, 'layout', 'text-size', zoom, f, functionCache, featureState));\n const fontArray = getValue(layer, 'layout', 'text-font', zoom, f, functionCache, featureState);\n textLineHeight = getValue(layer, 'layout', 'text-line-height', zoom, f, functionCache, featureState);\n font = mb2css(getFonts ? getFonts(fontArray, glStyle.metadata ? glStyle.metadata['ol:webfonts'] : undefined) : fontArray, textSize, textLineHeight);\n if (!font.includes('sans-serif')) {\n font += ',sans-serif';\n }\n letterSpacing = getValue(layer, 'layout', 'text-letter-spacing', zoom, f, functionCache, featureState);\n maxTextWidth = getValue(layer, 'layout', 'text-max-width', zoom, f, functionCache, featureState);\n const textField = getValue(layer, 'layout', 'text-field', zoom, f, functionCache, featureState);\n if (typeof textField === 'object' && textField.sections) {\n if (textField.sections.length === 1) {\n label = textField.toString();\n } else {\n label = textField.sections.reduce((acc, chunk, i) => {\n const fonts = chunk.fontStack ? chunk.fontStack.split(',') : fontArray;\n const chunkFont = mb2css(getFonts ? getFonts(fonts) : fonts, textSize * (chunk.scale || 1), textLineHeight);\n let text = chunk.text;\n if (text === '\\n') {\n acc.push('\\n', '');\n return acc;\n }\n if (type == 2) {\n acc.push(applyLetterSpacing(text, letterSpacing), chunkFont);\n return;\n }\n text = wrapText(text, chunkFont, maxTextWidth, letterSpacing).split('\\n');\n for (let i = 0, ii = text.length; i < ii; ++i) {\n if (i > 0) {\n acc.push('\\n', '');\n }\n acc.push(text[i], chunkFont);\n }\n return acc;\n }, []);\n }\n } else {\n label = fromTemplate(textField, properties).trim();\n }\n opacity = getValue(layer, 'paint', 'text-opacity', zoom, f, functionCache, featureState);\n }\n if (label && opacity && !skipLabel) {\n if (!hasImage) {\n ++stylesLength;\n style = styles[stylesLength];\n if (!style || !style.getText() || style.getFill() || style.getStroke()) {\n style = new Style();\n styles[stylesLength] = style;\n }\n style.setImage(undefined);\n style.setGeometry(undefined);\n }\n if (!style.getText()) {\n style.setText(text || new Text({\n padding: [\n 2,\n 2,\n 2,\n 2\n ]\n }));\n }\n text = style.getText();\n const textTransform = layout['text-transform'];\n if (textTransform == 'uppercase') {\n label = Array.isArray(label) ? label.map((t, i) => i % 2 ? t : t.toUpperCase()) : label.toUpperCase();\n } else if (textTransform == 'lowercase') {\n label = Array.isArray(label) ? label.map((t, i) => i % 2 ? t : t.toLowerCase()) : label.toLowerCase();\n }\n const wrappedLabel = Array.isArray(label) ? label : type == 2 ? applyLetterSpacing(label, letterSpacing) : wrapText(label, font, maxTextWidth, letterSpacing);\n text.setText(wrappedLabel);\n text.setFont(font);\n text.setRotation(deg2rad(getValue(layer, 'layout', 'text-rotate', zoom, f, functionCache, featureState)));\n const textAnchor = getValue(layer, 'layout', 'text-anchor', zoom, f, functionCache, featureState);\n const placement = hasImage || type == 1 ? 'point' : getValue(layer, 'layout', 'symbol-placement', zoom, f, functionCache, featureState);\n let textAlign;\n if (placement === 'line-center') {\n text.setPlacement('line');\n textAlign = 'center';\n } else {\n text.setPlacement(placement);\n }\n if (placement === 'line' && typeof text.setRepeat === 'function') {\n const symbolSpacing = getValue(layer, 'layout', 'symbol-spacing', zoom, f, functionCache, featureState);\n text.setRepeat(symbolSpacing * 2);\n }\n text.setOverflow(placement === 'point');\n let textHaloWidth = getValue(layer, 'paint', 'text-halo-width', zoom, f, functionCache, featureState);\n const textOffset = getValue(layer, 'layout', 'text-offset', zoom, f, functionCache, featureState);\n const textTranslate = getValue(layer, 'paint', 'text-translate', zoom, f, functionCache, featureState);\n // Text offset has to take halo width and line height into account\n let vOffset = 0;\n let hOffset = 0;\n if (placement == 'point') {\n textAlign = 'center';\n if (textAnchor.indexOf('left') !== -1) {\n textAlign = 'left';\n hOffset = textHaloWidth;\n } else if (textAnchor.indexOf('right') !== -1) {\n textAlign = 'right';\n hOffset = -textHaloWidth;\n }\n const textRotationAlignment = getValue(layer, 'layout', 'text-rotation-alignment', zoom, f, functionCache, featureState);\n text.setRotateWithView(textRotationAlignment == 'map');\n } else {\n text.setMaxAngle(deg2rad(getValue(layer, 'layout', 'text-max-angle', zoom, f, functionCache, featureState)) * label.length / wrappedLabel.length);\n text.setRotateWithView(false);\n }\n text.setTextAlign(textAlign);\n let textBaseline = 'middle';\n if (textAnchor.indexOf('bottom') == 0) {\n textBaseline = 'bottom';\n vOffset = -textHaloWidth - 0.5 * (textLineHeight - 1) * textSize;\n } else if (textAnchor.indexOf('top') == 0) {\n textBaseline = 'top';\n vOffset = textHaloWidth + 0.5 * (textLineHeight - 1) * textSize;\n }\n text.setTextBaseline(textBaseline);\n const textJustify = getValue(layer, 'layout', 'text-justify', zoom, f, functionCache, featureState);\n text.setJustify(textJustify === 'auto' ? undefined : textJustify);\n text.setOffsetX(textOffset[0] * textSize + hOffset + textTranslate[0]);\n text.setOffsetY(textOffset[1] * textSize + vOffset + textTranslate[1]);\n textColor.setColor(colorWithOpacity(getValue(layer, 'paint', 'text-color', zoom, f, functionCache, featureState), opacity));\n text.setFill(textColor);\n const haloColor = colorWithOpacity(getValue(layer, 'paint', 'text-halo-color', zoom, f, functionCache, featureState), opacity);\n if (haloColor) {\n textHalo.setColor(haloColor);\n // spec here : https://docs.mapbox.com/mapbox-gl-js/style-spec/#paint-symbol-text-halo-width\n // Halo width must be doubled because it is applied around the center of the text outline\n textHaloWidth *= 2;\n // 1/4 of text size (spec) x 2\n const halfTextSize = 0.5 * textSize;\n textHalo.setWidth(textHaloWidth <= halfTextSize ? textHaloWidth : halfTextSize);\n text.setStroke(textHalo);\n } else {\n text.setStroke(undefined);\n }\n const textPadding = getValue(layer, 'layout', 'text-padding', zoom, f, functionCache, featureState);\n const padding = text.getPadding();\n if (textPadding !== padding[0]) {\n padding[0] = textPadding;\n padding[1] = textPadding;\n padding[2] = textPadding;\n padding[3] = textPadding;\n }\n style.setZIndex(index);\n }\n }\n }\n if (stylesLength > -1) {\n styles.length = stylesLength + 1;\n if (recordLayer) {\n if ('set' in feature) {\n // ol/Feature\n feature.set('mapbox-layer', featureBelongsToLayer);\n } else {\n // ol/render/Feature\n feature.getProperties()['mapbox-layer'] = featureBelongsToLayer;\n }\n }\n return styles;\n }\n return undefined;\n };\n olLayer.setStyle(styleFunction);\n olLayer.set('mapbox-source', mapboxSource);\n olLayer.set('mapbox-layers', mapboxLayers);\n olLayer.set('mapbox-featurestate', olLayer.get('mapbox-featurestate') || {});\n return styleFunction;\n}\n/**\n * Get the the style for a specific Mapbox layer only. This can be useful for creating a legend.\n * @param {import(\"ol/Feature\").default|import(\"ol/render/Feature\").default} feature OpenLayers feature.\n * @param {number} resolution View resolution.\n * @param {import(\"ol/layer\").Vector|import(\"ol/layer\").VectorTile} olLayer OpenLayers layer.\n * @param {string} layerId Id of the Mapbox layer to get the style for\n * @return {Array} Styles for the provided Mapbox layer.\n */\nfunction getStyleForLayer(feature, resolution, olLayer, layerId) {\n const evaluateStyle = olLayer.getStyleFunction();\n if (evaluateStyle.length === 3) {\n // @ts-ignore\n return evaluateStyle(feature, resolution, layerId);\n }\n return undefined;\n}\n\n/**\n * Generates a shaded relief image given elevation data. Uses a 3x3\n * neighborhood for determining slope and aspect.\n * @param {Array} inputs Array of input images.\n * @param {Object} data Data added in the \"beforeoperations\" event.\n * @return {ImageData} Output image.\n */\nfunction hillshade(inputs, data) {\n const elevationImage = inputs[0];\n const width = elevationImage.width;\n const height = elevationImage.height;\n const elevationData = elevationImage.data;\n const shadeData = new Uint8ClampedArray(elevationData.length);\n const dp = data.resolution * 2;\n const maxX = width - 1;\n const maxY = height - 1;\n const pixel = [\n 0,\n 0,\n 0,\n 0\n ];\n const twoPi = 2 * Math.PI;\n const halfPi = Math.PI / 2;\n const sunEl = Math.PI * data.sunEl / 180;\n const sunAz = Math.PI * data.sunAz / 180;\n const cosSunEl = Math.cos(sunEl);\n const sinSunEl = Math.sin(sunEl);\n const highlightColor = data.highlightColor;\n const shadowColor = data.shadowColor;\n const accentColor = data.accentColor;\n const encoding = data.encoding;\n let pixelX, pixelY, x0, x1, y0, y1, offset, z0, z1, dzdx, dzdy, slope, aspect, accent, scaled, shade, scaledAccentColor, compositeShadeColor, clamp, slopeScaleBase, scaledSlope, cosIncidence;\n function calculateElevation(pixel, encoding = 'mapbox') {\n // The method used to extract elevations from the DEM.\n //\n // The supported methods are the Mapbox format\n // (red * 256 * 256 + green * 256 + blue) * 0.1 - 10000\n // and the Terrarium format\n // (red * 256 + green + blue / 256) - 32768\n //\n if (encoding === 'mapbox') {\n return (pixel[0] * 256 * 256 + pixel[1] * 256 + pixel[2]) * 0.1 - 10000;\n }\n if (encoding === 'terrarium') {\n return pixel[0] * 256 + pixel[1] + pixel[2] / 256 - 32768;\n }\n }\n for (pixelY = 0; pixelY <= maxY; ++pixelY) {\n y0 = pixelY === 0 ? 0 : pixelY - 1;\n y1 = pixelY === maxY ? maxY : pixelY + 1;\n for (pixelX = 0; pixelX <= maxX; ++pixelX) {\n x0 = pixelX === 0 ? 0 : pixelX - 1;\n x1 = pixelX === maxX ? maxX : pixelX + 1;\n // determine elevation for (x0, pixelY)\n offset = (pixelY * width + x0) * 4;\n pixel[0] = elevationData[offset];\n pixel[1] = elevationData[offset + 1];\n pixel[2] = elevationData[offset + 2];\n pixel[3] = elevationData[offset + 3];\n z0 = data.vert * calculateElevation(pixel, encoding);\n // determine elevation for (x1, pixelY)\n offset = (pixelY * width + x1) * 4;\n pixel[0] = elevationData[offset];\n pixel[1] = elevationData[offset + 1];\n pixel[2] = elevationData[offset + 2];\n pixel[3] = elevationData[offset + 3];\n z1 = data.vert * calculateElevation(pixel, encoding);\n dzdx = (z1 - z0) / dp;\n // determine elevation for (pixelX, y0)\n offset = (y0 * width + pixelX) * 4;\n pixel[0] = elevationData[offset];\n pixel[1] = elevationData[offset + 1];\n pixel[2] = elevationData[offset + 2];\n pixel[3] = elevationData[offset + 3];\n z0 = data.vert * calculateElevation(pixel, encoding);\n // determine elevation for (pixelX, y1)\n offset = (y1 * width + pixelX) * 4;\n pixel[0] = elevationData[offset];\n pixel[1] = elevationData[offset + 1];\n pixel[2] = elevationData[offset + 2];\n pixel[3] = elevationData[offset + 3];\n z1 = data.vert * calculateElevation(pixel, encoding);\n dzdy = (z1 - z0) / dp;\n aspect = Math.atan2(dzdy, -dzdx);\n if (aspect < 0) {\n aspect = halfPi - aspect;\n } else if (aspect > halfPi) {\n aspect = twoPi - aspect + halfPi;\n } else {\n aspect = halfPi - aspect;\n }\n // Bootstrap slope and corresponding incident values\n slope = Math.atan(Math.sqrt(dzdx * dzdx + dzdy * dzdy));\n cosIncidence = sinSunEl * Math.cos(slope) + cosSunEl * Math.sin(slope) * Math.cos(sunAz - aspect);\n accent = Math.cos(slope);\n // 255 for Hex colors\n scaled = 255 * cosIncidence;\n /*\n * The following is heavily inspired\n * by [Maplibre's equivalent WebGL shader](https://github.com/maplibre/maplibre-gl-js/blob/main/src/shaders/hillshade.fragment.glsl)\n */\n // Forces given value to stay between two given extremes\n clamp = Math.min(Math.max(2 * data.sunEl, 0), 1);\n // Intensity basis for hillshade opacity\n slopeScaleBase = 1.875 - data.opacity * 1.75;\n // Intensity interpolation so that higher intensity values create more opaque hillshading\n scaledSlope = data.opacity !== 0.5 ? halfPi * ((Math.pow(slopeScaleBase, slope) - 1) / (Math.pow(slopeScaleBase, halfPi) - 1)) : slope;\n // Accent hillshade color with given accentColor to emphasize rougher terrain\n scaledAccentColor = {\n r: (1 - accent) * accentColor.r * clamp * 255,\n g: (1 - accent) * accentColor.g * clamp * 255,\n b: (1 - accent) * accentColor.b * clamp * 255,\n a: (1 - accent) * accentColor.a * clamp * 255\n };\n // Allows highlight vs shadow discrimination\n shade = Math.abs(((aspect + sunAz) / Math.PI + 0.5) % 2 - 1);\n // Creates a composite color mix between highlight & shadow colors to emphasize slopes\n compositeShadeColor = {\n r: (highlightColor.r * (1 - shade) + shadowColor.r * shade) * scaled,\n g: (highlightColor.g * (1 - shade) + shadowColor.g * shade) * scaled,\n b: (highlightColor.b * (1 - shade) + shadowColor.b * shade) * scaled,\n a: (highlightColor.a * (1 - shade) + shadowColor.a * shade) * scaled\n };\n // Fill in result color value\n offset = (pixelY * width + pixelX) * 4;\n shadeData[offset] = scaledAccentColor.r * (1 - shade) + compositeShadeColor.r;\n shadeData[offset + 1] = scaledAccentColor.g * (1 - shade) + compositeShadeColor.g;\n shadeData[offset + 2] = scaledAccentColor.b * (1 - shade) + compositeShadeColor.b;\n // Key opacity on the scaledSlope to improve legibility by increasing higher elevation rates' contrast\n shadeData[offset + 3] = elevationData[offset + 3] * data.opacity * clamp * Math.sin(scaledSlope);\n }\n }\n return new ImageData(shadeData, width, height);\n}\n\n/*\nol-mapbox-style - Use Mapbox Style objects with OpenLayers\nCopyright 2016-present ol-mapbox-style contributors\nLicense: https://raw.githubusercontent.com/openlayers/ol-mapbox-style/master/LICENSE\n*/\n/**\n * @typedef {Object} FeatureIdentifier\n * @property {string|number} id The feature id.\n * @property {string} source The source id.\n */\n/**\n * @typedef {Object} Options\n * @property {string} [accessToken] Access token for 'mapbox://' urls.\n * @property {function(string, import(\"./util.js\").ResourceType): (Request|string|Promise|void)} [transformRequest]\n * Function for controlling how `ol-mapbox-style` fetches resources. Can be used for modifying\n * the url, adding headers or setting credentials options. Called with the url and the resource\n * type as arguments, this function is supposed to return a `Request` or a url `string`, or a promise tehereof.\n * Without a return value the original request will not be modified.\n * @property {string} [projection='EPSG:3857'] Only useful when working with non-standard projections.\n * Code of a projection registered with OpenLayers. All sources of the style must be provided in this\n * projection. The projection must also have a valid extent defined, which will be used to determine the\n * origin and resolutions of the tile grid for all tiled sources of the style. When provided, the bbox\n * placeholder in tile and geojson urls changes: the default is `{bbox-epsg-3857}`, when projection is e.g.\n * set to `EPSG:4326`, the bbox placeholder will be `{bbox-epsg-4326}`.\n * @property {Array} [resolutions] Only useful when working with non-standard projections.\n * Resolutions for mapping resolution to the `zoom` used in the Mapbox style.\n * @property {string} [styleUrl] URL of the Mapbox GL style. Required for styles that were provided\n * as object, when they contain a relative sprite url, or sources referencing data by relative url.\n * @property {function(VectorLayer|VectorTileLayer, string):HTMLImageElement|HTMLCanvasElement|string|undefined} [getImage=undefined]\n * Function that returns an image for an icon name. If the result is an HTMLImageElement, it must already be\n * loaded. The layer can be used to call layer.changed() when the loading and processing of the image has finished.\n * This function be used for icons not in the sprite or to override sprite icons.\n * @property {string} [accessTokenParam='access_token'] Access token param. For internal use.\n */\n/**\n * @typedef {Object} ApplyStyleOptions\n * @property {string} [source=''] Source. Default is `''`, which causes the first source in the\n * style to be used.\n * @property {Array} [layers] Layers. If no source is provided, the layers with the\n * provided ids will be used from the style's `layers` array. All layers need to use the same source.\n * @property {boolean} [updateSource=true] Update or create vector (tile) layer source with parameters\n * specified for the source in the mapbox style definition.\n */\n/**\n * @param {import(\"ol/proj/Projection.js\").default} projection Projection.\n * @param {number} [tileSize=512] Tile size.\n * @return {Array} Resolutions.\n */\nfunction getTileResolutions(projection, tileSize = 512) {\n return projection.getExtent() ? createXYZ({\n extent: projection.getExtent(),\n tileSize: tileSize,\n maxZoom: 22\n }).getResolutions() : defaultResolutions;\n}\n/**\n * @param {string} styleUrl Style URL.\n * @param {Options} options Options.\n * @return {Options} Completed options with accessToken and accessTokenParam.\n */\nfunction completeOptions(styleUrl, options) {\n if (!options.accessToken) {\n options = Object.assign({}, options);\n const searchParams = new URL(styleUrl).searchParams;\n // The last search parameter is the access token\n searchParams.forEach((value, key) => {\n options.accessToken = value;\n options.accessTokenParam = key;\n });\n }\n return options;\n}\n/**\n * Applies a style function to an `ol/layer/VectorTile` or `ol/layer/Vector`\n * with an `ol/source/VectorTile` or an `ol/source/Vector`. If the layer does not have a source\n * yet, it will be created and populated from the information in the `glStyle` (unless `updateSource` is\n * set to `false`).\n *\n * **Example:**\n * ```js\n * import {applyStyle} from 'ol-mapbox-style';\n * import {VectorTile} from 'ol/layer.js';\n *\n * const layer = new VectorTile({declutter: true});\n * applyStyle(layer, 'https://api.maptiler.com/maps/basic/style.json?key=YOUR_OPENMAPTILES_TOKEN');\n * ```\n *\n * The style function will render all layers from the `glStyle` object that use the source\n * of the first layer, the specified `source`, or a subset of layers from the same source. The\n * source needs to be a `\"type\": \"vector\"` or `\"type\": \"geojson\"` source.\n *\n * Two additional properties will be set on the provided layer:\n *\n * * `mapbox-source`: The `id` of the Mapbox Style document's source that the\n * OpenLayers layer was created from. Usually `apply()` creates one\n * OpenLayers layer per Mapbox Style source, unless the layer stack has\n * layers from different sources in between.\n * * `mapbox-layers`: The `id`s of the Mapbox Style document's layers that are\n * included in the OpenLayers layer.\n *\n * @param {VectorTileLayer|VectorLayer} layer OpenLayers layer. When the layer has a source configured,\n * it will be modified to use the configuration from the glStyle's `source`. Options specified on the\n * layer's source will override those from the glStyle's `source`, except for `url` and\n * `tileUrlFunction`. When the source projection is the default (`EPSG:3857`), the `tileGrid` will\n * also be overridden. If you'd rather not have ol-mapbox-style modify the source, configure `applyStyle()`\n * with the `updateSource: false` option.\n * @param {string|Object} glStyle Mapbox Style object.\n * @param {string|Array|Options&ApplyStyleOptions} [sourceOrLayersOrOptions] Options or\n * `source` key or an array of layer `id`s from the Mapbox Style object. When a `source` key is\n * provided, all layers for the specified source will be included in the style function. When layer\n * `id`s are provided, they must be from layers that use the same source. When not provided or a falsey\n * value, all layers using the first source specified in the glStyle will be rendered.\n * @param {Options&ApplyStyleOptions|string} [optionsOrPath] **Deprecated**. Options. Alternatively the path of the style file\n * (only required when a relative path is used for the `\"sprite\"` property of the style).\n * @param {Array} [resolutions] **Deprecated**. Resolutions for mapping resolution to zoom level.\n * Only needed when working with non-standard tile grids or projections, can also be supplied with\n * options.\n * @return {Promise} Promise which will be resolved when the style can be used\n * for rendering.\n */\nfunction applyStyle(layer, glStyle, sourceOrLayersOrOptions = '', optionsOrPath = {}, resolutions = undefined) {\n let styleUrl, sourceId;\n /** @type {Options&ApplyStyleOptions} */\n let options;\n let sourceOrLayers;\n let updateSource = true;\n if (typeof sourceOrLayersOrOptions !== 'string' && !Array.isArray(sourceOrLayersOrOptions)) {\n options = sourceOrLayersOrOptions;\n sourceOrLayers = options.source || options.layers;\n optionsOrPath = options;\n } else {\n sourceOrLayers = sourceOrLayersOrOptions;\n }\n if (typeof optionsOrPath === 'string') {\n styleUrl = optionsOrPath;\n options = {};\n } else {\n styleUrl = optionsOrPath.styleUrl;\n options = optionsOrPath;\n }\n if (options.updateSource === false) {\n updateSource = false;\n }\n if (!resolutions) {\n resolutions = options.resolutions;\n }\n if (!styleUrl && typeof glStyle === 'string' && !glStyle.trim().startsWith('{')) {\n styleUrl = glStyle;\n }\n if (styleUrl) {\n styleUrl = styleUrl.startsWith('data:') ? location.href : normalizeStyleUrl(styleUrl, options.accessToken);\n options = completeOptions(styleUrl, options);\n }\n return new Promise(function (resolve, reject) {\n // TODO: figure out where best place to check source type is\n // Note that the source arg is an array of gl layer ids and each must be\n // dereferenced to get source type to validate\n getGlStyle(glStyle, options).then(function (glStyle) {\n if (glStyle.version != 8) {\n return reject(new Error('glStyle version 8 required.'));\n }\n if (!(layer instanceof VectorLayer || layer instanceof VectorTileLayer)) {\n return reject(new Error('Can only apply to VectorLayer or VectorTileLayer'));\n }\n const type = layer instanceof VectorTileLayer ? 'vector' : 'geojson';\n if (!sourceOrLayers) {\n sourceId = Object.keys(glStyle.sources).find(function (key) {\n return glStyle.sources[key].type === type;\n });\n sourceOrLayers = sourceId;\n } else if (Array.isArray(sourceOrLayers)) {\n sourceId = glStyle.layers.find(function (layer) {\n return layer.id === sourceOrLayers[0];\n }).source;\n } else {\n sourceId = sourceOrLayers;\n }\n if (!sourceId) {\n return reject(new Error(`No ${ type } source found in the glStyle.`));\n }\n function assignSource() {\n if (!updateSource) {\n return Promise.resolve();\n }\n if (layer instanceof VectorTileLayer) {\n return setupVectorSource(glStyle.sources[sourceId], styleUrl, options).then(function (source) {\n const targetSource = layer.getSource();\n if (!targetSource) {\n layer.setSource(source);\n } else if (source !== targetSource) {\n targetSource.setTileUrlFunction(source.getTileUrlFunction());\n if (typeof targetSource.setUrls === 'function' && typeof source.getUrls === 'function') {\n // to get correct keys for tile cache and queue\n targetSource.setUrls(source.getUrls());\n }\n //@ts-ignore\n if (!targetSource.format_) {\n //@ts-ignore\n targetSource.format_ = source.format_;\n }\n if (!targetSource.getAttributions()) {\n targetSource.setAttributions(source.getAttributions());\n }\n if (targetSource.getTileLoadFunction() === defaultLoadFunction) {\n targetSource.setTileLoadFunction(source.getTileLoadFunction());\n }\n if (equivalent(targetSource.getProjection(), source.getProjection())) {\n targetSource.tileGrid = source.getTileGrid();\n }\n }\n if (!isFinite(layer.getMaxResolution()) && !isFinite(layer.getMinZoom())) {\n const tileGrid = layer.getSource().getTileGrid();\n layer.setMaxResolution(tileGrid.getResolution(tileGrid.getMinZoom()));\n }\n });\n }\n const glSource = glStyle.sources[sourceId];\n let source = layer.getSource();\n if (!source || source.get('mapbox-source') !== glSource) {\n source = setupGeoJSONSource(glSource, styleUrl, options);\n }\n const targetSource = layer.getSource();\n if (!targetSource) {\n layer.setSource(source);\n } else if (source !== targetSource) {\n if (!targetSource.getAttributions()) {\n targetSource.setAttributions(source.getAttributions());\n }\n //@ts-ignore\n if (!targetSource.format_) {\n //@ts-ignore\n targetSource.format_ = source.getFormat();\n }\n //@ts-ignore\n targetSource.url_ = source.getUrl();\n }\n return Promise.resolve();\n }\n let spriteScale, spriteData, spriteImageUrl, style;\n function onChange() {\n if (!style && (!glStyle.sprite || spriteData)) {\n if (options.projection && !resolutions) {\n const projection = get$1(options.projection);\n const units = projection.getUnits();\n if (units !== 'm') {\n resolutions = defaultResolutions.map(resolution => resolution / METERS_PER_UNIT[units]);\n }\n }\n style = stylefunction(layer, glStyle, sourceOrLayers, resolutions, spriteData, spriteImageUrl, getFonts, options.getImage);\n if (!layer.getStyle()) {\n reject(new Error(`Nothing to show for source [${ sourceId }]`));\n } else {\n assignSource().then(resolve).catch(reject);\n }\n } else if (style) {\n layer.setStyle(style);\n assignSource().then(resolve).catch(reject);\n } else {\n reject(new Error('Something went wrong trying to apply style.'));\n }\n }\n if (glStyle.sprite) {\n const sprite = new URL(normalizeSpriteUrl(glStyle.sprite, options.accessToken, styleUrl || location.href));\n spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1;\n const sizeFactor = spriteScale == 0.5 ? '@2x' : '';\n let spriteUrl = sprite.origin + sprite.pathname + sizeFactor + '.json' + sprite.search;\n new Promise(function (resolve, reject) {\n fetchResource('Sprite', spriteUrl, options).then(resolve).catch(function (error) {\n spriteUrl = sprite.origin + sprite.pathname + '.json' + sprite.search;\n fetchResource('Sprite', spriteUrl, options).then(resolve).catch(reject);\n });\n }).then(function (spritesJson) {\n if (spritesJson === undefined) {\n reject(new Error('No sprites found.'));\n }\n spriteData = spritesJson;\n spriteImageUrl = sprite.origin + sprite.pathname + sizeFactor + '.png' + sprite.search;\n if (options.transformRequest) {\n const transformed = options.transformRequest(spriteImageUrl, 'SpriteImage') || spriteImageUrl;\n if (transformed instanceof Request || transformed instanceof Promise) {\n spriteImageUrl = transformed;\n }\n }\n onChange();\n }).catch(function (err) {\n reject(new Error(`Sprites cannot be loaded: ${ spriteUrl }: ${ err.message }`));\n });\n } else {\n onChange();\n }\n }).catch(reject);\n });\n}\nconst emptyObj = {};\nfunction setFirstBackground(mapOrLayer, glStyle, options) {\n glStyle.layers.some(function (layer) {\n if (layer.type === 'background') {\n if (mapOrLayer instanceof Layer) {\n mapOrLayer.setBackground(function (resolution) {\n return getBackgroundColor(layer, resolution, options, {});\n });\n return true;\n }\n if (mapOrLayer instanceof Map || mapOrLayer instanceof LayerGroup) {\n mapOrLayer.getLayers().push(setupBackgroundLayer(layer, options, {}));\n return true;\n }\n }\n });\n}\n/**\n * Applies properties of the Mapbox Style's first `background` layer to the\n * provided map or layer (group).\n *\n * **Example:**\n * ```js\n * import {applyBackground} from 'ol-mapbox-style';\n * import {Map} from 'ol';\n *\n * const map = new Map({target: 'map'});\n * applyBackground(map, 'https://api.maptiler.com/maps/basic/style.json?key=YOUR_OPENMAPTILES_TOKEN');\n * ```\n * @param {Map|import(\"ol/layer/Base.js\").default} mapOrLayer OpenLayers Map or layer (group).\n * @param {Object|string} glStyle Mapbox Style object or url.\n * @param {Options} options Options.\n * @return {Promise} Promise that resolves when the background is applied.\n */\nfunction applyBackground(mapOrLayer, glStyle, options = {}) {\n return getGlStyle(glStyle, options).then(function (glStyle) {\n setFirstBackground(mapOrLayer, glStyle, options);\n });\n}\nfunction getSourceIdByRef(layers, ref) {\n let sourceId;\n layers.some(function (layer) {\n if (layer.id == ref) {\n sourceId = layer.source;\n return true;\n }\n });\n return sourceId;\n}\nfunction extentFromTileJSON(tileJSON, projection) {\n const bounds = tileJSON.bounds;\n if (bounds) {\n const ll = fromLonLat([\n bounds[0],\n bounds[1]\n ], projection);\n const tr = fromLonLat([\n bounds[2],\n bounds[3]\n ], projection);\n return [\n ll[0],\n ll[1],\n tr[0],\n tr[1]\n ];\n }\n return get$1(projection).getExtent();\n}\nfunction sourceOptionsFromTileJSON(glSource, tileJSON, options) {\n const tileJSONSource = new TileJSON({\n tileJSON: tileJSON,\n tileSize: glSource.tileSize || tileJSON.tileSize || 512\n });\n const tileJSONDoc = tileJSONSource.getTileJSON();\n const tileGrid = tileJSONSource.getTileGrid();\n const projection = get$1(options.projection || 'EPSG:3857');\n const extent = extentFromTileJSON(tileJSONDoc, projection);\n const projectionExtent = projection.getExtent();\n const minZoom = tileJSONDoc.minzoom || 0;\n const maxZoom = tileJSONDoc.maxzoom || 22;\n /** @type {import(\"ol/source/VectorTile.js\").Options} */\n const sourceOptions = {\n attributions: tileJSONSource.getAttributions(),\n projection: projection,\n tileGrid: new TileGrid({\n origin: projectionExtent ? getTopLeft(projectionExtent) : tileGrid.getOrigin(0),\n extent: extent || tileGrid.getExtent(),\n minZoom: minZoom,\n resolutions: getTileResolutions(projection, tileJSON.tileSize).slice(0, maxZoom + 1),\n tileSize: tileGrid.getTileSize(0)\n })\n };\n if (Array.isArray(tileJSONDoc.tiles)) {\n sourceOptions.urls = tileJSONDoc.tiles;\n } else {\n sourceOptions.url = tileJSONDoc.tiles;\n }\n return sourceOptions;\n}\nfunction getBackgroundColor(glLayer, resolution, options, functionCache) {\n const background = {\n id: glLayer.id,\n type: glLayer.type\n };\n const layout = glLayer.layout || {};\n const paint = glLayer.paint || {};\n background['paint'] = paint;\n const zoom = getZoomForResolution(resolution, options.resolutions || defaultResolutions);\n let bg, opacity;\n if (paint['background-color'] !== undefined) {\n bg = getValue(background, 'paint', 'background-color', zoom, emptyObj, functionCache);\n }\n if (paint['background-opacity'] !== undefined) {\n opacity = getValue(background, 'paint', 'background-opacity', zoom, emptyObj, functionCache);\n }\n return layout.visibility == 'none' ? undefined : colorWithOpacity(bg, opacity);\n}\n/**\n * @param {Object} glLayer Mapbox Style layer object.\n * @param {Options} options Options.\n * @param {Object} functionCache Cache for functions.\n * @return {Layer} OpenLayers layer.\n */\nfunction setupBackgroundLayer(glLayer, options, functionCache) {\n const div = document.createElement('div');\n div.className = 'ol-mapbox-style-background';\n div.style.position = 'absolute';\n div.style.width = '100%';\n div.style.height = '100%';\n return new Layer({\n source: new Source({}),\n render(frameState) {\n const color = getBackgroundColor(glLayer, frameState.viewState.resolution, options, functionCache);\n div.style.backgroundColor = color;\n return div;\n }\n });\n}\n/**\n * Creates an OpenLayers VectorTile source for a gl source entry.\n * @param {Object} glSource \"source\" entry from a Mapbox Style object.\n * @param {string|undefined} styleUrl URL to use for the source. This is expected to be the complete http(s) url,\n * with access key applied.\n * @param {Options} options Options.\n * @return {Promise} Promise resolving to a VectorTile source.\n * @private\n */\nfunction setupVectorSource(glSource, styleUrl, options) {\n return new Promise(function (resolve, reject) {\n getTileJson(glSource, styleUrl, options).then(function ({tileJson, tileLoadFunction}) {\n const sourceOptions = sourceOptionsFromTileJSON(glSource, tileJson, options);\n sourceOptions.tileLoadFunction = tileLoadFunction;\n sourceOptions.format = new MVT();\n resolve(new VectorTileSource(sourceOptions));\n }).catch(reject);\n });\n}\nfunction setupVectorLayer(glSource, styleUrl, options) {\n const layer = new VectorTileLayer({\n declutter: true,\n visible: false\n });\n setupVectorSource(glSource, styleUrl, options).then(function (source) {\n source.set('mapbox-source', glSource);\n layer.setSource(source);\n }).catch(function (error) {\n layer.setSource(undefined);\n });\n return layer;\n}\nfunction getBboxTemplate(projection) {\n const projCode = projection ? projection.getCode() : 'EPSG:3857';\n return `{bbox-${ projCode.toLowerCase().replace(/[^a-z0-9]/g, '-') }}`;\n}\nfunction setupRasterSource(glSource, styleUrl, options) {\n return new Promise(function (resolve, reject) {\n getTileJson(glSource, styleUrl, options).then(function ({tileJson, tileLoadFunction}) {\n const source = new TileJSON({\n interpolate: options.interpolate === undefined ? true : options.interpolate,\n transition: 0,\n crossOrigin: 'anonymous',\n tileJSON: tileJson\n });\n source.tileGrid = sourceOptionsFromTileJSON(glSource, tileJson, options).tileGrid;\n if (options.projection) {\n //@ts-ignore\n source.projection = get$1(options.projection);\n }\n const getTileUrl = source.getTileUrlFunction();\n if (tileLoadFunction) {\n source.setTileLoadFunction(tileLoadFunction);\n }\n source.setTileUrlFunction(function (tileCoord, pixelRatio, projection) {\n const bboxTemplate = getBboxTemplate(projection);\n let src = getTileUrl(tileCoord, pixelRatio, projection);\n if (src.indexOf(bboxTemplate) != -1) {\n const bbox = source.getTileGrid().getTileCoordExtent(tileCoord);\n src = src.replace(bboxTemplate, bbox.toString());\n }\n return src;\n });\n source.set('mapbox-source', glSource);\n resolve(source);\n }).catch(function (error) {\n reject(error);\n });\n });\n}\nfunction setupRasterLayer(glSource, styleUrl, options) {\n const layer = new TileLayer();\n setupRasterSource(glSource, styleUrl, options).then(function (source) {\n layer.setSource(source);\n }).catch(function () {\n layer.setSource(undefined);\n });\n return layer;\n}\n/**\n *\n * @param {Object} glSource \"source\" entry from a Mapbox Style object.\n * @param {string} styleUrl Style url\n * @param {Options} options ol-mapbox-style options.\n * @return {ImageLayer} The raster layer\n */\nfunction setupHillshadeLayer(glSource, styleUrl, options) {\n const tileLayer = setupRasterLayer(glSource, styleUrl, options);\n /** @type {ImageLayer} */\n const layer = new ImageLayer({\n source: new Raster({\n operationType: 'image',\n operation: hillshade,\n sources: [tileLayer]\n })\n });\n return layer;\n}\n/**\n * @param {Object} glSource glStyle source.\n * @param {string} styleUrl Style URL.\n * @param {Options} options Options.\n * @return {VectorSource} Configured vector source.\n */\nfunction setupGeoJSONSource(glSource, styleUrl, options) {\n const geoJsonFormat = options.projection ? new GeoJSON({ dataProjection: options.projection }) : new GeoJSON();\n const data = glSource.data;\n const sourceOptions = {};\n if (typeof data == 'string') {\n const geoJsonUrl = normalizeSourceUrl(data, options.accessToken, options.accessTokenParam || 'access_token', styleUrl || location.href);\n if (/\\{bbox-[0-9a-z-]+\\}/.test(geoJsonUrl)) {\n const extentUrl = (extent, resolution, projection) => {\n const bboxTemplate = getBboxTemplate(projection);\n return geoJsonUrl.replace(bboxTemplate, `${ extent.join(',') }`);\n };\n const source = new VectorSource({\n attributions: glSource.attribution,\n format: geoJsonFormat,\n loader: (extent, resolution, projection, success, failure) => {\n const url = typeof extentUrl === 'function' ? extentUrl(extent, resolution, projection) : extentUrl;\n fetchResource('GeoJSON', url, options).then(json => {\n const features = source.getFormat().readFeatures(json, { featureProjection: projection });\n source.addFeatures(features);\n success(features);\n }).catch(response => {\n source.removeLoadedExtent(extent);\n failure();\n });\n },\n strategy: bbox\n });\n source.set('mapbox-source', glSource);\n return source;\n }\n const source = new VectorSource({\n attributions: glSource.attribution,\n format: geoJsonFormat,\n url: geoJsonUrl,\n loader: (extent, resolution, projection, success, failure) => {\n fetchResource('GeoJSON', geoJsonUrl, options).then(json => {\n const features = source.getFormat().readFeatures(json, { featureProjection: projection });\n source.addFeatures(features);\n success(features);\n }).catch(response => {\n source.removeLoadedExtent(extent);\n failure();\n });\n }\n });\n return source;\n }\n sourceOptions.features = geoJsonFormat.readFeatures(data, { featureProjection: getUserProjection() || 'EPSG:3857' });\n const source = new VectorSource(Object.assign({\n attributions: glSource.attribution,\n format: geoJsonFormat\n }, sourceOptions));\n source.set('mapbox-source', glSource);\n return source;\n}\nfunction setupGeoJSONLayer(glSource, styleUrl, options) {\n return new VectorLayer({\n declutter: true,\n source: setupGeoJSONSource(glSource, styleUrl, options),\n visible: false\n });\n}\nfunction prerenderRasterLayer(glLayer, layer, functionCache) {\n let zoom = null;\n return function (event) {\n if (glLayer.paint && 'raster-opacity' in glLayer.paint && event.frameState.viewState.zoom !== zoom) {\n zoom = event.frameState.viewState.zoom;\n delete functionCache[glLayer.id];\n updateRasterLayerProperties(glLayer, layer, zoom, functionCache);\n }\n };\n}\nfunction updateRasterLayerProperties(glLayer, layer, zoom, functionCache) {\n const opacity = getValue(glLayer, 'paint', 'raster-opacity', zoom, emptyObj, functionCache);\n layer.setOpacity(opacity);\n}\nfunction manageVisibility(layer, mapOrGroup) {\n function onChange() {\n const glStyle = mapOrGroup.get('mapbox-style');\n if (!glStyle) {\n return;\n }\n const mapboxLayers = derefLayers(glStyle.layers);\n const layerMapboxLayerids = layer.get('mapbox-layers');\n const visible = mapboxLayers.filter(function (mapboxLayer) {\n return layerMapboxLayerids.includes(mapboxLayer.id);\n }).some(function (mapboxLayer) {\n return !mapboxLayer.layout || !mapboxLayer.layout.visibility || mapboxLayer.layout.visibility === 'visible';\n });\n if (layer.get('visible') !== visible) {\n layer.setVisible(visible);\n }\n }\n layer.on('change', onChange);\n onChange();\n}\nfunction setupLayer(glStyle, styleUrl, glLayer, options) {\n const functionCache = getFunctionCache(glStyle);\n const glLayers = glStyle.layers;\n const type = glLayer.type;\n const id = glLayer.source || getSourceIdByRef(glLayers, glLayer.ref);\n const glSource = glStyle.sources[id];\n let layer;\n if (type == 'background') {\n layer = setupBackgroundLayer(glLayer, options, functionCache);\n } else if (glSource.type == 'vector') {\n layer = setupVectorLayer(glSource, styleUrl, options);\n } else if (glSource.type == 'raster') {\n layer = setupRasterLayer(glSource, styleUrl, options);\n layer.setVisible(glLayer.layout ? glLayer.layout.visibility !== 'none' : true);\n layer.on('prerender', prerenderRasterLayer(glLayer, layer, functionCache));\n } else if (glSource.type == 'geojson') {\n layer = setupGeoJSONLayer(glSource, styleUrl, options);\n } else if (glSource.type == 'raster-dem' && glLayer.type == 'hillshade') {\n const hillshadeLayer = setupHillshadeLayer(glSource, styleUrl, options);\n layer = hillshadeLayer;\n hillshadeLayer.getSource().on('beforeoperations', function (event) {\n const data = event.data;\n data.resolution = event.resolution;\n const zoom = getZoomForResolution(event.resolution, options.resolutions || defaultResolutions);\n data.encoding = glSource.encoding;\n data.vert = 5 * getValue(glLayer, 'paint', 'hillshade-exaggeration', zoom, emptyObj, functionCache);\n data.sunAz = getValue(glLayer, 'paint', 'hillshade-illumination-direction', zoom, emptyObj, functionCache);\n data.sunEl = 35;\n data.opacity = 0.3;\n data.highlightColor = getValue(glLayer, 'paint', 'hillshade-highlight-color', zoom, emptyObj, functionCache);\n data.shadowColor = getValue(glLayer, 'paint', 'hillshade-shadow-color', zoom, emptyObj, functionCache);\n data.accentColor = getValue(glLayer, 'paint', 'hillshade-accent-color', zoom, emptyObj, functionCache);\n });\n layer.setVisible(glLayer.layout ? glLayer.layout.visibility !== 'none' : true);\n }\n const glSourceId = id;\n if (layer) {\n layer.set('mapbox-source', glSourceId);\n }\n return layer;\n}\n/**\n * @param {*} glStyle Mapbox Style.\n * @param {Map|LayerGroup} mapOrGroup Map or layer group.\n * @param {string} styleUrl Style URL.\n * @param {Options} options Options.\n * @return {Promise} Promise that resolves when the style is loaded.\n */\nfunction processStyle(glStyle, mapOrGroup, styleUrl, options) {\n const promises = [];\n let view = null;\n if (mapOrGroup instanceof Map) {\n view = mapOrGroup.getView();\n if (!view.isDef() && !view.getRotation() && !view.getResolutions()) {\n const projection = options.projection ? get$1(options.projection) : view.getProjection();\n view = new View(Object.assign(view.getProperties(), {\n maxResolution: defaultResolutions[0] / METERS_PER_UNIT[projection.getUnits()],\n projection: options.projection || view.getProjection()\n }));\n mapOrGroup.setView(view);\n }\n if ('center' in glStyle && !view.getCenter()) {\n view.setCenter(fromLonLat(glStyle.center, view.getProjection()));\n }\n if ('zoom' in glStyle && view.getZoom() === undefined) {\n view.setResolution(defaultResolutions[0] / METERS_PER_UNIT[view.getProjection().getUnits()] / Math.pow(2, glStyle.zoom));\n }\n if (!view.getCenter() || view.getZoom() === undefined) {\n view.fit(view.getProjection().getExtent(), {\n nearest: true,\n size: mapOrGroup.getSize()\n });\n }\n }\n mapOrGroup.set('mapbox-style', glStyle);\n mapOrGroup.set('mapbox-metadata', {\n styleUrl,\n options\n });\n const glLayers = glStyle.layers;\n let layerIds = [];\n let layer, glSourceId, id;\n for (let i = 0, ii = glLayers.length; i < ii; ++i) {\n const glLayer = glLayers[i];\n const type = glLayer.type;\n if (type == 'heatmap') {\n //FIXME Unsupported layer type\n throw new Error(`${ type } layers are not supported`);\n } else {\n id = glLayer.source || getSourceIdByRef(glLayers, glLayer.ref);\n // this technique assumes gl layers will be in a particular order\n if (!id || id != glSourceId) {\n if (layerIds.length) {\n promises.push(finalizeLayer(layer, layerIds, glStyle, styleUrl, mapOrGroup, options));\n layerIds = [];\n }\n layer = setupLayer(glStyle, styleUrl, glLayer, options);\n if (!(layer instanceof VectorLayer || layer instanceof VectorTileLayer)) {\n layerIds = [];\n }\n glSourceId = layer.get('mapbox-source');\n }\n layerIds.push(glLayer.id);\n }\n }\n promises.push(finalizeLayer(layer, layerIds, glStyle, styleUrl, mapOrGroup, options));\n return Promise.all(promises);\n}\n/**\n * Loads and applies a Mapbox Style object into an OpenLayers Map or LayerGroup.\n * This includes the map background, the layers, and for Map instances that did not\n * have a View defined yet also the center and the zoom.\n *\n * **Example:**\n * ```js\n * import apply from 'ol-mapbox-style';\n *\n * apply('map', 'mapbox://styles/mapbox/bright-v9', {accessToken: 'YOUR_MAPBOX_TOKEN'});\n * ```\n *\n * The center and zoom will only be set if present in the Mapbox Style document,\n * and if not already set on the OpenLayers map.\n *\n * Layers will be added to the OpenLayers map, without affecting any layers that\n * might already be set on the map.\n *\n * Layers added by `apply()` will have two additional properties:\n *\n * * `mapbox-source`: The `id` of the Mapbox Style document's source that the\n * OpenLayers layer was created from. Usually `apply()` creates one\n * OpenLayers layer per Mapbox Style source, unless the layer stack has\n * layers from different sources in between.\n * * `mapbox-layers`: The `id`s of the Mapbox Style document's layers that are\n * included in the OpenLayers layer.\n *\n * This function sets an additional `mapbox-style` property on the OpenLayers\n * Map or LayerGroup instance, which holds the Mapbox Style object.\n *\n * @param {Map|HTMLElement|string|LayerGroup} mapOrGroupOrElement Either an existing\n * OpenLayers Map instance, or a HTML element, or the id of a HTML element that will be\n * the target of a new OpenLayers Map, or a layer group. If layer group, styles\n * releated to the map and view will be ignored.\n * @param {string|Object} style JSON style object or style url pointing to a\n * Mapbox Style object. When using Mapbox APIs, the url is the `styleUrl`\n * shown in Mapbox Studio's \"share\" panel. In addition, the `accessToken` option\n * (see below) must be set.\n * When passed as JSON style object, all OpenLayers layers created by `apply()`\n * will be immediately available, but they may not have a source yet (i.e. when\n * they are defined by a TileJSON url in the Mapbox Style document). When passed\n * as style url, layers will be added to the map when the Mapbox Style document\n * is loaded and parsed.\n * @param {Options} options Options.\n * @return {Promise} A promise that resolves after all layers have been added to\n * the OpenLayers Map instance or LayerGroup, their sources set, and their styles applied. The\n * `resolve` callback will be called with the OpenLayers Map instance or LayerGroup as\n * argument.\n */\nfunction apply(mapOrGroupOrElement, style, options = {}) {\n let promise;\n /** @type {Map|LayerGroup} */\n let mapOrGroup;\n if (typeof mapOrGroupOrElement === 'string' || mapOrGroupOrElement instanceof HTMLElement) {\n mapOrGroup = new Map({ target: mapOrGroupOrElement });\n } else {\n mapOrGroup = mapOrGroupOrElement;\n }\n if (typeof style === 'string') {\n const styleUrl = style.startsWith('data:') ? location.href : normalizeStyleUrl(style, options.accessToken);\n options = completeOptions(styleUrl, options);\n promise = new Promise(function (resolve, reject) {\n getGlStyle(style, options).then(function (glStyle) {\n processStyle(glStyle, mapOrGroup, styleUrl, options).then(function () {\n resolve(mapOrGroup);\n }).catch(reject);\n }).catch(function (err) {\n reject(new Error(`Could not load ${ style }: ${ err.message }`));\n });\n });\n } else {\n promise = new Promise(function (resolve, reject) {\n processStyle(style, mapOrGroup, !options.styleUrl || options.styleUrl.startsWith('data:') ? location.href : normalizeStyleUrl(options.styleUrl, options.accessToken), options).then(function () {\n resolve(mapOrGroup);\n }).catch(reject);\n });\n }\n return promise;\n}\n/**\n * If layerIds is not empty, applies the style specified in glStyle to the layer,\n * and adds the layer to the map.\n *\n * The layer may not yet have a source when the function is called. If so, the style\n * is applied to the layer via a once listener on the 'change:source' event.\n *\n * @param {Layer} layer An OpenLayers layer instance.\n * @param {Array} layerIds Array containing layer ids of already-processed layers.\n * @param {Object} glStyle Style as a JSON object.\n * @param {string|undefined} styleUrl The original style URL. Only required\n * when a relative path is used with the `\"sprite\"` property of the style.\n * @param {Map|LayerGroup} mapOrGroup OpenLayers Map.\n * @param {Options} options Options.\n * @return {Promise} Returns a promise that resolves after the source has\n * been set on the specified layer, and the style has been applied.\n */\nfunction finalizeLayer(layer, layerIds, glStyle, styleUrl, mapOrGroup, options = {}) {\n let minZoom = 24;\n let maxZoom = 0;\n const glLayers = glStyle.layers;\n for (let i = 0, ii = glLayers.length; i < ii; ++i) {\n const glLayer = glLayers[i];\n if (layerIds.indexOf(glLayer.id) !== -1) {\n minZoom = Math.min('minzoom' in glLayer ? glLayer.minzoom : 0, minZoom);\n maxZoom = Math.max('maxzoom' in glLayer ? glLayer.maxzoom : 24, maxZoom);\n }\n }\n return new Promise(function (resolve, reject) {\n const setStyle = function () {\n const source = layer.getSource();\n if (!source || source.getState() === 'error') {\n reject(new Error('Error accessing data for source ' + layer.get('mapbox-source')));\n return;\n }\n if ('getTileGrid' in source) {\n const tileGrid = /** @type {import(\"ol/source/Tile.js\").default|import(\"ol/source/VectorTile.js\").default} */\n source.getTileGrid();\n if (tileGrid) {\n const sourceMinZoom = tileGrid.getMinZoom();\n if (minZoom > 0 || sourceMinZoom > 0) {\n layer.setMaxResolution(Math.min(defaultResolutions[minZoom], tileGrid.getResolution(sourceMinZoom)) + 1e-9);\n }\n if (maxZoom < 24) {\n layer.setMinResolution(defaultResolutions[maxZoom] + 1e-9);\n }\n }\n } else {\n if (minZoom > 0) {\n layer.setMaxResolution(defaultResolutions[minZoom] + 1e-9);\n }\n }\n if (source instanceof VectorSource || source instanceof VectorTileSource) {\n applyStyle(layer, glStyle, layerIds, Object.assign({ styleUrl: styleUrl }, options)).then(function () {\n manageVisibility(layer, mapOrGroup);\n resolve();\n }).catch(reject);\n } else {\n resolve();\n }\n };\n layer.set('mapbox-layers', layerIds);\n const layers = mapOrGroup.getLayers();\n if (layers.getArray().indexOf(layer) === -1) {\n layers.push(layer);\n }\n if (layer.getSource()) {\n setStyle();\n } else {\n layer.once('change:source', setStyle);\n }\n });\n}\n/**\n * Get the Mapbox Layer object for the provided `layerId`.\n * @param {Map|LayerGroup} mapOrGroup Map or LayerGroup.\n * @param {string} layerId Mapbox Layer id.\n * @return {Object} Mapbox Layer object.\n */\nfunction getMapboxLayer(mapOrGroup, layerId) {\n const style = mapOrGroup.get('mapbox-style');\n const layerStyle = style.layers.find(function (layer) {\n return layer.id === layerId;\n });\n return layerStyle;\n}\n/**\n * Add a new Mapbox Layer object to the style. The map will be re-rendered.\n * @param {Map|LayerGroup} mapOrGroup The Map or LayerGroup `apply` was called on.\n * @param {Object} mapboxLayer Mapbox Layer object.\n * @param {string} [beforeLayerId] Optional id of the Mapbox Layer before the new layer that will be added.\n * @return {Promise} Resolves when the added layer is available.\n */\nfunction addMapboxLayer(mapOrGroup, mapboxLayer, beforeLayerId) {\n const glStyle = mapOrGroup.get('mapbox-style');\n const mapboxLayers = glStyle.layers;\n let spliceIndex;\n let sourceIndex = -1;\n if (beforeLayerId !== undefined) {\n const beforeMapboxLayer = getMapboxLayer(mapOrGroup, beforeLayerId);\n if (beforeMapboxLayer === undefined) {\n throw new Error(`Layer with id \"${ beforeLayerId }\" not found.`);\n }\n spliceIndex = mapboxLayers.indexOf(beforeMapboxLayer);\n } else {\n spliceIndex = mapboxLayers.length;\n }\n let sourceOffset;\n if (spliceIndex > 0 && mapboxLayers[spliceIndex - 1].source === mapboxLayer.source) {\n sourceIndex = spliceIndex - 1;\n sourceOffset = -1;\n } else if (spliceIndex < mapboxLayers.length && mapboxLayers[spliceIndex].source === mapboxLayer.source) {\n sourceIndex = spliceIndex;\n sourceOffset = 0;\n }\n if (sourceIndex === -1) {\n const {options, styleUrl} = mapOrGroup.get('mapbox-metadata');\n const layer = setupLayer(glStyle, styleUrl, mapboxLayer, options);\n if (beforeLayerId) {\n const beforeLayer = getLayer(mapOrGroup, beforeLayerId);\n const beforeLayerIndex = mapOrGroup.getLayers().getArray().indexOf(beforeLayer);\n mapOrGroup.getLayers().insertAt(beforeLayerIndex, layer);\n }\n mapboxLayers.splice(spliceIndex, 0, mapboxLayer);\n return finalizeLayer(layer, [mapboxLayer.id], glStyle, styleUrl, mapOrGroup, options);\n }\n if (mapboxLayers.some(layer => layer.id === mapboxLayer.id)) {\n throw new Error(`Layer with id \"${ mapboxLayer.id }\" already exists.`);\n }\n const sourceLayerId = mapboxLayers[sourceIndex].id;\n const args = styleFunctionArgs[getStyleFunctionKey(mapOrGroup.get('mapbox-style'), getLayer(mapOrGroup, sourceLayerId))];\n mapboxLayers.splice(spliceIndex, 0, mapboxLayer);\n if (args) {\n const [olLayer, glStyle, sourceOrLayers, resolutions, spriteData, spriteImageUrl, getFonts, getImage] = args;\n if (Array.isArray(sourceOrLayers)) {\n const layerIndex = sourceOrLayers.indexOf(sourceLayerId) + sourceOffset;\n sourceOrLayers.splice(layerIndex, 0, mapboxLayer.id);\n }\n stylefunction(olLayer, glStyle, sourceOrLayers, resolutions, spriteData, spriteImageUrl, getFonts, getImage);\n } else {\n getLayer(mapOrGroup, mapboxLayers[sourceIndex].id).changed();\n }\n return Promise.resolve();\n}\n/**\n * Update a Mapbox Layer object in the style. The map will be re-rendered with the new style.\n * @param {Map|LayerGroup} mapOrGroup The Map or LayerGroup `apply` was called on.\n * @param {Object} mapboxLayer Updated Mapbox Layer object.\n */\nfunction updateMapboxLayer(mapOrGroup, mapboxLayer) {\n const glStyle = mapOrGroup.get('mapbox-style');\n const mapboxLayers = glStyle.layers;\n const index = mapboxLayers.findIndex(function (layer) {\n return layer.id === mapboxLayer.id;\n });\n if (index === -1) {\n throw new Error(`Layer with id \"${ mapboxLayer.id }\" not found.`);\n }\n const oldLayer = mapboxLayers[index];\n if (oldLayer.source !== mapboxLayer.source) {\n throw new Error('Updated layer and previous version must use the same source.');\n }\n delete getFunctionCache(glStyle)[mapboxLayer.id];\n delete getFilterCache(glStyle)[mapboxLayer.id];\n mapboxLayers[index] = mapboxLayer;\n const args = styleFunctionArgs[getStyleFunctionKey(mapOrGroup.get('mapbox-style'), getLayer(mapOrGroup, mapboxLayer.id))];\n if (args) {\n stylefunction.apply(undefined, args);\n } else {\n getLayer(mapOrGroup, mapboxLayer.id).changed();\n }\n}\n/**\n * Updates a Mapbox source object in the style. The according OpenLayers source will be replaced\n * and the map will be re-rendered.\n * @param {Map|LayerGroup} mapOrGroup The Map or LayerGroup `apply` was called on.\n * @param {string} id Key of the source in the `sources` object literal.\n * @param {Object} mapboxSource Mapbox source object.\n * @return {Promise} Promise that resolves when the source has been updated.\n */\nfunction updateMapboxSource(mapOrGroup, id, mapboxSource) {\n const currentSource = getSource(mapOrGroup, id);\n const layers = mapOrGroup.getLayers().getArray().filter(function (layer) {\n return (layer instanceof VectorLayer || layer instanceof TileLayer || layer instanceof VectorTileLayer) && layer.getSource() === currentSource;\n });\n const metadata = mapOrGroup.get('mapbox-metadata');\n let newSourcePromise;\n switch (mapboxSource.type) {\n case 'vector':\n newSourcePromise = setupVectorSource(mapboxSource, metadata.styleUrl, metadata.options);\n break;\n case 'geojson':\n newSourcePromise = Promise.resolve(setupGeoJSONSource(mapboxSource, metadata.styleUrl, metadata.options));\n break;\n case 'raster':\n case 'raster-dem':\n newSourcePromise = setupRasterSource(mapboxSource, metadata.styleUrl, metadata.options);\n break;\n default:\n return Promise.reject(new Error('Unsupported source type ' + mapboxSource.type));\n }\n newSourcePromise.then(function (newSource) {\n layers.forEach(function (layer) {\n layer.setSource(newSource);\n });\n });\n return newSourcePromise;\n}\n/**\n * Remove a Mapbox Layer object from the style. The map will be re-rendered.\n * @param {Map|LayerGroup} mapOrGroup The Map or LayerGroup `apply` was called on.\n * @param {string|Object} mapboxLayerIdOrLayer Mapbox Layer id or Mapbox Layer object.\n */\nfunction removeMapboxLayer(mapOrGroup, mapboxLayerIdOrLayer) {\n const mapboxLayerId = typeof mapboxLayerIdOrLayer === 'string' ? mapboxLayerIdOrLayer : mapboxLayerIdOrLayer.id;\n const layer = getLayer(mapOrGroup, mapboxLayerId);\n /** @type {Array} */\n const layerMapboxLayers = layer.get('mapbox-layers');\n if (layerMapboxLayers.length === 1) {\n throw new Error('Cannot remove last Mapbox layer from an OpenLayers layer.');\n }\n layerMapboxLayers.splice(layerMapboxLayers.indexOf(mapboxLayerId), 1);\n const glStyle = mapOrGroup.get('mapbox-style');\n const layers = glStyle.layers;\n layers.splice(layers.findIndex(layer => layer.id === mapboxLayerId), 1);\n const args = styleFunctionArgs[getStyleFunctionKey(glStyle, layer)];\n if (args) {\n const [olLayer, glStyle, sourceOrLayers, resolutions, spriteData, spriteImageUrl, getFonts, getImage] = args;\n if (Array.isArray(sourceOrLayers)) {\n sourceOrLayers.splice(sourceOrLayers.findIndex(layer => layer === mapboxLayerId), 1);\n }\n stylefunction(olLayer, glStyle, sourceOrLayers, resolutions, spriteData, spriteImageUrl, getFonts, getImage);\n } else {\n getLayer(mapOrGroup, mapboxLayerId).changed();\n }\n}\n/**\n * Get the OpenLayers layer instance that contains the provided Mapbox Style\n * `layer`. Note that multiple Mapbox Style layers are combined in a single\n * OpenLayers layer instance when they use the same Mapbox Style `source`.\n * @param {Map|LayerGroup} map OpenLayers Map or LayerGroup.\n * @param {string} layerId Mapbox Style layer id.\n * @return {Layer} OpenLayers layer instance.\n */\nfunction getLayer(map, layerId) {\n const layers = map.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const mapboxLayers = layers[i].get('mapbox-layers');\n if (mapboxLayers && mapboxLayers.indexOf(layerId) !== -1) {\n return layers[i];\n }\n }\n return undefined;\n}\n/**\n * Get the OpenLayers layer instances for the provided Mapbox Style `source`.\n * @param {Map|LayerGroup} map OpenLayers Map or LayerGroup.\n * @param {string} sourceId Mapbox Style source id.\n * @return {Array} OpenLayers layer instances.\n */\nfunction getLayers(map, sourceId) {\n const result = [];\n const layers = map.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n if (layers[i].get('mapbox-source') === sourceId) {\n result.push(layers[i]);\n }\n }\n return result;\n}\n/**\n * Get the OpenLayers source instance for the provided Mapbox Style `source`.\n * @param {Map|LayerGroup} map OpenLayers Map or LayerGroup.\n * @param {string} sourceId Mapbox Style source id.\n * @return {Source} OpenLayers source instance.\n */\nfunction getSource(map, sourceId) {\n const layers = map.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const source = /** @type {Layer} */\n layers[i].getSource();\n if (layers[i].get('mapbox-source') === sourceId) {\n return source;\n }\n }\n return undefined;\n}\n/**\n * Sets or removes a feature state. The feature state is taken into account for styling,\n * just like the feature's properties, and can be used e.g. to conditionally render selected\n * features differently.\n *\n * The feature state will be stored on the OpenLayers layer matching the feature identifier, in the\n * `mapbox-featurestate` property.\n * @param {Map|VectorLayer|VectorTileLayer} mapOrLayer OpenLayers Map or layer to set the feature\n * state on.\n * @param {FeatureIdentifier} feature Feature identifier.\n * @param {Object|null} state Feature state. Set to `null` to remove the feature state.\n */\nfunction setFeatureState(mapOrLayer, feature, state) {\n const layers = 'getLayers' in mapOrLayer ? getLayers(mapOrLayer, feature.source) : [mapOrLayer];\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const featureState = layers[i].get('mapbox-featurestate');\n if (featureState) {\n if (state) {\n featureState[feature.id] = state;\n } else {\n delete featureState[feature.id];\n }\n layers[i].changed();\n } else {\n throw new Error(`Map or layer for source \"${ feature.source }\" not found.`);\n }\n }\n}\n/**\n * Sets or removes a feature state. The feature state is taken into account for styling,\n * just like the feature's properties, and can be used e.g. to conditionally render selected\n * features differently.\n * @param {Map|VectorLayer|VectorTileLayer} mapOrLayer Map or layer to set the feature state on.\n * @param {FeatureIdentifier} feature Feature identifier.\n * @return {Object|null} Feature state or `null` when no feature state is set for the given\n * feature identifier.\n */\nfunction getFeatureState(mapOrLayer, feature) {\n const layers = 'getLayers' in mapOrLayer ? getLayers(mapOrLayer, feature.source) : [mapOrLayer];\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n const featureState = layers[i].get('mapbox-featurestate');\n if (featureState && featureState[feature.id]) {\n return featureState[feature.id];\n }\n }\n return undefined;\n}\n\n/** @typedef {import(\"ol/Map.js\").default} Map */\n/**\n * @classdesc\n * Event emitted on configuration or loading error.\n */\nclass ErrorEvent extends BaseEvent {\n /**\n * @param {Error} error error object.\n */\n constructor(error) {\n super(EventType.ERROR);\n /**\n * @type {Error}\n */\n this.error = error;\n }\n}\n/**\n * @typedef {Object} Options\n * @property {string} styleUrl The URL of the Mapbox style object to use for this layer. For a\n * style created with Mapbox Studio and hosted on Mapbox, this will look like\n * 'mapbox://styles/you/your-style'.\n * @property {string} [accessToken] The access token for your Mapbox style. This has to be provided\n * for `mapbox://` style urls. For `https://` and other urls, any access key must be the last query\n * parameter of the style url.\n * @property {string} [source] If your style uses more than one source, you need to use either the\n * `source` property or the `layers` property to limit rendering to a single vector source. The\n * `source` property corresponds to the id of a vector source in your Mapbox style.\n * @property {Array} [layers] Limit rendering to the list of included layers. All layers\n * must share the same vector source. If your style uses more than one source, you need to use\n * either the `source` property or the `layers` property to limit rendering to a single vector\n * source.\n * @property {boolean} [declutter=true] Declutter images and text. Decluttering is applied to all\n * image and text styles of all Vector and VectorTile layers that have set this to `true`. The priority\n * is defined by the z-index of the layer, the `zIndex` of the style and the render order of features.\n * Higher z-index means higher priority. Within the same z-index, a feature rendered before another has\n * higher priority.\n *\n * As an optimization decluttered features from layers with the same `className` are rendered above\n * the fill and stroke styles of all of those layers regardless of z-index. To opt out of this\n * behavior and place declutterd features with their own layer configure the layer with a `className`\n * other than `ol-layer`.\n * @property {import(\"ol/layer/Base.js\").BackgroundColor|false} [background] Background color for the layer.\n * If not specified, the background from the Mapbox style object will be used. Set to `false` to prevent\n * the Mapbox style's background from being used.\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"ol/extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible. If neither `maxResolution` nor `minZoom` are defined, the layer's `maxResolution` will\n * match the style source's `minzoom`.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will\n * be visible. If neither `maxResolution` nor `minZoom` are defined, the layer's `minZoom` will match\n * the style source's `minzoom`.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"ol/render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the tile extent used by the\n * renderer when getting features from the vector tile for the rendering or hit-detection.\n * Recommended value: Vector tiles are usually generated with a buffer, so this value should match\n * the largest possible buffer of the used tiles. It should be at least the size of the largest\n * point symbol or line width.\n * @property {import(\"ol/layer/VectorTile.js\").VectorTileRenderType} [renderMode='hybrid'] Render mode for vector tiles:\n * * `'hybrid'`: Polygon and line elements are rendered as images, so pixels are scaled during zoom\n * animations. Point symbols and texts are accurately rendered as vectors and can stay upright on\n * rotated views.\n * * `'vector'`: Everything is rendered as vectors. Use this mode for improved performance on vector\n * tile layers with only a few rendered features (e.g. for highlighting a subset of features of\n * another layer with the same source).\n * @property {import(\"ol/Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use `map.addLayer()`.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will be\n * recreated during animations. This means that no vectors will be shown clipped, but the setting\n * will have a performance impact for large amounts of vector data. When set to `false`, batches\n * will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will be\n * recreated during interactions. See also `updateWhileAnimating`.\n * @property {number} [preload=0] Preload. Load low-resolution tiles up to `preload` levels. `0`\n * means no preloading.\n * @property {boolean} [useInterimTilesOnError=true] Use interim tiles on error.\n * @property {Object} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n/**\n * @classdesc\n * ```js\n * import {MapboxVectorLayer} from 'ol-mapbox-style';\n * ```\n * A vector tile layer based on a Mapbox style that uses a single vector source. Configure\n * the layer with the `styleUrl` and `accessToken` shown in Mapbox Studio's share panel.\n * If the style uses more than one source, use the `source` property to choose a single\n * vector source. If you want to render a subset of the layers in the style, use the `layers`\n * property (all layers must share the same vector source). See the constructor options for\n * more detail.\n *\n * const map = new Map({\n * view: new View({\n * center: [0, 0],\n * zoom: 1,\n * }),\n * layers: [\n * new MapboxVectorLayer({\n * styleUrl: 'mapbox://styles/mapbox/bright-v9',\n * accessToken: 'your-mapbox-access-token-here',\n * }),\n * ],\n * target: 'map',\n * });\n *\n * On configuration or loading error, the layer will trigger an `'error'` event. Listeners\n * will receive an object with an `error` property that can be used to diagnose the problem.\n *\n * **Note for users of the full build**: The `MapboxVectorLayer` requires the\n * [ol-mapbox-style](https://github.com/openlayers/ol-mapbox-style) library to be loaded as well.\n *\n * @param {Options} options Options.\n * @extends {VectorTileLayer}\n * @fires module:ol/events/Event~BaseEvent#event:error\n * @api\n */\nclass MapboxVectorLayer extends VectorTileLayer {\n /**\n * @param {Options} options Layer options. At a minimum, `styleUrl` and `accessToken`\n * must be provided.\n */\n constructor(options) {\n const declutter = 'declutter' in options ? options.declutter : true;\n const source = new VectorTileSource({\n state: 'loading',\n format: new MVT()\n });\n super({\n source: source,\n background: options.background,\n declutter: declutter,\n className: options.className,\n opacity: options.opacity,\n visible: options.visible,\n zIndex: options.zIndex,\n minResolution: options.minResolution,\n maxResolution: options.maxResolution,\n minZoom: options.minZoom,\n maxZoom: options.maxZoom,\n renderOrder: options.renderOrder,\n renderBuffer: options.renderBuffer,\n renderMode: options.renderMode,\n map: options.map,\n updateWhileAnimating: options.updateWhileAnimating,\n updateWhileInteracting: options.updateWhileInteracting,\n preload: options.preload,\n useInterimTilesOnError: options.useInterimTilesOnError,\n properties: options.properties\n });\n if (options.accessToken) {\n this.accessToken = options.accessToken;\n }\n const url = options.styleUrl;\n const promises = [applyStyle(this, url, options.layers || options.source, { accessToken: this.accessToken })];\n if (this.getBackground() === undefined) {\n promises.push(applyBackground(this, options.styleUrl, { accessToken: this.accessToken }));\n }\n Promise.all(promises).then(() => {\n source.setState('ready');\n }).catch(error => {\n this.dispatchEvent(new ErrorEvent(error));\n const source = this.getSource();\n source.setState('error');\n });\n }\n}\n\nexport { MapboxVectorLayer, addMapboxLayer, apply, applyBackground, applyStyle, apply as default, getFeatureState, getLayer, getLayers, getMapboxLayer, getSource, getStyleForLayer, recordStyleLayer, removeMapboxLayer, renderTransparent, setFeatureState, stylefunction, updateMapboxLayer, updateMapboxSource };\n//# sourceMappingURL=index.js.map\n","/**\n * @module ol/Collection\n */\nimport BaseObject from './Object.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport Event from './events/Event.js';\n\n/**\n * @enum {string}\n * @private\n */\nconst Property = {\n LENGTH: 'length',\n};\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Collection~Collection} instances are instances of this\n * type.\n * @template T\n */\nexport class CollectionEvent extends Event {\n /**\n * @param {import(\"./CollectionEventType.js\").default} type Type.\n * @param {T} element Element.\n * @param {number} index The index of the added or removed element.\n */\n constructor(type, element, index) {\n super(type);\n\n /**\n * The element that is added to or removed from the collection.\n * @type {T}\n * @api\n */\n this.element = element;\n\n /**\n * The index of the added or removed element.\n * @type {number}\n * @api\n */\n this.index = index;\n }\n}\n\n/***\n * @template T\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'add'|'remove', CollectionEvent, Return> &\n * import(\"./Observable\").CombinedOnSignature} CollectionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [unique=false] Disallow the same item from being added to\n * the collection twice.\n */\n\n/**\n * @classdesc\n * An expanded version of standard JS Array, adding convenience methods for\n * manipulation. Add and remove changes to the Collection trigger a Collection\n * event. Note that this does not cover changes to the objects _within_ the\n * Collection; they trigger events on the appropriate object, not on the\n * Collection as a whole.\n *\n * @fires CollectionEvent\n *\n * @template T\n * @api\n */\nclass Collection extends BaseObject {\n /**\n * @param {Array} [array] Array.\n * @param {Options} [options] Collection options.\n */\n constructor(array, options) {\n super();\n\n /***\n * @type {CollectionOnSignature}\n */\n this.on;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.once;\n\n /***\n * @type {CollectionOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * @private\n * @type {boolean}\n */\n this.unique_ = !!options.unique;\n\n /**\n * @private\n * @type {!Array}\n */\n this.array_ = array ? array : [];\n\n if (this.unique_) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n this.assertUnique_(this.array_[i], i);\n }\n }\n\n this.updateLength_();\n }\n\n /**\n * Remove all elements from the collection.\n * @api\n */\n clear() {\n while (this.getLength() > 0) {\n this.pop();\n }\n }\n\n /**\n * Add elements to the collection. This pushes each item in the provided array\n * to the end of the collection.\n * @param {!Array} arr Array.\n * @return {Collection} This collection.\n * @api\n */\n extend(arr) {\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n this.push(arr[i]);\n }\n return this;\n }\n\n /**\n * Iterate over each element, calling the provided callback.\n * @param {function(T, number, Array): *} f The function to call\n * for every element. This function takes 3 arguments (the element, the\n * index and the array). The return value is ignored.\n * @api\n */\n forEach(f) {\n const array = this.array_;\n for (let i = 0, ii = array.length; i < ii; ++i) {\n f(array[i], i, array);\n }\n }\n\n /**\n * Get a reference to the underlying Array object. Warning: if the array\n * is mutated, no events will be dispatched by the collection, and the\n * collection's \"length\" property won't be in sync with the actual length\n * of the array.\n * @return {!Array} Array.\n * @api\n */\n getArray() {\n return this.array_;\n }\n\n /**\n * Get the element at the provided index.\n * @param {number} index Index.\n * @return {T} Element.\n * @api\n */\n item(index) {\n return this.array_[index];\n }\n\n /**\n * Get the length of this collection.\n * @return {number} The length of the array.\n * @observable\n * @api\n */\n getLength() {\n return this.get(Property.LENGTH);\n }\n\n /**\n * Insert an element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n insertAt(index, elem) {\n if (index < 0 || index > this.getLength()) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n this.array_.splice(index, 0, elem);\n this.updateLength_();\n this.dispatchEvent(\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n );\n }\n\n /**\n * Remove the last element of the collection and return it.\n * Return `undefined` if the collection is empty.\n * @return {T|undefined} Element.\n * @api\n */\n pop() {\n return this.removeAt(this.getLength() - 1);\n }\n\n /**\n * Insert the provided element at the end of the collection.\n * @param {T} elem Element.\n * @return {number} New length of the collection.\n * @api\n */\n push(elem) {\n if (this.unique_) {\n this.assertUnique_(elem);\n }\n const n = this.getLength();\n this.insertAt(n, elem);\n return this.getLength();\n }\n\n /**\n * Remove the first occurrence of an element from the collection.\n * @param {T} elem Element.\n * @return {T|undefined} The removed element or undefined if none found.\n * @api\n */\n remove(elem) {\n const arr = this.array_;\n for (let i = 0, ii = arr.length; i < ii; ++i) {\n if (arr[i] === elem) {\n return this.removeAt(i);\n }\n }\n return undefined;\n }\n\n /**\n * Remove the element at the provided index and return it.\n * Return `undefined` if the collection does not contain this index.\n * @param {number} index Index.\n * @return {T|undefined} Value.\n * @api\n */\n removeAt(index) {\n if (index < 0 || index >= this.getLength()) {\n return undefined;\n }\n const prev = this.array_[index];\n this.array_.splice(index, 1);\n this.updateLength_();\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n )\n );\n return prev;\n }\n\n /**\n * Set the element at the provided index.\n * @param {number} index Index.\n * @param {T} elem Element.\n * @api\n */\n setAt(index, elem) {\n const n = this.getLength();\n if (index >= n) {\n this.insertAt(index, elem);\n return;\n }\n if (index < 0) {\n throw new Error('Index out of bounds: ' + index);\n }\n if (this.unique_) {\n this.assertUnique_(elem, index);\n }\n const prev = this.array_[index];\n this.array_[index] = elem;\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.REMOVE, prev, index)\n )\n );\n this.dispatchEvent(\n /** @type {CollectionEvent} */ (\n new CollectionEvent(CollectionEventType.ADD, elem, index)\n )\n );\n }\n\n /**\n * @private\n */\n updateLength_() {\n this.set(Property.LENGTH, this.array_.length);\n }\n\n /**\n * @private\n * @param {T} elem Element.\n * @param {number} [except] Optional index to ignore.\n */\n assertUnique_(elem, except) {\n for (let i = 0, ii = this.array_.length; i < ii; ++i) {\n if (this.array_[i] === elem && i !== except) {\n throw new Error('Duplicate item added to a unique collection');\n }\n }\n }\n}\n\nexport default Collection;\n","/**\n * @module ol/CollectionEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when an item is added to the collection.\n * @event module:ol/Collection.CollectionEvent#add\n * @api\n */\n ADD: 'add',\n /**\n * Triggered when an item is removed from the collection.\n * @event module:ol/Collection.CollectionEvent#remove\n * @api\n */\n REMOVE: 'remove',\n};\n","/**\n * @module ol/DataTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\n\n/**\n * @typedef {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap} ImageLike\n */\n\n/**\n * @typedef {Uint8Array|Uint8ClampedArray|Float32Array|DataView} ArrayLike\n */\n\n/**\n * Data that can be used with a DataTile.\n * @typedef {ArrayLike|ImageLike} Data\n */\n\n/**\n * @param {Data} data Tile data.\n * @return {ImageLike|null} The image-like data.\n */\nexport function asImageLike(data) {\n return data instanceof Image ||\n data instanceof HTMLCanvasElement ||\n data instanceof HTMLVideoElement ||\n data instanceof ImageBitmap\n ? data\n : null;\n}\n\n/**\n * @param {Data} data Tile data.\n * @return {ArrayLike|null} The array-like data.\n */\nexport function asArrayLike(data) {\n return data instanceof Uint8Array ||\n data instanceof Uint8ClampedArray ||\n data instanceof Float32Array ||\n data instanceof DataView\n ? data\n : null;\n}\n\n/**\n * @type {CanvasRenderingContext2D|null}\n */\nlet sharedContext = null;\n\n/**\n * @param {ImageLike} image The image.\n * @return {Uint8ClampedArray} The data.\n */\nexport function toArray(image) {\n if (!sharedContext) {\n sharedContext = createCanvasContext2D(\n image.width,\n image.height,\n undefined,\n {willReadFrequently: true}\n );\n }\n const canvas = sharedContext.canvas;\n const width = image.width;\n if (canvas.width !== width) {\n canvas.width = width;\n }\n const height = image.height;\n if (canvas.height !== height) {\n canvas.height = height;\n }\n sharedContext.clearRect(0, 0, width, height);\n sharedContext.drawImage(image, 0, 0);\n return sharedContext.getImageData(0, 0, width, height).data;\n}\n\n/**\n * @type {import('./size.js').Size}\n */\nconst defaultSize = [256, 256];\n\n/**\n * @typedef {Object} Options\n * @property {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @property {function(): Promise} loader Data loader. For loaders that generate images,\n * the promise should not resolve until the image is loaded.\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @property {import('./size.js').Size} [size=[256, 256]] Tile size.\n * @api\n */\n\nclass DataTile extends Tile {\n /**\n * @param {Options} options Tile options.\n */\n constructor(options) {\n const state = TileState.IDLE;\n\n super(options.tileCoord, state, {\n transition: options.transition,\n interpolate: options.interpolate,\n });\n\n /**\n * @type {function(): Promise}\n * @private\n */\n this.loader_ = options.loader;\n\n /**\n * @type {Data}\n * @private\n */\n this.data_ = null;\n\n /**\n * @type {Error}\n * @private\n */\n this.error_ = null;\n\n /**\n * @type {import('./size.js').Size|null}\n * @private\n */\n this.size_ = options.size || null;\n }\n\n /**\n * Get the tile size.\n * @return {import('./size.js').Size} Tile size.\n */\n getSize() {\n if (this.size_) {\n return this.size_;\n }\n const imageData = asImageLike(this.data_);\n if (imageData) {\n return [imageData.width, imageData.height];\n }\n return defaultSize;\n }\n\n /**\n * Get the data for the tile.\n * @return {Data} Tile data.\n * @api\n */\n getData() {\n return this.data_;\n }\n\n /**\n * Get any loading error.\n * @return {Error} Loading error.\n * @api\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Load not yet loaded URI.\n * @api\n */\n load() {\n if (this.state !== TileState.IDLE && this.state !== TileState.ERROR) {\n return;\n }\n this.state = TileState.LOADING;\n this.changed();\n\n const self = this;\n this.loader_()\n .then(function (data) {\n self.data_ = data;\n self.state = TileState.LOADED;\n self.changed();\n })\n .catch(function (error) {\n self.error_ = error;\n self.state = TileState.ERROR;\n self.changed();\n });\n }\n}\n\nexport default DataTile;\n","/**\n * @module ol/Disposable\n */\n\n/**\n * @classdesc\n * Objects that need to clean up after themselves.\n */\nclass Disposable {\n constructor() {\n /**\n * The object has already been disposed.\n * @type {boolean}\n * @protected\n */\n this.disposed = false;\n }\n\n /**\n * Clean up.\n */\n dispose() {\n if (!this.disposed) {\n this.disposed = true;\n this.disposeInternal();\n }\n }\n\n /**\n * Extension point for disposable objects.\n * @protected\n */\n disposeInternal() {}\n}\n\nexport default Disposable;\n","/**\n * @module ol/Feature\n */\nimport BaseObject from './Object.js';\nimport EventType from './events/EventType.js';\nimport {assert} from './asserts.js';\nimport {listen, unlistenByKey} from './events.js';\n\n/**\n * @typedef {typeof Feature|typeof import(\"./render/Feature.js\").default} FeatureClass\n */\n\n/**\n * @typedef {Feature|import(\"./render/Feature.js\").default} FeatureLike\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} FeatureOnSignature\n */\n\n/***\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n * @typedef {Object & { geometry?: Geometry }} ObjectWithGeometry\n */\n\n/**\n * @classdesc\n * A vector object for geographic features with a geometry and other\n * attribute properties, similar to the features in vector file formats like\n * GeoJSON.\n *\n * Features can be styled individually with `setStyle`; otherwise they use the\n * style of their vector layer.\n *\n * Note that attribute properties are set as {@link module:ol/Object~BaseObject} properties on\n * the feature object, so they are observable, and have get/set accessors.\n *\n * Typically, a feature has a single geometry property. You can set the\n * geometry using the `setGeometry` method and get it with `getGeometry`.\n * It is possible to store more than one geometry on a feature using attribute\n * properties. By default, the geometry used for rendering is identified by\n * the property name `geometry`. If you want to use another geometry property\n * for rendering, use the `setGeometryName` method to change the attribute\n * property associated with the geometry for the feature. For example:\n *\n * ```js\n *\n * import Feature from 'ol/Feature.js';\n * import Polygon from 'ol/geom/Polygon.js';\n * import Point from 'ol/geom/Point.js';\n *\n * const feature = new Feature({\n * geometry: new Polygon(polyCoords),\n * labelPoint: new Point(labelCoords),\n * name: 'My Polygon',\n * });\n *\n * // get the polygon geometry\n * const poly = feature.getGeometry();\n *\n * // Render the feature as a point using the coordinates from labelPoint\n * feature.setGeometryName('labelPoint');\n *\n * // get the point geometry\n * const point = feature.getGeometry();\n * ```\n *\n * @api\n * @template {import(\"./geom/Geometry.js\").default} [Geometry=import(\"./geom/Geometry.js\").default]\n */\nclass Feature extends BaseObject {\n /**\n * @param {Geometry|ObjectWithGeometry} [geometryOrProperties]\n * You may pass a Geometry object directly, or an object literal containing\n * properties. If you pass an object literal, you may include a Geometry\n * associated with a `geometry` key.\n */\n constructor(geometryOrProperties) {\n super();\n\n /***\n * @type {FeatureOnSignature}\n */\n this.on;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.once;\n\n /***\n * @type {FeatureOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {number|string|undefined}\n */\n this.id_ = undefined;\n\n /**\n * @type {string}\n * @private\n */\n this.geometryName_ = 'geometry';\n\n /**\n * User provided style.\n * @private\n * @type {import(\"./style/Style.js\").StyleLike}\n */\n this.style_ = null;\n\n /**\n * @private\n * @type {import(\"./style/Style.js\").StyleFunction|undefined}\n */\n this.styleFunction_ = undefined;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.geometryChangeKey_ = null;\n\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n\n if (geometryOrProperties) {\n if (\n typeof (\n /** @type {?} */ (geometryOrProperties).getSimplifiedGeometry\n ) === 'function'\n ) {\n const geometry = /** @type {Geometry} */ (geometryOrProperties);\n this.setGeometry(geometry);\n } else {\n /** @type {Object} */\n const properties = geometryOrProperties;\n this.setProperties(properties);\n }\n }\n }\n\n /**\n * Clone this feature. If the original feature has a geometry it\n * is also cloned. The feature id is not set in the clone.\n * @return {Feature} The clone.\n * @api\n */\n clone() {\n const clone = /** @type {Feature} */ (\n new Feature(this.hasProperties() ? this.getProperties() : null)\n );\n clone.setGeometryName(this.getGeometryName());\n const geometry = this.getGeometry();\n if (geometry) {\n clone.setGeometry(/** @type {Geometry} */ (geometry.clone()));\n }\n const style = this.getStyle();\n if (style) {\n clone.setStyle(style);\n }\n return clone;\n }\n\n /**\n * Get the feature's default geometry. A feature may have any number of named\n * geometries. The \"default\" geometry (the one that is rendered by default) is\n * set when calling {@link module:ol/Feature~Feature#setGeometry}.\n * @return {Geometry|undefined} The default geometry for the feature.\n * @api\n * @observable\n */\n getGeometry() {\n return /** @type {Geometry|undefined} */ (this.get(this.geometryName_));\n }\n\n /**\n * Get the feature identifier. This is a stable identifier for the feature and\n * is either set when reading data from a remote source or set explicitly by\n * calling {@link module:ol/Feature~Feature#setId}.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id_;\n }\n\n /**\n * Get the name of the feature's default geometry. By default, the default\n * geometry is named `geometry`.\n * @return {string} Get the property name associated with the default geometry\n * for this feature.\n * @api\n */\n getGeometryName() {\n return this.geometryName_;\n }\n\n /**\n * Get the feature's style. Will return what was provided to the\n * {@link module:ol/Feature~Feature#setStyle} method.\n * @return {import(\"./style/Style.js\").StyleLike|undefined} The feature style.\n * @api\n */\n getStyle() {\n return this.style_;\n }\n\n /**\n * Get the feature's style function.\n * @return {import(\"./style/Style.js\").StyleFunction|undefined} Return a function\n * representing the current style of this feature.\n * @api\n */\n getStyleFunction() {\n return this.styleFunction_;\n }\n\n /**\n * @private\n */\n handleGeometryChange_() {\n this.changed();\n }\n\n /**\n * @private\n */\n handleGeometryChanged_() {\n if (this.geometryChangeKey_) {\n unlistenByKey(this.geometryChangeKey_);\n this.geometryChangeKey_ = null;\n }\n const geometry = this.getGeometry();\n if (geometry) {\n this.geometryChangeKey_ = listen(\n geometry,\n EventType.CHANGE,\n this.handleGeometryChange_,\n this\n );\n }\n this.changed();\n }\n\n /**\n * Set the default geometry for the feature. This will update the property\n * with the name returned by {@link module:ol/Feature~Feature#getGeometryName}.\n * @param {Geometry|undefined} geometry The new geometry.\n * @api\n * @observable\n */\n setGeometry(geometry) {\n this.set(this.geometryName_, geometry);\n }\n\n /**\n * Set the style for the feature to override the layer style. This can be a\n * single style object, an array of styles, or a function that takes a\n * resolution and returns an array of styles. To unset the feature style, call\n * `setStyle()` without arguments or a falsey value.\n * @param {import(\"./style/Style.js\").StyleLike} [style] Style for this feature.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setStyle(style) {\n this.style_ = style;\n this.styleFunction_ = !style ? undefined : createStyleFunction(style);\n this.changed();\n }\n\n /**\n * Set the feature id. The feature id is considered stable and may be used when\n * requesting features or comparing identifiers returned from a remote source.\n * The feature id can be used with the\n * {@link module:ol/source/Vector~VectorSource#getFeatureById} method.\n * @param {number|string|undefined} id The feature id.\n * @api\n * @fires module:ol/events/Event~BaseEvent#event:change\n */\n setId(id) {\n this.id_ = id;\n this.changed();\n }\n\n /**\n * Set the property name to be used when getting the feature's default geometry.\n * When calling {@link module:ol/Feature~Feature#getGeometry}, the value of the property with\n * this name will be returned.\n * @param {string} name The property name of the default geometry.\n * @api\n */\n setGeometryName(name) {\n this.removeChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.geometryName_ = name;\n this.addChangeListener(this.geometryName_, this.handleGeometryChanged_);\n this.handleGeometryChanged_();\n }\n}\n\n/**\n * Convert the provided object into a feature style function. Functions passed\n * through unchanged. Arrays of Style or single style objects wrapped\n * in a new feature style function.\n * @param {!import(\"./style/Style.js\").StyleFunction|!Array|!import(\"./style/Style.js\").default} obj\n * A feature style function, a single style, or an array of styles.\n * @return {import(\"./style/Style.js\").StyleFunction} A style function.\n */\nexport function createStyleFunction(obj) {\n if (typeof obj === 'function') {\n return obj;\n }\n /**\n * @type {Array}\n */\n let styles;\n if (Array.isArray(obj)) {\n styles = obj;\n } else {\n assert(\n typeof (/** @type {?} */ (obj).getZIndex) === 'function',\n 'Expected an `ol/style/Style` or an array of `ol/style/Style.js`'\n );\n const style = /** @type {import(\"./style/Style.js\").default} */ (obj);\n styles = [style];\n }\n return function () {\n return styles;\n };\n}\nexport default Feature;\n","/**\n * @module ol/Geolocation\n */\nimport BaseEvent from './events/Event.js';\nimport BaseObject from './Object.js';\nimport {circular as circularPolygon} from './geom/Polygon.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n identityTransform,\n} from './proj.js';\nimport {toRadians} from './math.js';\n\n/**\n * @enum {string}\n */\nconst Property = {\n ACCURACY: 'accuracy',\n ACCURACY_GEOMETRY: 'accuracyGeometry',\n ALTITUDE: 'altitude',\n ALTITUDE_ACCURACY: 'altitudeAccuracy',\n HEADING: 'heading',\n POSITION: 'position',\n PROJECTION: 'projection',\n SPEED: 'speed',\n TRACKING: 'tracking',\n TRACKING_OPTIONS: 'trackingOptions',\n};\n\n/**\n * @enum string\n */\nconst GeolocationErrorType = {\n /**\n * Triggered when a `GeolocationPositionError` occurs.\n * @event module:ol/Geolocation.GeolocationError#error\n * @api\n */\n ERROR: 'error',\n};\n\n/**\n * @classdesc\n * Events emitted on [GeolocationPositionError](https://developer.mozilla.org/en-US/docs/Web/API/GeolocationPositionError).\n */\nexport class GeolocationError extends BaseEvent {\n /**\n * @param {GeolocationPositionError} error error object.\n */\n constructor(error) {\n super(GeolocationErrorType.ERROR);\n\n /**\n * Code of the underlying `GeolocationPositionError`.\n * @type {number}\n * @api\n */\n this.code = error.code;\n\n /**\n * Message of the underlying `GeolocationPositionError`.\n * @type {string}\n * @api\n */\n this.message = error.message;\n }\n}\n\n/**\n * @typedef {Object} Options\n * @property {boolean} [tracking=false] Start Tracking right after\n * instantiation.\n * @property {PositionOptions} [trackingOptions] Tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position_options_interface.\n * @property {import(\"./proj.js\").ProjectionLike} [projection] The projection the position\n * is reported in.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:accuracy'|'change:accuracyGeometry'|'change:altitude'|\n * 'change:altitudeAccuracy'|'change:heading'|'change:position'|'change:projection'|'change:speed'|'change:tracking'|\n * 'change:trackingOptions'} GeolocationObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature<'error', GeolocationError, Return> &\n * import(\"./Observable\").CombinedOnSignature &\n * import(\"./Observable\").OnSignature} GeolocationOnSignature\n */\n\n/**\n * @classdesc\n * Helper class for providing HTML5 Geolocation capabilities.\n * The [Geolocation API](https://www.w3.org/TR/geolocation-API/)\n * is used to locate a user's position.\n *\n * To get notified of position changes and errors, register listeners for the generic\n * `change` event and the `error` event on your instance of {@link module:ol/Geolocation~Geolocation}.\n *\n * Example:\n *\n * const geolocation = new Geolocation({\n * // take the projection to use from the map's view\n * projection: view.getProjection()\n * });\n * // listen to changes in position\n * geolocation.on('change', function(evt) {\n * console.log(geolocation.getPosition());\n * });\n * // listen to error\n * geolocation.on('error', function(evt) {\n * window.console.log(evt.message);\n * });\n *\n * @fires GeolocationError\n * @api\n */\nclass Geolocation extends BaseObject {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.on;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.once;\n\n /***\n * @type {GeolocationOnSignature}\n */\n this.un;\n\n options = options || {};\n\n /**\n * The unprojected (EPSG:4326) device position.\n * @private\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.position_ = null;\n\n /**\n * @private\n * @type {import(\"./proj.js\").TransformFunction}\n */\n this.transform_ = identityTransform;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.watchId_ = undefined;\n\n this.addChangeListener(Property.PROJECTION, this.handleProjectionChanged_);\n this.addChangeListener(Property.TRACKING, this.handleTrackingChanged_);\n\n if (options.projection !== undefined) {\n this.setProjection(options.projection);\n }\n if (options.trackingOptions !== undefined) {\n this.setTrackingOptions(options.trackingOptions);\n }\n\n this.setTracking(options.tracking !== undefined ? options.tracking : false);\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.setTracking(false);\n super.disposeInternal();\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n getProjection('EPSG:4326'),\n projection\n );\n if (this.position_) {\n this.set(Property.POSITION, this.transform_(this.position_));\n }\n }\n }\n\n /**\n * @private\n */\n handleTrackingChanged_() {\n if ('geolocation' in navigator) {\n const tracking = this.getTracking();\n if (tracking && this.watchId_ === undefined) {\n this.watchId_ = navigator.geolocation.watchPosition(\n this.positionChange_.bind(this),\n this.positionError_.bind(this),\n this.getTrackingOptions()\n );\n } else if (!tracking && this.watchId_ !== undefined) {\n navigator.geolocation.clearWatch(this.watchId_);\n this.watchId_ = undefined;\n }\n }\n }\n\n /**\n * @private\n * @param {GeolocationPosition} position position event.\n */\n positionChange_(position) {\n const coords = position.coords;\n this.set(Property.ACCURACY, coords.accuracy);\n this.set(\n Property.ALTITUDE,\n coords.altitude === null ? undefined : coords.altitude\n );\n this.set(\n Property.ALTITUDE_ACCURACY,\n coords.altitudeAccuracy === null ? undefined : coords.altitudeAccuracy\n );\n this.set(\n Property.HEADING,\n coords.heading === null ? undefined : toRadians(coords.heading)\n );\n if (!this.position_) {\n this.position_ = [coords.longitude, coords.latitude];\n } else {\n this.position_[0] = coords.longitude;\n this.position_[1] = coords.latitude;\n }\n const projectedPosition = this.transform_(this.position_);\n this.set(Property.POSITION, projectedPosition.slice());\n this.set(Property.SPEED, coords.speed === null ? undefined : coords.speed);\n const geometry = circularPolygon(this.position_, coords.accuracy);\n geometry.applyTransform(this.transform_);\n this.set(Property.ACCURACY_GEOMETRY, geometry);\n this.changed();\n }\n\n /**\n * @private\n * @param {GeolocationPositionError} error error object.\n */\n positionError_(error) {\n this.dispatchEvent(new GeolocationError(error));\n }\n\n /**\n * Get the accuracy of the position in meters.\n * @return {number|undefined} The accuracy of the position measurement in\n * meters.\n * @observable\n * @api\n */\n getAccuracy() {\n return /** @type {number|undefined} */ (this.get(Property.ACCURACY));\n }\n\n /**\n * Get a geometry of the position accuracy.\n * @return {?import(\"./geom/Polygon.js\").default} A geometry of the position accuracy.\n * @observable\n * @api\n */\n getAccuracyGeometry() {\n return /** @type {?import(\"./geom/Polygon.js\").default} */ (\n this.get(Property.ACCURACY_GEOMETRY) || null\n );\n }\n\n /**\n * Get the altitude associated with the position.\n * @return {number|undefined} The altitude of the position in meters above mean\n * sea level.\n * @observable\n * @api\n */\n getAltitude() {\n return /** @type {number|undefined} */ (this.get(Property.ALTITUDE));\n }\n\n /**\n * Get the altitude accuracy of the position.\n * @return {number|undefined} The accuracy of the altitude measurement in\n * meters.\n * @observable\n * @api\n */\n getAltitudeAccuracy() {\n return /** @type {number|undefined} */ (\n this.get(Property.ALTITUDE_ACCURACY)\n );\n }\n\n /**\n * Get the heading as radians clockwise from North.\n * Note: depending on the browser, the heading is only defined if the `enableHighAccuracy`\n * is set to `true` in the tracking options.\n * @return {number|undefined} The heading of the device in radians from north.\n * @observable\n * @api\n */\n getHeading() {\n return /** @type {number|undefined} */ (this.get(Property.HEADING));\n }\n\n /**\n * Get the position of the device.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The current position of the device reported\n * in the current projection.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the projection associated with the position.\n * @return {import(\"./proj/Projection.js\").default|undefined} The projection the position is\n * reported in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"./proj/Projection.js\").default|undefined} */ (\n this.get(Property.PROJECTION)\n );\n }\n\n /**\n * Get the speed in meters per second.\n * @return {number|undefined} The instantaneous speed of the device in meters\n * per second.\n * @observable\n * @api\n */\n getSpeed() {\n return /** @type {number|undefined} */ (this.get(Property.SPEED));\n }\n\n /**\n * Determine if the device location is being tracked.\n * @return {boolean} The device location is being tracked.\n * @observable\n * @api\n */\n getTracking() {\n return /** @type {boolean} */ (this.get(Property.TRACKING));\n }\n\n /**\n * Get the tracking options.\n * See https://www.w3.org/TR/geolocation-API/#position-options.\n * @return {PositionOptions|undefined} PositionOptions as defined by\n * the [HTML5 Geolocation spec\n * ](https://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n getTrackingOptions() {\n return /** @type {PositionOptions|undefined} */ (\n this.get(Property.TRACKING_OPTIONS)\n );\n }\n\n /**\n * Set the projection to use for transforming the coordinates.\n * @param {import(\"./proj.js\").ProjectionLike} projection The projection the position is\n * reported in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(Property.PROJECTION, getProjection(projection));\n }\n\n /**\n * Enable or disable tracking.\n * @param {boolean} tracking Enable tracking.\n * @observable\n * @api\n */\n setTracking(tracking) {\n this.set(Property.TRACKING, tracking);\n }\n\n /**\n * Set the tracking options.\n * See http://www.w3.org/TR/geolocation-API/#position-options.\n * @param {PositionOptions} options PositionOptions as defined by the\n * [HTML5 Geolocation spec\n * ](http://www.w3.org/TR/geolocation-API/#position_options_interface).\n * @observable\n * @api\n */\n setTrackingOptions(options) {\n this.set(Property.TRACKING_OPTIONS, options);\n }\n}\n\nexport default Geolocation;\n","/**\n * @module ol/Image\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport ImageState from './ImageState.js';\nimport {CREATE_IMAGE_BITMAP, IMAGE_DECODE} from './has.js';\nimport {listenOnce, unlistenByKey} from './events.js';\nimport {toPromise} from './functions.js';\n\n/**\n * A function that takes an {@link module:ol/Image~ImageWrapper} for the image and a\n * `{string}` for the src as arguments. It is supposed to make it so the\n * underlying image {@link module:ol/Image~ImageWrapper#getImage} is assigned the\n * content specified by the src. If not specified, the default is\n *\n * function(image, src) {\n * image.getImage().src = src;\n * }\n *\n * Providing a custom `imageLoadFunction` can be useful to load images with\n * post requests or - in general - through XHR requests, where the src of the\n * image element would be set to a data URI when the content is loaded.\n *\n * @typedef {function(import(\"./Image.js\").default, string): void} LoadFunction\n * @api\n */\n\n/**\n * @typedef {Object} ImageObject\n * @property {import(\"./extent.js\").Extent} [extent] Extent, if different from the requested one.\n * @property {import(\"./resolution.js\").ResolutionLike} [resolution] Resolution, if different from the requested one.\n * When x and y resolution are different, use the array type (`[xResolution, yResolution]`).\n * @property {number} [pixelRatio] Pixel ratio, if different from the requested one.\n * @property {import('./DataTile.js').ImageLike} image Image.\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * For images that cover any extent and resolution (static images), the loader function should not accept\n * any arguments. The function returns an {@link import(\"./DataTile.js\").ImageLike image}, an\n * {@link import(\"./Image.js\").ImageObject image object}, or a promise for the same.\n * For loaders that generate images, the promise should not resolve until the image is loaded.\n * If the returned image does not match the extent, resolution or pixel ratio passed to the loader,\n * it has to return an {@link import(\"./Image.js\").ImageObject image object} with the `image` and the\n * correct `extent`, `resolution` and `pixelRatio`.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise} Loader\n * @api\n */\n\n/**\n * Loader function used for image sources. Receives extent, resolution and pixel ratio as arguments.\n * The function returns a promise for an {@link import(\"./Image.js\").ImageObject image object}.\n *\n * @typedef {function(import(\"./extent.js\").Extent, number, number, (function(HTMLImageElement, string): void)=): import(\"./DataTile.js\").ImageLike|ImageObject|Promise} ImageObjectPromiseLoader\n */\n\nclass ImageWrapper extends EventTarget {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number|Array|undefined} resolution Resolution. If provided as array, x and y\n * resolution will be assumed.\n * @param {number} pixelRatio Pixel ratio.\n * @param {import(\"./ImageState.js\").default|import(\"./Image.js\").Loader} stateOrLoader State.\n */\n constructor(extent, resolution, pixelRatio, stateOrLoader) {\n super();\n\n /**\n * @protected\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = extent;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ = pixelRatio;\n\n /**\n * @protected\n * @type {number|Array|undefined}\n */\n this.resolution = resolution;\n\n /**\n * @protected\n * @type {import(\"./ImageState.js\").default}\n */\n this.state =\n typeof stateOrLoader === 'function' ? ImageState.IDLE : stateOrLoader;\n\n /**\n * @private\n * @type {import('./DataTile.js').ImageLike|null}\n */\n this.image_ = null;\n\n /**\n * @protected\n * @type {import(\"./Image.js\").Loader}\n */\n this.loader = typeof stateOrLoader === 'function' ? stateOrLoader : null;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n getExtent() {\n return this.extent;\n }\n\n /**\n * @return {import('./DataTile.js').ImageLike} Image.\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * @return {number} PixelRatio.\n */\n getPixelRatio() {\n return this.pixelRatio_;\n }\n\n /**\n * @return {number|Array} Resolution.\n */\n getResolution() {\n return /** @type {number} */ (this.resolution);\n }\n\n /**\n * @return {import(\"./ImageState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n if (this.loader) {\n this.state = ImageState.LOADING;\n this.changed();\n const resolution = this.getResolution();\n const requestResolution = Array.isArray(resolution)\n ? resolution[0]\n : resolution;\n toPromise(() =>\n this.loader(this.getExtent(), requestResolution, this.getPixelRatio())\n )\n .then((image) => {\n if ('image' in image) {\n this.image_ = image.image;\n }\n if ('extent' in image) {\n this.extent = image.extent;\n }\n if ('resolution' in image) {\n this.resolution = image.resolution;\n }\n if ('pixelRatio' in image) {\n this.pixelRatio_ = image.pixelRatio;\n }\n if (\n image instanceof HTMLImageElement ||\n image instanceof ImageBitmap ||\n image instanceof HTMLCanvasElement ||\n image instanceof HTMLVideoElement\n ) {\n this.image_ = image;\n }\n this.state = ImageState.LOADED;\n })\n .catch((error) => {\n this.state = ImageState.ERROR;\n console.error(error); // eslint-disable-line no-console\n })\n .finally(() => this.changed());\n }\n }\n }\n\n /**\n * @param {import('./DataTile.js').ImageLike} image The image.\n */\n setImage(image) {\n this.image_ = image;\n }\n\n /**\n * @param {number|Array} resolution Resolution.\n */\n setResolution(resolution) {\n this.resolution = resolution;\n }\n}\n\n/**\n * @param {import('./DataTile.js').ImageLike} image Image element.\n * @param {function():any} loadHandler Load callback function.\n * @param {function():any} errorHandler Error callback function.\n * @return {function():void} Callback to stop listening.\n */\nexport function listenImage(image, loadHandler, errorHandler) {\n const img = /** @type {HTMLImageElement} */ (image);\n let listening = true;\n let decoding = false;\n let loaded = false;\n\n const listenerKeys = [\n listenOnce(img, EventType.LOAD, function () {\n loaded = true;\n if (!decoding) {\n loadHandler();\n }\n }),\n ];\n\n if (img.src && IMAGE_DECODE) {\n decoding = true;\n img\n .decode()\n .then(function () {\n if (listening) {\n loadHandler();\n }\n })\n .catch(function (error) {\n if (listening) {\n if (loaded) {\n loadHandler();\n } else {\n errorHandler();\n }\n }\n });\n } else {\n listenerKeys.push(listenOnce(img, EventType.ERROR, errorHandler));\n }\n\n return function unlisten() {\n listening = false;\n listenerKeys.forEach(unlistenByKey);\n };\n}\n\n/**\n * Loads an image.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n * @api\n */\nexport function load(image, src) {\n return new Promise((resolve, reject) => {\n function handleLoad() {\n unlisten();\n resolve(image);\n }\n function handleError() {\n unlisten();\n reject(new Error('Image load error'));\n }\n function unlisten() {\n image.removeEventListener('load', handleLoad);\n image.removeEventListener('error', handleError);\n }\n image.addEventListener('load', handleLoad);\n image.addEventListener('error', handleError);\n if (src) {\n image.src = src;\n }\n });\n}\n\n/**\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `HTMLImageElement`.\n */\nexport function decodeFallback(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE\n ? new Promise((resolve, reject) =>\n image\n .decode()\n .then(() => resolve(image))\n .catch((e) =>\n image.complete && image.width ? resolve(image) : reject(e)\n )\n )\n : load(image);\n}\n\n/**\n * Loads an image and decodes it to an `ImageBitmap` if `createImageBitmap()` is supported. Returns\n * the loaded image otherwise.\n * @param {HTMLImageElement} image Image, not yet loaded.\n * @param {string} [src] `src` attribute of the image. Optional, not required if already present.\n * @return {Promise} Promise resolving to an `ImageBitmap` or an\n * `HTMLImageElement` if `createImageBitmap()` is not supported.\n * @api\n */\nexport function decode(image, src) {\n if (src) {\n image.src = src;\n }\n return image.src && IMAGE_DECODE && CREATE_IMAGE_BITMAP\n ? image\n .decode()\n .then(() => createImageBitmap(image))\n .catch((e) => {\n if (image.complete && image.width) {\n return image;\n }\n throw e;\n })\n : decodeFallback(image);\n}\n\nexport default ImageWrapper;\n","/**\n * @module ol/ImageCanvas\n */\nimport ImageState from './ImageState.js';\nimport ImageWrapper from './Image.js';\n\n/**\n * A function that is called to trigger asynchronous canvas drawing. It is\n * called with a \"done\" callback that should be called when drawing is done.\n * If any error occurs during drawing, the \"done\" callback should be called with\n * that error.\n *\n * @typedef {function(function(Error=): void): void} Loader\n */\n\nclass ImageCanvas extends ImageWrapper {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {number} pixelRatio Pixel ratio.\n * @param {HTMLCanvasElement} canvas Canvas.\n * @param {Loader} [loader] Optional loader function to\n * support asynchronous canvas drawing.\n */\n constructor(extent, resolution, pixelRatio, canvas, loader) {\n const state = loader !== undefined ? ImageState.IDLE : ImageState.LOADED;\n\n super(extent, resolution, pixelRatio, state);\n\n /**\n * Optional canvas loader function.\n * @type {?Loader}\n * @private\n */\n this.loader_ = loader !== undefined ? loader : null;\n\n /**\n * @private\n * @type {HTMLCanvasElement}\n */\n this.canvas_ = canvas;\n\n /**\n * @private\n * @type {?Error}\n */\n this.error_ = null;\n }\n\n /**\n * Get any error associated with asynchronous rendering.\n * @return {?Error} Any error that occurred during rendering.\n */\n getError() {\n return this.error_;\n }\n\n /**\n * Handle async drawing complete.\n * @param {Error} [err] Any error during drawing.\n * @private\n */\n handleLoad_(err) {\n if (err) {\n this.error_ = err;\n this.state = ImageState.ERROR;\n } else {\n this.state = ImageState.LOADED;\n }\n this.changed();\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == ImageState.IDLE) {\n this.state = ImageState.LOADING;\n this.changed();\n this.loader_(this.handleLoad_.bind(this));\n }\n }\n\n /**\n * @return {HTMLCanvasElement} Canvas element.\n */\n getImage() {\n return this.canvas_;\n }\n}\n\nexport default ImageCanvas;\n","/**\n * @module ol/ImageState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/ImageTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {listenImage} from './Image.js';\n\nclass ImageTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Image source URI.\n * @param {?string} crossOrigin Cross origin.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, crossOrigin, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * @private\n * @type {?string}\n */\n this.crossOrigin_ = crossOrigin;\n\n /**\n * Image URI\n *\n * @private\n * @type {string}\n */\n this.src_ = src;\n\n this.key = src;\n\n /**\n * @private\n * @type {HTMLImageElement|HTMLCanvasElement}\n */\n this.image_ = new Image();\n if (crossOrigin !== null) {\n this.image_.crossOrigin = crossOrigin;\n }\n\n /**\n * @private\n * @type {?function():void}\n */\n this.unlisten_ = null;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n }\n\n /**\n * Get the HTML image element for this tile (may be a Canvas, Image, or Video).\n * @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.\n * @api\n */\n getImage() {\n return this.image_;\n }\n\n /**\n * Sets an HTML image element for this tile (may be a Canvas or preloaded Image).\n * @param {HTMLCanvasElement|HTMLImageElement} element Element.\n */\n setImage(element) {\n this.image_ = element;\n this.state = TileState.LOADED;\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Tracks loading or read errors.\n *\n * @private\n */\n handleImageError_() {\n this.state = TileState.ERROR;\n this.unlistenImage_();\n this.image_ = getBlankImage();\n this.changed();\n }\n\n /**\n * Tracks successful image load.\n *\n * @private\n */\n handleImageLoad_() {\n const image = /** @type {HTMLImageElement} */ (this.image_);\n if (image.naturalWidth && image.naturalHeight) {\n this.state = TileState.LOADED;\n } else {\n this.state = TileState.EMPTY;\n }\n this.unlistenImage_();\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n *\n * To retry loading tiles on failed requests, use a custom `tileLoadFunction`\n * that checks for error status codes and reloads only when the status code is\n * 408, 429, 500, 502, 503 and 504, and only when not too many retries have been\n * made already:\n *\n * ```js\n * const retryCodes = [408, 429, 500, 502, 503, 504];\n * const retries = {};\n * source.setTileLoadFunction((tile, src) => {\n * const image = tile.getImage();\n * fetch(src)\n * .then((response) => {\n * if (retryCodes.includes(response.status)) {\n * retries[src] = (retries[src] || 0) + 1;\n * if (retries[src] <= 3) {\n * setTimeout(() => tile.load(), retries[src] * 1000);\n * }\n * return Promise.reject();\n * }\n * return response.blob();\n * })\n * .then((blob) => {\n * const imageUrl = URL.createObjectURL(blob);\n * image.src = imageUrl;\n * setTimeout(() => URL.revokeObjectURL(imageUrl), 5000);\n * })\n * .catch(() => tile.setState(3)); // error\n * });\n * ```\n *\n * @api\n */\n load() {\n if (this.state == TileState.ERROR) {\n this.state = TileState.IDLE;\n this.image_ = new Image();\n if (this.crossOrigin_ !== null) {\n this.image_.crossOrigin = this.crossOrigin_;\n }\n }\n if (this.state == TileState.IDLE) {\n this.state = TileState.LOADING;\n this.changed();\n this.tileLoadFunction_(this, this.src_);\n this.unlisten_ = listenImage(\n this.image_,\n this.handleImageLoad_.bind(this),\n this.handleImageError_.bind(this)\n );\n }\n }\n\n /**\n * Discards event handlers which listen for load completion or errors.\n *\n * @private\n */\n unlistenImage_() {\n if (this.unlisten_) {\n this.unlisten_();\n this.unlisten_ = null;\n }\n }\n}\n\n/**\n * Get a 1-pixel blank image.\n * @return {HTMLCanvasElement} Blank image.\n */\nfunction getBlankImage() {\n const ctx = createCanvasContext2D(1, 1);\n ctx.fillStyle = 'rgba(0,0,0,0)';\n ctx.fillRect(0, 0, 1, 1);\n return ctx.canvas;\n}\n\nexport default ImageTile;\n","/**\n * @module ol/renderer/Map\n */\nimport Disposable from '../Disposable.js';\nimport {TRUE} from '../functions.js';\nimport {abstract} from '../util.js';\nimport {compose as composeTransform, makeInverse} from '../transform.js';\nimport {getWidth} from '../extent.js';\nimport {shared as iconImageCache} from '../style/IconImageCache.js';\nimport {inView} from '../layer/Layer.js';\nimport {wrapX} from '../coordinate.js';\n\n/**\n * @template T\n * @typedef HitMatch\n * @property {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @property {import(\"../layer/Layer.js\").default} layer Layer.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} distanceSq Squared distance.\n * @property {import(\"./vector.js\").FeatureCallback} callback Callback.\n */\n\n/**\n * @abstract\n */\nclass MapRenderer extends Disposable {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super();\n\n /**\n * @private\n * @type {import(\"../Map.js\").default}\n */\n this.map_ = map;\n }\n\n /**\n * @abstract\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @protected\n */\n calculateMatrices2D(frameState) {\n const viewState = frameState.viewState;\n const coordinateToPixelTransform = frameState.coordinateToPixelTransform;\n const pixelToCoordinateTransform = frameState.pixelToCoordinateTransform;\n\n composeTransform(\n coordinateToPixelTransform,\n frameState.size[0] / 2,\n frameState.size[1] / 2,\n 1 / viewState.resolution,\n -1 / viewState.resolution,\n -viewState.rotation,\n -viewState.center[0],\n -viewState.center[1]\n );\n\n makeInverse(pixelToCoordinateTransform, coordinateToPixelTransform);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {import(\"./vector.js\").FeatureCallback} callback Feature callback.\n * @param {S} thisArg Value to use as `this` when executing `callback`.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg2 Value to use as `this` when executing `layerFilter`.\n * @return {T|undefined} Callback result.\n * @template S,T,U\n */\n forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n callback,\n thisArg,\n layerFilter,\n thisArg2\n ) {\n let result;\n const viewState = frameState.viewState;\n\n /**\n * @param {boolean} managed Managed layer.\n * @param {import(\"../Feature.js\").FeatureLike} feature Feature.\n * @param {import(\"../layer/Layer.js\").default} layer Layer.\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @return {T|undefined} Callback result.\n */\n function forEachFeatureAtCoordinate(managed, feature, layer, geometry) {\n return callback.call(thisArg, feature, managed ? layer : null, geometry);\n }\n\n const projection = viewState.projection;\n\n const translatedCoordinate = wrapX(coordinate.slice(), projection);\n const offsets = [[0, 0]];\n if (projection.canWrapX() && checkWrapped) {\n const projectionExtent = projection.getExtent();\n const worldWidth = getWidth(projectionExtent);\n offsets.push([-worldWidth, 0], [worldWidth, 0]);\n }\n\n const layerStates = frameState.layerStatesArray;\n const numLayers = layerStates.length;\n\n const matches = /** @type {Array>} */ ([]);\n const tmpCoord = [];\n for (let i = 0; i < offsets.length; i++) {\n for (let j = numLayers - 1; j >= 0; --j) {\n const layerState = layerStates[j];\n const layer = layerState.layer;\n if (\n layer.hasRenderer() &&\n inView(layerState, viewState) &&\n layerFilter.call(thisArg2, layer)\n ) {\n const layerRenderer = layer.getRenderer();\n const source = layer.getSource();\n if (layerRenderer && source) {\n const coordinates = source.getWrapX()\n ? translatedCoordinate\n : coordinate;\n const callback = forEachFeatureAtCoordinate.bind(\n null,\n layerState.managed\n );\n tmpCoord[0] = coordinates[0] + offsets[i][0];\n tmpCoord[1] = coordinates[1] + offsets[i][1];\n result = layerRenderer.forEachFeatureAtCoordinate(\n tmpCoord,\n frameState,\n hitTolerance,\n callback,\n matches\n );\n }\n if (result) {\n return result;\n }\n }\n }\n }\n if (matches.length === 0) {\n return undefined;\n }\n const order = 1 / matches.length;\n matches.forEach((m, i) => (m.distanceSq += i * order));\n matches.sort((a, b) => a.distanceSq - b.distanceSq);\n matches.some((m) => {\n return (result = m.callback(m.feature, m.layer, m.geometry));\n });\n return result;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"../Map.js\").FrameState} frameState FrameState.\n * @param {number} hitTolerance Hit tolerance in pixels.\n * @param {boolean} checkWrapped Check for wrapped geometries.\n * @param {function(this: U, import(\"../layer/Layer.js\").default): boolean} layerFilter Layer filter\n * function, only layers which are visible and for which this function\n * returns `true` will be tested for features. By default, all visible\n * layers will be tested.\n * @param {U} thisArg Value to use as `this` when executing `layerFilter`.\n * @return {boolean} Is there a feature at the given coordinate?\n * @template U\n */\n hasFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n layerFilter,\n thisArg\n ) {\n const hasFeature = this.forEachFeatureAtCoordinate(\n coordinate,\n frameState,\n hitTolerance,\n checkWrapped,\n TRUE,\n this,\n layerFilter,\n thisArg\n );\n\n return hasFeature !== undefined;\n }\n\n /**\n * @return {import(\"../Map.js\").default} Map.\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Render.\n * @abstract\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n abstract();\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n flushDeclutterItems(frameState) {}\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @protected\n */\n scheduleExpireIconCache(frameState) {\n if (iconImageCache.canExpireCache()) {\n frameState.postRenderFunctions.push(expireIconCache);\n }\n }\n}\n\n/**\n * @param {import(\"../Map.js\").default} map Map.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\nfunction expireIconCache(map, frameState) {\n iconImageCache.expire();\n}\n\nexport default MapRenderer;\n","/**\n * @module ol/renderer/Composite\n */\nimport MapRenderer from './Map.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport RenderEvent from '../render/Event.js';\nimport RenderEventType from '../render/EventType.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {checkedFonts} from '../render/canvas.js';\nimport {inView} from '../layer/Layer.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {replaceChildren} from '../dom.js';\n\n/**\n * @classdesc\n * Canvas map renderer.\n * @api\n */\nclass CompositeMapRenderer extends MapRenderer {\n /**\n * @param {import(\"../Map.js\").default} map Map.\n */\n constructor(map) {\n super(map);\n\n /**\n * @type {import(\"../events.js\").EventsKey}\n */\n this.fontChangeListenerKey_ = listen(\n checkedFonts,\n ObjectEventType.PROPERTYCHANGE,\n map.redrawText.bind(map)\n );\n\n /**\n * @private\n * @type {HTMLDivElement}\n */\n this.element_ = document.createElement('div');\n const style = this.element_.style;\n style.position = 'absolute';\n style.width = '100%';\n style.height = '100%';\n style.zIndex = '0';\n\n this.element_.className = CLASS_UNSELECTABLE + ' ol-layers';\n\n const container = map.getViewport();\n container.insertBefore(this.element_, container.firstChild || null);\n\n /**\n * @private\n * @type {Array}\n */\n this.children_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n\n /**\n * @type {Array}\n */\n this.declutterLayers_ = [];\n }\n\n /**\n * @param {import(\"../render/EventType.js\").default} type Event type.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n dispatchRenderEvent(type, frameState) {\n const map = this.getMap();\n if (map.hasListener(type)) {\n const event = new RenderEvent(type, undefined, frameState);\n map.dispatchEvent(event);\n }\n }\n\n disposeInternal() {\n unlistenByKey(this.fontChangeListenerKey_);\n this.element_.parentNode.removeChild(this.element_);\n super.disposeInternal();\n }\n\n /**\n * Render.\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n renderFrame(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element_.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n this.calculateMatrices2D(frameState);\n this.dispatchRenderEvent(RenderEventType.PRECOMPOSE, frameState);\n\n const layerStatesArray = frameState.layerStatesArray.sort(function (a, b) {\n return a.zIndex - b.zIndex;\n });\n const viewState = frameState.viewState;\n\n this.children_.length = 0;\n\n const declutterLayers = this.declutterLayers_;\n declutterLayers.length = 0;\n\n let previousElement = null;\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const layerState = layerStatesArray[i];\n frameState.layerIndex = i;\n\n const layer = layerState.layer;\n const sourceState = layer.getSourceState();\n if (\n !inView(layerState, viewState) ||\n (sourceState != 'ready' && sourceState != 'undefined')\n ) {\n layer.unrender();\n continue;\n }\n\n const element = layer.render(frameState, previousElement);\n if (!element) {\n continue;\n }\n if (element !== previousElement) {\n this.children_.push(element);\n previousElement = element;\n }\n if ('getDeclutter' in layer) {\n declutterLayers.push(\n /** @type {import(\"../layer/BaseVector.js\").default} */ (layer)\n );\n }\n }\n this.flushDeclutterItems(frameState);\n\n replaceChildren(this.element_, this.children_);\n\n this.dispatchRenderEvent(RenderEventType.POSTCOMPOSE, frameState);\n\n if (!this.renderedVisible_) {\n this.element_.style.display = '';\n this.renderedVisible_ = true;\n }\n\n this.scheduleExpireIconCache(frameState);\n }\n\n /**\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n */\n flushDeclutterItems(frameState) {\n const layers = this.declutterLayers_;\n for (let i = layers.length - 1; i >= 0; --i) {\n layers[i].renderDeclutter(frameState, frameState.layerStatesArray[i]);\n }\n layers.length = 0;\n }\n}\n\nexport default CompositeMapRenderer;\n","/**\n * @module ol/MapBrowserEventHandler\n */\n\nimport EventType from './events/EventType.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport Target from './events/Target.js';\nimport {PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {listen, unlistenByKey} from './events.js';\n\nclass MapBrowserEventHandler extends Target {\n /**\n * @param {import(\"./Map.js\").default} map The map with the viewport to listen to events on.\n * @param {number} [moveTolerance] The minimal distance the pointer must travel to trigger a move.\n */\n constructor(map, moveTolerance) {\n super(map);\n\n /**\n * This is the element that we will listen to the real events on.\n * @type {import(\"./Map.js\").default}\n * @private\n */\n this.map_ = map;\n\n /**\n * @type {ReturnType}\n * @private\n */\n this.clickTimeoutId_;\n\n /**\n * Emulate dblclick and singleclick. Will be true when only one pointer is active.\n * @type {boolean}\n */\n this.emulateClicks_ = false;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_ = false;\n\n /**\n * @type {!Array}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * @type {number}\n * @private\n */\n this.moveTolerance_ = moveTolerance === undefined ? 1 : moveTolerance;\n\n /**\n * The most recent \"down\" type event (or null if none have occurred).\n * Set on pointerdown.\n * @type {PointerEvent|null}\n * @private\n */\n this.down_ = null;\n\n const element = this.map_.getViewport();\n\n /**\n * @type {Array}\n * @private\n */\n this.activePointers_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.trackedTouches_ = {};\n\n this.element_ = element;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.pointerdownListenerKey_ = listen(\n element,\n PointerEventType.POINTERDOWN,\n this.handlePointerDown_,\n this\n );\n\n /**\n * @type {PointerEvent}\n * @private\n */\n this.originalPointerMoveEvent_;\n\n /**\n * @type {?import(\"./events.js\").EventsKey}\n * @private\n */\n this.relayedListenerKey_ = listen(\n element,\n PointerEventType.POINTERMOVE,\n this.relayMoveEvent_,\n this\n );\n\n /**\n * @private\n */\n this.boundHandleTouchMove_ = this.handleTouchMove_.bind(this);\n\n this.element_.addEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false\n );\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n emulateClick_(pointerEvent) {\n let newEvent = new MapBrowserEvent(\n MapBrowserEventType.CLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n if (this.clickTimeoutId_ !== undefined) {\n // double-click\n clearTimeout(this.clickTimeoutId_);\n this.clickTimeoutId_ = undefined;\n newEvent = new MapBrowserEvent(\n MapBrowserEventType.DBLCLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n } else {\n // click\n this.clickTimeoutId_ = setTimeout(() => {\n this.clickTimeoutId_ = undefined;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.SINGLECLICK,\n this.map_,\n pointerEvent\n );\n this.dispatchEvent(newEvent);\n }, 250);\n }\n }\n\n /**\n * Keeps track on how many pointers are currently active.\n *\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n updateActivePointers_(pointerEvent) {\n const event = pointerEvent;\n const id = event.pointerId;\n\n if (\n event.type == MapBrowserEventType.POINTERUP ||\n event.type == MapBrowserEventType.POINTERCANCEL\n ) {\n delete this.trackedTouches_[id];\n for (const pointerId in this.trackedTouches_) {\n if (this.trackedTouches_[pointerId].target !== event.target) {\n // Some platforms assign a new pointerId when the target changes.\n // If this happens, delete one tracked pointer. If there is more\n // than one tracked pointer for the old target, it will be cleared\n // by subsequent POINTERUP events from other pointers.\n delete this.trackedTouches_[pointerId];\n break;\n }\n }\n } else if (\n event.type == MapBrowserEventType.POINTERDOWN ||\n event.type == MapBrowserEventType.POINTERMOVE\n ) {\n this.trackedTouches_[id] = event;\n }\n this.activePointers_ = Object.values(this.trackedTouches_);\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerUp_(pointerEvent) {\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERUP,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_\n );\n this.dispatchEvent(newEvent);\n\n // We emulate click events on left mouse button click, touch contact, and pen\n // contact. isMouseActionButton returns true in these cases (evt.button is set\n // to 0).\n // See http://www.w3.org/TR/pointerevents/#button-states\n // We only fire click, singleclick, and doubleclick if nobody has called\n // event.preventDefault().\n if (\n this.emulateClicks_ &&\n !newEvent.defaultPrevented &&\n !this.dragging_ &&\n this.isMouseActionButton_(pointerEvent)\n ) {\n this.emulateClick_(this.down_);\n }\n\n if (this.activePointers_.length === 0) {\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n this.dragging_ = false;\n this.down_ = null;\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} If the left mouse button was pressed.\n * @private\n */\n isMouseActionButton_(pointerEvent) {\n return pointerEvent.button === 0;\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerDown_(pointerEvent) {\n this.emulateClicks_ = this.activePointers_.length === 0;\n this.updateActivePointers_(pointerEvent);\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDOWN,\n this.map_,\n pointerEvent,\n undefined,\n undefined,\n this.activePointers_\n );\n this.dispatchEvent(newEvent);\n\n this.down_ = new PointerEvent(pointerEvent.type, pointerEvent);\n Object.defineProperty(this.down_, 'target', {\n writable: false,\n value: pointerEvent.target,\n });\n\n if (this.dragListenerKeys_.length === 0) {\n const doc = this.map_.getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(\n doc,\n MapBrowserEventType.POINTERMOVE,\n this.handlePointerMove_,\n this\n ),\n listen(doc, MapBrowserEventType.POINTERUP, this.handlePointerUp_, this),\n /* Note that the listener for `pointercancel is set up on\n * `pointerEventHandler_` and not `documentPointerEventHandler_` like\n * the `pointerup` and `pointermove` listeners.\n *\n * The reason for this is the following: `TouchSource.vacuumTouches_()`\n * issues `pointercancel` events, when there was no `touchend` for a\n * `touchstart`. Now, let's say a first `touchstart` is registered on\n * `pointerEventHandler_`. The `documentPointerEventHandler_` is set up.\n * But `documentPointerEventHandler_` doesn't know about the first\n * `touchstart`. If there is no `touchend` for the `touchstart`, we can\n * only receive a `touchcancel` from `pointerEventHandler_`, because it is\n * only registered there.\n */\n listen(\n this.element_,\n MapBrowserEventType.POINTERCANCEL,\n this.handlePointerUp_,\n this\n )\n );\n if (this.element_.getRootNode && this.element_.getRootNode() !== doc) {\n this.dragListenerKeys_.push(\n listen(\n this.element_.getRootNode(),\n MapBrowserEventType.POINTERUP,\n this.handlePointerUp_,\n this\n )\n );\n }\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n handlePointerMove_(pointerEvent) {\n // Between pointerdown and pointerup, pointermove events are triggered.\n // To avoid a 'false' touchmove event to be dispatched, we test if the pointer\n // moved a significant distance.\n if (this.isMoving_(pointerEvent)) {\n this.updateActivePointers_(pointerEvent);\n this.dragging_ = true;\n const newEvent = new MapBrowserEvent(\n MapBrowserEventType.POINTERDRAG,\n this.map_,\n pointerEvent,\n this.dragging_,\n undefined,\n this.activePointers_\n );\n this.dispatchEvent(newEvent);\n }\n }\n\n /**\n * Wrap and relay a pointermove event.\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @private\n */\n relayMoveEvent_(pointerEvent) {\n this.originalPointerMoveEvent_ = pointerEvent;\n const dragging = !!(this.down_ && this.isMoving_(pointerEvent));\n this.dispatchEvent(\n new MapBrowserEvent(\n MapBrowserEventType.POINTERMOVE,\n this.map_,\n pointerEvent,\n dragging\n )\n );\n }\n\n /**\n * Flexible handling of a `touch-action: none` css equivalent: because calling\n * `preventDefault()` on a `pointermove` event does not stop native page scrolling\n * and zooming, we also listen for `touchmove` and call `preventDefault()` on it\n * when an interaction (currently `DragPan` handles the event.\n * @param {TouchEvent} event Event.\n * @private\n */\n handleTouchMove_(event) {\n // Due to https://github.com/mpizenberg/elm-pep/issues/2, `this.originalPointerMoveEvent_`\n // may not be initialized yet when we get here on a platform without native pointer events,\n // when elm-pep is used as pointer events polyfill.\n const originalEvent = this.originalPointerMoveEvent_;\n if (\n (!originalEvent || originalEvent.defaultPrevented) &&\n (typeof event.cancelable !== 'boolean' || event.cancelable === true)\n ) {\n event.preventDefault();\n }\n }\n\n /**\n * @param {PointerEvent} pointerEvent Pointer\n * event.\n * @return {boolean} Is moving.\n * @private\n */\n isMoving_(pointerEvent) {\n return (\n this.dragging_ ||\n Math.abs(pointerEvent.clientX - this.down_.clientX) >\n this.moveTolerance_ ||\n Math.abs(pointerEvent.clientY - this.down_.clientY) > this.moveTolerance_\n );\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n if (this.relayedListenerKey_) {\n unlistenByKey(this.relayedListenerKey_);\n this.relayedListenerKey_ = null;\n }\n this.element_.removeEventListener(\n EventType.TOUCHMOVE,\n this.boundHandleTouchMove_\n );\n\n if (this.pointerdownListenerKey_) {\n unlistenByKey(this.pointerdownListenerKey_);\n this.pointerdownListenerKey_ = null;\n }\n\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n\n this.element_ = null;\n super.disposeInternal();\n }\n}\n\nexport default MapBrowserEventHandler;\n","/**\n * @module ol/Map\n */\nimport BaseObject from './Object.js';\nimport Collection from './Collection.js';\nimport CollectionEventType from './CollectionEventType.js';\nimport CompositeMapRenderer from './renderer/Composite.js';\nimport EventType from './events/EventType.js';\nimport Layer from './layer/Layer.js';\nimport LayerGroup, {GroupEvent} from './layer/Group.js';\nimport MapBrowserEvent from './MapBrowserEvent.js';\nimport MapBrowserEventHandler from './MapBrowserEventHandler.js';\nimport MapBrowserEventType from './MapBrowserEventType.js';\nimport MapEvent from './MapEvent.js';\nimport MapEventType from './MapEventType.js';\nimport MapProperty from './MapProperty.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport PointerEventType from './pointer/EventType.js';\nimport RenderEventType from './render/EventType.js';\nimport TileQueue, {getTilePriority} from './TileQueue.js';\nimport View from './View.js';\nimport ViewHint from './ViewHint.js';\nimport {DEVICE_PIXEL_RATIO, PASSIVE_EVENT_LISTENERS} from './has.js';\nimport {TRUE} from './functions.js';\nimport {\n apply as applyTransform,\n create as createTransform,\n} from './transform.js';\nimport {assert} from './asserts.js';\nimport {\n clone,\n createOrUpdateEmpty,\n equals as equalsExtent,\n getForViewAndSize,\n isEmpty,\n} from './extent.js';\nimport {defaults as defaultControls} from './control/defaults.js';\nimport {defaults as defaultInteractions} from './interaction/defaults.js';\nimport {equals} from './array.js';\nimport {fromUserCoordinate, toUserCoordinate} from './proj.js';\nimport {getUid} from './util.js';\nimport {hasArea} from './size.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {removeNode} from './dom.js';\nimport {warn} from './console.js';\n\n/**\n * State of the current frame. Only `pixelRatio`, `time` and `viewState` should\n * be used in applications.\n * @typedef {Object} FrameState\n * @property {number} pixelRatio The pixel ratio of the frame.\n * @property {number} time The time when rendering of the frame was requested.\n * @property {import(\"./View.js\").State} viewState The state of the current view.\n * @property {boolean} animate Animate.\n * @property {import(\"./transform.js\").Transform} coordinateToPixelTransform CoordinateToPixelTransform.\n * @property {import(\"rbush\").default} declutterTree DeclutterTree.\n * @property {null|import(\"./extent.js\").Extent} extent Extent (in view projection coordinates).\n * @property {import(\"./extent.js\").Extent} [nextExtent] Next extent during an animation series.\n * @property {number} index Index.\n * @property {Array} layerStatesArray LayerStatesArray.\n * @property {number} layerIndex LayerIndex.\n * @property {import(\"./transform.js\").Transform} pixelToCoordinateTransform PixelToCoordinateTransform.\n * @property {Array} postRenderFunctions PostRenderFunctions.\n * @property {import(\"./size.js\").Size} size Size.\n * @property {TileQueue} tileQueue TileQueue.\n * @property {!Object>} usedTiles UsedTiles.\n * @property {Array} viewHints ViewHints.\n * @property {!Object>} wantedTiles WantedTiles.\n * @property {string} mapId The id of the map.\n * @property {Object} renderTargets Identifiers of previously rendered elements.\n */\n\n/**\n * @typedef {function(Map, ?FrameState): any} PostRenderFunction\n */\n\n/**\n * @typedef {Object} AtPixelOptions\n * @property {undefined|function(import(\"./layer/Layer.js\").default): boolean} [layerFilter] Layer filter\n * function. The filter function will receive one argument, the\n * {@link module:ol/layer/Layer~Layer layer-candidate} and it should return a boolean value.\n * Only layers which are visible and for which this function returns `true`\n * will be tested for features. By default, all visible layers will be tested.\n * @property {number} [hitTolerance=0] Hit-detection tolerance in css pixels. Pixels\n * inside the radius around the given position will be checked for features.\n * @property {boolean} [checkWrapped=true] Check-Wrapped Will check for wrapped geometries inside the range of\n * +/- 1 world width. Works only if a projection is used that can be wrapped.\n */\n\n/**\n * @typedef {Object} MapOptionsInternal\n * @property {Collection} [controls] Controls.\n * @property {Collection} [interactions] Interactions.\n * @property {HTMLElement|Document} keyboardEventTarget KeyboardEventTarget.\n * @property {Collection} overlays Overlays.\n * @property {Object} values Values.\n */\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:layergroup'|'change:size'|'change:target'|'change:view'} MapObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} MapEventHandler\n */\n\n/**\n * Object literal with config options for the map.\n * @typedef {Object} MapOptions\n * @property {Collection|Array} [controls]\n * Controls initially added to the map. If not specified,\n * {@link module:ol/control/defaults.defaults} is used.\n * @property {number} [pixelRatio=window.devicePixelRatio] The ratio between\n * physical pixels and device-independent pixels (dips) on the device.\n * @property {Collection|Array} [interactions]\n * Interactions that are initially added to the map. If not specified,\n * {@link module:ol/interaction/defaults.defaults} is used.\n * @property {HTMLElement|Document|string} [keyboardEventTarget] The element to\n * listen to keyboard events on. This determines when the `KeyboardPan` and\n * `KeyboardZoom` interactions trigger. For example, if this option is set to\n * `document` the keyboard interactions will always trigger. If this option is\n * not specified, the element the library listens to keyboard events on is the\n * map target (i.e. the user-provided div for the map). If this is not\n * `document`, the target element needs to be focused for key events to be\n * emitted, requiring that the target element has a `tabindex` attribute.\n * @property {Array|Collection|LayerGroup} [layers]\n * Layers. If this is not defined, a map with no layers will be rendered. Note\n * that layers are rendered in the order supplied, so if you want, for example,\n * a vector layer to appear on top of a tile layer, it must come after the tile\n * layer.\n * @property {number} [maxTilesLoading=16] Maximum number tiles to load\n * simultaneously.\n * @property {number} [moveTolerance=1] The minimum distance in pixels the\n * cursor must move to be detected as a map move event instead of a click.\n * Increasing this value can make it easier to click on the map.\n * @property {Collection|Array} [overlays]\n * Overlays initially added to the map. By default, no overlays are added.\n * @property {HTMLElement|string} [target] The container for the map, either the\n * element itself or the `id` of the element. If not specified at construction\n * time, {@link module:ol/Map~Map#setTarget} must be called for the map to be\n * rendered. If passed by element, the container can be in a secondary document.\n * **Note:** CSS `transform` support for the target element is limited to `scale`.\n * @property {View|Promise} [view] The map's view. No layer sources will be\n * fetched unless this is specified at construction time or through\n * {@link module:ol/Map~Map#setView}.\n */\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n */\nfunction removeLayerMapProperty(layer) {\n if (layer instanceof Layer) {\n layer.setMapInternal(null);\n return;\n }\n if (layer instanceof LayerGroup) {\n layer.getLayers().forEach(removeLayerMapProperty);\n }\n}\n\n/**\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @param {Map} map Map.\n */\nfunction setLayerMapProperty(layer, map) {\n if (layer instanceof Layer) {\n layer.setMapInternal(map);\n return;\n }\n if (layer instanceof LayerGroup) {\n const layers = layer.getLayers().getArray();\n for (let i = 0, ii = layers.length; i < ii; ++i) {\n setLayerMapProperty(layers[i], map);\n }\n }\n}\n\n/**\n * @classdesc\n * The map is the core component of OpenLayers. For a map to render, a view,\n * one or more layers, and a target container are needed:\n *\n * import Map from 'ol/Map.js';\n * import View from 'ol/View.js';\n * import TileLayer from 'ol/layer/Tile.js';\n * import OSM from 'ol/source/OSM.js';\n *\n * const map = new Map({\n * view: new View({\n * center: [0, 0],\n * zoom: 1,\n * }),\n * layers: [\n * new TileLayer({\n * source: new OSM(),\n * }),\n * ],\n * target: 'map',\n * });\n *\n * The above snippet creates a map using a {@link module:ol/layer/Tile~TileLayer} to\n * display {@link module:ol/source/OSM~OSM} OSM data and render it to a DOM\n * element with the id `map`.\n *\n * The constructor places a viewport container (with CSS class name\n * `ol-viewport`) in the target element (see `getViewport()`), and then two\n * further elements within the viewport: one with CSS class name\n * `ol-overlaycontainer-stopevent` for controls and some overlays, and one with\n * CSS class name `ol-overlaycontainer` for other overlays (see the `stopEvent`\n * option of {@link module:ol/Overlay~Overlay} for the difference). The map\n * itself is placed in a further element within the viewport.\n *\n * Layers are stored as a {@link module:ol/Collection~Collection} in\n * layerGroups. A top-level group is provided by the library. This is what is\n * accessed by `getLayerGroup` and `setLayerGroup`. Layers entered in the\n * options are added to this group, and `addLayer` and `removeLayer` change the\n * layer collection in the group. `getLayers` is a convenience function for\n * `getLayerGroup().getLayers()`. Note that {@link module:ol/layer/Group~LayerGroup}\n * is a subclass of {@link module:ol/layer/Base~BaseLayer}, so layers entered in the\n * options or added with `addLayer` can be groups, which can contain further\n * groups, and so on.\n *\n * @fires import(\"./MapBrowserEvent.js\").MapBrowserEvent\n * @fires import(\"./MapEvent.js\").MapEvent\n * @fires import(\"./render/Event.js\").default#precompose\n * @fires import(\"./render/Event.js\").default#postcompose\n * @fires import(\"./render/Event.js\").default#rendercomplete\n * @api\n */\nclass Map extends BaseObject {\n /**\n * @param {MapOptions} [options] Map options.\n */\n constructor(options) {\n super();\n\n options = options || {};\n\n /***\n * @type {MapEventHandler}\n */\n this.on;\n\n /***\n * @type {MapEventHandler}\n */\n this.once;\n\n /***\n * @type {MapEventHandler}\n */\n this.un;\n\n const optionsInternal = createOptionsInternal(options);\n\n /**\n * @private\n * @type {boolean|undefined}\n */\n this.renderComplete_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.loaded_ = true;\n\n /** @private */\n this.boundHandleBrowserEvent_ = this.handleBrowserEvent.bind(this);\n\n /**\n * @type {number}\n * @private\n */\n this.maxTilesLoading_ =\n options.maxTilesLoading !== undefined ? options.maxTilesLoading : 16;\n\n /**\n * @private\n * @type {number}\n */\n this.pixelRatio_ =\n options.pixelRatio !== undefined\n ? options.pixelRatio\n : DEVICE_PIXEL_RATIO;\n\n /**\n * @private\n * @type {ReturnType}\n */\n this.postRenderTimeoutHandle_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.animationDelayKey_;\n\n /**\n * @private\n */\n this.animationDelay_ = this.animationDelay_.bind(this);\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.coordinateToPixelTransform_ = createTransform();\n\n /**\n * @private\n * @type {import(\"./transform.js\").Transform}\n */\n this.pixelToCoordinateTransform_ = createTransform();\n\n /**\n * @private\n * @type {number}\n */\n this.frameIndex_ = 0;\n\n /**\n * @private\n * @type {?FrameState}\n */\n this.frameState_ = null;\n\n /**\n * The extent at the previous 'moveend' event.\n * @private\n * @type {import(\"./extent.js\").Extent}\n */\n this.previousExtent_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewPropertyListenerKey_ = null;\n\n /**\n * @private\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.viewChangeListenerKey_ = null;\n\n /**\n * @private\n * @type {?Array}\n */\n this.layerGroupPropertyListenerKeys_ = null;\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.viewport_ = document.createElement('div');\n this.viewport_.className =\n 'ol-viewport' + ('ontouchstart' in window ? ' ol-touch' : '');\n this.viewport_.style.position = 'relative';\n this.viewport_.style.overflow = 'hidden';\n this.viewport_.style.width = '100%';\n this.viewport_.style.height = '100%';\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainer_ = document.createElement('div');\n this.overlayContainer_.style.position = 'absolute';\n this.overlayContainer_.style.zIndex = '0';\n this.overlayContainer_.style.width = '100%';\n this.overlayContainer_.style.height = '100%';\n this.overlayContainer_.style.pointerEvents = 'none';\n this.overlayContainer_.className = 'ol-overlaycontainer';\n this.viewport_.appendChild(this.overlayContainer_);\n\n /**\n * @private\n * @type {!HTMLElement}\n */\n this.overlayContainerStopEvent_ = document.createElement('div');\n this.overlayContainerStopEvent_.style.position = 'absolute';\n this.overlayContainerStopEvent_.style.zIndex = '0';\n this.overlayContainerStopEvent_.style.width = '100%';\n this.overlayContainerStopEvent_.style.height = '100%';\n this.overlayContainerStopEvent_.style.pointerEvents = 'none';\n this.overlayContainerStopEvent_.className = 'ol-overlaycontainer-stopevent';\n this.viewport_.appendChild(this.overlayContainerStopEvent_);\n\n /**\n * @private\n * @type {MapBrowserEventHandler}\n */\n this.mapBrowserEventHandler_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.moveTolerance_ = options.moveTolerance;\n\n /**\n * @private\n * @type {HTMLElement|Document}\n */\n this.keyboardEventTarget_ = optionsInternal.keyboardEventTarget;\n\n /**\n * @private\n * @type {?Array}\n */\n this.targetChangeHandlerKeys_ = null;\n\n /**\n * @private\n * @type {HTMLElement|null}\n */\n this.targetElement_ = null;\n\n /**\n * @type {ResizeObserver}\n */\n this.resizeObserver_ = new ResizeObserver(() => this.updateSize());\n\n /**\n * @type {Collection}\n * @protected\n */\n this.controls = optionsInternal.controls || defaultControls();\n\n /**\n * @type {Collection}\n * @protected\n */\n this.interactions =\n optionsInternal.interactions ||\n defaultInteractions({\n onFocusOnly: true,\n });\n\n /**\n * @type {Collection}\n * @private\n */\n this.overlays_ = optionsInternal.overlays;\n\n /**\n * A lookup of overlays by id.\n * @private\n * @type {Object}\n */\n this.overlayIdIndex_ = {};\n\n /**\n * @type {import(\"./renderer/Map.js\").default|null}\n * @private\n */\n this.renderer_ = null;\n\n /**\n * @private\n * @type {!Array}\n */\n this.postRenderFunctions_ = [];\n\n /**\n * @private\n * @type {TileQueue}\n */\n this.tileQueue_ = new TileQueue(\n this.getTilePriority.bind(this),\n this.handleTileChange_.bind(this)\n );\n\n this.addChangeListener(\n MapProperty.LAYERGROUP,\n this.handleLayerGroupChanged_\n );\n this.addChangeListener(MapProperty.VIEW, this.handleViewChanged_);\n this.addChangeListener(MapProperty.SIZE, this.handleSizeChanged_);\n this.addChangeListener(MapProperty.TARGET, this.handleTargetChanged_);\n\n // setProperties will trigger the rendering of the map if the map\n // is \"defined\" already.\n this.setProperties(optionsInternal.values);\n\n const map = this;\n if (options.view && !(options.view instanceof View)) {\n options.view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n this.controls.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent\n */\n (event) => {\n event.element.setMap(this);\n }\n );\n\n this.controls.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n }\n );\n\n this.interactions.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(this);\n }\n );\n\n this.interactions.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n event.element.setMap(null);\n }\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.ADD,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n this.addOverlayInternal_(event.element);\n }\n );\n\n this.overlays_.addEventListener(\n CollectionEventType.REMOVE,\n /**\n * @param {import(\"./Collection.js\").CollectionEvent} event CollectionEvent.\n */\n (event) => {\n const id = event.element.getId();\n if (id !== undefined) {\n delete this.overlayIdIndex_[id.toString()];\n }\n event.element.setMap(null);\n }\n );\n\n this.controls.forEach(\n /**\n * @param {import(\"./control/Control.js\").default} control Control.\n */\n (control) => {\n control.setMap(this);\n }\n );\n\n this.interactions.forEach(\n /**\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction.\n */\n (interaction) => {\n interaction.setMap(this);\n }\n );\n\n this.overlays_.forEach(this.addOverlayInternal_.bind(this));\n }\n\n /**\n * Add the given control to the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @api\n */\n addControl(control) {\n this.getControls().push(control);\n }\n\n /**\n * Add the given interaction to the map. If you want to add an interaction\n * at another point of the collection use `getInteractions()` and the methods\n * available on {@link module:ol/Collection~Collection}. This can be used to\n * stop the event propagation from the handleEvent function. The interactions\n * get to handle the events in the reverse order of this collection.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to add.\n * @api\n */\n addInteraction(interaction) {\n this.getInteractions().push(interaction);\n }\n\n /**\n * Adds the given layer to the top of this map. If you want to add a layer\n * elsewhere in the stack, use `getLayers()` and the methods available on\n * {@link module:ol/Collection~Collection}.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @api\n */\n addLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n layers.push(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer add event.\n * @private\n */\n handleLayerAdd_(event) {\n setLayerMapProperty(event.layer, this);\n }\n\n /**\n * Add the given overlay to the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @api\n */\n addOverlay(overlay) {\n this.getOverlays().push(overlay);\n }\n\n /**\n * This deals with map's overlay collection changes.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @private\n */\n addOverlayInternal_(overlay) {\n const id = overlay.getId();\n if (id !== undefined) {\n this.overlayIdIndex_[id.toString()] = overlay;\n }\n overlay.setMap(this);\n }\n\n /**\n *\n * Clean up.\n */\n disposeInternal() {\n this.controls.clear();\n this.interactions.clear();\n this.overlays_.clear();\n this.resizeObserver_.disconnect();\n this.setTarget(null);\n super.disposeInternal();\n }\n\n /**\n * Detect features that intersect a pixel on the viewport, and execute a\n * callback with each intersecting feature. Layers included in the detection can\n * be configured through the `layerFilter` option in `options`.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {function(import(\"./Feature.js\").FeatureLike, import(\"./layer/Layer.js\").default, import(\"./geom/SimpleGeometry.js\").default): T} callback Feature callback. The callback will be\n * called with two arguments. The first argument is one\n * {@link module:ol/Feature~Feature feature} or\n * {@link module:ol/render/Feature~RenderFeature render feature} at the pixel, the second is\n * the {@link module:ol/layer/Layer~Layer layer} of the feature and will be null for\n * unmanaged layers. To stop detection, callback functions can return a\n * truthy value.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {T|undefined} Callback result, i.e. the return value of last\n * callback execution, or the first truthy callback return value.\n * @template T\n * @api\n */\n forEachFeatureAtPixel(pixel, callback, options) {\n if (!this.frameState_ || !this.renderer_) {\n return;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.forEachFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n callback,\n null,\n layerFilter,\n null\n );\n }\n\n /**\n * Get all features that intersect a pixel on the viewport.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {Array} The detected features or\n * an empty array if none were found.\n * @api\n */\n getFeaturesAtPixel(pixel, options) {\n const features = [];\n this.forEachFeatureAtPixel(\n pixel,\n function (feature) {\n features.push(feature);\n },\n options\n );\n return features;\n }\n\n /**\n * Get all layers from all layer groups.\n * @return {Array} Layers.\n * @api\n */\n getAllLayers() {\n const layers = [];\n function addLayersFrom(layerGroup) {\n layerGroup.forEach(function (layer) {\n if (layer instanceof LayerGroup) {\n addLayersFrom(layer.getLayers());\n } else {\n layers.push(layer);\n }\n });\n }\n addLayersFrom(this.getLayers());\n return layers;\n }\n\n /**\n * Detect if features intersect a pixel on the viewport. Layers included in the\n * detection can be configured through the `layerFilter` option.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel.\n * @param {AtPixelOptions} [options] Optional options.\n * @return {boolean} Is there a feature at the given pixel?\n * @api\n */\n hasFeatureAtPixel(pixel, options) {\n if (!this.frameState_ || !this.renderer_) {\n return false;\n }\n const coordinate = this.getCoordinateFromPixelInternal(pixel);\n options = options !== undefined ? options : {};\n const layerFilter =\n options.layerFilter !== undefined ? options.layerFilter : TRUE;\n const hitTolerance =\n options.hitTolerance !== undefined ? options.hitTolerance : 0;\n const checkWrapped = options.checkWrapped !== false;\n return this.renderer_.hasFeatureAtCoordinate(\n coordinate,\n this.frameState_,\n hitTolerance,\n checkWrapped,\n layerFilter,\n null\n );\n }\n\n /**\n * Returns the coordinate in user projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n * @api\n */\n getEventCoordinate(event) {\n return this.getCoordinateFromPixel(this.getEventPixel(event));\n }\n\n /**\n * Returns the coordinate in view projection for a browser event.\n * @param {MouseEvent} event Event.\n * @return {import(\"./coordinate.js\").Coordinate} Coordinate.\n */\n getEventCoordinateInternal(event) {\n return this.getCoordinateFromPixelInternal(this.getEventPixel(event));\n }\n\n /**\n * Returns the map pixel position for a browser event relative to the viewport.\n * @param {UIEvent|{clientX: number, clientY: number}} event Event.\n * @return {import(\"./pixel.js\").Pixel} Pixel.\n * @api\n */\n getEventPixel(event) {\n const viewport = this.viewport_;\n const viewportPosition = viewport.getBoundingClientRect();\n const viewportSize = this.getSize();\n const scaleX = viewportPosition.width / viewportSize[0];\n const scaleY = viewportPosition.height / viewportSize[1];\n const eventPosition =\n //FIXME Are we really calling this with a TouchEvent anywhere?\n 'changedTouches' in event\n ? /** @type {TouchEvent} */ (event).changedTouches[0]\n : /** @type {MouseEvent} */ (event);\n\n return [\n (eventPosition.clientX - viewportPosition.left) / scaleX,\n (eventPosition.clientY - viewportPosition.top) / scaleY,\n ];\n }\n\n /**\n * Get the target in which this map is rendered.\n * Note that this returns what is entered as an option or in setTarget:\n * if that was an element, it returns an element; if a string, it returns that.\n * @return {HTMLElement|string|undefined} The Element or id of the Element that the\n * map is rendered in.\n * @observable\n * @api\n */\n getTarget() {\n return /** @type {HTMLElement|string|undefined} */ (\n this.get(MapProperty.TARGET)\n );\n }\n\n /**\n * Get the DOM element into which this map is rendered. In contrast to\n * `getTarget` this method always return an `Element`, or `null` if the\n * map has no target.\n * @return {HTMLElement} The element that the map is rendered in.\n * @api\n */\n getTargetElement() {\n return this.targetElement_;\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * user projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n * @api\n */\n getCoordinateFromPixel(pixel) {\n return toUserCoordinate(\n this.getCoordinateFromPixelInternal(pixel),\n this.getView().getProjection()\n );\n }\n\n /**\n * Get the coordinate for a given pixel. This returns a coordinate in the\n * map view projection.\n * @param {import(\"./pixel.js\").Pixel} pixel Pixel position in the map viewport.\n * @return {import(\"./coordinate.js\").Coordinate} The coordinate for the pixel position.\n */\n getCoordinateFromPixelInternal(pixel) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(frameState.pixelToCoordinateTransform, pixel.slice());\n }\n\n /**\n * Get the map controls. Modifying this collection changes the controls\n * associated with the map.\n * @return {Collection} Controls.\n * @api\n */\n getControls() {\n return this.controls;\n }\n\n /**\n * Get the map overlays. Modifying this collection changes the overlays\n * associated with the map.\n * @return {Collection} Overlays.\n * @api\n */\n getOverlays() {\n return this.overlays_;\n }\n\n /**\n * Get an overlay by its identifier (the value returned by overlay.getId()).\n * Note that the index treats string and numeric identifiers as the same. So\n * `map.getOverlayById(2)` will return an overlay with id `'2'` or `2`.\n * @param {string|number} id Overlay identifier.\n * @return {import(\"./Overlay.js\").default} Overlay.\n * @api\n */\n getOverlayById(id) {\n const overlay = this.overlayIdIndex_[id.toString()];\n return overlay !== undefined ? overlay : null;\n }\n\n /**\n * Get the map interactions. Modifying this collection changes the interactions\n * associated with the map.\n *\n * Interactions are used for e.g. pan, zoom and rotate.\n * @return {Collection} Interactions.\n * @api\n */\n getInteractions() {\n return this.interactions;\n }\n\n /**\n * Get the layergroup associated with this map.\n * @return {LayerGroup} A layer group containing the layers in this map.\n * @observable\n * @api\n */\n getLayerGroup() {\n return /** @type {LayerGroup} */ (this.get(MapProperty.LAYERGROUP));\n }\n\n /**\n * Clear any existing layers and add layers to the map.\n * @param {Array|Collection} layers The layers to be added to the map.\n * @api\n */\n setLayers(layers) {\n const group = this.getLayerGroup();\n if (layers instanceof Collection) {\n group.setLayers(layers);\n return;\n }\n\n const collection = group.getLayers();\n collection.clear();\n collection.extend(layers);\n }\n\n /**\n * Get the collection of layers associated with this map.\n * @return {!Collection} Layers.\n * @api\n */\n getLayers() {\n const layers = this.getLayerGroup().getLayers();\n return layers;\n }\n\n /**\n * @return {boolean} Layers have sources that are still loading.\n */\n getLoadingOrNotReady() {\n const layerStatesArray = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStatesArray.length; i < ii; ++i) {\n const state = layerStatesArray[i];\n if (!state.visible) {\n continue;\n }\n const renderer = state.layer.getRenderer();\n if (renderer && !renderer.ready) {\n return true;\n }\n const source = state.layer.getSource();\n if (source && source.loading) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the user\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n * @api\n */\n getPixelFromCoordinate(coordinate) {\n const viewCoordinate = fromUserCoordinate(\n coordinate,\n this.getView().getProjection()\n );\n return this.getPixelFromCoordinateInternal(viewCoordinate);\n }\n\n /**\n * Get the pixel for a coordinate. This takes a coordinate in the map view\n * projection and returns the corresponding pixel.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate A map coordinate.\n * @return {import(\"./pixel.js\").Pixel} A pixel position in the map viewport.\n */\n getPixelFromCoordinateInternal(coordinate) {\n const frameState = this.frameState_;\n if (!frameState) {\n return null;\n }\n return applyTransform(\n frameState.coordinateToPixelTransform,\n coordinate.slice(0, 2)\n );\n }\n\n /**\n * Get the map renderer.\n * @return {import(\"./renderer/Map.js\").default|null} Renderer\n */\n getRenderer() {\n return this.renderer_;\n }\n\n /**\n * Get the size of this map.\n * @return {import(\"./size.js\").Size|undefined} The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n getSize() {\n return /** @type {import(\"./size.js\").Size|undefined} */ (\n this.get(MapProperty.SIZE)\n );\n }\n\n /**\n * Get the view associated with this map. A view manages properties such as\n * center and resolution.\n * @return {View} The view that controls this map.\n * @observable\n * @api\n */\n getView() {\n return /** @type {View} */ (this.get(MapProperty.VIEW));\n }\n\n /**\n * Get the element that serves as the map viewport.\n * @return {HTMLElement} Viewport.\n * @api\n */\n getViewport() {\n return this.viewport_;\n }\n\n /**\n * Get the element that serves as the container for overlays. Elements added to\n * this container will let mousedown and touchstart events through to the map,\n * so clicks and gestures on an overlay will trigger {@link module:ol/MapBrowserEvent~MapBrowserEvent}\n * events.\n * @return {!HTMLElement} The map's overlay container.\n */\n getOverlayContainer() {\n return this.overlayContainer_;\n }\n\n /**\n * Get the element that serves as a container for overlays that don't allow\n * event propagation. Elements added to this container won't let mousedown and\n * touchstart events through to the map, so clicks and gestures on an overlay\n * don't trigger any {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @return {!HTMLElement} The map's overlay container that stops events.\n */\n getOverlayContainerStopEvent() {\n return this.overlayContainerStopEvent_;\n }\n\n /**\n * @return {!Document} The document where the map is displayed.\n */\n getOwnerDocument() {\n const targetElement = this.getTargetElement();\n return targetElement ? targetElement.ownerDocument : document;\n }\n\n /**\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\n getTilePriority(tile, tileSourceKey, tileCenter, tileResolution) {\n return getTilePriority(\n this.frameState_,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution\n );\n }\n\n /**\n * @param {UIEvent} browserEvent Browser event.\n * @param {string} [type] Type.\n */\n handleBrowserEvent(browserEvent, type) {\n type = type || browserEvent.type;\n const mapBrowserEvent = new MapBrowserEvent(type, this, browserEvent);\n this.handleMapBrowserEvent(mapBrowserEvent);\n }\n\n /**\n * @param {MapBrowserEvent} mapBrowserEvent The event to handle.\n */\n handleMapBrowserEvent(mapBrowserEvent) {\n if (!this.frameState_) {\n // With no view defined, we cannot translate pixels into geographical\n // coordinates so interactions cannot be used.\n return;\n }\n const originalEvent = /** @type {PointerEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const eventType = originalEvent.type;\n if (\n eventType === PointerEventType.POINTERDOWN ||\n eventType === EventType.WHEEL ||\n eventType === EventType.KEYDOWN\n ) {\n const doc = this.getOwnerDocument();\n const rootNode = this.viewport_.getRootNode\n ? this.viewport_.getRootNode()\n : doc;\n const target = /** @type {Node} */ (originalEvent.target);\n if (\n // Abort if the target is a child of the container for elements whose events are not meant\n // to be handled by map interactions.\n this.overlayContainerStopEvent_.contains(target) ||\n // Abort if the event target is a child of the container that is no longer in the page.\n // It's possible for the target to no longer be in the page if it has been removed in an\n // event listener, this might happen in a Control that recreates it's content based on\n // user interaction either manually or via a render in something like https://reactjs.org/\n !(rootNode === doc ? doc.documentElement : rootNode).contains(target)\n ) {\n return;\n }\n }\n mapBrowserEvent.frameState = this.frameState_;\n if (this.dispatchEvent(mapBrowserEvent) !== false) {\n const interactionsArray = this.getInteractions().getArray().slice();\n for (let i = interactionsArray.length - 1; i >= 0; i--) {\n const interaction = interactionsArray[i];\n if (\n interaction.getMap() !== this ||\n !interaction.getActive() ||\n !this.getTargetElement()\n ) {\n continue;\n }\n const cont = interaction.handleEvent(mapBrowserEvent);\n if (!cont || mapBrowserEvent.propagationStopped) {\n break;\n }\n }\n }\n }\n\n /**\n * @protected\n */\n handlePostRender() {\n const frameState = this.frameState_;\n\n // Manage the tile queue\n // Image loads are expensive and a limited resource, so try to use them\n // efficiently:\n // * When the view is static we allow a large number of parallel tile loads\n // to complete the frame as quickly as possible.\n // * When animating or interacting, image loads can cause janks, so we reduce\n // the maximum number of loads per frame and limit the number of parallel\n // tile loads to remain reactive to view changes and to reduce the chance of\n // loading tiles that will quickly disappear from view.\n const tileQueue = this.tileQueue_;\n if (!tileQueue.isEmpty()) {\n let maxTotalLoading = this.maxTilesLoading_;\n let maxNewLoads = maxTotalLoading;\n if (frameState) {\n const hints = frameState.viewHints;\n if (hints[ViewHint.ANIMATING] || hints[ViewHint.INTERACTING]) {\n const lowOnFrameBudget = Date.now() - frameState.time > 8;\n maxTotalLoading = lowOnFrameBudget ? 0 : 8;\n maxNewLoads = lowOnFrameBudget ? 0 : 2;\n }\n }\n if (tileQueue.getTilesLoading() < maxTotalLoading) {\n tileQueue.reprioritize(); // FIXME only call if view has changed\n tileQueue.loadMoreTiles(maxTotalLoading, maxNewLoads);\n }\n }\n\n if (frameState && this.renderer_ && !frameState.animate) {\n if (this.renderComplete_ === true) {\n if (this.hasListener(RenderEventType.RENDERCOMPLETE)) {\n this.renderer_.dispatchRenderEvent(\n RenderEventType.RENDERCOMPLETE,\n frameState\n );\n }\n if (this.loaded_ === false) {\n this.loaded_ = true;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADEND, this, frameState)\n );\n }\n } else if (this.loaded_ === true) {\n this.loaded_ = false;\n this.dispatchEvent(\n new MapEvent(MapEventType.LOADSTART, this, frameState)\n );\n }\n }\n\n const postRenderFunctions = this.postRenderFunctions_;\n for (let i = 0, ii = postRenderFunctions.length; i < ii; ++i) {\n postRenderFunctions[i](this, frameState);\n }\n postRenderFunctions.length = 0;\n }\n\n /**\n * @private\n */\n handleSizeChanged_() {\n if (this.getView() && !this.getView().getAnimating()) {\n this.getView().resolveConstraints(0);\n }\n\n this.render();\n }\n\n /**\n * @private\n */\n handleTargetChanged_() {\n if (this.mapBrowserEventHandler_) {\n for (let i = 0, ii = this.targetChangeHandlerKeys_.length; i < ii; ++i) {\n unlistenByKey(this.targetChangeHandlerKeys_[i]);\n }\n this.targetChangeHandlerKeys_ = null;\n this.viewport_.removeEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_\n );\n this.viewport_.removeEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_\n );\n this.mapBrowserEventHandler_.dispose();\n this.mapBrowserEventHandler_ = null;\n removeNode(this.viewport_);\n }\n\n if (this.targetElement_) {\n this.resizeObserver_.unobserve(this.targetElement_);\n const rootNode = this.targetElement_.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.unobserve(rootNode.host);\n }\n this.setSize(undefined);\n }\n\n // target may be undefined, null, a string or an Element.\n // If it's a string we convert it to an Element before proceeding.\n // If it's not now an Element we remove the viewport from the DOM.\n // If it's an Element we append the viewport element to it.\n\n const target = this.getTarget();\n const targetElement =\n typeof target === 'string' ? document.getElementById(target) : target;\n this.targetElement_ = targetElement;\n if (!targetElement) {\n if (this.renderer_) {\n clearTimeout(this.postRenderTimeoutHandle_);\n this.postRenderTimeoutHandle_ = undefined;\n this.postRenderFunctions_.length = 0;\n this.renderer_.dispose();\n this.renderer_ = null;\n }\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n this.animationDelayKey_ = undefined;\n }\n } else {\n targetElement.appendChild(this.viewport_);\n if (!this.renderer_) {\n this.renderer_ = new CompositeMapRenderer(this);\n }\n\n this.mapBrowserEventHandler_ = new MapBrowserEventHandler(\n this,\n this.moveTolerance_\n );\n for (const key in MapBrowserEventType) {\n this.mapBrowserEventHandler_.addEventListener(\n MapBrowserEventType[key],\n this.handleMapBrowserEvent.bind(this)\n );\n }\n this.viewport_.addEventListener(\n EventType.CONTEXTMENU,\n this.boundHandleBrowserEvent_,\n false\n );\n this.viewport_.addEventListener(\n EventType.WHEEL,\n this.boundHandleBrowserEvent_,\n PASSIVE_EVENT_LISTENERS ? {passive: false} : false\n );\n\n const keyboardEventTarget = !this.keyboardEventTarget_\n ? targetElement\n : this.keyboardEventTarget_;\n this.targetChangeHandlerKeys_ = [\n listen(\n keyboardEventTarget,\n EventType.KEYDOWN,\n this.handleBrowserEvent,\n this\n ),\n listen(\n keyboardEventTarget,\n EventType.KEYPRESS,\n this.handleBrowserEvent,\n this\n ),\n ];\n const rootNode = targetElement.getRootNode();\n if (rootNode instanceof ShadowRoot) {\n this.resizeObserver_.observe(rootNode.host);\n }\n this.resizeObserver_.observe(targetElement);\n }\n\n this.updateSize();\n // updateSize calls setSize, so no need to call this.render\n // ourselves here.\n }\n\n /**\n * @private\n */\n handleTileChange_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewPropertyChanged_() {\n this.render();\n }\n\n /**\n * @private\n */\n handleViewChanged_() {\n if (this.viewPropertyListenerKey_) {\n unlistenByKey(this.viewPropertyListenerKey_);\n this.viewPropertyListenerKey_ = null;\n }\n if (this.viewChangeListenerKey_) {\n unlistenByKey(this.viewChangeListenerKey_);\n this.viewChangeListenerKey_ = null;\n }\n const view = this.getView();\n if (view) {\n this.updateViewportSize_(this.getSize());\n\n this.viewPropertyListenerKey_ = listen(\n view,\n ObjectEventType.PROPERTYCHANGE,\n this.handleViewPropertyChanged_,\n this\n );\n this.viewChangeListenerKey_ = listen(\n view,\n EventType.CHANGE,\n this.handleViewPropertyChanged_,\n this\n );\n\n view.resolveConstraints(0);\n }\n this.render();\n }\n\n /**\n * @private\n */\n handleLayerGroupChanged_() {\n if (this.layerGroupPropertyListenerKeys_) {\n this.layerGroupPropertyListenerKeys_.forEach(unlistenByKey);\n this.layerGroupPropertyListenerKeys_ = null;\n }\n const layerGroup = this.getLayerGroup();\n if (layerGroup) {\n this.handleLayerAdd_(new GroupEvent('addlayer', layerGroup));\n this.layerGroupPropertyListenerKeys_ = [\n listen(layerGroup, ObjectEventType.PROPERTYCHANGE, this.render, this),\n listen(layerGroup, EventType.CHANGE, this.render, this),\n listen(layerGroup, 'addlayer', this.handleLayerAdd_, this),\n listen(layerGroup, 'removelayer', this.handleLayerRemove_, this),\n ];\n }\n this.render();\n }\n\n /**\n * @return {boolean} Is rendered.\n */\n isRendered() {\n return !!this.frameState_;\n }\n\n /**\n * @private\n */\n animationDelay_() {\n this.animationDelayKey_ = undefined;\n this.renderFrame_(Date.now());\n }\n\n /**\n * Requests an immediate render in a synchronous manner.\n * @api\n */\n renderSync() {\n if (this.animationDelayKey_) {\n cancelAnimationFrame(this.animationDelayKey_);\n }\n this.animationDelay_();\n }\n\n /**\n * Redraws all text after new fonts have loaded\n */\n redrawText() {\n const layerStates = this.getLayerGroup().getLayerStatesArray();\n for (let i = 0, ii = layerStates.length; i < ii; ++i) {\n const layer = layerStates[i].layer;\n if (layer.hasRenderer()) {\n layer.getRenderer().handleFontsChanged();\n }\n }\n }\n\n /**\n * Request a map rendering (at the next animation frame).\n * @api\n */\n render() {\n if (this.renderer_ && this.animationDelayKey_ === undefined) {\n this.animationDelayKey_ = requestAnimationFrame(this.animationDelay_);\n }\n }\n\n /**\n * This method is meant to be called in a layer's `prerender` listener. It causes all collected\n * declutter items to be decluttered and rendered on the map immediately. This is useful for\n * layers that need to appear entirely above the decluttered items of layers lower in the layer\n * stack.\n * @api\n */\n flushDeclutterItems() {\n const frameState = this.frameState_;\n if (!frameState) {\n return;\n }\n this.renderer_.flushDeclutterItems(frameState);\n }\n\n /**\n * Remove the given control from the map.\n * @param {import(\"./control/Control.js\").default} control Control.\n * @return {import(\"./control/Control.js\").default|undefined} The removed control (or undefined\n * if the control was not found).\n * @api\n */\n removeControl(control) {\n return this.getControls().remove(control);\n }\n\n /**\n * Remove the given interaction from the map.\n * @param {import(\"./interaction/Interaction.js\").default} interaction Interaction to remove.\n * @return {import(\"./interaction/Interaction.js\").default|undefined} The removed interaction (or\n * undefined if the interaction was not found).\n * @api\n */\n removeInteraction(interaction) {\n return this.getInteractions().remove(interaction);\n }\n\n /**\n * Removes the given layer from the map.\n * @param {import(\"./layer/Base.js\").default} layer Layer.\n * @return {import(\"./layer/Base.js\").default|undefined} The removed layer (or undefined if the\n * layer was not found).\n * @api\n */\n removeLayer(layer) {\n const layers = this.getLayerGroup().getLayers();\n return layers.remove(layer);\n }\n\n /**\n * @param {import(\"./layer/Group.js\").GroupEvent} event The layer remove event.\n * @private\n */\n handleLayerRemove_(event) {\n removeLayerMapProperty(event.layer);\n }\n\n /**\n * Remove the given overlay from the map.\n * @param {import(\"./Overlay.js\").default} overlay Overlay.\n * @return {import(\"./Overlay.js\").default|undefined} The removed overlay (or undefined\n * if the overlay was not found).\n * @api\n */\n removeOverlay(overlay) {\n return this.getOverlays().remove(overlay);\n }\n\n /**\n * @param {number} time Time.\n * @private\n */\n renderFrame_(time) {\n const size = this.getSize();\n const view = this.getView();\n const previousFrameState = this.frameState_;\n /** @type {?FrameState} */\n let frameState = null;\n if (size !== undefined && hasArea(size) && view && view.isDef()) {\n const viewHints = view.getHints(\n this.frameState_ ? this.frameState_.viewHints : undefined\n );\n const viewState = view.getState();\n frameState = {\n animate: false,\n coordinateToPixelTransform: this.coordinateToPixelTransform_,\n declutterTree: null,\n extent: getForViewAndSize(\n viewState.center,\n viewState.resolution,\n viewState.rotation,\n size\n ),\n index: this.frameIndex_++,\n layerIndex: 0,\n layerStatesArray: this.getLayerGroup().getLayerStatesArray(),\n pixelRatio: this.pixelRatio_,\n pixelToCoordinateTransform: this.pixelToCoordinateTransform_,\n postRenderFunctions: [],\n size: size,\n tileQueue: this.tileQueue_,\n time: time,\n usedTiles: {},\n viewState: viewState,\n viewHints: viewHints,\n wantedTiles: {},\n mapId: getUid(this),\n renderTargets: {},\n };\n if (viewState.nextCenter && viewState.nextResolution) {\n const rotation = isNaN(viewState.nextRotation)\n ? viewState.rotation\n : viewState.nextRotation;\n\n frameState.nextExtent = getForViewAndSize(\n viewState.nextCenter,\n viewState.nextResolution,\n rotation,\n size\n );\n }\n }\n\n this.frameState_ = frameState;\n this.renderer_.renderFrame(frameState);\n\n if (frameState) {\n if (frameState.animate) {\n this.render();\n }\n Array.prototype.push.apply(\n this.postRenderFunctions_,\n frameState.postRenderFunctions\n );\n\n if (previousFrameState) {\n const moveStart =\n !this.previousExtent_ ||\n (!isEmpty(this.previousExtent_) &&\n !equalsExtent(frameState.extent, this.previousExtent_));\n if (moveStart) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVESTART, this, previousFrameState)\n );\n this.previousExtent_ = createOrUpdateEmpty(this.previousExtent_);\n }\n }\n\n const idle =\n this.previousExtent_ &&\n !frameState.viewHints[ViewHint.ANIMATING] &&\n !frameState.viewHints[ViewHint.INTERACTING] &&\n !equalsExtent(frameState.extent, this.previousExtent_);\n\n if (idle) {\n this.dispatchEvent(\n new MapEvent(MapEventType.MOVEEND, this, frameState)\n );\n clone(frameState.extent, this.previousExtent_);\n }\n }\n\n this.dispatchEvent(new MapEvent(MapEventType.POSTRENDER, this, frameState));\n\n this.renderComplete_ =\n this.hasListener(MapEventType.LOADSTART) ||\n this.hasListener(MapEventType.LOADEND) ||\n this.hasListener(RenderEventType.RENDERCOMPLETE)\n ? !this.tileQueue_.getTilesLoading() &&\n !this.tileQueue_.getCount() &&\n !this.getLoadingOrNotReady()\n : undefined;\n\n if (!this.postRenderTimeoutHandle_) {\n this.postRenderTimeoutHandle_ = setTimeout(() => {\n this.postRenderTimeoutHandle_ = undefined;\n this.handlePostRender();\n }, 0);\n }\n }\n\n /**\n * Sets the layergroup of this map.\n * @param {LayerGroup} layerGroup A layer group containing the layers in this map.\n * @observable\n * @api\n */\n setLayerGroup(layerGroup) {\n const oldLayerGroup = this.getLayerGroup();\n if (oldLayerGroup) {\n this.handleLayerRemove_(new GroupEvent('removelayer', oldLayerGroup));\n }\n this.set(MapProperty.LAYERGROUP, layerGroup);\n }\n\n /**\n * Set the size of this map.\n * @param {import(\"./size.js\").Size|undefined} size The size in pixels of the map in the DOM.\n * @observable\n * @api\n */\n setSize(size) {\n this.set(MapProperty.SIZE, size);\n }\n\n /**\n * Set the target element to render this map into.\n * @param {HTMLElement|string} [target] The Element or id of the Element\n * that the map is rendered in.\n * @observable\n * @api\n */\n setTarget(target) {\n this.set(MapProperty.TARGET, target);\n }\n\n /**\n * Set the view for this map.\n * @param {View|Promise} view The view that controls this map.\n * It is also possible to pass a promise that resolves to options for constructing a view. This\n * alternative allows view properties to be resolved by sources or other components that load\n * view-related metadata.\n * @observable\n * @api\n */\n setView(view) {\n if (!view || view instanceof View) {\n this.set(MapProperty.VIEW, view);\n return;\n }\n this.set(MapProperty.VIEW, new View());\n\n const map = this;\n view.then(function (viewOptions) {\n map.setView(new View(viewOptions));\n });\n }\n\n /**\n * Force a recalculation of the map viewport size. This should be called when\n * third-party code changes the size of the map viewport.\n * @api\n */\n updateSize() {\n const targetElement = this.getTargetElement();\n\n let size = undefined;\n if (targetElement) {\n const computedStyle = getComputedStyle(targetElement);\n const width =\n targetElement.offsetWidth -\n parseFloat(computedStyle['borderLeftWidth']) -\n parseFloat(computedStyle['paddingLeft']) -\n parseFloat(computedStyle['paddingRight']) -\n parseFloat(computedStyle['borderRightWidth']);\n const height =\n targetElement.offsetHeight -\n parseFloat(computedStyle['borderTopWidth']) -\n parseFloat(computedStyle['paddingTop']) -\n parseFloat(computedStyle['paddingBottom']) -\n parseFloat(computedStyle['borderBottomWidth']);\n if (!isNaN(width) && !isNaN(height)) {\n size = [width, height];\n if (\n !hasArea(size) &&\n !!(\n targetElement.offsetWidth ||\n targetElement.offsetHeight ||\n targetElement.getClientRects().length\n )\n ) {\n warn(\n \"No map visible because the map container's width or height are 0.\"\n );\n }\n }\n }\n\n const oldSize = this.getSize();\n if (size && (!oldSize || !equals(size, oldSize))) {\n this.setSize(size);\n this.updateViewportSize_(size);\n }\n }\n\n /**\n * Recomputes the viewport size and save it on the view object (if any)\n * @param {import(\"./size.js\").Size|undefined} size The size.\n * @private\n */\n updateViewportSize_(size) {\n const view = this.getView();\n if (view) {\n view.setViewportSize(size);\n }\n }\n}\n\n/**\n * @param {MapOptions} options Map options.\n * @return {MapOptionsInternal} Internal map options.\n */\nfunction createOptionsInternal(options) {\n /**\n * @type {HTMLElement|Document}\n */\n let keyboardEventTarget = null;\n if (options.keyboardEventTarget !== undefined) {\n keyboardEventTarget =\n typeof options.keyboardEventTarget === 'string'\n ? document.getElementById(options.keyboardEventTarget)\n : options.keyboardEventTarget;\n }\n\n /**\n * @type {Object}\n */\n const values = {};\n\n const layerGroup =\n options.layers &&\n typeof (/** @type {?} */ (options.layers).getLayers) === 'function'\n ? /** @type {LayerGroup} */ (options.layers)\n : new LayerGroup({\n layers:\n /** @type {Collection|Array} */ (\n options.layers\n ),\n });\n values[MapProperty.LAYERGROUP] = layerGroup;\n\n values[MapProperty.TARGET] = options.target;\n\n values[MapProperty.VIEW] =\n options.view instanceof View ? options.view : new View();\n\n /** @type {Collection} */\n let controls;\n if (options.controls !== undefined) {\n if (Array.isArray(options.controls)) {\n controls = new Collection(options.controls.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.controls).getArray) === 'function',\n 'Expected `controls` to be an array or an `ol/Collection.js`'\n );\n controls = options.controls;\n }\n }\n\n /** @type {Collection} */\n let interactions;\n if (options.interactions !== undefined) {\n if (Array.isArray(options.interactions)) {\n interactions = new Collection(options.interactions.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.interactions).getArray) ===\n 'function',\n 'Expected `interactions` to be an array or an `ol/Collection.js`'\n );\n interactions = options.interactions;\n }\n }\n\n /** @type {Collection} */\n let overlays;\n if (options.overlays !== undefined) {\n if (Array.isArray(options.overlays)) {\n overlays = new Collection(options.overlays.slice());\n } else {\n assert(\n typeof (/** @type {?} */ (options.overlays).getArray) === 'function',\n 'Expected `overlays` to be an array or an `ol/Collection.js`'\n );\n overlays = options.overlays;\n }\n } else {\n overlays = new Collection();\n }\n\n return {\n controls: controls,\n interactions: interactions,\n keyboardEventTarget: keyboardEventTarget,\n overlays: overlays,\n values: values,\n };\n}\nexport default Map;\n","/**\n * @module ol/MapBrowserEvent\n */\nimport MapEvent from './MapEvent.js';\n\n/**\n * @classdesc\n * Events emitted as map browser events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map browser event.\n * @template {UIEvent} EVENT\n */\nclass MapBrowserEvent extends MapEvent {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {EVENT} originalEvent Original event.\n * @param {boolean} [dragging] Is the map currently being dragged?\n * @param {import(\"./Map.js\").FrameState} [frameState] Frame state.\n * @param {Array} [activePointers] Active pointers.\n */\n constructor(type, map, originalEvent, dragging, frameState, activePointers) {\n super(type, map, frameState);\n\n /**\n * The original browser event.\n * @const\n * @type {EVENT}\n * @api\n */\n this.originalEvent = originalEvent;\n\n /**\n * The map pixel relative to the viewport corresponding to the original browser event.\n * @type {?import(\"./pixel.js\").Pixel}\n */\n this.pixel_ = null;\n\n /**\n * The coordinate in the user projection corresponding to the original browser event.\n * @type {?import(\"./coordinate.js\").Coordinate}\n */\n this.coordinate_ = null;\n\n /**\n * Indicates if the map is currently being dragged. Only set for\n * `POINTERDRAG` and `POINTERMOVE` events. Default is `false`.\n *\n * @type {boolean}\n * @api\n */\n this.dragging = dragging !== undefined ? dragging : false;\n\n /**\n * @type {Array|undefined}\n */\n this.activePointers = activePointers;\n }\n\n /**\n * The map pixel relative to the viewport corresponding to the original event.\n * @type {import(\"./pixel.js\").Pixel}\n * @api\n */\n get pixel() {\n if (!this.pixel_) {\n this.pixel_ = this.map.getEventPixel(this.originalEvent);\n }\n return this.pixel_;\n }\n set pixel(pixel) {\n this.pixel_ = pixel;\n }\n\n /**\n * The coordinate corresponding to the original browser event. This will be in the user\n * projection if one is set. Otherwise it will be in the view projection.\n * @type {import(\"./coordinate.js\").Coordinate}\n * @api\n */\n get coordinate() {\n if (!this.coordinate_) {\n this.coordinate_ = this.map.getCoordinateFromPixel(this.pixel);\n }\n return this.coordinate_;\n }\n set coordinate(coordinate) {\n this.coordinate_ = coordinate;\n }\n\n /**\n * Prevents the default browser action.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.preventDefault.\n * @api\n */\n preventDefault() {\n super.preventDefault();\n if ('preventDefault' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).preventDefault();\n }\n }\n\n /**\n * Prevents further propagation of the current event.\n * See https://developer.mozilla.org/en-US/docs/Web/API/event.stopPropagation.\n * @api\n */\n stopPropagation() {\n super.stopPropagation();\n if ('stopPropagation' in this.originalEvent) {\n /** @type {UIEvent} */ (this.originalEvent).stopPropagation();\n }\n }\n}\n\nexport default MapBrowserEvent;\n","/**\n * @module ol/MapBrowserEventType\n */\nimport EventType from './events/EventType.js';\n\n/**\n * Constants for event names.\n * @enum {string}\n */\nexport default {\n /**\n * A true single click with no dragging and no double click. Note that this\n * event is delayed by 250 ms to ensure that it is not a double click.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#singleclick\n * @api\n */\n SINGLECLICK: 'singleclick',\n\n /**\n * A click with no dragging. A double click will fire two of this.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#click\n * @api\n */\n CLICK: EventType.CLICK,\n\n /**\n * A true double click, with no dragging.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#dblclick\n * @api\n */\n DBLCLICK: EventType.DBLCLICK,\n\n /**\n * Triggered when a pointer is dragged.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointerdrag\n * @api\n */\n POINTERDRAG: 'pointerdrag',\n\n /**\n * Triggered when a pointer is moved. Note that on touch devices this is\n * triggered when the map is panned, so is not the same as mousemove.\n * @event module:ol/MapBrowserEvent~MapBrowserEvent#pointermove\n * @api\n */\n POINTERMOVE: 'pointermove',\n\n POINTERDOWN: 'pointerdown',\n POINTERUP: 'pointerup',\n POINTEROVER: 'pointerover',\n POINTEROUT: 'pointerout',\n POINTERENTER: 'pointerenter',\n POINTERLEAVE: 'pointerleave',\n POINTERCANCEL: 'pointercancel',\n};\n\n/***\n * @typedef {'singleclick'|'click'|'dblclick'|'pointerdrag'|'pointermove'} Types\n */\n","/**\n * @module ol/MapEvent\n */\nimport Event from './events/Event.js';\n\n/**\n * @classdesc\n * Events emitted as map events are instances of this type.\n * See {@link module:ol/Map~Map} for which events trigger a map event.\n */\nclass MapEvent extends Event {\n /**\n * @param {string} type Event type.\n * @param {import(\"./Map.js\").default} map Map.\n * @param {?import(\"./Map.js\").FrameState} [frameState] Frame state.\n */\n constructor(type, map, frameState) {\n super(type);\n\n /**\n * The map where the event occurred.\n * @type {import(\"./Map.js\").default}\n * @api\n */\n this.map = map;\n\n /**\n * The frame state at the time of the event.\n * @type {?import(\"./Map.js\").FrameState}\n * @api\n */\n this.frameState = frameState !== undefined ? frameState : null;\n }\n}\n\nexport default MapEvent;\n","/**\n * @module ol/MapEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered after a map frame is rendered.\n * @event module:ol/MapEvent~MapEvent#postrender\n * @api\n */\n POSTRENDER: 'postrender',\n\n /**\n * Triggered when the map starts moving.\n * @event module:ol/MapEvent~MapEvent#movestart\n * @api\n */\n MOVESTART: 'movestart',\n\n /**\n * Triggered after the map is moved.\n * @event module:ol/MapEvent~MapEvent#moveend\n * @api\n */\n MOVEEND: 'moveend',\n\n /**\n * Triggered when loading of additional map data (tiles, images, features) starts.\n * @event module:ol/MapEvent~MapEvent#loadstart\n * @api\n */\n LOADSTART: 'loadstart',\n\n /**\n * Triggered when loading of additional map data has completed.\n * @event module:ol/MapEvent~MapEvent#loadend\n * @api\n */\n LOADEND: 'loadend',\n};\n\n/***\n * @typedef {'postrender'|'movestart'|'moveend'|'loadstart'|'loadend'} Types\n */\n","/**\n * @module ol/MapProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n LAYERGROUP: 'layergroup',\n SIZE: 'size',\n TARGET: 'target',\n VIEW: 'view',\n};\n","/**\n * @module ol/Object\n */\nimport Event from './events/Event.js';\nimport ObjectEventType from './ObjectEventType.js';\nimport Observable from './Observable.js';\nimport {getUid} from './util.js';\nimport {isEmpty} from './obj.js';\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/Object~BaseObject} instances are instances of this type.\n */\nexport class ObjectEvent extends Event {\n /**\n * @param {string} type The event type.\n * @param {string} key The property name.\n * @param {*} oldValue The old value for `key`.\n */\n constructor(type, key, oldValue) {\n super(type);\n\n /**\n * The name of the property whose value is changing.\n * @type {string}\n * @api\n */\n this.key = key;\n\n /**\n * The old value. To get the new value use `e.target.get(e.key)` where\n * `e` is the event object.\n * @type {*}\n * @api\n */\n this.oldValue = oldValue;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ObjectOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Most non-trivial classes inherit from this.\n *\n * This extends {@link module:ol/Observable~Observable} with observable\n * properties, where each property is observable as well as the object as a\n * whole.\n *\n * Classes that inherit from this have pre-defined properties, to which you can\n * add your owns. The pre-defined properties are listed in this documentation as\n * 'Observable Properties', and have their own accessors; for example,\n * {@link module:ol/Map~Map} has a `target` property, accessed with\n * `getTarget()` and changed with `setTarget()`. Not all properties are however\n * settable. There are also general-purpose accessors `get()` and `set()`. For\n * example, `get('target')` is equivalent to `getTarget()`.\n *\n * The `set` accessors trigger a change event, and you can monitor this by\n * registering a listener. For example, {@link module:ol/View~View} has a\n * `center` property, so `view.on('change:center', function(evt) {...});` would\n * call the function whenever the value of the center property changes. Within\n * the function, `evt.target` would be the view, so `evt.target.getCenter()`\n * would return the new center.\n *\n * You can add your own observable properties with\n * `object.set('prop', 'value')`, and retrieve that with `object.get('prop')`.\n * You can listen for changes on that property value with\n * `object.on('change:prop', listener)`. You can get a list of all\n * properties with {@link module:ol/Object~BaseObject#getProperties}.\n *\n * Note that the observable properties are separate from standard JS properties.\n * You can, for example, give your map object a title with\n * `map.title='New title'` and with `map.set('title', 'Another title')`. The\n * first will be a `hasOwnProperty`; the second will appear in\n * `getProperties()`. Only the second is observable.\n *\n * Properties can be deleted by using the unset method. E.g.\n * object.unset('foo').\n *\n * @fires ObjectEvent\n * @api\n */\nclass BaseObject extends Observable {\n /**\n * @param {Object} [values] An object with key-value pairs.\n */\n constructor(values) {\n super();\n\n /***\n * @type {ObjectOnSignature}\n */\n this.on;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.once;\n\n /***\n * @type {ObjectOnSignature}\n */\n this.un;\n\n // Call {@link module:ol/util.getUid} to ensure that the order of objects' ids is\n // the same as the order in which they were created. This also helps to\n // ensure that object properties are always added in the same order, which\n // helps many JavaScript engines generate faster code.\n getUid(this);\n\n /**\n * @private\n * @type {Object|null}\n */\n this.values_ = null;\n\n if (values !== undefined) {\n this.setProperties(values);\n }\n }\n\n /**\n * Gets a value.\n * @param {string} key Key name.\n * @return {*} Value.\n * @api\n */\n get(key) {\n let value;\n if (this.values_ && this.values_.hasOwnProperty(key)) {\n value = this.values_[key];\n }\n return value;\n }\n\n /**\n * Get a list of object property names.\n * @return {Array} List of property names.\n * @api\n */\n getKeys() {\n return (this.values_ && Object.keys(this.values_)) || [];\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object} Object.\n * @api\n */\n getProperties() {\n return (this.values_ && Object.assign({}, this.values_)) || {};\n }\n\n /**\n * Get an object of all property names and values.\n * @return {Object?} Object.\n */\n getPropertiesInternal() {\n return this.values_;\n }\n\n /**\n * @return {boolean} The object has properties.\n */\n hasProperties() {\n return !!this.values_;\n }\n\n /**\n * @param {string} key Key name.\n * @param {*} oldValue Old value.\n */\n notify(key, oldValue) {\n let eventType;\n eventType = `change:${key}`;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n eventType = ObjectEventType.PROPERTYCHANGE;\n if (this.hasListener(eventType)) {\n this.dispatchEvent(new ObjectEvent(eventType, key, oldValue));\n }\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n addChangeListener(key, listener) {\n this.addEventListener(`change:${key}`, listener);\n }\n\n /**\n * @param {string} key Key name.\n * @param {import(\"./events.js\").Listener} listener Listener.\n */\n removeChangeListener(key, listener) {\n this.removeEventListener(`change:${key}`, listener);\n }\n\n /**\n * Sets a value.\n * @param {string} key Key name.\n * @param {*} value Value.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n set(key, value, silent) {\n const values = this.values_ || (this.values_ = {});\n if (silent) {\n values[key] = value;\n } else {\n const oldValue = values[key];\n values[key] = value;\n if (oldValue !== value) {\n this.notify(key, oldValue);\n }\n }\n }\n\n /**\n * Sets a collection of key-value pairs. Note that this changes any existing\n * properties and adds new ones (it does not remove any existing properties).\n * @param {Object} values Values.\n * @param {boolean} [silent] Update without triggering an event.\n * @api\n */\n setProperties(values, silent) {\n for (const key in values) {\n this.set(key, values[key], silent);\n }\n }\n\n /**\n * Apply any properties from another object without triggering events.\n * @param {BaseObject} source The source object.\n * @protected\n */\n applyProperties(source) {\n if (!source.values_) {\n return;\n }\n Object.assign(this.values_ || (this.values_ = {}), source.values_);\n }\n\n /**\n * Unsets a property.\n * @param {string} key Key name.\n * @param {boolean} [silent] Unset without triggering an event.\n * @api\n */\n unset(key, silent) {\n if (this.values_ && key in this.values_) {\n const oldValue = this.values_[key];\n delete this.values_[key];\n if (isEmpty(this.values_)) {\n this.values_ = null;\n }\n if (!silent) {\n this.notify(key, oldValue);\n }\n }\n }\n}\n\nexport default BaseObject;\n","/**\n * @module ol/ObjectEventType\n */\n\n/**\n * @enum {string}\n */\nexport default {\n /**\n * Triggered when a property is changed.\n * @event module:ol/Object.ObjectEvent#propertychange\n * @api\n */\n PROPERTYCHANGE: 'propertychange',\n};\n\n/**\n * @typedef {'propertychange'} Types\n */\n","/**\n * @module ol/Observable\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport {listen, listenOnce, unlistenByKey} from './events.js';\n\n/***\n * @template {string} Type\n * @template {Event|import(\"./events/Event.js\").default} EventClass\n * @template Return\n * @typedef {(type: Type, listener: (event: EventClass) => ?) => Return} OnSignature\n */\n\n/***\n * @template {string} Type\n * @template Return\n * @typedef {(type: Type[], listener: (event: Event|import(\"./events/Event\").default) => ?) => Return extends void ? void : Return[]} CombinedOnSignature\n */\n\n/**\n * @typedef {'change'|'error'} EventTypes\n */\n\n/***\n * @template Return\n * @typedef {OnSignature & CombinedOnSignature} ObservableOnSignature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * An event target providing convenient methods for listener registration\n * and unregistration. A generic `change` event is always available through\n * {@link module:ol/Observable~Observable#changed}.\n *\n * @fires import(\"./events/Event.js\").default\n * @api\n */\nclass Observable extends EventTarget {\n constructor() {\n super();\n\n this.on =\n /** @type {ObservableOnSignature} */ (\n this.onInternal\n );\n\n this.once =\n /** @type {ObservableOnSignature} */ (\n this.onceInternal\n );\n\n this.un = /** @type {ObservableOnSignature} */ (this.unInternal);\n\n /**\n * @private\n * @type {number}\n */\n this.revision_ = 0;\n }\n\n /**\n * Increases the revision counter and dispatches a 'change' event.\n * @api\n */\n changed() {\n ++this.revision_;\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Get the version number for this object. Each time the object is modified,\n * its version number will be incremented.\n * @return {number} Revision.\n * @api\n */\n getRevision() {\n return this.revision_;\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onInternal(type, listener) {\n if (Array.isArray(type)) {\n const len = type.length;\n const keys = new Array(len);\n for (let i = 0; i < len; ++i) {\n keys[i] = listen(this, type[i], listener);\n }\n return keys;\n }\n return listen(this, /** @type {string} */ (type), listener);\n }\n\n /**\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @return {import(\"./events.js\").EventsKey|Array} Event key.\n * @protected\n */\n onceInternal(type, listener) {\n let key;\n if (Array.isArray(type)) {\n const len = type.length;\n key = new Array(len);\n for (let i = 0; i < len; ++i) {\n key[i] = listenOnce(this, type[i], listener);\n }\n } else {\n key = listenOnce(this, /** @type {string} */ (type), listener);\n }\n /** @type {Object} */ (listener).ol_key = key;\n return key;\n }\n\n /**\n * Unlisten for a certain type of event.\n * @param {string|Array} type Type.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener Listener.\n * @protected\n */\n unInternal(type, listener) {\n const key = /** @type {Object} */ (listener).ol_key;\n if (key) {\n unByKey(key);\n } else if (Array.isArray(type)) {\n for (let i = 0, ii = type.length; i < ii; ++i) {\n this.removeEventListener(type[i], listener);\n }\n } else {\n this.removeEventListener(type, listener);\n }\n }\n}\n\n/**\n * Listen for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.on;\n\n/**\n * Listen once for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @return {import(\"./events.js\").EventsKey|Array} Unique key for the listener. If\n * called with an array of event types as the first argument, the return\n * will be an array of keys.\n * @api\n */\nObservable.prototype.once;\n\n/**\n * Unlisten for a certain type of event.\n * @function\n * @param {string|Array} type The event type or array of event types.\n * @param {function((Event|import(\"./events/Event\").default)): ?} listener The listener function.\n * @api\n */\nObservable.prototype.un;\n\n/**\n * Removes an event listener using the key returned by `on()` or `once()`.\n * @param {import(\"./events.js\").EventsKey|Array} key The key returned by `on()`\n * or `once()` (or an array of keys).\n * @api\n */\nexport function unByKey(key) {\n if (Array.isArray(key)) {\n for (let i = 0, ii = key.length; i < ii; ++i) {\n unlistenByKey(key[i]);\n }\n } else {\n unlistenByKey(/** @type {import(\"./events.js\").EventsKey} */ (key));\n }\n}\n\nexport default Observable;\n","/**\n * @module ol/Overlay\n */\nimport BaseObject from './Object.js';\nimport MapEventType from './MapEventType.js';\nimport {CLASS_SELECTABLE} from './css.js';\nimport {containsExtent} from './extent.js';\nimport {listen, unlistenByKey} from './events.js';\nimport {outerHeight, outerWidth, removeChildren, removeNode} from './dom.js';\n\n/**\n * @typedef {'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right'} Positioning\n * The overlay position: `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, or `'top-right'`.\n */\n\n/**\n * @typedef {Object} Options\n * @property {number|string} [id] Set the overlay id. The overlay id can be used\n * with the {@link module:ol/Map~Map#getOverlayById} method.\n * @property {HTMLElement} [element] The overlay element.\n * @property {Array} [offset=[0, 0]] Offsets in pixels used when positioning\n * the overlay. The first element in the\n * array is the horizontal offset. A positive value shifts the overlay right.\n * The second element in the array is the vertical offset. A positive value\n * shifts the overlay down.\n * @property {import(\"./coordinate.js\").Coordinate} [position] The overlay position\n * in map projection.\n * @property {Positioning} [positioning='top-left'] Defines how\n * the overlay is actually positioned with respect to its `position` property.\n * Possible values are `'bottom-left'`, `'bottom-center'`, `'bottom-right'`,\n * `'center-left'`, `'center-center'`, `'center-right'`, `'top-left'`,\n * `'top-center'`, and `'top-right'`.\n * @property {boolean} [stopEvent=true] Whether event propagation to the map\n * viewport should be stopped. If `true` the overlay is placed in the same\n * container as that of the controls (CSS class name\n * `ol-overlaycontainer-stopevent`); if `false` it is placed in the container\n * with CSS class name specified by the `className` property.\n * @property {boolean} [insertFirst=true] Whether the overlay is inserted first\n * in the overlay container, or appended. If the overlay is placed in the same\n * container as that of the controls (see the `stopEvent` option) you will\n * probably set `insertFirst` to `true` so the overlay is displayed below the\n * controls.\n * @property {PanIntoViewOptions|boolean} [autoPan=false] Pan the map when calling\n * `setPosition`, so that the overlay is entirely visible in the current viewport.\n * @property {string} [className='ol-overlay-container ol-selectable'] CSS class\n * name.\n */\n\n/**\n * @typedef {Object} PanOptions\n * @property {number} [duration=1000] The duration of the animation in\n * milliseconds.\n * @property {function(number):number} [easing] The easing function to use. Can\n * be one from {@link module:ol/easing} or a custom function.\n * Default is {@link module:ol/easing.inAndOut}.\n */\n\n/**\n * @typedef {Object} PanIntoViewOptions\n * @property {PanOptions} [animation={}] The animation parameters for the pan\n * @property {number} [margin=20] The margin (in pixels) between the\n * overlay and the borders of the map when panning into view.\n */\n\n/**\n * @enum {string}\n * @protected\n */\nconst Property = {\n ELEMENT: 'element',\n MAP: 'map',\n OFFSET: 'offset',\n POSITION: 'position',\n POSITIONING: 'positioning',\n};\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:element'|'change:map'|'change:offset'|'change:position'|\n * 'change:positioning'} OverlayObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} OverlayOnSignature\n */\n\n/**\n * @classdesc\n * An element to be displayed over the map and attached to a single map\n * location. Like {@link module:ol/control/Control~Control}, Overlays are\n * visible widgets. Unlike Controls, they are not in a fixed position on the\n * screen, but are tied to a geographical coordinate, so panning the map will\n * move an Overlay but not a Control.\n *\n * Example:\n *\n * import Overlay from 'ol/Overlay.js';\n *\n * // ...\n * const popup = new Overlay({\n * element: document.getElementById('popup'),\n * });\n * popup.setPosition(coordinate);\n * map.addOverlay(popup);\n *\n * @api\n */\nclass Overlay extends BaseObject {\n /**\n * @param {Options} options Overlay options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {OverlayOnSignature}\n */\n this.on;\n\n /***\n * @type {OverlayOnSignature}\n */\n this.once;\n\n /***\n * @type {OverlayOnSignature}\n */\n this.un;\n\n /**\n * @protected\n * @type {Options}\n */\n this.options = options;\n\n /**\n * @protected\n * @type {number|string|undefined}\n */\n this.id = options.id;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.insertFirst =\n options.insertFirst !== undefined ? options.insertFirst : true;\n\n /**\n * @protected\n * @type {boolean}\n */\n this.stopEvent = options.stopEvent !== undefined ? options.stopEvent : true;\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = document.createElement('div');\n this.element.className =\n options.className !== undefined\n ? options.className\n : 'ol-overlay-container ' + CLASS_SELECTABLE;\n this.element.style.position = 'absolute';\n this.element.style.pointerEvents = 'auto';\n\n /**\n * @protected\n * @type {PanIntoViewOptions|undefined}\n */\n this.autoPan = options.autoPan === true ? {} : options.autoPan || undefined;\n\n /**\n * @protected\n * @type {{transform_: string,\n * visible: boolean}}\n */\n this.rendered = {\n transform_: '',\n visible: true,\n };\n\n /**\n * @protected\n * @type {?import(\"./events.js\").EventsKey}\n */\n this.mapPostrenderListenerKey = null;\n\n this.addChangeListener(Property.ELEMENT, this.handleElementChanged);\n this.addChangeListener(Property.MAP, this.handleMapChanged);\n this.addChangeListener(Property.OFFSET, this.handleOffsetChanged);\n this.addChangeListener(Property.POSITION, this.handlePositionChanged);\n this.addChangeListener(Property.POSITIONING, this.handlePositioningChanged);\n\n if (options.element !== undefined) {\n this.setElement(options.element);\n }\n\n this.setOffset(options.offset !== undefined ? options.offset : [0, 0]);\n\n this.setPositioning(options.positioning || 'top-left');\n\n if (options.position !== undefined) {\n this.setPosition(options.position);\n }\n }\n\n /**\n * Get the DOM element of this overlay.\n * @return {HTMLElement|undefined} The Element containing the overlay.\n * @observable\n * @api\n */\n getElement() {\n return /** @type {HTMLElement|undefined} */ (this.get(Property.ELEMENT));\n }\n\n /**\n * Get the overlay identifier which is set on constructor.\n * @return {number|string|undefined} Id.\n * @api\n */\n getId() {\n return this.id;\n }\n\n /**\n * Get the map associated with this overlay.\n * @return {import(\"./Map.js\").default|null} The map that the\n * overlay is part of.\n * @observable\n * @api\n */\n getMap() {\n return /** @type {import(\"./Map.js\").default|null} */ (\n this.get(Property.MAP) || null\n );\n }\n\n /**\n * Get the offset of this overlay.\n * @return {Array} The offset.\n * @observable\n * @api\n */\n getOffset() {\n return /** @type {Array} */ (this.get(Property.OFFSET));\n }\n\n /**\n * Get the current position of this overlay.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The spatial point that the overlay is\n * anchored at.\n * @observable\n * @api\n */\n getPosition() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(Property.POSITION)\n );\n }\n\n /**\n * Get the current positioning of this overlay.\n * @return {Positioning} How the overlay is positioned\n * relative to its point on the map.\n * @observable\n * @api\n */\n getPositioning() {\n return /** @type {Positioning} */ (this.get(Property.POSITIONING));\n }\n\n /**\n * @protected\n */\n handleElementChanged() {\n removeChildren(this.element);\n const element = this.getElement();\n if (element) {\n this.element.appendChild(element);\n }\n }\n\n /**\n * @protected\n */\n handleMapChanged() {\n if (this.mapPostrenderListenerKey) {\n removeNode(this.element);\n unlistenByKey(this.mapPostrenderListenerKey);\n this.mapPostrenderListenerKey = null;\n }\n const map = this.getMap();\n if (map) {\n this.mapPostrenderListenerKey = listen(\n map,\n MapEventType.POSTRENDER,\n this.render,\n this\n );\n this.updatePixelPosition();\n const container = this.stopEvent\n ? map.getOverlayContainerStopEvent()\n : map.getOverlayContainer();\n if (this.insertFirst) {\n container.insertBefore(this.element, container.childNodes[0] || null);\n } else {\n container.appendChild(this.element);\n }\n this.performAutoPan();\n }\n }\n\n /**\n * @protected\n */\n render() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handleOffsetChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * @protected\n */\n handlePositionChanged() {\n this.updatePixelPosition();\n this.performAutoPan();\n }\n\n /**\n * @protected\n */\n handlePositioningChanged() {\n this.updatePixelPosition();\n }\n\n /**\n * Set the DOM element to be associated with this overlay.\n * @param {HTMLElement|undefined} element The Element containing the overlay.\n * @observable\n * @api\n */\n setElement(element) {\n this.set(Property.ELEMENT, element);\n }\n\n /**\n * Set the map to be associated with this overlay.\n * @param {import(\"./Map.js\").default|null} map The map that the\n * overlay is part of. Pass `null` to just remove the overlay from the current map.\n * @observable\n * @api\n */\n setMap(map) {\n this.set(Property.MAP, map);\n }\n\n /**\n * Set the offset for this overlay.\n * @param {Array} offset Offset.\n * @observable\n * @api\n */\n setOffset(offset) {\n this.set(Property.OFFSET, offset);\n }\n\n /**\n * Set the position for this overlay. If the position is `undefined` the\n * overlay is hidden.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} position The spatial point that the overlay\n * is anchored at.\n * @observable\n * @api\n */\n setPosition(position) {\n this.set(Property.POSITION, position);\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary) using the configured autoPan parameters\n * @protected\n */\n performAutoPan() {\n if (this.autoPan) {\n this.panIntoView(this.autoPan);\n }\n }\n\n /**\n * Pan the map so that the overlay is entirely visible in the current viewport\n * (if necessary).\n * @param {PanIntoViewOptions} [panIntoViewOptions] Options for the pan action\n * @api\n */\n panIntoView(panIntoViewOptions) {\n const map = this.getMap();\n\n if (!map || !map.getTargetElement() || !this.get(Property.POSITION)) {\n return;\n }\n\n const mapRect = this.getRect(map.getTargetElement(), map.getSize());\n const element = this.getElement();\n const overlayRect = this.getRect(element, [\n outerWidth(element),\n outerHeight(element),\n ]);\n\n panIntoViewOptions = panIntoViewOptions || {};\n\n const myMargin =\n panIntoViewOptions.margin === undefined ? 20 : panIntoViewOptions.margin;\n if (!containsExtent(mapRect, overlayRect)) {\n // the overlay is not completely inside the viewport, so pan the map\n const offsetLeft = overlayRect[0] - mapRect[0];\n const offsetRight = mapRect[2] - overlayRect[2];\n const offsetTop = overlayRect[1] - mapRect[1];\n const offsetBottom = mapRect[3] - overlayRect[3];\n\n const delta = [0, 0];\n if (offsetLeft < 0) {\n // move map to the left\n delta[0] = offsetLeft - myMargin;\n } else if (offsetRight < 0) {\n // move map to the right\n delta[0] = Math.abs(offsetRight) + myMargin;\n }\n if (offsetTop < 0) {\n // move map up\n delta[1] = offsetTop - myMargin;\n } else if (offsetBottom < 0) {\n // move map down\n delta[1] = Math.abs(offsetBottom) + myMargin;\n }\n\n if (delta[0] !== 0 || delta[1] !== 0) {\n const center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n map.getView().getCenterInternal()\n );\n const centerPx = map.getPixelFromCoordinateInternal(center);\n if (!centerPx) {\n return;\n }\n const newCenterPx = [centerPx[0] + delta[0], centerPx[1] + delta[1]];\n\n const panOptions = panIntoViewOptions.animation || {};\n map.getView().animateInternal({\n center: map.getCoordinateFromPixelInternal(newCenterPx),\n duration: panOptions.duration,\n easing: panOptions.easing,\n });\n }\n }\n }\n\n /**\n * Get the extent of an element relative to the document\n * @param {HTMLElement} element The element.\n * @param {import(\"./size.js\").Size} size The size of the element.\n * @return {import(\"./extent.js\").Extent} The extent.\n * @protected\n */\n getRect(element, size) {\n const box = element.getBoundingClientRect();\n const offsetX = box.left + window.pageXOffset;\n const offsetY = box.top + window.pageYOffset;\n return [offsetX, offsetY, offsetX + size[0], offsetY + size[1]];\n }\n\n /**\n * Set the positioning for this overlay.\n * @param {Positioning} positioning how the overlay is\n * positioned relative to its point on the map.\n * @observable\n * @api\n */\n setPositioning(positioning) {\n this.set(Property.POSITIONING, positioning);\n }\n\n /**\n * Modify the visibility of the element.\n * @param {boolean} visible Element visibility.\n * @protected\n */\n setVisible(visible) {\n if (this.rendered.visible !== visible) {\n this.element.style.display = visible ? '' : 'none';\n this.rendered.visible = visible;\n }\n }\n\n /**\n * Update pixel position.\n * @protected\n */\n updatePixelPosition() {\n const map = this.getMap();\n const position = this.getPosition();\n if (!map || !map.isRendered() || !position) {\n this.setVisible(false);\n return;\n }\n\n const pixel = map.getPixelFromCoordinate(position);\n const mapSize = map.getSize();\n this.updateRenderedPosition(pixel, mapSize);\n }\n\n /**\n * @param {import(\"./pixel.js\").Pixel} pixel The pixel location.\n * @param {import(\"./size.js\").Size|undefined} mapSize The map size.\n * @protected\n */\n updateRenderedPosition(pixel, mapSize) {\n const style = this.element.style;\n const offset = this.getOffset();\n\n const positioning = this.getPositioning();\n\n this.setVisible(true);\n\n const x = Math.round(pixel[0] + offset[0]) + 'px';\n const y = Math.round(pixel[1] + offset[1]) + 'px';\n let posX = '0%';\n let posY = '0%';\n if (\n positioning == 'bottom-right' ||\n positioning == 'center-right' ||\n positioning == 'top-right'\n ) {\n posX = '-100%';\n } else if (\n positioning == 'bottom-center' ||\n positioning == 'center-center' ||\n positioning == 'top-center'\n ) {\n posX = '-50%';\n }\n if (\n positioning == 'bottom-left' ||\n positioning == 'bottom-center' ||\n positioning == 'bottom-right'\n ) {\n posY = '-100%';\n } else if (\n positioning == 'center-left' ||\n positioning == 'center-center' ||\n positioning == 'center-right'\n ) {\n posY = '-50%';\n }\n const transform = `translate(${posX}, ${posY}) translate(${x}, ${y})`;\n if (this.rendered.transform_ != transform) {\n this.rendered.transform_ = transform;\n style.transform = transform;\n }\n }\n\n /**\n * returns the options this Overlay has been created with\n * @return {Options} overlay options\n */\n getOptions() {\n return this.options;\n }\n}\n\nexport default Overlay;\n","/**\n * @module ol/Tile\n */\nimport EventTarget from './events/Target.js';\nimport EventType from './events/EventType.js';\nimport TileState from './TileState.js';\nimport {abstract} from './util.js';\nimport {easeIn} from './easing.js';\n\n/**\n * A function that takes an {@link module:ol/Tile~Tile} for the tile and a\n * `{string}` for the url as arguments. The default is\n * ```js\n * source.setTileLoadFunction(function(tile, src) {\n * tile.getImage().src = src;\n * });\n * ```\n * For more fine grained control, the load function can use fetch or XMLHttpRequest and involve\n * error handling:\n *\n * ```js\n * import TileState from 'ol/TileState.js';\n *\n * source.setTileLoadFunction(function(tile, src) {\n * const xhr = new XMLHttpRequest();\n * xhr.responseType = 'blob';\n * xhr.addEventListener('loadend', function (evt) {\n * const data = this.response;\n * if (data !== undefined) {\n * tile.getImage().src = URL.createObjectURL(data);\n * } else {\n * tile.setState(TileState.ERROR);\n * }\n * });\n * xhr.addEventListener('error', function () {\n * tile.setState(TileState.ERROR);\n * });\n * xhr.open('GET', src);\n * xhr.send();\n * });\n * ```\n *\n * @typedef {function(Tile, string): void} LoadFunction\n * @api\n */\n\n/**\n * {@link module:ol/source/Tile~TileSource} sources use a function of this type to get\n * the url that provides a tile for a given tile coordinate.\n *\n * This function takes an {@link module:ol/tilecoord~TileCoord} for the tile\n * coordinate, a `{number}` representing the pixel ratio and a\n * {@link module:ol/proj/Projection~Projection} for the projection as arguments\n * and returns a `{string}` representing the tile URL, or undefined if no tile\n * should be requested for the passed tile coordinate.\n *\n * @typedef {function(import(\"./tilecoord.js\").TileCoord, number,\n * import(\"./proj/Projection.js\").default): (string|undefined)} UrlFunction\n * @api\n */\n\n/**\n * @typedef {Object} Options\n * @property {number} [transition=250] A duration for tile opacity\n * transitions in milliseconds. A duration of 0 disables the opacity transition.\n * @property {boolean} [interpolate=false] Use interpolated values when resampling. By default,\n * the nearest neighbor is used when resampling.\n * @api\n */\n\n/**\n * @classdesc\n * Base class for tiles.\n *\n * @abstract\n */\nclass Tile extends EventTarget {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {Options} [options] Tile options.\n */\n constructor(tileCoord, state, options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"./tilecoord.js\").TileCoord}\n */\n this.tileCoord = tileCoord;\n\n /**\n * @protected\n * @type {import(\"./TileState.js\").default}\n */\n this.state = state;\n\n /**\n * An \"interim\" tile for this tile. The interim tile may be used while this\n * one is loading, for \"smooth\" transitions when changing params/dimensions\n * on the source.\n * @type {Tile|null}\n */\n this.interimTile = null;\n\n /**\n * A key assigned to the tile. This is used by the tile source to determine\n * if this tile can effectively be used, or if a new tile should be created\n * and this one be used as an interim tile for this new tile.\n * @type {string}\n */\n this.key = '';\n\n /**\n * The duration for the opacity transition.\n * @type {number}\n */\n this.transition_ =\n options.transition === undefined ? 250 : options.transition;\n\n /**\n * Lookup of start times for rendering transitions. If the start time is\n * equal to -1, the transition is complete.\n * @type {Object}\n */\n this.transitionStarts_ = {};\n\n /**\n * @type {boolean}\n */\n this.interpolate = !!options.interpolate;\n }\n\n /**\n * @protected\n */\n changed() {\n this.dispatchEvent(EventType.CHANGE);\n }\n\n /**\n * Called by the tile cache when the tile is removed from the cache due to expiry\n */\n release() {\n if (this.state === TileState.ERROR) {\n // to remove the `change` listener on this tile in `ol/TileQueue#handleTileChange`\n this.setState(TileState.EMPTY);\n }\n }\n\n /**\n * @return {string} Key.\n */\n getKey() {\n return this.key + '/' + this.tileCoord;\n }\n\n /**\n * Get the interim tile most suitable for rendering using the chain of interim\n * tiles. This corresponds to the most recent tile that has been loaded, if no\n * such tile exists, the original tile is returned.\n * @return {!Tile} Best tile for rendering.\n */\n getInterimTile() {\n let tile = this.interimTile;\n if (!tile) {\n //empty chain\n return this;\n }\n\n // find the first loaded tile and return it. Since the chain is sorted in\n // decreasing order of creation time, there is no need to search the remainder\n // of the list (all those tiles correspond to older requests and will be\n // cleaned up by refreshInterimChain)\n do {\n if (tile.getState() == TileState.LOADED) {\n // Show tile immediately instead of fading it in after loading, because\n // the interim tile is in place already\n this.transition_ = 0;\n return tile;\n }\n tile = tile.interimTile;\n } while (tile);\n\n // we can not find a better tile\n return this;\n }\n\n /**\n * Goes through the chain of interim tiles and discards sections of the chain\n * that are no longer relevant.\n */\n refreshInterimChain() {\n let tile = this.interimTile;\n if (!tile) {\n return;\n }\n\n /** @type {Tile} */\n let prev = this;\n do {\n if (tile.getState() == TileState.LOADED) {\n //we have a loaded tile, we can discard the rest of the list\n //we would could abort any LOADING tile request\n //older than this tile (i.e. any LOADING tile following this entry in the chain)\n tile.interimTile = null;\n break;\n }\n if (tile.getState() == TileState.LOADING) {\n //keep this LOADING tile any loaded tiles later in the chain are\n //older than this tile, so we're still interested in the request\n prev = tile;\n } else if (tile.getState() == TileState.IDLE) {\n //the head of the list is the most current tile, we don't need\n //to start any other requests for this chain\n prev.interimTile = tile.interimTile;\n } else {\n prev = tile;\n }\n tile = prev.interimTile;\n } while (tile);\n }\n\n /**\n * Get the tile coordinate for this tile.\n * @return {import(\"./tilecoord.js\").TileCoord} The tile coordinate.\n * @api\n */\n getTileCoord() {\n return this.tileCoord;\n }\n\n /**\n * @return {import(\"./TileState.js\").default} State.\n */\n getState() {\n return this.state;\n }\n\n /**\n * Sets the state of this tile. If you write your own {@link module:ol/Tile~LoadFunction tileLoadFunction} ,\n * it is important to set the state correctly to {@link module:ol/TileState~ERROR}\n * when the tile cannot be loaded. Otherwise the tile cannot be removed from\n * the tile queue and will block other requests.\n * @param {import(\"./TileState.js\").default} state State.\n * @api\n */\n setState(state) {\n if (this.state !== TileState.ERROR && this.state > state) {\n throw new Error('Tile load sequence violation');\n }\n this.state = state;\n this.changed();\n }\n\n /**\n * Load the image or retry if loading previously failed.\n * Loading is taken care of by the tile queue, and calling this method is\n * only needed for preloading or for reloading in case of an error.\n * @abstract\n * @api\n */\n load() {\n abstract();\n }\n\n /**\n * Get the alpha value for rendering.\n * @param {string} id An id for the renderer.\n * @param {number} time The render frame time.\n * @return {number} A number between 0 and 1.\n */\n getAlpha(id, time) {\n if (!this.transition_) {\n return 1;\n }\n\n let start = this.transitionStarts_[id];\n if (!start) {\n start = time;\n this.transitionStarts_[id] = start;\n } else if (start === -1) {\n return 1;\n }\n\n const delta = time - start + 1000 / 60; // avoid rendering at 0\n if (delta >= this.transition_) {\n return 1;\n }\n return easeIn(delta / this.transition_);\n }\n\n /**\n * Determine if a tile is in an alpha transition. A tile is considered in\n * transition if tile.getAlpha() has not yet been called or has been called\n * and returned 1.\n * @param {string} id An id for the renderer.\n * @return {boolean} The tile is in transition.\n */\n inTransition(id) {\n if (!this.transition_) {\n return false;\n }\n return this.transitionStarts_[id] !== -1;\n }\n\n /**\n * Mark a transition as complete.\n * @param {string} id An id for the renderer.\n */\n endTransition(id) {\n if (this.transition_) {\n this.transitionStarts_[id] = -1;\n }\n }\n}\n\nexport default Tile;\n","/**\n * @module ol/TileCache\n */\nimport LRUCache from './structs/LRUCache.js';\nimport {fromKey, getKey} from './tilecoord.js';\n\nclass TileCache extends LRUCache {\n clear() {\n while (this.getCount() > 0) {\n this.pop().release();\n }\n super.clear();\n }\n\n /**\n * @param {!Object} usedTiles Used tiles.\n */\n expireCache(usedTiles) {\n while (this.canExpireCache()) {\n const tile = this.peekLast();\n if (tile.getKey() in usedTiles) {\n break;\n } else {\n this.pop().release();\n }\n }\n }\n\n /**\n * Prune all tiles from the cache that don't have the same z as the newest tile.\n */\n pruneExceptNewestZ() {\n if (this.getCount() === 0) {\n return;\n }\n const key = this.peekFirstKey();\n const tileCoord = fromKey(key);\n const z = tileCoord[0];\n this.forEach((tile) => {\n if (tile.tileCoord[0] !== z) {\n this.remove(getKey(tile.tileCoord));\n tile.release();\n }\n });\n }\n}\n\nexport default TileCache;\n","/**\n * @module ol/structs/PriorityQueue\n */\nimport {assert} from '../asserts.js';\nimport {clear} from '../obj.js';\n\n/**\n * @type {number}\n */\nexport const DROP = Infinity;\n\n/**\n * @classdesc\n * Priority queue.\n *\n * The implementation is inspired from the Closure Library's Heap class and\n * Python's heapq module.\n *\n * See https://github.com/google/closure-library/blob/master/closure/goog/structs/heap.js\n * and https://hg.python.org/cpython/file/2.7/Lib/heapq.py.\n *\n * @template T\n */\nclass PriorityQueue {\n /**\n * @param {function(T): number} priorityFunction Priority function.\n * @param {function(T): string} keyFunction Key function.\n */\n constructor(priorityFunction, keyFunction) {\n /**\n * @type {function(T): number}\n * @private\n */\n this.priorityFunction_ = priorityFunction;\n\n /**\n * @type {function(T): string}\n * @private\n */\n this.keyFunction_ = keyFunction;\n\n /**\n * @type {Array}\n * @private\n */\n this.elements_ = [];\n\n /**\n * @type {Array}\n * @private\n */\n this.priorities_ = [];\n\n /**\n * @type {!Object}\n * @private\n */\n this.queuedElements_ = {};\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n clear() {\n this.elements_.length = 0;\n this.priorities_.length = 0;\n clear(this.queuedElements_);\n }\n\n /**\n * Remove and return the highest-priority element. O(log N).\n * @return {T} Element.\n */\n dequeue() {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[0];\n if (elements.length == 1) {\n elements.length = 0;\n priorities.length = 0;\n } else {\n elements[0] = /** @type {T} */ (elements.pop());\n priorities[0] = /** @type {number} */ (priorities.pop());\n this.siftUp_(0);\n }\n const elementKey = this.keyFunction_(element);\n delete this.queuedElements_[elementKey];\n return element;\n }\n\n /**\n * Enqueue an element. O(log N).\n * @param {T} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n assert(\n !(this.keyFunction_(element) in this.queuedElements_),\n 'Tried to enqueue an `element` that was already added to the queue'\n );\n const priority = this.priorityFunction_(element);\n if (priority != DROP) {\n this.elements_.push(element);\n this.priorities_.push(priority);\n this.queuedElements_[this.keyFunction_(element)] = true;\n this.siftDown_(0, this.elements_.length - 1);\n return true;\n }\n return false;\n }\n\n /**\n * @return {number} Count.\n */\n getCount() {\n return this.elements_.length;\n }\n\n /**\n * Gets the index of the left child of the node at the given index.\n * @param {number} index The index of the node to get the left child for.\n * @return {number} The index of the left child.\n * @private\n */\n getLeftChildIndex_(index) {\n return index * 2 + 1;\n }\n\n /**\n * Gets the index of the right child of the node at the given index.\n * @param {number} index The index of the node to get the right child for.\n * @return {number} The index of the right child.\n * @private\n */\n getRightChildIndex_(index) {\n return index * 2 + 2;\n }\n\n /**\n * Gets the index of the parent of the node at the given index.\n * @param {number} index The index of the node to get the parent for.\n * @return {number} The index of the parent.\n * @private\n */\n getParentIndex_(index) {\n return (index - 1) >> 1;\n }\n\n /**\n * Make this a heap. O(N).\n * @private\n */\n heapify_() {\n let i;\n for (i = (this.elements_.length >> 1) - 1; i >= 0; i--) {\n this.siftUp_(i);\n }\n }\n\n /**\n * @return {boolean} Is empty.\n */\n isEmpty() {\n return this.elements_.length === 0;\n }\n\n /**\n * @param {string} key Key.\n * @return {boolean} Is key queued.\n */\n isKeyQueued(key) {\n return key in this.queuedElements_;\n }\n\n /**\n * @param {T} element Element.\n * @return {boolean} Is queued.\n */\n isQueued(element) {\n return this.isKeyQueued(this.keyFunction_(element));\n }\n\n /**\n * @param {number} index The index of the node to move down.\n * @private\n */\n siftUp_(index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const count = elements.length;\n const element = elements[index];\n const priority = priorities[index];\n const startIndex = index;\n\n while (index < count >> 1) {\n const lIndex = this.getLeftChildIndex_(index);\n const rIndex = this.getRightChildIndex_(index);\n\n const smallerChildIndex =\n rIndex < count && priorities[rIndex] < priorities[lIndex]\n ? rIndex\n : lIndex;\n\n elements[index] = elements[smallerChildIndex];\n priorities[index] = priorities[smallerChildIndex];\n index = smallerChildIndex;\n }\n\n elements[index] = element;\n priorities[index] = priority;\n this.siftDown_(startIndex, index);\n }\n\n /**\n * @param {number} startIndex The index of the root.\n * @param {number} index The index of the node to move up.\n * @private\n */\n siftDown_(startIndex, index) {\n const elements = this.elements_;\n const priorities = this.priorities_;\n const element = elements[index];\n const priority = priorities[index];\n\n while (index > startIndex) {\n const parentIndex = this.getParentIndex_(index);\n if (priorities[parentIndex] > priority) {\n elements[index] = elements[parentIndex];\n priorities[index] = priorities[parentIndex];\n index = parentIndex;\n } else {\n break;\n }\n }\n elements[index] = element;\n priorities[index] = priority;\n }\n\n /**\n * FIXME empty description for jsdoc\n */\n reprioritize() {\n const priorityFunction = this.priorityFunction_;\n const elements = this.elements_;\n const priorities = this.priorities_;\n let index = 0;\n const n = elements.length;\n let element, i, priority;\n for (i = 0; i < n; ++i) {\n element = elements[i];\n priority = priorityFunction(element);\n if (priority == DROP) {\n delete this.queuedElements_[this.keyFunction_(element)];\n } else {\n priorities[index] = priority;\n elements[index++] = element;\n }\n }\n elements.length = index;\n priorities.length = index;\n this.heapify_();\n }\n}\n\nexport default PriorityQueue;\n","/**\n * @module ol/TileQueue\n */\nimport EventType from './events/EventType.js';\nimport PriorityQueue, {DROP} from './structs/PriorityQueue.js';\nimport TileState from './TileState.js';\n\n/**\n * @typedef {function(import(\"./Tile.js\").default, string, import(\"./coordinate.js\").Coordinate, number): number} PriorityFunction\n */\n\nclass TileQueue extends PriorityQueue {\n /**\n * @param {PriorityFunction} tilePriorityFunction Tile priority function.\n * @param {function(): ?} tileChangeCallback Function called on each tile change event.\n */\n constructor(tilePriorityFunction, tileChangeCallback) {\n super(\n /**\n * @param {Array} element Element.\n * @return {number} Priority.\n */\n function (element) {\n return tilePriorityFunction.apply(null, element);\n },\n /**\n * @param {Array} element Element.\n * @return {string} Key.\n */\n function (element) {\n return /** @type {import(\"./Tile.js\").default} */ (element[0]).getKey();\n }\n );\n\n /** @private */\n this.boundHandleTileChange_ = this.handleTileChange.bind(this);\n\n /**\n * @private\n * @type {function(): ?}\n */\n this.tileChangeCallback_ = tileChangeCallback;\n\n /**\n * @private\n * @type {number}\n */\n this.tilesLoading_ = 0;\n\n /**\n * @private\n * @type {!Object}\n */\n this.tilesLoadingKeys_ = {};\n }\n\n /**\n * @param {Array} element Element.\n * @return {boolean} The element was added to the queue.\n */\n enqueue(element) {\n const added = super.enqueue(element);\n if (added) {\n const tile = element[0];\n tile.addEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n return added;\n }\n\n /**\n * @return {number} Number of tiles loading.\n */\n getTilesLoading() {\n return this.tilesLoading_;\n }\n\n /**\n * @param {import(\"./events/Event.js\").default} event Event.\n * @protected\n */\n handleTileChange(event) {\n const tile = /** @type {import(\"./Tile.js\").default} */ (event.target);\n const state = tile.getState();\n if (\n state === TileState.LOADED ||\n state === TileState.ERROR ||\n state === TileState.EMPTY\n ) {\n if (state !== TileState.ERROR) {\n tile.removeEventListener(EventType.CHANGE, this.boundHandleTileChange_);\n }\n const tileKey = tile.getKey();\n if (tileKey in this.tilesLoadingKeys_) {\n delete this.tilesLoadingKeys_[tileKey];\n --this.tilesLoading_;\n }\n this.tileChangeCallback_();\n }\n }\n\n /**\n * @param {number} maxTotalLoading Maximum number tiles to load simultaneously.\n * @param {number} maxNewLoads Maximum number of new tiles to load.\n */\n loadMoreTiles(maxTotalLoading, maxNewLoads) {\n let newLoads = 0;\n let state, tile, tileKey;\n while (\n this.tilesLoading_ < maxTotalLoading &&\n newLoads < maxNewLoads &&\n this.getCount() > 0\n ) {\n tile = /** @type {import(\"./Tile.js\").default} */ (this.dequeue()[0]);\n tileKey = tile.getKey();\n state = tile.getState();\n if (state === TileState.IDLE && !(tileKey in this.tilesLoadingKeys_)) {\n this.tilesLoadingKeys_[tileKey] = true;\n ++this.tilesLoading_;\n ++newLoads;\n tile.load();\n }\n }\n }\n}\n\nexport default TileQueue;\n\n/**\n * @param {import('./Map.js').FrameState} frameState Frame state.\n * @param {import(\"./Tile.js\").default} tile Tile.\n * @param {string} tileSourceKey Tile source key.\n * @param {import(\"./coordinate.js\").Coordinate} tileCenter Tile center.\n * @param {number} tileResolution Tile resolution.\n * @return {number} Tile priority.\n */\nexport function getTilePriority(\n frameState,\n tile,\n tileSourceKey,\n tileCenter,\n tileResolution\n) {\n // Filter out tiles at higher zoom levels than the current zoom level, or that\n // are outside the visible extent.\n if (!frameState || !(tileSourceKey in frameState.wantedTiles)) {\n return DROP;\n }\n if (!frameState.wantedTiles[tileSourceKey][tile.getKey()]) {\n return DROP;\n }\n // Prioritize the highest zoom level tiles closest to the focus.\n // Tiles at higher zoom levels are prioritized using Math.log(tileResolution).\n // Within a zoom level, tiles are prioritized by the distance in pixels between\n // the center of the tile and the center of the viewport. The factor of 65536\n // means that the prioritization should behave as desired for tiles up to\n // 65536 * Math.log(2) = 45426 pixels from the focus.\n const center = frameState.viewState.center;\n const deltaX = tileCenter[0] - center[0];\n const deltaY = tileCenter[1] - center[1];\n return (\n 65536 * Math.log(tileResolution) +\n Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution\n );\n}\n","/**\n * @module ol/TileRange\n */\n\n/**\n * A representation of a contiguous block of tiles. A tile range is specified\n * by its min/max tile coordinates and is inclusive of coordinates.\n */\nclass TileRange {\n /**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n */\n constructor(minX, maxX, minY, maxY) {\n /**\n * @type {number}\n */\n this.minX = minX;\n\n /**\n * @type {number}\n */\n this.maxX = maxX;\n\n /**\n * @type {number}\n */\n this.minY = minY;\n\n /**\n * @type {number}\n */\n this.maxY = maxY;\n }\n\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @return {boolean} Contains tile coordinate.\n */\n contains(tileCoord) {\n return this.containsXY(tileCoord[1], tileCoord[2]);\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Contains.\n */\n containsTileRange(tileRange) {\n return (\n this.minX <= tileRange.minX &&\n tileRange.maxX <= this.maxX &&\n this.minY <= tileRange.minY &&\n tileRange.maxY <= this.maxY\n );\n }\n\n /**\n * @param {number} x Tile coordinate x.\n * @param {number} y Tile coordinate y.\n * @return {boolean} Contains coordinate.\n */\n containsXY(x, y) {\n return this.minX <= x && x <= this.maxX && this.minY <= y && y <= this.maxY;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Equals.\n */\n equals(tileRange) {\n return (\n this.minX == tileRange.minX &&\n this.minY == tileRange.minY &&\n this.maxX == tileRange.maxX &&\n this.maxY == tileRange.maxY\n );\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n */\n extend(tileRange) {\n if (tileRange.minX < this.minX) {\n this.minX = tileRange.minX;\n }\n if (tileRange.maxX > this.maxX) {\n this.maxX = tileRange.maxX;\n }\n if (tileRange.minY < this.minY) {\n this.minY = tileRange.minY;\n }\n if (tileRange.maxY > this.maxY) {\n this.maxY = tileRange.maxY;\n }\n }\n\n /**\n * @return {number} Height.\n */\n getHeight() {\n return this.maxY - this.minY + 1;\n }\n\n /**\n * @return {import(\"./size.js\").Size} Size.\n */\n getSize() {\n return [this.getWidth(), this.getHeight()];\n }\n\n /**\n * @return {number} Width.\n */\n getWidth() {\n return this.maxX - this.minX + 1;\n }\n\n /**\n * @param {TileRange} tileRange Tile range.\n * @return {boolean} Intersects.\n */\n intersects(tileRange) {\n return (\n this.minX <= tileRange.maxX &&\n this.maxX >= tileRange.minX &&\n this.minY <= tileRange.maxY &&\n this.maxY >= tileRange.minY\n );\n }\n}\n\n/**\n * @param {number} minX Minimum X.\n * @param {number} maxX Maximum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxY Maximum Y.\n * @param {TileRange} [tileRange] TileRange.\n * @return {TileRange} Tile range.\n */\nexport function createOrUpdate(minX, maxX, minY, maxY, tileRange) {\n if (tileRange !== undefined) {\n tileRange.minX = minX;\n tileRange.maxX = maxX;\n tileRange.minY = minY;\n tileRange.maxY = maxY;\n return tileRange;\n }\n return new TileRange(minX, maxX, minY, maxY);\n}\n\nexport default TileRange;\n","/**\n * @module ol/TileState\n */\n\n/**\n * @enum {number}\n */\nexport default {\n IDLE: 0,\n LOADING: 1,\n LOADED: 2,\n /**\n * Indicates that tile loading failed\n * @type {number}\n */\n ERROR: 3,\n EMPTY: 4,\n};\n","/**\n * @module ol/VectorTile\n */\nimport Tile from './Tile.js';\nimport TileState from './TileState.js';\n\nclass VectorTile extends Tile {\n /**\n * @param {import(\"./tilecoord.js\").TileCoord} tileCoord Tile coordinate.\n * @param {import(\"./TileState.js\").default} state State.\n * @param {string} src Data source url.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @param {import(\"./Tile.js\").LoadFunction} tileLoadFunction Tile load function.\n * @param {import(\"./Tile.js\").Options} [options] Tile options.\n */\n constructor(tileCoord, state, src, format, tileLoadFunction, options) {\n super(tileCoord, state, options);\n\n /**\n * Extent of this tile; set by the source.\n * @type {import(\"./extent.js\").Extent}\n */\n this.extent = null;\n\n /**\n * @private\n * @type {import(\"./format/Feature.js\").default}\n */\n this.format_ = format;\n\n /**\n * @private\n * @type {Array}\n */\n this.features_ = null;\n\n /**\n * @private\n * @type {import(\"./featureloader.js\").FeatureLoader}\n */\n this.loader_;\n\n /**\n * Feature projection of this tile; set by the source.\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection = null;\n\n /**\n * Resolution of this tile; set by the source.\n * @type {number}\n */\n this.resolution;\n\n /**\n * @private\n * @type {import(\"./Tile.js\").LoadFunction}\n */\n this.tileLoadFunction_ = tileLoadFunction;\n\n /**\n * @private\n * @type {string}\n */\n this.url_ = src;\n\n this.key = src;\n }\n\n /**\n * Get the feature format assigned for reading this tile's features.\n * @return {import(\"./format/Feature.js\").default} Feature format.\n * @api\n */\n getFormat() {\n return this.format_;\n }\n\n /**\n * Get the features for this tile. Geometries will be in the view projection.\n * @return {Array} Features.\n * @api\n */\n getFeatures() {\n return this.features_;\n }\n\n /**\n * Load not yet loaded URI.\n */\n load() {\n if (this.state == TileState.IDLE) {\n this.setState(TileState.LOADING);\n this.tileLoadFunction_(this, this.url_);\n if (this.loader_) {\n this.loader_(this.extent, this.resolution, this.projection);\n }\n }\n }\n\n /**\n * Handler for successful tile load.\n * @param {Array} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data projection.\n */\n onLoad(features, dataProjection) {\n this.setFeatures(features);\n }\n\n /**\n * Handler for tile load errors.\n */\n onError() {\n this.setState(TileState.ERROR);\n }\n\n /**\n * Function for use in an {@link module:ol/source/VectorTile~VectorTile}'s `tileLoadFunction`.\n * Sets the features for the tile.\n * @param {Array} features Features.\n * @api\n */\n setFeatures(features) {\n this.features_ = features;\n this.setState(TileState.LOADED);\n }\n\n /**\n * Set the feature loader for reading this tile's features.\n * @param {import(\"./featureloader.js\").FeatureLoader} loader Feature loader.\n * @api\n */\n setLoader(loader) {\n this.loader_ = loader;\n }\n}\n\nexport default VectorTile;\n","/**\n * @module ol/centerconstraint\n */\nimport {clamp} from './math.js';\n\n/**\n * @typedef {function((import(\"./coordinate.js\").Coordinate|undefined), number, import(\"./size.js\").Size, boolean=, Array=): (import(\"./coordinate.js\").Coordinate|undefined)} Type\n */\n\n/**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {boolean} onlyCenter If true, the constraint will only apply to the view center.\n * @param {boolean} smooth If true, the view will be able to go slightly out of the given extent\n * (only during interaction and animation).\n * @return {Type} The constraint.\n */\nexport function createExtent(extent, onlyCenter, smooth) {\n return (\n /**\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center Center.\n * @param {number|undefined} resolution Resolution.\n * @param {import(\"./size.js\").Size} size Viewport size; unused if `onlyCenter` was specified.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @param {Array} [centerShift] Shift between map center and viewport center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\n function (center, resolution, size, isMoving, centerShift) {\n if (!center) {\n return undefined;\n }\n if (!resolution && !onlyCenter) {\n return center;\n }\n const viewWidth = onlyCenter ? 0 : size[0] * resolution;\n const viewHeight = onlyCenter ? 0 : size[1] * resolution;\n const shiftX = centerShift ? centerShift[0] : 0;\n const shiftY = centerShift ? centerShift[1] : 0;\n let minX = extent[0] + viewWidth / 2 + shiftX;\n let maxX = extent[2] - viewWidth / 2 + shiftX;\n let minY = extent[1] + viewHeight / 2 + shiftY;\n let maxY = extent[3] - viewHeight / 2 + shiftY;\n\n // note: when zooming out of bounds, min and max values for x and y may\n // end up inverted (min > max); this has to be accounted for\n if (minX > maxX) {\n minX = (maxX + minX) / 2;\n maxX = minX;\n }\n if (minY > maxY) {\n minY = (maxY + minY) / 2;\n maxY = minY;\n }\n\n let x = clamp(center[0], minX, maxX);\n let y = clamp(center[1], minY, maxY);\n\n // during an interaction, allow some overscroll\n if (isMoving && smooth && resolution) {\n const ratio = 30 * resolution;\n x +=\n -ratio * Math.log(1 + Math.max(0, minX - center[0]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[0] - maxX) / ratio);\n y +=\n -ratio * Math.log(1 + Math.max(0, minY - center[1]) / ratio) +\n ratio * Math.log(1 + Math.max(0, center[1] - maxY) / ratio);\n }\n\n return [x, y];\n }\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} [center] Center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center.\n */\nexport function none(center) {\n return center;\n}\n","/**\n * @module ol/resolutionconstraint\n */\nimport {clamp} from './math.js';\nimport {getHeight, getWidth} from './extent.js';\nimport {linearFindNearest} from './array.js';\n\n/**\n * @typedef {function((number|undefined), number, import(\"./size.js\").Size, boolean=): (number|undefined)} Type\n */\n\n/**\n * Returns a modified resolution taking into account the viewport size and maximum\n * allowed extent.\n * @param {number} resolution Resolution\n * @param {import(\"./extent.js\").Extent} maxExtent Maximum allowed extent.\n * @param {import(\"./size.js\").Size} viewportSize Viewport size.\n * @param {boolean} showFullExtent Whether to show the full extent.\n * @return {number} Capped resolution.\n */\nfunction getViewportClampedResolution(\n resolution,\n maxExtent,\n viewportSize,\n showFullExtent\n) {\n const xResolution = getWidth(maxExtent) / viewportSize[0];\n const yResolution = getHeight(maxExtent) / viewportSize[1];\n\n if (showFullExtent) {\n return Math.min(resolution, Math.max(xResolution, yResolution));\n }\n return Math.min(resolution, Math.min(xResolution, yResolution));\n}\n\n/**\n * Returns a modified resolution to be between maxResolution and minResolution while\n * still allowing the value to be slightly out of bounds.\n * Note: the computation is based on the logarithm function (ln):\n * - at 1, ln(x) is 0\n * - above 1, ln(x) keeps increasing but at a much slower pace than x\n * The final result is clamped to prevent getting too far away from bounds.\n * @param {number} resolution Resolution.\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @return {number} Smoothed resolution.\n */\nfunction getSmoothClampedResolution(resolution, maxResolution, minResolution) {\n let result = Math.min(resolution, maxResolution);\n const ratio = 50;\n\n result *=\n Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio +\n 1;\n if (minResolution) {\n result = Math.max(result, minResolution);\n result /=\n Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) /\n ratio +\n 1;\n }\n return clamp(result, minResolution / 2, maxResolution * 2);\n}\n\n/**\n * @param {Array} resolutions Resolutions.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToResolutions(\n resolutions,\n smooth,\n maxExtent,\n showFullExtent\n) {\n smooth = smooth !== undefined ? smooth : true;\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const maxResolution = resolutions[0];\n const minResolution = resolutions[resolutions.length - 1];\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n }\n\n const capped = Math.min(cappedMaxRes, resolution);\n const z = Math.floor(linearFindNearest(resolutions, capped, direction));\n if (resolutions[z] > cappedMaxRes && z < resolutions.length - 1) {\n return resolutions[z + 1];\n }\n return resolutions[z];\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} power Power.\n * @param {number} maxResolution Maximum resolution.\n * @param {number} [minResolution] Minimum resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createSnapToPower(\n power,\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent\n) {\n smooth = smooth !== undefined ? smooth : true;\n minResolution = minResolution !== undefined ? minResolution : 0;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent\n )\n : maxResolution;\n\n // during interacting or animating, allow intermediary values\n if (isMoving) {\n if (!smooth) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n }\n\n const tolerance = 1e-9;\n const minZoomLevel = Math.ceil(\n Math.log(maxResolution / cappedMaxRes) / Math.log(power) - tolerance\n );\n const offset = -direction * (0.5 - tolerance) + 0.5;\n const capped = Math.min(cappedMaxRes, resolution);\n const cappedZoomLevel = Math.floor(\n Math.log(maxResolution / capped) / Math.log(power) + offset\n );\n const zoomLevel = Math.max(minZoomLevel, cappedZoomLevel);\n const newResolution = maxResolution / Math.pow(power, zoomLevel);\n return clamp(newResolution, minResolution, cappedMaxRes);\n }\n return undefined;\n }\n );\n}\n\n/**\n * @param {number} maxResolution Max resolution.\n * @param {number} minResolution Min resolution.\n * @param {boolean} [smooth] If true, the view will be able to slightly exceed resolution limits. Default: true.\n * @param {import(\"./extent.js\").Extent} [maxExtent] Maximum allowed extent.\n * @param {boolean} [showFullExtent] If true, allows us to show the full extent. Default: false.\n * @return {Type} Zoom function.\n */\nexport function createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n maxExtent,\n showFullExtent\n) {\n smooth = smooth !== undefined ? smooth : true;\n\n return (\n /**\n * @param {number|undefined} resolution Resolution.\n * @param {number} direction Direction.\n * @param {import(\"./size.js\").Size} size Viewport size.\n * @param {boolean} [isMoving] True if an interaction or animation is in progress.\n * @return {number|undefined} Resolution.\n */\n function (resolution, direction, size, isMoving) {\n if (resolution !== undefined) {\n const cappedMaxRes = maxExtent\n ? getViewportClampedResolution(\n maxResolution,\n maxExtent,\n size,\n showFullExtent\n )\n : maxResolution;\n\n if (!smooth || !isMoving) {\n return clamp(resolution, minResolution, cappedMaxRes);\n }\n return getSmoothClampedResolution(\n resolution,\n cappedMaxRes,\n minResolution\n );\n }\n return undefined;\n }\n );\n}\n","/**\n * @module ol/View\n */\nimport BaseObject from './Object.js';\nimport ViewHint from './ViewHint.js';\nimport ViewProperty from './ViewProperty.js';\nimport {DEFAULT_TILE_SIZE} from './tilegrid/common.js';\nimport {\n METERS_PER_UNIT,\n createProjection,\n disableCoordinateWarning,\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from './proj.js';\nimport {VOID} from './functions.js';\nimport {\n add as addCoordinate,\n equals as coordinatesEqual,\n equals,\n rotate as rotateCoordinate,\n} from './coordinate.js';\nimport {assert} from './asserts.js';\nimport {none as centerNone, createExtent} from './centerconstraint.js';\nimport {clamp, modulo} from './math.js';\nimport {\n createMinMaxResolution,\n createSnapToPower,\n createSnapToResolutions,\n} from './resolutionconstraint.js';\nimport {\n createSnapToN,\n createSnapToZero,\n disable,\n none as rotationNone,\n} from './rotationconstraint.js';\nimport {easeOut, inAndOut} from './easing.js';\nimport {\n getCenter,\n getForViewAndSize,\n getHeight,\n getWidth,\n isEmpty,\n} from './extent.js';\nimport {linearFindNearest} from './array.js';\nimport {fromExtent as polygonFromExtent} from './geom/Polygon.js';\n\n/**\n * An animation configuration\n *\n * @typedef {Object} Animation\n * @property {import(\"./coordinate.js\").Coordinate} [sourceCenter] Source center.\n * @property {import(\"./coordinate.js\").Coordinate} [targetCenter] Target center.\n * @property {number} [sourceResolution] Source resolution.\n * @property {number} [targetResolution] Target resolution.\n * @property {number} [sourceRotation] Source rotation.\n * @property {number} [targetRotation] Target rotation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Anchor.\n * @property {number} start Start.\n * @property {number} duration Duration.\n * @property {boolean} complete Complete.\n * @property {function(number):number} easing Easing.\n * @property {function(boolean):void} callback Callback.\n */\n\n/**\n * @typedef {Object} Constraints\n * @property {import(\"./centerconstraint.js\").Type} center Center.\n * @property {import(\"./resolutionconstraint.js\").Type} resolution Resolution.\n * @property {import(\"./rotationconstraint.js\").Type} rotation Rotation.\n */\n\n/**\n * @typedef {Object} FitOptions\n * @property {import(\"./size.js\").Size} [size] The size in pixels of the box to\n * fit the extent into. Defaults to the size of the map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired box size\n * (e.g. `map.getSize()`).\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in pixels) to be\n * cleared inside the view. Values in the array are top, right, bottom and left\n * padding.\n * @property {boolean} [nearest=false] If the view `constrainResolution` option is `true`,\n * get the nearest extent instead of the closest that actually fits the view.\n * @property {number} [minResolution=0] Minimum resolution that we zoom to.\n * @property {number} [maxZoom] Maximum zoom level that we zoom to. If\n * `minResolution` is given, this property is ignored.\n * @property {number} [duration] The duration of the animation in milliseconds.\n * By default, there is no animation to the target extent.\n * @property {function(number):number} [easing] The easing function used during\n * the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n * @property {function(boolean):void} [callback] Function called when the view is in\n * its final position. The callback will be called with `true` if the animation\n * series completed on its own or `false` if it was cancelled.\n */\n\n/**\n * @typedef {Object} ViewOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The initial center for\n * the view. If a user projection is not set, the coordinate system for the center is\n * specified with the `projection` option. Layer sources will not be fetched if this\n * is not set, but the center can be set later with {@link #setCenter}.\n * @property {boolean|number} [constrainRotation=true] Rotation constraint.\n * `false` means no constraint. `true` means no constraint, but snap to zero\n * near zero. A number constrains the rotation to that number of values. For\n * example, `4` will constrain the rotation to 0, 90, 180, and 270 degrees.\n * @property {boolean} [enableRotation=true] Enable rotation.\n * If `false`, a rotation constraint that always sets the rotation to zero is\n * used. The `constrainRotation` option has no effect if `enableRotation` is\n * `false`.\n * @property {import(\"./extent.js\").Extent} [extent] The extent that constrains the\n * view, in other words, nothing outside of this extent can be visible on the map.\n * @property {boolean} [constrainOnlyCenter=false] If true, the extent\n * constraint will only apply to the view center and not the whole extent.\n * @property {boolean} [smoothExtentConstraint=true] If true, the extent\n * constraint will be applied smoothly, i.e. allow the view to go slightly outside\n * of the given `extent`.\n * @property {number} [maxResolution] The maximum resolution used to determine\n * the resolution constraint. It is used together with `minResolution` (or\n * `maxZoom`) and `zoomFactor`. If unspecified it is calculated in such a way\n * that the projection's validity extent fits in a 256x256 px tile. If the\n * projection is Spherical Mercator (the default) then `maxResolution` defaults\n * to `40075016.68557849 / 256 = 156543.03392804097`.\n * @property {number} [minResolution] The minimum resolution used to determine\n * the resolution constraint. It is used together with `maxResolution` (or\n * `minZoom`) and `zoomFactor`. If unspecified it is calculated assuming 29\n * zoom levels (with a factor of 2). If the projection is Spherical Mercator\n * (the default) then `minResolution` defaults to\n * `40075016.68557849 / 256 / Math.pow(2, 28) = 0.0005831682455839253`.\n * @property {number} [maxZoom=28] The maximum zoom level used to determine the\n * resolution constraint. It is used together with `minZoom` (or\n * `maxResolution`) and `zoomFactor`. Note that if `minResolution` is also\n * provided, it is given precedence over `maxZoom`.\n * @property {number} [minZoom=0] The minimum zoom level used to determine the\n * resolution constraint. It is used together with `maxZoom` (or\n * `minResolution`) and `zoomFactor`. Note that if `maxResolution` is also\n * provided, it is given precedence over `minZoom`.\n * @property {boolean} [multiWorld=false] If `false` the view is constrained so\n * only one world is visible, and you cannot pan off the edge. If `true` the map\n * may show multiple worlds at low zoom levels. Only used if the `projection` is\n * global. Note that if `extent` is also provided it is given precedence.\n * @property {boolean} [constrainResolution=false] If true, the view will always\n * animate to the closest zoom level after an interaction; false means\n * intermediary zoom levels are allowed.\n * @property {boolean} [smoothResolutionConstraint=true] If true, the resolution\n * min/max values will be applied smoothly, i. e. allow the view to exceed slightly\n * the given resolution or zoom bounds.\n * @property {boolean} [showFullExtent=false] Allow the view to be zoomed out to\n * show the full configured extent. By default, when a view is configured with an\n * extent, users will not be able to zoom out so the viewport exceeds the extent in\n * either dimension. This means the full extent may not be visible if the viewport\n * is taller or wider than the aspect ratio of the configured extent. If\n * showFullExtent is true, the user will be able to zoom out so that the viewport\n * exceeds the height or width of the configured extent, but not both, allowing the\n * full extent to be shown.\n * @property {import(\"./proj.js\").ProjectionLike} [projection='EPSG:3857'] The\n * projection. The default is Spherical Mercator.\n * @property {number} [resolution] The initial resolution for the view. The\n * units are `projection` units per pixel (e.g. meters per pixel). An\n * alternative to setting this is to set `zoom`. Layer sources will not be\n * fetched if neither this nor `zoom` are defined, but they can be set later\n * with {@link #setZoom} or {@link #setResolution}.\n * @property {Array} [resolutions] Resolutions that determine the\n * zoom levels if specified. The index in the array corresponds to the zoom level,\n * therefore the resolution values have to be in descending order. It also constrains\n * the resolution by the minimum and maximum value. If set the `maxResolution`,\n * `minResolution`, `minZoom`, `maxZoom`, and `zoomFactor` options are ignored.\n * @property {number} [rotation=0] The initial rotation for the view in radians\n * (positive rotation clockwise, 0 means North).\n * @property {number} [zoom] Only used if `resolution` is not defined. Zoom\n * level used to calculate the initial resolution for the view.\n * @property {number} [zoomFactor=2] The zoom factor used to compute the\n * corresponding resolution.\n * @property {!Array} [padding=[0, 0, 0, 0]] Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from\n * that content. The order of the values is top, right, bottom, left.\n */\n\n/**\n * @typedef {Object} AnimationOptions\n * @property {import(\"./coordinate.js\").Coordinate} [center] The center of the view at the end of\n * the animation.\n * @property {number} [zoom] The zoom level of the view at the end of the\n * animation. This takes precedence over `resolution`.\n * @property {number} [resolution] The resolution of the view at the end\n * of the animation. If `zoom` is also provided, this option will be ignored.\n * @property {number} [rotation] The rotation of the view at the end of\n * the animation.\n * @property {import(\"./coordinate.js\").Coordinate} [anchor] Optional anchor to remain fixed\n * during a rotation or resolution animation.\n * @property {number} [duration=1000] The duration of the animation in milliseconds.\n * @property {function(number):number} [easing] The easing function used\n * during the animation (defaults to {@link module:ol/easing.inAndOut}).\n * The function will be called for each frame with a number representing a\n * fraction of the animation's duration. The function should return a number\n * between 0 and 1 representing the progress toward the destination state.\n */\n\n/**\n * @typedef {Object} State\n * @property {import(\"./coordinate.js\").Coordinate} center Center (in view projection coordinates).\n * @property {import(\"./proj/Projection.js\").default} projection Projection.\n * @property {number} resolution Resolution.\n * @property {import(\"./coordinate.js\").Coordinate} [nextCenter] The next center during an animation series.\n * @property {number} [nextResolution] The next resolution during an animation series.\n * @property {number} [nextRotation] The next rotation during an animation series.\n * @property {number} rotation Rotation.\n * @property {number} zoom Zoom.\n */\n\n/**\n * Like {@link import(\"./Map.js\").FrameState}, but just `viewState` and `extent`.\n * @typedef {Object} ViewStateLayerStateExtent\n * @property {State} viewState View state.\n * @property {import(\"./extent.js\").Extent} extent Extent (in user projection coordinates).\n * @property {Array} [layerStatesArray] Layer states.\n */\n\n/**\n * Default min zoom level for the map view.\n * @type {number}\n */\nconst DEFAULT_MIN_ZOOM = 0;\n\n/**\n * @typedef {import(\"./ObjectEventType\").Types|'change:center'|'change:resolution'|'change:rotation'} ViewObjectEventTypes\n */\n\n/***\n * @template Return\n * @typedef {import(\"./Observable\").OnSignature &\n * import(\"./Observable\").OnSignature &\n * import(\"./Observable\").CombinedOnSignature} ViewOnSignature\n */\n\n/**\n * @classdesc\n * A View object represents a simple 2D view of the map.\n *\n * This is the object to act upon to change the center, resolution,\n * and rotation of the map.\n *\n * A View has a `projection`. The projection determines the\n * coordinate system of the center, and its units determine the units of the\n * resolution (projection units per pixel). The default projection is\n * Web Mercator (EPSG:3857).\n *\n * ### The view states\n *\n * A View is determined by three states: `center`, `resolution`,\n * and `rotation`. Each state has a corresponding getter and setter, e.g.\n * `getCenter` and `setCenter` for the `center` state.\n *\n * The `zoom` state is actually not saved on the view: all computations\n * internally use the `resolution` state. Still, the `setZoom` and `getZoom`\n * methods are available, as well as `getResolutionForZoom` and\n * `getZoomForResolution` to switch from one system to the other.\n *\n * ### The constraints\n *\n * `setCenter`, `setResolution` and `setRotation` can be used to change the\n * states of the view, but any constraint defined in the constructor will\n * be applied along the way.\n *\n * A View object can have a *resolution constraint*, a *rotation constraint*\n * and a *center constraint*.\n *\n * The *resolution constraint* typically restricts min/max values and\n * snaps to specific resolutions. It is determined by the following\n * options: `resolutions`, `maxResolution`, `maxZoom` and `zoomFactor`.\n * If `resolutions` is set, the other three options are ignored. See\n * documentation for each option for more information. By default, the view\n * only has a min/max restriction and allow intermediary zoom levels when\n * pinch-zooming for example.\n *\n * The *rotation constraint* snaps to specific angles. It is determined\n * by the following options: `enableRotation` and `constrainRotation`.\n * By default rotation is allowed and its value is snapped to zero when approaching the\n * horizontal.\n *\n * The *center constraint* is determined by the `extent` option. By\n * default the view center is not constrained at all.\n *\n * ### Changing the view state\n *\n * It is important to note that `setZoom`, `setResolution`, `setCenter` and\n * `setRotation` are subject to the above mentioned constraints. As such, it\n * may sometimes not be possible to know in advance the resulting state of the\n * View. For example, calling `setResolution(10)` does not guarantee that\n * `getResolution()` will return `10`.\n *\n * A consequence of this is that, when applying a delta on the view state, one\n * should use `adjustCenter`, `adjustRotation`, `adjustZoom` and `adjustResolution`\n * rather than the corresponding setters. This will let view do its internal\n * computations. Besides, the `adjust*` methods also take an `anchor`\n * argument which allows specifying an origin for the transformation.\n *\n * ### Interacting with the view\n *\n * View constraints are usually only applied when the view is *at rest*, meaning that\n * no interaction or animation is ongoing. As such, if the user puts the view in a\n * state that is not equivalent to a constrained one (e.g. rotating the view when\n * the snap angle is 0), an animation will be triggered at the interaction end to\n * put back the view to a stable state;\n *\n * @api\n */\nclass View extends BaseObject {\n /**\n * @param {ViewOptions} [options] View options.\n */\n constructor(options) {\n super();\n\n /***\n * @type {ViewOnSignature}\n */\n this.on;\n\n /***\n * @type {ViewOnSignature}\n */\n this.once;\n\n /***\n * @type {ViewOnSignature}\n */\n this.un;\n\n options = Object.assign({}, options);\n\n /**\n * @private\n * @type {Array}\n */\n this.hints_ = [0, 0];\n\n /**\n * @private\n * @type {Array>}\n */\n this.animations_ = [];\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.updateAnimationKey_;\n\n /**\n * @private\n * @const\n * @type {import(\"./proj/Projection.js\").default}\n */\n this.projection_ = createProjection(options.projection, 'EPSG:3857');\n\n /**\n * @private\n * @type {import(\"./size.js\").Size}\n */\n this.viewportSize_ = [100, 100];\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.targetCenter_ = null;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetResolution_;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.targetRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate}\n */\n this.nextCenter_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.nextResolution_;\n\n /**\n * @private\n * @type {number}\n */\n this.nextRotation_;\n\n /**\n * @private\n * @type {import(\"./coordinate.js\").Coordinate|undefined}\n */\n this.cancelAnchor_ = undefined;\n\n if (options.projection) {\n disableCoordinateWarning();\n }\n if (options.center) {\n options.center = fromUserCoordinate(options.center, this.projection_);\n }\n if (options.extent) {\n options.extent = fromUserExtent(options.extent, this.projection_);\n }\n\n this.applyOptions_(options);\n }\n\n /**\n * Set up the view with the given options.\n * @param {ViewOptions} options View options.\n */\n applyOptions_(options) {\n const properties = Object.assign({}, options);\n for (const key in ViewProperty) {\n delete properties[key];\n }\n this.setProperties(properties, true);\n\n const resolutionConstraintInfo = createResolutionConstraint(options);\n\n /**\n * @private\n * @type {number}\n */\n this.maxResolution_ = resolutionConstraintInfo.maxResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.minResolution_ = resolutionConstraintInfo.minResolution;\n\n /**\n * @private\n * @type {number}\n */\n this.zoomFactor_ = resolutionConstraintInfo.zoomFactor;\n\n /**\n * @private\n * @type {Array|undefined}\n */\n this.resolutions_ = options.resolutions;\n\n /**\n * @type {Array|undefined}\n * @private\n */\n this.padding_ = options.padding;\n\n /**\n * @private\n * @type {number}\n */\n this.minZoom_ = resolutionConstraintInfo.minZoom;\n\n const centerConstraint = createCenterConstraint(options);\n const resolutionConstraint = resolutionConstraintInfo.constraint;\n const rotationConstraint = createRotationConstraint(options);\n\n /**\n * @private\n * @type {Constraints}\n */\n this.constraints_ = {\n center: centerConstraint,\n resolution: resolutionConstraint,\n rotation: rotationConstraint,\n };\n\n this.setRotation(options.rotation !== undefined ? options.rotation : 0);\n this.setCenterInternal(\n options.center !== undefined ? options.center : null\n );\n if (options.resolution !== undefined) {\n this.setResolution(options.resolution);\n } else if (options.zoom !== undefined) {\n this.setZoom(options.zoom);\n }\n }\n\n /**\n * Padding (in css pixels).\n * If the map viewport is partially covered with other content (overlays) along\n * its edges, this setting allows to shift the center of the viewport away from that\n * content. The order of the values in the array is top, right, bottom, left.\n * The default is no padding, which is equivalent to `[0, 0, 0, 0]`.\n * @type {Array|undefined}\n * @api\n */\n get padding() {\n return this.padding_;\n }\n set padding(padding) {\n let oldPadding = this.padding_;\n this.padding_ = padding;\n const center = this.getCenterInternal();\n if (center) {\n const newPadding = padding || [0, 0, 0, 0];\n oldPadding = oldPadding || [0, 0, 0, 0];\n const resolution = this.getResolution();\n const offsetX =\n (resolution / 2) *\n (newPadding[3] - oldPadding[3] + oldPadding[1] - newPadding[1]);\n const offsetY =\n (resolution / 2) *\n (newPadding[0] - oldPadding[0] + oldPadding[2] - newPadding[2]);\n this.setCenterInternal([center[0] + offsetX, center[1] - offsetY]);\n }\n }\n\n /**\n * Get an updated version of the view options used to construct the view. The\n * current resolution (or zoom), center, and rotation are applied to any stored\n * options. The provided options can be used to apply new min/max zoom or\n * resolution limits.\n * @param {ViewOptions} newOptions New options to be applied.\n * @return {ViewOptions} New options updated with the current view state.\n */\n getUpdatedOptions_(newOptions) {\n const options = this.getProperties();\n\n // preserve resolution (or zoom)\n if (options.resolution !== undefined) {\n options.resolution = this.getResolution();\n } else {\n options.zoom = this.getZoom();\n }\n\n // preserve center\n options.center = this.getCenterInternal();\n\n // preserve rotation\n options.rotation = this.getRotation();\n\n return Object.assign({}, options, newOptions);\n }\n\n /**\n * Animate the view. The view's center, zoom (or resolution), and rotation\n * can be animated for smooth transitions between view states. For example,\n * to animate the view to a new zoom level:\n *\n * view.animate({zoom: view.getZoom() + 1});\n *\n * By default, the animation lasts one second and uses in-and-out easing. You\n * can customize this behavior by including `duration` (in milliseconds) and\n * `easing` options (see {@link module:ol/easing}).\n *\n * To chain together multiple animations, call the method with multiple\n * animation objects. For example, to first zoom and then pan:\n *\n * view.animate({zoom: 10}, {center: [0, 0]});\n *\n * If you provide a function as the last argument to the animate method, it\n * will get called at the end of an animation series. The callback will be\n * called with `true` if the animation series completed on its own or `false`\n * if it was cancelled.\n *\n * Animations are cancelled by user interactions (e.g. dragging the map) or by\n * calling `view.setCenter()`, `view.setResolution()`, or `view.setRotation()`\n * (or another method that calls one of these).\n *\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation\n * options. Multiple animations can be run in series by passing multiple\n * options objects. To run multiple animations in parallel, call the method\n * multiple times. An optional callback can be provided as a final\n * argument. The callback will be called with a boolean indicating whether\n * the animation completed without being cancelled.\n * @api\n */\n animate(var_args) {\n if (this.isDef() && !this.getAnimating()) {\n this.resolveConstraints(0);\n }\n const args = new Array(arguments.length);\n for (let i = 0; i < args.length; ++i) {\n let options = arguments[i];\n if (options.center) {\n options = Object.assign({}, options);\n options.center = fromUserCoordinate(\n options.center,\n this.getProjection()\n );\n }\n if (options.anchor) {\n options = Object.assign({}, options);\n options.anchor = fromUserCoordinate(\n options.anchor,\n this.getProjection()\n );\n }\n args[i] = options;\n }\n this.animateInternal.apply(this, args);\n }\n\n /**\n * @param {...(AnimationOptions|function(boolean): void)} var_args Animation options.\n */\n animateInternal(var_args) {\n let animationCount = arguments.length;\n let callback;\n if (\n animationCount > 1 &&\n typeof arguments[animationCount - 1] === 'function'\n ) {\n callback = arguments[animationCount - 1];\n --animationCount;\n }\n\n let i = 0;\n for (; i < animationCount && !this.isDef(); ++i) {\n // if view properties are not yet set, shortcut to the final state\n const state = arguments[i];\n if (state.center) {\n this.setCenterInternal(state.center);\n }\n if (state.zoom !== undefined) {\n this.setZoom(state.zoom);\n } else if (state.resolution) {\n this.setResolution(state.resolution);\n }\n if (state.rotation !== undefined) {\n this.setRotation(state.rotation);\n }\n }\n if (i === animationCount) {\n if (callback) {\n animationCallback(callback, true);\n }\n return;\n }\n\n let start = Date.now();\n let center = this.targetCenter_.slice();\n let resolution = this.targetResolution_;\n let rotation = this.targetRotation_;\n const series = [];\n for (; i < animationCount; ++i) {\n const options = /** @type {AnimationOptions} */ (arguments[i]);\n\n const animation = {\n start: start,\n complete: false,\n anchor: options.anchor,\n duration: options.duration !== undefined ? options.duration : 1000,\n easing: options.easing || inAndOut,\n callback: callback,\n };\n\n if (options.center) {\n animation.sourceCenter = center;\n animation.targetCenter = options.center.slice();\n center = animation.targetCenter;\n }\n\n if (options.zoom !== undefined) {\n animation.sourceResolution = resolution;\n animation.targetResolution = this.getResolutionForZoom(options.zoom);\n resolution = animation.targetResolution;\n } else if (options.resolution) {\n animation.sourceResolution = resolution;\n animation.targetResolution = options.resolution;\n resolution = animation.targetResolution;\n }\n\n if (options.rotation !== undefined) {\n animation.sourceRotation = rotation;\n const delta =\n modulo(options.rotation - rotation + Math.PI, 2 * Math.PI) - Math.PI;\n animation.targetRotation = rotation + delta;\n rotation = animation.targetRotation;\n }\n\n // check if animation is a no-op\n if (isNoopAnimation(animation)) {\n animation.complete = true;\n // we still push it onto the series for callback handling\n } else {\n start += animation.duration;\n }\n series.push(animation);\n }\n this.animations_.push(series);\n this.setHint(ViewHint.ANIMATING, 1);\n this.updateAnimations_();\n }\n\n /**\n * Determine if the view is being animated.\n * @return {boolean} The view is being animated.\n * @api\n */\n getAnimating() {\n return this.hints_[ViewHint.ANIMATING] > 0;\n }\n\n /**\n * Determine if the user is interacting with the view, such as panning or zooming.\n * @return {boolean} The view is being interacted with.\n * @api\n */\n getInteracting() {\n return this.hints_[ViewHint.INTERACTING] > 0;\n }\n\n /**\n * Cancel any ongoing animations.\n * @api\n */\n cancelAnimations() {\n this.setHint(ViewHint.ANIMATING, -this.hints_[ViewHint.ANIMATING]);\n let anchor;\n for (let i = 0, ii = this.animations_.length; i < ii; ++i) {\n const series = this.animations_[i];\n if (series[0].callback) {\n animationCallback(series[0].callback, false);\n }\n if (!anchor) {\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (!animation.complete) {\n anchor = animation.anchor;\n break;\n }\n }\n }\n }\n this.animations_.length = 0;\n this.cancelAnchor_ = anchor;\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n }\n\n /**\n * Update all animations.\n */\n updateAnimations_() {\n if (this.updateAnimationKey_ !== undefined) {\n cancelAnimationFrame(this.updateAnimationKey_);\n this.updateAnimationKey_ = undefined;\n }\n if (!this.getAnimating()) {\n return;\n }\n const now = Date.now();\n let more = false;\n for (let i = this.animations_.length - 1; i >= 0; --i) {\n const series = this.animations_[i];\n let seriesComplete = true;\n for (let j = 0, jj = series.length; j < jj; ++j) {\n const animation = series[j];\n if (animation.complete) {\n continue;\n }\n const elapsed = now - animation.start;\n let fraction =\n animation.duration > 0 ? elapsed / animation.duration : 1;\n if (fraction >= 1) {\n animation.complete = true;\n fraction = 1;\n } else {\n seriesComplete = false;\n }\n const progress = animation.easing(fraction);\n if (animation.sourceCenter) {\n const x0 = animation.sourceCenter[0];\n const y0 = animation.sourceCenter[1];\n const x1 = animation.targetCenter[0];\n const y1 = animation.targetCenter[1];\n this.nextCenter_ = animation.targetCenter;\n const x = x0 + progress * (x1 - x0);\n const y = y0 + progress * (y1 - y0);\n this.targetCenter_ = [x, y];\n }\n if (animation.sourceResolution && animation.targetResolution) {\n const resolution =\n progress === 1\n ? animation.targetResolution\n : animation.sourceResolution +\n progress *\n (animation.targetResolution - animation.sourceResolution);\n if (animation.anchor) {\n const size = this.getViewportSize_(this.getRotation());\n const constrainedResolution = this.constraints_.resolution(\n resolution,\n 0,\n size,\n true\n );\n this.targetCenter_ = this.calculateCenterZoom(\n constrainedResolution,\n animation.anchor\n );\n }\n this.nextResolution_ = animation.targetResolution;\n this.targetResolution_ = resolution;\n this.applyTargetState_(true);\n }\n if (\n animation.sourceRotation !== undefined &&\n animation.targetRotation !== undefined\n ) {\n const rotation =\n progress === 1\n ? modulo(animation.targetRotation + Math.PI, 2 * Math.PI) -\n Math.PI\n : animation.sourceRotation +\n progress *\n (animation.targetRotation - animation.sourceRotation);\n if (animation.anchor) {\n const constrainedRotation = this.constraints_.rotation(\n rotation,\n true\n );\n this.targetCenter_ = this.calculateCenterRotate(\n constrainedRotation,\n animation.anchor\n );\n }\n this.nextRotation_ = animation.targetRotation;\n this.targetRotation_ = rotation;\n }\n this.applyTargetState_(true);\n more = true;\n if (!animation.complete) {\n break;\n }\n }\n if (seriesComplete) {\n this.animations_[i] = null;\n this.setHint(ViewHint.ANIMATING, -1);\n this.nextCenter_ = null;\n this.nextResolution_ = NaN;\n this.nextRotation_ = NaN;\n const callback = series[0].callback;\n if (callback) {\n animationCallback(callback, true);\n }\n }\n }\n // prune completed series\n this.animations_ = this.animations_.filter(Boolean);\n if (more && this.updateAnimationKey_ === undefined) {\n this.updateAnimationKey_ = requestAnimationFrame(\n this.updateAnimations_.bind(this)\n );\n }\n }\n\n /**\n * @param {number} rotation Target rotation.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Rotation anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for rotation and anchor.\n */\n calculateCenterRotate(rotation, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n if (currentCenter !== undefined) {\n center = [currentCenter[0] - anchor[0], currentCenter[1] - anchor[1]];\n rotateCoordinate(center, rotation - this.getRotation());\n addCoordinate(center, anchor);\n }\n return center;\n }\n\n /**\n * @param {number} resolution Target resolution.\n * @param {import(\"./coordinate.js\").Coordinate} anchor Zoom anchor.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Center for resolution and anchor.\n */\n calculateCenterZoom(resolution, anchor) {\n let center;\n const currentCenter = this.getCenterInternal();\n const currentResolution = this.getResolution();\n if (currentCenter !== undefined && currentResolution !== undefined) {\n const x =\n anchor[0] -\n (resolution * (anchor[0] - currentCenter[0])) / currentResolution;\n const y =\n anchor[1] -\n (resolution * (anchor[1] - currentCenter[1])) / currentResolution;\n center = [x, y];\n }\n return center;\n }\n\n /**\n * Returns the current viewport size.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size or `[100, 100]` when no viewport is found.\n */\n getViewportSize_(rotation) {\n const size = this.viewportSize_;\n if (rotation) {\n const w = size[0];\n const h = size[1];\n return [\n Math.abs(w * Math.cos(rotation)) + Math.abs(h * Math.sin(rotation)),\n Math.abs(w * Math.sin(rotation)) + Math.abs(h * Math.cos(rotation)),\n ];\n }\n return size;\n }\n\n /**\n * Stores the viewport size on the view. The viewport size is not read every time from the DOM\n * to avoid performance hit and layout reflow.\n * This should be done on map size change.\n * Note: the constraints are not resolved during an animation to avoid stopping it\n * @param {import(\"./size.js\").Size} [size] Viewport size; if undefined, [100, 100] is assumed\n */\n setViewportSize(size) {\n this.viewportSize_ = Array.isArray(size) ? size.slice() : [100, 100];\n if (!this.getAnimating()) {\n this.resolveConstraints(0);\n }\n }\n\n /**\n * Get the view center.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n * @observable\n * @api\n */\n getCenter() {\n const center = this.getCenterInternal();\n if (!center) {\n return center;\n }\n return toUserCoordinate(center, this.getProjection());\n }\n\n /**\n * Get the view center without transforming to user projection.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} The center of the view.\n */\n getCenterInternal() {\n return /** @type {import(\"./coordinate.js\").Coordinate|undefined} */ (\n this.get(ViewProperty.CENTER)\n );\n }\n\n /**\n * @return {Constraints} Constraints.\n */\n getConstraints() {\n return this.constraints_;\n }\n\n /**\n * @return {boolean} Resolution constraint is set\n */\n getConstrainResolution() {\n return this.get('constrainResolution');\n }\n\n /**\n * @param {Array} [hints] Destination array.\n * @return {Array} Hint.\n */\n getHints(hints) {\n if (hints !== undefined) {\n hints[0] = this.hints_[0];\n hints[1] = this.hints_[1];\n return hints;\n }\n return this.hints_.slice();\n }\n\n /**\n * Calculate the extent for the current view state and the passed box size.\n * @param {import(\"./size.js\").Size} [size] The pixel dimensions of the box\n * into which the calculated extent should fit. Defaults to the size of the\n * map the view is associated with.\n * If no map or multiple maps are connected to the view, provide the desired\n * box size (e.g. `map.getSize()`).\n * @return {import(\"./extent.js\").Extent} Extent.\n * @api\n */\n calculateExtent(size) {\n const extent = this.calculateExtentInternal(size);\n return toUserExtent(extent, this.getProjection());\n }\n\n /**\n * @param {import(\"./size.js\").Size} [size] Box pixel size. If not provided,\n * the map's last known viewport size will be used.\n * @return {import(\"./extent.js\").Extent} Extent.\n */\n calculateExtentInternal(size) {\n size = size || this.getViewportSizeMinusPadding_();\n const center = /** @type {!import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n assert(center, 'The view center is not defined');\n const resolution = /** @type {!number} */ (this.getResolution());\n assert(resolution !== undefined, 'The view resolution is not defined');\n const rotation = /** @type {!number} */ (this.getRotation());\n assert(rotation !== undefined, 'The view rotation is not defined');\n\n return getForViewAndSize(center, resolution, rotation, size);\n }\n\n /**\n * Get the maximum resolution of the view.\n * @return {number} The maximum resolution of the view.\n * @api\n */\n getMaxResolution() {\n return this.maxResolution_;\n }\n\n /**\n * Get the minimum resolution of the view.\n * @return {number} The minimum resolution of the view.\n * @api\n */\n getMinResolution() {\n return this.minResolution_;\n }\n\n /**\n * Get the maximum zoom level for the view.\n * @return {number} The maximum zoom level.\n * @api\n */\n getMaxZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.minResolution_)\n );\n }\n\n /**\n * Set a new maximum zoom level for the view.\n * @param {number} zoom The maximum zoom level.\n * @api\n */\n setMaxZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({maxZoom: zoom}));\n }\n\n /**\n * Get the minimum zoom level for the view.\n * @return {number} The minimum zoom level.\n * @api\n */\n getMinZoom() {\n return /** @type {number} */ (\n this.getZoomForResolution(this.maxResolution_)\n );\n }\n\n /**\n * Set a new minimum zoom level for the view.\n * @param {number} zoom The minimum zoom level.\n * @api\n */\n setMinZoom(zoom) {\n this.applyOptions_(this.getUpdatedOptions_({minZoom: zoom}));\n }\n\n /**\n * Set whether the view should allow intermediary zoom levels.\n * @param {boolean} enabled Whether the resolution is constrained.\n * @api\n */\n setConstrainResolution(enabled) {\n this.applyOptions_(this.getUpdatedOptions_({constrainResolution: enabled}));\n }\n\n /**\n * Get the view projection.\n * @return {import(\"./proj/Projection.js\").default} The projection of the view.\n * @api\n */\n getProjection() {\n return this.projection_;\n }\n\n /**\n * Get the view resolution.\n * @return {number|undefined} The resolution of the view.\n * @observable\n * @api\n */\n getResolution() {\n return /** @type {number|undefined} */ (this.get(ViewProperty.RESOLUTION));\n }\n\n /**\n * Get the resolutions for the view. This returns the array of resolutions\n * passed to the constructor of the View, or undefined if none were given.\n * @return {Array|undefined} The resolutions of the view.\n * @api\n */\n getResolutions() {\n return this.resolutions_;\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n * @api\n */\n getResolutionForExtent(extent, size) {\n return this.getResolutionForExtentInternal(\n fromUserExtent(extent, this.getProjection()),\n size\n );\n }\n\n /**\n * Get the resolution for a provided extent (in map units) and size (in pixels).\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {import(\"./size.js\").Size} [size] Box pixel size.\n * @return {number} The resolution at which the provided extent will render at\n * the given size.\n */\n getResolutionForExtentInternal(extent, size) {\n size = size || this.getViewportSizeMinusPadding_();\n const xResolution = getWidth(extent) / size[0];\n const yResolution = getHeight(extent) / size[1];\n return Math.max(xResolution, yResolution);\n }\n\n /**\n * Return a function that returns a value between 0 and 1 for a\n * resolution. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Resolution for value function.\n */\n getResolutionForValueFunction(power) {\n power = power || 2;\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / Math.log(power);\n return (\n /**\n * @param {number} value Value.\n * @return {number} Resolution.\n */\n function (value) {\n const resolution = maxResolution / Math.pow(power, value * max);\n return resolution;\n }\n );\n }\n\n /**\n * Get the view rotation.\n * @return {number} The rotation of the view in radians.\n * @observable\n * @api\n */\n getRotation() {\n return /** @type {number} */ (this.get(ViewProperty.ROTATION));\n }\n\n /**\n * Return a function that returns a resolution for a value between\n * 0 and 1. Exponential scaling is assumed.\n * @param {number} [power] Power.\n * @return {function(number): number} Value for resolution function.\n */\n getValueForResolutionFunction(power) {\n const logPower = Math.log(power || 2);\n const maxResolution = this.getConstrainedResolution(this.maxResolution_);\n const minResolution = this.minResolution_;\n const max = Math.log(maxResolution / minResolution) / logPower;\n return (\n /**\n * @param {number} resolution Resolution.\n * @return {number} Value.\n */\n function (resolution) {\n const value = Math.log(maxResolution / resolution) / logPower / max;\n return value;\n }\n );\n }\n\n /**\n * Returns the size of the viewport minus padding.\n * @private\n * @param {number} [rotation] Take into account the rotation of the viewport when giving the size\n * @return {import(\"./size.js\").Size} Viewport size reduced by the padding.\n */\n getViewportSizeMinusPadding_(rotation) {\n let size = this.getViewportSize_(rotation);\n const padding = this.padding_;\n if (padding) {\n size = [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ];\n }\n return size;\n }\n\n /**\n * @return {State} View state.\n */\n getState() {\n const projection = this.getProjection();\n const resolution = this.getResolution();\n const rotation = this.getRotation();\n let center = /** @type {import(\"./coordinate.js\").Coordinate} */ (\n this.getCenterInternal()\n );\n const padding = this.padding_;\n if (padding) {\n const reducedSize = this.getViewportSizeMinusPadding_();\n center = calculateCenterOn(\n center,\n this.getViewportSize_(),\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation\n );\n }\n return {\n center: center.slice(0),\n projection: projection !== undefined ? projection : null,\n resolution: resolution,\n nextCenter: this.nextCenter_,\n nextResolution: this.nextResolution_,\n nextRotation: this.nextRotation_,\n rotation: rotation,\n zoom: this.getZoom(),\n };\n }\n\n /**\n * @return {ViewStateLayerStateExtent} Like `FrameState`, but just `viewState` and `extent`.\n */\n getViewStateAndExtent() {\n return {\n viewState: this.getState(),\n extent: this.calculateExtent(),\n };\n }\n\n /**\n * Get the current zoom level. This method may return non-integer zoom levels\n * if the view does not constrain the resolution, or if an interaction or\n * animation is underway.\n * @return {number|undefined} Zoom.\n * @api\n */\n getZoom() {\n let zoom;\n const resolution = this.getResolution();\n if (resolution !== undefined) {\n zoom = this.getZoomForResolution(resolution);\n }\n return zoom;\n }\n\n /**\n * Get the zoom level for a resolution.\n * @param {number} resolution The resolution.\n * @return {number|undefined} The zoom level for the provided resolution.\n * @api\n */\n getZoomForResolution(resolution) {\n let offset = this.minZoom_ || 0;\n let max, zoomFactor;\n if (this.resolutions_) {\n const nearest = linearFindNearest(this.resolutions_, resolution, 1);\n offset = nearest;\n max = this.resolutions_[nearest];\n if (nearest == this.resolutions_.length - 1) {\n zoomFactor = 2;\n } else {\n zoomFactor = max / this.resolutions_[nearest + 1];\n }\n } else {\n max = this.maxResolution_;\n zoomFactor = this.zoomFactor_;\n }\n return offset + Math.log(max / resolution) / Math.log(zoomFactor);\n }\n\n /**\n * Get the resolution for a zoom level.\n * @param {number} zoom Zoom level.\n * @return {number} The view resolution for the provided zoom level.\n * @api\n */\n getResolutionForZoom(zoom) {\n if (this.resolutions_) {\n if (this.resolutions_.length <= 1) {\n return 0;\n }\n const baseLevel = clamp(\n Math.floor(zoom),\n 0,\n this.resolutions_.length - 2\n );\n const zoomFactor =\n this.resolutions_[baseLevel] / this.resolutions_[baseLevel + 1];\n return (\n this.resolutions_[baseLevel] /\n Math.pow(zoomFactor, clamp(zoom - baseLevel, 0, 1))\n );\n }\n return (\n this.maxResolution_ / Math.pow(this.zoomFactor_, zoom - this.minZoom_)\n );\n }\n\n /**\n * Fit the given geometry or extent based on the given map size and border.\n * The size is pixel dimensions of the box to fit the extent into.\n * In most cases you will want to use the map size, that is `map.getSize()`.\n * Takes care of the map angle.\n * @param {import(\"./geom/SimpleGeometry.js\").default|import(\"./extent.js\").Extent} geometryOrExtent The geometry or\n * extent to fit the view to.\n * @param {FitOptions} [options] Options.\n * @api\n */\n fit(geometryOrExtent, options) {\n /** @type {import(\"./geom/SimpleGeometry.js\").default} */\n let geometry;\n assert(\n Array.isArray(geometryOrExtent) ||\n typeof (/** @type {?} */ (geometryOrExtent).getSimplifiedGeometry) ===\n 'function',\n 'Invalid extent or geometry provided as `geometry`'\n );\n if (Array.isArray(geometryOrExtent)) {\n assert(\n !isEmpty(geometryOrExtent),\n 'Cannot fit empty extent provided as `geometry`'\n );\n const extent = fromUserExtent(geometryOrExtent, this.getProjection());\n geometry = polygonFromExtent(extent);\n } else if (geometryOrExtent.getType() === 'Circle') {\n const extent = fromUserExtent(\n geometryOrExtent.getExtent(),\n this.getProjection()\n );\n geometry = polygonFromExtent(extent);\n geometry.rotate(this.getRotation(), getCenter(extent));\n } else {\n const userProjection = getUserProjection();\n if (userProjection) {\n geometry = /** @type {import(\"./geom/SimpleGeometry.js\").default} */ (\n geometryOrExtent\n .clone()\n .transform(userProjection, this.getProjection())\n );\n } else {\n geometry = geometryOrExtent;\n }\n }\n\n this.fitInternal(geometry, options);\n }\n\n /**\n * Calculate rotated extent\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @return {import(\"./extent\").Extent} The rotated extent for the geometry.\n */\n rotatedExtentForGeometry(geometry) {\n const rotation = this.getRotation();\n const cosAngle = Math.cos(rotation);\n const sinAngle = Math.sin(-rotation);\n const coords = geometry.getFlatCoordinates();\n const stride = geometry.getStride();\n let minRotX = +Infinity;\n let minRotY = +Infinity;\n let maxRotX = -Infinity;\n let maxRotY = -Infinity;\n for (let i = 0, ii = coords.length; i < ii; i += stride) {\n const rotX = coords[i] * cosAngle - coords[i + 1] * sinAngle;\n const rotY = coords[i] * sinAngle + coords[i + 1] * cosAngle;\n minRotX = Math.min(minRotX, rotX);\n minRotY = Math.min(minRotY, rotY);\n maxRotX = Math.max(maxRotX, rotX);\n maxRotY = Math.max(maxRotY, rotY);\n }\n return [minRotX, minRotY, maxRotX, maxRotY];\n }\n\n /**\n * @param {import(\"./geom/SimpleGeometry.js\").default} geometry The geometry.\n * @param {FitOptions} [options] Options.\n */\n fitInternal(geometry, options) {\n options = options || {};\n let size = options.size;\n if (!size) {\n size = this.getViewportSizeMinusPadding_();\n }\n const padding =\n options.padding !== undefined ? options.padding : [0, 0, 0, 0];\n const nearest = options.nearest !== undefined ? options.nearest : false;\n let minResolution;\n if (options.minResolution !== undefined) {\n minResolution = options.minResolution;\n } else if (options.maxZoom !== undefined) {\n minResolution = this.getResolutionForZoom(options.maxZoom);\n } else {\n minResolution = 0;\n }\n\n const rotatedExtent = this.rotatedExtentForGeometry(geometry);\n\n // calculate resolution\n let resolution = this.getResolutionForExtentInternal(rotatedExtent, [\n size[0] - padding[1] - padding[3],\n size[1] - padding[0] - padding[2],\n ]);\n resolution = isNaN(resolution)\n ? minResolution\n : Math.max(resolution, minResolution);\n resolution = this.getConstrainedResolution(resolution, nearest ? 0 : 1);\n\n // calculate center\n const rotation = this.getRotation();\n const sinAngle = Math.sin(rotation);\n const cosAngle = Math.cos(rotation);\n const centerRot = getCenter(rotatedExtent);\n centerRot[0] += ((padding[1] - padding[3]) / 2) * resolution;\n centerRot[1] += ((padding[0] - padding[2]) / 2) * resolution;\n const centerX = centerRot[0] * cosAngle - centerRot[1] * sinAngle;\n const centerY = centerRot[1] * cosAngle + centerRot[0] * sinAngle;\n const center = this.getConstrainedCenter([centerX, centerY], resolution);\n const callback = options.callback ? options.callback : VOID;\n\n if (options.duration !== undefined) {\n this.animateInternal(\n {\n resolution: resolution,\n center: center,\n duration: options.duration,\n easing: options.easing,\n },\n callback\n );\n } else {\n this.targetResolution_ = resolution;\n this.targetCenter_ = center;\n this.applyTargetState_(false, true);\n animationCallback(callback, true);\n }\n }\n\n /**\n * Center on coordinate and view position.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @api\n */\n centerOn(coordinate, size, position) {\n this.centerOnInternal(\n fromUserCoordinate(coordinate, this.getProjection()),\n size,\n position\n );\n }\n\n /**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n */\n centerOnInternal(coordinate, size, position) {\n this.setCenterInternal(\n calculateCenterOn(\n coordinate,\n size,\n position,\n this.getResolution(),\n this.getRotation()\n )\n );\n }\n\n /**\n * Calculates the shift between map and viewport center.\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array|undefined} Center shift.\n */\n calculateCenterShift(center, resolution, rotation, size) {\n let centerShift;\n const padding = this.padding_;\n if (padding && center) {\n const reducedSize = this.getViewportSizeMinusPadding_(-rotation);\n const shiftedCenter = calculateCenterOn(\n center,\n size,\n [reducedSize[0] / 2 + padding[3], reducedSize[1] / 2 + padding[0]],\n resolution,\n rotation\n );\n centerShift = [\n center[0] - shiftedCenter[0],\n center[1] - shiftedCenter[1],\n ];\n }\n return centerShift;\n }\n\n /**\n * @return {boolean} Is defined.\n */\n isDef() {\n return !!this.getCenterInternal() && this.getResolution() !== undefined;\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n * @api\n */\n adjustCenter(deltaCoordinates) {\n const center = toUserCoordinate(this.targetCenter_, this.getProjection());\n this.setCenter([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Adds relative coordinates to the center of the view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate} deltaCoordinates Relative value to add.\n */\n adjustCenterInternal(deltaCoordinates) {\n const center = this.targetCenter_;\n this.setCenterInternal([\n center[0] + deltaCoordinates[0],\n center[1] + deltaCoordinates[1],\n ]);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustResolution(ratio, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.adjustResolutionInternal(ratio, anchor);\n }\n\n /**\n * Multiply the view resolution by a ratio, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} ratio The ratio to apply on the view resolution.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n adjustResolutionInternal(ratio, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const size = this.getViewportSize_(this.getRotation());\n const newResolution = this.constraints_.resolution(\n this.targetResolution_ * ratio,\n 0,\n size,\n isMoving\n );\n\n if (anchor) {\n this.targetCenter_ = this.calculateCenterZoom(newResolution, anchor);\n }\n\n this.targetResolution_ *= ratio;\n this.applyTargetState_();\n }\n\n /**\n * Adds a value to the view zoom level, optionally using an anchor. Any resolution\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom level.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n adjustZoom(delta, anchor) {\n this.adjustResolution(Math.pow(this.zoomFactor_, -delta), anchor);\n }\n\n /**\n * Adds a value to the view rotation, optionally using an anchor. Any rotation\n * constraint will apply.\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n * @api\n */\n adjustRotation(delta, anchor) {\n if (anchor) {\n anchor = fromUserCoordinate(anchor, this.getProjection());\n }\n this.adjustRotationInternal(delta, anchor);\n }\n\n /**\n * @param {number} delta Relative value to add to the zoom rotation, in radians.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The rotation center.\n */\n adjustRotationInternal(delta, anchor) {\n const isMoving = this.getAnimating() || this.getInteracting();\n const newRotation = this.constraints_.rotation(\n this.targetRotation_ + delta,\n isMoving\n );\n if (anchor) {\n this.targetCenter_ = this.calculateCenterRotate(newRotation, anchor);\n }\n this.targetRotation_ += delta;\n this.applyTargetState_();\n }\n\n /**\n * Set the center of the current view. Any extent constraint will apply.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n * @observable\n * @api\n */\n setCenter(center) {\n this.setCenterInternal(\n center ? fromUserCoordinate(center, this.getProjection()) : center\n );\n }\n\n /**\n * Set the center using the view projection (not the user projection).\n * @param {import(\"./coordinate.js\").Coordinate|undefined} center The center of the view.\n */\n setCenterInternal(center) {\n this.targetCenter_ = center;\n this.applyTargetState_();\n }\n\n /**\n * @param {import(\"./ViewHint.js\").default} hint Hint.\n * @param {number} delta Delta.\n * @return {number} New value.\n */\n setHint(hint, delta) {\n this.hints_[hint] += delta;\n this.changed();\n return this.hints_[hint];\n }\n\n /**\n * Set the resolution for this view. Any resolution constraint will apply.\n * @param {number|undefined} resolution The resolution of the view.\n * @observable\n * @api\n */\n setResolution(resolution) {\n this.targetResolution_ = resolution;\n this.applyTargetState_();\n }\n\n /**\n * Set the rotation for this view. Any rotation constraint will apply.\n * @param {number} rotation The rotation of the view in radians.\n * @observable\n * @api\n */\n setRotation(rotation) {\n this.targetRotation_ = rotation;\n this.applyTargetState_();\n }\n\n /**\n * Zoom to a specific zoom level. Any resolution constrain will apply.\n * @param {number} zoom Zoom level.\n * @api\n */\n setZoom(zoom) {\n this.setResolution(this.getResolutionForZoom(zoom));\n }\n\n /**\n * Recompute rotation/resolution/center based on target values.\n * Note: we have to compute rotation first, then resolution and center considering that\n * parameters can influence one another in case a view extent constraint is present.\n * @param {boolean} [doNotCancelAnims] Do not cancel animations.\n * @param {boolean} [forceMoving] Apply constraints as if the view is moving.\n * @private\n */\n applyTargetState_(doNotCancelAnims, forceMoving) {\n const isMoving =\n this.getAnimating() || this.getInteracting() || forceMoving;\n\n // compute rotation\n const newRotation = this.constraints_.rotation(\n this.targetRotation_,\n isMoving\n );\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n 0,\n size,\n isMoving\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n isMoving,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size\n )\n );\n\n if (this.get(ViewProperty.ROTATION) !== newRotation) {\n this.set(ViewProperty.ROTATION, newRotation);\n }\n if (this.get(ViewProperty.RESOLUTION) !== newResolution) {\n this.set(ViewProperty.RESOLUTION, newResolution);\n this.set('zoom', this.getZoom(), true);\n }\n if (\n !newCenter ||\n !this.get(ViewProperty.CENTER) ||\n !equals(this.get(ViewProperty.CENTER), newCenter)\n ) {\n this.set(ViewProperty.CENTER, newCenter);\n }\n\n if (this.getAnimating() && !doNotCancelAnims) {\n this.cancelAnimations();\n }\n this.cancelAnchor_ = undefined;\n }\n\n /**\n * If any constraints need to be applied, an animation will be triggered.\n * This is typically done on interaction end.\n * Note: calling this with a duration of 0 will apply the constrained values straight away,\n * without animation.\n * @param {number} [duration] The animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n resolveConstraints(duration, resolutionDirection, anchor) {\n duration = duration !== undefined ? duration : 200;\n const direction = resolutionDirection || 0;\n\n const newRotation = this.constraints_.rotation(this.targetRotation_);\n const size = this.getViewportSize_(newRotation);\n const newResolution = this.constraints_.resolution(\n this.targetResolution_,\n direction,\n size\n );\n const newCenter = this.constraints_.center(\n this.targetCenter_,\n newResolution,\n size,\n false,\n this.calculateCenterShift(\n this.targetCenter_,\n newResolution,\n newRotation,\n size\n )\n );\n\n if (duration === 0 && !this.cancelAnchor_) {\n this.targetResolution_ = newResolution;\n this.targetRotation_ = newRotation;\n this.targetCenter_ = newCenter;\n this.applyTargetState_();\n return;\n }\n\n anchor = anchor || (duration === 0 ? this.cancelAnchor_ : undefined);\n this.cancelAnchor_ = undefined;\n\n if (\n this.getResolution() !== newResolution ||\n this.getRotation() !== newRotation ||\n !this.getCenterInternal() ||\n !equals(this.getCenterInternal(), newCenter)\n ) {\n if (this.getAnimating()) {\n this.cancelAnimations();\n }\n\n this.animateInternal({\n rotation: newRotation,\n center: newCenter,\n resolution: newResolution,\n duration: duration,\n easing: easeOut,\n anchor: anchor,\n });\n }\n }\n\n /**\n * Notify the View that an interaction has started.\n * The view state will be resolved to a stable one if needed\n * (depending on its constraints).\n * @api\n */\n beginInteraction() {\n this.resolveConstraints(0);\n\n this.setHint(ViewHint.INTERACTING, 1);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n * @api\n */\n endInteraction(duration, resolutionDirection, anchor) {\n anchor = anchor && fromUserCoordinate(anchor, this.getProjection());\n this.endInteractionInternal(duration, resolutionDirection, anchor);\n }\n\n /**\n * Notify the View that an interaction has ended. The view state will be resolved\n * to a stable one if needed (depending on its constraints).\n * @param {number} [duration] Animation duration in ms.\n * @param {number} [resolutionDirection] Which direction to zoom.\n * @param {import(\"./coordinate.js\").Coordinate} [anchor] The origin of the transformation.\n */\n endInteractionInternal(duration, resolutionDirection, anchor) {\n if (!this.getInteracting()) {\n return;\n }\n this.setHint(ViewHint.INTERACTING, -1);\n this.resolveConstraints(duration, resolutionDirection, anchor);\n }\n\n /**\n * Get a valid position for the view center according to the current constraints.\n * @param {import(\"./coordinate.js\").Coordinate|undefined} targetCenter Target center position.\n * @param {number} [targetResolution] Target resolution. If not supplied, the current one will be used.\n * This is useful to guess a valid center position at a different zoom level.\n * @return {import(\"./coordinate.js\").Coordinate|undefined} Valid center position.\n */\n getConstrainedCenter(targetCenter, targetResolution) {\n const size = this.getViewportSize_(this.getRotation());\n return this.constraints_.center(\n targetCenter,\n targetResolution || this.getResolution(),\n size\n );\n }\n\n /**\n * Get a valid zoom level according to the current view constraints.\n * @param {number|undefined} targetZoom Target zoom.\n * @param {number} [direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid zoom level.\n */\n getConstrainedZoom(targetZoom, direction) {\n const targetRes = this.getResolutionForZoom(targetZoom);\n return this.getZoomForResolution(\n this.getConstrainedResolution(targetRes, direction)\n );\n }\n\n /**\n * Get a valid resolution according to the current view constraints.\n * @param {number|undefined} targetResolution Target resolution.\n * @param {number} [direction=0] Indicate which resolution should be used\n * by a renderer if the view resolution does not match any resolution of the tile source.\n * If 0, the nearest resolution will be used. If 1, the nearest lower resolution\n * will be used. If -1, the nearest higher resolution will be used.\n * @return {number|undefined} Valid resolution.\n */\n getConstrainedResolution(targetResolution, direction) {\n direction = direction || 0;\n const size = this.getViewportSize_(this.getRotation());\n\n return this.constraints_.resolution(targetResolution, direction, size);\n }\n}\n\n/**\n * @param {Function} callback Callback.\n * @param {*} returnValue Return value.\n */\nfunction animationCallback(callback, returnValue) {\n setTimeout(function () {\n callback(returnValue);\n }, 0);\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./centerconstraint.js\").Type} The constraint.\n */\nexport function createCenterConstraint(options) {\n if (options.extent !== undefined) {\n const smooth =\n options.smoothExtentConstraint !== undefined\n ? options.smoothExtentConstraint\n : true;\n return createExtent(options.extent, options.constrainOnlyCenter, smooth);\n }\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n if (options.multiWorld !== true && projection.isGlobal()) {\n const extent = projection.getExtent().slice();\n extent[0] = -Infinity;\n extent[2] = Infinity;\n return createExtent(extent, false, false);\n }\n\n return centerNone;\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {{constraint: import(\"./resolutionconstraint.js\").Type, maxResolution: number,\n * minResolution: number, minZoom: number, zoomFactor: number}} The constraint.\n */\nexport function createResolutionConstraint(options) {\n let resolutionConstraint;\n let maxResolution;\n let minResolution;\n\n // TODO: move these to be ol constants\n // see https://github.com/openlayers/openlayers/issues/2076\n const defaultMaxZoom = 28;\n const defaultZoomFactor = 2;\n\n let minZoom =\n options.minZoom !== undefined ? options.minZoom : DEFAULT_MIN_ZOOM;\n\n let maxZoom =\n options.maxZoom !== undefined ? options.maxZoom : defaultMaxZoom;\n\n const zoomFactor =\n options.zoomFactor !== undefined ? options.zoomFactor : defaultZoomFactor;\n\n const multiWorld =\n options.multiWorld !== undefined ? options.multiWorld : false;\n\n const smooth =\n options.smoothResolutionConstraint !== undefined\n ? options.smoothResolutionConstraint\n : true;\n\n const showFullExtent =\n options.showFullExtent !== undefined ? options.showFullExtent : false;\n\n const projection = createProjection(options.projection, 'EPSG:3857');\n const projExtent = projection.getExtent();\n let constrainOnlyCenter = options.constrainOnlyCenter;\n let extent = options.extent;\n if (!multiWorld && !extent && projection.isGlobal()) {\n constrainOnlyCenter = false;\n extent = projExtent;\n }\n\n if (options.resolutions !== undefined) {\n const resolutions = options.resolutions;\n maxResolution = resolutions[minZoom];\n minResolution =\n resolutions[maxZoom] !== undefined\n ? resolutions[maxZoom]\n : resolutions[resolutions.length - 1];\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToResolutions(\n resolutions,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n }\n } else {\n // calculate the default min and max resolution\n const size = !projExtent\n ? // use an extent that can fit the whole world if need be\n (360 * METERS_PER_UNIT.degrees) / projection.getMetersPerUnit()\n : Math.max(getWidth(projExtent), getHeight(projExtent));\n\n const defaultMaxResolution =\n size / DEFAULT_TILE_SIZE / Math.pow(defaultZoomFactor, DEFAULT_MIN_ZOOM);\n\n const defaultMinResolution =\n defaultMaxResolution /\n Math.pow(defaultZoomFactor, defaultMaxZoom - DEFAULT_MIN_ZOOM);\n\n // user provided maxResolution takes precedence\n maxResolution = options.maxResolution;\n if (maxResolution !== undefined) {\n minZoom = 0;\n } else {\n maxResolution = defaultMaxResolution / Math.pow(zoomFactor, minZoom);\n }\n\n // user provided minResolution takes precedence\n minResolution = options.minResolution;\n if (minResolution === undefined) {\n if (options.maxZoom !== undefined) {\n if (options.maxResolution !== undefined) {\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom);\n } else {\n minResolution = defaultMaxResolution / Math.pow(zoomFactor, maxZoom);\n }\n } else {\n minResolution = defaultMinResolution;\n }\n }\n\n // given discrete zoom levels, minResolution may be different than provided\n maxZoom =\n minZoom +\n Math.floor(\n Math.log(maxResolution / minResolution) / Math.log(zoomFactor)\n );\n minResolution = maxResolution / Math.pow(zoomFactor, maxZoom - minZoom);\n\n if (options.constrainResolution) {\n resolutionConstraint = createSnapToPower(\n zoomFactor,\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n } else {\n resolutionConstraint = createMinMaxResolution(\n maxResolution,\n minResolution,\n smooth,\n !constrainOnlyCenter && extent,\n showFullExtent\n );\n }\n }\n return {\n constraint: resolutionConstraint,\n maxResolution: maxResolution,\n minResolution: minResolution,\n minZoom: minZoom,\n zoomFactor: zoomFactor,\n };\n}\n\n/**\n * @param {ViewOptions} options View options.\n * @return {import(\"./rotationconstraint.js\").Type} Rotation constraint.\n */\nexport function createRotationConstraint(options) {\n const enableRotation =\n options.enableRotation !== undefined ? options.enableRotation : true;\n if (enableRotation) {\n const constrainRotation = options.constrainRotation;\n if (constrainRotation === undefined || constrainRotation === true) {\n return createSnapToZero();\n }\n if (constrainRotation === false) {\n return rotationNone;\n }\n if (typeof constrainRotation === 'number') {\n return createSnapToN(constrainRotation);\n }\n return rotationNone;\n }\n return disable;\n}\n\n/**\n * Determine if an animation involves no view change.\n * @param {Animation} animation The animation.\n * @return {boolean} The animation involves no view change.\n */\nexport function isNoopAnimation(animation) {\n if (animation.sourceCenter && animation.targetCenter) {\n if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) {\n return false;\n }\n }\n if (animation.sourceResolution !== animation.targetResolution) {\n return false;\n }\n if (animation.sourceRotation !== animation.targetRotation) {\n return false;\n }\n return true;\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {import(\"./size.js\").Size} size Box pixel size.\n * @param {import(\"./pixel.js\").Pixel} position Position on the view to center on.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @return {import(\"./coordinate.js\").Coordinate} Shifted center.\n */\nfunction calculateCenterOn(coordinate, size, position, resolution, rotation) {\n // calculate rotated position\n const cosAngle = Math.cos(-rotation);\n let sinAngle = Math.sin(-rotation);\n let rotX = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n let rotY = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n rotX += (size[0] / 2 - position[0]) * resolution;\n rotY += (position[1] - size[1] / 2) * resolution;\n\n // go back to original angle\n sinAngle = -sinAngle; // go back to original rotation\n const centerX = rotX * cosAngle - rotY * sinAngle;\n const centerY = rotY * cosAngle + rotX * sinAngle;\n\n return [centerX, centerY];\n}\n\nexport default View;\n","/**\n * @module ol/ViewHint\n */\n\n/**\n * @enum {number}\n */\nexport default {\n ANIMATING: 0,\n INTERACTING: 1,\n};\n","/**\n * @module ol/ViewProperty\n */\n\n/**\n * @enum {string}\n */\nexport default {\n CENTER: 'center',\n RESOLUTION: 'resolution',\n ROTATION: 'rotation',\n};\n","/**\n * @module ol/array\n */\n\n/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n * https://github.com/darkskyapp/binary-search\n *\n * @param {Array<*>} haystack Items to search through.\n * @param {*} needle The item to look for.\n * @param {Function} [comparator] Comparator function.\n * @return {number} The index of the item if found, -1 if not.\n */\nexport function binarySearch(haystack, needle, comparator) {\n let mid, cmp;\n comparator = comparator || ascending;\n let low = 0;\n let high = haystack.length;\n let found = false;\n\n while (low < high) {\n /* Note that \"(low + high) >>> 1\" may overflow, and results in a typecast\n * to double (which gives the wrong results). */\n mid = low + ((high - low) >> 1);\n cmp = +comparator(haystack[mid], needle);\n\n if (cmp < 0.0) {\n /* Too low. */\n low = mid + 1;\n } else {\n /* Key found or too high */\n high = mid;\n found = !cmp;\n }\n }\n\n /* Key not found. */\n return found ? low : ~low;\n}\n\n/**\n * Compare function sorting arrays in ascending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is less than, equal to, or greater than the second.\n */\nexport function ascending(a, b) {\n return a > b ? 1 : a < b ? -1 : 0;\n}\n\n/**\n * Compare function sorting arrays in descending order. Safe to use for numeric values.\n * @param {*} a The first object to be compared.\n * @param {*} b The second object to be compared.\n * @return {number} A negative number, zero, or a positive number as the first\n * argument is greater than, equal to, or less than the second.\n */\nexport function descending(a, b) {\n return a < b ? 1 : a > b ? -1 : 0;\n}\n\n/**\n * {@link module:ol/tilegrid/TileGrid~TileGrid#getZForResolution} can use a function\n * of this type to determine which nearest resolution to use.\n *\n * This function takes a `{number}` representing a value between two array entries,\n * a `{number}` representing the value of the nearest higher entry and\n * a `{number}` representing the value of the nearest lower entry\n * as arguments and returns a `{number}`. If a negative number or zero is returned\n * the lower value will be used, if a positive number is returned the higher value\n * will be used.\n * @typedef {function(number, number, number): number} NearestDirectionFunction\n * @api\n */\n\n/**\n * @param {Array} arr Array in descending order.\n * @param {number} target Target.\n * @param {number|NearestDirectionFunction} direction\n * 0 means return the nearest,\n * > 0 means return the largest nearest,\n * < 0 means return the smallest nearest.\n * @return {number} Index.\n */\nexport function linearFindNearest(arr, target, direction) {\n if (arr[0] <= target) {\n return 0;\n }\n\n const n = arr.length;\n if (target <= arr[n - 1]) {\n return n - 1;\n }\n\n if (typeof direction === 'function') {\n for (let i = 1; i < n; ++i) {\n const candidate = arr[i];\n if (candidate === target) {\n return i;\n }\n if (candidate < target) {\n if (direction(target, arr[i - 1], candidate) > 0) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n }\n\n if (direction > 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] < target) {\n return i - 1;\n }\n }\n return n - 1;\n }\n\n if (direction < 0) {\n for (let i = 1; i < n; ++i) {\n if (arr[i] <= target) {\n return i;\n }\n }\n return n - 1;\n }\n\n for (let i = 1; i < n; ++i) {\n if (arr[i] == target) {\n return i;\n }\n if (arr[i] < target) {\n if (arr[i - 1] - target < target - arr[i]) {\n return i - 1;\n }\n return i;\n }\n }\n return n - 1;\n}\n\n/**\n * @param {Array<*>} arr Array.\n * @param {number} begin Begin index.\n * @param {number} end End index.\n */\nexport function reverseSubArray(arr, begin, end) {\n while (begin < end) {\n const tmp = arr[begin];\n arr[begin] = arr[end];\n arr[end] = tmp;\n ++begin;\n --end;\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {!Array|VALUE} data The elements or arrays of elements to add to arr.\n * @template VALUE\n */\nexport function extend(arr, data) {\n const extension = Array.isArray(data) ? data : [data];\n const length = extension.length;\n for (let i = 0; i < length; i++) {\n arr[arr.length] = extension[i];\n }\n}\n\n/**\n * @param {Array} arr The array to modify.\n * @param {VALUE} obj The element to remove.\n * @template VALUE\n * @return {boolean} If the element was removed.\n */\nexport function remove(arr, obj) {\n const i = arr.indexOf(obj);\n const found = i > -1;\n if (found) {\n arr.splice(i, 1);\n }\n return found;\n}\n\n/**\n * @param {Array|Uint8ClampedArray} arr1 The first array to compare.\n * @param {Array|Uint8ClampedArray} arr2 The second array to compare.\n * @return {boolean} Whether the two arrays are equal.\n */\nexport function equals(arr1, arr2) {\n const len1 = arr1.length;\n if (len1 !== arr2.length) {\n return false;\n }\n for (let i = 0; i < len1; i++) {\n if (arr1[i] !== arr2[i]) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Sort the passed array such that the relative order of equal elements is preserved.\n * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.\n * @param {Array<*>} arr The array to sort (modifies original).\n * @param {!function(*, *): number} compareFnc Comparison function.\n * @api\n */\nexport function stableSort(arr, compareFnc) {\n const length = arr.length;\n const tmp = Array(arr.length);\n let i;\n for (i = 0; i < length; i++) {\n tmp[i] = {index: i, value: arr[i]};\n }\n tmp.sort(function (a, b) {\n return compareFnc(a.value, b.value) || a.index - b.index;\n });\n for (i = 0; i < arr.length; i++) {\n arr[i] = tmp[i].value;\n }\n}\n\n/**\n * @param {Array<*>} arr The array to test.\n * @param {Function} [func] Comparison function.\n * @param {boolean} [strict] Strictly sorted (default false).\n * @return {boolean} Return index.\n */\nexport function isSorted(arr, func, strict) {\n const compare = func || ascending;\n return arr.every(function (currentVal, index) {\n if (index === 0) {\n return true;\n }\n const res = compare(arr[index - 1], currentVal);\n return !(res > 0 || (strict && res === 0));\n });\n}\n","/**\n * @module ol/asserts\n */\n\n/**\n * @param {*} assertion Assertion we expected to be truthy.\n * @param {string} errorMessage Error message.\n */\nexport function assert(assertion, errorMessage) {\n if (!assertion) {\n throw new Error(errorMessage);\n }\n}\n","/**\n * RGB space.\n *\n * @module color-space/rgb\n */\n\nexport default {\n\tname: 'rgb',\n\tmin: [0,0,0],\n\tmax: [255,255,255],\n\tchannel: ['red', 'green', 'blue'],\n\talias: ['RGB']\n};\n","/**\n * CIE XYZ\n *\n * @module color-space/xyz\n */\nimport rgb from './rgb.js';\n\nvar xyz = {\n\tname: 'xyz',\n\tmin: [0,0,0],\n\tchannel: ['X','Y','Z'],\n\talias: ['XYZ', 'ciexyz', 'cie1931']\n};\n\n\n/**\n * Whitepoint reference values with observer/illuminant\n *\n * http://en.wikipedia.org/wiki/Standard_illuminant\n */\nxyz.whitepoint = {\n\t//1931 2°\n\t2: {\n\t\t//incadescent\n\t\tA:[109.85, 100, 35.585],\n\t\t// B:[],\n\t\tC: [98.074, 100, 118.232],\n\t\tD50: [96.422, 100, 82.521],\n\t\tD55: [95.682, 100, 92.149],\n\t\t//daylight\n\t\tD65: [95.045592705167, 100, 108.9057750759878],\n\t\tD75: [94.972, 100, 122.638],\n\t\t//flourescent\n\t\t// F1: [],\n\t\tF2: [99.187, 100, 67.395],\n\t\t// F3: [],\n\t\t// F4: [],\n\t\t// F5: [],\n\t\t// F6:[],\n\t\tF7: [95.044, 100, 108.755],\n\t\t// F8: [],\n\t\t// F9: [],\n\t\t// F10: [],\n\t\tF11: [100.966, 100, 64.370],\n\t\t// F12: [],\n\t\tE: [100,100,100]\n\t},\n\n\t//1964 10°\n\t10: {\n\t\t//incadescent\n\t\tA:[111.144, 100, 35.200],\n\t\tC: [97.285, 100, 116.145],\n\t\tD50: [96.720, 100, 81.427],\n\t\tD55: [95.799, 100, 90.926],\n\t\t//daylight\n\t\tD65: [94.811, 100, 107.304],\n\t\tD75: [94.416, 100, 120.641],\n\t\t//flourescent\n\t\tF2: [103.280, 100, 69.026],\n\t\tF7: [95.792, 100, 107.687],\n\t\tF11: [103.866, 100, 65.627],\n\t\tE: [100,100,100]\n\t}\n};\n\n\n/**\n * Top values are the whitepoint’s top values, default are D65\n */\nxyz.max = xyz.whitepoint[2].D65;\n\n\n/**\n * Transform xyz to rgb\n *\n * @param {Array} xyz Array of xyz values\n *\n * @return {Array} RGB values\n */\nxyz.rgb = function (_xyz, white) {\n\t//FIXME: make sure we have to divide like this. Probably we have to replace matrix as well then\n\twhite = white || xyz.whitepoint[2].E;\n\n\tvar x = _xyz[0] / white[0],\n\t\ty = _xyz[1] / white[1],\n\t\tz = _xyz[2] / white[2],\n\t\tr, g, b;\n\n\t// assume sRGB\n\t// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html\n\tr = (x * 3.240969941904521) + (y * -1.537383177570093) + (z * -0.498610760293);\n\tg = (x * -0.96924363628087) + (y * 1.87596750150772) + (z * 0.041555057407175);\n\tb = (x * 0.055630079696993) + (y * -0.20397695888897) + (z * 1.056971514242878);\n\n\tr = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n\t\t: r = (r * 12.92);\n\n\tg = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n\t\t: g = (g * 12.92);\n\n\tb = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n\t\t: b = (b * 12.92);\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n}\n\n\n\n/**\n * RGB to XYZ\n *\n * @param {Array} rgb RGB channels\n *\n * @return {Array} XYZ channels\n */\nrgb.xyz = function(rgb, white) {\n\tvar r = rgb[0] / 255,\n\t\t\tg = rgb[1] / 255,\n\t\t\tb = rgb[2] / 255;\n\n\t// assume sRGB\n\tr = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tvar x = (r * 0.41239079926595) + (g * 0.35758433938387) + (b * 0.18048078840183);\n\tvar y = (r * 0.21263900587151) + (g * 0.71516867876775) + (b * 0.072192315360733);\n\tvar z = (r * 0.019330818715591) + (g * 0.11919477979462) + (b * 0.95053215224966);\n\n\twhite = white || xyz.whitepoint[2].E;\n\n\treturn [x * white[0], y * white[1], z * white[2]];\n};\n\n\n\nexport default xyz;\n","/**\n * CIE LUV (C'est la vie)\n *\n * @module color-space/luv\n */\n import xyz from './xyz.js';\n\nexport default {\n\tname: 'luv',\n\t//NOTE: luv has no rigidly defined limits\n\t//easyrgb fails to get proper coords\n\t//boronine states no rigid limits\n\t//colorMine refers this ones:\n\tmin: [0,-134,-140],\n\tmax: [100,224,122],\n\tchannel: ['lightness', 'u', 'v'],\n\talias: ['LUV', 'cieluv', 'cie1976'],\n\n\txyz: function(arg, i, o){\n\t\tvar _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;\n\t\tl = arg[0], u = arg[1], v = arg[2];\n\n\t\tif (l === 0) return [0,0,0];\n\n\t\t//get constants\n\t\t//var e = 0.008856451679035631; //(6/29)^3\n\t\tvar k = 0.0011070564598794539; //(3/29)^3\n\n\t\t//get illuminant/observer\n\t\ti = i || 'D65';\n\t\to = o || 2;\n\n\t\txn = xyz.whitepoint[o][i][0];\n\t\tyn = xyz.whitepoint[o][i][1];\n\t\tzn = xyz.whitepoint[o][i][2];\n\n\t\tun = (4 * xn) / (xn + (15 * yn) + (3 * zn));\n\t\tvn = (9 * yn) / (xn + (15 * yn) + (3 * zn));\n\t\t// un = 0.19783000664283;\n\t\t// vn = 0.46831999493879;\n\n\n\t\t_u = u / (13 * l) + un || 0;\n\t\t_v = v / (13 * l) + vn || 0;\n\n\t\ty = l > 8 ? yn * Math.pow( (l + 16) / 116 , 3) : yn * l * k;\n\n\t\t//wikipedia method\n\t\tx = y * 9 * _u / (4 * _v) || 0;\n\t\tz = y * (12 - 3 * _u - 20 * _v) / (4 * _v) || 0;\n\n\t\t//boronine method\n\t\t//https://github.com/boronine/husl/blob/master/husl.coffee#L201\n\t\t// x = 0 - (9 * y * _u) / ((_u - 4) * _v - _u * _v);\n\t\t// z = (9 * y - (15 * _v * y) - (_v * x)) / (3 * _v);\n\n\t\treturn [x, y, z];\n\t}\n};\n\n// http://www.brucelindbloom.com/index.html?Equations.html\n// https://github.com/boronine/husl/blob/master/husl.coffee\n//i - illuminant\n//o - observer\nxyz.luv = function(arg, i, o) {\n\tvar _u, _v, l, u, v, x, y, z, xn, yn, zn, un, vn;\n\n\t//get constants\n\tvar e = 0.008856451679035631; //(6/29)^3\n\tvar k = 903.2962962962961; //(29/3)^3\n\n\t//get illuminant/observer coords\n\ti = i || 'D65';\n\to = o || 2;\n\n\txn = xyz.whitepoint[o][i][0];\n\tyn = xyz.whitepoint[o][i][1];\n\tzn = xyz.whitepoint[o][i][2];\n\n\tun = (4 * xn) / (xn + (15 * yn) + (3 * zn));\n\tvn = (9 * yn) / (xn + (15 * yn) + (3 * zn));\n\n\n\tx = arg[0], y = arg[1], z = arg[2];\n\n\n\t_u = (4 * x) / (x + (15 * y) + (3 * z)) || 0;\n\t_v = (9 * y) / (x + (15 * y) + (3 * z)) || 0;\n\n\tvar yr = y/yn;\n\n\tl = yr <= e ? k * yr : 116 * Math.pow(yr, 1/3) - 16;\n\n\tu = 13 * l * (_u - un);\n\tv = 13 * l * (_v - vn);\n\n\treturn [l, u, v];\n};\n","/**\n * Cylindrical CIE LUV\n *\n * @module color-space/lchuv\n */\nimport luv from './luv.js';\nimport xyz from './xyz.js';\n\n//cylindrical luv\nvar lchuv = {\n\tname: 'lchuv',\n\tchannel: ['lightness', 'chroma', 'hue'],\n\talias: ['LCHuv', 'cielchuv'],\n\tmin: [0,0,0],\n\tmax: [100,100,360],\n\n\tluv: function(luv){\n\t\tvar l = luv[0],\n\t\tc = luv[1],\n\t\th = luv[2],\n\t\tu, v, hr;\n\n\t\thr = h / 360 * 2 * Math.PI;\n\t\tu = c * Math.cos(hr);\n\t\tv = c * Math.sin(hr);\n\t\treturn [l, u, v];\n\t},\n\n\txyz: function(arg) {\n\t\treturn luv.xyz(lchuv.luv(arg));\n\t}\n};\n\nexport default lchuv;\n\nluv.lchuv = function(luv){\n\tvar l = luv[0], u = luv[1], v = luv[2];\n\n\tvar c = Math.sqrt(u*u + v*v);\n\tvar hr = Math.atan2(v,u);\n\tvar h = hr * 360 / 2 / Math.PI;\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\treturn [l,c,h]\n};\n\nxyz.lchuv = function(arg){\n return luv.lchuv(xyz.luv(arg));\n};\n","/**\n * @module color-parse\n */\nimport names from 'color-name'\n\nexport default parse\n\n/**\n * Base hues\n * http://dev.w3.org/csswg/css-color/#typedef-named-hue\n */\n//FIXME: use external hue detector\nvar baseHues = {\n\tred: 0,\n\torange: 60,\n\tyellow: 120,\n\tgreen: 180,\n\tblue: 240,\n\tpurple: 300\n}\n\n/**\n * Parse color from the string passed\n *\n * @return {Object} A space indicator `space`, an array `values` and `alpha`\n */\nfunction parse(cstr) {\n\tvar m, parts = [], alpha = 1, space\n\n\t//numeric case\n\tif (typeof cstr === 'number') {\n\t\treturn { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\t}\n\tif (typeof cstr === 'number') return { space: 'rgb', values: [cstr >>> 16, (cstr & 0x00ff00) >>> 8, cstr & 0x0000ff], alpha: 1 }\n\n\tcstr = String(cstr).toLowerCase();\n\n\t//keyword\n\tif (names[cstr]) {\n\t\tparts = names[cstr].slice()\n\t\tspace = 'rgb'\n\t}\n\n\t//reserved words\n\telse if (cstr === 'transparent') {\n\t\talpha = 0\n\t\tspace = 'rgb'\n\t\tparts = [0, 0, 0]\n\t}\n\n\t//hex\n\telse if (cstr[0] === '#') {\n\t\tvar base = cstr.slice(1)\n\t\tvar size = base.length\n\t\tvar isShort = size <= 4\n\t\talpha = 1\n\n\t\tif (isShort) {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[0], 16),\n\t\t\t\tparseInt(base[1] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[2], 16)\n\t\t\t]\n\t\t\tif (size === 4) {\n\t\t\t\talpha = parseInt(base[3] + base[3], 16) / 255\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tparts = [\n\t\t\t\tparseInt(base[0] + base[1], 16),\n\t\t\t\tparseInt(base[2] + base[3], 16),\n\t\t\t\tparseInt(base[4] + base[5], 16)\n\t\t\t]\n\t\t\tif (size === 8) {\n\t\t\t\talpha = parseInt(base[6] + base[7], 16) / 255\n\t\t\t}\n\t\t}\n\n\t\tif (!parts[0]) parts[0] = 0\n\t\tif (!parts[1]) parts[1] = 0\n\t\tif (!parts[2]) parts[2] = 0\n\n\t\tspace = 'rgb'\n\t}\n\n\t// color space\n\telse if (m = /^((?:rgba?|hs[lvb]a?|hwba?|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms|oklch|oklab|color))\\s*\\(([^\\)]*)\\)/.exec(cstr)) {\n\t\tvar name = m[1]\n\t\tspace = name.replace(/a$/, '')\n\t\tvar dims = space === 'cmyk' ? 4 : space === 'gray' ? 1 : 3\n\t\tparts = m[2].trim().split(/\\s*[,\\/]\\s*|\\s+/)\n\n\t\t// color(srgb-linear x x x) -> srgb-linear(x x x)\n\t\tif (space === 'color') space = parts.shift()\n\n\t\tparts = parts.map(function (x, i) {\n\t\t\t//\n\t\t\tif (x[x.length - 1] === '%') {\n\t\t\t\tx = parseFloat(x) / 100\n\t\t\t\t// alpha -> 0..1\n\t\t\t\tif (i === 3) return x\n\t\t\t\t// rgb -> 0..255\n\t\t\t\tif (space === 'rgb') return x * 255\n\t\t\t\t// hsl, hwb H -> 0..100\n\t\t\t\tif (space[0] === 'h') return x * 100\n\t\t\t\t// lch, lab L -> 0..100\n\t\t\t\tif (space[0] === 'l' && !i) return x * 100\n\t\t\t\t// lab A B -> -125..125\n\t\t\t\tif (space === 'lab') return x * 125\n\t\t\t\t// lch C -> 0..150, H -> 0..360\n\t\t\t\tif (space === 'lch') return i < 2 ? x * 150 : x * 360\n\t\t\t\t// oklch/oklab L -> 0..1\n\t\t\t\tif (space[0] === 'o' && !i) return x\n\t\t\t\t// oklab A B -> -0.4..0.4\n\t\t\t\tif (space === 'oklab') return x * 0.4\n\t\t\t\t// oklch C -> 0..0.4, H -> 0..360\n\t\t\t\tif (space === 'oklch') return i < 2 ? x * 0.4 : x * 360\n\t\t\t\t// color(xxx) -> 0..1\n\t\t\t\treturn x\n\t\t\t}\n\n\t\t\t//hue\n\t\t\tif (space[i] === 'h' || (i === 2 && space[space.length - 1] === 'h')) {\n\t\t\t\t//\n\t\t\t\tif (baseHues[x] !== undefined) return baseHues[x]\n\t\t\t\t//\n\t\t\t\tif (x.endsWith('deg')) return parseFloat(x)\n\t\t\t\t//\n\t\t\t\tif (x.endsWith('turn')) return parseFloat(x) * 360\n\t\t\t\tif (x.endsWith('grad')) return parseFloat(x) * 360 / 400\n\t\t\t\tif (x.endsWith('rad')) return parseFloat(x) * 180 / Math.PI\n\t\t\t}\n\t\t\tif (x === 'none') return 0\n\t\t\treturn parseFloat(x)\n\t\t});\n\n\t\talpha = parts.length > dims ? parts.pop() : 1\n\t}\n\n\t//named channels case\n\telse if (/[0-9](?:\\s|\\/|,)/.test(cstr)) {\n\t\tparts = cstr.match(/([0-9]+)/g).map(function (value) {\n\t\t\treturn parseFloat(value)\n\t\t})\n\n\t\tspace = cstr.match(/([a-z])/ig)?.join('')?.toLowerCase() || 'rgb'\n\t}\n\n\treturn {\n\t\tspace,\n\t\tvalues: parts,\n\t\talpha\n\t}\n}\n","/**\n * @module color-space/hsl\n */\nimport rgb from './rgb.js';\n\nexport default {\n\tname: 'hsl',\n\tmin: [0,0,0],\n\tmax: [360,100,100],\n\tchannel: ['hue', 'saturation', 'lightness'],\n\talias: ['HSL'],\n\n\trgb: function(hsl) {\n\t\tvar h = hsl[0]/360, s = hsl[1]/100, l = hsl[2]/100, t1, t2, t3, rgb, val, i=0;\n\n\t\tif (s === 0) return val = l * 255, [val, val, val];\n\n\t\tt2 = l < 0.5 ? l * (1 + s) : l + s - l * s;\n\t\tt1 = 2 * l - t2;\n\n\t\trgb = [0, 0, 0];\n\t\tfor (;i<3;) {\n\t\t\tt3 = h + 1 / 3 * - (i - 1);\n\t\t\tt3 < 0 ? t3++ : t3 > 1 && t3--;\n\t\t\tval = 6 * t3 < 1 ? t1 + (t2 - t1) * 6 * t3 :\n\t\t\t2 * t3 < 1 ? t2 :\n\t\t\t3 * t3 < 2 ? t1 + (t2 - t1) * (2 / 3 - t3) * 6 :\n\t\t\tt1;\n\t\t\trgb[i++] = val * 255;\n\t\t}\n\n\t\treturn rgb;\n\t}\n};\n\n\n//extend rgb\nrgb.hsl = function(rgb) {\n\tvar r = rgb[0]/255,\n\t\t\tg = rgb[1]/255,\n\t\t\tb = rgb[2]/255,\n\t\t\tmin = Math.min(r, g, b),\n\t\t\tmax = Math.max(r, g, b),\n\t\t\tdelta = max - min,\n\t\t\th, s, l;\n\n\tif (max === min) {\n\t\th = 0;\n\t}\n\telse if (r === max) {\n\t\th = (g - b) / delta;\n\t}\n\telse if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t}\n\telse if (b === max) {\n\t\th = 4 + (r - g)/ delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tl = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t}\n\telse if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t}\n\telse {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n","/**\n * @module ol/color\n */\nimport lchuv from 'color-space/lchuv.js';\nimport parseRgba from 'color-rgba';\nimport rgb from 'color-space/rgb.js';\nimport xyz from 'color-space/xyz.js';\nimport {clamp} from './math.js';\n\n/**\n * A color represented as a short array [red, green, blue, alpha].\n * red, green, and blue should be integers in the range 0..255 inclusive.\n * alpha should be a float in the range 0..1 inclusive. If no alpha value is\n * given then `1` will be used.\n * @typedef {Array} Color\n * @api\n */\n\n/**\n * Return the color as an rgba string.\n * @param {Color|string} color Color.\n * @return {string} Rgba string.\n * @api\n */\nexport function asString(color) {\n if (typeof color === 'string') {\n return color;\n }\n return toString(color);\n}\n\n/**\n * @type {number}\n */\nconst MAX_CACHE_SIZE = 1024;\n\n/**\n * We maintain a small cache of parsed strings. Whenever the cache grows too large,\n * we delete an arbitrary set of the entries.\n *\n * @type {Object}\n */\nconst cache = {};\n\n/**\n * @type {number}\n */\nlet cacheSize = 0;\n\n/**\n * @param {Color} color A color that may or may not have an alpha channel.\n * @return {Color} The input color with an alpha channel. If the input color has\n * an alpha channel, the input color will be returned unchanged. Otherwise, a new\n * array will be returned with the input color and an alpha channel of 1.\n */\nexport function withAlpha(color) {\n if (color.length === 4) {\n return color;\n }\n const output = color.slice();\n output[3] = 1;\n return output;\n}\n\n/**\n * @param {Color} color RGBA color.\n * @return {Color} LCHuv color with alpha.\n */\nexport function rgbaToLcha(color) {\n const output = xyz.lchuv(rgb.xyz(color));\n output[3] = color[3];\n return output;\n}\n\n/**\n * @param {Color} color LCHuv color with alpha.\n * @return {Color} RGBA color.\n */\nexport function lchaToRgba(color) {\n const output = xyz.rgb(lchuv.xyz(color));\n output[3] = color[3];\n return output;\n}\n\n/**\n * @param {string} s String.\n * @return {Color} Color.\n */\nexport function fromString(s) {\n if (cache.hasOwnProperty(s)) {\n return cache[s];\n }\n if (cacheSize >= MAX_CACHE_SIZE) {\n let i = 0;\n for (const key in cache) {\n if ((i++ & 3) === 0) {\n delete cache[key];\n --cacheSize;\n }\n }\n }\n\n const color = parseRgba(s);\n if (color.length !== 4) {\n throw new Error('Failed to parse \"' + s + '\" as color');\n }\n for (const c of color) {\n if (isNaN(c)) {\n throw new Error('Failed to parse \"' + s + '\" as color');\n }\n }\n normalize(color);\n cache[s] = color;\n ++cacheSize;\n return color;\n}\n\n/**\n * Return the color as an array. This function maintains a cache of calculated\n * arrays which means the result should not be modified.\n * @param {Color|string} color Color.\n * @return {Color} Color.\n * @api\n */\nexport function asArray(color) {\n if (Array.isArray(color)) {\n return color;\n }\n return fromString(color);\n}\n\n/**\n * Exported for the tests.\n * @param {Color} color Color.\n * @return {Color} Clamped color.\n */\nexport function normalize(color) {\n color[0] = clamp((color[0] + 0.5) | 0, 0, 255);\n color[1] = clamp((color[1] + 0.5) | 0, 0, 255);\n color[2] = clamp((color[2] + 0.5) | 0, 0, 255);\n color[3] = clamp(color[3], 0, 1);\n return color;\n}\n\n/**\n * @param {Color} color Color.\n * @return {string} String.\n */\nexport function toString(color) {\n let r = color[0];\n if (r != (r | 0)) {\n r = (r + 0.5) | 0;\n }\n let g = color[1];\n if (g != (g | 0)) {\n g = (g + 0.5) | 0;\n }\n let b = color[2];\n if (b != (b | 0)) {\n b = (b + 0.5) | 0;\n }\n const a = color[3] === undefined ? 1 : Math.round(color[3] * 1000) / 1000;\n return 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';\n}\n\n/**\n * @param {string} s String.\n * @return {boolean} Whether the string is actually a valid color\n */\nexport function isStringColor(s) {\n try {\n fromString(s);\n return true;\n } catch (_) {\n return false;\n }\n}\n","/** @module color-rgba */\nimport parse from 'color-parse'\nimport rgb from 'color-space/rgb.js'\nimport hsl from 'color-space/hsl.js'\n\nexport default function rgba(color) {\n\t// template literals\n\tif (Array.isArray(color) && color.raw) color = String.raw(...arguments)\n\tif (color instanceof Number) color = +color\n\n\tvar values, i, l\n\n\t//attempt to parse non-array arguments\n\tvar parsed = parse(color)\n\n\tif (!parsed.space) return []\n\n\tconst min = parsed.space[0] === 'h' ? hsl.min : rgb.min\n\tconst max = parsed.space[0] === 'h' ? hsl.max : rgb.max\n\n\tvalues = Array(3)\n\tvalues[0] = Math.min(Math.max(parsed.values[0], min[0]), max[0])\n\tvalues[1] = Math.min(Math.max(parsed.values[1], min[1]), max[1])\n\tvalues[2] = Math.min(Math.max(parsed.values[2], min[2]), max[2])\n\n\tif (parsed.space[0] === 'h') {\n\t\tvalues = hsl.rgb(values)\n\t}\n\n\tvalues.push(Math.min(Math.max(parsed.alpha, 0), 1))\n\n\treturn values\n}\n","/**\n * @module ol/colorlike\n */\nimport ImageState from './ImageState.js';\nimport {createCanvasContext2D} from './dom.js';\nimport {get as getIconImage} from './style/IconImage.js';\nimport {shared as iconCache} from './style/IconImageCache.js';\nimport {toString} from './color.js';\n\n/**\n * @typedef {Object} PatternDescriptor\n * @property {string} src Pattern image URL\n * @property {import(\"./color.js\").Color|string} [color] Color to tint the pattern with.\n * @property {import(\"./size.js\").Size} [size] Size of the desired slice from the pattern image.\n * Use this together with `offset` when the pattern image is a sprite sheet.\n * @property {import(\"./size.js\").Size} [offset] Offset of the desired slice from the pattern image.\n * Use this together with `size` when the pattern image is a sprite sheet.\n */\n\n/**\n * A type accepted by CanvasRenderingContext2D.fillStyle\n * or CanvasRenderingContext2D.strokeStyle.\n * Represents a color, [CanvasPattern](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern),\n * or [CanvasGradient](https://developer.mozilla.org/en-US/docs/Web/API/CanvasGradient). The origin for\n * patterns and gradients as fill style is an increment of 512 css pixels from map coordinate\n * `[0, 0]`. For seamless repeat patterns, width and height of the pattern image\n * must be a factor of two (2, 4, 8, ..., 512).\n *\n * @typedef {string|CanvasPattern|CanvasGradient} ColorLike\n * @api\n */\n\n/**\n * @param {import(\"./color.js\").Color|ColorLike|PatternDescriptor|null} color Color.\n * @return {ColorLike|null} The color as an {@link ol/colorlike~ColorLike}.\n * @api\n */\nexport function asColorLike(color) {\n if (!color) {\n return null;\n }\n if (Array.isArray(color)) {\n return toString(color);\n }\n if (typeof color === 'object' && 'src' in color) {\n return asCanvasPattern(color);\n }\n return color;\n}\n\n/**\n * @param {PatternDescriptor} pattern Pattern descriptor.\n * @return {CanvasPattern|null} Canvas pattern or null if the pattern referenced in the\n * PatternDescriptor was not found in the icon image cache.\n */\nfunction asCanvasPattern(pattern) {\n if (!pattern.offset || !pattern.size) {\n return iconCache.getPattern(pattern.src, 'anonymous', pattern.color);\n }\n\n const cacheKey = pattern.src + ':' + pattern.offset;\n\n const canvasPattern = iconCache.getPattern(\n cacheKey,\n undefined,\n pattern.color\n );\n if (canvasPattern) {\n return canvasPattern;\n }\n\n const iconImage = iconCache.get(pattern.src, 'anonymous', null);\n if (iconImage.getImageState() !== ImageState.LOADED) {\n return null;\n }\n const patternCanvasContext = createCanvasContext2D(\n pattern.size[0],\n pattern.size[1]\n );\n patternCanvasContext.drawImage(\n iconImage.getImage(1),\n pattern.offset[0],\n pattern.offset[1],\n pattern.size[0],\n pattern.size[1],\n 0,\n 0,\n pattern.size[0],\n pattern.size[1]\n );\n getIconImage(\n patternCanvasContext.canvas,\n cacheKey,\n undefined,\n ImageState.LOADED,\n pattern.color,\n true\n );\n return iconCache.getPattern(cacheKey, undefined, pattern.color);\n}\n","/**\n * @module ol/console\n */\n\n/**\n * @typedef {'info'|'warn'|'error'|'none'} Level\n */\n\n/**\n * @type {Object}\n */\nconst levels = {\n info: 1,\n warn: 2,\n error: 3,\n none: 4,\n};\n\n/**\n * @type {number}\n */\nlet level = levels.info;\n\n/**\n * Set the logging level. By default, the level is set to 'info' and all\n * messages will be logged. Set to 'warn' to only display warnings and errors.\n * Set to 'error' to only display errors. Set to 'none' to silence all messages.\n *\n * @param {Level} l The new level.\n */\nexport function setLevel(l) {\n level = levels[l];\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function log(...args) {\n if (level > levels.info) {\n return;\n }\n console.log(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function warn(...args) {\n if (level > levels.warn) {\n return;\n }\n console.warn(...args); // eslint-disable-line no-console\n}\n\n/**\n * @param {...any} args Arguments to log\n */\nexport function error(...args) {\n if (level > levels.error) {\n return;\n }\n console.error(...args); // eslint-disable-line no-console\n}\n","/**\n * @module ol/control/Attribution\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {equals} from '../array.js';\nimport {removeChildren, replaceNode} from '../dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-attribution'] CSS class name.\n * @property {HTMLElement|string} [target] Specify a target if you\n * want the control to be rendered outside of the map's\n * viewport.\n * @property {boolean} [collapsible] Specify if attributions can\n * be collapsed. If not specified, sources control this behavior with their\n * `attributionsCollapsible` setting.\n * @property {boolean} [collapsed=true] Specify if attributions should\n * be collapsed at startup.\n * @property {string} [tipLabel='Attributions'] Text label to use for the button tip.\n * @property {string|HTMLElement} [label='i'] Text label to use for the\n * collapsed attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [expandClassName=className + '-expand'] CSS class name for the\n * collapsed attributions button.\n * @property {string|HTMLElement} [collapseLabel='›'] Text label to use\n * for the expanded attributions button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [collapseClassName=className + '-collapse'] CSS class name for the\n * expanded attributions button.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n */\n\n/**\n * @classdesc\n * Control to show all the attributions associated with the layer sources\n * in the map. This control is one of the default controls included in maps.\n * By default it will show in the bottom right portion of the map, but this can\n * be changed by using a css selector for `.ol-attribution`.\n *\n * @api\n */\nclass Attribution extends Control {\n /**\n * @param {Options} [options] Attribution options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.ulElement_ = document.createElement('ul');\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.userCollapsed_ = this.collapsed_;\n\n /**\n * @private\n * @type {boolean}\n */\n this.overrideCollapsible_ = options.collapsible !== undefined;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n const className =\n options.className !== undefined ? options.className : 'ol-attribution';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Attributions';\n\n const expandClassName =\n options.expandClassName !== undefined\n ? options.expandClassName\n : className + '-expand';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u203A';\n\n const collapseClassName =\n options.collapseClassName !== undefined\n ? options.collapseClassName\n : className + '-collapse';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n this.collapseLabel_.className = collapseClassName;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : 'i';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n this.label_.className = expandClassName;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.toggleButton_ = document.createElement('button');\n this.toggleButton_.setAttribute('type', 'button');\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n this.toggleButton_.title = tipLabel;\n this.toggleButton_.appendChild(activeLabel);\n\n this.toggleButton_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.toggleButton_);\n element.appendChild(this.ulElement_);\n\n /**\n * A list of currently rendered resolutions.\n * @type {Array}\n * @private\n */\n this.renderedAttributions_ = [];\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = true;\n }\n\n /**\n * Collect a list of visible attributions and set the collapsible state.\n * @param {import(\"../Map.js\").FrameState} frameState Frame state.\n * @return {Array} Attributions.\n * @private\n */\n collectSourceAttributions_(frameState) {\n const visibleAttributions = Array.from(\n new Set(\n this.getMap()\n .getAllLayers()\n .flatMap((layer) => layer.getAttributions(frameState))\n )\n );\n\n const collapsible = !this.getMap()\n .getAllLayers()\n .some(\n (layer) =>\n layer.getSource() &&\n layer.getSource().getAttributionsCollapsible() === false\n );\n if (!this.overrideCollapsible_) {\n this.setCollapsible(collapsible);\n }\n return visibleAttributions;\n }\n\n /**\n * @private\n * @param {?import(\"../Map.js\").FrameState} frameState Frame state.\n */\n updateElement_(frameState) {\n if (!frameState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const attributions = this.collectSourceAttributions_(frameState);\n\n const visible = attributions.length > 0;\n if (this.renderedVisible_ != visible) {\n this.element.style.display = visible ? '' : 'none';\n this.renderedVisible_ = visible;\n }\n\n if (equals(attributions, this.renderedAttributions_)) {\n return;\n }\n\n removeChildren(this.ulElement_);\n\n // append the attributions\n for (let i = 0, ii = attributions.length; i < ii; ++i) {\n const element = document.createElement('li');\n element.innerHTML = attributions[i];\n this.ulElement_.appendChild(element);\n }\n\n this.renderedAttributions_ = attributions;\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n this.userCollapsed_ = this.collapsed_;\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n this.toggleButton_.setAttribute('aria-expanded', String(!this.collapsed_));\n }\n\n /**\n * Return `true` if the attribution is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the attribution should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (this.userCollapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the attribution according to the passed parameter. Will\n * not do anything if the attribution isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n this.userCollapsed_ = collapsed;\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Return `true` when the attribution is currently collapsed or `false`\n * otherwise.\n * @return {boolean} True if the widget is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Update the attribution element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.updateElement_(mapEvent.frameState);\n }\n}\n\nexport default Attribution;\n","/**\n * @module ol/control/Control\n */\nimport BaseObject from '../Object.js';\nimport MapEventType from '../MapEventType.js';\nimport {VOID} from '../functions.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {removeNode} from '../dom.js';\n\n/**\n * @typedef {Object} Options\n * @property {HTMLElement} [element] The element is the control's\n * container element. This only needs to be specified if you're developing\n * a custom control.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when\n * the control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want\n * the control to be rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control is a visible widget with a DOM element in a fixed position on the\n * screen. They can involve user input (buttons), or be informational only;\n * the position is determined using CSS. By default these are placed in the\n * container with CSS class name `ol-overlaycontainer-stopevent`, but can use\n * any outside DOM element.\n *\n * This is the base class for controls. You can use it for simple custom\n * controls by creating the element with listeners, creating an instance:\n * ```js\n * const myControl = new Control({element: myElement});\n * ```\n * and then adding this to the map.\n *\n * The main advantage of having this as a control rather than a simple separate\n * DOM element is that preventing propagation is handled for you. Controls\n * will also be objects in a {@link module:ol/Collection~Collection}, so you can use their methods.\n *\n * You can also extend this base for your own control class. See\n * examples/custom-controls for an example of how to do this.\n *\n * @api\n */\nclass Control extends BaseObject {\n /**\n * @param {Options} options Control options.\n */\n constructor(options) {\n super();\n\n const element = options.element;\n if (element && !options.target && !element.style.pointerEvents) {\n element.style.pointerEvents = 'auto';\n }\n\n /**\n * @protected\n * @type {HTMLElement}\n */\n this.element = element ? element : null;\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.target_ = null;\n\n /**\n * @private\n * @type {import(\"../Map.js\").default|null}\n */\n this.map_ = null;\n\n /**\n * @protected\n * @type {!Array}\n */\n this.listenerKeys = [];\n\n if (options.render) {\n this.render = options.render;\n }\n\n if (options.target) {\n this.setTarget(options.target);\n }\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n removeNode(this.element);\n super.disposeInternal();\n }\n\n /**\n * Get the map associated with this control.\n * @return {import(\"../Map.js\").default|null} Map.\n * @api\n */\n getMap() {\n return this.map_;\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n if (this.map_) {\n removeNode(this.element);\n }\n for (let i = 0, ii = this.listenerKeys.length; i < ii; ++i) {\n unlistenByKey(this.listenerKeys[i]);\n }\n this.listenerKeys.length = 0;\n this.map_ = map;\n if (map) {\n const target = this.target_\n ? this.target_\n : map.getOverlayContainerStopEvent();\n target.appendChild(this.element);\n if (this.render !== VOID) {\n this.listenerKeys.push(\n listen(map, MapEventType.POSTRENDER, this.render, this)\n );\n }\n map.render();\n }\n }\n\n /**\n * Renders the control.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @api\n */\n render(mapEvent) {}\n\n /**\n * This function is used to set a target element for the control. It has no\n * effect if it is called after the control has been added to the map (i.e.\n * after `setMap` is called on the control). If no `target` is set in the\n * options passed to the control constructor and if `setTarget` is not called\n * then the control is added to the map's overlay container.\n * @param {HTMLElement|string} target Target.\n * @api\n */\n setTarget(target) {\n this.target_ =\n typeof target === 'string' ? document.getElementById(target) : target;\n }\n}\n\nexport default Control;\n","/**\n * @module ol/control/FullScreen\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport MapProperty from '../MapProperty.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE, CLASS_UNSUPPORTED} from '../css.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {replaceNode} from '../dom.js';\n\nconst events = [\n 'fullscreenchange',\n 'webkitfullscreenchange',\n 'MSFullscreenChange',\n];\n\n/**\n * @enum {string}\n */\nconst FullScreenEventType = {\n /**\n * Triggered after the map entered fullscreen.\n * @event FullScreenEventType#enterfullscreen\n * @api\n */\n ENTERFULLSCREEN: 'enterfullscreen',\n\n /**\n * Triggered after the map leave fullscreen.\n * @event FullScreenEventType#leavefullscreen\n * @api\n */\n LEAVEFULLSCREEN: 'leavefullscreen',\n};\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} FullScreenOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-full-screen'] CSS class name.\n * @property {string|Text|HTMLElement} [label='\\u2922'] Text label to use for the button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|Text|HTMLElement} [labelActive='\\u00d7'] Text label to use for the\n * button when full-screen is active.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [activeClassName=className + '-true'] CSS class name for the button\n * when full-screen is active.\n * @property {string} [inactiveClassName=className + '-false'] CSS class name for the button\n * when full-screen is inactive.\n * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip.\n * @property {boolean} [keys=false] Full keyboard access.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {HTMLElement|string} [source] The element to be displayed\n * fullscreen. When not provided, the element containing the map viewport will\n * be displayed fullscreen.\n */\n\n/**\n * @classdesc\n * Provides a button that when clicked fills up the full screen with the map.\n * The full screen source element is by default the element containing the map viewport unless\n * overridden by providing the `source` option. In which case, the dom\n * element introduced using this parameter will be displayed in full screen.\n *\n * When in full screen mode, a close button is shown to exit full screen mode.\n * The [Fullscreen API](https://www.w3.org/TR/fullscreen/) is used to\n * toggle the map in full screen mode.\n *\n * @fires FullScreenEventType#enterfullscreen\n * @fires FullScreenEventType#leavefullscreen\n * @api\n */\nclass FullScreen extends Control {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.on;\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.once;\n\n /***\n * @type {FullScreenOnSignature}\n */\n this.un;\n\n /**\n * @private\n * @type {boolean}\n */\n this.keys_ = options.keys !== undefined ? options.keys : false;\n\n /**\n * @private\n * @type {HTMLElement|string|undefined}\n */\n this.source_ = options.source;\n\n /**\n * @type {boolean}\n * @private\n */\n this.isInFullscreen_ = false;\n\n /**\n * @private\n */\n this.boundHandleMapTargetChange_ = this.handleMapTargetChange_.bind(this);\n\n /**\n * @private\n * @type {string}\n */\n this.cssClassName_ =\n options.className !== undefined ? options.className : 'ol-full-screen';\n\n /**\n * @private\n * @type {Array}\n */\n this.documentListeners_ = [];\n\n /**\n * @private\n * @type {Array}\n */\n this.activeClassName_ =\n options.activeClassName !== undefined\n ? options.activeClassName.split(' ')\n : [this.cssClassName_ + '-true'];\n\n /**\n * @private\n * @type {Array}\n */\n this.inactiveClassName_ =\n options.inactiveClassName !== undefined\n ? options.inactiveClassName.split(' ')\n : [this.cssClassName_ + '-false'];\n\n const label = options.label !== undefined ? options.label : '\\u2922';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelNode_ =\n typeof label === 'string' ? document.createTextNode(label) : label;\n\n const labelActive =\n options.labelActive !== undefined ? options.labelActive : '\\u00d7';\n\n /**\n * @private\n * @type {Text|HTMLElement}\n */\n this.labelActiveNode_ =\n typeof labelActive === 'string'\n ? document.createTextNode(labelActive)\n : labelActive;\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Toggle full-screen';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.button_ = document.createElement('button');\n this.button_.title = tipLabel;\n this.button_.setAttribute('type', 'button');\n this.button_.appendChild(this.labelNode_);\n this.button_.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n this.setClassName_(this.button_, this.isInFullscreen_);\n\n this.element.className = `${this.cssClassName_} ${CLASS_UNSELECTABLE} ${CLASS_CONTROL}`;\n this.element.appendChild(this.button_);\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleFullScreen_();\n }\n\n /**\n * @private\n */\n handleFullScreen_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const doc = map.getOwnerDocument();\n if (!isFullScreenSupported(doc)) {\n return;\n }\n if (isFullScreen(doc)) {\n exitFullScreen(doc);\n } else {\n let element;\n if (this.source_) {\n element =\n typeof this.source_ === 'string'\n ? doc.getElementById(this.source_)\n : this.source_;\n } else {\n element = map.getTargetElement();\n }\n if (this.keys_) {\n requestFullScreenWithKeys(element);\n } else {\n requestFullScreen(element);\n }\n }\n }\n\n /**\n * @private\n */\n handleFullScreenChange_() {\n const map = this.getMap();\n if (!map) {\n return;\n }\n const wasInFullscreen = this.isInFullscreen_;\n this.isInFullscreen_ = isFullScreen(map.getOwnerDocument());\n if (wasInFullscreen !== this.isInFullscreen_) {\n this.setClassName_(this.button_, this.isInFullscreen_);\n if (this.isInFullscreen_) {\n replaceNode(this.labelActiveNode_, this.labelNode_);\n this.dispatchEvent(FullScreenEventType.ENTERFULLSCREEN);\n } else {\n replaceNode(this.labelNode_, this.labelActiveNode_);\n this.dispatchEvent(FullScreenEventType.LEAVEFULLSCREEN);\n }\n map.updateSize();\n }\n }\n\n /**\n * @param {HTMLElement} element Target element\n * @param {boolean} fullscreen True if fullscreen class name should be active\n * @private\n */\n setClassName_(element, fullscreen) {\n if (fullscreen) {\n element.classList.remove(...this.inactiveClassName_);\n element.classList.add(...this.activeClassName_);\n } else {\n element.classList.remove(...this.activeClassName_);\n element.classList.add(...this.inactiveClassName_);\n }\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (oldMap) {\n oldMap.removeChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_\n );\n }\n\n super.setMap(map);\n\n this.handleMapTargetChange_();\n if (map) {\n map.addChangeListener(\n MapProperty.TARGET,\n this.boundHandleMapTargetChange_\n );\n }\n }\n\n /**\n * @private\n */\n handleMapTargetChange_() {\n const listeners = this.documentListeners_;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n unlistenByKey(listeners[i]);\n }\n listeners.length = 0;\n\n const map = this.getMap();\n if (map) {\n const doc = map.getOwnerDocument();\n if (isFullScreenSupported(doc)) {\n this.element.classList.remove(CLASS_UNSUPPORTED);\n } else {\n this.element.classList.add(CLASS_UNSUPPORTED);\n }\n\n for (let i = 0, ii = events.length; i < ii; ++i) {\n listeners.push(\n listen(doc, events[i], this.handleFullScreenChange_, this)\n );\n }\n this.handleFullScreenChange_();\n }\n }\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Fullscreen is supported by the current platform.\n */\nfunction isFullScreenSupported(doc) {\n const body = doc.body;\n return !!(\n body['webkitRequestFullscreen'] ||\n (body.requestFullscreen && doc.fullscreenEnabled)\n );\n}\n\n/**\n * @param {Document} doc The root document to check.\n * @return {boolean} Element is currently in fullscreen.\n */\nfunction isFullScreen(doc) {\n return !!(doc['webkitIsFullScreen'] || doc.fullscreenElement);\n}\n\n/**\n * Request to fullscreen an element.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreen(element) {\n if (element.requestFullscreen) {\n element.requestFullscreen();\n } else if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n }\n}\n\n/**\n * Request to fullscreen an element with keyboard input.\n * @param {HTMLElement} element Element to request fullscreen\n */\nfunction requestFullScreenWithKeys(element) {\n if (element['webkitRequestFullscreen']) {\n element['webkitRequestFullscreen']();\n } else {\n requestFullScreen(element);\n }\n}\n\n/**\n * Exit fullscreen.\n * @param {Document} doc The document to exit fullscren from\n */\nfunction exitFullScreen(doc) {\n if (doc.exitFullscreen) {\n doc.exitFullscreen();\n } else if (doc['webkitExitFullscreen']) {\n doc['webkitExitFullscreen']();\n }\n}\n\nexport default FullScreen;\n","/**\n * @module ol/control/MousePosition\n */\n\nimport Control from './Control.js';\nimport EventType from '../pointer/EventType.js';\nimport {\n get as getProjection,\n getTransformFromProjections,\n getUserProjection,\n identityTransform,\n} from '../proj.js';\nimport {listen} from '../events.js';\nimport {wrapX} from '../coordinate.js';\n\n/**\n * @type {string}\n */\nconst PROJECTION = 'projection';\n\n/**\n * @type {string}\n */\nconst COORDINATE_FORMAT = 'coordinateFormat';\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} MousePositionOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-mouse-position'] CSS class name.\n * @property {import(\"../coordinate.js\").CoordinateFormat} [coordinateFormat] Coordinate format.\n * @property {import(\"../proj.js\").ProjectionLike} [projection] Projection. Default is the view projection.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the\n * control should be re-rendered. This is called in a `requestAnimationFrame`\n * callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the\n * control to be rendered outside of the map's viewport.\n * @property {string} [placeholder] Markup to show when the mouse position is not\n * available (e.g. when the pointer leaves the map viewport). By default, a non-breaking space is rendered\n * initially and the last position is retained when the mouse leaves the viewport.\n * When a string is provided (e.g. `'no position'` or `''` for an empty string) it is used as a\n * placeholder.\n * @property {boolean} [wrapX=true] Wrap the world horizontally on the projection's antimeridian, if it\n * is a global projection.\n */\n\n/**\n * @classdesc\n * A control to show the 2D coordinates of the mouse cursor. By default, these\n * are in the view projection, but can be in any supported projection.\n * By default the control is shown in the top right corner of the map, but this\n * can be changed by using the css selector `.ol-mouse-position`.\n *\n * On touch devices, which usually do not have a mouse cursor, the coordinates\n * of the currently touched position are shown.\n *\n * @api\n */\nclass MousePosition extends Control {\n /**\n * @param {Options} [options] Mouse position options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.className =\n options.className !== undefined ? options.className : 'ol-mouse-position';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.on;\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.once;\n\n /***\n * @type {MousePositionOnSignature}\n */\n this.un;\n\n this.addChangeListener(PROJECTION, this.handleProjectionChanged_);\n\n if (options.coordinateFormat) {\n this.setCoordinateFormat(options.coordinateFormat);\n }\n if (options.projection) {\n this.setProjection(options.projection);\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderOnMouseOut_ = options.placeholder !== undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.placeholder_ = this.renderOnMouseOut_ ? options.placeholder : ' ';\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = element.innerHTML;\n\n /**\n * @private\n * @type {?import(\"../proj/Projection.js\").default}\n */\n this.mapProjection_ = null;\n\n /**\n * @private\n * @type {?import(\"../proj.js\").TransformFunction}\n */\n this.transform_ = null;\n\n /**\n * @private\n * @type {boolean}\n */\n this.wrapX_ = options.wrapX === false ? false : true;\n }\n\n /**\n * @private\n */\n handleProjectionChanged_() {\n this.transform_ = null;\n }\n\n /**\n * Return the coordinate format type used to render the current position or\n * undefined.\n * @return {import(\"../coordinate.js\").CoordinateFormat|undefined} The format to render the current\n * position in.\n * @observable\n * @api\n */\n getCoordinateFormat() {\n return /** @type {import(\"../coordinate.js\").CoordinateFormat|undefined} */ (\n this.get(COORDINATE_FORMAT)\n );\n }\n\n /**\n * Return the projection that is used to report the mouse position.\n * @return {import(\"../proj/Projection.js\").default|undefined} The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n getProjection() {\n return /** @type {import(\"../proj/Projection.js\").default|undefined} */ (\n this.get(PROJECTION)\n );\n }\n\n /**\n * @param {MouseEvent} event Browser event.\n * @protected\n */\n handleMouseMove(event) {\n const map = this.getMap();\n this.updateHTML_(map.getEventPixel(event));\n }\n\n /**\n * @param {Event} event Browser event.\n * @protected\n */\n handleMouseOut(event) {\n this.updateHTML_(null);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n const viewport = map.getViewport();\n this.listenerKeys.push(\n listen(viewport, EventType.POINTERMOVE, this.handleMouseMove, this)\n );\n if (this.renderOnMouseOut_) {\n this.listenerKeys.push(\n listen(viewport, EventType.POINTEROUT, this.handleMouseOut, this)\n );\n }\n this.updateHTML_(null);\n }\n }\n\n /**\n * Set the coordinate format type used to render the current position.\n * @param {import(\"../coordinate.js\").CoordinateFormat} format The format to render the current\n * position in.\n * @observable\n * @api\n */\n setCoordinateFormat(format) {\n this.set(COORDINATE_FORMAT, format);\n }\n\n /**\n * Set the projection that is used to report the mouse position.\n * @param {import(\"../proj.js\").ProjectionLike} projection The projection to report mouse\n * position in.\n * @observable\n * @api\n */\n setProjection(projection) {\n this.set(PROJECTION, getProjection(projection));\n }\n\n /**\n * @param {?import(\"../pixel.js\").Pixel} pixel Pixel.\n * @private\n */\n updateHTML_(pixel) {\n let html = this.placeholder_;\n if (pixel && this.mapProjection_) {\n if (!this.transform_) {\n const projection = this.getProjection();\n if (projection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n projection\n );\n } else {\n this.transform_ = identityTransform;\n }\n }\n const map = this.getMap();\n const coordinate = map.getCoordinateFromPixelInternal(pixel);\n if (coordinate) {\n const userProjection = getUserProjection();\n if (userProjection) {\n this.transform_ = getTransformFromProjections(\n this.mapProjection_,\n userProjection\n );\n }\n this.transform_(coordinate, coordinate);\n if (this.wrapX_) {\n const projection =\n userProjection || this.getProjection() || this.mapProjection_;\n wrapX(coordinate, projection);\n }\n const coordinateFormat = this.getCoordinateFormat();\n if (coordinateFormat) {\n html = coordinateFormat(coordinate);\n } else {\n html = coordinate.toString();\n }\n }\n }\n if (!this.renderedHTML_ || html !== this.renderedHTML_) {\n this.element.innerHTML = html;\n this.renderedHTML_ = html;\n }\n }\n\n /**\n * Update the projection. Rendering of the coordinates is done in\n * `handleMouseMove` and `handleMouseUp`.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.mapProjection_ = null;\n } else {\n if (this.mapProjection_ != frameState.viewState.projection) {\n this.mapProjection_ = frameState.viewState.projection;\n this.transform_ = null;\n }\n }\n }\n}\n\nexport default MousePosition;\n","/**\n * @module ol/control/OverviewMap\n */\nimport Collection from '../Collection.js';\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport Map from '../Map.js';\nimport MapEventType from '../MapEventType.js';\nimport MapProperty from '../MapProperty.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport Overlay from '../Overlay.js';\nimport View from '../View.js';\nimport ViewProperty from '../ViewProperty.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {\n containsExtent,\n equals as equalsExtent,\n getBottomRight,\n getTopLeft,\n scaleFromCenter,\n} from '../extent.js';\nimport {listen, listenOnce} from '../events.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport {replaceNode} from '../dom.js';\n\n/**\n * Maximum width and/or height extent ratio that determines when the overview\n * map should be zoomed out.\n * @type {number}\n */\nconst MAX_RATIO = 0.75;\n\n/**\n * Minimum width and/or height extent ratio that determines when the overview\n * map should be zoomed in.\n * @type {number}\n */\nconst MIN_RATIO = 0.1;\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-overviewmap'] CSS class name.\n * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).\n * @property {string|HTMLElement} [collapseLabel='‹'] Text label to use for the\n * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {boolean} [collapsible=true] Whether the control can be collapsed or not.\n * @property {string|HTMLElement} [label='›'] Text label to use for the collapsed\n * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {Array|import(\"../Collection.js\").default} [layers]\n * Layers for the overview map.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string} [tipLabel='Overview map'] Text label to use for the button tip.\n * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,\n * a default view with the same projection as the main map will be used.\n */\n\n/**\n * Create a new control with a map acting as an overview map for another\n * defined map.\n *\n * @api\n */\nclass OverviewMap extends Control {\n /**\n * @param {Options} [options] OverviewMap options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n */\n this.boundHandleRotationChanged_ = this.handleRotationChanged_.bind(this);\n\n /**\n * @type {boolean}\n * @private\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.viewExtent_ = undefined;\n\n const className =\n options.className !== undefined ? options.className : 'ol-overviewmap';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Overview map';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u2039';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : '\\u203A';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.ovmapDiv_ = document.createElement('div');\n this.ovmapDiv_.className = 'ol-overviewmap-map';\n\n /**\n * Explicitly given view to be used instead of a view derived from the main map.\n * @type {View}\n * @private\n */\n this.view_ = options.view;\n\n const ovmap = new Map({\n view: options.view,\n controls: new Collection(),\n interactions: new Collection(),\n });\n\n /**\n * @type {Map}\n * @private\n */\n this.ovmap_ = ovmap;\n\n if (options.layers) {\n options.layers.forEach(function (layer) {\n ovmap.addLayer(layer);\n });\n }\n\n const box = document.createElement('div');\n box.className = 'ol-overviewmap-box';\n box.style.boxSizing = 'border-box';\n\n /**\n * @type {import(\"../Overlay.js\").default}\n * @private\n */\n this.boxOverlay_ = new Overlay({\n position: [0, 0],\n positioning: 'center-center',\n element: box,\n });\n this.ovmap_.addOverlay(this.boxOverlay_);\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.ovmapDiv_);\n element.appendChild(button);\n\n /* Interactive map */\n\n const scope = this;\n\n const overlay = this.boxOverlay_;\n const overlayBox = this.boxOverlay_.getElement();\n\n /* Functions definition */\n\n const computeDesiredMousePosition = function (mousePosition) {\n return {\n clientX: mousePosition.clientX,\n clientY: mousePosition.clientY,\n };\n };\n\n const move = function (event) {\n const position = /** @type {?} */ (computeDesiredMousePosition(event));\n const coordinates = ovmap.getEventCoordinateInternal(\n /** @type {MouseEvent} */ (position)\n );\n\n overlay.setPosition(coordinates);\n };\n\n const endMoving = function (event) {\n const coordinates = ovmap.getEventCoordinateInternal(event);\n\n scope.getMap().getView().setCenterInternal(coordinates);\n\n window.removeEventListener('mousemove', move);\n window.removeEventListener('mouseup', endMoving);\n };\n\n /* Binding */\n\n overlayBox.addEventListener('mousedown', function () {\n window.addEventListener('mousemove', move);\n window.addEventListener('mouseup', endMoving);\n });\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (map === oldMap) {\n return;\n }\n if (oldMap) {\n const oldView = oldMap.getView();\n if (oldView) {\n this.unbindView_(oldView);\n }\n this.ovmap_.setTarget(null);\n }\n super.setMap(map);\n\n if (map) {\n this.ovmap_.setTarget(this.ovmapDiv_);\n this.listenerKeys.push(\n listen(\n map,\n ObjectEventType.PROPERTYCHANGE,\n this.handleMapPropertyChange_,\n this\n )\n );\n\n const view = map.getView();\n if (view) {\n this.bindView_(view);\n if (view.isDef()) {\n this.ovmap_.updateSize();\n this.resetExtent_();\n }\n }\n\n if (!this.ovmap_.isRendered()) {\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n }\n\n /**\n * Handle map property changes. This only deals with changes to the map's view.\n * @param {import(\"../Object.js\").ObjectEvent} event The propertychange event.\n * @private\n */\n handleMapPropertyChange_(event) {\n if (event.key === MapProperty.VIEW) {\n const oldView = /** @type {import(\"../View.js\").default} */ (\n event.oldValue\n );\n if (oldView) {\n this.unbindView_(oldView);\n }\n const newView = this.getMap().getView();\n this.bindView_(newView);\n } else if (\n !this.ovmap_.isRendered() &&\n (event.key === MapProperty.TARGET || event.key === MapProperty.SIZE)\n ) {\n this.ovmap_.updateSize();\n }\n }\n\n /**\n * Register listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n bindView_(view) {\n if (!this.view_) {\n // Unless an explicit view definition was given, derive default from whatever main map uses.\n const newView = new View({\n projection: view.getProjection(),\n });\n this.ovmap_.setView(newView);\n }\n\n view.addChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_\n );\n // Sync once with the new view\n this.handleRotationChanged_();\n }\n\n /**\n * Unregister listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n unbindView_(view) {\n view.removeChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_\n );\n }\n\n /**\n * Handle rotation changes to the main map.\n * @private\n */\n handleRotationChanged_() {\n if (this.rotateWithView_) {\n this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());\n }\n }\n\n /**\n * Reset the overview map extent if the box size (width or\n * height) is less than the size of the overview map size times minRatio\n * or is greater than the size of the overview size times maxRatio.\n *\n * If the map extent was not reset, the box size can fits in the defined\n * ratio sizes. This method then checks if is contained inside the overview\n * map current extent. If not, recenter the overview map to the current\n * main map center location.\n * @private\n */\n validateExtent_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n if (this.viewExtent_ && equalsExtent(extent, this.viewExtent_)) {\n // repeats of the same extent may indicate constraint conflicts leading to an endless cycle\n return;\n }\n this.viewExtent_ = extent;\n\n const ovmapSize = /** @type {import(\"../size.js\").Size} */ (\n ovmap.getSize()\n );\n\n const ovview = ovmap.getView();\n const ovextent = ovview.calculateExtentInternal(ovmapSize);\n\n const topLeftPixel = ovmap.getPixelFromCoordinateInternal(\n getTopLeft(extent)\n );\n const bottomRightPixel = ovmap.getPixelFromCoordinateInternal(\n getBottomRight(extent)\n );\n\n const boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);\n const boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);\n\n const ovmapWidth = ovmapSize[0];\n const ovmapHeight = ovmapSize[1];\n\n if (\n boxWidth < ovmapWidth * MIN_RATIO ||\n boxHeight < ovmapHeight * MIN_RATIO ||\n boxWidth > ovmapWidth * MAX_RATIO ||\n boxHeight > ovmapHeight * MAX_RATIO\n ) {\n this.resetExtent_();\n } else if (!containsExtent(ovextent, extent)) {\n this.recenter_();\n }\n }\n\n /**\n * Reset the overview map extent to half calculated min and max ratio times\n * the extent of the main map.\n * @private\n */\n resetExtent_() {\n if (MAX_RATIO === 0 || MIN_RATIO === 0) {\n return;\n }\n\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n const ovview = ovmap.getView();\n\n // get how many times the current map overview could hold different\n // box sizes using the min and max ratio, pick the step in the middle used\n // to calculate the extent from the main map to set it to the overview map,\n const steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2;\n const ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);\n scaleFromCenter(extent, ratio);\n ovview.fitInternal(polygonFromExtent(extent));\n }\n\n /**\n * Set the center of the overview map to the map center without changing its\n * resolution.\n * @private\n */\n recenter_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n ovview.setCenterInternal(view.getCenterInternal());\n }\n\n /**\n * Update the box using the main map extent\n * @private\n */\n updateBox_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n const rotation = this.rotateWithView_ ? 0 : -view.getRotation();\n\n const overlay = this.boxOverlay_;\n const box = this.boxOverlay_.getElement();\n const center = view.getCenterInternal();\n const resolution = view.getResolution();\n const ovresolution = ovview.getResolution();\n const width = (mapSize[0] * resolution) / ovresolution;\n const height = (mapSize[1] * resolution) / ovresolution;\n\n // set position using center coordinates\n overlay.setPosition(center);\n\n // set box size calculated from map extent size and overview map resolution\n if (box) {\n box.style.width = width + 'px';\n box.style.height = height + 'px';\n const transform = 'rotate(' + rotation + 'rad)';\n box.style.transform = transform;\n }\n }\n\n /**\n * @private\n */\n updateBoxAfterOvmapIsRendered_() {\n if (this.ovmapPostrenderKey_) {\n return;\n }\n this.ovmapPostrenderKey_ = listenOnce(\n this.ovmap_,\n MapEventType.POSTRENDER,\n function (event) {\n delete this.ovmapPostrenderKey_;\n this.updateBox_();\n },\n this\n );\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n\n // manage overview map if it had not been rendered before and control\n // is expanded\n const ovmap = this.ovmap_;\n if (!this.collapsed_) {\n if (ovmap.isRendered()) {\n this.viewExtent_ = undefined;\n ovmap.render();\n return;\n }\n ovmap.updateSize();\n this.resetExtent_();\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n\n /**\n * Return `true` if the overview map is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the overview map should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the overview map according to the passed parameter. Will\n * not do anything if the overview map isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Determine if the overview map is collapsed.\n * @return {boolean} The overview map is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Return `true` if the overview map view can rotate, `false` otherwise.\n * @return {boolean} True if the control view can rotate.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Set whether the overview map view should rotate with the main map view.\n * @param {boolean} rotateWithView True if the control view should rotate.\n * @api\n */\n setRotateWithView(rotateWithView) {\n if (this.rotateWithView_ === rotateWithView) {\n return;\n }\n this.rotateWithView_ = rotateWithView;\n if (this.getMap().getView().getRotation() !== 0) {\n if (this.rotateWithView_) {\n this.handleRotationChanged_();\n } else {\n this.ovmap_.getView().setRotation(0);\n }\n this.viewExtent_ = undefined;\n this.validateExtent_();\n this.updateBox_();\n }\n }\n\n /**\n * Return the overview map.\n * @return {import(\"../Map.js\").default} Overview map.\n * @api\n */\n getOverviewMap() {\n return this.ovmap_;\n }\n\n /**\n * Update the overview map element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.validateExtent_();\n this.updateBox_();\n }\n}\n\nexport default OverviewMap;\n","/**\n * @module ol/control/ScaleLine\n */\nimport Control from './Control.js';\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {METERS_PER_UNIT, getPointResolution} from '../proj.js';\n\n/**\n * @type {string}\n */\nconst UNITS_PROP = 'units';\n\n/**\n * @typedef {'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'} Units\n * Units for the scale line.\n */\n\n/**\n * @const\n * @type {Array}\n */\nconst LEADING_DIGITS = [1, 2, 5];\n\n/**\n * @const\n * @type {number}\n */\nconst DEFAULT_DPI = 25.4 / 0.28;\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature &\n * import(\"../Observable\").OnSignature &\n * import(\"../Observable\").CombinedOnSignature} ScaleLineOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className] CSS class name. The default is `ol-scale-bar` when configured with\n * `bar: true`. Otherwise the default is `ol-scale-line`.\n * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {Units} [units='metric'] Units.\n * @property {boolean} [bar=false] Render scalebars instead of a line.\n * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers\n * for best results. Only applies when `bar` is `true`.\n * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies\n * when `bar` is `true`.\n * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies\n * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.\n */\n\n/**\n * @classdesc\n * A control displaying rough y-axis distances, calculated for the center of the\n * viewport. For conformal projections (e.g. EPSG:3857, the default view\n * projection in OpenLayers), the scale is valid for all directions.\n * No scale line will be shown when the y-axis distance of a pixel at the\n * viewport center cannot be calculated in the view projection.\n * By default the scale line will show in the bottom left portion of the map,\n * but this can be changed by using the css selector `.ol-scale-line`.\n * When specifying `bar` as `true`, a scalebar will be rendered instead\n * of a scaleline.\n *\n * @api\n */\nclass ScaleLine extends Control {\n /**\n * @param {Options} [options] Scale line options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.style.pointerEvents = 'none';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.on;\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.once;\n\n /***\n * @type {ScaleLineOnSignature}\n */\n this.un;\n\n const className =\n options.className !== undefined\n ? options.className\n : options.bar\n ? 'ol-scale-bar'\n : 'ol-scale-line';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.innerElement_ = document.createElement('div');\n this.innerElement_.className = className + '-inner';\n\n this.element.className = className + ' ' + CLASS_UNSELECTABLE;\n this.element.appendChild(this.innerElement_);\n\n /**\n * @private\n * @type {?import(\"../View.js\").State}\n */\n this.viewState_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.maxWidth_ = options.maxWidth;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderedWidth_ = undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = '';\n\n this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);\n\n this.setUnits(options.units || 'metric');\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBar_ = options.bar || false;\n\n /**\n * @private\n * @type {number}\n */\n this.scaleBarSteps_ = options.steps || 4;\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBarText_ = options.text || false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.dpi_ = options.dpi || undefined;\n }\n\n /**\n * Return the units to use in the scale line.\n * @return {Units} The units\n * to use in the scale line.\n * @observable\n * @api\n */\n getUnits() {\n return this.get(UNITS_PROP);\n }\n\n /**\n * @private\n */\n handleUnitsChanged_() {\n this.updateElement_();\n }\n\n /**\n * Set the units to use in the scale line.\n * @param {Units} units The units to use in the scale line.\n * @observable\n * @api\n */\n setUnits(units) {\n this.set(UNITS_PROP, units);\n }\n\n /**\n * Specify the dpi of output device such as printer.\n * @param {number|undefined} dpi The dpi of output device.\n * @api\n */\n setDpi(dpi) {\n this.dpi_ = dpi;\n }\n\n /**\n * @private\n */\n updateElement_() {\n const viewState = this.viewState_;\n\n if (!viewState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const center = viewState.center;\n const projection = viewState.projection;\n const units = this.getUnits();\n const pointResolutionUnits = units == 'degrees' ? 'degrees' : 'm';\n let pointResolution = getPointResolution(\n projection,\n viewState.resolution,\n center,\n pointResolutionUnits\n );\n\n const minWidth =\n (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;\n\n const maxWidth =\n this.maxWidth_ !== undefined\n ? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI\n : undefined;\n\n let nominalCount = minWidth * pointResolution;\n let suffix = '';\n if (units == 'degrees') {\n const metersPerDegree = METERS_PER_UNIT.degrees;\n nominalCount *= metersPerDegree;\n if (nominalCount < metersPerDegree / 60) {\n suffix = '\\u2033'; // seconds\n pointResolution *= 3600;\n } else if (nominalCount < metersPerDegree) {\n suffix = '\\u2032'; // minutes\n pointResolution *= 60;\n } else {\n suffix = '\\u00b0'; // degrees\n }\n } else if (units == 'imperial') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution /= 0.0254;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.3048;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.344;\n }\n } else if (units == 'nautical') {\n pointResolution /= 1852;\n suffix = 'NM';\n } else if (units == 'metric') {\n if (nominalCount < 0.001) {\n suffix = 'μm';\n pointResolution *= 1000000;\n } else if (nominalCount < 1) {\n suffix = 'mm';\n pointResolution *= 1000;\n } else if (nominalCount < 1000) {\n suffix = 'm';\n } else {\n suffix = 'km';\n pointResolution /= 1000;\n }\n } else if (units == 'us') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution *= 39.37;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.30480061;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.3472;\n }\n } else {\n throw new Error('Invalid units');\n }\n\n let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));\n let count, width, decimalCount;\n let previousCount, previousWidth, previousDecimalCount;\n while (true) {\n decimalCount = Math.floor(i / 3);\n const decimal = Math.pow(10, decimalCount);\n count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;\n width = Math.round(count / pointResolution);\n if (isNaN(width)) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n return;\n }\n if (maxWidth !== undefined && width >= maxWidth) {\n count = previousCount;\n width = previousWidth;\n decimalCount = previousDecimalCount;\n break;\n } else if (width >= minWidth) {\n break;\n }\n previousCount = count;\n previousWidth = width;\n previousDecimalCount = decimalCount;\n ++i;\n }\n const html = this.scaleBar_\n ? this.createScaleBar(width, count, suffix)\n : count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;\n\n if (this.renderedHTML_ != html) {\n this.innerElement_.innerHTML = html;\n this.renderedHTML_ = html;\n }\n\n if (this.renderedWidth_ != width) {\n this.innerElement_.style.width = width + 'px';\n this.renderedWidth_ = width;\n }\n\n if (!this.renderedVisible_) {\n this.element.style.display = '';\n this.renderedVisible_ = true;\n }\n }\n\n /**\n * @private\n * @param {number} width The current width of the scalebar.\n * @param {number} scale The current scale.\n * @param {string} suffix The suffix to append to the scale text.\n * @return {string} The stringified HTML of the scalebar.\n */\n createScaleBar(width, scale, suffix) {\n const resolutionScale = this.getScaleForResolution();\n const mapScale =\n resolutionScale < 1\n ? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'\n : '1 : ' + Math.round(resolutionScale).toLocaleString();\n const steps = this.scaleBarSteps_;\n const stepWidth = width / steps;\n const scaleSteps = [this.createMarker('absolute')];\n for (let i = 0; i < steps; ++i) {\n const cls =\n i % 2 === 0 ? 'ol-scale-singlebar-odd' : 'ol-scale-singlebar-even';\n scaleSteps.push(\n '
' +\n '
' +\n '
' +\n this.createMarker('relative') +\n // render text every second step, except when only 2 steps\n (i % 2 === 0 || steps === 2\n ? this.createStepText(i, width, false, scale, suffix)\n : '') +\n '
'\n );\n }\n // render text at the end\n scaleSteps.push(this.createStepText(steps, width, true, scale, suffix));\n\n const scaleBarText = this.scaleBarText_\n ? `
` +\n mapScale +\n '
'\n : '';\n return scaleBarText + scaleSteps.join('');\n }\n\n /**\n * Creates a marker at given position\n * @param {'absolute'|'relative'} position The position, absolute or relative\n * @return {string} The stringified div containing the marker\n */\n createMarker(position) {\n const top = position === 'absolute' ? 3 : -10;\n return (\n '
'\n );\n }\n\n /**\n * Creates the label for a marker marker at given position\n * @param {number} i The iterator\n * @param {number} width The width the scalebar will currently use\n * @param {boolean} isLast Flag indicating if we add the last step text\n * @param {number} scale The current scale for the whole scalebar\n * @param {string} suffix The suffix for the scale\n * @return {string} The stringified div containing the step text\n */\n createStepText(i, width, isLast, scale, suffix) {\n const length =\n i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;\n const lengthString = length + (i === 0 ? '' : ' ' + suffix);\n const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;\n const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;\n return (\n '
' +\n lengthString +\n '
'\n );\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units.\n * @return {number} The appropriate scale.\n */\n getScaleForResolution() {\n const resolution = getPointResolution(\n this.viewState_.projection,\n this.viewState_.resolution,\n this.viewState_.center,\n 'm'\n );\n const dpi = this.dpi_ || DEFAULT_DPI;\n const inchesPerMeter = 1000 / 25.4;\n return resolution * inchesPerMeter * dpi;\n }\n\n /**\n * Update the scale line element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.viewState_ = null;\n } else {\n this.viewState_ = frameState.viewState;\n }\n this.updateElement_();\n }\n}\n\nexport default ScaleLine;\n","/**\n * @module ol/control/ZoomSlider\n */\n\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport PointerEventType from '../pointer/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {clamp} from '../math.js';\nimport {easeOut} from '../easing.js';\nimport {listen, unlistenByKey} from '../events.js';\nimport {stopPropagation} from '../events/Event.js';\n\n/**\n * The enum for available directions.\n *\n * @enum {number}\n */\nconst Direction = {\n VERTICAL: 0,\n HORIZONTAL: 1,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-zoomslider'] CSS class name.\n * @property {number} [duration=200] Animation duration in milliseconds.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A slider type of control for zooming.\n *\n * Example:\n *\n * map.addControl(new ZoomSlider());\n *\n * @api\n */\nclass ZoomSlider extends Control {\n /**\n * @param {Options} [options] Zoom slider options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n target: options.target,\n element: document.createElement('div'),\n render: options.render,\n });\n\n /**\n * @type {!Array}\n * @private\n */\n this.dragListenerKeys_ = [];\n\n /**\n * Will hold the current resolution of the view.\n *\n * @type {number|undefined}\n * @private\n */\n this.currentResolution_ = undefined;\n\n /**\n * The direction of the slider. Will be determined from actual display of the\n * container and defaults to Direction.VERTICAL.\n *\n * @type {Direction}\n * @private\n */\n this.direction_ = Direction.VERTICAL;\n\n /**\n * @type {boolean}\n * @private\n */\n this.dragging_;\n\n /**\n * @type {number}\n * @private\n */\n this.heightLimit_ = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.widthLimit_ = 0;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startX_;\n\n /**\n * @type {number|undefined}\n * @private\n */\n this.startY_;\n\n /**\n * The calculated thumb size (border box plus margins). Set when initSlider_\n * is called.\n * @type {import(\"../size.js\").Size}\n * @private\n */\n this.thumbSize_ = null;\n\n /**\n * Whether the slider is initialized.\n * @type {boolean}\n * @private\n */\n this.sliderInitialized_ = false;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 200;\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoomslider';\n const thumbElement = document.createElement('button');\n thumbElement.setAttribute('type', 'button');\n thumbElement.className = className + '-thumb ' + CLASS_UNSELECTABLE;\n const containerElement = this.element;\n containerElement.className =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n containerElement.appendChild(thumbElement);\n\n containerElement.addEventListener(\n PointerEventType.POINTERDOWN,\n this.handleDraggerStart_.bind(this),\n false\n );\n containerElement.addEventListener(\n PointerEventType.POINTERMOVE,\n this.handleDraggerDrag_.bind(this),\n false\n );\n containerElement.addEventListener(\n PointerEventType.POINTERUP,\n this.handleDraggerEnd_.bind(this),\n false\n );\n\n containerElement.addEventListener(\n EventType.CLICK,\n this.handleContainerClick_.bind(this),\n false\n );\n thumbElement.addEventListener(EventType.CLICK, stopPropagation, false);\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n */\n setMap(map) {\n super.setMap(map);\n if (map) {\n map.render();\n }\n }\n\n /**\n * Initializes the slider element. This will determine and set this controls\n * direction_ and also constrain the dragging of the thumb to always be within\n * the bounds of the container.\n *\n * @return {boolean} Initialization successful\n * @private\n */\n initSlider_() {\n const container = this.element;\n let containerWidth = container.offsetWidth;\n let containerHeight = container.offsetHeight;\n if (containerWidth === 0 && containerHeight === 0) {\n return (this.sliderInitialized_ = false);\n }\n\n const containerStyle = getComputedStyle(container);\n containerWidth -=\n parseFloat(containerStyle['paddingRight']) +\n parseFloat(containerStyle['paddingLeft']);\n containerHeight -=\n parseFloat(containerStyle['paddingTop']) +\n parseFloat(containerStyle['paddingBottom']);\n const thumb = /** @type {HTMLElement} */ (container.firstElementChild);\n const thumbStyle = getComputedStyle(thumb);\n const thumbWidth =\n thumb.offsetWidth +\n parseFloat(thumbStyle['marginRight']) +\n parseFloat(thumbStyle['marginLeft']);\n const thumbHeight =\n thumb.offsetHeight +\n parseFloat(thumbStyle['marginTop']) +\n parseFloat(thumbStyle['marginBottom']);\n this.thumbSize_ = [thumbWidth, thumbHeight];\n\n if (containerWidth > containerHeight) {\n this.direction_ = Direction.HORIZONTAL;\n this.widthLimit_ = containerWidth - thumbWidth;\n } else {\n this.direction_ = Direction.VERTICAL;\n this.heightLimit_ = containerHeight - thumbHeight;\n }\n return (this.sliderInitialized_ = true);\n }\n\n /**\n * @param {PointerEvent} event The browser event to handle.\n * @private\n */\n handleContainerClick_(event) {\n const view = this.getMap().getView();\n\n const relativePosition = this.getRelativePosition_(\n event.offsetX - this.thumbSize_[0] / 2,\n event.offsetY - this.thumbSize_[1] / 2\n );\n\n const resolution = this.getResolutionForPosition_(relativePosition);\n const zoom = view.getConstrainedZoom(view.getZoomForResolution(resolution));\n\n view.animateInternal({\n zoom: zoom,\n duration: this.duration_,\n easing: easeOut,\n });\n }\n\n /**\n * Handle dragger start events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerStart_(event) {\n if (!this.dragging_ && event.target === this.element.firstElementChild) {\n const element = /** @type {HTMLElement} */ (\n this.element.firstElementChild\n );\n this.getMap().getView().beginInteraction();\n this.startX_ = event.clientX - parseFloat(element.style.left);\n this.startY_ = event.clientY - parseFloat(element.style.top);\n this.dragging_ = true;\n\n if (this.dragListenerKeys_.length === 0) {\n const drag = this.handleDraggerDrag_;\n const end = this.handleDraggerEnd_;\n const doc = this.getMap().getOwnerDocument();\n this.dragListenerKeys_.push(\n listen(doc, PointerEventType.POINTERMOVE, drag, this),\n listen(doc, PointerEventType.POINTERUP, end, this)\n );\n }\n }\n }\n\n /**\n * Handle dragger drag events.\n *\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerDrag_(event) {\n if (this.dragging_) {\n const deltaX = event.clientX - this.startX_;\n const deltaY = event.clientY - this.startY_;\n const relativePosition = this.getRelativePosition_(deltaX, deltaY);\n this.currentResolution_ =\n this.getResolutionForPosition_(relativePosition);\n this.getMap().getView().setResolution(this.currentResolution_);\n }\n }\n\n /**\n * Handle dragger end events.\n * @param {PointerEvent} event The drag event.\n * @private\n */\n handleDraggerEnd_(event) {\n if (this.dragging_) {\n const view = this.getMap().getView();\n view.endInteraction();\n\n this.dragging_ = false;\n this.startX_ = undefined;\n this.startY_ = undefined;\n this.dragListenerKeys_.forEach(unlistenByKey);\n this.dragListenerKeys_.length = 0;\n }\n }\n\n /**\n * Positions the thumb inside its container according to the given resolution.\n *\n * @param {number} res The res.\n * @private\n */\n setThumbPosition_(res) {\n const position = this.getPositionForResolution_(res);\n const thumb = /** @type {HTMLElement} */ (this.element.firstElementChild);\n\n if (this.direction_ == Direction.HORIZONTAL) {\n thumb.style.left = this.widthLimit_ * position + 'px';\n } else {\n thumb.style.top = this.heightLimit_ * position + 'px';\n }\n }\n\n /**\n * Calculates the relative position of the thumb given x and y offsets. The\n * relative position scales from 0 to 1. The x and y offsets are assumed to be\n * in pixel units within the dragger limits.\n *\n * @param {number} x Pixel position relative to the left of the slider.\n * @param {number} y Pixel position relative to the top of the slider.\n * @return {number} The relative position of the thumb.\n * @private\n */\n getRelativePosition_(x, y) {\n let amount;\n if (this.direction_ === Direction.HORIZONTAL) {\n amount = x / this.widthLimit_;\n } else {\n amount = y / this.heightLimit_;\n }\n return clamp(amount, 0, 1);\n }\n\n /**\n * Calculates the corresponding resolution of the thumb given its relative\n * position (where 0 is the minimum and 1 is the maximum).\n *\n * @param {number} position The relative position of the thumb.\n * @return {number} The corresponding resolution.\n * @private\n */\n getResolutionForPosition_(position) {\n const fn = this.getMap().getView().getResolutionForValueFunction();\n return fn(1 - position);\n }\n\n /**\n * Determines the relative position of the slider for the given resolution. A\n * relative position of 0 corresponds to the minimum view resolution. A\n * relative position of 1 corresponds to the maximum view resolution.\n *\n * @param {number} res The resolution.\n * @return {number} The relative position value (between 0 and 1).\n * @private\n */\n getPositionForResolution_(res) {\n const fn = this.getMap().getView().getValueForResolutionFunction();\n return clamp(1 - fn(res), 0, 1);\n }\n\n /**\n * Update the zoomslider element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n if (!mapEvent.frameState) {\n return;\n }\n if (!this.sliderInitialized_ && !this.initSlider_()) {\n return;\n }\n const res = mapEvent.frameState.viewState.resolution;\n this.currentResolution_ = res;\n this.setThumbPosition_(res);\n }\n}\n\nexport default ZoomSlider;\n","/**\n * @module ol/control/Rotate\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_HIDDEN, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-rotate'] CSS class name.\n * @property {string|HTMLElement} [label='⇧'] Text label to use for the rotate button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [tipLabel='Reset rotation'] Text label to use for the rotate tip.\n * @property {string} [compassClassName='ol-compass'] CSS class name for the compass.\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {boolean} [autoHide=true] Hide the control when rotation is 0.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control should\n * be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {function():void} [resetNorth] Function called when the control is clicked.\n * This will override the default `resetNorth`.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A button control to reset rotation to 0.\n * To style this control use css selector `.ol-rotate`. A `.ol-hidden` css\n * selector is added to the button when the rotation is 0.\n *\n * @api\n */\nclass Rotate extends Control {\n /**\n * @param {Options} [options] Rotate options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-rotate';\n\n const label = options.label !== undefined ? options.label : '\\u21E7';\n\n const compassClassName =\n options.compassClassName !== undefined\n ? options.compassClassName\n : 'ol-compass';\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.label_ = null;\n\n if (typeof label === 'string') {\n this.label_ = document.createElement('span');\n this.label_.className = compassClassName;\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n this.label_.classList.add(compassClassName);\n }\n\n const tipLabel = options.tipLabel ? options.tipLabel : 'Reset rotation';\n\n const button = document.createElement('button');\n button.className = className + '-reset';\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(this.label_);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(button);\n\n this.callResetNorth_ = options.resetNorth ? options.resetNorth : undefined;\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n\n /**\n * @type {boolean}\n * @private\n */\n this.autoHide_ = options.autoHide !== undefined ? options.autoHide : true;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.rotation_ = undefined;\n\n if (this.autoHide_) {\n this.element.classList.add(CLASS_HIDDEN);\n }\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n if (this.callResetNorth_ !== undefined) {\n this.callResetNorth_();\n } else {\n this.resetNorth_();\n }\n }\n\n /**\n * @private\n */\n resetNorth_() {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const rotation = view.getRotation();\n if (rotation !== undefined) {\n if (this.duration_ > 0 && rotation % (2 * Math.PI) !== 0) {\n view.animate({\n rotation: 0,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setRotation(0);\n }\n }\n }\n\n /**\n * Update the rotate control element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n return;\n }\n const rotation = frameState.viewState.rotation;\n if (rotation != this.rotation_) {\n const transform = 'rotate(' + rotation + 'rad)';\n if (this.autoHide_) {\n const contains = this.element.classList.contains(CLASS_HIDDEN);\n if (!contains && rotation === 0) {\n this.element.classList.add(CLASS_HIDDEN);\n } else if (contains && rotation !== 0) {\n this.element.classList.remove(CLASS_HIDDEN);\n }\n }\n this.label_.style.transform = transform;\n }\n this.rotation_ = rotation;\n }\n}\n\nexport default Rotate;\n","/**\n * @module ol/control/Zoom\n */\nimport Control from './Control.js';\nimport EventType from '../events/EventType.js';\nimport {CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {easeOut} from '../easing.js';\n\n/**\n * @typedef {Object} Options\n * @property {number} [duration=250] Animation duration in milliseconds.\n * @property {string} [className='ol-zoom'] CSS class name.\n * @property {string} [zoomInClassName=className + '-in'] CSS class name for the zoom-in button.\n * @property {string} [zoomOutClassName=className + '-out'] CSS class name for the zoom-out button.\n * @property {string|HTMLElement} [zoomInLabel='+'] Text label to use for the zoom-in\n * button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string|HTMLElement} [zoomOutLabel='–'] Text label to use for the zoom-out button.\n * Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {string} [zoomInTipLabel='Zoom in'] Text label to use for the button tip.\n * @property {string} [zoomOutTipLabel='Zoom out'] Text label to use for the button tip.\n * @property {number} [delta=1] The zoom delta applied on each click.\n * @property {HTMLElement|string} [target] Specify a target if you want the control to be\n * rendered outside of the map's viewport.\n */\n\n/**\n * @classdesc\n * A control with 2 buttons, one for zoom in and one for zoom out.\n * This control is one of the default controls of a map. To style this control\n * use css selectors `.ol-zoom-in` and `.ol-zoom-out`.\n *\n * @api\n */\nclass Zoom extends Control {\n /**\n * @param {Options} [options] Zoom options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n target: options.target,\n });\n\n const className =\n options.className !== undefined ? options.className : 'ol-zoom';\n\n const delta = options.delta !== undefined ? options.delta : 1;\n\n const zoomInClassName =\n options.zoomInClassName !== undefined\n ? options.zoomInClassName\n : className + '-in';\n\n const zoomOutClassName =\n options.zoomOutClassName !== undefined\n ? options.zoomOutClassName\n : className + '-out';\n\n const zoomInLabel =\n options.zoomInLabel !== undefined ? options.zoomInLabel : '+';\n const zoomOutLabel =\n options.zoomOutLabel !== undefined ? options.zoomOutLabel : '\\u2013';\n\n const zoomInTipLabel =\n options.zoomInTipLabel !== undefined ? options.zoomInTipLabel : 'Zoom in';\n const zoomOutTipLabel =\n options.zoomOutTipLabel !== undefined\n ? options.zoomOutTipLabel\n : 'Zoom out';\n\n const inElement = document.createElement('button');\n inElement.className = zoomInClassName;\n inElement.setAttribute('type', 'button');\n inElement.title = zoomInTipLabel;\n inElement.appendChild(\n typeof zoomInLabel === 'string'\n ? document.createTextNode(zoomInLabel)\n : zoomInLabel\n );\n\n inElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, delta),\n false\n );\n\n const outElement = document.createElement('button');\n outElement.className = zoomOutClassName;\n outElement.setAttribute('type', 'button');\n outElement.title = zoomOutTipLabel;\n outElement.appendChild(\n typeof zoomOutLabel === 'string'\n ? document.createTextNode(zoomOutLabel)\n : zoomOutLabel\n );\n\n outElement.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this, -delta),\n false\n );\n\n const cssClasses =\n className + ' ' + CLASS_UNSELECTABLE + ' ' + CLASS_CONTROL;\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(inElement);\n element.appendChild(outElement);\n\n /**\n * @type {number}\n * @private\n */\n this.duration_ = options.duration !== undefined ? options.duration : 250;\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(delta, event) {\n event.preventDefault();\n this.zoomByDelta_(delta);\n }\n\n /**\n * @param {number} delta Zoom delta.\n * @private\n */\n zoomByDelta_(delta) {\n const map = this.getMap();\n const view = map.getView();\n if (!view) {\n // the map does not have a view, so we can't act\n // upon it\n return;\n }\n const currentZoom = view.getZoom();\n if (currentZoom !== undefined) {\n const newZoom = view.getConstrainedZoom(currentZoom + delta);\n if (this.duration_ > 0) {\n if (view.getAnimating()) {\n view.cancelAnimations();\n }\n view.animate({\n zoom: newZoom,\n duration: this.duration_,\n easing: easeOut,\n });\n } else {\n view.setZoom(newZoom);\n }\n }\n }\n}\n\nexport default Zoom;\n","/**\n * @module ol/control/defaults\n */\nimport Attribution from './Attribution.js';\nimport Collection from '../Collection.js';\nimport Rotate from './Rotate.js';\nimport Zoom from './Zoom.js';\n\n/**\n * @typedef {Object} DefaultsOptions\n * @property {boolean} [attribution=true] Include\n * {@link module:ol/control/Attribution~Attribution}.\n * @property {import(\"./Attribution.js\").Options} [attributionOptions]\n * Options for {@link module:ol/control/Attribution~Attribution}.\n * @property {boolean} [rotate=true] Include\n * {@link module:ol/control/Rotate~Rotate}.\n * @property {import(\"./Rotate.js\").Options} [rotateOptions] Options\n * for {@link module:ol/control/Rotate~Rotate}.\n * @property {boolean} [zoom] Include {@link module:ol/control/Zoom~Zoom}.\n * @property {import(\"./Zoom.js\").Options} [zoomOptions] Options for\n * {@link module:ol/control/Zoom~Zoom}.\n */\n\n/**\n * Set of controls included in maps by default. Unless configured otherwise,\n * this returns a collection containing an instance of each of the following\n * controls:\n * * {@link module:ol/control/Zoom~Zoom}\n * * {@link module:ol/control/Rotate~Rotate}\n * * {@link module:ol/control/Attribution~Attribution}\n *\n * @param {DefaultsOptions} [options] Options for the default controls.\n * @return {Collection} A collection of controls\n * to be used with the {@link module:ol/Map~Map} constructor's `controls` option.\n * @api\n */\nexport function defaults(options) {\n options = options ? options : {};\n\n /** @type {Collection} */\n const controls = new Collection();\n\n const zoomControl = options.zoom !== undefined ? options.zoom : true;\n if (zoomControl) {\n controls.push(new Zoom(options.zoomOptions));\n }\n\n const rotateControl = options.rotate !== undefined ? options.rotate : true;\n if (rotateControl) {\n controls.push(new Rotate(options.rotateOptions));\n }\n\n const attributionControl =\n options.attribution !== undefined ? options.attribution : true;\n if (attributionControl) {\n controls.push(new Attribution(options.attributionOptions));\n }\n\n return controls;\n}\n","/**\n * @module ol/coordinate\n */\nimport {getWidth} from './extent.js';\nimport {modulo, toFixed} from './math.js';\nimport {padNumber} from './string.js';\n\n/**\n * An array of numbers representing an `xy`, `xyz` or `xyzm` coordinate.\n * Example: `[16, 48]`.\n * @typedef {Array} Coordinate\n * @api\n */\n\n/**\n * A function that takes a {@link module:ol/coordinate~Coordinate} and\n * transforms it into a `{string}`.\n *\n * @typedef {function((Coordinate|undefined)): string} CoordinateFormat\n * @api\n */\n\n/**\n * Add `delta` to `coordinate`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {add} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * add(coord, [-2, 4]);\n * // coord is now [5.85, 51.983333]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {Coordinate} delta Delta.\n * @return {Coordinate} The input coordinate adjusted by\n * the given delta.\n * @api\n */\nexport function add(coordinate, delta) {\n coordinate[0] += +delta[0];\n coordinate[1] += +delta[1];\n return coordinate;\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed circle.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {import(\"./geom/Circle.js\").default} circle The circle.\n * @return {Coordinate} Closest point on the circumference.\n */\nexport function closestOnCircle(coordinate, circle) {\n const r = circle.getRadius();\n const center = circle.getCenter();\n const x0 = center[0];\n const y0 = center[1];\n const x1 = coordinate[0];\n const y1 = coordinate[1];\n\n let dx = x1 - x0;\n const dy = y1 - y0;\n if (dx === 0 && dy === 0) {\n dx = 1;\n }\n const d = Math.sqrt(dx * dx + dy * dy);\n\n const x = x0 + (r * dx) / d;\n const y = y0 + (r * dy) / d;\n\n return [x, y];\n}\n\n/**\n * Calculates the point closest to the passed coordinate on the passed segment.\n * This is the foot of the perpendicular of the coordinate to the segment when\n * the foot is on the segment, or the closest segment coordinate when the foot\n * is outside the segment.\n *\n * @param {Coordinate} coordinate The coordinate.\n * @param {Array} segment The two coordinates\n * of the segment.\n * @return {Coordinate} The foot of the perpendicular of\n * the coordinate to the segment.\n */\nexport function closestOnSegment(coordinate, segment) {\n const x0 = coordinate[0];\n const y0 = coordinate[1];\n const start = segment[0];\n const end = segment[1];\n const x1 = start[0];\n const y1 = start[1];\n const x2 = end[0];\n const y2 = end[1];\n const dx = x2 - x1;\n const dy = y2 - y1;\n const along =\n dx === 0 && dy === 0\n ? 0\n : (dx * (x0 - x1) + dy * (y0 - y1)) / (dx * dx + dy * dy || 0);\n let x, y;\n if (along <= 0) {\n x = x1;\n y = y1;\n } else if (along >= 1) {\n x = x2;\n y = y2;\n } else {\n x = x1 + along * dx;\n y = y1 + along * dy;\n }\n return [x, y];\n}\n\n/**\n * Returns a {@link module:ol/coordinate~CoordinateFormat} function that can be\n * used to format\n * a {Coordinate} to a string.\n *\n * Example without specifying the fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY();\n * const out = stringifyFunc(coord);\n * // out is now '8, 48'\n *\n * Example with explicitly specifying 2 fractional digits:\n *\n * import {createStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const stringifyFunc = createStringXY(2);\n * const out = stringifyFunc(coord);\n * // out is now '7.85, 47.98'\n *\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {CoordinateFormat} Coordinate format.\n * @api\n */\nexport function createStringXY(fractionDigits) {\n return (\n /**\n * @param {Coordinate} coordinate Coordinate.\n * @return {string} String XY.\n */\n function (coordinate) {\n return toStringXY(coordinate, fractionDigits);\n }\n );\n}\n\n/**\n * @param {string} hemispheres Hemispheres.\n * @param {number} degrees Degrees.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} String.\n */\nexport function degreesToStringHDMS(hemispheres, degrees, fractionDigits) {\n const normalizedDegrees = modulo(degrees + 180, 360) - 180;\n const x = Math.abs(3600 * normalizedDegrees);\n const decimals = fractionDigits || 0;\n\n let deg = Math.floor(x / 3600);\n let min = Math.floor((x - deg * 3600) / 60);\n let sec = toFixed(x - deg * 3600 - min * 60, decimals);\n\n if (sec >= 60) {\n sec = 0;\n min += 1;\n }\n\n if (min >= 60) {\n min = 0;\n deg += 1;\n }\n\n let hdms = deg + '\\u00b0';\n if (min !== 0 || sec !== 0) {\n hdms += ' ' + padNumber(min, 2) + '\\u2032';\n }\n if (sec !== 0) {\n hdms += ' ' + padNumber(sec, 2, decimals) + '\\u2033';\n }\n if (normalizedDegrees !== 0) {\n hdms += ' ' + hemispheres.charAt(normalizedDegrees < 0 ? 1 : 0);\n }\n\n return hdms;\n}\n\n/**\n * Transforms the given {@link module:ol/coordinate~Coordinate} to a string\n * using the given string template. The strings `{x}` and `{y}` in the template\n * will be replaced with the first and second coordinate values respectively.\n *\n * Example without specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template);\n * // out is now 'Coordinate is (8|48).'\n *\n * Example explicitly specifying the fractional digits:\n *\n * import {format} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const template = 'Coordinate is ({x}|{y}).';\n * const out = format(coord, template, 2);\n * // out is now 'Coordinate is (7.85|47.98).'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {string} template A template string with `{x}` and `{y}` placeholders\n * that will be replaced by first and second coordinate values.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Formatted coordinate.\n * @api\n */\nexport function format(coordinate, template, fractionDigits) {\n if (coordinate) {\n return template\n .replace('{x}', coordinate[0].toFixed(fractionDigits))\n .replace('{y}', coordinate[1].toFixed(fractionDigits));\n }\n return '';\n}\n\n/**\n * @param {Coordinate} coordinate1 First coordinate.\n * @param {Coordinate} coordinate2 Second coordinate.\n * @return {boolean} The two coordinates are equal.\n */\nexport function equals(coordinate1, coordinate2) {\n let equals = true;\n for (let i = coordinate1.length - 1; i >= 0; --i) {\n if (coordinate1[i] != coordinate2[i]) {\n equals = false;\n break;\n }\n }\n return equals;\n}\n\n/**\n * Rotate `coordinate` by `angle`. `coordinate` is modified in place and\n * returned by the function.\n *\n * Example:\n *\n * import {rotate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const rotateRadians = Math.PI / 2; // 90 degrees\n * rotate(coord, rotateRadians);\n * // coord is now [-47.983333, 7.85]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} angle Angle in radian.\n * @return {Coordinate} Coordinate.\n * @api\n */\nexport function rotate(coordinate, angle) {\n const cosAngle = Math.cos(angle);\n const sinAngle = Math.sin(angle);\n const x = coordinate[0] * cosAngle - coordinate[1] * sinAngle;\n const y = coordinate[1] * cosAngle + coordinate[0] * sinAngle;\n coordinate[0] = x;\n coordinate[1] = y;\n return coordinate;\n}\n\n/**\n * Scale `coordinate` by `scale`. `coordinate` is modified in place and returned\n * by the function.\n *\n * Example:\n *\n * import {scale as scaleCoordinate} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const scale = 1.2;\n * scaleCoordinate(coord, scale);\n * // coord is now [9.42, 57.5799996]\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} scale Scale factor.\n * @return {Coordinate} Coordinate.\n */\nexport function scale(coordinate, scale) {\n coordinate[0] *= scale;\n coordinate[1] *= scale;\n return coordinate;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Squared distance between coord1 and coord2.\n */\nexport function squaredDistance(coord1, coord2) {\n const dx = coord1[0] - coord2[0];\n const dy = coord1[1] - coord2[1];\n return dx * dx + dy * dy;\n}\n\n/**\n * @param {Coordinate} coord1 First coordinate.\n * @param {Coordinate} coord2 Second coordinate.\n * @return {number} Distance between coord1 and coord2.\n */\nexport function distance(coord1, coord2) {\n return Math.sqrt(squaredDistance(coord1, coord2));\n}\n\n/**\n * Calculate the squared distance from a coordinate to a line segment.\n *\n * @param {Coordinate} coordinate Coordinate of the point.\n * @param {Array} segment Line segment (2\n * coordinates).\n * @return {number} Squared distance from the point to the line segment.\n */\nexport function squaredDistanceToSegment(coordinate, segment) {\n return squaredDistance(coordinate, closestOnSegment(coordinate, segment));\n}\n\n/**\n * Format a geographic coordinate with the hemisphere, degrees, minutes, and\n * seconds.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord);\n * // out is now '47° 58′ 60″ N 7° 50′ 60″ E'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringHDMS} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringHDMS(coord, 1);\n * // out is now '47° 58′ 60.0″ N 7° 50′ 60.0″ E'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} Hemisphere, degrees, minutes and seconds.\n * @api\n */\nexport function toStringHDMS(coordinate, fractionDigits) {\n if (coordinate) {\n return (\n degreesToStringHDMS('NS', coordinate[1], fractionDigits) +\n ' ' +\n degreesToStringHDMS('EW', coordinate[0], fractionDigits)\n );\n }\n return '';\n}\n\n/**\n * Format a coordinate as a comma delimited string.\n *\n * Example without specifying fractional digits:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord);\n * // out is now '8, 48'\n *\n * Example explicitly specifying 1 fractional digit:\n *\n * import {toStringXY} from 'ol/coordinate.js';\n *\n * const coord = [7.85, 47.983333];\n * const out = toStringXY(coord, 1);\n * // out is now '7.8, 48.0'\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {number} [fractionDigits] The number of digits to include\n * after the decimal point. Default is `0`.\n * @return {string} XY.\n * @api\n */\nexport function toStringXY(coordinate, fractionDigits) {\n return format(coordinate, '{x}, {y}', fractionDigits);\n}\n\n/**\n * Modifies the provided coordinate in-place to be within the real world\n * extent. The lower projection extent boundary is inclusive, the upper one\n * exclusive.\n *\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @return {Coordinate} The coordinate within the real world extent.\n */\nexport function wrapX(coordinate, projection) {\n if (projection.canWrapX()) {\n const worldWidth = getWidth(projection.getExtent());\n const worldsAway = getWorldsAway(coordinate, projection, worldWidth);\n if (worldsAway) {\n coordinate[0] -= worldsAway * worldWidth;\n }\n }\n return coordinate;\n}\n/**\n * @param {Coordinate} coordinate Coordinate.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {number} [sourceExtentWidth] Width of the source extent.\n * @return {number} Offset in world widths.\n */\nexport function getWorldsAway(coordinate, projection, sourceExtentWidth) {\n const projectionExtent = projection.getExtent();\n let worldsAway = 0;\n if (\n projection.canWrapX() &&\n (coordinate[0] < projectionExtent[0] || coordinate[0] > projectionExtent[2])\n ) {\n sourceExtentWidth = sourceExtentWidth || getWidth(projectionExtent);\n worldsAway = Math.floor(\n (coordinate[0] - projectionExtent[0]) / sourceExtentWidth\n );\n }\n return worldsAway;\n}\n","/**\n * @module ol/css\n */\n\n/**\n * @typedef {Object} FontParameters\n * @property {string} style Style.\n * @property {string} variant Variant.\n * @property {string} weight Weight.\n * @property {string} size Size.\n * @property {string} lineHeight LineHeight.\n * @property {string} family Family.\n * @property {Array} families Families.\n */\n\n/**\n * The CSS class for hidden feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_HIDDEN = 'ol-hidden';\n\n/**\n * The CSS class that we'll give the DOM elements to have them selectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_SELECTABLE = 'ol-selectable';\n\n/**\n * The CSS class that we'll give the DOM elements to have them unselectable.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSELECTABLE = 'ol-unselectable';\n\n/**\n * The CSS class for unsupported feature.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_UNSUPPORTED = 'ol-unsupported';\n\n/**\n * The CSS class for controls.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_CONTROL = 'ol-control';\n\n/**\n * The CSS class that we'll give the DOM elements that are collapsed, i.e.\n * to those elements which usually can be expanded.\n *\n * @const\n * @type {string}\n */\nexport const CLASS_COLLAPSED = 'ol-collapsed';\n\n/**\n * From https://stackoverflow.com/questions/10135697/regex-to-parse-any-css-font\n * @type {RegExp}\n */\nconst fontRegEx = new RegExp(\n [\n '^\\\\s*(?=(?:(?:[-a-z]+\\\\s*){0,2}(italic|oblique))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(small-caps))?)',\n '(?=(?:(?:[-a-z]+\\\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)',\n '(?:(?:normal|\\\\1|\\\\2|\\\\3)\\\\s*){0,3}((?:xx?-)?',\n '(?:small|large)|medium|smaller|larger|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx]))',\n '(?:\\\\s*\\\\/\\\\s*(normal|[\\\\.\\\\d]+(?:\\\\%|in|[cem]m|ex|p[ctx])?))',\n '?\\\\s*([-,\\\\\"\\\\\\'\\\\sa-z]+?)\\\\s*$',\n ].join(''),\n 'i'\n);\n/** @type {Array<'style'|'variant'|'weight'|'size'|'lineHeight'|'family'>} */\nconst fontRegExMatchIndex = [\n 'style',\n 'variant',\n 'weight',\n 'size',\n 'lineHeight',\n 'family',\n];\n\n/**\n * Get the list of font families from a font spec. Note that this doesn't work\n * for font families that have commas in them.\n * @param {string} fontSpec The CSS font property.\n * @return {FontParameters|null} The font parameters (or null if the input spec is invalid).\n */\nexport const getFontParameters = function (fontSpec) {\n const match = fontSpec.match(fontRegEx);\n if (!match) {\n return null;\n }\n const style = /** @type {FontParameters} */ ({\n lineHeight: 'normal',\n size: '1.2em',\n style: 'normal',\n weight: 'normal',\n variant: 'normal',\n });\n for (let i = 0, ii = fontRegExMatchIndex.length; i < ii; ++i) {\n const value = match[i + 1];\n if (value !== undefined) {\n style[fontRegExMatchIndex[i]] = value;\n }\n }\n style.families = style.family.split(/,\\s?/);\n return style;\n};\n","import {WORKER_OFFSCREEN_CANVAS} from './has.js';\n\n/**\n * @module ol/dom\n */\n\n//FIXME Move this function to the canvas module\n/**\n * Create an html canvas element and returns its 2d context.\n * @param {number} [width] Canvas width.\n * @param {number} [height] Canvas height.\n * @param {Array} [canvasPool] Canvas pool to take existing canvas from.\n * @param {CanvasRenderingContext2DSettings} [settings] CanvasRenderingContext2DSettings\n * @return {CanvasRenderingContext2D} The context.\n */\nexport function createCanvasContext2D(width, height, canvasPool, settings) {\n /** @type {HTMLCanvasElement|OffscreenCanvas} */\n let canvas;\n if (canvasPool && canvasPool.length) {\n canvas = /** @type {HTMLCanvasElement} */ (canvasPool.shift());\n } else if (WORKER_OFFSCREEN_CANVAS) {\n canvas = new OffscreenCanvas(width || 300, height || 300);\n } else {\n canvas = document.createElement('canvas');\n }\n if (width) {\n canvas.width = width;\n }\n if (height) {\n canvas.height = height;\n }\n //FIXME Allow OffscreenCanvasRenderingContext2D as return type\n return /** @type {CanvasRenderingContext2D} */ (\n canvas.getContext('2d', settings)\n );\n}\n\n/** @type {CanvasRenderingContext2D} */\nlet sharedCanvasContext;\n\n/**\n * @return {CanvasRenderingContext2D} Shared canvas context.\n */\nexport function getSharedCanvasContext2D() {\n if (!sharedCanvasContext) {\n sharedCanvasContext = createCanvasContext2D(1, 1);\n }\n return sharedCanvasContext;\n}\n\n/**\n * Releases canvas memory to avoid exceeding memory limits in Safari.\n * See https://pqina.nl/blog/total-canvas-memory-use-exceeds-the-maximum-limit/\n * @param {CanvasRenderingContext2D} context Context.\n */\nexport function releaseCanvas(context) {\n const canvas = context.canvas;\n canvas.width = 1;\n canvas.height = 1;\n context.clearRect(0, 0, 1, 1);\n}\n\n/**\n * Get the current computed width for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerWidth(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The width.\n */\nexport function outerWidth(element) {\n let width = element.offsetWidth;\n const style = getComputedStyle(element);\n width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);\n\n return width;\n}\n\n/**\n * Get the current computed height for the given element including margin,\n * padding and border.\n * Equivalent to jQuery's `$(el).outerHeight(true)`.\n * @param {!HTMLElement} element Element.\n * @return {number} The height.\n */\nexport function outerHeight(element) {\n let height = element.offsetHeight;\n const style = getComputedStyle(element);\n height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);\n\n return height;\n}\n\n/**\n * @param {Node} newNode Node to replace old node\n * @param {Node} oldNode The node to be replaced\n */\nexport function replaceNode(newNode, oldNode) {\n const parent = oldNode.parentNode;\n if (parent) {\n parent.replaceChild(newNode, oldNode);\n }\n}\n\n/**\n * @param {Node} node The node to remove.\n * @return {Node|null} The node that was removed or null.\n */\nexport function removeNode(node) {\n return node && node.parentNode ? node.parentNode.removeChild(node) : null;\n}\n\n/**\n * @param {Node} node The node to remove the children from.\n */\nexport function removeChildren(node) {\n while (node.lastChild) {\n node.removeChild(node.lastChild);\n }\n}\n\n/**\n * Transform the children of a parent node so they match the\n * provided list of children. This function aims to efficiently\n * remove, add, and reorder child nodes while maintaining a simple\n * implementation (it is not guaranteed to minimize DOM operations).\n * @param {Node} node The parent node whose children need reworking.\n * @param {Array} children The desired children.\n */\nexport function replaceChildren(node, children) {\n const oldChildren = node.childNodes;\n\n for (let i = 0; true; ++i) {\n const oldChild = oldChildren[i];\n const newChild = children[i];\n\n // check if our work is done\n if (!oldChild && !newChild) {\n break;\n }\n\n // check if children match\n if (oldChild === newChild) {\n continue;\n }\n\n // check if a new child needs to be added\n if (!oldChild) {\n node.appendChild(newChild);\n continue;\n }\n\n // check if an old child needs to be removed\n if (!newChild) {\n node.removeChild(oldChild);\n --i;\n continue;\n }\n\n // reorder\n node.insertBefore(newChild, oldChild);\n }\n}\n","/**\n * @module ol/easing\n */\n\n/**\n * Start slow and speed up.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeIn(t) {\n return Math.pow(t, 3);\n}\n\n/**\n * Start fast and slow down.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function easeOut(t) {\n return 1 - easeIn(1 - t);\n}\n\n/**\n * Start slow, speed up, and then slow down again.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function inAndOut(t) {\n return 3 * t * t - 2 * t * t * t;\n}\n\n/**\n * Maintain a constant speed over time.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function linear(t) {\n return t;\n}\n\n/**\n * Start slow, speed up, and at the very end slow down again. This has the\n * same general behavior as {@link module:ol/easing.inAndOut}, but the final\n * slowdown is delayed.\n * @param {number} t Input between 0 and 1.\n * @return {number} Output between 0 and 1.\n * @api\n */\nexport function upAndDown(t) {\n if (t < 0.5) {\n return inAndOut(2 * t);\n }\n return 1 - inAndOut(2 * (t - 0.5));\n}\n","/**\n * @module ol/events\n */\nimport {clear} from './obj.js';\n\n/**\n * Key to use with {@link module:ol/Observable.unByKey}.\n * @typedef {Object} EventsKey\n * @property {ListenerFunction} listener Listener.\n * @property {import(\"./events/Target.js\").EventTargetLike} target Target.\n * @property {string} type Type.\n * @api\n */\n\n/**\n * Listener function. This function is called with an event object as argument.\n * When the function returns `false`, event propagation will stop.\n *\n * @typedef {function((Event|import(\"./events/Event.js\").default)): (void|boolean)} ListenerFunction\n * @api\n */\n\n/**\n * @typedef {Object} ListenerObject\n * @property {ListenerFunction} handleEvent HandleEvent listener function.\n */\n\n/**\n * @typedef {ListenerFunction|ListenerObject} Listener\n */\n\n/**\n * Registers an event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` to a `this` object, and returns\n * a key for use with {@link module:ol/events.unlistenByKey}.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @param {boolean} [once] If true, add the listener as one-off listener.\n * @return {EventsKey} Unique key for the listener.\n */\nexport function listen(target, type, listener, thisArg, once) {\n if (thisArg && thisArg !== target) {\n listener = listener.bind(thisArg);\n }\n if (once) {\n const originalListener = listener;\n listener = function () {\n target.removeEventListener(type, listener);\n originalListener.apply(this, arguments);\n };\n }\n const eventsKey = {\n target: target,\n type: type,\n listener: listener,\n };\n target.addEventListener(type, listener);\n return eventsKey;\n}\n\n/**\n * Registers a one-off event listener on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * This function efficiently binds a `listener` as self-unregistering listener\n * to a `this` object, and returns a key for use with\n * {@link module:ol/events.unlistenByKey} in case the listener needs to be\n * unregistered before it is called.\n *\n * When {@link module:ol/events.listen} is called with the same arguments after this\n * function, the self-unregistering listener will be turned into a permanent\n * listener.\n *\n * @param {import(\"./events/Target.js\").EventTargetLike} target Event target.\n * @param {string} type Event type.\n * @param {ListenerFunction} listener Listener.\n * @param {Object} [thisArg] Object referenced by the `this` keyword in the\n * listener. Default is the `target`.\n * @return {EventsKey} Key for unlistenByKey.\n */\nexport function listenOnce(target, type, listener, thisArg) {\n return listen(target, type, listener, thisArg, true);\n}\n\n/**\n * Unregisters event listeners on an event target. Inspired by\n * https://google.github.io/closure-library/api/source/closure/goog/events/events.js.src.html\n *\n * The argument passed to this function is the key returned from\n * {@link module:ol/events.listen} or {@link module:ol/events.listenOnce}.\n *\n * @param {EventsKey} key The key.\n */\nexport function unlistenByKey(key) {\n if (key && key.target) {\n key.target.removeEventListener(key.type, key.listener);\n clear(key);\n }\n}\n","/**\n * @module ol/events/Event\n */\n\n/**\n * @classdesc\n * Stripped down implementation of the W3C DOM Level 2 Event interface.\n * See https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface.\n *\n * This implementation only provides `type` and `target` properties, and\n * `stopPropagation` and `preventDefault` methods. It is meant as base class\n * for higher level events defined in the library, and works with\n * {@link module:ol/events/Target~Target}.\n */\nclass BaseEvent {\n /**\n * @param {string} type Type.\n */\n constructor(type) {\n /**\n * @type {boolean}\n */\n this.propagationStopped;\n\n /**\n * @type {boolean}\n */\n this.defaultPrevented;\n\n /**\n * The event type.\n * @type {string}\n * @api\n */\n this.type = type;\n\n /**\n * The event target.\n * @type {Object}\n * @api\n */\n this.target = null;\n }\n\n /**\n * Prevent default. This means that no emulated `click`, `singleclick` or `doubleclick` events\n * will be fired.\n * @api\n */\n preventDefault() {\n this.defaultPrevented = true;\n }\n\n /**\n * Stop event propagation.\n * @api\n */\n stopPropagation() {\n this.propagationStopped = true;\n }\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function stopPropagation(evt) {\n evt.stopPropagation();\n}\n\n/**\n * @param {Event|import(\"./Event.js\").default} evt Event\n */\nexport function preventDefault(evt) {\n evt.preventDefault();\n}\n\nexport default BaseEvent;\n","/**\n * @module ol/events/EventType\n */\n\n/**\n * @enum {string}\n * @const\n */\nexport default {\n /**\n * Generic change event. Triggered when the revision counter is increased.\n * @event module:ol/events/Event~BaseEvent#change\n * @api\n */\n CHANGE: 'change',\n\n /**\n * Generic error event. Triggered when an error occurs.\n * @event module:ol/events/Event~BaseEvent#error\n * @api\n */\n ERROR: 'error',\n\n BLUR: 'blur',\n CLEAR: 'clear',\n CONTEXTMENU: 'contextmenu',\n CLICK: 'click',\n DBLCLICK: 'dblclick',\n DRAGENTER: 'dragenter',\n DRAGOVER: 'dragover',\n DROP: 'drop',\n FOCUS: 'focus',\n KEYDOWN: 'keydown',\n KEYPRESS: 'keypress',\n LOAD: 'load',\n RESIZE: 'resize',\n TOUCHMOVE: 'touchmove',\n WHEEL: 'wheel',\n};\n","/**\n * @module ol/events/Target\n */\nimport Disposable from '../Disposable.js';\nimport Event from './Event.js';\nimport {VOID} from '../functions.js';\nimport {clear} from '../obj.js';\n\n/**\n * @typedef {EventTarget|Target} EventTargetLike\n */\n\n/**\n * @classdesc\n * A simplified implementation of the W3C DOM Level 2 EventTarget interface.\n * See https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget.\n *\n * There are two important simplifications compared to the specification:\n *\n * 1. The handling of `useCapture` in `addEventListener` and\n * `removeEventListener`. There is no real capture model.\n * 2. The handling of `stopPropagation` and `preventDefault` on `dispatchEvent`.\n * There is no event target hierarchy. When a listener calls\n * `stopPropagation` or `preventDefault` on an event object, it means that no\n * more listeners after this one will be called. Same as when the listener\n * returns false.\n */\nclass Target extends Disposable {\n /**\n * @param {*} [target] Default event target for dispatched events.\n */\n constructor(target) {\n super();\n\n /**\n * @private\n * @type {*}\n */\n this.eventTarget_ = target;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.pendingRemovals_ = null;\n\n /**\n * @private\n * @type {Object|null}\n */\n this.dispatching_ = null;\n\n /**\n * @private\n * @type {Object>|null}\n */\n this.listeners_ = null;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n addEventListener(type, listener) {\n if (!type || !listener) {\n return;\n }\n const listeners = this.listeners_ || (this.listeners_ = {});\n const listenersForType = listeners[type] || (listeners[type] = []);\n if (!listenersForType.includes(listener)) {\n listenersForType.push(listener);\n }\n }\n\n /**\n * Dispatches an event and calls all listeners listening for events\n * of this type. The event parameter can either be a string or an\n * Object with a `type` property.\n *\n * @param {import(\"./Event.js\").default|string} event Event object.\n * @return {boolean|undefined} `false` if anyone called preventDefault on the\n * event object or if any of the listeners returned false.\n * @api\n */\n dispatchEvent(event) {\n const isString = typeof event === 'string';\n const type = isString ? event : event.type;\n const listeners = this.listeners_ && this.listeners_[type];\n if (!listeners) {\n return;\n }\n\n const evt = isString ? new Event(event) : /** @type {Event} */ (event);\n if (!evt.target) {\n evt.target = this.eventTarget_ || this;\n }\n const dispatching = this.dispatching_ || (this.dispatching_ = {});\n const pendingRemovals =\n this.pendingRemovals_ || (this.pendingRemovals_ = {});\n if (!(type in dispatching)) {\n dispatching[type] = 0;\n pendingRemovals[type] = 0;\n }\n ++dispatching[type];\n let propagate;\n for (let i = 0, ii = listeners.length; i < ii; ++i) {\n if ('handleEvent' in listeners[i]) {\n propagate = /** @type {import(\"../events.js\").ListenerObject} */ (\n listeners[i]\n ).handleEvent(evt);\n } else {\n propagate = /** @type {import(\"../events.js\").ListenerFunction} */ (\n listeners[i]\n ).call(this, evt);\n }\n if (propagate === false || evt.propagationStopped) {\n propagate = false;\n break;\n }\n }\n if (--dispatching[type] === 0) {\n let pr = pendingRemovals[type];\n delete pendingRemovals[type];\n while (pr--) {\n this.removeEventListener(type, VOID);\n }\n delete dispatching[type];\n }\n return propagate;\n }\n\n /**\n * Clean up.\n */\n disposeInternal() {\n this.listeners_ && clear(this.listeners_);\n }\n\n /**\n * Get the listeners for a specified event type. Listeners are returned in the\n * order that they will be called in.\n *\n * @param {string} type Type.\n * @return {Array|undefined} Listeners.\n */\n getListeners(type) {\n return (this.listeners_ && this.listeners_[type]) || undefined;\n }\n\n /**\n * @param {string} [type] Type. If not provided,\n * `true` will be returned if this event target has any listeners.\n * @return {boolean} Has listeners.\n */\n hasListener(type) {\n if (!this.listeners_) {\n return false;\n }\n return type\n ? type in this.listeners_\n : Object.keys(this.listeners_).length > 0;\n }\n\n /**\n * @param {string} type Type.\n * @param {import(\"../events.js\").Listener} listener Listener.\n */\n removeEventListener(type, listener) {\n if (!this.listeners_) {\n return;\n }\n const listeners = this.listeners_[type];\n if (!listeners) {\n return;\n }\n const index = listeners.indexOf(listener);\n if (index !== -1) {\n if (this.pendingRemovals_ && type in this.pendingRemovals_) {\n // make listener a no-op, and remove later in #dispatchEvent()\n listeners[index] = VOID;\n ++this.pendingRemovals_[type];\n } else {\n listeners.splice(index, 1);\n if (listeners.length === 0) {\n delete this.listeners_[type];\n }\n }\n }\n }\n}\n\nexport default Target;\n","/**\n * @module ol/events/condition\n */\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {FALSE, TRUE} from '../functions.js';\nimport {MAC, WEBKIT} from '../has.js';\nimport {assert} from '../asserts.js';\n\n/**\n * A function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * `{boolean}`. If the condition is met, true should be returned.\n *\n * @typedef {function(this: ?, import(\"../MapBrowserEvent.js\").default): boolean} Condition\n */\n\n/**\n * Creates a condition function that passes when all provided conditions pass.\n * @param {...Condition} var_args Conditions to check.\n * @return {Condition} Condition function.\n */\nexport function all(var_args) {\n const conditions = arguments;\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {boolean} All conditions passed.\n */\n return function (event) {\n let pass = true;\n for (let i = 0, ii = conditions.length; i < ii; ++i) {\n pass = pass && conditions[i](event);\n if (!pass) {\n break;\n }\n }\n return pass;\n };\n}\n\n/**\n * Return `true` if only the alt-key is pressed, `false` otherwise (e.g. when\n * additionally the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt key is pressed.\n * @api\n */\nexport const altKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the alt-key and shift-key is pressed, `false` otherwise\n * (e.g. when additionally the platform-modifier-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the alt and shift keys are pressed.\n * @api\n */\nexport const altShiftKeysOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the map has the focus. This condition requires a map target\n * element with a `tabindex` attribute, e.g. `
`.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map has the focus.\n * @api\n */\nexport const focus = function (event) {\n const targetElement = event.map.getTargetElement();\n const activeElement = event.map.getOwnerDocument().activeElement;\n return targetElement.contains(activeElement);\n};\n\n/**\n * Return `true` if the map has the focus or no 'tabindex' attribute set.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} event Map browser event.\n * @return {boolean} The map container has the focus or no 'tabindex' attribute.\n */\nexport const focusWithTabindex = function (event) {\n return event.map.getTargetElement().hasAttribute('tabindex')\n ? focus(event)\n : true;\n};\n\n/**\n * Return always true.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True.\n * @api\n */\nexport const always = TRUE;\n\n/**\n * Return `true` if the event is a `click` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `click` event.\n * @api\n */\nexport const click = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.CLICK;\n};\n\n/**\n * Return `true` if the event has an \"action\"-producing mouse button.\n *\n * By definition, this includes left-click on windows/linux, and left-click\n * without the ctrl key on Macs.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} The result.\n */\nexport const mouseActionButton = function (mapBrowserEvent) {\n const originalEvent = /** @type {MouseEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return originalEvent.button == 0 && !(WEBKIT && MAC && originalEvent.ctrlKey);\n};\n\n/**\n * Return always false.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} False.\n * @api\n */\nexport const never = FALSE;\n\n/**\n * Return `true` if the browser event is a `pointermove` event, `false`\n * otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the browser event is a `pointermove` event.\n * @api\n */\nexport const pointerMove = function (mapBrowserEvent) {\n return mapBrowserEvent.type == 'pointermove';\n};\n\n/**\n * Return `true` if the event is a map `singleclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `singleclick` event.\n * @api\n */\nexport const singleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK;\n};\n\n/**\n * Return `true` if the event is a map `dblclick` event, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event is a map `dblclick` event.\n * @api\n */\nexport const doubleClick = function (mapBrowserEvent) {\n return mapBrowserEvent.type == MapBrowserEventType.DBLCLICK;\n};\n\n/**\n * Return `true` if no modifier key (alt-, shift- or platform-modifier-key) is\n * pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if there no modifier keys are pressed.\n * @api\n */\nexport const noModifierKeys = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if only the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed, `false` otherwise (e.g. when additionally\n * the shift-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n (MAC ? originalEvent.metaKey : originalEvent.ctrlKey) &&\n !originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the platform-modifier-key (the meta-key on Mac,\n * ctrl-key otherwise) is pressed.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the platform modifier key is pressed.\n * @api\n */\nexport const platformModifierKey = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return MAC ? originalEvent.metaKey : originalEvent.ctrlKey;\n};\n\n/**\n * Return `true` if only the shift-key is pressed, `false` otherwise (e.g. when\n * additionally the alt-key is pressed).\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if only the shift key is pressed.\n * @api\n */\nexport const shiftKeyOnly = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n return (\n !originalEvent.altKey &&\n !(originalEvent.metaKey || originalEvent.ctrlKey) &&\n originalEvent.shiftKey\n );\n};\n\n/**\n * Return `true` if the target element is not editable, i.e. not an `input`,\n * `select`, or `textarea` element and no `contenteditable` attribute is\n * set or inherited, `false` otherwise.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True only if the target element is not editable.\n * @api\n */\nexport const targetNotEditable = function (mapBrowserEvent) {\n const originalEvent = /** @type {KeyboardEvent|MouseEvent|TouchEvent} */ (\n mapBrowserEvent.originalEvent\n );\n const tagName = /** @type {Element} */ (originalEvent.target).tagName;\n return (\n tagName !== 'INPUT' &&\n tagName !== 'SELECT' &&\n tagName !== 'TEXTAREA' &&\n // `isContentEditable` is only available on `HTMLElement`, but it may also be a\n // different type like `SVGElement`.\n // @ts-ignore\n !originalEvent.target.isContentEditable\n );\n};\n\n/**\n * Return `true` if the event originates from a mouse device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a mouse device.\n * @api\n */\nexport const mouseOnly = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvent !== undefined,\n 'mapBrowserEvent must originate from a pointer event'\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvent.pointerType == 'mouse';\n};\n\n/**\n * Return `true` if the event originates from a touchable device.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a touchable device.\n * @api\n */\nexport const touchOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvt !== undefined,\n 'mapBrowserEvent must originate from a pointer event'\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'touch';\n};\n\n/**\n * Return `true` if the event originates from a digital pen.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a digital pen.\n * @api\n */\nexport const penOnly = function (mapBrowserEvent) {\n const pointerEvt = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvt !== undefined,\n 'mapBrowserEvent must originate from a pointer event'\n );\n // see https://www.w3.org/TR/pointerevents/#widl-PointerEvent-pointerType\n return pointerEvt.pointerType === 'pen';\n};\n\n/**\n * Return `true` if the event originates from a primary pointer in\n * contact with the surface or if the left mouse button is pressed.\n * See https://www.w3.org/TR/pointerevents/#button-states.\n *\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} True if the event originates from a primary pointer.\n * @api\n */\nexport const primaryAction = function (mapBrowserEvent) {\n const pointerEvent = /** @type {import(\"../MapBrowserEvent\").default} */ (\n mapBrowserEvent\n ).originalEvent;\n assert(\n pointerEvent !== undefined,\n 'mapBrowserEvent must originate from a pointer event'\n );\n return pointerEvent.isPrimary && pointerEvent.button === 0;\n};\n","/**\n * @module ol/expr/expression\n */\nimport {ascending} from '../array.js';\nimport {isStringColor} from '../color.js';\n\n/**\n * @fileoverview This module includes types and functions for parsing array encoded expressions.\n * The result of parsing an encoded expression is one of the specific expression classes.\n * During parsing, information is added to the parsing context about the data accessed by the\n * expression.\n */\n\n/**\n * Base type used for literal style parameters; can be a number literal or the output of an operator,\n * which in turns takes {@link import(\"./expression.js\").ExpressionValue} arguments.\n *\n * The following operators can be used:\n *\n * * Reading operators:\n * * `['band', bandIndex, xOffset, yOffset]` For tile layers only. Fetches pixel values from band\n * `bandIndex` of the source's data. The first `bandIndex` of the source data is `1`. Fetched values\n * are in the 0..1 range. {@link import(\"../source/TileImage.js\").default} sources have 4 bands: red,\n * green, blue and alpha. {@link import(\"../source/DataTile.js\").default} sources can have any number\n * of bands, depending on the underlying data source and\n * {@link import(\"../source/GeoTIFF.js\").Options configuration}. `xOffset` and `yOffset` are optional\n * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels.\n * * `['get', 'attributeName', typeHint]` fetches a feature property value, similar to `feature.get('attributeName')`\n * A type hint can optionally be specified, in case the resulting expression contains a type ambiguity which\n * will make it invalid. Type hints can be one of: 'string', 'color', 'number', 'boolean', 'number[]'\n * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'\n * `Multi*` values are returned as their singular equivalent\n * `Circle` geometries are returned as 'Polygon'\n * `GeometryCollection` geometries are returned as the type of the first geometry found in the collection\n * * `['resolution']` returns the current resolution\n * * `['time']` returns the time in seconds since the creation of the layer\n * * `['var', 'varName']` fetches a value from the style variables; will throw an error if that variable is undefined\n * * `['zoom']` returns the current zoom level\n *\n * * Math operators:\n * * `['*', value1, value2, ...]` multiplies the values (either numbers or colors)\n * * `['/', value1, value2]` divides `value1` by `value2`\n * * `['+', value1, value2, ...]` adds the values\n * * `['-', value1, value2]` subtracts `value2` from `value1`\n * * `['clamp', value, low, high]` clamps `value` between `low` and `high`\n * * `['%', value1, value2]` returns the result of `value1 % value2` (modulo)\n * * `['^', value1, value2]` returns the value of `value1` raised to the `value2` power\n * * `['abs', value1]` returns the absolute value of `value1`\n * * `['floor', value1]` returns the nearest integer less than or equal to `value1`\n * * `['round', value1]` returns the nearest integer to `value1`\n * * `['ceil', value1]` returns the nearest integer greater than or equal to `value1`\n * * `['sin', value1]` returns the sine of `value1`\n * * `['cos', value1]` returns the cosine of `value1`\n * * `['atan', value1, value2]` returns `atan2(value1, value2)`. If `value2` is not provided, returns `atan(value1)`\n * * `['sqrt', value1]` returns the square root of `value1`\n *\n * * Transform operators:\n * * `['case', condition1, output1, ...conditionN, outputN, fallback]` selects the first output whose corresponding\n * condition evaluates to `true`. If no match is found, returns the `fallback` value.\n * All conditions should be `boolean`, output and fallback can be any kind.\n * * `['match', input, match1, output1, ...matchN, outputN, fallback]` compares the `input` value against all\n * provided `matchX` values, returning the output associated with the first valid match. If no match is found,\n * returns the `fallback` value.\n * `input` and `matchX` values must all be of the same type, and can be `number` or `string`. `outputX` and\n * `fallback` values must be of the same type, and can be of any kind.\n * * `['interpolate', interpolation, input, stop1, output1, ...stopN, outputN]` returns a value by interpolating between\n * pairs of inputs and outputs; `interpolation` can either be `['linear']` or `['exponential', base]` where `base` is\n * the rate of increase from stop A to stop B (i.e. power to which the interpolation ratio is raised); a value\n * of 1 is equivalent to `['linear']`.\n * `input` and `stopX` values must all be of type `number`. `outputX` values can be `number` or `color` values.\n * Note: `input` will be clamped between `stop1` and `stopN`, meaning that all output values will be comprised\n * between `output1` and `outputN`.\n *\n * * Logical operators:\n * * `['<', value1, value2]` returns `true` if `value1` is strictly lower than `value2`, or `false` otherwise.\n * * `['<=', value1, value2]` returns `true` if `value1` is lower than or equals `value2`, or `false` otherwise.\n * * `['>', value1, value2]` returns `true` if `value1` is strictly greater than `value2`, or `false` otherwise.\n * * `['>=', value1, value2]` returns `true` if `value1` is greater than or equals `value2`, or `false` otherwise.\n * * `['==', value1, value2]` returns `true` if `value1` equals `value2`, or `false` otherwise.\n * * `['!=', value1, value2]` returns `true` if `value1` does not equal `value2`, or `false` otherwise.\n * * `['!', value1]` returns `false` if `value1` is `true` or greater than `0`, or `true` otherwise.\n * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.\n * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.\n * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`\n * (inclusively), or `false` otherwise.\n * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and\n * `false` otherwise.\n * This operator has the following limitations:\n * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)\n * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an\n * expression. If `haystack` is an array of strings, use the `literal` operator to disambiguate from an expression:\n * `['literal', ['abc', 'def', 'ghi']]`\n *\n * * Conversion operators:\n * * `['array', value1, ...valueN]` creates a numerical array from `number` values; please note that the amount of\n * values can currently only be 2, 3 or 4.\n * * `['color', red, green, blue, alpha]` or `['color', shade, alpha]` creates a `color` value from `number` values;\n * the `alpha` parameter is optional; if not specified, it will be set to 1.\n * Note: `red`, `green` and `blue` or `shade` components must be values between 0 and 255; `alpha` between 0 and 1.\n * * `['palette', index, colors]` picks a `color` value from an array of colors using the given index; the `index`\n * expression must evaluate to a number; the items in the `colors` array must be strings with hex colors\n * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),\n * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b\n * in the 0-255 range and a in the 0-1 range).\n *\n * Values can either be literals or another operator, as they will be evaluated recursively.\n * Literal values can be of the following types:\n * * `boolean`\n * * `number`\n * * `number[]` (number arrays can only have a length of 2, 3 or 4)\n * * `string`\n * * {@link module:ol/color~Color}\n *\n * @typedef {Array<*>|import(\"../color.js\").Color|string|number|boolean} ExpressionValue\n * @api\n */\n\nlet numTypes = 0;\nexport const NoneType = 0;\nexport const BooleanType = 1 << numTypes++;\nexport const NumberType = 1 << numTypes++;\nexport const StringType = 1 << numTypes++;\nexport const ColorType = 1 << numTypes++;\nexport const NumberArrayType = 1 << numTypes++;\nexport const AnyType = Math.pow(2, numTypes) - 1;\n\nconst typeNames = {\n [BooleanType]: 'boolean',\n [NumberType]: 'number',\n [StringType]: 'string',\n [ColorType]: 'color',\n [NumberArrayType]: 'number[]',\n};\n\nconst namedTypes = Object.keys(typeNames).map(Number).sort(ascending);\n\n/**\n * Get a string representation for a type.\n * @param {number} type The type.\n * @return {string} The type name.\n */\nexport function typeName(type) {\n const names = [];\n for (const namedType of namedTypes) {\n if (includesType(type, namedType)) {\n names.push(typeNames[namedType]);\n }\n }\n if (names.length === 0) {\n return 'untyped';\n }\n if (names.length < 3) {\n return names.join(' or ');\n }\n return names.slice(0, -1).join(', ') + ', or ' + names[names.length - 1];\n}\n\n/**\n * @param {number} broad The broad type.\n * @param {number} specific The specific type.\n * @return {boolean} The broad type includes the specific type.\n */\nexport function includesType(broad, specific) {\n return (broad & specific) === specific;\n}\n\n/**\n * @param {number} oneType One type.\n * @param {number} otherType Another type.\n * @return {boolean} The set of types overlap (share a common specific type)\n */\nexport function overlapsType(oneType, otherType) {\n return !!(oneType & otherType);\n}\n\n/**\n * @param {number} type The type.\n * @param {number} expected The expected type.\n * @return {boolean} The given type is exactly the expected type.\n */\nexport function isType(type, expected) {\n return type === expected;\n}\n\n/**\n * @typedef {boolean|number|string|Array} LiteralValue\n */\n\nexport class LiteralExpression {\n /**\n * @param {number} type The value type.\n * @param {LiteralValue} value The literal value.\n */\n constructor(type, value) {\n this.type = type;\n this.value = value;\n }\n}\n\nexport class CallExpression {\n /**\n * @param {number} type The return type.\n * @param {string} operator The operator.\n * @param {...Expression} args The arguments.\n */\n constructor(type, operator, ...args) {\n this.type = type;\n this.operator = operator;\n this.args = args;\n }\n}\n\n/**\n * @typedef {LiteralExpression|CallExpression} Expression\n */\n\n/**\n * @typedef {Object} ParsingContext\n * @property {Set} variables Variables referenced with the 'var' operator.\n * @property {Set} properties Properties referenced with the 'get' operator.\n * @property {boolean} featureId The style uses the feature id.\n * @property {import(\"../style/flat.js\").FlatStyle|import(\"../style/webgl.js\").WebGLStyle} style The style being parsed\n */\n\n/**\n * @return {ParsingContext} A new parsing context.\n */\nexport function newParsingContext() {\n return {\n variables: new Set(),\n properties: new Set(),\n featureId: false,\n style: {},\n };\n}\n\n/**\n * @param {string} typeHint Type hint\n * @return {number} Resulting value type (will be a single type)\n */\nfunction getTypeFromHint(typeHint) {\n switch (typeHint) {\n case 'string':\n return StringType;\n case 'color':\n return ColorType;\n case 'number':\n return NumberType;\n case 'boolean':\n return BooleanType;\n case 'number[]':\n return NumberArrayType;\n default:\n throw new Error(`Unrecognized type hint: ${typeHint}`);\n }\n}\n\n/**\n * @typedef {LiteralValue|Array} EncodedExpression\n */\n\n/**\n * @param {EncodedExpression} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @param {number} [typeHint] Optional type hint\n * @return {Expression} The parsed expression result.\n */\nexport function parse(encoded, context, typeHint) {\n switch (typeof encoded) {\n case 'boolean': {\n return new LiteralExpression(BooleanType, encoded);\n }\n case 'number': {\n return new LiteralExpression(NumberType, encoded);\n }\n case 'string': {\n let type = StringType;\n if (isStringColor(encoded)) {\n type |= ColorType;\n }\n // apply the given type hint only if it won't result in an empty type\n if (!isType(type & typeHint, NoneType)) {\n type &= typeHint;\n }\n return new LiteralExpression(type, encoded);\n }\n default: {\n // pass\n }\n }\n\n if (!Array.isArray(encoded)) {\n throw new Error('Expression must be an array or a primitive value');\n }\n\n if (encoded.length === 0) {\n throw new Error('Empty expression');\n }\n\n if (typeof encoded[0] === 'string') {\n return parseCallExpression(encoded, context, typeHint);\n }\n\n for (const item of encoded) {\n if (typeof item !== 'number') {\n throw new Error('Expected an array of numbers');\n }\n }\n\n let type = NumberArrayType;\n if (encoded.length === 3 || encoded.length === 4) {\n type |= ColorType;\n }\n if (typeHint) {\n type &= typeHint;\n }\n return new LiteralExpression(type, encoded);\n}\n\n/**\n * @type {Object}\n */\nexport const Ops = {\n Get: 'get',\n Var: 'var',\n Concat: 'concat',\n GeometryType: 'geometry-type',\n Any: 'any',\n All: 'all',\n Not: '!',\n Resolution: 'resolution',\n Zoom: 'zoom',\n Time: 'time',\n Equal: '==',\n NotEqual: '!=',\n GreaterThan: '>',\n GreaterThanOrEqualTo: '>=',\n LessThan: '<',\n LessThanOrEqualTo: '<=',\n Multiply: '*',\n Divide: '/',\n Add: '+',\n Subtract: '-',\n Clamp: 'clamp',\n Mod: '%',\n Pow: '^',\n Abs: 'abs',\n Floor: 'floor',\n Ceil: 'ceil',\n Round: 'round',\n Sin: 'sin',\n Cos: 'cos',\n Atan: 'atan',\n Sqrt: 'sqrt',\n Match: 'match',\n Between: 'between',\n Interpolate: 'interpolate',\n Case: 'case',\n In: 'in',\n Number: 'number',\n String: 'string',\n Array: 'array',\n Color: 'color',\n Id: 'id',\n Band: 'band',\n Palette: 'palette',\n};\n\n/**\n * @typedef {function(Array, ParsingContext, number):Expression} Parser\n * Third argument is a type hint\n */\n\n/**\n * @type {Object}\n */\nconst parsers = {\n [Ops.Get]: createParser(\n ([_, typeHint]) => {\n if (typeHint !== undefined) {\n return getTypeFromHint(\n /** @type {string} */ (\n /** @type {LiteralExpression} */ (typeHint).value\n )\n );\n }\n return AnyType;\n },\n withArgsCount(1, 2),\n withGetArgs\n ),\n [Ops.Var]: createParser(\n ([firstArg]) => firstArg.type,\n withArgsCount(1, 1),\n withVarArgs\n ),\n [Ops.Id]: createParser(NumberType | StringType, withNoArgs, usesFeatureId),\n [Ops.Concat]: createParser(\n StringType,\n withArgsCount(2, Infinity),\n parseArgsOfType(AnyType)\n ),\n [Ops.GeometryType]: createParser(StringType, withNoArgs),\n [Ops.Resolution]: createParser(NumberType, withNoArgs),\n [Ops.Zoom]: createParser(NumberType, withNoArgs),\n [Ops.Time]: createParser(NumberType, withNoArgs),\n [Ops.Any]: createParser(\n BooleanType,\n withArgsCount(2, Infinity),\n parseArgsOfType(BooleanType)\n ),\n [Ops.All]: createParser(\n BooleanType,\n withArgsCount(2, Infinity),\n parseArgsOfType(BooleanType)\n ),\n [Ops.Not]: createParser(\n BooleanType,\n withArgsCount(1, 1),\n parseArgsOfType(BooleanType)\n ),\n [Ops.Equal]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.NotEqual]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.GreaterThan]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.GreaterThanOrEqualTo]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.LessThan]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.LessThanOrEqualTo]: createParser(\n BooleanType,\n withArgsCount(2, 2),\n parseArgsOfType(AnyType),\n narrowArgsType\n ),\n [Ops.Multiply]: createParser(\n (parsedArgs) => {\n let outputType = NumberType | ColorType;\n for (let i = 0; i < parsedArgs.length; i++) {\n outputType &= parsedArgs[i].type;\n }\n return outputType;\n },\n withArgsCount(2, Infinity),\n parseArgsOfType(NumberType | ColorType),\n narrowArgsType\n ),\n [Ops.Divide]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType)\n ),\n [Ops.Add]: createParser(\n NumberType,\n withArgsCount(2, Infinity),\n parseArgsOfType(NumberType)\n ),\n [Ops.Subtract]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType)\n ),\n [Ops.Clamp]: createParser(\n NumberType,\n withArgsCount(3, 3),\n parseArgsOfType(NumberType)\n ),\n [Ops.Mod]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType)\n ),\n [Ops.Pow]: createParser(\n NumberType,\n withArgsCount(2, 2),\n parseArgsOfType(NumberType)\n ),\n [Ops.Abs]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Floor]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Ceil]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Round]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Sin]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Cos]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Atan]: createParser(\n NumberType,\n withArgsCount(1, 2),\n parseArgsOfType(NumberType)\n ),\n [Ops.Sqrt]: createParser(\n NumberType,\n withArgsCount(1, 1),\n parseArgsOfType(NumberType)\n ),\n [Ops.Match]: createParser(\n (parsedArgs) => {\n let type = AnyType;\n for (let i = 2; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n type &= parsedArgs[parsedArgs.length - 1].type;\n return type;\n },\n withArgsCount(4, Infinity),\n withEvenArgs,\n parseMatchArgs\n ),\n [Ops.Between]: createParser(\n BooleanType,\n withArgsCount(3, 3),\n parseArgsOfType(NumberType)\n ),\n [Ops.Interpolate]: createParser(\n (parsedArgs) => {\n let type = ColorType | NumberType;\n for (let i = 3; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n return type;\n },\n withArgsCount(6, Infinity),\n withEvenArgs,\n parseInterpolateArgs\n ),\n [Ops.Case]: createParser(\n (parsedArgs) => {\n let type = AnyType;\n for (let i = 1; i < parsedArgs.length; i += 2) {\n type &= parsedArgs[i].type;\n }\n type &= parsedArgs[parsedArgs.length - 1].type;\n return type;\n },\n withArgsCount(3, Infinity),\n withOddArgs,\n parseCaseArgs\n ),\n [Ops.In]: createParser(BooleanType, withArgsCount(2, 2), parseInArgs),\n [Ops.Number]: createParser(\n NumberType,\n withArgsCount(1, Infinity),\n parseArgsOfType(AnyType)\n ),\n [Ops.String]: createParser(\n StringType,\n withArgsCount(1, Infinity),\n parseArgsOfType(AnyType)\n ),\n [Ops.Array]: createParser(\n (parsedArgs) => {\n return parsedArgs.length === 3 || parsedArgs.length === 4\n ? NumberArrayType | ColorType\n : NumberArrayType;\n },\n withArgsCount(1, Infinity),\n parseArgsOfType(NumberType)\n ),\n [Ops.Color]: createParser(\n ColorType,\n withArgsCount(1, 4),\n parseArgsOfType(NumberType)\n ),\n [Ops.Band]: createParser(\n NumberType,\n withArgsCount(1, 3),\n parseArgsOfType(NumberType)\n ),\n [Ops.Palette]: createParser(ColorType, withArgsCount(2, 2), parsePaletteArgs),\n};\n\n/**\n * @typedef {function(Array, ParsingContext, Array, number?):Array|void} ArgValidator\n * An argument validator applies various checks to an encoded expression arguments\n * Returns the parsed arguments if any.\n * Third argument is the array of parsed arguments from previous validators\n * Fourth argument is an optional type hint\n */\n\n/**\n * @type ArgValidator\n */\nfunction withGetArgs(encoded, context) {\n const arg = parse(encoded[1], context);\n if (!(arg instanceof LiteralExpression)) {\n throw new Error('Expected a literal argument for get operation');\n }\n if (typeof arg.value !== 'string') {\n throw new Error('Expected a string argument for get operation');\n }\n context.properties.add(arg.value);\n if (encoded.length === 3) {\n const hint = parse(encoded[2], context);\n return [arg, hint];\n }\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction withVarArgs(encoded, context, parsedArgs, typeHint) {\n const varName = encoded[1];\n if (typeof varName !== 'string') {\n throw new Error('Expected a string argument for var operation');\n }\n context.variables.add(varName);\n if (\n !('variables' in context.style) ||\n context.style.variables[varName] === undefined\n ) {\n return [new LiteralExpression(AnyType, varName)];\n }\n const initialValue = context.style.variables[varName];\n const arg = /** @type {LiteralExpression} */ (parse(initialValue, context));\n arg.value = varName;\n if (typeHint && !overlapsType(typeHint, arg.type)) {\n throw new Error(\n `The variable ${varName} has type ${typeName(\n arg.type\n )} but the following type was expected: ${typeName(typeHint)}`\n );\n }\n return [arg];\n}\n\n/**\n * @type ArgValidator\n */\nfunction usesFeatureId(encoded, context) {\n context.featureId = true;\n}\n\n/**\n * @type ArgValidator\n */\nfunction withNoArgs(encoded, context) {\n const operation = encoded[0];\n if (encoded.length !== 1) {\n throw new Error(`Expected no arguments for ${operation} operation`);\n }\n return [];\n}\n\n/**\n * @param {number} minArgs The minimum number of arguments.\n * @param {number} maxArgs The maximum number of arguments.\n * @return {ArgValidator} The argument validator\n */\nfunction withArgsCount(minArgs, maxArgs) {\n return function (encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (minArgs === maxArgs) {\n if (argCount !== minArgs) {\n const plural = minArgs === 1 ? '' : 's';\n throw new Error(\n `Expected ${minArgs} argument${plural} for ${operation}, got ${argCount}`\n );\n }\n } else if (argCount < minArgs || argCount > maxArgs) {\n const range =\n maxArgs === Infinity\n ? `${minArgs} or more`\n : `${minArgs} to ${maxArgs}`;\n throw new Error(\n `Expected ${range} arguments for ${operation}, got ${argCount}`\n );\n }\n };\n}\n\n/**\n * @param {number} argType The argument type.\n * @return {ArgValidator} The argument validator\n */\nfunction parseArgsOfType(argType) {\n return function (encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n /**\n * @type {Array}\n */\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n const expression = parse(encoded[i + 1], context);\n if (!overlapsType(argType, expression.type)) {\n const gotType = typeName(argType);\n const expectedType = typeName(expression.type);\n throw new Error(\n `Unexpected type for argument ${i} of ${operation} operation` +\n `, got ${gotType} but expected ${expectedType}`\n );\n }\n expression.type &= argType;\n args[i] = expression;\n }\n return args;\n };\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction narrowArgsType(encoded, context, parsedArgs) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n\n // first pass to determine a narrowed down type\n let sameType = AnyType;\n for (let i = 0; i < parsedArgs.length; ++i) {\n sameType &= parsedArgs[i].type;\n }\n\n if (sameType === NoneType) {\n throw new Error(\n `No common type could be found for arguments of ${operation} operation`\n );\n }\n\n // re-parse args\n const args = new Array(argCount);\n for (let i = 0; i < argCount; ++i) {\n args[i] = parse(encoded[i + 1], context, sameType);\n }\n return args;\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withOddArgs(encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 0) {\n throw new Error(\n `An odd amount of arguments was expected for operation ${operation}, got ${JSON.stringify(\n argCount\n )} instead`\n );\n }\n}\n\n/**\n * @type {ArgValidator}\n */\nfunction withEvenArgs(encoded, context) {\n const operation = encoded[0];\n const argCount = encoded.length - 1;\n if (argCount % 2 === 1) {\n throw new Error(\n `An even amount of arguments was expected for operation ${operation}, got ${JSON.stringify(\n argCount\n )} instead`\n );\n }\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseMatchArgs(encoded, context, parsedArgs, typeHint) {\n const argsCount = encoded.length - 1;\n\n const input = parse(encoded[1], context);\n let inputType = input.type;\n const fallback = parse(encoded[encoded.length - 1], context);\n let outputType =\n typeHint !== undefined ? typeHint & fallback.type : fallback.type;\n\n // first parse args to figure out possible types\n const args = new Array(argsCount - 2);\n for (let i = 0; i < argsCount - 2; i += 2) {\n const match = parse(encoded[i + 2], context);\n const output = parse(encoded[i + 3], context);\n inputType &= match.type;\n outputType &= output.type;\n args[i] = match;\n args[i + 1] = output;\n }\n\n // check input and output types validity\n const expectedInputType = StringType | NumberType | BooleanType;\n if (!overlapsType(expectedInputType, inputType)) {\n throw new Error(\n `Expected an input of type ${typeName(\n expectedInputType\n )} for the interpolate operation` + `, got ${typeName(inputType)} instead`\n );\n }\n if (isType(outputType, NoneType)) {\n throw new Error(\n `Could not find a common output type for the following match operation: ` +\n JSON.stringify(encoded)\n );\n }\n\n // parse again inputs and outputs with common type\n for (let i = 0; i < argsCount - 2; i += 2) {\n const match = parse(encoded[i + 2], context, inputType);\n const output = parse(encoded[i + 3], context, outputType);\n args[i] = match;\n args[i + 1] = output;\n }\n\n return [\n parse(encoded[1], context, inputType),\n ...args,\n parse(encoded[encoded.length - 1], context, outputType),\n ];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseInterpolateArgs(encoded, context, parsedArgs, typeHint) {\n const interpolationType = encoded[1];\n let interpolation;\n switch (interpolationType[0]) {\n case 'linear':\n interpolation = 1;\n break;\n case 'exponential':\n interpolation = interpolationType[1];\n if (typeof interpolation !== 'number') {\n throw new Error(\n `Expected a number base for exponential interpolation` +\n `, got ${JSON.stringify(interpolation)} instead`\n );\n }\n break;\n default:\n interpolation = null;\n }\n if (!interpolation) {\n throw new Error(\n `Invalid interpolation type: ${JSON.stringify(interpolationType)}`\n );\n }\n interpolation = parse(interpolation, context);\n\n // check input types\n let input = parse(encoded[2], context);\n if (!overlapsType(NumberType, input.type)) {\n throw new Error(\n `Expected an input of type number for the interpolate operation` +\n `, got ${typeName(input.type)} instead`\n );\n }\n input = parse(encoded[2], context, NumberType); // parse again with narrower output\n\n const args = new Array(encoded.length - 3);\n for (let i = 0; i < args.length; i += 2) {\n let stop = parse(encoded[i + 3], context);\n if (!overlapsType(NumberType, stop.type)) {\n throw new Error(\n `Expected all stop input values in the interpolate operation to be of type number` +\n `, got ${typeName(stop.type)} at position ${i + 2} instead`\n );\n }\n let output = parse(encoded[i + 4], context);\n if (!overlapsType(NumberType | ColorType, output.type)) {\n throw new Error(\n `Expected all stop output values in the interpolate operation to be a number or color` +\n `, got ${typeName(output.type)} at position ${i + 3} instead`\n );\n }\n // parse again with narrower types\n stop = parse(encoded[i + 3], context, NumberType);\n output = parse(encoded[i + 4], context, NumberType | ColorType);\n args[i] = stop;\n args[i + 1] = output;\n }\n\n return [interpolation, input, ...args];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseCaseArgs(encoded, context, parsedArgs, typeHint) {\n const fallback = parse(encoded[encoded.length - 1], context);\n let outputType =\n typeHint !== undefined ? typeHint & fallback.type : fallback.type;\n\n // first parse args to figure out possible types\n const args = new Array(encoded.length - 1);\n for (let i = 0; i < args.length - 1; i += 2) {\n const condition = parse(encoded[i + 1], context);\n const output = parse(encoded[i + 2], context);\n if (!overlapsType(BooleanType, condition.type)) {\n throw new Error(\n `Expected all conditions in the case operation to be of type boolean` +\n `, got ${typeName(condition.type)} at position ${i} instead`\n );\n }\n outputType &= output.type;\n args[i] = condition;\n args[i + 1] = output;\n }\n\n if (isType(outputType, NoneType)) {\n throw new Error(\n `Could not find a common output type for the following case operation: ` +\n JSON.stringify(encoded)\n );\n }\n\n // parse again args with common output type\n for (let i = 0; i < args.length - 1; i += 2) {\n args[i + 1] = parse(encoded[i + 2], context, outputType);\n }\n args[args.length - 1] = parse(\n encoded[encoded.length - 1],\n context,\n outputType\n );\n\n return args;\n}\n\n/**\n * @type ArgValidator\n */\nfunction parseInArgs(encoded, context) {\n /** @type {Array} */\n let haystack = /** @type {any} */ (encoded[2]);\n if (!Array.isArray(haystack)) {\n throw new Error(\n `The \"in\" operator was provided a literal value which was not an array as second argument.`\n );\n }\n if (typeof haystack[0] === 'string') {\n if (haystack[0] !== 'literal') {\n throw new Error(\n `For the \"in\" operator, a string array should be wrapped in a \"literal\" operator to disambiguate from expressions.`\n );\n }\n if (!Array.isArray(haystack[1])) {\n throw new Error(\n `The \"in\" operator was provided a literal value which was not an array as second argument.`\n );\n }\n haystack = haystack[1];\n }\n\n let needleType = StringType | NumberType;\n const args = new Array(haystack.length);\n for (let i = 0; i < args.length; i++) {\n const arg = parse(haystack[i], context);\n needleType &= arg.type;\n args[i] = arg;\n }\n if (isType(needleType, NoneType)) {\n throw new Error(\n `Could not find a common type for the following in operation: ` +\n JSON.stringify(encoded)\n );\n }\n\n const needle = parse(encoded[1], context, needleType);\n return [needle, ...args];\n}\n\n/**\n * @type ArgValidator\n */\nfunction parsePaletteArgs(encoded, context) {\n const index = parse(encoded[1], context, NumberType);\n if (index.type !== NumberType) {\n throw new Error(\n `The first argument of palette must be an number, got ${typeName(\n index.type\n )} instead`\n );\n }\n const colors = encoded[2];\n if (!Array.isArray(colors)) {\n throw new Error('The second argument of palette must be an array');\n }\n const parsedColors = new Array(colors.length);\n for (let i = 0; i < parsedColors.length; i++) {\n const color = parse(colors[i], context, ColorType);\n if (!(color instanceof LiteralExpression)) {\n throw new Error(\n `The palette color at index ${i} must be a literal value`\n );\n }\n if (!overlapsType(color.type, ColorType)) {\n throw new Error(\n `The palette color at index ${i} should be of type color, got ${typeName(\n color.type\n )} instead`\n );\n }\n parsedColors[i] = color;\n }\n return [index, ...parsedColors];\n}\n\n/**\n * @param {number|function(Array):number} returnType The return type of the operator; can be a fixed value or a callback taking the parsed\n * arguments\n * @param {Array} argValidators A chain of argument validators; the return value of the last validator\n * will be used as parsed arguments\n * @return {Parser} The parser.\n */\nfunction createParser(returnType, ...argValidators) {\n return function (encoded, context, typeHint) {\n const operator = encoded[0];\n let parsedArgs = [];\n for (let i = 0; i < argValidators.length; i++) {\n parsedArgs =\n argValidators[i](encoded, context, parsedArgs, typeHint) || parsedArgs;\n }\n let actualType =\n typeof returnType === 'function' ? returnType(parsedArgs) : returnType;\n if (typeHint !== undefined) {\n if (!overlapsType(actualType, typeHint)) {\n throw new Error(\n `The following expression was expected to return ${typeName(\n typeHint\n )}, but returns ${typeName(actualType)} instead: ${JSON.stringify(\n encoded\n )}`\n );\n }\n actualType &= typeHint;\n }\n if (actualType === NoneType) {\n throw new Error(\n `No matching type was found for the following expression: ${JSON.stringify(\n encoded\n )}`\n );\n }\n return new CallExpression(actualType, operator, ...parsedArgs);\n };\n}\n\n/**\n * @param {Array} encoded The encoded expression.\n * @param {ParsingContext} context The parsing context.\n * @param {number} [typeHint] Optional type hint\n * @return {Expression} The parsed expression.\n */\nfunction parseCallExpression(encoded, context, typeHint) {\n const operator = encoded[0];\n\n const parser = parsers[operator];\n if (!parser) {\n throw new Error(`Unknown operator: ${operator}`);\n }\n return parser(encoded, context, typeHint);\n}\n","/**\n * @module ol/webgl/PaletteTexture\n */\n\nclass PaletteTexture {\n /**\n * @param {string} name The name of the texture.\n * @param {Uint8Array} data The texture data.\n */\n constructor(name, data) {\n this.name = name;\n this.data = data;\n\n /**\n * @type {WebGLTexture|null}\n * @private\n */\n this.texture_ = null;\n }\n\n /**\n * @param {WebGLRenderingContext} gl Rendering context.\n * @return {WebGLTexture} The texture.\n */\n getTexture(gl) {\n if (!this.texture_) {\n const texture = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texImage2D(\n gl.TEXTURE_2D,\n 0,\n gl.RGBA,\n this.data.length / 4,\n 1,\n 0,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n this.data\n );\n this.texture_ = texture;\n }\n return this.texture_;\n }\n}\n\nexport default PaletteTexture;\n","/**\n * @module ol/expr/gpu\n */\nimport PaletteTexture from '../webgl/PaletteTexture.js';\nimport {\n BooleanType,\n CallExpression,\n ColorType,\n NoneType,\n NumberArrayType,\n NumberType,\n Ops,\n StringType,\n isType,\n overlapsType,\n parse,\n typeName,\n} from './expression.js';\nimport {Uniforms} from '../renderer/webgl/TileLayer.js';\nimport {asArray} from '../color.js';\n\n/**\n * @param {string} operator Operator\n * @param {CompilationContext} context Compilation context\n * @return {string} A function name based on the operator, unique in the given context\n */\nfunction computeOperatorFunctionName(operator, context) {\n return `operator_${operator}_${Object.keys(context.functions).length}`;\n}\n\n/**\n * Will return the number as a float with a dot separator, which is required by GLSL.\n * @param {number} v Numerical value.\n * @return {string} The value as string.\n */\nexport function numberToGlsl(v) {\n const s = v.toString();\n return s.includes('.') ? s : s + '.0';\n}\n\n/**\n * Will return the number array as a float with a dot separator, concatenated with ', '.\n * @param {Array} array Numerical values array.\n * @return {string} The array as a vector, e. g.: `vec3(1.0, 2.0, 3.0)`.\n */\nexport function arrayToGlsl(array) {\n if (array.length < 2 || array.length > 4) {\n throw new Error(\n '`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.'\n );\n }\n return `vec${array.length}(${array.map(numberToGlsl).join(', ')})`;\n}\n\n/**\n * Will normalize and converts to string a `vec4` color array compatible with GLSL.\n * @param {string|import(\"../color.js\").Color} color Color either in string format or [r, g, b, a] array format,\n * with RGB components in the 0..255 range and the alpha component in the 0..1 range.\n * Note that the final array will always have 4 components.\n * @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.\n */\nexport function colorToGlsl(color) {\n const array = asArray(color);\n const alpha = array.length > 3 ? array[3] : 1;\n // all components are premultiplied with alpha value\n return arrayToGlsl([\n (array[0] / 255) * alpha,\n (array[1] / 255) * alpha,\n (array[2] / 255) * alpha,\n alpha,\n ]);\n}\n\n/** @type {Object} */\nconst stringToFloatMap = {};\nlet stringToFloatCounter = 0;\n\n/**\n * Returns a stable equivalent number for the string literal.\n * @param {string} string String literal value\n * @return {number} Number equivalent\n */\nexport function getStringNumberEquivalent(string) {\n if (!(string in stringToFloatMap)) {\n stringToFloatMap[string] = stringToFloatCounter++;\n }\n return stringToFloatMap[string];\n}\n\n/**\n * Returns a stable equivalent number for the string literal, for use in shaders. This number is then\n * converted to be a GLSL-compatible string.\n * Note: with a float precision of `mediump`, the amount of unique strings supported is 16,777,216\n * @param {string} string String literal value\n * @return {string} GLSL-compatible string containing a number\n */\nexport function stringToGlsl(string) {\n return numberToGlsl(getStringNumberEquivalent(string));\n}\n\n/**\n * Get the uniform name given a variable name.\n * @param {string} variableName The variable name.\n * @return {string} The uniform name.\n */\nexport function uniformNameForVariable(variableName) {\n return 'u_var_' + variableName;\n}\n\n/**\n * @typedef {import('./expression.js').ParsingContext} ParsingContext\n */\n/**\n *\n * @typedef {import(\"./expression.js\").Expression} Expression\n */\n/**\n *\n * @typedef {import(\"./expression.js\").LiteralExpression} LiteralExpression\n */\n\n/**\n * @typedef {Object} CompilationContextProperty\n * @property {string} name Name\n * @property {number} type Resolved property type\n * @property {function(import(\"../Feature.js\").FeatureLike): *} [evaluator] Function used for evaluating the value;\n */\n\n/**\n * @typedef {Object} CompilationContextVariable\n * @property {string} name Name\n * @property {number} type Resolved variable type\n * @property {function(Object): *} [evaluator] Function used for evaluating the value; argument is the style variables object\n */\n\n/**\n * @typedef {Object} CompilationContext\n * @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader\n * @property {Object} properties The values for properties used in 'get' expressions.\n * @property {Object} variables The values for variables used in 'var' expressions.\n * @property {Object} functions Lookup of functions used by the style.\n * @property {number} [bandCount] Number of bands per pixel.\n * @property {Array} [paletteTextures] List of palettes used by the style.\n * @property {import(\"../style/webgl.js\").WebGLStyle} style Literal style.\n */\n\n/**\n * @return {CompilationContext} A new compilation context.\n */\nexport function newCompilationContext() {\n return {\n inFragmentShader: false,\n variables: {},\n properties: {},\n functions: {},\n bandCount: 0,\n style: {},\n };\n}\n\nconst GET_BAND_VALUE_FUNC = 'getBandValue';\n\nexport const PALETTE_TEXTURE_ARRAY = 'u_paletteTextures';\n\n/**\n * @typedef {string} CompiledExpression\n */\n\n/**\n * @typedef {function(CompilationContext, CallExpression, number): string} Compiler\n * Third argument is the expected value types\n */\n\n/**\n * @param {import('./expression.js').EncodedExpression} encoded The encoded expression.\n * @param {number} type The expected type.\n * @param {import('./expression.js').ParsingContext} parsingContext The parsing context.\n * @param {CompilationContext} compilationContext An existing compilation context\n * @return {CompiledExpression} The compiled expression.\n */\nexport function buildExpression(\n encoded,\n type,\n parsingContext,\n compilationContext\n) {\n const expression = parse(encoded, parsingContext, type);\n if (isType(expression.type, NoneType)) {\n throw new Error(`No matching type was found`);\n }\n if (!overlapsType(type, expression.type)) {\n const expected = typeName(type);\n const actual = typeName(expression.type);\n throw new Error(\n `Expected expression to be of type ${expected}, got ${actual}`\n );\n }\n return compile(expression, type, compilationContext);\n}\n\n/**\n * @param {function(Array, CompilationContext): string} output Function that takes in parsed arguments and returns a string\n * @return {function(CompilationContext, import(\"./expression.js\").CallExpression, number): string} Compiler for the call expression\n */\nfunction createCompiler(output) {\n return (context, expression, type) => {\n const length = expression.args.length;\n const args = new Array(length);\n for (let i = 0; i < length; ++i) {\n args[i] = compile(expression.args[i], type, context);\n }\n return output(args, context);\n };\n}\n\n/**\n * @type {Object}\n */\nconst compilers = {\n [Ops.Get]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const propName = /** @type {string} */ (firstArg.value);\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: expression.type,\n };\n }\n const prefix = context.inFragmentShader ? 'v_prop_' : 'a_prop_';\n return prefix + propName;\n },\n [Ops.GeometryType]: (context, expression, type) => {\n const propName = 'geometryType';\n const computeType = (geometry) => {\n const type = geometry.getType();\n switch (type) {\n case 'Point':\n case 'LineString':\n case 'Polygon':\n return type;\n case 'MultiPoint':\n case 'MultiLineString':\n case 'MultiPolygon':\n return type.substring(5);\n case 'Circle':\n return 'Polygon';\n case 'GeometryCollection':\n return computeType(geometry.getGeometries()[0]);\n default:\n }\n };\n const isExisting = propName in context.properties;\n if (!isExisting) {\n context.properties[propName] = {\n name: propName,\n type: StringType,\n evaluator: (feature) => {\n return computeType(feature.getGeometry());\n },\n };\n }\n const prefix = context.inFragmentShader ? 'v_prop_' : 'a_prop_';\n return prefix + propName;\n },\n [Ops.Var]: (context, expression) => {\n const firstArg = /** @type {LiteralExpression} */ (expression.args[0]);\n const varName = /** @type {string} */ (firstArg.value);\n const isExisting = varName in context.variables;\n if (!isExisting) {\n context.variables[varName] = {\n name: varName,\n type: expression.type,\n };\n }\n return uniformNameForVariable(varName);\n },\n [Ops.Resolution]: () => 'u_resolution',\n [Ops.Zoom]: () => 'u_zoom',\n [Ops.Time]: () => 'u_time',\n [Ops.Any]: createCompiler((compiledArgs) => `(${compiledArgs.join(` || `)})`),\n [Ops.All]: createCompiler((compiledArgs) => `(${compiledArgs.join(` && `)})`),\n [Ops.Not]: createCompiler(([value]) => `(!${value})`),\n [Ops.Equal]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} == ${secondValue})`\n ),\n [Ops.NotEqual]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} != ${secondValue})`\n ),\n [Ops.GreaterThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} > ${secondValue})`\n ),\n [Ops.GreaterThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} >= ${secondValue})`\n ),\n [Ops.LessThan]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} < ${secondValue})`\n ),\n [Ops.LessThanOrEqualTo]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} <= ${secondValue})`\n ),\n [Ops.Multiply]: createCompiler(\n (compiledArgs) => `(${compiledArgs.join(' * ')})`\n ),\n [Ops.Divide]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} / ${secondValue})`\n ),\n [Ops.Add]: createCompiler((compiledArgs) => `(${compiledArgs.join(' + ')})`),\n [Ops.Subtract]: createCompiler(\n ([firstValue, secondValue]) => `(${firstValue} - ${secondValue})`\n ),\n [Ops.Clamp]: createCompiler(\n ([value, min, max]) => `clamp(${value}, ${min}, ${max})`\n ),\n [Ops.Mod]: createCompiler(([value, modulo]) => `mod(${value}, ${modulo})`),\n [Ops.Pow]: createCompiler(([value, power]) => `pow(${value}, ${power})`),\n [Ops.Abs]: createCompiler(([value]) => `abs(${value})`),\n [Ops.Floor]: createCompiler(([value]) => `floor(${value})`),\n [Ops.Ceil]: createCompiler(([value]) => `ceil(${value})`),\n [Ops.Round]: createCompiler(([value]) => `floor(${value} + 0.5)`),\n [Ops.Sin]: createCompiler(([value]) => `sin(${value})`),\n [Ops.Cos]: createCompiler(([value]) => `cos(${value})`),\n [Ops.Atan]: createCompiler(([firstValue, secondValue]) => {\n return secondValue !== undefined\n ? `atan(${firstValue}, ${secondValue})`\n : `atan(${firstValue})`;\n }),\n [Ops.Sqrt]: createCompiler(([value]) => `sqrt(${value})`),\n [Ops.Match]: createCompiler((compiledArgs) => {\n const input = compiledArgs[0];\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 1; i -= 2) {\n const match = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${input} == ${match} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.Between]: createCompiler(\n ([value, min, max]) => `(${value} >= ${min} && ${value} <= ${max})`\n ),\n [Ops.Interpolate]: createCompiler(([exponent, input, ...compiledArgs]) => {\n let result = '';\n for (let i = 0; i < compiledArgs.length - 2; i += 2) {\n const stop1 = compiledArgs[i];\n const output1 = result || compiledArgs[i + 1];\n const stop2 = compiledArgs[i + 2];\n const output2 = compiledArgs[i + 3];\n let ratio;\n if (exponent === numberToGlsl(1)) {\n ratio = `(${input} - ${stop1}) / (${stop2} - ${stop1})`;\n } else {\n ratio = `(pow(${exponent}, (${input} - ${stop1})) - 1.0) / (pow(${exponent}, (${stop2} - ${stop1})) - 1.0)`;\n }\n result = `mix(${output1}, ${output2}, clamp(${ratio}, 0.0, 1.0))`;\n }\n return result;\n }),\n [Ops.Case]: createCompiler((compiledArgs) => {\n const fallback = compiledArgs[compiledArgs.length - 1];\n let result = null;\n for (let i = compiledArgs.length - 3; i >= 0; i -= 2) {\n const condition = compiledArgs[i];\n const output = compiledArgs[i + 1];\n result = `(${condition} ? ${output} : ${result || fallback})`;\n }\n return result;\n }),\n [Ops.In]: createCompiler(([needle, ...haystack], context) => {\n const funcName = computeOperatorFunctionName('in', context);\n const tests = [];\n for (let i = 0; i < haystack.length; i += 1) {\n tests.push(` if (inputValue == ${haystack[i]}) { return true; }`);\n }\n context.functions[funcName] = `bool ${funcName}(float inputValue) {\n${tests.join('\\n')}\n return false;\n}`;\n return `${funcName}(${needle})`;\n }),\n [Ops.Array]: createCompiler(\n (args) => `vec${args.length}(${args.join(', ')})`\n ),\n [Ops.Color]: createCompiler((compiledArgs) => {\n if (compiledArgs.length === 1) {\n //grayscale\n return `vec4(vec3(${compiledArgs[0]} / 255.0), 1.0)`;\n }\n if (compiledArgs.length === 2) {\n //grayscale with alpha\n return `(${compiledArgs[1]} * vec4(vec3(${compiledArgs[0]} / 255.0), 1.0))`;\n }\n const rgb = compiledArgs.slice(0, 3).map((color) => `${color} / 255.0`);\n if (compiledArgs.length === 3) {\n return `vec4(${rgb.join(', ')}, 1.0)`;\n }\n const alpha = compiledArgs[3];\n return `(${alpha} * vec4(${rgb.join(', ')}, 1.0))`;\n }),\n [Ops.Band]: createCompiler(([band, xOffset, yOffset], context) => {\n if (!(GET_BAND_VALUE_FUNC in context.functions)) {\n let ifBlocks = '';\n const bandCount = context.bandCount || 1;\n for (let i = 0; i < bandCount; i++) {\n const colorIndex = Math.floor(i / 4);\n let bandIndex = i % 4;\n if (i === bandCount - 1 && bandIndex === 1) {\n // LUMINANCE_ALPHA - band 1 assigned to rgb and band 2 assigned to alpha\n bandIndex = 3;\n }\n const textureName = `${Uniforms.TILE_TEXTURE_ARRAY}[${colorIndex}]`;\n ifBlocks += ` if (band == ${i + 1}.0) {\n return texture2D(${textureName}, v_textureCoord + vec2(dx, dy))[${bandIndex}];\n }\n`;\n }\n\n context.functions[\n GET_BAND_VALUE_FUNC\n ] = `float getBandValue(float band, float xOffset, float yOffset) {\n float dx = xOffset / ${Uniforms.TEXTURE_PIXEL_WIDTH};\n float dy = yOffset / ${Uniforms.TEXTURE_PIXEL_HEIGHT};\n${ifBlocks}\n}`;\n }\n\n return `${GET_BAND_VALUE_FUNC}(${band}, ${xOffset ?? '0.0'}, ${\n yOffset ?? '0.0'\n })`;\n }),\n [Ops.Palette]: (context, expression) => {\n const [index, ...colors] = expression.args;\n const numColors = colors.length;\n const palette = new Uint8Array(numColors * 4);\n for (let i = 0; i < colors.length; i++) {\n const parsedValue = /** @type {string | Array} */ (\n /** @type {LiteralExpression} */ (colors[i]).value\n );\n const color = asArray(parsedValue);\n const offset = i * 4;\n palette[offset] = color[0];\n palette[offset + 1] = color[1];\n palette[offset + 2] = color[2];\n palette[offset + 3] = color[3] * 255;\n }\n if (!context.paletteTextures) {\n context.paletteTextures = [];\n }\n const paletteName = `${PALETTE_TEXTURE_ARRAY}[${context.paletteTextures.length}]`;\n const paletteTexture = new PaletteTexture(paletteName, palette);\n context.paletteTextures.push(paletteTexture);\n const compiledIndex = compile(index, NumberType, context);\n return `texture2D(${paletteName}, vec2((${compiledIndex} + 0.5) / ${numColors}.0, 0.5))`;\n },\n // TODO: unimplemented\n // Ops.Number\n // Ops.String\n // Ops.Concat\n};\n\n/**\n * @param {Expression} expression The expression.\n * @param {number} returnType The expected return type.\n * @param {CompilationContext} context The compilation context.\n * @return {CompiledExpression} The compiled expression\n */\nfunction compile(expression, returnType, context) {\n // operator\n if (expression instanceof CallExpression) {\n const compiler = compilers[expression.operator];\n if (compiler === undefined) {\n throw new Error(\n `No compiler defined for this operator: ${JSON.stringify(\n expression.operator\n )}`\n );\n }\n return compiler(context, expression, returnType);\n }\n\n if ((expression.type & NumberType) > 0) {\n return numberToGlsl(/** @type {number} */ (expression.value));\n }\n\n if ((expression.type & BooleanType) > 0) {\n return expression.value.toString();\n }\n\n if ((expression.type & StringType) > 0) {\n return stringToGlsl(expression.value.toString());\n }\n\n if ((expression.type & ColorType) > 0) {\n return colorToGlsl(\n /** @type {Array | string} */ (expression.value)\n );\n }\n\n if ((expression.type & NumberArrayType) > 0) {\n return arrayToGlsl(/** @type {Array} */ (expression.value));\n }\n\n throw new Error(\n `Unexpected expression ${expression.value} (expected type ${typeName(\n returnType\n )})`\n );\n}\n","/**\n * @module ol/extent\n */\nimport Relationship from './extent/Relationship.js';\n\n/**\n * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`.\n * @typedef {Array} Extent\n * @api\n */\n\n/**\n * Extent corner.\n * @typedef {'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'} Corner\n */\n\n/**\n * Build an extent that includes all given coordinates.\n *\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Bounding extent.\n * @api\n */\nexport function boundingExtent(coordinates) {\n const extent = createEmpty();\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Array} xs Xs.\n * @param {Array} ys Ys.\n * @param {Extent} [dest] Destination extent.\n * @private\n * @return {Extent} Extent.\n */\nfunction _boundingExtentXYs(xs, ys, dest) {\n const minX = Math.min.apply(null, xs);\n const minY = Math.min.apply(null, ys);\n const maxX = Math.max.apply(null, xs);\n const maxY = Math.max.apply(null, ys);\n return createOrUpdate(minX, minY, maxX, maxY, dest);\n}\n\n/**\n * Return extent increased by the provided value.\n * @param {Extent} extent Extent.\n * @param {number} value The amount by which the extent should be buffered.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n * @api\n */\nexport function buffer(extent, value, dest) {\n if (dest) {\n dest[0] = extent[0] - value;\n dest[1] = extent[1] - value;\n dest[2] = extent[2] + value;\n dest[3] = extent[3] + value;\n return dest;\n }\n return [\n extent[0] - value,\n extent[1] - value,\n extent[2] + value,\n extent[3] + value,\n ];\n}\n\n/**\n * Creates a clone of an extent.\n *\n * @param {Extent} extent Extent to clone.\n * @param {Extent} [dest] Extent.\n * @return {Extent} The clone.\n */\nexport function clone(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent.slice();\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n * @return {number} Closest squared distance.\n */\nexport function closestSquaredDistanceXY(extent, x, y) {\n let dx, dy;\n if (x < extent[0]) {\n dx = extent[0] - x;\n } else if (extent[2] < x) {\n dx = x - extent[2];\n } else {\n dx = 0;\n }\n if (y < extent[1]) {\n dy = extent[1] - y;\n } else if (extent[3] < y) {\n dy = y - extent[3];\n } else {\n dy = 0;\n }\n return dx * dx + dy * dy;\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @return {boolean} The coordinate is contained in the extent.\n * @api\n */\nexport function containsCoordinate(extent, coordinate) {\n return containsXY(extent, coordinate[0], coordinate[1]);\n}\n\n/**\n * Check if one extent contains another.\n *\n * An extent is deemed contained if it lies completely within the other extent,\n * including if they share one or more edges.\n *\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The second extent is contained by or on the edge of the\n * first.\n * @api\n */\nexport function containsExtent(extent1, extent2) {\n return (\n extent1[0] <= extent2[0] &&\n extent2[2] <= extent1[2] &&\n extent1[1] <= extent2[1] &&\n extent2[3] <= extent1[3]\n );\n}\n\n/**\n * Check if the passed coordinate is contained or on the edge of the extent.\n *\n * @param {Extent} extent Extent.\n * @param {number} x X coordinate.\n * @param {number} y Y coordinate.\n * @return {boolean} The x, y values are contained in the extent.\n * @api\n */\nexport function containsXY(extent, x, y) {\n return extent[0] <= x && x <= extent[2] && extent[1] <= y && y <= extent[3];\n}\n\n/**\n * Get the relationship between a coordinate and extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"./extent/Relationship.js\").default} The relationship (bitwise compare with\n * import(\"./extent/Relationship.js\").Relationship).\n */\nexport function coordinateRelationship(extent, coordinate) {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const x = coordinate[0];\n const y = coordinate[1];\n let relationship = Relationship.UNKNOWN;\n if (x < minX) {\n relationship = relationship | Relationship.LEFT;\n } else if (x > maxX) {\n relationship = relationship | Relationship.RIGHT;\n }\n if (y < minY) {\n relationship = relationship | Relationship.BELOW;\n } else if (y > maxY) {\n relationship = relationship | Relationship.ABOVE;\n }\n if (relationship === Relationship.UNKNOWN) {\n relationship = Relationship.INTERSECTING;\n }\n return relationship;\n}\n\n/**\n * Create an empty extent.\n * @return {Extent} Empty extent.\n * @api\n */\nexport function createEmpty() {\n return [Infinity, Infinity, -Infinity, -Infinity];\n}\n\n/**\n * Create a new extent or update the provided extent.\n * @param {number} minX Minimum X.\n * @param {number} minY Minimum Y.\n * @param {number} maxX Maximum X.\n * @param {number} maxY Maximum Y.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdate(minX, minY, maxX, maxY, dest) {\n if (dest) {\n dest[0] = minX;\n dest[1] = minY;\n dest[2] = maxX;\n dest[3] = maxY;\n return dest;\n }\n return [minX, minY, maxX, maxY];\n}\n\n/**\n * Create a new empty extent or make the provided one empty.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateEmpty(dest) {\n return createOrUpdate(Infinity, Infinity, -Infinity, -Infinity, dest);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinate(coordinate, dest) {\n const x = coordinate[0];\n const y = coordinate[1];\n return createOrUpdate(x, y, x, y, dest);\n}\n\n/**\n * @param {Array} coordinates Coordinates.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromCoordinates(coordinates, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendCoordinates(extent, coordinates);\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromFlatCoordinates(\n flatCoordinates,\n offset,\n end,\n stride,\n dest\n) {\n const extent = createOrUpdateEmpty(dest);\n return extendFlatCoordinates(extent, flatCoordinates, offset, end, stride);\n}\n\n/**\n * @param {Array>} rings Rings.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function createOrUpdateFromRings(rings, dest) {\n const extent = createOrUpdateEmpty(dest);\n return extendRings(extent, rings);\n}\n\n/**\n * Determine if two extents are equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {boolean} The two extents are equivalent.\n * @api\n */\nexport function equals(extent1, extent2) {\n return (\n extent1[0] == extent2[0] &&\n extent1[2] == extent2[2] &&\n extent1[1] == extent2[1] &&\n extent1[3] == extent2[3]\n );\n}\n\n/**\n * Determine if two extents are approximately equivalent.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {number} tolerance Tolerance in extent coordinate units.\n * @return {boolean} The two extents differ by less than the tolerance.\n */\nexport function approximatelyEquals(extent1, extent2, tolerance) {\n return (\n Math.abs(extent1[0] - extent2[0]) < tolerance &&\n Math.abs(extent1[2] - extent2[2]) < tolerance &&\n Math.abs(extent1[1] - extent2[1]) < tolerance &&\n Math.abs(extent1[3] - extent2[3]) < tolerance\n );\n}\n\n/**\n * Modify an extent to include another extent.\n * @param {Extent} extent1 The extent to be modified.\n * @param {Extent} extent2 The extent that will be included in the first.\n * @return {Extent} A reference to the first (extended) extent.\n * @api\n */\nexport function extend(extent1, extent2) {\n if (extent2[0] < extent1[0]) {\n extent1[0] = extent2[0];\n }\n if (extent2[2] > extent1[2]) {\n extent1[2] = extent2[2];\n }\n if (extent2[1] < extent1[1]) {\n extent1[1] = extent2[1];\n }\n if (extent2[3] > extent1[3]) {\n extent1[3] = extent2[3];\n }\n return extent1;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {import(\"./coordinate.js\").Coordinate} coordinate Coordinate.\n */\nexport function extendCoordinate(extent, coordinate) {\n if (coordinate[0] < extent[0]) {\n extent[0] = coordinate[0];\n }\n if (coordinate[0] > extent[2]) {\n extent[2] = coordinate[0];\n }\n if (coordinate[1] < extent[1]) {\n extent[1] = coordinate[1];\n }\n if (coordinate[1] > extent[3]) {\n extent[3] = coordinate[1];\n }\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} coordinates Coordinates.\n * @return {Extent} Extent.\n */\nexport function extendCoordinates(extent, coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n extendCoordinate(extent, coordinates[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {number} offset Offset.\n * @param {number} end End.\n * @param {number} stride Stride.\n * @return {Extent} Extent.\n */\nexport function extendFlatCoordinates(\n extent,\n flatCoordinates,\n offset,\n end,\n stride\n) {\n for (; offset < end; offset += stride) {\n extendXY(extent, flatCoordinates[offset], flatCoordinates[offset + 1]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Array>} rings Rings.\n * @return {Extent} Extent.\n */\nexport function extendRings(extent, rings) {\n for (let i = 0, ii = rings.length; i < ii; ++i) {\n extendCoordinates(extent, rings[i]);\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} x X.\n * @param {number} y Y.\n */\nexport function extendXY(extent, x, y) {\n extent[0] = Math.min(extent[0], x);\n extent[1] = Math.min(extent[1], y);\n extent[2] = Math.max(extent[2], x);\n extent[3] = Math.max(extent[3], y);\n}\n\n/**\n * This function calls `callback` for each corner of the extent. If the\n * callback returns a truthy value the function returns that value\n * immediately. Otherwise the function returns `false`.\n * @param {Extent} extent Extent.\n * @param {function(import(\"./coordinate.js\").Coordinate): S} callback Callback.\n * @return {S|boolean} Value.\n * @template S\n */\nexport function forEachCorner(extent, callback) {\n let val;\n val = callback(getBottomLeft(extent));\n if (val) {\n return val;\n }\n val = callback(getBottomRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopRight(extent));\n if (val) {\n return val;\n }\n val = callback(getTopLeft(extent));\n if (val) {\n return val;\n }\n return false;\n}\n\n/**\n * Get the size of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Area.\n * @api\n */\nexport function getArea(extent) {\n let area = 0;\n if (!isEmpty(extent)) {\n area = getWidth(extent) * getHeight(extent);\n }\n return area;\n}\n\n/**\n * Get the bottom left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom left coordinate.\n * @api\n */\nexport function getBottomLeft(extent) {\n return [extent[0], extent[1]];\n}\n\n/**\n * Get the bottom right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Bottom right coordinate.\n * @api\n */\nexport function getBottomRight(extent) {\n return [extent[2], extent[1]];\n}\n\n/**\n * Get the center coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Center.\n * @api\n */\nexport function getCenter(extent) {\n return [(extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2];\n}\n\n/**\n * Get a corner coordinate of an extent.\n * @param {Extent} extent Extent.\n * @param {Corner} corner Corner.\n * @return {import(\"./coordinate.js\").Coordinate} Corner coordinate.\n */\nexport function getCorner(extent, corner) {\n let coordinate;\n if (corner === 'bottom-left') {\n coordinate = getBottomLeft(extent);\n } else if (corner === 'bottom-right') {\n coordinate = getBottomRight(extent);\n } else if (corner === 'top-left') {\n coordinate = getTopLeft(extent);\n } else if (corner === 'top-right') {\n coordinate = getTopRight(extent);\n } else {\n throw new Error('Invalid corner');\n }\n return coordinate;\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Enlarged area.\n */\nexport function getEnlargedArea(extent1, extent2) {\n const minX = Math.min(extent1[0], extent2[0]);\n const minY = Math.min(extent1[1], extent2[1]);\n const maxX = Math.max(extent1[2], extent2[2]);\n const maxY = Math.max(extent1[3], extent2[3]);\n return (maxX - minX) * (maxY - minY);\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @param {Extent} [dest] Destination extent.\n * @return {Extent} Extent.\n */\nexport function getForViewAndSize(center, resolution, rotation, size, dest) {\n const [x0, y0, x1, y1, x2, y2, x3, y3] = getRotatedViewport(\n center,\n resolution,\n rotation,\n size\n );\n return createOrUpdate(\n Math.min(x0, x1, x2, x3),\n Math.min(y0, y1, y2, y3),\n Math.max(x0, x1, x2, x3),\n Math.max(y0, y1, y2, y3),\n dest\n );\n}\n\n/**\n * @param {import(\"./coordinate.js\").Coordinate} center Center.\n * @param {number} resolution Resolution.\n * @param {number} rotation Rotation.\n * @param {import(\"./size.js\").Size} size Size.\n * @return {Array} Linear ring representing the viewport.\n */\nexport function getRotatedViewport(center, resolution, rotation, size) {\n const dx = (resolution * size[0]) / 2;\n const dy = (resolution * size[1]) / 2;\n const cosRotation = Math.cos(rotation);\n const sinRotation = Math.sin(rotation);\n const xCos = dx * cosRotation;\n const xSin = dx * sinRotation;\n const yCos = dy * cosRotation;\n const ySin = dy * sinRotation;\n const x = center[0];\n const y = center[1];\n return [\n x - xCos + ySin,\n y - xSin - yCos,\n x - xCos - ySin,\n y - xSin + yCos,\n x + xCos - ySin,\n y + xSin + yCos,\n x + xCos + ySin,\n y + xSin - yCos,\n x - xCos + ySin,\n y - xSin - yCos,\n ];\n}\n\n/**\n * Get the height of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Height.\n * @api\n */\nexport function getHeight(extent) {\n return extent[3] - extent[1];\n}\n\n/**\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @return {number} Intersection area.\n */\nexport function getIntersectionArea(extent1, extent2) {\n const intersection = getIntersection(extent1, extent2);\n return getArea(intersection);\n}\n\n/**\n * Get the intersection of two extents.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent 2.\n * @param {Extent} [dest] Optional extent to populate with intersection.\n * @return {Extent} Intersecting extent.\n * @api\n */\nexport function getIntersection(extent1, extent2, dest) {\n const intersection = dest ? dest : createEmpty();\n if (intersects(extent1, extent2)) {\n if (extent1[0] > extent2[0]) {\n intersection[0] = extent1[0];\n } else {\n intersection[0] = extent2[0];\n }\n if (extent1[1] > extent2[1]) {\n intersection[1] = extent1[1];\n } else {\n intersection[1] = extent2[1];\n }\n if (extent1[2] < extent2[2]) {\n intersection[2] = extent1[2];\n } else {\n intersection[2] = extent2[2];\n }\n if (extent1[3] < extent2[3]) {\n intersection[3] = extent1[3];\n } else {\n intersection[3] = extent2[3];\n }\n } else {\n createOrUpdateEmpty(intersection);\n }\n return intersection;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @return {number} Margin.\n */\nexport function getMargin(extent) {\n return getWidth(extent) + getHeight(extent);\n}\n\n/**\n * Get the size (width, height) of an extent.\n * @param {Extent} extent The extent.\n * @return {import(\"./size.js\").Size} The extent size.\n * @api\n */\nexport function getSize(extent) {\n return [extent[2] - extent[0], extent[3] - extent[1]];\n}\n\n/**\n * Get the top left coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top left coordinate.\n * @api\n */\nexport function getTopLeft(extent) {\n return [extent[0], extent[3]];\n}\n\n/**\n * Get the top right coordinate of an extent.\n * @param {Extent} extent Extent.\n * @return {import(\"./coordinate.js\").Coordinate} Top right coordinate.\n * @api\n */\nexport function getTopRight(extent) {\n return [extent[2], extent[3]];\n}\n\n/**\n * Get the width of an extent.\n * @param {Extent} extent Extent.\n * @return {number} Width.\n * @api\n */\nexport function getWidth(extent) {\n return extent[2] - extent[0];\n}\n\n/**\n * Determine if one extent intersects another.\n * @param {Extent} extent1 Extent 1.\n * @param {Extent} extent2 Extent.\n * @return {boolean} The two extents intersect.\n * @api\n */\nexport function intersects(extent1, extent2) {\n return (\n extent1[0] <= extent2[2] &&\n extent1[2] >= extent2[0] &&\n extent1[1] <= extent2[3] &&\n extent1[3] >= extent2[1]\n );\n}\n\n/**\n * Determine if an extent is empty.\n * @param {Extent} extent Extent.\n * @return {boolean} Is empty.\n * @api\n */\nexport function isEmpty(extent) {\n return extent[2] < extent[0] || extent[3] < extent[1];\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {Extent} [dest] Extent.\n * @return {Extent} Extent.\n */\nexport function returnOrUpdate(extent, dest) {\n if (dest) {\n dest[0] = extent[0];\n dest[1] = extent[1];\n dest[2] = extent[2];\n dest[3] = extent[3];\n return dest;\n }\n return extent;\n}\n\n/**\n * @param {Extent} extent Extent.\n * @param {number} value Value.\n */\nexport function scaleFromCenter(extent, value) {\n const deltaX = ((extent[2] - extent[0]) / 2) * (value - 1);\n const deltaY = ((extent[3] - extent[1]) / 2) * (value - 1);\n extent[0] -= deltaX;\n extent[2] += deltaX;\n extent[1] -= deltaY;\n extent[3] += deltaY;\n}\n\n/**\n * Determine if the segment between two coordinates intersects (crosses,\n * touches, or is contained by) the provided extent.\n * @param {Extent} extent The extent.\n * @param {import(\"./coordinate.js\").Coordinate} start Segment start coordinate.\n * @param {import(\"./coordinate.js\").Coordinate} end Segment end coordinate.\n * @return {boolean} The segment intersects the extent.\n */\nexport function intersectsSegment(extent, start, end) {\n let intersects = false;\n const startRel = coordinateRelationship(extent, start);\n const endRel = coordinateRelationship(extent, end);\n if (\n startRel === Relationship.INTERSECTING ||\n endRel === Relationship.INTERSECTING\n ) {\n intersects = true;\n } else {\n const minX = extent[0];\n const minY = extent[1];\n const maxX = extent[2];\n const maxY = extent[3];\n const startX = start[0];\n const startY = start[1];\n const endX = end[0];\n const endY = end[1];\n const slope = (endY - startY) / (endX - startX);\n let x, y;\n if (!!(endRel & Relationship.ABOVE) && !(startRel & Relationship.ABOVE)) {\n // potentially intersects top\n x = endX - (endY - maxY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.RIGHT) &&\n !(startRel & Relationship.RIGHT)\n ) {\n // potentially intersects right\n y = endY - (endX - maxX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.BELOW) &&\n !(startRel & Relationship.BELOW)\n ) {\n // potentially intersects bottom\n x = endX - (endY - minY) / slope;\n intersects = x >= minX && x <= maxX;\n }\n if (\n !intersects &&\n !!(endRel & Relationship.LEFT) &&\n !(startRel & Relationship.LEFT)\n ) {\n // potentially intersects left\n y = endY - (endX - minX) * slope;\n intersects = y >= minY && y <= maxY;\n }\n }\n return intersects;\n}\n\n/**\n * Apply a transform function to the extent.\n * @param {Extent} extent Extent.\n * @param {import(\"./proj.js\").TransformFunction} transformFn Transform function.\n * Called with `[minX, minY, maxX, maxY]` extent coordinates.\n * @param {Extent} [dest] Destination extent.\n * @param {number} [stops] Number of stops per side used for the transform.\n * By default only the corners are used.\n * @return {Extent} Extent.\n * @api\n */\nexport function applyTransform(extent, transformFn, dest, stops) {\n if (isEmpty(extent)) {\n return createOrUpdateEmpty(dest);\n }\n let coordinates = [];\n if (stops > 1) {\n const width = extent[2] - extent[0];\n const height = extent[3] - extent[1];\n for (let i = 0; i < stops; ++i) {\n coordinates.push(\n extent[0] + (width * i) / stops,\n extent[1],\n extent[2],\n extent[1] + (height * i) / stops,\n extent[2] - (width * i) / stops,\n extent[3],\n extent[0],\n extent[3] - (height * i) / stops\n );\n }\n } else {\n coordinates = [\n extent[0],\n extent[1],\n extent[2],\n extent[1],\n extent[2],\n extent[3],\n extent[0],\n extent[3],\n ];\n }\n transformFn(coordinates, coordinates, 2);\n const xs = [];\n const ys = [];\n for (let i = 0, l = coordinates.length; i < l; i += 2) {\n xs.push(coordinates[i]);\n ys.push(coordinates[i + 1]);\n }\n return _boundingExtentXYs(xs, ys, dest);\n}\n\n/**\n * Modifies the provided extent in-place to be within the real world\n * extent.\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Extent} The extent within the real world extent.\n */\nexport function wrapX(extent, projection) {\n const projectionExtent = projection.getExtent();\n const center = getCenter(extent);\n if (\n projection.canWrapX() &&\n (center[0] < projectionExtent[0] || center[0] >= projectionExtent[2])\n ) {\n const worldWidth = getWidth(projectionExtent);\n const worldsAway = Math.floor(\n (center[0] - projectionExtent[0]) / worldWidth\n );\n const offset = worldsAway * worldWidth;\n extent[0] -= offset;\n extent[2] -= offset;\n }\n return extent;\n}\n\n/**\n * Fits the extent to the real world\n *\n * If the extent does not cross the anti meridian, this will return the extent in an array\n * If the extent crosses the anti meridian, the extent will be sliced, so each part fits within the\n * real world\n *\n *\n * @param {Extent} extent Extent.\n * @param {import(\"./proj/Projection.js\").default} projection Projection\n * @return {Array} The extent within the real world extent.\n */\nexport function wrapAndSliceX(extent, projection) {\n if (projection.canWrapX()) {\n const projectionExtent = projection.getExtent();\n\n if (!isFinite(extent[0]) || !isFinite(extent[2])) {\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n\n wrapX(extent, projection);\n const worldWidth = getWidth(projectionExtent);\n\n if (getWidth(extent) > worldWidth) {\n // the extent wraps around on itself\n return [[projectionExtent[0], extent[1], projectionExtent[2], extent[3]]];\n }\n if (extent[0] < projectionExtent[0]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0] + worldWidth, extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2], extent[3]],\n ];\n }\n if (extent[2] > projectionExtent[2]) {\n // the extent crosses the anti meridian, so it needs to be sliced\n return [\n [extent[0], extent[1], projectionExtent[2], extent[3]],\n [projectionExtent[0], extent[1], extent[2] - worldWidth, extent[3]],\n ];\n }\n }\n\n return [extent];\n}\n","/**\n * @module ol/extent/Relationship\n */\n\n/**\n * Relationship to an extent.\n * @enum {number}\n */\nexport default {\n UNKNOWN: 0,\n INTERSECTING: 1,\n ABOVE: 2,\n RIGHT: 4,\n BELOW: 8,\n LEFT: 16,\n};\n","/**\n * @module ol/featureloader\n */\nimport {VOID} from './functions.js';\n\n/**\n *\n * @type {boolean}\n * @private\n */\nlet withCredentials = false;\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * load features.\n *\n * This function takes up to 5 arguments. These are an {@link module:ol/extent~Extent} representing\n * the area to be loaded, a `{number}` representing the resolution (map units per pixel), an\n * {@link module:ol/proj/Projection~Projection} for the projection, an optional success callback that should get\n * the loaded features passed as an argument and an optional failure callback with no arguments. If\n * the callbacks are not used, the corresponding vector source will not fire `'featuresloadend'` and\n * `'featuresloaderror'` events. `this` within the function is bound to the\n * {@link module:ol/source/Vector~VectorSource} it's called from.\n *\n * The function is responsible for loading the features and adding them to the\n * source.\n * @typedef {function(this:(import(\"./source/Vector\").default|import(\"./VectorTile.js\").default),\n * import(\"./extent.js\").Extent,\n * number,\n * import(\"./proj/Projection.js\").default,\n * function(Array): void=,\n * function(): void=): void} FeatureLoader\n * @api\n */\n\n/**\n * {@link module:ol/source/Vector~VectorSource} sources use a function of this type to\n * get the url to load features from.\n *\n * This function takes an {@link module:ol/extent~Extent} representing the area\n * to be loaded, a `{number}` representing the resolution (map units per pixel)\n * and an {@link module:ol/proj/Projection~Projection} for the projection as\n * arguments and returns a `{string}` representing the URL.\n * @typedef {function(import(\"./extent.js\").Extent, number, import(\"./proj/Projection.js\").default): string} FeatureUrlFunction\n * @api\n */\n\n/**\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array, import(\"./proj/Projection.js\").default): void} success Success\n * Function called with the loaded features and optionally with the data projection.\n * @param {function(): void} failure Failure\n * Function called when loading failed.\n */\nexport function loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n success,\n failure\n) {\n const xhr = new XMLHttpRequest();\n xhr.open(\n 'GET',\n typeof url === 'function' ? url(extent, resolution, projection) : url,\n true\n );\n if (format.getType() == 'arraybuffer') {\n xhr.responseType = 'arraybuffer';\n }\n xhr.withCredentials = withCredentials;\n /**\n * @param {Event} event Event.\n * @private\n */\n xhr.onload = function (event) {\n // status will be 0 for file:// urls\n if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {\n const type = format.getType();\n /** @type {Document|Node|Object|string|undefined} */\n let source;\n if (type == 'json') {\n source = JSON.parse(xhr.responseText);\n } else if (type == 'text') {\n source = xhr.responseText;\n } else if (type == 'xml') {\n source = xhr.responseXML;\n if (!source) {\n source = new DOMParser().parseFromString(\n xhr.responseText,\n 'application/xml'\n );\n }\n } else if (type == 'arraybuffer') {\n source = /** @type {ArrayBuffer} */ (xhr.response);\n }\n if (source) {\n success(\n /** @type {Array} */\n (\n format.readFeatures(source, {\n extent: extent,\n featureProjection: projection,\n })\n ),\n format.readProjection(source)\n );\n } else {\n failure();\n }\n } else {\n failure();\n }\n };\n /**\n * @private\n */\n xhr.onerror = failure;\n xhr.send();\n}\n\n/**\n * Create an XHR feature loader for a `url` and `format`. The feature loader\n * loads features (with XHR), parses the features, and adds them to the\n * vector source.\n * @param {string|FeatureUrlFunction} url Feature URL service.\n * @param {import(\"./format/Feature.js\").default} format Feature format.\n * @return {FeatureLoader} The feature loader.\n * @api\n */\nexport function xhr(url, format) {\n /**\n * @param {import(\"./extent.js\").Extent} extent Extent.\n * @param {number} resolution Resolution.\n * @param {import(\"./proj/Projection.js\").default} projection Projection.\n * @param {function(Array): void} [success] Success\n * Function called when loading succeeded.\n * @param {function(): void} [failure] Failure\n * Function called when loading failed.\n */\n return function (extent, resolution, projection, success, failure) {\n const source = /** @type {import(\"./source/Vector\").default} */ (this);\n loadFeaturesXhr(\n url,\n format,\n extent,\n resolution,\n projection,\n /**\n * @param {Array} features The loaded features.\n * @param {import(\"./proj/Projection.js\").default} dataProjection Data\n * projection.\n */\n function (features, dataProjection) {\n source.addFeatures(features);\n if (success !== undefined) {\n success(features);\n }\n },\n /* FIXME handle error */ failure ? failure : VOID\n );\n };\n}\n\n/**\n * Setter for the withCredentials configuration for the XHR.\n *\n * @param {boolean} xhrWithCredentials The value of withCredentials to set.\n * Compare https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/\n * @api\n */\nexport function setWithCredentials(xhrWithCredentials) {\n withCredentials = xhrWithCredentials;\n}\n","/**\n * @module ol/format/EsriJSON\n */\nimport Feature from '../Feature.js';\nimport JSONFeature from './JSONFeature.js';\nimport LineString from '../geom/LineString.js';\nimport LinearRing from '../geom/LinearRing.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport {containsExtent} from '../extent.js';\nimport {deflateCoordinates} from '../geom/flat/deflate.js';\nimport {get as getProjection} from '../proj.js';\nimport {isEmpty} from '../obj.js';\nimport {linearRingIsClockwise} from '../geom/flat/orient.js';\nimport {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @typedef {import(\"arcgis-rest-api\").Feature} EsriJSONFeature\n * @typedef {import(\"arcgis-rest-api\").FeatureSet} EsriJSONFeatureSet\n * @typedef {import(\"arcgis-rest-api\").Geometry} EsriJSONGeometry\n * @typedef {import(\"arcgis-rest-api\").Point} EsriJSONPoint\n * @typedef {import(\"arcgis-rest-api\").Polyline} EsriJSONPolyline\n * @typedef {import(\"arcgis-rest-api\").Polygon} EsriJSONPolygon\n * @typedef {import(\"arcgis-rest-api\").Multipoint} EsriJSONMultipoint\n * @typedef {import(\"arcgis-rest-api\").HasZM} EsriJSONHasZM\n * @typedef {import(\"arcgis-rest-api\").Position} EsriJSONPosition\n * @typedef {import(\"arcgis-rest-api\").SpatialReferenceWkid} EsriJSONSpatialReferenceWkid\n */\n\n/**\n * @typedef {Object} EsriJSONMultiPolygon\n * @property {Array>>>} rings Rings for the MultiPolygon.\n * @property {boolean} [hasM] If the polygon coordinates have an M value.\n * @property {boolean} [hasZ] If the polygon coordinates have a Z value.\n * @property {EsriJSONSpatialReferenceWkid} [spatialReference] The coordinate reference system.\n */\n\n/**\n * @const\n * @type {Object}\n */\nconst GEOMETRY_READERS = {\n Point: readPointGeometry,\n LineString: readLineStringGeometry,\n Polygon: readPolygonGeometry,\n MultiPoint: readMultiPointGeometry,\n MultiLineString: readMultiLineStringGeometry,\n MultiPolygon: readMultiPolygonGeometry,\n};\n\n/**\n * @const\n * @type {Object}\n */\nconst GEOMETRY_WRITERS = {\n Point: writePointGeometry,\n LineString: writeLineStringGeometry,\n Polygon: writePolygonGeometry,\n MultiPoint: writeMultiPointGeometry,\n MultiLineString: writeMultiLineStringGeometry,\n MultiPolygon: writeMultiPolygonGeometry,\n};\n\n/**\n * @typedef {Object} Options\n * @property {string} [geometryName] Geometry name to use when creating features.\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the EsriJSON format.\n *\n * @api\n */\nclass EsriJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super();\n\n /**\n * Name of the geometry attribute for features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @param {string} [idField] Name of the field where to get the id from.\n * @protected\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromObject(object, options, idField) {\n const esriJSONFeature = /** @type {EsriJSONFeature} */ (object);\n const geometry = readGeometry(esriJSONFeature.geometry, options);\n const feature = new Feature();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n }\n feature.setGeometry(geometry);\n if (esriJSONFeature.attributes) {\n feature.setProperties(esriJSONFeature.attributes, true);\n const id = esriJSONFeature.attributes[idField];\n if (id !== undefined) {\n feature.setId(/** @type {number} */ (id));\n }\n }\n return feature;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n options = options ? options : {};\n if (object['features']) {\n const esriJSONFeatureSet = /** @type {EsriJSONFeatureSet} */ (object);\n /** @type {Array} */\n const features = [];\n const esriJSONFeatures = esriJSONFeatureSet.features;\n for (let i = 0, ii = esriJSONFeatures.length; i < ii; ++i) {\n features.push(\n this.readFeatureFromObject(\n esriJSONFeatures[i],\n options,\n object.objectIdFieldName\n )\n );\n }\n return features;\n }\n return [this.readFeatureFromObject(object, options)];\n }\n\n /**\n * @param {EsriJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return readGeometry(object, options);\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n if (\n object['spatialReference'] &&\n object['spatialReference']['wkid'] !== undefined\n ) {\n const spatialReference = /** @type {EsriJSONSpatialReferenceWkid} */ (\n object['spatialReference']\n );\n const crs = spatialReference.wkid;\n return getProjection('EPSG:' + crs);\n }\n return null;\n }\n\n /**\n * Encode a geometry as a EsriJSON object.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONGeometry} Object.\n * @api\n */\n writeGeometryObject(geometry, options) {\n return writeGeometry(geometry, this.adaptOptions(options));\n }\n\n /**\n * Encode a feature as a esriJSON Feature object.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n * @api\n */\n writeFeatureObject(feature, options) {\n options = this.adaptOptions(options);\n const object = {};\n if (!feature.hasProperties()) {\n object['attributes'] = {};\n return object;\n }\n const properties = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry) {\n object['geometry'] = writeGeometry(geometry, options);\n const projection =\n options && (options.dataProjection || options.featureProjection);\n if (projection) {\n object['geometry']['spatialReference'] =\n /** @type {EsriJSONSpatialReferenceWkid} */ ({\n wkid: Number(getProjection(projection).getCode().split(':').pop()),\n });\n }\n delete properties[feature.getGeometryName()];\n }\n if (!isEmpty(properties)) {\n object['attributes'] = properties;\n } else {\n object['attributes'] = {};\n }\n return object;\n }\n\n /**\n * Encode an array of features as a EsriJSON object.\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONFeatureSet} EsriJSON Object.\n * @api\n */\n writeFeaturesObject(features, options) {\n options = this.adaptOptions(options);\n const objects = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n objects.push(this.writeFeatureObject(features[i], options));\n }\n return {\n 'features': objects,\n };\n }\n}\n\n/**\n * @param {EsriJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readGeometry(object, options) {\n if (!object) {\n return null;\n }\n /** @type {import(\"../geom/Geometry.js\").Type} */\n let type;\n if (typeof object['x'] === 'number' && typeof object['y'] === 'number') {\n type = 'Point';\n } else if (object['points']) {\n type = 'MultiPoint';\n } else if (object['paths']) {\n const esriJSONPolyline = /** @type {EsriJSONPolyline} */ (object);\n if (esriJSONPolyline.paths.length === 1) {\n type = 'LineString';\n } else {\n type = 'MultiLineString';\n }\n } else if (object['rings']) {\n const esriJSONPolygon = /** @type {EsriJSONPolygon} */ (object);\n const layout = getGeometryLayout(esriJSONPolygon);\n const rings = convertRings(esriJSONPolygon.rings, layout);\n if (rings.length === 1) {\n type = 'Polygon';\n object = Object.assign({}, object, {['rings']: rings[0]});\n } else {\n type = 'MultiPolygon';\n object = Object.assign({}, object, {['rings']: rings});\n }\n }\n const geometryReader = GEOMETRY_READERS[type];\n return transformGeometryWithOptions(geometryReader(object), false, options);\n}\n\n/**\n * Determines inner and outer rings.\n * Checks if any polygons in this array contain any other polygons in this\n * array. It is used for checking for holes.\n * Logic inspired by: https://github.com/Esri/terraformer-arcgis-parser\n * @param {Array>>} rings Rings.\n * @param {import(\"../geom/Geometry.js\").GeometryLayout} layout Geometry layout.\n * @return {Array>>>} Transformed rings.\n */\nfunction convertRings(rings, layout) {\n const flatRing = [];\n const outerRings = [];\n const holes = [];\n let i, ii;\n for (i = 0, ii = rings.length; i < ii; ++i) {\n flatRing.length = 0;\n deflateCoordinates(flatRing, 0, rings[i], layout.length);\n // is this ring an outer ring? is it clockwise?\n const clockwise = linearRingIsClockwise(\n flatRing,\n 0,\n flatRing.length,\n layout.length\n );\n if (clockwise) {\n outerRings.push([rings[i]]);\n } else {\n holes.push(rings[i]);\n }\n }\n while (holes.length) {\n const hole = holes.shift();\n let matched = false;\n // loop over all outer rings and see if they contain our hole.\n for (i = outerRings.length - 1; i >= 0; i--) {\n const outerRing = outerRings[i][0];\n const containsHole = containsExtent(\n new LinearRing(outerRing).getExtent(),\n new LinearRing(hole).getExtent()\n );\n if (containsHole) {\n // the hole is contained push it into our polygon\n outerRings[i].push(hole);\n matched = true;\n break;\n }\n }\n if (!matched) {\n // no outer rings contain this hole turn it into and outer\n // ring (reverse it)\n outerRings.push([hole.reverse()]);\n }\n }\n return outerRings;\n}\n\n/**\n * @param {EsriJSONPoint} object Object.\n * @return {import(\"../geom/Geometry.js\").default} Point.\n */\nfunction readPointGeometry(object) {\n let point;\n if (object.m !== undefined && object.z !== undefined) {\n point = new Point([object.x, object.y, object.z, object.m], 'XYZM');\n } else if (object.z !== undefined) {\n point = new Point([object.x, object.y, object.z], 'XYZ');\n } else if (object.m !== undefined) {\n point = new Point([object.x, object.y, object.m], 'XYM');\n } else {\n point = new Point([object.x, object.y]);\n }\n return point;\n}\n\n/**\n * @param {EsriJSONPolyline} object Object.\n * @return {import(\"../geom/Geometry.js\").default} LineString.\n */\nfunction readLineStringGeometry(object) {\n const layout = getGeometryLayout(object);\n return new LineString(object.paths[0], layout);\n}\n\n/**\n * @param {EsriJSONPolyline} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiLineString.\n */\nfunction readMultiLineStringGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiLineString(object.paths, layout);\n}\n\n/**\n * @param {EsriJSONHasZM} object Object.\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} The geometry layout to use.\n */\nfunction getGeometryLayout(object) {\n /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */\n let layout = 'XY';\n if (object.hasZ === true && object.hasM === true) {\n layout = 'XYZM';\n } else if (object.hasZ === true) {\n layout = 'XYZ';\n } else if (object.hasM === true) {\n layout = 'XYM';\n }\n return layout;\n}\n\n/**\n * @param {EsriJSONMultipoint} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiPoint.\n */\nfunction readMultiPointGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiPoint(object.points, layout);\n}\n\n/**\n * @param {EsriJSONMultiPolygon} object Object.\n * @return {import(\"../geom/Geometry.js\").default} MultiPolygon.\n */\nfunction readMultiPolygonGeometry(object) {\n const layout = getGeometryLayout(object);\n return new MultiPolygon(object.rings, layout);\n}\n\n/**\n * @param {EsriJSONPolygon} object Object.\n * @return {import(\"../geom/Geometry.js\").default} Polygon.\n */\nfunction readPolygonGeometry(object) {\n const layout = getGeometryLayout(object);\n return new Polygon(object.rings, layout);\n}\n\n/**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPoint} EsriJSON geometry.\n */\nfunction writePointGeometry(geometry, options) {\n const coordinates = geometry.getCoordinates();\n /** @type {EsriJSONPoint} */\n let esriJSON;\n const layout = geometry.getLayout();\n if (layout === 'XYZ') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n z: coordinates[2],\n };\n } else if (layout === 'XYM') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n m: coordinates[2],\n };\n } else if (layout === 'XYZM') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n z: coordinates[2],\n m: coordinates[3],\n };\n } else if (layout === 'XY') {\n esriJSON = {\n x: coordinates[0],\n y: coordinates[1],\n };\n } else {\n throw new Error('Invalid geometry layout');\n }\n return esriJSON;\n}\n\n/**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @return {Object} Object with boolean hasZ and hasM keys.\n */\nfunction getHasZM(geometry) {\n const layout = geometry.getLayout();\n return {\n hasZ: layout === 'XYZ' || layout === 'XYZM',\n hasM: layout === 'XYM' || layout === 'XYZM',\n };\n}\n\n/**\n * @param {import(\"../geom/LineString.js\").default} lineString Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolyline} EsriJSON geometry.\n */\nfunction writeLineStringGeometry(lineString, options) {\n const hasZM = getHasZM(lineString);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n paths: [\n /** @type {Array} */ (lineString.getCoordinates()),\n ],\n };\n}\n\n/**\n * @param {import(\"../geom/Polygon.js\").default} polygon Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolygon} EsriJSON geometry.\n */\nfunction writePolygonGeometry(polygon, options) {\n // Esri geometries use the left-hand rule\n const hasZM = getHasZM(polygon);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n rings: /** @type {Array>} */ (\n polygon.getCoordinates(false)\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiLineString.js\").default} multiLineString Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolyline} EsriJSON geometry.\n */\nfunction writeMultiLineStringGeometry(multiLineString, options) {\n const hasZM = getHasZM(multiLineString);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n paths: /** @type {Array>} */ (\n multiLineString.getCoordinates()\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPoint.js\").default} multiPoint Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONMultipoint} EsriJSON geometry.\n */\nfunction writeMultiPointGeometry(multiPoint, options) {\n const hasZM = getHasZM(multiPoint);\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n points: /** @type {Array} */ (\n multiPoint.getCoordinates()\n ),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONPolygon} EsriJSON geometry.\n */\nfunction writeMultiPolygonGeometry(geometry, options) {\n const hasZM = getHasZM(geometry);\n const coordinates = geometry.getCoordinates(false);\n const output = [];\n for (let i = 0; i < coordinates.length; i++) {\n for (let x = coordinates[i].length - 1; x >= 0; x--) {\n output.push(coordinates[i][x]);\n }\n }\n return {\n hasZ: hasZM.hasZ,\n hasM: hasZM.hasM,\n rings: /** @type {Array>} */ (output),\n };\n}\n\n/**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {EsriJSONGeometry} EsriJSON geometry.\n */\nfunction writeGeometry(geometry, options) {\n const geometryWriter = GEOMETRY_WRITERS[geometry.getType()];\n return geometryWriter(\n transformGeometryWithOptions(geometry, true, options),\n options\n );\n}\n\nexport default EsriJSON;\n","/**\n * @module ol/format/Feature\n */\nimport Feature from '../Feature.js';\nimport RenderFeature from '../render/Feature.js';\nimport {\n GeometryCollection,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from '../geom.js';\nimport {abstract} from '../util.js';\nimport {\n equivalent as equivalentProjection,\n get as getProjection,\n getTransform,\n transformExtent,\n} from '../proj.js';\nimport {\n linearRingsAreOriented,\n linearRingssAreOriented,\n orientLinearRings,\n orientLinearRingsArray,\n} from '../geom/flat/orient.js';\n\n/**\n * @typedef {Object} ReadOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are reading.\n * If not provided, the projection will be derived from the data (where possible) or\n * the `dataProjection` of the format is assigned (where set). If the projection\n * can not be derived from the data and if no `dataProjection` is set for a format,\n * the features will not be reprojected.\n * @property {import(\"../extent.js\").Extent} [extent] Tile extent in map units of the tile being read.\n * This is only required when reading data with tile pixels as geometry units. When configured,\n * a `dataProjection` with `TILE_PIXELS` as `units` and the tile's pixel extent as `extent` needs to be\n * provided.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * created by the format reader. If not provided, features will be returned in the\n * `dataProjection`.\n */\n\n/**\n * @typedef {Object} WriteOptions\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection] Projection of the data we are writing.\n * If not provided, the `dataProjection` of the format is assigned (where set).\n * If no `dataProjection` is set for a format, the features will be returned\n * in the `featureProjection`.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection of the feature geometries\n * that will be serialized by the format writer. If not provided, geometries are assumed\n * to be in the `dataProjection` if that is set; in other words, they are not transformed.\n * @property {boolean} [rightHanded] When writing geometries, follow the right-hand\n * rule for linear ring orientation. This means that polygons will have counter-clockwise\n * exterior rings and clockwise interior rings. By default, coordinates are serialized\n * as they are provided at construction. If `true`, the right-hand rule will\n * be applied. If `false`, the left-hand rule will be applied (clockwise for\n * exterior and counter-clockwise for interior rings). Note that not all\n * formats support this. The GeoJSON format does use this property when writing\n * geometries.\n * @property {number} [decimals] Maximum number of decimal places for coordinates.\n * Coordinates are stored internally as floats, but floating-point arithmetic can create\n * coordinates with a large number of decimal places, not generally wanted on output.\n * Set a number here to round coordinates. Can also be used to ensure that\n * coordinates read in can be written back out with the same number of decimals.\n * Default is no rounding.\n */\n\n/**\n * @typedef {'arraybuffer' | 'json' | 'text' | 'xml'} Type\n */\n\n/**\n * @typedef {Object} SimpleGeometryObject\n * @property {import('../geom/Geometry.js').Type} type Type.\n * @property {Array} flatCoordinates Flat coordinates.\n * @property {Array|Array>} [ends] Ends or endss.\n * @property {import('../geom/Geometry.js').GeometryLayout} [layout] Layout.\n */\n\n/**\n * @typedef {Array} GeometryCollectionObject\n */\n\n/**\n * @typedef {SimpleGeometryObject|GeometryCollectionObject} GeometryObject\n */\n\n/**\n * @typedef {Object} FeatureObject\n * @property {string|number} [id] Id.\n * @property {GeometryObject} [geometry] Geometry.\n * @property {Object} [properties] Properties.\n */\n\n/***\n * @template {import(\"../Feature.js\").FeatureClass} T\n * @typedef {T extends typeof import(\"../render/Feature.js\").default ? import(\"../render/Feature.js\").default : import(\"../Feature.js\").default} FeatureOrRenderFeature\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for feature formats.\n * {@link module:ol/format/Feature~FeatureFormat} subclasses provide the ability to decode and encode\n * {@link module:ol/Feature~Feature} objects from a variety of commonly used geospatial\n * file formats. See the documentation for each format for more details.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof import('../Feature.js').default]\n * @abstract\n * @api\n */\nclass FeatureFormat {\n constructor() {\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.dataProjection = undefined;\n\n /**\n * @protected\n * @type {import(\"../proj/Projection.js\").default|undefined}\n */\n this.defaultFeatureProjection = undefined;\n\n /**\n * @protected\n * @type {import(\"../Feature.js\").FeatureClass}\n */\n this.featureClass = Feature;\n\n /**\n * A list media types supported by the format in descending order of preference.\n * @type {Array}\n */\n this.supportedMediaTypes = null;\n }\n\n /**\n * Adds the data projection to the read options.\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Options.\n * @return {ReadOptions|undefined} Options.\n * @protected\n */\n getReadOptions(source, options) {\n if (options) {\n let dataProjection = options.dataProjection\n ? getProjection(options.dataProjection)\n : this.readProjection(source);\n if (\n options.extent &&\n dataProjection &&\n dataProjection.getUnits() === 'tile-pixels'\n ) {\n dataProjection = getProjection(dataProjection);\n dataProjection.setWorldExtent(options.extent);\n }\n options = {\n dataProjection: dataProjection,\n featureProjection: options.featureProjection,\n };\n }\n return this.adaptOptions(options);\n }\n\n /**\n * Sets the `dataProjection` on the options, if no `dataProjection`\n * is set.\n * @param {WriteOptions|ReadOptions|undefined} options\n * Options.\n * @protected\n * @return {WriteOptions|ReadOptions|undefined}\n * Updated options.\n */\n adaptOptions(options) {\n return Object.assign(\n {\n dataProjection: this.dataProjection,\n featureProjection: this.defaultFeatureProjection,\n featureClass: this.featureClass,\n },\n options\n );\n }\n\n /**\n * @abstract\n * @return {Type} The format type.\n */\n getType() {\n return abstract();\n }\n\n /**\n * Read a single feature from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").FeatureLike|Array} Feature.\n */\n readFeature(source, options) {\n return abstract();\n }\n\n /**\n * Read all features from a source.\n *\n * @abstract\n * @param {Document|Element|ArrayBuffer|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {Array>} Features.\n */\n readFeatures(source, options) {\n return abstract();\n }\n\n /**\n * Read a single geometry from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometry(source, options) {\n return abstract();\n }\n\n /**\n * Read the projection from a source.\n *\n * @abstract\n * @param {Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default|undefined} Projection.\n */\n readProjection(source) {\n return abstract();\n }\n\n /**\n * Encode a feature in this format.\n *\n * @abstract\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeature(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features in this format.\n *\n * @abstract\n * @param {Array} features Features.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeFeatures(features, options) {\n return abstract();\n }\n\n /**\n * Write a single geometry in this format.\n *\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {WriteOptions} [options] Write options.\n * @return {string|ArrayBuffer} Result.\n */\n writeGeometry(geometry, options) {\n return abstract();\n }\n}\n\nexport default FeatureFormat;\n\n/**\n * @template {import(\"../geom/Geometry.js\").default|RenderFeature} T\n * @param {T} geometry Geometry.\n * @param {boolean} write Set to true for writing, false for reading.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {T} Transformed geometry.\n */\nexport function transformGeometryWithOptions(geometry, write, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n let transformed = geometry;\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n if (write) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n const fromProjection = write ? featureProjection : dataProjection;\n const toProjection = write ? dataProjection : featureProjection;\n if (fromProjection.getUnits() === 'tile-pixels') {\n transformed.transform(fromProjection, toProjection);\n } else {\n transformed.applyTransform(getTransform(fromProjection, toProjection));\n }\n }\n if (\n write &&\n options &&\n /** @type {WriteOptions} */ (options).decimals !== undefined\n ) {\n const power = Math.pow(10, /** @type {WriteOptions} */ (options).decimals);\n // if decimals option on write, round each coordinate appropriately\n /**\n * @param {Array} coordinates Coordinates.\n * @return {Array} Transformed coordinates.\n */\n const transform = function (coordinates) {\n for (let i = 0, ii = coordinates.length; i < ii; ++i) {\n coordinates[i] = Math.round(coordinates[i] * power) / power;\n }\n return coordinates;\n };\n if (transformed === geometry) {\n transformed = /** @type {T} */ (geometry.clone());\n }\n transformed.applyTransform(transform);\n }\n return transformed;\n}\n\n/**\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {ReadOptions} [options] Read options.\n * @return {import(\"../extent.js\").Extent} Transformed extent.\n */\nexport function transformExtentWithOptions(extent, options) {\n const featureProjection = options\n ? getProjection(options.featureProjection)\n : null;\n const dataProjection = options ? getProjection(options.dataProjection) : null;\n\n if (\n featureProjection &&\n dataProjection &&\n !equivalentProjection(featureProjection, dataProjection)\n ) {\n return transformExtent(extent, dataProjection, featureProjection);\n }\n return extent;\n}\n\nconst GeometryConstructor = {\n Point: Point,\n LineString: LineString,\n Polygon: Polygon,\n MultiPoint: MultiPoint,\n MultiLineString: MultiLineString,\n MultiPolygon: MultiPolygon,\n};\n\nfunction orientFlatCoordinates(flatCoordinates, ends, stride) {\n if (Array.isArray(ends[0])) {\n // MultiPolagon\n if (!linearRingssAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRingsArray(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n }\n if (!linearRingsAreOriented(flatCoordinates, 0, ends, stride)) {\n flatCoordinates = flatCoordinates.slice();\n orientLinearRings(flatCoordinates, 0, ends, stride);\n }\n return flatCoordinates;\n}\n\n/**\n * @param {FeatureObject} object Feature object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {RenderFeature|Array} Render feature.\n */\nexport function createRenderFeature(object, options) {\n const geometry = object.geometry;\n if (!geometry) {\n return [];\n }\n if (Array.isArray(geometry)) {\n return geometry\n .map((geometry) => createRenderFeature({...object, geometry}))\n .flat();\n }\n\n const geometryType =\n geometry.type === 'MultiPolygon' ? 'Polygon' : geometry.type;\n if (geometryType === 'GeometryCollection' || geometryType === 'Circle') {\n throw new Error('Unsupported geometry type: ' + geometryType);\n }\n\n const stride = geometry.layout.length;\n return transformGeometryWithOptions(\n new RenderFeature(\n geometryType,\n geometryType === 'Polygon'\n ? orientFlatCoordinates(geometry.flatCoordinates, geometry.ends, stride)\n : geometry.flatCoordinates,\n geometry.ends?.flat(),\n stride,\n object.properties || {},\n object.id\n ).enableSimplifyTransformed(),\n false,\n options\n );\n}\n\n/**\n * @param {GeometryObject|null} object Geometry object.\n * @param {WriteOptions|ReadOptions} [options] Options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nexport function createGeometry(object, options) {\n if (!object) {\n return null;\n }\n if (Array.isArray(object)) {\n const geometries = object.map((geometry) =>\n createGeometry(geometry, options)\n );\n return new GeometryCollection(geometries);\n }\n const Geometry = GeometryConstructor[object.type];\n return transformGeometryWithOptions(\n new Geometry(object.flatCoordinates, object.layout, object.ends),\n false,\n options\n );\n}\n","/**\n * @module ol/format/GML2\n */\nimport GMLBase, {GMLNS} from './GMLBase.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n createElementNS,\n getAllTextContent,\n makeArrayPusher,\n makeChildAppender,\n makeReplacer,\n makeSimpleNodeFactory,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {createOrUpdate} from '../extent.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n transformExtentWithOptions,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport {writeStringTextNode} from './xsd.js';\n\n/**\n * @const\n * @type {string}\n */\nconst schemaLocation =\n GMLNS + ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';\n\n/**\n * @const\n * @type {Object}\n */\nconst MULTIGEOMETRY_TO_MEMBER_NODENAME = {\n 'MultiLineString': 'lineStringMember',\n 'MultiCurve': 'curveMember',\n 'MultiPolygon': 'polygonMember',\n 'MultiSurface': 'surfaceMember',\n};\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GML format,\n * version 2.1.2.\n *\n * @api\n */\nclass GML2 extends GMLBase {\n /**\n * @param {import(\"./GMLBase.js\").Options} [options] Optional configuration object.\n */\n constructor(options) {\n options = options ? options : {};\n\n super(options);\n\n this.FEATURE_COLLECTION_PARSERS[GMLNS]['featureMember'] = makeArrayPusher(\n this.readFeaturesInternal\n );\n\n /**\n * @type {string}\n */\n this.schemaLocation = options.schemaLocation\n ? options.schemaLocation\n : schemaLocation;\n }\n\n /**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array|undefined} Flat coordinates.\n */\n readFlatCoordinates(node, objectStack) {\n const s = getAllTextContent(node, false).replace(/^\\s*|\\s*$/g, '');\n const context = /** @type {import(\"../xml.js\").NodeStackItem} */ (\n objectStack[0]\n );\n const containerSrs = context['srsName'];\n let axisOrientation = 'enu';\n if (containerSrs) {\n const proj = getProjection(containerSrs);\n if (proj) {\n axisOrientation = proj.getAxisOrientation();\n }\n }\n const coordsGroups = s.trim().split(/\\s+/);\n const flatCoordinates = [];\n for (let i = 0, ii = coordsGroups.length; i < ii; i++) {\n const coords = coordsGroups[i].split(/,+/);\n const x = parseFloat(coords[0]);\n const y = parseFloat(coords[1]);\n const z = coords.length === 3 ? parseFloat(coords[2]) : 0;\n if (axisOrientation.substr(0, 2) === 'en') {\n flatCoordinates.push(x, y, z);\n } else {\n flatCoordinates.push(y, x, z);\n }\n }\n return flatCoordinates;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Envelope.\n */\n readBox(node, objectStack) {\n /** @type {Array} */\n const flatCoordinates = pushParseAndPop(\n [null],\n this.BOX_PARSERS_,\n node,\n objectStack,\n this\n );\n return createOrUpdate(\n flatCoordinates[1][0],\n flatCoordinates[1][1],\n flatCoordinates[1][3],\n flatCoordinates[1][4]\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n innerBoundaryIsParser(node, objectStack) {\n /** @type {Array|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings.push(flatLinearRing);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n outerBoundaryIsParser(node, objectStack) {\n /** @type {Array|undefined} */\n const flatLinearRing = pushParseAndPop(\n undefined,\n this.RING_PARSERS,\n node,\n objectStack,\n this\n );\n if (flatLinearRing) {\n const flatLinearRings =\n /** @type {Array>} */\n (objectStack[objectStack.length - 1]);\n flatLinearRings[0] = flatLinearRing;\n }\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Element|undefined} Node.\n * @private\n */\n GEOMETRY_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const multiSurface = context['multiSurface'];\n const surface = context['surface'];\n const multiCurve = context['multiCurve'];\n if (!Array.isArray(value)) {\n nodeName = /** @type {import(\"../geom/Geometry.js\").default} */ (\n value\n ).getType();\n if (nodeName === 'MultiPolygon' && multiSurface === true) {\n nodeName = 'MultiSurface';\n } else if (nodeName === 'Polygon' && surface === true) {\n nodeName = 'Surface';\n } else if (nodeName === 'MultiLineString' && multiCurve === true) {\n nodeName = 'MultiCurve';\n }\n } else {\n nodeName = 'Envelope';\n }\n return createElementNS('http://www.opengis.net/gml', nodeName);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {Array<*>} objectStack Node stack.\n */\n writeFeatureElement(node, feature, objectStack) {\n const fid = feature.getId();\n if (fid) {\n node.setAttribute('fid', /** @type {string} */ (fid));\n }\n const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const featureNS = context['featureNS'];\n const geometryName = feature.getGeometryName();\n if (!context.serializers) {\n context.serializers = {};\n context.serializers[featureNS] = {};\n }\n const keys = [];\n const values = [];\n if (feature.hasProperties()) {\n const properties = feature.getProperties();\n for (const key in properties) {\n const value = properties[key];\n if (value !== null) {\n keys.push(key);\n values.push(value);\n if (\n key == geometryName ||\n typeof (/** @type {?} */ (value).getSimplifiedGeometry) ===\n 'function'\n ) {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] = makeChildAppender(\n this.writeGeometryElement,\n this\n );\n }\n } else {\n if (!(key in context.serializers[featureNS])) {\n context.serializers[featureNS][key] =\n makeChildAppender(writeStringTextNode);\n }\n }\n }\n }\n }\n const item = Object.assign({}, context);\n item.node = node;\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n context.serializers,\n makeSimpleNodeFactory(undefined, featureNS),\n values,\n objectStack,\n keys\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} geometry LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (node.nodeName !== 'LineStringSegment' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (\n node.nodeName === 'LineString' ||\n node.nodeName === 'LineStringSegment'\n ) {\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n this.writeCoordinates_(coordinates, geometry, objectStack);\n } else if (node.nodeName === 'Curve') {\n const segments = createElementNS(node.namespaceURI, 'segments');\n node.appendChild(segments);\n this.writeCurveSegments_(segments, geometry, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLineStringOrCurveMember(node, line, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiLineString.js\").default} geometry MultiLineString geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiCurveOrLineString(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const curve = context['curve'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const lines = geometry.getLineStrings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, curve: curve},\n this.LINESTRINGORCURVEMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n lines,\n objectStack,\n undefined,\n this\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent} geometry Geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeGeometryElement(node, geometry, objectStack) {\n const context = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[objectStack.length - 1]\n );\n const item = Object.assign({}, context);\n item['node'] = node;\n let value;\n if (Array.isArray(geometry)) {\n value = transformExtentWithOptions(\n /** @type {import(\"../extent.js\").Extent} */ (geometry),\n context\n );\n } else {\n value = transformGeometryWithOptions(\n /** @type {import(\"../geom/Geometry.js\").default} */ (geometry),\n true,\n context\n );\n }\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n (item),\n this.GEOMETRY_SERIALIZERS,\n this.GEOMETRY_NODE_FACTORY_,\n [value],\n objectStack,\n undefined,\n this\n );\n }\n\n /**\n * @param {string} namespaceURI XML namespace.\n * @return {Element} coordinates node.\n * @private\n */\n createCoordinatesNode_(namespaceURI) {\n const coordinates = createElementNS(namespaceURI, 'coordinates');\n coordinates.setAttribute('decimal', '.');\n coordinates.setAttribute('cs', ',');\n coordinates.setAttribute('ts', ' ');\n\n return coordinates;\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/LineString.js\").default|import(\"../geom/LinearRing.js\").default} value Geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeCoordinates_(node, value, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n // only 2d for simple features profile\n const points = value.getCoordinates();\n const len = points.length;\n const parts = new Array(len);\n for (let i = 0; i < len; ++i) {\n const point = points[i];\n parts[i] = this.getCoords_(point, srsName, hasZ);\n }\n writeStringTextNode(node, parts.join(' '));\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LineString.js\").default} line LineString geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeCurveSegments_(node, line, objectStack) {\n const child = createElementNS(node.namespaceURI, 'LineStringSegment');\n node.appendChild(child);\n this.writeCurveOrLineString(child, line, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Polygon.js\").default} geometry Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (node.nodeName !== 'PolygonPatch' && srsName) {\n node.setAttribute('srsName', srsName);\n }\n if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {\n const rings = geometry.getLinearRings();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.RING_SERIALIZERS,\n this.RING_NODE_FACTORY_,\n rings,\n objectStack,\n undefined,\n this\n );\n } else if (node.nodeName === 'Surface') {\n const patches = createElementNS(node.namespaceURI, 'patches');\n node.appendChild(patches);\n this.writeSurfacePatches_(patches, geometry, objectStack);\n }\n }\n\n /**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node} Node.\n * @private\n */\n RING_NODE_FACTORY_(value, objectStack, nodeName) {\n const context = objectStack[objectStack.length - 1];\n const parentNode = context.node;\n const exteriorWritten = context['exteriorWritten'];\n if (exteriorWritten === undefined) {\n context['exteriorWritten'] = true;\n }\n return createElementNS(\n parentNode.namespaceURI,\n exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs'\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Polygon.js\").default} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n * @private\n */\n writeSurfacePatches_(node, polygon, objectStack) {\n const child = createElementNS(node.namespaceURI, 'PolygonPatch');\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} ring LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeRing(node, ring, objectStack) {\n const linearRing = createElementNS(node.namespaceURI, 'LinearRing');\n node.appendChild(linearRing);\n this.writeLinearRing(linearRing, ring, objectStack);\n }\n\n /**\n * @param {Array} point Point geometry.\n * @param {string} [srsName] Optional srsName\n * @param {boolean} [hasZ] whether the geometry has a Z coordinate (is 3D) or not.\n * @return {string} The coords string.\n * @private\n */\n getCoords_(point, srsName, hasZ) {\n let axisOrientation = 'enu';\n if (srsName) {\n axisOrientation = getProjection(srsName).getAxisOrientation();\n }\n let coords =\n axisOrientation.substr(0, 2) === 'en'\n ? point[0] + ',' + point[1]\n : point[1] + ',' + point[0];\n if (hasZ) {\n // For newly created points, Z can be undefined.\n const z = point[2] || 0;\n coords += ',' + z;\n }\n\n return coords;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} geometry Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n const point = geometry.getCoordinates();\n const coord = this.getCoords_(point, srsName, hasZ);\n writeStringTextNode(coordinates, coord);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiPoint.js\").default} geometry MultiPoint geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiPoint(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const points = geometry.getPoints();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName},\n this.POINTMEMBER_SERIALIZERS,\n makeSimpleNodeFactory('pointMember'),\n points,\n objectStack,\n undefined,\n this\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/Point.js\").default} point Point geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writePointMember(node, point, objectStack) {\n const child = createElementNS(node.namespaceURI, 'Point');\n node.appendChild(child);\n this.writePoint(child, point, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/LinearRing.js\").default} geometry LinearRing geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeLinearRing(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const coordinates = this.createCoordinatesNode_(node.namespaceURI);\n node.appendChild(coordinates);\n this.writeCoordinates_(coordinates, geometry, objectStack);\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry MultiPolygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeMultiSurfaceOrPolygon(node, geometry, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const hasZ = context['hasZ'];\n const srsName = context['srsName'];\n const surface = context['surface'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const polygons = geometry.getPolygons();\n pushSerializeAndPop(\n {node: node, hasZ: hasZ, srsName: srsName, surface: surface},\n this.SURFACEORPOLYGONMEMBER_SERIALIZERS,\n this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_,\n polygons,\n objectStack,\n undefined,\n this\n );\n }\n\n /**\n * @param {Node} node Node.\n * @param {import(\"../geom/Polygon.js\").default} polygon Polygon geometry.\n * @param {Array<*>} objectStack Node stack.\n */\n writeSurfaceOrPolygonMember(node, polygon, objectStack) {\n const child = this.GEOMETRY_NODE_FACTORY_(polygon, objectStack);\n if (child) {\n node.appendChild(child);\n this.writeSurfaceOrPolygon(child, polygon, objectStack);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"../extent.js\").Extent} extent Extent.\n * @param {Array<*>} objectStack Node stack.\n */\n writeEnvelope(node, extent, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const srsName = context['srsName'];\n if (srsName) {\n node.setAttribute('srsName', srsName);\n }\n const keys = ['lowerCorner', 'upperCorner'];\n const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: node}),\n this.ENVELOPE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n keys,\n this\n );\n }\n\n /**\n * @const\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n * @private\n */\n MULTIGEOMETRY_MEMBER_NODE_FACTORY_(value, objectStack, nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(\n 'http://www.opengis.net/gml',\n MULTIGEOMETRY_TO_MEMBER_NODENAME[parentNode.nodeName]\n );\n }\n}\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'coordinates': makeReplacer(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser,\n 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser,\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.BOX_PARSERS_ = {\n 'http://www.opengis.net/gml': {\n 'coordinates': makeArrayPusher(GML2.prototype.readFlatCoordinates),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Point': makeReplacer(GMLBase.prototype.readPoint),\n 'MultiPoint': makeReplacer(GMLBase.prototype.readMultiPoint),\n 'LineString': makeReplacer(GMLBase.prototype.readLineString),\n 'MultiLineString': makeReplacer(GMLBase.prototype.readMultiLineString),\n 'LinearRing': makeReplacer(GMLBase.prototype.readLinearRing),\n 'Polygon': makeReplacer(GMLBase.prototype.readPolygon),\n 'MultiPolygon': makeReplacer(GMLBase.prototype.readMultiPolygon),\n 'Box': makeReplacer(GML2.prototype.readBox),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.GEOMETRY_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'Curve': makeChildAppender(GML2.prototype.writeCurveOrLineString),\n 'MultiCurve': makeChildAppender(GML2.prototype.writeMultiCurveOrLineString),\n 'Point': makeChildAppender(GML2.prototype.writePoint),\n 'MultiPoint': makeChildAppender(GML2.prototype.writeMultiPoint),\n 'LineString': makeChildAppender(GML2.prototype.writeCurveOrLineString),\n 'MultiLineString': makeChildAppender(\n GML2.prototype.writeMultiCurveOrLineString\n ),\n 'LinearRing': makeChildAppender(GML2.prototype.writeLinearRing),\n 'Polygon': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),\n 'MultiPolygon': makeChildAppender(\n GML2.prototype.writeMultiSurfaceOrPolygon\n ),\n 'Surface': makeChildAppender(GML2.prototype.writeSurfaceOrPolygon),\n 'MultiSurface': makeChildAppender(\n GML2.prototype.writeMultiSurfaceOrPolygon\n ),\n 'Envelope': makeChildAppender(GML2.prototype.writeEnvelope),\n },\n};\n\n/**\n * @type {Object>}\n */\nGML2.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lineStringMember': makeChildAppender(\n GML2.prototype.writeLineStringOrCurveMember\n ),\n 'curveMember': makeChildAppender(\n GML2.prototype.writeLineStringOrCurveMember\n ),\n },\n};\n\n/**\n * @type {Object>}\n */\nGML2.prototype.RING_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),\n 'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing),\n },\n};\n\n/**\n * @type {Object>}\n */\nGML2.prototype.POINTMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'pointMember': makeChildAppender(GML2.prototype.writePointMember),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGML2.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'surfaceMember': makeChildAppender(\n GML2.prototype.writeSurfaceOrPolygonMember\n ),\n 'polygonMember': makeChildAppender(\n GML2.prototype.writeSurfaceOrPolygonMember\n ),\n },\n};\n\n/**\n * @type {Object>}\n */\nGML2.prototype.ENVELOPE_SERIALIZERS = {\n 'http://www.opengis.net/gml': {\n 'lowerCorner': makeChildAppender(writeStringTextNode),\n 'upperCorner': makeChildAppender(writeStringTextNode),\n },\n};\n\nexport default GML2;\n","/**\n * @module ol/format/GMLBase\n */\n// FIXME Envelopes should not be treated as geometries! readEnvelope_ is part\n// of GEOMETRY_PARSERS_ and methods using GEOMETRY_PARSERS_ do not expect\n// envelopes/extents, only geometries!\nimport Feature from '../Feature.js';\nimport Geometry from '../geom/Geometry.js';\nimport LineString from '../geom/LineString.js';\nimport LinearRing from '../geom/LinearRing.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport XMLFeature from './XMLFeature.js';\nimport {extend} from '../array.js';\nimport {\n getAllTextContent,\n getAttributeNS,\n makeArrayPusher,\n makeReplacer,\n parseNode,\n pushParseAndPop,\n} from '../xml.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n transformExtentWithOptions,\n transformGeometryWithOptions,\n} from './Feature.js';\n\n/**\n * @const\n * @type {string}\n */\nexport const GMLNS = 'http://www.opengis.net/gml';\n\n/**\n * A regular expression that matches if a string only contains whitespace\n * characters. It will e.g. match `''`, `' '`, `'\\n'` etc.\n *\n * @const\n * @type {RegExp}\n */\nconst ONLY_WHITESPACE_RE = /^\\s*$/;\n\n/**\n * @typedef {Object} Options\n * @property {Object|string} [featureNS] Feature\n * namespace. If not defined will be derived from GML. If multiple\n * feature types have been configured which come from different feature\n * namespaces, this will be an object with the keys being the prefixes used\n * in the entries of featureType array. The values of the object will be the\n * feature namespaces themselves. So for instance there might be a featureType\n * item `topp:states` in the `featureType` array and then there will be a key\n * `topp` in the featureNS object with value `http://www.openplans.org/topp`.\n * @property {Array|string} [featureType] Feature type(s) to parse.\n * If multiple feature types need to be configured\n * which come from different feature namespaces, `featureNS` will be an object\n * with the keys being the prefixes used in the entries of featureType array.\n * The values of the object will be the feature namespaces themselves.\n * So for instance there might be a featureType item `topp:states` and then\n * there will be a key named `topp` in the featureNS object with value\n * `http://www.openplans.org/topp`.\n * @property {string} [srsName] srsName to use when writing geometries.\n * @property {boolean} [surface=false] Write gml:Surface instead of gml:Polygon\n * elements. This also affects the elements in multi-part geometries.\n * @property {boolean} [curve=false] Write gml:Curve instead of gml:LineString\n * elements. This also affects the elements in multi-part geometries.\n * @property {boolean} [multiCurve=true] Write gml:MultiCurve instead of gml:MultiLineString.\n * Since the latter is deprecated in GML 3.\n * @property {boolean} [multiSurface=true] Write gml:multiSurface instead of\n * gml:MultiPolygon. Since the latter is deprecated in GML 3.\n * @property {string} [schemaLocation] Optional schemaLocation to use when\n * writing out the GML, this will override the default provided.\n * @property {boolean} [hasZ=false] If coordinates have a Z value.\n */\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Feature base format for reading and writing data in the GML format.\n * This class cannot be instantiated, it contains only base content that\n * is shared with versioned format classes GML2 and GML3.\n *\n * @abstract\n * @api\n */\nclass GMLBase extends XMLFeature {\n /**\n * @param {Options} [options] Optional configuration object.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @protected\n * @type {Array|string|undefined}\n */\n this.featureType = options.featureType;\n\n /**\n * @protected\n * @type {Object|string|undefined}\n */\n this.featureNS = options.featureNS;\n\n /**\n * @protected\n * @type {string|undefined}\n */\n this.srsName = options.srsName;\n\n /**\n * @protected\n * @type {string}\n */\n this.schemaLocation = '';\n\n /**\n * @type {Object>}\n */\n this.FEATURE_COLLECTION_PARSERS = {};\n this.FEATURE_COLLECTION_PARSERS[this.namespace] = {\n 'featureMember': makeArrayPusher(this.readFeaturesInternal),\n 'featureMembers': makeReplacer(this.readFeaturesInternal),\n };\n\n this.supportedMediaTypes = ['application/gml+xml'];\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array | undefined} Features.\n */\n readFeaturesInternal(node, objectStack) {\n const localName = node.localName;\n let features = null;\n if (localName == 'FeatureCollection') {\n features = pushParseAndPop(\n [],\n this.FEATURE_COLLECTION_PARSERS,\n node,\n objectStack,\n this\n );\n } else if (\n localName == 'featureMembers' ||\n localName == 'featureMember' ||\n localName == 'member'\n ) {\n const context = objectStack[0];\n let featureType = context['featureType'];\n let featureNS = context['featureNS'];\n const prefix = 'p';\n const defaultPrefix = 'p0';\n if (!featureType && node.childNodes) {\n (featureType = []), (featureNS = {});\n for (let i = 0, ii = node.childNodes.length; i < ii; ++i) {\n const child = /** @type {Element} */ (node.childNodes[i]);\n if (child.nodeType === 1) {\n const ft = child.nodeName.split(':').pop();\n if (!featureType.includes(ft)) {\n let key = '';\n let count = 0;\n const uri = child.namespaceURI;\n for (const candidate in featureNS) {\n if (featureNS[candidate] === uri) {\n key = candidate;\n break;\n }\n ++count;\n }\n if (!key) {\n key = prefix + count;\n featureNS[key] = uri;\n }\n featureType.push(key + ':' + ft);\n }\n }\n }\n if (localName != 'featureMember') {\n // recheck featureType for each featureMember\n context['featureType'] = featureType;\n context['featureNS'] = featureNS;\n }\n }\n if (typeof featureNS === 'string') {\n const ns = featureNS;\n featureNS = {};\n featureNS[defaultPrefix] = ns;\n }\n /** @type {Object>} */\n const parsersNS = {};\n const featureTypes = Array.isArray(featureType)\n ? featureType\n : [featureType];\n for (const p in featureNS) {\n /** @type {Object} */\n const parsers = {};\n for (let i = 0, ii = featureTypes.length; i < ii; ++i) {\n const featurePrefix = featureTypes[i].includes(':')\n ? featureTypes[i].split(':')[0]\n : defaultPrefix;\n if (featurePrefix === p) {\n parsers[featureTypes[i].split(':').pop()] =\n localName == 'featureMembers'\n ? makeArrayPusher(this.readFeatureElement, this)\n : makeReplacer(this.readFeatureElement, this);\n }\n }\n parsersNS[featureNS[p]] = parsers;\n }\n if (localName == 'featureMember' || localName == 'member') {\n features = pushParseAndPop(undefined, parsersNS, node, objectStack);\n } else {\n features = pushParseAndPop([], parsersNS, node, objectStack);\n }\n }\n if (features === null) {\n features = [];\n }\n return features;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../geom/Geometry.js\").default|import(\"../extent.js\").Extent|undefined} Geometry.\n */\n readGeometryOrExtent(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n context['srsName'] = node.firstElementChild.getAttribute('srsName');\n context['srsDimension'] =\n node.firstElementChild.getAttribute('srsDimension');\n return pushParseAndPop(\n null,\n this.GEOMETRY_PARSERS,\n node,\n objectStack,\n this\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../extent.js\").Extent|undefined} Geometry.\n */\n readExtentElement(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n const extent = /** @type {import(\"../extent.js\").Extent} */ (\n this.readGeometryOrExtent(node, objectStack)\n );\n return extent ? transformExtentWithOptions(extent, context) : undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {import(\"../geom/Geometry.js\").default|undefined} Geometry.\n */\n readGeometryElement(node, objectStack) {\n const context = /** @type {Object} */ (objectStack[0]);\n const geometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n this.readGeometryOrExtent(node, objectStack)\n );\n return geometry\n ? transformGeometryWithOptions(geometry, false, context)\n : undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @param {boolean} asFeature whether result should be wrapped as a feature.\n * @return {Feature|Object} Feature\n */\n readFeatureElementInternal(node, objectStack, asFeature) {\n let geometryName;\n const values = {};\n for (let n = node.firstElementChild; n; n = n.nextElementSibling) {\n let value;\n const localName = n.localName;\n // first, check if it is simple attribute\n if (\n n.childNodes.length === 0 ||\n (n.childNodes.length === 1 &&\n (n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))\n ) {\n value = getAllTextContent(n, false);\n if (ONLY_WHITESPACE_RE.test(value)) {\n value = undefined;\n }\n } else {\n if (asFeature) {\n //if feature, try it as a geometry or extent\n value =\n localName === 'boundedBy'\n ? this.readExtentElement(n, objectStack)\n : this.readGeometryElement(n, objectStack);\n }\n if (!value) {\n //if not a geometry or not a feature, treat it as a complex attribute\n value = this.readFeatureElementInternal(n, objectStack, false);\n } else if (localName !== 'boundedBy') {\n // boundedBy is an extent and must not be considered as a geometry\n geometryName = localName;\n }\n }\n\n const len = n.attributes.length;\n if (len > 0 && !(value instanceof Geometry)) {\n value = {_content_: value};\n for (let i = 0; i < len; i++) {\n const attName = n.attributes[i].name;\n value[attName] = n.attributes[i].value;\n }\n }\n\n if (values[localName]) {\n if (!(values[localName] instanceof Array)) {\n values[localName] = [values[localName]];\n }\n values[localName].push(value);\n } else {\n values[localName] = value;\n }\n }\n if (!asFeature) {\n return values;\n }\n const feature = new Feature(values);\n if (geometryName) {\n feature.setGeometryName(geometryName);\n }\n const fid =\n node.getAttribute('fid') || getAttributeNS(node, this.namespace, 'id');\n if (fid) {\n feature.setId(fid);\n }\n return feature;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature} Feature.\n */\n readFeatureElement(node, objectStack) {\n return this.readFeatureElementInternal(node, objectStack, true);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Point|undefined} Point.\n */\n readPoint(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n return new Point(flatCoordinates, 'XYZ');\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiPoint|undefined} MultiPoint.\n */\n readMultiPoint(node, objectStack) {\n /** @type {Array>} */\n const coordinates = pushParseAndPop(\n [],\n this.MULTIPOINT_PARSERS,\n node,\n objectStack,\n this\n );\n if (coordinates) {\n return new MultiPoint(coordinates);\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiLineString|undefined} MultiLineString.\n */\n readMultiLineString(node, objectStack) {\n /** @type {Array} */\n const lineStrings = pushParseAndPop(\n [],\n this.MULTILINESTRING_PARSERS,\n node,\n objectStack,\n this\n );\n if (lineStrings) {\n return new MultiLineString(lineStrings);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {MultiPolygon|undefined} MultiPolygon.\n */\n readMultiPolygon(node, objectStack) {\n /** @type {Array} */\n const polygons = pushParseAndPop(\n [],\n this.MULTIPOLYGON_PARSERS,\n node,\n objectStack,\n this\n );\n if (polygons) {\n return new MultiPolygon(polygons);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n pointMemberParser(node, objectStack) {\n parseNode(this.POINTMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n lineStringMemberParser(node, objectStack) {\n parseNode(this.LINESTRINGMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\n polygonMemberParser(node, objectStack) {\n parseNode(this.POLYGONMEMBER_PARSERS, node, objectStack, this);\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LineString|undefined} LineString.\n */\n readLineString(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n const lineString = new LineString(flatCoordinates, 'XYZ');\n return lineString;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array|undefined} LinearRing flat coordinates.\n */\n readFlatLinearRing(node, objectStack) {\n const ring = pushParseAndPop(\n null,\n this.GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n this\n );\n if (ring) {\n return ring;\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {LinearRing|undefined} LinearRing.\n */\n readLinearRing(node, objectStack) {\n const flatCoordinates = this.readFlatCoordinatesFromNode(node, objectStack);\n if (flatCoordinates) {\n return new LinearRing(flatCoordinates, 'XYZ');\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Polygon|undefined} Polygon.\n */\n readPolygon(node, objectStack) {\n /** @type {Array>} */\n const flatLinearRings = pushParseAndPop(\n [null],\n this.FLAT_LINEAR_RINGS_PARSERS,\n node,\n objectStack,\n this\n );\n if (flatLinearRings && flatLinearRings[0]) {\n const flatCoordinates = flatLinearRings[0];\n const ends = [flatCoordinates.length];\n let i, ii;\n for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {\n extend(flatCoordinates, flatLinearRings[i]);\n ends.push(flatCoordinates.length);\n }\n return new Polygon(flatCoordinates, 'XYZ', ends);\n }\n return undefined;\n }\n\n /**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Array} Flat coordinates.\n */\n readFlatCoordinatesFromNode(node, objectStack) {\n return pushParseAndPop(\n null,\n this.GEOMETRY_FLAT_COORDINATES_PARSERS,\n node,\n objectStack,\n this\n );\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromNode(node, options) {\n const geometry = this.readGeometryElement(node, [\n this.getReadOptions(node, options ? options : {}),\n ]);\n return geometry ? geometry : null;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array} Features.\n */\n readFeaturesFromNode(node, options) {\n const internalOptions = {\n featureType: this.featureType,\n featureNS: this.featureNS,\n };\n if (internalOptions) {\n Object.assign(internalOptions, this.getReadOptions(node, options));\n }\n const features = this.readFeaturesInternal(node, [internalOptions]);\n return features || [];\n }\n\n /**\n * @param {Element} node Node.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromNode(node) {\n return getProjection(\n this.srsName\n ? this.srsName\n : node.firstElementChild.getAttribute('srsName')\n );\n }\n}\n\nGMLBase.prototype.namespace = GMLNS;\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.FLAT_LINEAR_RINGS_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.GEOMETRY_PARSERS = {\n 'http://www.opengis.net/gml': {},\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.MULTIPOINT_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n 'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.MULTILINESTRING_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'lineStringMember': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser\n ),\n 'lineStringMembers': makeArrayPusher(\n GMLBase.prototype.lineStringMemberParser\n ),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.MULTIPOLYGON_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n 'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.POINTMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.LINESTRINGMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LineString': makeArrayPusher(GMLBase.prototype.readLineString),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.POLYGONMEMBER_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),\n },\n};\n\n/**\n * @const\n * @type {Object>}\n */\nGMLBase.prototype.RING_PARSERS = {\n 'http://www.opengis.net/gml': {\n 'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing),\n },\n};\n\nexport default GMLBase;\n","/**\n * @module ol/format/GPX\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport Point from '../geom/Point.js';\nimport XMLFeature from './XMLFeature.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n makeArrayPusher,\n makeArraySerializer,\n makeChildAppender,\n makeObjectPropertySetter,\n makeSequence,\n makeSimpleNodeFactory,\n makeStructureNS,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n readDateTime,\n readDecimal,\n readPositiveInteger,\n readString,\n writeDateTimeTextNode,\n writeDecimalTextNode,\n writeNonNegativeIntegerTextNode,\n writeStringTextNode,\n} from './xsd.js';\nimport {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @const\n * @type {Array}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://www.topografix.com/GPX/1/0',\n 'http://www.topografix.com/GPX/1/1',\n];\n\n/**\n * @const\n * @type {string}\n */\nconst SCHEMA_LOCATION =\n 'http://www.topografix.com/GPX/1/1 ' +\n 'http://www.topografix.com/GPX/1/1/gpx.xsd';\n\n/**\n * @const\n * @type {Object): (Feature|undefined)>}\n */\nconst FEATURE_READER = {\n 'rte': readRte,\n 'trk': readTrk,\n 'wpt': readWpt,\n};\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst GPX_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'rte': makeArrayPusher(readRte),\n 'trk': makeArrayPusher(readTrk),\n 'wpt': makeArrayPusher(readWpt),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'text': makeObjectPropertySetter(readString, 'linkText'),\n 'type': makeObjectPropertySetter(readString, 'linkType'),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst GPX_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'rte': makeChildAppender(writeRte),\n 'trk': makeChildAppender(writeTrk),\n 'wpt': makeChildAppender(writeWpt),\n});\n\n/**\n * @typedef {Object} Options\n * @property {function(Feature, Node):void} [readExtensions] Callback function\n * to process `extensions` nodes. To prevent memory leaks, this callback function must\n * not store any references to the node. Note that the `extensions`\n * node is not allowed in GPX 1.0. Moreover, only `extensions`\n * nodes from `wpt`, `rte` and `trk` can be processed, as those are\n * directly mapped to a feature.\n */\n\n/**\n * @typedef {Object} LayoutOptions\n * @property {boolean} [hasZ] HasZ.\n * @property {boolean} [hasM] HasM.\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GPX format.\n *\n * Note that {@link module:ol/format/GPX~GPX#readFeature} only reads the first\n * feature of the source.\n *\n * When reading, routes (``) are converted into LineString geometries, and\n * tracks (``) into MultiLineString. Any properties on route and track\n * waypoints are ignored.\n *\n * When writing, LineString geometries are output as routes (``), and\n * MultiLineString as tracks (``).\n *\n * @api\n */\nclass GPX extends XMLFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @type {function(Feature, Node): void|undefined}\n * @private\n */\n this.readExtensions_ = options.readExtensions;\n }\n\n /**\n * @param {Array} features List of features.\n * @private\n */\n handleReadExtensions_(features) {\n if (!features) {\n features = [];\n }\n for (let i = 0, ii = features.length; i < ii; ++i) {\n const feature = features[i];\n if (this.readExtensions_) {\n const extensionsNode = feature.get('extensionsNode_') || null;\n this.readExtensions_(feature, extensionsNode);\n }\n feature.set('extensionsNode_', undefined);\n }\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return null;\n }\n const featureReader = FEATURE_READER[node.localName];\n if (!featureReader) {\n return null;\n }\n const feature = featureReader(node, [this.getReadOptions(node, options)]);\n if (!feature) {\n return null;\n }\n this.handleReadExtensions_([feature]);\n return feature;\n }\n\n /**\n * @param {Element} node Node.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Options.\n * @return {Array} Features.\n */\n readFeaturesFromNode(node, options) {\n if (!NAMESPACE_URIS.includes(node.namespaceURI)) {\n return [];\n }\n if (node.localName == 'gpx') {\n /** @type {Array} */\n const features = pushParseAndPop([], GPX_PARSERS, node, [\n this.getReadOptions(node, options),\n ]);\n if (features) {\n this.handleReadExtensions_(features);\n return features;\n }\n return [];\n }\n return [];\n }\n\n /**\n * Encode an array of features in the GPX format as an XML node.\n * LineString geometries are output as routes (``), and MultiLineString\n * as tracks (``).\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Options.\n * @return {Node} Node.\n * @api\n */\n writeFeaturesNode(features, options) {\n options = this.adaptOptions(options);\n //FIXME Serialize metadata\n const gpx = createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');\n const xmlnsUri = 'http://www.w3.org/2000/xmlns/';\n gpx.setAttributeNS(xmlnsUri, 'xmlns:xsi', XML_SCHEMA_INSTANCE_URI);\n gpx.setAttributeNS(\n XML_SCHEMA_INSTANCE_URI,\n 'xsi:schemaLocation',\n SCHEMA_LOCATION\n );\n gpx.setAttribute('version', '1.1');\n gpx.setAttribute('creator', 'OpenLayers');\n\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: gpx}),\n GPX_SERIALIZERS,\n GPX_NODE_FACTORY,\n features,\n [options]\n );\n return gpx;\n }\n}\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst RTE_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'number': makeObjectPropertySetter(readPositiveInteger),\n 'extensions': parseExtensions,\n 'type': makeObjectPropertySetter(readString),\n 'rtept': parseRtePt,\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst RTEPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'number': makeObjectPropertySetter(readPositiveInteger),\n 'type': makeObjectPropertySetter(readString),\n 'extensions': parseExtensions,\n 'trkseg': parseTrkSeg,\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRKSEG_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'trkpt': parseTrkPt,\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRKPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst WPT_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeObjectPropertySetter(readDecimal),\n 'time': makeObjectPropertySetter(readDateTime),\n 'magvar': makeObjectPropertySetter(readDecimal),\n 'geoidheight': makeObjectPropertySetter(readDecimal),\n 'name': makeObjectPropertySetter(readString),\n 'cmt': makeObjectPropertySetter(readString),\n 'desc': makeObjectPropertySetter(readString),\n 'src': makeObjectPropertySetter(readString),\n 'link': parseLink,\n 'sym': makeObjectPropertySetter(readString),\n 'type': makeObjectPropertySetter(readString),\n 'fix': makeObjectPropertySetter(readString),\n 'sat': makeObjectPropertySetter(readPositiveInteger),\n 'hdop': makeObjectPropertySetter(readDecimal),\n 'vdop': makeObjectPropertySetter(readDecimal),\n 'pdop': makeObjectPropertySetter(readDecimal),\n 'ageofdgpsdata': makeObjectPropertySetter(readDecimal),\n 'dgpsid': makeObjectPropertySetter(readPositiveInteger),\n 'extensions': parseExtensions,\n});\n\n/**\n * @const\n * @type {Array}\n */\nconst LINK_SEQUENCE = ['text', 'type'];\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst LINK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'text': makeChildAppender(writeStringTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst RTE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'number',\n 'type',\n 'rtept',\n]);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst RTE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'number': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'rtept': makeArraySerializer(makeChildAppender(writeWptType)),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst RTEPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['ele', 'time']);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRK_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'number',\n 'type',\n 'trkseg',\n]);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRK_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'number': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'trkseg': makeArraySerializer(makeChildAppender(writeTrkSeg)),\n});\n\n/**\n * @const\n * @type {function(*, Array<*>, string=): (Node|undefined)}\n */\nconst TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt');\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst TRKSEG_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'trkpt': makeChildAppender(writeWptType),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst WPT_TYPE_SEQUENCE = makeStructureNS(NAMESPACE_URIS, [\n 'ele',\n 'time',\n 'magvar',\n 'geoidheight',\n 'name',\n 'cmt',\n 'desc',\n 'src',\n 'link',\n 'sym',\n 'type',\n 'fix',\n 'sat',\n 'hdop',\n 'vdop',\n 'pdop',\n 'ageofdgpsdata',\n 'dgpsid',\n]);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst WPT_TYPE_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'ele': makeChildAppender(writeDecimalTextNode),\n 'time': makeChildAppender(writeDateTimeTextNode),\n 'magvar': makeChildAppender(writeDecimalTextNode),\n 'geoidheight': makeChildAppender(writeDecimalTextNode),\n 'name': makeChildAppender(writeStringTextNode),\n 'cmt': makeChildAppender(writeStringTextNode),\n 'desc': makeChildAppender(writeStringTextNode),\n 'src': makeChildAppender(writeStringTextNode),\n 'link': makeChildAppender(writeLink),\n 'sym': makeChildAppender(writeStringTextNode),\n 'type': makeChildAppender(writeStringTextNode),\n 'fix': makeChildAppender(writeStringTextNode),\n 'sat': makeChildAppender(writeNonNegativeIntegerTextNode),\n 'hdop': makeChildAppender(writeDecimalTextNode),\n 'vdop': makeChildAppender(writeDecimalTextNode),\n 'pdop': makeChildAppender(writeDecimalTextNode),\n 'ageofdgpsdata': makeChildAppender(writeDecimalTextNode),\n 'dgpsid': makeChildAppender(writeNonNegativeIntegerTextNode),\n});\n\n/**\n * @const\n * @type {Object}\n */\nconst GEOMETRY_TYPE_TO_NODENAME = {\n 'Point': 'wpt',\n 'LineString': 'rte',\n 'MultiLineString': 'trk',\n};\n\n/**\n * @param {*} value Value.\n * @param {Array<*>} objectStack Object stack.\n * @param {string} [nodeName] Node name.\n * @return {Node|undefined} Node.\n */\nfunction GPX_NODE_FACTORY(value, objectStack, nodeName) {\n const geometry = /** @type {Feature} */ (value).getGeometry();\n if (geometry) {\n const nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()];\n if (nodeName) {\n const parentNode = objectStack[objectStack.length - 1].node;\n return createElementNS(parentNode.namespaceURI, nodeName);\n }\n }\n}\n\n/**\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {LayoutOptions} layoutOptions Layout options.\n * @param {Element} node Node.\n * @param {!Object} values Values.\n * @return {Array} Flat coordinates.\n */\nfunction appendCoordinate(flatCoordinates, layoutOptions, node, values) {\n flatCoordinates.push(\n parseFloat(node.getAttribute('lon')),\n parseFloat(node.getAttribute('lat'))\n );\n if ('ele' in values) {\n flatCoordinates.push(/** @type {number} */ (values['ele']));\n delete values['ele'];\n layoutOptions.hasZ = true;\n } else {\n flatCoordinates.push(0);\n }\n if ('time' in values) {\n flatCoordinates.push(/** @type {number} */ (values['time']));\n delete values['time'];\n layoutOptions.hasM = true;\n } else {\n flatCoordinates.push(0);\n }\n return flatCoordinates;\n}\n\n/**\n * Choose GeometryLayout based on flags in layoutOptions and adjust flatCoordinates\n * and ends arrays by shrinking them accordingly (removing unused zero entries).\n *\n * @param {LayoutOptions} layoutOptions Layout options.\n * @param {Array} flatCoordinates Flat coordinates.\n * @param {Array} [ends] Ends.\n * @return {import(\"../geom/Geometry.js\").GeometryLayout} Layout.\n */\nfunction applyLayoutOptions(layoutOptions, flatCoordinates, ends) {\n /** @type {import(\"../geom/Geometry.js\").GeometryLayout} */\n let layout = 'XY';\n let stride = 2;\n if (layoutOptions.hasZ && layoutOptions.hasM) {\n layout = 'XYZM';\n stride = 4;\n } else if (layoutOptions.hasZ) {\n layout = 'XYZ';\n stride = 3;\n } else if (layoutOptions.hasM) {\n layout = 'XYM';\n stride = 3;\n }\n if (stride !== 4) {\n for (let i = 0, ii = flatCoordinates.length / 4; i < ii; i++) {\n flatCoordinates[i * stride] = flatCoordinates[i * 4];\n flatCoordinates[i * stride + 1] = flatCoordinates[i * 4 + 1];\n if (layoutOptions.hasZ) {\n flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 2];\n }\n if (layoutOptions.hasM) {\n flatCoordinates[i * stride + 2] = flatCoordinates[i * 4 + 3];\n }\n }\n flatCoordinates.length = (flatCoordinates.length / 4) * stride;\n if (ends) {\n for (let i = 0, ii = ends.length; i < ii; i++) {\n ends[i] = (ends[i] / 4) * stride;\n }\n }\n }\n return layout;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseLink(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n const href = node.getAttribute('href');\n if (href !== null) {\n values['link'] = href;\n }\n parseNode(LINK_PARSERS, node, objectStack);\n}\n\n/**\n * @param {Node} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseExtensions(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n values['extensionsNode_'] = node;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseRtePt(node, objectStack) {\n const values = pushParseAndPop({}, RTEPT_PARSERS, node, objectStack);\n if (values) {\n const rteValues = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const flatCoordinates = /** @type {Array} */ (\n rteValues['flatCoordinates']\n );\n const layoutOptions = /** @type {LayoutOptions} */ (\n rteValues['layoutOptions']\n );\n appendCoordinate(flatCoordinates, layoutOptions, node, values);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseTrkPt(node, objectStack) {\n const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);\n if (values) {\n const trkValues = /** @type {!Object} */ (\n objectStack[objectStack.length - 1]\n );\n const flatCoordinates = /** @type {Array} */ (\n trkValues['flatCoordinates']\n );\n const layoutOptions = /** @type {LayoutOptions} */ (\n trkValues['layoutOptions']\n );\n appendCoordinate(flatCoordinates, layoutOptions, node, values);\n }\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction parseTrkSeg(node, objectStack) {\n const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);\n parseNode(TRKSEG_PARSERS, node, objectStack);\n const flatCoordinates =\n /** @type {Array} */\n (values['flatCoordinates']);\n const ends = /** @type {Array} */ (values['ends']);\n ends.push(flatCoordinates.length);\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Track.\n */\nfunction readRte(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop(\n {\n 'flatCoordinates': [],\n 'layoutOptions': {},\n },\n RTE_PARSERS,\n node,\n objectStack\n );\n if (!values) {\n return undefined;\n }\n const flatCoordinates =\n /** @type {Array} */\n (values['flatCoordinates']);\n delete values['flatCoordinates'];\n const layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);\n delete values['layoutOptions'];\n const layout = applyLayoutOptions(layoutOptions, flatCoordinates);\n const geometry = new LineString(flatCoordinates, layout);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Track.\n */\nfunction readTrk(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop(\n {\n 'flatCoordinates': [],\n 'ends': [],\n 'layoutOptions': {},\n },\n TRK_PARSERS,\n node,\n objectStack\n );\n if (!values) {\n return undefined;\n }\n const flatCoordinates =\n /** @type {Array} */\n (values['flatCoordinates']);\n delete values['flatCoordinates'];\n const ends = /** @type {Array} */ (values['ends']);\n delete values['ends'];\n const layoutOptions = /** @type {LayoutOptions} */ (values['layoutOptions']);\n delete values['layoutOptions'];\n const layout = applyLayoutOptions(layoutOptions, flatCoordinates, ends);\n const geometry = new MultiLineString(flatCoordinates, layout, ends);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {Array<*>} objectStack Object stack.\n * @return {Feature|undefined} Waypoint.\n */\nfunction readWpt(node, objectStack) {\n const options = /** @type {import(\"./Feature.js\").ReadOptions} */ (\n objectStack[0]\n );\n const values = pushParseAndPop({}, WPT_PARSERS, node, objectStack);\n if (!values) {\n return undefined;\n }\n const layoutOptions = /** @type {LayoutOptions} */ ({});\n const coordinates = appendCoordinate([], layoutOptions, node, values);\n const layout = applyLayoutOptions(layoutOptions, coordinates);\n const geometry = new Point(coordinates, layout);\n transformGeometryWithOptions(geometry, false, options);\n const feature = new Feature(geometry);\n feature.setProperties(values, true);\n return feature;\n}\n\n/**\n * @param {Element} node Node.\n * @param {string} value Value for the link's `href` attribute.\n * @param {Array<*>} objectStack Node stack.\n */\nfunction writeLink(node, value, objectStack) {\n node.setAttribute('href', value);\n const context = objectStack[objectStack.length - 1];\n const properties = context['properties'];\n const link = [properties['linkText'], properties['linkType']];\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */ ({node: node}),\n LINK_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n link,\n objectStack,\n LINK_SEQUENCE\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {import(\"../coordinate.js\").Coordinate} coordinate Coordinate.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeWptType(node, coordinate, objectStack) {\n const context = objectStack[objectStack.length - 1];\n const parentNode = context.node;\n const namespaceURI = parentNode.namespaceURI;\n const properties = context['properties'];\n //FIXME Projection handling\n node.setAttributeNS(null, 'lat', String(coordinate[1]));\n node.setAttributeNS(null, 'lon', String(coordinate[0]));\n const geometryLayout = context['geometryLayout'];\n switch (geometryLayout) {\n case 'XYZM':\n if (coordinate[3] !== 0) {\n properties['time'] = coordinate[3];\n }\n // fall through\n case 'XYZ':\n if (coordinate[2] !== 0) {\n properties['ele'] = coordinate[2];\n }\n break;\n case 'XYM':\n if (coordinate[2] !== 0) {\n properties['time'] = coordinate[2];\n }\n break;\n default:\n // pass\n }\n const orderedKeys =\n node.nodeName == 'rtept'\n ? RTEPT_TYPE_SEQUENCE[namespaceURI]\n : WPT_TYPE_SEQUENCE[namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n /** @type {import(\"../xml.js\").NodeStackItem} */\n ({node: node, 'properties': properties}),\n WPT_TYPE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys\n );\n}\n\n/**\n * @param {Node} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeRte(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const properties = feature.getProperties();\n const context = {node: node};\n context['properties'] = properties;\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'LineString') {\n const lineString = /** @type {LineString} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n context['geometryLayout'] = lineString.getLayout();\n properties['rtept'] = lineString.getCoordinates();\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = RTE_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n RTE_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeTrk(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const properties = feature.getProperties();\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {node: node};\n context['properties'] = properties;\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'MultiLineString') {\n const multiLineString = /** @type {MultiLineString} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n properties['trkseg'] = multiLineString.getLineStrings();\n }\n const parentNode = objectStack[objectStack.length - 1].node;\n const orderedKeys = TRK_SEQUENCE[parentNode.namespaceURI];\n const values = makeSequence(properties, orderedKeys);\n pushSerializeAndPop(\n context,\n TRK_SERIALIZERS,\n OBJECT_PROPERTY_NODE_FACTORY,\n values,\n objectStack,\n orderedKeys\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {LineString} lineString LineString.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeTrkSeg(node, lineString, objectStack) {\n /** @type {import(\"../xml.js\").NodeStackItem} */\n const context = {node: node};\n context['geometryLayout'] = lineString.getLayout();\n context['properties'] = {};\n pushSerializeAndPop(\n context,\n TRKSEG_SERIALIZERS,\n TRKSEG_NODE_FACTORY,\n lineString.getCoordinates(),\n objectStack\n );\n}\n\n/**\n * @param {Element} node Node.\n * @param {Feature} feature Feature.\n * @param {Array<*>} objectStack Object stack.\n */\nfunction writeWpt(node, feature, objectStack) {\n const options = /** @type {import(\"./Feature.js\").WriteOptions} */ (\n objectStack[0]\n );\n const context = objectStack[objectStack.length - 1];\n context['properties'] = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry.getType() == 'Point') {\n const point = /** @type {Point} */ (\n transformGeometryWithOptions(geometry, true, options)\n );\n context['geometryLayout'] = point.getLayout();\n writeWptType(node, point.getCoordinates(), objectStack);\n }\n}\n\nexport default GPX;\n","/**\n * @module ol/format/GeoJSON\n */\n\nimport Feature from '../Feature.js';\nimport JSONFeature from './JSONFeature.js';\nimport RenderFeature from '../render/Feature.js';\nimport {\n createGeometry,\n createRenderFeature,\n transformGeometryWithOptions,\n} from './Feature.js';\nimport {\n deflateCoordinatesArray,\n deflateMultiCoordinatesArray,\n} from '../geom/flat/deflate.js';\nimport {getLayoutForStride} from '../geom/SimpleGeometry.js';\nimport {get as getProjection} from '../proj.js';\nimport {isEmpty} from '../obj.js';\n\n/**\n * @typedef {import(\"geojson\").GeoJSON} GeoJSONObject\n * @typedef {import(\"geojson\").Feature} GeoJSONFeature\n * @typedef {import(\"geojson\").FeatureCollection} GeoJSONFeatureCollection\n * @typedef {import(\"geojson\").Geometry} GeoJSONGeometry\n * @typedef {import(\"geojson\").Point} GeoJSONPoint\n * @typedef {import(\"geojson\").LineString} GeoJSONLineString\n * @typedef {import(\"geojson\").Polygon} GeoJSONPolygon\n * @typedef {import(\"geojson\").MultiPoint} GeoJSONMultiPoint\n * @typedef {import(\"geojson\").MultiLineString} GeoJSONMultiLineString\n * @typedef {import(\"geojson\").MultiPolygon} GeoJSONMultiPolygon\n * @typedef {import(\"geojson\").GeometryCollection} GeoJSONGeometryCollection\n */\n\n/**\n * @template {import(\"../Feature.js\").FeatureClass} FeatureOrRenderFeature\n * @typedef {Object} Options\n *\n * @property {import(\"../proj.js\").ProjectionLike} [dataProjection='EPSG:4326'] Default data projection.\n * @property {import(\"../proj.js\").ProjectionLike} [featureProjection] Projection for features read or\n * written by the format. Options passed to read or write methods will take precedence.\n * @property {string} [geometryName] Geometry name to use when creating features.\n * @property {boolean} [extractGeometryName=false] Certain GeoJSON providers include\n * the geometry_name field in the feature GeoJSON. If set to `true` the GeoJSON reader\n * will look for that field to set the geometry name. If both this field is set to `true`\n * and a `geometryName` is provided, the `geometryName` will take precedence.\n * @property {FeatureOrRenderFeature} [featureClass] Feature class\n * to be used when reading features. The default is {@link module:ol/Feature~Feature}. If performance is\n * the primary concern, and features are not going to be modified or round-tripped through the format,\n * consider using {@link module:ol/render/Feature~RenderFeature}\n */\n\n/**\n * @classdesc\n * Feature format for reading and writing data in the GeoJSON format.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof Feature]\n * @extends {JSONFeature}\n * @api\n */\nclass GeoJSON extends JSONFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super();\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection(\n options.dataProjection ? options.dataProjection : 'EPSG:4326'\n );\n\n if (options.featureProjection) {\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.defaultFeatureProjection = getProjection(options.featureProjection);\n }\n\n if (options.featureClass) {\n this.featureClass = options.featureClass;\n }\n\n /**\n * Name of the geometry attribute for features.\n * @type {string|undefined}\n * @private\n */\n this.geometryName_ = options.geometryName;\n\n /**\n * Look for the `geometry_name` in the feature GeoJSON\n * @type {boolean|undefined}\n * @private\n */\n this.extractGeometryName_ = options.extractGeometryName;\n\n this.supportedMediaTypes = [\n 'application/geo+json',\n 'application/vnd.geo+json',\n ];\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Feature|RenderFeature|Array}.default} Feature.\n */\n readFeatureFromObject(object, options) {\n /**\n * @type {GeoJSONFeature}\n */\n let geoJSONFeature = null;\n if (object['type'] === 'Feature') {\n geoJSONFeature = /** @type {GeoJSONFeature} */ (object);\n } else {\n geoJSONFeature = {\n 'type': 'Feature',\n 'geometry': /** @type {GeoJSONGeometry} */ (object),\n 'properties': null,\n };\n }\n\n const geometry = readGeometryInternal(geoJSONFeature['geometry'], options);\n if (this.featureClass === RenderFeature) {\n return createRenderFeature(\n {\n geometry,\n id: geoJSONFeature['id'],\n properties: geoJSONFeature['properties'],\n },\n options\n );\n }\n\n const feature = new Feature();\n if (this.geometryName_) {\n feature.setGeometryName(this.geometryName_);\n } else if (this.extractGeometryName_ && geoJSONFeature['geometry_name']) {\n feature.setGeometryName(geoJSONFeature['geometry_name']);\n }\n feature.setGeometry(createGeometry(geometry, options));\n\n if ('id' in geoJSONFeature) {\n feature.setId(geoJSONFeature['id']);\n }\n\n if (geoJSONFeature['properties']) {\n feature.setProperties(geoJSONFeature['properties'], true);\n }\n return feature;\n }\n\n /**\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n const geoJSONObject = /** @type {GeoJSONObject} */ (object);\n /** @type {Array>} */\n let features = null;\n if (geoJSONObject['type'] === 'FeatureCollection') {\n const geoJSONFeatureCollection = /** @type {GeoJSONFeatureCollection} */ (\n object\n );\n features = [];\n const geoJSONFeatures = geoJSONFeatureCollection['features'];\n for (let i = 0, ii = geoJSONFeatures.length; i < ii; ++i) {\n const featureObject = this.readFeatureFromObject(\n geoJSONFeatures[i],\n options\n );\n if (!featureObject) {\n continue;\n }\n features.push(featureObject);\n }\n } else {\n features = [this.readFeatureFromObject(object, options)];\n }\n return features.flat();\n }\n\n /**\n * @param {GeoJSONGeometry} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return readGeometry(object, options);\n }\n\n /**\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n const crs = object['crs'];\n let projection;\n if (crs) {\n if (crs['type'] == 'name') {\n projection = getProjection(crs['properties']['name']);\n } else if (crs['type'] === 'EPSG') {\n projection = getProjection('EPSG:' + crs['properties']['code']);\n } else {\n throw new Error('Unknown SRS type');\n }\n } else {\n projection = this.dataProjection;\n }\n return /** @type {import(\"../proj/Projection.js\").default} */ (projection);\n }\n\n /**\n * Encode a feature as a GeoJSON Feature object.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeature} Object.\n * @api\n */\n writeFeatureObject(feature, options) {\n options = this.adaptOptions(options);\n\n /** @type {GeoJSONFeature} */\n const object = {\n 'type': 'Feature',\n geometry: null,\n properties: null,\n };\n\n const id = feature.getId();\n if (id !== undefined) {\n object.id = id;\n }\n\n if (!feature.hasProperties()) {\n return object;\n }\n\n const properties = feature.getProperties();\n const geometry = feature.getGeometry();\n if (geometry) {\n object.geometry = writeGeometry(geometry, options);\n\n delete properties[feature.getGeometryName()];\n }\n\n if (!isEmpty(properties)) {\n object.properties = properties;\n }\n\n return object;\n }\n\n /**\n * Encode an array of features as a GeoJSON object.\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONFeatureCollection} GeoJSON Object.\n * @api\n */\n writeFeaturesObject(features, options) {\n options = this.adaptOptions(options);\n const objects = [];\n for (let i = 0, ii = features.length; i < ii; ++i) {\n objects.push(this.writeFeatureObject(features[i], options));\n }\n return {\n type: 'FeatureCollection',\n features: objects,\n };\n }\n\n /**\n * Encode a geometry as a GeoJSON object.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry|GeoJSONGeometryCollection} Object.\n * @api\n */\n writeGeometryObject(geometry, options) {\n return writeGeometry(geometry, this.adaptOptions(options));\n }\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryObject} Geometry.\n */\nfunction readGeometryInternal(object, options) {\n if (!object) {\n return null;\n }\n\n /** @type {import(\"./Feature.js\").GeometryObject} */\n let geometry;\n switch (object['type']) {\n case 'Point': {\n geometry = readPointGeometry(/** @type {GeoJSONPoint} */ (object));\n break;\n }\n case 'LineString': {\n geometry = readLineStringGeometry(\n /** @type {GeoJSONLineString} */ (object)\n );\n break;\n }\n case 'Polygon': {\n geometry = readPolygonGeometry(/** @type {GeoJSONPolygon} */ (object));\n break;\n }\n case 'MultiPoint': {\n geometry = readMultiPointGeometry(\n /** @type {GeoJSONMultiPoint} */ (object)\n );\n break;\n }\n case 'MultiLineString': {\n geometry = readMultiLineStringGeometry(\n /** @type {GeoJSONMultiLineString} */ (object)\n );\n break;\n }\n case 'MultiPolygon': {\n geometry = readMultiPolygonGeometry(\n /** @type {GeoJSONMultiPolygon} */ (object)\n );\n break;\n }\n case 'GeometryCollection': {\n geometry = readGeometryCollectionGeometry(\n /** @type {GeoJSONGeometryCollection} */ (object)\n );\n break;\n }\n default: {\n throw new Error('Unsupported GeoJSON type: ' + object['type']);\n }\n }\n return geometry;\n}\n\n/**\n * @param {GeoJSONGeometry|GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\nfunction readGeometry(object, options) {\n const geometryObject = readGeometryInternal(object, options);\n return createGeometry(geometryObject, options);\n}\n\n/**\n * @param {GeoJSONGeometryCollection} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"./Feature.js\").GeometryCollectionObject} Geometry collection.\n */\nfunction readGeometryCollectionGeometry(object, options) {\n const geometries = object['geometries'].map(\n /**\n * @param {GeoJSONGeometry} geometry Geometry.\n * @return {import(\"./Feature.js\").GeometryObject} geometry Geometry.\n */\n function (geometry) {\n return readGeometryInternal(geometry, options);\n }\n );\n return geometries;\n}\n\n/**\n * @param {GeoJSONPoint} object Input object.\n * @return {import(\"./Feature.js\").GeometryObject} Point geometry.\n */\nfunction readPointGeometry(object) {\n const flatCoordinates = object['coordinates'];\n return {\n type: 'Point',\n flatCoordinates,\n layout: getLayoutForStride(flatCoordinates.length),\n };\n}\n\n/**\n * @param {GeoJSONLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} LineString geometry.\n */\nfunction readLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = coordinates.flat();\n return {\n type: 'LineString',\n flatCoordinates,\n ends: [flatCoordinates.length],\n layout: getLayoutForStride(coordinates[0].length),\n };\n}\n\n/**\n * @param {GeoJSONMultiLineString} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiLineString geometry.\n */\nfunction readMultiLineStringGeometry(object) {\n const coordinates = object['coordinates'];\n const stride = coordinates[0][0].length;\n const flatCoordinates = [];\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'MultiLineString',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONMultiPoint} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPoint geometry.\n */\nfunction readMultiPointGeometry(object) {\n const coordinates = object['coordinates'];\n return {\n type: 'MultiPoint',\n flatCoordinates: coordinates.flat(),\n layout: getLayoutForStride(coordinates[0].length),\n };\n}\n\n/**\n * @param {GeoJSONMultiPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} MultiPolygon geometry.\n */\nfunction readMultiPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0][0][0].length;\n const endss = deflateMultiCoordinatesArray(\n flatCoordinates,\n 0,\n coordinates,\n stride\n );\n return {\n type: 'MultiPolygon',\n flatCoordinates,\n ends: endss,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {GeoJSONPolygon} object Object.\n * @return {import(\"./Feature.js\").GeometryObject} Polygon.\n */\nfunction readPolygonGeometry(object) {\n const coordinates = object['coordinates'];\n const flatCoordinates = [];\n const stride = coordinates[0][0].length;\n const ends = deflateCoordinatesArray(flatCoordinates, 0, coordinates, stride);\n return {\n type: 'Polygon',\n flatCoordinates,\n ends,\n layout: getLayoutForStride(stride),\n };\n}\n\n/**\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeGeometry(geometry, options) {\n geometry = transformGeometryWithOptions(geometry, true, options);\n\n const type = geometry.getType();\n\n /** @type {GeoJSONGeometry} */\n let geoJSON;\n switch (type) {\n case 'Point': {\n geoJSON = writePointGeometry(\n /** @type {import(\"../geom/Point.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'LineString': {\n geoJSON = writeLineStringGeometry(\n /** @type {import(\"../geom/LineString.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'Polygon': {\n geoJSON = writePolygonGeometry(\n /** @type {import(\"../geom/Polygon.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'MultiPoint': {\n geoJSON = writeMultiPointGeometry(\n /** @type {import(\"../geom/MultiPoint.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'MultiLineString': {\n geoJSON = writeMultiLineStringGeometry(\n /** @type {import(\"../geom/MultiLineString.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'MultiPolygon': {\n geoJSON = writeMultiPolygonGeometry(\n /** @type {import(\"../geom/MultiPolygon.js\").default} */ (geometry),\n options\n );\n break;\n }\n case 'GeometryCollection': {\n geoJSON = writeGeometryCollectionGeometry(\n /** @type {import(\"../geom/GeometryCollection.js\").default} */ (\n geometry\n ),\n options\n );\n break;\n }\n case 'Circle': {\n geoJSON = {\n type: 'GeometryCollection',\n geometries: [],\n };\n break;\n }\n default: {\n throw new Error('Unsupported geometry type: ' + type);\n }\n }\n return geoJSON;\n}\n\n/**\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometryCollection} GeoJSON geometry collection.\n */\nfunction writeGeometryCollectionGeometry(geometry, options) {\n options = Object.assign({}, options);\n delete options.featureProjection;\n const geometries = geometry.getGeometriesArray().map(function (geometry) {\n return writeGeometry(geometry, options);\n });\n return {\n type: 'GeometryCollection',\n geometries: geometries,\n };\n}\n\n/**\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeLineStringGeometry(geometry, options) {\n return {\n type: 'LineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiLineStringGeometry(geometry, options) {\n return {\n type: 'MultiLineString',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPointGeometry(geometry, options) {\n return {\n type: 'MultiPoint',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writeMultiPolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'MultiPolygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\n/**\n * @param {import(\"../geom/Point.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePointGeometry(geometry, options) {\n return {\n type: 'Point',\n coordinates: geometry.getCoordinates(),\n };\n}\n\n/**\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {GeoJSONGeometry} GeoJSON geometry.\n */\nfunction writePolygonGeometry(geometry, options) {\n let right;\n if (options) {\n right = options.rightHanded;\n }\n return {\n type: 'Polygon',\n coordinates: geometry.getCoordinates(right),\n };\n}\n\nexport default GeoJSON;\n","/**\n * @module ol/format/IGC\n */\nimport Feature from '../Feature.js';\nimport LineString from '../geom/LineString.js';\nimport TextFeature from './TextFeature.js';\nimport {get as getProjection} from '../proj.js';\nimport {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @typedef {'barometric' | 'gps' | 'none'} IGCZ\n * IGC altitude/z. One of 'barometric', 'gps', 'none'.\n */\n\n/**\n * @const\n * @type {RegExp}\n */\nconst B_RECORD_RE =\n /^B(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{5})([NS])(\\d{3})(\\d{5})([EW])([AV])(\\d{5})(\\d{5})/;\n\n/**\n * @const\n * @type {RegExp}\n */\nconst H_RECORD_RE = /^H.([A-Z]{3}).*?:(.*)/;\n\n/**\n * @const\n * @type {RegExp}\n */\nconst HFDTE_RECORD_RE = /^HFDTE(\\d{2})(\\d{2})(\\d{2})/;\n\n/**\n * A regular expression matching the newline characters `\\r\\n`, `\\r` and `\\n`.\n *\n * @const\n * @type {RegExp}\n */\nconst NEWLINE_RE = /\\r\\n|\\r|\\n/;\n\n/**\n * @typedef {Object} Options\n * @property {IGCZ} [altitudeMode='none'] Altitude mode. Possible\n * values are `'barometric'`, `'gps'`, and `'none'`.\n */\n\n/**\n * @classdesc\n * Feature format for `*.igc` flight recording files.\n *\n * As IGC sources contain a single feature,\n * {@link module:ol/format/IGC~IGC#readFeatures} will return the feature in an\n * array\n *\n * @api\n */\nclass IGC extends TextFeature {\n /**\n * @param {Options} [options] Options.\n */\n constructor(options) {\n super();\n\n options = options ? options : {};\n\n /**\n * @type {import(\"../proj/Projection.js\").default}\n */\n this.dataProjection = getProjection('EPSG:4326');\n\n /**\n * @private\n * @type {IGCZ}\n */\n this.altitudeMode_ = options.altitudeMode ? options.altitudeMode : 'none';\n }\n\n /**\n * @protected\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").default} Feature.\n */\n readFeatureFromText(text, options) {\n const altitudeMode = this.altitudeMode_;\n const lines = text.split(NEWLINE_RE);\n /** @type {Object} */\n const properties = {};\n const flatCoordinates = [];\n let year = 2000;\n let month = 0;\n let day = 1;\n let lastDateTime = -1;\n let i, ii;\n for (i = 0, ii = lines.length; i < ii; ++i) {\n const line = lines[i];\n let m;\n if (line.charAt(0) == 'B') {\n m = B_RECORD_RE.exec(line);\n if (m) {\n const hour = parseInt(m[1], 10);\n const minute = parseInt(m[2], 10);\n const second = parseInt(m[3], 10);\n let y = parseInt(m[4], 10) + parseInt(m[5], 10) / 60000;\n if (m[6] == 'S') {\n y = -y;\n }\n let x = parseInt(m[7], 10) + parseInt(m[8], 10) / 60000;\n if (m[9] == 'W') {\n x = -x;\n }\n flatCoordinates.push(x, y);\n if (altitudeMode != 'none') {\n let z;\n if (altitudeMode == 'gps') {\n z = parseInt(m[11], 10);\n } else if (altitudeMode == 'barometric') {\n z = parseInt(m[12], 10);\n } else {\n z = 0;\n }\n flatCoordinates.push(z);\n }\n let dateTime = Date.UTC(year, month, day, hour, minute, second);\n // Detect UTC midnight wrap around.\n if (dateTime < lastDateTime) {\n dateTime = Date.UTC(year, month, day + 1, hour, minute, second);\n }\n flatCoordinates.push(dateTime / 1000);\n lastDateTime = dateTime;\n }\n } else if (line.charAt(0) == 'H') {\n m = HFDTE_RECORD_RE.exec(line);\n if (m) {\n day = parseInt(m[1], 10);\n month = parseInt(m[2], 10) - 1;\n year = 2000 + parseInt(m[3], 10);\n } else {\n m = H_RECORD_RE.exec(line);\n if (m) {\n properties[m[1]] = m[2].trim();\n }\n }\n }\n }\n if (flatCoordinates.length === 0) {\n return null;\n }\n const layout = altitudeMode == 'none' ? 'XYM' : 'XYZM';\n const lineString = new LineString(flatCoordinates, layout);\n const feature = new Feature(\n transformGeometryWithOptions(lineString, false, options)\n );\n feature.setProperties(properties, true);\n return feature;\n }\n\n /**\n * @param {string} text Text.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromText(text, options) {\n const feature = this.readFeatureFromText(text, options);\n if (feature) {\n return [feature];\n }\n return [];\n }\n}\n\nexport default IGC;\n","/**\n * @module ol/format/JSONFeature\n */\nimport FeatureFormat from './Feature.js';\nimport {abstract} from '../util.js';\n\n/**\n * @classdesc\n * Abstract base class; normally only used for creating subclasses and not\n * instantiated in apps.\n * Base class for JSON feature formats.\n *\n * @template {import('../Feature.js').FeatureClass} [T=typeof import('../Feature.js').default]\n * @extends {FeatureFormat}\n * @abstract\n */\nclass JSONFeature extends FeatureFormat {\n constructor() {\n super();\n }\n\n /**\n * @return {import(\"./Feature.js\").Type} Format.\n */\n getType() {\n return 'json';\n }\n\n /**\n * Read a feature. Only works for a single feature. Use `readFeatures` to\n * read a feature collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../Feature.js\").FeatureLike|Array} Feature.\n * @api\n */\n readFeature(source, options) {\n return this.readFeatureFromObject(\n getObject(source),\n this.getReadOptions(source, options)\n );\n }\n\n /**\n * Read all features. Works with both a single feature and a feature\n * collection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {Array>} Features.\n * @api\n */\n readFeatures(source, options) {\n return /** @type {Array>} */ (\n this.readFeaturesFromObject(\n getObject(source),\n this.getReadOptions(source, options)\n )\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../Feature.js\").default|import(\"../render/Feature.js\").default|Array} Feature.\n */\n readFeatureFromObject(object, options) {\n return abstract();\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {Array} Features.\n */\n readFeaturesFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read a geometry.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n * @api\n */\n readGeometry(source, options) {\n return this.readGeometryFromObject(\n getObject(source),\n this.getReadOptions(source, options)\n );\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @param {import(\"./Feature.js\").ReadOptions} [options] Read options.\n * @protected\n * @return {import(\"../geom/Geometry.js\").default} Geometry.\n */\n readGeometryFromObject(object, options) {\n return abstract();\n }\n\n /**\n * Read the projection.\n *\n * @param {ArrayBuffer|Document|Element|Object|string} source Source.\n * @return {import(\"../proj/Projection.js\").default} Projection.\n * @api\n */\n readProjection(source) {\n return this.readProjectionFromObject(getObject(source));\n }\n\n /**\n * @abstract\n * @param {Object} object Object.\n * @protected\n * @return {import(\"../proj/Projection.js\").default} Projection.\n */\n readProjectionFromObject(object) {\n return abstract();\n }\n\n /**\n * Encode a feature as string.\n *\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded feature.\n * @api\n */\n writeFeature(feature, options) {\n return JSON.stringify(this.writeFeatureObject(feature, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../Feature.js\").default} feature Feature.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeatureObject(feature, options) {\n return abstract();\n }\n\n /**\n * Encode an array of features as string.\n *\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded features.\n * @api\n */\n writeFeatures(features, options) {\n return JSON.stringify(this.writeFeaturesObject(features, options));\n }\n\n /**\n * @abstract\n * @param {Array} features Features.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeFeaturesObject(features, options) {\n return abstract();\n }\n\n /**\n * Encode a geometry as string.\n *\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {string} Encoded geometry.\n * @api\n */\n writeGeometry(geometry, options) {\n return JSON.stringify(this.writeGeometryObject(geometry, options));\n }\n\n /**\n * @abstract\n * @param {import(\"../geom/Geometry.js\").default} geometry Geometry.\n * @param {import(\"./Feature.js\").WriteOptions} [options] Write options.\n * @return {Object} Object.\n */\n writeGeometryObject(geometry, options) {\n return abstract();\n }\n}\n\n/**\n * @param {Document|Element|Object|string} source Source.\n * @return {Object} Object.\n */\nfunction getObject(source) {\n if (typeof source === 'string') {\n const object = JSON.parse(source);\n return object ? /** @type {Object} */ (object) : null;\n }\n if (source !== null) {\n return source;\n }\n return null;\n}\n\nexport default JSONFeature;\n","/**\n * @module ol/format/KML\n */\nimport Feature from '../Feature.js';\nimport Fill from '../style/Fill.js';\nimport GeometryCollection from '../geom/GeometryCollection.js';\nimport Icon from '../style/Icon.js';\nimport ImageState from '../ImageState.js';\nimport LineString from '../geom/LineString.js';\nimport MultiLineString from '../geom/MultiLineString.js';\nimport MultiPoint from '../geom/MultiPoint.js';\nimport MultiPolygon from '../geom/MultiPolygon.js';\nimport Point from '../geom/Point.js';\nimport Polygon from '../geom/Polygon.js';\nimport Stroke from '../style/Stroke.js';\nimport Style from '../style/Style.js';\nimport Text from '../style/Text.js';\nimport XMLFeature from './XMLFeature.js';\nimport {\n OBJECT_PROPERTY_NODE_FACTORY,\n XML_SCHEMA_INSTANCE_URI,\n createElementNS,\n getAllTextContent,\n isDocument,\n makeArrayExtender,\n makeArrayPusher,\n makeChildAppender,\n makeObjectPropertySetter,\n makeReplacer,\n makeSequence,\n makeSimpleNodeFactory,\n makeStructureNS,\n parse,\n parseNode,\n pushParseAndPop,\n pushSerializeAndPop,\n} from '../xml.js';\nimport {asArray} from '../color.js';\nimport {extend} from '../array.js';\nimport {get as getProjection} from '../proj.js';\nimport {\n readBoolean,\n readDecimal,\n readString,\n writeBooleanTextNode,\n writeCDATASection,\n writeDecimalTextNode,\n writeStringTextNode,\n} from './xsd.js';\nimport {toRadians} from '../math.js';\nimport {transformGeometryWithOptions} from './Feature.js';\n\n/**\n * @typedef {Object} Vec2\n * @property {number} x X coordinate.\n * @property {import(\"../style/Icon.js\").IconAnchorUnits} xunits Units of x.\n * @property {number} y Y coordinate.\n * @property {import(\"../style/Icon.js\").IconAnchorUnits} yunits Units of Y.\n * @property {import(\"../style/Icon.js\").IconOrigin} [origin] Origin.\n */\n\n/**\n * @typedef {Object} GxTrackObject\n * @property {Array>} coordinates Coordinates.\n * @property {Array} whens Whens.\n */\n\n/**\n * @const\n * @type {Array}\n */\nconst GX_NAMESPACE_URIS = ['http://www.google.com/kml/ext/2.2'];\n\n/**\n * @const\n * @type {Array}\n */\nconst NAMESPACE_URIS = [\n null,\n 'http://earth.google.com/kml/2.0',\n 'http://earth.google.com/kml/2.1',\n 'http://earth.google.com/kml/2.2',\n 'http://www.opengis.net/kml/2.2',\n];\n\n/**\n * @const\n * @type {string}\n */\nconst SCHEMA_LOCATION =\n 'http://www.opengis.net/kml/2.2 ' +\n 'https://developers.google.com/kml/schema/kml22gx.xsd';\n\n/**\n * @type {Object}\n */\nconst ICON_ANCHOR_UNITS_MAP = {\n 'fraction': 'fraction',\n 'pixels': 'pixels',\n 'insetPixels': 'pixels',\n};\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst PLACEMARK_PARSERS = makeStructureNS(\n NAMESPACE_URIS,\n {\n 'ExtendedData': extendedDataParser,\n 'Region': regionParser,\n 'MultiGeometry': makeObjectPropertySetter(readMultiGeometry, 'geometry'),\n 'LineString': makeObjectPropertySetter(readLineString, 'geometry'),\n 'LinearRing': makeObjectPropertySetter(readLinearRing, 'geometry'),\n 'Point': makeObjectPropertySetter(readPoint, 'geometry'),\n 'Polygon': makeObjectPropertySetter(readPolygon, 'geometry'),\n 'Style': makeObjectPropertySetter(readStyle),\n 'StyleMap': placemarkStyleMapParser,\n 'address': makeObjectPropertySetter(readString),\n 'description': makeObjectPropertySetter(readString),\n 'name': makeObjectPropertySetter(readString),\n 'open': makeObjectPropertySetter(readBoolean),\n 'phoneNumber': makeObjectPropertySetter(readString),\n 'styleUrl': makeObjectPropertySetter(readStyleURL),\n 'visibility': makeObjectPropertySetter(readBoolean),\n },\n makeStructureNS(GX_NAMESPACE_URIS, {\n 'MultiTrack': makeObjectPropertySetter(readGxMultiTrack, 'geometry'),\n 'Track': makeObjectPropertySetter(readGxTrack, 'geometry'),\n })\n);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst NETWORK_LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'ExtendedData': extendedDataParser,\n 'Region': regionParser,\n 'Link': linkParser,\n 'address': makeObjectPropertySetter(readString),\n 'description': makeObjectPropertySetter(readString),\n 'name': makeObjectPropertySetter(readString),\n 'open': makeObjectPropertySetter(readBoolean),\n 'phoneNumber': makeObjectPropertySetter(readString),\n 'visibility': makeObjectPropertySetter(readBoolean),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst LINK_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'href': makeObjectPropertySetter(readURI),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst CAMERA_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n Altitude: makeObjectPropertySetter(readDecimal),\n Longitude: makeObjectPropertySetter(readDecimal),\n Latitude: makeObjectPropertySetter(readDecimal),\n Tilt: makeObjectPropertySetter(readDecimal),\n AltitudeMode: makeObjectPropertySetter(readString),\n Heading: makeObjectPropertySetter(readDecimal),\n Roll: makeObjectPropertySetter(readDecimal),\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst REGION_PARSERS = makeStructureNS(NAMESPACE_URIS, {\n 'LatLonAltBox': latLonAltBoxParser,\n 'Lod': lodParser,\n});\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst KML_SEQUENCE = makeStructureNS(NAMESPACE_URIS, ['Document', 'Placemark']);\n\n/**\n * @const\n * @type {Object>}\n */\n// @ts-ignore\nconst KML_SERIALIZERS = makeStructureNS(NAMESPACE_URIS, {\n 'Document': makeChildAppender(writeDocument),\n 'Placemark': makeChildAppender(writePlacemark),\n});\n\n/**\n * @type {import(\"../color.js\").Color}\n */\nlet DEFAULT_COLOR;\n\n/**\n * @type {Fill|null}\n */\nlet DEFAULT_FILL_STYLE = null;\n\n/**\n * Get the default fill style (or null if not yet set).\n * @return {Fill|null} The default fill style.\n */\nexport function getDefaultFillStyle() {\n return DEFAULT_FILL_STYLE;\n}\n\n/**\n * @type {import(\"../size.js\").Size}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR;\n\n/**\n * @type {import(\"../style/Icon.js\").IconAnchorUnits}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR_X_UNITS;\n\n/**\n * @type {import(\"../style/Icon.js\").IconAnchorUnits}\n */\nlet DEFAULT_IMAGE_STYLE_ANCHOR_Y_UNITS;\n\n/**\n * @type {import(\"../size.js\").Size}\n */\nlet DEFAULT_IMAGE_STYLE_SIZE;\n\n/**\n * @type {string}\n */\nlet DEFAULT_IMAGE_STYLE_SRC;\n\n/**\n * @type {import(\"../style/Image.js\").default|null}\n */\nlet DEFAULT_IMAGE_STYLE = null;\n\n/**\n * Get the default image style (or null if not yet set).\n * @return {import(\"../style/Image.js\").default|null} The default image style.\n */\nexport function getDefaultImageStyle() {\n return DEFAULT_IMAGE_STYLE;\n}\n\n/**\n * @type {string}\n */\nlet DEFAULT_NO_IMAGE_STYLE;\n\n/**\n * @type {Stroke|null}\n */\nlet DEFAULT_STROKE_STYLE = null;\n\n/**\n * Get the default stroke style (or null if not yet set).\n * @return {Stroke|null} The default stroke style.\n */\nexport function getDefaultStrokeStyle() {\n return DEFAULT_STROKE_STYLE;\n}\n\n/**\n * @type {Stroke}\n */\nlet DEFAULT_TEXT_STROKE_STYLE;\n\n/**\n * @type {Text|null}\n */\nlet DEFAULT_TEXT_STYLE = null;\n\n/**\n * Get the default text style (or null if not yet set).\n * @return {Text|null} The default text style.\n */\nexport function getDefaultTextStyle() {\n return DEFAULT_TEXT_STYLE;\n}\n\n/**\n * @type {Style|null}\n */\nlet DEFAULT_STYLE = null;\n\n/**\n * Get the default style (or null if not yet set).\n * @return {Style|null} The default style.\n */\nexport function getDefaultStyle() {\n return DEFAULT_STYLE;\n}\n\n/**\n * @type {Array