/*! For license information please see ol.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ol=e():t.ol=e()}(self,(function(){return function(){var t,e={187:function(t){"use strict";function e(t,e,r){r=r||2;var o,h,a,c,f,p,m,v=e&&e.length,g=v?e[0]*r:t.length,y=i(t,0,g,r,!0),w=[];if(!y||y.next===y.prev)return w;if(v&&(y=function(t,e,s,r){var o,h,a,c=[];for(o=0,h=e.length;o<h;o++)(a=i(t,e[o]*r,o<h-1?e[o+1]*r:t.length,r,!1))===a.next&&(a.steiner=!0),c.push(d(a));for(c.sort(u),o=0;o<c.length;o++)s=n(s=l(c[o],s),s.next);return s}(t,e,y,r)),t.length>80*r){o=a=t[0],h=c=t[1];for(var x=r;x<g;x+=r)(f=t[x])<o&&(o=f),(p=t[x+1])<h&&(h=p),f>a&&(a=f),p>c&&(c=p);m=0!==(m=Math.max(a-o,c-h))?1/m:0}return s(y,w,r,o,h,m),w}function i(t,e,i,n,s){var r,o;if(s===E(t,e,i,n)>0)for(r=e;r<i;r+=n)o=S(r,t[r],t[r+1],o);else for(r=i-n;r>=e;r-=n)o=S(r,t[r],t[r+1],o);return o&&g(o,o.next)&&(P(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||!g(n,n.next)&&0!==v(n.prev,n,n.next))n=n.next;else{if(P(n),(n=e=n.prev)===n.next)break;i=!0}}while(i||n!==e);return e}function s(t,e,i,u,l,c,d){if(t){!d&&c&&function(t,e,i,n){var s=t;do{null===s.z&&(s.z=f(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){var e,i,n,s,r,o,h,a,u=1;do{for(i=t,t=null,r=null,o=0;i;){for(o++,n=i,h=0,e=0;e<u&&(h++,n=n.nextZ);e++);for(a=u;h>0||a>0&&n;)0!==h&&(0===a||!n||i.z<=n.z)?(s=i,i=i.nextZ,h--):(s=n,n=n.nextZ,a--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,u*=2}while(o>1)}(s)}(t,u,l,c);for(var p,m,v=t;t.prev!==t.next;)if(p=t.prev,m=t.next,c?o(t,u,l,c):r(t))e.push(p.i/i),e.push(t.i/i),e.push(m.i/i),P(t),t=m.next,v=m.next;else if((t=m)===v){d?1===d?s(t=h(n(t),e,i),e,i,u,l,c,2):2===d&&a(t,e,i,u,l,c):s(n(t),e,i,u,l,c,1);break}}}function r(t){var e=t.prev,i=t,n=t.next;if(v(e,i,n)>=0)return!1;for(var s=t.next.next;s!==t.prev;){if(p(e.x,e.y,i.x,i.y,n.x,n.y,s.x,s.y)&&v(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function o(t,e,i,n){var s=t.prev,r=t,o=t.next;if(v(s,r,o)>=0)return!1;for(var h=s.x<r.x?s.x<o.x?s.x:o.x:r.x<o.x?r.x:o.x,a=s.y<r.y?s.y<o.y?s.y:o.y:r.y<o.y?r.y:o.y,u=s.x>r.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,l=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,c=f(h,a,e,i,n),d=f(u,l,e,i,n),m=t.prevZ,g=t.nextZ;m&&m.z>=c&&g&&g.z<=d;){if(m!==t.prev&&m!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;if(m=m.prevZ,g!==t.prev&&g!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&v(g.prev,g,g.next)>=0)return!1;g=g.nextZ}for(;m&&m.z>=c;){if(m!==t.prev&&m!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,m.x,m.y)&&v(m.prev,m,m.next)>=0)return!1;m=m.prevZ}for(;g&&g.z<=d;){if(g!==t.prev&&g!==t.next&&p(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&v(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function h(t,e,i){var s=t;do{var r=s.prev,o=s.next.next;!g(r,o)&&y(r,s,s.next,o)&&b(r,o)&&b(o,r)&&(e.push(r.i/i),e.push(s.i/i),e.push(o.i/i),P(s),P(s.next),s=t=o),s=s.next}while(s!==t);return n(s)}function a(t,e,i,r,o,h){var a=t;do{for(var u=a.next.next;u!==a.prev;){if(a.i!==u.i&&m(a,u)){var l=M(a,u);return a=n(a,a.next),l=n(l,l.next),s(a,e,i,r,o,h),void s(l,e,i,r,o,h)}u=u.next}a=a.next}while(a!==t)}function u(t,e){return t.x-e.x}function l(t,e){var i=function(t,e){var i,n=e,s=t.x,r=t.y,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var h=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(h<=s&&h>o){if(o=h,h===s){if(r===n.y)return n;if(r===n.next.y)return n.next}i=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!i)return null;if(s===o)return i;var a,u=i,l=i.x,f=i.y,d=1/0;n=i;do{s>=n.x&&n.x>=l&&s!==n.x&&p(r<f?s:o,r,l,f,r<f?o:s,r,n.x,n.y)&&(a=Math.abs(r-n.y)/(s-n.x),b(n,t)&&(a<d||a===d&&(n.x>i.x||n.x===i.x&&c(i,n)))&&(i=n,d=a)),n=n.next}while(n!==u);return i}(t,e);if(!i)return e;var s=M(i,t),r=n(i,i.next);return n(s,s.next),e===i?r:e}function c(t,e){return v(t.prev,t,e.prev)<0&&v(e.next,t,t.next)<0}function f(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*s)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*s)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function p(t,e,i,n,s,r,o,h){return(s-o)*(e-h)-(t-o)*(r-h)>=0&&(t-o)*(n-h)-(i-o)*(e-h)>=0&&(i-o)*(r-h)-(s-o)*(n-h)>=0}function m(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)&&(b(t,e)&&b(e,t)&&function(t,e){var i=t,n=!1,s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(v(t.prev,t,e.prev)||v(t,e.prev,e))||g(t,e)&&v(t.prev,t,t.next)>0&&v(e.prev,e,e.next)>0)}function v(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function g(t,e){return t.x===e.x&&t.y===e.y}function y(t,e,i,n){var s=x(v(t,e,i)),r=x(v(t,e,n)),o=x(v(i,n,t)),h=x(v(i,n,e));return s!==r&&o!==h||(!(0!==s||!w(t,i,e))||(!(0!==r||!w(t,n,e))||(!(0!==o||!w(i,t,n))||!(0!==h||!w(i,e,n)))))}function w(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 x(t){return t>0?1:t<0?-1:0}function b(t,e){return v(t.prev,t,t.next)<0?v(t,e,t.next)>=0&&v(t,t.prev,e)>=0:v(t,e,t.prev)<0||v(t,t.next,e)<0}function M(t,e){var i=new _(t.i,t.x,t.y),n=new _(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function S(t,e,i,n){var s=new _(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function P(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 _(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function E(t,e,i,n){for(var s=0,r=e,o=i-n;r<i;r+=n)s+=(t[o]-t[r])*(t[r+1]+t[o+1]),o=r;return s}t.exports=e,t.exports.default=e,e.deviation=function(t,e,i,n){var s=e&&e.length,r=s?e[0]*i:t.length,o=Math.abs(E(t,0,r,i));if(s)for(var h=0,a=e.length;h<a;h++){var u=e[h]*i,l=h<a-1?e[h+1]*i:t.length;o-=Math.abs(E(t,u,l,i))}var c=0;for(h=0;h<n.length;h+=3){var f=n[h]*i,d=n[h+1]*i,p=n[h+2]*i;c+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===c?0:Math.abs((c-o)/o)},e.flatten=function(t){for(var e=t[0][0].length,i={vertices:[],holes:[],dimensions:e},n=0,s=0;s<t.length;s++){for(var r=0;r<t[s].length;r++)for(var o=0;o<e;o++)i.vertices.push(t[s][r][o]);s>0&&(n+=t[s-1].length,i.holes.push(n))}return i}},645:function(t,e){e.read=function(t,e,i,n,s){var r,o,h=8*s-n-1,a=(1<<h)-1,u=a>>1,l=-7,c=i?s-1:0,f=i?-1:1,d=t[e+c];for(c+=f,r=d&(1<<-l)-1,d>>=-l,l+=h;l>0;r=256*r+t[e+c],c+=f,l-=8);for(o=r&(1<<-l)-1,r>>=-l,l+=n;l>0;o=256*o+t[e+c],c+=f,l-=8);if(0===r)r=1-u;else{if(r===a)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),r-=u}return(d?-1:1)*o*Math.pow(2,r-n)},e.write=function(t,e,i,n,s,r){var o,h,a,u=8*r-s-1,l=(1<<u)-1,c=l>>1,f=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:r-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(h=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),(e+=o+c>=1?f/a:f*Math.pow(2,1-c))*a>=2&&(o++,a/=2),o+c>=l?(h=0,o=l):o+c>=1?(h=(e*a-1)*Math.pow(2,s),o+=c):(h=e*Math.pow(2,c-1)*Math.pow(2,s),o=0));s>=8;t[i+d]=255&h,d+=p,h/=256,s-=8);for(o=o<<s|h,u+=s;u>0;t[i+d]=255&o,d+=p,o/=256,u-=8);t[i+d-p]|=128*m}},593:function(t,e,i){"use strict";const n=i(411),s=Symbol("max"),r=Symbol("length"),o=Symbol("lengthCalculator"),h=Symbol("allowStale"),a=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),f=Symbol("cache"),d=Symbol("updateAgeOnGet"),p=()=>1;const m=(t,e,i)=>{const n=t[f].get(e);if(n){const e=n.value;if(v(t,e)){if(y(t,n),!t[h])return}else i&&(t[d]&&(n.value.now=Date.now()),t[c].unshiftNode(n));return e.value}},v=(t,e)=>{if(!e||!e.maxAge&&!t[a])return!1;const i=Date.now()-e.now;return e.maxAge?i>e.maxAge:t[a]&&i>t[a]},g=t=>{if(t[r]>t[s])for(let e=t[c].tail;t[r]>t[s]&&null!==e;){const i=e.prev;y(t,e),e=i}},y=(t,e)=>{if(e){const i=e.value;t[u]&&t[u](i.key,i.value),t[r]-=i.length,t[f].delete(i.key),t[c].removeNode(e)}};class w{constructor(t,e,i,n,s){this.key=t,this.value=e,this.length=i,this.now=n,this.maxAge=s||0}}const x=(t,e,i,n)=>{let s=i.value;v(t,s)&&(y(t,i),t[h]||(s=void 0)),s&&e.call(n,s.value,s.key,t)};t.exports=class{constructor(t){if("number"==typeof t&&(t={max:t}),t||(t={}),t.max&&("number"!=typeof t.max||t.max<0))throw new TypeError("max must be a non-negative number");this[s]=t.max||1/0;const e=t.length||p;if(this[o]="function"!=typeof e?p:e,this[h]=t.stale||!1,t.maxAge&&"number"!=typeof t.maxAge)throw new TypeError("maxAge must be a number");this[a]=t.maxAge||0,this[u]=t.dispose,this[l]=t.noDisposeOnSet||!1,this[d]=t.updateAgeOnGet||!1,this.reset()}set max(t){if("number"!=typeof t||t<0)throw new TypeError("max must be a non-negative number");this[s]=t||1/0,g(this)}get max(){return this[s]}set allowStale(t){this[h]=!!t}get allowStale(){return this[h]}set maxAge(t){if("number"!=typeof t)throw new TypeError("maxAge must be a non-negative number");this[a]=t,g(this)}get maxAge(){return this[a]}set lengthCalculator(t){"function"!=typeof t&&(t=p),t!==this[o]&&(this[o]=t,this[r]=0,this[c].forEach((t=>{t.length=this[o](t.value,t.key),this[r]+=t.length}))),g(this)}get lengthCalculator(){return this[o]}get length(){return this[r]}get itemCount(){return this[c].length}rforEach(t,e){e=e||this;for(let i=this[c].tail;null!==i;){const n=i.prev;x(this,t,i,e),i=n}}forEach(t,e){e=e||this;for(let i=this[c].head;null!==i;){const n=i.next;x(this,t,i,e),i=n}}keys(){return this[c].toArray().map((t=>t.key))}values(){return this[c].toArray().map((t=>t.value))}reset(){this[u]&&this[c]&&this[c].length&&this[c].forEach((t=>this[u](t.key,t.value))),this[f]=new Map,this[c]=new n,this[r]=0}dump(){return this[c].map((t=>!v(this,t)&&{k:t.key,v:t.value,e:t.now+(t.maxAge||0)})).toArray().filter((t=>t))}dumpLru(){return this[c]}set(t,e,i){if((i=i||this[a])&&"number"!=typeof i)throw new TypeError("maxAge must be a number");const n=i?Date.now():0,h=this[o](e,t);if(this[f].has(t)){if(h>this[s])return y(this,this[f].get(t)),!1;const o=this[f].get(t).value;return this[u]&&(this[l]||this[u](t,o.value)),o.now=n,o.maxAge=i,o.value=e,this[r]+=h-o.length,o.length=h,this.get(t),g(this),!0}const d=new w(t,e,h,n,i);return d.length>this[s]?(this[u]&&this[u](t,e),!1):(this[r]+=d.length,this[c].unshift(d),this[f].set(t,this[c].head),g(this),!0)}has(t){if(!this[f].has(t))return!1;const e=this[f].get(t).value;return!v(this,e)}get(t){return m(this,t,!0)}peek(t){return m(this,t,!1)}pop(){const t=this[c].tail;return t?(y(this,t),t.value):null}del(t){y(this,this[f].get(t))}load(t){this.reset();const e=Date.now();for(let i=t.length-1;i>=0;i--){const n=t[i],s=n.e||0;if(0===s)this.set(n.k,n.v);else{const t=s-e;t>0&&this.set(n.k,n.v,t)}}}prune(){this[f].forEach(((t,e)=>m(this,e,!1)))}}},614:function(t,e,i){"use strict";t.exports=s;var n=i(645);function s(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}s.Varint=0,s.Fixed64=1,s.Bytes=2,s.Fixed32=5;var r=4294967296,o=1/r,h="undefined"==typeof TextDecoder?null:new TextDecoder("utf8");function a(t){return t.type===s.Bytes?t.readVarint()+t.pos:t.pos+1}function u(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function l(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 s=i.pos-1;s>=t;s--)i.buf[s+n]=i.buf[s]}function c(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function f(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function d(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function p(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function m(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function v(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function g(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function y(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function w(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function x(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function b(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function M(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}s.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),s=n>>3,r=this.pos;this.type=7&n,t(s,e,this),this.pos===r&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=x(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=M(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=x(this.buf,this.pos)+x(this.buf,this.pos+4)*r;return this.pos+=8,t},readSFixed64:function(){var t=x(this.buf,this.pos)+M(this.buf,this.pos+4)*r;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,s,r=i.buf;if(s=r[i.pos++],n=(112&s)>>4,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<3,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<10,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<17,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(127&s)<<24,s<128)return u(t,n,e);if(s=r[i.pos++],n|=(1&s)<<31,s<128)return u(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&&h?function(t,e,i){return h.decode(t.subarray(e,i))}(this.buf,e,t):function(t,e,i){var n="",s=e;for(;s<i;){var r,o,h,a=t[s],u=null,l=a>239?4:a>223?3:a>191?2:1;if(s+l>i)break;1===l?a<128&&(u=a):2===l?128==(192&(r=t[s+1]))&&(u=(31&a)<<6|63&r)<=127&&(u=null):3===l?(r=t[s+1],o=t[s+2],128==(192&r)&&128==(192&o)&&((u=(15&a)<<12|(63&r)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===l&&(r=t[s+1],o=t[s+2],h=t[s+3],128==(192&r)&&128==(192&o)&&128==(192&h)&&((u=(15&a)<<18|(63&r)<<12|(63&o)<<6|63&h)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,l=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),s+=l}return n}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==s.Bytes)return t.push(this.readVarint(e));var i=a(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==s.Bytes)return t.push(this.readSVarint());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==s.Bytes)return t.push(this.readBoolean());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==s.Bytes)return t.push(this.readFloat());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==s.Bytes)return t.push(this.readDouble());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==s.Bytes)return t.push(this.readFixed32());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==s.Bytes)return t.push(this.readSFixed32());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==s.Bytes)return t.push(this.readFixed64());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==s.Bytes)return t.push(this.readSFixed64());var e=a(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===s.Varint)for(;this.buf[this.pos++]>127;);else if(e===s.Bytes)this.pos=this.readVarint()+this.pos;else if(e===s.Fixed32)this.pos+=4;else{if(e!==s.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),b(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(t*o),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),b(this.buf,-1&t,this.pos),b(this.buf,Math.floor(t*o),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||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,s,r=0;r<e.length;r++){if((n=e.charCodeAt(r))>55295&&n<57344){if(!s){n>56319||r+1===e.length?(t[i++]=239,t[i++]=191,t[i++]=189):s=n;continue}if(n<56320){t[i++]=239,t[i++]=191,t[i++]=189,s=n;continue}n=s-55296<<10|n-56320|65536,s=null}else s&&(t[i++]=239,t[i++]=191,t[i++]=189,s=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&&l(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<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&l(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,i){this.writeTag(t,s.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,f,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,m,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,d,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,p,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,v,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,g,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,y,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,w,e)},writeBytesField:function(t,e){this.writeTag(t,s.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,s.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,s.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,s.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,s.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,s.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,s.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,s.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,s.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,s.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}},582:function(t){t.exports=function(){"use strict";function t(t,n,s,r,o){!function t(i,n,s,r,o){for(;r>s;){if(r-s>600){var h=r-s+1,a=n-s+1,u=Math.log(h),l=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*l*(h-l)/h)*(a-h/2<0?-1:1);t(i,n,Math.max(s,Math.floor(n-a*l/h+c)),Math.min(r,Math.floor(n+(h-a)*l/h+c)),o)}var f=i[n],d=s,p=r;for(e(i,s,n),o(i[r],f)>0&&e(i,s,r);d<p;){for(e(i,d,p),d++,p--;o(i[d],f)<0;)d++;for(;o(i[p],f)>0;)p--}0===o(i[s],f)?e(i,s,p):e(i,++p,r),p<=n&&(s=p+1),n<=p&&(r=p-1)}}(t,n,s||0,r||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 t<e?-1:t>e?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 s(t,e,i){if(!i)return e.indexOf(t);for(var n=0;n<e.length;n++)if(i(t,e[n]))return n;return-1}function r(t,e){o(t,0,t.children.length,e,t)}function o(t,e,i,n,s){s||(s=p(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var r=e;r<i;r++){var o=t.children[r];h(s,t.leaf?n(o):o)}return s}function h(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function a(t,e){return t.minX-e.minX}function u(t,e){return t.minY-e.minY}function l(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function c(t){return t.maxX-t.minX+(t.maxY-t.minY)}function f(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function d(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.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 m(e,i,n,s,r){for(var o=[i,n];o.length;)if(!((n=o.pop())-(i=o.pop())<=s)){var h=i+Math.ceil((n-i)/s/2)*s;t(e,h,i,n,r),o.push(i,h,h,n)}}return n.prototype.all=function(){return this._all(this.data,[])},n.prototype.search=function(t){var e=this.data,i=[];if(!d(t,e))return i;for(var n=this.toBBox,s=[];e;){for(var r=0;r<e.children.length;r++){var o=e.children[r],h=e.leaf?n(o):o;d(t,h)&&(e.leaf?i.push(o):f(t,h)?this._all(o,i):s.push(o))}e=s.pop()}return i},n.prototype.collides=function(t){var e=this.data;if(!d(t,e))return!1;for(var i=[];e;){for(var n=0;n<e.children.length;n++){var s=e.children[n],r=e.leaf?this.toBBox(s):s;if(d(t,r)){if(e.leaf||f(t,r))return!0;i.push(s)}}e=i.pop()}return!1},n.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0;e<t.length;e++)this.insert(t[e]);return this}var i=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===i.height)this._splitRoot(this.data,i);else{if(this.data.height<i.height){var n=this.data;this.data=i,i=n}this._insert(i,this.data.height-i.height-1,!0)}else this.data=i;return this},n.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},n.prototype.clear=function(){return this.data=p([]),this},n.prototype.remove=function(t,e){if(!t)return this;for(var i,n,r,o=this.data,h=this.toBBox(t),a=[],u=[];o||a.length;){if(o||(o=a.pop(),n=a[a.length-1],i=u.pop(),r=!0),o.leaf){var l=s(t,o.children,e);if(-1!==l)return o.children.splice(l,1),a.push(o),this._condense(a),this}r||o.leaf||!f(o,h)?n?(i++,o=n.children[i],r=!1):o=null:(a.push(o),u.push(i),i=0,n=o,o=o.children[0])}return this},n.prototype.toBBox=function(t){return t},n.prototype.compareMinX=function(t,e){return t.minX-e.minX},n.prototype.compareMinY=function(t,e){return t.minY-e.minY},n.prototype.toJSON=function(){return this.data},n.prototype.fromJSON=function(t){return this.data=t,this},n.prototype._all=function(t,e){for(var i=[];t;)t.leaf?e.push.apply(e,t.children):i.push.apply(i,t.children),t=i.pop();return e},n.prototype._build=function(t,e,i,n){var s,o=i-e+1,h=this._maxEntries;if(o<=h)return r(s=p(t.slice(e,i+1)),this.toBBox),s;n||(n=Math.ceil(Math.log(o)/Math.log(h)),h=Math.ceil(o/Math.pow(h,n-1))),(s=p([])).leaf=!1,s.height=n;var a=Math.ceil(o/h),u=a*Math.ceil(Math.sqrt(h));m(t,e,i,u,this.compareMinX);for(var l=e;l<=i;l+=u){var c=Math.min(l+u-1,i);m(t,l,c,a,this.compareMinY);for(var f=l;f<=c;f+=a){var d=Math.min(f+a-1,c);s.children.push(this._build(t,f,d,n-1))}}return r(s,this.toBBox),s},n.prototype._chooseSubtree=function(t,e,i,n){for(;n.push(e),!e.leaf&&n.length-1!==i;){for(var s=1/0,r=1/0,o=void 0,h=0;h<e.children.length;h++){var a=e.children[h],u=l(a),c=(f=t,d=a,(Math.max(d.maxX,f.maxX)-Math.min(d.minX,f.minX))*(Math.max(d.maxY,f.maxY)-Math.min(d.minY,f.minY))-u);c<r?(r=c,s=u<s?u:s,o=a):c===r&&u<s&&(s=u,o=a)}e=o||e.children[0]}var f,d;return e},n.prototype._insert=function(t,e,i){var n=i?t:this.toBBox(t),s=[],r=this._chooseSubtree(n,this.data,e,s);for(r.children.push(t),h(r,n);e>=0&&s[e].children.length>this._maxEntries;)this._split(s,e),e--;this._adjustParentBBoxes(n,s,e)},n.prototype._split=function(t,e){var i=t[e],n=i.children.length,s=this._minEntries;this._chooseSplitAxis(i,s,n);var o=this._chooseSplitIndex(i,s,n),h=p(i.children.splice(o,i.children.length-o));h.height=i.height,h.leaf=i.leaf,r(i,this.toBBox),r(h,this.toBBox),e?t[e-1].children.push(h):this._splitRoot(i,h)},n.prototype._splitRoot=function(t,e){this.data=p([t,e]),this.data.height=t.height+1,this.data.leaf=!1,r(this.data,this.toBBox)},n.prototype._chooseSplitIndex=function(t,e,i){for(var n,s,r,h,a,u,c,f=1/0,d=1/0,p=e;p<=i-e;p++){var m=o(t,0,p,this.toBBox),v=o(t,p,i,this.toBBox),g=(s=m,r=v,h=void 0,a=void 0,u=void 0,c=void 0,h=Math.max(s.minX,r.minX),a=Math.max(s.minY,r.minY),u=Math.min(s.maxX,r.maxX),c=Math.min(s.maxY,r.maxY),Math.max(0,u-h)*Math.max(0,c-a)),y=l(m)+l(v);g<f?(f=g,n=p,d=y<d?y:d):g===f&&y<d&&(d=y,n=p)}return n||i-e},n.prototype._chooseSplitAxis=function(t,e,i){var n=t.leaf?this.compareMinX:a,s=t.leaf?this.compareMinY:u;this._allDistMargin(t,e,i,n)<this._allDistMargin(t,e,i,s)&&t.children.sort(n)},n.prototype._allDistMargin=function(t,e,i,n){t.children.sort(n);for(var s=this.toBBox,r=o(t,0,e,s),a=o(t,i-e,i,s),u=c(r)+c(a),l=e;l<i-e;l++){var f=t.children[l];h(r,t.leaf?s(f):f),u+=c(r)}for(var d=i-e-1;d>=e;d--){var p=t.children[d];h(a,t.leaf?s(p):p),u+=c(a)}return u},n.prototype._adjustParentBBoxes=function(t,e,i){for(var n=i;n>=0;n--)h(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():r(t[e],this.toBBox)},n}()},635:function(t,e,i){const n=i(622);t.exports=function(t,e,i){const s=i&&i.debug||!1,r=i&&i.startIndex||0;s&&console.log("starting findTagByName with",e," and ",i);const o=n(t,`<${e}[ >]`,r);if(s&&console.log("start:",o),-1===o)return;const h=t.slice(o+e.length);let a=n(h,"[ /]"+e+">",0);const u=-1===a;u&&(a=n(h,"[ /]>",0));const l=o+e.length+a+1+(u?0:e.length)+1;if(s&&console.log("end:",l),-1===l)return;const c=t.slice(o,l);let f;return f=u?null:c.slice(c.indexOf(">")+1,c.lastIndexOf("<")),{inner:f,outer:c,start:o,end:l}}},602:function(t,e,i){const n=i(635);t.exports=function(t,e,i){const s=[],r=i&&i.debug||!1;let o,h=i&&i.startIndex||0;for(;o=n(t,e,{debug:r,startIndex:h});)h=o.end,s.push(o);return r&&console.log("findTagsByName found",s.length,"tags"),s}},330:function(t){t.exports=function(t,e,i){const n=i&&i.debug||!1;n&&console.log("getting "+e+" in "+t);const s="object"==typeof t?t.outer:t,r=`${e}\\="([^"]*)"`;n&&console.log("pattern:",r);const o=new RegExp(r).exec(s);if(n&&console.log("match:",o),o)return o[1]}},622:function(t){t.exports=function(t,e,i){const n=new RegExp(e).exec(t.slice(i));return n?i+n.index:-1}},371:function(t){"use strict";t.exports=function(t){t.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}},411:function(t,e,i){"use strict";function n(t){var e=this;if(e instanceof n||(e=new n),e.tail=null,e.head=null,e.length=0,t&&"function"==typeof t.forEach)t.forEach((function(t){e.push(t)}));else if(arguments.length>0)for(var i=0,s=arguments.length;i<s;i++)e.push(arguments[i]);return e}function s(t,e,i){var n=e===t.head?new h(i,null,e,t):new h(i,e,e.next,t);return null===n.next&&(t.tail=n),null===n.prev&&(t.head=n),t.length++,n}function r(t,e){t.tail=new h(e,t.tail,null,t),t.head||(t.head=t.tail),t.length++}function o(t,e){t.head=new h(e,null,t.head,t),t.tail||(t.tail=t.head),t.length++}function h(t,e,i,n){if(!(this instanceof h))return new h(t,e,i,n);this.list=n,this.value=t,e?(e.next=this,this.prev=e):this.prev=null,i?(i.prev=this,this.next=i):this.next=null}t.exports=n,n.Node=h,n.create=n,n.prototype.removeNode=function(t){if(t.list!==this)throw new Error("removing node which does not belong to this list");var e=t.next,i=t.prev;return e&&(e.prev=i),i&&(i.next=e),t===this.head&&(this.head=e),t===this.tail&&(this.tail=i),t.list.length--,t.next=null,t.prev=null,t.list=null,e},n.prototype.unshiftNode=function(t){if(t!==this.head){t.list&&t.list.removeNode(t);var e=this.head;t.list=this,t.next=e,e&&(e.prev=t),this.head=t,this.tail||(this.tail=t),this.length++}},n.prototype.pushNode=function(t){if(t!==this.tail){t.list&&t.list.removeNode(t);var e=this.tail;t.list=this,t.prev=e,e&&(e.next=t),this.tail=t,this.head||(this.head=t),this.length++}},n.prototype.push=function(){for(var t=0,e=arguments.length;t<e;t++)r(this,arguments[t]);return this.length},n.prototype.unshift=function(){for(var t=0,e=arguments.length;t<e;t++)o(this,arguments[t]);return this.length},n.prototype.pop=function(){if(this.tail){var t=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,t}},n.prototype.shift=function(){if(this.head){var t=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,t}},n.prototype.forEach=function(t,e){e=e||this;for(var i=this.head,n=0;null!==i;n++)t.call(e,i.value,n,this),i=i.next},n.prototype.forEachReverse=function(t,e){e=e||this;for(var i=this.tail,n=this.length-1;null!==i;n--)t.call(e,i.value,n,this),i=i.prev},n.prototype.get=function(t){for(var e=0,i=this.head;null!==i&&e<t;e++)i=i.next;if(e===t&&null!==i)return i.value},n.prototype.getReverse=function(t){for(var e=0,i=this.tail;null!==i&&e<t;e++)i=i.prev;if(e===t&&null!==i)return i.value},n.prototype.map=function(t,e){e=e||this;for(var i=new n,s=this.head;null!==s;)i.push(t.call(e,s.value,this)),s=s.next;return i},n.prototype.mapReverse=function(t,e){e=e||this;for(var i=new n,s=this.tail;null!==s;)i.push(t.call(e,s.value,this)),s=s.prev;return i},n.prototype.reduce=function(t,e){var i,n=this.head;if(arguments.length>1)i=e;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,i=this.head.value}for(var s=0;null!==n;s++)i=t(i,n.value,s),n=n.next;return i},n.prototype.reduceReverse=function(t,e){var i,n=this.tail;if(arguments.length>1)i=e;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,i=this.tail.value}for(var s=this.length-1;null!==n;s--)i=t(i,n.value,s),n=n.prev;return i},n.prototype.toArray=function(){for(var t=new Array(this.length),e=0,i=this.head;null!==i;e++)t[e]=i.value,i=i.next;return t},n.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,i=this.tail;null!==i;e++)t[e]=i.value,i=i.prev;return t},n.prototype.slice=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var i=new n;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=0,r=this.head;null!==r&&s<t;s++)r=r.next;for(;null!==r&&s<e;s++,r=r.next)i.push(r.value);return i},n.prototype.sliceReverse=function(t,e){(e=e||this.length)<0&&(e+=this.length),(t=t||0)<0&&(t+=this.length);var i=new n;if(e<t||e<0)return i;t<0&&(t=0),e>this.length&&(e=this.length);for(var s=this.length,r=this.tail;null!==r&&s>e;s--)r=r.prev;for(;null!==r&&s>t;s--,r=r.prev)i.push(r.value);return i},n.prototype.splice=function(t,e,...i){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,r=this.head;null!==r&&n<t;n++)r=r.next;var o=[];for(n=0;r&&n<e;n++)o.push(r.value),r=this.removeNode(r);null===r&&(r=this.tail),r!==this.head&&r!==this.tail&&(r=r.prev);for(n=0;n<i.length;n++)r=s(this,r,i[n]);return o},n.prototype.reverse=function(){for(var t=this.head,e=this.tail,i=t;null!==i;i=i.prev){var n=i.prev;i.prev=i.next,i.next=n}return this.head=e,this.tail=t,this};try{i(371)(n)}catch(t){}},752:function(){},640:function(){},630:function(){},499:function(t,e,i){"use strict";i.d(e,{Ie:function(){return a},It:function(){return r},L:function(){return n},L5:function(){return l},P1:function(){return f},Qb:function(){return c},pd:function(){return u},sf:function(){return h}});const n={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},s={};for(const t in n)n.hasOwnProperty(t)&&(s[n[t]]=parseInt(t,10));const r=[s.BitsPerSample,s.ExtraSamples,s.SampleFormat,s.StripByteCounts,s.StripOffsets,s.StripRowCounts,s.TileByteCounts,s.TileOffsets,s.SubIFDs],o={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},h={};for(const t in o)o.hasOwnProperty(t)&&(h[o[t]]=parseInt(t,10));const a={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},u={Unspecified:0,Assocalpha:1,Unassalpha:2},l={Version:0,AddCompression:1},c={None:0,Deflate:1},f={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},d={};for(const t in f)f.hasOwnProperty(t)&&(d[f[t]]=parseInt(t,10))}},i={};function n(t){var s=i[t];if(void 0!==s)return s.exports;var r=i[t]={exports:{}};return e[t].call(r.exports,r,r.exports,n),r.exports}n.m=e,n.d=function(t,e){for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.f={},n.e=function(t){return Promise.all(Object.keys(n.f).reduce((function(e,i){return n.f[i](t,e),e}),[]))},n.u=function(t){return t+".ol.js"},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},t={},n.l=function(e,i,s,r){if(t[e])t[e].push(i);else{var o,h;if(void 0!==s)for(var a=document.getElementsByTagName("script"),u=0;u<a.length;u++){var l=a[u];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="ol:"+s){o=l;break}}o||(h=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,n.nc&&o.setAttribute("nonce",n.nc),o.setAttribute("data-webpack","ol:"+s),o.src=e),t[e]=[i];var c=function(i,n){o.onerror=o.onload=null,clearTimeout(f);var s=t[e];if(delete t[e],o.parentNode&&o.parentNode.removeChild(o),s&&s.forEach((function(t){return t(n)})),i)return i(n)},f=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),h&&document.head.appendChild(o)}},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},function(){var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t}(),function(){var t={179:0};n.f.j=function(e,i){var s=n.o(t,e)?t[e]:void 0;if(0!==s)if(s)i.push(s[2]);else{var r=new Promise((function(i,n){s=t[e]=[i,n]}));i.push(s[2]=r);var o=n.p+n.u(e),h=new Error;n.l(o,(function(i){if(n.o(t,e)&&(0!==(s=t[e])&&(t[e]=void 0),s)){var r=i&&("load"===i.type?"missing":i.type),o=i&&i.target&&i.target.src;h.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",h.name="ChunkLoadError",h.type=r,h.request=o,s[1](h)}}),"chunk-"+e,e)}};var e=function(e,i){var s,r,o=i[0],h=i[1],a=i[2],u=0;if(o.some((function(e){return 0!==t[e]}))){for(s in h)n.o(h,s)&&(n.m[s]=h[s]);if(a)a(n)}for(e&&e(i);u<o.length;u++)r=o[u],n.o(t,r)&&t[r]&&t[r][0](),t[r]=0},i=self.webpackChunkol=self.webpackChunkol||[];i.forEach(e.bind(null,0)),i.push=e.bind(null,i.push.bind(i))}();var s={};return function(){"use strict";function t(){throw new Error("Unimplemented abstract method.")}n.d(s,{default:function(){return LF}});let e=0;function i(t){return t.ol_uid||(t.ol_uid=String(++e))}const r="7.0.0";class o extends Error{constructor(t){const e="Assertion failed. See https://openlayers.org/en/"+("v"+r.split("-")[0])+"/doc/errors/#"+t+" for details.";super(e),this.code=t,this.name="AssertionError",this.message=e}}var h=o;function a(t){t.stopPropagation()}var u=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},l="propertychange";var c=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function f(t,e,i){let n,s;i=i||d;let r=0,o=t.length,h=!1;for(;r<o;)n=r+(o-r>>1),s=+i(t[n],e),s<0?r=n+1:(o=n,h=!s);return h?r:~r}function d(t,e){return t>e?1:t<e?-1:0}function p(t,e,i){const n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;{let s;if(i>0){for(s=1;s<n;++s)if(t[s]<e)return s-1}else if(i<0){for(s=1;s<n;++s)if(t[s]<=e)return s}else for(s=1;s<n;++s){if(t[s]==e)return s;if(t[s]<e)return"function"==typeof i?i(e,t[s-1],t[s])>0?s-1:s:t[s-1]-e<e-t[s]?s-1:s}return n-1}}function m(t,e,i){for(;e<i;){const n=t[e];t[e]=t[i],t[i]=n,++e,--i}}function v(t,e){const i=Array.isArray(e)?e:[e],n=i.length;for(let e=0;e<n;e++)t[t.length]=i[e]}function g(t,e){const i=t.length;if(i!==e.length)return!1;for(let n=0;n<i;n++)if(t[n]!==e[n])return!1;return!0}function y(t,e,i){const n=e||d;return t.every((function(e,s){if(0===s)return!0;const r=n(t[s-1],e);return!(r>0||i&&0===r)}))}function w(){return!0}function x(){return!1}function b(){}function M(t){let e,i,n,s=!1;return function(){const r=Array.prototype.slice.call(arguments);return s&&this===n&&g(r,i)||(s=!0,n=this,i=r,e=t.apply(this,arguments)),e}}function S(t){return function(){let e;try{e=t()}catch(t){return Promise.reject(t)}return e instanceof Promise?e:Promise.resolve(e)}()}function P(t){for(const e in t)delete t[e]}function _(t){let e;for(e in t)return!1;return!e}var E=class extends c{constructor(t){super(),this.t=t,this.S=null,this.P=null,this._=null}addEventListener(t,e){if(!t||!e)return;const i=this._||(this._={}),n=i[t]||(i[t]=[]);n.includes(e)||n.push(e)}dispatchEvent(t){const e="string"==typeof t,i=e?t:t.type,n=this._&&this._[i];if(!n)return;const s=e?new u(t):t;s.target||(s.target=this.t||this);const r=this.P||(this.P={}),o=this.S||(this.S={});let h;i in r||(r[i]=0,o[i]=0),++r[i];for(let t=0,e=n.length;t<e;++t)if(h="handleEvent"in n[t]?n[t].handleEvent(s):n[t].call(this,s),!1===h||s.propagationStopped){h=!1;break}if(0==--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,b);delete r[i]}return h}disposeInternal(){this._&&P(this._)}getListeners(t){return this._&&this._[t]||void 0}hasListener(t){return!!this._&&(t?t in this._:Object.keys(this._).length>0)}removeEventListener(t,e){const i=this._&&this._[t];if(i){const n=i.indexOf(e);-1!==n&&(this.S&&t in this.S?(i[n]=b,++this.S[t]):(i.splice(n,1),0===i.length&&delete this._[t]))}}},T="change",C="error",F="contextmenu",I="click",A="dblclick",k="dragenter",R="dragover",L="drop",N="keydown",O="keypress",z="load",G="resize",j="touchmove",D="wheel";function U(t,e,i,n,s){if(n&&n!==t&&(i=i.bind(n)),s){const n=i;i=function(){t.removeEventListener(e,i),n.apply(this,arguments)}}const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function $(t,e,i,n){return U(t,e,i,n,!0)}function B(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),P(t))}class q extends E{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.T=0}changed(){++this.T,this.dispatchEvent(T)}getRevision(){return this.T}onInternal(t,e){if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=U(this,t[s],e);return n}return U(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const n=t.length;i=new Array(n);for(let s=0;s<n;++s)i[s]=$(this,t[s],e)}else i=$(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)X(i);else if(Array.isArray(t))for(let i=0,n=t.length;i<n;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}function X(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)B(t[e]);else B(t)}q.prototype.on,q.prototype.once,q.prototype.un;var Y=q;class Z extends u{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}var V=class extends Y{constructor(t){super(),this.on,this.once,this.un,i(this),this.C=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.C&&this.C.hasOwnProperty(t)&&(e=this.C[t]),e}getKeys(){return this.C&&Object.keys(this.C)||[]}getProperties(){return this.C&&Object.assign({},this.C)||{}}hasProperties(){return!!this.C}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Z(i,t,e)),i=l,this.hasListener(i)&&this.dispatchEvent(new Z(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.C||(this.C={});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.C&&Object.assign(this.C||(this.C={}),t.C)}unset(t,e){if(this.C&&t in this.C){const i=this.C[t];delete this.C[t],_(this.C)&&(this.C=null),e||this.notify(t,i)}}},W="add",H="remove";const K="length";class J extends u{constructor(t,e,i){super(t),this.element=e,this.index=i}}var Q=class extends V{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.A=!!e.unique,this.R=t||[],this.A)for(let t=0,e=this.R.length;t<e;++t)this.O(this.R[t],t);this.G()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.R;for(let i=0,n=e.length;i<n;++i)t(e[i],i,e)}getArray(){return this.R}item(t){return this.R[t]}getLength(){return this.get(K)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.A&&this.O(e),this.R.splice(t,0,e),this.G(),this.dispatchEvent(new J(W,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){this.A&&this.O(t);const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.R;for(let i=0,n=e.length;i<n;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.R[t];return this.R.splice(t,1),this.G(),this.dispatchEvent(new J(H,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.A&&this.O(e,t);const i=this.R[t];this.R[t]=e,this.dispatchEvent(new J(H,i,t)),this.dispatchEvent(new J(W,e,t))}G(){this.set(K,this.R.length)}O(t,e){for(let i=0,n=this.R.length;i<n;++i)if(this.R[i]===t&&i!==e)throw new h(58)}},tt=0,et=1,it=2,nt=3,st=4;function rt(t){return Math.pow(t,3)}function ot(t){return 1-rt(1-t)}function ht(t){return 3*t*t-2*t*t*t}function at(t){return t}var ut=class extends E{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.interimTile=null,this.key="",this.D=void 0===i.transition?250:i.transition,this.U={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(T)}release(){this.state===nt&&this.setState(st)}getKey(){return this.key+"/"+this.tileCoord}getInterimTile(){if(!this.interimTile)return this;let t=this.interimTile;do{if(t.getState()==it)return this.D=0,t;t=t.interimTile}while(t);return this}refreshInterimChain(){if(!this.interimTile)return;let t=this.interimTile,e=this;do{if(t.getState()==it){t.interimTile=null;break}t.getState()==et?e=t:t.getState()==tt?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==nt&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}load(){t()}getAlpha(t,e){if(!this.D)return 1;let i=this.U[t];if(i){if(-1===i)return 1}else i=e,this.U[t]=i;const n=e-i+1e3/60;return n>=this.D?1:rt(n/this.D)}inTransition(t){return!!this.D&&-1!==this.U[t]}endTransition(t){this.D&&(this.U[t]=-1)}};var lt=class extends ut{constructor(t){const e=tt;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.$=t.loader,this.B=null,this.q=null,this.V=t.size||[256,256]}getSize(){return this.V}getData(){return this.B}getError(){return this.q}load(){if(this.state!==tt&&this.state!==nt)return;this.state=et,this.changed();const t=this;this.$().then((function(e){t.B=e,t.state=it,t.changed()})).catch((function(e){t.q=e,t.state=nt,t.changed()}))}};function ct(t,e){if(!t)throw new h(e)}class ft extends V{constructor(t){if(super(),this.on,this.once,this.un,this.W=void 0,this.H="geometry",this.K=null,this.tt=void 0,this.et=null,this.addChangeListener(this.H,this.it),t)if("function"==typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new ft(this.hasProperties()?this.getProperties():null);t.setGeometryName(this.getGeometryName());const e=this.getGeometry();e&&t.setGeometry(e.clone());const i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.H)}getId(){return this.W}getGeometryName(){return this.H}getStyle(){return this.K}getStyleFunction(){return this.tt}nt(){this.changed()}it(){this.et&&(B(this.et),this.et=null);const t=this.getGeometry();t&&(this.et=U(t,T,this.nt,this)),this.changed()}setGeometry(t){this.set(this.H,t)}setStyle(t){this.K=t,this.tt=t?dt(t):void 0,this.changed()}setId(t){this.W=t,this.changed()}setGeometryName(t){this.removeChangeListener(this.H,this.it),this.H=t,this.addChangeListener(this.H,this.it),this.it()}}function dt(t){if("function"==typeof t)return t;{let e;if(Array.isArray(t))e=t;else{ct("function"==typeof t.getZIndex,41);e=[t]}return function(){return e}}}var pt=ft;const mt="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",vt=mt.includes("firefox"),gt=mt.includes("safari")&&!mt.includes("chrom"),yt=gt&&(mt.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(mt)),wt=mt.includes("webkit")&&!mt.includes("edge"),xt=mt.includes("macintosh"),bt="undefined"!=typeof devicePixelRatio?devicePixelRatio:1,Mt="undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,St="undefined"!=typeof Image&&Image.prototype.decode,Pt=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch(t){}return t}(),_t=new Array(6);function Et(){return[1,0,0,1,0,0]}function Tt(t){return Ft(t,1,0,0,1,0,0)}function Ct(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=t[4],h=t[5],a=e[0],u=e[1],l=e[2],c=e[3],f=e[4],d=e[5];return t[0]=i*a+s*u,t[1]=n*a+r*u,t[2]=i*l+s*c,t[3]=n*l+r*c,t[4]=i*f+s*d+o,t[5]=n*f+r*d+h,t}function Ft(t,e,i,n,s,r,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=s,t[4]=r,t[5]=o,t}function It(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function At(t,e){const i=e[0],n=e[1];return e[0]=t[0]*i+t[2]*n+t[4],e[1]=t[1]*i+t[3]*n+t[5],e}function kt(t,e){const i=Math.cos(e),n=Math.sin(e);return Ct(t,Ft(_t,i,n,-n,i,0,0))}function Rt(t,e,i){return Ct(t,Ft(_t,e,0,0,i,0,0))}function Lt(t,e,i){return Ft(t,e,0,0,i,0,0)}function Nt(t,e,i){return Ct(t,Ft(_t,1,0,0,1,e,i))}function Ot(t,e,i,n,s,r,o,h){const a=Math.sin(r),u=Math.cos(r);return t[0]=n*u,t[1]=s*a,t[2]=-n*a,t[3]=s*u,t[4]=o*n*u-h*n*a+e,t[5]=o*s*a+h*s*u+i,t}function zt(t,e){const i=Gt(e);ct(0!==i,32);const n=e[0],s=e[1],r=e[2],o=e[3],h=e[4],a=e[5];return t[0]=o/i,t[1]=-s/i,t[2]=-r/i,t[3]=n/i,t[4]=(r*a-o*h)/i,t[5]=-(n*a-s*h)/i,t}function Gt(t){return t[0]*t[3]-t[1]*t[2]}let jt;function Dt(t){const e="matrix("+t.join(", ")+")";if(Mt)return e;const i=jt||(jt=document.createElement("div"));return i.style.transform=e,i.style.transform}var Ut=0,$t=1,Bt=2,qt=4,Xt=8,Yt=16;function Zt(t){const e=ee();for(let i=0,n=t.length;i<n;++i)ue(e,t[i]);return e}function Vt(t,e,i){return i?(i[0]=t[0]-e,i[1]=t[1]-e,i[2]=t[2]+e,i[3]=t[3]+e,i):[t[0]-e,t[1]-e,t[2]+e,t[3]+e]}function Wt(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Ht(t,e,i){let n,s;return n=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,s=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,n*n+s*s}function Kt(t,e){return Qt(t,e[0],e[1])}function Jt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Qt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function te(t,e){const i=t[0],n=t[1],s=t[2],r=t[3],o=e[0],h=e[1];let a=Ut;return o<i?a|=Yt:o>s&&(a|=qt),h<n?a|=Xt:h>r&&(a|=Bt),a===Ut&&(a=$t),a}function ee(){return[1/0,1/0,-1/0,-1/0]}function ie(t,e,i,n,s){return s?(s[0]=t,s[1]=e,s[2]=i,s[3]=n,s):[t,e,i,n]}function ne(t){return ie(1/0,1/0,-1/0,-1/0,t)}function se(t,e){const i=t[0],n=t[1];return ie(i,n,i,n,e)}function re(t,e,i,n,s){return ce(ne(s),t,e,i,n)}function oe(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function he(t,e,i){return Math.abs(t[0]-e[0])<i&&Math.abs(t[2]-e[2])<i&&Math.abs(t[1]-e[1])<i&&Math.abs(t[3]-e[3])<i}function ae(t,e){return e[0]<t[0]&&(t[0]=e[0]),e[2]>t[2]&&(t[2]=e[2]),e[1]<t[1]&&(t[1]=e[1]),e[3]>t[3]&&(t[3]=e[3]),t}function ue(t,e){e[0]<t[0]&&(t[0]=e[0]),e[0]>t[2]&&(t[2]=e[0]),e[1]<t[1]&&(t[1]=e[1]),e[1]>t[3]&&(t[3]=e[1])}function le(t,e){for(let i=0,n=e.length;i<n;++i)ue(t,e[i]);return t}function ce(t,e,i,n,s){for(;i<n;i+=s)de(t,e[i],e[i+1]);return t}function fe(t,e){for(let i=0,n=e.length;i<n;++i)le(t,e[i]);return t}function de(t,e,i){t[0]=Math.min(t[0],e),t[1]=Math.min(t[1],i),t[2]=Math.max(t[2],e),t[3]=Math.max(t[3],i)}function pe(t,e){let i;return i=e(ve(t)),i||(i=e(ge(t)),i||(i=e(_e(t)),i||(i=e(Pe(t)),i||!1)))}function me(t){let e=0;return Ce(t)||(e=Ee(t)*Me(t)),e}function ve(t){return[t[0],t[1]]}function ge(t){return[t[2],t[1]]}function ye(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function we(t,e){let i;return"bottom-left"===e?i=ve(t):"bottom-right"===e?i=ge(t):"top-left"===e?i=Pe(t):"top-right"===e?i=_e(t):ct(!1,13),i}function xe(t,e,i,n,s){const[r,o,h,a,u,l,c,f]=be(t,e,i,n);return ie(Math.min(r,h,u,c),Math.min(o,a,l,f),Math.max(r,h,u,c),Math.max(o,a,l,f),s)}function be(t,e,i,n){const s=e*n[0]/2,r=e*n[1]/2,o=Math.cos(i),h=Math.sin(i),a=s*o,u=s*h,l=r*o,c=r*h,f=t[0],d=t[1];return[f-a+c,d-u-l,f-a-c,d-u+l,f+a-c,d+u+l,f+a+c,d+u-l,f-a+c,d-u-l]}function Me(t){return t[3]-t[1]}function Se(t,e,i){const n=i||[1/0,1/0,-1/0,-1/0];return Te(t,e)?(t[0]>e[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]<e[2]?n[2]=t[2]:n[2]=e[2],t[3]<e[3]?n[3]=t[3]:n[3]=e[3]):ne(n),n}function Pe(t){return[t[0],t[3]]}function _e(t){return[t[2],t[3]]}function Ee(t){return t[2]-t[0]}function Te(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function Ce(t){return t[2]<t[0]||t[3]<t[1]}function Fe(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function Ie(t,e){const i=(t[2]-t[0])/2*(e-1),n=(t[3]-t[1])/2*(e-1);t[0]-=i,t[2]+=i,t[1]-=n,t[3]+=n}function Ae(t,e,i){let n=!1;const s=te(t,e),r=te(t,i);if(s===$t||r===$t)n=!0;else{const o=t[0],h=t[1],a=t[2],u=t[3],l=e[0],c=e[1],f=i[0],d=i[1],p=(d-c)/(f-l);let m,v;r&Bt&&!(s&Bt)&&(m=f-(d-u)/p,n=m>=o&&m<=a),n||!(r&qt)||s&qt||(v=d-(f-a)*p,n=v>=h&&v<=u),n||!(r&Xt)||s&Xt||(m=f-(d-h)/p,n=m>=o&&m<=a),n||!(r&Yt)||s&Yt||(v=d-(f-o)*p,n=v>=h&&v<=u)}return n}function ke(t,e,i,n){let s=[];if(n>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<n;++r)s.push(t[0]+e*r/n,t[1],t[2],t[1]+i*r/n,t[2]-e*r/n,t[3],t[0],t[3]-i*r/n)}else s=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(s,s,2);const r=[],o=[];for(let t=0,e=s.length;t<e;t+=2)r.push(s[t]),o.push(s[t+1]);return function(t,e,i){return ie(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}function Re(t,e){const i=e.getExtent(),n=ye(t);if(e.canWrapX()&&(n[0]<i[0]||n[0]>=i[2])){const e=Ee(i),s=Math.floor((n[0]-i[0])/e)*e;t[0]-=s,t[2]-=s}return t}function Le(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]]];Re(t,e);const n=Ee(i);if(Ee(t)>n)return[[i[0],t[1],i[2],t[3]]];if(t[0]<i[0])return[[t[0]+n,t[1],i[2],t[3]],[i[0],t[1],t[2],t[3]]];if(t[2]>i[2])return[[t[0],t[1],i[2],t[3]],[i[0],t[1],t[2]-n,t[3]]]}return[t]}const Ne={9001:"m",9002:"ft",9003:"us-ft",9101:"radians",9102:"degrees"};function Oe(t){return Ne[t]}const ze={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};var Ge=class{constructor(t){this.st=t.code,this.rt=t.units,this.ot=void 0!==t.extent?t.extent:null,this.ht=void 0!==t.worldExtent?t.worldExtent:null,this.ut=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.lt=void 0!==t.global&&t.global,this.ct=!(!this.lt||!this.ot),this.dt=t.getPointResolution,this.vt=null,this.gt=t.metersPerUnit}canWrapX(){return this.ct}getCode(){return this.st}getExtent(){return this.ot}getUnits(){return this.rt}getMetersPerUnit(){return this.gt||ze[this.rt]}getWorldExtent(){return this.ht}getAxisOrientation(){return this.ut}isGlobal(){return this.lt}setGlobal(t){this.lt=t,this.ct=!(!t||!this.ot)}getDefaultTileGrid(){return this.vt}setDefaultTileGrid(t){this.vt=t}setExtent(t){this.ot=t,this.ct=!(!this.lt||!t)}setWorldExtent(t){this.ht=t}setGetPointResolution(t){this.dt=t}getPointResolutionFunc(){return this.dt}};const je=6378137,De=Math.PI*je,Ue=[-De,-De,De,De],$e=[-180,-85,180,85],Be=je*Math.log(Math.tan(Math.PI/2));class qe extends Ge{constructor(t){super({code:t,units:"m",extent:Ue,global:!0,worldExtent:$e,getPointResolution:function(t,e){return t/Math.cosh(e[1]/je)}})}}const Xe=[new qe("EPSG:3857"),new qe("EPSG:102100"),new qe("EPSG:102113"),new qe("EPSG:900913"),new qe("http://www.opengis.net/def/crs/EPSG/0/3857"),new qe("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Ye(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 s=0;s<n;s+=i){e[s]=De*t[s]/180;let i=je*Math.log(Math.tan(Math.PI*(+t[s+1]+90)/360));i>Be?i=Be:i<-Be&&(i=-Be),e[s+1]=i}return e}function Ze(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 s=0;s<n;s+=i)e[s]=180*t[s]/De,e[s+1]=360*Math.atan(Math.exp(t[s+1]/je))/Math.PI-90;return e}const Ve=6378137,We=[-180,-90,180,90],He=Math.PI*Ve/180;class Ke extends Ge{constructor(t,e){super({code:t,units:"degrees",extent:We,axisOrientation:e,global:!0,metersPerUnit:He,worldExtent:We})}}const Je=[new Ke("CRS:84"),new Ke("EPSG:4326","neu"),new Ke("urn:ogc:def:crs:OGC:1.3:CRS84"),new Ke("urn:ogc:def:crs:OGC:2:84"),new Ke("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Ke("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Ke("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Qe={};function ti(){Qe={}}function ei(t){return Qe[t]||Qe[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function ii(t,e){Qe[t]=e}let ni={};function si(){ni={}}function ri(t,e,i){const n=t.getCode(),s=e.getCode();n in ni||(ni[n]={}),ni[n][s]=i}function oi(t,e){let i;return t in ni&&e in ni[t]&&(i=ni[t][e]),i}function hi(t,e,i){return Math.min(Math.max(t,e),i)}function ai(t,e,i,n,s,r){const o=s-i,h=r-n;if(0!==o||0!==h){const a=((t-i)*o+(e-n)*h)/(o*o+h*h);a>1?(i=s,n=r):a>0&&(i+=o*a,n+=h*a)}return ui(t,e,i,n)}function ui(t,e,i,n){const s=i-t,r=n-e;return s*s+r*r}function li(t){const e=t.length;for(let i=0;i<e;i++){let n=i,s=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>s&&(s=e,n=r)}if(0===s)return null;const r=t[n];t[n]=t[i],t[i]=r;for(let n=i+1;n<e;n++){const s=-t[n][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[n][r]=0:t[n][r]+=s*t[i][r]}}const i=new Array(e);for(let n=e-1;n>=0;n--){i[n]=t[n][e]/t[n][n];for(let s=n-1;s>=0;s--)t[s][e]-=t[s][n]*i[n]}return i}function ci(t){return 180*t/Math.PI}function fi(t){return t*Math.PI/180}function di(t,e){const i=t%e;return i*e<0?i+e:i}function pi(t,e,i){return t+i*(e-t)}function mi(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function vi(t,e){return Math.round(mi(t,e))}function gi(t,e){return Math.floor(mi(t,e))}function yi(t,e){return Math.ceil(mi(t,e))}function wi(t,e,i){const n=void 0!==i?t.toFixed(i):""+t;let s=n.indexOf(".");return s=-1===s?n.length:s,s>e?n:new Array(1+e-s).join("0")+n}function xi(t,e){const i=(""+t).split("."),n=(""+e).split(".");for(let t=0;t<Math.max(i.length,n.length);t++){const e=parseInt(i[t]||"0",10),s=parseInt(n[t]||"0",10);if(e>s)return 1;if(s>e)return-1}return 0}function bi(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Mi(t,e){const i=e.getRadius(),n=e.getCenter(),s=n[0],r=n[1];let o=t[0]-s;const h=t[1]-r;0===o&&0===h&&(o=1);const a=Math.sqrt(o*o+h*h);return[s+i*o/a,r+i*h/a]}function Si(t,e){const i=t[0],n=t[1],s=e[0],r=e[1],o=s[0],h=s[1],a=r[0],u=r[1],l=a-o,c=u-h,f=0===l&&0===c?0:(l*(i-o)+c*(n-h))/(l*l+c*c||0);let d,p;return f<=0?(d=o,p=h):f>=1?(d=a,p=u):(d=o+f*l,p=h+f*c),[d,p]}function Pi(t,e,i){const n=di(e+180,360)-180,s=Math.abs(3600*n),r=i||0;let o=Math.floor(s/3600),h=Math.floor((s-3600*o)/60),a=mi(s-3600*o-60*h,r);a>=60&&(a=0,h+=1),h>=60&&(h=0,o+=1);let u=o+"°";return 0===h&&0===a||(u+=" "+wi(h,2)+"′"),0!==a&&(u+=" "+wi(a,2,r)+"″"),0!==n&&(u+=" "+t.charAt(n<0?1:0)),u}function _i(t,e,i){return t?e.replace("{x}",t[0].toFixed(i)).replace("{y}",t[1].toFixed(i)):""}function Ei(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 Ti(t,e){const i=Math.cos(e),n=Math.sin(e),s=t[0]*i-t[1]*n,r=t[1]*i+t[0]*n;return t[0]=s,t[1]=r,t}function Ci(t,e){return t[0]*=e,t[1]*=e,t}function Fi(t,e){const i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Ii(t,e){return Math.sqrt(Fi(t,e))}function Ai(t,e){return Fi(t,Si(t,e))}function ki(t,e){return _i(t,"{x}, {y}",e)}function Ri(t,e){if(e.canWrapX()){const i=Ee(e.getExtent()),n=Li(t,e,i);n&&(t[0]-=n*i)}return t}function Li(t,e,i){const n=e.getExtent();let s=0;return e.canWrapX()&&(t[0]<n[0]||t[0]>n[2])&&(i=i||Ee(n),s=Math.floor((t[0]-n[0])/i)),s}const Ni=6371008.8;function Oi(t,e,i){i=i||Ni;const n=fi(t[1]),s=fi(e[1]),r=(s-n)/2,o=fi(e[0]-t[0])/2,h=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(n)*Math.cos(s);return 2*i*Math.atan2(Math.sqrt(h),Math.sqrt(1-h))}function zi(t,e){let i=0;for(let n=0,s=t.length;n<s-1;++n)i+=Oi(t[n],t[n+1],e);return i}function Gi(t,e){let i=0;const n=t.length;let s=t[n-1][0],r=t[n-1][1];for(let e=0;e<n;e++){const n=t[e][0],o=t[e][1];i+=fi(n-s)*(2+Math.sin(fi(r))+Math.sin(fi(o))),s=n,r=o}return i*e*e/2}function ji(t,e,i,n){n=n||Ni;const s=fi(t[1]),r=fi(t[0]),o=e/n,h=Math.asin(Math.sin(s)*Math.cos(o)+Math.cos(s)*Math.sin(o)*Math.cos(i));return[ci(r+Math.atan2(Math.sin(i)*Math.sin(o)*Math.cos(s),Math.cos(o)-Math.sin(s)*Math.sin(h))),ci(h)]}let Di=!0;function Ui(t){Di=!(void 0===t||t)}function $i(t,e,i){if(void 0!==e)for(let i=0,n=t.length;i<n;++i)e[i]=t[i];else e=t.slice();return e}function Bi(t,e,i){if(void 0!==e&&t!==e){for(let i=0,n=t.length;i<n;++i)e[i]=t[i];t=e}return t}function qi(t){ii(t.getCode(),t),ri(t,t,$i)}function Xi(t){t.forEach(qi)}function Yi(t){return"string"==typeof t?ei(t):t||null}function Zi(t,e,i,n){let s;const r=(t=Yi(t)).getPointResolutionFunc();if(r){if(s=r(e,i),n&&n!==t.getUnits()){const e=t.getMetersPerUnit();e&&(s=s*e/ze[n])}}else{const r=t.getUnits();if("degrees"==r&&!n||"degrees"==n)s=e;else{const o=en(t,Yi("EPSG:4326"));if(o===Bi&&"degrees"!==r)s=e*t.getMetersPerUnit();else{let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2);s=(Oi(t.slice(0,2),t.slice(2,4))+Oi(t.slice(4,6),t.slice(6,8)))/2}const h=n?ze[n]:t.getMetersPerUnit();void 0!==h&&(s/=h)}}return s}function Vi(t){Xi(t),t.forEach((function(e){t.forEach((function(t){e!==t&&ri(e,t,$i)}))}))}function Wi(t,e,i,n){t.forEach((function(t){e.forEach((function(e){ri(t,e,i),ri(e,t,n)}))}))}function Hi(t,e){return t?"string"==typeof t?Yi(t):t:Yi(e)}function Ki(t){return function(e,i,n){const s=e.length;n=void 0!==n?n:2,i=void 0!==i?i:new Array(s);for(let r=0;r<s;r+=n){const s=t(e.slice(r,r+n)),o=s.length;for(let t=0,h=n;t<h;++t)i[r+t]=t>=o?e[r+t]:s[t]}return i}}function Ji(t,e,i,n){const s=Yi(t),r=Yi(e);ri(s,r,Ki(i)),ri(r,s,Ki(n))}function Qi(t,e){return Ui(),sn(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function tn(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;return en(t,e)===$i&&i}function en(t,e){let i=oi(t.getCode(),e.getCode());return i||(i=Bi),i}function nn(t,e){return en(Yi(t),Yi(e))}function sn(t,e,i){return nn(e,i)(t,void 0,t.length)}function rn(t,e,i,n){return ke(t,nn(e,i),void 0,n)}let on=null;function hn(t){on=Yi(t)}function an(){return on}function un(t,e){return on?sn(t,e,on):t}function ln(t,e){return on?sn(t,on,e):(Di&&!Ei(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Di=!1,console.warn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function cn(t,e){return on?rn(t,e,on):t}function fn(t,e){return on?rn(t,on,e):t}function dn(t,e){if(!on)return t;const i=Yi(e).getUnits(),n=on.getUnits();return i&&n?t*ze[i]/ze[n]:t}function pn(t,e){if(!on)return t;const i=Yi(e).getUnits(),n=on.getUnits();return i&&n?t*ze[n]/ze[i]:t}function mn(t,e,i){return function(n){let s,r;if(t.canWrapX()){const e=t.getExtent(),o=Ee(e);r=Li(n=n.slice(0),t,o),r&&(n[0]=n[0]-r*o),n[0]=hi(n[0],e[0],e[2]),n[1]=hi(n[1],e[1],e[3]),s=i(n)}else s=i(n);return r&&e.canWrapX()&&(s[0]+=r*Ee(e.getExtent())),s}}function vn(){Vi(Xe),Vi(Je),Wi(Je,Xe,Ye,Ze)}function gn(t,e,i,n,s,r){r=r||[];let o=0;for(let h=e;h<i;h+=n){const e=t[h],i=t[h+1];r[o++]=s[0]*e+s[2]*i+s[4],r[o++]=s[1]*e+s[3]*i+s[5]}return r&&r.length!=o&&(r.length=o),r}function yn(t,e,i,n,s,r,o){o=o||[];const h=Math.cos(s),a=Math.sin(s),u=r[0],l=r[1];let c=0;for(let s=e;s<i;s+=n){const e=t[s]-u,i=t[s+1]-l;o[c++]=u+e*h-i*a,o[c++]=l+e*a+i*h;for(let e=s+2;e<s+n;++e)o[c++]=t[e]}return o&&o.length!=c&&(o.length=c),o}function wn(t,e,i,n,s,r,o,h){h=h||[];const a=o[0],u=o[1];let l=0;for(let o=e;o<i;o+=n){const e=t[o]-a,i=t[o+1]-u;h[l++]=a+s*e,h[l++]=u+r*i;for(let e=o+2;e<o+n;++e)h[l++]=t[e]}return h&&h.length!=l&&(h.length=l),h}function xn(t,e,i,n,s,r,o){o=o||[];let h=0;for(let a=e;a<i;a+=n){o[h++]=t[a]+s,o[h++]=t[a+1]+r;for(let e=a+2;e<a+n;++e)o[h++]=t[e]}return o&&o.length!=h&&(o.length=h),o}vn();const bn=[1,0,0,1,0,0];var Mn=class extends V{constructor(){super(),this.ot=[1/0,1/0,-1/0,-1/0],this.yt=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=M((function(t,e,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 t()}closestPointXY(e,i,n,s){return t()}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(e){return t()}getExtent(t){if(this.yt!=this.getRevision()){const t=this.computeExtent(this.ot);(isNaN(t[0])||isNaN(t[1]))&&ne(t),this.yt=this.getRevision()}return Fe(this.ot,t)}rotate(e,i){t()}scale(e,i,n){t()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(e){return t()}getType(){return t()}applyTransform(e){t()}intersectsExtent(e){return t()}translate(e,i){t()}transform(t,e){const i=Yi(t),n="tile-pixels"==i.getUnits()?function(t,n,s){const r=i.getExtent(),o=i.getWorldExtent(),h=Me(o)/Me(r);return Ot(bn,o[0],o[3],h,-h,0,0,0),gn(t,0,t.length,s,bn,n),nn(i,e)(t,n,s)}:nn(i,e);return this.applyTransform(n),this}};function Sn(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Pn(t,e,i){const n=t.getFlatCoordinates();if(n){const s=t.getStride();return gn(n,0,n.length,s,e,i)}return null}var _n=class extends Mn{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates=null}computeExtent(t){return re(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return t()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=Sn(t),this.layout=t,this.flatCoordinates=e}setCoordinates(e,i){t()}setLayout(t,e,i){let n;if(t)n=Sn(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}n=e.length,t=function(t){let e;2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM");return e}(n)}this.layout=t,this.stride=n}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();yn(i,0,i.length,n,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=ye(this.getExtent()));const n=this.getFlatCoordinates();if(n){const s=this.getStride();wn(n,0,n.length,s,t,e,i,n),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const n=this.getStride();xn(i,0,i.length,n,t,e,i),this.changed()}}};function En(t,e,i,n,s,r,o){const h=t[e],a=t[e+1],u=t[i]-h,l=t[i+1]-a;let c;if(0===u&&0===l)c=e;else{const f=((s-h)*u+(r-a)*l)/(u*u+l*l);if(f>1)c=i;else{if(f>0){for(let s=0;s<n;++s)o[s]=pi(t[e+s],t[i+s],f);return void(o.length=n)}c=e}}for(let e=0;e<n;++e)o[e]=t[c+e];o.length=n}function Tn(t,e,i,n,s){let r=t[e],o=t[e+1];for(e+=n;e<i;e+=n){const i=t[e],n=t[e+1],h=ui(r,o,i,n);h>s&&(s=h),r=i,o=n}return s}function Cn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Tn(t,e,o,n,s),e=o}return s}function Fn(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];s=Cn(t,e,o,n,s),e=o[o.length-1]}return s}function In(t,e,i,n,s,r,o,h,a,u,l){if(e==i)return u;let c,f;if(0===s){if(f=ui(o,h,t[e],t[e+1]),f<u){for(c=0;c<n;++c)a[c]=t[e+c];return a.length=n,f}return u}l=l||[NaN,NaN];let d=e+n;for(;d<i;)if(En(t,d-n,d,n,o,h,l),f=ui(o,h,l[0],l[1]),f<u){for(u=f,c=0;c<n;++c)a[c]=l[c];a.length=n,d+=n}else d+=n*Math.max((Math.sqrt(f)-Math.sqrt(u))/s|0,1);if(r&&(En(t,i-n,e,n,o,h,l),f=ui(o,h,l[0],l[1]),f<u)){for(u=f,c=0;c<n;++c)a[c]=l[c];a.length=n}return u}function An(t,e,i,n,s,r,o,h,a,u,l){l=l||[NaN,NaN];for(let c=0,f=i.length;c<f;++c){const f=i[c];u=In(t,e,f,n,s,r,o,h,a,u,l),e=f}return u}function kn(t,e,i,n,s,r,o,h,a,u,l){l=l||[NaN,NaN];for(let c=0,f=i.length;c<f;++c){const f=i[c];u=An(t,e,f,n,s,r,o,h,a,u,l),e=f[f.length-1]}return u}function Rn(t,e,i,n){for(let n=0,s=i.length;n<s;++n)t[e++]=i[n];return e}function Ln(t,e,i,n){for(let s=0,r=i.length;s<r;++s){const r=i[s];for(let i=0;i<n;++i)t[e++]=r[i]}return e}function Nn(t,e,i,n,s){s=s||[];let r=0;for(let o=0,h=i.length;o<h;++o){const h=Ln(t,e,i[o],n);s[r++]=h,e=h}return s.length=r,s}function On(t,e,i,n,s){s=s||[];let r=0;for(let o=0,h=i.length;o<h;++o){const h=Nn(t,e,i[o],n,s[r]);0===h.length&&(h[0]=e),s[r++]=h,e=h[h.length-1]}return s.length=r,s}function zn(t,e,i,n,s,r,o){const h=(i-e)/n;if(h<3){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}const a=new Array(h);a[0]=1,a[h-1]=1;const u=[e,i-n];let l=0;for(;u.length>0;){const i=u.pop(),r=u.pop();let o=0;const h=t[r],c=t[r+1],f=t[i],d=t[i+1];for(let e=r+n;e<i;e+=n){const i=ai(t[e],t[e+1],h,c,f,d);i>o&&(l=e,o=i)}o>s&&(a[(l-e)/n]=1,r+n<l&&u.push(r,l),l+n<i&&u.push(l,i))}for(let i=0;i<h;++i)a[i]&&(r[o++]=t[e+i*n],r[o++]=t[e+i*n+1]);return o}function Gn(t,e,i,n,s,r,o,h){for(let a=0,u=i.length;a<u;++a){const u=i[a];o=zn(t,e,u,n,s,r,o),h.push(o),e=u}return o}function jn(t,e,i,n,s,r,o){if(i<=e+n){for(;e<i;e+=n)r[o++]=t[e],r[o++]=t[e+1];return o}let h=t[e],a=t[e+1];r[o++]=h,r[o++]=a;let u=h,l=a;for(e+=n;e<i;e+=n)u=t[e],l=t[e+1],ui(h,a,u,l)>s&&(r[o++]=u,r[o++]=l,h=u,a=l);return u==h&&l==a||(r[o++]=u,r[o++]=l),o}function Dn(t,e){return e*Math.round(t/e)}function Un(t,e,i,n,s,r,o){if(e==i)return o;let h,a,u=Dn(t[e],s),l=Dn(t[e+1],s);e+=n,r[o++]=u,r[o++]=l;do{if(h=Dn(t[e],s),a=Dn(t[e+1],s),(e+=n)==i)return r[o++]=h,r[o++]=a,o}while(h==u&&a==l);for(;e<i;){const i=Dn(t[e],s),c=Dn(t[e+1],s);if(e+=n,i==h&&c==a)continue;const f=h-u,d=a-l,p=i-u,m=c-l;f*m==d*p&&(f<0&&p<f||f==p||f>0&&p>f)&&(d<0&&m<d||d==m||d>0&&m>d)?(h=i,a=c):(r[o++]=h,r[o++]=a,u=h,l=a,h=i,a=c)}return r[o++]=h,r[o++]=a,o}function $n(t,e,i,n,s,r,o,h){for(let a=0,u=i.length;a<u;++a){const u=i[a];o=Un(t,e,u,n,s,r,o),h.push(o),e=u}return o}function Bn(t,e,i,n,s,r,o,h){for(let a=0,u=i.length;a<u;++a){const u=i[a],l=[];o=$n(t,e,u,n,s,r,o,l),h.push(l),e=u[u.length-1]}return o}function qn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=e;o<i;o+=n)s[r++]=t.slice(o,o+n);return s.length=r,s}function Xn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,h=i.length;o<h;++o){const h=i[o];s[r++]=qn(t,e,h,n,s[r]),e=h}return s.length=r,s}function Yn(t,e,i,n,s){s=void 0!==s?s:[];let r=0;for(let o=0,h=i.length;o<h;++o){const h=i[o];s[r++]=1===h.length&&h[0]===e?[]:Xn(t,e,h,n,s[r]),e=h[h.length-1]}return s.length=r,s}function Zn(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=o*i-r*n,r=i,o=n}return s/2}function Vn(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Zn(t,e,o,n),e=o}return s}function Wn(t,e,i,n){let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];s+=Vn(t,e,o,n),e=o[o.length-1]}return s}class Hn extends _n{constructor(t,e){super(),this.wt=-1,this.xt=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new Hn(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,n){return n<Ht(this.getExtent(),t,e)?n:(this.xt!=this.getRevision()&&(this.wt=Math.sqrt(Tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.xt=this.getRevision()),In(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.wt,!0,t,e,i,n))}getArea(){return Zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Hn(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ln(this.flatCoordinates,0,t,this.stride),this.changed()}}var Kn=Hn;class Jn extends _n{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Jn(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=ui(t,e,s[0],s[1]);if(r<n){const t=this.stride;for(let e=0;e<t;++e)i[e]=s[e];return i.length=t,r}return n}getCoordinates(){return this.flatCoordinates?this.flatCoordinates.slice():[]}computeExtent(t){return se(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Qt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Rn(this.flatCoordinates,0,t,this.stride),this.changed()}}var Qn=Jn;function ts(t,e,i,n,s){return!pe(s,(function(s){return!es(t,e,i,n,s[0],s[1])}))}function es(t,e,i,n,s,r){let o=0,h=t[i-n],a=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];a<=r?n>r&&(i-h)*(r-a)-(s-h)*(n-a)>0&&o++:n<=r&&(i-h)*(r-a)-(s-h)*(n-a)<0&&o--,h=i,a=n}return 0!==o}function is(t,e,i,n,s,r){if(0===i.length)return!1;if(!es(t,e,i[0],n,s,r))return!1;for(let e=1,o=i.length;e<o;++e)if(es(t,i[e-1],i[e],n,s,r))return!1;return!0}function ns(t,e,i,n,s,r){if(0===i.length)return!1;for(let o=0,h=i.length;o<h;++o){const h=i[o];if(is(t,e,h,n,s,r))return!0;e=h[h.length-1]}return!1}function ss(t,e,i,n,s,r,o){let h,a,u,l,c,f,p;const m=s[r+1],v=[];for(let s=0,r=i.length;s<r;++s){const r=i[s];for(l=t[r-n],f=t[r-n+1],h=e;h<r;h+=n)c=t[h],p=t[h+1],(m<=f&&p<=m||f<=m&&m<=p)&&(u=(m-f)/(p-f)*(c-l)+l,v.push(u)),l=c,f=p}let g=NaN,y=-1/0;for(v.sort(d),l=v[0],h=1,a=v.length;h<a;++h){c=v[h];const s=Math.abs(c-l);s>y&&(u=(l+c)/2,is(t,e,i,n,u,m)&&(g=u,y=s)),l=c}return isNaN(g)&&(g=s[r]),o?(o.push(g,m,y),o):[g,m,y]}function rs(t,e,i,n,s){let r=[];for(let o=0,h=i.length;o<h;++o){const h=i[o];r=ss(t,e,h,n,s,2*o,r),e=h[h.length-1]}return r}function os(t,e,i,n,s){let r;for(e+=n;e<i;e+=n)if(r=s(t.slice(e-n,e),t.slice(e,e+n)),r)return r;return!1}function hs(t,e,i,n,s){const r=ce([1/0,1/0,-1/0,-1/0],t,e,i,n);return!!Te(s,r)&&(!!Jt(s,r)||(r[0]>=s[0]&&r[2]<=s[2]||(r[1]>=s[1]&&r[3]<=s[3]||os(t,e,i,n,(function(t,e){return Ae(s,t,e)})))))}function as(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){if(hs(t,e,i[r],n,s))return!0;e=i[r]}return!1}function us(t,e,i,n,s){return!!hs(t,e,i,n,s)||(!!es(t,e,i,n,s[0],s[1])||(!!es(t,e,i,n,s[0],s[3])||(!!es(t,e,i,n,s[2],s[1])||!!es(t,e,i,n,s[2],s[3]))))}function ls(t,e,i,n,s){if(!us(t,e,i[0],n,s))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(ts(t,i[e-1],i[e],n,s)&&!hs(t,i[e-1],i[e],n,s))return!1;return!0}function cs(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(ls(t,e,o,n,s))return!0;e=o[o.length-1]}return!1}function fs(t,e,i,n){for(;e<i-n;){for(let s=0;s<n;++s){const r=t[e+s];t[e+s]=t[i-n+s],t[i-n+s]=r}e+=n,i-=n}}function ds(t,e,i,n){let s=0,r=t[i-n],o=t[i-n+1];for(;e<i;e+=n){const i=t[e],n=t[e+1];s+=(i-r)*(n+o),r=i,o=n}return 0===s?void 0:s>0}function ps(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],h=ds(t,e,o,n);if(0===r){if(s&&h||!s&&!h)return!1}else if(s&&!h||!s&&h)return!1;e=o}return!0}function ms(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!ps(t,e,o,n,s))return!1;o.length&&(e=o[o.length-1])}return!0}function vs(t,e,i,n,s){s=void 0!==s&&s;for(let r=0,o=i.length;r<o;++r){const o=i[r],h=ds(t,e,o,n);(0===r?s&&h||!s&&!h:s&&!h||!s&&h)&&fs(t,e,o,n),e=o}return e}function gs(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r)e=vs(t,e,i[r],n,s);return e}function ys(t,e){const i=[];let n=0,s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r];if(ds(t,n,o,2)){if(0===i.length)continue;i[i.length-1].push(e[s])}else i.push(e.slice(s,r+1));s=r+1,n=o}return i}class ws extends _n{constructor(t,e,i){super(),this.bt=[],this.Mt=-1,this.St=null,this.wt=-1,this.xt=-1,this.Pt=-1,this._t=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.bt=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?v(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.bt.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ws(this.flatCoordinates.slice(),this.layout,this.bt.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ht(this.getExtent(),t,e)?n:(this.xt!=this.getRevision()&&(this.wt=Math.sqrt(Cn(this.flatCoordinates,0,this.bt,this.stride,0)),this.xt=this.getRevision()),An(this.flatCoordinates,0,this.bt,this.stride,this.wt,!0,t,e,i,n))}containsXY(t,e){return is(this.getOrientedFlatCoordinates(),0,this.bt,this.stride,t,e)}getArea(){return Vn(this.getOrientedFlatCoordinates(),0,this.bt,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),vs(e,0,this.bt,this.stride,t)):e=this.flatCoordinates,Xn(e,0,this.bt,this.stride)}getEnds(){return this.bt}getFlatInteriorPoint(){if(this.Mt!=this.getRevision()){const t=ye(this.getExtent());this.St=ss(this.getOrientedFlatCoordinates(),0,this.bt,this.stride,t,0),this.Mt=this.getRevision()}return this.St}getInteriorPoint(){return new Qn(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.bt.length}getLinearRing(t){return t<0||this.bt.length<=t?null:new Kn(this.flatCoordinates.slice(0===t?0:this.bt[t-1],this.bt[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.bt,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],h=new Kn(e.slice(s,o),t);n.push(h),s=o}return n}getOrientedFlatCoordinates(){if(this.Pt!=this.getRevision()){const t=this.flatCoordinates;ps(t,0,this.bt,this.stride)?this._t=t:(this._t=t.slice(),this._t.length=vs(this._t,0,this.bt,this.stride)),this.Pt=this.getRevision()}return this._t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=$n(this.flatCoordinates,0,this.bt,this.stride,Math.sqrt(t),e,0,i),new ws(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return ls(this.getOrientedFlatCoordinates(),0,this.bt,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Nn(this.flatCoordinates,0,t,this.stride,this.bt);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var xs=ws;function bs(t,e,i,n){i=i||32;const s=[];for(let r=0;r<i;++r)v(s,ji(t,e,2*Math.PI*r/i,n));return s.push(s[0],s[1]),new ws(s,"XY",[s.length])}function Ms(t){const e=t[0],i=t[1],n=t[2],s=t[3],r=[e,i,e,s,n,s,n,i,e,i];return new ws(r,"XY",[r.length])}function Ss(t,e,i){e=e||32;const n=t.getStride(),s=t.getLayout(),r=t.getCenter(),o=n*(e+1),h=new Array(o);for(let t=0;t<o;t+=n){h[t]=0,h[t+1]=0;for(let e=2;e<n;e++)h[t+e]=r[e]}const a=[h.length],u=new ws(h,s,a);return Ps(u,r,t.getRadius(),i),u}function Ps(t,e,i,n){const s=t.getFlatCoordinates(),r=t.getStride(),o=s.length/r-1,h=n||0;for(let t=0;t<=o;++t){const n=t*r,a=h+2*di(t,o)*Math.PI/o;s[n]=e[0]+i*Math.cos(a),s[n+1]=e[1]+i*Math.sin(a)}t.changed()}const _s="accuracy",Es="accuracyGeometry",Ts="altitude",Cs="altitudeAccuracy",Fs="heading",Is="position",As="projection",ks="speed",Rs="tracking",Ls="trackingOptions";class Ns extends u{constructor(t){super(C),this.code=t.code,this.message=t.message}}var Os=class extends V{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.Et=null,this.Tt=Bi,this.Ct=void 0,this.addChangeListener(As,this.Ft),this.addChangeListener(Rs,this.At),void 0!==t.projection&&this.setProjection(t.projection),void 0!==t.trackingOptions&&this.setTrackingOptions(t.trackingOptions),this.setTracking(void 0!==t.tracking&&t.tracking)}disposeInternal(){this.setTracking(!1),super.disposeInternal()}Ft(){const t=this.getProjection();t&&(this.Tt=en(Yi("EPSG:4326"),t),this.Et&&this.set(Is,this.Tt(this.Et)))}At(){if("geolocation"in navigator){const t=this.getTracking();t&&void 0===this.Ct?this.Ct=navigator.geolocation.watchPosition(this.kt.bind(this),this.Rt.bind(this),this.getTrackingOptions()):t||void 0===this.Ct||(navigator.geolocation.clearWatch(this.Ct),this.Ct=void 0)}}kt(t){const e=t.coords;this.set(_s,e.accuracy),this.set(Ts,null===e.altitude?void 0:e.altitude),this.set(Cs,null===e.altitudeAccuracy?void 0:e.altitudeAccuracy),this.set(Fs,null===e.heading?void 0:fi(e.heading)),this.Et?(this.Et[0]=e.longitude,this.Et[1]=e.latitude):this.Et=[e.longitude,e.latitude];const i=this.Tt(this.Et);this.set(Is,i),this.set(ks,null===e.speed?void 0:e.speed);const n=bs(this.Et,e.accuracy);n.applyTransform(this.Tt),this.set(Es,n),this.changed()}Rt(t){this.dispatchEvent(new Ns(t))}getAccuracy(){return this.get(_s)}getAccuracyGeometry(){return this.get(Es)||null}getAltitude(){return this.get(Ts)}getAltitudeAccuracy(){return this.get(Cs)}getHeading(){return this.get(Fs)}getPosition(){return this.get(Is)}getProjection(){return this.get(As)}getSpeed(){return this.get(ks)}getTracking(){return this.get(Rs)}getTrackingOptions(){return this.get(Ls)}setProjection(t){this.set(As,Yi(t))}setTracking(t){this.set(Rs,t)}setTrackingOptions(t){this.set(Ls,t)}};var zs=class extends E{constructor(t,e,i,n){super(),this.extent=t,this.Lt=i,this.resolution=e,this.state=n}changed(){this.dispatchEvent(T)}getExtent(){return this.extent}getImage(){return t()}getPixelRatio(){return this.Lt}getResolution(){return this.resolution}getState(){return this.state}load(){t()}},Gs=0,js=1,Ds=2,Us=3,$s=4;function Bs(t,e,i){const n=t;let s=!0,r=!1,o=!1;const h=[$(n,z,(function(){o=!0,r||e()}))];return n.src&&St?(r=!0,n.decode().then((function(){s&&e()})).catch((function(t){s&&(o?e():i())}))):h.push($(n,C,i)),function(){s=!1,h.forEach(B)}}var qs=class extends zs{constructor(t,e,i,n,s,r){super(t,e,i,Gs),this.Nt=n,this.Ot=new Image,null!==s&&(this.Ot.crossOrigin=s),this.zt=null,this.state=Gs,this.Gt=r}getImage(){return this.Ot}jt(){this.state=Us,this.Dt(),this.changed()}Ut(){void 0===this.resolution&&(this.resolution=Me(this.extent)/this.Ot.height),this.state=Ds,this.Dt(),this.changed()}load(){this.state!=Gs&&this.state!=Us||(this.state=js,this.changed(),this.Gt(this,this.Nt),this.zt=Bs(this.Ot,this.Ut.bind(this),this.jt.bind(this)))}setImage(t){this.Ot=t,this.resolution=Me(this.extent)/this.Ot.height}Dt(){this.zt&&(this.zt(),this.zt=null)}};var Xs=class extends zs{constructor(t,e,i,n,s){super(t,e,i,void 0!==s?Gs:Ds),this.$=void 0!==s?s:null,this.$t=n,this.q=null}getError(){return this.q}Bt(t){t?(this.q=t,this.state=Us):this.state=Ds,this.changed()}load(){this.state==Gs&&(this.state=js,this.changed(),this.$(this.Bt.bind(this)))}getImage(){return this.$t}};function Ys(t,e,i,n){let s;return s=i&&i.length?i.shift():Mt?new OffscreenCanvas(t||300,e||300):document.createElement("canvas"),t&&(s.width=t),e&&(s.height=e),s.getContext("2d",n)}function Zs(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function Vs(t){let e=t.offsetWidth;const i=getComputedStyle(t);return e+=parseInt(i.marginLeft,10)+parseInt(i.marginRight,10),e}function Ws(t){let e=t.offsetHeight;const i=getComputedStyle(t);return e+=parseInt(i.marginTop,10)+parseInt(i.marginBottom,10),e}function Hs(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function Ks(t){return t&&t.parentNode?t.parentNode.removeChild(t):null}function Js(t){for(;t.lastChild;)t.removeChild(t.lastChild)}function Qs(t,e){const i=t.childNodes;for(let n=0;;++n){const s=i[n],r=e[n];if(!s&&!r)break;s!==r&&(s?r?t.insertBefore(r,s):(t.removeChild(s),--n):t.appendChild(r))}}var tr=class extends ut{constructor(t,e,i,n,s,r){super(t,e,r),this.qt=n,this.Nt=i,this.key=i,this.Ot=new Image,null!==n&&(this.Ot.crossOrigin=n),this.zt=null,this.Xt=s}getImage(){return this.Ot}setImage(t){this.Ot=t,this.state=it,this.Dt(),this.changed()}jt(){this.state=nt,this.Dt(),this.Ot=function(){const t=Ys(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}Ut(){const t=this.Ot;t.naturalWidth&&t.naturalHeight?this.state=it:this.state=st,this.Dt(),this.changed()}load(){this.state==nt&&(this.state=tt,this.Ot=new Image,null!==this.qt&&(this.Ot.crossOrigin=this.qt)),this.state==tt&&(this.state=et,this.changed(),this.Xt(this,this.Nt),this.zt=Bs(this.Ot,this.Ut.bind(this),this.jt.bind(this)))}Dt(){this.zt&&(this.zt(),this.zt=null)}};var er=class{constructor(t,e,i){this.Yt=t,this.Zt=e,this.Vt=i,this.Wt=[],this.Ht=0,this.Kt=0}begin(){this.Wt.length=0,this.Ht=0,this.Kt=0}update(t,e){this.Wt.push(t,e,Date.now())}end(){if(this.Wt.length<6)return!1;const t=Date.now()-this.Vt,e=this.Wt.length-3;if(this.Wt[e+2]<t)return!1;let i=e-3;for(;i>0&&this.Wt[i+2]>t;)i-=3;const n=this.Wt[e+2]-this.Wt[i+2];if(n<1e3/60)return!1;const s=this.Wt[e]-this.Wt[i],r=this.Wt[e+1]-this.Wt[i+1];return this.Ht=Math.atan2(r,s),this.Kt=Math.sqrt(s*s+r*r)/n,this.Kt>this.Zt}getDistance(){return(this.Zt-this.Kt)/this.Yt}getAngle(){return this.Ht}};const ir=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,nr=/^([a-z]*)$|^hsla?\(.*\)$/i;function sr(t){return"string"==typeof t?t:ur(t)}function rr(t){const e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);const t=getComputedStyle(e).color;return document.body.removeChild(e),t}return""}const or=function(){const t={};let e=0;return function(i){let n;if(t.hasOwnProperty(i))n=t[i];else{if(e>=1024){let i=0;for(const n in t)0==(3&i++)&&(delete t[n],--e)}n=function(t){let e,i,n,s,r;nr.exec(t)&&(t=rr(t));if(ir.exec(t)){const o=t.length-1;let h;h=o<=4?1:2;const a=4===o||8===o;e=parseInt(t.substr(1+0*h,h),16),i=parseInt(t.substr(1+1*h,h),16),n=parseInt(t.substr(1+2*h,h),16),s=a?parseInt(t.substr(1+3*h,h),16):255,1==h&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,a&&(s=(s<<4)+s)),r=[e,i,n,s/255]}else t.startsWith("rgba(")?(r=t.slice(5,-1).split(",").map(Number),ar(r)):t.startsWith("rgb(")?(r=t.slice(4,-1).split(",").map(Number),r.push(1),ar(r)):ct(!1,14);return r}(i),t[i]=n,++e}return n}}();function hr(t){return Array.isArray(t)?t:or(t)}function ar(t){return t[0]=hi(t[0]+.5|0,0,255),t[1]=hi(t[1]+.5|0,0,255),t[2]=hi(t[2]+.5|0,0,255),t[3]=hi(t[3],0,1),t}function ur(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(100*t[3])/100)+")"}function lr(t){return nr.test(t)&&(t=rr(t)),ir.test(t)||t.startsWith("rgba(")||t.startsWith("rgb(")}class cr{constructor(){this.Jt={},this.Qt=0,this.te=32}clear(){this.Jt={},this.Qt=0}canExpireCache(){return this.Qt>this.te}expire(){if(this.canExpireCache()){let t=0;for(const e in this.Jt){const i=this.Jt[e];0!=(3&t++)||i.hasListener()||(delete this.Jt[e],--this.Qt)}}}get(t,e,i){const n=fr(t,e,i);return n in this.Jt?this.Jt[n]:null}set(t,e,i,n){const s=fr(t,e,i);this.Jt[s]=n,++this.Qt}setSize(t){this.te=t,this.expire()}}function fr(t,e,i){return e+":"+t+":"+(i?sr(i):"null")}var dr=cr;const pr=new cr;var mr="opacity",vr="visible",gr="extent",yr="zIndex",wr="maxResolution",xr="minResolution",br="maxZoom",Mr="minZoom",Sr="source",Pr="map";var _r=class extends V{constructor(t){super(),this.on,this.once,this.un,this.ee=t.background;const e=Object.assign({},t);"object"==typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[mr]=void 0!==t.opacity?t.opacity:1,ct("number"==typeof e[mr],64),e[vr]=void 0===t.visible||t.visible,e[yr]=t.zIndex,e[wr]=void 0!==t.maxResolution?t.maxResolution:1/0,e[xr]=void 0!==t.minResolution?t.minResolution:0,e[Mr]=void 0!==t.minZoom?t.minZoom:-1/0,e[br]=void 0!==t.maxZoom?t.maxZoom:1/0,this.ie=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.ne=null}getBackground(){return this.ee}getClassName(){return this.ie}getLayerState(t){const e=this.ne||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=hi(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.ne=e,e}getLayersArray(e){return t()}getLayerStatesArray(e){return t()}getExtent(){return this.get(gr)}getMaxResolution(){return this.get(wr)}getMinResolution(){return this.get(xr)}getMinZoom(){return this.get(Mr)}getMaxZoom(){return this.get(br)}getOpacity(){return this.get(mr)}getSourceState(){return t()}getVisible(){return this.get(vr)}getZIndex(){return this.get(yr)}setBackground(t){this.ee=t,this.changed()}setExtent(t){this.set(gr,t)}setMaxResolution(t){this.set(wr,t)}setMinResolution(t){this.set(xr,t)}setMaxZoom(t){this.set(br,t)}setMinZoom(t){this.set(Mr,t)}setOpacity(t){ct("number"==typeof t,64),this.set(mr,t)}setVisible(t){this.set(vr,t)}setZIndex(t){this.set(yr,t)}disposeInternal(){this.ne&&(this.ne.layer=null,this.ne=null),super.disposeInternal()}},Er="prerender",Tr="postrender",Cr="precompose",Fr="postcompose",Ir="rendercomplete";function Ar(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var kr=class extends _r{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.se=null,this.re=null,this.oe=null,this.he=null,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Sr,this.ae);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(Sr)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}ue(){this.changed()}ae(){this.oe&&(B(this.oe),this.oe=null);const t=this.getSource();t&&(this.oe=U(t,T,this.ue,this)),this.changed()}getFeatures(t){return this.he?this.he.getFeatures(t):new Promise((t=>t([])))}getData(t){return this.he&&this.rendered?this.he.getData(t):null}render(t,e){const i=this.getRenderer();if(i.prepareFrame(t))return this.rendered=!0,i.renderFrame(t,e)}unrender(){this.rendered=!1}setMapInternal(t){t||this.unrender(),this.set(Pr,t)}getMapInternal(){return this.get(Pr)}setMap(t){this.se&&(B(this.se),this.se=null),t||this.changed(),this.re&&(B(this.re),this.re=null),t&&(this.se=U(t,Cr,(function(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);ct(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.re=U(this,T,t.render,t),this.changed())}setSource(t){this.set(Sr,t)}getRenderer(){return this.he||(this.he=this.createRenderer()),this.he}hasRenderer(){return!!this.he}createRenderer(){return null}disposeInternal(){this.he&&(this.he.dispose(),delete this.he),this.setSource(null),super.disposeInternal()}};function Rr(t,e){pr.expire()}var Lr=class extends c{constructor(t){super(),this.le=t}dispatchRenderEvent(e,i){t()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,n=t.pixelToCoordinateTransform;Ot(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),zt(n,i)}forEachFeatureAtCoordinate(t,e,i,n,s,r,o,h){let a;const u=e.viewState;function l(t,e,i,n){return s.call(r,e,t?i:null,n)}const c=u.projection,f=Ri(t.slice(),c),d=[[0,0]];if(c.canWrapX()&&n){const t=Ee(c.getExtent());d.push([-t,0],[t,0])}const p=e.layerStatesArray,m=p.length,v=[],g=[];for(let n=0;n<d.length;n++)for(let s=m-1;s>=0;--s){const r=p[s],c=r.layer;if(c.hasRenderer()&&Ar(r,u)&&o.call(h,c)){const s=c.getRenderer(),o=c.getSource();if(s&&o){const h=o.getWrapX()?f:t,u=l.bind(null,r.managed);g[0]=h[0]+d[n][0],g[1]=h[1]+d[n][1],a=s.forEachFeatureAtCoordinate(g,e,i,u,v)}if(a)return a}}if(0===v.length)return;const y=1/v.length;return v.forEach(((t,e)=>t.distanceSq+=e*y)),v.sort(((t,e)=>t.distanceSq-e.distanceSq)),v.some((t=>a=t.callback(t.feature,t.layer,t.geometry))),a}hasFeatureAtCoordinate(t,e,i,n,s,r){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,w,this,s,r)}getMap(){return this.le}renderFrame(e){t()}scheduleExpireIconCache(t){pr.canExpireCache()&&t.postRenderFunctions.push(Rr)}};var Nr=class extends u{constructor(t,e,i,n){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=n}};const Or="ol-hidden",zr="ol-selectable",Gr="ol-unselectable",jr="ol-unsupported",Dr="ol-control",Ur="ol-collapsed",$r=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"),Br=["style","variant","weight","size","lineHeight","family"],qr=function(t){const e=t.match($r);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"normal",variant:"normal"};for(let t=0,n=Br.length;t<n;++t){const n=e[t+1];void 0!==n&&(i[Br[t]]=n)}return i.families=i.family.split(/,\s?/),i},Xr="10px sans-serif",Yr="#000",Zr="round",Vr=[],Wr="round",Hr=10,Kr="#000",Jr="center",Qr="middle",to=[0,0,0,0],eo=new V;let io,no=null;const so={},ro=function(){const t="32px ",e=["monospace","serif"],i=e.length,n="wmytzilWMYTZIL@#/&?$%10";let s,r;function o(s,o,h){let a=!0;for(let u=0;u<i;++u){const i=e[u];if(r=ao(s+" "+o+" "+t+i,n),h!=i){const e=ao(s+" "+o+" "+t+h+","+i,n);a=a&&e!=r}}return!!a}function h(){let t=!0;const e=eo.getKeys();for(let i=0,n=e.length;i<n;++i){const n=e[i];eo.get(n)<100&&(o.apply(this,n.split("\n"))?(P(so),no=null,io=void 0,eo.set(n,100)):(eo.set(n,eo.get(n)+1,!0),t=!1))}t&&(clearInterval(s),s=void 0)}return function(t){const e=qr(t);if(!e)return;const i=e.families;for(let t=0,n=i.length;t<n;++t){const n=i[t],r=e.style+"\n"+e.weight+"\n"+n;void 0===eo.get(r)&&(eo.set(r,100,!0),o(e.style,e.weight,n)||(eo.set(r,0,!0),void 0===s&&(s=setInterval(h,32))))}}}(),oo=function(){let t;return function(e){let i=so[e];if(null==i){if(Mt){const t=qr(e),n=ho(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(n.actualBoundingBoxAscent+n.actualBoundingBoxDescent)}else t||(t=document.createElement("div"),t.innerHTML="M",t.style.minHeight="0",t.style.maxHeight="none",t.style.height="auto",t.style.padding="0",t.style.border="none",t.style.position="absolute",t.style.display="block",t.style.left="-99999px"),t.style.font=e,document.body.appendChild(t),i=t.offsetHeight,document.body.removeChild(t);so[e]=i}return i}}();function ho(t,e){return no||(no=Ys(1,1)),t!=io&&(no.font=t,io=no.font),no.measureText(e)}function ao(t,e){return ho(t,e).width}function uo(t,e,i){if(e in i)return i[e];const n=e.split("\n").reduce(((e,i)=>Math.max(e,ao(t,i))),0);return i[e]=n,n}function lo(t,e){const i=[],n=[],s=[];let r=0,o=0,h=0,a=0;for(let u=0,l=e.length;u<=l;u+=2){const c=e[u];if("\n"===c||u===l){r=Math.max(r,o),s.push(o),o=0,h+=a;continue}const f=e[u+1]||t.font,d=ao(f,c);i.push(d),o+=d;const p=oo(f);n.push(p),a=Math.max(a,p)}return{width:r,height:h,widths:i,heights:n,lineWidths:s}}function co(t,e,i,n,s,r,o,h,a,u,l){t.save(),1!==i&&(t.globalAlpha*=i),e&&t.setTransform.apply(t,e),n.contextInstructions?(t.translate(a,u),t.scale(l[0],l[1]),function(t,e){const i=t.contextInstructions;for(let t=0,n=i.length;t<n;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(n,t)):l[0]<0||l[1]<0?(t.translate(a,u),t.scale(l[0],l[1]),t.drawImage(n,s,r,o,h,0,0,o,h)):t.drawImage(n,s,r,o,h,a,u,o*l[0],h*l[1]),t.restore()}var fo=class extends Lr{constructor(t){super(t),this.ce=U(eo,l,t.redrawText.bind(t)),this.fe=document.createElement("div");const e=this.fe.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.fe.className="ol-unselectable ol-layers";const i=t.getViewport();i.insertBefore(this.fe,i.firstChild||null),this.de=[],this.pe=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const n=new Nr(t,void 0,e);i.dispatchEvent(n)}}disposeInternal(){B(this.ce),this.fe.parentNode.removeChild(this.fe),super.disposeInternal()}renderFrame(t){if(!t)return void(this.pe&&(this.fe.style.display="none",this.pe=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Cr,t);const e=t.layerStatesArray.sort((function(t,e){return t.zIndex-e.zIndex})),i=t.viewState;this.de.length=0;const n=[];let s=null;for(let r=0,o=e.length;r<o;++r){const o=e[r];t.layerIndex=r;const h=o.layer,a=h.getSourceState();if(!Ar(o,i)||"ready"!=a&&"undefined"!=a){h.unrender();continue}const u=h.render(t,s);u&&(u!==s&&(this.de.push(u),s=u),"getDeclutter"in h&&n.push(h))}for(let e=n.length-1;e>=0;--e)n[e].renderDeclutter(t);Qs(this.fe,this.de),this.dispatchRenderEvent(Fr,t),this.pe||(this.fe.style.display="",this.pe=!0),this.scheduleExpireIconCache(t)}};class po extends u{constructor(t,e){super(t),this.layer=e}}const mo="layers";class vo extends _r{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.me=[],this.ve={},this.addChangeListener(mo,this.ge),i?Array.isArray(i)?i=new Q(i.slice(),{unique:!0}):ct("function"==typeof i.getArray,43):i=new Q(void 0,{unique:!0}),this.setLayers(i)}ye(){this.changed()}ge(){this.me.forEach(B),this.me.length=0;const t=this.getLayers();this.me.push(U(t,W,this.we,this),U(t,H,this.xe,this));for(const t in this.ve)this.ve[t].forEach(B);P(this.ve);const e=t.getArray();for(let t=0,i=e.length;t<i;t++){const i=e[t];this.be(i),this.dispatchEvent(new po("addlayer",i))}this.changed()}be(t){const e=[U(t,l,this.ye,this),U(t,T,this.ye,this)];t instanceof vo&&e.push(U(t,"addlayer",this.Me,this),U(t,"removelayer",this.Se,this)),this.ve[i(t)]=e}Me(t){this.dispatchEvent(new po("addlayer",t.layer))}Se(t){this.dispatchEvent(new po("removelayer",t.layer))}we(t){const e=t.element;this.be(e),this.dispatchEvent(new po("addlayer",e)),this.changed()}xe(t){const e=t.element,n=i(e);this.ve[n].forEach(B),delete this.ve[n],this.dispatchEvent(new po("removelayer",e)),this.changed()}getLayers(){return this.get(mo)}setLayers(t){const e=this.getLayers();if(e){const t=e.getArray();for(let e=0,i=t.length;e<i;++e)this.dispatchEvent(new po("removelayer",t[e]))}this.set(mo,t)}getLayersArray(t){return t=void 0!==t?t:[],this.getLayers().forEach((function(e){e.getLayersArray(t)})),t}getLayerStatesArray(t){const e=void 0!==t?t:[],i=e.length;this.getLayers().forEach((function(t){t.getLayerStatesArray(e)}));const n=this.getLayerState();let s=n.zIndex;t||void 0!==n.zIndex||(s=0);for(let t=i,r=e.length;t<r;t++){const i=e[t];i.opacity*=n.opacity,i.visible=i.visible&&n.visible,i.maxResolution=Math.min(i.maxResolution,n.maxResolution),i.minResolution=Math.max(i.minResolution,n.minResolution),i.minZoom=Math.max(i.minZoom,n.minZoom),i.maxZoom=Math.min(i.maxZoom,n.maxZoom),void 0!==n.extent&&(void 0!==i.extent?i.extent=Se(i.extent,n.extent):i.extent=n.extent),void 0===i.zIndex&&(i.zIndex=s)}return e}getSourceState(){return"ready"}}var go=vo;var yo=class extends u{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}};var wo=class extends yo{constructor(t,e,i,n,s,r){super(t,e,s),this.originalEvent=i,this.Pe=null,this._e=null,this.dragging=void 0!==n&&n,this.activePointers=r}get pixel(){return this.Pe||(this.Pe=this.map.getEventPixel(this.originalEvent)),this.Pe}set pixel(t){this.Pe=t}get coordinate(){return this._e||(this._e=this.map.getCoordinateFromPixel(this.pixel)),this._e}set coordinate(t){this._e=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}},xo={SINGLECLICK:"singleclick",CLICK:I,DBLCLICK:A,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"},bo="pointermove",Mo="pointerdown",So="pointerup",Po="pointerout";var _o=class extends E{constructor(t,e){super(t),this.le=t,this.Ee,this.Te=!1,this.Ce=!1,this.Fe=[],this.Ae=void 0===e?1:e,this.ke=null;const i=this.le.getViewport();this.Re=[],this.Le={},this.fe=i,this.Ne=U(i,Mo,this.Oe,this),this.ze,this.Ge=U(i,bo,this.je,this),this.De=this.Ue.bind(this),this.fe.addEventListener(j,this.De,!!Pt&&{passive:!1})}$e(t){let e=new wo(xo.CLICK,this.le,t);this.dispatchEvent(e),void 0!==this.Ee?(clearTimeout(this.Ee),this.Ee=void 0,e=new wo(xo.DBLCLICK,this.le,t),this.dispatchEvent(e)):this.Ee=setTimeout(function(){this.Ee=void 0;const e=new wo(xo.SINGLECLICK,this.le,t);this.dispatchEvent(e)}.bind(this),250)}Be(t){const e=t,i=e.pointerId;if(e.type==xo.POINTERUP||e.type==xo.POINTERCANCEL){delete this.Le[i];for(const t in this.Le)if(this.Le[t].target!==e.target){delete this.Le[t];break}}else e.type!=xo.POINTERDOWN&&e.type!=xo.POINTERMOVE||(this.Le[i]=e);this.Re=Object.values(this.Le)}qe(t){this.Be(t);const e=new wo(xo.POINTERUP,this.le,t,void 0,void 0,this.Re);this.dispatchEvent(e),this.Te&&!e.defaultPrevented&&!this.Ce&&this.Xe(t)&&this.$e(this.ke),0===this.Re.length&&(this.Fe.forEach(B),this.Fe.length=0,this.Ce=!1,this.ke=null)}Xe(t){return 0===t.button}Oe(t){this.Te=0===this.Re.length,this.Be(t);const e=new wo(xo.POINTERDOWN,this.le,t,void 0,void 0,this.Re);this.dispatchEvent(e),this.ke={};for(const e in t){const i=t[e];this.ke[e]="function"==typeof i?b:i}if(0===this.Fe.length){const t=this.le.getOwnerDocument();this.Fe.push(U(t,xo.POINTERMOVE,this.Ye,this),U(t,xo.POINTERUP,this.qe,this),U(this.fe,xo.POINTERCANCEL,this.qe,this)),this.fe.getRootNode&&this.fe.getRootNode()!==t&&this.Fe.push(U(this.fe.getRootNode(),xo.POINTERUP,this.qe,this))}}Ye(t){if(this.Ze(t)){this.Be(t),this.Ce=!0;const e=new wo(xo.POINTERDRAG,this.le,t,this.Ce,void 0,this.Re);this.dispatchEvent(e)}}je(t){this.ze=t;const e=!(!this.ke||!this.Ze(t));this.dispatchEvent(new wo(xo.POINTERMOVE,this.le,t,e))}Ue(t){const e=this.ze;e&&!e.defaultPrevented||"boolean"==typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}Ze(t){return this.Ce||Math.abs(t.clientX-this.ke.clientX)>this.Ae||Math.abs(t.clientY-this.ke.clientY)>this.Ae}disposeInternal(){this.Ge&&(B(this.Ge),this.Ge=null),this.fe.removeEventListener(j,this.De),this.Ne&&(B(this.Ne),this.Ne=null),this.Fe.forEach(B),this.Fe.length=0,this.fe=null,super.disposeInternal()}},Eo="postrender",To="movestart",Co="moveend",Fo="loadstart",Io="loadend",Ao="layergroup",ko="size",Ro="target",Lo="view";const No=1/0;var Oo=class{constructor(t,e){this.Ve=t,this.We=e,this.He=[],this.Ke=[],this.Je={}}clear(){this.He.length=0,this.Ke.length=0,P(this.Je)}dequeue(){const t=this.He,e=this.Ke,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.Qe(0));const n=this.We(i);return delete this.Je[n],i}enqueue(t){ct(!(this.We(t)in this.Je),31);const e=this.Ve(t);return e!=No&&(this.He.push(t),this.Ke.push(e),this.Je[this.We(t)]=!0,this.ti(0,this.He.length-1),!0)}getCount(){return this.He.length}ei(t){return 2*t+1}ii(t){return 2*t+2}ni(t){return t-1>>1}si(){let t;for(t=(this.He.length>>1)-1;t>=0;t--)this.Qe(t)}isEmpty(){return 0===this.He.length}isKeyQueued(t){return t in this.Je}isQueued(t){return this.isKeyQueued(this.We(t))}Qe(t){const e=this.He,i=this.Ke,n=e.length,s=e[t],r=i[t],o=t;for(;t<n>>1;){const s=this.ei(t),r=this.ii(t),o=r<n&&i[r]<i[s]?r:s;e[t]=e[o],i[t]=i[o],t=o}e[t]=s,i[t]=r,this.ti(o,t)}ti(t,e){const i=this.He,n=this.Ke,s=i[e],r=n[e];for(;e>t;){const t=this.ni(e);if(!(n[t]>r))break;i[e]=i[t],n[e]=n[t],e=t}i[e]=s,n[e]=r}reprioritize(){const t=this.Ve,e=this.He,i=this.Ke;let n=0;const s=e.length;let r,o,h;for(o=0;o<s;++o)r=e[o],h=t(r),h==No?delete this.Je[this.We(r)]:(i[n]=h,e[n++]=r);e.length=n,i.length=n,this.si()}};var zo=class extends Oo{constructor(t,e){super((function(e){return t.apply(null,e)}),(function(t){return t[0].getKey()})),this.ri=this.handleTileChange.bind(this),this.oi=e,this.hi=0,this.ai={}}enqueue(t){const e=super.enqueue(t);if(e){t[0].addEventListener(T,this.ri)}return e}getTilesLoading(){return this.hi}handleTileChange(t){const e=t.target,i=e.getState();if(i===it||i===nt||i===st){i!==nt&&e.removeEventListener(T,this.ri);const t=e.getKey();t in this.ai&&(delete this.ai[t],--this.hi),this.oi()}}loadMoreTiles(t,e){let i,n,s,r=0;for(;this.hi<t&&r<e&&this.getCount()>0;)n=this.dequeue()[0],s=n.getKey(),i=n.getState(),i!==tt||s in this.ai||(this.ai[s]=!0,++this.hi,++r,n.load())}};function Go(t,e,i,n,s){if(!t||!(i in t.wantedTiles))return No;if(!t.wantedTiles[i][e.getKey()])return No;const r=t.viewState.center,o=n[0]-r[0],h=n[1]-r[1];return 65536*Math.log(s)+Math.sqrt(o*o+h*h)/s}var jo=0,Do=1,Uo={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};const $o=256;function Bo(t,e,i){return function(n,s,r,o,h){if(!n)return;if(!s&&!e)return n;const a=e?0:r[0]*s,u=e?0:r[1]*s,l=h?h[0]:0,c=h?h[1]:0;let f=t[0]+a/2+l,d=t[2]-a/2+l,p=t[1]+u/2+c,m=t[3]-u/2+c;f>d&&(f=(d+f)/2,d=f),p>m&&(p=(m+p)/2,m=p);let v=hi(n[0],f,d),g=hi(n[1],p,m);if(o&&i&&s){const t=30*s;v+=-t*Math.log(1+Math.max(0,f-n[0])/t)+t*Math.log(1+Math.max(0,n[0]-d)/t),g+=-t*Math.log(1+Math.max(0,p-n[1])/t)+t*Math.log(1+Math.max(0,n[1]-m)/t)}return[v,g]}}function qo(t){return t}function Xo(t,e,i,n){const s=Ee(e)/i[0],r=Me(e)/i[1];return n?Math.min(t,Math.max(s,r)):Math.min(t,Math.min(s,r))}function Yo(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),hi(n,i/2,2*e)}function Zo(t,e,i,n){return e=void 0===e||e,function(s,r,o,h){if(void 0!==s){const a=t[0],u=t[t.length-1],l=i?Xo(a,i,o,n):a;if(h)return e?Yo(s,l,u):hi(s,u,l);const c=Math.min(l,s),f=Math.floor(p(t,c,r));return t[f]>l&&f<t.length-1?t[f+1]:t[f]}}}function Vo(t,e,i,n,s,r){return n=void 0===n||n,i=void 0!==i?i:0,function(o,h,a,u){if(void 0!==o){const l=s?Xo(e,s,a,r):e;if(u)return n?Yo(o,l,i):hi(o,i,l);const c=1e-9,f=Math.ceil(Math.log(e/l)/Math.log(t)-c),d=-h*(.5-c)+.5,p=Math.min(l,o),m=Math.floor(Math.log(e/p)/Math.log(t)+d),v=Math.max(f,m);return hi(e/Math.pow(t,v),i,l)}}}function Wo(t,e,i,n,s){return i=void 0===i||i,function(r,o,h,a){if(void 0!==r){const o=n?Xo(t,n,h,s):t;return i&&a?Yo(r,o,e):hi(r,e,o)}}}function Ho(t){return void 0!==t?0:void 0}function Ko(t){return void 0!==t?t:void 0}function Jo(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 Qo(t){return t=t||fi(5),function(e,i){return i?e:void 0!==e?Math.abs(e)<=t?0:e:void 0}}function th(t,e){setTimeout((function(){t(e)}),0)}function eh(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Bo(t.extent,t.constrainOnlyCenter,e)}const e=Hi(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Bo(t,!1,!1)}return qo}function ih(t){let e,i,n;let s=void 0!==t.minZoom?t.minZoom:0,r=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,h=void 0!==t.multiWorld&&t.multiWorld,a=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,l=Hi(t.projection,"EPSG:3857"),c=l.getExtent();let f=t.constrainOnlyCenter,d=t.extent;if(h||d||!l.isGlobal()||(f=!1,d=c),void 0!==t.resolutions){const o=t.resolutions;i=o[s],n=void 0!==o[r]?o[r]:o[o.length-1],e=t.constrainResolution?Zo(o,a,!f&&d,u):Wo(i,n,a,!f&&d,u)}else{const h=(c?Math.max(Ee(c),Me(c)):360*ze.degrees/l.getMetersPerUnit())/$o/Math.pow(2,0),p=h/Math.pow(2,28);i=t.maxResolution,void 0!==i?s=0:i=h/Math.pow(o,s),n=t.minResolution,void 0===n&&(n=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,r):h/Math.pow(o,r):p),r=s+Math.floor(Math.log(i/n)/Math.log(o)),n=i/Math.pow(o,r-s),e=t.constrainResolution?Vo(o,i,n,a,!f&&d,u):Wo(i,n,a,!f&&d,u)}return{constraint:e,maxResolution:i,minResolution:n,minZoom:s,zoomFactor:o}}function nh(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?Qo():!1===e?Ko:"number"==typeof e?Jo(e):Ko}return Ho}function sh(t){return!(t.sourceCenter&&t.targetCenter&&!Ei(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function rh(t,e,i,n,s){const r=Math.cos(-s);let o=Math.sin(-s),h=t[0]*r-t[1]*o,a=t[1]*r+t[0]*o;h+=(e[0]/2-i[0])*n,a+=(i[1]-e[1]/2)*n,o=-o;return[h*r-a*o,a*r+h*o]}var oh=class extends V{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.ui=[0,0],this.li=[],this.ci,this.fi=Hi(t.projection,"EPSG:3857"),this.di=[100,100],this.mi=null,this.vi,this.gi,this.yi=null,this.wi,this.xi,this.bi=void 0,t.projection&&Ui(),t.center&&(t.center=ln(t.center,this.fi)),t.extent&&(t.extent=fn(t.extent,this.fi)),this.Mi(t)}Mi(t){const e=Object.assign({},t);for(const t in Uo)delete e[t];this.setProperties(e,!0);const i=ih(t);this.Si=i.maxResolution,this.Pi=i.minResolution,this._i=i.zoomFactor,this.Ei=t.resolutions,this.Ti=t.padding,this.Ci=i.minZoom;const n=eh(t),s=i.constraint,r=nh(t);this.Fi={center:n,resolution:s,rotation:r},this.setRotation(void 0!==t.rotation?t.rotation:0),this.setCenterInternal(void 0!==t.center?t.center:null),void 0!==t.resolution?this.setResolution(t.resolution):void 0!==t.zoom&&this.setZoom(t.zoom)}get padding(){return this.Ti}set padding(t){let e=this.Ti;this.Ti=t;const i=this.getCenter();if(i){const n=t||[0,0,0,0];e=e||[0,0,0,0];const s=this.getResolution(),r=s/2*(n[3]-e[3]+e[1]-n[1]),o=s/2*(n[0]-e[0]+e[2]-n[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}Ii(t){const e=this.getProperties();return void 0!==e.resolution?e.resolution=this.getResolution():e.zoom=this.getZoom(),e.center=this.getCenterInternal(),e.rotation=this.getRotation(),Object.assign({},e,t)}animate(t){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);const e=new Array(arguments.length);for(let t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=ln(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=ln(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let n=0;for(;n<i&&!this.isDef();++n){const t=arguments[n];t.center&&this.setCenterInternal(t.center),void 0!==t.zoom?this.setZoom(t.zoom):t.resolution&&this.setResolution(t.resolution),void 0!==t.rotation&&this.setRotation(t.rotation)}if(n===i)return void(e&&th(e,!0));let s=Date.now(),r=this.mi.slice(),o=this.vi,h=this.gi;const a=[];for(;n<i;++n){const t=arguments[n],i={start:s,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||ht,callback:e};if(t.center&&(i.sourceCenter=r,i.targetCenter=t.center.slice(),r=i.targetCenter),void 0!==t.zoom?(i.sourceResolution=o,i.targetResolution=this.getResolutionForZoom(t.zoom),o=i.targetResolution):t.resolution&&(i.sourceResolution=o,i.targetResolution=t.resolution,o=i.targetResolution),void 0!==t.rotation){i.sourceRotation=h;const e=di(t.rotation-h+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=h+e,h=i.targetRotation}sh(i)?i.complete=!0:s+=i.duration,a.push(i)}this.li.push(a),this.setHint(jo,1),this.Ai()}getAnimating(){return this.ui[jo]>0}getInteracting(){return this.ui[Do]>0}cancelAnimations(){let t;this.setHint(jo,-this.ui[jo]);for(let e=0,i=this.li.length;e<i;++e){const i=this.li[e];if(i[0].callback&&th(i[0].callback,!1),!t)for(let e=0,n=i.length;e<n;++e){const n=i[e];if(!n.complete){t=n.anchor;break}}}this.li.length=0,this.bi=t,this.yi=null,this.wi=NaN,this.xi=NaN}Ai(){if(void 0!==this.ci&&(cancelAnimationFrame(this.ci),this.ci=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.li.length-1;i>=0;--i){const n=this.li[i];let s=!0;for(let i=0,r=n.length;i<r;++i){const r=n[i];if(r.complete)continue;const o=t-r.start;let h=r.duration>0?o/r.duration:1;h>=1?(r.complete=!0,h=1):s=!1;const a=r.easing(h);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],n=r.targetCenter[1];this.yi=r.targetCenter;const s=t+a*(i-t),o=e+a*(n-e);this.mi=[s,o]}if(r.sourceResolution&&r.targetResolution){const t=1===a?r.targetResolution:r.sourceResolution+a*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.ki(this.getRotation()),i=this.Fi.resolution(t,0,e,!0);this.mi=this.calculateCenterZoom(i,r.anchor)}this.wi=r.targetResolution,this.vi=t,this.Ri(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===a?di(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+a*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.Fi.rotation(t,!0);this.mi=this.calculateCenterRotate(e,r.anchor)}this.xi=r.targetRotation,this.gi=t}if(this.Ri(!0),e=!0,!r.complete)break}if(s){this.li[i]=null,this.setHint(jo,-1),this.yi=null,this.wi=NaN,this.xi=NaN;const t=n[0].callback;t&&th(t,!0)}}this.li=this.li.filter(Boolean),e&&void 0===this.ci&&(this.ci=requestAnimationFrame(this.Ai.bind(this)))}calculateCenterRotate(t,e){let i;const n=this.getCenterInternal();return void 0!==n&&(i=[n[0]-e[0],n[1]-e[1]],Ti(i,t-this.getRotation()),bi(i,e)),i}calculateCenterZoom(t,e){let i;const n=this.getCenterInternal(),s=this.getResolution();if(void 0!==n&&void 0!==s){i=[e[0]-t*(e[0]-n[0])/s,e[1]-t*(e[1]-n[1])/s]}return i}ki(t){const e=this.di;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.di=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?un(t,this.getProjection()):t}getCenterInternal(){return this.get(Uo.CENTER)}getConstraints(){return this.Fi}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.ui[0],t[1]=this.ui[1],t):this.ui.slice()}calculateExtent(t){return cn(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.Li();const e=this.getCenterInternal();ct(e,1);const i=this.getResolution();ct(void 0!==i,2);const n=this.getRotation();return ct(void 0!==n,3),xe(e,i,n,t)}getMaxResolution(){return this.Si}getMinResolution(){return this.Pi}getMaxZoom(){return this.getZoomForResolution(this.Pi)}setMaxZoom(t){this.Mi(this.Ii({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.Si)}setMinZoom(t){this.Mi(this.Ii({minZoom:t}))}setConstrainResolution(t){this.Mi(this.Ii({constrainResolution:t}))}getProjection(){return this.fi}getResolution(){return this.get(Uo.RESOLUTION)}getResolutions(){return this.Ei}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(fn(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.Li();const i=Ee(t)/e[0],n=Me(t)/e[1];return Math.max(i,n)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.Si),i=this.Pi,n=Math.log(e/i)/Math.log(t);return function(i){return e/Math.pow(t,i*n)}}getRotation(){return this.get(Uo.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.Si),n=this.Pi,s=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/s}}Li(t){let e=this.ki(t);const i=this.Ti;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 s=this.Ti;if(s){const t=this.Li();n=rh(n,this.ki(),[t[0]/2+s[3],t[1]/2+s[0]],e,i)}return{center:n.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.yi,nextResolution:this.wi,nextRotation:this.xi,rotation:i,zoom:this.getZoom()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,n=this.Ci||0;if(this.Ei){const s=p(this.Ei,t,1);n=s,e=this.Ei[s],i=s==this.Ei.length-1?2:e/this.Ei[s+1]}else e=this.Si,i=this._i;return n+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.Ei){if(this.Ei.length<=1)return 0;const e=hi(Math.floor(t),0,this.Ei.length-2),i=this.Ei[e]/this.Ei[e+1];return this.Ei[e]/Math.pow(i,hi(t-e,0,1))}return this.Si/Math.pow(this._i,t-this.Ci)}fit(t,e){let i;if(ct(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t)){ct(!Ce(t),25);i=Ms(fn(t,this.getProjection()))}else if("Circle"===t.getType()){const e=fn(t.getExtent(),this.getProjection());i=Ms(e),i.rotate(this.getRotation(),ye(e))}else{const e=an();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),s=t.getFlatCoordinates(),r=t.getStride();let o=1/0,h=1/0,a=-1/0,u=-1/0;for(let t=0,e=s.length;t<e;t+=r){const e=s[t]*i-s[t+1]*n,r=s[t]*n+s[t+1]*i;o=Math.min(o,e),h=Math.min(h,r),a=Math.max(a,e),u=Math.max(u,r)}return[o,h,a,u]}fitInternal(t,e){let i=(e=e||{}).size;i||(i=this.Li());const n=void 0!==e.padding?e.padding:[0,0,0,0],s=void 0!==e.nearest&&e.nearest;let r;r=void 0!==e.minResolution?e.minResolution:void 0!==e.maxZoom?this.getResolutionForZoom(e.maxZoom):0;const o=this.rotatedExtentForGeometry(t);let h=this.getResolutionForExtentInternal(o,[i[0]-n[1]-n[3],i[1]-n[0]-n[2]]);h=isNaN(h)?r:Math.max(h,r),h=this.getConstrainedResolution(h,s?0:1);const a=this.getRotation(),u=Math.sin(a),l=Math.cos(a),c=ye(o);c[0]+=(n[1]-n[3])/2*h,c[1]+=(n[0]-n[2])/2*h;const f=c[0]*l-c[1]*u,d=c[1]*l+c[0]*u,p=this.getConstrainedCenter([f,d],h),m=e.callback?e.callback:b;void 0!==e.duration?this.animateInternal({resolution:h,center:p,duration:e.duration,easing:e.easing},m):(this.vi=h,this.mi=p,this.Ri(!1,!0),th(m,!0))}centerOn(t,e,i){this.centerOnInternal(ln(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(rh(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,n){let s;const r=this.Ti;if(r&&t){const o=this.Li(-i),h=rh(t,n,[o[0]/2+r[3],o[1]/2+r[0]],e,i);s=[t[0]-h[0],t[1]-h[1]]}return s}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=un(this.mi,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.mi;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&ln(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.ki(this.getRotation()),s=this.Fi.resolution(this.vi*t,0,n,i);e&&(this.mi=this.calculateCenterZoom(s,e)),this.vi*=t,this.Ri()}adjustZoom(t,e){this.adjustResolution(Math.pow(this._i,-t),e)}adjustRotation(t,e){e&&(e=ln(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),n=this.Fi.rotation(this.gi+t,i);e&&(this.mi=this.calculateCenterRotate(n,e)),this.gi+=t,this.Ri()}setCenter(t){this.setCenterInternal(t?ln(t,this.getProjection()):t)}setCenterInternal(t){this.mi=t,this.Ri()}setHint(t,e){return this.ui[t]+=e,this.changed(),this.ui[t]}setResolution(t){this.vi=t,this.Ri()}setRotation(t){this.gi=t,this.Ri()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}Ri(t,e){const i=this.getAnimating()||this.getInteracting()||e,n=this.Fi.rotation(this.gi,i),s=this.ki(n),r=this.Fi.resolution(this.vi,0,s,i),o=this.Fi.center(this.mi,r,s,i,this.calculateCenterShift(this.mi,r,n,s));this.get(Uo.ROTATION)!==n&&this.set(Uo.ROTATION,n),this.get(Uo.RESOLUTION)!==r&&(this.set(Uo.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(Uo.CENTER)&&Ei(this.get(Uo.CENTER),o)||this.set(Uo.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.bi=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const n=e||0,s=this.Fi.rotation(this.gi),r=this.ki(s),o=this.Fi.resolution(this.vi,n,r),h=this.Fi.center(this.mi,o,r,!1,this.calculateCenterShift(this.mi,o,s,r));if(0===t&&!this.bi)return this.vi=o,this.gi=s,this.mi=h,void this.Ri();i=i||(0===t?this.bi:void 0),this.bi=void 0,this.getResolution()===o&&this.getRotation()===s&&this.getCenterInternal()&&Ei(this.getCenterInternal(),h)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:s,center:h,resolution:o,duration:t,easing:ot,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(Do,1)}endInteraction(t,e,i){i=i&&ln(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.setHint(Do,-1),this.resolveConstraints(t,e,i)}getConstrainedCenter(t,e){const i=this.ki(this.getRotation());return this.Fi.center(t,e||this.getResolution(),i)}getConstrainedZoom(t,e){const i=this.getResolutionForZoom(t);return this.getZoomForResolution(this.getConstrainedResolution(i,e))}getConstrainedResolution(t,e){e=e||0;const i=this.ki(this.getRotation());return this.Fi.resolution(t,e,i)}};var hh=class extends V{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.Ni=null,this.le=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){Ks(this.element),super.disposeInternal()}getMap(){return this.le}setMap(t){this.le&&Ks(this.element);for(let t=0,e=this.listenerKeys.length;t<e;++t)B(this.listenerKeys[t]);if(this.listenerKeys.length=0,this.le=t,t){(this.Ni?this.Ni:t.getOverlayContainerStopEvent()).appendChild(this.element),this.render!==b&&this.listenerKeys.push(U(t,Eo,this.render,this)),t.render()}}render(t){}setTarget(t){this.Ni="string"==typeof t?document.getElementById(t):t}};var ah=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.Oi=document.createElement("ul"),this.zi=void 0===t.collapsed||t.collapsed,this.Gi=this.zi,this.ji=void 0!==t.collapsible,this.Di=void 0===t.collapsible||t.collapsible,this.Di||(this.zi=!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",s=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"==typeof s?(this.Ui=document.createElement("span"),this.Ui.textContent=s,this.Ui.className=r):this.Ui=s;const o=void 0!==t.label?t.label:"i";"string"==typeof o?(this.$i=document.createElement("span"),this.$i.textContent=o,this.$i.className=n):this.$i=o;const h=this.Di&&!this.zi?this.Ui:this.$i;this.Bi=document.createElement("button"),this.Bi.setAttribute("type","button"),this.Bi.setAttribute("aria-expanded",String(!this.zi)),this.Bi.title=i,this.Bi.appendChild(h),this.Bi.addEventListener(I,this.qi.bind(this),!1);const a=e+" "+"ol-unselectable "+Dr+(this.zi&&this.Di?" ol-collapsed":"")+(this.Di?"":" ol-uncollapsible"),u=this.element;u.className=a,u.appendChild(this.Bi),u.appendChild(this.Oi),this.Xi=[],this.pe=!0}Yi(t){const e={},i=[];let n=!0;const s=t.layerStatesArray;for(let r=0,o=s.length;r<o;++r){const o=s[r];if(!Ar(o,t.viewState))continue;const h=o.layer.getSource();if(!h)continue;const a=h.getAttributions();if(!a)continue;const u=a(t);if(u)if(n=n&&!1!==h.getAttributionsCollapsible(),Array.isArray(u))for(let t=0,n=u.length;t<n;++t)u[t]in e||(i.push(u[t]),e[u[t]]=!0);else u in e||(i.push(u),e[u]=!0)}return this.ji||this.setCollapsible(n),i}Zi(t){if(!t)return void(this.pe&&(this.element.style.display="none",this.pe=!1));const e=this.Yi(t),i=e.length>0;if(this.pe!=i&&(this.element.style.display=i?"":"none",this.pe=i),!g(e,this.Xi)){Js(this.Oi);for(let t=0,i=e.length;t<i;++t){const i=document.createElement("li");i.innerHTML=e[t],this.Oi.appendChild(i)}this.Xi=e}}qi(t){t.preventDefault(),this.Vi(),this.Gi=this.zi}Vi(){this.element.classList.toggle(Ur),this.zi?Hs(this.Ui,this.$i):Hs(this.$i,this.Ui),this.zi=!this.zi,this.Bi.setAttribute("aria-expanded",String(!this.zi))}getCollapsible(){return this.Di}setCollapsible(t){this.Di!==t&&(this.Di=t,this.element.classList.toggle("ol-uncollapsible"),this.Gi&&this.Vi())}setCollapsed(t){this.Gi=t,this.Di&&this.zi!==t&&this.Vi()}getCollapsed(){return this.zi}render(t){this.Zi(t.frameState)}};var uh=class extends hh{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.$i=null,"string"==typeof i?(this.$i=document.createElement("span"),this.$i.className=n,this.$i.textContent=i):(this.$i=i,this.$i.classList.add(n));const s=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=s,r.appendChild(this.$i),r.addEventListener(I,this.qi.bind(this),!1);const o=e+" "+"ol-unselectable "+Dr,h=this.element;h.className=o,h.appendChild(r),this.Wi=t.resetNorth?t.resetNorth:void 0,this.Hi=void 0!==t.duration?t.duration:250,this.Ki=void 0===t.autoHide||t.autoHide,this.Ji=void 0,this.Ki&&this.element.classList.add(Or)}qi(t){t.preventDefault(),void 0!==this.Wi?this.Wi():this.Qi()}Qi(){const t=this.getMap().getView();if(!t)return;const e=t.getRotation();void 0!==e&&(this.Hi>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.Hi,easing:ot}):t.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.Ji){const t="rotate("+i+"rad)";if(this.Ki){const t=this.element.classList.contains(Or);t||0!==i?t&&0!==i&&this.element.classList.remove(Or):this.element.classList.add(Or)}this.$i.style.transform=t}this.Ji=i}};var lh=class extends hh{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",s=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",h=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",a=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",u=document.createElement("button");u.className=n,u.setAttribute("type","button"),u.title=h,u.appendChild("string"==typeof r?document.createTextNode(r):r),u.addEventListener(I,this.qi.bind(this,i),!1);const l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=a,l.appendChild("string"==typeof o?document.createTextNode(o):o),l.addEventListener(I,this.qi.bind(this,-i),!1);const c=e+" "+"ol-unselectable "+Dr,f=this.element;f.className=c,f.appendChild(u),f.appendChild(l),this.Hi=void 0!==t.duration?t.duration:250}qi(t,e){e.preventDefault(),this.tn(t)}tn(t){const e=this.getMap().getView();if(!e)return;const i=e.getZoom();if(void 0!==i){const n=e.getConstrainedZoom(i+t);this.Hi>0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.Hi,easing:ot})):e.setZoom(n)}}};function ch(t){t=t||{};const e=new Q;(void 0===t.zoom||t.zoom)&&e.push(new lh(t.zoomOptions));(void 0===t.rotate||t.rotate)&&e.push(new uh(t.rotateOptions));return(void 0===t.attribution||t.attribution)&&e.push(new ah(t.attributionOptions)),e}var fh="active";function dh(t,e,i){const n=t.getCenterInternal();if(n){const s=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:at,center:t.getConstrainedCenter(s)})}}function ph(t,e,i,n){const s=t.getZoom();if(void 0===s)return;const r=t.getConstrainedZoom(s+e),o=t.getResolutionForZoom(r);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:ot})}var mh=class extends V{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.le=null,this.setActive(!0)}getActive(){return this.get(fh)}getMap(){return this.le}handleEvent(t){return!0}setActive(t){this.set(fh,t)}setMap(t){this.le=t}};var vh=class extends mh{constructor(t){super(),t=t||{},this.en=t.delta?t.delta:1,this.Hi=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==xo.DBLCLICK){const i=t.originalEvent,n=t.map,s=t.coordinate,r=i.shiftKey?-this.en:this.en;ph(n.getView(),r,s,this.Hi),i.preventDefault(),e=!0}return!e}};function gh(t){const e=t.length;let i=0,n=0;for(let s=0;s<e;s++)i+=t[s].clientX,n+=t[s].clientY;return[i/e,n/e]}var yh=class extends mh{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.nn(t),this.handlingDownUpSequence){if(t.type==xo.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==xo.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==xo.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==xo.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}nn(t){t.activePointers&&(this.targetPointers=t.activePointers)}};function wh(t){const e=arguments;return function(t){let i=!0;for(let n=0,s=e.length;n<s&&(i=i&&e[n](t),i);++n);return i}}const xh=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},bh=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Mh=function(t){const e=t.map.getTargetElement(),i=t.map.getOwnerDocument().activeElement;return e.contains(i)},Sh=function(t){return!t.map.getTargetElement().hasAttribute("tabindex")||Mh(t)},Ph=w,_h=function(t){const e=t.originalEvent;return 0==e.button&&!(wt&&xt&&e.ctrlKey)},Eh=x,Th=function(t){return t.type==xo.SINGLECLICK},Ch=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Fh=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Ih=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Ah=function(t){const e=t.originalEvent;return ct(void 0!==e,56),"mouse"==e.pointerType},kh=function(t){const e=t.originalEvent;return ct(void 0!==e,56),e.isPrimary&&0===e.button};var Rh=class extends yh{constructor(t){super({stopDown:x}),t=t||{},this.sn=t.kinetic,this.lastCentroid=null,this.rn,this.hn=!1;const e=t.condition?t.condition:wh(Ch,kh);this.an=t.onFocusOnly?wh(Sh,e):e,this.cn=!1}handleDragEvent(t){this.hn||(this.hn=!0,this.getMap().getView().beginInteraction());const e=this.targetPointers,i=gh(e);if(e.length==this.rn){if(this.sn&&this.sn.update(i[0],i[1]),this.lastCentroid){const e=[this.lastCentroid[0]-i[0],i[1]-this.lastCentroid[1]],n=t.map.getView();Ci(e,n.getResolution()),Ti(e,n.getRotation()),n.adjustCenterInternal(e)}}else this.sn&&this.sn.begin();this.lastCentroid=i,this.rn=e.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.cn&&this.sn&&this.sn.end()){const t=this.sn.getDistance(),n=this.sn.getAngle(),s=i.getCenterInternal(),r=e.getPixelFromCoordinateInternal(s),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(n),r[1]-t*Math.sin(n)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:ot})}return this.hn&&(this.hn=!1,i.endInteraction()),!1}return this.sn&&this.sn.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.an(t)){const e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.sn&&this.sn.begin(),this.cn=this.targetPointers.length>1,!0}return!1}};var Lh=class extends yh{constructor(t){t=t||{},super({stopDown:x}),this.an=t.condition?t.condition:bh,this.fn=void 0,this.Hi=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Ah(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Ho)return;const n=e.getSize(),s=t.pixel,r=Math.atan2(n[1]/2-s[1],s[0]-n[0]/2);if(void 0!==this.fn){const t=r-this.fn;i.adjustRotationInternal(-t)}this.fn=r}handleUpEvent(t){if(!Ah(t))return!0;return t.map.getView().endInteraction(this.Hi),!1}handleDownEvent(t){if(!Ah(t))return!1;if(_h(t)&&this.an(t)){return t.map.getView().beginInteraction(),this.fn=void 0,!0}return!1}};var Nh=class extends c{constructor(t){super(),this.dn=null,this.fe=document.createElement("div"),this.fe.style.position="absolute",this.fe.style.pointerEvents="auto",this.fe.className="ol-box "+t,this.le=null,this.pn=null,this.mn=null}disposeInternal(){this.setMap(null)}vn(){const t=this.pn,e=this.mn,i="px",n=this.fe.style;n.left=Math.min(t[0],e[0])+i,n.top=Math.min(t[1],e[1])+i,n.width=Math.abs(e[0]-t[0])+i,n.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.le){this.le.getOverlayContainer().removeChild(this.fe);const t=this.fe.style;t.left="inherit",t.top="inherit",t.width="inherit",t.height="inherit"}this.le=t,this.le&&this.le.getOverlayContainer().appendChild(this.fe)}setPixels(t,e){this.pn=t,this.mn=e,this.createOrUpdateGeometry(),this.vn()}createOrUpdateGeometry(){const t=this.pn,e=this.mn,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.le.getCoordinateFromPixelInternal,this.le);i[4]=i[0].slice(),this.dn?this.dn.setCoordinates([i]):this.dn=new xs([i])}getGeometry(){return this.dn}};const Oh="boxstart",zh="boxdrag",Gh="boxend",jh="boxcancel";class Dh extends u{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}var Uh=class extends yh{constructor(t){super(),this.on,this.once,this.un,t=t||{},this.gn=new Nh(t.className||"ol-dragbox"),this.yn=void 0!==t.minArea?t.minArea:64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.pn=null,this.an=t.condition?t.condition:_h,this.wn=t.boxEndCondition?t.boxEndCondition:this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const n=i[0]-e[0],s=i[1]-e[1];return n*n+s*s>=this.yn}getGeometry(){return this.gn.getGeometry()}handleDragEvent(t){this.gn.setPixels(this.pn,t.pixel),this.dispatchEvent(new Dh(zh,t.coordinate,t))}handleUpEvent(t){this.gn.setMap(null);const e=this.wn(t,this.pn,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new Dh(e?Gh:jh,t.coordinate,t)),!1}handleDownEvent(t){return!!this.an(t)&&(this.pn=t.pixel,this.gn.setMap(t.map),this.gn.setPixels(this.pn,this.pn),this.dispatchEvent(new Dh(Oh,t.coordinate,t)),!0)}onBoxEnd(t){}};var $h=class extends Uh{constructor(t){super({condition:(t=t||{}).condition?t.condition:Fh,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.Hi=void 0!==t.duration?t.duration:200,this.xn=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap().getView();let i=this.getGeometry();if(this.xn){const t=e.rotatedExtentForGeometry(i),n=e.getResolutionForExtentInternal(t),s=e.getResolution()/n;i=i.clone(),i.scale(s*s)}e.fitInternal(i,{duration:this.Hi,easing:ot})}},Bh=37,qh=38,Xh=39,Yh=40;var Zh=class extends mh{constructor(t){super(),t=t||{},this.bn=function(t){return Ch(t)&&Ih(t)},this.an=void 0!==t.condition?t.condition:this.bn,this.Hi=void 0!==t.duration?t.duration:100,this.Mn=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==N){const i=t.originalEvent,n=i.keyCode;if(this.an(t)&&(n==Yh||n==Bh||n==Xh||n==qh)){const s=t.map.getView(),r=s.getResolution()*this.Mn;let o=0,h=0;n==Yh?h=-r:n==Bh?o=-r:n==Xh?o=r:h=r;const a=[o,h];Ti(a,s.getRotation()),dh(s,a,this.Hi),i.preventDefault(),e=!0}}return!e}};var Vh=class extends mh{constructor(t){super(),t=t||{},this.an=t.condition?t.condition:Ih,this.en=t.delta?t.delta:1,this.Hi=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==N||t.type==O){const i=t.originalEvent,n=i.charCode;if(this.an(t)&&(n=="+".charCodeAt(0)||n=="-".charCodeAt(0))){const s=t.map,r=n=="+".charCodeAt(0)?this.en:-this.en;ph(s.getView(),r,void 0,this.Hi),i.preventDefault(),e=!0}}return!e}};var Wh=class extends mh{constructor(t){super(t=t||{}),this.Sn=0,this.Pn=0,this.wt=void 0!==t.maxDelta?t.maxDelta:1,this.Hi=void 0!==t.duration?t.duration:250,this._n=void 0!==t.timeout?t.timeout:80,this.En=void 0===t.useAnchor||t.useAnchor,this.Tn=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:Ph;this.an=t.onFocusOnly?wh(Sh,e):e,this.Cn=null,this.Fn=void 0,this.In,this.An=void 0,this.kn=400,this.Rn,this.Ln=300}Nn(){this.Rn=void 0;const t=this.getMap();if(!t)return;t.getView().endInteraction(void 0,this.Pn?this.Pn>0?1:-1:0,this.Cn)}handleEvent(t){if(!this.an(t))return!0;if(t.type!==D)return!0;const e=t.map,i=t.originalEvent;let n;if(i.preventDefault(),this.En&&(this.Cn=t.coordinate),t.type==D&&(n=i.deltaY,vt&&i.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(n/=bt),i.deltaMode===WheelEvent.DOM_DELTA_LINE&&(n*=40)),0===n)return!1;this.Pn=n;const s=Date.now();void 0===this.Fn&&(this.Fn=s),(!this.An||s-this.Fn>this.kn)&&(this.An=Math.abs(n)<4?"trackpad":"wheel");const r=e.getView();if("trackpad"===this.An&&!r.getConstrainResolution()&&!this.Tn)return this.Rn?clearTimeout(this.Rn):(r.getAnimating()&&r.cancelAnimations(),r.beginInteraction()),this.Rn=setTimeout(this.Nn.bind(this),this._n),r.adjustZoom(-n/this.Ln,this.Cn),this.Fn=s,!1;this.Sn+=n;const o=Math.max(this._n-(s-this.Fn),0);return clearTimeout(this.In),this.In=setTimeout(this.On.bind(this,e),o),!1}On(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-hi(this.Sn,-this.wt*this.Ln,this.wt*this.Ln)/this.Ln;(e.getConstrainResolution()||this.Tn)&&(i=i?i>0?1:-1:0),ph(e,i,this.Cn,this.Hi),this.An=void 0,this.Sn=0,this.Cn=null,this.Fn=void 0,this.In=void 0}setMouseAnchor(t){this.En=t,t||(this.Cn=null)}};var Hh=class extends yh{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=x),super(e),this.zn=null,this.fn=void 0,this.Gn=!1,this.jn=0,this.Dn=void 0!==t.threshold?t.threshold:.3,this.Hi=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],n=this.targetPointers[1],s=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.fn){const t=s-this.fn;this.jn+=t,!this.Gn&&Math.abs(this.jn)>this.Dn&&(this.Gn=!0),e=t}this.fn=s;const r=t.map,o=r.getView();if(o.getConstraints().rotation===Ho)return;const h=r.getViewport().getBoundingClientRect(),a=gh(this.targetPointers);a[0]-=h.left,a[1]-=h.top,this.zn=r.getCoordinateFromPixelInternal(a),this.Gn&&(r.render(),o.adjustRotationInternal(e,this.zn))}handleUpEvent(t){if(this.targetPointers.length<2){return t.map.getView().endInteraction(this.Hi),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.zn=null,this.fn=void 0,this.Gn=!1,this.jn=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};var Kh=class extends yh{constructor(t){const e=t=t||{};e.stopDown||(e.stopDown=x),super(e),this.zn=null,this.Hi=void 0!==t.duration?t.duration:400,this.Un=void 0,this.$n=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],n=this.targetPointers[1],s=i.clientX-n.clientX,r=i.clientY-n.clientY,o=Math.sqrt(s*s+r*r);void 0!==this.Un&&(e=this.Un/o),this.Un=o;const h=t.map,a=h.getView();1!=e&&(this.$n=e);const u=h.getViewport().getBoundingClientRect(),l=gh(this.targetPointers);l[0]-=u.left,l[1]-=u.top,this.zn=h.getCoordinateFromPixelInternal(l),h.render(),a.adjustResolutionInternal(e,this.zn)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map.getView(),i=this.$n>1?1:-1;return e.endInteraction(this.Hi,i),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.zn=null,this.Un=void 0,this.$n=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}};function Jh(t){t=t||{};const e=new Q,i=new er(-.005,.05,100);(void 0===t.altShiftDragRotate||t.altShiftDragRotate)&&e.push(new Lh);(void 0===t.doubleClickZoom||t.doubleClickZoom)&&e.push(new vh({delta:t.zoomDelta,duration:t.zoomDuration}));(void 0===t.dragPan||t.dragPan)&&e.push(new Rh({onFocusOnly:t.onFocusOnly,kinetic:i}));(void 0===t.pinchRotate||t.pinchRotate)&&e.push(new Hh);(void 0===t.pinchZoom||t.pinchZoom)&&e.push(new Kh({duration:t.zoomDuration}));(void 0===t.keyboard||t.keyboard)&&(e.push(new Zh),e.push(new Vh({delta:t.zoomDelta,duration:t.zoomDuration})));(void 0===t.mouseWheelZoom||t.mouseWheelZoom)&&e.push(new Wh({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));return(void 0===t.shiftDragZoom||t.shiftDragZoom)&&e.push(new $h({duration:t.zoomDuration})),e}function Qh(t,e,i){return void 0===i&&(i=[0,0]),i[0]=t[0]+2*e,i[1]=t[1]+2*e,i}function ta(t){return t[0]>0&&t[1]>0}function ea(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 ia(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}function na(t){t instanceof kr?t.setMapInternal(null):t instanceof go&&t.getLayers().forEach(na)}function sa(t,e){if(t instanceof kr)t.setMapInternal(e);else if(t instanceof go){const i=t.getLayers().getArray();for(let t=0,n=i.length;t<n;++t)sa(i[t],e)}}var ra=class extends V{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=function(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},n=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new go({layers:t.layers});let s,r,o;i[Ao]=n,i[Ro]=t.target,i[Lo]=t.view instanceof oh?t.view:new oh,void 0!==t.controls&&(Array.isArray(t.controls)?s=new Q(t.controls.slice()):(ct("function"==typeof t.controls.getArray,47),s=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Q(t.interactions.slice()):(ct("function"==typeof t.interactions.getArray,48),r=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?o=new Q(t.overlays.slice()):(ct("function"==typeof t.overlays.getArray,49),o=t.overlays):o=new Q;return{controls:s,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}(t);this.Bn,this.qn=!0,this.Xn=this.handleBrowserEvent.bind(this),this.Yn=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.Lt=void 0!==t.pixelRatio?t.pixelRatio:bt,this.Zn,this.Vn,this.Wn=this.Wn.bind(this),this.Hn=[1,0,0,1,0,0],this.Kn=[1,0,0,1,0,0],this.Jn=0,this.Qn=null,this.ts=null,this.es=null,this.ns=null,this.ss=null,this.rs=document.createElement("div"),this.rs.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.rs.style.position="relative",this.rs.style.overflow="hidden",this.rs.style.width="100%",this.rs.style.height="100%",this.os=document.createElement("div"),this.os.style.position="absolute",this.os.style.zIndex="0",this.os.style.width="100%",this.os.style.height="100%",this.os.style.pointerEvents="none",this.os.className="ol-overlaycontainer",this.rs.appendChild(this.os),this.hs=document.createElement("div"),this.hs.style.position="absolute",this.hs.style.zIndex="0",this.hs.style.width="100%",this.hs.style.height="100%",this.hs.style.pointerEvents="none",this.hs.className="ol-overlaycontainer-stopevent",this.rs.appendChild(this.hs),this.us=null,this.Ae=t.moveTolerance,this.ls=e.keyboardEventTarget,this.cs=null,this.controls=e.controls||ch(),this.interactions=e.interactions||Jh({onFocusOnly:!0}),this.fs=e.overlays,this.ds={},this.he=null,this.ps=[],this.vs=new zo(this.getTilePriority.bind(this),this.gs.bind(this)),this.addChangeListener(Ao,this.ys),this.addChangeListener(Lo,this.ws),this.addChangeListener(ko,this.xs),this.addChangeListener(Ro,this.bs),this.setProperties(e.values);const i=this;!t.view||t.view instanceof oh||t.view.then((function(t){i.setView(new oh(t))})),this.controls.addEventListener(W,function(t){t.element.setMap(this)}.bind(this)),this.controls.addEventListener(H,function(t){t.element.setMap(null)}.bind(this)),this.interactions.addEventListener(W,function(t){t.element.setMap(this)}.bind(this)),this.interactions.addEventListener(H,function(t){t.element.setMap(null)}.bind(this)),this.fs.addEventListener(W,function(t){this.Ms(t.element)}.bind(this)),this.fs.addEventListener(H,function(t){const e=t.element.getId();void 0!==e&&delete this.ds[e.toString()],t.element.setMap(null)}.bind(this)),this.controls.forEach(function(t){t.setMap(this)}.bind(this)),this.interactions.forEach(function(t){t.setMap(this)}.bind(this)),this.fs.forEach(this.Ms.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){this.getLayerGroup().getLayers().push(t)}Ss(t){sa(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}Ms(t){const e=t.getId();void 0!==e&&(this.ds[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.fs.clear(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.Qn||!this.he)return;const n=this.getCoordinateFromPixelInternal(t),s=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:w,o=!1!==i.checkWrapped;return this.he.forEachFeatureAtCoordinate(n,this.Qn,s,o,e,null,r,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 go?e(i.getLayers()):t.push(i)}))}(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.Qn||!this.he)return!1;const i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:w,s=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.he.hasFeatureAtCoordinate(i,this.Qn,s,r,n,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.rs.getBoundingClientRect(),i="changedTouches"in t?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]}getTarget(){return this.get(Ro)}getTargetElement(){const t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null}getCoordinateFromPixel(t){return un(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())}getCoordinateFromPixelInternal(t){const e=this.Qn;return e?At(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.fs}getOverlayById(t){const e=this.ds[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ao)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Q)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<i;++e){const i=t[e];if(!i.visible)continue;const n=i.layer.getRenderer();if(n&&!n.ready)return!0;const s=i.layer.getSource();if(s&&s.loading)return!0}return!1}getPixelFromCoordinate(t){const e=ln(t,this.getView().getProjection());return this.getPixelFromCoordinateInternal(e)}getPixelFromCoordinateInternal(t){const e=this.Qn;return e?At(e.coordinateToPixelTransform,t.slice(0,2)):null}getRenderer(){return this.he}getSize(){return this.get(ko)}getView(){return this.get(Lo)}getViewport(){return this.rs}getOverlayContainer(){return this.os}getOverlayContainerStopEvent(){return this.hs}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,n){return Go(this.Qn,t,e,i,n)}handleBrowserEvent(t,e){e=e||t.type;const i=new wo(e,this,t);this.handleMapBrowserEvent(i)}handleMapBrowserEvent(t){if(!this.Qn)return;const e=t.originalEvent,i=e.type;if(i===Mo||i===D||i===N){const t=this.getOwnerDocument(),i=this.rs.getRootNode?this.rs.getRootNode():t,n=e.target;if(this.hs.contains(n)||!(i===t?t.documentElement:i).contains(n))return}if(t.frameState=this.Qn,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=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.Qn,e=this.vs;if(!e.isEmpty()){let i=this.Yn,n=i;if(t){const e=t.viewHints;if(e[jo]||e[Do]){const e=Date.now()-t.time>8;i=e?0:8,n=e?0:2}}e.getTilesLoading()<i&&(e.reprioritize(),e.loadMoreTiles(i,n))}t&&this.he&&!t.animate&&(!0===this.Bn?(this.hasListener(Ir)&&this.he.dispatchRenderEvent(Ir,t),!1===this.qn&&(this.qn=!0,this.dispatchEvent(new yo(Io,this,t)))):!0===this.qn&&(this.qn=!1,this.dispatchEvent(new yo(Fo,this,t))));const i=this.ps;for(let e=0,n=i.length;e<n;++e)i[e](this,t);i.length=0}xs(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}bs(){if(this.us){for(let t=0,e=this.cs.length;t<e;++t)B(this.cs[t]);this.cs=null,this.rs.removeEventListener(F,this.Xn),this.rs.removeEventListener(D,this.Xn),this.us.dispose(),this.us=null,Ks(this.rs)}const t=this.getTargetElement();if(t){t.appendChild(this.rs),this.he||(this.he=new fo(this)),this.us=new _o(this,this.Ae);for(const t in xo)this.us.addEventListener(xo[t],this.handleMapBrowserEvent.bind(this));this.rs.addEventListener(F,this.Xn,!1),this.rs.addEventListener(D,this.Xn,!!Pt&&{passive:!1});const e=this.getOwnerDocument().defaultView,i=this.ls?this.ls:t;this.cs=[U(i,N,this.handleBrowserEvent,this),U(i,O,this.handleBrowserEvent,this),U(e,G,this.updateSize,this)]}else this.he&&(clearTimeout(this.Zn),this.Zn=void 0,this.ps.length=0,this.he.dispose(),this.he=null),this.Vn&&(cancelAnimationFrame(this.Vn),this.Vn=void 0);this.updateSize()}gs(){this.render()}Ps(){this.render()}ws(){this.es&&(B(this.es),this.es=null),this.ns&&(B(this.ns),this.ns=null);const t=this.getView();t&&(this._s(),this.es=U(t,l,this.Ps,this),this.ns=U(t,T,this.Ps,this),t.resolveConstraints(0)),this.render()}ys(){this.ss&&(this.ss.forEach(B),this.ss=null);const t=this.getLayerGroup();t&&(this.Ss(new po("addlayer",t)),this.ss=[U(t,l,this.render,this),U(t,T,this.render,this),U(t,"addlayer",this.Ss,this),U(t,"removelayer",this.Es,this)]),this.render()}isRendered(){return!!this.Qn}Wn(){this.Vn=void 0,this.Ts(Date.now())}renderSync(){this.Vn&&cancelAnimationFrame(this.Vn),this.Wn()}redrawText(){const t=this.getLayerGroup().getLayerStatesArray();for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.he&&void 0===this.Vn&&(this.Vn=requestAnimationFrame(this.Wn))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){return this.getLayerGroup().getLayers().remove(t)}Es(t){na(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}Ts(t){const e=this.getSize(),n=this.getView(),s=this.Qn;let r=null;if(void 0!==e&&ta(e)&&n&&n.isDef()){const s=n.getHints(this.Qn?this.Qn.viewHints:void 0),o=n.getState();if(r={animate:!1,coordinateToPixelTransform:this.Hn,declutterTree:null,extent:xe(o.center,o.resolution,o.rotation,e),index:this.Jn++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.Lt,pixelToCoordinateTransform:this.Kn,postRenderFunctions:[],size:e,tileQueue:this.vs,time:t,usedTiles:{},viewState:o,viewHints:s,wantedTiles:{},mapId:i(this),renderTargets:{}},o.nextCenter&&o.nextResolution){const t=isNaN(o.nextRotation)?o.rotation:o.nextRotation;r.nextExtent=xe(o.nextCenter,o.nextResolution,t,e)}}if(this.Qn=r,this.he.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.ps,r.postRenderFunctions),s){(!this.ts||!Ce(this.ts)&&!oe(r.extent,this.ts))&&(this.dispatchEvent(new yo(To,this,s)),this.ts=ne(this.ts))}this.ts&&!r.viewHints[jo]&&!r.viewHints[Do]&&!oe(r.extent,this.ts)&&(this.dispatchEvent(new yo(Co,this,r)),Wt(r.extent,this.ts))}this.dispatchEvent(new yo(Eo,this,r)),this.Bn=this.hasListener(Fo)||this.hasListener(Io)||this.hasListener(Ir)?!this.vs.getTilesLoading()&&!this.vs.getCount()&&!this.getLoadingOrNotReady():void 0,this.Zn||(this.Zn=setTimeout((()=>{this.Zn=void 0,this.handlePostRender()}),0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.Es(new po("removelayer",e)),this.set(Ao,t)}setSize(t){this.set(ko,t)}setTarget(t){this.set(Ro,t)}setView(t){if(!t||t instanceof oh)return void this.set(Lo,t);this.set(Lo,new oh);const e=this;t.then((function(t){e.setView(new oh(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),s=t.offsetHeight-parseFloat(i.borderTopWidth)-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom)-parseFloat(i.borderBottomWidth);isNaN(n)||isNaN(s)||(e=[n,s],!ta(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&console.warn("No map visible because the map container's width or height are 0."))}this.setSize(e),this._s()}_s(){const t=this.getView();if(t){let e;const i=getComputedStyle(this.rs);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}}};const oa="element",ha="map",aa="offset",ua="position",la="positioning";var ca=class extends V{constructor(t){super(),this.on,this.once,this.un,this.options=t,this.id=t.id,this.insertFirst=void 0===t.insertFirst||t.insertFirst,this.stopEvent=void 0===t.stopEvent||t.stopEvent,this.element=document.createElement("div"),this.element.className=void 0!==t.className?t.className:"ol-overlay-container ol-selectable",this.element.style.position="absolute",this.element.style.pointerEvents="auto",this.autoPan=!0===t.autoPan?{}:t.autoPan||void 0,this.rendered={Tt:"",visible:!0},this.mapPostrenderListenerKey=null,this.addChangeListener(oa,this.handleElementChanged),this.addChangeListener(ha,this.handleMapChanged),this.addChangeListener(aa,this.handleOffsetChanged),this.addChangeListener(ua,this.handlePositionChanged),this.addChangeListener(la,this.handlePositioningChanged),void 0!==t.element&&this.setElement(t.element),this.setOffset(void 0!==t.offset?t.offset:[0,0]),this.setPositioning(t.positioning||"top-left"),void 0!==t.position&&this.setPosition(t.position)}getElement(){return this.get(oa)}getId(){return this.id}getMap(){return this.get(ha)||null}getOffset(){return this.get(aa)}getPosition(){return this.get(ua)}getPositioning(){return this.get(la)}handleElementChanged(){Js(this.element);const t=this.getElement();t&&this.element.appendChild(t)}handleMapChanged(){this.mapPostrenderListenerKey&&(Ks(this.element),B(this.mapPostrenderListenerKey),this.mapPostrenderListenerKey=null);const t=this.getMap();if(t){this.mapPostrenderListenerKey=U(t,Eo,this.render,this),this.updatePixelPosition();const e=this.stopEvent?t.getOverlayContainerStopEvent():t.getOverlayContainer();this.insertFirst?e.insertBefore(this.element,e.childNodes[0]||null):e.appendChild(this.element),this.performAutoPan()}}render(){this.updatePixelPosition()}handleOffsetChanged(){this.updatePixelPosition()}handlePositionChanged(){this.updatePixelPosition(),this.performAutoPan()}handlePositioningChanged(){this.updatePixelPosition()}setElement(t){this.set(oa,t)}setMap(t){this.set(ha,t)}setOffset(t){this.set(aa,t)}setPosition(t){this.set(ua,t)}performAutoPan(){this.autoPan&&this.panIntoView(this.autoPan)}panIntoView(t){const e=this.getMap();if(!e||!e.getTargetElement()||!this.get(ua))return;const i=this.getRect(e.getTargetElement(),e.getSize()),n=this.getElement(),s=this.getRect(n,[Vs(n),Ws(n)]),r=void 0===(t=t||{}).margin?20:t.margin;if(!Jt(i,s)){const n=s[0]-i[0],o=i[2]-s[2],h=s[1]-i[1],a=i[3]-s[3],u=[0,0];if(n<0?u[0]=n-r:o<0&&(u[0]=Math.abs(o)+r),h<0?u[1]=h-r:a<0&&(u[1]=Math.abs(a)+r),0!==u[0]||0!==u[1]){const i=e.getView().getCenterInternal(),n=e.getPixelFromCoordinateInternal(i);if(!n)return;const s=[n[0]+u[0],n[1]+u[1]],r=t.animation||{};e.getView().animateInternal({center:e.getCoordinateFromPixelInternal(s),duration:r.duration,easing:r.easing})}}}getRect(t,e){const i=t.getBoundingClientRect(),n=i.left+window.pageXOffset,s=i.top+window.pageYOffset;return[n,s,n+e[0],s+e[1]]}setPositioning(t){this.set(la,t)}setVisible(t){this.rendered.visible!==t&&(this.element.style.display=t?"":"none",this.rendered.visible=t)}updatePixelPosition(){const t=this.getMap(),e=this.getPosition();if(!t||!t.isRendered()||!e)return void this.setVisible(!1);const i=t.getPixelFromCoordinate(e),n=t.getSize();this.updateRenderedPosition(i,n)}updateRenderedPosition(t,e){const i=this.element.style,n=this.getOffset(),s=this.getPositioning();this.setVisible(!0);let r="0%",o="0%";"bottom-right"==s||"center-right"==s||"top-right"==s?r="-100%":"bottom-center"!=s&&"center-center"!=s&&"top-center"!=s||(r="-50%"),"bottom-left"==s||"bottom-center"==s||"bottom-right"==s?o="-100%":"center-left"!=s&&"center-center"!=s&&"center-right"!=s||(o="-50%");const h=`translate(${r}, ${o}) translate(${Math.round(t[0]+n[0])+"px"}, ${Math.round(t[1]+n[1])+"px"})`;this.rendered.Tt!=h&&(this.rendered.Tt=h,i.transform=h)}getOptions(){return this.options}};var fa=class{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.Cs=0,this.Fs={},this.Is=null,this.As=null}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.pop()}clear(){this.Cs=0,this.Fs={},this.Is=null,this.As=null}containsKey(t){return this.Fs.hasOwnProperty(t)}forEach(t){let e=this.Is;for(;e;)t(e.ks,e.Rs,this),e=e.newer}get(t,e){const i=this.Fs[t];return ct(void 0!==i,15),i===this.As||(i===this.Is?(this.Is=this.Is.newer,this.Is.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.As,this.As.newer=i,this.As=i),i.ks}remove(t){const e=this.Fs[t];return ct(void 0!==e,15),e===this.As?(this.As=e.older,this.As&&(this.As.newer=null)):e===this.Is?(this.Is=e.newer,this.Is&&(this.Is.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.Fs[t],--this.Cs,e.ks}getCount(){return this.Cs}getKeys(){const t=new Array(this.Cs);let e,i=0;for(e=this.As;e;e=e.older)t[i++]=e.Rs;return t}getValues(){const t=new Array(this.Cs);let e,i=0;for(e=this.As;e;e=e.older)t[i++]=e.ks;return t}peekLast(){return this.Is.ks}peekLastKey(){return this.Is.Rs}peekFirstKey(){return this.As.Rs}peek(t){if(this.containsKey(t))return this.Fs[t].ks}pop(){const t=this.Is;return delete this.Fs[t.Rs],t.newer&&(t.newer.older=null),this.Is=t.newer,this.Is||(this.As=null),--this.Cs,t.ks}replace(t,e){this.get(t),this.Fs[t].ks=e}set(t,e){ct(!(t in this.Fs),16);const i={Rs:t,newer:null,older:this.As,ks:e};this.As?this.As.newer=i:this.Is=i,this.As=i,this.Fs[t]=i,++this.Cs}setSize(t){this.highWaterMark=t}};function da(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function pa(t,e,i){return t+"/"+e+"/"+i}function ma(t){return pa(t[0],t[1],t[2])}function va(t){const[e,i,n]=t.substring(t.lastIndexOf("/")+1,t.length).split(",").map(Number);return pa(e,i,n)}function ga(t){return t.split("/").map(Number)}function ya(t){return(t[1]<<t[0])+t[2]}function wa(t,e){const i=t[0],n=t[1],s=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(n,s)}var xa=class extends fa{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=ga(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(ma(e.tileCoord)),e.release())}.bind(this))}};class ba{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.minX<this.minX&&(this.minX=t.minX),t.maxX>this.maxX&&(this.maxX=t.maxX),t.minY<this.minY&&(this.minY=t.minY),t.maxY>this.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 Ma(t,e,i,n,s){return void 0!==s?(s.minX=t,s.maxX=e,s.minY=i,s.maxY=n,s):new ba(t,e,i,n)}var Sa=ba;const Pa=[];var _a=class extends ut{constructor(t,e,i,n){super(t,e,{transition:0}),this.Ls={},this.executorGroups={},this.declutterExecutorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.Ns={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=n.bind(void 0,this),this.wrappedTileCoord=i}getContext(t){const e=i(t);return e in this.Ls||(this.Ls[e]=Ys(1,1,Pa)),this.Ls[e]}hasContext(t){return i(t)in this.Ls}getImage(t){return this.hasContext(t)?this.getContext(t).canvas:null}getReplayState(t){const e=i(t);return e in this.Ns||(this.Ns[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.Ns[e]}load(){this.getSourceTiles()}release(){for(const t in this.Ls){const e=this.Ls[t];Zs(e),Pa.push(e.canvas),delete this.Ls[t]}super.release()}};var Ea=class extends ut{constructor(t,e,i,n,s,r){super(t,e,r),this.extent=null,this.Os=n,this.zs=null,this.$,this.projection=null,this.resolution,this.Xt=s,this.Gs=i,this.key=i}getFormat(){return this.Os}getFeatures(){return this.zs}load(){this.state==tt&&(this.setState(et),this.Xt(this,this.Gs),this.$&&this.$(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(nt)}setFeatures(t){this.zs=t,this.setState(it)}setLoader(t){this.$=t}};function Ta(t){return Array.isArray(t)?ur(t):t}let Ca,Fa=!1;function Ia(t,e,i,n,s,r,o){const h=new XMLHttpRequest;h.open("GET","function"==typeof t?t(i,n,s):t,!0),"arraybuffer"==e.getType()&&(h.responseType="arraybuffer"),h.withCredentials=Fa,h.onload=function(t){if(!h.status||h.status>=200&&h.status<300){const t=e.getType();let n;"json"==t||"text"==t?n=h.responseText:"xml"==t?(n=h.responseXML,n||(n=(new DOMParser).parseFromString(h.responseText,"application/xml"))):"arraybuffer"==t&&(n=h.response),n?r(e.readFeatures(n,{extent:i,featureProjection:s}),e.readProjection(n)):o()}else o()},h.onerror=o,h.send()}function Aa(t,e){return function(i,n,s,r,o){const h=this;Ia(t,e,i,n,s,(function(t,e){h.addFeatures(t),void 0!==r&&r(t)}),o||b)}}function ka(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Ra(t,e,n,s){const r=document.createElement("script"),o="olc_"+i(e);function h(){delete window[o],r.parentNode.removeChild(r)}r.async=!0,r.src=t+(t.includes("?")?"&":"?")+(s||"callback")+"="+o;const a=setTimeout((function(){h(),n&&n()}),1e4);window[o]=function(t){clearTimeout(a),h(),e(t)},document.head.appendChild(r)}class La extends Error{constructor(t){super("Unexpected response status: "+t.status),this.name="ResponseError",this.response=t}}class Na extends Error{constructor(t){super("Failed to issue request"),this.name="ClientError",this.client=t}}function Oa(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 La(n))})),n.addEventListener("error",(function(t){i(new Na(t.target))})),n.open("GET",t),n.setRequestHeader("Accept","application/json"),n.send()}))}function za(t,e){return e.includes("://")?e:new URL(e,t).href}var Ga=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){}};var ja=class extends Ga{constructor(t,e,i,n,s,r,o){super(),this.Ls=t,this.Lt=e,this.ot=i,this.Tt=n,this.js=s,this.Ds=r,this.Us=o,this.$s=null,this.Bs=null,this.qs=null,this.Xs=null,this.Ys=null,this.Ot=null,this.Zs=0,this.Vs=0,this.Ws=0,this.Hs=0,this.Ks=0,this.Js=0,this.Qs=!1,this.tr=0,this.er=[0,0],this.ir=0,this.nr="",this.sr=0,this.rr=0,this.hr=!1,this.ar=0,this.ur=[0,0],this.lr=null,this.cr=null,this.dr=null,this.pr=[],this.mr=[1,0,0,1,0,0]}vr(t,e,i,n){if(!this.Ot)return;const s=gn(t,e,i,n,this.Tt,this.pr),r=this.Ls,o=this.mr,h=r.globalAlpha;1!=this.Hs&&(r.globalAlpha=h*this.Hs);let a=this.tr;this.Qs&&(a+=this.js);for(let t=0,e=s.length;t<e;t+=2){const e=s[t]-this.Zs,i=s[t+1]-this.Vs;if(0!==a||1!=this.er[0]||1!=this.er[1]){const t=e+this.Zs,n=i+this.Vs;Ot(o,t,n,1,1,a,-t,-n),r.setTransform.apply(r,o),r.translate(t,n),r.scale(this.er[0],this.er[1]),r.drawImage(this.Ot,this.Ks,this.Js,this.ir,this.Ws,-this.Zs,-this.Vs,this.ir,this.Ws),r.setTransform(1,0,0,1,0,0)}else r.drawImage(this.Ot,this.Ks,this.Js,this.ir,this.Ws,e,i,this.ir,this.Ws)}1!=this.Hs&&(r.globalAlpha=h)}gr(t,e,i,n){if(!this.dr||""===this.nr)return;this.lr&&this.yr(this.lr),this.cr&&this.wr(this.cr),this.br(this.dr);const s=gn(t,e,i,n,this.Tt,this.pr),r=this.Ls;let o=this.ar;for(this.hr&&(o+=this.js);e<i;e+=n){const t=s[e]+this.sr,i=s[e+1]+this.rr;0!==o||1!=this.ur[0]||1!=this.ur[1]?(r.translate(t-this.sr,i-this.rr),r.rotate(o),r.translate(this.sr,this.rr),r.scale(this.ur[0],this.ur[1]),this.cr&&r.strokeText(this.nr,0,0),this.lr&&r.fillText(this.nr,0,0),r.setTransform(1,0,0,1,0,0)):(this.cr&&r.strokeText(this.nr,t,i),this.lr&&r.fillText(this.nr,t,i))}}Mr(t,e,i,n,s){const r=this.Ls,o=gn(t,e,i,n,this.Tt,this.pr);r.moveTo(o[0],o[1]);let h=o.length;s&&(h-=2);for(let t=2;t<h;t+=2)r.lineTo(o[t],o[t+1]);return s&&r.closePath(),i}Sr(t,e,i,n){for(let s=0,r=i.length;s<r;++s)e=this.Mr(t,e,i[s],n,!0);return e}drawCircle(t){if(Te(this.ot,t.getExtent())){if(this.Xs||this.Ys){this.Xs&&this.yr(this.Xs),this.Ys&&this.wr(this.Ys);const e=Pn(t,this.Tt,this.pr),i=e[2]-e[0],n=e[3]-e[1],s=Math.sqrt(i*i+n*n),r=this.Ls;r.beginPath(),r.arc(e[0],e[1],s,0,2*Math.PI),this.Xs&&r.fill(),this.Ys&&r.stroke()}""!==this.nr&&this.gr(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.Tt=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&Te(this.ot,i.getExtent())&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us));const e=t.getFlatCoordinates(),i=t.getStride();this.Ot&&this.vr(e,0,e.length,i),""!==this.nr&&this.gr(e,0,e.length,i)}drawMultiPoint(t){this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us));const e=t.getFlatCoordinates(),i=t.getStride();this.Ot&&this.vr(e,0,e.length,i),""!==this.nr&&this.gr(e,0,e.length,i)}drawLineString(t){if(this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us)),Te(this.ot,t.getExtent())){if(this.Ys){this.wr(this.Ys);const e=this.Ls,i=t.getFlatCoordinates();e.beginPath(),this.Mr(i,0,i.length,t.getStride(),!1),e.stroke()}if(""!==this.nr){const e=t.getFlatMidpoint();this.gr(e,0,2,2)}}}drawMultiLineString(t){this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us));const e=t.getExtent();if(Te(this.ot,e)){if(this.Ys){this.wr(this.Ys);const e=this.Ls,i=t.getFlatCoordinates();let n=0;const s=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t)n=this.Mr(i,n,s[t],r,!1);e.stroke()}if(""!==this.nr){const e=t.getFlatMidpoints();this.gr(e,0,e.length,2)}}}drawPolygon(t){if(this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us)),Te(this.ot,t.getExtent())){if(this.Ys||this.Xs){this.Xs&&this.yr(this.Xs),this.Ys&&this.wr(this.Ys);const e=this.Ls;e.beginPath(),this.Sr(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride()),this.Xs&&e.fill(),this.Ys&&e.stroke()}if(""!==this.nr){const e=t.getFlatInteriorPoint();this.gr(e,0,2,2)}}}drawMultiPolygon(t){if(this.Ds&&(t=t.simplifyTransformed(this.Ds,this.Us)),Te(this.ot,t.getExtent())){if(this.Ys||this.Xs){this.Xs&&this.yr(this.Xs),this.Ys&&this.wr(this.Ys);const e=this.Ls,i=t.getOrientedFlatCoordinates();let n=0;const s=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,e=s.length;t<e;++t){const e=s[t];n=this.Sr(i,n,e,r)}this.Xs&&e.fill(),this.Ys&&e.stroke()}if(""!==this.nr){const e=t.getFlatInteriorPoints();this.gr(e,0,e.length,2)}}}yr(t){const e=this.Ls,i=this.$s;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.$s={fillStyle:t.fillStyle})}wr(t){const e=this.Ls,i=this.Bs;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),g(i.lineDash,t.lineDash)||e.setLineDash(i.lineDash=t.lineDash),i.lineDashOffset!=t.lineDashOffset&&(i.lineDashOffset=t.lineDashOffset,e.lineDashOffset=t.lineDashOffset),i.lineJoin!=t.lineJoin&&(i.lineJoin=t.lineJoin,e.lineJoin=t.lineJoin),i.lineWidth!=t.lineWidth&&(i.lineWidth=t.lineWidth,e.lineWidth=t.lineWidth),i.miterLimit!=t.miterLimit&&(i.miterLimit=t.miterLimit,e.miterLimit=t.miterLimit),i.strokeStyle!=t.strokeStyle&&(i.strokeStyle=t.strokeStyle,e.strokeStyle=t.strokeStyle)):(e.lineCap=t.lineCap,e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset,e.lineJoin=t.lineJoin,e.lineWidth=t.lineWidth,e.miterLimit=t.miterLimit,e.strokeStyle=t.strokeStyle,this.Bs={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}br(t){const e=this.Ls,i=this.qs,n=t.textAlign?t.textAlign:Jr;i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=n&&(i.textAlign=n,e.textAlign=n),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=n,e.textBaseline=t.textBaseline,this.qs={font:t.font,textAlign:n,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.Xs={fillStyle:Ta(e||Yr)}}else this.Xs=null;if(e){const t=e.getColor(),i=e.getLineCap(),n=e.getLineDash(),s=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),h=e.getMiterLimit(),a=n||Vr;this.Ys={lineCap:void 0!==i?i:Zr,lineDash:1===this.Lt?a:a.map((t=>t*this.Lt)),lineDashOffset:(s||0)*this.Lt,lineJoin:void 0!==r?r:Wr,lineWidth:(void 0!==o?o:1)*this.Lt,miterLimit:void 0!==h?h:Hr,strokeStyle:Ta(t||Kr)}}else this.Ys=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.Ot=null);const i=t.getPixelRatio(this.Lt),n=t.getAnchor(),s=t.getOrigin();this.Ot=t.getImage(this.Lt),this.Zs=n[0]*i,this.Vs=n[1]*i,this.Ws=e[1]*i,this.Hs=t.getOpacity(),this.Ks=s[0],this.Js=s[1],this.Qs=t.getRotateWithView(),this.tr=t.getRotation();const r=t.getScaleArray();this.er=[r[0]*this.Lt/i,r[1]*this.Lt/i],this.ir=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.lr={fillStyle:Ta(t||Yr)}}else this.lr=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),n=i.getLineDash(),s=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),h=i.getMiterLimit();this.cr={lineCap:void 0!==e?e:Zr,lineDash:n||Vr,lineDashOffset:s||0,lineJoin:void 0!==r?r:Wr,lineWidth:void 0!==o?o:1,miterLimit:void 0!==h?h:Hr,strokeStyle:Ta(t||Kr)}}else this.cr=null;const n=t.getFont(),s=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),h=t.getRotation(),a=t.getScaleArray(),u=t.getText(),l=t.getTextAlign(),c=t.getTextBaseline();this.dr={font:void 0!==n?n:Xr,textAlign:void 0!==l?l:Jr,textBaseline:void 0!==c?c:Qr},this.nr=void 0!==u?Array.isArray(u)?u.reduce(((t,e,i)=>t+(i%2?" ":e)),""):u:"",this.sr=void 0!==s?this.Lt*s:0,this.rr=void 0!==r?this.Lt*r:0,this.hr=void 0!==o&&o,this.ar=void 0!==h?h:0,this.ur=[this.Lt*a[0],this.Lt*a[1]]}else this.nr=""}};const Da={Point:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let h;if(r){if(r.getImageState()!=Ds)return;let a=t;if(s){const u=r.getDeclutterMode();if("none"!==u)if(a=s,"obstacle"===u){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,h),s.drawPoint(e,n)}else o&&o.getText()&&(h={})}const u=a.getBuilder(i.getZIndex(),"Image");u.setImageStyle(r,h),u.drawPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const a=r.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o,h),a.drawText(e,n)}},LineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},Polygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawPolygon(e,n)}const h=i.getText();if(h&&h.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(h),r.drawText(e,n)}},MultiPoint:function(t,e,i,n,s){const r=i.getImage(),o=i.getText();let h;if(r){if(r.getImageState()!=Ds)return;let a=t;if(s){const u=r.getDeclutterMode();if("none"!==u)if(a=s,"obstacle"===u){const s=t.getBuilder(i.getZIndex(),"Image");s.setImageStyle(r,h),s.drawMultiPoint(e,n)}else o&&o.getText()&&(h={})}const u=a.getBuilder(i.getZIndex(),"Image");u.setImageStyle(r,h),u.drawMultiPoint(e,n)}if(o&&o.getText()){let r=t;s&&(r=s);const a=r.getBuilder(i.getZIndex(),"Text");a.setTextStyle(o,h),a.drawText(e,n)}},MultiLineString:function(t,e,i,n,s){const r=i.getStroke();if(r){const s=t.getBuilder(i.getZIndex(),"LineString");s.setFillStrokeStyle(null,r),s.drawMultiLineString(e,n)}const o=i.getText();if(o&&o.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,n)}},MultiPolygon:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(o||r){const s=t.getBuilder(i.getZIndex(),"Polygon");s.setFillStrokeStyle(r,o),s.drawMultiPolygon(e,n)}const h=i.getText();if(h&&h.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(h),r.drawText(e,n)}},GeometryCollection:function(t,e,i,n,s){const r=e.getGeometriesArray();let o,h;for(o=0,h=r.length;o<h;++o){(0,Da[r[o].getType()])(t,r[o],i,n,s)}},Circle:function(t,e,i,n,s){const r=i.getFill(),o=i.getStroke();if(r||o){const s=t.getBuilder(i.getZIndex(),"Circle");s.setFillStrokeStyle(r,o),s.drawCircle(e,n)}const h=i.getText();if(h&&h.getText()){const r=(s||t).getBuilder(i.getZIndex(),"Text");r.setTextStyle(h),r.drawText(e,n)}}};function Ua(t,e){return parseInt(i(t),10)-parseInt(i(e),10)}function $a(t,e){const i=Ba(t,e);return i*i}function Ba(t,e){return.5*t/e}function qa(t,e,i,n,s,r,o){let h=!1;const a=i.getImage();if(a){const t=a.getImageState();t==Ds||t==Us?a.unlistenImageChange(s):(t==Gs&&a.load(),a.listenImageChange(s),h=!0)}return function(t,e,i,n,s,r){const o=i.getGeometryFunction()(e);if(!o)return;const h=o.simplifyTransformed(n,s);if(i.getRenderer())Xa(t,h,i,e);else{(0,Da[h.getType()])(t,h,i,e,r)}}(t,e,i,n,r,o),h}function Xa(t,e,i,n){if("GeometryCollection"==e.getType()){const s=e.getGeometries();for(let e=0,r=s.length;e<r;++e)Xa(t,s[e],i,n);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,n,i.getRenderer(),i.getHitDetectionRenderer())}function Ya(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.frameState,n=Ct(t.inversePixelTransform.slice(),i.coordinateToPixelTransform),s=$a(i.viewState.resolution,e);let r;const o=an();return o&&(r=en(o,i.viewState.projection)),new ja(t.context,e,i.extent,n,i.viewState.rotation,s,r)}let Za;const Va=[];function Wa(t,e,i,n,s){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,s),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,s)),t.restore()}function Ha(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Ka(t,e,i,n){const s=sn(i,e,t);let r=Zi(e,n,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const h=t.getMetersPerUnit();void 0!==h&&(r/=h);const a=t.getExtent();if(!a||Kt(a,s)){const e=Zi(t,r,s)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Ja(t,e,i,n){const s=ye(i);let r=Ka(t,e,s,n);return(!isFinite(r)||r<=0)&&pe(i,(function(i){return r=Ka(t,e,i,n),isFinite(r)&&r>0})),r}function Qa(t,e,i,n,s,r,o,h,a,u,l,c){const f=Ys(Math.round(i*t),Math.round(i*e),Va);if(c||(f.imageSmoothingEnabled=!1),0===a.length)return f.canvas;function d(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];a.forEach((function(t,e,i){ae(p,t.extent)}));const m=Ee(p),v=Me(p),g=Ys(Math.round(i*m/n),Math.round(i*v/n));c||(g.imageSmoothingEnabled=!1);const y=i/n;a.forEach((function(t,e,i){const n=t.extent[0]-p[0],s=-(t.extent[3]-p[3]),r=Ee(t.extent),o=Me(t.extent);t.image.width>0&&t.image.height>0&&g.drawImage(t.image,u,u,t.image.width-2*u,t.image.height-2*u,n*y,s*y,r*y,o*y)}));const w=Pe(o);return h.getTriangles().forEach((function(t,e,s){const o=t.source,h=t.target;let a=o[0][0],u=o[0][1],l=o[1][0],m=o[1][1],v=o[2][0],y=o[2][1];const x=d((h[0][0]-w[0])/r),b=d(-(h[0][1]-w[1])/r),M=d((h[1][0]-w[0])/r),S=d(-(h[1][1]-w[1])/r),P=d((h[2][0]-w[0])/r),_=d(-(h[2][1]-w[1])/r),E=a,T=u;a=0,u=0,l-=E,m-=T,v-=E,y-=T;const C=li([[l,m,0,0,M-x],[v,y,0,0,P-x],[0,0,l,m,S-b],[0,0,v,y,_-b]]);if(C){if(f.save(),f.beginPath(),function(){if(void 0===Za){const t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Wa(t,4,5,4,0),Wa(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;Za=Ha(e,0)||Ha(e,4)||Ha(e,8)}return Za}()||!c){f.moveTo(M,S);const t=4,e=x-M,i=b-S;for(let n=0;n<t;n++)f.lineTo(M+d((n+1)*e/t),S+d(n*i/(t-1))),n!=t-1&&f.lineTo(M+d((n+1)*e/t),S+d((n+1)*i/(t-1)));f.lineTo(P,_)}else f.moveTo(M,S),f.lineTo(x,b),f.lineTo(P,_);f.clip(),f.transform(C[0],C[2],C[1],C[3],x,b),f.translate(p[0]-E,p[3]-T),f.scale(n/i,-n/i),f.drawImage(g.canvas,0,0),f.restore()}})),l&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,h.getTriangles().forEach((function(t,e,i){const n=t.target,s=(n[0][0]-w[0])/r,o=-(n[0][1]-w[1])/r,h=(n[1][0]-w[0])/r,a=-(n[1][1]-w[1])/r,u=(n[2][0]-w[0])/r,l=-(n[2][1]-w[1])/r;f.beginPath(),f.moveTo(h,a),f.lineTo(s,o),f.lineTo(u,l),f.closePath(),f.stroke()})),f.restore()),f.canvas}const tu=[0,0,0];var eu=class{constructor(t){let e;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.Ei=t.resolutions,ct(y(this.Ei,(function(t,e){return e-t}),!0),17),!t.origins)for(let t=0,i=this.Ei.length-1;t<i;++t)if(e){if(this.Ei[t]/this.Ei[t+1]!==e){e=void 0;break}}else e=this.Ei[t]/this.Ei[t+1];this._i=e,this.maxZoom=this.Ei.length-1,this.Pr=void 0!==t.origin?t.origin:null,this._r=null,void 0!==t.origins&&(this._r=t.origins,ct(this._r.length==this.Ei.length,20));const i=t.extent;void 0===i||this.Pr||this._r||(this.Pr=Pe(i)),ct(!this.Pr&&this._r||this.Pr&&!this._r,18),this.Er=null,void 0!==t.tileSizes&&(this.Er=t.tileSizes,ct(this.Er.length==this.Ei.length,19)),this.Tr=void 0!==t.tileSize?t.tileSize:this.Er?null:$o,ct(!this.Tr&&this.Er||this.Tr&&!this.Er,22),this.ot=void 0!==i?i:null,this.Cr=null,this.Fr=[0,0],this.Ir=[0,0,0,0],void 0!==t.sizes?this.Cr=t.sizes.map((function(t,e){const n=new Sa(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);n.minX=Math.max(t.minX,n.minX),n.maxX=Math.min(t.maxX,n.maxX),n.minY=Math.max(t.minY,n.minY),n.maxY=Math.min(t.maxY,n.maxY)}return n}),this):i&&this.Ar(i)}forEachTileCoord(t,e,i){const n=this.getTileRangeForExtentAndZ(t,e);for(let t=n.minX,s=n.maxX;t<=s;++t)for(let s=n.minY,r=n.maxY;s<=r;++s)i([e,t,s])}forEachTileCoordParentTileRange(t,e,i,n){let s,r,o,h=null,a=t[0]-1;for(2===this._i?(r=t[1],o=t[2]):h=this.getTileCoordExtent(t,n);a>=this.minZoom;){if(2===this._i?(r=Math.floor(r/2),o=Math.floor(o/2),s=Ma(r,r,o,o,i)):s=this.getTileRangeForExtentAndZ(h,a,i),e(a,s))return!0;--a}return!1}getExtent(){return this.ot}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.Pr?this.Pr:this._r[t]}getResolution(t){return this.Ei[t]}getResolutions(){return this.Ei}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this._i){const i=2*t[1],n=2*t[2];return Ma(i,i+1,n,n+1,e)}const n=this.getTileCoordExtent(t,i||this.Ir);return this.getTileRangeForExtentAndZ(n,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const n=t[0],s=t[1],r=t[2];if(e===n)return Ma(s,r,s,r,i);if(this._i){const t=Math.pow(this._i,e-n),o=Math.floor(s*t),h=Math.floor(r*t);if(e<n)return Ma(o,o,h,h,i);return Ma(o,Math.floor(t*(s+1))-1,h,Math.floor(t*(r+1))-1,i)}const o=this.getTileCoordExtent(t,this.Ir);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeExtent(t,e,i){const n=this.getOrigin(t),s=this.getResolution(t),r=ia(this.getTileSize(t),this.Fr),o=n[0]+e.minX*r[0]*s,h=n[0]+(e.maxX+1)*r[0]*s;return ie(o,n[1]+e.minY*r[1]*s,h,n[1]+(e.maxY+1)*r[1]*s,i)}getTileRangeForExtentAndZ(t,e,i){const n=tu;this.kr(t[0],t[3],e,!1,n);const s=n[1],r=n[2];return this.kr(t[2],t[1],e,!0,n),Ma(s,n[1],r,n[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),n=ia(this.getTileSize(t[0]),this.Fr);return[e[0]+(t[1]+.5)*n[0]*i,e[1]-(t[2]+.5)*n[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),n=this.getResolution(t[0]),s=ia(this.getTileSize(t[0]),this.Fr),r=i[0]+t[1]*s[0]*n,o=i[1]-(t[2]+1)*s[1]*n;return ie(r,o,r+s[0]*n,o+s[1]*n,e)}getTileCoordForCoordAndResolution(t,e,i){return this.Rr(t[0],t[1],e,!1,i)}Rr(t,e,i,n,s){const r=this.getZForResolution(i),o=i/this.getResolution(r),h=this.getOrigin(r),a=ia(this.getTileSize(r),this.Fr);let u=o*(t-h[0])/i/a[0],l=o*(h[1]-e)/i/a[1];return n?(u=yi(u,5)-1,l=yi(l,5)-1):(u=gi(u,5),l=gi(l,5)),da(r,u,l,s)}kr(t,e,i,n,s){const r=this.getOrigin(i),o=this.getResolution(i),h=ia(this.getTileSize(i),this.Fr);let a=(t-r[0])/o/h[0],u=(r[1]-e)/o/h[1];return n?(a=yi(a,5)-1,u=yi(u,5)-1):(a=gi(a,5),u=gi(u,5)),da(i,a,u,s)}getTileCoordForCoordAndZ(t,e,i){return this.kr(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.Ei[t[0]]}getTileSize(t){return this.Tr?this.Tr:this.Er[t]}getFullTileRange(t){return this.Cr?this.Cr[t]:this.ot?this.getTileRangeForExtentAndZ(this.ot,t):null}getZForResolution(t,e){return hi(p(this.Ei,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return us(e,0,e.length,2,this.getTileCoordExtent(t))}Ar(t){const e=this.Ei.length,i=new Array(e);for(let n=this.minZoom;n<e;++n)i[n]=this.getTileRangeForExtentAndZ(t,n);this.Cr=i}};function iu(t){let e=t.getDefaultTileGrid();return e||(e=hu(t),t.setDefaultTileGrid(e)),e}function nu(t,e,i){const n=e[0],s=t.getTileCoordCenter(e),r=au(i);if(Kt(r,s))return e;{const e=Ee(r),i=Math.ceil((r[0]-s[0])/e);return s[0]+=e*i,t.getTileCoordForCoordAndZ(s,n)}}function su(t,e,i,n){n=void 0!==n?n:"top-left";const s=ou(t,e,i);return new eu({extent:t,origin:we(t,n),resolutions:s,tileSize:i})}function ru(t){const e=t||{},i=e.extent||Yi("EPSG:3857").getExtent(),n={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:ou(i,e.maxZoom,e.tileSize,e.maxResolution)};return new eu(n)}function ou(t,e,i,n){e=void 0!==e?e:42,i=ia(void 0!==i?i:$o);const s=Me(t),r=Ee(t);n=n>0?n:Math.max(r/i[0],s/i[1]);const o=e+1,h=new Array(o);for(let t=0;t<o;++t)h[t]=n/Math.pow(2,t);return h}function hu(t,e,i,n){return su(au(t),e,i,n)}function au(t){let e=(t=Yi(t)).getExtent();if(!e){const i=180*ze.degrees/t.getMetersPerUnit();e=ie(-i,-i,i,i)}return e}function uu(t,e){const i=/\{z\}/g,n=/\{x\}/g,s=/\{y\}/g,r=/\{-y\}/g;return function(o,h,a){return o?t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(s,o[2].toString()).replace(r,(function(){const t=o[0],i=e.getFullTileRange(t);ct(i,55);return(i.getHeight()-o[2]-1).toString()})):void 0}}function lu(t,e){const i=t.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=uu(t[s],e);return cu(n)}function cu(t){return 1===t.length?t[0]:function(e,i,n){if(e){const s=di(ya(e),t.length);return t[s](e,i,n)}}}function fu(t,e,i){}function du(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const n=i[1].charCodeAt(0),s=i[2].charCodeAt(0);let r;for(r=n;r<=s;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const n=parseInt(i[2],10);for(let s=parseInt(i[1],10);s<=n;s++)e.push(t.replace(i[0],s.toString()));return e}return e.push(t),e}function pu(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}const mu=34962,vu=34963,gu=35044,yu=35048,wu=5126,xu=["experimental-webgl","webgl","webkit-3d","moz-webgl"];function bu(t,e){e=Object.assign({preserveDrawingBuffer:!0,antialias:!yt},e);const i=xu.length;for(let n=0;n<i;++n)try{const i=t.getContext(xu[n],e);if(i)return i}catch(t){}return null}let Mu;const Su="http://www.w3.org/2001/XMLSchema-instance";function Pu(t,e){return Vu().createElementNS(t,e)}function _u(t,e){return Eu(t,e,[]).join("")}function Eu(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)Eu(n,e,i)}return i}function Tu(t){return"documentElement"in t}function Cu(t,e,i){return t.getAttributeNS(e,i)||""}function Fu(t){return(new DOMParser).parseFromString(t,"application/xml")}function Iu(t,e){return function(i,n){const s=t.call(void 0!==e?e:this,i,n);if(void 0!==s){v(n[n.length-1],s)}}}function Au(t,e){return function(i,n){const s=t.call(void 0!==e?e:this,i,n);if(void 0!==s){n[n.length-1].push(s)}}}function ku(t,e){return function(i,n){const s=t.call(void 0!==e?e:this,i,n);void 0!==s&&(n[n.length-1]=s)}}function Ru(t,e,i){return function(n,s){const r=t.call(void 0!==i?i:this,n,s);if(void 0!==r){const t=s[s.length-1],i=void 0!==e?e:n.localName;let o;i in t?o=t[i]:(o=[],t[i]=o),o.push(r)}}}function Lu(t,e,i){return function(n,s){const r=t.call(void 0!==i?i:this,n,s);if(void 0!==r){s[s.length-1][void 0!==e?e:n.localName]=r}}}function Nu(t,e){return function(i,n,s){t.call(void 0!==e?e:this,i,n,s);s[s.length-1].node.appendChild(i)}}function Ou(t,e){let i,n;return function(e,s,r){if(void 0===i){i={};const s={};s[e.localName]=t,i[e.namespaceURI]=s,n=zu(e.localName)}Bu(i,n,s,r)}}function zu(t,e){return function(i,n,s){const r=n[n.length-1].node;let o=t;void 0===o&&(o=s);return Pu(void 0!==e?e:r.namespaceURI,o)}}const Gu=zu();function ju(t,e){const i=e.length,n=new Array(i);for(let s=0;s<i;++s)n[s]=t[e[s]];return n}function Du(t,e,i){let n,s;for(i=void 0!==i?i:{},n=0,s=t.length;n<s;++n)i[t[n]]=e;return i}function Uu(t,e,i,n){let s;for(s=e.firstElementChild;s;s=s.nextElementSibling){const e=t[s.namespaceURI];if(void 0!==e){const t=e[s.localName];void 0!==t&&t.call(n,s,i)}}}function $u(t,e,i,n,s){return n.push(t),Uu(e,i,n,s),n.pop()}function Bu(t,e,i,n,s,r){const o=(void 0!==s?s:i).length;let h,a;for(let u=0;u<o;++u)h=i[u],void 0!==h&&(a=e.call(void 0!==r?r:this,h,n,void 0!==s?s[u]:void 0),void 0!==a&&t[a.namespaceURI][a.localName].call(r,a,h,n))}function qu(t,e,i,n,s,r,o){return s.push(t),Bu(e,i,n,s,r,o),s.pop()}let Xu,Yu;function Zu(){return void 0===Xu&&"undefined"!=typeof XMLSerializer&&(Xu=new XMLSerializer),Xu}function Vu(){return void 0===Yu&&"undefined"!=typeof document&&(Yu=document.implementation.createDocument("","",null)),Yu}const Wu=gu;function Hu(t){switch(t){case mu:return Float32Array;case vu:return Uint32Array;default:return Float32Array}}var Ku=class{constructor(t,e){this.array=null,this.type=t,ct(t===mu||t===vu,62),this.usage=void 0!==e?e:Wu}ofSize(t){this.array=new(Hu(this.type))(t)}fromArray(t){this.array=Hu(this.type).from(t)}fromArrayBuffer(t){this.array=new(Hu(this.type))(t)}getType(){return this.type}getArray(){return this.array}getUsage(){return this.usage}getSize(){return this.array?this.array.length:0}},Ju="webglcontextlost",Qu="webglcontextrestored";var tl=class{constructor(t){this.Lr=t.webGlContext;const e=this.Lr;this.Nr=t.scaleRatio||1,this.zr=e.createTexture(),this.Gr=null,this.jr=e.createFramebuffer();const i=e.createShader(e.VERTEX_SHADER);e.shaderSource(i,t.vertexShader||"\n  precision mediump float;\n  \n  attribute vec2 a_position;\n  varying vec2 v_texCoord;\n  varying vec2 v_screenCoord;\n  \n  uniform vec2 u_screenSize;\n   \n  void main() {\n    v_texCoord = a_position * 0.5 + 0.5;\n    v_screenCoord = v_texCoord * u_screenSize;\n    gl_Position = vec4(a_position, 0.0, 1.0);\n  }\n"),e.compileShader(i);const n=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(n,t.fragmentShader||"\n  precision mediump float;\n   \n  uniform sampler2D u_image;\n  uniform float u_opacity;\n   \n  varying vec2 v_texCoord;\n   \n  void main() {\n    gl_FragColor = texture2D(u_image, v_texCoord) * u_opacity;\n  }\n"),e.compileShader(n),this.Dr=e.createProgram(),e.attachShader(this.Dr,i),e.attachShader(this.Dr,n),e.linkProgram(this.Dr),this.Ur=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,this.Ur),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,1,-1,1,1,-1,1]),e.STATIC_DRAW),this.$r=e.getAttribLocation(this.Dr,"a_position"),this.Br=e.getUniformLocation(this.Dr,"u_screenSize"),this.qr=e.getUniformLocation(this.Dr,"u_opacity"),this.Xr=e.getUniformLocation(this.Dr,"u_image"),this.Yr=[],t.uniforms&&Object.keys(t.uniforms).forEach(function(i){this.Yr.push({value:t.uniforms[i],location:e.getUniformLocation(this.Dr,i)})}.bind(this))}getGL(){return this.Lr}init(t){const e=this.getGL(),i=[e.drawingBufferWidth*this.Nr,e.drawingBufferHeight*this.Nr];if(e.bindFramebuffer(e.FRAMEBUFFER,this.getFrameBuffer()),e.viewport(0,0,i[0],i[1]),!this.Gr||this.Gr[0]!==i[0]||this.Gr[1]!==i[1]){this.Gr=i;const t=0,n=e.RGBA,s=0,r=e.RGBA,o=e.UNSIGNED_BYTE,h=null;e.bindTexture(e.TEXTURE_2D,this.zr),e.texImage2D(e.TEXTURE_2D,t,n,i[0],i[1],s,r,o,h),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.zr,0)}}apply(t,e,n,s){const r=this.getGL(),o=t.size;if(r.bindFramebuffer(r.FRAMEBUFFER,e?e.getFrameBuffer():null),r.activeTexture(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,this.zr),!e){const e=i(r.canvas);if(!t.renderTargets[e]){const i=r.getContextAttributes();i&&i.preserveDrawingBuffer&&(r.clearColor(0,0,0,0),r.clear(r.COLOR_BUFFER_BIT)),t.renderTargets[e]=!0}}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.Ur),r.useProgram(this.Dr),r.enableVertexAttribArray(this.$r),r.vertexAttribPointer(this.$r,2,r.FLOAT,!1,0,0),r.uniform2f(this.Br,o[0],o[1]),r.uniform1i(this.Xr,0);const h=t.layerStatesArray[t.layerIndex].opacity;r.uniform1f(this.qr,h),this.applyUniforms(t),n&&n(r,t),r.drawArrays(r.TRIANGLES,0,6),s&&s(r,t)}getFrameBuffer(){return this.jr}applyUniforms(t){const e=this.getGL();let i,n=1;this.Yr.forEach((function(s){if(i="function"==typeof s.value?s.value(t):s.value,i instanceof HTMLCanvasElement||i instanceof ImageData)s.texture||(s.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,s.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(s.location,n++);else if(Array.isArray(i))switch(i.length){case 2:return void e.uniform2f(s.location,i[0],i[1]);case 3:return void e.uniform3f(s.location,i[0],i[1],i[2]);case 4:return void e.uniform4f(s.location,i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(s.location,i)}))}};function el(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function il(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}const nl="u_projectionMatrix",sl="u_offsetScaleMatrix",rl="u_offsetRotateMatrix",ol="u_time",hl="u_zoom",al="u_resolution",ul="u_sizePx",ll="u_pixelRatio",cl={UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,UNSIGNED_INT:5125,FLOAT:wu},fl={};function dl(t){return"shared/"+t}let pl=0;function ml(t){let e=0;for(let i=0;i<t.length;i++){const n=t[i];e+=n.size*vl(n.type)}return e}function vl(t){switch(t){case cl.UNSIGNED_BYTE:return Uint8Array.BYTES_PER_ELEMENT;case cl.UNSIGNED_SHORT:return Uint16Array.BYTES_PER_ELEMENT;case cl.UNSIGNED_INT:return Uint32Array.BYTES_PER_ELEMENT;case cl.FLOAT:default:return Float32Array.BYTES_PER_ELEMENT}}var gl=class extends c{constructor(t){super(),t=t||{},this.Zr=this.handleWebGLContextLost.bind(this),this.Vr=this.handleWebGLContextRestored.bind(this),this.Wr=t.canvasCacheKey?dl(t.canvasCacheKey):function(){const t="unique/"+pl;return pl+=1,t}(),this.$t=function(t){let e=fl[t];if(!e){const i=document.createElement("canvas");i.style.position="absolute",i.style.left="0",e={users:0,canvas:i},fl[t]=e}return e.users+=1,e.canvas}(this.Wr),this.Lr=bu(this.$t),this.Hr={},this.Kr={},this.Jr=null,this.$t.addEventListener(Ju,this.Zr),this.$t.addEventListener(Qu,this.Vr),this.Qr=[1,0,0,1,0,0],this.eo=[1,0,0,1,0,0],this.io=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.no={},this.so={},this.Yr=[],t.uniforms&&this.setUniforms(t.uniforms);const e=this.getGL();this.ro=t.postProcesses?t.postProcesses.map((function(t){return new tl({webGlContext:e,scaleRatio:t.scaleRatio,vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms})})):[new tl({webGlContext:e})],this.oo=null,this.Fn=Date.now()}setUniforms(t){this.Yr=[];for(const e in t)this.Yr.push({name:e,value:t[e]});this.no={}}canvasCacheKeyMatches(t){return this.Wr===dl(t)}getExtension(t){if(t in this.Kr)return this.Kr[t];const e=this.Lr.getExtension(t);return this.Kr[t]=e,e}bindBuffer(t){const e=this.getGL(),n=i(t);let s=this.Hr[n];if(!s){s={buffer:t,webGlBuffer:e.createBuffer()},this.Hr[n]=s}e.bindBuffer(t.getType(),s.webGlBuffer)}flushBufferData(t){const e=this.getGL();this.bindBuffer(t),e.bufferData(t.getType(),t.getArray(),t.getUsage())}deleteBuffer(t){const e=this.getGL(),n=i(t),s=this.Hr[n];s&&!e.isContextLost()&&e.deleteBuffer(s.webGlBuffer),delete this.Hr[n]}disposeInternal(){this.$t.removeEventListener(Ju,this.Zr),this.$t.removeEventListener(Qu,this.Vr),function(t){const e=fl[t];if(!e)return;if(e.users-=1,e.users>0)return;const i=bu(e.canvas).getExtension("WEBGL_lose_context");i&&i.loseContext(),delete fl[t]}(this.Wr),delete this.Lr,delete this.$t}prepareDraw(t,e){const i=this.getGL(),n=this.getCanvas(),s=t.size,r=t.pixelRatio;n.width=s[0]*r,n.height=s[1]*r,n.style.width=s[0]+"px",n.style.height=s[1]+"px";for(let e=this.ro.length-1;e>=0;e--)this.ro[e].init(t);i.bindTexture(i.TEXTURE_2D,null),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),i.enable(i.BLEND),i.blendFunc(i.ONE,e?i.ZERO:i.ONE_MINUS_SRC_ALPHA)}prepareDrawToRenderTarget(t,e,i){const n=this.getGL(),s=e.getSize();n.bindFramebuffer(n.FRAMEBUFFER,e.getFramebuffer()),n.viewport(0,0,s[0],s[1]),n.bindTexture(n.TEXTURE_2D,e.getTexture()),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.ONE,i?n.ZERO:n.ONE_MINUS_SRC_ALPHA)}drawElements(t,e){const i=this.getGL();this.getExtension("OES_element_index_uint");const n=i.UNSIGNED_INT,s=e-t,r=4*t;i.drawElements(i.TRIANGLES,s,n,r)}finalizeDraw(t,e,i){for(let n=0,s=this.ro.length;n<s;n++)n===s-1?this.ro[n].apply(t,null,e,i):this.ro[n].apply(t,this.ro[n+1])}getCanvas(){return this.$t}getGL(){return this.Lr}applyFrameState(t){const e=t.size,i=t.viewState.rotation,n=t.pixelRatio,s=Tt(this.eo);Rt(s,2/e[0],2/e[1]);const r=Tt(this.Qr);0!==i&&kt(r,-i),this.setUniformMatrixValue(sl,il(this.io,s)),this.setUniformMatrixValue(rl,il(this.io,r)),this.setUniformFloatValue(ol,.001*(Date.now()-this.Fn)),this.setUniformFloatValue(hl,t.viewState.zoom),this.setUniformFloatValue(al,t.viewState.resolution),this.setUniformFloatValue(ll,n),this.setUniformFloatVec2(ul,[e[0],e[1]])}applyUniforms(t){const e=this.getGL();let i,n=0;this.Yr.forEach(function(s){if(i="function"==typeof s.value?s.value(t):s.value,i instanceof HTMLCanvasElement||i instanceof HTMLImageElement||i instanceof ImageData){s.texture||(s.prevValue=void 0,s.texture=e.createTexture()),e.activeTexture(e[`TEXTURE${n}`]),e.bindTexture(e.TEXTURE_2D,s.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 HTMLImageElement)||i.complete)&&s.prevValue!==i&&(s.prevValue=i,e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i)),e.uniform1i(this.getUniformLocation(s.name),n++)}else if(Array.isArray(i)&&6===i.length)this.setUniformMatrixValue(s.name,il(this.io,i));else if(Array.isArray(i)&&i.length<=4)switch(i.length){case 2:return void e.uniform2f(this.getUniformLocation(s.name),i[0],i[1]);case 3:return void e.uniform3f(this.getUniformLocation(s.name),i[0],i[1],i[2]);case 4:return void e.uniform4f(this.getUniformLocation(s.name),i[0],i[1],i[2],i[3]);default:return}else"number"==typeof i&&e.uniform1f(this.getUniformLocation(s.name),i)}.bind(this))}useProgram(t,e){this.getGL().useProgram(t),this.Jr=t,this.no={},this.so={},this.applyFrameState(e),this.applyUniforms(e)}compileShader(t,e){const i=this.getGL(),n=i.createShader(e);return i.shaderSource(n,t),i.compileShader(n),n}getProgram(t,e){const i=this.getGL(),n=this.compileShader(t,i.FRAGMENT_SHADER),s=this.compileShader(e,i.VERTEX_SHADER),r=i.createProgram();if(i.attachShader(r,n),i.attachShader(r,s),i.linkProgram(r),!i.getShaderParameter(n,i.COMPILE_STATUS)){const t=`Fragment shader compliation failed: ${i.getShaderInfoLog(n)}`;throw new Error(t)}if(i.deleteShader(n),!i.getShaderParameter(s,i.COMPILE_STATUS)){const t=`Vertex shader compilation failed: ${i.getShaderInfoLog(s)}`;throw new Error(t)}if(i.deleteShader(s),!i.getProgramParameter(r,i.LINK_STATUS)){const t=`GL program linking failed: ${i.getShaderInfoLog(s)}`;throw new Error(t)}return r}getUniformLocation(t){return void 0===this.no[t]&&(this.no[t]=this.getGL().getUniformLocation(this.Jr,t)),this.no[t]}getAttributeLocation(t){return void 0===this.so[t]&&(this.so[t]=this.getGL().getAttribLocation(this.Jr,t)),this.so[t]}makeProjectionTransform(t,e){const i=t.size,n=t.viewState.rotation,s=t.viewState.resolution,r=t.viewState.center;return Tt(e),Ot(e,0,0,2/(s*i[0]),2/(s*i[1]),-n,-r[0],-r[1]),e}setUniformFloatValue(t,e){this.getGL().uniform1f(this.getUniformLocation(t),e)}setUniformFloatVec2(t,e){this.getGL().uniform2fv(this.getUniformLocation(t),e)}setUniformFloatVec4(t,e){this.getGL().uniform4fv(this.getUniformLocation(t),e)}setUniformMatrixValue(t,e){this.getGL().uniformMatrix4fv(this.getUniformLocation(t),!1,e)}ho(t,e,i,n,s){const r=this.getAttributeLocation(t);r<0||(this.getGL().enableVertexAttribArray(r),this.getGL().vertexAttribPointer(r,e,i,!1,n,s))}enableAttributes(t){const e=ml(t);let i=0;for(let n=0;n<t.length;n++){const s=t[n];this.ho(s.name,s.size,s.type||wu,e,i),i+=s.size*vl(s.type)}}handleWebGLContextLost(){P(this.Hr),this.Jr=null}handleWebGLContextRestored(){}createTexture(t,e,i){const n=this.getGL();i=i||n.createTexture();const s=n.RGBA,r=n.RGBA,o=n.UNSIGNED_BYTE;return n.bindTexture(n.TEXTURE_2D,i),e?n.texImage2D(n.TEXTURE_2D,0,s,r,o,e):n.texImage2D(n.TEXTURE_2D,0,s,t[0],t[1],0,r,o,null),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),i}};var yl=class{constructor(t,e){this.name=t,this.data=e,this.ao=null}getTexture(t){if(!this.ao){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.data.length/4,1,0,t.RGBA,t.UNSIGNED_BYTE,this.data),this.ao=e}return this.ao}};const wl=new Uint8Array(4);var xl=class{constructor(t,e){this.uo=t;const i=t.getGL();this.ao=i.createTexture(),this.lo=i.createFramebuffer(),this.V=e||[1,1],this.B=new Uint8Array(0),this.co=!0,this.fo()}setSize(t){g(t,this.V)||(this.V[0]=t[0],this.V[1]=t[1],this.fo())}getSize(){return this.V}clearCachedData(){this.co=!0}readAll(){if(this.co){const t=this.V,e=this.uo.getGL();e.bindFramebuffer(e.FRAMEBUFFER,this.lo),e.readPixels(0,0,t[0],t[1],e.RGBA,e.UNSIGNED_BYTE,this.B),this.co=!1}return this.B}readPixel(t,e){if(t<0||e<0||t>this.V[0]||e>=this.V[1])return wl[0]=0,wl[1]=0,wl[2]=0,wl[3]=0,wl;this.readAll();const i=Math.floor(t)+(this.V[1]-Math.floor(e)-1)*this.V[0];return wl[0]=this.B[4*i],wl[1]=this.B[4*i+1],wl[2]=this.B[4*i+2],wl[3]=this.B[4*i+3],wl}getTexture(){return this.ao}getFramebuffer(){return this.lo}fo(){const t=this.V,e=this.uo.getGL();this.ao=this.uo.createTexture(t,null,this.ao),e.bindFramebuffer(e.FRAMEBUFFER,this.lo),e.viewport(0,0,t[0],t[1]),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.ao,0),this.B=new Uint8Array(t[0]*t[1]*4)}};var bl=class{constructor(t,e,i,n,s,r){this.do=t,this.po=e;let o={};const h=nn(this.po,this.do);this.mo=function(t){const e=t[0]+"/"+t[1];return o[e]||(o[e]=h(t)),o[e]},this.vo=n,this.yo=s*s,this.wo=[],this.xo=!1,this.bo=this.do.canWrapX()&&!!n&&!!this.do.getExtent()&&Ee(n)==Ee(this.do.getExtent()),this.Mo=this.do.getExtent()?Ee(this.do.getExtent()):null,this.So=this.po.getExtent()?Ee(this.po.getExtent()):null;const a=Pe(i),u=_e(i),l=ge(i),c=ve(i),f=this.mo(a),d=this.mo(u),p=this.mo(l),m=this.mo(c),v=10+(r?Math.max(0,Math.ceil(Math.log2(me(i)/(r*r*256*256)))):0);if(this.Po(a,u,l,c,f,d,p,m,v),this.xo){let t=1/0;this.wo.forEach((function(e,i,n){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])})),this.wo.forEach(function(e){if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.Mo/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.Mo/2&&(i[0][0]-=this.Mo),i[1][0]-t>this.Mo/2&&(i[1][0]-=this.Mo),i[2][0]-t>this.Mo/2&&(i[2][0]-=this.Mo);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<this.Mo/2&&(e.source=i)}}.bind(this))}o={}}_o(t,e,i,n,s,r){this.wo.push({source:[n,s,r],target:[t,e,i]})}Po(t,e,i,n,s,r,o,h,a){const u=Zt([s,r,o,h]),l=this.Mo?Ee(u)/this.Mo:null,c=this.Mo,f=this.do.canWrapX()&&l>.5&&l<1;let d=!1;if(a>0){if(this.po.isGlobal()&&this.So){d=Ee(Zt([t,e,i,n]))/this.So>.25||d}!f&&this.do.isGlobal()&&l&&(d=l>.25||d)}if(!d&&this.vo&&isFinite(u[0])&&isFinite(u[1])&&isFinite(u[2])&&isFinite(u[3])&&!Te(u,this.vo))return;let p=0;if(!(d||isFinite(s[0])&&isFinite(s[1])&&isFinite(r[0])&&isFinite(r[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(h[0])&&isFinite(h[1])))if(a>0)d=!0;else if(p=(isFinite(s[0])&&isFinite(s[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(h[0])&&isFinite(h[1])?0:1),1!=p&&2!=p&&4!=p&&8!=p)return;if(a>0){if(!d){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],n=this.mo(e);let r;if(f){r=(di(s[0],c)+di(o[0],c))/2-di(n[0],c)}else r=(s[0]+o[0])/2-n[0];const h=(s[1]+o[1])/2-n[1];d=r*r+h*h>this.yo}if(d){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const u=[(e[0]+i[0])/2,(e[1]+i[1])/2],l=this.mo(u),c=[(n[0]+t[0])/2,(n[1]+t[1])/2],f=this.mo(c);this.Po(t,e,u,c,s,r,l,f,a-1),this.Po(c,u,i,n,f,l,o,h,a-1)}else{const u=[(t[0]+e[0])/2,(t[1]+e[1])/2],l=this.mo(u),c=[(i[0]+n[0])/2,(i[1]+n[1])/2],f=this.mo(c);this.Po(t,u,c,n,s,l,f,h,a-1),this.Po(u,e,i,c,l,r,o,f,a-1)}return}}if(f){if(!this.bo)return;this.xo=!0}0==(11&p)&&this._o(t,i,n,s,o,h),0==(14&p)&&this._o(t,i,e,s,o,r),p&&(0==(13&p)&&this._o(e,n,t,r,h,s),0==(7&p)&&this._o(e,n,i,r,h,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.wo.forEach((function(e,i,n){const s=e.source;ue(t,s[0]),ue(t,s[1]),ue(t,s[2])})),t}getTriangles(){return this.wo}};var Ml=class extends ut{constructor(t,e,i,n,s,r,o,h,a,u,l,c){super(s,tt,{interpolate:!!c}),this.Eo=void 0!==l&&l,this.Lt=o,this.To=h,this.$t=null,this.Co=e,this.Fo=n,this.Io=r||s,this.Ao=[],this.ko=null,this.Ro=0;const f=n.getTileCoordExtent(this.Io),d=this.Fo.getExtent();let p=this.Co.getExtent();const m=d?Se(f,d):f;if(0===me(m))return void(this.state=st);const v=t.getExtent();v&&(p=p?Se(p,v):v);const g=n.getResolution(this.Io[0]),y=Ja(t,i,m,g);if(!isFinite(y)||y<=0)return void(this.state=st);const w=void 0!==u?u:.5;if(this.Lo=new bl(t,i,m,p,y*w,g),0===this.Lo.getTriangles().length)return void(this.state=st);this.Ro=e.getZForResolution(y);let x=this.Lo.calculateSourceExtent();if(p&&(t.canWrapX()?(x[1]=hi(x[1],p[1],p[3]),x[3]=hi(x[3],p[1],p[3])):x=Se(x,p)),me(x)){const t=e.getTileRangeForExtentAndZ(x,this.Ro);for(let e=t.minX;e<=t.maxX;e++)for(let i=t.minY;i<=t.maxY;i++){const t=a(this.Ro,e,i,o);t&&this.Ao.push(t)}0===this.Ao.length&&(this.state=st)}else this.state=st}getImage(){return this.$t}No(){const t=[];if(this.Ao.forEach(function(e,i,n){e&&e.getState()==it&&t.push({extent:this.Co.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.Ao.length=0,0===t.length)this.state=nt;else{const e=this.Io[0],i=this.Fo.getTileSize(e),n="number"==typeof i?i:i[0],s="number"==typeof i?i:i[1],r=this.Fo.getResolution(e),o=this.Co.getResolution(this.Ro),h=this.Fo.getTileCoordExtent(this.Io);this.$t=Qa(n,s,this.Lt,o,this.Co.getExtent(),r,h,this.Lo,t,this.To,this.Eo,this.interpolate),this.state=it}this.changed()}load(){if(this.state==tt){this.state=et,this.changed();let t=0;this.ko=[],this.Ao.forEach(function(e,i,n){const s=e.getState();if(s==tt||s==et){t++;const i=U(e,T,(function(n){const s=e.getState();s!=it&&s!=nt&&s!=st||(B(i),t--,0===t&&(this.Oo(),this.No()))}),this);this.ko.push(i)}}.bind(this)),0===t?setTimeout(this.No.bind(this),0):this.Ao.forEach((function(t,e,i){t.getState()==tt&&t.load()}))}}Oo(){this.ko.forEach(B),this.ko=null}release(){this.$t&&(Zs(this.$t.getContext("2d")),Va.push(this.$t),this.$t=null),super.release()}};function Sl(t,e,i){const n=i?t.LINEAR:t.NEAREST;t.bindTexture(t.TEXTURE_2D,e),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n)}function Pl(t,e,i,n,s,r){const o=t.getGL();let h,a;if(i instanceof Float32Array){h=o.FLOAT,t.getExtension("OES_texture_float");a=null!==t.getExtension("OES_texture_float_linear")}else h=o.UNSIGNED_BYTE,a=!0;Sl(o,e,r&&a);const u=i.byteLength/n[1];let l,c=1;switch(u%8==0?c=8:u%4==0?c=4:u%2==0&&(c=2),s){case 1:l=o.LUMINANCE;break;case 2:l=o.LUMINANCE_ALPHA;break;case 3:l=o.RGB;break;case 4:l=o.RGBA;break;default:throw new Error(`Unsupported number of bands: ${s}`)}const f=o.getParameter(o.UNPACK_ALIGNMENT);o.pixelStorei(o.UNPACK_ALIGNMENT,c),o.texImage2D(o.TEXTURE_2D,0,l,n[0],n[1],0,l,h,i),o.pixelStorei(o.UNPACK_ALIGNMENT,f)}let _l=null;var El=class extends E{constructor(t){super(),this.tile,this.textures=[],this.gs=this.gs.bind(this),this.zo=ia(t.grid.getTileSize(t.tile.tileCoord[0])),this.To=t.gutter||0,this.bandCount=NaN,this.uo=t.helper;const e=new Ku(mu,gu);e.fromArray([0,1,1,1,1,0,0,0]),this.uo.flushBufferData(e),this.coords=e,this.setTile(t.tile)}setTile(t){if(t!==this.tile)if(this.tile&&this.tile.removeEventListener(T,this.gs),this.tile=t,this.textures.length=0,this.loaded=t.getState()===it,this.loaded)this.Go();else{if(t instanceof tr){const e=t.getImage();e instanceof Image&&!e.crossOrigin&&(e.crossOrigin="anonymous")}t.addEventListener(T,this.gs)}}Go(){const t=this.uo,e=t.getGL(),i=this.tile;if(i instanceof tr||i instanceof Ml){const t=e.createTexture();return this.textures.push(t),this.bandCount=4,void function(t,e,i,n){Sl(t,e,n),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,i)}(e,t,i.getImage(),i.interpolate)}const n=i.getSize(),s=[n[0]+2*this.To,n[1]+2*this.To],r=i.getData(),o=r instanceof Float32Array,h=s[0]*s[1],a=o?Float32Array:Uint8Array,u=a.BYTES_PER_ELEMENT,l=r.byteLength/s[1];this.bandCount=Math.floor(l/u/s[0]);const c=Math.ceil(this.bandCount/4);if(1===c){const n=e.createTexture();return this.textures.push(n),void Pl(t,n,r,s,this.bandCount,i.interpolate)}const f=new Array(c);for(let t=0;t<c;++t){const i=e.createTexture();this.textures.push(i);const n=t<c-1?4:(this.bandCount-1)%4+1;f[t]=new a(h*n)}let d=0,p=0;const m=s[0]*this.bandCount;for(let t=0;t<s[1];++t){for(let t=0;t<m;++t){const e=r[p+t],i=Math.floor(d/this.bandCount),n=t%this.bandCount,s=f[Math.floor(n/4)];s[i*(s.length/h)+n%4]=e,++d}p+=l/u}for(let e=0;e<c;++e){const n=this.textures[e],r=f[e];Pl(t,n,r,s,r.length/h,i.interpolate)}}gs(){this.tile.getState()===it&&(this.loaded=!0,this.Go(),this.dispatchEvent(T))}disposeInternal(){const t=this.uo.getGL();this.uo.deleteBuffer(this.coords);for(let e=0;e<this.textures.length;++e)t.deleteTexture(this.textures[e]);this.tile.removeEventListener(T,this.gs)}getPixelData(t,e){if(!this.loaded)return null;const i=this.zo[0],n=this.zo[1],s=this.To;if(this.tile instanceof lt){const r=this.tile.getSize(),o=r[0],h=r[1],a=o+2*s,u=h+2*s,l=s+Math.floor(o*(t/i)),c=s+Math.floor(h*(e/n)),f=this.tile.getData();if(f instanceof DataView){const t=f.byteLength/(a*u),e=t*(c*a+l),i=f.buffer.slice(e,e+t);return new DataView(i)}const d=this.bandCount*(c*a+l);return f.slice(d,d+this.bandCount)}_l||function(){const t=document.createElement("canvas");t.width=1,t.height=1,_l=t.getContext("2d")}(),_l.clearRect(0,0,1,1);const r=this.tile.getImage(),o=r.width-2*s,h=r.height-2*s,a=s+Math.floor(o*(t/i)),u=s+Math.floor(h*(e/n));let l;try{_l.drawImage(r,a,u,1,1,0,0,1,1),l=_l.getImageData(0,0,1,1).data}catch(t){return _l=null,null}return l}};var Tl=class extends Y{constructor(t){super(),this.ready=!0,this.jo=this.Do.bind(this),this.Uo=t,this.declutterExecutorGroup=null}getFeatures(e){return t()}getData(t){return null}prepareFrame(e){return t()}renderFrame(e,i){return t()}loadedTileCallback(t,e,i){t[e]||(t[e]={}),t[e][i.tileCoord.toString()]=i}createLoadedTileFinder(t,e,i){return function(n,s){const r=this.loadedTileCallback.bind(this,i,n);return t.forEachLoadedTile(e,n,s,r)}.bind(this)}forEachFeatureAtCoordinate(t,e,i,n,s){}getLayer(){return this.Uo}handleFontsChanged(){}Do(t){t.target.getState()===Ds&&this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Ds&&e!=Us&&t.addEventListener(T,this.jo),e==Gs&&(t.load(),e=t.getState()),e==Ds}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}disposeInternal(){delete this.Uo,super.disposeInternal()}};class Cl extends Tl{constructor(t,e){super(t),e=e||{},this.$o=[1,0,0,1,0,0],this.Bo=null,this.qo=e.postProcesses,this.Yr=e.uniforms,this.helper,t.addChangeListener(Pr,this.removeHelper.bind(this)),this.dispatchPreComposeEvent=this.dispatchPreComposeEvent.bind(this),this.dispatchPostComposeEvent=this.dispatchPostComposeEvent.bind(this)}dispatchPreComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(Cr)){const n=new Nr(Cr,void 0,e,t);i.dispatchEvent(n)}}dispatchPostComposeEvent(t,e){const i=this.getLayer();if(i.hasListener(Fr)){const n=new Nr(Fr,void 0,e,t);i.dispatchEvent(n)}}reset(t){this.Yr=t.uniforms,this.helper&&this.helper.setUniforms(this.Yr)}removeHelper(){this.helper&&(this.helper.dispose(),delete this.helper)}prepareFrame(t){if(this.getLayer().getRenderSource()){let e,i=!0,n=-1;for(let s=0,r=t.layerStatesArray.length;s<r;s++){const r=t.layerStatesArray[s].layer,o=r.getRenderer();if(!(o instanceof Cl)){i=!0;continue}const h=r.getClassName();if((i||h!==e)&&(n+=1,i=!1),e=h,o===this)break}const s="map/"+t.mapId+"/group/"+n;this.helper&&this.helper.canvasCacheKeyMatches(s)||(this.removeHelper(),this.helper=new gl({postProcesses:this.qo,uniforms:this.Yr,canvasCacheKey:s}),e&&(this.helper.getCanvas().className=e),this.afterHelperCreated())}return this.prepareFrameInternal(t)}afterHelperCreated(){}prepareFrameInternal(t){return!0}disposeInternal(){this.removeHelper(),super.disposeInternal()}Xo(t,e,i){const n=this.getLayer();if(n.hasListener(t)){Ot(this.$o,0,0,i.pixelRatio,-i.pixelRatio,0,0,-i.size[1]);const s=new Nr(t,this.$o,i,e);n.dispatchEvent(s)}}preRender(t,e){this.Xo(Er,t,e)}postRender(t,e){this.Xo(Tr,t,e)}}var Fl=Cl;const Il={TILE_TEXTURE_ARRAY:"u_tileTextures",TILE_TRANSFORM:"u_tileTransform",TRANSITION_ALPHA:"u_transitionAlpha",DEPTH:"u_depth",TEXTURE_PIXEL_WIDTH:"u_texturePixelWidth",TEXTURE_PIXEL_HEIGHT:"u_texturePixelHeight",TEXTURE_RESOLUTION:"u_textureResolution",TEXTURE_ORIGIN_X:"u_textureOriginX",TEXTURE_ORIGIN_Y:"u_textureOriginY",RENDER_EXTENT:"u_renderExtent",RESOLUTION:"u_resolution",ZOOM:"u_zoom"},Al={TEXTURE_COORD:"a_textureCoord"},kl=[{name:Al.TEXTURE_COORD,size:2,type:cl.FLOAT}],Rl={};function Ll(t){return 2*(1-1/(t+1))-1}function Nl(t,e,i){i in t||(t[i]=[]),t[i].push(e)}function Ol(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=Se(e,fn(i.extent,t.viewState.projection)));const n=i.layer.getRenderSource();if(!n.getWrapX()){const i=n.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=Se(e,i))}return e}function zl(t,e){return`${t.getKey()},${ma(e)}`}var Gl=class extends Fl{constructor(t,e){super(t,{uniforms:e.uniforms}),this.renderComplete=!1,this.Yo=[1,0,0,1,0,0],this.Zo=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],this.Vo=new Sa(0,0,0,0),this.Wo=da(0,0,0),this.Ho=[0,0],this.Ko,this.Jo=e.vertexShader,this.Qo=e.fragmentShader,this.th=new Ku(vu,gu),this.th.fromArray([0,1,3,1,2,3]);const i=void 0!==e.cacheSize?e.cacheSize:512;this.eh=new fa(i),this.ih=e.paletteTextures||[],this.Qn=null}reset(t){super.reset({uniforms:t.uniforms}),this.Jo=t.vertexShader,this.Qo=t.fragmentShader,this.ih=t.paletteTextures||[],this.helper&&(this.Ko=this.helper.getProgram(this.Qo,this.Jo))}afterHelperCreated(){this.Ko=this.helper.getProgram(this.Qo,this.Jo),this.helper.flushBufferData(this.th)}nh(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==it||i==st||i==nt&&!n}prepareFrameInternal(t){const e=this.getLayer().getRenderSource();return!!e&&(!Ce(Ol(t,t.extent))&&"ready"===e.getState())}enqueueTiles(t,e,n,s){const r=t.viewState,o=this.getLayer(),h=o.getRenderSource(),a=h.getTileGridForProjection(r.projection),u=h.getGutterForProjection(r.projection),l=i(h);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],f=this.eh,d=Math.max(n-o.getPreload(),a.getMinZoom(),o.getMinZoom());for(let i=n;i>=d;--i){const n=a.getTileRangeForExtentAndZ(e,i,this.Vo),o=a.getResolution(i);for(let e=n.minX;e<=n.maxX;++e)for(let d=n.minY;d<=n.maxY;++d){const n=da(i,e,d,this.Wo),p=zl(h,n);let m,v;if(f.containsKey(p)&&(m=f.get(p),v=m.tile),!m||m.tile.key!==h.getKey())if(v=h.getTile(i,e,d,t.pixelRatio,r.projection),m)if(this.nh(v))m.setTile(v);else{const t=v.getInterimTile();m.setTile(t)}else m=new El({tile:v,grid:a,helper:this.helper,gutter:u}),f.set(p,m);Nl(s,m,i);const g=v.getKey();c[g]=!0,v.getState()===tt&&(t.tileQueue.isKeyQueued(g)||t.tileQueue.enqueue([v,l,a.getTileCoordCenter(n),o]))}}}renderFrame(t){this.Qn=t,this.renderComplete=!0;const e=this.helper.getGL();this.preRender(e,t);const n=t.viewState,s=this.getLayer().getRenderSource(),r=s.getTileGridForProjection(n.projection),o=s.getGutterForProjection(n.projection),h=Ol(t,t.extent),a=r.getZForResolution(n.resolution,s.zDirection),u={};if(t.nextExtent){const e=r.getZForResolution(n.nextResolution,s.zDirection),i=Ol(t,t.nextExtent);this.enqueueTiles(t,i,e,u)}this.enqueueTiles(t,h,a,u);const l={},c=i(this),f=t.time;let p=!1;const m=u[a];for(let t=0,e=m.length;t<e;++t){const e=m[t],i=e.tile,n=i.tileCoord;if(e.loaded){const t=i.getAlpha(c,f);if(1===t){i.endTransition(c);continue}p=!0;l[ma(n)]=t}this.renderComplete=!1;if(this.sh(r,n,a+1,u))continue;const s=r.getMinZoom();for(let t=a-1;t>=s;--t){if(this.sh(r,n,t,u))break}}this.helper.useProgram(this.Ko,t),this.helper.prepareDraw(t,!p);const v=Object.keys(u).map(Number).sort(d),g=n.center[0],y=n.center[1];for(let i=0,s=v.length;i<s;++i){const s=v[i],a=r.getResolution(s),c=ia(r.getTileSize(s),this.Ho),f=r.getOrigin(s),d=c[0]+2*o,p=c[1]+2*o,m=d/p,w=(g-f[0])/(c[0]*a),x=(f[1]-y)/(c[1]*a),b=n.resolution/a,M=Ll(s),S=u[s];for(let i=0,s=S.length;i<s;++i){const s=S[i];if(!s.loaded)continue;const u=s.tile.tileCoord,v=ma(u),g=u[1],y=u[2];Tt(this.Yo),Rt(this.Yo,2/(t.size[0]*b/d),-2/(t.size[1]*b/d)),kt(this.Yo,n.rotation),Rt(this.Yo,1,1/m),Nt(this.Yo,(c[0]*(g-w)-o)/d,(c[1]*(y-x)-o)/p),this.helper.setUniformMatrixValue(Il.TILE_TRANSFORM,il(this.Zo,this.Yo)),this.helper.bindBuffer(s.coords),this.helper.bindBuffer(this.th),this.helper.enableAttributes(kl);let P=0;for(;P<s.textures.length;){const t="TEXTURE"+P,i=`${Il.TILE_TEXTURE_ARRAY}[${P}]`;e.activeTexture(e[t]),e.bindTexture(e.TEXTURE_2D,s.textures[P]),e.uniform1i(this.helper.getUniformLocation(i),P),++P}for(let t=0;t<this.ih.length;++t){const i=this.ih[t];e.activeTexture(e["TEXTURE"+P]);const n=i.getTexture(e);e.bindTexture(e.TEXTURE_2D,n),e.uniform1i(this.helper.getUniformLocation(i.name),P),++P}const _=v in l?l[v]:1;_<1&&(t.animate=!0),this.helper.setUniformFloatValue(Il.TRANSITION_ALPHA,_),this.helper.setUniformFloatValue(Il.DEPTH,M),this.helper.setUniformFloatValue(Il.TEXTURE_PIXEL_WIDTH,d),this.helper.setUniformFloatValue(Il.TEXTURE_PIXEL_HEIGHT,p),this.helper.setUniformFloatValue(Il.TEXTURE_RESOLUTION,a),this.helper.setUniformFloatValue(Il.TEXTURE_ORIGIN_X,f[0]+g*c[0]*a-o*a),this.helper.setUniformFloatValue(Il.TEXTURE_ORIGIN_Y,f[1]-y*c[1]*a+o*a);let E=h;o>0&&(E=r.getTileCoordExtent(u),Se(E,h,E)),this.helper.setUniformFloatVec4(Il.RENDER_EXTENT,E),this.helper.setUniformFloatValue(Il.RESOLUTION,n.resolution),this.helper.setUniformFloatValue(Il.ZOOM,n.zoom),this.helper.drawElements(0,this.th.getSize())}}this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const w=this.helper.getCanvas(),x=this.eh;for(;x.canExpireCache();){x.pop().dispose()}return t.postRenderFunctions.push((function(t,e){s.updateCacheSize(.1,e.viewState.projection),s.expireCache(e.viewState.projection,Rl)})),this.postRender(e,t),w}getData(t){if(!this.helper.getGL())return null;const e=this.Qn;if(!e)return null;const i=this.getLayer(),n=At(e.pixelToCoordinateTransform,t.slice()),s=e.viewState,r=i.getExtent();if(r&&!Kt(fn(r,s.projection),n))return null;const o=i.getSources(Zt([n]),s.resolution);let h,a,u;for(h=o.length-1;h>=0;--h)if(a=o[h],"ready"===a.getState()){if(u=a.getTileGridForProjection(s.projection),a.getWrapX())break;const t=u.getExtent();if(!t||Kt(t,n))break}if(h<0)return null;const l=this.eh;for(let t=u.getZForResolution(s.resolution);t>=u.getMinZoom();--t){const e=u.getTileCoordForCoordAndZ(n,t),i=zl(a,e);if(!l.containsKey(i))continue;const s=l.get(i);if(!s.loaded)continue;const r=u.getOrigin(t),o=ia(u.getTileSize(t)),h=u.getResolution(t),c=(n[0]-r[0])/h-e[1]*o[0],f=(r[1]-n[1])/h-e[2]*o[1];return s.getPixelData(c,f)}return null}sh(t,e,i,n){const s=t.getTileRangeForTileCoordAndZ(e,i,this.Vo);if(!s)return!1;let r=!0;const o=this.eh,h=this.getLayer().getRenderSource();for(let t=s.minX;t<=s.maxX;++t)for(let e=s.minY;e<=s.maxY;++e){const s=zl(h,[i,t,e]);let a=!1;if(o.containsKey(s)){const t=o.get(s);t.loaded&&(Nl(n,t,i),a=!0)}a||(r=!1)}return r}removeHelper(){if(this.helper){const t=this.eh;t.forEach((t=>t.dispose())),t.clear()}super.removeHelper()}disposeInternal(){const t=this.helper;if(t){t.getGL().deleteProgram(this.Ko),delete this.Ko,t.deleteBuffer(this.th)}super.disposeInternal(),delete this.th,delete this.eh,delete this.Qn}};const jl=1,Dl=2,Ul=4,$l=8,Bl=16,ql=31,Xl=0,Yl={};function Zl(t){if("number"==typeof t)return jl;if("boolean"==typeof t)return $l;if("string"==typeof t)return lr(t)?Ul|Dl:Dl;if(!Array.isArray(t))throw new Error(`Unhandled value type: ${JSON.stringify(t)}`);const e=t;if(e.every((function(t){return"number"==typeof t})))return 3===e.length||4===e.length?Ul|Bl:Bl;if("string"!=typeof e[0])throw new Error(`Expected an expression operator but received: ${JSON.stringify(e)}`);const i=Yl[e[0]];if(void 0===i)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return i.getReturnType(e.slice(1))}function Vl(t){return Math.log2(t)%1==0}function Wl(t){const e=t.toString();return e.includes(".")?e:e+".0"}function Hl(t){if(t.length<2||t.length>4)throw new Error("`formatArray` can only output `vec2`, `vec3` or `vec4` arrays.");return`vec${t.length}(${t.map(Wl).join(", ")})`}function Kl(t){const e=hr(t).slice();return e.length<4&&e.push(1),Hl(e.map((function(t,e){return e<3?t/255:t})))}function Jl(t,e){return void 0===t.stringLiteralsMap[e]&&(t.stringLiteralsMap[e]=Object.keys(t.stringLiteralsMap).length),t.stringLiteralsMap[e]}function Ql(t,e){return Wl(Jl(t,e))}function tc(t,e,i){if(Array.isArray(e)&&"string"==typeof e[0]){const n=Yl[e[0]];if(void 0===n)throw new Error(`Unrecognized expression operator: ${JSON.stringify(e)}`);return n.toGlsl(t,e.slice(1),i)}const n=Zl(e);if((n&jl)>0)return Wl(e);if((n&$l)>0)return e.toString();if((n&Dl)>0&&(void 0===i||i==Dl))return Ql(t,e.toString());if((n&Ul)>0&&(void 0===i||i==Ul))return Kl(e);if((n&Bl)>0)return Hl(e);throw new Error(`Unexpected expression ${e} (expected type ${i})`)}function ec(t){if(!(Zl(t)&jl))throw new Error(`A numeric value was expected, got ${JSON.stringify(t)} instead`)}function ic(t){for(let e=0;e<t.length;e++)ec(t[e])}function nc(t){if(!(Zl(t)&Dl))throw new Error(`A string value was expected, got ${JSON.stringify(t)} instead`)}function sc(t){if(!(Zl(t)&$l))throw new Error(`A boolean value was expected, got ${JSON.stringify(t)} instead`)}function rc(t,e){if(t.length!==e)throw new Error(`Exactly ${e} arguments were expected, got ${t.length} instead`)}function oc(t,e){if(t.length<e)throw new Error(`At least ${e} arguments were expected, got ${t.length} instead`)}function hc(t,e){if(t.length>e)throw new Error(`At most ${e} arguments were expected, got ${t.length} instead`)}function ac(t){if(t.length%2!=0)throw new Error(`An even amount of arguments was expected, got ${t} instead`)}function uc(t,e){if(!Vl(e))throw new Error(`Could not infer only one type from the following expression: ${JSON.stringify(t)}`)}function lc(t){return"u_var_"+t}Yl.get={getReturnType:function(t){return ql},toGlsl:function(t,e){rc(e,1),nc(e[0]);const i=e[0].toString();t.attributes.includes(i)||t.attributes.push(i);return(t.inFragmentShader?"v_":"a_")+i}},Yl.var={getReturnType:function(t){return ql},toGlsl:function(t,e){rc(e,1),nc(e[0]);const i=e[0].toString();return t.variables.includes(i)||t.variables.push(i),lc(i)}};const cc="u_paletteTextures";Yl.palette={getReturnType:function(t){return Ul},toGlsl:function(t,e){rc(e,2),ec(e[0]);const i=tc(t,e[0]),n=e[1];if(!Array.isArray(n))throw new Error("The second argument of palette must be an array");const s=n.length,r=new Uint8Array(4*s);for(let t=0;t<s;t++){const e=n[t];let i;if("string"==typeof e)i=or(e);else{if(!Array.isArray(e))throw new Error("The second argument of palette must be an array of strings or colors");const t=e.length;if(4===t)i=e;else{if(3!==t)throw new Error(`Expected palette color to have 3 or 4 values, got ${t}`);i=[e[0],e[1],e[2],1]}}const s=4*t;r[s]=i[0],r[s+1]=i[1],r[s+2]=i[2],r[s+3]=255*i[3]}t.paletteTextures||(t.paletteTextures=[]);const o=`u_paletteTextures[${t.paletteTextures.length}]`,h=new yl(o,r);return t.paletteTextures.push(h),`texture2D(${o}, vec2((${i} + 0.5) / ${s}.0, 0.5))`}};const fc="getBandValue";function dc(t){return{getReturnType:function(t){return $l},toGlsl:function(e,i){rc(i,2);let n=ql;for(let t=0;t<i.length;t++)n&=Zl(i[t]);if(n===Xl)throw new Error(`All arguments should be of compatible type, got ${JSON.stringify(i)} instead`);return n&=~Ul,`(${tc(e,i[0],n)} ${t} ${tc(e,i[1],n)})`}}}function pc(t){return{getReturnType:function(t){return $l},toGlsl:function(e,i){oc(i,2);for(let t=0;t<i.length;t++)sc(i[t]);let n="";return n=i.map((t=>tc(e,t))).join(` ${t} `),n=`(${n})`,n}}}Yl.band={getReturnType:function(t){return jl},toGlsl:function(t,e){oc(e,1),hc(e,3);const i=e[0];if(!(fc in t.functions)){let e="";const i=t.bandCount||1;for(let t=0;t<i;t++){const n=Math.floor(t/4);let s=t%4;t===i-1&&1===s&&(s=3);e+=`\n          if (band == ${t+1}.0) {\n            return texture2D(${`${Il.TILE_TEXTURE_ARRAY}[${n}]`}, v_textureCoord + vec2(dx, dy))[${s}];\n          }\n        `}t.functions.getBandValue=`\n        float getBandValue(float band, float xOffset, float yOffset) {\n          float dx = xOffset / ${Il.TEXTURE_PIXEL_WIDTH};\n          float dy = yOffset / ${Il.TEXTURE_PIXEL_HEIGHT};\n          ${e}\n        }\n      `}return`getBandValue(${tc(t,i)}, ${tc(t,e[1]||0)}, ${tc(t,e[2]||0)})`}},Yl.time={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,0),"u_time"}},Yl.zoom={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,0),"u_zoom"}},Yl.resolution={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,0),"u_resolution"}},Yl["*"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} * ${tc(t,e[1])})`}},Yl["/"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} / ${tc(t,e[1])})`}},Yl["+"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} + ${tc(t,e[1])})`}},Yl["-"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} - ${tc(t,e[1])})`}},Yl.clamp={getReturnType:function(t){return jl},toGlsl:function(t,e){rc(e,3),ic(e);const i=tc(t,e[1]),n=tc(t,e[2]);return`clamp(${tc(t,e[0])}, ${i}, ${n})`}},Yl["%"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`mod(${tc(t,e[0])}, ${tc(t,e[1])})`}},Yl["^"]={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,2),ic(e),`pow(${tc(t,e[0])}, ${tc(t,e[1])})`}},Yl.abs={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`abs(${tc(t,e[0])})`}},Yl.floor={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`floor(${tc(t,e[0])})`}},Yl.round={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`floor(${tc(t,e[0])} + 0.5)`}},Yl.ceil={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`ceil(${tc(t,e[0])})`}},Yl.sin={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`sin(${tc(t,e[0])})`}},Yl.cos={getReturnType:function(t){return jl},toGlsl:function(t,e){return rc(e,1),ic(e),`cos(${tc(t,e[0])})`}},Yl.atan={getReturnType:function(t){return jl},toGlsl:function(t,e){return oc(e,1),hc(e,2),ic(e),2===e.length?`atan(${tc(t,e[0])}, ${tc(t,e[1])})`:`atan(${tc(t,e[0])})`}},Yl[">"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} > ${tc(t,e[1])})`}},Yl[">="]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} >= ${tc(t,e[1])})`}},Yl["<"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} < ${tc(t,e[1])})`}},Yl["<="]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,2),ic(e),`(${tc(t,e[0])} <= ${tc(t,e[1])})`}},Yl["=="]=dc("=="),Yl["!="]=dc("!="),Yl["!"]={getReturnType:function(t){return $l},toGlsl:function(t,e){return rc(e,1),sc(e[0]),`(!${tc(t,e[0])})`}},Yl.all=pc("&&"),Yl.any=pc("||"),Yl.between={getReturnType:function(t){return $l},toGlsl:function(t,e){rc(e,3),ic(e);const i=tc(t,e[1]),n=tc(t,e[2]),s=tc(t,e[0]);return`(${s} >= ${i} && ${s} <= ${n})`}},Yl.array={getReturnType:function(t){return Bl},toGlsl:function(t,e){oc(e,2),hc(e,4),ic(e);const i=e.map((function(e){return tc(t,e,jl)}));return`vec${e.length}(${i.join(", ")})`}},Yl.color={getReturnType:function(t){return Ul},toGlsl:function(t,e){oc(e,3),hc(e,4),ic(e);const i=e;3===e.length&&i.push(1);const n=e.map((function(e,i){return tc(t,e,jl)+(i<3?" / 255.0":"")}));return`vec${e.length}(${n.join(", ")})`}},Yl.interpolate={getReturnType:function(t){let e=Ul|jl;for(let i=3;i<t.length;i+=2)e&=Zl(t[i]);return e},toGlsl:function(t,e,i){ac(e),oc(e,6);const n=e[0];let s;switch(n[0]){case"linear":s=1;break;case"exponential":s=n[1];break;default:s=null}if(!s)throw new Error(`Invalid interpolation type for "interpolate" operator, received: ${JSON.stringify(n)}`);i=void 0!==i?i:ql;const r=Yl.interpolate.getReturnType(e)&i;uc(e,r);const o=tc(t,e[1]),h=Wl(s);let a="";for(let i=2;i<e.length-2;i+=2){const n=tc(t,e[i]),s=a||tc(t,e[i+1],r),u=tc(t,e[i+2]);a=`mix(${s}, ${tc(t,e[i+3],r)}, pow(clamp((${o} - ${n}) / (${u} - ${n}), 0.0, 1.0), ${h}))`}return a}},Yl.match={getReturnType:function(t){let e=ql;for(let i=2;i<t.length;i+=2)e&=Zl(t[i]);return e&=Zl(t[t.length-1]),e},toGlsl:function(t,e,i){ac(e),oc(e,4),i=void 0!==i?i:ql;const n=Yl.match.getReturnType(e)&i;uc(e,n);const s=tc(t,e[0]),r=tc(t,e[e.length-1],n);let o=null;for(let i=e.length-3;i>=1;i-=2){o=`(${s} == ${tc(t,e[i])} ? ${tc(t,e[i+1],n)} : ${o||r})`}return o}},Yl.case={getReturnType:function(t){let e=ql;for(let i=1;i<t.length;i+=2)e&=Zl(t[i]);return e&=Zl(t[t.length-1]),e},toGlsl:function(t,e,i){!function(t){if(t.length%2==0)throw new Error(`An odd amount of arguments was expected, got ${t} instead`)}(e),oc(e,3),i=void 0!==i?i:ql;const n=Yl.case.getReturnType(e)&i;uc(e,n);for(let t=0;t<e.length-1;t+=2)sc(e[t]);const s=tc(t,e[e.length-1],n);let r=null;for(let i=e.length-3;i>=0;i-=2){r=`(${tc(t,e[i])} ? ${tc(t,e[i+1],n)} : ${r||s})`}return r}};class mc{constructor(){this.uniforms=[],this.attributes=[],this.varyings=[],this.sizeExpression="vec2(1.0)",this.rotationExpression="0.0",this.offsetExpression="vec2(0.0)",this.colorExpression="vec4(1.0)",this.texCoordExpression="vec4(0.0, 0.0, 1.0, 1.0)",this.discardExpression="false",this.rotateWithView=!1}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}setSizeExpression(t){return this.sizeExpression=t,this}setRotationExpression(t){return this.rotationExpression=t,this}setSymbolOffsetExpression(t){return this.offsetExpression=t,this}setColorExpression(t){return this.colorExpression=t,this}setTextureCoordinateExpression(t){return this.texCoordExpression=t,this}setFragmentDiscardExpression(t){return this.discardExpression=t,this}setSymbolRotateWithView(t){return this.rotateWithView=t,this}getSizeExpression(){return this.sizeExpression}getOffsetExpression(){return this.offsetExpression}getColorExpression(){return this.colorExpression}getTextureCoordinateExpression(){return this.texCoordExpression}getFragmentDiscardExpression(){return this.discardExpression}getSymbolVertexShader(t){const e=this.rotateWithView?"u_offsetScaleMatrix * u_offsetRotateMatrix":"u_offsetScaleMatrix";let i=this.attributes,n=this.varyings;return t&&(i=i.concat("vec4 a_hitColor"),n=n.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_offsetScaleMatrix;\nuniform mat4 u_offsetRotateMatrix;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nattribute vec2 a_position;\nattribute float a_index;\n${i.map((function(t){return"attribute "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${n.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n  mat4 offsetMatrix = ${e};\n  vec2 halfSize = ${this.sizeExpression} * 0.5;\n  vec2 offset = ${this.offsetExpression};\n  float angle = ${this.rotationExpression};\n  float offsetX;\n  float offsetY;\n  if (a_index == 0.0) {\n    offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n    offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n  } else if (a_index == 1.0) {\n    offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y - halfSize.y) * sin(angle);\n    offsetY = (offset.y - halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n  } else if (a_index == 2.0) {\n    offsetX = (offset.x + halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n    offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x + halfSize.x) * sin(angle);\n  } else {\n    offsetX = (offset.x - halfSize.x) * cos(angle) + (offset.y + halfSize.y) * sin(angle);\n    offsetY = (offset.y + halfSize.y) * cos(angle) - (offset.x - halfSize.x) * sin(angle);\n  }\n  vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n  gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\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  u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n  v = a_index == 2.0 || a_index == 3.0 ? 0.0 : 1.0;\n  v_quadCoord = vec2(u, v);\n${n.map((function(t){return"  "+t.name+" = "+t.expression+";"})).join("\n")}\n}`}getSymbolFragmentShader(t){const e=t?"  if (gl_FragColor.a < 0.1) { discard; } gl_FragColor = v_hitColor;":"";let i=this.varyings;return t&&(i=i.concat({name:"v_hitColor",type:"vec4",expression:"a_hitColor"})),`precision mediump float;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\n${this.uniforms.map((function(t){return"uniform "+t+";"})).join("\n")}\nvarying vec2 v_texCoord;\nvarying vec2 v_quadCoord;\n${i.map((function(t){return"varying "+t.type+" "+t.name+";"})).join("\n")}\nvoid main(void) {\n  if (${this.discardExpression}) { discard; }\n  gl_FragColor = ${this.colorExpression};\n  gl_FragColor.rgb *= gl_FragColor.a;\n${e}\n}`}}function vc(t){const e=t.symbol,i=void 0!==e.size?e.size:1,n=e.color||"white",s=e.textureCoord||[0,0,1,1],r=e.offset||[0,0],o=void 0!==e.opacity?e.opacity:1,h=void 0!==e.rotation?e.rotation:0,a={inFragmentShader:!1,variables:[],attributes:[],stringLiteralsMap:{},functions:{}},u=tc(a,i,Bl|jl),l=tc(a,r,Bl),c=tc(a,s,Bl),f=tc(a,h,jl),d={inFragmentShader:!0,variables:a.variables,attributes:[],stringLiteralsMap:a.stringLiteralsMap,functions:{}},p=tc(d,n,Ul),m=tc(d,o,jl);let v="1.0";const g=`vec2(${tc(d,i,Bl|jl)}).x`;switch(e.symbolType){case"square":case"image":break;case"circle":v=`(1.0-smoothstep(1.-4./${g},1.,dot(v_quadCoord-.5,v_quadCoord-.5)*4.))`;break;case"triangle":const t="(v_quadCoord*2.-1.)",i=`(atan(${t}.x,${t}.y))`;v=`(1.0-smoothstep(.5-3./${g},.5,cos(floor(.5+${i}/2.094395102)*2.094395102-${i})*length(${t})))`;break;default:throw new Error("Unexpected symbol type: "+e.symbolType)}const y=(new mc).setSizeExpression(`vec2(${u})`).setRotationExpression(f).setSymbolOffsetExpression(l).setTextureCoordinateExpression(c).setSymbolRotateWithView(!!e.rotateWithView).setColorExpression(`vec4(${p}.rgb, ${p}.a * ${m} * ${v})`);if(t.filter){const e=tc(d,t.filter,$l);y.setFragmentDiscardExpression(`!${e}`)}const w={};if(d.variables.forEach((function(e){const i=lc(e);y.addUniform(`float ${i}`),w[i]=function(){if(!t.variables||void 0===t.variables[e])throw new Error(`The following variable is missing from the style: ${e}`);let i=t.variables[e];return"string"==typeof i&&(i=Jl(a,i)),void 0!==i?i:-9999999}})),"image"===e.symbolType&&e.src){const t=new Image;t.crossOrigin=void 0===e.crossOrigin?"anonymous":e.crossOrigin,t.src=e.src,y.addUniform("sampler2D u_texture").setColorExpression(y.getColorExpression()+" * texture2D(u_texture, v_texCoord)"),w.u_texture=t}return d.attributes.forEach((function(t){a.attributes.includes(t)||a.attributes.push(t),y.addVarying(`v_${t}`,"float",`a_${t}`)})),a.attributes.forEach((function(t){y.addAttribute(`float a_${t}`)})),{builder:y,attributes:a.attributes.map((function(t){return{name:t,callback:function(e,i){let n=i[t];return"string"==typeof n&&(n=Jl(a,n)),void 0!==n?n:-9999999}}})),uniforms:w}}class gc extends eu{constructor(t){super({extent:t.extent,origin:t.origin,origins:t.origins,resolutions:t.resolutions,tileSize:t.tileSize,tileSizes:t.tileSizes,sizes:t.sizes}),this.rh=t.matrixIds}getMatrixId(t){return this.rh[t]}getMatrixIds(){return this.rh}}var yc=gc;function wc(t,e,i){const n=[],s=[],r=[],o=[],h=[];i=void 0!==i?i:[];const a=Yi(t.SupportedCRS),u=a.getMetersPerUnit(),l="ne"==a.getAxisOrientation().substr(0,2);return t.TileMatrix.sort((function(t,e){return e.ScaleDenominator-t.ScaleDenominator})),t.TileMatrix.forEach((function(e){let a;if(a=!(i.length>0)||i.find((function(i){return e.Identifier==i.TileMatrix||!e.Identifier.includes(":")&&t.Identifier+":"+e.Identifier===i.TileMatrix})),a){s.push(e.Identifier);const t=28e-5*e.ScaleDenominator/u,i=e.TileWidth,a=e.TileHeight;l?r.push([e.TopLeftCorner[1],e.TopLeftCorner[0]]):r.push(e.TopLeftCorner),n.push(t),o.push(i==a?i:[i,a]),h.push([e.MatrixWidth,e.MatrixHeight])}})),new gc({extent:e,origins:r,resolutions:n,matrixIds:s,tileSizes:o,sizes:h})}class xc{constructor(t){this.oh=t.opacity,this.hh=t.rotateWithView,this.Ji=t.rotation,this.ah=t.scale,this.uh=ia(t.scale),this.lh=t.displacement,this.fh=t.declutterMode}clone(){const t=this.getScale();return new xc({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.oh}getRotateWithView(){return this.hh}getRotation(){return this.Ji}getScale(){return this.ah}getScaleArray(){return this.uh}getDisplacement(){return this.lh}getDeclutterMode(){return this.fh}getAnchor(){return t()}getImage(e){return t()}getHitDetectionImage(){return t()}getPixelRatio(t){return 1}getImageState(){return t()}getImageSize(){return t()}getOrigin(){return t()}getSize(){return t()}setDisplacement(t){this.lh=t}setOpacity(t){this.oh=t}setRotateWithView(t){this.hh=t}setRotation(t){this.Ji=t}setScale(t){this.ah=t,this.uh=ia(t)}listenImageChange(e){t()}load(){t()}unlistenImageChange(e){t()}}var bc=xc;class Mc extends bc{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.$t=void 0,this.dh=null,this.ph=void 0!==t.fill?t.fill:null,this.Pr=[0,0],this.Wt=t.points,this.mh=void 0!==t.radius?t.radius:t.radius1,this.gh=t.radius2,this.Ht=void 0!==t.angle?t.angle:0,this.yh=void 0!==t.stroke?t.stroke:null,this.V=null,this.wh=null,this.render()}clone(){const t=this.getScale(),e=new Mc({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.V;if(!t)return null;const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.Ht}getFill(){return this.ph}setFill(t){this.ph=t,this.render()}getHitDetectionImage(){return this.dh||this.xh(this.wh),this.dh}getImage(t){let e=this.$t[t];if(!e){const i=this.wh,n=Ys(i.size*t,i.size*t);this.bh(i,n,t),e=n.canvas,this.$t[t]=e}return e}getPixelRatio(t){return t}getImageSize(){return this.V}getImageState(){return Ds}getOrigin(){return this.Pr}getPoints(){return this.Wt}getRadius(){return this.mh}getRadius2(){return this.gh}getSize(){return this.V}getStroke(){return this.yh}setStroke(t){this.yh=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}Mh(t,e,i){if(0===e||this.Wt===1/0||"bevel"!==t&&"miter"!==t)return e;let n=this.mh,s=void 0===this.gh?n:this.gh;if(n<s){const t=n;n=s,s=t}const r=void 0===this.gh?this.Wt:2*this.Wt,o=2*Math.PI/r,h=s*Math.sin(o),a=n-Math.sqrt(s*s-h*h),u=Math.sqrt(h*h+a*a),l=u/h;if("miter"===t&&l<=i)return l*e;const c=e/2/l,f=e/2*(a/u),d=Math.sqrt((n+c)*(n+c)+f*f)-n;if(void 0===this.gh||"bevel"===t)return 2*d;const p=n*Math.sin(o),m=s-Math.sqrt(n*n-p*p),v=Math.sqrt(p*p+m*m)/p;if(v<=i){const t=v*e/2-s-n;return 2*Math.max(d,t)}return 2*d}createRenderOptions(){let t,e=Wr,i=0,n=null,s=0,r=0;this.yh&&(t=this.yh.getColor(),null===t&&(t=Kr),t=Ta(t),r=this.yh.getWidth(),void 0===r&&(r=1),n=this.yh.getLineDash(),s=this.yh.getLineDashOffset(),e=this.yh.getLineJoin(),void 0===e&&(e=Wr),i=this.yh.getMiterLimit(),void 0===i&&(i=Hr));const o=this.Mh(e,r,i),h=Math.max(this.mh,this.gh||0);return{strokeStyle:t,strokeWidth:r,size:Math.ceil(2*h+o),lineDash:n,lineDashOffset:s,lineJoin:e,miterLimit:i}}render(){this.wh=this.createRenderOptions();const t=this.wh.size;this.$t={},this.V=[t,t]}bh(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.Sh(e),this.ph){let t=this.ph.getColor();null===t&&(t=Yr),e.fillStyle=Ta(t),e.fill()}this.yh&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}xh(t){if(this.ph){let e=this.ph.getColor(),i=0;if("string"==typeof e&&(e=hr(e)),null===e?i=1:Array.isArray(e)&&(i=4===e.length?e[3]:1),0===i){const e=Ys(t.size,t.size);this.dh=e.canvas,this.Ph(t,e)}}this.dh||(this.dh=this.getImage(1))}Sh(t){let e=this.Wt;const i=this.mh;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const n=void 0===this.gh?i:this.gh;void 0!==this.gh&&(e*=2);const s=this.Ht-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=s+o*r,h=o%2==0?i:n;t.lineTo(h*Math.cos(e),h*Math.sin(e))}t.closePath()}}Ph(t,e){e.translate(t.size/2,t.size/2),this.Sh(e),e.fillStyle=Yr,e.fill(),this.yh&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}}var Sc=Mc;class Pc extends Sc{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new Pc({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}setRadius(t){this.mh=t,this.render()}}var _c=Pc;class Ec{constructor(t){t=t||{},this._h=void 0!==t.color?t.color:null}clone(){const t=this.getColor();return new Ec({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this._h}setColor(t){this._h=t}}var Tc=Ec;let Cc=null;class Fc extends E{constructor(t,e,i,n,s,r){super(),this.Eh=null,this.Ot=t,this.qt=n,this.$t={},this._h=r,this.zt=null,this.Th=s,this.V=i,this.Nt=e,this.Ch}Fh(){this.Ot=new Image,null!==this.qt&&(this.Ot.crossOrigin=this.qt)}Ih(){if(void 0===this.Ch&&this.Th===Ds){Cc||(Cc=Ys(1,1)),Cc.drawImage(this.Ot,0,0);try{Cc.getImageData(0,0,1,1),this.Ch=!1}catch(t){Cc=null,this.Ch=!0}}return!0===this.Ch}Ah(){this.dispatchEvent(T)}jt(){this.Th=Us,this.Dt(),this.Ah()}Ut(){this.Th=Ds,this.V?(this.Ot.width=this.V[0],this.Ot.height=this.V[1]):this.V=[this.Ot.width,this.Ot.height],this.Dt(),this.Ah()}getImage(t){return this.Ot||this.Fh(),this.kh(t),this.$t[t]?this.$t[t]:this.Ot}getPixelRatio(t){return this.kh(t),this.$t[t]?t:1}getImageState(){return this.Th}getHitDetectionImage(){if(this.Ot||this.Fh(),!this.Eh)if(this.Ih()){const t=this.V[0],e=this.V[1],i=Ys(t,e);i.fillRect(0,0,t,e),this.Eh=i.canvas}else this.Eh=this.Ot;return this.Eh}getSize(){return this.V}getSrc(){return this.Nt}load(){if(this.Th===Gs){this.Ot||this.Fh(),this.Th=js;try{this.Ot.src=this.Nt}catch(t){this.jt()}this.zt=Bs(this.Ot,this.Ut.bind(this),this.jt.bind(this))}}kh(t){if(!this._h||this.$t[t]||this.Th!==Ds)return;const e=this.Ot,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=sr(this._h),n.fillRect(0,0,i.width/t,i.height/t),n.globalCompositeOperation="destination-in",n.drawImage(e,0,0),this.$t[t]=i}Dt(){this.zt&&(this.zt(),this.zt=null)}}function Ic(t,e,i,n,s,r){let o=pr.get(e,n,r);return o||(o=new Fc(t,e,i,n,s,r),pr.set(e,n,r,o)),o}var Ac=Fc;class kc extends bc{constructor(t){const e=void 0!==(t=t||{}).opacity?t.opacity:1,n=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,r=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:n,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:r,declutterMode:t.declutterMode}),this.zn=void 0!==t.anchor?t.anchor:[.5,.5],this.Rh=null,this.Lh=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.Nh=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.Oh=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.qt=void 0!==t.crossOrigin?t.crossOrigin:null;const o=void 0!==t.img?t.img:null;this.zh=t.imgSize;let h=t.src;ct(!(void 0!==h&&o),4),ct(!o||o&&this.zh,5),void 0!==h&&0!==h.length||!o||(h=o.src||i(o)),ct(void 0!==h&&h.length>0,6);const a=void 0!==t.src?Gs:Ds;this._h=void 0!==t.color?hr(t.color):null,this.Gh=Ic(o,h,void 0!==this.zh?this.zh:null,this.qt,a,this._h),this.jh=void 0!==t.offset?t.offset:[0,0],this.Dh=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.Pr=null,this.V=void 0!==t.size?t.size:null}clone(){const t=this.getScale();return new kc({anchor:this.zn.slice(),anchorOrigin:this.Lh,anchorXUnits:this.Nh,anchorYUnits:this.Oh,color:this._h&&this._h.slice?this._h.slice():this._h||void 0,crossOrigin:this.qt,imgSize:this.zh,offset:this.jh.slice(),offsetOrigin:this.Dh,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:Array.isArray(t)?t.slice():t,size:null!==this.V?this.V.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.Rh;if(!t){t=this.zn;const e=this.getSize();if("fraction"==this.Nh||"fraction"==this.Oh){if(!e)return null;t=this.zn.slice(),"fraction"==this.Nh&&(t[0]*=e[0]),"fraction"==this.Oh&&(t[1]*=e[1])}if("top-left"!=this.Lh){if(!e)return null;t===this.zn&&(t=this.zn.slice()),"top-right"!=this.Lh&&"bottom-right"!=this.Lh||(t[0]=-t[0]+e[0]),"bottom-left"!=this.Lh&&"bottom-right"!=this.Lh||(t[1]=-t[1]+e[1])}this.Rh=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.zn=t,this.Rh=null}getColor(){return this._h}getImage(t){return this.Gh.getImage(t)}getPixelRatio(t){return this.Gh.getPixelRatio(t)}getImageSize(){return this.Gh.getSize()}getImageState(){return this.Gh.getImageState()}getHitDetectionImage(){return this.Gh.getHitDetectionImage()}getOrigin(){if(this.Pr)return this.Pr;let t=this.jh;if("top-left"!=this.Dh){const e=this.getSize(),i=this.Gh.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.Dh&&"bottom-right"!=this.Dh||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.Dh&&"bottom-right"!=this.Dh||(t[1]=i[1]-e[1]-t[1])}return this.Pr=t,this.Pr}getSrc(){return this.Gh.getSrc()}getSize(){return this.V?this.V:this.Gh.getSize()}listenImageChange(t){this.Gh.addEventListener(T,t)}load(){this.Gh.load()}unlistenImageChange(t){this.Gh.removeEventListener(T,t)}}var Rc=kc;class Lc{constructor(t){t=t||{},this._h=void 0!==t.color?t.color:null,this.Uh=t.lineCap,this.$h=void 0!==t.lineDash?t.lineDash:null,this.Bh=t.lineDashOffset,this.qh=t.lineJoin,this.Xh=t.miterLimit,this.Yh=t.width}clone(){const t=this.getColor();return new Lc({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})}getColor(){return this._h}getLineCap(){return this.Uh}getLineDash(){return this.$h}getLineDashOffset(){return this.Bh}getLineJoin(){return this.qh}getMiterLimit(){return this.Xh}getWidth(){return this.Yh}setColor(t){this._h=t}setLineCap(t){this.Uh=t}setLineDash(t){this.$h=t}setLineDashOffset(t){this.Bh=t}setLineJoin(t){this.qh=t}setMiterLimit(t){this.Xh=t}setWidth(t){this.Yh=t}}var Nc=Lc;class Oc{constructor(t){t=t||{},this.dn=null,this.Zh=Uc,void 0!==t.geometry&&this.setGeometry(t.geometry),this.ph=void 0!==t.fill?t.fill:null,this.Ot=void 0!==t.image?t.image:null,this.he=void 0!==t.renderer?t.renderer:null,this.Vh=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.yh=void 0!==t.stroke?t.stroke:null,this.nr=void 0!==t.text?t.text:null,this.Wh=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"==typeof t&&(t=t.clone()),new Oc({geometry:t,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer(),stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.he}setRenderer(t){this.he=t}setHitDetectionRenderer(t){this.Vh=t}getHitDetectionRenderer(){return this.Vh}getGeometry(){return this.dn}getGeometryFunction(){return this.Zh}getFill(){return this.ph}setFill(t){this.ph=t}getImage(){return this.Ot}setImage(t){this.Ot=t}getStroke(){return this.yh}setStroke(t){this.yh=t}getText(){return this.nr}setText(t){this.nr=t}getZIndex(){return this.Wh}setGeometry(t){"function"==typeof t?this.Zh=t:"string"==typeof t?this.Zh=function(e){return e.get(t)}:t?void 0!==t&&(this.Zh=function(){return t}):this.Zh=Uc,this.dn=t}setZIndex(t){this.Wh=t}}function zc(t){let e;if("function"==typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{ct("function"==typeof t.getZIndex,41);i=[t]}e=function(){return i}}return e}let Gc=null;function jc(t,e){if(!Gc){const t=new Tc({color:"rgba(255,255,255,0.4)"}),e=new Nc({color:"#3399CC",width:1.25});Gc=[new Oc({image:new _c({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return Gc}function Dc(){const t={},e=[255,255,255,1],i=[0,153,255,1];return t.Polygon=[new Oc({fill:new Tc({color:[255,255,255,.5]})})],t.MultiPolygon=t.Polygon,t.LineString=[new Oc({stroke:new Nc({color:e,width:5})}),new Oc({stroke:new Nc({color:i,width:3})})],t.MultiLineString=t.LineString,t.Circle=t.Polygon.concat(t.LineString),t.Point=[new Oc({image:new _c({radius:6,fill:new Tc({color:i}),stroke:new Nc({color:e,width:1.5})}),zIndex:1/0})],t.MultiPoint=t.Point,t.GeometryCollection=t.Polygon.concat(t.LineString,t.Point),t}function Uc(t){return t.getGeometry()}var $c=Oc;class Bc{constructor(t){t=t||{},this.Hh=t.font,this.Ji=t.rotation,this.hh=t.rotateWithView,this.ah=t.scale,this.uh=ia(void 0!==t.scale?t.scale:1),this.nr=t.text,this.Kh=t.textAlign,this.Jh=t.justify,this.Qh=t.textBaseline,this.ph=void 0!==t.fill?t.fill:new Tc({color:"#333"}),this.ta=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.ea=void 0!==t.placement?t.placement:"point",this.ia=!!t.overflow,this.yh=void 0!==t.stroke?t.stroke:null,this.na=void 0!==t.offsetX?t.offsetX:0,this.sa=void 0!==t.offsetY?t.offsetY:0,this.ra=t.backgroundFill?t.backgroundFill:null,this.oa=t.backgroundStroke?t.backgroundStroke:null,this.Ti=void 0===t.padding?null:t.padding}clone(){const t=this.getScale();return new Bc({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0})}getOverflow(){return this.ia}getFont(){return this.Hh}getMaxAngle(){return this.ta}getPlacement(){return this.ea}getOffsetX(){return this.na}getOffsetY(){return this.sa}getFill(){return this.ph}getRotateWithView(){return this.hh}getRotation(){return this.Ji}getScale(){return this.ah}getScaleArray(){return this.uh}getStroke(){return this.yh}getText(){return this.nr}getTextAlign(){return this.Kh}getJustify(){return this.Jh}getTextBaseline(){return this.Qh}getBackgroundFill(){return this.ra}getBackgroundStroke(){return this.oa}getPadding(){return this.Ti}setOverflow(t){this.ia=t}setFont(t){this.Hh=t}setMaxAngle(t){this.ta=t}setOffsetX(t){this.na=t}setOffsetY(t){this.sa=t}setPlacement(t){this.ea=t}setRotateWithView(t){this.hh=t}setFill(t){this.ph=t}setRotation(t){this.Ji=t}setScale(t){this.ah=t,this.uh=ia(void 0!==t?t:1)}setStroke(t){this.yh=t}setText(t){this.nr=t}setTextAlign(t){this.Kh=t}setJustify(t){this.Jh=t}setTextBaseline(t){this.Qh=t}setBackgroundFill(t){this.ra=t}setBackgroundStroke(t){this.oa=t}setPadding(t){this.Ti=t}}var qc=Bc;function Xc(t){return new $c({fill:Yc(t,""),stroke:Zc(t,""),text:Vc(t),image:Wc(t)})}function Yc(t,e){const i=t[e+"fill-color"];if(i)return new Tc({color:i})}function Zc(t,e){const i=t[e+"stroke-width"],n=t[e+"stroke-color"];if(i||n)return new Nc({width:i,color:n,lineCap:t[e+"stroke-line-cap"],lineJoin:t[e+"stroke-line-join"],lineDash:t[e+"stroke-line-dash"],lineDashOffset:t[e+"stroke-line-dash-offset"],miterLimit:t[e+"stroke-miter-limit"]})}function Vc(t){const e=t["text-value"];if(!e)return;return new qc({text:e,font:t["text-font"],maxAngle:t["text-max-angle"],offsetX:t["text-offset-x"],offsetY:t["text-offset-y"],overflow:t["text-overflow"],placement:t["text-placement"],scale:t["text-scale"],rotateWithView:t["text-rotate-with-view"],rotation:t["text-rotation"],textAlign:t["text-align"],justify:t["text-justify"],textBaseline:t["text-baseline"],padding:t["text-padding"],fill:Yc(t,"text-"),backgroundFill:Yc(t,"text-background-"),stroke:Zc(t,"text-"),backgroundStroke:Zc(t,"text-background-")})}function Wc(t){const e=t["icon-src"],i=t["icon-img"];if(e||i){return new Rc({src:e,img:i,imgSize:t["icon-img-size"],anchor:t["icon-anchor"],anchorOrigin:t["icon-anchor-origin"],anchorXUnits:t["icon-anchor-x-units"],anchorYUnits:t["icon-anchor-y-units"],color:t["icon-color"],crossOrigin:t["icon-cross-origin"],offset:t["icon-offset"],displacement:t["icon-displacement"],opacity:t["icon-opacity"],scale:t["icon-scale"],rotation:t["icon-rotation"],rotateWithView:t["icon-rotate-with-view"],size:t["icon-size"],declutterMode:t["icon-declutter-mode"]})}const n=t["shape-points"];if(n){const e="shape-";return new Sc({points:n,fill:Yc(t,e),stroke:Zc(t,e),radius:t["shape-radius"],radius1:t["shape-radius1"],radius2:t["shape-radius2"],angle:t["shape-angle"],displacement:t["shape-displacement"],rotation:t["shape-rotation"],rotateWithView:t["shape-rotate-with-view"],scale:t["shape-scale"],declutterMode:t["shape-declutter-mode"]})}const s=t["circle-radius"];if(s){const e="circle-";return new _c({radius:s,fill:Yc(t,e),stroke:Zc(t,e),displacement:t["circle-displacement"],scale:t["circle-scale"],rotation:t["circle-rotation"],rotateWithView:t["circle-rotate-with-view"],declutterMode:t["circle-declutter-mode"]})}}var Hc=class{constructor(t){this.ha,this.aa,this.ua,this.la=void 0===t||t,this.ca=0}insertItem(t){const e={prev:void 0,next:void 0,data:t},i=this.ua;if(i){const t=i.next;e.prev=i,e.next=t,i.next=e,t&&(t.prev=e),i===this.aa&&(this.aa=e)}else this.ha=e,this.aa=e,this.la&&(e.next=e,e.prev=e);this.ua=e,this.ca++}removeItem(){const t=this.ua;if(t){const e=t.next,i=t.prev;e&&(e.prev=i),i&&(i.next=e),this.ua=e||i,this.ha===this.aa?(this.ua=void 0,this.ha=void 0,this.aa=void 0):this.ha===t?this.ha=this.ua:this.aa===t&&(this.aa=i?this.ua.prev:this.ua),this.ca--}}firstItem(){if(this.ua=this.ha,this.ua)return this.ua.data}lastItem(){if(this.ua=this.aa,this.ua)return this.ua.data}nextItem(){if(this.ua&&this.ua.next)return this.ua=this.ua.next,this.ua.data}getNextItem(){if(this.ua&&this.ua.next)return this.ua.next.data}prevItem(){if(this.ua&&this.ua.prev)return this.ua=this.ua.prev,this.ua.data}getPrevItem(){if(this.ua&&this.ua.prev)return this.ua.prev.data}getCurrItem(){if(this.ua)return this.ua.data}setFirstItem(){this.la&&this.ua&&(this.ha=this.ua,this.aa=this.ua.prev)}concat(t){if(t.ua){if(this.ua){const e=this.ua.next;this.ua.next=t.ha,t.ha.prev=this.ua,e.prev=t.aa,t.aa.next=e,this.ca+=t.ca}else this.ua=t.ua,this.ha=t.ha,this.aa=t.aa,this.ca=t.ca;t.ua=void 0,t.ha=void 0,t.aa=void 0,t.ca=0}}getLength(){return this.ca}},Kc=n(582);var Jc=class{constructor(t){this.fa=new Kc(t),this.da={}}insert(t,e){const n={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.fa.insert(n),this.da[i(e)]=n}load(t,e){const n=new Array(e.length);for(let s=0,r=e.length;s<r;s++){const r=t[s],o=e[s],h={minX:r[0],minY:r[1],maxX:r[2],maxY:r[3],value:o};n[s]=h,this.da[i(o)]=h}this.fa.load(n)}remove(t){const e=i(t),n=this.da[e];return delete this.da[e],null!==this.fa.remove(n)}update(t,e){const n=this.da[i(e)];oe([n.minX,n.minY,n.maxX,n.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.fa.all().map((function(t){return t.value}))}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.fa.search(e).map((function(t){return t.value}))}forEach(t){return this.pa(this.getAll(),t)}forEachInExtent(t,e){return this.pa(this.getInExtent(t),e)}pa(t,e){let i;for(let n=0,s=t.length;n<s;n++)if(i=e(t[n]),i)return i;return i}isEmpty(){return _(this.da)}clear(){this.fa.clear(),this.da={}}getExtent(t){const e=this.fa.toJSON();return ie(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.fa.load(t.fa.all());for(const e in t.da)this.da[e]=t.da[e]}},Qc="tileloadstart",tf="tileloadend",ef="tileloaderror";function nf(t){return t?Array.isArray(t)?function(e){return t}:"function"==typeof t?t:function(e){return[t]}:null}var sf=class extends V{constructor(t){super(),this.projection=Yi(t.projection),this.ma=nf(t.attributions),this.va=void 0===t.attributionsCollapsible||t.attributionsCollapsible,this.loading=!1,this.ne=void 0!==t.state?t.state:"ready",this.ga=void 0!==t.wrapX&&t.wrapX,this.ya=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.wa=new Promise((function(t,i){e.viewResolver=t,e.viewRejector=i}))}getAttributions(){return this.ma}getAttributionsCollapsible(){return this.va}getProjection(){return this.projection}getResolutions(){return t()}getView(){return this.wa}getState(){return this.ne}getWrapX(){return this.ga}getInterpolate(){return this.ya}refresh(){this.changed()}setAttributions(t){this.ma=nf(t),this.changed()}setState(t){this.ne=t,this.changed()}};class rf extends u{constructor(t,e){super(t),this.tile=e}}var of=class extends sf{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.xa=void 0!==t.opaque&&t.opaque,this.ba=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&ia(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tileCache=new xa(t.cacheSize||0),this.tmpSize=[0,0],this.Rs=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 s=this.getTileCacheForProjection(t);if(!s)return!1;let r,o,h,a=!0;for(let t=i.minX;t<=i.maxX;++t)for(let u=i.minY;u<=i.maxY;++u)o=pa(e,t,u),h=!1,s.containsKey(o)&&(r=s.get(o),h=r.getState()===it,h&&(h=!1!==n(r))),h||(a=!1);return a}getGutterForProjection(t){return 0}getKey(){return this.Rs}setKey(t){this.Rs!==t&&(this.Rs=t,this.changed())}getOpaque(t){return this.xa}getResolutions(){return this.tileGrid?this.tileGrid.getResolutions():null}getTile(e,i,n,s,r){return t()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:iu(t)}getTileCacheForProjection(t){const e=this.getProjection();return ct(null===e||tn(e,t),68),this.tileCache}getTilePixelRatio(t){return this.ba}getTilePixelSize(t,e,i){const n=this.getTileGridForProjection(i),s=this.getTilePixelRatio(e),r=ia(n.getTileSize(t),this.tmpSize);return 1==s?r:ea(r,s,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){e=void 0!==e?e:this.getProjection();const i=this.getTileGridForProjection(e);return this.getWrapX()&&e.isGlobal()&&(t=nu(i,t,e)),wa(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 hf extends of{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.Ma=this.tileUrlFunction===hf.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.Sa={}}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,n=i(e),s=e.getState();let r;s==et?(this.Sa[n]=!0,r=Qc):n in this.Sa&&(delete this.Sa[n],r=s==nt?ef:s==it?tf:void 0),null!=r&&this.dispatchEvent(new rf(r,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=du(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.Ma?this.setTileUrlFunction(lu(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}useTile(t,e,i){const n=pa(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}}var af=hf;function uf(t,e){t.getImage().src=e}var lf=class extends af{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:uf,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:tr,this.tileCacheForProjection={},this.tileGridForProjection={},this.Pa=t.reprojectionErrorThreshold,this._a=!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&&!tn(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&&!tn(this.getProjection(),t))&&super.getOpaque(t)}getTileGridForProjection(t){const e=this.getProjection();if(!this.tileGrid||e&&!tn(e,t)){const e=i(t);return e in this.tileGridForProjection||(this.tileGridForProjection[e]=iu(t)),this.tileGridForProjection[e]}return this.tileGrid}getTileCacheForProjection(t){const e=this.getProjection();if(!e||tn(e,t))return this.tileCache;{const e=i(t);return e in this.tileCacheForProjection||(this.tileCacheForProjection[e]=new xa(this.tileCache.highWaterMark)),this.tileCacheForProjection[e]}}Ea(t,e,i,n,s,r){const o=[t,e,i],h=this.getTileCoordForTileUrlFunction(o,s),a=h?this.tileUrlFunction(h,n,s):void 0,u=new this.tileClass(o,void 0!==a?tt:st,void 0!==a?a:"",this.crossOrigin,this.tileLoadFunction,this.tileOptions);return u.key=r,u.addEventListener(T,this.handleTileChange.bind(this)),u}getTile(t,e,i,n,s){const r=this.getProjection();if(r&&s&&!tn(r,s)){const o=this.getTileCacheForProjection(s),h=[t,e,i];let a;const u=ma(h);o.containsKey(u)&&(a=o.get(u));const l=this.getKey();if(a&&a.key==l)return a;{const t=this.getTileGridForProjection(r),e=this.getTileGridForProjection(s),i=this.getTileCoordForTileUrlFunction(h,s),c=new Ml(r,t,s,e,h,i,this.getTilePixelRatio(n),this.getGutter(),function(t,e,i,n){return this.getTileInternal(t,e,i,n,r)}.bind(this),this.Pa,this._a,this.getInterpolate());return c.key=l,a?(c.interimTile=a,c.refreshInterimChain(),o.replace(u,c)):o.set(u,c),c}}return this.getTileInternal(t,e,i,n,r||s)}getTileInternal(t,e,i,n,s){let r=null;const o=pa(t,e,i),h=this.getKey();if(this.tileCache.containsKey(o)){if(r=this.tileCache.get(o),r.key!=h){const a=r;r=this.Ea(t,e,i,n,s,h),a.getState()==tt?r.interimTile=a.interimTile:r.interimTile=a,r.refreshInterimChain(),this.tileCache.replace(o,r)}}else r=this.Ea(t,e,i,n,s,h),this.tileCache.set(o,r);return r}setRenderReprojectionEdges(t){if(this._a!=t){this._a=t;for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear();this.changed()}}setTileGridForProjection(t,e){const n=Yi(t);if(n){const t=i(n);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}clear(){super.clear();for(const t in this.tileCacheForProjection)this.tileCacheForProjection[t].clear()}};function cf(t){const e=t[0],i=new Array(e);let n,s,r=1<<e-1;for(n=0;n<e;++n)s=48,t[1]&r&&(s+=1),t[2]&r&&(s+=2),i[n]=String.fromCharCode(s),r>>=1;return i.join("")}var ff=class extends lf{constructor(t){const e=void 0!==t.hidpi&&t.hidpi;super({cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,opaque:!0,projection:Yi("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.Ta=e,this.Ca=void 0!==t.culture?t.culture:"en-us",this.Fa=void 0!==t.maxZoom?t.maxZoom:-1,this.Ia=t.key,this.Aa=t.imagerySet;Ra("https://dev.virtualearth.net/REST/v1/Imagery/Metadata/"+this.Aa+"?uriScheme=https&include=ImageryProviders&key="+this.Ia+"&c="+this.Ca,this.handleImageryMetadataResponse.bind(this),void 0,"jsonp")}getApiKey(){return this.Ia}getImagerySet(){return this.Aa}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.Fa?e.zoomMax:this.Fa,n=au(this.getProjection()),s=this.Ta?2:1,r=e.imageWidth==e.imageHeight?e.imageWidth/s:[e.imageWidth/s,e.imageHeight/s],o=ru({extent:n,minZoom:e.zoomMin,maxZoom:i,tileSize:r});this.tileGrid=o;const h=this.Ca,a=this.Ta;if(this.tileUrlFunction=cu(e.imageUrlSubdomains.map((function(t){const i=[0,0,0],n=e.imageUrl.replace("{subdomain}",t).replace("{culture}",h);return function(t,e,s){if(t){da(t[0],t[1],t[2],i);let e=n;return a&&(e+="&dpi=d1&device=mobile"),e.replace("{quadkey}",cf(i))}}}))),e.imageryProviders){const t=en(Yi("EPSG:4326"),this.getProjection());this.setAttributions(function(i){const n=[],s=i.viewState,r=this.getTileGrid(),o=r.getZForResolution(s.resolution,this.zDirection),h=r.getTileCoordForCoordAndZ(s.center,o)[0];return e.imageryProviders.map((function(e){let s=!1;const r=e.coverageAreas;for(let e=0,n=r.length;e<n;++e){const n=r[e];if(h>=n.zoomMin&&h<=n.zoomMax){const e=n.bbox;if(Te(ke([e[1],e[0],e[3],e[2]],t),i.extent)){s=!0;break}}}s&&n.push(e.attribution)})),n.push('<a class="ol-attribution-bing-tos" href="https://www.microsoft.com/maps/product/terms.html" target="_blank">Terms of Use</a>'),n}.bind(this))}this.setState("ready")}};var df=class extends lf{constructor(t){const e=void 0!==(t=t||{}).projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:ru({extent:au(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,opaque:t.opaque,projection:e,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.To=void 0!==t.gutter?t.gutter:0}getGutter(){return this.To}};var pf=class extends df{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,maxZoom:void 0!==t.maxZoom?t.maxZoom:18,minZoom:t.minZoom,projection:t.projection,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection}),this.ka=t.account,this.Ra=t.map||"",this.La=t.config||{},this.Na={},this.Oa()}getConfig(){return this.La}updateConfig(t){Object.assign(this.La,t),this.Oa()}setConfig(t){this.La=t||{},this.Oa()}Oa(){const t=JSON.stringify(this.La);if(this.Na[t])return void this.za(this.Na[t]);let e="https://"+this.ka+".carto.com/api/v1/map";this.Ra&&(e+="/named/"+this.Ra);const i=new XMLHttpRequest;i.addEventListener("load",this.Ga.bind(this,t)),i.addEventListener("error",this.ja.bind(this)),i.open("POST",e),i.setRequestHeader("Content-type","application/json"),i.send(JSON.stringify(this.La))}Ga(t,e){const i=e.target;if(!i.status||i.status>=200&&i.status<300){let e;try{e=JSON.parse(i.responseText)}catch(t){return void this.setState("error")}this.za(e),this.Na[t]=e,this.setState("ready")}else this.setState("error")}ja(t){this.setState("error")}za(t){const e="https://"+t.cdn_url.https+"/"+this.ka+"/api/v1/map/"+t.layergroupid+"/{z}/{x}/{y}.png";this.setUrl(e)}},mf="addfeature",vf="changefeature",gf="clear",yf="removefeature",wf="featuresloadstart",xf="featuresloadend",bf="featuresloaderror";class Mf extends u{constructor(t,e,i){super(t),this.feature=e,this.features=i}}var Sf=class extends sf{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.$=b,this.Os=t.format,this.Da=void 0===t.overlaps||t.overlaps,this.Gs=t.url,void 0!==t.loader?this.$=t.loader:void 0!==this.Gs&&(ct(this.Os,7),this.$=Aa(this.Gs,this.Os)),this.Ua=void 0!==t.strategy?t.strategy:ka;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,n;this.$a=e?new Jc:null,this.Ba=new Jc,this.qa=0,this.Xa={},this.Ya={},this.Za={},this.Va={},this.Wa=null,Array.isArray(t.features)?n=t.features:t.features&&(i=t.features,n=i.getArray()),e||void 0!==i||(i=new Q(n)),void 0!==n&&this.addFeaturesInternal(n),void 0!==i&&this.Ha(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=i(t);if(!this.Ka(e,t))return void(this.Wa&&this.Wa.remove(t));this.Ja(e,t);const n=t.getGeometry();if(n){const e=n.getExtent();this.$a&&this.$a.insert(e,t)}else this.Xa[e]=t;this.dispatchEvent(new Mf(mf,t))}Ja(t,e){this.Va[t]=[U(e,T,this.Qa,this),U(e,l,this.Qa,this)]}Ka(t,e){let i=!0;const n=e.getId();return void 0!==n&&(n.toString()in this.Ya?i=!1:this.Ya[n.toString()]=e),i&&(ct(!(t in this.Za),30),this.Za[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],n=[],s=[];for(let e=0,s=t.length;e<s;e++){const s=t[e],r=i(s);this.Ka(r,s)&&n.push(s)}for(let t=0,r=n.length;t<r;t++){const r=n[t],o=i(r);this.Ja(o,r);const h=r.getGeometry();if(h){const t=h.getExtent();e.push(t),s.push(r)}else this.Xa[o]=r}if(this.$a&&this.$a.load(e,s),this.hasListener(mf))for(let t=0,e=n.length;t<e;t++)this.dispatchEvent(new Mf(mf,n[t]))}Ha(t){let e=!1;this.addEventListener(mf,(function(i){e||(e=!0,t.push(i.feature),e=!1)})),this.addEventListener(yf,(function(i){e||(e=!0,t.remove(i.feature),e=!1)})),t.addEventListener(W,function(t){e||(e=!0,this.addFeature(t.element),e=!1)}.bind(this)),t.addEventListener(H,function(t){e||(e=!0,this.removeFeature(t.element),e=!1)}.bind(this)),this.Wa=t}clear(t){if(t){for(const t in this.Va){this.Va[t].forEach(B)}this.Wa||(this.Va={},this.Ya={},this.Za={})}else if(this.$a){const t=function(t){this.removeFeatureInternal(t)}.bind(this);this.$a.forEach(t);for(const t in this.Xa)this.removeFeatureInternal(this.Xa[t])}this.Wa&&this.Wa.clear(),this.$a&&this.$a.clear(),this.Xa={};const e=new Mf(gf);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.$a)return this.$a.forEach(t);this.Wa&&this.Wa.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,(function(i){return i.getGeometry().intersectsCoordinate(t)?e(i):void 0}))}forEachFeatureInExtent(t,e){if(this.$a)return this.$a.forEachInExtent(t,e);this.Wa&&this.Wa.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,(function(i){if(i.getGeometry().intersectsExtent(t)){const t=e(i);if(t)return t}}))}getFeaturesCollection(){return this.Wa}getFeatures(){let t;return this.Wa?t=this.Wa.getArray().slice(0):this.$a&&(t=this.$a.getAll(),_(this.Xa)||v(t,Object.values(this.Xa))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,(function(t){e.push(t)})),e}getFeaturesInExtent(t,e){if(this.$a){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.$a.getInExtent(t);const i=Le(t,e);return[].concat(...i.map((t=>this.$a.getInExtent(t))))}return this.Wa?this.Wa.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],n=t[1];let s=null;const r=[NaN,NaN];let o=1/0;const h=[-1/0,-1/0,1/0,1/0];return e=e||w,this.$a.forEachInExtent(h,(function(t){if(e(t)){const e=t.getGeometry(),a=o;if(o=e.closestPointXY(i,n,r,o),o<a){s=t;const e=Math.sqrt(o);h[0]=i-e,h[1]=n-e,h[2]=i+e,h[3]=n+e}}})),s}getExtent(t){return this.$a.getExtent(t)}getFeatureById(t){const e=this.Ya[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.Za[t];return void 0!==e?e:null}getFormat(){return this.Os}getOverlaps(){return this.Da}getUrl(){return this.Gs}Qa(t){const e=t.target,n=i(e),s=e.getGeometry();if(s){const t=s.getExtent();n in this.Xa?(delete this.Xa[n],this.$a&&this.$a.insert(t,e)):this.$a&&this.$a.update(t,e)}else n in this.Xa||(this.$a&&this.$a.remove(e),this.Xa[n]=e);const r=e.getId();if(void 0!==r){const t=r.toString();this.Ya[t]!==e&&(this.tu(e),this.Ya[t]=e)}else this.tu(e),this.Za[n]=e;this.changed(),this.dispatchEvent(new Mf(vf,e))}hasFeature(t){const e=t.getId();return void 0!==e?e in this.Ya:i(t)in this.Za}isEmpty(){return this.$a?this.$a.isEmpty()&&_(this.Xa):!this.Wa||0===this.Wa.getLength()}loadFeatures(t,e,i){const n=this.Ba,s=this.Ua(t,e,i);for(let t=0,r=s.length;t<r;++t){const r=s[t];n.forEachInExtent(r,(function(t){return Jt(t.extent,r)}))||(++this.qa,this.dispatchEvent(new Mf(wf)),this.$.call(this,r,e,i,function(t){--this.qa,this.dispatchEvent(new Mf(xf,void 0,t))}.bind(this),function(){--this.qa,this.dispatchEvent(new Mf(bf))}.bind(this)),n.insert(r,{extent:r.slice()}))}this.loading=!(this.$.length<4)&&this.qa>0}refresh(){this.clear(!0),this.Ba.clear(),super.refresh()}removeLoadedExtent(t){const e=this.Ba;let i;e.forEachInExtent(t,(function(e){if(oe(e.extent,t))return i=e,!0})),i&&e.remove(i)}removeFeature(t){if(!t)return;const e=i(t);e in this.Xa?delete this.Xa[e]:this.$a&&this.$a.remove(t);this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=i(t),n=this.Va[e];if(!n)return;n.forEach(B),delete this.Va[e];const s=t.getId();return void 0!==s&&delete this.Ya[s.toString()],delete this.Za[e],this.dispatchEvent(new Mf(yf,t)),t}tu(t){let e=!1;for(const i in this.Ya)if(this.Ya[i]===t){delete this.Ya[i],e=!0;break}return e}setLoader(t){this.$=t}setUrl(t){ct(this.Os,7),this.Gs=t,this.setLoader(Aa(t,this.Os))}};var Pf=class extends Sf{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 ct("Point"==e.getType(),10),e},this.eu=t.createCluster,this.source=null,this.iu=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(T,this.iu),this.source=t,t&&t.addEventListener(T,this.iu),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=[1/0,1/0,-1/0,-1/0],e=this.distance*this.resolution,n=this.source.getFeatures(),s={};for(let r=0,o=n.length;r<o;r++){const o=n[r];if(!(i(o)in s)){const n=this.geometryFunction(o);if(n){se(n.getCoordinates(),t),Vt(t,e,t);const r=this.source.getFeaturesInExtent(t).filter((function(t){const e=i(t);return!(e in s)&&(s[e]=!0,!0)}));this.features.push(this.createCluster(r,t))}}}}createCluster(t,e){const i=[0,0];for(let e=t.length-1;e>=0;--e){const n=this.geometryFunction(t[e]);n?bi(i,n.getCoordinates()):t.splice(e,1)}Ci(i,1/t.length);const n=ye(e),s=this.interpolationRatio,r=new Qn([i[0]*(1-s)+n[0]*s,i[1]*(1-s)+n[1]*s]);return this.eu?this.eu(r,t):new pt({geometry:r,features:t})}};var _f=class extends of{constructor(t){const e=void 0===t.projection?"EPSG:3857":t.projection;let i=t.tileGrid;void 0===i&&e&&(i=ru({extent:au(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.To=void 0!==t.gutter?t.gutter:0,this.Tr=t.tileSize?ia(t.tileSize):null,this.Er=null,this.Sa={},this.$=t.loader,this.gs=this.gs.bind(this),this.bandCount=void 0===t.bandCount?4:t.bandCount}setTileSizes(t){this.Er=t}getTileSize(t){if(this.Er)return this.Er[t];if(this.Tr)return this.Tr;const e=this.getTileGrid();return e?ia(e.getTileSize(t)):[256,256]}getGutterForProjection(t){return this.To}setLoader(t){this.$=t}getTile(t,e,i,n,s){const r=this.getTileSize(t),o=pa(t,e,i);if(this.tileCache.containsKey(o))return this.tileCache.get(o);const h=this.$;const a=Object.assign({tileCoord:[t,e,i],loader:function(){return S((function(){return h(t,e,i)}))},size:r},this.tileOptions),u=new lt(a);return u.key=this.getKey(),u.addEventListener(T,this.gs),this.tileCache.set(o,u),u}gs(t){const e=t.target,n=i(e),s=e.getState();let r;s==et?(this.Sa[n]=!0,r=Qc):n in this.Sa&&(delete this.Sa[n],r=s==nt?ef:s==it?tf:void 0),r&&this.dispatchEvent(new rf(r,e))}};const Ef=new Map;function Tf(t,e){Array.isArray(t)||(t=[t]),t.forEach((t=>Ef.set(t,e)))}async function Cf(t){const e=Ef.get(t.Compression);if(!e)throw new Error(`Unknown compression method identifier: ${t.Compression}`);return new(await e())(t)}Tf([void 0,1],(()=>n.e(321).then(n.bind(n,321)).then((t=>t.default)))),Tf(5,(()=>n.e(672).then(n.bind(n,672)).then((t=>t.default)))),Tf(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),Tf(7,(()=>n.e(347).then(n.bind(n,347)).then((t=>t.default)))),Tf([8,32946],(()=>Promise.all([n.e(497),n.e(522)]).then(n.bind(n,522)).then((t=>t.default)))),Tf(32773,(()=>n.e(411).then(n.bind(n,878)).then((t=>t.default)))),Tf(34887,(()=>Promise.all([n.e(497),n.e(173)]).then(n.bind(n,173)).then((t=>t.default)))),Tf(50001,(()=>n.e(588).then(n.bind(n,588)).then((t=>t.default))));const Ff="undefined"!=typeof navigator&&navigator.hardwareConcurrency||2;var If=class{constructor(t=Ff,e){this.workers=null,this._awaitingDecoder=null,this.size=t,this.messageId=0,t&&(this._awaitingDecoder=e?Promise.resolve(e):new Promise((t=>{n.e(831).then(n.bind(n,831)).then((e=>{t(e.create)}))})),this._awaitingDecoder.then((e=>{this._awaitingDecoder=null,this.workers=[];for(let i=0;i<t;i++)this.workers.push({worker:e(),idle:!0})})))}async decode(t,e){return this._awaitingDecoder&&await this._awaitingDecoder,0===this.size?Cf(t).then((i=>i.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 s=this.messageId++,r=t=>{t.data.id===s&&(n.idle=!0,i(t.data.decoded),n.worker.removeEventListener("message",r))};n.worker.addEventListener("message",r),n.worker.postMessage({fileDirectory:t,buffer:e,id:s},[e])}))}destroy(){this.workers&&(this.workers.forEach((t=>{t.worker.terminate()})),this.workers=null)}};const Af=new ArrayBuffer(4),kf=new Float32Array(Af),Rf=new Uint32Array(Af),Lf=new Uint32Array(512),Nf=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(Lf[t]=0,Lf[256|t]=32768,Nf[t]=24,Nf[256|t]=24):e<-14?(Lf[t]=1024>>-e-14,Lf[256|t]=1024>>-e-14|32768,Nf[t]=-e-1,Nf[256|t]=-e-1):e<=15?(Lf[t]=e+15<<10,Lf[256|t]=e+15<<10|32768,Nf[t]=13,Nf[256|t]=13):e<128?(Lf[t]=31744,Lf[256|t]=64512,Nf[t]=24,Nf[256|t]=24):(Lf[t]=31744,Lf[256|t]=64512,Nf[t]=13,Nf[256|t]=13)}const Of=new Uint32Array(2048),zf=new Uint32Array(64),Gf=new Uint32Array(64);Of[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,Of[t]=e|i}for(let t=1024;t<2048;++t)Of[t]=939524096+(t-1024<<13);zf[0]=0;for(let t=1;t<31;++t)zf[t]=t<<23;zf[31]=1199570944,zf[32]=2147483648;for(let t=33;t<63;++t)zf[t]=2147483648+(t-32<<23);zf[63]=3347054592,Gf[0]=0;for(let t=1;t<64;++t)Gf[t]=32===t?0:1024;const jf=Reflect.getPrototypeOf(Uint8Array).prototype,Df=Reflect.getOwnPropertyDescriptor(jf,Symbol.toStringTag).get;function Uf(t){return void 0!==Df.call(t)}const $f=Object.prototype.toString;function Bf(t,e,...i){if(n=t,!ArrayBuffer.isView(n)||Uf(n)||"[object DataView]"!==$f.call(n))throw new TypeError("First argument to getFloat16 function must be a DataView");var n;return function(t){const e=t>>10;return Rf[0]=Of[Gf[e]+(1023&t)]+zf[e],kf[0]}(t.getUint16(e,...i))}var qf=n(330),Xf=n(602),Yf=n(499);function Zf(t,e,i,n=1){return new(Object.getPrototypeOf(t).constructor)(e*i*n)}function Vf(t,e,i){return(1-i)*t+i*e}function Wf(t,e,i,n,s,r="nearest"){switch(r.toLowerCase()){case"nearest":return function(t,e,i,n,s){const r=e/n,o=i/s;return t.map((t=>{const h=Zf(t,n,s);for(let a=0;a<s;++a){const s=Math.min(Math.round(o*a),i-1);for(let i=0;i<n;++i){const o=Math.min(Math.round(r*i),e-1),u=t[s*e+o];h[a*n+i]=u}}return h}))}(t,e,i,n,s);case"bilinear":case"linear":return function(t,e,i,n,s){const r=e/n,o=i/s;return t.map((t=>{const h=Zf(t,n,s);for(let a=0;a<s;++a){const s=o*a,u=Math.floor(s),l=Math.min(Math.ceil(s),i-1);for(let i=0;i<n;++i){const o=r*i,c=o%1,f=Math.floor(o),d=Math.min(Math.ceil(o),e-1),p=t[u*e+f],m=t[u*e+d],v=t[l*e+f],g=t[l*e+d],y=Vf(Vf(p,m,c),Vf(v,g,c),s%1);h[a*n+i]=y}}return h}))}(t,e,i,n,s);default:throw new Error(`Unsupported resampling method: '${r}'`)}}function Hf(t,e,i,n,s,r,o="nearest"){switch(o.toLowerCase()){case"nearest":return function(t,e,i,n,s,r){const o=e/n,h=i/s,a=Zf(t,n,s,r);for(let u=0;u<s;++u){const s=Math.min(Math.round(h*u),i-1);for(let i=0;i<n;++i){const h=Math.min(Math.round(o*i),e-1);for(let o=0;o<r;++o){const l=t[s*e*r+h*r+o];a[u*n*r+i*r+o]=l}}}return a}(t,e,i,n,s,r);case"bilinear":case"linear":return function(t,e,i,n,s,r){const o=e/n,h=i/s,a=Zf(t,n,s,r);for(let u=0;u<s;++u){const s=h*u,l=Math.floor(s),c=Math.min(Math.ceil(s),i-1);for(let i=0;i<n;++i){const h=o*i,f=h%1,d=Math.floor(h),p=Math.min(Math.ceil(h),e-1);for(let o=0;o<r;++o){const h=t[l*e*r+d*r+o],m=t[l*e*r+p*r+o],v=t[c*e*r+d*r+o],g=t[c*e*r+p*r+o],y=Vf(Vf(h,m,f),Vf(v,g,f),s%1);a[u*n*r+i*r+o]=y}}}return a}(t,e,i,n,s,r);default:throw new Error(`Unsupported resampling method: '${o}'`)}}function Kf(t,e,i){let n=0;for(let s=e;s<i;++s)n+=t[s];return n}function Jf(t,e,i){switch(t){case 1:if(e<=8)return new Uint8Array(i);if(e<=16)return new Uint16Array(i);if(e<=32)return new Uint32Array(i);break;case 2:if(8===e)return new Int8Array(i);if(16===e)return new Int16Array(i);if(32===e)return new Int32Array(i);break;case 3:switch(e){case 16:case 32:return new Float32Array(i);case 64:return new Float64Array(i)}}throw Error("Unsupported data format/bitsPerSample")}var Qf=class{constructor(t,e,i,n,s,r){this.fileDirectory=t,this.geoKeys=e,this.dataView=i,this.littleEndian=n,this.tiles=s?{}:null,this.isTiled=!t.StripOffsets;const o=t.PlanarConfiguration;if(this.planarConfiguration=void 0===o?1:o,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=r}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(t){return this.isTiled||(t+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-t*this.getTileHeight()}getBytesPerPixel(){let t=0;for(let e=0;e<this.fileDirectory.BitsPerSample.length;++e)t+=this.getSampleByteSize(e);return t}getSampleByteSize(t){if(t>=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 Bf(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 Jf(this.getSampleFormat(t),this.getBitsPerSample(t),e)}async getTileOrStrip(t,e,i,n,s){const r=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let h;const{tiles:a}=this;let u,l;1===this.planarConfiguration?h=e*r+t:2===this.planarConfiguration&&(h=i*r*o+e*r+t),this.isTiled?(u=this.fileDirectory.TileOffsets[h],l=this.fileDirectory.TileByteCounts[h]):(u=this.fileDirectory.StripOffsets[h],l=this.fileDirectory.StripByteCounts[h]);const c=(await this.source.fetch([{offset:u,length:l}],s))[0];let f;return null!==a&&a[h]?f=a[h]:(f=(async()=>{let t=await n.decode(this.fileDirectory,c);const i=this.getSampleFormat(),s=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,s)&&(t=function(t,e,i,n,s,r,o){const h=new DataView(t),a=2===i?1:n,u=Jf(e,s,2===i?o*r:o*r*n),l=parseInt("1".repeat(s),2);if(1===e){let t;t=1===i?n*s:s;let e=r*t;0!=(7&e)&&(e=e+7&-8);for(let t=0;t<o;++t){const i=t*e;for(let e=0;e<r;++e){const n=i+e*a*s;for(let i=0;i<a;++i){const o=n+i*s,c=(t*r+e)*a+i,f=Math.floor(o/8),d=o%8;if(d+s<=8)u[c]=h.getUint8(f)>>8-s-d&l;else if(d+s<=16)u[c]=h.getUint16(f)>>16-s-d&l;else if(d+s<=24){const t=h.getUint16(f)<<8|h.getUint8(f+2);u[c]=t>>24-s-d&l}else u[c]=h.getUint32(f)>>32-s-d&l}}}}return u.buffer}(t,i,this.planarConfiguration,this.getSamplesPerPixel(),s,this.getTileWidth(),this.getBlockHeight(e))),t})(),null!==a&&(a[h]=f)),{x:t,y:e,sample:i,data:await f}}async _readRaster(t,e,i,n,s,r,o,h,a){const u=this.getTileWidth(),l=this.getTileHeight(),c=this.getWidth(),f=this.getHeight(),d=Math.max(Math.floor(t[0]/u),0),p=Math.min(Math.ceil(t[2]/u),Math.ceil(c/u)),m=Math.max(Math.floor(t[1]/l),0),v=Math.min(Math.ceil(t[3]/l),Math.ceil(f/l)),g=t[2]-t[0];let y=this.getBytesPerPixel();const w=[],x=[];for(let t=0;t<e.length;++t)1===this.planarConfiguration?w.push(Kf(this.fileDirectory.BitsPerSample,0,e[t])/8):w.push(0),x.push(this.getReaderForSample(e[t]));const b=[],{littleEndian:M}=this;for(let r=m;r<v;++r)for(let o=d;o<p;++o)for(let h=0;h<e.length;++h){const d=h,p=e[h];2===this.planarConfiguration&&(y=this.getSampleByteSize(h));const m=this.getTileOrStrip(o,r,p,s,a);b.push(m),m.then((s=>{const r=s.data,o=new DataView(r),h=this.getBlockHeight(s.y),a=s.y*l,p=s.x*u,m=a+h,v=(s.x+1)*u,b=x[d],S=Math.min(h,h-(m-t[3]),f-a),P=Math.min(u,u-(v-t[2]),c-p);for(let s=Math.max(0,t[1]-a);s<S;++s)for(let r=Math.max(0,t[0]-p);r<P;++r){const h=(s*u+r)*y,l=b.call(o,h+w[d],M);let c;n?(c=(s+a-t[1])*g*e.length+(r+p-t[0])*e.length+d,i[c]=l):(c=(s+a-t[1])*g+r+p-t[0],i[d][c]=l)}}))}if(await Promise.all(b),r&&t[2]-t[0]!==r||o&&t[3]-t[1]!==o){let s;return s=n?Hf(i,t[2]-t[0],t[3]-t[1],r,o,e.length,h):Wf(i,t[2]-t[0],t[3]-t[1],r,o,h),s.width=r,s.height=o,s}return i.width=r||t[2]-t[0],i.height=o||t[3]-t[1],i}async readRasters({window:t,samples:e=[],interleave:i,pool:n=null,width:s,height:r,resampleMethod:o,fillValue:h,signal:a}={}){const u=t||[0,0,this.getWidth(),this.getHeight()];if(u[0]>u[2]||u[1]>u[3])throw new Error("Invalid subsets");const l=(u[2]-u[0])*(u[3]-u[1]),c=this.getSamplesPerPixel();if(e&&e.length){for(let t=0;t<e.length;++t)if(e[t]>=c)return Promise.reject(new RangeError(`Invalid sample index '${e[t]}'.`))}else for(let t=0;t<c;++t)e.push(t);let f;if(i){f=Jf(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),l*e.length),h&&f.fill(h)}else{f=[];for(let t=0;t<e.length;++t){const i=this.getArrayForSample(e[t],l);Array.isArray(h)&&t<h.length?i.fill(h[t]):h&&!Array.isArray(h)&&i.fill(h),f.push(i)}}const d=n||await Cf(this.fileDirectory);return await this._readRaster(u,e,f,i,d,s,r,o,a)}async readRGB({window:t,interleave:e=!0,pool:i=null,width:n,height:s,resampleMethod:r,enableAlpha:o=!1,signal:h}={}){const a=t||[0,0,this.getWidth(),this.getHeight()];if(a[0]>a[2]||a[1]>a[3])throw new Error("Invalid subsets");const u=this.fileDirectory.PhotometricInterpretation;if(u===Yf.Ie.RGB){let a=[0,1,2];if(this.fileDirectory.ExtraSamples!==Yf.pd.Unspecified&&o){a=[];for(let t=0;t<this.fileDirectory.BitsPerSample.length;t+=1)a.push(t)}return this.readRasters({window:t,interleave:e,samples:a,pool:i,width:n,height:s,resampleMethod:r,signal:h})}let l;switch(u){case Yf.Ie.WhiteIsZero:case Yf.Ie.BlackIsZero:case Yf.Ie.Palette:l=[0];break;case Yf.Ie.CMYK:l=[0,1,2,3];break;case Yf.Ie.YCbCr:case Yf.Ie.CIELab:l=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const c={window:a,interleave:!0,samples:l,pool:i,width:n,height:s,resampleMethod:r,signal:h},{fileDirectory:f}=this,d=await this.readRasters(c),p=2**this.fileDirectory.BitsPerSample[0];let m;switch(u){case Yf.Ie.WhiteIsZero:m=function(t,e){const{width:i,height:n}=t,s=new Uint8Array(i*n*3);let r;for(let i=0,n=0;i<t.length;++i,n+=3)r=256-t[i]/e*256,s[n]=r,s[n+1]=r,s[n+2]=r;return s}(d,p);break;case Yf.Ie.BlackIsZero:m=function(t,e){const{width:i,height:n}=t,s=new Uint8Array(i*n*3);let r;for(let i=0,n=0;i<t.length;++i,n+=3)r=t[i]/e*256,s[n]=r,s[n+1]=r,s[n+2]=r;return s}(d,p);break;case Yf.Ie.Palette:m=function(t,e){const{width:i,height:n}=t,s=new Uint8Array(i*n*3),r=e.length/3,o=e.length/3*2;for(let i=0,n=0;i<t.length;++i,n+=3){const h=t[i];s[n]=e[h]/65536*256,s[n+1]=e[h+r]/65536*256,s[n+2]=e[h+o]/65536*256}return s}(d,f.ColorMap);break;case Yf.Ie.CMYK:m=function(t){const{width:e,height:i}=t,n=new Uint8Array(e*i*3);for(let e=0,i=0;e<t.length;e+=4,i+=3){const s=t[e],r=t[e+1],o=t[e+2],h=t[e+3];n[i]=(255-s)/256*255*((255-h)/256),n[i+1]=(255-r)/256*255*((255-h)/256),n[i+2]=(255-o)/256*255*((255-h)/256)}return n}(d);break;case Yf.Ie.YCbCr:m=function(t){const{width:e,height:i}=t,n=new Uint8ClampedArray(e*i*3);for(let e=0,i=0;e<t.length;e+=3,i+=3){const s=t[e],r=t[e+1],o=t[e+2];n[i]=s+1.402*(o-128),n[i+1]=s-.34414*(r-128)-.71414*(o-128),n[i+2]=s+1.772*(r-128)}return n}(d);break;case Yf.Ie.CIELab:m=function(t){const{width:e,height:i}=t,n=new Uint8Array(e*i*3);for(let e=0,i=0;e<t.length;e+=3,i+=3){let s,r,o,h=(t[e+0]+16)/116,a=(t[e+1]<<24>>24)/500+h,u=h-(t[e+2]<<24>>24)/200;a=.95047*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),h=1*(h*h*h>.008856?h*h*h:(h-16/116)/7.787),u=1.08883*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),s=3.2406*a+-1.5372*h+-.4986*u,r=-.9689*a+1.8758*h+.0415*u,o=.0557*a+-.204*h+1.057*u,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n[i]=255*Math.max(0,Math.min(1,s)),n[i+1]=255*Math.max(0,Math.min(1,r)),n[i+2]=255*Math.max(0,Math.min(1,o))}return n}(d);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,s=0;n<m.length;n+=3,++s)t[s]=m[n],e[s]=m[n+1],i[s]=m[n+2];m=[t,e,i]}return m.width=d.width,m.height=d.height,m}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const t=[];for(let e=0;e<this.fileDirectory.ModelTiepoint.length;e+=6)t.push({i:this.fileDirectory.ModelTiepoint[e],j:this.fileDirectory.ModelTiepoint[e+1],k:this.fileDirectory.ModelTiepoint[e+2],x:this.fileDirectory.ModelTiepoint[e+3],y:this.fileDirectory.ModelTiepoint[e+4],z:this.fileDirectory.ModelTiepoint[e+5]});return t}getGDALMetadata(t=null){const e={};if(!this.fileDirectory.GDAL_METADATA)return null;const i=this.fileDirectory.GDAL_METADATA;let n=Xf(i,"Item");n=null===t?n.filter((t=>void 0===qf(t,"sample"))):n.filter((e=>Number(qf(e,"sample"))===t));for(let t=0;t<n.length;++t){const i=n[t];e[qf(i,"name")]=i.inner}return e}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const t=this.fileDirectory.GDAL_NODATA;return Number(t.substring(0,t.length-1))}getOrigin(){const t=this.fileDirectory.ModelTiepoint,e=this.fileDirectory.ModelTransformation;if(t&&6===t.length)return[t[3],t[4],t[5]];if(e)return[e[3],e[7],e[11]];throw new Error("The image does not have an affine transformation.")}getResolution(t=null){const e=this.fileDirectory.ModelPixelScale,i=this.fileDirectory.ModelTransformation;if(e)return[e[0],-e[1],e[2]];if(i)return[i[0],i[5],i[10]];if(t){const[e,i,n]=t.getResolution();return[e*t.getWidth()/this.getWidth(),i*t.getHeight()/this.getHeight(),n*t.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(){const t=this.getOrigin(),e=this.getResolution(),i=t[0],n=t[1],s=i+e[0]*this.getWidth(),r=n+e[1]*this.getHeight();return[Math.min(i,s),Math.min(n,r),Math.max(i,s),Math.max(n,r)]}};class td{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 s;if(e){if(s=i+2**32*n,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*i+n,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(t,e){let i=0;const n=(128&this._dataView.getUint8(t+(e?7:0)))>0;let s=!0;for(let r=0;r<8;r++){let o=this._dataView.getUint8(t+(e?r:7-r));n&&(s?0!==o&&(o=255&~(o-1),s=!1):o=255&~o),i+=o*256**r}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 Bf(this._dataView,t,e)}getFloat32(t,e){return this._dataView.getFloat32(t,e)}getFloat64(t,e){return this._dataView.getFloat64(t,e)}}class ed{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 s=0;s<8;s++){let r=this._dataView.getUint8(t+(this._littleEndian?s:7-s));i&&(n?0!==r&&(r=255&~(r-1),n=!1):r=255&~r),e+=r*256**s}return i&&(e=-e),e}readOffset(t){return this._bigTiff?this.readUint64(t):this.readUint32(t)}}const id="\r\n\r\n";function nd(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 sd(t){const e=t.split("\r\n").map((t=>{const e=t.split(":").map((t=>t.trim()));return e[0]=e[0].toLowerCase(),e}));return nd(e)}function rd(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 od{async fetch(t,e){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(){}}var hd=n(593);function ad(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]]))}class ud extends Error{constructor(t){super(t),Error.captureStackTrace&&Error.captureStackTrace(this,ud),this.name="AbortError"}}class ld extends Error{constructor(t,e){super(e),this.errors=t,this.message=e,this.name="AggregateError"}}const cd=ld;class fd{constructor(t,e,i=null){this.offset=t,this.length=e,this.data=i}get top(){return this.offset+this.length}}class dd{constructor(t,e,i){this.offset=t,this.length=e,this.blockIds=i}}class pd extends od{constructor(t,{blockSize:e=65536,cacheSize:i=100}={}){super(),this.source=t,this.blockSize=e,this.blockCache=new hd({max:i}),this.blockRequests=new Map,this.blockIdsToFetch=new Set}get fileSize(){return this.source.fileSize}async fetch(t,e){const i=new Map,n=new Map,s=new Set;for(const{offset:e,length:r}of t){let t=e+r;const{fileSize:o}=this;null!==o&&(t=Math.min(t,o));for(let r=Math.floor(e/this.blockSize)*this.blockSize;r<t;r+=this.blockSize){const t=Math.floor(r/this.blockSize);this.blockCache.has(t)?i.set(t,this.blockCache.get(t)):this.blockRequests.has(t)?n.set(t,this.blockRequests.get(t)):(this.blockIdsToFetch.has(t)||this.blockIdsToFetch.add(t),s.add(t))}}await async function(t){return new Promise((e=>setTimeout(e,t)))}(),this.fetchBlocks(e);for(const t of s){const e=this.blockRequests.get(t),s=this.blockCache.get(t);if(e)n.set(t,e);else{if(!s)throw new Error(`Block ${t} is not in the block requests`);i.set(t,s)}}let r=await Promise.allSettled(Array.from(n.values()));if(r.some((t=>"rejected"===t.status))){const t=new Set;for(const[i,s]of ad(n.keys(),r)){const{rejected:n,reason:r}=s;n&&"AbortError"===r.name&&r.signal!==e&&(this.blockIdsToFetch.add(i),t.add(i))}if(this.blockIdsToFetch.length>0){this.fetchBlocks(e);for(const e of t){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);n.set(e,t)}r=await Promise.allSettled(Array.from(n.values()))}}if(r.some((t=>"rejected"===t.status))){if(e&&e.aborted)throw new ud("Request was aborted");throw new cd(r.filter((t=>"rejected"===t.status)).map((t=>t.reason)),"Request failed")}const o=r.map((t=>t.value)),h=new Map(ad(Array.from(n.keys()),o));for(const[t,e]of i)h.set(t,e);return this.readSliceData(t,h)}fetchBlocks(t){if(this.blockIdsToFetch.size>0){const e=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(e,t);for(let n=0;n<e.length;++n){const s=e[n];for(const e of s.blockIds){const s=(async()=>{try{const t=(await i)[n],s=e*this.blockSize,r=s-t.offset,o=Math.min(r+this.blockSize,t.data.byteLength),h=t.data.slice(r,o),a=new fd(s,h.byteLength,h);return this.blockCache.set(e,a),a}catch(e){throw"AbortError"===e.name&&(e.signal=t),e}finally{this.blockRequests.delete(e)}})();this.blockRequests.set(e,s)}}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 s=[];for(const t of e)null===n||n+1===t?(i.push(t),n=t):(s.push(new dd(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[t],n=t);return s.push(new dd(i[0]*this.blockSize,i.length*this.blockSize,i)),s}readSliceData(t,e){return t.map((t=>{const i=t.offset+t.length,n=Math.floor(t.offset/this.blockSize),s=Math.floor((t.offset+t.length)/this.blockSize),r=new ArrayBuffer(t.length),o=new Uint8Array(r);for(let r=n;r<=s;++r){const n=e.get(r),s=n.offset-t.offset,h=n.top-i;let a,u=0,l=0;s<0?u=-s:s>0&&(l=s),a=h<0?n.length-u:i-n.offset-u;const c=new Uint8Array(n.data,u,a);o.set(c,l)}return r}))}}class md{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 vd{constructor(t){this.url=t}async request({headers:t,credentials:e,signal:i}={}){throw new Error("request is not implemented")}}class gd extends md{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 yd extends vd{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 gd(n)}}class wd extends md{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 xd extends vd{constructRequest(t,e){return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",this.url),s.responseType="arraybuffer";for(const[e,i]of Object.entries(t))s.setRequestHeader(e,i);s.onload=()=>{const t=s.response;i(new wd(s,t))},s.onerror=n,s.onabort=()=>n(new ud("Request aborted")),s.send(),e&&(e.aborted&&s.abort(),e.addEventListener("abort",(()=>s.abort())))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}var bd=n(752),Md=n(640),Sd=n(630);class Pd extends md{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 _d extends vd{constructor(t){super(t),this.parsedUrl=Sd.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?bd:Md}constructRequest(t,e){return new Promise(((i,n)=>{const s=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 Pd(t,e))}));s.on("error",n),e&&(e.aborted&&s.destroy(new ud("Request aborted")),e.addEventListener("abort",(()=>s.destroy(new ud("Request aborted")))))}))}async request({headers:t,signal:e}={}){return await this.constructRequest(t,e)}}class Ed extends od{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:s}=function(t){const[e,...i]=t.split(";").map((t=>t.trim()));return{type:e,params:nd(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"),s=[],r=`--${e}`,o=`${r}--`;for(let e=0;e<10;++e)n.decode(new Uint8Array(t,e,r.length))===r&&(i=e);if(null===i)throw new Error("Could not find initial boundary");for(;i<t.byteLength;){const e=n.decode(new Uint8Array(t,i,Math.min(r.length+1024,t.byteLength-i)));if(0===e.length||e.startsWith(o))break;if(!e.startsWith(r))throw new Error("Part does not start with boundary");const h=e.substr(r.length+2);if(0===h.length)break;const a=h.indexOf(id),u=sd(h.substr(0,a)),{start:l,end:c,total:f}=rd(u["content-range"]),d=i+r.length+a+id.length,p=parseInt(c,10)+1-parseInt(l,10);s.push({headers:u,data:t.slice(d,d+p),offset:l,length:p,fileSize:f}),i=d+p+4}return s}(await i.getData(),s.boundary);return this._fileSize=t[0].fileSize||null,t}const r=await i.getData(),{start:o,end:h,total:a}=rd(i.getHeader("content-range"));this._fileSize=a||null;const u=[{data:r,offset:o,length:h-o}];if(t.length>1){const i=await Promise.all(t.slice(1).map((t=>this.fetchSlice(t,e))));return u.concat(i)}return u}{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,s=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+n}`},signal:e});if(s.ok){if(206===s.status){const t=await s.getData(),{total:e}=rd(s.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 s.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 Td(t,{blockSize:e,cacheSize:i}){return null===e?t:new pd(t,e,i)}function Cd(t,{forceXHR:e=!1,...i}={}){return"function"!=typeof fetch||e?"undefined"!=typeof XMLHttpRequest?function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...s}={}){const r=new xd(t);return Td(new Ed(r,e,i,n),s)}(t,i):function(t,{headers:e={},maxRanges:i=0,allowFullFile:n=!1,...s}={}){const r=new _d(t);return Td(new Ed(r,e,i,n),s)}(t,i):function(t,{headers:e={},credentials:i,maxRanges:n=0,allowFullFile:s=!1,...r}={}){const o=new yd(t,i);return Td(new Ed(o,e,n,s),r)}(t,i)}class Fd extends od{constructor(t){super(),this.file=t}async fetchSlice(t,e){return new Promise(((i,n)=>{const s=this.file.slice(t.offset,t.offset+t.length),r=new FileReader;r.onload=t=>i(t.target.result),r.onerror=n,r.onabort=n,r.readAsArrayBuffer(s),e&&e.addEventListener("abort",(()=>r.abort()))}))}}function Id(t){switch(t){case Yf.sf.BYTE:case Yf.sf.ASCII:case Yf.sf.SBYTE:case Yf.sf.UNDEFINED:return 1;case Yf.sf.SHORT:case Yf.sf.SSHORT:return 2;case Yf.sf.LONG:case Yf.sf.SLONG:case Yf.sf.FLOAT:case Yf.sf.IFD:return 4;case Yf.sf.RATIONAL:case Yf.sf.SRATIONAL:case Yf.sf.DOUBLE:case Yf.sf.LONG8:case Yf.sf.SLONG8:case Yf.sf.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${t}`)}}function Ad(t,e,i,n){let s=null,r=null;const o=Id(e);switch(e){case Yf.sf.BYTE:case Yf.sf.ASCII:case Yf.sf.UNDEFINED:s=new Uint8Array(i),r=t.readUint8;break;case Yf.sf.SBYTE:s=new Int8Array(i),r=t.readInt8;break;case Yf.sf.SHORT:s=new Uint16Array(i),r=t.readUint16;break;case Yf.sf.SSHORT:s=new Int16Array(i),r=t.readInt16;break;case Yf.sf.LONG:case Yf.sf.IFD:s=new Uint32Array(i),r=t.readUint32;break;case Yf.sf.SLONG:s=new Int32Array(i),r=t.readInt32;break;case Yf.sf.LONG8:case Yf.sf.IFD8:s=new Array(i),r=t.readUint64;break;case Yf.sf.SLONG8:s=new Array(i),r=t.readInt64;break;case Yf.sf.RATIONAL:s=new Uint32Array(2*i),r=t.readUint32;break;case Yf.sf.SRATIONAL:s=new Int32Array(2*i),r=t.readInt32;break;case Yf.sf.FLOAT:s=new Float32Array(i),r=t.readFloat32;break;case Yf.sf.DOUBLE:s=new Float64Array(i),r=t.readFloat64;break;default:throw new RangeError(`Invalid field type: ${e}`)}if(e!==Yf.sf.RATIONAL&&e!==Yf.sf.SRATIONAL)for(let e=0;e<i;++e)s[e]=r.call(t,n+e*o);else for(let e=0;e<i;e+=2)s[e]=r.call(t,n+e*o),s[e+1]=r.call(t,n+(e*o+4));return e===Yf.sf.ASCII?new TextDecoder("utf-8").decode(s):s}class kd{constructor(t,e,i){this.fileDirectory=t,this.geoKeyDirectory=e,this.nextIFDByteOffset=i}}class Rd extends Error{constructor(t){super(`No image at index ${t}`),this.index=t}}class Ld{async readRasters(t={}){const{window:e,width:i,height:n}=t;let{resX:s,resY:r,bbox:o}=t;const h=await this.getImage();let a=h;const u=await this.getImageCount(),l=h.getBoundingBox();if(e&&o)throw new Error('Both "bbox" and "window" passed.');if(i||n){if(e){const[t,i]=h.getOrigin(),[n,s]=h.getResolution();o=[t+e[0]*n,i+e[1]*s,t+e[2]*n,i+e[3]*s]}const t=o||l;if(i){if(s)throw new Error("Both width and resX passed");s=(t[2]-t[0])/i}if(n){if(r)throw new Error("Both width and resY passed");r=(t[3]-t[1])/n}}if(s||r){const t=[];for(let e=0;e<u;++e){const i=await this.getImage(e),{SubfileType:n,NewSubfileType:s}=i.fileDirectory;(0===e||2===n||1&s)&&t.push(i)}t.sort(((t,e)=>t.getWidth()-e.getWidth()));for(let e=0;e<t.length;++e){const i=t[e],n=(l[2]-l[0])/i.getWidth(),o=(l[3]-l[1])/i.getHeight();if(a=i,s&&s>n||r&&r>o)break}}let c=e;if(o){const[t,e]=h.getOrigin(),[i,n]=a.getResolution(h);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 a.readRasters({...t,window:c})}}class Nd extends Ld{constructor(t,e,i,n,s={}){super(),this.source=t,this.littleEndian=e,this.bigTiff=i,this.firstIFDOffset=n,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(t,e){const i=this.bigTiff?4048:1024;return new ed((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 s=this.bigTiff?n.readUint64(t):n.readUint16(t),r=s*e+(this.bigTiff?16:6);n.covers(t,r)||(n=await this.getSlice(t,r));const o={};let h=t+(this.bigTiff?8:2);for(let t=0;t<s;h+=e,++t){const t=n.readUint16(h),e=n.readUint16(h+2),i=this.bigTiff?n.readUint64(h+4):n.readUint32(h+4);let s,r;const a=Id(e),u=h+(this.bigTiff?12:8);if(a*i<=(this.bigTiff?8:4))s=Ad(n,e,i,u);else{const t=n.readOffset(u),r=Id(e)*i;if(n.covers(t,r))s=Ad(n,e,i,t);else{s=Ad(await this.getSlice(t,r),e,i,t)}}r=1===i&&-1===Yf.It.indexOf(t)&&e!==Yf.sf.RATIONAL&&e!==Yf.sf.SRATIONAL?s[0]:s,o[Yf.L[t]]=r}const a=function(t){const e=t.GeoKeyDirectory;if(!e)return null;const i={};for(let n=4;n<=4*e[3];n+=4){const s=Yf.P1[e[n]],r=e[n+1]?Yf.L[e[n+1]]:null,o=e[n+2],h=e[n+3];let a=null;if(r){if(a=t[r],null==a)throw new Error(`Could not get value of geoKey '${s}'.`);"string"==typeof a?a=a.substring(h,h+o-1):a.subarray&&(a=a.subarray(h,h+o),1===o&&(a=a[0]))}else a=h;i[s]=a}return i}(o),u=n.readOffset(t+i+e*s);return new kd(o,a,u)}async requestIFD(t){if(this.ifdRequests[t])return this.ifdRequests[t];if(0===t)return this.ifdRequests[t]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[t];if(!this.ifdRequests[t-1])try{this.ifdRequests[t-1]=this.requestIFD(t-1)}catch(e){if(e instanceof Rd)throw new Rd(t);throw e}return this.ifdRequests[t]=(async()=>{const e=await this.ifdRequests[t-1];if(0===e.nextIFDByteOffset)throw new Rd(t);return this.parseFileDirectoryAt(e.nextIFDByteOffset)})(),this.ifdRequests[t]}async getImage(t=0){const e=await this.requestIFD(t);return new Qf(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 Rd))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=",i=e.length+100;let n=await this.getSlice(t,i);if(e===Ad(n,Yf.sf.ASCII,e.length,t)){const e=Ad(n,Yf.sf.ASCII,i,t).split("\n")[0],s=Number(e.split("=")[1].split(" ")[0])+e.length;s>i&&(n=await this.getSlice(t,s));const r=Ad(n,Yf.sf.ASCII,s,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],s=new td(n),r=s.getUint16(0,0);let o;if(18761===r)o=!0;else{if(19789!==r)throw new TypeError("Invalid byte order value.");o=!1}const h=s.getUint16(2,o);let a;if(42===h)a=!1;else{if(43!==h)throw new TypeError("Invalid magic number.");a=!0;if(8!==s.getUint16(4,o))throw new Error("Unsupported offset byte-size.")}const u=a?s.getUint64(8,o):s.getUint32(4,o);return new Nd(t,o,a,u,e)}close(){return"function"==typeof this.source.close&&this.source.close()}}class Od extends Ld{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;n<this.imageFiles.length;n++){const s=this.imageFiles[n];for(let r=0;r<this.imageCounts[n];r++){if(t===e){const t=await s.requestIFD(i);return new Qf(t.fileDirectory,t.geoKeyDirectory,s.dataView,s.littleEndian,s.cache,s.source)}e++,i++}i=0}throw new RangeError("Invalid image index")}async getImageCount(){if(null!==this.imageCount)return this.imageCount;const t=[this.mainFile.getImageCount()].concat(this.overviewFiles.map((t=>t.getImageCount())));return this.imageCounts=await Promise.all(t),this.imageCount=this.imageCounts.reduce(((t,e)=>t+e),0),this.imageCount}}async function zd(t,e){return Nd.fromSource(new Fd(t),e)}const Gd="STATISTICS_MAXIMUM",jd="STATISTICS_MINIMUM";let Dd;function Ud(t){try{return t.getBoundingBox()}catch(e){const i=t.fileDirectory;return[0,0,i.ImageWidth,i.ImageLength]}}function $d(t){try{return t.getOrigin().slice(0,2)}catch(e){return[0,t.fileDirectory.ImageLength]}}function Bd(t,e){try{return t.getResolution(e)}catch(i){return[e.fileDirectory.ImageWidth/t.fileDirectory.ImageWidth,e.fileDirectory.ImageHeight/t.fileDirectory.ImageHeight]}}function qd(t){const e=t.geoKeys;if(!e)return null;if(e.ProjectedCSTypeGeoKey){const t="EPSG:"+e.ProjectedCSTypeGeoKey;let i=Yi(t);if(!i){const n=Oe(e.ProjLinearUnitsGeoKey);n&&(i=new Ge({code:t,units:n}))}return i}if(e.GeographicTypeGeoKey){const t="EPSG:"+e.GeographicTypeGeoKey;let i=Yi(t);if(!i){const n=Oe(e.GeogAngularUnitsGeoKey);n&&(i=new Ge({code:t,units:n}))}return i}return null}function Xd(t){return t.getImageCount().then((function(e){const i=new Array(e);for(let n=0;n<e;++n)i[n]=t.getImage(n);return Promise.all(i)}))}function Yd(t,e){let i;return i=t.blob?zd(t.blob):t.overviews?async function(t,e=[],i={},n){const s=await Nd.fromSource(Cd(t,i),n),r=await Promise.all(e.map((t=>Nd.fromSource(Cd(t,i)))));return new Od(s,r)}(t.url,t.overviews,e):async function(t,e={},i){return Nd.fromSource(Cd(t,e),i)}(t.url,e),i.then(Xd)}function Zd(t,e,i,n,s){if(Array.isArray(t)){const r=t.length;if(!Array.isArray(e)||r!=e.length){const t=new Error(n);throw s(t),t}for(let o=0;o<r;++o)Zd(t[o],e[o],i,n,s)}else if(Math.abs(t-e)>i*t)throw new Error(n)}function Vd(t){return t instanceof Int8Array?-128:t instanceof Int16Array?-32768:t instanceof Int32Array?-2147483648:t instanceof Float32Array?12e-39:0}function Wd(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 Hd extends _f{constructor(t){super({state:"loading",tileGrid:null,projection:null,opaque:t.opaque,transition:t.transition,interpolate:!1!==t.interpolate,wrapX:t.wrapX}),this.nu=t.sources;const e=this.nu.length;this.su=t.sourceOptions,this.ru=new Array(e),this.ou=new Array(e),this.hu,this.au,this.uu,this.lu=!1!==t.normalize,this.cu=!1,this.q=null,this.fu=t.convertToRGB?"readRGB":"readRasters",this.setKey(this.nu.map((t=>t.url)).join(","));const i=this,n=new Array(e);for(let t=0;t<e;++t)n[t]=Yd(this.nu[t],this.su);Promise.all(n).then((function(t){i.du(t)})).catch((function(t){console.error(t),i.q=t,i.setState("error")}))}getError(){return this.q}du(t){let e,i,n,s,r;const o=new Array(t.length),h=new Array(t.length),a=new Array(t.length);let u=0;const l=t.length;for(let c=0;c<l;++c){const l=t[c],f=l.length;let d,p;const m=new Array(f),v=new Array(f),g=new Array(f);h[c]=new Array(f),a[c]=new Array(f);for(let t=0;t<f;++t){const e=l[t],i=e.getGDALNoData();a[c][t]=e.getGDALMetadata(0),h[c][t]=i;const n=this.nu[c].bands;o[c]=n?n.length:e.getSamplesPerPixel();const s=f-(t+1);d||(d=Ud(e)),p||(p=$d(e));const r=Bd(e,l[0]);g[s]=r[0];const u=[e.getTileWidth(),e.getTileHeight()];m[s]=u;const y=r[0]/Math.abs(r[1]);v[s]=[u[0],u[1]/y]}if(e?Se(e,d,e):e=d,i){Zd(i,p,0,`Origin mismatch for source ${c}, got [${p}] but expected [${i}]`,this.viewRejector)}else i=p;if(r){r.length-u>g.length&&(u=r.length-g.length);const t=r[r.length-1]/g[g.length-1];this.ou[c]=t;const e=g.map((e=>e*t)),i=`Resolution mismatch for source ${c}, got [${e}] but expected [${r}]`;Zd(r.slice(u,r.length),e,.02,i,this.viewRejector)}else r=g,this.ou[c]=1;n?Zd(n.slice(u,n.length),v,.01,`Tile size mismatch for source ${c}`,this.viewRejector):n=v,s?Zd(s.slice(u,s.length),m,0,`Tile size mismatch for source ${c}`,this.viewRejector):s=m,this.ru[c]=l.reverse()}for(let t=0,e=this.ru.length;t<e;++t){const e=this.ru[t];for(;e.length<r.length;)e.unshift(void 0)}if(!this.getProjection()){const e=t[0];for(let t=e.length-1;t>=0;--t){const i=qd(e[t]);if(i){this.projection=i;break}}}this.hu=o,this.au=h,this.uu=a;t:for(let t=0;t<l;++t){if(void 0!==this.nu[t].nodata){this.cu=!0;break}const e=h[t],i=this.nu[t].bands;if(i){for(let t=0;t<i.length;++t)if(null!==e[i[t]-1]){this.cu=!0;break t}}else for(let t=0;t<e.length;++t)if(null!==e[t]){this.cu=!0;break t}}const c=this.cu?1:0;this.bandCount=o.reduce(((t,e)=>t+=e),0)+c;const f=new eu({extent:e,minZoom:u,origin:i,resolutions:r,tileSizes:n});this.tileGrid=f,this.setTileSizes(s),this.setLoader(this.pu.bind(this)),this.setState("ready"),this.viewResolver({projection:this.projection,resolutions:r,center:un(ye(e),this.projection),extent:cn(e,this.projection),zoom:0})}pu(t,e,i){const n=this.getTileSize(t),s=this.ru.length,r=new Array(s),o=this.cu,h=this.bandCount,a=this.hu,u=this.au,l=this.nu;for(let o=0;o<s;++o){const s=l[o],h=this.ou[o],a=[Math.round(e*(n[0]*h)),Math.round(i*(n[1]*h)),Math.round((e+1)*(n[0]*h)),Math.round((i+1)*(n[1]*h))],c=this.ru[o][t];let f,d;s.bands&&(f=s.bands.map((function(t){return t-1}))),d="nodata"in s&&null!==s.nodata?s.nodata:f?f.map((function(t){return u[o][t]})):u[o],r[o]=c[this.fu]({window:a,width:n[0],height:n[1],samples:f,fillValue:d,pool:(Dd||(Dd=new If),Dd),interleave:!1})}const c=n[0]*n[1],f=c*h,d=this.lu,p=this.uu;return Promise.all(r).then((function(t){let e;e=d?new Uint8Array(f):new Float32Array(f);let i=0;for(let n=0;n<c;++n){let r=o;for(let h=0;h<s;++h){const s=l[h];let c,f,m=s.min,v=s.max;if(d){const e=p[h][0];void 0===m&&(m=e&&jd in e?parseFloat(e.STATISTICS_MINIMUM):Vd(t[h][0])),void 0===v&&(v=e&&Gd in e?parseFloat(e.STATISTICS_MAXIMUM):Wd(t[h][0])),c=255/(v-m),f=-m*c}for(let l=0;l<a[h];++l){const a=t[h][l][n];let p;if(p=d?hi(c*a+f,0,255):a,o){let t=s.nodata;if(void 0===t){let e;e=s.bands?s.bands[l]-1:l,t=u[h][e]}const n=isNaN(t);(!n&&a!==t||n&&!isNaN(a))&&(r=!1,e[i]=p)}else e[i]=p;i++}}o&&(r||(e[i]=255),i++)}return e})).catch((function(t){throw console.error(t),t}))}}Hd.prototype.getView;var Kd=Hd;class Jd extends tr{constructor(t,e,i,n,s,r,o){super(e,i,n,s,r,o),this.mu=null,this.Tr=t}getImage(){if(this.mu)return this.mu;const t=super.getImage();if(this.state==it){const e=this.Tr;if(t.width==e[0]&&t.height==e[1])return this.mu=t,t;{const i=Ys(e[0],e[1]);return i.drawImage(t,0,0),this.mu=i.canvas,i.canvas}}return t}}var Qd=class extends lf{constructor(t){const e=t.size,i=void 0!==t.tierSizeCalculation?t.tierSizeCalculation:"default",n=t.tilePixelRatio||1,s=e[0],r=e[1],o=[],h=t.tileSize||$o;let a=h*n;switch(i){case"default":for(;s>a||r>a;)o.push([Math.ceil(s/a),Math.ceil(r/a)]),a+=a;break;case"truncated":let t=s,e=r;for(;t>a||e>a;)o.push([Math.ceil(t/a),Math.ceil(e/a)]),t>>=1,e>>=1;break;default:ct(!1,53)}o.push([1,1]),o.reverse();const u=[n],l=[0];for(let t=1,e=o.length;t<e;t++)u.push(n<<t),l.push(o[t-1][0]*o[t-1][1]+l[t-1]);u.reverse();const c=new eu({tileSize:h,extent:t.extent||[0,-r,s,0],resolutions:u});let f=t.url;!f||f.includes("{TileGroup}")||f.includes("{tileIndex}")||(f+="{TileGroup}/{z}-{x}-{y}.jpg");const d=du(f);let p=h*n;const m=cu(d.map((function(t){return function(e,i,n){if(e){const i=e[0],n=e[1],s=e[2],r=n+s*o[i][0],h={z:i,x:n,y:s,tileIndex:r,TileGroup:"TileGroup"+((r+l[i])/p|0)};return t.replace(/\{(\w+?)\}/g,(function(t,e){return h[e]}))}}}))),v=Jd.bind(null,ia(h*n));super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,tilePixelRatio:n,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:v,tileGrid:c,tileUrlFunction:m,transition:t.transition}),this.zDirection=t.zDirection;const g=m(c.getTileCoordForCoordAndResolution(ye(c.getExtent()),u[u.length-1]),1,null),y=new Image;y.addEventListener("error",function(){p=h,this.changed()}.bind(this)),y.src=g}};const tp="version1",ep="version2",ip="version3",np={};np[tp]={level0:{supports:[],formats:[],qualities:["native"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["native"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["native","color","grey","bitonal"]}},np[ep]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","sizeByW","sizeByH","sizeByPct"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByDistortedWh","sizeByWh"],formats:["jpg","png"],qualities:["default","bitonal"]}},np[ip]={level0:{supports:[],formats:["jpg"],qualities:["default"]},level1:{supports:["regionByPx","regionSquare","sizeByW","sizeByH","sizeByWh"],formats:["jpg"],qualities:["default"]},level2:{supports:["regionByPx","regionSquare","regionByPct","sizeByW","sizeByH","sizeByPct","sizeByConfinedWh","sizeByWh"],formats:["jpg","png"],qualities:["default"]}},np.none={none:{supports:[],formats:[],qualities:[]}};const sp=/^https?:\/\/library\.stanford\.edu\/iiif\/image-api\/(?:1\.1\/)?compliance\.html#level[0-2]$/,rp=/^https?:\/\/iiif\.io\/api\/image\/2\/level[0-2](?:\.json)?$/,op=/(^https?:\/\/iiif\.io\/api\/image\/3\/level[0-2](?:\.json)?$)|(^level[0-2]$)/;const hp={};hp[tp]=function(t){let e=t.getComplianceLevelSupportedFeatures();return void 0===e&&(e=np[tp].level0),{url:void 0===t.imageInfo["@id"]?void 0:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),supports:e.supports,formats:[...e.formats,void 0===t.imageInfo.formats?[]:t.imageInfo.formats],qualities:[...e.qualities,void 0===t.imageInfo.qualities?[]:t.imageInfo.qualities],resolutions:t.imageInfo.scale_factors,tileSize:void 0!==t.imageInfo.tile_width?void 0!==t.imageInfo.tile_height?[t.imageInfo.tile_width,t.imageInfo.tile_height]:[t.imageInfo.tile_width,t.imageInfo.tile_width]:null!=t.imageInfo.tile_height?[t.imageInfo.tile_height,t.imageInfo.tile_height]:void 0}},hp[ep]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=Array.isArray(t.imageInfo.profile)&&t.imageInfo.profile.length>1,n=i&&t.imageInfo.profile[1].supports?t.imageInfo.profile[1].supports:[],s=i&&t.imageInfo.profile[1].formats?t.imageInfo.profile[1].formats:[],r=i&&t.imageInfo.profile[1].qualities?t.imageInfo.profile[1].qualities:[];return{url:t.imageInfo["@id"].replace(/\/?(?:info\.json)?$/g,""),sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return void 0===t.height?t.width:t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:[...e.supports,...n],formats:[...e.formats,...s],qualities:[...e.qualities,...r]}},hp[ip]=function(t){const e=t.getComplianceLevelSupportedFeatures(),i=void 0===t.imageInfo.extraFormats?e.formats:[...e.formats,...t.imageInfo.extraFormats],n=void 0!==t.imageInfo.preferredFormats&&Array.isArray(t.imageInfo.preferredFormats)&&t.imageInfo.preferredFormats.length>0?t.imageInfo.preferredFormats.filter((function(t){return["jpg","png","gif"].includes(t)})).reduce((function(t,e){return void 0===t&&i.includes(e)?e:t}),void 0):void 0;return{url:t.imageInfo.id,sizes:void 0===t.imageInfo.sizes?void 0:t.imageInfo.sizes.map((function(t){return[t.width,t.height]})),tileSize:void 0===t.imageInfo.tiles?void 0:[t.imageInfo.tiles.map((function(t){return t.width}))[0],t.imageInfo.tiles.map((function(t){return t.height}))[0]],resolutions:void 0===t.imageInfo.tiles?void 0:t.imageInfo.tiles.map((function(t){return t.scaleFactors}))[0],supports:void 0===t.imageInfo.extraFeatures?e.supports:[...e.supports,...t.imageInfo.extraFeatures],formats:i,qualities:void 0===t.imageInfo.extraQualities?e.qualities:[...e.qualities,...t.imageInfo.extraQualities],preferredFormat:n}};var ap=class{constructor(t){this.setImageInfo(t)}setImageInfo(t){this.imageInfo="string"==typeof t?JSON.parse(t):t}getImageApiVersion(){if(void 0===this.imageInfo)return;let t=this.imageInfo["@context"]||"ol-no-context";"string"==typeof t&&(t=[t]);for(let e=0;e<t.length;e++)switch(t[e]){case"http://library.stanford.edu/iiif/image-api/1.1/context.json":case"http://iiif.io/api/image/1/context.json":return tp;case"http://iiif.io/api/image/2/context.json":return ep;case"http://iiif.io/api/image/3/context.json":return ip;case"ol-no-context":if(this.getComplianceLevelEntryFromProfile(tp)&&this.imageInfo.identifier)return tp}ct(!1,61)}getComplianceLevelEntryFromProfile(t){if(void 0!==this.imageInfo&&void 0!==this.imageInfo.profile)switch(void 0===t&&(t=this.getImageApiVersion()),t){case tp:if(sp.test(this.imageInfo.profile))return this.imageInfo.profile;break;case ip:if(op.test(this.imageInfo.profile))return this.imageInfo.profile;break;case ep:if("string"==typeof this.imageInfo.profile&&rp.test(this.imageInfo.profile))return this.imageInfo.profile;if(Array.isArray(this.imageInfo.profile)&&this.imageInfo.profile.length>0&&"string"==typeof this.imageInfo.profile[0]&&rp.test(this.imageInfo.profile[0]))return this.imageInfo.profile[0]}}getComplianceLevelFromProfile(t){const e=this.getComplianceLevelEntryFromProfile(t);if(void 0===e)return;const i=e.match(/level[0-2](?:\.json)?$/g);return Array.isArray(i)?i[0].replace(".json",""):void 0}getComplianceLevelSupportedFeatures(){if(void 0===this.imageInfo)return;const t=this.getImageApiVersion(),e=this.getComplianceLevelFromProfile(t);return void 0===e?np.none.none:np[t][e]}getTileSourceOptions(t){const e=t||{},i=this.getImageApiVersion();if(void 0===i)return;const n=void 0===i?void 0:hp[i](this);return void 0!==n?{url:n.url,version:i,size:[this.imageInfo.width,this.imageInfo.height],sizes:n.sizes,format:void 0!==e.format&&n.formats.includes(e.format)?e.format:void 0!==n.preferredFormat?n.preferredFormat:"jpg",supports:n.supports,quality:e.quality&&n.qualities.includes(e.quality)?e.quality:n.qualities.includes("native")?"native":"default",resolutions:Array.isArray(n.resolutions)?n.resolutions.sort((function(t,e){return e-t})):void 0,tileSize:n.tileSize}:void 0}};function up(t){return t.toLocaleString("en",{maximumFractionDigits:10})}var lp=class extends lf{constructor(t){const e=t||{};let i=e.url||"";i+=i.lastIndexOf("/")===i.length-1||""===i?"":"/";const n=e.version||ep,s=e.sizes||[],r=e.size;ct(null!=r&&Array.isArray(r)&&2==r.length&&!isNaN(r[0])&&r[0]>0&&!isNaN(r[1])&&r[1]>0,60);const o=r[0],h=r[1],a=e.tileSize,u=e.tilePixelRatio||1,l=e.format||"jpg",c=e.quality||(e.version==tp?"native":"default");let f=e.resolutions||[];const d=e.supports||[],p=e.extent||[0,-h,o,0],m=null!=s&&Array.isArray(s)&&s.length>0,v=void 0!==a&&("number"==typeof a&&Number.isInteger(a)&&a>0||Array.isArray(a)&&a.length>0),g=null!=d&&Array.isArray(d)&&(d.includes("regionByPx")||d.includes("regionByPct"))&&(d.includes("sizeByWh")||d.includes("sizeByH")||d.includes("sizeByW")||d.includes("sizeByPct"));let y,w,x;if(f.sort((function(t,e){return e-t})),v||g)if(null!=a&&("number"==typeof a&&Number.isInteger(a)&&a>0?(y=a,w=a):Array.isArray(a)&&a.length>0&&((1==a.length||null==a[1]&&Number.isInteger(a[0]))&&(y=a[0],w=a[0]),2==a.length&&(Number.isInteger(a[0])&&Number.isInteger(a[1])?(y=a[0],w=a[1]):null==a[0]&&Number.isInteger(a[1])&&(y=a[1],w=a[1])))),void 0!==y&&void 0!==w||(y=$o,w=$o),0==f.length){x=Math.max(Math.ceil(Math.log(o/y)/Math.LN2),Math.ceil(Math.log(h/w)/Math.LN2));for(let t=x;t>=0;t--)f.push(Math.pow(2,t))}else{const t=Math.max(...f);x=Math.round(Math.log(t)/Math.LN2)}else if(y=o,w=h,f=[],m){s.sort((function(t,e){return t[0]-e[0]})),x=-1;const t=[];for(let e=0;e<s.length;e++){const i=o/s[e][0];f.length>0&&f[f.length-1]==i?t.push(e):(f.push(i),x++)}if(t.length>0)for(let e=0;e<t.length;e++)s.splice(t[e]-e,1)}else f.push(1),s.push([o,h]),x=0;const b=new eu({tileSize:[y,w],extent:p,origin:Pe(p),resolutions:f}),M=Jd.bind(null,ia(a||256).map((function(t){return t*u})));super({attributions:e.attributions,attributionsCollapsible:e.attributionsCollapsible,cacheSize:e.cacheSize,crossOrigin:e.crossOrigin,interpolate:e.interpolate,projection:e.projection,reprojectionErrorThreshold:e.reprojectionErrorThreshold,state:e.state,tileClass:M,tileGrid:b,tilePixelRatio:e.tilePixelRatio,tileUrlFunction:function(t,e,r){let a,u;const p=t[0];if(p>x)return;const b=t[1],M=t[2],S=f[p];if(!(void 0===b||void 0===M||void 0===S||b<0||Math.ceil(o/S/y)<=b||M<0||Math.ceil(h/S/w)<=M)){if(g||v){const t=b*y*S,e=M*w*S;let i=y*S,s=w*S,r=y,l=w;if(t+i>o&&(i=o-t),e+s>h&&(s=h-e),t+y*S>o&&(r=Math.floor((o-t+S-1)/S)),e+w*S>h&&(l=Math.floor((h-e+S-1)/S)),0==t&&i==o&&0==e&&s==h)a="full";else if(!g||d.includes("regionByPx"))a=t+","+e+","+i+","+s;else if(d.includes("regionByPct")){a="pct:"+up(t/o*100)+","+up(e/h*100)+","+up(i/o*100)+","+up(s/h*100)}n!=ip||g&&!d.includes("sizeByWh")?!g||d.includes("sizeByW")?u=r+",":d.includes("sizeByH")?u=","+l:d.includes("sizeByWh")?u=r+","+l:d.includes("sizeByPct")&&(u="pct:"+up(100/S)):u=r+","+l}else if(a="full",m){const t=s[p][0],e=s[p][1];u=n==ip?t==o&&e==h?"max":t+","+e:t==o?"full":t+","}else u=n==ip?"max":"full";return i+a+"/"+u+"/0/"+c+"."+l}},transition:e.transition}),this.zDirection=e.zDirection}};var cp=class extends zs{constructor(t,e,i,n,s,r,o){const h=t.getExtent(),a=e.getExtent(),u=a?Se(i,a):i,l=Ka(t,e,ye(u),n),c=new bl(t,e,u,h,.5*l,n),f=r(c.calculateSourceExtent(),l,s),d=f?Gs:$s,p=f?f.getPixelRatio():1;super(i,n,p,d),this.po=e,this.vo=h,this.Lo=c,this.vi=n,this.vu=i,this.gu=f,this.yu=p,this.ya=o,this.$t=null,this.wu=null}disposeInternal(){this.state==js&&this.xu(),super.disposeInternal()}getImage(){return this.$t}getProjection(){return this.po}No(){const t=this.gu.getState();if(t==Ds){const t=Ee(this.vu)/this.vi,e=Me(this.vu)/this.vi;this.$t=Qa(t,e,this.yu,this.gu.getResolution(),this.vo,this.vi,this.vu,this.Lo,[{extent:this.gu.getExtent(),image:this.gu.getImage()}],0,void 0,this.ya)}this.state=t,this.changed()}load(){if(this.state==Gs){this.state=js,this.changed();const t=this.gu.getState();t==Ds||t==Us?this.No():(this.wu=U(this.gu,T,(function(t){const e=this.gu.getState();e!=Ds&&e!=Us||(this.xu(),this.No())}),this),this.gu.load())}}xu(){B(this.wu),this.wu=null}};const fp="imageloadstart",dp="imageloadend",pp="imageloaderror";class mp extends u{constructor(t,e){super(t),this.image=e}}function vp(t,e){t.getImage().src=e}var gp=class extends sf{constructor(t){super({attributions:t.attributions,projection:t.projection,state:t.state,interpolate:void 0===t.interpolate||t.interpolate}),this.on,this.once,this.un,this.Ei=void 0!==t.resolutions?t.resolutions:null,this.bu=null,this.Mu=0}getResolutions(){return this.Ei}findNearestResolution(t){if(this.Ei){const e=p(this.Ei,t,0);t=this.Ei[e]}return t}getImage(t,e,i,n){const s=this.getProjection();if(s&&n&&!tn(s,n)){if(this.bu){if(this.Mu==this.getRevision()&&tn(this.bu.getProjection(),n)&&this.bu.getResolution()==e&&oe(this.bu.getExtent(),t))return this.bu;this.bu.dispose(),this.bu=null}return this.bu=new cp(s,n,t,e,i,function(t,e,i){return this.getImageInternal(t,e,i,s)}.bind(this),this.getInterpolate()),this.Mu=this.getRevision(),this.bu}return s&&(n=s),this.getImageInternal(t,e,i,n)}getImageInternal(e,i,n,s){return t()}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case js:this.loading=!0,i=fp;break;case Ds:this.loading=!1,i=dp;break;case Us:this.loading=!1,i=pp;break;default:return}this.hasListener(i)&&this.dispatchEvent(new mp(i,e))}};var yp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Ta=void 0===t.hidpi||t.hidpi,this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Su=t.params||{},this.Ot=null,this.Pu=[0,0],this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getParams(){return this.Su}getImageInternal(t,e,i,n){if(void 0===this.Gs)return null;e=this.findNearestResolution(e),i=this.Ta?i:1;const s=this.Ot;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;const r={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};Object.assign(r,this.Su);const o=((t=t.slice())[0]+t[2])/2,h=(t[1]+t[3])/2;if(1!=this.Eu){const e=this.Eu*Ee(t)/2,i=this.Eu*Me(t)/2;t[0]=o-e,t[1]=h-i,t[2]=o+e,t[3]=h+i}const a=e/i,u=Math.ceil(Ee(t)/a),l=Math.ceil(Me(t)/a);t[0]=o-a*u/2,t[2]=o+a*u/2,t[1]=h-a*l/2,t[3]=h+a*l/2,this.Pu[0]=u,this.Pu[1]=l;const c=this.Tu(t,this.Pu,i,n,r);return this.Ot=new qs(t,e,i,c,this.qt,this.Gt),this._u=this.getRevision(),this.Ot.addEventListener(T,this.handleImageChange.bind(this)),this.Ot}getImageLoadFunction(){return this.Gt}Tu(t,e,i,n,s){const r=n.getCode().split(/:(?=\d+$)/).pop();s.SIZE=e[0]+","+e[1],s.BBOX=t.join(","),s.BBOXSR=r,s.IMAGESR=r,s.DPI=Math.round(90*i);const o=this.Gs,h=o.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage");return h==o&&ct(!1,50),pu(h,s)}getUrl(){return this.Gs}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}setUrl(t){t!=this.Gs&&(this.Gs=t,this.Ot=null,this.changed())}updateParams(t){Object.assign(this.Su,t),this.Ot=null,this.changed()}};var wp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions,state:t.state}),this.Cu=t.canvasFunction,this.$t=null,this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getImageInternal(t,e,i,n){e=this.findNearestResolution(e);let s=this.$t;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;Ie(t=t.slice(),this.Eu);const r=[Ee(t)/e*i,Me(t)/e*i],o=this.Cu.call(this,t,e,i,r,n);return o&&(s=new Xs(t,e,i,o)),this.$t=s,this._u=this.getRevision(),s}};var xp=class extends gp{constructor(t){super({interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Fu=void 0!==t.displayDpi?t.displayDpi:96,this.Su=t.params||{},this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Ta=void 0===t.hidpi||t.hidpi,this.gt=void 0!==t.metersPerUnit?t.metersPerUnit:1,this.Eu=void 0!==t.ratio?t.ratio:1,this.Iu=void 0!==t.useOverlay&&t.useOverlay,this.Ot=null,this._u=0}getParams(){return this.Su}getImageInternal(t,e,i,n){e=this.findNearestResolution(e),i=this.Ta?i:1;let s=this.Ot;if(s&&this._u==this.getRevision()&&s.getResolution()==e&&s.getPixelRatio()==i&&Jt(s.getExtent(),t))return s;1!=this.Eu&&Ie(t=t.slice(),this.Eu);const r=[Ee(t)/e*i,Me(t)/e*i];if(void 0!==this.Gs){const o=this.getUrl(this.Gs,this.Su,t,r,n);s=new qs(t,e,i,o,this.qt,this.Gt),s.addEventListener(T,this.handleImageChange.bind(this))}else s=null;return this.Ot=s,this._u=this.getRevision(),s}getImageLoadFunction(){return this.Gt}updateParams(t){Object.assign(this.Su,t),this.changed()}getUrl(t,e,i,n,s){const r=function(t,e,i,n){const s=Ee(t),r=Me(t),o=e[0],h=e[1],a=.0254/n;return h*s>o*r?s*i/(o*a):r*i/(h*a)}(i,n,this.gt,this.Fu),o=ye(i),h={OPERATION:this.Iu?"GETDYNAMICMAPOVERLAYIMAGE":"GETMAPIMAGE",VERSION:"2.0.0",LOCALE:"en",CLIENTAGENT:"ol/source/ImageMapGuide source",CLIP:"1",SETDISPLAYDPI:this.Fu,SETDISPLAYWIDTH:Math.round(n[0]),SETDISPLAYHEIGHT:Math.round(n[1]),SETVIEWSCALE:r,SETVIEWCENTERX:o[0],SETVIEWCENTERY:o[1]};return Object.assign(h,e),pu(t,h)}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}};var bp=class extends gp{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp;super({attributions:t.attributions,interpolate:t.interpolate,projection:Yi(t.projection)}),this.Gs=t.url,this.Au=t.imageExtent,this.Ot=new qs(this.Au,void 0,1,this.Gs,e,i),this.Pu=t.imageSize?t.imageSize:null,this.Ot.addEventListener(T,this.handleImageChange.bind(this))}getImageExtent(){return this.Au}getImageInternal(t,e,i,n){return Te(t,this.Ot.getExtent())?this.Ot:null}getUrl(){return this.Gs}handleImageChange(t){if(this.Ot.getState()==Ds){const t=this.Ot.getExtent(),e=this.Ot.getImage();let i,n;this.Pu?(i=this.Pu[0],n=this.Pu[1]):(i=e.width,n=e.height);const s=Ee(t),r=Me(t),o=s/i,h=r/n;let a=i,u=n;if(o>h?a=Math.round(s/h):u=Math.round(r/o),a!==i||u!==n){const t=Ys(a,u);this.getInterpolate()||(t.imageSmoothingEnabled=!1);const s=t.canvas;t.drawImage(e,0,0,i,n,0,0,s.width,s.height),this.Ot.setImage(s)}}super.handleImageChange(t)}};const Mp="1.3.0",Sp=[101,101];var Pp=class extends gp{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:t.interpolate,projection:t.projection,resolutions:t.resolutions}),this.qt=void 0!==t.crossOrigin?t.crossOrigin:null,this.Gs=t.url,this.Gt=void 0!==t.imageLoadFunction?t.imageLoadFunction:vp,this.Su=t.params||{},this.ku=!0,this.Ru(),this.Lu=t.serverType,this.Ta=void 0===t.hidpi||t.hidpi,this.Ot=null,this.Pu=[0,0],this._u=0,this.Eu=void 0!==t.ratio?t.ratio:1.5}getFeatureInfoUrl(t,e,i,n){if(void 0===this.Gs)return;const s=Yi(i),r=this.getProjection();r&&r!==s&&(e=Ka(r,s,t,e),t=sn(t,s,r));const o=xe(t,e,0,Sp),h={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.Su.LAYERS};Object.assign(h,this.Su,n);const a=gi((t[0]-o[0])/e,4),u=gi((o[3]-t[1])/e,4);return h[this.ku?"I":"X"]=a,h[this.ku?"J":"Y"]=u,this.Tu(o,Sp,1,r||s,h)}getLegendUrl(t,e){if(void 0===this.Gs)return;const i={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.Su.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),pu(this.Gs,i)}getParams(){return this.Su}getImageInternal(t,e,i,n){if(void 0===this.Gs)return null;e=this.findNearestResolution(e),1==i||this.Ta&&void 0!==this.Lu||(i=1);const s=e/i,r=ye(t),o=xe(r,s,0,[yi(Ee(t)/s,4),yi(Me(t)/s,4)]),h=xe(r,s,0,[yi(this.Eu*Ee(t)/s,4),yi(this.Eu*Me(t)/s,4)]),a=this.Ot;if(a&&this._u==this.getRevision()&&a.getResolution()==e&&a.getPixelRatio()==i&&Jt(a.getExtent(),o))return a;const u={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};Object.assign(u,this.Su),this.Pu[0]=vi(Ee(h)/s,4),this.Pu[1]=vi(Me(h)/s,4);const l=this.Tu(h,this.Pu,i,n,u);return this.Ot=new qs(h,e,i,l,this.qt,this.Gt),this._u=this.getRevision(),this.Ot.addEventListener(T,this.handleImageChange.bind(this)),this.Ot}getImageLoadFunction(){return this.Gt}Tu(t,e,i,n,s){if(ct(void 0!==this.Gs,9),s[this.ku?"CRS":"SRS"]=n.getCode(),"STYLES"in this.Su||(s.STYLES=""),1!=i)switch(this.Lu){case"geoserver":const t=90*i+.5|0;"FORMAT_OPTIONS"in s?s.FORMAT_OPTIONS+=";dpi:"+t:s.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":s.MAP_RESOLUTION=90*i;break;case"carmentaserver":case"qgis":s.DPI=90*i;break;default:ct(!1,8)}s.WIDTH=e[0],s.HEIGHT=e[1];const r=n.getAxisOrientation();let o;return o=this.ku&&"ne"==r.substr(0,2)?[t[1],t[0],t[3],t[2]]:t,s.BBOX=o.join(","),pu(this.Gs,s)}getUrl(){return this.Gs}setImageLoadFunction(t){this.Ot=null,this.Gt=t,this.changed()}setUrl(t){t!=this.Gs&&(this.Gs=t,this.Ot=null,this.changed())}updateParams(t){Object.assign(this.Su,t),this.Ru(),this.Ot=null,this.changed()}Ru(){const t=this.Su.VERSION||Mp;this.ku=xi(t,"1.3")>=0}};const _p={"image/png":!0,"image/jpeg":!0,"image/gif":!0,"image/webp":!0},Ep={"application/vnd.mapbox-vector-tile":!0,"application/geo+json":!0};function Tp(t,e){let i,n;for(let s=0;s<t.length;++s){const r=t[s];if("item"===r.rel){if(r.type===e){i=r.href;break}(_p[r.type]||!n&&r.type.startsWith("image/"))&&(n=r.href)}}if(!i){if(!n)throw new Error('Could not find "item" link');i=n}return i}function Cp(t,e,i){let n,s;const r={};for(let i=0;i<t.length;++i){const o=t[i];if(r[o.type]=o.href,"item"===o.rel){if(o.type===e){n=o.href;break}Ep[o.type]&&(s=o.href)}}if(!n&&i)for(let t=0;t<i.length;++t){const e=i[t];if(r[e]){n=r[e];break}}if(!n){if(!s)throw new Error('Could not find "item" link');n=s}return n}function Fp(t,e,i,n){let s=t.projection;if(!s&&(s=Yi(e.crs),!s))throw new Error(`Unsupported CRS: ${e.crs}`);const r="en"!==s.getAxisOrientation().substr(0,2),o=e.tileMatrices,h={};for(let t=0;t<o.length;++t){const e=o[t];h[e.id]=e}const a={},u=[];if(n)for(let t=0;t<n.length;++t){const e=n[t],i=e.tileMatrix;u.push(i),a[i]=e}else for(let t=0;t<o.length;++t){const e=o[t].id;u.push(e)}const l=u.length,c=new Array(l),f=new Array(l),d=new Array(l),p=new Array(l),m=[-1/0,-1/0,1/0,1/0];for(let t=0;t<l;++t){const e=u[t],i=h[e],n=i.pointOfOrigin;c[t]=r?[n[1],n[0]]:n,f[t]=i.cellSize,d[t]=[i.matrixWidth,i.matrixHeight],p[t]=[i.tileWidth,i.tileHeight];const s=a[e];if(s){const e=i.cellSize*i.tileWidth,n=c[t][0]+s.minTileCol*e,r=c[t][0]+(s.maxTileCol+1)*e,o=i.cellSize*i.tileHeight;let h,a;"bottomLeft"===i.cornerOfOrigin?(h=c[t][1]+s.minTileRow*o,a=c[t][1]+(s.maxTileRow+1)*o):(h=c[t][1]-(s.maxTileRow+1)*o,a=c[t][1]-s.minTileRow*o),Se(m,[n,h,r,a],m)}}const v=new eu({origins:c,resolutions:f,sizes:d,tileSizes:p,extent:n?m:void 0}),g=t.context,y=t.url;return{grid:v,urlTemplate:i,urlFunction:function(t,e,s){if(!t)return;const r=u[t[0]],o=h[r],l="bottomLeft"===o.cornerOfOrigin,c={tileMatrix:r,tileCol:t[1],tileRow:l?-t[2]-1:t[2]};if(n){const t=a[o.id];if(c.tileCol<t.minTileCol||c.tileCol>t.maxTileCol||c.tileRow<t.minTileRow||c.tileRow>t.maxTileRow)return}Object.assign(c,g);const f=i.replace(/\{(\w+?)\}/g,(function(t,e){return c[e]}));return za(y,f)}}}function Ip(t){return Oa(t.url).then((function(e){return function(t,e){const i=e.tileMatrixSetLimits;let n;if("map"===e.dataType)n=Tp(e.links,t.mediaType);else{if("vector"!==e.dataType)throw new Error('Expected tileset data type to be "map" or "vector"');n=Cp(e.links,t.mediaType,t.supportedMediaTypes)}if(e.tileMatrixSet)return Fp(t,e.tileMatrixSet,n,i);const s=e.links.find((t=>"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 r=s.href;return Oa(za(t.url,r)).then((function(e){return Fp(t,e,n,i)}))}(t,e)}))}var Ap=class extends lf{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});Ip({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,context:t.context||null}).then(this.Nu.bind(this)).catch(this.Ou.bind(this))}Nu(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}Ou(t){console.error(t),this.setState("error")}};var kp=class extends af{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||au(e),n=t.tileGrid||ru({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:Rp,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.Os=t.format?t.format:null,this.sourceTileCache=new xa(this.tileCache.highWaterMark),this.Da=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Ea,this.zu={}}getFeaturesInExtent(t){const e=[],i=this.tileCache;if(0===i.getCount())return e;const n=ga(i.peekFirstKey())[0],s=this.tileGrid;return i.forEach((function(i){if(i.tileCoord[0]!==n||i.getState()!==it)return;const r=i.getSourceTiles();for(let i=0,n=r.length;i<n;++i){const n=r[i],o=n.tileCoord;if(Te(t,s.getTileCoordExtent(o))){const i=n.getFeatures();if(i)for(let n=0,s=i.length;n<s;++n){const s=i[n],r=s.getGeometry();Te(t,r.getExtent())&&e.push(s)}}}})),e}getOverlaps(){return this.Da}clear(){this.tileCache.clear(),this.sourceTileCache.clear()}expireCache(t,e){const i=this.getTileCacheForProjection(t),n=Object.keys(e).reduce(((t,e)=>{const n=va(e),s=i.peek(n);if(s){const e=s.sourceTiles;for(let i=0,n=e.length;i<n;++i)t[e[i].getKey()]=!0}return t}),{});super.expireCache(t,e),this.sourceTileCache.expireCache(n)}getSourceTiles(t,e,i){if(i.getState()===tt){i.setState(et);const n=i.wrappedTileCoord,s=this.getTileGridForProjection(e),r=s.getTileCoordExtent(n),o=n[0],h=s.getResolution(o);Vt(r,-h,r);const a=this.tileGrid,u=a.getExtent();u&&Se(r,u,r);const l=a.getZForResolution(h,this.zDirection);a.forEachTileCoord(r,l,(n=>{const s=this.tileUrlFunction(n,t,e),r=this.sourceTileCache.containsKey(s)?this.sourceTileCache.get(s):new this.tileClass(n,s?tt:st,s,this.Os,this.tileLoadFunction);i.sourceTiles.push(r);const o=r.getState();if(o<it){const t=e=>{this.handleTileChange(e);const n=r.getState();if(n===it||n===nt){const e=r.getKey();e in i.errorTileKeys?r.getState()===it&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,n===nt?i.errorTileKeys[e]=!0:r.removeEventListener(T,t),0===i.loadingSourceTiles&&i.setState(_(i.errorTileKeys)?it:nt)}};r.addEventListener(T,t),i.loadingSourceTiles++}o===tt&&(r.extent=a.getTileCoordExtent(n),r.projection=e,r.resolution=a.getResolution(n[0]),this.sourceTileCache.set(s,r),r.load())})),i.loadingSourceTiles||i.setState(i.sourceTiles.some((t=>t.getState()===nt))?nt:it)}return i.sourceTiles}getTile(t,e,i,n,s){const r=pa(t,e,i),o=this.getKey();let h;if(this.tileCache.containsKey(r)&&(h=this.tileCache.get(r),h.key===o))return h;const a=[t,e,i];let u=this.getTileCoordForTileUrlFunction(a,s);const l=this.getTileGrid().getExtent(),c=this.getTileGridForProjection(s);if(u&&l){const e=c.getTileCoordExtent(u);Vt(e,-c.getResolution(t),e),Te(l,e)||(u=null)}let f=!0;if(null!==u){const e=this.tileGrid,i=c.getResolution(t),r=e.getZForResolution(i,1),o=c.getTileCoordExtent(u);Vt(o,-i,o),e.forEachTileCoord(o,r,function(t){f=f&&!this.tileUrlFunction(t,n,s)}.bind(this))}const d=new _a(a,f?st:tt,u,this.getSourceTiles.bind(this,n,s));return d.key=o,h?(d.interimTile=h,d.refreshInterimChain(),this.tileCache.replace(r,d)):this.tileCache.set(r,d),d}getTileGridForProjection(t){const e=t.getCode();let i=this.zu[e];if(!i){const t=this.tileGrid,n=t.getResolutions().slice(),s=n.map((function(e,i){return t.getOrigin(i)})),r=n.map((function(e,i){return t.getTileSize(i)})),o=43;for(let t=n.length;t<o;++t)n.push(n[t-1]/2),s.push(s[t-1]),r.push(r[t-1]);i=new eu({extent:t.getExtent(),origins:s,resolutions:n,tileSizes:r}),this.zu[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const n=ia(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(n[0]*e),Math.round(n[1]*e)]}updateCacheSize(t,e){super.updateCacheSize(2*t,e),this.sourceTileCache.highWaterMark=this.getTileCacheForProjection(e).highWaterMark}};function Rp(t,e){t.setLoader((function(i,n,s){Ia(e,t.getFormat(),i,n,s,t.onLoad.bind(t),t.onError.bind(t))}))}var Lp=class extends kp{constructor(t){super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,format:t.format,overlaps:t.overlaps,projection:t.projection,tileClass:t.tileClass,transition:t.transition,wrapX:t.wrapX,zDirection:t.zDirection,state:"loading"});Ip({url:t.url,projection:this.getProjection(),mediaType:t.mediaType,supportedMediaTypes:t.format.supportedMediaTypes,context:t.context||null}).then(this.Nu.bind(this)).catch(this.Ou.bind(this))}Nu(t){this.tileGrid=t.grid,this.setTileUrlFunction(t.urlFunction,t.urlTemplate),this.setState("ready")}Ou(t){console.error(t),this.setState("error")}};const Np='&#169; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors.';var Op=class extends df{constructor(t){let e;e=void 0!==(t=t||{}).attributions?t.attributions:[Np];const i=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",n=void 0!==t.url?t.url:"https://{a-c}.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})}};var zp=class extends kr{constructor(t){super(t=t||{})}};const Gp=[];let jp=null;var Dp=class extends Tl{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=[1,0,0,1,0,0],this.pixelTransform=[1,0,0,1,0,0],this.inversePixelTransform=[1,0,0,1,0,0],this.context=null,this.containerReused=!1,this.Bo=null,this.frameState=null}getImageData(t,e,i){let n;jp||function(){const t=document.createElement("canvas");t.width=1,t.height=1,jp=t.getContext("2d")}(),jp.clearRect(0,0,1,1);try{jp.drawImage(t,e,i,1,1,0,0,1,1),n=jp.getImageData(0,0,1,1).data}catch(t){return jp=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 s,r;if(t&&t.className===n&&(!i||t&&t.style.backgroundColor&&g(hr(t.style.backgroundColor),hr(i)))){const e=t.firstElementChild;e instanceof HTMLCanvasElement&&(r=e.getContext("2d"))}if(r&&r.canvas.style.transform===e?(this.container=t,this.context=r,this.containerReused=!0):this.containerReused&&(this.container=null,this.context=null,this.containerReused=!1),!this.container){s=document.createElement("div"),s.className=n;let t=s.style;t.position="absolute",t.width="100%",t.height="100%",r=Ys();const e=r.canvas;s.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=s,this.context=r}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const n=Pe(i),s=_e(i),r=ge(i),o=ve(i);At(e.coordinateToPixelTransform,n),At(e.coordinateToPixelTransform,s),At(e.coordinateToPixelTransform,r),At(e.coordinateToPixelTransform,o);const h=this.inversePixelTransform;At(h,n),At(h,s),At(h,r),At(h,o),t.save(),t.beginPath(),t.moveTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}Xo(t,e,i){const n=this.getLayer();if(n.hasListener(t)){const s=new Nr(t,this.inversePixelTransform,i,e);n.dispatchEvent(s)}}preRender(t,e){this.frameState=e,this.Xo(Er,t,e)}postRender(t,e){this.Xo(Tr,t,e)}getRenderTransform(t,e,i,n,s,r,o){const h=s/2,a=r/2,u=n/e,l=-u,c=-t[0]+o,f=-t[1];return Ot(this.tempTransform,h,a,u,l,-i,c,f)}disposeInternal(){delete this.frameState,super.disposeInternal()}};var Up=class extends Dp{constructor(t){super(t),this.Ot=null}getImage(){return this.Ot?this.Ot.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,n=t.viewState,s=n.resolution,r=this.getLayer().getSource(),o=t.viewHints;let h=t.extent;if(void 0!==e.extent&&(h=Se(h,fn(e.extent,n.projection))),!o[jo]&&!o[Do]&&!Ce(h))if(r){const t=n.projection,e=r.getImage(h,s,i,t);e&&(this.loadImage(e)?this.Ot=e:e.getState()===$s&&(this.Ot=null))}else this.Ot=null;return!!this.Ot}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=At(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Kt(s,n))return null;const r=this.Ot.getExtent(),o=this.Ot.getImage(),h=Ee(r),a=Math.floor(o.width*((n[0]-r[0])/h));if(a<0||a>=o.width)return null;const u=Me(r),l=Math.floor(o.height*((r[3]-n[1])/u));return l<0||l>=o.height?null:this.getImageData(o,a,l)}renderFrame(t,e){const i=this.Ot,n=i.getExtent(),s=i.getResolution(),r=i.getPixelRatio(),o=t.layerStatesArray[t.layerIndex],h=t.pixelRatio,a=t.viewState,u=a.center,l=h*s/(a.resolution*r),c=t.extent,f=a.resolution,d=a.rotation,p=Math.round(Ee(c)/f*h),m=Math.round(Me(c)/f*h);Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/h,1/h,d,-p/2,-m/2),zt(this.inversePixelTransform,this.pixelTransform);const v=Dt(this.pixelTransform);this.useContainer(e,v,this.getBackground(t));const g=this.context,y=g.canvas;y.width!=p||y.height!=m?(y.width=p,y.height=m):this.containerReused||g.clearRect(0,0,p,m);let w=!1,x=!0;if(o.extent){const e=fn(o.extent,a.projection);x=Te(e,t.extent),w=x&&!Jt(e,t.extent),w&&this.clipUnrotated(g,t,e)}const b=i.getImage(),M=Ot(this.tempTransform,p/2,m/2,l,l,0,r*(n[0]-u[0])/s,r*(u[1]-n[3])/s);this.renderedResolution=s*h/r;const S=b.width*M[0],P=b.height*M[3];if(this.getLayer().getSource().getInterpolate()||(g.imageSmoothingEnabled=!1),this.preRender(g,t),x&&S>=.5&&P>=.5){const t=M[4],e=M[5],i=o.opacity;let n;1!==i&&(n=g.globalAlpha,g.globalAlpha=i),g.drawImage(b,0,0,+b.width,+b.height,t,e,S,P),1!==i&&(g.globalAlpha=n)}return this.postRender(g,t),w&&g.restore(),g.imageSmoothingEnabled=!0,v!==y.style.transform&&(y.style.transform=v),this.container}};var $p=class extends zp{constructor(t){super(t)}createRenderer(){return new Up(this)}getData(t){return super.getData(t)}},Bp="preload",qp="useInterimTilesOnError";var Xp=class extends kr{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(Bp)}setPreload(t){this.set(Bp,t)}getUseInterimTilesOnError(){return this.get(qp)}setUseInterimTilesOnError(t){this.set(qp,t)}getData(t){return super.getData(t)}};var Yp=class extends Dp{constructor(t){super(t),this.extentChanged=!0,this.Gu=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedRevision,this.renderedTiles=[],this.ju=!1,this.tmpExtent=[1/0,1/0,-1/0,-1/0],this.Du=new Sa(0,0,0,0)}isDrawableTile(t){const e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==it||i==st||i==nt&&!n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState.projection,o=this.getLayer();let h=o.getSource().getTile(t,e,i,s,r);return h.getState()==nt&&o.getUseInterimTilesOnError()&&o.getPreload()>0&&(this.ju=!0),this.isDrawableTile(h)||(h=h.getInterimTile()),h}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),n=At(e.pixelToCoordinateTransform,t.slice()),s=i.getExtent();if(s&&!Kt(s,n))return null;const r=e.pixelRatio,o=e.viewState.projection,h=e.viewState,a=i.getRenderSource(),u=a.getTileGridForProjection(h.projection),l=a.getTilePixelRatio(e.pixelRatio);for(let t=u.getZForResolution(h.resolution);t>=u.getMinZoom();--t){const e=u.getTileCoordForCoordAndZ(n,t),i=a.getTile(t,e[1],e[2],r,o);if(!(i instanceof tr||i instanceof Ml))return null;if(i.getState()!==it)continue;const s=u.getOrigin(t),c=ia(u.getTileSize(t)),f=u.getResolution(t),d=Math.floor(l*((n[0]-s[0])/f-e[1]*c[0])),p=Math.floor(l*((s[1]-n[1])/f-e[2]*c[1])),m=Math.round(l*a.getGutterForProjection(h.projection));return this.getImageData(i.getImage(),d+m,p+m)}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 n=t.layerStatesArray[t.layerIndex],s=t.viewState,r=s.projection,o=s.resolution,h=s.center,a=s.rotation,u=t.pixelRatio,l=this.getLayer(),c=l.getSource(),f=c.getRevision(),p=c.getTileGridForProjection(r),m=p.getZForResolution(o,c.zDirection),v=p.getResolution(m);let g=t.extent;const y=t.viewState.resolution,w=c.getTilePixelRatio(u),x=Math.round(Ee(g)/y*u),b=Math.round(Me(g)/y*u),M=n.extent&&fn(n.extent,r);M&&(g=Se(g,fn(n.extent,r)));const S=v*x/2/w,P=v*b/2/w,_=[h[0]-S,h[1]-P,h[0]+S,h[1]+P],E=p.getTileRangeForExtentAndZ(g,m),T={};T[m]={};const C=this.createLoadedTileFinder(c,r,T),F=this.tmpExtent,I=this.Du;this.ju=!1;const A=a?be(s.center,y,a,t.size):void 0;for(let e=E.minX;e<=E.maxX;++e)for(let s=E.minY;s<=E.maxY;++s){if(a&&!p.tileCoordIntersectsViewport([m,e,s],A))continue;const r=this.getTile(m,e,s,t);if(this.isDrawableTile(r)){const e=i(this);if(r.getState()==it){T[m][r.tileCoord.toString()]=r;let t=r.inTransition(e);t&&1!==n.opacity&&(r.endTransition(e),t=!1),this.ju||!t&&this.renderedTiles.includes(r)||(this.ju=!0)}if(1===r.getAlpha(e,t.time))continue}const o=p.getTileCoordChildTileRange(r.tileCoord,I,F);let h=!1;o&&(h=C(m+1,o)),h||p.forEachTileCoordParentTileRange(r.tileCoord,C,I,F)}const k=v/o*u/w;Ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/u,1/u,a,-x/2,-b/2);const R=Dt(this.pixelTransform);this.useContainer(e,R,this.getBackground(t));const L=this.context,N=L.canvas;zt(this.inversePixelTransform,this.pixelTransform),Ot(this.tempTransform,x/2,b/2,k,k,0,-x/2,-b/2),N.width!=x||N.height!=b?(N.width=x,N.height=b):this.containerReused||L.clearRect(0,0,x,b),M&&this.clipUnrotated(L,t,M),c.getInterpolate()||(L.imageSmoothingEnabled=!1),this.preRender(L,t),this.renderedTiles.length=0;let O,z,G,j=Object.keys(T).map(Number);j.sort(d),1!==n.opacity||this.containerReused&&!c.getOpaque(t.viewState.projection)?(O=[],z=[]):j=j.reverse();for(let e=j.length-1;e>=0;--e){const n=j[e],s=c.getTilePixelSize(n,u,r),o=p.getResolution(n)/v,h=s[0]*o*k,a=s[1]*o*k,l=p.getTileCoordForCoordAndZ(Pe(_),n),f=p.getTileCoordExtent(l),d=At(this.tempTransform,[w*(f[0]-_[0])/v,w*(_[3]-f[3])/v]),g=w*c.getGutterForProjection(r),y=T[n];for(const e in y){const s=y[e],r=s.tileCoord,o=l[1]-r[1],u=Math.round(d[0]-(o-1)*h),f=l[2]-r[2],p=Math.round(d[1]-(f-1)*a),v=Math.round(d[0]-o*h),w=Math.round(d[1]-f*a),x=u-v,b=p-w,M=m===n,S=M&&1!==s.getAlpha(i(this),t.time);let P=!1;if(!S)if(O){G=[v,w,v+x,w,v+x,w+b,v,w+b];for(let t=0,e=O.length;t<e;++t)if(m!==n&&n<z[t]){const e=O[t];Te([v,w,v+x,w+b],[e[0],e[3],e[4],e[7]])&&(P||(L.save(),P=!0),L.beginPath(),L.moveTo(G[0],G[1]),L.lineTo(G[2],G[3]),L.lineTo(G[4],G[5]),L.lineTo(G[6],G[7]),L.moveTo(e[6],e[7]),L.lineTo(e[4],e[5]),L.lineTo(e[2],e[3]),L.lineTo(e[0],e[1]),L.clip())}O.push(G),z.push(n)}else L.clearRect(v,w,x,b);this.drawTileImage(s,t,v,w,x,b,g,M),O&&!S?(P&&L.restore(),this.renderedTiles.unshift(s)):this.renderedTiles.push(s),this.updateUsedTiles(t.usedTiles,c,s)}}return this.renderedRevision=f,this.renderedResolution=v,this.extentChanged=!this.Gu||!oe(this.Gu,_),this.Gu=_,this.renderedPixelRatio=u,this.renderedProjection=r,this.manageTilePyramid(t,c,p,u,r,g,m,l.getPreload()),this.scheduleExpireCache(t,c),this.postRender(L,t),n.extent&&L.restore(),L.imageSmoothingEnabled=!0,R!==N.style.transform&&(N.style.transform=R),this.container}drawTileImage(t,e,n,s,r,o,h,a){const u=this.getTileImage(t);if(!u)return;const l=i(this),c=e.layerStatesArray[e.layerIndex],f=c.opacity*(a?t.getAlpha(l,e.time):1),d=f!==this.context.globalAlpha;d&&(this.context.save(),this.context.globalAlpha=f),this.context.drawImage(u,h,h,u.width-2*h,u.height-2*h,n,s,r,o),d&&this.context.restore(),f!==c.opacity?e.animate=!0:a&&t.endTransition(l)}getImage(){const t=this.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}scheduleExpireCache(t,e){if(e.canExpireCache()){const n=function(t,e,n){const s=i(t);s in n.usedTiles&&t.expireCache(n.viewState.projection,n.usedTiles[s])}.bind(null,e);t.postRenderFunctions.push(n)}}updateUsedTiles(t,e,n){const s=i(e);s in t||(t[s]={}),t[s][n.getKey()]=!0}manageTilePyramid(t,e,n,s,r,o,h,a,u){const l=i(e);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],f=t.tileQueue,d=n.getMinZoom(),p=t.viewState.rotation,m=p?be(t.viewState.center,t.viewState.resolution,p,t.size):void 0;let v,g,y,w,x,b,M=0;for(b=d;b<=h;++b)for(g=n.getTileRangeForExtentAndZ(o,b,g),y=n.getResolution(b),w=g.minX;w<=g.maxX;++w)for(x=g.minY;x<=g.maxY;++x)p&&!n.tileCoordIntersectsViewport([b,w,x],m)||(h-b<=a?(++M,v=e.getTile(b,w,x,s,r),v.getState()==tt&&(c[v.getKey()]=!0,f.isKeyQueued(v.getKey())||f.enqueue([v,l,n.getTileCoordCenter(v.tileCoord),y])),void 0!==u&&u(v)):e.useTile(b,w,x,r));e.updateCacheSize(M,r)}};var Zp=class extends Xp{constructor(t){super(t)}createRenderer(){return new Yp(this)}};let Vp,Wp=!0;try{new ImageData(10,10)}catch(t){Wp=!1}function Hp(t,e,i){if(Wp)return new ImageData(t,e,i);Vp||(Vp=document.createElement("canvas").getContext("2d"));const n=Vp.createImageData(e,i);return n.data.set(t),n}function Kp(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,s=e.meta,r=e.imageOps,o=e.width,h=e.height,a=n.length,u=n[0].byteLength;if(r){const e=new Array(a);for(let t=0;t<a;++t)e[t]=i(new Uint8ClampedArray(n[t]),o,h);return t(e,s).data.buffer}const l=new Uint8ClampedArray(u),c=new Array(a),f=new Array(a);for(let t=0;t<a;++t)c[t]=new Uint8ClampedArray(n[t]),f[t]=[0,0,0,0];for(let e=0;e<u;e+=4){for(let t=0;t<a;++t){const i=c[t];f[t][0]=i[e],f[t][1]=i[e+1],f[t][2]=i[e+2],f[t][3]=i[e+3]}const i=t(f,s);l[e]=i[0],l[e+1]=i[1],l[e+2]=i[2],l[e+3]=i[3]}return l.buffer}}function Jp(t,e){const i=Object.keys(t.lib||{}).map((function(e){return"const "+e+" = "+t.lib[e].toString()+";"})).concat(["const __minion__ = ("+Kp.toString()+")(",t.operation.toString(),");",'self.addEventListener("message", function(event) {',"  const buffer = __minion__(event.data);","  self.postMessage({buffer: buffer, meta: event.data.meta}, [buffer]);","});"]),n=new Worker("undefined"==typeof Blob?"data:text/javascript;base64,"+Buffer.from(i.join("\n"),"binary").toString("base64"):URL.createObjectURL(new Blob(i,{type:"text/javascript"})));return n.addEventListener("message",e),n}class Qp extends c{constructor(t){let e;super(),this._imageOps=!!t.imageOps,e=0===t.threads?0:this._imageOps?1:t.threads||1;const i=new Array(e);if(e)for(let n=0;n<e;++n)i[n]=Jp(t,this._onWorkerMessage.bind(this,n));else i[0]=function(t,e){const i=Kp(t.operation);let n=!1;return{postMessage:function(t){setTimeout((function(){n||e({data:{buffer:i(t),meta:t.meta}})}),0)},terminate:function(){n=!0}}}(t,this._onWorkerMessage.bind(this,0));this._workers=i,this._queue=[],this._maxQueueLength=t.queue||1/0,this._running=0,this._dataLookup={},this._job=null}process(t,e,i){this._enqueue({inputs:t,meta:e,callback:i}),this._dispatch()}_enqueue(t){for(this._queue.push(t);this._queue.length>this._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})),s=this._workers.length;if(this._running=s,1===s)return void this._workers[0].postMessage({buffers:n,meta:t.meta,imageOps:this._imageOps,width:e,height:i},n);const r=t.inputs[0].data.length,o=4*Math.ceil(r/4/s);for(let r=0;r<s;++r){const s=r*o,h=[];for(let t=0,e=n.length;t<e;++t)h.push(n[t].slice(s,s+o));this._workers[r].postMessage({buffers:h,meta:t.meta,imageOps:this._imageOps,width:e,height:i},h)}}_onWorkerMessage(t,e){this.disposed||(this._dataLookup[t]=e.data,--this._running,0===this._running&&this._resolveJob())}_resolveJob(){const t=this._job,e=this._workers.length;let i,n;if(1===e)i=new Uint8ClampedArray(this._dataLookup[0].buffer),n=this._dataLookup[0].meta;else{const s=t.inputs[0].data.length;i=new Uint8ClampedArray(s),n=new Array(e);const r=4*Math.ceil(s/4/e);for(let t=0;t<e;++t){const e=this._dataLookup[t].buffer,s=t*r;i.set(new Uint8ClampedArray(e),s),n[t]=this._dataLookup[t].meta}}this._job=null,this._dataLookup={},t.callback(null,Hp(i,t.inputs[0].width,t.inputs[0].height),n),this._dispatch()}disposeInternal(){for(let t=0;t<this._workers.length;++t)this._workers[t].terminate();this._workers.length=0}}const tm="beforeoperations",em="afteroperations";class im extends u{constructor(t,e,i){super(t),this.extent=e.extent,this.resolution=e.viewState.resolution/e.pixelRatio,this.data=i}}class nm extends gp{constructor(t){super({projection:null}),this.on,this.once,this.un,this.Uu=null,this.$u=void 0!==t.operationType?t.operationType:"pixel",this.Bu=void 0!==t.threads?t.threads:1,this.qu=function(t){const e=t.length,i=new Array(e);for(let n=0;n<e;++n)i[n]=om(t[n]);return i}(t.sources);const e=this.changed.bind(this);for(let t=0,i=this.qu.length;t<i;++t)this.qu[t].addEventListener(T,e);var n;this.vs=new zo((function(){return 1}),this.changed.bind(this)),this.Xu,this.Yu=null,this._u,this.Qn={animate:!1,coordinateToPixelTransform:[1,0,0,1,0,0],declutterTree:null,extent:null,index:0,layerIndex:0,layerStatesArray:(n=this.qu,n.map((function(t){return t.getLayerState()}))),pixelRatio:1,pixelToCoordinateTransform:[1,0,0,1,0,0],postRenderFunctions:[],size:[0,0],tileQueue:this.vs,time:Date.now(),usedTiles:{},viewState:{rotation:0},viewHints:[],wantedTiles:{},mapId:i(this),renderTargets:{}},this.setAttributions((function(e){const i=[];for(let n=0,s=t.sources.length;n<s;++n){const s=t.sources[n],r=(s instanceof sf?s:s.getSource()).getAttributions();if("function"==typeof r){const t=r(e);i.push.apply(i,t)}}return 0!==i.length?i:null})),void 0!==t.operation&&this.setOperation(t.operation,t.lib)}setOperation(t,e){this.Uu&&this.Uu.dispose(),this.Uu=new Qp({operation:t,imageOps:"image"===this.$u,queue:1,lib:e,threads:this.Bu}),this.changed()}Zu(t,e,i){const n=Object.assign({},this.Qn);n.viewState=Object.assign({},n.viewState);const s=ye(t);n.extent=t.slice(),n.size[0]=Math.round(Ee(t)/e),n.size[1]=Math.round(Me(t)/e),n.time=Date.now();const r=n.viewState;return r.center=s,r.projection=i,r.resolution=e,n}Vu(){let t,e=!0;for(let i=0,n=this.qu.length;i<n;++i)if(t=this.qu[i].getSource(),"ready"!==t.getState()){e=!1;break}return e}getImage(t,e,i,n){if(!this.Vu())return null;const s=this.Zu(t,e,n);if(this.Xu=s,this.Yu){const i=this.Yu.getResolution(),n=this.Yu.getExtent();e===i&&oe(t,n)||(this.Yu=null)}return this.Yu&&this.getRevision()===this._u||this.Wu(),s.tileQueue.loadMoreTiles(16,16),s.animate&&requestAnimationFrame(this.changed.bind(this)),this.Yu}Wu(){const t=this.Xu,e=this.qu.length,i=new Array(e);for(let n=0;n<e;++n){t.layerIndex=n;const e=rm(this.qu[n],t);if(!e)return;i[n]=e}const n={};this.dispatchEvent(new im(tm,t,n)),this.Uu.process(i,n,this.Hu.bind(this,t))}Hu(t,e,i,n){if(e||!i)return;const s=t.extent,r=t.viewState.resolution;if(r!==this.Xu.viewState.resolution||!oe(s,this.Xu.extent))return;let o;if(this.Yu)o=this.Yu.getImage().getContext("2d");else{o=Ys(Math.round(Ee(s)/r),Math.round(Me(s)/r)),this.Yu=new Xs(s,r,1,o.canvas)}o.putImageData(i,0,0),this.changed(),this._u=this.getRevision(),this.dispatchEvent(new im(em,t,n)),t.animate&&requestAnimationFrame(this.changed.bind(this))}disposeInternal(){this.Uu&&this.Uu.dispose(),super.disposeInternal()}}nm.prototype.dispose;let sm=null;function rm(t,e){const i=t.getRenderer();if(!i)throw new Error("Unsupported layer type: "+t);if(!i.prepareFrame(e))return null;const n=e.size[0],s=e.size[1];if(0===n||0===s)return null;const r=i.renderFrame(e,null);let o;if(r instanceof HTMLCanvasElement)o=r;else{if(r&&(o=r.firstElementChild),!(o instanceof HTMLCanvasElement))throw new Error("Unsupported rendered element: "+o);if(o.width===n&&o.height===s){return o.getContext("2d").getImageData(0,0,n,s)}}if(sm){const t=sm.canvas;t.width!==n||t.height!==s?sm=Ys(n,s):sm.clearRect(0,0,n,s)}else sm=Ys(n,s);return sm.drawImage(o,0,0,n,s),sm.getImageData(0,0,n,s)}function om(t){let e;return t instanceof sf?t instanceof of?e=new Zp({source:t}):t instanceof gp&&(e=new $p({source:t})):e=t,e}var hm=nm;const am=['Map tiles by <a href="https://stamen.com/" target="_blank">Stamen Design</a>, under <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>.',Np],um={terrain:{extension:"jpg",opaque:!0},"terrain-background":{extension:"jpg",opaque:!0},"terrain-labels":{extension:"png",opaque:!1},"terrain-lines":{extension:"png",opaque:!1},"toner-background":{extension:"png",opaque:!0},toner:{extension:"png",opaque:!0},"toner-hybrid":{extension:"png",opaque:!1},"toner-labels":{extension:"png",opaque:!1},"toner-lines":{extension:"png",opaque:!1},"toner-lite":{extension:"png",opaque:!0},watercolor:{extension:"jpg",opaque:!0}},lm={terrain:{minZoom:0,maxZoom:18},toner:{minZoom:0,maxZoom:20},watercolor:{minZoom:0,maxZoom:18}};var cm=class extends df{constructor(t){const e=t.layer.indexOf("-"),i=-1==e?t.layer:t.layer.slice(0,e),n=lm[i],s=um[t.layer],r=void 0!==t.url?t.url:"https://stamen-tiles-{a-d}.a.ssl.fastly.net/"+t.layer+"/{z}/{x}/{y}."+s.extension;super({attributions:am,cacheSize:t.cacheSize,crossOrigin:"anonymous",interpolate:t.interpolate,maxZoom:null!=t.maxZoom?t.maxZoom:n.maxZoom,minZoom:null!=t.minZoom?t.minZoom:n.minZoom,opaque:s.opaque,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileLoadFunction:t.tileLoadFunction,transition:t.transition,url:r,wrapX:t.wrapX,zDirection:t.zDirection})}};var fm=class extends lf{constructor(t){super({attributions:(t=t||{}).attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,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.Su=t.params||{},this.Ta=void 0===t.hidpi||t.hidpi,this.Ir=[1/0,1/0,-1/0,-1/0],this.setKey(this.Ku())}Ku(){let t=0;const e=[];for(const i in this.Su)e[t++]=i+"-"+this.Su[i];return e.join("/")}getParams(){return this.Su}Tu(t,e,i,n,s,r){const o=this.urls;if(!o)return;const h=s.getCode().split(/:(?=\d+$)/).pop();let a;if(r.SIZE=e[0]+","+e[1],r.BBOX=i.join(","),r.BBOXSR=h,r.IMAGESR=h,r.DPI=Math.round(r.DPI?r.DPI*n:90*n),1==o.length)a=o[0];else{a=o[di(ya(t),o.length)]}return pu(a.replace(/MapServer\/?$/,"MapServer/export").replace(/ImageServer\/?$/,"ImageServer/exportImage"),r)}getTilePixelRatio(t){return this.Ta?t:1}updateParams(t){Object.assign(this.Su,t),this.setKey(this.Ku())}tileUrlFunction(t,e,i){let n=this.getTileGrid();if(n||(n=this.getTileGridForProjection(i)),n.getResolutions().length<=t[0])return;1==e||this.Ta||(e=1);const s=n.getTileCoordExtent(t,this.Ir);let r=ia(n.getTileSize(t[0]),this.tmpSize);1!=e&&(r=ea(r,e,this.tmpSize));const o={F:"image",FORMAT:"PNG32",TRANSPARENT:!0};return Object.assign(o,this.Su),this.Tu(t,r,s,e,i,o)}};var dm=class extends df{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=ia(this.tileGrid.getTileSize(i)),s=Ys(n[0],n[1]);s.strokeStyle="grey",s.strokeRect(.5,.5,n[0]+.5,n[1]+.5),s.fillStyle="grey",s.strokeStyle="white",s.textAlign="center",s.textBaseline="middle",s.font="24px sans-serif",s.lineWidth=4,s.strokeText(e,n[0]/2,n[1]/2,n[0]),s.fillText(e,n[0]/2,n[1]/2,n[0]),t.setImage(s.canvas)}})}};var pm=class extends lf{constructor(t){if(super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:Yi("EPSG:3857"),reprojectionErrorThreshold:t.reprojectionErrorThreshold,state:"loading",tileLoadFunction:t.tileLoadFunction,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.Ju=null,this.Tr=t.tileSize,t.url)if(t.jsonp)Ra(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.Qu.bind(this)),e.addEventListener("error",this.tl.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):ct(!1,51)}Qu(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()}tl(t){this.handleTileJSONError()}getTileJSON(){return this.Ju}handleTileJSONResponse(t){const e=Yi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=en(e,i);n=ke(t.bounds,s)}const s=au(i),r=t.minzoom||0,o=ru({extent:s,maxZoom:t.maxzoom||22,minZoom:r,tileSize:this.Tr});if(this.tileGrid=o,this.tileUrlFunction=lu(t.tiles,o),void 0!==t.attribution&&!this.getAttributions()){const e=void 0!==n?n:s;this.setAttributions((function(i){return Te(e,i.extent)?[t.attribution]:null}))}this.Ju=t,this.setState("ready")}handleTileJSONError(){this.setState("error")}};var mm=class extends lf{constructor(t){const e=(t=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.To=void 0!==t.gutter?t.gutter:0,this.Su=e,this.ku=!0,this.Lu=t.serverType,this.Ta=void 0===t.hidpi||t.hidpi,this.Ir=[1/0,1/0,-1/0,-1/0],this.Ru(),this.setKey(this.Ku())}getFeatureInfoUrl(t,e,i,n){const s=Yi(i),r=this.getProjection();let o=this.getTileGrid();o||(o=this.getTileGridForProjection(s));const h=o.getZForResolution(e,this.zDirection),a=o.getTileCoordForCoordAndZ(t,h);if(o.getResolutions().length<=a[0])return;let u=o.getResolution(a[0]),l=o.getTileCoordExtent(a,this.Ir),c=ia(o.getTileSize(a[0]),this.tmpSize);const f=this.To;0!==f&&(c=Qh(c,f,this.tmpSize),l=Vt(l,u*f,l)),r&&r!==s&&(u=Ka(r,s,t,u),l=rn(l,s,r),t=sn(t,s,r));const d={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetFeatureInfo",FORMAT:"image/png",TRANSPARENT:!0,QUERY_LAYERS:this.Su.LAYERS};Object.assign(d,this.Su,n);const p=Math.floor((t[0]-l[0])/u),m=Math.floor((l[3]-t[1])/u);return d[this.ku?"I":"X"]=p,d[this.ku?"J":"Y"]=m,this.Tu(a,c,l,1,r||s,d)}getLegendUrl(t,e){if(void 0===this.urls[0])return;const i={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetLegendGraphic",FORMAT:"image/png"};if(void 0===e||void 0===e.LAYER){const t=this.Su.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),pu(this.urls[0],i)}getGutter(){return this.To}getParams(){return this.Su}Tu(t,e,i,n,s,r){const o=this.urls;if(!o)return;if(r.WIDTH=e[0],r.HEIGHT=e[1],r[this.ku?"CRS":"SRS"]=s.getCode(),"STYLES"in this.Su||(r.STYLES=""),1!=n)switch(this.Lu){case"geoserver":const t=90*n+.5|0;"FORMAT_OPTIONS"in r?r.FORMAT_OPTIONS+=";dpi:"+t:r.FORMAT_OPTIONS="dpi:"+t;break;case"mapserver":r.MAP_RESOLUTION=90*n;break;case"carmentaserver":case"qgis":r.DPI=90*n;break;default:ct(!1,52)}const h=s.getAxisOrientation(),a=i;if(this.ku&&"ne"==h.substr(0,2)){let t;t=i[0],a[0]=i[1],a[1]=t,t=i[2],a[2]=i[3],a[3]=t}let u;if(r.BBOX=a.join(","),1==o.length)u=o[0];else{u=o[di(ya(t),o.length)]}return pu(u,r)}getTilePixelRatio(t){return this.Ta&&void 0!==this.Lu?t:1}Ku(){let t=0;const e=[];for(const i in this.Su)e[t++]=i+"-"+this.Su[i];return e.join("/")}updateParams(t){Object.assign(this.Su,t),this.Ru(),this.setKey(this.Ku())}Ru(){const t=this.Su.VERSION||Mp;this.ku=xi(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.Ta&&void 0!==this.Lu||(e=1);const s=n.getResolution(t[0]);let r=n.getTileCoordExtent(t,this.Ir),o=ia(n.getTileSize(t[0]),this.tmpSize);const h=this.To;0!==h&&(o=Qh(o,h,this.tmpSize),r=Vt(r,s*h,r)),1!=e&&(o=ea(o,e,this.tmpSize));const a={SERVICE:"WMS",VERSION:Mp,REQUEST:"GetMap",FORMAT:"image/png",TRANSPARENT:!0};return Object.assign(a,this.Su),this.Tu(t,o,r,e,i,a)}};class vm extends ut{constructor(t,e,i,n,s,r){super(t,e),this.Nt=i,this.ot=n,this.el=s,this.il=null,this.nl=null,this.B=null,this.sl=r}getImage(){return null}getData(t){if(!this.il||!this.nl)return null;const e=(t[0]-this.ot[0])/(this.ot[2]-this.ot[0]),i=(t[1]-this.ot[1])/(this.ot[3]-this.ot[1]),n=this.il[Math.floor((1-i)*this.il.length)];if("string"!=typeof n)return null;let s=n.charCodeAt(Math.floor(e*n.length));s>=93&&s--,s>=35&&s--,s-=32;let r=null;if(s in this.nl){const t=this.nl[s];r=this.B&&t in this.B?this.B[t]:t}return r}forDataAtCoordinate(t,e,i){this.state==st&&!0===i?(this.state=tt,$(this,T,(function(i){e(this.getData(t))}),this),this.rl()):!0===i?setTimeout(function(){e(this.getData(t))}.bind(this),0):e(this.getData(t))}getKey(){return this.Nt}Ou(){this.state=nt,this.changed()}Bt(t){this.il=t.grid,this.nl=t.keys,this.B=t.data,this.state=it,this.changed()}rl(){if(this.state==tt)if(this.state=et,this.sl)Ra(this.Nt,this.Bt.bind(this),this.Ou.bind(this));else{const t=new XMLHttpRequest;t.addEventListener("load",this.Qu.bind(this)),t.addEventListener("error",this.tl.bind(this)),t.open("GET",this.Nt),t.send()}}Qu(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.Ou()}this.Bt(t)}else this.Ou()}tl(t){this.Ou()}load(){this.el?this.rl():this.setState(st)}}var gm=class extends of{constructor(t){if(super({projection:Yi("EPSG:3857"),state:"loading",zDirection:t.zDirection}),this.el=void 0===t.preemptive||t.preemptive,this.hl=fu,this.al=void 0,this.sl=t.jsonp||!1,t.url)if(this.sl)Ra(t.url,this.handleTileJSONResponse.bind(this),this.handleTileJSONError.bind(this));else{const e=new XMLHttpRequest;e.addEventListener("load",this.Qu.bind(this)),e.addEventListener("error",this.tl.bind(this)),e.open("GET",t.url),e.send()}else t.tileJSON?this.handleTileJSONResponse(t.tileJSON):ct(!1,51)}Qu(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()}tl(t){this.handleTileJSONError()}getTemplate(){return this.al}forDataAtCoordinateAndResolution(t,e,i,n){if(this.tileGrid){const s=this.tileGrid.getZForResolution(e,this.zDirection),r=this.tileGrid.getTileCoordForCoordAndZ(t,s);this.getTile(r[0],r[1],r[2],1,this.getProjection()).forDataAtCoordinate(t,i,n)}else!0===n?setTimeout((function(){i(null)}),0):i(null)}handleTileJSONError(){this.setState("error")}handleTileJSONResponse(t){const e=Yi("EPSG:4326"),i=this.getProjection();let n;if(void 0!==t.bounds){const s=en(e,i);n=ke(t.bounds,s)}const s=au(i),r=t.minzoom||0,o=ru({extent:s,maxZoom:t.maxzoom||22,minZoom:r});this.tileGrid=o,this.al=t.template;const h=t.grids;if(h){if(this.hl=lu(h,o),void 0!==t.attribution){const e=void 0!==n?n:s;this.setAttributions((function(i){return Te(e,i.extent)?[t.attribution]:null}))}this.setState("ready")}else this.setState("error")}getTile(t,e,i,n,s){const r=pa(t,e,i);if(this.tileCache.containsKey(r))return this.tileCache.get(r);{const o=[t,e,i],h=this.getTileCoordForTileUrlFunction(o,s),a=this.hl(h,n,s),u=new vm(o,void 0!==a?tt:st,void 0!==a?a:"",this.tileGrid.getTileCoordExtent(o),this.el,this.sl);return this.tileCache.set(r,u),u}}useTile(t,e,i){const n=pa(t,e,i);this.tileCache.containsKey(n)&&this.tileCache.get(n)}};var ym=class extends lf{constructor(t){const e=void 0!==t.requestEncoding?t.requestEncoding:"KVP",i=t.tileGrid;let n=t.urls;void 0===n&&void 0!==t.url&&(n=du(t.url)),super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,interpolate:t.interpolate,projection:t.projection,reprojectionErrorThreshold:t.reprojectionErrorThreshold,tileClass:t.tileClass,tileGrid:i,tileLoadFunction:t.tileLoadFunction,tilePixelRatio:t.tilePixelRatio,urls:n,wrapX:void 0!==t.wrapX&&t.wrapX,transition:t.transition,zDirection:t.zDirection}),this.ul=void 0!==t.version?t.version:"1.0.0",this.Os=void 0!==t.format?t.format:"image/jpeg",this.ll=void 0!==t.dimensions?t.dimensions:{},this.Uo=t.layer,this.cl=t.matrixSet,this.K=t.style,this.fl=e,this.setKey(this.dl()),n&&n.length>0&&(this.tileUrlFunction=cu(n.map(this.createFromWMTSTemplate.bind(this))))}setUrls(t){this.urls=t;const e=t.join("\n");this.setTileUrlFunction(cu(t.map(this.createFromWMTSTemplate.bind(this))),e)}getDimensions(){return this.ll}getFormat(){return this.Os}getLayer(){return this.Uo}getMatrixSet(){return this.cl}getRequestEncoding(){return this.fl}getStyle(){return this.K}getVersion(){return this.ul}dl(){let t=0;const e=[];for(const i in this.ll)e[t++]=i+"-"+this.ll[i];return e.join("/")}updateDimensions(t){Object.assign(this.ll,t),this.setKey(this.dl())}createFromWMTSTemplate(t){const e=this.fl,i={layer:this.Uo,style:this.K,tilematrixset:this.cl};"KVP"==e&&Object.assign(i,{Service:"WMTS",Request:"GetTile",Version:this.ul,Format:this.Os}),t="KVP"==e?pu(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));const n=this.tileGrid,s=this.ll;return function(i,r,o){if(i){const r={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};Object.assign(r,s);let o=t;return o="KVP"==e?pu(o,r):o.replace(/\{(\w+?)\}/g,(function(t,e){return r[e]})),o}}}};const wm="renderOrder";var xm=class extends kr{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.pl=void 0!==t.declutter&&t.declutter,this.ml=void 0!==t.renderBuffer?t.renderBuffer:100,this.K=null,this.tt=void 0,this.setStyle(t.style),this.vl=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.gl=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.pl}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.ml}getRenderOrder(){return this.get(wm)}getStyle(){return this.K}getStyleFunction(){return this.tt}getUpdateWhileAnimating(){return this.vl}getUpdateWhileInteracting(){return this.gl}renderDeclutter(t){t.declutterTree||(t.declutterTree=new Kc(9)),this.getRenderer().renderDeclutter(t)}setRenderOrder(t){this.set(wm,t)}setStyle(t){let e;if(void 0===t)e=jc;else if(null===t)e=null;else if("function"==typeof t)e=t;else if(t instanceof $c)e=t;else if(Array.isArray(t)){const i=t.length,n=new Array(i);for(let e=0;e<i;++e){const i=t[e];n[e]=i instanceof $c?i:Xc(i)}e=n}else e=Xc(t);this.K=e,this.tt=null===t?void 0:zc(this.K),this.changed()}};const bm="GENERATE_POLYGON_BUFFERS",Mm="GENERATE_POINT_BUFFERS",Sm="GENERATE_LINE_STRING_BUFFERS";var Pm=n(187);const _m=[],Em={vertexPosition:0,indexPosition:0};function Tm(t,e,i,n,s){t[e+0]=i,t[e+1]=n,t[e+2]=s}function Cm(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 Fm(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}function Im(){const t='const e="GENERATE_POLYGON_BUFFERS",n="GENERATE_POINT_BUFFERS",t="GENERATE_LINE_STRING_BUFFERS",r="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"";r.includes("firefox");r.includes("safari")&&!r.includes("chrom")&&(r.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(r)),r.includes("webkit")&&r.includes("edge"),r.includes("macintosh"),"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&(self,WorkerGlobalScope),function(){let e=!1;try{const n=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("_",null,n),window.removeEventListener("_",null,n)}catch(e){}}();class x extends Error{constructor(e){const n="Assertion failed. See https://openlayers.org/en/latest/doc/errors/#"+e+" for details.";super(n),this.code=e,this.name="AssertionError",this.message=n}}function o(e,n){const t=n[0],r=n[1];return n[0]=e[0]*t+e[2]*r+e[4],n[1]=e[1]*t+e[3]*r+e[5],n}function i(e,n){const t=(r=n)[0]*r[3]-r[1]*r[2];var r;!function(e,n){if(!e)throw new x(n)}(0!==t,32);const o=n[0],i=n[1],u=n[2],s=n[3],f=n[4],a=n[5];return e[0]=s/t,e[1]=-i/t,e[2]=-u/t,e[3]=o/t,e[4]=(u*a-s*f)/t,e[5]=-(o*a-i*f)/t,e}new Array(6);var u={exports:{}};function s(e,n,t){t=t||2;var r,x,o,i,u,s,c,v=n&&n.length,h=v?n[0]*t:e.length,y=f(e,0,h,t,!0),g=[];if(!y||y.next===y.prev)return g;if(v&&(y=function(e,n,t,r){var x,o,i,u=[];for(x=0,o=n.length;x<o;x++)(i=f(e,n[x]*r,x<o-1?n[x+1]*r:e.length,r,!1))===i.next&&(i.steiner=!0),u.push(w(i));for(u.sort(p),x=0;x<u.length;x++)t=a(t=d(u[x],t),t.next);return t}(e,n,y,t)),e.length>80*t){r=o=e[0],x=i=e[1];for(var b=t;b<h;b+=t)(u=e[b])<r&&(r=u),(s=e[b+1])<x&&(x=s),u>o&&(o=u),s>i&&(i=s);c=0!==(c=Math.max(o-r,i-x))?1/c:0}return l(y,g,t,r,x,c),g}function f(e,n,t,r,x){var o,i;if(x===O(e,n,t,r)>0)for(o=n;o<t;o+=r)i=k(o,e[o],e[o+1],i);else for(o=t-r;o>=n;o-=r)i=k(o,e[o],e[o+1],i);return i&&M(i,i.next)&&(z(i),i=i.next),i}function a(e,n){if(!e)return e;n||(n=e);var t,r=e;do{if(t=!1,r.steiner||!M(r,r.next)&&0!==A(r.prev,r,r.next))r=r.next;else{if(z(r),(r=n=r.prev)===r.next)break;t=!0}}while(t||r!==n);return n}function l(e,n,t,r,x,o,i){if(e){!i&&o&&function(e,n,t,r){var x=e;do{null===x.z&&(x.z=b(x.x,x.y,n,t,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 n,t,r,x,o,i,u,s,f=1;do{for(t=e,e=null,o=null,i=0;t;){for(i++,r=t,u=0,n=0;n<f&&(u++,r=r.nextZ);n++);for(s=f;u>0||s>0&&r;)0!==u&&(0===s||!r||t.z<=r.z)?(x=t,t=t.nextZ,u--):(x=r,r=r.nextZ,s--),o?o.nextZ=x:e=x,x.prevZ=o,o=x;t=r}o.nextZ=null,f*=2}while(i>1)}(x)}(e,r,x,o);for(var u,s,f=e;e.prev!==e.next;)if(u=e.prev,s=e.next,o?v(e,r,x,o):c(e))n.push(u.i/t),n.push(e.i/t),n.push(s.i/t),z(e),e=s.next,f=s.next;else if((e=s)===f){i?1===i?l(e=h(a(e),n,t),n,t,r,x,o,2):2===i&&y(e,n,t,r,x,o):l(a(e),n,t,r,x,o,1);break}}}function c(e){var n=e.prev,t=e,r=e.next;if(A(n,t,r)>=0)return!1;for(var x=e.next.next;x!==e.prev;){if(Z(n.x,n.y,t.x,t.y,r.x,r.y,x.x,x.y)&&A(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function v(e,n,t,r){var x=e.prev,o=e,i=e.next;if(A(x,o,i)>=0)return!1;for(var u=x.x<o.x?x.x<i.x?x.x:i.x:o.x<i.x?o.x:i.x,s=x.y<o.y?x.y<i.y?x.y:i.y:o.y<i.y?o.y:i.y,f=x.x>o.x?x.x>i.x?x.x:i.x:o.x>i.x?o.x:i.x,a=x.y>o.y?x.y>i.y?x.y:i.y:o.y>i.y?o.y:i.y,l=b(u,s,n,t,r),c=b(f,a,n,t,r),v=e.prevZ,h=e.nextZ;v&&v.z>=l&&h&&h.z<=c;){if(v!==e.prev&&v!==e.next&&Z(x.x,x.y,o.x,o.y,i.x,i.y,v.x,v.y)&&A(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,h!==e.prev&&h!==e.next&&Z(x.x,x.y,o.x,o.y,i.x,i.y,h.x,h.y)&&A(h.prev,h,h.next)>=0)return!1;h=h.nextZ}for(;v&&v.z>=l;){if(v!==e.prev&&v!==e.next&&Z(x.x,x.y,o.x,o.y,i.x,i.y,v.x,v.y)&&A(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;h&&h.z<=c;){if(h!==e.prev&&h!==e.next&&Z(x.x,x.y,o.x,o.y,i.x,i.y,h.x,h.y)&&A(h.prev,h,h.next)>=0)return!1;h=h.nextZ}return!0}function h(e,n,t){var r=e;do{var x=r.prev,o=r.next.next;!M(x,o)&&E(x,r,r.next,o)&&P(x,o)&&P(o,x)&&(n.push(x.i/t),n.push(r.i/t),n.push(o.i/t),z(r),z(r.next),r=e=o),r=r.next}while(r!==e);return a(r)}function y(e,n,t,r,x,o){var i=e;do{for(var u=i.next.next;u!==i.prev;){if(i.i!==u.i&&m(i,u)){var s=_(i,u);return i=a(i,i.next),s=a(s,s.next),l(i,n,t,r,x,o),void l(s,n,t,r,x,o)}u=u.next}i=i.next}while(i!==e)}function p(e,n){return e.x-n.x}function d(e,n){var t=function(e,n){var t,r=n,x=e.x,o=e.y,i=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var u=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(u<=x&&u>i){if(i=u,u===x){if(o===r.y)return r;if(o===r.next.y)return r.next}t=r.x<r.next.x?r:r.next}}r=r.next}while(r!==n);if(!t)return null;if(x===i)return t;var s,f=t,a=t.x,l=t.y,c=1/0;r=t;do{x>=r.x&&r.x>=a&&x!==r.x&&Z(o<l?x:i,o,a,l,o<l?i:x,o,r.x,r.y)&&(s=Math.abs(o-r.y)/(x-r.x),P(r,e)&&(s<c||s===c&&(r.x>t.x||r.x===t.x&&g(t,r)))&&(t=r,c=s)),r=r.next}while(r!==f);return t}(e,n);if(!t)return n;var r=_(t,e),x=a(t,t.next);return a(r,r.next),n===t?x:n}function g(e,n){return A(e.prev,e,n.prev)<0&&A(n.next,e,e.next)<0}function b(e,n,t,r,x){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-t)*x)|e<<8))|e<<4))|e<<2))|e<<1))|(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=32767*(n-r)*x)|n<<8))|n<<4))|n<<2))|n<<1))<<1}function w(e){var n=e,t=e;do{(n.x<t.x||n.x===t.x&&n.y<t.y)&&(t=n),n=n.next}while(n!==e);return t}function Z(e,n,t,r,x,o,i,u){return(x-i)*(n-u)-(e-i)*(o-u)>=0&&(e-i)*(r-u)-(t-i)*(n-u)>=0&&(t-i)*(o-u)-(x-i)*(r-u)>=0}function m(e,n){return e.next.i!==n.i&&e.prev.i!==n.i&&!function(e,n){var t=e;do{if(t.i!==e.i&&t.next.i!==e.i&&t.i!==n.i&&t.next.i!==n.i&&E(t,t.next,e,n))return!0;t=t.next}while(t!==e);return!1}(e,n)&&(P(e,n)&&P(n,e)&&function(e,n){var t=e,r=!1,x=(e.x+n.x)/2,o=(e.y+n.y)/2;do{t.y>o!=t.next.y>o&&t.next.y!==t.y&&x<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next}while(t!==e);return r}(e,n)&&(A(e.prev,e,n.prev)||A(e,n.prev,n))||M(e,n)&&A(e.prev,e,e.next)>0&&A(n.prev,n,n.next)>0)}function A(e,n,t){return(n.y-e.y)*(t.x-n.x)-(n.x-e.x)*(t.y-n.y)}function M(e,n){return e.x===n.x&&e.y===n.y}function E(e,n,t,r){var x=I(A(e,n,t)),o=I(A(e,n,r)),i=I(A(t,r,e)),u=I(A(t,r,n));return x!==o&&i!==u||(!(0!==x||!F(e,t,n))||(!(0!==o||!F(e,r,n))||(!(0!==i||!F(t,e,r))||!(0!==u||!F(t,n,r)))))}function F(e,n,t){return n.x<=Math.max(e.x,t.x)&&n.x>=Math.min(e.x,t.x)&&n.y<=Math.max(e.y,t.y)&&n.y>=Math.min(e.y,t.y)}function I(e){return e>0?1:e<0?-1:0}function P(e,n){return A(e.prev,e,e.next)<0?A(e,n,e.next)>=0&&A(e,e.prev,n)>=0:A(e,n,e.prev)<0||A(e,e.next,n)<0}function _(e,n){var t=new B(e.i,e.x,e.y),r=new B(n.i,n.x,n.y),x=e.next,o=n.prev;return e.next=n,n.prev=e,t.next=x,x.prev=t,r.next=t,t.prev=r,o.next=r,r.prev=o,r}function k(e,n,t,r){var x=new B(e,n,t);return r?(x.next=r.next,x.prev=r,r.next.prev=x,r.next=x):(x.prev=x,x.next=x),x}function z(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 B(e,n,t){this.i=e,this.x=n,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function O(e,n,t,r){for(var x=0,o=n,i=t-r;o<t;o+=r)x+=(e[i]-e[o])*(e[o+1]+e[i+1]),i=o;return x}u.exports=s,u.exports.default=s,s.deviation=function(e,n,t,r){var x=n&&n.length,o=x?n[0]*t:e.length,i=Math.abs(O(e,0,o,t));if(x)for(var u=0,s=n.length;u<s;u++){var f=n[u]*t,a=u<s-1?n[u+1]*t:e.length;i-=Math.abs(O(e,f,a,t))}var l=0;for(u=0;u<r.length;u+=3){var c=r[u]*t,v=r[u+1]*t,h=r[u+2]*t;l+=Math.abs((e[c]-e[h])*(e[v+1]-e[c+1])-(e[c]-e[v])*(e[h+1]-e[c+1]))}return 0===i&&0===l?0:Math.abs((l-i)/i)},s.flatten=function(e){for(var n=e[0][0].length,t={vertices:[],holes:[],dimensions:n},r=0,x=0;x<e.length;x++){for(var o=0;o<e[x].length;o++)for(var i=0;i<n;i++)t.vertices.push(e[x][o][i]);x>0&&(r+=e[x-1].length,t.holes.push(r))}return t};const G=[],N={vertexPosition:0,indexPosition:0};function R(e,n,t,r,x){e[n+0]=t,e[n+1]=r,e[n+2]=x}function S(e,n,t,r,x,o){const i=3+x,u=e[n+0],s=e[n+1],f=G;f.length=x;for(let t=0;t<f.length;t++)f[t]=e[n+2+t];let a=o?o.vertexPosition:0,l=o?o.indexPosition:0;const c=a/i;return R(t,a,u,s,0),f.length&&t.set(f,a+3),a+=i,R(t,a,u,s,1),f.length&&t.set(f,a+3),a+=i,R(t,a,u,s,2),f.length&&t.set(f,a+3),a+=i,R(t,a,u,s,3),f.length&&t.set(f,a+3),a+=i,r[l++]=c,r[l++]=c+1,r[l++]=c+3,r[l++]=c+1,r[l++]=c+2,r[l++]=c+3,N.vertexPosition=a,N.indexPosition=l,N}function T(e,n,t,r,x,i,u,s,f,a){const l=5+s.length,c=i.length/l,v=[e[n+0],e[n+1]],h=[e[t],e[t+1]],y=o(a,[...v]),p=o(a,[...h]);function d(e,n,t){const r=1e4;return Math.round(1500*n)+Math.round(1500*t)*r+e*r*r}function g(e,n,t){const r=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),x=[(n[0]-e[0])/r,(n[1]-e[1])/r],o=[-x[1],x[0]],i=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),u=[(t[0]-e[0])/i,(t[1]-e[1])/i],s=0===r||0===i?0:Math.acos((f=u[0]*x[0]+u[1]*x[1],a=-1,l=1,Math.min(Math.max(f,a),l)));var f,a,l;return u[0]*o[0]+u[1]*o[1]>0?s:2*Math.PI-s}const b=null!==x;let w=0,Z=0;if(null!==r){w=g(y,p,o(a,[...[e[r],e[r+1]]]))}if(b){Z=g(p,y,o(a,[...[e[x],e[x+1]]]))}i.push(v[0],v[1],h[0],h[1],d(0,w,Z)),i.push(...s),i.push(v[0],v[1],h[0],h[1],d(1,w,Z)),i.push(...s),i.push(v[0],v[1],h[0],h[1],d(2,w,Z)),i.push(...s),i.push(v[0],v[1],h[0],h[1],d(3,w,Z)),i.push(...s),u.push(c,c+1,c+2,c+1,c+3,c+2)}function U(e,n,t,r,x){const o=2+x;let i=n;const s=e.slice(i,i+x);i+=x;const f=e[i++];let a=0;const l=new Array(f-1);for(let n=0;n<f;n++)a+=e[i++],n<f-1&&(l[n]=a);const c=e.slice(i,i+2*a),v=u.exports(c,l,2);for(let e=0;e<v.length;e++)r.push(v[e]+t.length/o);for(let e=0;e<c.length;e+=2)t.push(c[e],c[e+1],...s);return i+2*a}const C=self;C.onmessage=r=>{const x=r.data;switch(x.type){case n:{const e=3,n=2,t=x.customAttributesCount,r=n+t,o=new Float32Array(x.renderInstructions),i=o.length/r,u=4*i*(t+e),s=new Uint32Array(6*i),f=new Float32Array(u);let a;for(let e=0;e<o.length;e+=r)a=S(o,e,f,s,t,a);const l=Object.assign({vertexBuffer:f.buffer,indexBuffer:s.buffer,renderInstructions:o.buffer},x);C.postMessage(l,[f.buffer,s.buffer,o.buffer]);break}case t:{const e=[],n=[],t=x.customAttributesCount,r=2,o=new Float32Array(x.renderInstructions);let u=0;const s=x.renderInstructionsTransform,f=[1,0,0,1,0,0];let a,l;for(i(f,s);u<o.length;){l=Array.from(o.slice(u,u+t)),u+=t,a=o[u++];for(let t=0;t<a-1;t++)T(o,u+t*r,u+(t+1)*r,t>0?u+(t-1)*r:null,t<a-2?u+(t+2)*r:null,e,n,l,0,f);u+=a*r}const c=Uint32Array.from(n),v=Float32Array.from(e),h=Object.assign({vertexBuffer:v.buffer,indexBuffer:c.buffer,renderInstructions:o.buffer},x);C.postMessage(h,[v.buffer,c.buffer,o.buffer]);break}case e:{const e=[],n=[],t=x.customAttributesCount,r=new Float32Array(x.renderInstructions);let o=0;for(;o<r.length;)o=U(r,o,e,n,t);const i=Uint32Array.from(n),u=Float32Array.from(e),s=Object.assign({vertexBuffer:u.buffer,indexBuffer:i.buffer,renderInstructions:r.buffer},x);C.postMessage(s,[u.buffer,i.buffer,r.buffer]);break}}};';return new Worker("undefined"==typeof Blob?"data:application/javascript;base64,"+Buffer.from(t,"binary").toString("base64"):URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}var Am=class extends Fl{constructor(t,e){const n=e.uniforms||{},s=[1,0,0,1,0,0];n[nl]=s,super(t,{uniforms:n,postProcesses:e.postProcesses}),this.ready=!1,this.yl=-1,this.wl=new Ku(mu,yu),this.xl=new Ku(mu,yu),this.bl=new Ku(vu,yu),this.Jo=e.vertexShader,this.Qo=e.fragmentShader,this.Ko,this.Ml=!(!e.hitFragmentShader||!e.hitVertexShader),this.Sl=e.hitVertexShader,this.Pl=e.hitFragmentShader,this._l;const r=e.attributes?e.attributes.map((function(t){return{name:"a_"+t.name,size:1,type:cl.FLOAT}})):[];this.attributes=[{name:"a_position",size:2,type:cl.FLOAT},{name:"a_index",size:1,type:cl.FLOAT}].concat(r),this.hitDetectionAttributes=[{name:"a_position",size:2,type:cl.FLOAT},{name:"a_index",size:1,type:cl.FLOAT},{name:"a_hitColor",size:4,type:cl.FLOAT},{name:"a_featureUid",size:1,type:cl.FLOAT}].concat(r),this.customAttributes=e.attributes?e.attributes:[],this.ts=[1/0,1/0,-1/0,-1/0],this.El=s,this.Tl=[1,0,0,1,0,0],this.Cl=[1,0,0,1,0,0],this.Fl=new Float32Array(0),this.Il=new Float32Array(0),this.Al,this.kl=0,this.Rl=Im(),this.Rl.addEventListener("message",function(t){const e=t.data;if(e.type===Mm){const i=e.projectionTransform;e.hitDetection?(this.xl.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.xl)):(this.wl.fromArrayBuffer(e.vertexBuffer),this.helper.flushBufferData(this.wl)),this.bl.fromArrayBuffer(e.indexBuffer),this.helper.flushBufferData(this.bl),this.Tl=i,zt(this.Cl,this.Tl),e.hitDetection?this.Il=new Float32Array(t.data.renderInstructions):(this.Fl=new Float32Array(t.data.renderInstructions),e.generateBuffersRun===this.kl&&(this.ready=!0)),this.getLayer().changed()}}.bind(this)),this.Ll={},this.Nl=0;const o=this.getLayer().getSource();this.Ol=[U(o,mf,this.zl,this),U(o,vf,this.Gl,this),U(o,yf,this.jl,this),U(o,gf,this.Dl,this)],o.forEachFeature(function(t){this.Ll[i(t)]={feature:t,properties:t.getProperties(),geometry:t.getGeometry()},this.Nl++}.bind(this))}afterHelperCreated(){this.Ko=this.helper.getProgram(this.Qo,this.Jo),this.Ml&&(this._l=this.helper.getProgram(this.Pl,this.Sl),this.Al=new xl(this.helper))}zl(t){const e=t.feature;this.Ll[i(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()},this.Nl++}Gl(t){const e=t.feature;this.Ll[i(e)]={feature:e,properties:e.getProperties(),geometry:e.getGeometry()}}jl(t){const e=t.feature;delete this.Ll[i(e)],this.Nl--}Dl(){this.Ll={},this.Nl=0}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const i=t.viewState.projection,n=this.getLayer().getSource().getWrapX()&&i.canWrapX(),s=i.getExtent(),r=t.extent,o=n?Ee(s):null,h=n?Math.ceil((r[2]-s[2])/o)+1:1,a=n?Math.floor((r[0]-s[0])/o):0;let u=a;const l=this.bl.getSize();do{this.helper.makeProjectionTransform(t,this.El),Nt(this.El,u*o,0),Ct(this.El,this.Cl),this.helper.applyUniforms(t),this.helper.drawElements(0,l)}while(++u<h);this.helper.finalizeDraw(t,this.dispatchPreComposeEvent,this.dispatchPostComposeEvent);const c=this.helper.getCanvas();return this.Ml&&(this.renderHitDetection(t,a,h,o),this.Al.clearCachedData()),this.postRender(e,t),c}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),n=t.viewState,s=!t.viewHints[jo]&&!t.viewHints[Do],r=!oe(this.ts,t.extent),o=this.yl<i.getRevision();if(o&&(this.yl=i.getRevision()),s&&(r||o)){const s=n.projection,r=n.resolution,o=e instanceof xm?e.getRenderBuffer():0,h=Vt(t.extent,o*r);i.loadFeatures(h,r,s),this.Ul(t),this.ts=t.extent.slice()}return this.helper.useProgram(this.Ko,t),this.helper.prepareDraw(t),this.helper.bindBuffer(this.wl),this.helper.bindBuffer(this.bl),this.helper.enableAttributes(this.attributes),!0}Ul(t){const e=[1,0,0,1,0,0];this.helper.makeProjectionTransform(t,e);const i=(2+this.customAttributes.length)*this.Nl;if(this.Fl&&this.Fl.length===i||(this.Fl=new Float32Array(i)),this.Ml){const t=(7+this.customAttributes.length)*this.Nl;this.Il&&this.Il.length===t||(this.Il=new Float32Array(t))}let n,s;const r=[],o=[];let h,a=0,u=0;for(const t in this.Ll){if(n=this.Ll[t],s=n.geometry,!s||"Point"!==s.getType())continue;let i;r[0]=s.getFlatCoordinates()[0],r[1]=s.getFlatCoordinates()[1],At(e,r),h=Cm(u+6,o),this.Fl[a++]=r[0],this.Fl[a++]=r[1],this.Ml&&(this.Il[u++]=r[0],this.Il[u++]=r[1],this.Il[u++]=h[0],this.Il[u++]=h[1],this.Il[u++]=h[2],this.Il[u++]=h[3],this.Il[u++]=Number(t));for(let t=0;t<this.customAttributes.length;t++)i=this.customAttributes[t].callback(n.feature,n.properties),this.Fl[a++]=i,this.Ml&&(this.Il[u++]=i)}const l={id:0,type:Mm,renderInstructions:this.Fl.buffer,customAttributesCount:this.customAttributes.length};if(l.projectionTransform=e,l.generateBuffersRun=++this.kl,this.ready=!1,this.Rl.postMessage(l,[this.Fl.buffer]),this.Fl=null,this.Ml){const t={id:0,type:Mm,renderInstructions:this.Il.buffer,customAttributesCount:5+this.customAttributes.length};t.projectionTransform=e,t.hitDetection=!0,this.Rl.postMessage(t,[this.Il.buffer]),this.Il=null}}forEachFeatureAtCoordinate(t,e,i,n,s){if(ct(this.Ml,66),!this.Il)return;const r=At(e.coordinateToPixelTransform,t.slice()),o=this.Al.readPixel(r[0]/2,r[1]/2),h=Fm([o[0]/255,o[1]/255,o[2]/255,o[3]/255]),a=this.Il[h],u=Math.floor(a).toString(),l=this.getLayer().getSource().getFeatureByUid(u);return l?n(l,this.getLayer(),null):void 0}renderHitDetection(t,e,i,n){if(!this.xl.getSize())return;let s=e;this.Al.setSize([Math.floor(t.size[0]/2),Math.floor(t.size[1]/2)]),this.helper.useProgram(this._l,t),this.helper.prepareDrawToRenderTarget(t,this.Al,!0),this.helper.bindBuffer(this.xl),this.helper.bindBuffer(this.bl),this.helper.enableAttributes(this.hitDetectionAttributes);do{this.helper.makeProjectionTransform(t,this.El),Nt(this.El,s*n,0),Ct(this.El,this.Cl),this.helper.applyUniforms(t);const e=this.bl.getSize();this.helper.drawElements(0,e)}while(++s<i)}disposeInternal(){this.Rl.terminate(),this.Uo=null,this.Ol.forEach((function(t){B(t)})),this.Ol=null,super.disposeInternal()}};let km=0;var Rm=class{constructor(t,e,i,n,s){this.uo=t,this.Rl=e,this.Ko=this.uo.getProgram(n,i),this.attributes=[],this.customAttributes=s}rebuild(t,e,i,n){t.renderInstructionsTransform=this.uo.makeProjectionTransform(e,[1,0,0,1,0,0]),this.generateRenderInstructions(t),this.$l(t,i,n)}render(t,e,i,n){this.uo.makeProjectionTransform(i,e),Nt(e,n,0),Ct(e,t.invertVerticesBufferTransform),this.uo.useProgram(this.Ko,i),this.uo.bindBuffer(t.verticesBuffer),this.uo.bindBuffer(t.indicesBuffer),this.uo.enableAttributes(this.attributes);const s=t.indicesBuffer.getSize();this.uo.drawElements(0,s)}generateRenderInstructions(e){t()}$l(t,e,i){const n=km++;let s;switch(e){case"Polygon":s=bm;break;case"Point":s=Mm;break;case"LineString":s=Sm}const r={id:n,type:s,renderInstructions:t.renderInstructions.buffer,renderInstructionsTransform:t.renderInstructionsTransform,customAttributesCount:this.customAttributes.length};this.Rl.postMessage(r,[t.renderInstructions.buffer]),t.renderInstructions=null;const o=function(e){const s=e.data;s.id===n&&(this.Rl.removeEventListener("message",o),t.verticesBufferTransform=s.renderInstructionsTransform,zt(t.invertVerticesBufferTransform,t.verticesBufferTransform),t.verticesBuffer.fromArrayBuffer(s.vertexBuffer),this.uo.flushBufferData(t.verticesBuffer),t.indicesBuffer.fromArrayBuffer(s.indexBuffer),this.uo.flushBufferData(t.indicesBuffer),t.renderInstructions=new Float32Array(s.renderInstructions),i())}.bind(this);this.Rl.addEventListener("message",o)}};const Lm={SEGMENT_START:"a_segmentStart",SEGMENT_END:"a_segmentEnd",PARAMETERS:"a_parameters"};var Nm=class extends Rm{constructor(t,e,i,n,s){super(t,e,i,n,s),this.attributes=[{name:Lm.SEGMENT_START,size:2,type:cl.FLOAT},{name:Lm.SEGMENT_END,size:2,type:cl.FLOAT},{name:Lm.PARAMETERS,size:1,type:cl.FLOAT}].concat(s.map((function(t){return{name:"a_"+t.name,size:1,type:cl.FLOAT}})))}generateRenderInstructions(t){const e=2*t.verticesCount+(1+this.customAttributes.length)*t.geometriesCount;let i;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const n=[];let s,r=0;for(const e in t.entries){i=t.entries[e];for(let e=0,o=i.flatCoordss.length;e<o;e++){n.length=i.flatCoordss[e].length,gn(i.flatCoordss[e],0,n.length,2,t.renderInstructionsTransform,n);for(let e=0,n=this.customAttributes.length;e<n;e++)s=this.customAttributes[e].callback(i.feature),t.renderInstructions[r++]=s;t.renderInstructions[r++]=n.length/2;for(let e=0,i=n.length;e<i;e+=2)t.renderInstructions[r++]=n[e],t.renderInstructions[r++]=n[e+1]}}}};var Om=class{constructor(){this.polygonBatch={entries:{},geometriesCount:0,verticesCount:0,ringsCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Ku(mu,yu),indicesBuffer:new Ku(vu,yu),renderInstructionsTransform:[1,0,0,1,0,0],verticesBufferTransform:[1,0,0,1,0,0],invertVerticesBufferTransform:[1,0,0,1,0,0]},this.pointBatch={entries:{},geometriesCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Ku(mu,yu),indicesBuffer:new Ku(vu,yu),renderInstructionsTransform:[1,0,0,1,0,0],verticesBufferTransform:[1,0,0,1,0,0],invertVerticesBufferTransform:[1,0,0,1,0,0]},this.lineStringBatch={entries:{},geometriesCount:0,verticesCount:0,renderInstructions:new Float32Array(0),verticesBuffer:new Ku(mu,yu),indicesBuffer:new Ku(vu,yu),renderInstructionsTransform:[1,0,0,1,0,0],verticesBufferTransform:[1,0,0,1,0,0],invertVerticesBufferTransform:[1,0,0,1,0,0]}}addFeatures(t){for(let e=0;e<t.length;e++)this.addFeature(t[e])}addFeature(t){const e=t.getGeometry();e&&this.Bl(e,t)}ql(t){const e=i(t);return e in this.pointBatch.entries||(this.pointBatch.entries[e]={feature:t,flatCoordss:[]}),this.pointBatch.entries[e]}Xl(t){const e=i(t);return e in this.lineStringBatch.entries||(this.lineStringBatch.entries[e]={feature:t,flatCoordss:[],verticesCount:0}),this.lineStringBatch.entries[e]}Yl(t){const e=i(t);return e in this.polygonBatch.entries||(this.polygonBatch.entries[e]={feature:t,flatCoordss:[],verticesCount:0,ringsCount:0,ringsVerticesCounts:[]}),this.polygonBatch.entries[e]}Zl(t){const e=this.pointBatch.entries[i(t)];e&&(this.pointBatch.geometriesCount-=e.flatCoordss.length,delete this.pointBatch.entries[i(t)])}Vl(t){const e=this.lineStringBatch.entries[i(t)];e&&(this.lineStringBatch.verticesCount-=e.verticesCount,this.lineStringBatch.geometriesCount-=e.flatCoordss.length,delete this.lineStringBatch.entries[i(t)])}Wl(t){const e=this.polygonBatch.entries[i(t)];e&&(this.polygonBatch.verticesCount-=e.verticesCount,this.polygonBatch.ringsCount-=e.ringsCount,this.polygonBatch.geometriesCount-=e.flatCoordss.length,delete this.polygonBatch.entries[i(t)])}Bl(t,e){let i,n,s;switch(t.getType()){case"GeometryCollection":t.getGeometries().map((t=>this.Bl(t,e)));break;case"MultiPolygon":t.getPolygons().map((t=>this.Bl(t,e)));break;case"MultiLineString":t.getLineStrings().map((t=>this.Bl(t,e)));break;case"MultiPoint":t.getPoints().map((t=>this.Bl(t,e)));break;case"Polygon":const r=t;s=this.Yl(e),i=r.getFlatCoordinates(),n=i.length/2;const o=r.getLinearRingCount(),h=r.getEnds().map(((t,e,i)=>e>0?(t-i[e-1])/2:t/2));this.polygonBatch.verticesCount+=n,this.polygonBatch.ringsCount+=o,this.polygonBatch.geometriesCount++,s.flatCoordss.push(i),s.ringsVerticesCounts.push(h),s.verticesCount+=n,s.ringsCount+=o,r.getLinearRings().map((t=>this.Bl(t,e)));break;case"Point":const a=t;s=this.ql(e),i=a.getFlatCoordinates(),this.pointBatch.geometriesCount++,s.flatCoordss.push(i);break;case"LineString":case"LinearRing":const u=t;s=this.Xl(e),i=u.getFlatCoordinates(),n=i.length/2,this.lineStringBatch.verticesCount+=n,this.lineStringBatch.geometriesCount++,s.flatCoordss.push(i),s.verticesCount+=n}}changeFeature(t){this.Zl(t),this.Wl(t),this.Vl(t);const e=t.getGeometry();e&&this.Bl(e,t)}removeFeature(t){this.Zl(t),this.Wl(t),this.Vl(t)}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}};const zm={POSITION:"a_position",INDEX:"a_index"};var Gm=class extends Rm{constructor(t,e,i,n,s){super(t,e,i,n,s),this.attributes=[{name:zm.POSITION,size:2,type:cl.FLOAT},{name:zm.INDEX,size:1,type:cl.FLOAT}].concat(s.map((function(t){return{name:"a_"+t.name,size:1,type:cl.FLOAT}})))}generateRenderInstructions(t){const e=(2+this.customAttributes.length)*t.geometriesCount;let i;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const n=[];let s,r=0;for(const e in t.entries){i=t.entries[e];for(let e=0,o=i.flatCoordss.length;e<o;e++){n[0]=i.flatCoordss[e][0],n[1]=i.flatCoordss[e][1],At(t.renderInstructionsTransform,n),t.renderInstructions[r++]=n[0],t.renderInstructions[r++]=n[1];for(let e=0,n=this.customAttributes.length;e<n;e++)s=this.customAttributes[e].callback(i.feature),t.renderInstructions[r++]=s}}}};const jm={POSITION:"a_position"};var Dm=class extends Rm{constructor(t,e,i,n,s){super(t,e,i,n,s),this.attributes=[{name:jm.POSITION,size:2,type:cl.FLOAT}].concat(s.map((function(t){return{name:"a_"+t.name,size:1,type:cl.FLOAT}})))}generateRenderInstructions(t){const e=2*t.verticesCount+(1+this.customAttributes.length)*t.geometriesCount+t.ringsCount;let i;t.renderInstructions&&t.renderInstructions.length===e||(t.renderInstructions=new Float32Array(e));const n=[];let s,r=0;for(const e in t.entries){i=t.entries[e];for(let e=0,o=i.flatCoordss.length;e<o;e++){n.length=i.flatCoordss[e].length,gn(i.flatCoordss[e],0,n.length,2,t.renderInstructionsTransform,n);for(let e=0,n=this.customAttributes.length;e<n;e++)s=this.customAttributes[e].callback(i.feature),t.renderInstructions[r++]=s;t.renderInstructions[r++]=i.ringsVerticesCounts[e].length;for(let n=0,s=i.ringsVerticesCounts[e].length;n<s;n++)t.renderInstructions[r++]=i.ringsVerticesCounts[e][n];for(let e=0,i=n.length;e<i;e+=2)t.renderInstructions[r++]=n[e],t.renderInstructions[r++]=n[e+1]}}}};function Um(t){const e=hr(t);return 256*e[0]*256+256*e[1]+e[2]}const $m="vec3(\n  fract(floor(a_color / 256.0 / 256.0) / 256.0),\n  fract(floor(a_color / 256.0) / 256.0),\n  fract(a_color / 256.0)\n);",Bm=`\n  precision mediump float;\n  uniform mat4 u_projectionMatrix;\n  attribute vec2 a_position;\n  attribute float a_color;\n  attribute float a_opacity;\n  varying vec3 v_color;\n  varying float v_opacity;\n\n  void main(void) {\n    gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0);\n    v_color = ${$m}\n    v_opacity = a_opacity;\n  }`,qm="\n  precision mediump float;\n  varying vec3 v_color;\n  varying float v_opacity;\n\n  void main(void) {\n    gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n  }",Xm=`\n  precision mediump float;\n  uniform mat4 u_projectionMatrix;\n  uniform vec2 u_sizePx;\n  attribute vec2 a_segmentStart;\n  attribute vec2 a_segmentEnd;\n  attribute float a_parameters;\n  attribute float a_color;\n  attribute float a_opacity;\n  attribute float a_width;\n  varying vec2 v_segmentStart;\n  varying vec2 v_segmentEnd;\n  varying float v_angleStart;\n  varying float v_angleEnd;\n  varying vec3 v_color;\n  varying float v_opacity;\n  varying float v_width;\n\n  vec2 worldToPx(vec2 worldPos) {\n    vec4 screenPos = u_projectionMatrix * vec4(worldPos, 0.0, 1.0);\n    return (0.5 * screenPos.xy + 0.5) * u_sizePx;\n  }\n\n  vec4 pxToScreen(vec2 pxPos) {\n    vec2 screenPos = pxPos * 4.0 / u_sizePx;\n    return vec4(screenPos.xy, 0.0, 0.0);\n  }\n\n  vec2 getOffsetDirection(vec2 normalPx, vec2 tangentPx, float joinAngle) {\n    if (cos(joinAngle) > 0.93) return normalPx - tangentPx;\n    float halfAngle = joinAngle / 2.0;\n    vec2 angleBisectorNormal = vec2(\n      sin(halfAngle) * normalPx.x + cos(halfAngle) * normalPx.y,\n      -cos(halfAngle) * normalPx.x + sin(halfAngle) * normalPx.y\n    );\n    float length = 1.0 / sin(halfAngle);\n    return angleBisectorNormal * length;\n  }\n\n  void main(void) {\n    float anglePrecision = 1500.0;\n    float paramShift = 10000.0;\n    v_angleStart = fract(a_parameters / paramShift) * paramShift / anglePrecision;\n    v_angleEnd = fract(floor(a_parameters / paramShift + 0.5) / paramShift) * paramShift / anglePrecision;\n    float vertexNumber = floor(a_parameters / paramShift / paramShift + 0.0001);\n    vec2 tangentPx = worldToPx(a_segmentEnd) - worldToPx(a_segmentStart);\n    tangentPx = normalize(tangentPx);\n    vec2 normalPx = vec2(-tangentPx.y, tangentPx.x);\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 offsetPx = getOffsetDirection(normalPx * normalDir, tangentDir * tangentPx, angle) * a_width * 0.5;\n    vec2 position =  vertexNumber < 1.5 ? a_segmentStart : a_segmentEnd;\n    gl_Position = u_projectionMatrix * vec4(position, 0.0, 1.0) + pxToScreen(offsetPx);\n    v_segmentStart = worldToPx(a_segmentStart);\n    v_segmentEnd = worldToPx(a_segmentEnd);\n    v_color = ${$m}\n    v_opacity = a_opacity;\n    v_width = a_width;\n  }`,Ym="\n  precision mediump float;\n  uniform float u_pixelRatio;\n  varying vec2 v_segmentStart;\n  varying vec2 v_segmentEnd;\n  varying float v_angleStart;\n  varying float v_angleEnd;\n  varying vec3 v_color;\n  varying float v_opacity;\n  varying float v_width;\n\n  float segmentDistanceField(vec2 point, vec2 start, vec2 end, float radius) {\n    vec2 startToPoint = point - start;\n    vec2 startToEnd = end - start;\n    float ratio = clamp(dot(startToPoint, startToEnd) / dot(startToEnd, startToEnd), 0.0, 1.0);\n    float dist = length(startToPoint - ratio * startToEnd);\n    return 1.0 - smoothstep(radius - 1.0, radius, dist);\n  }\n\n  void main(void) {\n    vec2 v_currentPoint = gl_FragCoord.xy / u_pixelRatio;\n    gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n    gl_FragColor *= segmentDistanceField(v_currentPoint, v_segmentStart, v_segmentEnd, v_width);\n  }",Zm=`\n  precision mediump float;\n  uniform mat4 u_projectionMatrix;\n  uniform mat4 u_offsetScaleMatrix;\n  attribute vec2 a_position;\n  attribute float a_index;\n  attribute float a_color;\n  attribute float a_opacity;\n  varying vec2 v_texCoord;\n  varying vec3 v_color;\n  varying float v_opacity;\n\n  void main(void) {\n    mat4 offsetMatrix = u_offsetScaleMatrix;\n    float size = 6.0;\n    float offsetX = a_index == 0.0 || a_index == 3.0 ? -size / 2.0 : size / 2.0;\n    float offsetY = a_index == 0.0 || a_index == 1.0 ? -size / 2.0 : size / 2.0;\n    vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n    gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n    float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n    float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n    v_texCoord = vec2(u, v);\n    v_color = ${$m}\n    v_opacity = a_opacity;\n  }`,Vm="\n  precision mediump float;\n  varying vec3 v_color;\n  varying float v_opacity;\n\n  void main(void) {\n      gl_FragColor = vec4(v_color, 1.0) * v_opacity;\n  }";function Wm(t){return Object.keys(t).map((e=>({name:e,callback:t[e]})))}var Hm=class extends Fl{constructor(t,e){const i=e.uniforms||{},n=[1,0,0,1,0,0];i[nl]=n,super(t,{uniforms:i,postProcesses:e.postProcesses}),this.yl=-1,this.ts=[1/0,1/0,-1/0,-1/0],this.El=n;const s={color:function(){return Um("#ddd")},opacity:function(){return 1},...e.fill&&e.fill.attributes},r={color:function(){return Um("#eee")},opacity:function(){return 1},width:function(){return 1.5},...e.stroke&&e.stroke.attributes},o={color:function(){return Um("#eee")},opacity:function(){return 1},...e.point&&e.point.attributes};this.Hl=e.fill&&e.fill.vertexShader||Bm,this.Kl=e.fill&&e.fill.fragmentShader||qm,this.Jl=Wm(s),this.Ql=e.stroke&&e.stroke.vertexShader||Xm,this.tc=e.stroke&&e.stroke.fragmentShader||Ym,this.ec=Wm(r),this.ic=e.point&&e.point.vertexShader||Zm,this.sc=e.point&&e.point.fragmentShader||Vm,this.rc=Wm(o),this.Rl=Im(),this.oc=new Om;const h=this.getLayer().getSource();this.oc.addFeatures(h.getFeatures()),this.Ol=[U(h,mf,this.zl,this),U(h,vf,this.Gl,this),U(h,yf,this.jl,this),U(h,gf,this.Dl,this)]}afterHelperCreated(){this.hc=new Dm(this.helper,this.Rl,this.Hl,this.Kl,this.Jl),this.ac=new Gm(this.helper,this.Rl,this.ic,this.sc,this.rc),this.uc=new Nm(this.helper,this.Rl,this.Ql,this.tc,this.ec)}zl(t){const e=t.feature;this.oc.addFeature(e)}Gl(t){const e=t.feature;this.oc.changeFeature(e)}jl(t){const e=t.feature;this.oc.removeFeature(e)}Dl(){this.oc.clear()}renderFrame(t){const e=this.helper.getGL();this.preRender(e,t);const i=this.getLayer().getSource(),n=t.viewState.projection,s=i.getWrapX()&&n.canWrapX(),r=n.getExtent(),o=t.extent,h=s?Ee(r):null,a=s?Math.ceil((o[2]-r[2])/h)+1:1;let u=s?Math.floor((o[0]-r[0])/h):0;do{this.hc.render(this.oc.polygonBatch,this.El,t,u*h),this.uc.render(this.oc.lineStringBatch,this.El,t,u*h),this.ac.render(this.oc.pointBatch,this.El,t,u*h)}while(++u<a);this.helper.finalizeDraw(t);const l=this.helper.getCanvas(),c=t.layerStatesArray[t.layerIndex].opacity;return c!==parseFloat(l.style.opacity)&&(l.style.opacity=String(c)),this.postRender(e,t),l}prepareFrameInternal(t){const e=this.getLayer(),i=e.getSource(),n=t.viewState,s=!t.viewHints[jo]&&!t.viewHints[Do],r=!oe(this.ts,t.extent),o=this.yl<i.getRevision();if(o&&(this.yl=i.getRevision()),s&&(r||o)){const s=n.projection,r=n.resolution,o=e instanceof xm?e.getRenderBuffer():0,h=Vt(t.extent,o*r);i.loadFeatures(h,r,s),this.ready=!1;let a=3;const u=()=>{a--,this.ready=a<=0,this.getLayer().changed()};this.hc.rebuild(this.oc.polygonBatch,t,"Polygon",u),this.uc.rebuild(this.oc.lineStringBatch,t,"LineString",u),this.ac.rebuild(this.oc.pointBatch,t,"Point",u),this.ts=t.extent.slice()}return this.helper.makeProjectionTransform(t,this.El),this.helper.prepareDraw(t),!0}forEachFeatureAtCoordinate(t,e,i,n,s){}disposeInternal(){this.Rl.terminate(),this.Uo=null,this.Ol.forEach((function(t){B(t)})),this.Ol=null,super.disposeInternal()}};const Km={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},Jm=[Km.FILL],Qm=[Km.STROKE],tv=[Km.BEGIN_PATH],ev=[Km.CLOSE_PATH];var iv=Km;var nv=class extends Ga{constructor(t,e,i,n){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=n,this.maxLineWidth=0,this.resolution=i,this.lc=null,this.cc=null,this.fc=null,this.instructions=[],this.coordinates=[],this.dc=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(t){const e=this.pixelRatio;return 1==e?t:t.map((function(t){return t*e}))}appendFlatPointCoordinates(t,e){const i=this.getBufferedMaxExtent(),n=this.dc,s=this.coordinates;let r=s.length;for(let o=0,h=t.length;o<h;o+=e)n[0]=t[o],n[1]=t[o+1],Kt(i,n)&&(s[r++]=n[0],s[r++]=n[1]);return r}appendFlatLineCoordinates(t,e,i,n,s,r){const o=this.coordinates;let h=o.length;const a=this.getBufferedMaxExtent();r&&(e+=n);let u=t[e],l=t[e+1];const c=this.dc;let f,d,p,m=!0;for(f=e+n;f<i;f+=n)c[0]=t[f],c[1]=t[f+1],p=te(a,c),p!==d?(m&&(o[h++]=u,o[h++]=l,m=!1),o[h++]=c[0],o[h++]=c[1]):p===$t?(o[h++]=c[0],o[h++]=c[1],m=!1):m=!0,u=c[0],l=c[1],d=p;return(s&&m||f===e+n)&&(o[h++]=u,o[h++]=l),h}mc(t,e,i,n,s){for(let r=0,o=i.length;r<o;++r){const o=i[r],h=this.appendFlatLineCoordinates(t,e,o,n,!1,!1);s.push(h),e=o}return e}drawCustom(t,e,i,n){this.beginGeometry(t,e);const s=t.getType(),r=t.getStride(),o=this.coordinates.length;let h,a,u,l,c;switch(s){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),l=[];const e=t.getEndss();c=0;for(let t=0,i=e.length;t<i;++t){const i=[];c=this.mc(h,c,e[t],r,i),l.push(i)}this.instructions.push([iv.CUSTOM,o,l,t,i,Yn]),this.hitDetectionInstructions.push([iv.CUSTOM,o,l,t,n||i,Yn]);break;case"Polygon":case"MultiLineString":u=[],h="Polygon"==s?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),c=this.mc(h,0,t.getEnds(),r,u),this.instructions.push([iv.CUSTOM,o,u,t,i,Xn]),this.hitDetectionInstructions.push([iv.CUSTOM,o,u,t,n||i,Xn]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),a=this.appendFlatLineCoordinates(h,0,h.length,r,!1,!1),this.instructions.push([iv.CUSTOM,o,a,t,i,qn]),this.hitDetectionInstructions.push([iv.CUSTOM,o,a,t,n||i,qn]);break;case"MultiPoint":h=t.getFlatCoordinates(),a=this.appendFlatPointCoordinates(h,r),a>o&&(this.instructions.push([iv.CUSTOM,o,a,t,i,qn]),this.hitDetectionInstructions.push([iv.CUSTOM,o,a,t,n||i,qn]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),a=this.coordinates.length,this.instructions.push([iv.CUSTOM,o,a,t,i]),this.hitDetectionInstructions.push([iv.CUSTOM,o,a,t,n||i])}this.endGeometry(e)}beginGeometry(t,e){this.lc=[iv.BEGIN_GEOMETRY,e,0,t],this.instructions.push(this.lc),this.cc=[iv.BEGIN_GEOMETRY,e,0,t],this.hitDetectionInstructions.push(this.cc)}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 n,s,r=-1;for(e=0;e<i;++e)n=t[e],s=n[0],s==iv.END_GEOMETRY?r=e:s==iv.BEGIN_GEOMETRY&&(n[2]=e,m(this.hitDetectionInstructions,r,e),r=-1)}setFillStrokeStyle(t,e){const i=this.state;if(t){const e=t.getColor();i.fillStyle=Ta(e||Yr)}else i.fillStyle=void 0;if(e){const t=e.getColor();i.strokeStyle=Ta(t||Kr);const n=e.getLineCap();i.lineCap=void 0!==n?n:Zr;const s=e.getLineDash();i.lineDash=s?s.slice():Vr;const r=e.getLineDashOffset();i.lineDashOffset=r||0;const o=e.getLineJoin();i.lineJoin=void 0!==o?o:Wr;const h=e.getWidth();i.lineWidth=void 0!==h?h:1;const a=e.getMiterLimit();i.miterLimit=void 0!==a?a:Hr,i.lineWidth>this.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.fc=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=[iv.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[iv.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,s=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,h=t.lineWidth,a=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||s!=t.currentLineDash&&!g(t.currentLineDash,s)||t.currentLineDashOffset!=r||t.currentLineJoin!=o||t.currentLineWidth!=h||t.currentMiterLimit!=a)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=s,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=h,t.currentMiterLimit=a)}endGeometry(t){this.lc[2]=this.instructions.length,this.lc=null,this.cc[2]=this.hitDetectionInstructions.length,this.cc=null;const e=[iv.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.fc&&(this.fc=Wt(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Vt(this.fc,t,this.fc)}return this.fc}};var sv=class extends nv{constructor(t,e,i,n){super(t,e,i,n),this.Eh=null,this.Ot=null,this.vc=void 0,this.gc=void 0,this.yc=void 0,this.wc=void 0,this.oh=void 0,this.xc=void 0,this.bc=void 0,this.hh=void 0,this.Ji=void 0,this.ah=void 0,this.Yh=void 0,this.fh=void 0,this.Mc=void 0}drawPoint(t,e){if(!this.Ot)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([iv.DRAW_IMAGE,s,r,this.Ot,this.gc*this.vc,this.yc*this.vc,Math.ceil(this.wc*this.vc),this.oh,this.xc*this.vc,this.bc*this.vc,this.hh,this.Ji,[this.ah[0]*this.pixelRatio/this.vc,this.ah[1]*this.pixelRatio/this.vc],Math.ceil(this.Yh*this.vc),this.fh,this.Mc]),this.hitDetectionInstructions.push([iv.DRAW_IMAGE,s,r,this.Eh,this.gc,this.yc,this.wc,this.oh,this.xc,this.bc,this.hh,this.Ji,this.ah,this.Yh,this.fh,this.Mc]),this.endGeometry(e)}drawMultiPoint(t,e){if(!this.Ot)return;this.beginGeometry(t,e);const i=t.getFlatCoordinates(),n=t.getStride(),s=this.coordinates.length,r=this.appendFlatPointCoordinates(i,n);this.instructions.push([iv.DRAW_IMAGE,s,r,this.Ot,this.gc*this.vc,this.yc*this.vc,Math.ceil(this.wc*this.vc),this.oh,this.xc*this.vc,this.bc*this.vc,this.hh,this.Ji,[this.ah[0]*this.pixelRatio/this.vc,this.ah[1]*this.pixelRatio/this.vc],Math.ceil(this.Yh*this.vc),this.fh,this.Mc]),this.hitDetectionInstructions.push([iv.DRAW_IMAGE,s,r,this.Eh,this.gc,this.yc,this.wc,this.oh,this.xc,this.bc,this.hh,this.Ji,this.ah,this.Yh,this.fh,this.Mc]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.gc=void 0,this.yc=void 0,this.Eh=null,this.Ot=null,this.vc=void 0,this.wc=void 0,this.ah=void 0,this.oh=void 0,this.xc=void 0,this.bc=void 0,this.hh=void 0,this.Ji=void 0,this.Yh=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),n=t.getSize(),s=t.getOrigin();this.vc=t.getPixelRatio(this.pixelRatio),this.gc=i[0],this.yc=i[1],this.Eh=t.getHitDetectionImage(),this.Ot=t.getImage(this.pixelRatio),this.wc=n[1],this.oh=t.getOpacity(),this.xc=s[0],this.bc=s[1],this.hh=t.getRotateWithView(),this.Ji=t.getRotation(),this.ah=t.getScaleArray(),this.Yh=n[0],this.fh=t.getDeclutterMode(),this.Mc=e}};var rv=class extends nv{constructor(t,e,i,n){super(t,e,i,n)}Sc(t,e,i,n){const s=this.coordinates.length,r=this.appendFlatLineCoordinates(t,e,i,n,!1,!1),o=[iv.MOVE_TO_LINE_TO,s,r];return this.instructions.push(o),this.hitDetectionInstructions.push(o),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([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,Vr,0],tv);const r=t.getFlatCoordinates(),o=t.getStride();this.Sc(r,0,r.length,o),this.hitDetectionInstructions.push(Qm),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([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],tv);const r=t.getEnds(),o=t.getFlatCoordinates(),h=t.getStride();let a=0;for(let t=0,e=r.length;t<e;++t)a=this.Sc(o,a,r[t],h);this.hitDetectionInstructions.push(Qm),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qm),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qm),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(tv)}};var ov=class extends nv{constructor(t,e,i,n){super(t,e,i,n)}Pc(t,e,i,n){const s=this.state,r=void 0!==s.fillStyle,o=void 0!==s.strokeStyle,h=i.length;this.instructions.push(tv),this.hitDetectionInstructions.push(tv);for(let s=0;s<h;++s){const r=i[s],h=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,r,n,!0,!o),u=[iv.MOVE_TO_LINE_TO,h,a];this.instructions.push(u),this.hitDetectionInstructions.push(u),o&&(this.instructions.push(ev),this.hitDetectionInstructions.push(ev)),e=r}return r&&(this.instructions.push(Jm),this.hitDetectionInstructions.push(Jm)),o&&(this.instructions.push(Qm),this.hitDetectionInstructions.push(Qm)),e}drawCircle(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this._c(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([iv.SET_FILL_STYLE,Yr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const r=t.getFlatCoordinates(),o=t.getStride(),h=this.coordinates.length;this.appendFlatLineCoordinates(r,0,r.length,o,!1,!1);const a=[iv.CIRCLE,h];this.instructions.push(tv,a),this.hitDetectionInstructions.push(tv,a),void 0!==i.fillStyle&&(this.instructions.push(Jm),this.hitDetectionInstructions.push(Jm)),void 0!==i.strokeStyle&&(this.instructions.push(Qm),this.hitDetectionInstructions.push(Qm)),this.endGeometry(e)}drawPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this._c(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([iv.SET_FILL_STYLE,Yr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const r=t.getEnds(),o=t.getOrientedFlatCoordinates(),h=t.getStride();this.Pc(o,0,r,h),this.endGeometry(e)}drawMultiPolygon(t,e){const i=this.state,n=i.fillStyle,s=i.strokeStyle;if(void 0===n&&void 0===s)return;this._c(),this.beginGeometry(t,e),void 0!==i.fillStyle&&this.hitDetectionInstructions.push([iv.SET_FILL_STYLE,Yr]),void 0!==i.strokeStyle&&this.hitDetectionInstructions.push([iv.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset]);const r=t.getEndss(),o=t.getOrientedFlatCoordinates(),h=t.getStride();let a=0;for(let t=0,e=r.length;t<e;++t)a=this.Pc(o,a,r[t],h);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,n=e.length;i<n;++i)e[i]=Dn(e[i],t)}return super.finish()}_c(){const t=this.state;void 0!==t.fillStyle&&this.updateFillStyle(t,this.createFill),void 0!==t.strokeStyle&&this.updateStrokeStyle(t,this.applyStroke)}};function hv(t,e,i,n,s){let r,o,h,a,u,l,c,f,d,p,m=i,v=i,g=0,y=0,w=i;for(o=i;o<n;o+=s){const i=e[o],n=e[o+1];void 0!==u&&(d=i-u,p=n-l,a=Math.sqrt(d*d+p*p),void 0!==c&&(y+=h,r=Math.acos((c*d+f*p)/(h*a)),r>t&&(y>g&&(g=y,m=w,v=o),y=0,w=o-s)),h=a,c=d,f=p),u=i,l=n}return y+=a,y>g?[w,o]:[m,v]}const av={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};var uv=class extends nv{constructor(t,e,i,n){super(t,e,i,n),this.Ec=null,this.nr="",this.sr=0,this.rr=0,this.hr=void 0,this.ar=0,this.lr=null,this.fillStates={},this.cr=null,this.strokeStates={},this.dr={},this.textStates={},this.Tc="",this.Cc="",this.Fc="",this.Mc=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.lr,n=this.cr,s=this.dr;if(""===this.nr||!s||!i&&!n)return;const r=this.coordinates;let o=r.length;const h=t.getType();let a=null,u=t.getStride();if("line"!==s.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let i=s.overflow?null:[];switch(h){case"Point":case"MultiPoint":a=t.getFlatCoordinates();break;case"LineString":a=t.getFlatMidpoint();break;case"Circle":a=t.getCenter();break;case"MultiLineString":a=t.getFlatMidpoints(),u=2;break;case"Polygon":a=t.getFlatInteriorPoint(),s.overflow||i.push(a[2]/this.resolution),u=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();a=[];for(let t=0,n=e.length;t<n;t+=3)s.overflow||i.push(e[t+2]/this.resolution),a.push(e[t],e[t+1]);if(0===a.length)return;u=2}const n=this.appendFlatPointCoordinates(a,u);if(n===o)return;if(i&&(n-o)/2!=a.length/u){let t=o/2;i=i.filter(((e,i)=>{const n=r[2*(t+i)]===a[i*u]&&r[2*(t+i)+1]===a[i*u+1];return n||--t,n}))}this.Ic(),(s.backgroundFill||s.backgroundStroke)&&(this.setFillStrokeStyle(s.backgroundFill,s.backgroundStroke),s.backgroundFill&&(this.updateFillStyle(this.state,this.createFill),this.hitDetectionInstructions.push(this.createFill(this.state))),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!=to&&(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 c=this.pixelRatio;this.instructions.push([iv.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.hr,this.ar,[1,1],NaN,void 0,this.Mc,l==to?to:l.map((function(t){return t*c})),!!s.backgroundFill,!!s.backgroundStroke,this.nr,this.Tc,this.Fc,this.Cc,this.sr,this.rr,i]);const f=1/c;this.hitDetectionInstructions.push([iv.DRAW_IMAGE,o,n,null,NaN,NaN,NaN,1,0,0,this.hr,this.ar,[f,f],NaN,void 0,this.Mc,l,!!s.backgroundFill,!!s.backgroundStroke,this.nr,this.Tc,this.Fc,this.Cc,this.sr,this.rr,i]),this.endGeometry(e)}else{if(!Te(this.getBufferedMaxExtent(),t.getExtent()))return;let i;if(a=t.getFlatCoordinates(),"LineString"==h)i=[a.length];else if("MultiLineString"==h)i=t.getEnds();else if("Polygon"==h)i=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t][0])}this.beginGeometry(t,e);const n=s.textAlign;let l,c=0;for(let t=0,e=i.length;t<e;++t){if(null==n){const e=hv(s.maxAngle,a,c,i[t],u);c=e[0],l=e[1]}else l=i[t];for(let t=c;t<l;t+=u)r.push(a[t],a[t+1]);const e=r.length;c=i[t],this.Ac(o,e),o=e}this.endGeometry(e)}}Ic(){const t=this.cr,e=this.dr,i=this.lr,n=this.Fc;t&&(n in this.strokeStates||(this.strokeStates[n]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const s=this.Tc;s in this.textStates||(this.textStates[s]={font:e.font,textAlign:e.textAlign||Jr,justify:e.justify,textBaseline:e.textBaseline||Qr,scale:e.scale});const r=this.Cc;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}Ac(t,e){const i=this.cr,n=this.dr,s=this.Fc,r=this.Tc,o=this.Cc;this.Ic();const h=this.pixelRatio,a=av[n.textBaseline],u=this.rr*h,l=this.nr,c=i?i.lineWidth*Math.abs(n.scale[0])/2:0;this.instructions.push([iv.DRAW_CHARS,t,e,a,n.overflow,o,n.maxAngle,h,u,s,c*h,l,r,1]),this.hitDetectionInstructions.push([iv.DRAW_CHARS,t,e,a,n.overflow,o,n.maxAngle,1,u,s,c,l,r,1/h])}setTextStyle(t,e){let n,s,r;if(t){const e=t.getFill();e?(s=this.lr,s||(s={},this.lr=s),s.fillStyle=Ta(e.getColor()||Yr)):(s=null,this.lr=s);const o=t.getStroke();if(o){r=this.cr,r||(r={},this.cr=r);const t=o.getLineDash(),e=o.getLineDashOffset(),i=o.getWidth(),n=o.getMiterLimit();r.lineCap=o.getLineCap()||Zr,r.lineDash=t?t.slice():Vr,r.lineDashOffset=void 0===e?0:e,r.lineJoin=o.getLineJoin()||Wr,r.lineWidth=void 0===i?1:i,r.miterLimit=void 0===n?Hr:n,r.strokeStyle=Ta(o.getColor()||Kr)}else r=null,this.cr=r;n=this.dr;const h=t.getFont()||Xr;ro(h);const a=t.getScaleArray();n.overflow=t.getOverflow(),n.font=h,n.maxAngle=t.getMaxAngle(),n.placement=t.getPlacement(),n.textAlign=t.getTextAlign(),n.justify=t.getJustify(),n.textBaseline=t.getTextBaseline()||Qr,n.backgroundFill=t.getBackgroundFill(),n.backgroundStroke=t.getBackgroundStroke(),n.padding=t.getPadding()||to,n.scale=void 0===a?[1,1]:a;const u=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),f=t.getRotation();this.nr=t.getText()||"",this.sr=void 0===u?0:u,this.rr=void 0===l?0:l,this.hr=void 0!==c&&c,this.ar=void 0===f?0:f,this.Fc=r?("string"==typeof r.strokeStyle?r.strokeStyle:i(r.strokeStyle))+r.lineCap+r.lineDashOffset+"|"+r.lineWidth+r.lineJoin+r.miterLimit+"["+r.lineDash.join()+"]":"",this.Tc=n.font+n.scale+(n.textAlign||"?")+(n.justify||"?")+(n.textBaseline||"?"),this.Cc=s?"string"==typeof s.fillStyle?s.fillStyle:"|"+i(s.fillStyle):""}else this.nr="";this.Mc=e}};const lv={Circle:ov,Default:nv,Image:sv,LineString:rv,Polygon:ov,Text:uv};var cv=class{constructor(t,e,i,n){this.kc=t,this.Rc=e,this.Lt=n,this.Lc=i,this.Nc={}}finish(){const t={};for(const e in this.Nc){t[e]=t[e]||{};const i=this.Nc[e];for(const n in i){const s=i[n].finish();t[e][n]=s}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let n=this.Nc[i];void 0===n&&(n={},this.Nc[i]=n);let s=n[e];if(void 0===s){s=new(0,lv[e])(this.kc,this.Rc,this.Lc,this.Lt),n[e]=s}return s}};function fv(t,e,i,n,s,r,o,h,a,u,l,c){let f=t[e],d=t[e+1],p=0,m=0,v=0,g=0;function y(){p=f,m=d,f=t[e+=n],d=t[e+1],g+=v,v=Math.sqrt((f-p)*(f-p)+(d-m)*(d-m))}do{y()}while(e<i-n&&g+v<r);let w=0===v?0:(r-g)/v;const x=pi(p,f,w),b=pi(m,d,w),M=e-n,S=g,P=r+h*a(u,s,l);for(;e<i-n&&g+v<P;)y();w=0===v?0:(P-g)/v;const _=pi(p,f,w),E=pi(m,d,w);let T;if(c){const t=[x,b,_,E];yn(t,0,4,2,c,t,t),T=t[0]>t[2]}else T=x>_;const C=Math.PI,F=[],I=M+n===e;let A;if(v=0,g=S,f=t[e=M],d=t[e+1],I){y(),A=Math.atan2(d-m,f-p),T&&(A+=A>0?-C:C);const t=(_+x)/2,e=(E+b)/2;return F[0]=[t,e,(P-r)/2,A,s],F}for(let t=0,c=(s=s.replace(/\n/g," ")).length;t<c;){y();let x=Math.atan2(d-m,f-p);if(T&&(x+=x>0?-C:C),void 0!==A){let t=x-A;if(t+=t>C?-2*C:t<-C?2*C:0,Math.abs(t)>o)return null}A=x;const b=t;let M=0;for(;t<c;++t){const o=h*a(u,s[T?c-t-1:t],l);if(e+n<i&&g+v<r+M+o/2)break;M+=o}if(t===b)continue;const S=T?s.substring(c-b,c-t):s.substring(b,t);w=0===v?0:(r+M/2-g)/v;const P=pi(p,f,w),_=pi(m,d,w);F.push([P,_,M/2,x,S]),r+=M}return F}function dv(t,e,i,n){let s=t[e],r=t[e+1],o=0;for(let h=e+n;h<i;h+=n){const e=t[h],i=t[h+1];o+=Math.sqrt((e-s)*(e-s)+(i-r)*(i-r)),s=e,r=i}return o}const pv=[1/0,1/0,-1/0,-1/0],mv=[],vv=[],gv=[],yv=[];function wv(t){return t[3].declutterBox}const xv=new RegExp("["+String.fromCharCode(1425)+"-"+String.fromCharCode(2303)+String.fromCharCode(64285)+"-"+String.fromCharCode(65023)+String.fromCharCode(65136)+"-"+String.fromCharCode(65276)+String.fromCharCode(67584)+"-"+String.fromCharCode(69631)+String.fromCharCode(124928)+"-"+String.fromCharCode(126975)+"]");function bv(t,e){return"start"!==e&&"end"!==e||xv.test(t)||(e="start"===e?"left":"right"),av[e]}function Mv(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}var Sv=class{constructor(t,e,i,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.Oc,this.instructions=n.instructions,this.coordinates=n.coordinates,this.zc={},this.Gc=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pr=null,this.js=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.jc={},this.Ec={}}createLabel(t,e,i,n){const s=t+e+i+n;if(this.Ec[s])return this.Ec[s];const r=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,h=this.textStates[e],a=this.pixelRatio,u=[h.scale[0]*a,h.scale[1]*a],l=Array.isArray(t),c=h.justify?av[h.justify]:bv(Array.isArray(t)?t[0]:t,h.textAlign||Jr),f=n&&r.lineWidth?r.lineWidth:0,d=l?t:t.split("\n").reduce(Mv,[]),{width:p,height:m,widths:v,heights:g,lineWidths:y}=lo(h,d),w=p+f,x=[],b=(w+2)*u[0],M=(m+f)*u[1],S={width:b<0?Math.floor(b):Math.ceil(b),height:M<0?Math.floor(M):Math.ceil(M),contextInstructions:x};1==u[0]&&1==u[1]||x.push("scale",u),n&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",f),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const P=.5-c;let _=c*w+P*f;const E=[],T=[];let C,F=0,I=0,A=0,k=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){I+=F,F=0,_=c*w+P*f,++k;continue}const s=d[t+1]||h.font;s!==C&&(n&&E.push("font",s),i&&T.push("font",s),C=s),F=Math.max(F,g[A]);const r=[e,_+P*v[A]+c*(v[A]-y[k]),.5*(f+F)+I];_+=v[A],n&&E.push("strokeText",r),i&&T.push("fillText",r),++A}return Array.prototype.push.apply(x,E),Array.prototype.push.apply(x,T),this.Ec[s]=S,S}Dc(t,e,i,n,s,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,n),t.lineTo.apply(t,s),t.lineTo.apply(t,e),r&&(this.Oc=r[2],this.ph(t)),o&&(this.Uc(t,o),t.stroke())}$c(t,e,i,n,s,r,o,h,a,u,l,c,f,d,p,m){let v=i-(o*=c[0]),g=n-(h*=c[1]);const y=s+a>t?t-a:s,w=r+u>e?e-u:r,x=d[3]+y*c[0]+d[1],b=d[0]+w*c[1]+d[2],M=v-d[3],S=g-d[0];let P;return(p||0!==l)&&(mv[0]=M,yv[0]=M,mv[1]=S,vv[1]=S,vv[0]=M+x,gv[0]=vv[0],gv[1]=S+b,yv[1]=gv[1]),0!==l?(P=Ot([1,0,0,1,0,0],i,n,1,1,l,-i,-n),At(P,mv),At(P,vv),At(P,gv),At(P,yv),ie(Math.min(mv[0],vv[0],gv[0],yv[0]),Math.min(mv[1],vv[1],gv[1],yv[1]),Math.max(mv[0],vv[0],gv[0],yv[0]),Math.max(mv[1],vv[1],gv[1],yv[1]),pv)):ie(Math.min(M,M+x),Math.min(S,S+b),Math.max(M,M+x),Math.max(S,S+b),pv),f&&(v=Math.round(v),g=Math.round(g)),{drawImageX:v,drawImageY:g,drawImageW:y,drawImageH:w,originX:a,originY:u,declutterBox:{minX:pv[0],minY:pv[1],maxX:pv[2],maxY:pv[3],value:m},canvasTransform:P,scale:c}}Bc(t,e,i,n,s,r,o){const h=!(!r&&!o),a=n.declutterBox,u=t.canvas,l=o?o[2]*n.scale[0]/2:0;return a.minX-l<=u.width/e&&a.maxX+l>=0&&a.minY-l<=u.height/e&&a.maxY+l>=0&&(h&&this.Dc(t,mv,vv,gv,yv,r,o),co(t,n.canvasTransform,s,i,n.originX,n.originY,n.drawImageW,n.drawImageH,n.drawImageX,n.drawImageY,n.scale)),!0}ph(t){if(this.Oc){const e=At(this.Gc,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.js)}t.fill(),this.Oc&&t.restore()}Uc(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])}qc(t,e,i,n){const s=this.textStates[e],r=this.createLabel(t,e,n,i),o=this.strokeStates[i],h=this.pixelRatio,a=bv(Array.isArray(t)?t[0]:t,s.textAlign||Jr),u=av[s.textBaseline||Qr],l=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:a*(r.width/h-2*s.scale[0])+2*(.5-a)*l,anchorY:u*r.height/h+2*(.5-u)*l}}Xc(t,e,i,n,s,r,o,h){let a;this.pr&&g(i,this.Gc)?a=this.pr:(this.pr||(this.pr=[]),a=gn(this.coordinates,0,this.coordinates.length,2,i,this.pr),It(this.Gc,i));let u=0;const l=n.length;let c,f,d,p,m,v,y,w,x,b,M,S,P=0,_=0,E=0,T=null,C=null;const F=this.zc,I=this.js,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:I},R=this.instructions!=n||this.overlaps?0:200;let L,N,O,z;for(;u<l;){const i=n[u];switch(i[0]){case iv.BEGIN_GEOMETRY:L=i[1],z=i[3],L.getGeometry()?void 0===o||Te(o,z.getExtent())?++u:u=i[2]+1:u=i[2];break;case iv.BEGIN_PATH:_>R&&(this.ph(t),_=0),E>R&&(t.stroke(),E=0),_||E||(t.beginPath(),p=NaN,m=NaN),++u;break;case iv.CIRCLE:P=i[1];const n=a[P],l=a[P+1],g=a[P+2]-n,G=a[P+3]-l,j=Math.sqrt(g*g+G*G);t.moveTo(n+j,l),t.arc(n,l,j,0,2*Math.PI,!0),++u;break;case iv.CLOSE_PATH:t.closePath(),++u;break;case iv.CUSTOM:P=i[1],c=i[2];const D=i[3],U=i[4],$=6==i.length?i[5]:void 0;k.geometry=D,k.feature=L,u in F||(F[u]=[]);const B=F[u];$?$(a,P,c,2,B):(B[0]=a[P],B[1]=a[P+1],B.length=2),U(B,k),++u;break;case iv.DRAW_IMAGE:P=i[1],c=i[2],w=i[3],f=i[4],d=i[5];let q=i[6];const X=i[7],Y=i[8],Z=i[9],V=i[10];let W=i[11];const H=i[12];let K=i[13];const J=i[14],Q=i[15];if(!w&&i.length>=20){x=i[19],b=i[20],M=i[21],S=i[22];const t=this.qc(x,b,M,S);w=t.label,i[3]=w;const e=i[23];f=(t.anchorX-e)*this.pixelRatio,i[4]=f;const n=i[24];d=(t.anchorY-n)*this.pixelRatio,i[5]=d,q=w.height,i[6]=q,K=w.width,i[13]=K}let tt,et,it,nt;i.length>25&&(tt=i[25]),i.length>17?(et=i[16],it=i[17],nt=i[18]):(et=to,it=!1,nt=!1),V&&A?W+=I:V||A||(W-=I);let st=0;for(;P<c;P+=2){if(tt&&tt[st++]<K/this.pixelRatio)continue;const i=this.$c(w.width,w.height,a[P],a[P+1],K,q,f,d,Y,Z,W,H,s,et,it||nt,L),n=[t,e,w,i,X,it?T:null,nt?C:null];if(h){if("none"===J)continue;if("obstacle"===J){h.insert(i.declutterBox);continue}{let t,e;if(Q){const i=c-P;if(!Q[i]){Q[i]=n;continue}if(t=Q[i],delete Q[i],e=wv(t),h.collides(e))continue}if(h.collides(i.declutterBox))continue;t&&(h.insert(e),this.Bc.apply(this,t)),h.insert(i.declutterBox)}}this.Bc.apply(this,n)}++u;break;case iv.DRAW_CHARS:const rt=i[1],ot=i[2],ht=i[3],at=i[4];S=i[5];const ut=i[6],lt=i[7],ct=i[8];M=i[9];const ft=i[10];x=i[11],b=i[12];const dt=[i[13],i[13]],pt=this.textStates[b],mt=pt.font,vt=[pt.scale[0]*lt,pt.scale[1]*lt];let gt;mt in this.jc?gt=this.jc[mt]:(gt={},this.jc[mt]=gt);const yt=dv(a,rt,ot,2),wt=Math.abs(vt[0])*uo(mt,x,gt);if(at||wt<=yt){const i=this.textStates[b].textAlign,n=fv(a,rt,ot,2,x,(yt-wt)*av[i],ut,Math.abs(vt[0]),uo,mt,gt,A?0:this.js);t:if(n){const i=[];let s,r,o,a,u;if(M)for(s=0,r=n.length;s<r;++s){u=n[s],o=u[4],a=this.createLabel(o,b,"",M),f=u[2]+(vt[0]<0?-ft:ft),d=ht*a.height+2*(.5-ht)*ft*vt[1]/vt[0]-ct;const r=this.$c(a.width,a.height,u[0],u[1],a.width,a.height,f,d,0,0,u[3],dt,!1,to,!1,L);if(h&&h.collides(r.declutterBox))break t;i.push([t,e,a,r,1,null,null])}if(S)for(s=0,r=n.length;s<r;++s){u=n[s],o=u[4],a=this.createLabel(o,b,S,""),f=u[2],d=ht*a.height-ct;const r=this.$c(a.width,a.height,u[0],u[1],a.width,a.height,f,d,0,0,u[3],dt,!1,to,!1,L);if(h&&h.collides(r.declutterBox))break t;i.push([t,e,a,r,1,null,null])}h&&h.load(i.map(wv));for(let t=0,e=i.length;t<e;++t)this.Bc.apply(this,i[t])}}++u;break;case iv.END_GEOMETRY:if(void 0!==r){L=i[1];const t=r(L,z);if(t)return t}++u;break;case iv.FILL:R?_++:this.ph(t),++u;break;case iv.MOVE_TO_LINE_TO:for(P=i[1],c=i[2],N=a[P],O=a[P+1],v=N+.5|0,y=O+.5|0,v===p&&y===m||(t.moveTo(N,O),p=v,m=y),P+=2;P<c;P+=2)N=a[P],O=a[P+1],v=N+.5|0,y=O+.5|0,P!=c-2&&v===p&&y===m||(t.lineTo(N,O),p=v,m=y);++u;break;case iv.SET_FILL_STYLE:T=i,this.Oc=i[2],_&&(this.ph(t),_=0,E&&(t.stroke(),E=0)),t.fillStyle=i[1],++u;break;case iv.SET_STROKE_STYLE:C=i,E&&(t.stroke(),E=0),this.Uc(t,i),++u;break;case iv.STROKE:R?E++:t.stroke(),++u;break;default:++u}}_&&this.ph(t),E&&t.stroke()}execute(t,e,i,n,s,r){this.js=n,this.Xc(t,e,i,this.instructions,s,void 0,void 0,r)}executeHitDetection(t,e,i,n,s){return this.js=i,this.Xc(t,1,e,this.hitDetectionInstructions,!0,n,s)}};const Pv=["Polygon","Circle","LineString","Image","Text","Default"];const _v={};function Ev(t){if(void 0!==_v[t])return _v[t];const e=2*t+1,i=t*t,n=new Array(i+1);for(let s=0;s<=t;++s)for(let r=0;r<=t;++r){const o=s*s+r*r;if(o>i)break;let h=n[o];h||(h=[],n[o]=h),h.push(4*((t+s)*e+(t+r))+3),s>0&&h.push(4*((t-s)*e+(t+r))+3),r>0&&(h.push(4*((t+s)*e+(t-r))+3),s>0&&h.push(4*((t-s)*e+(t-r))+3))}const s=[];for(let t=0,e=n.length;t<e;++t)n[t]&&s.push(...n[t]);return _v[t]=s,s}var Tv=class{constructor(t,e,i,n,s,r){this.Rc=t,this.Da=n,this.Lt=i,this.Lc=e,this.ml=r,this.Yc={},this.Zc=null,this.Vc=[1,0,0,1,0,0],this.Wc(s)}clip(t,e){const i=this.getClipCoords(e);t.beginPath(),t.moveTo(i[0],i[1]),t.lineTo(i[2],i[3]),t.lineTo(i[4],i[5]),t.lineTo(i[6],i[7]),t.clip()}Wc(t){for(const e in t){let i=this.Yc[e];void 0===i&&(i={},this.Yc[e]=i);const n=t[e];for(const t in n){const e=n[t];i[t]=new Sv(this.Lc,this.Lt,this.Da,e)}}}hasExecutors(t){for(const e in this.Yc){const i=this.Yc[e];for(let e=0,n=t.length;e<n;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,n,s,r){const o=2*(n=Math.round(n))+1,h=Ot(this.Vc,n+.5,n+.5,1/e,-1/e,-i,-t[0],-t[1]),a=!this.Zc;a&&(this.Zc=Ys(o,o));const u=this.Zc;let l;u.canvas.width!==o||u.canvas.height!==o?(u.canvas.width=o,u.canvas.height=o):a||u.clearRect(0,0,o,o),void 0!==this.ml&&(l=[1/0,1/0,-1/0,-1/0],ue(l,t),Vt(l,e*(this.ml+n),l));const c=Ev(n);let f;function p(t,e){const i=u.getImageData(0,0,o,o).data;for(let h=0,a=c.length;h<a;h++)if(i[c[h]]>0){if(!r||"Image"!==f&&"Text"!==f||r.includes(t)){const i=(c[h]-3)/4,r=n-i%o,a=n-(i/o|0),u=s(t,e,r*r+a*a);if(u)return u}u.clearRect(0,0,o,o);break}}const m=Object.keys(this.Yc).map(Number);let v,g,y,w,x;for(m.sort(d),v=m.length-1;v>=0;--v){const t=m[v].toString();for(y=this.Yc[t],g=Pv.length-1;g>=0;--g)if(f=Pv[g],w=y[f],void 0!==w&&(x=w.executeHitDetection(u,h,i,p,l),x))return x}}getClipCoords(t){const e=this.Rc;if(!e)return null;const i=e[0],n=e[1],s=e[2],r=e[3],o=[i,n,i,r,s,r,s,n];return gn(o,0,8,2,t,o),o}isEmpty(){return _(this.Yc)}execute(t,e,i,n,s,r,o){const h=Object.keys(this.Yc).map(Number);let a,u,l,c,f,p;for(h.sort(d),this.Rc&&(t.save(),this.clip(t,i)),r=r||Pv,o&&h.reverse(),a=0,u=h.length;a<u;++a){const u=h[a].toString();for(f=this.Yc[u],l=0,c=r.length;l<c;++l){p=f[r[l]],void 0!==p&&p.execute(t,e,i,n,s,o)}}this.Rc&&t.restore()}};const Cv=.5;function Fv(t,e,i,n,s,r,o){const h=Ys(t[0]*Cv,t[1]*Cv);h.imageSmoothingEnabled=!1;const a=h.canvas,u=new ja(h,Cv,s,null,o),l=i.length,c=Math.floor(16777215/l),f={};for(let t=1;t<=l;++t){const e=i[t-1],o=e.getStyleFunction()||n;if(!n)continue;let h=o(e,r);if(!h)continue;Array.isArray(h)||(h=[h]);const a="#"+("000000"+(t*c).toString(16)).slice(-6);for(let t=0,i=h.length;t<i;++t){const i=h[t],n=i.getGeometryFunction()(e);if(!n||!Te(s,n.getExtent()))continue;const r=i.clone(),o=r.getFill();o&&o.setColor(a);const u=r.getStroke();u&&(u.setColor(a),u.setLineDash(null)),r.setText(void 0);const l=i.getImage();if(l&&0!==l.getOpacity()){const t=l.getImageSize();if(!t)continue;const e=Ys(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),r.setImage(new Rc({img:i,imgSize:t,anchor:l.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:l.getOrigin(),opacity:1,size:l.getSize(),scale:l.getScale(),rotation:l.getRotation(),rotateWithView:l.getRotateWithView()}))}const c=r.getZIndex()||0;let d=f[c];d||(d={},f[c]=d,d.Polygon=[],d.Circle=[],d.LineString=[],d.Point=[]),d[n.getType().replace("Multi","")].push(n,r)}}const p=Object.keys(f).map(Number).sort(d);for(let t=0,i=p.length;t<i;++t){const i=f[p[t]];for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t+=2){u.setStyle(n[t+1]);for(let i=0,s=e.length;i<s;++i)u.setTransform(e[i]),u.drawGeometry(n[t])}}}return h.getImageData(0,0,a.width,a.height)}function Iv(t,e,i){const n=[];if(i){const s=Math.floor(Math.round(t[0])*Cv),r=Math.floor(Math.round(t[1])*Cv),o=4*(hi(s,0,i.width-1)+hi(r,0,i.height-1)*i.width),h=i.data[o],a=i.data[o+1],u=i.data[o+2]+256*(a+256*h),l=Math.floor(16777215/e.length);u&&u%l==0&&n.push(e[u/l-1])}return n}var Av=class extends Dp{constructor(t){super(t),this.Hc=this.Kc.bind(this),this.Jc,this.Qc=null,this.tf=null,this._u=-1,this.ef=NaN,this.Gu=[1/0,1/0,-1/0,-1/0],this.if=[1/0,1/0,-1/0,-1/0],this.nf,this.rf=null,this.hf=null,this.af=null,this.uf=null,this.replayGroupChanged=!0,this.declutterExecutorGroup=null,this.clipping=!0,this.lf=null,this.oh=1}renderWorlds(t,e,i){const n=e.extent,s=e.viewState,r=s.center,o=s.resolution,h=s.projection,a=s.rotation,u=h.getExtent(),l=this.getLayer().getSource(),c=e.pixelRatio,f=e.viewHints,d=!(f[jo]||f[Do]),p=this.lf,m=Math.round(e.size[0]*c),v=Math.round(e.size[1]*c),g=l.getWrapX()&&h.canWrapX(),y=g?Ee(u):null,w=g?Math.ceil((n[2]-u[2])/y)+1:1;let x=g?Math.floor((n[0]-u[0])/y):0;do{const e=this.getRenderTransform(r,o,a,c,m,v,x*y);t.execute(p,1,e,a,d,void 0,i)}while(++x<w)}cf(){if(1!==this.oh){const t=Ys(this.context.canvas.width,this.context.canvas.height,Gp);this.lf=t}else this.lf=this.context}ff(){if(1!==this.oh){const t=this.context.globalAlpha;this.context.globalAlpha=this.oh,this.context.drawImage(this.lf.canvas,0,0),this.context.globalAlpha=t,Zs(this.lf),Gp.push(this.lf.canvas),this.lf=null}}renderDeclutter(t){this.declutterExecutorGroup&&(this.cf(),this.renderWorlds(this.declutterExecutorGroup,t,t.declutterTree),this.ff())}renderFrame(t,e){const i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];Lt(this.pixelTransform,1/i,1/i),zt(this.inversePixelTransform,this.pixelTransform);const s=Dt(this.pixelTransform);this.useContainer(e,s,this.getBackground(t));const r=this.context,o=r.canvas,h=this.uf,a=this.declutterExecutorGroup;if((!h||h.isEmpty())&&(!a||a.isEmpty()))return null;const u=Math.round(t.size[0]*i),l=Math.round(t.size[1]*i);o.width!=u||o.height!=l?(o.width=u,o.height=l,o.style.transform!==s&&(o.style.transform=s)):this.containerReused||r.clearRect(0,0,u,l),this.preRender(r,t);const c=t.viewState,f=c.projection;this.oh=n.opacity,this.cf();let d=!1,p=!0;if(n.extent&&this.clipping){const e=fn(n.extent,f);p=Te(e,t.extent),d=p&&!Jt(e,t.extent),d&&this.clipUnrotated(this.lf,t,e)}return p&&this.renderWorlds(h,t),d&&this.lf.restore(),this.ff(),this.postRender(r,t),this.nf!==c.rotation&&(this.nf=c.rotation,this.Qc=null),this.container}getFeatures(t){return new Promise(function(e){if(!this.Qc&&!this.Jc){const t=[this.context.canvas.width,this.context.canvas.height];At(this.pixelTransform,t);const e=this.rf,i=this.ef,n=this.nf,s=this.hf,r=this.if,o=this.getLayer(),h=[],a=t[0]*Cv,u=t[1]*Cv;h.push(this.getRenderTransform(e,i,n,Cv,a,u,0).slice());const l=o.getSource(),c=s.getExtent();if(l.getWrapX()&&s.canWrapX()&&!Jt(c,r)){let t=r[0];const s=Ee(c);let o,l=0;for(;t<c[0];)--l,o=s*l,h.push(this.getRenderTransform(e,i,n,Cv,a,u,o).slice()),t+=s;for(l=0,t=r[2];t>c[2];)++l,o=s*l,h.push(this.getRenderTransform(e,i,n,Cv,a,u,o).slice()),t-=s}this.Qc=Fv(t,h,this.tf,o.getStyleFunction(),r,i,n)}e(Iv(t,this.tf,this.Qc))}.bind(this))}forEachFeatureAtCoordinate(t,e,n,s,r){if(!this.uf)return;const o=e.viewState.resolution,h=e.viewState.rotation,a=this.getLayer(),u={},l=function(t,e,n){const o=i(t),h=u[o];if(h){if(!0!==h&&n<h.distanceSq){if(0===n)return u[o]=!0,r.splice(r.lastIndexOf(h),1),s(t,a,e);h.geometry=e,h.distanceSq=n}}else{if(0===n)return u[o]=!0,s(t,a,e);r.push(u[o]={feature:t,layer:a,geometry:e,distanceSq:n,callback:s})}};let c;const f=[this.uf];return this.declutterExecutorGroup&&f.push(this.declutterExecutorGroup),f.some((i=>c=i.forEachFeatureAtCoordinate(t,o,h,n,l,i===this.declutterExecutorGroup&&e.declutterTree?e.declutterTree.all().map((t=>t.value)):null))),c}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.uf&&t.changed()}Kc(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const n=t.viewHints[jo],s=t.viewHints[Do],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&n||!o&&s)return this.Jc=!0,!0;this.Jc=!1;const h=t.extent,a=t.viewState,u=a.projection,l=a.resolution,c=t.pixelRatio,f=e.getRevision(),d=e.getRenderBuffer();let p=e.getRenderOrder();void 0===p&&(p=Ua);const m=a.center.slice(),v=Vt(h,d*l),y=v.slice(),w=[v.slice()],x=u.getExtent();if(i.getWrapX()&&u.canWrapX()&&!Jt(x,t.extent)){const t=Ee(x),e=Math.max(Ee(v)/2,t);v[0]=x[0]-e,v[2]=x[2]+e,Ri(m,u);const i=Re(w[0],u);i[0]<x[0]&&i[2]<x[2]?w.push([i[0]+t,i[1],i[2]+t,i[3]]):i[0]>x[0]&&i[2]>x[2]&&w.push([i[0]-t,i[1],i[2]-t,i[3]])}if(this.ready&&this.ef==l&&this._u==f&&this.af==p&&Jt(this.if,v))return g(this.Gu,y)||(this.Qc=null,this.Gu=y),this.rf=m,this.replayGroupChanged=!1,!0;this.uf=null;const b=new cv(Ba(l,c),v,l,c);let M;this.getLayer().getDeclutter()&&(M=new cv(Ba(l,c),v,l,c));const S=an();let P;if(S){for(let t=0,e=w.length;t<e;++t){const e=cn(w[t],u);i.loadFeatures(e,dn(l,u),S)}P=en(S,u)}else for(let t=0,e=w.length;t<e;++t)i.loadFeatures(w[t],l,u);const _=$a(l,c);let E=!0;const T=function(t){let i;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(i=n(t,l)),i){const e=this.renderFeature(t,_,i,b,P,M);E=E&&!e}}.bind(this),C=cn(v,u),F=i.getFeaturesInExtent(C);p&&F.sort(p);for(let t=0,e=F.length;t<e;++t)T(F[t]);this.tf=F,this.ready=E;const I=b.finish(),A=new Tv(v,l,c,i.getOverlaps(),I,e.getRenderBuffer());return M&&(this.declutterExecutorGroup=new Tv(v,l,c,i.getOverlaps(),M.finish(),e.getRenderBuffer())),this.ef=l,this._u=f,this.af=p,this.Gu=y,this.if=v,this.rf=m,this.hf=u,this.uf=A,this.Qc=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,n,s,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let h=0,a=i.length;h<a;++h)o=qa(n,t,i[h],e,this.Hc,s,r)||o;else o=qa(n,t,i,e,this.Hc,s,r);return o}};var kv=class extends Up{constructor(t){super(t),this.df=new Av(t),this.pf=t.getImageRatio(),this.mf=[1,0,0,1,0,0],this.vf=null}disposeInternal(){this.df.dispose(),super.disposeInternal()}getFeatures(t){if(!this.df)return new Promise((t=>t([])));const e=At(this.mf,At(this.vf,t.slice()));return this.df.getFeatures(e)}handleFontsChanged(){this.df.handleFontsChanged()}prepareFrame(t){const e=t.pixelRatio,i=t.viewState,n=i.resolution,s=t.viewHints,r=this.df;let o=t.extent;1!==this.pf&&(o=o.slice(0),Ie(o,this.pf));const h=Ee(o)/n,a=Me(o)/n;if(!s[jo]&&!s[Do]&&!Ce(o)){r.useContainer(null,null);const s=r.context,u=t.layerStatesArray[t.layerIndex];s.globalAlpha=u.opacity;const l=Object.assign({},u,{opacity:1}),c=Object.assign({},t,{declutterTree:new Kc(9),extent:o,size:[h,a],viewState:Object.assign({},t.viewState,{rotation:0}),layerStatesArray:[l],layerIndex:0});let f=!0;const d=new Xs(o,n,e,s.canvas,(function(t){r.prepareFrame(c)&&r.replayGroupChanged&&(r.clipping=!1,r.renderFrame(c,null)&&(r.renderDeclutter(c),f=!1),t())}));d.addEventListener(T,function(){if(d.getState()!==Ds)return;this.Ot=f?null:d;const t=d.getResolution(),n=d.getPixelRatio(),s=t*e/n;this.renderedResolution=s,this.mf=Ot(this.mf,h/2,a/2,1/s,-1/s,0,-i.center[0],-i.center[1])}.bind(this)),d.load()}return this.Ot&&(this.vf=t.pixelToCoordinateTransform.slice()),!!this.Ot}preRender(){}postRender(){}renderDeclutter(){}forEachFeatureAtCoordinate(t,e,i,n,s){return this.df?this.df.forEachFeatureAtCoordinate(t,e,i,n,s):super.forEachFeatureAtCoordinate(t,e,i,n,s)}};const Rv={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Lv={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]};var Nv=class extends Yp{constructor(t){super(t),this.Hc=this.Kc.bind(this),this.gf,this.vf=null,this.nf,this.yf=[1,0,0,1,0,0]}prepareTile(t,e,i){let n;const s=t.getState();return s!==it&&s!==nt||(this.wf(t,e,i),this.xf(t)&&(n=!0)),n}getTile(t,e,i,n){const s=n.pixelRatio,r=n.viewState,o=r.resolution,h=r.projection,a=this.getLayer(),u=a.getSource().getTile(t,e,i,s,h),l=n.viewHints,c=!(l[jo]||l[Do]);!c&&u.wantedResolution||(u.wantedResolution=o);return this.prepareTile(u,s,h)&&(c||Date.now()-n.time<8)&&"vector"!==a.getRenderMode()&&this.bf(u,n),super.getTile(t,e,i,n)}isDrawableTile(t){const e=this.getLayer();return super.isDrawableTile(t)&&("vector"===e.getRenderMode()?i(e)in t.executorGroups:t.hasContext(e))}getTileImage(t){return t.getImage(this.getLayer())}prepareFrame(t){const e=this.getLayer().getRevision();return this.gf!==e&&(this.gf=e,this.renderedTiles.length=0),super.prepareFrame(t)}wf(t,e,n){const s=this.getLayer(),r=s.getRevision(),o=s.getRenderOrder()||null,h=t.wantedResolution,a=t.getReplayState(s);if(!a.dirty&&a.renderedResolution===h&&a.renderedRevision==r&&a.renderedRenderOrder==o)return;const u=s.getSource(),l=s.getDeclutter(),c=u.getTileGrid(),f=u.getTileGridForProjection(n).getTileCoordExtent(t.wrappedTileCoord),d=u.getSourceTiles(e,n,t),p=i(s);delete t.hitDetectionImageData[p],t.executorGroups[p]=[],l&&(t.declutterExecutorGroups[p]=[]),a.dirty=!1;for(let i=0,n=d.length;i<n;++i){const n=d[i];if(n.getState()!=it)continue;const r=n.tileCoord,m=c.getTileCoordExtent(r),v=Se(f,m),g=Vt(v,s.getRenderBuffer()*h,this.tmpExtent),y=oe(m,v)?null:g,w=new cv(0,g,h,e),x=l?new cv(0,v,h,e):void 0,b=$a(h,e),M=function(t){let e;const i=t.getStyleFunction()||s.getStyleFunction();if(i&&(e=i(t,h)),e){const i=this.renderFeature(t,b,e,w,x);a.dirty=a.dirty||i}},S=n.getFeatures();o&&o!==a.renderedRenderOrder&&S.sort(o);for(let t=0,e=S.length;t<e;++t){const e=S[t];y&&!Te(y,e.getGeometry().getExtent())||M.call(this,e)}const P=w.finish(),_="vector"!==s.getRenderMode()&&l&&1===d.length?null:v,E=new Tv(_,h,e,u.getOverlaps(),P,s.getRenderBuffer());if(t.executorGroups[p].push(E),x){const i=new Tv(null,h,e,u.getOverlaps(),x.finish(),s.getRenderBuffer());t.declutterExecutorGroups[p].push(i)}}a.renderedRevision=r,a.renderedRenderOrder=o,a.renderedResolution=h}forEachFeatureAtCoordinate(t,e,n,s,r){const o=e.viewState.resolution,h=e.viewState.rotation;n=null==n?0:n;const a=this.getLayer(),u=a.getSource().getTileGridForProjection(e.viewState.projection),l=Zt([t]);Vt(l,o*n,l);const c={},f=function(t,e,n){let o=t.getId();void 0===o&&(o=i(t));const h=c[o];if(h){if(!0!==h&&n<h.distanceSq){if(0===n)return c[o]=!0,r.splice(r.lastIndexOf(h),1),s(t,a,e);h.geometry=e,h.distanceSq=n}}else{if(0===n)return c[o]=!0,s(t,a,e);r.push(c[o]={feature:t,layer:a,geometry:e,distanceSq:n,callback:s})}},d=this.renderedTiles;let p;for(let s=0,r=d.length;!p&&s<r;++s){const r=d[s];if(!Te(u.getTileCoordExtent(r.wrappedTileCoord),l))continue;const c=i(a),m=[r.executorGroups[c]],v=r.declutterExecutorGroups[c];v&&m.push(v),m.some((i=>{const s=i===v?e.declutterTree.all().map((t=>t.value)):null;for(let e=0,r=i.length;e<r;++e){const r=i[e];if(p=r.forEachFeatureAtCoordinate(t,o,h,n,f,s),p)return!0}}))}return p}getFeatures(t){return new Promise(function(e,n){const s=this.getLayer(),r=i(s),o=s.getSource(),h=this.renderedProjection,a=h.getExtent(),u=this.renderedResolution,l=o.getTileGridForProjection(h),c=At(this.vf,t.slice()),f=l.getTileCoordForCoordAndResolution(c,u);let d;for(let t=0,e=this.renderedTiles.length;t<e;++t)if(f.toString()===this.renderedTiles[t].tileCoord.toString()){if(d=this.renderedTiles[t],d.getState()===it){const t=l.getTileCoordExtent(d.tileCoord);o.getWrapX()&&h.canWrapX()&&!Jt(a,t)&&Ri(c,h);break}d=void 0}if(!d||d.loadingSourceTiles>0)return void e([]);const p=Pe(l.getTileCoordExtent(d.wrappedTileCoord)),m=[(c[0]-p[0])/u,(p[1]-c[1])/u],v=d.getSourceTiles().reduce((function(t,e){return t.concat(e.getFeatures())}),[]);let g=d.hitDetectionImageData[r];if(!g&&!this.Jc){const t=ia(l.getTileSize(l.getZForResolution(u,o.zDirection))),e=this.nf;g=Fv(t,[this.getRenderTransform(l.getTileCoordCenter(d.wrappedTileCoord),u,0,Cv,t[0]*Cv,t[1]*Cv,0)],v,s.getStyleFunction(),l.getTileCoordExtent(d.wrappedTileCoord),d.getReplayState(s).renderedResolution,e),d.hitDetectionImageData[r]=g}e(Iv(m,v,g))}.bind(this))}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.gf&&t.changed()}Kc(t){this.renderIfReadyAndVisible()}renderDeclutter(t){const e=this.context,n=e.globalAlpha;e.globalAlpha=this.getLayer().getOpacity();const s=t.viewHints,r=!(s[jo]||s[Do]),o=this.renderedTiles;for(let e=0,n=o.length;e<n;++e){const n=o[e],s=n.declutterExecutorGroups[i(this.getLayer())];if(s)for(let e=s.length-1;e>=0;--e)s[e].execute(this.context,1,this.getTileRenderTransform(n,t),t.viewState.rotation,r,void 0,t.declutterTree)}e.globalAlpha=n}getTileRenderTransform(t,e){const i=e.pixelRatio,n=e.viewState,s=n.center,r=n.resolution,o=n.rotation,h=e.size,a=Math.round(h[0]*i),u=Math.round(h[1]*i),l=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),c=t.tileCoord,f=l.getTileCoordExtent(t.wrappedTileCoord),d=l.getTileCoordExtent(c,this.tmpExtent)[0]-f[0];return Ct(Rt(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(s,r,o,i,a,u,d))}postRender(t,e){const n=e.viewHints,s=!(n[jo]||n[Do]);this.vf=e.pixelToCoordinateTransform.slice(),this.nf=e.viewState.rotation;const r=this.getLayer(),o=r.getRenderMode(),h=t.globalAlpha;t.globalAlpha=r.getOpacity();const a=Lv[o],u=e.viewState,l=u.rotation,c=r.getSource(),f=c.getTileGridForProjection(u.projection).getZForResolution(u.resolution,c.zDirection),d=this.renderedTiles,p=[],m=[];let v=!0;for(let n=d.length-1;n>=0;--n){const o=d[n];v=v&&!o.getReplayState(r).dirty;const h=o.executorGroups[i(r)].filter((t=>t.hasExecutors(a)));if(0===h.length)continue;const u=this.getTileRenderTransform(o,e),c=o.tileCoord[0];let g=!1;const y=h[0].getClipCoords(u);if(y){for(let e=0,i=p.length;e<i;++e)if(f!==c&&c<m[e]){const i=p[e];Te([y[0],y[3],y[4],y[7]],[i[0],i[3],i[4],i[7]])&&(g||(t.save(),g=!0),t.beginPath(),t.moveTo(y[0],y[1]),t.lineTo(y[2],y[3]),t.lineTo(y[4],y[5]),t.lineTo(y[6],y[7]),t.moveTo(i[6],i[7]),t.lineTo(i[4],i[5]),t.lineTo(i[2],i[3]),t.lineTo(i[0],i[1]),t.clip())}p.push(y),m.push(c)}for(let e=0,i=h.length;e<i;++e){h[e].execute(t,1,u,l,s,a)}g&&t.restore()}t.globalAlpha=h,this.ready=v,super.postRender(t,e)}renderFeature(t,e,i,n,s){if(!i)return!1;let r=!1;if(Array.isArray(i))for(let o=0,h=i.length;o<h;++o)r=qa(n,t,i[o],e,this.Hc,void 0,s)||r;else r=qa(n,t,i,e,this.Hc,void 0,s);return r}xf(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),n=e.getRevision(),s=t.wantedResolution;return i.renderedTileResolution!==s||i.renderedTileRevision!==n}bf(t,e){const n=this.getLayer(),s=t.getReplayState(n),r=n.getRevision(),o=t.executorGroups[i(n)];s.renderedTileRevision=r;const h=t.wrappedTileCoord,a=h[0],u=n.getSource();let l=e.pixelRatio;const c=e.viewState.projection,f=u.getTileGridForProjection(c),d=f.getResolution(t.tileCoord[0]),p=e.pixelRatio/t.wantedResolution*d,m=f.getResolution(a),v=t.getContext(n);l=Math.round(Math.max(l,p/l));const g=u.getTilePixelSize(a,l,c);v.canvas.width=g[0],v.canvas.height=g[1];const y=l/p;if(1!==y){const t=Tt(this.yf);Rt(t,y,y),v.setTransform.apply(v,t)}const w=f.getTileCoordExtent(h,this.tmpExtent),x=p/m,b=Tt(this.yf);Rt(b,x,-x),Nt(b,-w[0],-w[3]);for(let t=0,e=o.length;t<e;++t){o[t].execute(v,y,b,0,!0,Rv[n.getRenderMode()])}s.renderedTileResolution=t.wantedResolution}};class Ov extends _n{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){this.flatCoordinates?v(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.changed()}clone(){const t=new Ov(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ht(this.getExtent(),t,e))return n;const s=this.flatCoordinates,r=this.stride;for(let o=0,h=s.length;o<h;o+=r){const h=ui(t,e,s[o],s[o+1]);if(h<n){n=h;for(let t=0;t<r;++t)i[t]=s[o+t];i.length=r}}return n}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates?this.flatCoordinates.length/this.stride:0;return t<0||e<=t?null:new Qn(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,n=[];for(let s=0,r=t.length;s<r;s+=i){const r=new Qn(t.slice(s,s+i),e);n.push(r)}return n}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let n=0,s=e.length;n<s;n+=i){if(Qt(t,e[n],e[n+1]))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ln(this.flatCoordinates,0,t,this.stride),this.changed()}}var zv=Ov;function Gv(t,e,i,n,s,r,o){let h,a;const u=(i-e)/n;if(1===u)h=e;else if(2===u)h=e,a=s;else if(0!==u){let r=t[e],o=t[e+1],u=0;const l=[0];for(let s=e+n;s<i;s+=n){const e=t[s],i=t[s+1];u+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),l.push(u),r=e,o=i}const c=s*u,d=f(l,c);d<0?(a=(c-l[-d-2])/(l[-d-1]-l[-d-2]),h=e+(-d-2)*n):h=e+d*n}o=o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===h?NaN:void 0===a?t[h+e]:pi(t[h+e],t[h+n+e],a);return r}function jv(t,e,i,n,s,r){if(i==e)return null;let o;if(s<t[e+n-1])return r?(o=t.slice(e,e+n),o[n-1]=s,o):null;if(t[i-1]<s)return r?(o=t.slice(i-n,i),o[n-1]=s,o):null;if(s==t[e+n-1])return t.slice(e,e+n);let h=e/n,a=i/n;for(;h<a;){const e=h+a>>1;s<t[(e+1)*n-1]?a=e:h=e+1}const u=t[h*n-1];if(s==u)return t.slice((h-1)*n,(h-1)*n+n);const l=(s-u)/(t[(h+1)*n-1]-u);o=[];for(let e=0;e<n-1;++e)o.push(pi(t[(h-1)*n+e],t[h*n+e],l));return o.push(s),o}function Dv(t,e,i,n,s,r,o){if(o)return jv(t,e,i[i.length-1],n,s,r);let h;if(s<t[n-1])return r?(h=t.slice(0,n),h[n-1]=s,h):null;if(t[t.length-1]<s)return r?(h=t.slice(t.length-n),h[n-1]=s,h):null;for(let r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(s<t[e+n-1])return null;if(s<=t[o-1])return jv(t,e,o,n,s,!1);e=o}}return null}class Uv extends _n{constructor(t,e){super(),this.Mf=null,this.Sf=-1,this.wt=-1,this.xt=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){this.flatCoordinates?v(this.flatCoordinates,t):this.flatCoordinates=t.slice(),this.changed()}clone(){const t=new Uv(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ht(this.getExtent(),t,e)?n:(this.xt!=this.getRevision()&&(this.wt=Math.sqrt(Tn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.xt=this.getRevision()),In(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.wt,!1,t,e,i,n))}forEachSegment(t){return os(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,jv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return qn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return Gv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return dv(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.Sf!=this.getRevision()&&(this.Mf=this.getCoordinateAt(.5,this.Mf),this.Sf=this.getRevision()),this.Mf}getSimplifiedGeometryInternal(t){const e=[];return e.length=zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Uv(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return hs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Ln(this.flatCoordinates,0,t,this.stride),this.changed()}}var $v=Uv;class Bv extends _n{constructor(t,e,i){if(super(),this.bt=[],this.wt=-1,this.xt=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.bt=i;else{let e=this.getLayout();const i=t,n=[],s=[];for(let t=0,r=i.length;t<r;++t){const r=i[t];0===t&&(e=r.getLayout()),v(n,r.getFlatCoordinates()),s.push(n.length)}this.setFlatCoordinates(e,n),this.bt=s}}appendLineString(t){this.flatCoordinates?v(this.flatCoordinates,t.getFlatCoordinates().slice()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.bt.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Bv(this.flatCoordinates.slice(),this.layout,this.bt.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,n){return n<Ht(this.getExtent(),t,e)?n:(this.xt!=this.getRevision()&&(this.wt=Math.sqrt(Cn(this.flatCoordinates,0,this.bt,this.stride,0)),this.xt=this.getRevision()),An(this.flatCoordinates,0,this.bt,this.stride,this.wt,!1,t,e,i,n))}getCoordinateAtM(t,e,i){return"XYM"!=this.layout&&"XYZM"!=this.layout||0===this.flatCoordinates.length?null:(e=void 0!==e&&e,i=void 0!==i&&i,Dv(this.flatCoordinates,0,this.bt,this.stride,t,e,i))}getCoordinates(){return Xn(this.flatCoordinates,0,this.bt,this.stride)}getEnds(){return this.bt}getLineString(t){return t<0||this.bt.length<=t?null:new $v(this.flatCoordinates.slice(0===t?0:this.bt[t-1],this.bt[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.bt,i=this.layout,n=[];let s=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],h=new $v(t.slice(s,o),i);n.push(h),s=o}return n}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const n=this.bt,s=this.stride;for(let r=0,o=n.length;r<o;++r){const o=n[r];v(t,Gv(e,i,o,s,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Gn(this.flatCoordinates,0,this.bt,this.stride,t,e,0,i),new Bv(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return as(this.flatCoordinates,0,this.bt,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=Nn(this.flatCoordinates,0,t,this.stride,this.bt);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var qv=Bv;function Xv(t,e,i,n){const s=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,h=i.length;o<h;++o){const h=i[o];r=re(t,e,h[0],n),s.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=h[h.length-1]}return s}class Yv extends _n{constructor(t,e,i){if(super(),this.Pf=[],this._f=-1,this.Ef=null,this.wt=-1,this.xt=-1,this.Pt=-1,this._t=null,!i&&!Array.isArray(t[0])){let n=this.getLayout();const s=t,r=[],o=[];for(let t=0,e=s.length;t<e;++t){const e=s[t];0===t&&(n=e.getLayout());const i=r.length,h=e.getEnds();for(let t=0,e=h.length;t<e;++t)h[t]+=i;v(r,e.getFlatCoordinates()),o.push(h)}e=n,t=r,i=o}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.Pf=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;v(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,n=e.length;t<n;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.Pf.push();this.Pf.push(e),this.changed()}clone(){const t=this.Pf.length,e=new Array(t);for(let i=0;i<t;++i)e[i]=this.Pf[i].slice();const i=new Yv(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,n){return n<Ht(this.getExtent(),t,e)?n:(this.xt!=this.getRevision()&&(this.wt=Math.sqrt(Fn(this.flatCoordinates,0,this.Pf,this.stride,0)),this.xt=this.getRevision()),kn(this.getOrientedFlatCoordinates(),0,this.Pf,this.stride,this.wt,!0,t,e,i,n))}containsXY(t,e){return ns(this.getOrientedFlatCoordinates(),0,this.Pf,this.stride,t,e)}getArea(){return Wn(this.getOrientedFlatCoordinates(),0,this.Pf,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),gs(e,0,this.Pf,this.stride,t)):e=this.flatCoordinates,Yn(e,0,this.Pf,this.stride)}getEndss(){return this.Pf}getFlatInteriorPoints(){if(this._f!=this.getRevision()){const t=Xv(this.flatCoordinates,0,this.Pf,this.stride);this.Ef=rs(this.getOrientedFlatCoordinates(),0,this.Pf,this.stride,t),this._f=this.getRevision()}return this.Ef}getInteriorPoints(){return new zv(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.Pt!=this.getRevision()){const t=this.flatCoordinates;ms(t,0,this.Pf,this.stride)?this._t=t:(this._t=t.slice(),this._t.length=gs(this._t,0,this.Pf,this.stride)),this.Pt=this.getRevision()}return this._t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=Bn(this.flatCoordinates,0,this.Pf,this.stride,Math.sqrt(t),e,0,i),new Yv(e,"XY",i)}getPolygon(t){if(t<0||this.Pf.length<=t)return null;let e;if(0===t)e=0;else{const i=this.Pf[t-1];e=i[i.length-1]}const i=this.Pf[t].slice(),n=i[i.length-1];if(0!==e)for(let t=0,n=i.length;t<n;++t)i[t]-=e;return new xs(this.flatCoordinates.slice(e,n),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.Pf,n=[];let s=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),h=o[o.length-1];if(0!==s)for(let t=0,e=o.length;t<e;++t)o[t]-=s;const a=new xs(e.slice(s,h),t,o);n.push(a),s=h}return n}getType(){return"MultiPolygon"}intersectsExtent(t){return cs(this.getOrientedFlatCoordinates(),0,this.Pf,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=On(this.flatCoordinates,0,t,this.stride,this.Pf);if(0===i.length)this.flatCoordinates.length=0;else{const t=i[i.length-1];this.flatCoordinates.length=0===t.length?0:t[t.length-1]}this.changed()}}var Zv=Yv;const Vv=[1,0,0,1,0,0];class Wv{constructor(t,e,i,n,s){this.styleFunction,this.ot,this.W=s,this.Tf=t,this.Cf=e,this.Ef=null,this.Ff=null,this.bt=i,this.If=n}get(t){return this.If[t]}getExtent(){return this.ot||(this.ot="Point"===this.Tf?se(this.Cf):re(this.Cf,0,this.Cf.length,2)),this.ot}getFlatInteriorPoint(){if(!this.Ef){const t=ye(this.getExtent());this.Ef=ss(this.Cf,0,this.bt,2,t,0)}return this.Ef}getFlatInteriorPoints(){if(!this.Ef){const t=Xv(this.Cf,0,this.bt,2);this.Ef=rs(this.Cf,0,this.bt,2,t)}return this.Ef}getFlatMidpoint(){return this.Ff||(this.Ff=Gv(this.Cf,0,this.Cf.length,2,.5)),this.Ff}getFlatMidpoints(){if(!this.Ff){this.Ff=[];const t=this.Cf;let e=0;const i=this.bt;for(let n=0,s=i.length;n<s;++n){const s=i[n],r=Gv(t,e,s,2,.5);v(this.Ff,r),e=s}}return this.Ff}getId(){return this.W}getOrientedFlatCoordinates(){return this.Cf}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.If}getStride(){return 2}getStyleFunction(){return this.styleFunction}getType(){return this.Tf}transform(t){const e=(t=Yi(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=Me(i)/Me(e);Ot(Vv,i[0],i[3],t,-t,0,0,0),gn(this.Cf,0,this.Cf.length,2,Vv,this.Cf)}}getEnds(){return this.bt}}function Hv(t){const e=t.getType();switch(e){case"Point":return new Qn(t.getFlatCoordinates());case"MultiPoint":return new zv(t.getFlatCoordinates(),"XY");case"LineString":return new $v(t.getFlatCoordinates(),"XY");case"MultiLineString":return new qv(t.getFlatCoordinates(),"XY",t.getEnds());case"Polygon":const i=t.getFlatCoordinates(),n=t.getEnds(),s=ys(i,n);return s.length>1?new Zv(i,"XY",s):new xs(i,"XY",n);default:throw new Error("Invalid geometry type:"+e)}}Wv.prototype.getEndss=Wv.prototype.getEnds,Wv.prototype.getFlatCoordinates=Wv.prototype.getOrientedFlatCoordinates;var Kv=Wv;var Jv=class extends xm{constructor(t){super(t)}createRenderer(){return new Av(this)}};function Qv(t,e,i){const n=[];let s=t(0),r=t(1),o=e(s),h=e(r);const a=[r,s],u=[h,o],l=[1,0],c={};let f,d,p,m,v,g,y=1e5;for(;--y>0&&l.length>0;)p=l.pop(),s=a.pop(),o=u.pop(),g=p.toString(),g in c||(n.push(o[0],o[1]),c[g]=!0),m=l.pop(),r=a.pop(),h=u.pop(),v=(p+m)/2,f=t(v),d=e(f),ai(d[0],d[1],o[0],o[1],h[0],h[1])<i?(n.push(h[0],h[1]),g=m.toString(),c[g]=!0):(l.push(m,v,v,p),u.push(h,d,d,o),a.push(r,f,f,s));return n}function tg(t,e,i,n,s){return Qv((function(n){return[t,e+(i-e)*n]}),nn(Yi("EPSG:4326"),n),s)}function eg(t,e,i,n,s){return Qv((function(n){return[e+(i-e)*n,t]}),nn(Yi("EPSG:4326"),n),s)}const ig=new Nc({color:"rgba(0,0,0,0.2)"}),ng=[90,45,30,20,10,5,2,1,.5,20/60,10/60,5/60,2/60,1/60,30/3600,20/3600,10/3600,5/3600,2/3600,1/3600];var sg=class extends Jv{constructor(t){t=t||{};const e=Object.assign({updateWhileAnimating:!0,updateWhileInteracting:!0,renderBuffer:0},t);delete e.maxLines,delete e.strokeStyle,delete e.targetSize,delete e.showLabels,delete e.lonLabelFormatter,delete e.latLabelFormatter,delete e.lonLabelPosition,delete e.latLabelPosition,delete e.lonLabelStyle,delete e.latLabelStyle,delete e.intervals,super(e),this.fi=null,this.Af=1/0,this.kf=1/0,this.Rf=-1/0,this.Lf=-1/0,this.Nf=1/0,this.Of=1/0,this.zf=-1/0,this.Gf=-1/0,this.jf=void 0!==t.targetSize?t.targetSize:100,this.Df=void 0!==t.maxLines?t.maxLines:100,this.Uf=[],this.$f=[],this.Bf=void 0!==t.strokeStyle?t.strokeStyle:ig,this.qf=void 0,this.Xf=void 0,this.Yf=null,this.Zf=null,this.Vf=null,this.Wf=null,this.Hf=null,this.Kf=null,this.Jf=null,t.showLabels&&(this.Qf=null==t.lonLabelFormatter?Pi.bind(this,"EW"):t.lonLabelFormatter,this.td=null==t.latLabelFormatter?Pi.bind(this,"NS"):t.latLabelFormatter,this.ed=null==t.lonLabelPosition?0:t.lonLabelPosition,this.sd=null==t.latLabelPosition?1:t.latLabelPosition,this.rd=new $c({text:void 0!==t.lonLabelStyle?t.lonLabelStyle.clone():new qc({font:"12px Calibri,sans-serif",textBaseline:"bottom",fill:new Tc({color:"rgba(0,0,0,1)"}),stroke:new Nc({color:"rgba(255,255,255,1)",width:3})})}),this.od=function(t){const e=t.get("graticule_label");return this.rd.getText().setText(e),this.rd}.bind(this),this.hd=new $c({text:void 0!==t.latLabelStyle?t.latLabelStyle.clone():new qc({font:"12px Calibri,sans-serif",textAlign:"right",fill:new Tc({color:"rgba(0,0,0,1)"}),stroke:new Nc({color:"rgba(255,255,255,1)",width:3})})}),this.ad=function(t){const e=t.get("graticule_label");return this.hd.getText().setText(e),this.hd}.bind(this),this.Kf=[],this.Jf=[],this.addEventListener(Tr,this.ud.bind(this))),this.ld=void 0!==t.intervals?t.intervals:ng,this.setSource(new Sf({loader:this.loaderFunction.bind(this),strategy:this.strategyFunction.bind(this),features:new Q,overlaps:!1,useSpatialIndex:!1,wrapX:t.wrapX})),this.fd=[],this.dd=new $c({stroke:this.Bf}),this.md=null,this.Gu=null,this.ef=null,this.setRenderOrder(null)}strategyFunction(t,e){let i=t.slice();return this.fi&&this.getSource().getWrapX()&&Re(i,this.fi),this.md&&(he(this.md,i,e)?i=this.md.slice():this.getSource().removeLoadedExtent(this.md)),[i]}loaderFunction(t,e,i){this.md=t;const n=this.getSource(),s=Se(this.getExtent()||[-1/0,-1/0,1/0,1/0],t);if(this.Gu&&oe(this.Gu,s)&&this.ef===e)return;if(this.Gu=s,this.ef=e,Ce(s))return;const r=ye(s),o=e*e/4;(!this.fi||!tn(this.fi,i))&&this.vd(i),this.gd(s,r,e,o);let h,a=this.Uf.length+this.$f.length;for(this.Kf&&(a+=this.Uf.length),this.Jf&&(a+=this.$f.length);a>this.fd.length;)h=new pt,this.fd.push(h);const u=n.getFeaturesCollection();u.clear();let l,c,f=0;for(l=0,c=this.Uf.length;l<c;++l)h=this.fd[f++],h.setGeometry(this.Uf[l]),h.setStyle(this.dd),u.push(h);for(l=0,c=this.$f.length;l<c;++l)h=this.fd[f++],h.setGeometry(this.$f[l]),h.setStyle(this.dd),u.push(h)}yd(t,e,i,n,s,r){const o=this.wd(t,e,i,n,r);if(Te(o.getExtent(),s)){if(this.Kf){const e=this.Qf(t);r in this.Kf?this.Kf[r].text=e:this.Kf[r]={geom:new Qn([]),text:e}}this.Uf[r++]=o}return r}xd(t,e,i,n,s,r){const o=this.bd(t,e,i,n,r);if(Te(o.getExtent(),s)){if(this.Jf){const e=this.td(t);r in this.Jf?this.Jf[r].text=e:this.Jf[r]={geom:new Qn([]),text:e}}this.$f[r++]=o}return r}ud(t){const e=t.frameState.viewState.rotation,i=t.frameState.viewState.resolution,n=t.frameState.size,s=t.frameState.extent,r=ye(s);let o=s;if(e){const t=n[0]*i,e=n[1]*i;o=[r[0]-t/2,r[1]-e/2,r[0]+t/2,r[1]+e/2]}let h=0,a=0,u=this.sd<.5;const l=this.fi.getExtent(),c=Ee(l);if(this.getSource().getWrapX()&&this.fi.canWrapX()&&!Jt(l,s)){h=Math.floor((s[0]-l[0])/c),a=Math.ceil((s[2]-l[2])/c);u=u!==Math.abs(e)>Math.PI/2}const f=Ya(t);for(let t=h;t<=a;++t){let i,n,l,d,p=this.Uf.length+this.$f.length;if(this.Kf)for(n=0,l=this.Kf.length;n<l;++n){const h=this.Uf[n];if(e||0!==t){const i=h.clone();i.translate(t*c,0),i.rotate(-e,r),d=this.Md(i,o,n),d.rotate(e,r)}else d=this.Md(h,s,n);i=this.fd[p++],i.setGeometry(d),i.set("graticule_label",this.Kf[n].text),f.drawFeature(i,this.od(i))}if(this.Jf&&(t===h&&u||t===a&&!u))for(n=0,l=this.$f.length;n<l;++n){const h=this.$f[n];if(e||0!==t){const i=h.clone();i.translate(t*c,0),i.rotate(-e,r),d=this.Sd(i,o,n),d.rotate(e,r)}else d=this.Sd(h,s,n);i=this.fd[p++],i.setGeometry(d),i.set("graticule_label",this.Jf[n].text),f.drawFeature(i,this.ad(i))}}}gd(t,e,i,n){const s=this.Pd(i);if(-1==s)return this.Uf.length=0,this.$f.length=0,this.Kf&&(this.Kf.length=0),void(this.Jf&&(this.Jf.length=0));let r=!1;const o=this.fi.getExtent(),h=Ee(o);this.getSource().getWrapX()&&this.fi.canWrapX()&&!Jt(o,t)&&(Ee(t)>=h?(t[0]=o[0],t[2]=o[2]):r=!0);const a=[hi(e[0],this.zf,this.Nf),hi(e[1],this.Gf,this.Of)],u=this.Xf(a);isNaN(u[1])&&(u[1]=Math.abs(this.Af)>=Math.abs(this.Rf)?this.Af:this.Rf);let l=hi(u[0],this.Lf,this.kf),c=hi(u[1],this.Rf,this.Af);const f=this.Df;let d,p,m,v,g=t;r||(g=[hi(t[0],this.zf,this.Nf),hi(t[1],this.Gf,this.Of),hi(t[2],this.zf,this.Nf),hi(t[3],this.Gf,this.Of)]);const y=ke(g,this.Xf,void 0,8);let w=y[3],x=y[2],b=y[1],M=y[0];if(r||(Kt(g,this.Zf)&&(M=this.Lf,b=this.Rf),Kt(g,this.Vf)&&(x=this.kf,b=this.Rf),Kt(g,this.Wf)&&(M=this.Lf,w=this.Af),Kt(g,this.Hf)&&(x=this.kf,w=this.Af),w=hi(w,c,this.Af),x=hi(x,l,this.kf),b=hi(b,this.Rf,c),M=hi(M,this.Lf,l)),l=Math.floor(l/s)*s,v=hi(l,this.Lf,this.kf),p=this.yd(v,b,w,n,t,0),d=0,r)for(;(v-=s)>=M&&d++<f;)p=this.yd(v,b,w,n,t,p);else for(;v!=this.Lf&&d++<f;)v=Math.max(v-s,this.Lf),p=this.yd(v,b,w,n,t,p);if(v=hi(l,this.Lf,this.kf),d=0,r)for(;(v+=s)<=x&&d++<f;)p=this.yd(v,b,w,n,t,p);else for(;v!=this.kf&&d++<f;)v=Math.min(v+s,this.kf),p=this.yd(v,b,w,n,t,p);for(this.Uf.length=p,this.Kf&&(this.Kf.length=p),c=Math.floor(c/s)*s,m=hi(c,this.Rf,this.Af),p=this.xd(m,M,x,n,t,0),d=0;m!=this.Rf&&d++<f;)m=Math.max(m-s,this.Rf),p=this.xd(m,M,x,n,t,p);for(m=hi(c,this.Rf,this.Af),d=0;m!=this.Af&&d++<f;)m=Math.min(m+s,this.Af),p=this.xd(m,M,x,n,t,p);this.$f.length=p,this.Jf&&(this.Jf.length=p)}Pd(t){const e=this.Yf[0],i=this.Yf[1];let n=-1;const s=Math.pow(this.jf*t,2),r=[],o=[];for(let t=0,h=this.ld.length;t<h;++t){const h=hi(this.ld[t]/2,0,90),a=hi(i,-90+h,90-h);r[0]=e-h,r[1]=a-h,o[0]=e+h,o[1]=a+h,this.qf(r,r),this.qf(o,o);if(Math.pow(o[0]-r[0],2)+Math.pow(o[1]-r[1],2)<=s)break;n=this.ld[t]}return n}wd(t,e,i,n,s){const r=tg(t,e,i,this.fi,n);let o=this.Uf[s];return o?(o.setFlatCoordinates("XY",r),o.changed()):(o=new $v(r,"XY"),this.Uf[s]=o),o}Md(t,e,i){const n=t.getFlatCoordinates();let s=1,r=n.length-1;n[s]>n[r]&&(s=r,r=1);const o=Math.max(e[1],n[s]),h=Math.min(e[3],n[r]),a=hi(e[1]+Math.abs(e[1]-e[3])*this.ed,o,h),u=[n[s-1]+(n[r-1]-n[s-1])*(a-n[s])/(n[r]-n[s]),a],l=this.Kf[i].geom;return l.setCoordinates(u),l}getMeridians(){return this.Uf}bd(t,e,i,n,s){const r=eg(t,e,i,this.fi,n);let o=this.$f[s];return o?(o.setFlatCoordinates("XY",r),o.changed()):o=new $v(r,"XY"),o}Sd(t,e,i){const n=t.getFlatCoordinates();let s=0,r=n.length-2;n[s]>n[r]&&(s=r,r=0);const o=Math.max(e[0],n[s]),h=Math.min(e[2],n[r]),a=hi(e[0]+Math.abs(e[0]-e[2])*this.sd,o,h),u=[a,n[s+1]+(n[r+1]-n[s+1])*(a-n[s])/(n[r]-n[s])],l=this.Jf[i].geom;return l.setCoordinates(u),l}getParallels(){return this.$f}vd(t){const e=Yi("EPSG:4326"),i=t.getWorldExtent();this.Af=i[3],this.kf=i[2],this.Rf=i[1],this.Lf=i[0];const n=nn(t,e);if(this.Lf<this.kf)this.Xf=n;else{const t=this.Lf+this.kf/2;this.kf+=360,this.Xf=function(e,i,s){const r=n(e,i,s=s||2);for(let e=0,i=r.length;e<i;e+=s)r[e]<t&&(r[e]+=360);return r}}this.qf=nn(e,t);const s=ke([this.Lf,this.Rf,this.kf,this.Af],this.qf,void 0,8);this.zf=s[0],this.Nf=s[2],this.Gf=s[1],this.Of=s[3],this.Zf=this.qf([this.Lf,this.Rf]),this.Vf=this.qf([this.kf,this.Rf]),this.Wf=this.qf([this.Lf,this.Af]),this.Hf=this.qf([this.kf,this.Af]),this.Yf=this.Xf(ye(t.getExtent())),isNaN(this.Yf[1])&&(this.Yf[1]=Math.abs(this.Af)>=Math.abs(this.Rf)?this.Af:this.Rf),this.fi=t}};const rg="blur",og="gradient",hg="radius",ag=["#00f","#0ff","#0f0","#ff0","#f00"];var ug=class extends xm{constructor(t){t=t||{};const e=Object.assign({},t);delete e.gradient,delete e.radius,delete e.blur,delete e.weight,super(e),this._d=null,this.addChangeListener(og,this.Ed),this.setGradient(t.gradient?t.gradient:ag),this.setBlur(void 0!==t.blur?t.blur:15),this.setRadius(void 0!==t.radius?t.radius:8);const i=t.weight?t.weight:"weight";this.Td="string"==typeof i?function(t){return t.get(i)}:i,this.setRenderOrder(null)}getBlur(){return this.get(rg)}getGradient(){return this.get(og)}getRadius(){return this.get(hg)}Ed(){this._d=function(t){const e=1,i=256,n=Ys(e,i),s=n.createLinearGradient(0,0,e,i),r=1/(t.length-1);for(let e=0,i=t.length;e<i;++e)s.addColorStop(e*r,t[e]);return n.fillStyle=s,n.fillRect(0,0,e,i),n.canvas}(this.getGradient())}setBlur(t){this.set(rg,t)}setGradient(t){this.set(og,t)}setRadius(t){this.set(hg,t)}createRenderer(){return new Am(this,{className:this.getClassName(),attributes:[{name:"weight",callback:function(t){const e=this.Td(t);return void 0!==e?hi(e,0,1):1}.bind(this)}],vertexShader:"\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_weight = a_weight;\n        }",fragmentShader:"\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          gl_FragColor = vec4(alpha, alpha, alpha, alpha);\n        }",hitVertexShader:"\n        precision mediump float;\n        uniform mat4 u_projectionMatrix;\n        uniform mat4 u_offsetScaleMatrix;\n        uniform float u_size;\n        attribute vec2 a_position;\n        attribute float a_index;\n        attribute float a_weight;\n        attribute vec4 a_hitColor;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          mat4 offsetMatrix = u_offsetScaleMatrix;\n          float offsetX = a_index == 0.0 || a_index == 3.0 ? -u_size / 2.0 : u_size / 2.0;\n          float offsetY = a_index == 0.0 || a_index == 1.0 ? -u_size / 2.0 : u_size / 2.0;\n          vec4 offsets = offsetMatrix * vec4(offsetX, offsetY, 0.0, 0.0);\n          gl_Position = u_projectionMatrix * vec4(a_position, 0.0, 1.0) + offsets;\n          float u = a_index == 0.0 || a_index == 3.0 ? 0.0 : 1.0;\n          float v = a_index == 0.0 || a_index == 1.0 ? 0.0 : 1.0;\n          v_texCoord = vec2(u, v);\n          v_hitColor = a_hitColor;\n          v_weight = a_weight;\n        }",hitFragmentShader:"\n        precision mediump float;\n        uniform float u_blurSlope;\n\n        varying vec2 v_texCoord;\n        varying float v_weight;\n        varying vec4 v_hitColor;\n\n        void main(void) {\n          vec2 texCoord = v_texCoord * 2.0 - vec2(1.0, 1.0);\n          float sqRadius = texCoord.x * texCoord.x + texCoord.y * texCoord.y;\n          float value = (1.0 - sqrt(sqRadius)) * u_blurSlope;\n          float alpha = smoothstep(0.0, 1.0, value) * v_weight;\n          if (alpha < 0.05) {\n            discard;\n          }\n\n          gl_FragColor = v_hitColor;\n        }",uniforms:{u_size:function(){return 2*(this.get(hg)+this.get(rg))}.bind(this),u_blurSlope:function(){return this.get(hg)/Math.max(1,this.get(rg))}.bind(this)},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:function(){return this._d}.bind(this),u_opacity:function(){return this.getOpacity()}.bind(this)}}]})}renderDeclutter(){}};var lg=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Yi(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Yi(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection},t)}getType(){return t()}readFeature(e,i){return t()}readFeatures(e,i){return t()}readGeometry(e,i){return t()}readProjection(e){return t()}writeFeature(e,i){return t()}writeFeatures(e,i){return t()}writeGeometry(e,i){return t()}};function cg(t,e,i){const n=i?Yi(i.featureProjection):null,s=i?Yi(i.dataProjection):null;let r;if(r=n&&s&&!tn(n,s)?(e?t.clone():t).transform(e?n:s,e?s:n):t,e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),n=function(t){for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e)/e;return t};r===t&&(r=t.clone()),r.applyTransform(n)}return r}function fg(t,e){const i=e?Yi(e.featureProjection):null,n=e?Yi(e.dataProjection):null;return i&&n&&!tn(i,n)?rn(t,n,i):t}var dg=n(614);function pg(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},n=i.readVarint()+i.pos;i.readFields(mg,t,n),t.length=t.features.length,t.length&&(e[t.name]=t)}}function mg(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let n=null;const s=i.readVarint()+i.pos;for(;i.pos<s;)n=1===(t=i.readVarint()>>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 vg(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],n=e.layer.values[i.readVarint()];e.properties[t]=n}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function gg(t,e,i){t.pos=e.features[i];const n=t.readVarint()+t.pos,s={layer:e,type:0,properties:{}};return t.readFields(vg,s,n),s}var yg=class extends lg{constructor(t){super(),t=t||{},this.dataProjection=new Ge({code:"",units:"tile-pixels"}),this.Cd=t.featureClass?t.featureClass:Kv,this.H=t.geometryName,this.Fd=t.layerName?t.layerName:"layer",this.qu=t.layers?t.layers:null,this.Id=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}Ad(t,e,i,n){t.pos=e.geometry;const s=t.readVarint()+t.pos;let r=1,o=0,h=0,a=0,u=0,l=0;for(;t.pos<s;){if(!o){const e=t.readVarint();r=7&e,o=e>>3}o--,1===r||2===r?(h+=t.readSVarint(),a+=t.readSVarint(),1===r&&u>l&&(n.push(u),l=u),i.push(h,a),u+=2):7===r?u>l&&(i.push(i[l],i[l+1]),u+=2):ct(!1,59)}u>l&&(n.push(u),l=u)}kd(t,e,i){const n=e.type;if(0===n)return null;let s;const r=e.properties;let o;this.Id?(o=r[this.Id],delete r[this.Id]):o=e.id,r[this.Fd]=e.layer.name;const h=[],a=[];this.Ad(t,e,h,a);const u=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}(n,a.length);if(this.Cd===Kv)s=new this.Cd(u,h,a,r,o),s.transform(i.dataProjection);else{let t;if("Polygon"==u){const e=ys(h,a);t=e.length>1?new Zv(h,"XY",e):new xs(h,"XY",a)}else t="Point"===u?new Qn(h,"XY"):"LineString"===u?new $v(h,"XY"):"MultiPoint"===u?new zv(h,"XY"):"MultiLineString"===u?new qv(h,"XY",a):null;s=new(0,this.Cd),this.H&&s.setGeometryName(this.H);const e=cg(t,!1,i);s.setGeometry(e),void 0!==o&&s.setId(o),s.setProperties(r,!0)}return s}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.qu,n=Yi((e=this.adaptOptions(e)).dataProjection);n.setWorldExtent(e.extent),e.dataProjection=n;const s=new dg(t),r=s.readFields(pg,{}),o=[];for(const t in r){if(i&&!i.includes(t))continue;const h=r[t],a=h?[0,0,h.extent,h.extent]:null;n.setExtent(a);for(let t=0,i=h.length;t<i;++t){const i=gg(s,h,t),n=this.kd(s,i,e);null!==n&&o.push(n)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.qu=t}};var wg=class extends xm{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un;const i=t.renderMode||"hybrid";ct("hybrid"==i||"vector"==i,28),this.Rd=i,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Nv(this)}getFeatures(t){return super.getFeatures(t)}getRenderMode(){return this.Rd}getPreload(){return this.get(Bp)}getUseInterimTilesOnError(){return this.get(qp)}setPreload(t){this.set(Bp,t)}setUseInterimTilesOnError(t){this.set(qp,t)}};class xg extends Mn{constructor(t){super(),this.Ld=t||null,this.Nd=[],this.Od()}zd(){this.Nd.forEach(B),this.Nd.length=0}Od(){if(this.Ld)for(let t=0,e=this.Ld.length;t<e;++t)this.Nd.push(U(this.Ld[t],T,this.changed,this))}clone(){const t=new xg(null);return t.setGeometries(this.Ld),t.applyProperties(this),t}closestPointXY(t,e,i,n){if(n<Ht(this.getExtent(),t,e))return n;const s=this.Ld;for(let r=0,o=s.length;r<o;++r)n=s[r].closestPointXY(t,e,i,n);return n}containsXY(t,e){const i=this.Ld;for(let n=0,s=i.length;n<s;++n)if(i[n].containsXY(t,e))return!0;return!1}computeExtent(t){ne(t);const e=this.Ld;for(let i=0,n=e.length;i<n;++i)ae(t,e[i].getExtent());return t}getGeometries(){return bg(this.Ld)}getGeometriesArray(){return this.Ld}getGeometriesArrayRecursive(){let t=[];const e=this.Ld;for(let i=0,n=e.length;i<n;++i)e[i].getType()===this.getType()?t=t.concat(e[i].getGeometriesArrayRecursive()):t.push(e[i]);return t}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=[],i=this.Ld;let n=!1;for(let s=0,r=i.length;s<r;++s){const r=i[s],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(n=!0)}if(n){const t=new xg(null);return t.setGeometriesArray(e),t}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.Ld;for(let i=0,n=e.length;i<n;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.Ld.length}rotate(t,e){const i=this.Ld;for(let n=0,s=i.length;n<s;++n)i[n].rotate(t,e);this.changed()}scale(t,e,i){i||(i=ye(this.getExtent()));const n=this.Ld;for(let s=0,r=n.length;s<r;++s)n[s].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(bg(t))}setGeometriesArray(t){this.zd(),this.Ld=t,this.Od(),this.changed()}applyTransform(t){const e=this.Ld;for(let i=0,n=e.length;i<n;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.Ld;for(let n=0,s=i.length;n<s;++n)i[n].translate(t,e);this.changed()}disposeInternal(){this.zd(),super.disposeInternal()}}function bg(t){const e=[];for(let i=0,n=t.length;i<n;++i)e.push(t[i].clone());return e}var Mg=xg;function Sg(t){if("string"==typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}var Pg=class extends lg{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Sg(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Sg(t),this.getReadOptions(t,e))}readFeatureFromObject(e,i){return t()}readFeaturesFromObject(e,i){return t()}readGeometry(t,e){return this.readGeometryFromObject(Sg(t),this.getReadOptions(t,e))}readGeometryFromObject(e,i){return t()}readProjection(t){return this.readProjectionFromObject(Sg(t))}readProjectionFromObject(e){return t()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(e,i){return t()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(e,i){return t()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(e,i){return t()}};function _g(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){return new Qn(t.coordinates)}(t);break;case"LineString":i=function(t){return new $v(t.coordinates)}(t);break;case"Polygon":i=function(t){return new xs(t.coordinates)}(t);break;case"MultiPoint":i=function(t){return new zv(t.coordinates)}(t);break;case"MultiLineString":i=function(t){return new qv(t.coordinates)}(t);break;case"MultiPolygon":i=function(t){return new Zv(t.coordinates)}(t);break;case"GeometryCollection":i=function(t,e){const i=t.geometries.map((function(t){return _g(t,e)}));return new Mg(i)}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return cg(i,!1,e)}function Eg(t,e){const i=(t=cg(t,!0,e)).getType();let n;switch(i){case"Point":n=function(t,e){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":n=function(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":n=function(t,e){let i;e&&(i=e.rightHanded);return{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":n=function(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":n=function(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":n=function(t,e){let i;e&&(i=e.rightHanded);return{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":n=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map((function(t){return Eg(t,e)}))}}(t,e);break;case"Circle":n={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return n}var Tg,Cg=class extends Pg{constructor(t){t=t||{},super(),this.dataProjection=Yi(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Yi(t.featureProjection)),this.H=t.geometryName,this.Gd=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const n=_g(i.geometry,e),s=new pt;return this.H?s.setGeometryName(this.H):this.Gd&&"geometry_name"in i!==void 0&&s.setGeometryName(i.geometry_name),s.setGeometry(n),"id"in i&&s.setId(i.id),i.properties&&s.setProperties(i.properties,!0),s}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const n=t.features;for(let t=0,s=n.length;t<s;++t)i.push(this.readFeatureFromObject(n[t],e))}else i=[this.readFeatureFromObject(t,e)];return i}readGeometryFromObject(t,e){return _g(t,e)}readProjectionFromObject(t){const e=t.crs;let i;return e?"name"==e.type?i=Yi(e.properties.name):"EPSG"===e.type?i=Yi("EPSG:"+e.properties.code):ct(!1,36):i=this.dataProjection,i}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},n=t.getId();if(void 0!==n&&(i.id=n),!t.hasProperties())return i;const s=t.getProperties(),r=t.getGeometry();return r&&(i.geometry=Eg(r,e),delete s[t.getGeometryName()]),_(s)||(i.properties=s),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,s=t.length;n<s;++n)i.push(this.writeFeatureObject(t[n],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return Eg(t,this.adaptOptions(e))}},Fg={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ig(t){return(t=Math.round(t))<0?0:t>255?255:t}function Ag(t){return t<0?0:t>1?1:t}function kg(t){return"%"===t[t.length-1]?Ig(parseFloat(t)/100*255):Ig(parseInt(t))}function Rg(t){return"%"===t[t.length-1]?Ag(parseFloat(t)/100):Ag(parseFloat(t))}function Lg(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{Tg={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in Fg)return Fg[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("("),s=i.indexOf(")");if(-1!==n&&s+1===i.length){var r=i.substr(0,n),o=i.substr(n+1,s-(n+1)).split(","),h=1;switch(r){case"rgba":if(4!==o.length)return null;h=Rg(o.pop());case"rgb":return 3!==o.length?null:[kg(o[0]),kg(o[1]),kg(o[2]),h];case"hsla":if(4!==o.length)return null;h=Rg(o.pop());case"hsl":if(3!==o.length)return null;var a=(parseFloat(o[0])%360+360)%360/360,u=Rg(o[1]),l=Rg(o[2]),c=l<=.5?l*(u+1):l+u-l*u,f=2*l-c;return[Ig(255*Lg(f,c,a+1/3)),Ig(255*Lg(f,c,a)),Ig(255*Lg(f,c,a-1/3)),h];default:return null}}return null}}catch(t){}var Ng=function(t,e,i,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=i,this.a=n};function Og(t){return"object"==typeof t?["literal",t]:t}function zg(t,e){var i=t.stops;if(!i)return function(t,e){var 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];var n=["color"===e.type?"to-color":e.type,i,Og(t.default)];return"array"===e.type&&n.splice(1,0,e.value,e.length||null),n}(t,e);var n=i&&"object"==typeof i[0][0],s=n||void 0!==t.property,r=n||!s;return i=i.map((function(t){return!s&&e.tokens&&"string"==typeof t[1]?[t[0],qg(t[1])]:[t[0],Og(t[1])]})),n?function(t,e,i){for(var n={},s={},r=[],o=0;o<i.length;o++){var h=i[o],a=h[0].zoom;void 0===n[a]&&(n[a]={zoom:a,type:t.type,property:t.property,default:t.default},s[a]=[],r.push(a)),s[a].push([h[0].value,h[1]])}if("exponential"===Bg({},e)){for(var u=[Gg(t),["linear"],["zoom"]],l=0,c=r;l<c.length;l+=1){var f=c[l];$g(u,f,Dg(n[f],e,s[f]),!1)}return u}for(var d=["step",["zoom"]],p=0,m=r;p<m.length;p+=1){var v=m[p];$g(d,v,Dg(n[v],e,s[v]),!0)}return Ug(d),d}(t,e,i):r?function(t,e,i,n){void 0===n&&(n=["zoom"]);var s,r=Bg(t,e),o=!1;if("interval"===r)s=["step",n],o=!0;else{if("exponential"!==r)throw new Error('Unknown zoom function type "'+r+'"');var h=void 0!==t.base?t.base:1;s=[Gg(t),1===h?["linear"]:["exponential",h],n]}for(var a=0,u=i;a<u.length;a+=1){var l=u[a];$g(s,l[0],l[1],o)}return Ug(s),s}(t,e,i):Dg(t,e,i)}function Gg(t){switch(t.colorSpace){case"hcl":return"interpolate-hcl";case"lab":return"interpolate-lab";default:return"interpolate"}}function jg(t,e){var i,n,s=Og((i=t.default,n=e.default,void 0!==i?i:void 0!==n?n:void 0));return void 0===s&&"resolvedImage"===e.type?"":s}function Dg(t,e,i){var n=Bg(t,e),s=["get",t.property];if("categorical"===n&&"boolean"==typeof i[0][0]){for(var r=["case"],o=0,h=i;o<h.length;o+=1){var a=h[o];r.push(["==",s,a[0]],a[1])}return r.push(jg(t,e)),r}if("categorical"===n){for(var u=["match",s],l=0,c=i;l<c.length;l+=1){var f=c[l];$g(u,f[0],f[1],!1)}return u.push(jg(t,e)),u}if("interval"===n){for(var d=["step",["number",s]],p=0,m=i;p<m.length;p+=1){var v=m[p];$g(d,v[0],v[1],!0)}return Ug(d),void 0===t.default?d:["case",["==",["typeof",s],"number"],d,Og(t.default)]}if("exponential"===n){for(var g=void 0!==t.base?t.base:1,y=[Gg(t),1===g?["linear"]:["exponential",g],["number",s]],w=0,x=i;w<x.length;w+=1){var b=x[w];$g(y,b[0],b[1],!1)}return void 0===t.default?y:["case",["==",["typeof",s],"number"],y,Og(t.default)]}throw new Error("Unknown property function type "+n)}function Ug(t){"step"===t[0]&&3===t.length&&(t.push(0),t.push(t[3]))}function $g(t,e,i,n){t.length>3&&e===t[t.length-2]||(n&&2===t.length||t.push(e),t.push(i))}function Bg(t,e){return t.type?t.type:e.expression.interpolated?"exponential":"interval"}function qg(t){for(var e=["concat"],i=/{([^{}]+)}/g,n=0,s=i.exec(t);null!==s;s=i.exec(t)){var r=t.slice(n,i.lastIndex-s[0].length);n=i.lastIndex,r.length>0&&e.push(r),e.push(["get",s[1]])}if(1===e.length)return t;if(n<t.length)e.push(t.slice(n));else if(2===e.length)return["to-string",e[1]];return e}Ng.parse=function(t){if(t){if(t instanceof Ng)return t;if("string"==typeof t){var e=Tg(t);if(e)return new Ng(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},Ng.prototype.toString=function(){var t=this.toArray(),e=t[0],i=t[1],n=t[2],s=t[3];return"rgba("+Math.round(e)+","+Math.round(i)+","+Math.round(n)+","+s+")"},Ng.prototype.toArray=function(){var t=this,e=t.r,i=t.g,n=t.b,s=t.a;return 0===s?[0,0,0,0]:[255*e/s,255*i/s,255*n/s,s]},Ng.prototype.toArray01=function(){var t=this,e=t.r,i=t.g,n=t.b,s=t.a;return 0===s?[0,0,0,0]:[e/s,i/s,n/s,s]},Ng.prototype.toArray01PremultipliedAlpha=function(){var t=this;return[t.r,t.g,t.b,t.a]},Ng.black=new Ng(0,0,0,1),Ng.white=new Ng(1,1,1,1),Ng.transparent=new Ng(0,0,0,0),Ng.red=new Ng(1,0,0,1),Ng.blue=new Ng(0,0,1,1);var Xg=function(t){function e(e,i){t.call(this,i),this.message=i,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Yg=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var i=0,n=e;i<n.length;i+=1){var s=n[i],r=s[0],o=s[1];this.bindings[r]=o}};Yg.prototype.concat=function(t){return new Yg(this,t)},Yg.prototype.get=function(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(t+" not found in scope.")},Yg.prototype.has=function(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)};var Zg={kind:"null"},Vg={kind:"number"},Wg={kind:"string"},Hg={kind:"boolean"},Kg={kind:"color"},Jg={kind:"object"},Qg={kind:"value"},ty={kind:"collator"},ey={kind:"formatted"},iy={kind:"resolvedImage"};function ny(t,e){return{kind:"array",itemType:t,N:e}}function sy(t){if("array"===t.kind){var e=sy(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var ry=[Zg,Vg,Wg,Hg,Kg,ey,Jg,ny(Qg),iy];function oy(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!oy(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(var i=0,n=ry;i<n.length;i+=1){if(!oy(n[i],e))return null}}return"Expected "+sy(t)+" but found "+sy(e)+" instead."}function hy(t,e){return e.some((function(e){return e.kind===t.kind}))}function ay(t,e){return e.some((function(e){return"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t}))}var uy=function(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"})};uy.prototype.compare=function(t,e){return this.collator.compare(t,e)},uy.prototype.resolvedLocale=function(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale};var ly=function(t,e,i,n,s){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=i,this.fontStack=n,this.textColor=s},cy=function(t){this.sections=t};cy.fromString=function(t){return new cy([new ly(t,null,null,null,null)])},cy.prototype.isEmpty=function(){return 0===this.sections.length||!this.sections.some((function(t){return 0!==t.text.length||t.image&&0!==t.image.name.length}))},cy.factory=function(t){return t instanceof cy?t:cy.fromString(t)},cy.prototype.toString=function(){return 0===this.sections.length?"":this.sections.map((function(t){return t.text})).join("")},cy.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var n=i[e];if(n.image)t.push(["image",n.image.name]);else{t.push(n.text);var s={};n.fontStack&&(s["text-font"]=["literal",n.fontStack.split(",")]),n.scale&&(s["font-scale"]=n.scale),n.textColor&&(s["text-color"]=["rgba"].concat(n.textColor.toArray())),t.push(s)}}return t};var fy=function(t){this.name=t.name,this.available=t.available};function dy(t,e,i,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof i&&i>=0&&i<=255?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.":"Invalid rgba value ["+("number"==typeof n?[t,e,i,n]:[t,e,i]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."}function py(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 Ng)return!0;if(t instanceof uy)return!0;if(t instanceof cy)return!0;if(t instanceof fy)return!0;if(Array.isArray(t)){for(var e=0,i=t;e<i.length;e+=1){if(!py(i[e]))return!1}return!0}if("object"==typeof t){for(var n in t)if(!py(t[n]))return!1;return!0}return!1}function my(t){if(null===t)return Zg;if("string"==typeof t)return Wg;if("boolean"==typeof t)return Hg;if("number"==typeof t)return Vg;if(t instanceof Ng)return Kg;if(t instanceof uy)return ty;if(t instanceof cy)return ey;if(t instanceof fy)return iy;if(Array.isArray(t)){for(var e,i=t.length,n=0,s=t;n<s.length;n+=1){var r=my(s[n]);if(e){if(e===r)continue;e=Qg;break}e=r}return ny(e||Qg,i)}return Jg}function vy(t){var e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Ng||t instanceof cy||t instanceof fy?t.toString():JSON.stringify(t)}fy.prototype.toString=function(){return this.name},fy.fromString=function(t){return t?new fy({name:t,available:!1}):null},fy.prototype.serialize=function(){return["image",this.name]};var gy=function(t,e){this.type=t,this.value=e};gy.parse=function(t,e){if(2!==t.length)return e.error("'literal' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(!py(t[1]))return e.error("invalid value");var i=t[1],n=my(i),s=e.expectedType;return"array"!==n.kind||0!==n.N||!s||"array"!==s.kind||"number"==typeof s.N&&0!==s.N||(n=s),new gy(n,i)},gy.prototype.evaluate=function(){return this.value},gy.prototype.eachChild=function(){},gy.prototype.outputDefined=function(){return!0},gy.prototype.serialize=function(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Ng?["rgba"].concat(this.value.toArray()):this.value instanceof cy?this.value.serialize():this.value};var yy=function(t){this.name="ExpressionEvaluationError",this.message=t};yy.prototype.toJSON=function(){return this.message};var wy={string:Wg,number:Vg,boolean:Hg,object:Jg},xy=function(t,e){this.type=t,this.args=e};xy.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i,n=1,s=t[0];if("array"===s){var r,o;if(t.length>2){var h=t[1];if("string"!=typeof h||!(h in wy)||"object"===h)return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=wy[h],n++}else r=Qg;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);o=t[2],n++}i=ny(r,o)}else i=wy[s];for(var a=[];n<t.length;n++){var u=e.parse(t[n],n,Qg);if(!u)return null;a.push(u)}return new xy(i,a)},xy.prototype.evaluate=function(t){for(var e=0;e<this.args.length;e++){var i=this.args[e].evaluate(t);if(!oy(this.type,my(i)))return i;if(e===this.args.length-1)throw new yy("Expected value to be of type "+sy(this.type)+", but found "+sy(my(i))+" instead.")}return null},xy.prototype.eachChild=function(t){this.args.forEach(t)},xy.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},xy.prototype.serialize=function(){var t=this.type,e=[t.kind];if("array"===t.kind){var i=t.itemType;if("string"===i.kind||"number"===i.kind||"boolean"===i.kind){e.push(i.kind);var n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((function(t){return t.serialize()})))};var by=function(t){this.type=ey,this.sections=t};by.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return e.error("First argument must be an image or text section.");for(var n=[],s=!1,r=1;r<=t.length-1;++r){var o=t[r];if(s&&"object"==typeof o&&!Array.isArray(o)){s=!1;var h=null;if(o["font-scale"]&&!(h=e.parse(o["font-scale"],1,Vg)))return null;var a=null;if(o["text-font"]&&!(a=e.parse(o["text-font"],1,ny(Wg))))return null;var u=null;if(o["text-color"]&&!(u=e.parse(o["text-color"],1,Kg)))return null;var l=n[n.length-1];l.scale=h,l.font=a,l.textColor=u}else{var c=e.parse(t[r],1,Qg);if(!c)return null;var f=c.type.kind;if("string"!==f&&"value"!==f&&"null"!==f&&"resolvedImage"!==f)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");s=!0,n.push({content:c,scale:null,font:null,textColor:null})}}return new by(n)},by.prototype.evaluate=function(t){return new cy(this.sections.map((function(e){var i=e.content.evaluate(t);return my(i)===iy?new ly("",i,null,null,null):new ly(vy(i),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))},by.prototype.eachChild=function(t){for(var e=0,i=this.sections;e<i.length;e+=1){var n=i[e];t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor)}},by.prototype.outputDefined=function(){return!1},by.prototype.serialize=function(){for(var t=["format"],e=0,i=this.sections;e<i.length;e+=1){var n=i[e];t.push(n.content.serialize());var s={};n.scale&&(s["font-scale"]=n.scale.serialize()),n.font&&(s["text-font"]=n.font.serialize()),n.textColor&&(s["text-color"]=n.textColor.serialize()),t.push(s)}return t};var My=function(t){this.type=iy,this.input=t};My.parse=function(t,e){if(2!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Wg);return i?new My(i):e.error("No image name provided.")},My.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=fy.fromString(e);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(e)>-1),i},My.prototype.eachChild=function(t){t(this.input)},My.prototype.outputDefined=function(){return!1},My.prototype.serialize=function(){return["image",this.input.serialize()]};var Sy={"to-boolean":Hg,"to-color":Kg,"to-number":Vg,"to-string":Wg},Py=function(t,e){this.type=t,this.args=e};Py.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");var i=t[0];if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return e.error("Expected one argument.");for(var n=Sy[i],s=[],r=1;r<t.length;r++){var o=e.parse(t[r],r,Qg);if(!o)return null;s.push(o)}return new Py(n,s)},Py.prototype.evaluate=function(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){for(var e,i,n=0,s=this.args;n<s.length;n+=1){if(i=null,(e=s[n].evaluate(t))instanceof Ng)return e;if("string"==typeof e){var r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&!(i=e.length<3||e.length>4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":dy(e[0],e[1],e[2],e[3])))return new Ng(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new yy(i||"Could not parse color from value '"+("string"==typeof e?e:String(JSON.stringify(e)))+"'")}if("number"===this.type.kind){for(var o=null,h=0,a=this.args;h<a.length;h+=1){if(null===(o=a[h].evaluate(t)))return 0;var u=Number(o);if(!isNaN(u))return u}throw new yy("Could not convert "+JSON.stringify(o)+" to number.")}return"formatted"===this.type.kind?cy.fromString(vy(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?fy.fromString(vy(this.args[0].evaluate(t))):vy(this.args[0].evaluate(t))},Py.prototype.eachChild=function(t){this.args.forEach(t)},Py.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},Py.prototype.serialize=function(){if("formatted"===this.type.kind)return new by([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new My(this.args[0]).serialize();var t=["to-"+this.type.kind];return this.eachChild((function(e){t.push(e.serialize())})),t};var _y=["Unknown","Point","LineString","Polygon"],Ey=function(){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};Ey.prototype.id=function(){return this.feature&&"id"in this.feature&&this.feature.id?this.feature.id:null},Ey.prototype.geometryType=function(){return this.feature?"number"==typeof this.feature.type?_y[this.feature.type]:this.feature.type:null},Ey.prototype.geometry=function(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null},Ey.prototype.canonicalID=function(){return this.canonical},Ey.prototype.properties=function(){return this.feature&&this.feature.properties||{}},Ey.prototype.distanceFromCenter=function(){if(this.featureTileCoord&&this.featureDistanceData){var t=this.featureDistanceData.center,e=this.featureDistanceData.scale,i=this.featureTileCoord,n=i.x,s=i.y,r=n*e-t[0],o=s*e-t[1];return this.featureDistanceData.bearing[0]*r+this.featureDistanceData.bearing[1]*o}return 0},Ey.prototype.parseColor=function(t){var e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=Ng.parse(t)),e};var Ty=function(t,e,i,n){this.name=t,this.type=e,this._evaluate=i,this.args=n};Ty.prototype.evaluate=function(t){return this._evaluate(t,this.args)},Ty.prototype.eachChild=function(t){this.args.forEach(t)},Ty.prototype.outputDefined=function(){return!1},Ty.prototype.serialize=function(){return[this.name].concat(this.args.map((function(t){return t.serialize()})))},Ty.parse=function(t,e){var i,n=t[0],s=Ty.definitions[n];if(!s)return e.error('Unknown expression "'+n+'". If you wanted a literal array, use ["literal", [...]].',0);for(var r=Array.isArray(s)?s[0]:s.type,o=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,h=o.filter((function(e){var i=e[0];return!Array.isArray(i)||i.length===t.length-1})),a=null,u=0,l=h;u<l.length;u+=1){var c=l[u],f=c[0],d=c[1];a=new Ky(e.registry,e.path,null,e.scope);for(var p=[],m=!1,v=1;v<t.length;v++){var g=t[v],y=Array.isArray(f)?f[v-1]:f.type,w=a.parse(g,1+p.length,y);if(!w){m=!0;break}p.push(w)}if(!m)if(Array.isArray(f)&&f.length!==p.length)a.error("Expected "+f.length+" arguments, but found "+p.length+" instead.");else{for(var x=0;x<p.length;x++){var b=Array.isArray(f)?f[x]:f.type,M=p[x];a.concat(x+1).checkSubtype(b,M.type)}if(0===a.errors.length)return new Ty(n,r,d,p)}}if(1===h.length)(i=e.errors).push.apply(i,a.errors);else{for(var S=(h.length?h:o).map((function(t){var e,i=t[0];return e=i,Array.isArray(e)?"("+e.map(sy).join(", ")+")":"("+sy(e.type)+"...)"})).join(" | "),P=[],_=1;_<t.length;_++){var E=e.parse(t[_],1+P.length);if(!E)return null;P.push(sy(E.type))}e.error("Expected arguments of type "+S+", but found ("+P.join(", ")+") instead.")}return null},Ty.register=function(t,e){for(var i in Ty.definitions=e,e)t[i]=Ty};var Cy=function(t,e,i){this.type=ty,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=e};Cy.parse=function(t,e){if(2!==t.length)return e.error("Expected one argument.");var i=t[1];if("object"!=typeof i||Array.isArray(i))return e.error("Collator options argument must be an object.");var n=e.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,Hg);if(!n)return null;var s=e.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,Hg);if(!s)return null;var r=null;return i.locale&&!(r=e.parse(i.locale,1,Wg))?null:new Cy(n,s,r)},Cy.prototype.evaluate=function(t){return new uy(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)},Cy.prototype.eachChild=function(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)},Cy.prototype.outputDefined=function(){return!1},Cy.prototype.serialize=function(){var t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]};var Fy=8192;function Iy(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Ay(t,e){return!(t[0]<=e[0])&&(!(t[2]>=e[2])&&(!(t[1]<=e[1])&&!(t[3]>=e[3])))}function ky(t,e){var i,n=(180+t[0])/360,s=(i=t[1],(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360),r=Math.pow(2,e.z);return[Math.round(n*r*Fy),Math.round(s*r*Fy)]}function Ry(t,e,i){var n=t[0]-e[0],s=t[1]-e[1],r=t[0]-i[0],o=t[1]-i[1];return n*o-r*s==0&&n*r<=0&&s*o<=0}function Ly(t,e,i){return e[1]>t[1]!=i[1]>t[1]&&t[0]<(i[0]-e[0])*(t[1]-e[1])/(i[1]-e[1])+e[0]}function Ny(t,e){for(var i=!1,n=0,s=e.length;n<s;n++)for(var r=e[n],o=0,h=r.length;o<h-1;o++){if(Ry(t,r[o],r[o+1]))return!1;Ly(t,r[o],r[o+1])&&(i=!i)}return i}function Oy(t,e){for(var i=0;i<e.length;i++)if(Ny(t,e[i]))return!0;return!1}function zy(t,e,i,n){var s=t[0]-i[0],r=t[1]-i[1],o=e[0]-i[0],h=e[1]-i[1],a=n[0]-i[0],u=n[1]-i[1],l=s*u-a*r,c=o*u-a*h;return l>0&&c<0||l<0&&c>0}function Gy(t,e,i){for(var n=0,s=i;n<s.length;n+=1)for(var r=s[n],o=0;o<r.length-1;++o)if(h=t,a=e,u=r[o],l=r[o+1],c=void 0,f=void 0,d=void 0,p=void 0,d=[a[0]-h[0],a[1]-h[1]],p=[l[0]-u[0],l[1]-u[1]],0!=(c=p)[0]*(f=d)[1]-c[1]*f[0]&&zy(h,a,u,l)&&zy(u,l,h,a))return!0;var h,a,u,l,c,f,d,p;return!1}function jy(t,e){for(var i=0;i<t.length;++i)if(!Ny(t[i],e))return!1;for(var n=0;n<t.length-1;++n)if(Gy(t[n],t[n+1],e))return!1;return!0}function Dy(t,e){for(var i=0;i<e.length;i++)if(jy(t,e[i]))return!0;return!1}function Uy(t,e,i){for(var n=[],s=0;s<t.length;s++){for(var r=[],o=0;o<t[s].length;o++){var h=ky(t[s][o],i);Iy(e,h),r.push(h)}n.push(r)}return n}function $y(t,e,i){for(var n=[],s=0;s<t.length;s++){var r=Uy(t[s],e,i);n.push(r)}return n}function By(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){var s=.5*n,r=t[0]-i[0]>s?-n:i[0]-t[0]>s?n:0;0===r&&(r=t[0]-i[2]>s?-n:i[2]-t[0]>s?n:0),t[0]+=r}Iy(e,t)}function qy(t,e,i,n){var s=Math.pow(2,n.z)*Fy,r=[n.x*Fy,n.y*Fy],o=[];if(!t)return o;for(var h=0,a=t;h<a.length;h+=1)for(var u=0,l=a[h];u<l.length;u+=1){var c=l[u],f=[c.x+r[0],c.y+r[1]];By(f,e,i,s),o.push(f)}return o}function Xy(t,e,i,n){var s=Math.pow(2,n.z)*Fy,r=[n.x*Fy,n.y*Fy],o=[];if(!t)return o;for(var h=0,a=t;h<a.length;h+=1){for(var u=[],l=0,c=a[h];l<c.length;l+=1){var f=c[l],d=[f.x+r[0],f.y+r[1]];Iy(e,d),u.push(d)}o.push(u)}if(e[2]-e[0]<=s/2){!function(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}(e);for(var p=0,m=o;p<m.length;p+=1)for(var v=0,g=m[p];v<g.length;v+=1){By(g[v],e,i,s)}}return o}var Yy=function(t,e){this.type=Hg,this.geojson=t,this.geometries=e};function Zy(t){if(t instanceof Ty){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof Yy)return!1;var e=!0;return t.eachChild((function(t){e&&!Zy(t)&&(e=!1)})),e}function Vy(t){if(t instanceof Ty&&"feature-state"===t.name)return!1;var e=!0;return t.eachChild((function(t){e&&!Vy(t)&&(e=!1)})),e}function Wy(t,e){if(t instanceof Ty&&e.indexOf(t.name)>=0)return!1;var i=!0;return t.eachChild((function(t){i&&!Wy(t,e)&&(i=!1)})),i}Yy.parse=function(t,e){if(2!==t.length)return e.error("'within' expression requires exactly one argument, but found "+(t.length-1)+" instead.");if(py(t[1])){var i=t[1];if("FeatureCollection"===i.type)for(var n=0;n<i.features.length;++n){var s=i.features[n].geometry.type;if("Polygon"===s||"MultiPolygon"===s)return new Yy(i,i.features[n].geometry)}else if("Feature"===i.type){var r=i.geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Yy(i,i.geometry)}else if("Polygon"===i.type||"MultiPolygon"===i.type)return new Yy(i,i)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")},Yy.prototype.evaluate=function(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=t.canonicalID();if(!s)return!1;if("Polygon"===e.type){var r=Uy(e.coordinates,n,s),o=qy(t.geometry(),i,n,s);if(!Ay(i,n))return!1;for(var h=0,a=o;h<a.length;h+=1)if(!Ny(a[h],r))return!1}if("MultiPolygon"===e.type){var u=$y(e.coordinates,n,s),l=qy(t.geometry(),i,n,s);if(!Ay(i,n))return!1;for(var c=0,f=l;c<f.length;c+=1)if(!Oy(f[c],u))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){var i=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],s=t.canonicalID();if(!s)return!1;if("Polygon"===e.type){var r=Uy(e.coordinates,n,s),o=Xy(t.geometry(),i,n,s);if(!Ay(i,n))return!1;for(var h=0,a=o;h<a.length;h+=1)if(!jy(a[h],r))return!1}if("MultiPolygon"===e.type){var u=$y(e.coordinates,n,s),l=Xy(t.geometry(),i,n,s);if(!Ay(i,n))return!1;for(var c=0,f=l;c<f.length;c+=1)if(!Dy(f[c],u))return!1}return!0}(t,this.geometries)}return!1},Yy.prototype.eachChild=function(){},Yy.prototype.outputDefined=function(){return!0},Yy.prototype.serialize=function(){return["within",this.geojson]};var Hy=function(t,e){this.type=e.type,this.name=t,this.boundExpression=e};Hy.parse=function(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");var i=t[1];return e.scope.has(i)?new Hy(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)},Hy.prototype.evaluate=function(t){return this.boundExpression.evaluate(t)},Hy.prototype.eachChild=function(){},Hy.prototype.outputDefined=function(){return!1},Hy.prototype.serialize=function(){return["var",this.name]};var Ky=function(t,e,i,n,s){void 0===e&&(e=[]),void 0===n&&(n=new Yg),void 0===s&&(s=[]),this.registry=t,this.path=e,this.key=e.map((function(t){return"["+t+"]"})).join(""),this.scope=n,this.errors=s,this.expectedType=i};function Jy(t){if(t instanceof Hy)return Jy(t.boundExpression);if(t instanceof Ty&&"error"===t.name)return!1;if(t instanceof Cy)return!1;if(t instanceof Yy)return!1;var e=t instanceof Py||t instanceof xy,i=!0;return t.eachChild((function(t){i=e?i&&Jy(t):i&&t instanceof gy})),!!i&&(Zy(t)&&Wy(t,["zoom","heatmap-density","line-progress","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center"]))}function Qy(t,e){for(var i,n,s=t.length-1,r=0,o=s,h=0;r<=o;)if(i=t[h=Math.floor((r+o)/2)],n=t[h+1],i<=e){if(h===s||e<n)return h;r=h+1}else{if(!(i>e))throw new yy("Input is not a number.");o=h-1}return 0}Ky.prototype.parse=function(t,e,i,n,s){return void 0===s&&(s={}),e?this.concat(e,i,n)._parse(t,s):this._parse(t,s)},Ky.prototype._parse=function(t,e){function i(t,e,i){return"assert"===i?new xy(e,[t]):"coerce"===i?new Py(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var n=t[0];if("string"!=typeof n)return this.error("Expression name must be a string, but found "+typeof n+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var s=this.registry[n];if(s){var r=s.parse(t,this);if(!r)return null;if(this.expectedType){var o=this.expectedType,h=r.type;if("string"!==o.kind&&"number"!==o.kind&&"boolean"!==o.kind&&"object"!==o.kind&&"array"!==o.kind||"value"!==h.kind)if("color"!==o.kind&&"formatted"!==o.kind&&"resolvedImage"!==o.kind||"value"!==h.kind&&"string"!==h.kind){if(this.checkSubtype(o,h))return null}else r=i(r,o,e.typeAnnotation||"coerce");else r=i(r,o,e.typeAnnotation||"assert")}if(!(r instanceof gy)&&"resolvedImage"!==r.type.kind&&Jy(r)){var a=new Ey;try{r=new gy(r.type,r.evaluate(a))}catch(t){return this.error(t.message),null}}return r}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.")},Ky.prototype.concat=function(t,e,i){var n="number"==typeof t?this.path.concat(t):this.path,s=i?this.scope.concat(i):this.scope;return new Ky(this.registry,n,e||null,s,this.errors)},Ky.prototype.error=function(t){for(var e=[],i=arguments.length-1;i-- >0;)e[i]=arguments[i+1];var n=""+this.key+e.map((function(t){return"["+t+"]"})).join("");this.errors.push(new Xg(n,t))},Ky.prototype.checkSubtype=function(t,e){var i=oy(t,e);return i&&this.error(i),i};var tw=function(t,e,i){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,s=i;n<s.length;n+=1){var r=s[n],o=r[0],h=r[1];this.labels.push(o),this.outputs.push(h)}};tw.parse=function(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.");var i=e.parse(t[1],1,Vg);if(!i)return null;var n=[],s=null;e.expectedType&&"value"!==e.expectedType.kind&&(s=e.expectedType);for(var r=1;r<t.length;r+=2){var o=1===r?-1/0:t[r],h=t[r+1],a=r,u=r+1;if("number"!=typeof o)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n[n.length-1][0]>=o)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);var l=e.parse(h,u,s);if(!l)return null;s=s||l.type,n.push([o,l])}return new tw(s,i,n)},tw.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var s=e.length;return n>=e[s-1]?i[s-1].evaluate(t):i[Qy(e,n)].evaluate(t)},tw.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1){t(i[e])}},tw.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},tw.prototype.serialize=function(){for(var t=["step",this.input.serialize()],e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t};var ew=iw;function iw(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}function nw(t,e,i){return t*(1-i)+e*i}iw.prototype.sampleCurveX=function(t){return((this.ax*t+this.bx)*t+this.cx)*t},iw.prototype.sampleCurveY=function(t){return((this.ay*t+this.by)*t+this.cy)*t},iw.prototype.sampleCurveDerivativeX=function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},iw.prototype.solveCurveX=function(t,e){var i,n,s,r,o;for(void 0===e&&(e=1e-6),s=t,o=0;o<8;o++){if(r=this.sampleCurveX(s)-t,Math.abs(r)<e)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=r/h}if((s=t)<(i=0))return i;if(s>(n=1))return n;for(;i<n;){if(r=this.sampleCurveX(s),Math.abs(r-t)<e)return s;t>r?i=s:n=s,s=.5*(n-i)+i}return s},iw.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))};var sw=Object.freeze({__proto__:null,number:nw,color:function(t,e,i){return new Ng(nw(t.r,e.r,i),nw(t.g,e.g,i),nw(t.b,e.b,i),nw(t.a,e.a,i))},array:function(t,e,i){return t.map((function(t,n){return nw(t,e[n],i)}))}}),rw=.95047,ow=1.08883,hw=4/29,aw=6/29,uw=3*aw*aw,lw=Math.PI/180,cw=180/Math.PI;function fw(t){return t>.008856451679035631?Math.pow(t,1/3):t/uw+hw}function dw(t){return t>aw?t*t*t:uw*(t-hw)}function pw(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function mw(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vw(t){var e=mw(t.r),i=mw(t.g),n=mw(t.b),s=fw((.4124564*e+.3575761*i+.1804375*n)/rw),r=fw((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*r-16,a:500*(s-r),b:200*(r-fw((.0193339*e+.119192*i+.9503041*n)/ow)),alpha:t.a}}function gw(t){var 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=1*dw(e),i=rw*dw(i),n=ow*dw(n),new Ng(pw(3.2404542*i-1.5371385*e-.4985314*n),pw(-.969266*i+1.8760108*e+.041556*n),pw(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function yw(t,e,i){var n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}var ww={forward:vw,reverse:gw,interpolate:function(t,e,i){return{l:nw(t.l,e.l,i),a:nw(t.a,e.a,i),b:nw(t.b,e.b,i),alpha:nw(t.alpha,e.alpha,i)}}},xw={forward:function(t){var e=vw(t),i=e.l,n=e.a,s=e.b,r=Math.atan2(s,n)*cw;return{h:r<0?r+360:r,c:Math.sqrt(n*n+s*s),l:i,alpha:t.a}},reverse:function(t){var e=t.h*lw,i=t.c;return gw({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:yw(t.h,e.h,i),c:nw(t.c,e.c,i),l:nw(t.l,e.l,i),alpha:nw(t.alpha,e.alpha,i)}}},bw=function(t,e,i,n,s){this.type=t,this.operator=e,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(var r=0,o=s;r<o.length;r+=1){var h=o[r],a=h[0],u=h[1];this.labels.push(a),this.outputs.push(u)}};function Mw(t,e,i,n){var s=n-i,r=t-i;return 0===s?0:1===e?r/s:(Math.pow(e,r)-1)/(Math.pow(e,s)-1)}bw.interpolationFactor=function(t,e,i,n){var s=0;if("exponential"===t.name)s=Mw(e,t.base,i,n);else if("linear"===t.name)s=Mw(e,1,i,n);else if("cubic-bezier"===t.name){var r=t.controlPoints;s=new ew(r[0],r[1],r[2],r[3]).solve(Mw(e,1,i,n))}return s},bw.parse=function(t,e){var i=t[0],n=t[1],s=t[2],r=t.slice(3);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]){var o=n[1];if("number"!=typeof o)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:o}}else{if("cubic-bezier"!==n[0])return e.error("Unknown interpolation type "+String(n[0]),1,0);var h=n.slice(1);if(4!==h.length||h.some((function(t){return"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:h}}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(!(s=e.parse(s,2,Vg)))return null;var a=[],u=null;"interpolate-hcl"===i||"interpolate-lab"===i?u=Kg:e.expectedType&&"value"!==e.expectedType.kind&&(u=e.expectedType);for(var l=0;l<r.length;l+=2){var c=r[l],f=r[l+1],d=l+3,p=l+4;if("number"!=typeof c)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(a.length&&a[a.length-1][0]>=c)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);var m=e.parse(f,p,u);if(!m)return null;u=u||m.type,a.push([c,m])}return"number"===u.kind||"color"===u.kind||"array"===u.kind&&"number"===u.itemType.kind&&"number"==typeof u.N?new bw(u,i,n,s,a):e.error("Type "+sy(u)+" is not interpolatable.")},bw.prototype.evaluate=function(t){var e=this.labels,i=this.outputs;if(1===e.length)return i[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return i[0].evaluate(t);var s=e.length;if(n>=e[s-1])return i[s-1].evaluate(t);var r=Qy(e,n),o=e[r],h=e[r+1],a=bw.interpolationFactor(this.interpolation,n,o,h),u=i[r].evaluate(t),l=i[r+1].evaluate(t);return"interpolate"===this.operator?sw[this.type.kind.toLowerCase()](u,l,a):"interpolate-hcl"===this.operator?xw.reverse(xw.interpolate(xw.forward(u),xw.forward(l),a)):ww.reverse(ww.interpolate(ww.forward(u),ww.forward(l),a))},bw.prototype.eachChild=function(t){t(this.input);for(var e=0,i=this.outputs;e<i.length;e+=1){t(i[e])}},bw.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))},bw.prototype.serialize=function(){var 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);for(var e=[this.operator,t,this.input.serialize()],i=0;i<this.labels.length;i++)e.push(this.labels[i],this.outputs[i].serialize());return e};var Sw=function(t,e){this.type=t,this.args=e};Sw.parse=function(t,e){if(t.length<2)return e.error("Expectected at least one argument.");var i=null,n=e.expectedType;n&&"value"!==n.kind&&(i=n);for(var s=[],r=0,o=t.slice(1);r<o.length;r+=1){var h=o[r],a=e.parse(h,1+s.length,i,void 0,{typeAnnotation:"omit"});if(!a)return null;i=i||a.type,s.push(a)}var u=n&&s.some((function(t){return oy(n,t.type)}));return new Sw(u?Qg:i,s)},Sw.prototype.evaluate=function(t){for(var e,i=null,n=0,s=0,r=this.args;s<r.length;s+=1){if(n++,(i=r[s].evaluate(t))&&i instanceof fy&&!i.available&&(e||(e=i),i=null,n===this.args.length))return e;if(null!==i)break}return i},Sw.prototype.eachChild=function(t){this.args.forEach(t)},Sw.prototype.outputDefined=function(){return this.args.every((function(t){return t.outputDefined()}))},Sw.prototype.serialize=function(){var t=["coalesce"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Pw=function(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e};Pw.prototype.evaluate=function(t){return this.result.evaluate(t)},Pw.prototype.eachChild=function(t){for(var e=0,i=this.bindings;e<i.length;e+=1){t(i[e][1])}t(this.result)},Pw.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found "+(t.length-1)+" instead.");for(var i=[],n=1;n<t.length-1;n+=2){var s=t[n];if("string"!=typeof s)return e.error("Expected string, but found "+typeof s+" instead.",n);if(/[^a-zA-Z0-9_]/.test(s))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);var r=e.parse(t[n+1],n+1);if(!r)return null;i.push([s,r])}var o=e.parse(t[t.length-1],t.length-1,e.expectedType,i);return o?new Pw(i,o):null},Pw.prototype.outputDefined=function(){return this.result.outputDefined()},Pw.prototype.serialize=function(){for(var t=["let"],e=0,i=this.bindings;e<i.length;e+=1){var n=i[e],s=n[0],r=n[1];t.push(s,r.serialize())}return t.push(this.result.serialize()),t};var _w=function(t,e,i){this.type=t,this.index=e,this.input=i};_w.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Vg),n=e.parse(t[2],2,ny(e.expectedType||Qg));if(!i||!n)return null;var s=n.type;return new _w(s.itemType,i,n)},_w.prototype.evaluate=function(t){var e=this.index.evaluate(t),i=this.input.evaluate(t);if(e<0)throw new yy("Array index out of bounds: "+e+" < 0.");if(e>=i.length)throw new yy("Array index out of bounds: "+e+" > "+(i.length-1)+".");if(e!==Math.floor(e))throw new yy("Array index must be an integer, but found "+e+" instead.");return i[e]},_w.prototype.eachChild=function(t){t(this.index),t(this.input)},_w.prototype.outputDefined=function(){return!1},_w.prototype.serialize=function(){return["at",this.index.serialize(),this.input.serialize()]};var Ew=function(t,e){this.type=Hg,this.needle=t,this.haystack=e};Ew.parse=function(t,e){if(3!==t.length)return e.error("Expected 2 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Qg);return i&&n?hy(i.type,[Hg,Wg,Vg,Zg,Qg])?new Ew(i,n):e.error("Expected first argument to be of type boolean, string, number or null, but found "+sy(i.type)+" instead"):null},Ew.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(null==i)return!1;if(!ay(e,["boolean","string","number","null"]))throw new yy("Expected first argument to be of type boolean, string, number or null, but found "+sy(my(e))+" instead.");if(!ay(i,["string","array"]))throw new yy("Expected second argument to be of type array or string, but found "+sy(my(i))+" instead.");return i.indexOf(e)>=0},Ew.prototype.eachChild=function(t){t(this.needle),t(this.haystack)},Ew.prototype.outputDefined=function(){return!0},Ew.prototype.serialize=function(){return["in",this.needle.serialize(),this.haystack.serialize()]};var Tw=function(t,e,i){this.type=Vg,this.needle=t,this.haystack=e,this.fromIndex=i};Tw.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Qg);if(!i||!n)return null;if(!hy(i.type,[Hg,Wg,Vg,Zg,Qg]))return e.error("Expected first argument to be of type boolean, string, number or null, but found "+sy(i.type)+" instead");if(4===t.length){var s=e.parse(t[3],3,Vg);return s?new Tw(i,n,s):null}return new Tw(i,n)},Tw.prototype.evaluate=function(t){var e=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!ay(e,["boolean","string","number","null"]))throw new yy("Expected first argument to be of type boolean, string, number or null, but found "+sy(my(e))+" instead.");if(!ay(i,["string","array"]))throw new yy("Expected second argument to be of type array or string, but found "+sy(my(i))+" instead.");if(this.fromIndex){var n=this.fromIndex.evaluate(t);return i.indexOf(e,n)}return i.indexOf(e)},Tw.prototype.eachChild=function(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)},Tw.prototype.outputDefined=function(){return!1},Tw.prototype.serialize=function(){if(null!=this.fromIndex&&void 0!==this.fromIndex){var t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]};var Cw=function(t,e,i,n,s,r){this.inputType=t,this.type=e,this.input=i,this.cases=n,this.outputs=s,this.otherwise=r};Cw.parse=function(t,e){if(t.length<5)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if(t.length%2!=1)return e.error("Expected an even number of arguments.");var i,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);for(var s={},r=[],o=2;o<t.length-1;o+=2){var h=t[o],a=t[o+1];Array.isArray(h)||(h=[h]);var u=e.concat(o);if(0===h.length)return u.error("Expected at least one branch label.");for(var l=0,c=h;l<c.length;l+=1){var f=c[l];if("number"!=typeof f&&"string"!=typeof f)return u.error("Branch labels must be numbers or strings.");if("number"==typeof f&&Math.abs(f)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof f&&Math.floor(f)!==f)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,my(f)))return null}else i=my(f);if(void 0!==s[String(f)])return u.error("Branch labels must be unique.");s[String(f)]=r.length}var d=e.parse(a,o,n);if(!d)return null;n=n||d.type,r.push(d)}var p=e.parse(t[1],1,Qg);if(!p)return null;var m=e.parse(t[t.length-1],t.length-1,n);return m?"value"!==p.type.kind&&e.concat(1).checkSubtype(i,p.type)?null:new Cw(i,n,p,s,r,m):null},Cw.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(my(e)===this.inputType&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},Cw.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},Cw.prototype.outputDefined=function(){return this.outputs.every((function(t){return t.outputDefined()}))&&this.otherwise.outputDefined()},Cw.prototype.serialize=function(){for(var t=this,e=["match",this.input.serialize()],i=[],n={},s=0,r=Object.keys(this.cases).sort();s<r.length;s+=1){var o=r[s];void 0===(c=n[this.cases[o]])?(n[this.cases[o]]=i.length,i.push([this.cases[o],[o]])):i[c][1].push(o)}for(var h=function(e){return"number"===t.inputType.kind?Number(e):e},a=0,u=i;a<u.length;a+=1){var l=u[a],c=l[0],f=l[1];1===f.length?e.push(h(f[0])):e.push(f.map(h)),e.push(this.outputs[outputIndex$1].serialize())}return e.push(this.otherwise.serialize()),e};var Fw=function(t,e,i){this.type=t,this.branches=e,this.otherwise=i};Fw.parse=function(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.");var i;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(var n=[],s=1;s<t.length-1;s+=2){var r=e.parse(t[s],s,Hg);if(!r)return null;var o=e.parse(t[s+1],s+1,i);if(!o)return null;n.push([r,o]),i=i||o.type}var h=e.parse(t[t.length-1],t.length-1,i);return h?new Fw(i,n,h):null},Fw.prototype.evaluate=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var n=i[e],s=n[0],r=n[1];if(s.evaluate(t))return r.evaluate(t)}return this.otherwise.evaluate(t)},Fw.prototype.eachChild=function(t){for(var e=0,i=this.branches;e<i.length;e+=1){var n=i[e],s=n[0],r=n[1];t(s),t(r)}t(this.otherwise)},Fw.prototype.outputDefined=function(){return this.branches.every((function(t){return t[0],t[1].outputDefined()}))&&this.otherwise.outputDefined()},Fw.prototype.serialize=function(){var t=["case"];return this.eachChild((function(e){t.push(e.serialize())})),t};var Iw=function(t,e,i,n){this.type=t,this.input=e,this.beginIndex=i,this.endIndex=n};function Aw(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 kw(t,e,i,n){return 0===n.compare(e,i)}function Rw(t,e,i){var n="=="!==t&&"!="!==t;return function(){function s(t,e,i){this.type=Hg,this.lhs=t,this.rhs=e,this.collator=i,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}return s.parse=function(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");var i=t[0],r=e.parse(t[1],1,Qg);if(!r)return null;if(!Aw(i,r.type))return e.concat(1).error('"'+i+"\" comparisons are not supported for type '"+sy(r.type)+"'.");var o=e.parse(t[2],2,Qg);if(!o)return null;if(!Aw(i,o.type))return e.concat(2).error('"'+i+"\" comparisons are not supported for type '"+sy(o.type)+"'.");if(r.type.kind!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error("Cannot compare types '"+sy(r.type)+"' and '"+sy(o.type)+"'.");n&&("value"===r.type.kind&&"value"!==o.type.kind?r=new xy(o.type,[r]):"value"!==r.type.kind&&"value"===o.type.kind&&(o=new xy(r.type,[o])));var h=null;if(4===t.length){if("string"!==r.type.kind&&"string"!==o.type.kind&&"value"!==r.type.kind&&"value"!==o.type.kind)return e.error("Cannot use collator to compare non-string types.");if(!(h=e.parse(t[3],3,ty)))return null}return new s(r,o,h)},s.prototype.evaluate=function(s){var r=this.lhs.evaluate(s),o=this.rhs.evaluate(s);if(n&&this.hasUntypedArgument){var h=my(r),a=my(o);if(h.kind!==a.kind||"string"!==h.kind&&"number"!==h.kind)throw new yy('Expected arguments for "'+t+'" to be (string, string) or (number, number), but found ('+h.kind+", "+a.kind+") instead.")}if(this.collator&&!n&&this.hasUntypedArgument){var u=my(r),l=my(o);if("string"!==u.kind||"string"!==l.kind)return e(s,r,o)}return this.collator?i(s,r,o,this.collator.evaluate(s)):e(s,r,o)},s.prototype.eachChild=function(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)},s.prototype.outputDefined=function(){return!0},s.prototype.serialize=function(){var e=[t];return this.eachChild((function(t){e.push(t.serialize())})),e},s}()}Iw.parse=function(t,e){if(t.length<=2||t.length>=5)return e.error("Expected 3 or 4 arguments, but found "+(t.length-1)+" instead.");var i=e.parse(t[1],1,Qg),n=e.parse(t[2],2,Vg);if(!i||!n)return null;if(!hy(i.type,[ny(Qg),Wg,Qg]))return e.error("Expected first argument to be of type array or string, but found "+sy(i.type)+" instead");if(4===t.length){var s=e.parse(t[3],3,Vg);return s?new Iw(i.type,i,n,s):null}return new Iw(i.type,i,n)},Iw.prototype.evaluate=function(t){var e=this.input.evaluate(t),i=this.beginIndex.evaluate(t);if(!ay(e,["string","array"]))throw new yy("Expected first argument to be of type array or string, but found "+sy(my(e))+" instead.");if(this.endIndex){var n=this.endIndex.evaluate(t);return e.slice(i,n)}return e.slice(i)},Iw.prototype.eachChild=function(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)},Iw.prototype.outputDefined=function(){return!1},Iw.prototype.serialize=function(){if(null!=this.endIndex&&void 0!==this.endIndex){var t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]};var Lw=Rw("==",(function(t,e,i){return e===i}),kw),Nw=Rw("!=",(function(t,e,i){return e!==i}),(function(t,e,i,n){return!kw(0,e,i,n)})),Ow=Rw("<",(function(t,e,i){return e<i}),(function(t,e,i,n){return n.compare(e,i)<0})),zw=Rw(">",(function(t,e,i){return e>i}),(function(t,e,i,n){return n.compare(e,i)>0})),Gw=Rw("<=",(function(t,e,i){return e<=i}),(function(t,e,i,n){return n.compare(e,i)<=0})),jw=Rw(">=",(function(t,e,i){return e>=i}),(function(t,e,i,n){return n.compare(e,i)>=0})),Dw=function(t,e,i,n,s){this.type=Wg,this.number=t,this.locale=e,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=s};Dw.parse=function(t,e){if(3!==t.length)return e.error("Expected two arguments.");var i=e.parse(t[1],1,Vg);if(!i)return null;var n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");var s=null;if(n.locale&&!(s=e.parse(n.locale,1,Wg)))return null;var r=null;if(n.currency&&!(r=e.parse(n.currency,1,Wg)))return null;var o=null;if(n["min-fraction-digits"]&&!(o=e.parse(n["min-fraction-digits"],1,Vg)))return null;var h=null;return n["max-fraction-digits"]&&!(h=e.parse(n["max-fraction-digits"],1,Vg))?null:new Dw(i,s,r,o,h)},Dw.prototype.evaluate=function(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))},Dw.prototype.eachChild=function(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)},Dw.prototype.outputDefined=function(){return!1},Dw.prototype.serialize=function(){var t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]};var Uw=function(t){this.type=Vg,this.input=t};Uw.parse=function(t,e){if(2!==t.length)return e.error("Expected 1 argument, but found "+(t.length-1)+" instead.");var 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 "+sy(i.type)+" instead."):new Uw(i):null},Uw.prototype.evaluate=function(t){var e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new yy("Expected value to be of type string or array, but found "+sy(my(e))+" instead.")},Uw.prototype.eachChild=function(t){t(this.input)},Uw.prototype.outputDefined=function(){return!1},Uw.prototype.serialize=function(){var t=["length"];return this.eachChild((function(e){t.push(e.serialize())})),t};var $w={"==":Lw,"!=":Nw,">":zw,"<":Ow,">=":jw,"<=":Gw,array:xy,at:_w,boolean:xy,case:Fw,coalesce:Sw,collator:Cy,format:by,image:My,in:Ew,"index-of":Tw,interpolate:bw,"interpolate-hcl":bw,"interpolate-lab":bw,length:Uw,let:Pw,literal:gy,match:Cw,number:xy,"number-format":Dw,object:xy,slice:Iw,step:tw,string:xy,"to-boolean":Py,"to-color":Py,"to-number":Py,"to-string":Py,var:Hy,within:Yy};function Bw(t,e){var i=e[0],n=e[1],s=e[2],r=e[3];i=i.evaluate(t),n=n.evaluate(t),s=s.evaluate(t);var o=r?r.evaluate(t):1,h=dy(i,n,s,o);if(h)throw new yy(h);return new Ng(i/255*o,n/255*o,s/255*o,o)}function qw(t,e){return t in e}function Xw(t,e){var i=e[t];return void 0===i?null:i}function Yw(t){return{type:t}}function Zw(t){return{result:"success",value:t}}function Vw(t){return{result:"error",value:t}}function Ww(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}Ty.register($w,{error:[{kind:"error"},[Wg],function(t,e){var i=e[0];throw new yy(i.evaluate(t))}],typeof:[Wg,[Qg],function(t,e){return sy(my(e[0].evaluate(t)))}],"to-rgba":[ny(Vg,4),[Kg],function(t,e){return e[0].evaluate(t).toArray()}],rgb:[Kg,[Vg,Vg,Vg],Bw],rgba:[Kg,[Vg,Vg,Vg,Vg],Bw],has:{type:Hg,overloads:[[[Wg],function(t,e){return qw(e[0].evaluate(t),t.properties())}],[[Wg,Jg],function(t,e){var i=e[0],n=e[1];return qw(i.evaluate(t),n.evaluate(t))}]]},get:{type:Qg,overloads:[[[Wg],function(t,e){return Xw(e[0].evaluate(t),t.properties())}],[[Wg,Jg],function(t,e){var i=e[0],n=e[1];return Xw(i.evaluate(t),n.evaluate(t))}]]},"feature-state":[Qg,[Wg],function(t,e){return Xw(e[0].evaluate(t),t.featureState||{})}],properties:[Jg,[],function(t){return t.properties()}],"geometry-type":[Wg,[],function(t){return t.geometryType()}],id:[Qg,[],function(t){return t.id()}],zoom:[Vg,[],function(t){return t.globals.zoom}],pitch:[Vg,[],function(t){return t.globals.pitch||0}],"distance-from-center":[Vg,[],function(t){return t.distanceFromCenter()}],"heatmap-density":[Vg,[],function(t){return t.globals.heatmapDensity||0}],"line-progress":[Vg,[],function(t){return t.globals.lineProgress||0}],"sky-radial-progress":[Vg,[],function(t){return t.globals.skyRadialProgress||0}],accumulated:[Qg,[],function(t){return void 0===t.globals.accumulated?null:t.globals.accumulated}],"+":[Vg,Yw(Vg),function(t,e){for(var i=0,n=0,s=e;n<s.length;n+=1){i+=s[n].evaluate(t)}return i}],"*":[Vg,Yw(Vg),function(t,e){for(var i=1,n=0,s=e;n<s.length;n+=1){i*=s[n].evaluate(t)}return i}],"-":{type:Vg,overloads:[[[Vg,Vg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)-n.evaluate(t)}],[[Vg],function(t,e){return-e[0].evaluate(t)}]]},"/":[Vg,[Vg,Vg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)/n.evaluate(t)}],"%":[Vg,[Vg,Vg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)%n.evaluate(t)}],ln2:[Vg,[],function(){return Math.LN2}],pi:[Vg,[],function(){return Math.PI}],e:[Vg,[],function(){return Math.E}],"^":[Vg,[Vg,Vg],function(t,e){var i=e[0],n=e[1];return Math.pow(i.evaluate(t),n.evaluate(t))}],sqrt:[Vg,[Vg],function(t,e){var i=e[0];return Math.sqrt(i.evaluate(t))}],log10:[Vg,[Vg],function(t,e){var i=e[0];return Math.log(i.evaluate(t))/Math.LN10}],ln:[Vg,[Vg],function(t,e){var i=e[0];return Math.log(i.evaluate(t))}],log2:[Vg,[Vg],function(t,e){var i=e[0];return Math.log(i.evaluate(t))/Math.LN2}],sin:[Vg,[Vg],function(t,e){var i=e[0];return Math.sin(i.evaluate(t))}],cos:[Vg,[Vg],function(t,e){var i=e[0];return Math.cos(i.evaluate(t))}],tan:[Vg,[Vg],function(t,e){var i=e[0];return Math.tan(i.evaluate(t))}],asin:[Vg,[Vg],function(t,e){var i=e[0];return Math.asin(i.evaluate(t))}],acos:[Vg,[Vg],function(t,e){var i=e[0];return Math.acos(i.evaluate(t))}],atan:[Vg,[Vg],function(t,e){var i=e[0];return Math.atan(i.evaluate(t))}],min:[Vg,Yw(Vg),function(t,e){return Math.min.apply(Math,e.map((function(e){return e.evaluate(t)})))}],max:[Vg,Yw(Vg),function(t,e){return Math.max.apply(Math,e.map((function(e){return e.evaluate(t)})))}],abs:[Vg,[Vg],function(t,e){var i=e[0];return Math.abs(i.evaluate(t))}],round:[Vg,[Vg],function(t,e){var i=e[0].evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[Vg,[Vg],function(t,e){var i=e[0];return Math.floor(i.evaluate(t))}],ceil:[Vg,[Vg],function(t,e){var i=e[0];return Math.ceil(i.evaluate(t))}],"filter-==":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1];return t.properties()[i.value]===n.value}],"filter-id-==":[Hg,[Qg],function(t,e){var i=e[0];return t.id()===i.value}],"filter-type-==":[Hg,[Wg],function(t,e){var i=e[0];return t.geometryType()===i.value}],"filter-<":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s<r}],"filter-id-<":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n<s}],"filter->":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s>r}],"filter-id->":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n>s}],"filter-<=":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s<=r}],"filter-id-<=":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n<=s}],"filter->=":[Hg,[Wg,Qg],function(t,e){var i=e[0],n=e[1],s=t.properties()[i.value],r=n.value;return typeof s==typeof r&&s>=r}],"filter-id->=":[Hg,[Qg],function(t,e){var i=e[0],n=t.id(),s=i.value;return typeof n==typeof s&&n>=s}],"filter-has":[Hg,[Qg],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[Hg,[],function(t){return null!==t.id()&&void 0!==t.id()}],"filter-type-in":[Hg,[ny(Wg)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[Hg,[ny(Qg)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[Hg,[Wg,ny(Qg)],function(t,e){var i=e[0];return e[1].value.indexOf(t.properties()[i.value])>=0}],"filter-in-large":[Hg,[Wg,ny(Qg)],function(t,e){var i=e[0],n=e[1];return function(t,e,i,n){for(;i<=n;){var s=i+n>>1;if(e[s]===t)return!0;e[s]>t?n=s-1:i=s+1}return!1}(t.properties()[i.value],n.value,0,n.value.length-1)}],all:{type:Hg,overloads:[[[Hg,Hg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)&&n.evaluate(t)}],[Yw(Hg),function(t,e){for(var i=0,n=e;i<n.length;i+=1){if(!n[i].evaluate(t))return!1}return!0}]]},any:{type:Hg,overloads:[[[Hg,Hg],function(t,e){var i=e[0],n=e[1];return i.evaluate(t)||n.evaluate(t)}],[Yw(Hg),function(t,e){for(var i=0,n=e;i<n.length;i+=1){if(n[i].evaluate(t))return!0}return!1}]]},"!":[Hg,[Hg],function(t,e){return!e[0].evaluate(t)}],"is-supported-script":[Hg,[Wg],function(t,e){var i=e[0],n=t.globals&&t.globals.isSupportedScript;return!n||n(i.evaluate(t))}],upcase:[Wg,[Wg],function(t,e){return e[0].evaluate(t).toUpperCase()}],downcase:[Wg,[Wg],function(t,e){return e[0].evaluate(t).toLowerCase()}],concat:[Wg,Yw(Qg),function(t,e){return e.map((function(e){return vy(e.evaluate(t))})).join("")}],"resolved-locale":[Wg,[ty],function(t,e){return e[0].evaluate(t).resolvedLocale()}]});var Hw=function(t,e){this.expression=t,this._warningHistory={},this._evaluator=new Ey,this._defaultValue=e?function(t){return"color"===t.type&&(Ww(t.default)||Array.isArray(t.default))?new Ng(0,0,0,0):"color"===t.type?Ng.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null};function Kw(t,e){var i=new Ky($w,[],e?function(t){var e={color:Kg,string:Wg,number:Vg,enum:Wg,boolean:Hg,formatted:ey,resolvedImage:iy};if("array"===t.type)return ny(e[t.value]||Qg,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?Zw(new Hw(n,e)):Vw(i.errors)}Hw.prototype.evaluateWithoutErrorHandling=function(t,e,i,n,s,r,o,h){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=i,this._evaluator.canonical=n||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=r,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)},Hw.prototype.evaluate=function(t,e,i,n,s,r,o,h){this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=s||null,this._evaluator.formattedSection=r||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=h||null;try{var a=this.expression.evaluate(this._evaluator);if(null==a||"number"==typeof a&&a!=a)return this._defaultValue;if(this._enumValues&&!(a in this._enumValues))throw new yy("Expected value to be one of "+Object.keys(this._enumValues).map((function(t){return JSON.stringify(t)})).join(", ")+", but found "+JSON.stringify(a)+" instead.");return a}catch(t){return this._warningHistory[t.message]||(this._warningHistory[t.message]=!0,"undefined"!=typeof console&&console.warn(t.message)),this._defaultValue}};var Jw=function(t,e){this.kind=t,this._styleExpression=e,this.isStateDependent="constant"!==t&&!Vy(e.expression)};Jw.prototype.evaluateWithoutErrorHandling=function(t,e,i,n,s,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,s,r)},Jw.prototype.evaluate=function(t,e,i,n,s,r){return this._styleExpression.evaluate(t,e,i,n,s,r)};var Qw=function(t,e,i,n){this.kind=t,this.zoomStops=i,this._styleExpression=e,this.isStateDependent="camera"!==t&&!Vy(e.expression),this.interpolationType=n};function tx(t,e){if("error"===(t=Kw(t,e)).result)return t;var i=t.value.expression,n=Zy(i);if(!n&&!function(t){return"data-driven"===t["property-type"]||"cross-faded-data-driven"===t["property-type"]}(e))return Vw([new Xg("","data expressions not supported")]);var s=Wy(i,["zoom","pitch","distance-from-center"]);if(!s&&!function(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}(e))return Vw([new Xg("","zoom expressions not supported")]);var r=ex(i);if(!r&&!s)return Vw([new Xg("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(r instanceof Xg)return Vw([r]);if(r instanceof bw&&!function(t){return!!t.expression&&t.expression.interpolated}(e))return Vw([new Xg("",'"interpolate" expressions cannot be used with this property')]);if(!r)return Zw(new Jw(n?"constant":"source",t.value));var o=r instanceof bw?r.interpolation:void 0;return Zw(new Qw(n?"camera":"composite",t.value,r.labels,o))}function ex(t){var e=null;if(t instanceof Pw)e=ex(t.result);else if(t instanceof Sw)for(var i=0,n=t.args;i<n.length;i+=1){var s=n[i];if(e=ex(s))break}else(t instanceof tw||t instanceof bw)&&t.input instanceof Ty&&"zoom"===t.input.name&&(e=t);return e instanceof Xg||t.eachChild((function(t){var i=ex(t);i instanceof Xg?e=i:!e&&i?e=new Xg("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new Xg("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function ix(t){if(Array.isArray(t))return t.map(ix);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){var e={};for(var i in t)e[i]=ix(t[i]);return e}return function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}(t)}Qw.prototype.evaluateWithoutErrorHandling=function(t,e,i,n,s,r){return this._styleExpression.evaluateWithoutErrorHandling(t,e,i,n,s,r)},Qw.prototype.evaluate=function(t,e,i,n,s,r){return this._styleExpression.evaluate(t,e,i,n,s,r)},Qw.prototype.interpolationFactor=function(t,e,i){return this.interpolationType?bw.interpolationFactor(this.interpolationType,t,e,i):0};var nx={$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"}},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:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-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:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};function sx(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(var e=0,i=t.slice(1);e<i.length;e+=1){var n=i[e];if(!sx(n)&&"boolean"!=typeof n)return!1}return!0;default:return!0}}function rx(t,e){if(void 0===e&&(e="fill"),null==t)return{filter:function(){return!0},needGeometry:!1,needFeature:!1};sx(t)||(t=fx(t));var i=t,n=!0;try{n=function(t){if(!ax(t))return t;var e=ix(t);return hx(e),e=ox(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        ")}var s=nx["filter_"+e],r=Kw(n,s),o=null;if("error"===r.result)throw new Error(r.value.map((function(t){return t.key+": "+t.message})).join(", "));o=function(t,e,i){return r.value.evaluate(t,e,{},i)};var h=null,a=null;if(n!==i){var u=Kw(i,s);if("error"===u.result)throw new Error(u.value.map((function(t){return t.key+": "+t.message})).join(", "));h=function(t,e,i,n,s){return u.value.evaluate(t,e,{},i,void 0,void 0,n,s)},a=!Zy(u.value.expression)}return{filter:o,dynamicFilter:h||void 0,needGeometry:cx(n),needFeature:!!a}}function ox(t){if(!Array.isArray(t))return t;var e=function(t){if(ux.has(t[0]))for(var e=1;e<t.length;e++){if(ax(t[e]))return!0}return t}(t);return!0===e?e:e.map((function(t){return ox(t)}))}function hx(t){var e=!1,i=[];if("case"===t[0]){for(var n=1;n<t.length-1;n+=2)e=e||ax(t[n]),i.push(t[n+1]);i.push(t[t.length-1])}else if("match"===t[0]){e=e||ax(t[1]);for(var s=2;s<t.length-1;s+=2)i.push(t[s+1]);i.push(t[t.length-1])}else if("step"===t[0]){e=e||ax(t[1]);for(var r=1;r<t.length-1;r+=2)i.push(t[r+1])}e&&(t.length=0,t.push.apply(t,["any"].concat(i)));for(var o=1;o<t.length;o++)hx(t[o])}function ax(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;for(var e,i=1;i<t.length;i++){if(ax(t[i]))return!0}return!1}var ux=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function lx(t,e){return t<e?-1:t>e?1:0}function cx(t){if(!Array.isArray(t))return!1;if("within"===t[0])return!0;for(var e=1;e<t.length;e++)if(cx(t[e]))return!0;return!1}function fx(t){if(!t)return!0;var e,i=t[0];return t.length<=1?"any"!==i:"=="===i?dx(t[1],t[2],"=="):"!="===i?vx(dx(t[1],t[2],"==")):"<"===i||">"===i||"<="===i||">="===i?dx(t[1],t[2],i):"any"===i?(e=t.slice(1),["any"].concat(e.map(fx))):"all"===i?["all"].concat(t.slice(1).map(fx)):"none"===i?["all"].concat(t.slice(1).map(fx).map(vx)):"in"===i?px(t[1],t.slice(2)):"!in"===i?vx(px(t[1],t.slice(2))):"has"===i?mx(t[1]):"!has"===i?vx(mx(t[1])):"within"!==i||t}function dx(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 px(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((function(t){return typeof t!=typeof e[0]}))?["filter-in-large",t,["literal",e.sort(lx)]]:["filter-in-small",t,["literal",e]]}}function mx(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function vx(t){return["!",t]}var gx=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function yx(t,e){var i={};for(var n in t)"ref"!==n&&(i[n]=t[n]);return gx.forEach((function(t){t in e&&(i[t]=e[t])})),i}var wx={thin:100,hairline:100,"ultra-light":100,"extra-light":100,light:200,book:300,regular:400,normal:400,plain:400,roman:400,standard:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,heavy:800,black:800,"extra-bold":800,"ultra-black":900,"extra-black":900,"ultra-bold":900,"heavy-black":900,fat:900,poster:900},xx=" ",bx=/(italic|oblique)$/i,Mx={},Sx=function(t,e,i){var n=Mx[t];if(!n){Array.isArray(t)||(t=[t]);for(var s=400,r="normal",o=[],h=0,a=t.length;h<a;++h){var u=t[h].split(" "),l=u[u.length-1].toLowerCase();for(var c in"normal"==l||"italic"==l||"oblique"==l?(r=l,u.pop(),l=u[u.length-1].toLowerCase()):bx.test(l)&&(l=l.replace(bx,""),r=u[u.length-1].replace(l,"")),wx){var f=u.length>1?u[u.length-2].toLowerCase():"";if(l==c||l==c.replace("-","")||f+"-"+l==c){s=wx[c],u.pop(),f&&c.startsWith(f)&&u.pop();break}}"number"==typeof l&&(s=l);var d=u.join(xx).replace("Klokantech Noto Sans","Noto Sans");-1!==d.indexOf(xx)&&(d='"'+d+'"'),o.push(d)}n=Mx[t]=[r,s,o]}return n[0]+xx+n[1]+xx+e+"px"+(i?"/"+i:"")+xx+n[2]},Px="https://api.mapbox.com";function _x(t){var e="mapbox://";return 0!==t.indexOf(e)?"":t.slice(e.length)}function Ex(t,e){var i=_x(t);if(!i)return decodeURI(new URL(t,location.href).href);var n="styles/";if(0!==i.indexOf(n))throw new Error("unexpected style url: "+t);var s=i.slice(n.length);return Px+"/styles/v1/"+s+"?&access_token="+e}function Tx(t,e,i,n){var s=new URL(t,n),r=_x(t);return r?"https://{a-d}.tiles.mapbox.com/v4/"+r+"/{z}/{x}/{y}.vector.pbf?access_token="+e:e?(s.searchParams.set(i,e),decodeURI(s.href)):decodeURI(s.href)}function Cx(t){return t*Math.PI/180}var Fx=function(){for(var t=[],e=78271.51696402048;t.length<=24;e/=2)t.push(e);return t}();function Ix(t,e){if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(t,e);var i=document.createElement("canvas");return i.width=t,i.height=e,i}var Ax={};function kx(t,e,i){if(void 0===i&&(i={}),e in Ax)return Ax[e];var n=i.transformRequest&&i.transformRequest(e,t)||new Request(e);n.headers.get("Accept")||n.headers.set("Accept","application/json");var s=fetch(n).then((function(t){return delete Ax[e],t.ok?t.json():Promise.reject(new Error("Error fetching source "+e))})).catch((function(t){return delete Ax[e],Promise.reject(new Error("Error fetching source "+e))}));return Ax[e]=s,s}function Rx(t,e){if("string"!=typeof t)return Promise.resolve(t);if(!t.trim().startsWith("{"))return kx("Style",t=Ex(t,e.accessToken),e);try{var i=JSON.parse(t);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}var Lx={};function Nx(t,e,i){void 0===i&&(i={});var n=[e,JSON.stringify(t)].toString(),s=Lx[n];if(!s||i.transformRequest){var r=t.url;if(r&&!t.tiles){var o=Tx(r,i.accessToken,i.accessTokenParam||"access_token",e||location.href);s=r.startsWith("mapbox://")?Promise.resolve(Object.assign({},t,{url:void 0,tiles:o})):kx("Source",o,i).then((function(t){for(var e=0,n=t.tiles.length;e<n;++e){var s=t.tiles[e];if(i.transformRequest){var r=i.transformRequest(o,"Source");r&&(o=r.url)}var h=Tx(s,i.accessToken,i.accessTokenParam||"access_token",o);if(i.transformRequest){var a=i.transformRequest(h,"Tiles");a instanceof Request&&(h=decodeURI(a.url))}t.tiles[e]=h}return Promise.resolve(t)}))}else t=Object.assign({},t,{tiles:t.tiles.map((function(t){return Tx(t,i.accessToken,i.accessTokenParam||"access_token",e||location.href)}))}),s=Promise.resolve(Object.assign({},t));Lx[n]=s}return s}var Ox,zx=Array(256).join(" ");function Gx(t,e){if(e>=.05){for(var i="",n=t.split("\n"),s=zx.slice(0,Math.round(e/.1)),r=0,o=n.length;r<o;++r)r>0&&(i+="\n"),i+=n[r].split("").join(s);return i}return t}function jx(){return Ox||(Ox=Ix(1,1).getContext("2d")),Ox}function Dx(t,e){return jx().measureText(t).width+(t.length-1)*e}var Ux={};function $x(t,e,i,n){if(-1!==t.indexOf("\n")){for(var s=t.split("\n"),r=[],o=0,h=s.length;o<h;++o)r.push($x(s[o],e,i,n));return r.join("\n")}var a=i+","+e+","+t+","+n,u=Ux[a];if(!u){var l=t.split(" ");if(l.length>1){var c=jx();c.font=e;for(var f=c.measureText("M").width*i,d="",p=[],m=0,v=l.length;m<v;++m){var g=l[m],y=d+(d?" ":"")+g;Dx(y,n)<=f?d=y:(d&&p.push(d),d=g)}d&&p.push(d);for(var w=0,x=p.length;w<x&&x>1;++w){var b=p[w];if(Dx(b,n)<.35*f){var M=w>0?Dx(p[w-1],n):1/0,S=w<x-1?Dx(p[w+1],n):1/0;p.splice(w,1),x-=1,M<S?(p[w-1]+=" "+b,w-=1):p[w]=b+" "+p[w]}}for(var P=0,_=p.length-1;P<_;++P){var E=p[P],T=p[P+1];if(Dx(E,n)>.7*f&&Dx(T,n)<.6*f){var C=E.split(" "),F=C.pop();Dx(F,n)<.2*f&&(p[P]=C.join(" "),p[P+1]=F+" "+T),_-=1}}u=p.join("\n")}else u=t;u=Gx(u,n),Ux[a]=u}return u}var Bx,qx=/font-family: ?([^;]*);/,Xx=/("|')/g;function Yx(t){if(!Bx){Bx={};for(var e=document.styleSheets,i=0,n=e.length;i<n;++i){var s=e[i];try{var r=s.rules||s.cssRules;if(r)for(var o=0,h=r.length;o<h;++o){var a=r[o];if(5==a.type){var u=a.cssText.match(qx);Bx[u[1].replace(Xx,"")]=!0}}}catch(t){}}}return t in Bx}var Zx={};function Vx(t){var e=t.toString();if(e in Zx)return Zx[e];for(var i=[],n=0,s=t.length;n<s;++n){t[n]=t[n].replace("Arial Unicode MS","Arial");var r=t[n],o=Sx(r,1);ro(o);var h=o.split(" ");i.push([h.slice(3).join(" ").replace(/"/g,""),h[1],h[0]])}for(var a=0,u=i.length;a<u;++a){var l=i[a],c=l[0];if(!Yx(c)&&100!==eo.get(l[2]+"\n"+l[1]+" \n"+c)){var f="https://fonts.googleapis.com/css?family="+c.replace(/ /g,"+")+":"+l[1]+l[2];if(!document.querySelector('link[href="'+f+'"]')){var d=document.createElement("link");d.href=f,d.rel="stylesheet",document.head.appendChild(d)}}}return Zx[e]=t,t}var Wx,Hx,Kx={Point:1,MultiPoint:1,LineString:2,MultiLineString:2,Polygon:3,MultiPolygon:3},Jx={center:[.5,.5],left:[0,.5],right:[1,.5],top:[.5,0],bottom:[.5,1],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},Qx={},tb={zoom:0};function eb(t,e,i,n,s,r,o){var h=t.id;r||(r={},console.warn("No functionCache provided to getValue()")),r[h]||(r[h]={});var a,u=r[h];if(!u[i]){var l=(t[e]||Qx)[i],c=nx[e+"_"+t.type][i];void 0===l&&(l=c.default);var f=(a=l,Array.isArray(a)&&a.length>0&&"string"==typeof a[0]&&a[0]in $w);if(!f&&Ww(l)&&(l=zg(l,c),f=!0),f){var d=function(t,e){var i=tx(t,e);if("error"===i.result)throw new Error(i.value.map((function(t){return t.key+": "+t.message})).join(", "));return i.value}(l,c);u[i]=d.evaluate.bind(d)}else"color"==c.type&&(l=Ng.parse(l)),u[i]=function(){return l}}return tb.zoom=n,u[i](tb,s,o)}function ib(t,e,i,n){return eb(t,"layout","icon-allow-overlap",e,i,n)?eb(t,"layout","icon-ignore-placement",e,i,n)?"none":"obstacle":"declutter"}function nb(t,e,i,n,s){return s||console.warn("No filterCache provided to evaluateFilter()"),t in s||(s[t]=rx(e).filter),tb.zoom=n,s[t](tb,i)}var sb=!1;function rb(t,e){if(t){if(!sb&&(0===t.a||0===e))return;var 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}var ob=/\{[^{}}]*\}/g;function hb(t,e){return t.replace(ob,(function(t){return e[t.slice(1,-1)]||""}))}var ab=!1;function ub(t,e,i,n,s,r,o){if(void 0===n&&(n=Fx),void 0===s&&(s=void 0),void 0===r&&(r=void 0),void 0===o&&(o=void 0),"string"==typeof e&&(e=JSON.parse(e)),8!=e.version)throw new Error("glStyle version 8 required.");var h,a;if(r)if("undefined"!=typeof Image){var u=new Image;u.crossOrigin="anonymous",u.onload=function(){h=u,a=[u.width,u.height],t.changed(),u.onload=null},u.src=r}else if("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope){var l=self;l.postMessage({action:"loadImage",src:r}),l.addEventListener("message",(function(t){"imageLoaded"===t.data.action&&t.data.src===r&&(h=t.data.image,a=[h.width,h.height])}))}for(var c,f=function(t){t=t.slice();for(var e=Object.create(null),i=0;i<t.length;i++)e[t[i].id]=t[i];for(var n=0;n<t.length;n++)"ref"in t[n]&&(t[n]=yx(t[n],e[t[n].ref]));return t}(e.layers),d={},p=[],m={},v={},g={},y={},w=0,x=f.length;w<x;++w){var b=f[w],M=b.id;if("string"==typeof i&&b.source==i||-1!==i.indexOf(M)){var S=b["source-layer"];if(c){if(b.source!==c)throw new Error('Layer "'+M+'" does not use source "'+c)}else{c=b.source;var P=e.sources[c];if(!P)throw new Error('Source "'+c+'" is not defined');var _=P.type;if("vector"!==_&&"geojson"!==_)throw new Error('Source "'+c+'" is not of type "vector" or "geojson", but "'+_+'"')}var E=d[S];E||(E=[],d[S]=E),E.push({layer:b,index:w}),p.push(M)}}var T=new Nc,C=new Tc,F=[],I=function(e,i){var r=e.getProperties(),u=d[r.layer];if(u){var l=n.indexOf(i);-1==l&&(l=function(t,e){for(var i=0,n=e.length;i<n;++i)if(e[i]<t&&i+1<n){var s=e[i]/e[i+1];return i+Math.log(e[i]/t)/Math.log(s)}return n-1}(i,n));for(var c,f=Kx[e.getGeometry().getType()],p={properties:r,type:f},w=t.get("mapbox-featurestate")[e.getId()],x=-1,b=0,M=u.length;b<M;++b){var S=u[b],P=S.layer,_=P.id,E=P.layout||Qx,I=P.paint||Qx;if(!("none"===E.visibility||"minzoom"in P&&l<P.minzoom||"maxzoom"in P&&l>=P.maxzoom)){var A=P.filter;if(!A||nb(_,A,p,l,y)){c=P;var k=void 0,R=void 0,L=void 0,N=void 0,O=void 0,z=void 0,G=S.index;if(3==f&&("fill"==P.type||"fill-extrusion"==P.type))if(R=eb(P,"paint",P.type+"-opacity",l,p,g,w),P.type+"-pattern"in I){var j=eb(P,"paint",P.type+"-pattern",l,p,g,w);if(j){var D="string"==typeof j?hb(j,r):j.toString();if(h&&s&&s[D]){++x,(z=F[x])&&z.getFill()&&!z.getStroke()&&!z.getText()||(z=new $c({fill:new Tc}),F[x]=z),L=z.getFill(),z.setZIndex(G);var U=D+"."+R,$=v[U];if(!$){var B=s[D],q=Ix(B.width,B.height),X=q.getContext("2d");X.globalAlpha=R,X.drawImage(h,B.x,B.y,B.width,B.height,0,0,B.width,B.height),$=X.createPattern(q,"repeat"),v[U]=$}L.setColor($)}}}else k=rb(eb(P,"paint",P.type+"-color",l,p,g,w),R),P.type+"-outline-color"in I&&(O=rb(eb(P,"paint",P.type+"-outline-color",l,p,g,w),R)),O||(O=k),(k||O)&&(++x,(!(z=F[x])||k&&!z.getFill()||!k&&z.getFill()||O&&!z.getStroke()||!O&&z.getStroke()||z.getText())&&(z=new $c({fill:k?new Tc:void 0,stroke:O?new Nc:void 0}),F[x]=z),k&&(L=z.getFill()).setColor(k),O&&((N=z.getStroke()).setColor(O),N.setWidth(.5)),z.setZIndex(G));if(1!=f&&"line"==P.type){k=!("line-pattern"in I)&&"line-color"in I?rb(eb(P,"paint","line-color",l,p,g,w),eb(P,"paint","line-opacity",l,p,g,w)):void 0;var Y=eb(P,"paint","line-width",l,p,g,w);k&&Y>0&&(++x,(z=F[x])&&z.getStroke()&&!z.getFill()&&!z.getText()||(z=new $c({stroke:new Nc}),F[x]=z),(N=z.getStroke()).setLineCap(eb(P,"layout","line-cap",l,p,g,w)),N.setLineJoin(eb(P,"layout","line-join",l,p,g,w)),N.setMiterLimit(eb(P,"layout","line-miter-limit",l,p,g,w)),N.setColor(k),N.setWidth(Y),N.setLineDash(I["line-dasharray"]?eb(P,"paint","line-dasharray",l,p,g,w).map((function(t){return t*Y})):null),z.setZIndex(G))}var Z=!1,V=null,W=0,H=void 0,K=void 0,J=void 0;if((1==f||2==f)&&"icon-image"in E){var Q=eb(P,"layout","icon-image",l,p,g,w);if(Q){H="string"==typeof Q?hb(Q,r):Q.toString();var tt=void 0;if(h&&s&&s[H]){var et=eb(P,"layout","icon-rotation-alignment",l,p,g,w);if(2==f){var it=e.getGeometry();if(it.getFlatMidpoint||it.getFlatMidpoints){var nt=it.getExtent();if(Math.sqrt(Math.max(Math.pow((nt[2]-nt[0])/i,2),Math.pow((nt[3]-nt[1])/i,2)))>150){var st="MultiLineString"===it.getType()?it.getFlatMidpoints():it.getFlatMidpoint();if(Hx||(Hx=new Kv("Point",Wx=[NaN,NaN],[],{},null)),tt=Hx,Wx[0]=st[0],Wx[1]=st[1],"line"===eb(P,"layout","symbol-placement",l,p,g,w)&&"map"===et)for(var rt=it.getStride(),ot=it.getFlatCoordinates(),ht=0,at=ot.length-rt;ht<at;ht+=rt){var ut=ot[ht],lt=ot[ht+1],ct=ot[ht+rt],ft=ot[ht+rt+1],dt=Math.min(ut,ct),pt=Math.min(lt,ft),mt=Math.max(ut,ct),vt=Math.max(lt,ft);if(st[0]>=dt&&st[0]<=mt&&st[1]>=pt&&st[1]<=vt){W=Math.atan2(lt-ft,ct-ut);break}}}}}if(2!==f||tt){var gt=eb(P,"layout","icon-size",l,p,g,w),yt=void 0!==I["icon-color"]?eb(P,"paint","icon-color",l,p,g,w):null;if(!yt||0!==yt.a){var wt=H+"."+gt;if(null!==yt&&(wt+="."+yt),!(K=m[wt])){var xt=s[H],bt=ib(P,l,p,g),Mt=void 0;"icon-offset"in E&&((Mt=eb(P,"layout","icon-offset",l,p,g,w))[1]*=-1),K=new Rc({color:yt?[255*yt.r,255*yt.g,255*yt.b,yt.a]:void 0,img:h,imgSize:a,size:[xt.width,xt.height],offset:[xt.x,xt.y],rotateWithView:"map"===et,scale:gt/xt.pixelRatio,displacement:Mt,declutterMode:bt}),m[wt]=K}}K&&(++x,(z=F[x])&&z.getImage()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z),z.setGeometry(tt),K.setRotation(W+Cx(eb(P,"layout","icon-rotate",l,p,g,w))),K.setOpacity(eb(P,"paint","icon-opacity",l,p,g,w)),K.setAnchor(Jx[eb(P,"layout","icon-anchor",l,p,g,w)]),z.setImage(K),V=z.getText(),z.setText(void 0),z.setZIndex(G),Z=!0,J=!1)}else J=!0}}}if(1==f&&"circle"===P.type){++x,(z=F[x])&&z.getImage()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z);var St="circle-radius"in I?eb(P,"paint","circle-radius",l,p,g,w):5,Pt=rb(eb(P,"paint","circle-stroke-color",l,p,g,w),eb(P,"paint","circle-stroke-opacity",l,p,g,w)),_t=rb(eb(P,"paint","circle-color",l,p,g,w),eb(P,"paint","circle-opacity",l,p,g,w)),Et=eb(P,"paint","circle-stroke-width",l,p,g,w),Tt=St+"."+Pt+"."+_t+"."+Et;(K=m[Tt])||(K=new _c({radius:St,stroke:Pt&&Et>0?new Nc({width:Et,color:Pt}):void 0,fill:_t?new Tc({color:_t}):void 0,declutterMode:"none"}),m[Tt]=K),z.setImage(K),V=z.getText(),z.setText(void 0),z.setGeometry(void 0),z.setZIndex(G),Z=!0}var Ct=void 0,Ft=void 0,It=void 0,At=void 0,kt=void 0,Rt=void 0;if("text-field"in E){At=Math.round(eb(P,"layout","text-size",l,p,g,w));var Lt=eb(P,"layout","text-font",l,p,g,w);It=eb(P,"layout","text-line-height",l,p,g,w),(Ft=Sx(o?o(Lt):Lt,At,It)).includes("sans-serif")||(Ft+=",sans-serif"),kt=eb(P,"layout","text-letter-spacing",l,p,g,w),Rt=eb(P,"layout","text-max-width",l,p,g,w);var Nt=eb(P,"layout","text-field",l,p,g,w);Ct="object"==typeof Nt&&Nt.sections?1===Nt.sections.length?Nt.toString():Nt.sections.reduce((function(t,e,i){var n=e.fontStack?e.fontStack.split(","):Lt,s=Sx(o?o(n):n,At*(e.scale||1),It),r=e.text;if("\n"===r)return t.push("\n",""),t;if(2!=f){for(var h=0,a=(r=$x(r,s,Rt,kt).split("\n")).length;h<a;++h)h>0&&t.push("\n",""),t.push(r[h],s);return t}t.push(Gx(r,kt),s)}),[]):hb(Nt,r).trim(),R=eb(P,"paint","text-opacity",l,p,g,w)}if(Ct&&R&&!J){Z||(++x,(z=F[x])&&z.getText()&&!z.getFill()&&!z.getStroke()||(z=new $c,F[x]=z),z.setImage(void 0),z.setGeometry(void 0)),z.getText()||z.setText(V||new qc({padding:[2,2,2,2]})),V=z.getText();var Ot=E["text-transform"];"uppercase"==Ot?Ct=Array.isArray(Ct)?Ct.map((function(t,e){return e%2?t:t.toUpperCase()})):Ct.toUpperCase():"lowercase"==Ot&&(Ct=Array.isArray(Ct)?Ct.map((function(t,e){return e%2?t:t.toLowerCase()})):Ct.toLowerCase());var zt=Array.isArray(Ct)?Ct:2==f?Gx(Ct,kt):$x(Ct,Ft,Rt,kt);V.setText(zt),V.setFont(Ft),V.setRotation(Cx(eb(P,"layout","text-rotate",l,p,g,w)));var Gt=eb(P,"layout","text-anchor",l,p,g,w),jt=Z||1==f?"point":eb(P,"layout","symbol-placement",l,p,g,w);V.setPlacement(jt),V.setOverflow("point"===jt);var Dt=eb(P,"paint","text-halo-width",l,p,g,w),Ut=eb(P,"layout","text-offset",l,p,g,w),$t=eb(P,"paint","text-translate",l,p,g,w),Bt=0,qt=0;if("point"==jt){var Xt="center";-1!==Gt.indexOf("left")?(Xt="left",qt=Dt):-1!==Gt.indexOf("right")&&(Xt="right",qt=-Dt),V.setTextAlign(Xt);var Yt=eb(P,"layout","text-rotation-alignment",l,p,g,w);V.setRotateWithView("map"==Yt)}else V.setMaxAngle(Cx(eb(P,"layout","text-max-angle",l,p,g,w))*Ct.length/zt.length),V.setTextAlign(),V.setRotateWithView(!1);var Zt="middle";0==Gt.indexOf("bottom")?(Zt="bottom",Bt=-Dt-.5*(It-1)*At):0==Gt.indexOf("top")&&(Zt="top",Bt=Dt+.5*(It-1)*At),V.setTextBaseline(Zt);var Vt=eb(P,"layout","text-justify",l,p,g,w);V.setJustify("auto"===Vt?void 0:Vt),V.setOffsetX(Ut[0]*At+qt+$t[0]),V.setOffsetY(Ut[1]*At+Bt+$t[1]),C.setColor(rb(eb(P,"paint","text-color",l,p,g,w),R)),V.setFill(C);var Wt=rb(eb(P,"paint","text-halo-color",l,p,g,w),R);if(Wt){T.setColor(Wt),Dt*=2;var Ht=.5*At;T.setWidth(Dt<=Ht?Dt:Ht),V.setStroke(T)}else V.setStroke(void 0);var Kt=eb(P,"layout","text-padding",l,p,g,w),Jt=V.getPadding();Kt!==Jt[0]&&(Jt[0]=Kt,Jt[1]=Kt,Jt[2]=Kt,Jt[3]=Kt),z.setZIndex(G)}}}}return x>-1?(F.length=x+1,ab&&("function"==typeof e.set?e.set("mapbox-layer",c):e.getProperties()["mapbox-layer"]=c),F):void 0}};return t.setStyle(I),t.set("mapbox-source",c),t.set("mapbox-layers",p),t.set("mapbox-featurestate",{}),I}function lb(t,e){e.accessToken||(e=Object.assign({},e),new URL(t).searchParams.forEach((function(t,i){e.accessToken=t,e.accessTokenParam=i})));return e}function cb(t,e,i,n,s){var r,o,h;return void 0===i&&(i=""),void 0===n&&(n={}),void 0===s&&(s=void 0),"string"==typeof n?(r=n,h={}):(r=n.styleUrl,h=n),s||(s=h.resolutions),r||"string"!=typeof e||e.trim().startsWith("{")||(r=e),r&&(r=r.startsWith("data:")?location.href:Ex(r,h.accessToken),h=lb(r,h)),new Promise((function(n,a){Rx(e,h).then((function(e){if(8!=e.version)return a(new Error("glStyle version 8 required."));if(!(t instanceof Jv||t instanceof wg))return a(new Error("Can only apply to VectorLayer or VectorTileLayer"));var u,l,c,f=t instanceof wg?"vector":"geojson";if(i?o=Array.isArray(i)?e.layers.find((function(t){return t.id===i[0]})).source:i:(o=Object.keys(e.sources).find((function(t){return e.sources[t].type===f})),i=o),!o)return a(new Error("No "+f+" source found in the glStyle."));function d(){if(t instanceof wg)return vb(e.sources[o],r,h).then((function(e){var i=t.getSource();if(i?e!==i&&(i.setTileUrlFunction(e.getTileUrlFunction()),i.Os||(i.Os=e.Os),i.getAttributions()||i.setAttributions(e.getAttributions()),i.getTileLoadFunction()===Rp&&i.setTileLoadFunction(e.getTileLoadFunction()),tn(i.getProjection(),e.getProjection())&&(i.tileGrid=e.getTileGrid())):t.setSource(e),!isFinite(t.getMaxResolution())&&!isFinite(t.getMinZoom())){var n=t.getSource().getTileGrid();t.setMaxResolution(n.getResolution(n.getMinZoom()))}}));var i=e.sources[o],n=t.getSource();n&&n.get("mapbox-source")===i||(n=yb(i,r,h));var s=t.getSource();return s?n!==s&&(s.getAttributions()||s.setAttributions(n.getAttributions()),s.Os||(s.Os=n.getFormat()),s.Gs=n.getUrl()):t.setSource(n),Promise.resolve()}function p(){c||e.sprite&&!u?c?(t.setStyle(c),d().then(n).catch(a)):a(new Error("Something went wrong trying to apply style.")):(c=ub(t,e,i,s,u,l,Vx),t.getStyle()?d().then(n).catch(a):a(new Error("Nothing to show for source ["+o+"]")))}if(e.sprite){var m=new URL(function(t,e,i){var n=_x(t);if(!n)return decodeURI(new URL(t,i).href);var s="sprites/";if(0!==n.indexOf(s))throw new Error("unexpected sprites url: "+t);var r=n.slice(s.length);return Px+"/styles/v1/"+r+"/sprite?access_token="+e}(e.sprite,h.accessToken,r||location.href)),v=.5==(window.devicePixelRatio>=1.5?.5:1)?"@2x":"",g=m.origin+m.pathname+v+".json"+m.search;new Promise((function(t,e){kx("Sprite",g,h).then(t).catch((function(i){kx("Sprite",g=m.origin+m.pathname+".json"+m.search,h).then(t).catch(e)}))})).then((function(t){if(void 0===t&&a(new Error("No sprites found.")),u=t,l=m.origin+m.pathname+v+".png"+m.search,h.transformRequest){var e=h.transformRequest(l,"SpriteImage");e instanceof Request&&(l=encodeURI(e.url))}p()})).catch((function(t){a(new Error("Sprites cannot be loaded: "+g+": "+t.message))}))}else p()})).catch(a)}))}var fb={};function db(t,e){var i={id:e.id,type:e.type},n={};function s(s){var r=e.layout||{},o=e.paint||{};i.paint=o;var h,a,u="function"==typeof t.getSource?t.getSource().getTileGrid().getZForResolution(s):t.getView().getZoom(),l="function"==typeof t.getTargetElement?t.getTargetElement():void 0;if(void 0!==o["background-color"]&&(h=eb(i,"paint","background-color",u,fb,n),l&&(l.style.background=Ng.parse(h).toString())),void 0!==o["background-opacity"]&&(a=eb(i,"paint","background-opacity",u,fb,n),l&&(l.style.opacity=a)),"none"!=r.visibility)return rb(h,a);l&&(l.style.backgroundColor="",l.style.opacity="")}if("function"==typeof t.getTargetElement)t.getTargetElement()&&s(),t.on(["change:resolution","change:target"],s);else{if("function"!=typeof t.setBackground)throw new Error("Unable to apply background.");t.setBackground(s)}}function pb(t,e){e.layers.some((function(e){if("background"===e.type)return db(t,e),!0}))}function mb(t){var e=t.bounds;if(e){var i=Qi([e[0],e[1]]),n=Qi([e[2],e[3]]);return[i[0],i[1],n[0],n[1]]}}function vb(t,e,i){return new Promise((function(n,s){Nx(t,e,i).then((function(t){var e=new pm({tileJSON:t}),i=e.getTileJSON(),s=e.getTileGrid(),r=mb(i),o=i.minzoom||0,h=i.maxzoom||22,a={attributions:e.getAttributions(),format:new yg,tileGrid:new eu({origin:s.getOrigin(0),extent:r||s.getExtent(),minZoom:o,resolutions:Fx.slice(0,h+1),tileSize:512})};Array.isArray(i.tiles)?a.urls=i.tiles:a.url=i.tiles,t.olSourceOptions&&Object.assign(a,t.olSourceOptions),n(new kp(a))})).catch(s)}))}var gb=new Cg;function yb(t,e,i){var n=t.data,s={};if("string"==typeof n){var r=Tx(n,i.accessToken,i.accessTokenParam||"access_token",e||location.href);if(i.transformRequest){var o=i.transformRequest(r,"GeoJSON");o instanceof Request&&(r=encodeURI(o.url))}s.url=r}else s.features=gb.readFeatures(n,{featureProjection:an()||"EPSG:3857"});var h=new Sf(Object.assign({attributions:t.attribution,format:gb},s));return h.set("mapbox-source",t),h}class wb extends u{constructor(t){super(C),this.error=t}}var xb=class extends wg{constructor(t){const e=!("declutter"in t)||t.declutter,i=new kp({state:"loading",format:new yg});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);cb(this,t.styleUrl,t.layers||t.source,{accessToken:this.accessToken}).then((()=>{i.setState("ready")})).catch((t=>{this.dispatchEvent(new wb(t));this.getSource().setState("error")})),void 0===this.getBackground()&&function(t,e,i){void 0===i&&(i={}),"object"==typeof e?(pb(t,e),Promise.resolve()):Rx(e,i).then((function(e){pb(t,e)}))}(this,t.styleUrl,{accessToken:this.accessToken})}};var bb=class extends xm{constructor(t){t=t||{};const e=Object.assign({},t);delete e.imageRatio,super(e),this.jd=void 0!==t.imageRatio?t.imageRatio:1}getImageRatio(){return this.jd}createRenderer(){return new kv(this)}};var Mb=class extends kr{constructor(t){super(Object.assign({},t)),this.Dd=vc(t.style),this.Ud=t.style.variables||{},this.$d=!!t.disableHitDetection}createRenderer(){return new Am(this,{vertexShader:this.Dd.builder.getSymbolVertexShader(),fragmentShader:this.Dd.builder.getSymbolFragmentShader(),hitVertexShader:!this.$d&&this.Dd.builder.getSymbolVertexShader(!0),hitFragmentShader:!this.$d&&this.Dd.builder.getSymbolFragmentShader(!0),uniforms:this.Dd.uniforms,attributes:this.Dd.attributes})}updateStyleVariables(t){Object.assign(this.Ud,t),this.changed()}};function Sb(t,e){const i=`\n    attribute vec2 ${Al.TEXTURE_COORD};\n    uniform mat4 ${Il.TILE_TRANSFORM};\n    uniform float ${Il.TEXTURE_PIXEL_WIDTH};\n    uniform float ${Il.TEXTURE_PIXEL_HEIGHT};\n    uniform float ${Il.TEXTURE_RESOLUTION};\n    uniform float ${Il.TEXTURE_ORIGIN_X};\n    uniform float ${Il.TEXTURE_ORIGIN_Y};\n    uniform float ${Il.DEPTH};\n\n    varying vec2 v_textureCoord;\n    varying vec2 v_mapCoord;\n\n    void main() {\n      v_textureCoord = ${Al.TEXTURE_COORD};\n      v_mapCoord = vec2(\n        ${Il.TEXTURE_ORIGIN_X} + ${Il.TEXTURE_RESOLUTION} * ${Il.TEXTURE_PIXEL_WIDTH} * v_textureCoord[0],\n        ${Il.TEXTURE_ORIGIN_Y} - ${Il.TEXTURE_RESOLUTION} * ${Il.TEXTURE_PIXEL_HEIGHT} * v_textureCoord[1]\n      );\n      gl_Position = ${Il.TILE_TRANSFORM} * vec4(${Al.TEXTURE_COORD}, ${Il.DEPTH}, 1.0);\n    }\n  `,n={inFragmentShader:!0,variables:[],attributes:[],stringLiteralsMap:{},functions:{},bandCount:e},s=[];if(void 0!==t.color){const e=tc(n,t.color,Ul);s.push(`color = ${e};`)}if(void 0!==t.contrast){const e=tc(n,t.contrast,jl);s.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=tc(n,t.exposure,jl);s.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=tc(n,t.saturation,jl);s.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=tc(n,t.gamma,jl);s.push(`color.rgb = pow(color.rgb, vec3(1.0 / ${e}));`)}if(void 0!==t.brightness){const e=tc(n,t.brightness,jl);s.push(`color.rgb = clamp(color.rgb + ${e}, vec3(0.0, 0.0, 0.0), vec3(1.0, 1.0, 1.0));`)}const r={},o=n.variables.length;if(o>1&&!t.variables)throw new Error(`Missing variables in style (expected ${n.variables})`);for(let e=0;e<o;++e){const i=n.variables[e];if(!(i in t.variables))throw new Error(`Missing '${i}' in style variables`);r[lc(i)]=function(){let e=t.variables[i];return"string"==typeof e&&(e=Jl(n,e)),void 0!==e?e:-9999999}}const h=Object.keys(r).map((function(t){return`uniform float ${t};`})),a=Math.ceil(e/4);h.push(`uniform sampler2D ${Il.TILE_TEXTURE_ARRAY}[${a}];`),n.paletteTextures&&h.push(`uniform sampler2D u_paletteTextures[${n.paletteTextures.length}];`);const u=Object.keys(n.functions).map((function(t){return n.functions[t]}));return{vertexShader:i,fragmentShader:`\n    #ifdef GL_FRAGMENT_PRECISION_HIGH\n    precision highp float;\n    #else\n    precision mediump float;\n    #endif\n\n    varying vec2 v_textureCoord;\n    varying vec2 v_mapCoord;\n    uniform vec4 ${Il.RENDER_EXTENT};\n    uniform float ${Il.TRANSITION_ALPHA};\n    uniform float ${Il.TEXTURE_PIXEL_WIDTH};\n    uniform float ${Il.TEXTURE_PIXEL_HEIGHT};\n    uniform float ${Il.RESOLUTION};\n    uniform float ${Il.ZOOM};\n\n    ${h.join("\n")}\n\n    ${u.join("\n")}\n\n    void main() {\n      if (\n        v_mapCoord[0] < ${Il.RENDER_EXTENT}[0] ||\n        v_mapCoord[1] < ${Il.RENDER_EXTENT}[1] ||\n        v_mapCoord[0] > ${Il.RENDER_EXTENT}[2] ||\n        v_mapCoord[1] > ${Il.RENDER_EXTENT}[3]\n      ) {\n        discard;\n      }\n\n      vec4 color = texture2D(${Il.TILE_TEXTURE_ARRAY}[0],  v_textureCoord);\n\n      ${s.join("\n")}\n\n      if (color.a == 0.0) {\n        discard;\n      }\n\n      gl_FragColor = color;\n      gl_FragColor.rgb *= gl_FragColor.a;\n      gl_FragColor *= ${Il.TRANSITION_ALPHA};\n    }`,uniforms:r,paletteTextures:n.paletteTextures}}class Pb extends Xp{constructor(t){const e=(t=t?Object.assign({},t):{}).style||{};delete t.style;const i=t.cacheSize;delete t.cacheSize,super(t),this.Bd=t.sources,this.qd=null,this.ef=NaN,this.K=e,this.Qt=i,this.Ud=this.K.variables||{},this.addChangeListener(Sr,this.Xd)}getSources(t,e){const i=this.getSource();return this.Bd?"function"==typeof this.Bd?this.Bd(t,e):this.Bd:i?[i]:[]}getRenderSource(){return this.qd||this.getSource()}getSourceState(){const t=this.getRenderSource();return t?t.getState():"undefined"}Xd(){this.getSource()&&this.setStyle(this.K)}Yd(){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=Sb(this.K,this.Yd());return new Gl(this,{vertexShader:t.vertexShader,fragmentShader:t.fragmentShader,uniforms:t.uniforms,cacheSize:this.Qt,paletteTextures:t.paletteTextures})}renderSources(t,e){const i=this.getRenderer();let n;for(let s=0,r=e.length;s<r;++s)this.qd=e[s],i.prepareFrame(t)&&(n=i.renderFrame(t));return n}render(t,e){this.rendered=!0;const i=t.viewState,n=this.getSources(t.extent,i.resolution);let s=!0;for(let t=0,e=n.length;t<e;++t){const e=n[t],i=e.getState();if("loading"==i){const t=()=>{"ready"==e.getState()&&(e.removeEventListener("change",t),this.changed())};e.addEventListener("change",t)}s=s&&"ready"==i}const r=this.renderSources(t,n);if(this.getRenderer().renderComplete&&s)return this.ef=i.resolution,r;if(this.ef>.5*i.resolution){const e=this.getSources(t.extent,this.ef).filter((t=>!n.includes(t)));if(e.length>0)return this.renderSources(t,e)}return r}setStyle(t){this.Ud=t.variables||{},this.K=t;const e=Sb(this.K,this.Yd());this.getRenderer().reset({vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,paletteTextures:e.paletteTextures}),this.changed()}updateStyleVariables(t){Object.assign(this.Ud,t),this.changed()}}Pb.prototype.dispose;var _b=Pb;const Eb="addfeatures";class Tb extends u{constructor(t,e,i,n){super(t),this.features=i,this.file=e,this.projection=n}}var Cb=class extends mh{constructor(t){t=t||{},super({handleEvent:w}),this.on,this.once,this.un,this.Zd=!1,this.Vd=[];const e=t.formatConstructors?t.formatConstructors:[];for(let t=0,i=e.length;t<i;++t){let i=e[t];"function"==typeof i&&(i=new i),this.Vd.push(i),this.Zd=this.Zd||"arraybuffer"===i.getType()}this.fi=t.projection?Yi(t.projection):null,this.Wd=null,this.Hd=t.source||null,this.target=t.target?t.target:null}Kd(t,e){const i=e.target.result,n=this.getMap();let s,r=this.fi;if(!r&&(r=an(),!r)){r=n.getView().getProjection()}const o=this.Vd;for(let e=0,n=o.length;e<n;++e){const n=o[e];let h=i;this.Zd&&"arraybuffer"!==n.getType()&&(void 0===s&&(s=(new TextDecoder).decode(i)),h=s);const a=this.Jd(n,h,{featureProjection:r});if(a&&a.length>0){this.Hd&&(this.Hd.clear(),this.Hd.addFeatures(a)),this.dispatchEvent(new Tb(Eb,t,a,r));break}}}Qd(){const t=this.getMap();if(t){const e=this.target?this.target:t.getViewport();this.Wd=[U(e,L,this.handleDrop,this),U(e,k,this.handleStop,this),U(e,R,this.handleStop,this),U(e,L,this.handleStop,this)]}}setActive(t){!this.getActive()&&t&&this.Qd(),this.getActive()&&!t&&this.tp(),super.setActive(t)}setMap(t){this.tp(),super.setMap(t),this.getActive()&&this.Qd()}Jd(t,e,i){try{return t.readFeatures(e,i)}catch(t){return null}}tp(){this.Wd&&(this.Wd.forEach(B),this.Wd=null)}handleDrop(t){const e=t.dataTransfer.files;for(let t=0,i=e.length;t<i;++t){const i=e.item(t),n=new FileReader;n.addEventListener(z,this.Kd.bind(this,i)),this.Zd?n.readAsArrayBuffer(i):n.readAsText(i)}}handleStop(t){t.stopPropagation(),t.preventDefault(),t.dataTransfer.dropEffect="copy"}};var Fb=class extends yh{constructor(t){super(t=t||{}),this.an=t.condition?t.condition:Fh,this.fn=void 0,this.ep=void 0,this.$n=0,this.Hi=void 0!==t.duration?t.duration:400}handleDragEvent(t){if(!Ah(t))return;const e=t.map,i=e.getSize(),n=t.pixel,s=n[0]-i[0]/2,r=i[1]/2-n[1],o=Math.atan2(r,s),h=Math.sqrt(s*s+r*r),a=e.getView();if(void 0!==this.fn){const t=this.fn-o;a.adjustRotationInternal(t)}this.fn=o,void 0!==this.ep&&a.adjustResolutionInternal(this.ep/h),void 0!==this.ep&&(this.$n=this.ep/h),this.ep=h}handleUpEvent(t){if(!Ah(t))return!0;const e=t.map.getView(),i=this.$n>1?1:-1;return e.endInteraction(this.Hi,i),this.$n=0,!1}handleDownEvent(t){return!!Ah(t)&&(!!this.an(t)&&(t.map.getView().beginInteraction(),this.fn=void 0,this.ep=void 0,!0))}};class Ib extends _n{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 Ib(this.flatCoordinates.slice(),void 0,this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,n){const s=this.flatCoordinates,r=t-s[0],o=e-s[1],h=r*r+o*o;if(h<n){if(0===h)for(let t=0;t<this.stride;++t)i[t]=s[t];else{const t=this.getRadius()/Math.sqrt(h);i[0]=s[0]+t*r,i[1]=s[1]+t*o;for(let t=2;t<this.stride;++t)i[t]=s[t]}return i.length=this.stride,h}return n}containsXY(t,e){const i=this.flatCoordinates,n=t-i[0],s=e-i[1];return n*n+s*s<=this.ip()}getCenter(){return this.flatCoordinates.slice(0,this.stride)}computeExtent(t){const e=this.flatCoordinates,i=e[this.stride]-e[0];return ie(e[0]-i,e[1]-i,e[0]+i,e[1]+i,t)}getRadius(){return Math.sqrt(this.ip())}ip(){const t=this.flatCoordinates[this.stride]-this.flatCoordinates[0],e=this.flatCoordinates[this.stride+1]-this.flatCoordinates[1];return t*t+e*e}getType(){return"Circle"}intersectsExtent(t){if(Te(t,this.getExtent())){const e=this.getCenter();return t[0]<=e[0]&&t[2]>=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||pe(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<e;++i)n[e+i]=t[i];this.setFlatCoordinates(this.layout,n),this.changed()}setCenterAndRadius(t,e,i){this.setLayout(i,t,0),this.flatCoordinates||(this.flatCoordinates=[]);const n=this.flatCoordinates;let s=Rn(n,0,t,this.stride);n[s++]=n[0]+e;for(let t=1,e=this.stride;t<e;++t)n[s++]=n[t];n.length=s,this.changed()}getCoordinates(){return null}setCoordinates(t,e){}setRadius(t){this.flatCoordinates[this.stride]=this.flatCoordinates[0]+t,this.changed()}rotate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(yn(i,0,i.length,n,t,e,i)),this.changed()}translate(t,e){const i=this.getCenter(),n=this.getStride();this.setCenter(xn(i,0,i.length,n,t,e,i)),this.changed()}}Ib.prototype.transform;var Ab=Ib;const kb="drawstart",Rb="drawend",Lb="drawabort";class Nb extends u{constructor(t,e){super(t),this.feature=e}}function Ob(){const t=Dc();return function(e,i){return t[e.getGeometry().getType()]}}var zb=class extends yh{constructor(t){const e=t;e.stopDown||(e.stopDown=x),super(e),this.on,this.once,this.un,this.np=!1,this.sp=null,this.rp,this.op,this.hp,this.ap=!1,this.Hd=t.source?t.source:null,this.zs=t.features?t.features:null,this.up=t.snapTolerance?t.snapTolerance:12,this.Tf=t.type,this.An=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.Tf),this.lp=!!t.stopClick,this.cp=t.minPoints?t.minPoints:"Polygon"===this.An?3:2,this.fp="Circle"===this.An?2:t.maxPoints?t.maxPoints:1/0,this.dp=t.finishCondition?t.finishCondition:w,this.pp=t.geometryLayout?t.geometryLayout:"XY";let i=t.geometryFunction;if(!i){const t=this.An;if("Circle"===t)i=function(t,e,i){const n=e||new Ab([NaN,NaN]),s=ln(t[0],i),r=Fi(s,ln(t[t.length-1],i));n.setCenterAndRadius(s,Math.sqrt(r),this.pp);const o=an();return o&&n.transform(i,o),n};else{let e;"Point"===t?e=Qn:"LineString"===t?e=$v:"Polygon"===t&&(e=xs),i=function(i,n,s){return n?"Polygon"===t?i[0].length?n.setCoordinates([i[0].concat([i[0][0]])],this.pp):n.setCoordinates([],this.pp):n.setCoordinates(i,this.pp):n=new e(i,this.pp),n}}}this.Zh=i,this.mp=void 0!==t.dragVertexDelay?t.dragVertexDelay:500,this.vp=null,this.gp=null,this.yp=null,this.wp=null,this.xp=null,this.bp=null,this.Mp=t.clickTolerance?t.clickTolerance*t.clickTolerance:36,this.Sp=new Jv({source:new Sf({useSpatialIndex:!1,wrapX:!!t.wrapX&&t.wrapX}),style:t.style?t.style:Ob(),updateWhileInteracting:!0}),this.H=t.geometryName,this.an=t.condition?t.condition:Ch,this.Pp,t.freehand?this.Pp=Ph:this.Pp=t.freehandCondition?t.freehandCondition:Fh,this.addChangeListener(fh,this._p)}setMap(t){super.setMap(t),this._p()}getOverlay(){return this.Sp}handleEvent(t){t.originalEvent.type===F&&t.originalEvent.preventDefault(),this.ap="Point"!==this.An&&this.Pp(t);let e=t.type===xo.POINTERMOVE,i=!0;if(!this.ap&&this.op&&t.type===xo.POINTERDRAG){Date.now()-this.op>=this.mp?(this.sp=t.pixel,this.np=!this.ap,e=!0):this.op=void 0,this.np&&void 0!==this.rp&&(clearTimeout(this.rp),this.rp=void 0)}return this.ap&&t.type===xo.POINTERDRAG&&null!==this.gp?(this.Ep(t.coordinate),i=!1):this.ap&&t.type===xo.POINTERDOWN?i=!1:e&&this.getPointerCount()<2?(i=t.type===xo.POINTERMOVE,i&&this.ap?(this.Ye(t),this.np&&t.originalEvent.preventDefault()):("mouse"===t.originalEvent.pointerType||t.type===xo.POINTERDRAG&&void 0===this.rp)&&this.Ye(t)):t.type===xo.DBLCLICK&&(i=!1),super.handleEvent(t)&&i}handleDownEvent(t){return this.np=!this.ap,this.ap?(this.sp=t.pixel,this.vp||this.Tp(t.coordinate),!0):this.an(t)?(this.op=Date.now(),this.rp=setTimeout(function(){this.Ye(new wo(xo.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.mp),this.sp=t.pixel,!0):(this.op=void 0,!1)}handleUpEvent(t){let e=!0;if(0===this.getPointerCount())if(this.rp&&(clearTimeout(this.rp),this.rp=void 0),this.Ye(t),this.np){const i=!this.vp;i&&this.Tp(t.coordinate),!i&&this.ap?this.finishDrawing():this.ap||i&&"Point"!==this.An||(this.Cp(t.pixel)?this.dp(t)&&this.finishDrawing():this.Ep(t.coordinate)),e=!1}else this.ap&&this.abortDrawing();return!e&&this.lp&&t.preventDefault(),e}Ye(t){if(this.hp=t.originalEvent.pointerType,this.sp&&(!this.ap&&this.np||this.ap&&!this.np)){const e=this.sp,i=t.pixel,n=e[0]-i[0],s=e[1]-i[1],r=n*n+s*s;if(this.np=this.ap?r>this.Mp:r<=this.Mp,!this.np)return}this.vp?this.Fp(t.coordinate):this.Ip(t.coordinate.slice())}Cp(t){let e=!1;if(this.gp){let i=!1,n=[this.vp];const s=this.An;if("Point"===s)e=!0;else if("Circle"===s)e=2===this.wp.length;else if("LineString"===s)i=this.wp.length>this.cp;else if("Polygon"===s){const t=this.wp;i=t[0].length>this.cp,n=[t[0][0],t[0][t[0].length-2]]}if(i){const i=this.getMap();for(let s=0,r=n.length;s<r;s++){const r=n[s],o=i.getPixelFromCoordinate(r),h=t[0]-o[0],a=t[1]-o[1],u=this.ap?1:this.up;if(e=Math.sqrt(h*h+a*a)<=u,e){this.vp=r;break}}}}return e}Ip(t){if(this.yp){this.yp.getGeometry().setCoordinates(t)}else this.yp=new pt(new Qn(t)),this.Ap()}kp(t){this.xp||(this.xp=new pt);const e=t.getLinearRing(0);let i=this.xp.getGeometry();i?(i.setFlatCoordinates(e.getLayout(),e.getFlatCoordinates()),i.changed()):(i=new $v(e.getFlatCoordinates(),e.getLayout()),this.xp.setGeometry(i))}Tp(t){const e=this.getMap().getView().getProjection(),i=Sn(this.pp);for(;t.length<i;)t.push(0);this.vp=t,"Point"===this.An?this.wp=t.slice():"Polygon"===this.An?(this.wp=[[t.slice(),t.slice()]],this.bp=this.wp[0]):this.wp=[t.slice(),t.slice()],this.bp&&(this.xp=new pt(new $v(this.bp)));const n=this.Zh(this.wp,void 0,e);this.gp=new pt,this.H&&this.gp.setGeometryName(this.H),this.gp.setGeometry(n),this.Ap(),this.dispatchEvent(new Nb(kb,this.gp))}Fp(t){const e=this.getMap(),i=this.gp.getGeometry(),n=e.getView().getProjection(),s=Sn(this.pp);let r,o;for(;t.length<s;)t.push(0);if("Point"===this.An?o=this.wp:"Polygon"===this.An?(r=this.wp[0],o=r[r.length-1],this.Cp(e.getPixelFromCoordinate(t))&&(t=this.vp.slice())):(r=this.wp,o=r[r.length-1]),o[0]=t[0],o[1]=t[1],this.Zh(this.wp,i,n),this.yp){this.yp.getGeometry().setCoordinates(t)}if("Polygon"===i.getType()&&"Polygon"!==this.An)this.kp(i);else if(this.bp){this.xp.getGeometry().setCoordinates(this.bp)}this.Ap()}Ep(t){const e=this.gp.getGeometry(),i=this.getMap().getView().getProjection();let n,s;const r=this.An;"LineString"===r||"Circle"===r?(this.vp=t.slice(),s=this.wp,s.length>=this.fp&&(this.ap?s.pop():n=!0),s.push(t.slice()),this.Zh(s,e,i)):"Polygon"===r&&(s=this.wp[0],s.length>=this.fp&&(this.ap?s.pop():n=!0),s.push(t.slice()),n&&(this.vp=s[0]),this.Zh(this.wp,e,i)),this.Ip(t.slice()),this.Ap(),n&&this.finishDrawing()}removeLastPoint(){if(!this.gp)return;const t=this.gp.getGeometry(),e=this.getMap().getView().getProjection();let i;const n=this.An;if("LineString"===n||"Circle"===n){if(i=this.wp,i.splice(-2,1),i.length>=2){this.vp=i[i.length-2].slice();const t=this.vp.slice();i[i.length-1]=t,this.Ip(t)}this.Zh(i,t,e),"Polygon"===t.getType()&&this.xp&&this.kp(t)}else if("Polygon"===n){i=this.wp[0],i.splice(-2,1);const n=this.xp.getGeometry();if(i.length>=2){const t=i[i.length-2].slice();i[i.length-1]=t,this.Ip(t)}n.setCoordinates(i),this.Zh(this.wp,t,e)}1===i.length&&this.abortDrawing(),this.Ap()}finishDrawing(){const t=this.Rp();if(!t)return;let e=this.wp;const i=t.getGeometry(),n=this.getMap().getView().getProjection();"LineString"===this.An?(e.pop(),this.Zh(e,i,n)):"Polygon"===this.An&&(e[0].pop(),this.Zh(e,i,n),e=i.getCoordinates()),"MultiPoint"===this.Tf?t.setGeometry(new zv([e])):"MultiLineString"===this.Tf?t.setGeometry(new qv([e])):"MultiPolygon"===this.Tf&&t.setGeometry(new Zv([e])),this.dispatchEvent(new Nb(Rb,t)),this.zs&&this.zs.push(t),this.Hd&&this.Hd.addFeature(t)}Rp(){this.vp=null;const t=this.gp;return this.gp=null,this.yp=null,this.xp=null,this.Sp.getSource().clear(!0),t}abortDrawing(){const t=this.Rp();t&&this.dispatchEvent(new Nb(Lb,t))}appendCoordinates(t){const e=this.An,i=!this.gp;let n;if(i&&this.Tp(t[0]),"LineString"===e||"Circle"===e)n=this.wp;else{if("Polygon"!==e)return;n=this.wp&&this.wp.length?this.wp[0]:[]}i&&n.shift(),n.pop();for(let e=0;e<t.length;e++)this.Ep(t[e]);const s=t[t.length-1];this.Ep(s),this.Fp(s)}extend(t){const e=t.getGeometry();this.gp=t,this.wp=e.getCoordinates();const i=this.wp[this.wp.length-1];this.vp=i.slice(),this.wp.push(i.slice()),this.yp=new pt(new Qn(i)),this.Ap(),this.dispatchEvent(new Nb(kb,this.gp))}Ap(){const t=[];this.gp&&t.push(this.gp),this.xp&&t.push(this.xp),this.yp&&t.push(this.yp);const e=this.Sp.getSource();e.clear(!0),e.addFeatures(t)}_p(){const t=this.getMap(),e=this.getActive();t&&e||this.abortDrawing(),this.Sp.setMap(e?t:null)}};const Gb="extentchanged";class jb extends u{constructor(t){super(Gb),this.extent=t}}function Db(){const t=Dc();return function(e,i){return t.Polygon}}function Ub(){const t=Dc();return function(e,i){return t.Point}}function $b(t){return function(e){return Zt([t,e])}}function Bb(t,e){return t[0]==e[0]?function(i){return Zt([t,[i[0],e[1]]])}:t[1]==e[1]?function(i){return Zt([t,[e[0],i[1]]])}:null}var qb=class extends yh{constructor(t){super(t=t||{}),this.on,this.once,this.un,this.an=t.condition?t.condition:Ph,this.ot=null,this.Lp=null,this.Np=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.Op=!1,this.zp=null,this.Gp=null,t||(t={}),this.jp=new Jv({source:new Sf({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.boxStyle?t.boxStyle:Db(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.Dp=new Jv({source:new Sf({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.pointerStyle?t.pointerStyle:Ub(),updateWhileAnimating:!0,updateWhileInteracting:!0}),t.extent&&this.setExtent(t.extent)}Up(t,e){const i=e.getCoordinateFromPixelInternal(t),n=function(t,e){return Ai(i,t)-Ai(i,e)},s=this.getExtentInternal();if(s){const r=function(t){return[[[t[0],t[1]],[t[0],t[3]]],[[t[0],t[3]],[t[2],t[3]]],[[t[2],t[3]],[t[2],t[1]]],[[t[2],t[1]],[t[0],t[1]]]]}(s);r.sort(n);const o=r[0];let h=Si(i,o);const a=e.getPixelFromCoordinateInternal(h);if(Ii(t,a)<=this.Np){const t=e.getPixelFromCoordinateInternal(o[0]),i=e.getPixelFromCoordinateInternal(o[1]),n=Fi(a,t),s=Fi(a,i),r=Math.sqrt(Math.min(n,s));return this.Op=r<=this.Np,this.Op&&(h=n>s?o[1]:o[0]),h}}return null}Ye(t){const e=t.pixel,i=t.map;let n=this.Up(e,i);n||(n=i.getCoordinateFromPixelInternal(e)),this.$p(n)}Bp(t){let e=this.zp;return e?t?e.setGeometry(Ms(t)):e.setGeometry(void 0):(e=new pt(t?Ms(t):{}),this.zp=e,this.jp.getSource().addFeature(e)),e}$p(t){let e=this.Gp;if(e){e.getGeometry().setCoordinates(t)}else e=new pt(new Qn(t)),this.Gp=e,this.Dp.getSource().addFeature(e);return e}handleEvent(t){return!t.originalEvent||!this.an(t)||(t.type!=xo.POINTERMOVE||this.handlingDownUpSequence||this.Ye(t),super.handleEvent(t),!1)}handleDownEvent(t){const e=t.pixel,i=t.map,n=this.getExtentInternal();let s=this.Up(e,i);const r=function(t){let e=null,i=null;return t[0]==n[0]?e=n[2]:t[0]==n[2]&&(e=n[0]),t[1]==n[1]?i=n[3]:t[1]==n[3]&&(i=n[1]),null!==e&&null!==i?[e,i]:null};if(s&&n){const t=s[0]==n[0]||s[0]==n[2]?s[0]:null,e=s[1]==n[1]||s[1]==n[3]?s[1]:null;null!==t&&null!==e?this.Lp=$b(r(s)):null!==t?this.Lp=Bb(r([t,n[1]]),r([t,n[3]])):null!==e&&(this.Lp=Bb(r([n[0],e]),r([n[2],e])))}else s=i.getCoordinateFromPixelInternal(e),this.setExtent([s[0],s[1],s[0],s[1]]),this.Lp=$b(s);return!0}handleDragEvent(t){if(this.Lp){const e=t.coordinate;this.setExtent(this.Lp(e)),this.$p(e)}}handleUpEvent(t){this.Lp=null;const e=this.getExtentInternal();return e&&0!==me(e)||this.setExtent(null),!1}setMap(t){this.jp.setMap(t),this.Dp.setMap(t),super.setMap(t)}getExtent(){return cn(this.getExtentInternal(),this.getMap().getView().getProjection())}getExtentInternal(){return this.ot}setExtent(t){this.ot=t||null,this.Bp(t),this.dispatchEvent(new jb(this.ot))}};function Xb(t){return parseFloat(t)}function Yb(t){return function(t){return mi(t,5)}(t).toString()}function Zb(t,e){return!isNaN(t)&&t!==Xb(Yb(e))}var Vb=class extends mh{constructor(t){let e;super(),e=!0===(t=Object.assign({animate:!0,replace:!1,prefix:""},t||{})).animate?{duration:250}:t.animate?t.animate:null,this.qp=e,this.Xp=t.replace,this.Yp=t.prefix,this.ve=[],this.Zp=!0,this._p=this._p.bind(this)}Vp(t){return this.Yp?this.Yp+t:t}Wp(t,e){return t.get(this.Vp(e))}Hp(t,e,i){t.set(this.Vp(e),i)}Kp(t,e){t.delete(this.Vp(e))}setMap(t){const e=this.getMap();super.setMap(t),t!==e&&(e&&this.tp(e),t&&(this.Zp=!0,this._p(),this.Qd(t)))}Qd(t){this.ve.push(U(t,Co,this.Jp,this),U(t.getLayerGroup(),T,this.Jp,this),U(t,"change:layergroup",this.Qp,this)),this.Xp||addEventListener("popstate",this._p)}tp(t){for(let t=0,e=this.ve.length;t<e;++t)B(this.ve[t]);this.ve.length=0,this.Xp||removeEventListener("popstate",this._p);const e=new URL(window.location.href),i=e.searchParams;this.Kp(i,"x"),this.Kp(i,"y"),this.Kp(i,"z"),this.Kp(i,"r"),this.Kp(i,"l"),window.history.replaceState(null,"",e)}Qp(){const t=this.getMap();t&&(this.tp(t),this.Qd(t),this.Zp=!0,this.Jp())}_p(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=new URL(window.location.href).searchParams;let n=!1;const s={},r=Xb(this.Wp(i,"z"));Zb(r,e.getZoom())&&(n=!0,s.zoom=r);const o=Xb(this.Wp(i,"r"));Zb(o,e.getRotation())&&(n=!0,s.rotation=o);const h=[Xb(this.Wp(i,"x")),Xb(this.Wp(i,"y"))];var a,u;a=h,u=e.getCenter(),(Zb(a[0],u[0])||Zb(a[1],u[1]))&&(n=!0,s.center=h),n&&(!this.Zp&&this.qp?e.animate(Object.assign(s,this.qp)):(s.center&&e.setCenter(s.center),"zoom"in s&&e.setZoom(s.zoom),"rotation"in s&&e.setRotation(s.rotation)));const l=t.getAllLayers(),c=this.Wp(i,"l");if(c&&c.length===l.length)for(let t=0,e=l.length;t<e;++t){const e=parseInt(c[t]);if(!isNaN(e)){const i=Boolean(e),n=l[t];n.getVisible()!==i&&n.setVisible(i)}}}Jp(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=this.Zp;this.Zp=!1;const n=e.getCenter(),s=e.getZoom(),r=e.getRotation(),o=t.getAllLayers(),h=new Array(o.length);for(let t=0,e=o.length;t<e;++t)h[t]=o[t].getVisible()?"1":"0";const a=new URL(window.location.href),u=a.searchParams;this.Hp(u,"x",Yb(n[0])),this.Hp(u,"y",Yb(n[1])),this.Hp(u,"z",Yb(s)),this.Hp(u,"r",Yb(r)),this.Hp(u,"l",h.join("")),a.href!==window.location.href&&(i||this.Xp?window.history.replaceState(null,"",a):window.history.pushState(null,"",a))}};const Wb=[0,0,0,0],Hb=[],Kb="modifystart",Jb="modifyend";class Qb extends u{constructor(t,e,i){super(t),this.features=e,this.mapBrowserEvent=i}}function tM(t,e){return t.index-e.index}function eM(t,e,i){const n=e.geometry;if("Circle"===n.getType()){let s=n;if(1===e.index){const e=an();e&&(s=s.clone().transform(e,i));const n=Fi(s.getCenter(),ln(t,i)),r=Math.sqrt(n)-s.getRadius();return r*r}}const s=ln(t,i);return Hb[0]=ln(e.segment[0],i),Hb[1]=ln(e.segment[1],i),Ai(s,Hb)}function iM(t,e,i){const n=e.geometry;if("Circle"===n.getType()&&1===e.index){let e=n;const s=an();return s&&(e=e.clone().transform(s,i)),un(e.getClosestPoint(ln(t,i)),i)}const s=ln(t,i);return Hb[0]=ln(e.segment[0],i),Hb[1]=ln(e.segment[1],i),un(Si(s,Hb),i)}function nM(){const t=Dc();return function(e,i){return t.Point}}var sM=class extends yh{constructor(t){let e;if(super(t),this.on,this.once,this.un,this.tm=this.Qa.bind(this),this.an=t.condition?t.condition:kh,this.im=function(t){return xh(t)&&Th(t)},this.nm=t.deleteCondition?t.deleteCondition:this.im,this.sm=t.insertVertexCondition?t.insertVertexCondition:Ph,this.Gp=null,this.rm=null,this.om=[0,0],this.hm=!1,this.am=null,this.um=new Jc,this.Np=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.Op=!1,this.lm=!1,this.fm=[],this.Sp=new Jv({source:new Sf({useSpatialIndex:!1,wrapX:!!t.wrapX}),style:t.style?t.style:nM(),updateWhileAnimating:!0,updateWhileInteracting:!0}),this.dm={Point:this.pm.bind(this),LineString:this.vm.bind(this),LinearRing:this.vm.bind(this),Polygon:this.gm.bind(this),MultiPoint:this.ym.bind(this),MultiLineString:this.wm.bind(this),MultiPolygon:this.xm.bind(this),Circle:this.bm.bind(this),GeometryCollection:this.Mm.bind(this)},this.Hd=null,this.Sm=null,t.features?e=t.features:t.source&&(this.Hd=t.source,e=new Q(this.Hd.getFeatures()),this.Hd.addEventListener(mf,this.Pm.bind(this)),this.Hd.addEventListener(yf,this._m.bind(this))),!e)throw new Error("The modify interaction requires features, a source or a layer");t.hitDetection&&(this.Sm=t.hitDetection),this.zs=e,this.zs.forEach(this.Em.bind(this)),this.zs.addEventListener(W,this.Tm.bind(this)),this.zs.addEventListener(H,this.Cm.bind(this)),this.Fm=null,this.en=[0,0],this.Im=void 0===t.snapToPointer?!this.Sm:t.snapToPointer}Em(t){const e=t.getGeometry();if(e){const i=this.dm[e.getType()];i&&i(t,e)}const i=this.getMap();i&&i.isRendered()&&this.getActive()&&this.Am(this.om,i),t.addEventListener(T,this.tm)}km(t,e){if(!this.am){this.am=new Q;const i=this.am.getArray();for(let t=0,n=e.length;t<n;++t){const n=e[t];for(let t=0,e=n.length;t<e;++t){const e=n[t].feature;e&&!i.includes(e)&&this.am.push(e)}}0===this.am.getLength()?this.am=null:this.dispatchEvent(new Qb(Kb,this.am,t))}}Rm(t){this.Lm(t),this.Gp&&0===this.zs.getLength()&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null),t.removeEventListener(T,this.tm)}Lm(t){const e=this.um,i=[];e.forEach((function(e){t===e.feature&&i.push(e)}));for(let t=i.length-1;t>=0;--t){const n=i[t];for(let t=this.fm.length-1;t>=0;--t)this.fm[t][0]===n&&this.fm.splice(t,1);e.remove(n)}}setActive(t){this.Gp&&!t&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null),super.setActive(t)}setMap(t){this.Sp.setMap(t),super.setMap(t)}getOverlay(){return this.Sp}Pm(t){t.feature&&this.zs.push(t.feature)}_m(t){t.feature&&this.zs.remove(t.feature)}Tm(t){this.Em(t.element)}Qa(t){if(!this.lm){const e=t.target;this.Rm(e),this.Em(e)}}Cm(t){this.Rm(t.element)}pm(t,e){const i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.um.insert(e.getExtent(),n)}ym(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n],r={feature:t,geometry:e,depth:[n],index:n,segment:[s,s]};this.um.insert(e.getExtent(),r)}}vm(t,e){const i=e.getCoordinates();for(let n=0,s=i.length-1;n<s;++n){const s=i.slice(n,n+2),r={feature:t,geometry:e,index:n,segment:s};this.um.insert(Zt(s),r)}}wm(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length-1;i<r;++i){const r=s.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:r};this.um.insert(Zt(r),o)}}}gm(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length-1;i<r;++i){const r=s.slice(i,i+2),o={feature:t,geometry:e,depth:[n],index:i,segment:r};this.um.insert(Zt(r),o)}}}xm(t,e){const i=e.getCoordinates();for(let n=0,s=i.length;n<s;++n){const s=i[n];for(let i=0,r=s.length;i<r;++i){const r=s[i];for(let s=0,o=r.length-1;s<o;++s){const o=r.slice(s,s+2),h={feature:t,geometry:e,depth:[i,n],index:s,segment:o};this.um.insert(Zt(o),h)}}}}bm(t,e){const i=e.getCenter(),n={feature:t,geometry:e,index:0,segment:[i,i]},s={feature:t,geometry:e,index:1,segment:[i,i]},r=[n,s];n.featureSegments=r,s.featureSegments=r,this.um.insert(se(i),n);let o=e;const h=an();if(h&&this.getMap()){const t=this.getMap().getView().getProjection();o=o.clone().transform(h,t),o=Ss(o).transform(t,h)}this.um.insert(o.getExtent(),s)}Mm(t,e){const i=e.getGeometriesArray();for(let e=0;e<i.length;++e){const n=i[e];(0,this.dm[n.getType()])(t,n)}}Nm(t,e,i){let n=this.Gp;if(n){n.getGeometry().setCoordinates(t)}else n=new pt(new Qn(t)),this.Gp=n,this.Sp.getSource().addFeature(n);return n.set("features",e),n.set("geometries",i),n}handleEvent(t){if(!t.originalEvent)return!0;let e;return this.Fm=t,t.map.getView().getInteracting()||t.type!=xo.POINTERMOVE||this.handlingDownUpSequence||this.Ye(t),this.Gp&&this.nm(t)&&(e=!(t.type!=xo.SINGLECLICK||!this.hm)||this.removePoint()),t.type==xo.SINGLECLICK&&(this.hm=!1),super.handleEvent(t)&&!e}handleDragEvent(t){this.hm=!1,this.km(t,this.fm);const e=[t.coordinate[0]+this.en[0],t.coordinate[1]+this.en[1]],i=[],n=[];for(let s=0,r=this.fm.length;s<r;++s){const r=this.fm[s],o=r[0],h=o.feature;i.includes(h)||i.push(h);const a=o.geometry;n.includes(a)||n.push(a);const u=o.depth;let l;const c=o.segment,f=r[1];for(;e.length<a.getStride();)e.push(c[f][e.length]);switch(a.getType()){case"Point":l=e,c[0]=e,c[1]=e;break;case"MultiPoint":l=a.getCoordinates(),l[o.index]=e,c[0]=e,c[1]=e;break;case"LineString":l=a.getCoordinates(),l[o.index+f]=e,c[f]=e;break;case"MultiLineString":case"Polygon":l=a.getCoordinates(),l[u[0]][o.index+f]=e,c[f]=e;break;case"MultiPolygon":l=a.getCoordinates(),l[u[1]][u[0]][o.index+f]=e,c[f]=e;break;case"Circle":if(c[0]=e,c[1]=e,0===o.index)this.lm=!0,a.setCenter(e),this.lm=!1;else{this.lm=!0;const i=t.map.getView().getProjection();let n=Ii(ln(a.getCenter(),i),ln(e,i));const s=an();if(s){const t=a.clone().transform(s,i);t.setRadius(n),n=t.transform(i,s).getRadius()}a.setRadius(n),this.lm=!1}}l&&this.Om(a,l)}this.Nm(e,i,n)}handleDownEvent(t){if(!this.an(t))return!1;const e=t.coordinate;this.Am(t.pixel,t.map,e),this.fm.length=0,this.am=null;const n=this.Gp;if(n){const s=t.map.getView().getProjection(),r=[],o=n.getGeometry().getCoordinates(),h=Zt([o]),a=this.um.getInExtent(h),u={};a.sort(tM);for(let n=0,h=a.length;n<h;++n){const h=a[n],l=h.segment;let c=i(h.geometry);const f=h.depth;if(f&&(c+="-"+f.join("-")),u[c]||(u[c]=new Array(2)),"Circle"!==h.geometry.getType()||1!==h.index)if(!Ei(l[0],o)||u[c][0])if(!Ei(l[1],o)||u[c][1])i(l)in this.rm&&!u[c][0]&&!u[c][1]&&this.sm(t)&&r.push(h);else{if(u[c][0]&&0===u[c][0].index){let t=h.geometry.getCoordinates();switch(h.geometry.getType()){case"LineString":case"MultiLineString":continue;case"MultiPolygon":t=t[f[1]];case"Polygon":if(h.index!==t[f[0]].length-2)continue}}this.fm.push([h,1]),u[c][1]=h}else this.fm.push([h,0]),u[c][0]=h;else{Ei(iM(e,h,s),o)&&!u[c][0]&&(this.fm.push([h,0]),u[c][0]=h)}}r.length&&this.km(t,[r]);for(let t=r.length-1;t>=0;--t)this.zm(r[t],o)}return!!this.Gp}handleUpEvent(t){for(let e=this.fm.length-1;e>=0;--e){const i=this.fm[e][0],n=i.geometry;if("Circle"===n.getType()){const e=n.getCenter(),s=i.featureSegments[0],r=i.featureSegments[1];s.segment[0]=e,s.segment[1]=e,r.segment[0]=e,r.segment[1]=e,this.um.update(se(e),s);let o=n;const h=an();if(h){const e=t.map.getView().getProjection();o=o.clone().transform(h,e),o=Ss(o).transform(e,h)}this.um.update(o.getExtent(),r)}else this.um.update(Zt(i.segment),i)}return this.am&&(this.dispatchEvent(new Qb(Jb,this.am,t)),this.am=null),!1}Ye(t){this.om=t.pixel,this.Am(t.pixel,t.map,t.coordinate)}Am(t,e,n){const s=n||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),o=function(t,e){return eM(s,t,r)-eM(s,e,r)};let h,a;if(this.Sm){const i="object"==typeof this.Sm?t=>t===this.Sm:void 0;e.forEachFeatureAtPixel(t,((t,e,i)=>{if("Point"===(i=i||t.getGeometry()).getType()&&this.zs.getArray().includes(t)){a=i;const e=i.getFlatCoordinates().slice(0,2);h=[{feature:t,geometry:i,segment:[e,e]}]}return!0}),{layerFilter:i})}if(!h){const t=cn(Vt(fn(se(s,Wb),r),e.getView().getResolution()*this.Np,Wb),r);h=this.um.getInExtent(t)}if(h&&h.length>0){const n=h.sort(o)[0],u=n.segment;let l=iM(s,n,r);const c=e.getPixelFromCoordinate(l);let f=Ii(t,c);if(a||f<=this.Np){const t={};if(t[i(u)]=!0,this.Im||(this.en[0]=l[0]-s[0],this.en[1]=l[1]-s[1]),"Circle"===n.geometry.getType()&&1===n.index)this.Op=!0,this.Nm(l,[n.feature],[n.geometry]);else{const s=e.getPixelFromCoordinate(u[0]),r=e.getPixelFromCoordinate(u[1]),o=Fi(c,s),a=Fi(c,r);f=Math.sqrt(Math.min(o,a)),this.Op=f<=this.Np,this.Op&&(l=o>a?u[1]:u[0]),this.Nm(l,[n.feature],[n.geometry]);const d={};d[i(n.geometry)]=!0;for(let e=1,n=h.length;e<n;++e){const n=h[e].segment;if(!(Ei(u[0],n[0])&&Ei(u[1],n[1])||Ei(u[0],n[1])&&Ei(u[1],n[0])))break;{const s=i(h[e].geometry);s in d||(d[s]=!0,t[i(n)]=!0)}}}return void(this.rm=t)}}this.Gp&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null)}zm(t,e){const i=t.segment,n=t.feature,s=t.geometry,r=t.depth,o=t.index;let h;for(;e.length<s.getStride();)e.push(0);switch(s.getType()){case"MultiLineString":case"Polygon":h=s.getCoordinates(),h[r[0]].splice(o+1,0,e);break;case"MultiPolygon":h=s.getCoordinates(),h[r[1]][r[0]].splice(o+1,0,e);break;case"LineString":h=s.getCoordinates(),h.splice(o+1,0,e);break;default:return}this.Om(s,h);const a=this.um;a.remove(t),this.Gm(s,o,r,1);const u={segment:[i[0],e],feature:n,geometry:s,depth:r,index:o};a.insert(Zt(u.segment),u),this.fm.push([u,1]);const l={segment:[e,i[1]],feature:n,geometry:s,depth:r,index:o+1};a.insert(Zt(l.segment),l),this.fm.push([l,0]),this.hm=!0}removePoint(){if(this.Fm&&this.Fm.type!=xo.POINTERDRAG){const t=this.Fm;this.km(t,this.fm);const e=this.jm();return this.am&&this.dispatchEvent(new Qb(Jb,this.am,t)),this.am=null,e}return!1}jm(){const t=this.fm,e={};let n,s,r,o,h,a,u,l,c,f,d,p=!1;for(h=t.length-1;h>=0;--h)r=t[h],f=r[0],d=i(f.feature),f.depth&&(d+="-"+f.depth.join("-")),d in e||(e[d]={}),0===r[1]?(e[d].right=f,e[d].index=f.index):1==r[1]&&(e[d].left=f,e[d].index=f.index+1);for(d in e){switch(c=e[d].right,u=e[d].left,a=e[d].index,l=a-1,f=void 0!==u?u:c,l<0&&(l=0),o=f.geometry,s=o.getCoordinates(),n=s,p=!1,o.getType()){case"MultiLineString":s[f.depth[0]].length>2&&(s[f.depth[0]].splice(a,1),p=!0);break;case"LineString":s.length>2&&(s.splice(a,1),p=!0);break;case"MultiPolygon":n=n[f.depth[1]];case"Polygon":n=n[f.depth[0]],n.length>4&&(a==n.length-1&&(a=0),n.splice(a,1),p=!0,0===a&&(n.pop(),n.push(n[0]),l=n.length-1))}if(p){this.Om(o,s);const e=[];if(void 0!==u&&(this.um.remove(u),e.push(u.segment[0])),void 0!==c&&(this.um.remove(c),e.push(c.segment[1])),void 0!==u&&void 0!==c){const t={depth:f.depth,feature:f.feature,geometry:f.geometry,index:l,segment:e};this.um.insert(Zt(t.segment),t)}this.Gm(o,a,f.depth,-1),this.Gp&&(this.Sp.getSource().removeFeature(this.Gp),this.Gp=null),t.length=0}}return p}Om(t,e){this.lm=!0,t.setCoordinates(e),this.lm=!1}Gm(t,e,i,n){this.um.forEachInExtent(t.getExtent(),(function(s){s.geometry===t&&(void 0===i||void 0===s.depth||g(s.depth,i))&&s.index>e&&(s.index+=n)}))}};const rM="select";class oM extends u{constructor(t,e,i,n){super(t),this.selected=e,this.deselected=i,this.mapBrowserEvent=n}}const hM={};class aM extends mh{constructor(t){let e;if(super(),this.on,this.once,this.un,t=t||{},this.Dm=this.Em.bind(this),this.Um=this.Rm.bind(this),this.an=t.condition?t.condition:Th,this.$m=t.addCondition?t.addCondition:Eh,this.Bm=t.removeCondition?t.removeCondition:Eh,this.qm=t.toggleCondition?t.toggleCondition:Fh,this.Xm=!!t.multi&&t.multi,this.Ym=t.filter?t.filter:w,this.Zm=t.hitTolerance?t.hitTolerance:0,this.K=void 0!==t.style?t.style:function(){const t=Dc();return v(t.Polygon,t.LineString),v(t.GeometryCollection,t.LineString),function(e){return e.getGeometry()?t[e.getGeometry().getType()]:null}}(),this.zs=t.features||new Q,t.layers)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=w;this.Vm=e,this.Wm={}}Hm(t,e){this.Wm[i(t)]=e}getFeatures(){return this.zs}getHitTolerance(){return this.Zm}getLayer(t){return this.Wm[i(t)]}setHitTolerance(t){this.Zm=t}setMap(t){this.getMap()&&this.K&&this.zs.forEach(this.Km.bind(this)),super.setMap(t),t?(this.zs.addEventListener(W,this.Dm),this.zs.addEventListener(H,this.Um),this.K&&this.zs.forEach(this.Jm.bind(this))):(this.zs.removeEventListener(W,this.Dm),this.zs.removeEventListener(H,this.Um))}Em(t){const e=t.element;if(this.K&&this.Jm(e),!this.getLayer(e)){const t=this.getMap().getAllLayers().find((function(t){if(t instanceof Jv&&t.getSource()&&t.getSource().hasFeature(e))return t}));t&&this.Hm(e,t)}}Rm(t){this.K&&this.Km(t.element)}getStyle(){return this.K}Jm(t){const e=i(t);e in hM||(hM[e]=t.getStyle()),t.setStyle(this.K)}Km(t){const e=this.getMap().getInteractions().getArray();for(let i=e.length-1;i>=0;--i){const n=e[i];if(n!==this&&n instanceof aM&&n.getStyle()&&-1!==n.getFeatures().getArray().lastIndexOf(t))return void t.setStyle(n.getStyle())}const n=i(t);t.setStyle(hM[n]),delete hM[n]}Qm(t){delete this.Wm[i(t)]}handleEvent(t){if(!this.an(t))return!0;const e=this.$m(t),i=this.Bm(t),n=this.qm(t),s=!e&&!i&&!n,r=t.map,o=this.getFeatures(),h=[],a=[];if(s){P(this.Wm),r.forEachFeatureAtPixel(t.pixel,function(t,e){if(t instanceof pt&&this.Ym(t,e))return this.Hm(t,e),a.push(t),!this.Xm}.bind(this),{layerFilter:this.Vm,hitTolerance:this.Zm});for(let t=o.getLength()-1;t>=0;--t){const e=o.item(t),i=a.indexOf(e);i>-1?a.splice(i,1):(o.remove(e),h.push(e))}0!==a.length&&o.extend(a)}else{r.forEachFeatureAtPixel(t.pixel,function(t,s){if(t instanceof pt&&this.Ym(t,s))return!e&&!n||o.getArray().includes(t)?(i||n)&&o.getArray().includes(t)&&(h.push(t),this.Qm(t)):(this.Hm(t,s),a.push(t)),!this.Xm}.bind(this),{layerFilter:this.Vm,hitTolerance:this.Zm});for(let t=h.length-1;t>=0;--t)o.remove(h[t]);o.extend(a)}return(a.length>0||h.length>0)&&this.dispatchEvent(new oM(rM,a,h,t)),!0}}var uM=aM;function lM(t){return t.feature?t.feature:t.element?t.element:void 0}const cM=[];var fM=class extends yh{constructor(t){const e=t=t||{};e.handleDownEvent||(e.handleDownEvent=w),e.stopDown||(e.stopDown=x),super(e),this.Hd=t.source?t.source:null,this.tv=void 0===t.vertex||t.vertex,this.ev=void 0===t.edge||t.edge,this.zs=t.features?t.features:null,this.iv=[],this.nv={},this.sv={},this.rv={},this.Np=void 0!==t.pixelTolerance?t.pixelTolerance:10,this.um=new Jc,this.ov={Point:this.hv.bind(this),LineString:this.av.bind(this),LinearRing:this.av.bind(this),Polygon:this.uv.bind(this),MultiPoint:this.lv.bind(this),MultiLineString:this.cv.bind(this),MultiPolygon:this.fv.bind(this),GeometryCollection:this.dv.bind(this),Circle:this.pv.bind(this)}}addFeature(t,e){e=void 0===e||e;const n=i(t),s=t.getGeometry();if(s){const e=this.ov[s.getType()];if(e){this.sv[n]=s.getExtent([1/0,1/0,-1/0,-1/0]);const i=[];if(e(i,s),1===i.length)this.um.insert(Zt(i[0]),{feature:t,segment:i[0]});else if(i.length>1){const e=i.map((t=>Zt(t))),n=i.map((e=>({feature:t,segment:e})));this.um.load(e,n)}}}e&&(this.nv[n]=U(t,T,this.Qa,this))}mv(t){this.addFeature(t)}vv(t){this.removeFeature(t)}gv(){let t;return this.zs?t=this.zs:this.Hd&&(t=this.Hd.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),super.handleEvent(t)}Tm(t){const e=lM(t);this.addFeature(e)}Cm(t){const e=lM(t);this.removeFeature(e)}Qa(t){const e=t.target;if(this.handlingDownUpSequence){const t=i(e);t in this.rv||(this.rv[t]=e)}else this.yv(e)}handleUpEvent(t){const e=Object.values(this.rv);return e.length&&(e.forEach(this.yv.bind(this)),this.rv={}),!1}removeFeature(t,e){const n=void 0===e||e,s=i(t),r=this.sv[s];if(r){const e=this.um,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])}n&&(B(this.nv[s]),delete this.nv[s])}setMap(t){const e=this.getMap(),i=this.iv,n=this.gv();e&&(i.forEach(B),i.length=0,n.forEach(this.vv.bind(this))),super.setMap(t),t&&(this.zs?i.push(U(this.zs,W,this.Tm,this),U(this.zs,H,this.Cm,this)):this.Hd&&i.push(U(this.Hd,mf,this.Tm,this),U(this.Hd,yf,this.Cm,this)),n.forEach(this.mv.bind(this)))}snapTo(t,e,i){const n=Zt([i.getCoordinateFromPixel([t[0]-this.Np,t[1]+this.Np]),i.getCoordinateFromPixel([t[0]+this.Np,t[1]-this.Np])]),s=this.um.getInExtent(n),r=s.length;if(0===r)return null;const o=i.getView().getProjection(),h=ln(e,o);let a,u=1/0;const l=this.Np*this.Np,c=()=>{if(a){const e=i.getPixelFromCoordinate(a);if(Fi(t,e)<=l)return{vertex:a,vertexPixel:[Math.round(e[0]),Math.round(e[1])]}}return null};if(this.tv){for(let t=0;t<r;++t){const e=s[t];"Circle"!==e.feature.getGeometry().getType()&&e.segment.forEach((t=>{const e=ln(t,o),i=Fi(h,e);i<u&&(a=t,u=i)}))}const t=c();if(t)return t}if(this.ev){for(let t=0;t<r;++t){let e=null;const i=s[t];if("Circle"===i.feature.getGeometry().getType()){let t=i.feature.getGeometry();const n=an();n&&(t=t.clone().transform(n,o)),e=un(Mi(h,t),o)}else{const[t,n]=i.segment;n&&(cM[0]=ln(t,o),cM[1]=ln(n,o),e=Si(h,cM))}if(e){const t=Fi(h,e);t<u&&(a=e,u=t)}}const t=c();if(t)return t}return null}yv(t){this.removeFeature(t,!1),this.addFeature(t,!1)}pv(t,e){const i=this.getMap().getView().getProjection();let n=e;const s=an();s&&(n=n.clone().transform(s,i));const r=Ss(n);s&&r.transform(i,s);const o=r.getCoordinates()[0];for(let e=0,i=o.length-1;e<i;++e)t.push(o.slice(e,e+2))}dv(t,e){const i=e.getGeometriesArray();for(let e=0;e<i.length;++e){const n=this.ov[i[e].getType()];n&&n(t,i[e])}}av(t,e){const i=e.getCoordinates();for(let e=0,n=i.length-1;e<n;++e)t.push(i.slice(e,e+2))}cv(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e<n;++e){const n=i[e];for(let e=0,i=n.length-1;e<i;++e)t.push(n.slice(e,e+2))}}lv(t,e){e.getCoordinates().forEach((e=>{t.push([e])}))}fv(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e<n;++e){const n=i[e];for(let e=0,i=n.length;e<i;++e){const i=n[e];for(let e=0,n=i.length-1;e<n;++e)t.push(i.slice(e,e+2))}}}hv(t,e){t.push([e.getCoordinates()])}uv(t,e){const i=e.getCoordinates();for(let e=0,n=i.length;e<n;++e){const n=i[e];for(let e=0,i=n.length-1;e<i;++e)t.push(n.slice(e,e+2))}}};const dM="translatestart",pM="translating",mM="translateend";class vM extends u{constructor(t,e,i,n,s){super(t),this.features=e,this.coordinate=i,this.startCoordinate=n,this.mapBrowserEvent=s}}var gM=class extends yh{constructor(t){let e;if(super(t=t||{}),this.on,this.once,this.un,this.wv=null,this.xv=null,this.zs=void 0!==t.features?t.features:null,t.layers&&!this.zs)if("function"==typeof t.layers)e=t.layers;else{const i=t.layers;e=function(t){return i.includes(t)}}else e=w;this.Vm=e,this.Ym=t.filter&&!this.zs?t.filter:w,this.Zm=t.hitTolerance?t.hitTolerance:0,this.an=t.condition?t.condition:Ph,this.bv=null,this.addChangeListener(fh,this.Mv)}handleDownEvent(t){if(!t.originalEvent||!this.an(t))return!1;if(this.bv=this.Sv(t.pixel,t.map),!this.wv&&this.bv){this.xv=t.coordinate,this.wv=t.coordinate,this.handleMoveEvent(t);const e=this.zs||new Q([this.bv]);return this.dispatchEvent(new vM(dM,e,t.coordinate,this.xv,t)),!0}return!1}handleUpEvent(t){if(this.wv){this.wv=null,this.handleMoveEvent(t);const e=this.zs||new Q([this.bv]);return this.dispatchEvent(new vM(mM,e,t.coordinate,this.xv,t)),this.xv=null,!0}return!1}handleDragEvent(t){if(this.wv){const e=t.coordinate,i=e[0]-this.wv[0],n=e[1]-this.wv[1],s=this.zs||new Q([this.bv]);s.forEach((function(t){const e=t.getGeometry();e.translate(i,n),t.setGeometry(e)})),this.wv=e,this.dispatchEvent(new vM(pM,s,e,this.xv,t))}}handleMoveEvent(t){const e=t.map.getViewport();this.Sv(t.pixel,t.map)?(e.classList.remove(this.wv?"ol-grab":"ol-grabbing"),e.classList.add(this.wv?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")}Sv(t,e){return e.forEachFeatureAtPixel(t,function(t,e){if(this.Ym(t,e)&&(!this.zs||this.zs.getArray().includes(t)))return t}.bind(this),{layerFilter:this.Vm,hitTolerance:this.Zm})}getHitTolerance(){return this.Zm}setHitTolerance(t){this.Zm=t}setMap(t){const e=this.getMap();super.setMap(t),this._p(e)}Mv(){this._p(null)}_p(t){let e=this.getMap();const i=this.getActive();if((!e||!i)&&(e=e||t,e)){e.getViewport().classList.remove("ol-grab","ol-grabbing")}}};function yM(t,e,i,n,s,r){void 0!==s?r=void 0!==r?r:0:(s=[],r=0);let o=e;for(;o<i;){const e=t[o++];s[r++]=t[o++],s[r++]=e;for(let e=2;e<n;++e)s[r++]=t[o++]}return s.length=r,s}const wM={Point:function(t){let e;e=void 0!==t.m&&void 0!==t.z?new Qn([t.x,t.y,t.z,t.m],"XYZM"):void 0!==t.z?new Qn([t.x,t.y,t.z],"XYZ"):void 0!==t.m?new Qn([t.x,t.y,t.m],"XYM"):new Qn([t.x,t.y]);return e},LineString:function(t){const e=MM(t);return new $v(t.paths[0],e)},Polygon:function(t){const e=MM(t);return new xs(t.rings,e)},MultiPoint:function(t){const e=MM(t);return new zv(t.points,e)},MultiLineString:function(t){const e=MM(t);return new qv(t.paths,e)},MultiPolygon:function(t){const e=MM(t);return new Zv(t.rings,e)}},xM={Point:function(t,e){const i=t.getCoordinates();let n;const s=t.getLayout();"XYZ"===s?n={x:i[0],y:i[1],z:i[2]}:"XYM"===s?n={x:i[0],y:i[1],m:i[2]}:"XYZM"===s?n={x:i[0],y:i[1],z:i[2],m:i[3]}:"XY"===s?n={x:i[0],y:i[1]}:ct(!1,34);return n},LineString:function(t,e){const i=SM(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:[t.getCoordinates()]}},Polygon:function(t,e){const i=SM(t);return{hasZ:i.hasZ,hasM:i.hasM,rings:t.getCoordinates(!1)}},MultiPoint:function(t,e){const i=SM(t);return{hasZ:i.hasZ,hasM:i.hasM,points:t.getCoordinates()}},MultiLineString:function(t,e){const i=SM(t);return{hasZ:i.hasZ,hasM:i.hasM,paths:t.getCoordinates()}},MultiPolygon:function(t,e){const i=SM(t),n=t.getCoordinates(!1),s=[];for(let t=0;t<n.length;t++)for(let e=n[t].length-1;e>=0;e--)s.push(n[t][e]);return{hasZ:i.hasZ,hasM:i.hasM,rings:s}}};function bM(t,e){if(!t)return null;let i;if("number"==typeof t.x&&"number"==typeof t.y)i="Point";else if(t.points)i="MultiPoint";else if(t.paths){i=1===t.paths.length?"LineString":"MultiLineString"}else if(t.rings){const e=t,n=MM(e),s=function(t,e){const i=[],n=[],s=[];let r,o;for(r=0,o=t.length;r<o;++r){i.length=0,Ln(i,0,t[r],e.length);ds(i,0,i.length,e.length)?n.push([t[r]]):s.push(t[r])}for(;s.length;){const t=s.shift();let e=!1;for(r=n.length-1;r>=0;r--){const i=n[r][0];if(Jt(new Kn(i).getExtent(),new Kn(t).getExtent())){n[r].push(t),e=!0;break}}e||n.push([t.reverse()])}return n}(e.rings,n);1===s.length?(i="Polygon",t=Object.assign({},t,{rings:s[0]})):(i="MultiPolygon",t=Object.assign({},t,{rings:s}))}return cg((0,wM[i])(t),!1,e)}function MM(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 SM(t){const e=t.getLayout();return{hasZ:"XYZ"===e||"XYZM"===e,hasM:"XYM"===e||"XYZM"===e}}function PM(t,e){return(0,xM[t.getType()])(cg(t,!0,e),e)}var _M=class extends Pg{constructor(t){t=t||{},super(),this.H=t.geometryName}readFeatureFromObject(t,e,i){const n=t,s=bM(n.geometry,e),r=new pt;if(this.H&&r.setGeometryName(this.H),r.setGeometry(s),n.attributes){r.setProperties(n.attributes,!0);const t=n.attributes[i];void 0!==t&&r.setId(t)}return r}readFeaturesFromObject(t,e){if(e=e||{},t.features){const i=[],n=t.features;for(let s=0,r=n.length;s<r;++s)i.push(this.readFeatureFromObject(n[s],e,t.objectIdFieldName));return i}return[this.readFeatureFromObject(t,e)]}readGeometryFromObject(t,e){return bM(t,e)}readProjectionFromObject(t){if(t.spatialReference&&void 0!==t.spatialReference.wkid){return Yi("EPSG:"+t.spatialReference.wkid)}return null}writeGeometryObject(t,e){return PM(t,this.adaptOptions(e))}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={};if(!t.hasProperties())return i.attributes={},i;const n=t.getProperties(),s=t.getGeometry();if(s){i.geometry=PM(s,e);const r=e&&(e.dataProjection||e.featureProjection);r&&(i.geometry.spatialReference={wkid:Number(Yi(r).getCode().split(":").pop())}),delete n[t.getGeometryName()]}return _(n)?i.attributes={}:i.attributes=n,i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let n=0,s=t.length;n<s;++n)i.push(this.writeFeatureObject(t[n],e));return{features:i}}};var EM=class extends lg{constructor(){super(),this.Pv=Zu()}getType(){return"xml"}readFeature(t,e){if(t){if("string"==typeof t){const i=Fu(t);return this.readFeatureFromDocument(i,e)}return Tu(t)?this.readFeatureFromDocument(t,e):this.readFeatureFromNode(t,e)}return null}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){if("string"==typeof t){const i=Fu(t);return this.readFeaturesFromDocument(i,e)}return Tu(t)?this.readFeaturesFromDocument(t,e):this.readFeaturesFromNode(t,e)}return[]}readFeaturesFromDocument(t,e){const i=[];for(let n=t.firstChild;n;n=n.nextSibling)n.nodeType==Node.ELEMENT_NODE&&v(i,this.readFeaturesFromNode(n,e));return i}readFeaturesFromNode(e,i){return t()}readGeometry(t,e){if(t){if("string"==typeof t){const i=Fu(t);return this.readGeometryFromDocument(i,e)}return Tu(t)?this.readGeometryFromDocument(t,e):this.readGeometryFromNode(t,e)}return null}readGeometryFromDocument(t,e){return null}readGeometryFromNode(t,e){return null}readProjection(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readProjectionFromDocument(e)}return Tu(t)?this.readProjectionFromDocument(t):this.readProjectionFromNode(t)}return null}readProjectionFromDocument(t){return this.dataProjection}readProjectionFromNode(t){return this.dataProjection}writeFeature(t,e){const i=this.writeFeatureNode(t,e);return this.Pv.serializeToString(i)}writeFeatureNode(t,e){return null}writeFeatures(t,e){const i=this.writeFeaturesNode(t,e);return this.Pv.serializeToString(i)}writeFeaturesNode(t,e){return null}writeGeometry(t,e){const i=this.writeGeometryNode(t,e);return this.Pv.serializeToString(i)}writeGeometryNode(t,e){return null}};const TM="http://www.opengis.net/gml",CM=/^\s*$/;class FM extends EM{constructor(t){super(),t=t||{},this.featureType=t.featureType,this.featureNS=t.featureNS,this.srsName=t.srsName,this.schemaLocation="",this.FEATURE_COLLECTION_PARSERS={},this.FEATURE_COLLECTION_PARSERS[this.namespace]={featureMember:Au(this.readFeaturesInternal),featureMembers:ku(this.readFeaturesInternal)},this.supportedMediaTypes=["application/gml+xml"]}readFeaturesInternal(t,e){const i=t.localName;let n=null;if("FeatureCollection"==i)n=$u([],this.FEATURE_COLLECTION_PARSERS,t,e,this);else if("featureMembers"==i||"featureMember"==i||"member"==i){const s=e[0];let r=s.featureType,o=s.featureNS;const h="p",a="p0";if(!r&&t.childNodes){r=[],o={};for(let e=0,i=t.childNodes.length;e<i;++e){const i=t.childNodes[e];if(1===i.nodeType){const t=i.nodeName.split(":").pop();if(!r.includes(t)){let e="",n=0;const s=i.namespaceURI;for(const t in o){if(o[t]===s){e=t;break}++n}e||(e=h+n,o[e]=s),r.push(e+":"+t)}}}"featureMember"!=i&&(s.featureType=r,s.featureNS=o)}if("string"==typeof o){const t=o;o={},o[a]=t}const u={},l=Array.isArray(r)?r:[r];for(const t in o){const e={};for(let n=0,s=l.length;n<s;++n){(l[n].includes(":")?l[n].split(":")[0]:a)===t&&(e[l[n].split(":").pop()]="featureMembers"==i?Au(this.readFeatureElement,this):ku(this.readFeatureElement,this))}u[o[t]]=e}n=$u("featureMember"==i||"member"==i?void 0:[],u,t,e)}return null===n&&(n=[]),n}readGeometryOrExtent(t,e){const i=e[0];return i.srsName=t.firstElementChild.getAttribute("srsName"),i.srsDimension=t.firstElementChild.getAttribute("srsDimension"),$u(null,this.GEOMETRY_PARSERS,t,e,this)}readExtentElement(t,e){const i=e[0],n=this.readGeometryOrExtent(t,e);return n?fg(n,i):void 0}readGeometryElement(t,e){const i=e[0],n=this.readGeometryOrExtent(t,e);return n?cg(n,!1,i):void 0}readFeatureElementInternal(t,e,i){let n;const s={};for(let r=t.firstElementChild;r;r=r.nextElementSibling){let t;const o=r.localName;0===r.childNodes.length||1===r.childNodes.length&&(3===r.firstChild.nodeType||4===r.firstChild.nodeType)?(t=_u(r,!1),CM.test(t)&&(t=void 0)):(i&&(t="boundedBy"===o?this.readExtentElement(r,e):this.readGeometryElement(r,e)),t?"boundedBy"!==o&&(n=o):t=this.readFeatureElementInternal(r,e,!1));const h=r.attributes.length;if(h>0){t={_v:t};for(let e=0;e<h;e++){t[r.attributes[e].name]=r.attributes[e].value}}s[o]?(s[o]instanceof Array||(s[o]=[s[o]]),s[o].push(t)):s[o]=t}if(i){const e=new pt(s);n&&e.setGeometryName(n);const i=t.getAttribute("fid")||Cu(t,this.namespace,"id");return i&&e.setId(i),e}return s}readFeatureElement(t,e){return this.readFeatureElementInternal(t,e,!0)}readPoint(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i)return new Qn(i,"XYZ")}readMultiPoint(t,e){const i=$u([],this.MULTIPOINT_PARSERS,t,e,this);return i?new zv(i):void 0}readMultiLineString(t,e){const i=$u([],this.MULTILINESTRING_PARSERS,t,e,this);if(i)return new qv(i)}readMultiPolygon(t,e){const i=$u([],this.MULTIPOLYGON_PARSERS,t,e,this);if(i)return new Zv(i)}pointMemberParser(t,e){Uu(this.POINTMEMBER_PARSERS,t,e,this)}lineStringMemberParser(t,e){Uu(this.LINESTRINGMEMBER_PARSERS,t,e,this)}polygonMemberParser(t,e){Uu(this.POLYGONMEMBER_PARSERS,t,e,this)}readLineString(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i){return new $v(i,"XYZ")}}readFlatLinearRing(t,e){const i=$u(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this);return i||void 0}readLinearRing(t,e){const i=this.readFlatCoordinatesFromNode(t,e);if(i)return new Kn(i,"XYZ")}readPolygon(t,e){const i=$u([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this);if(i&&i[0]){const t=i[0],e=[t.length];let n,s;for(n=1,s=i.length;n<s;++n)v(t,i[n]),e.push(t.length);return new xs(t,"XYZ",e)}}readFlatCoordinatesFromNode(t,e){return $u(null,this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)}readGeometryFromNode(t,e){const i=this.readGeometryElement(t,[this.getReadOptions(t,e||{})]);return i||null}readFeaturesFromNode(t,e){const i={featureType:this.featureType,featureNS:this.featureNS};i&&Object.assign(i,this.getReadOptions(t,e));return this.readFeaturesInternal(t,[i])||[]}readProjectionFromNode(t){return Yi(this.srsName?this.srsName:t.firstElementChild.getAttribute("srsName"))}}FM.prototype.namespace=TM,FM.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{}},FM.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{}},FM.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{}},FM.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml":{pointMember:Au(FM.prototype.pointMemberParser),pointMembers:Au(FM.prototype.pointMemberParser)}},FM.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml":{lineStringMember:Au(FM.prototype.lineStringMemberParser),lineStringMembers:Au(FM.prototype.lineStringMemberParser)}},FM.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml":{polygonMember:Au(FM.prototype.polygonMemberParser),polygonMembers:Au(FM.prototype.polygonMemberParser)}},FM.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml":{Point:Au(FM.prototype.readFlatCoordinatesFromNode)}},FM.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:Au(FM.prototype.readLineString)}},FM.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:Au(FM.prototype.readPolygon)}},FM.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:ku(FM.prototype.readFlatLinearRing)}};var IM=FM;function AM(t){return kM(_u(t,!1))}function kM(t){const e=/^\s*(true|1)|(false|0)\s*$/.exec(t);return e?void 0!==e[1]||!1:void 0}function RM(t){const e=_u(t,!1),i=Date.parse(e);return isNaN(i)?void 0:i/1e3}function LM(t){return NM(_u(t,!1))}function NM(t){const e=/^\s*([+\-]?\d*\.?\d+(?:e[+\-]?\d+)?)\s*$/i.exec(t);return e?parseFloat(e[1]):void 0}function OM(t){return zM(_u(t,!1))}function zM(t){const e=/^\s*(\d+)\s*$/.exec(t);return e?parseInt(e[1],10):void 0}function GM(t){return _u(t,!1).trim()}function jM(t,e){qM(t,e?"1":"0")}function DM(t,e){t.appendChild(Vu().createCDATASection(e))}function UM(t,e){const i=new Date(1e3*e),n=i.getUTCFullYear()+"-"+wi(i.getUTCMonth()+1,2)+"-"+wi(i.getUTCDate(),2)+"T"+wi(i.getUTCHours(),2)+":"+wi(i.getUTCMinutes(),2)+":"+wi(i.getUTCSeconds(),2)+"Z";t.appendChild(Vu().createTextNode(n))}function $M(t,e){const i=e.toPrecision();t.appendChild(Vu().createTextNode(i))}function BM(t,e){const i=e.toString();t.appendChild(Vu().createTextNode(i))}function qM(t,e){t.appendChild(Vu().createTextNode(e))}const XM={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class YM extends IM{constructor(t){super(t=t||{}),this.FEATURE_COLLECTION_PARSERS[TM].featureMember=Au(this.readFeaturesInternal),this.schemaLocation=t.schemaLocation?t.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/2.1.2/feature.xsd"}readFlatCoordinates(t,e){const i=_u(t,!1).replace(/^\s*|\s*$/g,""),n=e[0].srsName;let s="enu";if(n){const t=Yi(n);t&&(s=t.getAxisOrientation())}const r=i.trim().split(/\s+/),o=[];for(let t=0,e=r.length;t<e;t++){const e=r[t].split(/,+/),i=parseFloat(e[0]),n=parseFloat(e[1]),h=3===e.length?parseFloat(e[2]):0;"en"===s.substr(0,2)?o.push(i,n,h):o.push(n,i,h)}return o}readBox(t,e){const i=$u([null],this.Ev,t,e,this);return ie(i[1][0],i[1][1],i[1][3],i[1][4])}innerBoundaryIsParser(t,e){const i=$u(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1].push(i)}}outerBoundaryIsParser(t,e){const i=$u(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1][0]=i}}Tv(t,e,i){const n=e[e.length-1],s=n.multiSurface,r=n.surface,o=n.multiCurve;return Array.isArray(t)?i="Envelope":"MultiPolygon"===(i=t.getType())&&!0===s?i="MultiSurface":"Polygon"===i&&!0===r?i="Surface":"MultiLineString"===i&&!0===o&&(i="MultiCurve"),Pu("http://www.opengis.net/gml",i)}writeFeatureElement(t,e,i){const n=e.getId();n&&t.setAttribute("fid",n);const s=i[i.length-1],r=s.featureNS,o=e.getGeometryName();s.serializers||(s.serializers={},s.serializers[r]={});const h=[],a=[];if(e.hasProperties()){const t=e.getProperties();for(const e in t){const i=t[e];null!==i&&(h.push(e),a.push(i),e==o||"function"==typeof i.getSimplifiedGeometry?e in s.serializers[r]||(s.serializers[r][e]=Nu(this.writeGeometryElement,this)):e in s.serializers[r]||(s.serializers[r][e]=Nu(qM)))}}const u=Object.assign({},s);u.node=t,qu(u,s.serializers,zu(void 0,r),a,i,h)}writeCurveOrLineString(t,e,i){const n=i[i.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){const n=this.Cv(t.namespaceURI);t.appendChild(n),this.Fv(n,e,i)}else if("Curve"===t.nodeName){const n=Pu(t.namespaceURI,"segments");t.appendChild(n),this.Iv(n,e,i)}}writeLineStringOrCurveMember(t,e,i){const n=this.Tv(e,i);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,i))}writeMultiCurveOrLineString(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName,o=n.curve;r&&t.setAttribute("srsName",r);const h=e.getLineStrings();qu({node:t,hasZ:s,srsName:r,curve:o},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.Av,h,i,void 0,this)}writeGeometryElement(t,e,i){const n=i[i.length-1],s=Object.assign({},n);let r;s.node=t,r=Array.isArray(e)?fg(e,n):cg(e,!0,n),qu(s,this.GEOMETRY_SERIALIZERS,this.Tv,[r],i,void 0,this)}Cv(t){const e=Pu(t,"coordinates");return e.setAttribute("decimal","."),e.setAttribute("cs",","),e.setAttribute("ts"," "),e}Fv(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName,o=e.getCoordinates(),h=o.length,a=new Array(h);for(let t=0;t<h;++t){const e=o[t];a[t]=this.kv(e,r,s)}qM(t,a.join(" "))}Iv(t,e,i){const n=Pu(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,i)}writeSurfaceOrPolygon(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName;if("PolygonPatch"!==t.nodeName&&r&&t.setAttribute("srsName",r),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){const n=e.getLinearRings();qu({node:t,hasZ:s,srsName:r},this.RING_SERIALIZERS,this.Rv,n,i,void 0,this)}else if("Surface"===t.nodeName){const n=Pu(t.namespaceURI,"patches");t.appendChild(n),this.Lv(n,e,i)}}Rv(t,e,i){const n=e[e.length-1],s=n.node,r=n.exteriorWritten;return void 0===r&&(n.exteriorWritten=!0),Pu(s.namespaceURI,void 0!==r?"innerBoundaryIs":"outerBoundaryIs")}Lv(t,e,i){const n=Pu(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i)}writeRing(t,e,i){const n=Pu(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,i)}kv(t,e,i){let n="enu";e&&(n=Yi(e).getAxisOrientation());let s="en"===n.substr(0,2)?t[0]+","+t[1]:t[1]+","+t[0];if(i){s+=","+(t[2]||0)}return s}writePoint(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName;r&&t.setAttribute("srsName",r);const o=this.Cv(t.namespaceURI);t.appendChild(o);const h=e.getCoordinates();qM(o,this.kv(h,r,s))}writeMultiPoint(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName;r&&t.setAttribute("srsName",r);const o=e.getPoints();qu({node:t,hasZ:s,srsName:r},this.POINTMEMBER_SERIALIZERS,zu("pointMember"),o,i,void 0,this)}writePointMember(t,e,i){const n=Pu(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,i)}writeLinearRing(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const s=this.Cv(t.namespaceURI);t.appendChild(s),this.Fv(s,e,i)}writeMultiSurfaceOrPolygon(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName,o=n.surface;r&&t.setAttribute("srsName",r);const h=e.getPolygons();qu({node:t,hasZ:s,srsName:r,surface:o},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.Av,h,i,void 0,this)}writeSurfaceOrPolygonMember(t,e,i){const n=this.Tv(e,i);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i))}writeEnvelope(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const s=[e[0]+" "+e[1],e[2]+" "+e[3]];qu({node:t},this.ENVELOPE_SERIALIZERS,Gu,s,i,["lowerCorner","upperCorner"],this)}Av(t,e,i){const n=e[e.length-1].node;return Pu("http://www.opengis.net/gml",XM[n.nodeName])}}YM.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{coordinates:ku(YM.prototype.readFlatCoordinates)}},YM.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{innerBoundaryIs:YM.prototype.innerBoundaryIsParser,outerBoundaryIs:YM.prototype.outerBoundaryIsParser}},YM.prototype.Ev={"http://www.opengis.net/gml":{coordinates:Au(YM.prototype.readFlatCoordinates)}},YM.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:ku(IM.prototype.readPoint),MultiPoint:ku(IM.prototype.readMultiPoint),LineString:ku(IM.prototype.readLineString),MultiLineString:ku(IM.prototype.readMultiLineString),LinearRing:ku(IM.prototype.readLinearRing),Polygon:ku(IM.prototype.readPolygon),MultiPolygon:ku(IM.prototype.readMultiPolygon),Box:ku(YM.prototype.readBox)}},YM.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:Nu(YM.prototype.writeCurveOrLineString),MultiCurve:Nu(YM.prototype.writeMultiCurveOrLineString),Point:Nu(YM.prototype.writePoint),MultiPoint:Nu(YM.prototype.writeMultiPoint),LineString:Nu(YM.prototype.writeCurveOrLineString),MultiLineString:Nu(YM.prototype.writeMultiCurveOrLineString),LinearRing:Nu(YM.prototype.writeLinearRing),Polygon:Nu(YM.prototype.writeSurfaceOrPolygon),MultiPolygon:Nu(YM.prototype.writeMultiSurfaceOrPolygon),Surface:Nu(YM.prototype.writeSurfaceOrPolygon),MultiSurface:Nu(YM.prototype.writeMultiSurfaceOrPolygon),Envelope:Nu(YM.prototype.writeEnvelope)}},YM.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:Nu(YM.prototype.writeLineStringOrCurveMember),curveMember:Nu(YM.prototype.writeLineStringOrCurveMember)}},YM.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{outerBoundaryIs:Nu(YM.prototype.writeRing),innerBoundaryIs:Nu(YM.prototype.writeRing)}},YM.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:Nu(YM.prototype.writePointMember)}},YM.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:Nu(YM.prototype.writeSurfaceOrPolygonMember),polygonMember:Nu(YM.prototype.writeSurfaceOrPolygonMember)}},YM.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:Nu(qM),upperCorner:Nu(qM)}};var ZM=YM;const VM={MultiLineString:"lineStringMember",MultiCurve:"curveMember",MultiPolygon:"polygonMember",MultiSurface:"surfaceMember"};class WM extends IM{constructor(t){super(t=t||{}),this.Nv=void 0!==t.surface&&t.surface,this.Ov=void 0!==t.curve&&t.curve,this.zv=void 0===t.multiCurve||t.multiCurve,this.Gv=void 0===t.multiSurface||t.multiSurface,this.schemaLocation=t.schemaLocation?t.schemaLocation:"http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd",this.hasZ=void 0!==t.hasZ&&t.hasZ}readMultiCurve(t,e){const i=$u([],this.MULTICURVE_PARSERS,t,e,this);if(i){return new qv(i)}}readFlatCurveRing(t,e){const i=$u([],this.MULTICURVE_PARSERS,t,e,this),n=[];for(let t=0,e=i.length;t<e;++t)v(n,i[t].getFlatCoordinates());return n}readMultiSurface(t,e){const i=$u([],this.MULTISURFACE_PARSERS,t,e,this);if(i)return new Zv(i)}curveMemberParser(t,e){Uu(this.CURVEMEMBER_PARSERS,t,e,this)}surfaceMemberParser(t,e){Uu(this.SURFACEMEMBER_PARSERS,t,e,this)}readPatch(t,e){return $u([null],this.PATCHES_PARSERS,t,e,this)}readSegment(t,e){return $u([],this.SEGMENTS_PARSERS,t,e,this)}readPolygonPatch(t,e){return $u([null],this.FLAT_LINEAR_RINGS_PARSERS,t,e,this)}readLineStringSegment(t,e){return $u([null],this.GEOMETRY_FLAT_COORDINATES_PARSERS,t,e,this)}interiorParser(t,e){const i=$u(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1].push(i)}}exteriorParser(t,e){const i=$u(void 0,this.RING_PARSERS,t,e,this);if(i){e[e.length-1][0]=i}}readSurface(t,e){const i=$u([null],this.SURFACE_PARSERS,t,e,this);if(i&&i[0]){const t=i[0],e=[t.length];let n,s;for(n=1,s=i.length;n<s;++n)v(t,i[n]),e.push(t.length);return new xs(t,"XYZ",e)}}readCurve(t,e){const i=$u([null],this.CURVE_PARSERS,t,e,this);if(i){return new $v(i,"XYZ")}}readEnvelope(t,e){const i=$u([null],this.ENVELOPE_PARSERS,t,e,this);return ie(i[1][0],i[1][1],i[2][0],i[2][1])}readFlatPos(t,e){let i=_u(t,!1);const n=/^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/,s=[];let r;for(;r=n.exec(i);)s.push(parseFloat(r[1])),i=i.substr(r[0].length);if(""!==i)return;const o=e[0].srsName;let h="enu";if(o){h=Yi(o).getAxisOrientation()}if("neu"===h){let t,e;for(t=0,e=s.length;t<e;t+=3){const e=s[t],i=s[t+1];s[t]=i,s[t+1]=e}}const a=s.length;return 2==a&&s.push(0),0!==a?s:void 0}readFlatPosList(t,e){const i=_u(t,!1).replace(/^\s*|\s*$/g,""),n=e[0],s=n.srsName,r=n.srsDimension;let o="enu";if(s){o=Yi(s).getAxisOrientation()}const h=i.split(/\s+/);let a,u,l,c=2;t.getAttribute("srsDimension")?c=zM(t.getAttribute("srsDimension")):t.getAttribute("dimension")?c=zM(t.getAttribute("dimension")):t.parentNode.getAttribute("srsDimension")?c=zM(t.parentNode.getAttribute("srsDimension")):r&&(c=zM(r));const f=[];for(let t=0,e=h.length;t<e;t+=c)a=parseFloat(h[t]),u=parseFloat(h[t+1]),l=3===c?parseFloat(h[t+2]):0,"en"===o.substr(0,2)?f.push(a,u,l):f.push(u,a,l);return f}jv(t,e,i){const n=i[i.length-1],s=n.hasZ,r=s?"3":"2";t.setAttribute("srsDimension",r);const o=n.srsName;let h="enu";o&&(h=Yi(o).getAxisOrientation());const a=e.getCoordinates();let u;if(u="en"===h.substr(0,2)?a[0]+" "+a[1]:a[1]+" "+a[0],s){u+=" "+(a[2]||0)}qM(t,u)}kv(t,e,i){let n="enu";e&&(n=Yi(e).getAxisOrientation());let s="en"===n.substr(0,2)?t[0]+" "+t[1]:t[1]+" "+t[0];if(i){s+=" "+(t[2]||0)}return s}Dv(t,e,i){const n=i[i.length-1],s=n.hasZ,r=s?"3":"2";t.setAttribute("srsDimension",r);const o=n.srsName,h=e.getCoordinates(),a=h.length,u=new Array(a);let l;for(let t=0;t<a;++t)l=h[t],u[t]=this.kv(l,o,s);qM(t,u.join(" "))}writePoint(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const s=Pu(t.namespaceURI,"pos");t.appendChild(s),this.jv(s,e,i)}writeEnvelope(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const s=[e[0]+" "+e[1],e[2]+" "+e[3]];qu({node:t},this.ENVELOPE_SERIALIZERS,Gu,s,i,["lowerCorner","upperCorner"],this)}writeLinearRing(t,e,i){const n=i[i.length-1].srsName;n&&t.setAttribute("srsName",n);const s=Pu(t.namespaceURI,"posList");t.appendChild(s),this.Dv(s,e,i)}Rv(t,e,i){const n=e[e.length-1],s=n.node,r=n.exteriorWritten;return void 0===r&&(n.exteriorWritten=!0),Pu(s.namespaceURI,void 0!==r?"interior":"exterior")}writeSurfaceOrPolygon(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName;if("PolygonPatch"!==t.nodeName&&r&&t.setAttribute("srsName",r),"Polygon"===t.nodeName||"PolygonPatch"===t.nodeName){const n=e.getLinearRings();qu({node:t,hasZ:s,srsName:r},this.RING_SERIALIZERS,this.Rv,n,i,void 0,this)}else if("Surface"===t.nodeName){const n=Pu(t.namespaceURI,"patches");t.appendChild(n),this.Lv(n,e,i)}}writeCurveOrLineString(t,e,i){const n=i[i.length-1].srsName;if("LineStringSegment"!==t.nodeName&&n&&t.setAttribute("srsName",n),"LineString"===t.nodeName||"LineStringSegment"===t.nodeName){const n=Pu(t.namespaceURI,"posList");t.appendChild(n),this.Dv(n,e,i)}else if("Curve"===t.nodeName){const n=Pu(t.namespaceURI,"segments");t.appendChild(n),this.Iv(n,e,i)}}writeMultiSurfaceOrPolygon(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName,o=n.surface;r&&t.setAttribute("srsName",r);const h=e.getPolygons();qu({node:t,hasZ:s,srsName:r,surface:o},this.SURFACEORPOLYGONMEMBER_SERIALIZERS,this.Av,h,i,void 0,this)}writeMultiPoint(t,e,i){const n=i[i.length-1],s=n.srsName,r=n.hasZ;s&&t.setAttribute("srsName",s);const o=e.getPoints();qu({node:t,hasZ:r,srsName:s},this.POINTMEMBER_SERIALIZERS,zu("pointMember"),o,i,void 0,this)}writeMultiCurveOrLineString(t,e,i){const n=i[i.length-1],s=n.hasZ,r=n.srsName,o=n.curve;r&&t.setAttribute("srsName",r);const h=e.getLineStrings();qu({node:t,hasZ:s,srsName:r,curve:o},this.LINESTRINGORCURVEMEMBER_SERIALIZERS,this.Av,h,i,void 0,this)}writeRing(t,e,i){const n=Pu(t.namespaceURI,"LinearRing");t.appendChild(n),this.writeLinearRing(n,e,i)}writeSurfaceOrPolygonMember(t,e,i){const n=this.Tv(e,i);n&&(t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i))}writePointMember(t,e,i){const n=Pu(t.namespaceURI,"Point");t.appendChild(n),this.writePoint(n,e,i)}writeLineStringOrCurveMember(t,e,i){const n=this.Tv(e,i);n&&(t.appendChild(n),this.writeCurveOrLineString(n,e,i))}Lv(t,e,i){const n=Pu(t.namespaceURI,"PolygonPatch");t.appendChild(n),this.writeSurfaceOrPolygon(n,e,i)}Iv(t,e,i){const n=Pu(t.namespaceURI,"LineStringSegment");t.appendChild(n),this.writeCurveOrLineString(n,e,i)}writeGeometryElement(t,e,i){const n=i[i.length-1],s=Object.assign({},n);let r;s.node=t,r=Array.isArray(e)?fg(e,n):cg(e,!0,n),qu(s,this.GEOMETRY_SERIALIZERS,this.Tv,[r],i,void 0,this)}writeFeatureElement(t,e,i){const n=e.getId();n&&t.setAttribute("fid",n);const s=i[i.length-1],r=s.featureNS,o=e.getGeometryName();s.serializers||(s.serializers={},s.serializers[r]={});const h=[],a=[];if(e.hasProperties()){const t=e.getProperties();for(const e in t){const i=t[e];null!==i&&(h.push(e),a.push(i),e==o||"function"==typeof i.getSimplifiedGeometry?e in s.serializers[r]||(s.serializers[r][e]=Nu(this.writeGeometryElement,this)):e in s.serializers[r]||(s.serializers[r][e]=Nu(qM)))}}const u=Object.assign({},s);u.node=t,qu(u,s.serializers,zu(void 0,r),a,i,h)}Uv(t,e,i){const n=i[i.length-1],s=n.featureType,r=n.featureNS,o={};o[r]={},o[r][s]=Nu(this.writeFeatureElement,this);const h=Object.assign({},n);h.node=t,qu(h,o,zu(s,r),e,i)}Av(t,e,i){const n=e[e.length-1].node;return Pu(this.namespace,VM[n.nodeName])}Tv(t,e,i){const n=e[e.length-1],s=n.multiSurface,r=n.surface,o=n.curve,h=n.multiCurve;return Array.isArray(t)?i="Envelope":"MultiPolygon"===(i=t.getType())&&!0===s?i="MultiSurface":"Polygon"===i&&!0===r?i="Surface":"LineString"===i&&!0===o?i="Curve":"MultiLineString"===i&&!0===h&&(i="MultiCurve"),Pu(this.namespace,i)}writeGeometryNode(t,e){e=this.adaptOptions(e);const i=Pu(this.namespace,"geom"),n={node:i,hasZ:this.hasZ,srsName:this.srsName,curve:this.Ov,surface:this.Nv,multiSurface:this.Gv,multiCurve:this.zv};return e&&Object.assign(n,e),this.writeGeometryElement(i,t,[n]),i}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=Pu(this.namespace,"featureMembers");i.setAttributeNS(Su,"xsi:schemaLocation",this.schemaLocation);const n={srsName:this.srsName,hasZ:this.hasZ,curve:this.Ov,surface:this.Nv,multiSurface:this.Gv,multiCurve:this.zv,featureNS:this.featureNS,featureType:this.featureType};return e&&Object.assign(n,e),this.Uv(i,t,[n]),i}}WM.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml":{pos:ku(WM.prototype.readFlatPos),posList:ku(WM.prototype.readFlatPosList),coordinates:ku(ZM.prototype.readFlatCoordinates)}},WM.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml":{interior:WM.prototype.interiorParser,exterior:WM.prototype.exteriorParser}},WM.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml":{Point:ku(IM.prototype.readPoint),MultiPoint:ku(IM.prototype.readMultiPoint),LineString:ku(IM.prototype.readLineString),MultiLineString:ku(IM.prototype.readMultiLineString),LinearRing:ku(IM.prototype.readLinearRing),Polygon:ku(IM.prototype.readPolygon),MultiPolygon:ku(IM.prototype.readMultiPolygon),Surface:ku(WM.prototype.readSurface),MultiSurface:ku(WM.prototype.readMultiSurface),Curve:ku(WM.prototype.readCurve),MultiCurve:ku(WM.prototype.readMultiCurve),Envelope:ku(WM.prototype.readEnvelope)}},WM.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml":{curveMember:Au(WM.prototype.curveMemberParser),curveMembers:Au(WM.prototype.curveMemberParser)}},WM.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml":{surfaceMember:Au(WM.prototype.surfaceMemberParser),surfaceMembers:Au(WM.prototype.surfaceMemberParser)}},WM.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml":{LineString:Au(IM.prototype.readLineString),Curve:Au(WM.prototype.readCurve)}},WM.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml":{Polygon:Au(IM.prototype.readPolygon),Surface:Au(WM.prototype.readSurface)}},WM.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml":{patches:ku(WM.prototype.readPatch)}},WM.prototype.CURVE_PARSERS={"http://www.opengis.net/gml":{segments:ku(WM.prototype.readSegment)}},WM.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml":{lowerCorner:Au(WM.prototype.readFlatPosList),upperCorner:Au(WM.prototype.readFlatPosList)}},WM.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml":{PolygonPatch:ku(WM.prototype.readPolygonPatch)}},WM.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml":{LineStringSegment:Iu(WM.prototype.readLineStringSegment)}},IM.prototype.RING_PARSERS={"http://www.opengis.net/gml":{LinearRing:ku(IM.prototype.readFlatLinearRing),Ring:ku(WM.prototype.readFlatCurveRing)}},WM.prototype.writeFeatures,WM.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml":{exterior:Nu(WM.prototype.writeRing),interior:Nu(WM.prototype.writeRing)}},WM.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml":{lowerCorner:Nu(qM),upperCorner:Nu(qM)}},WM.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{surfaceMember:Nu(WM.prototype.writeSurfaceOrPolygonMember),polygonMember:Nu(WM.prototype.writeSurfaceOrPolygonMember)}},WM.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{pointMember:Nu(WM.prototype.writePointMember)}},WM.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml":{lineStringMember:Nu(WM.prototype.writeLineStringOrCurveMember),curveMember:Nu(WM.prototype.writeLineStringOrCurveMember)}},WM.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml":{Curve:Nu(WM.prototype.writeCurveOrLineString),MultiCurve:Nu(WM.prototype.writeMultiCurveOrLineString),Point:Nu(WM.prototype.writePoint),MultiPoint:Nu(WM.prototype.writeMultiPoint),LineString:Nu(WM.prototype.writeCurveOrLineString),MultiLineString:Nu(WM.prototype.writeMultiCurveOrLineString),LinearRing:Nu(WM.prototype.writeLinearRing),Polygon:Nu(WM.prototype.writeSurfaceOrPolygon),MultiPolygon:Nu(WM.prototype.writeMultiSurfaceOrPolygon),Surface:Nu(WM.prototype.writeSurfaceOrPolygon),MultiSurface:Nu(WM.prototype.writeMultiSurfaceOrPolygon),Envelope:Nu(WM.prototype.writeEnvelope)}};var HM=WM;const KM=HM;KM.prototype.writeFeatures,KM.prototype.writeFeaturesNode;var JM=KM;class QM extends HM{constructor(t){super(t=t||{}),this.schemaLocation=t.schemaLocation?t.schemaLocation:this.namespace+" http://schemas.opengis.net/gml/3.2.1/gml.xsd"}}QM.prototype.namespace="http://www.opengis.net/gml/3.2",QM.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS={"http://www.opengis.net/gml/3.2":{pos:ku(HM.prototype.readFlatPos),posList:ku(HM.prototype.readFlatPosList),coordinates:ku(ZM.prototype.readFlatCoordinates)}},QM.prototype.FLAT_LINEAR_RINGS_PARSERS={"http://www.opengis.net/gml/3.2":{interior:HM.prototype.interiorParser,exterior:HM.prototype.exteriorParser}},QM.prototype.GEOMETRY_PARSERS={"http://www.opengis.net/gml/3.2":{Point:ku(IM.prototype.readPoint),MultiPoint:ku(IM.prototype.readMultiPoint),LineString:ku(IM.prototype.readLineString),MultiLineString:ku(IM.prototype.readMultiLineString),LinearRing:ku(IM.prototype.readLinearRing),Polygon:ku(IM.prototype.readPolygon),MultiPolygon:ku(IM.prototype.readMultiPolygon),Surface:ku(QM.prototype.readSurface),MultiSurface:ku(HM.prototype.readMultiSurface),Curve:ku(QM.prototype.readCurve),MultiCurve:ku(HM.prototype.readMultiCurve),Envelope:ku(QM.prototype.readEnvelope)}},QM.prototype.MULTICURVE_PARSERS={"http://www.opengis.net/gml/3.2":{curveMember:Au(HM.prototype.curveMemberParser),curveMembers:Au(HM.prototype.curveMemberParser)}},QM.prototype.MULTISURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{surfaceMember:Au(HM.prototype.surfaceMemberParser),surfaceMembers:Au(HM.prototype.surfaceMemberParser)}},QM.prototype.CURVEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:Au(IM.prototype.readLineString),Curve:Au(HM.prototype.readCurve)}},QM.prototype.SURFACEMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:Au(IM.prototype.readPolygon),Surface:Au(HM.prototype.readSurface)}},QM.prototype.SURFACE_PARSERS={"http://www.opengis.net/gml/3.2":{patches:ku(HM.prototype.readPatch)}},QM.prototype.CURVE_PARSERS={"http://www.opengis.net/gml/3.2":{segments:ku(HM.prototype.readSegment)}},QM.prototype.ENVELOPE_PARSERS={"http://www.opengis.net/gml/3.2":{lowerCorner:Au(HM.prototype.readFlatPosList),upperCorner:Au(HM.prototype.readFlatPosList)}},QM.prototype.PATCHES_PARSERS={"http://www.opengis.net/gml/3.2":{PolygonPatch:ku(HM.prototype.readPolygonPatch)}},QM.prototype.SEGMENTS_PARSERS={"http://www.opengis.net/gml/3.2":{LineStringSegment:Iu(HM.prototype.readLineStringSegment)}},QM.prototype.MULTIPOINT_PARSERS={"http://www.opengis.net/gml/3.2":{pointMember:Au(IM.prototype.pointMemberParser),pointMembers:Au(IM.prototype.pointMemberParser)}},QM.prototype.MULTILINESTRING_PARSERS={"http://www.opengis.net/gml/3.2":{lineStringMember:Au(IM.prototype.lineStringMemberParser),lineStringMembers:Au(IM.prototype.lineStringMemberParser)}},QM.prototype.MULTIPOLYGON_PARSERS={"http://www.opengis.net/gml/3.2":{polygonMember:Au(IM.prototype.polygonMemberParser),polygonMembers:Au(IM.prototype.polygonMemberParser)}},QM.prototype.POINTMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Point:Au(IM.prototype.readFlatCoordinatesFromNode)}},QM.prototype.LINESTRINGMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{LineString:Au(IM.prototype.readLineString)}},QM.prototype.POLYGONMEMBER_PARSERS={"http://www.opengis.net/gml/3.2":{Polygon:Au(IM.prototype.readPolygon)}},QM.prototype.RING_PARSERS={"http://www.opengis.net/gml/3.2":{LinearRing:ku(IM.prototype.readFlatLinearRing),Ring:ku(QM.prototype.readFlatCurveRing)}},QM.prototype.RING_SERIALIZERS={"http://www.opengis.net/gml/3.2":{exterior:Nu(HM.prototype.writeRing),interior:Nu(HM.prototype.writeRing)}},QM.prototype.ENVELOPE_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lowerCorner:Nu(qM),upperCorner:Nu(qM)}},QM.prototype.SURFACEORPOLYGONMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{surfaceMember:Nu(HM.prototype.writeSurfaceOrPolygonMember),polygonMember:Nu(HM.prototype.writeSurfaceOrPolygonMember)}},QM.prototype.POINTMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{pointMember:Nu(HM.prototype.writePointMember)}},QM.prototype.LINESTRINGORCURVEMEMBER_SERIALIZERS={"http://www.opengis.net/gml/3.2":{lineStringMember:Nu(HM.prototype.writeLineStringOrCurveMember),curveMember:Nu(HM.prototype.writeLineStringOrCurveMember)}},QM.prototype.GEOMETRY_SERIALIZERS={"http://www.opengis.net/gml/3.2":{Curve:Nu(HM.prototype.writeCurveOrLineString),MultiCurve:Nu(HM.prototype.writeMultiCurveOrLineString),Point:Nu(QM.prototype.writePoint),MultiPoint:Nu(HM.prototype.writeMultiPoint),LineString:Nu(HM.prototype.writeCurveOrLineString),MultiLineString:Nu(HM.prototype.writeMultiCurveOrLineString),LinearRing:Nu(HM.prototype.writeLinearRing),Polygon:Nu(HM.prototype.writeSurfaceOrPolygon),MultiPolygon:Nu(HM.prototype.writeMultiSurfaceOrPolygon),Surface:Nu(HM.prototype.writeSurfaceOrPolygon),MultiSurface:Nu(HM.prototype.writeMultiSurfaceOrPolygon),Envelope:Nu(HM.prototype.writeEnvelope)}};var tS=QM;const eS=[null,"http://www.topografix.com/GPX/1/0","http://www.topografix.com/GPX/1/1"],iS={rte:FS,trk:IS,wpt:AS},nS=Du(eS,{rte:Au(FS),trk:Au(IS),wpt:Au(AS)}),sS=Du(eS,{text:Lu(GM,"linkText"),type:Lu(GM,"linkType")}),rS=Du(eS,{rte:Nu((function(t,e,i){const n=i[0],s=e.getProperties(),r={node:t};r.properties=s;const o=e.getGeometry();if("LineString"==o.getType()){const t=cg(o,!0,n);r.geometryLayout=t.getLayout(),s.rtept=t.getCoordinates()}const h=i[i.length-1].node,a=pS[h.namespaceURI],u=ju(s,a);qu(r,mS,Gu,u,i,a)})),trk:Nu((function(t,e,i){const n=i[0],s=e.getProperties(),r={node:t};r.properties=s;const o=e.getGeometry();if("MultiLineString"==o.getType()){const t=cg(o,!0,n);s.trkseg=t.getLineStrings()}const h=i[i.length-1].node,a=gS[h.namespaceURI],u=ju(s,a);qu(r,yS,Gu,u,i,a)})),wpt:Nu((function(t,e,i){const n=i[0],s=i[i.length-1];s.properties=e.getProperties();const r=e.getGeometry();if("Point"==r.getType()){const e=cg(r,!0,n);s.geometryLayout=e.getLayout(),RS(t,e.getCoordinates(),i)}}))});const oS=Du(eS,{name:Lu(GM),cmt:Lu(GM),desc:Lu(GM),src:Lu(GM),link:TS,number:Lu(OM),extensions:CS,type:Lu(GM),rtept:function(t,e){const i=$u({},hS,t,e);if(i){const n=e[e.length-1],s=n.flatCoordinates,r=n.layoutOptions;_S(s,r,t,i)}}}),hS=Du(eS,{ele:Lu(LM),time:Lu(RM)}),aS=Du(eS,{name:Lu(GM),cmt:Lu(GM),desc:Lu(GM),src:Lu(GM),link:TS,number:Lu(OM),type:Lu(GM),extensions:CS,trkseg:function(t,e){const i=e[e.length-1];Uu(uS,t,e);const n=i.flatCoordinates;i.ends.push(n.length)}}),uS=Du(eS,{trkpt:function(t,e){const i=$u({},lS,t,e);if(i){const n=e[e.length-1],s=n.flatCoordinates,r=n.layoutOptions;_S(s,r,t,i)}}}),lS=Du(eS,{ele:Lu(LM),time:Lu(RM)}),cS=Du(eS,{ele:Lu(LM),time:Lu(RM),magvar:Lu(LM),geoidheight:Lu(LM),name:Lu(GM),cmt:Lu(GM),desc:Lu(GM),src:Lu(GM),link:TS,sym:Lu(GM),type:Lu(GM),fix:Lu(GM),sat:Lu(OM),hdop:Lu(LM),vdop:Lu(LM),pdop:Lu(LM),ageofdgpsdata:Lu(LM),dgpsid:Lu(OM),extensions:CS}),fS=["text","type"],dS=Du(eS,{text:Nu(qM),type:Nu(qM)}),pS=Du(eS,["name","cmt","desc","src","link","number","type","rtept"]),mS=Du(eS,{name:Nu(qM),cmt:Nu(qM),desc:Nu(qM),src:Nu(qM),link:Nu(kS),number:Nu(BM),type:Nu(qM),rtept:Ou(Nu(RS))}),vS=Du(eS,["ele","time"]),gS=Du(eS,["name","cmt","desc","src","link","number","type","trkseg"]),yS=Du(eS,{name:Nu(qM),cmt:Nu(qM),desc:Nu(qM),src:Nu(qM),link:Nu(kS),number:Nu(BM),type:Nu(qM),trkseg:Ou(Nu((function(t,e,i){const n={node:t};n.geometryLayout=e.getLayout(),n.properties={},qu(n,xS,wS,e.getCoordinates(),i)})))}),wS=zu("trkpt"),xS=Du(eS,{trkpt:Nu(RS)}),bS=Du(eS,["ele","time","magvar","geoidheight","name","cmt","desc","src","link","sym","type","fix","sat","hdop","vdop","pdop","ageofdgpsdata","dgpsid"]),MS=Du(eS,{ele:Nu($M),time:Nu(UM),magvar:Nu($M),geoidheight:Nu($M),name:Nu(qM),cmt:Nu(qM),desc:Nu(qM),src:Nu(qM),link:Nu(kS),sym:Nu(qM),type:Nu(qM),fix:Nu(qM),sat:Nu(BM),hdop:Nu($M),vdop:Nu($M),pdop:Nu($M),ageofdgpsdata:Nu($M),dgpsid:Nu(BM)}),SS={Point:"wpt",LineString:"rte",MultiLineString:"trk"};function PS(t,e,i){const n=t.getGeometry();if(n){const t=SS[n.getType()];if(t){return Pu(e[e.length-1].node.namespaceURI,t)}}}function _S(t,e,i,n){return t.push(parseFloat(i.getAttribute("lon")),parseFloat(i.getAttribute("lat"))),"ele"in n?(t.push(n.ele),delete n.ele,e.hasZ=!0):t.push(0),"time"in n?(t.push(n.time),delete n.time,e.hasM=!0):t.push(0),t}function ES(t,e,i){let n="XY",s=2;if(t.hasZ&&t.hasM?(n="XYZM",s=4):t.hasZ?(n="XYZ",s=3):t.hasM&&(n="XYM",s=3),4!==s){for(let i=0,n=e.length/4;i<n;i++)e[i*s]=e[4*i],e[i*s+1]=e[4*i+1],t.hasZ&&(e[i*s+2]=e[4*i+2]),t.hasM&&(e[i*s+2]=e[4*i+3]);if(e.length=e.length/4*s,i)for(let t=0,e=i.length;t<e;t++)i[t]=i[t]/4*s}return n}function TS(t,e){const i=e[e.length-1],n=t.getAttribute("href");null!==n&&(i.link=n),Uu(sS,t,e)}function CS(t,e){e[e.length-1].$v=t}function FS(t,e){const i=e[0],n=$u({flatCoordinates:[],layoutOptions:{}},oS,t,e);if(!n)return;const s=n.flatCoordinates;delete n.flatCoordinates;const r=n.layoutOptions;delete n.layoutOptions;const o=ES(r,s),h=new $v(s,o);cg(h,!1,i);const a=new pt(h);return a.setProperties(n,!0),a}function IS(t,e){const i=e[0],n=$u({flatCoordinates:[],ends:[],layoutOptions:{}},aS,t,e);if(!n)return;const s=n.flatCoordinates;delete n.flatCoordinates;const r=n.ends;delete n.ends;const o=n.layoutOptions;delete n.layoutOptions;const h=ES(o,s,r),a=new qv(s,h,r);cg(a,!1,i);const u=new pt(a);return u.setProperties(n,!0),u}function AS(t,e){const i=e[0],n=$u({},cS,t,e);if(!n)return;const s={},r=_S([],s,t,n),o=ES(s,r),h=new Qn(r,o);cg(h,!1,i);const a=new pt(h);return a.setProperties(n,!0),a}function kS(t,e,i){t.setAttribute("href",e);const n=i[i.length-1].properties,s=[n.linkText,n.linkType];qu({node:t},dS,Gu,s,i,fS)}function RS(t,e,i){const n=i[i.length-1],s=n.node.namespaceURI,r=n.properties;t.setAttributeNS(null,"lat",String(e[1])),t.setAttributeNS(null,"lon",String(e[0]));switch(n.geometryLayout){case"XYZM":0!==e[3]&&(r.time=e[3]);case"XYZ":0!==e[2]&&(r.ele=e[2]);break;case"XYM":0!==e[2]&&(r.time=e[2])}const o="rtept"==t.nodeName?vS[s]:bS[s],h=ju(r,o);qu({node:t,properties:r},MS,Gu,h,i,o)}var LS=class extends EM{constructor(t){super(),t=t||{},this.dataProjection=Yi("EPSG:4326"),this.Bv=t.readExtensions}qv(t){t||(t=[]);for(let e=0,i=t.length;e<i;++e){const i=t[e];if(this.Bv){const t=i.get("extensionsNode_")||null;this.Bv(i,t)}i.set("extensionsNode_",void 0)}}readFeatureFromNode(t,e){if(!eS.includes(t.namespaceURI))return null;const i=iS[t.localName];if(!i)return null;const n=i(t,[this.getReadOptions(t,e)]);return n?(this.qv([n]),n):null}readFeaturesFromNode(t,e){if(!eS.includes(t.namespaceURI))return[];if("gpx"==t.localName){const i=$u([],nS,t,[this.getReadOptions(t,e)]);return i?(this.qv(i),i):[]}return[]}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=Pu("http://www.topografix.com/GPX/1/1","gpx");return i.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xsi",Su),i.setAttributeNS(Su,"xsi:schemaLocation","http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"),i.setAttribute("version","1.1"),i.setAttribute("creator","OpenLayers"),qu({node:i},rS,PS,t,[e]),i}};function NS(t){return"string"==typeof t?t:""}var OS=class extends lg{constructor(){super()}getType(){return"text"}readFeature(t,e){return this.readFeatureFromText(NS(t),this.adaptOptions(e))}readFeatureFromText(e,i){return t()}readFeatures(t,e){return this.readFeaturesFromText(NS(t),this.adaptOptions(e))}readFeaturesFromText(e,i){return t()}readGeometry(t,e){return this.readGeometryFromText(NS(t),this.adaptOptions(e))}readGeometryFromText(e,i){return t()}readProjection(t){return this.readProjectionFromText(NS(t))}readProjectionFromText(t){return this.dataProjection}writeFeature(t,e){return this.writeFeatureText(t,this.adaptOptions(e))}writeFeatureText(e,i){return t()}writeFeatures(t,e){return this.writeFeaturesText(t,this.adaptOptions(e))}writeFeaturesText(e,i){return t()}writeGeometry(t,e){return this.writeGeometryText(t,this.adaptOptions(e))}writeGeometryText(e,i){return t()}};const zS=/^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{5})([NS])(\d{3})(\d{5})([EW])([AV])(\d{5})(\d{5})/,GS=/^H.([A-Z]{3}).*?:(.*)/,jS=/^HFDTE(\d{2})(\d{2})(\d{2})/,DS=/\r\n|\r|\n/;var US=class extends OS{constructor(t){super(),t=t||{},this.dataProjection=Yi("EPSG:4326"),this.Xv=t.altitudeMode?t.altitudeMode:"none"}readFeatureFromText(t,e){const i=this.Xv,n=t.split(DS),s={},r=[];let o,h,a=2e3,u=0,l=1,c=-1;for(o=0,h=n.length;o<h;++o){const t=n[o];let e;if("B"==t.charAt(0)){if(e=zS.exec(t),e){const t=parseInt(e[1],10),n=parseInt(e[2],10),s=parseInt(e[3],10);let o=parseInt(e[4],10)+parseInt(e[5],10)/6e4;"S"==e[6]&&(o=-o);let h=parseInt(e[7],10)+parseInt(e[8],10)/6e4;if("W"==e[9]&&(h=-h),r.push(h,o),"none"!=i){let t;t="gps"==i?parseInt(e[11],10):"barometric"==i?parseInt(e[12],10):0,r.push(t)}let f=Date.UTC(a,u,l,t,n,s);f<c&&(f=Date.UTC(a,u,l+1,t,n,s)),r.push(f/1e3),c=f}}else"H"==t.charAt(0)&&(e=jS.exec(t),e?(l=parseInt(e[1],10),u=parseInt(e[2],10)-1,a=2e3+parseInt(e[3],10)):(e=GS.exec(t),e&&(s[e[1]]=e[2].trim())))}if(0===r.length)return null;const f=new $v(r,"none"==i?"XYM":"XYZM"),d=new pt(cg(f,!1,e));return d.setProperties(s,!0),d}readFeaturesFromText(t,e){const i=this.readFeatureFromText(t,e);return i?[i]:[]}};const $S=["http://www.google.com/kml/ext/2.2"],BS=[null,"http://earth.google.com/kml/2.0","http://earth.google.com/kml/2.1","http://earth.google.com/kml/2.2","http://www.opengis.net/kml/2.2"],qS={fraction:"fraction",pixels:"pixels",insetPixels:"pixels"},XS=Du(BS,{ExtendedData:ZP,Region:VP,MultiGeometry:Lu(GP,"geometry"),LineString:Lu(NP,"geometry"),LinearRing:Lu(OP,"geometry"),Point:Lu(jP,"geometry"),Polygon:Lu(UP,"geometry"),Style:Lu(BP),StyleMap:function(t,e){const i=bP.call(this,t,e);if(!i)return;const n=e[e.length-1];Array.isArray(i)?n.Style=i:"string"==typeof i?n.styleUrl=i:ct(!1,38)},address:Lu(GM),description:Lu(GM),name:Lu(GM),open:Lu(AM),phoneNumber:Lu(GM),styleUrl:Lu(yP),visibility:Lu(AM)},Du($S,{MultiTrack:Lu((function(t,e){const i=$u([],CP,t,e);if(!i)return;return new qv(i)}),"geometry"),Track:Lu(IP,"geometry")})),YS=Du(BS,{ExtendedData:ZP,Region:VP,Link:function(t,e){Uu(ZS,t,e)},address:Lu(GM),description:Lu(GM),name:Lu(GM),open:Lu(AM),phoneNumber:Lu(GM),visibility:Lu(AM)}),ZS=Du(BS,{href:Lu(gP)}),VS=Du(BS,{LatLonAltBox:function(t,e){const i=$u({},KP,t,e);if(!i)return;const n=e[e.length-1],s=[parseFloat(i.west),parseFloat(i.south),parseFloat(i.east),parseFloat(i.north)];n.extent=s,n.altitudeMode=i.altitudeMode,n.minAltitude=parseFloat(i.minAltitude),n.maxAltitude=parseFloat(i.maxAltitude)},Lod:function(t,e){const i=$u({},JP,t,e);if(!i)return;const n=e[e.length-1];n.minLodPixels=parseFloat(i.minLodPixels),n.maxLodPixels=parseFloat(i.maxLodPixels),n.minFadeExtent=parseFloat(i.minFadeExtent),n.maxFadeExtent=parseFloat(i.maxFadeExtent)}}),WS=Du(BS,["Document","Placemark"]),HS=Du(BS,{Document:Nu((function(t,e,i){qu({node:t},n_,s_,e,i,void 0,this)})),Placemark:Nu(C_)});let KS,JS,QS,tP,eP,iP,nP=null;let sP,rP=null;let oP,hP=null;let aP=null;let uP=null;let lP,cP=null;function fP(t){return 32/Math.min(t[0],t[1])}function dP(t){return t}function pP(t,e,i){return Array.isArray(t)?t:"string"==typeof t?pP(i[t],e,i):e}function mP(t){const e=_u(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 vP(t){let e=_u(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 s;for(;s=n.exec(e);){const t=parseFloat(s[1]),n=parseFloat(s[2]),r=s[3]?parseFloat(s[3]):0;i.push(t,n,r),e=e.substr(s[0].length)}if(""===e)return i}function gP(t){const e=_u(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 yP(t){const e=_u(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 wP(t){return LM(t)}const xP=Du(BS,{Pair:function(t,e){const i=$u({},WP,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 bP(t,e){return $u(void 0,xP,t,e,this)}const MP=Du(BS,{Icon:Lu((function(t,e){const i=$u({},AP,t,e);return i||null})),color:Lu(mP),heading:Lu(LM),hotSpot:Lu((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:qS[e],y:parseFloat(t.getAttribute("y")),yunits:qS[i],origin:n}})),scale:Lu(wP)});const SP=Du(BS,{color:Lu(mP),scale:Lu(wP)});const PP=Du(BS,{color:Lu(mP),width:Lu(LM)});const _P=Du(BS,{color:Lu(mP),fill:Lu(AM),outline:Lu(AM)});const EP=Du(BS,{coordinates:ku(vP)});function TP(t,e){return $u(null,EP,t,e)}const CP=Du($S,{Track:Au(IP)});const FP=Du(BS,{when:function(t,e){const i=e[e.length-1].whens,n=_u(t,!1),s=Date.parse(n);i.push(isNaN(s)?0:s)}},Du($S,{coord:function(t,e){const i=e[e.length-1].coordinates,n=_u(t,!1),s=/^\s*([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s+([+\-]?\d+(?:\.\d*)?(?:e[+\-]?\d*)?)\s*$/i.exec(n);if(s){const t=parseFloat(s[1]),e=parseFloat(s[2]),n=parseFloat(s[3]);i.push([t,e,n])}else i.push([])}}));function IP(t,e){const i=$u({coordinates:[],whens:[]},FP,t,e);if(!i)return;const n=[],s=i.coordinates,r=i.whens;for(let t=0,e=Math.min(s.length,r.length);t<e;++t)3==s[t].length&&n.push(s[t][0],s[t][1],s[t][2],r[t]);return new $v(n,"XYZM")}const AP=Du(BS,{href:Lu(gP)},Du($S,{x:Lu(LM),y:Lu(LM),w:Lu(LM),h:Lu(LM)}));const kP=Du(BS,{coordinates:ku(vP)});function RP(t,e){return $u(null,kP,t,e)}const LP=Du(BS,{extrude:Lu(AM),tessellate:Lu(AM),altitudeMode:Lu(GM)});function NP(t,e){const i=$u({},LP,t,e),n=RP(t,e);if(n){const t=new $v(n,"XYZ");return t.setProperties(i,!0),t}}function OP(t,e){const i=$u({},LP,t,e),n=RP(t,e);if(n){const t=new xs(n,"XYZ",[n.length]);return t.setProperties(i,!0),t}}const zP=Du(BS,{LineString:Au(NP),LinearRing:Au(OP),MultiGeometry:Au(GP),Point:Au(jP),Polygon:Au(UP)});function GP(t,e){const i=$u([],zP,t,e);if(!i)return null;if(0===i.length)return new Mg(i);let n,s=!0;const r=i[0].getType();let o;for(let t=1,e=i.length;t<e;++t)if(o=i[t],o.getType()!=r){s=!1;break}if(s){let t,e;if("Point"==r){const s=i[0];t=s.getLayout(),e=s.getFlatCoordinates();for(let t=1,n=i.length;t<n;++t)o=i[t],v(e,o.getFlatCoordinates());n=new zv(e,t),qP(n,i)}else"LineString"==r?(n=new qv(i),qP(n,i)):"Polygon"==r?(n=new Zv(i),qP(n,i)):"GeometryCollection"==r?n=new Mg(i):ct(!1,37)}else n=new Mg(i);return n}function jP(t,e){const i=$u({},LP,t,e),n=RP(t,e);if(n){const t=new Qn(n,"XYZ");return t.setProperties(i,!0),t}}const DP=Du(BS,{innerBoundaryIs:function(t,e){const i=$u([],QP,t,e);if(i.length>0){e[e.length-1].push(...i)}},outerBoundaryIs:function(t,e){const i=$u(void 0,t_,t,e);if(i){e[e.length-1][0]=i}}});function UP(t,e){const i=$u({},LP,t,e),n=$u([null],DP,t,e);if(n&&n[0]){const t=n[0],e=[t.length];for(let i=1,s=n.length;i<s;++i)v(t,n[i]),e.push(t.length);const s=new xs(t,"XYZ",e);return s.setProperties(i,!0),s}}const $P=Du(BS,{IconStyle:function(t,e){const i=$u({},MP,t,e);if(!i)return;const n=e[e.length-1],s="Icon"in i?i.Icon:{},r=!("Icon"in i)||Object.keys(s).length>0;let o;const h=s.href;let a,u,l;h?o=h:r&&(o=iP);let c="bottom-left";const f=i.hotSpot;let d;f?(a=[f.x,f.y],u=f.xunits,l=f.yunits,c=f.origin):/^https?:\/\/maps\.(?:google|gstatic)\.com\//.test(o)&&(o.includes("pushpin")?(a=JS,u=QS,l=tP):o.includes("arrow-reverse")?(a=[54,42],u=QS,l=tP):o.includes("paddle")&&(a=[32,1],u=QS,l=tP));const p=s.x,m=s.y;let v;void 0!==p&&void 0!==m&&(d=[p,m]);const g=s.w,y=s.h;let w;void 0!==g&&void 0!==y&&(v=[g,y]);const x=i.heading;void 0!==x&&(w=fi(x));const b=i.scale,M=i.color;if(r){o==iP&&(v=eP);const t=new Rc({anchor:a,anchorOrigin:c,anchorXUnits:u,anchorYUnits:l,crossOrigin:this.qt,offset:d,offsetOrigin:"bottom-left",rotation:w,scale:b,size:v,src:this.Yv(o),color:M}),e=t.getScaleArray()[0],i=t.getSize();if(null===i){const i=t.getImageState();if(i===Gs||i===js){const n=function(){const i=t.getImageState();if(i!==Gs&&i!==js){const i=t.getSize();if(i&&2==i.length){const n=fP(i);t.setScale(e*n)}t.unlistenImageChange(n)}};t.listenImageChange(n),i===Gs&&t.load()}}else if(2==i.length){const n=fP(i);t.setScale(e*n)}n.imageStyle=t}else n.imageStyle=sP},LabelStyle:function(t,e){const i=$u({},SP,t,e);if(!i)return;const n=e[e.length-1],s=new qc({fill:new Tc({color:"color"in i?i.color:KS}),scale:i.scale});n.textStyle=s},LineStyle:function(t,e){const i=$u({},PP,t,e);if(!i)return;const n=e[e.length-1],s=new Nc({color:"color"in i?i.color:KS,width:"width"in i?i.width:1});n.strokeStyle=s},PolyStyle:function(t,e){const i=$u({},_P,t,e);if(!i)return;const n=e[e.length-1],s=new Tc({color:"color"in i?i.color:KS});n.fillStyle=s;const r=i.fill;void 0!==r&&(n.fill=r);const o=i.outline;void 0!==o&&(n.outline=o)}});function BP(t,e){const i=$u({},$P,t,e,this);if(!i)return null;let n="fillStyle"in i?i.fillStyle:nP;const s=i.fill;let r;void 0===s||s||(n=null),"imageStyle"in i?i.imageStyle!=sP&&(r=i.imageStyle):r=rP;const o="textStyle"in i?i.textStyle:aP,h="strokeStyle"in i?i.strokeStyle:hP,a=i.outline;return void 0===a||a?[new $c({fill:n,image:r,stroke:h,text:o,zIndex:void 0})]:[new $c({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Mg(e.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"!==e&&"MultiPolygon"!==e})))}if("Polygon"!==i&&"MultiPolygon"!==i)return e},fill:n,image:r,stroke:h,text:o,zIndex:void 0}),new $c({geometry:function(t){const e=t.getGeometry(),i=e.getType();if("GeometryCollection"===i){return new Mg(e.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 qP(t,e){const i=e.length,n=new Array(e.length),s=new Array(e.length),r=new Array(e.length);let o,h,a;o=!1,h=!1,a=!1;for(let t=0;t<i;++t){const i=e[t];n[t]=i.get("extrude"),s[t]=i.get("tessellate"),r[t]=i.get("altitudeMode"),o=o||void 0!==n[t],h=h||void 0!==s[t],a=a||r[t]}o&&t.set("extrude",n),h&&t.set("tessellate",s),a&&t.set("altitudeMode",r)}const XP=Du(BS,{displayName:Lu(GM),value:Lu(GM)});const YP=Du(BS,{Data:function(t,e){const i=t.getAttribute("name");Uu(XP,t,e);const n=e[e.length-1];i&&n.displayName?n[i]={value:n.value,displayName:n.displayName,toString:function(){return n.value}}:null!==i?n[i]=n.value:null!==n.displayName&&(n[n.displayName]=n.value),delete n.value},SchemaData:function(t,e){Uu(HP,t,e)}});function ZP(t,e){Uu(YP,t,e)}function VP(t,e){Uu(VS,t,e)}const WP=Du(BS,{Style:Lu(BP),key:Lu(GM),styleUrl:Lu(yP)});const HP=Du(BS,{SimpleData:function(t,e){const i=t.getAttribute("name");if(null!==i){const n=GM(t);e[e.length-1][i]=n}}});const KP=Du(BS,{altitudeMode:Lu(GM),minAltitude:Lu(LM),maxAltitude:Lu(LM),north:Lu(LM),south:Lu(LM),east:Lu(LM),west:Lu(LM)});const JP=Du(BS,{minLodPixels:Lu(LM),maxLodPixels:Lu(LM),minFadeExtent:Lu(LM),maxFadeExtent:Lu(LM)});const QP=Du(BS,{LinearRing:Au(TP)});const t_=Du(BS,{LinearRing:ku(TP)});function e_(t,e){const i=hr(e),n=[255*(4==i.length?i[3]:1),i[2],i[1],i[0]];for(let t=0;t<4;++t){const e=Math.floor(n[t]).toString(16);n[t]=1==e.length?"0"+e:e}qM(t,n.join(""))}const i_=Du(BS,{Data:Nu((function(t,e,i){t.setAttribute("name",e.name);const n={node:t},s=e.value;"object"==typeof s?(null!==s&&s.displayName&&qu(n,i_,Gu,[s.displayName],i,["displayName"]),null!==s&&s.value&&qu(n,i_,Gu,[s.value],i,["value"])):qu(n,i_,Gu,[s],i,["value"])})),value:Nu((function(t,e){qM(t,e)})),displayName:Nu((function(t,e){DM(t,e)}))});const n_=Du(BS,{Placemark:Nu(C_)}),s_=function(t,e,i){return Pu(e[e.length-1].node.namespaceURI,"Placemark")};const r_=zu("Data");const o_=Du(BS,["href"],Du($S,["x","y","w","h"])),h_=Du(BS,{href:Nu(qM)},Du($S,{x:Nu($M),y:Nu($M),w:Nu($M),h:Nu($M)})),a_=function(t,e,i){return Pu($S[0],"gx:"+i)};const u_=Du(BS,["scale","heading","Icon","color","hotSpot"]),l_=Du(BS,{Icon:Nu((function(t,e,i){const n={node:t},s=i[i.length-1].node;let r=o_[s.namespaceURI],o=ju(e,r);qu(n,h_,Gu,o,i,r),r=o_[$S[0]],o=ju(e,r),qu(n,h_,a_,o,i,r)})),color:Nu(e_),heading:Nu($M),hotSpot:Nu((function(t,e){t.setAttribute("x",String(e.x)),t.setAttribute("y",String(e.y)),t.setAttribute("xunits",e.xunits),t.setAttribute("yunits",e.yunits)})),scale:Nu(G_)});const c_=Du(BS,["color","scale"]),f_=Du(BS,{color:Nu(e_),scale:Nu(G_)});const d_=Du(BS,["color","width"]),p_=Du(BS,{color:Nu(e_),width:Nu($M)});const m_={Point:"Point",LineString:"LineString",LinearRing:"LinearRing",Polygon:"Polygon",MultiPoint:"MultiGeometry",MultiLineString:"MultiGeometry",MultiPolygon:"MultiGeometry",GeometryCollection:"MultiGeometry"},v_=function(t,e,i){if(t){return Pu(e[e.length-1].node.namespaceURI,m_[t.getType()])}},g_=zu("Point"),y_=zu("LineString"),w_=zu("LinearRing"),x_=zu("Polygon"),b_=Du(BS,{LineString:Nu(A_),Point:Nu(A_),Polygon:Nu(O_),GeometryCollection:Nu(M_)});function M_(t,e,i){const n={node:t},s=e.getType();let r,o=[];"GeometryCollection"===s?(e.getGeometriesArrayRecursive().forEach((function(t){const e=t.getType();"MultiPoint"===e?o=o.concat(t.getPoints()):"MultiLineString"===e?o=o.concat(t.getLineStrings()):"MultiPolygon"===e?o=o.concat(t.getPolygons()):"Point"===e||"LineString"===e||"Polygon"===e?o.push(t):ct(!1,39)})),r=v_):"MultiPoint"===s?(o=e.getPoints(),r=g_):"MultiLineString"===s?(o=e.getLineStrings(),r=y_):"MultiPolygon"===s?(o=e.getPolygons(),r=x_):ct(!1,39),qu(n,b_,r,o,i)}const S_=Du(BS,{LinearRing:Nu(A_)});function P_(t,e,i){qu({node:t},S_,w_,[e],i)}const __=Du(BS,{ExtendedData:Nu((function(t,e,i){const n={node:t},s=e.names,r=e.values,o=s.length;for(let t=0;t<o;t++)qu(n,i_,r_,[{name:s[t],value:r[t]}],i)})),MultiGeometry:Nu(M_),LineString:Nu(A_),LinearRing:Nu(A_),Point:Nu(A_),Polygon:Nu(O_),Style:Nu((function(t,e,i){const n={node:t},s={};if(e.pointStyles.length){const t=e.pointStyles[0].getText();t&&(s.LabelStyle=t);const i=e.pointStyles[0].getImage();i&&"function"==typeof i.getSrc&&(s.IconStyle=i)}if(e.lineStyles.length){const t=e.lineStyles[0].getStroke();t&&(s.LineStyle=t)}if(e.polyStyles.length){const t=e.polyStyles[0].getStroke();t&&!s.LineStyle&&(s.LineStyle=t),s.PolyStyle=e.polyStyles[0]}const r=i[i.length-1].node,o=j_[r.namespaceURI],h=ju(s,o);qu(n,D_,Gu,h,i,o)})),address:Nu(qM),description:Nu(qM),name:Nu(qM),open:Nu(jM),phoneNumber:Nu(qM),styleUrl:Nu(qM),visibility:Nu(jM)}),E_=Du(BS,["name","open","visibility","address","phoneNumber","description","styleUrl","Style"]),T_=zu("ExtendedData");function C_(t,e,i){const n={node:t};e.getId()&&t.setAttribute("id",e.getId());const s=e.getProperties(),r={address:1,description:1,name:1,open:1,phoneNumber:1,styleUrl:1,visibility:1};r[e.getGeometryName()]=1;const o=Object.keys(s||{}).sort().filter((function(t){return!r[t]})),h=e.getStyleFunction();if(h){const t=h(e,0);if(t){const i=Array.isArray(t)?t:[t];let n=i;if(e.getGeometry()&&(n=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Point"===e||"MultiPoint"===e})).length:"Point"===t||"MultiPoint"===t}}))),this.Zv){let t=i,r=i;e.getGeometry()&&(t=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"LineString"===e||"MultiLineString"===e})).length:"LineString"===t||"MultiLineString"===t}})),r=i.filter((function(t){const i=t.getGeometryFunction()(e);if(i){const t=i.getType();return"GeometryCollection"===t?i.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Polygon"===e||"MultiPolygon"===e})).length:"Polygon"===t||"MultiPolygon"===t}}))),s.Style={pointStyles:n,lineStyles:t,polyStyles:r}}if(n.length&&void 0===s.name){const t=n[0].getText();t&&(s.name=t.getText())}}}const a=i[i.length-1].node,u=E_[a.namespaceURI],l=ju(s,u);if(qu(n,__,Gu,l,i,u),o.length>0){const t=ju(s,o);qu(n,__,T_,[{names:o,values:t}],i)}const c=i[0];let f=e.getGeometry();f&&(f=cg(f,!0,c)),qu(n,__,v_,[f],i)}const F_=Du(BS,["extrude","tessellate","altitudeMode","coordinates"]),I_=Du(BS,{extrude:Nu(jM),tessellate:Nu(jM),altitudeMode:Nu(qM),coordinates:Nu((function(t,e,i){const n=i[i.length-1],s=n.layout,r=n.stride;let o;"XY"==s||"XYM"==s?o=2:"XYZ"==s||"XYZM"==s?o=3:ct(!1,34);const h=e.length;let a="";if(h>0){a+=e[0];for(let t=1;t<o;++t)a+=","+e[t];for(let t=r;t<h;t+=r){a+=" "+e[t];for(let i=1;i<o;++i)a+=","+e[t+i]}}qM(t,a)}))});function A_(t,e,i){const n=e.getFlatCoordinates(),s={node:t};s.layout=e.getLayout(),s.stride=e.getStride();const r=e.getProperties();r.coordinates=n;const o=i[i.length-1].node,h=F_[o.namespaceURI],a=ju(r,h);qu(s,I_,Gu,a,i,h)}const k_=Du(BS,["color","fill","outline"]),R_=Du(BS,{outerBoundaryIs:Nu(P_),innerBoundaryIs:Nu(P_)}),L_=zu("innerBoundaryIs"),N_=zu("outerBoundaryIs");function O_(t,e,i){const n=e.getLinearRings(),s=n.shift(),r={node:t};qu(r,R_,L_,n,i),qu(r,R_,N_,[s],i)}const z_=Du(BS,{color:Nu(e_),fill:Nu(jM),outline:Nu(jM)});function G_(t,e){$M(t,Math.round(1e6*e)/1e6)}const j_=Du(BS,["IconStyle","LabelStyle","LineStyle","PolyStyle"]),D_=Du(BS,{IconStyle:Nu((function(t,e,i){const n={node:t},s={},r=e.getSrc(),o=e.getSize(),h=e.getImageSize(),a={href:r};if(o){a.w=o[0],a.h=o[1];const t=e.getAnchor(),i=e.getOrigin();if(i&&h&&0!==i[0]&&i[1]!==o[1]&&(a.x=i[0],a.y=h[1]-(i[1]+o[1])),t&&(t[0]!==o[0]/2||t[1]!==o[1]/2)){const e={x:t[0],xunits:"pixels",y:o[1]-t[1],yunits:"pixels"};s.hotSpot=e}}s.Icon=a;let u=e.getScaleArray()[0],l=o;if(null===l&&(l=eP),2==l.length){u/=fP(l)}1!==u&&(s.scale=u);const c=e.getRotation();0!==c&&(s.heading=c);const f=e.getColor();f&&(s.color=f);const d=i[i.length-1].node,p=u_[d.namespaceURI],m=ju(s,p);qu(n,l_,Gu,m,i,p)})),LabelStyle:Nu((function(t,e,i){const n={node:t},s={},r=e.getFill();r&&(s.color=r.getColor());const o=e.getScale();o&&1!==o&&(s.scale=o);const h=i[i.length-1].node,a=c_[h.namespaceURI],u=ju(s,a);qu(n,f_,Gu,u,i,a)})),LineStyle:Nu((function(t,e,i){const n={node:t},s={color:e.getColor(),width:Number(e.getWidth())||1},r=i[i.length-1].node,o=d_[r.namespaceURI],h=ju(s,o);qu(n,p_,Gu,h,i,o)})),PolyStyle:Nu((function(t,e,i){const n={node:t},s=e.getFill(),r=e.getStroke(),o={color:s?s.getColor():void 0,fill:!!s&&void 0,outline:!!r&&void 0},h=i[i.length-1].node,a=k_[h.namespaceURI],u=ju(o,a);qu(n,z_,Gu,u,i,a)}))});var U_=class extends EM{constructor(t){super(),t=t||{},cP||(KS=[255,255,255,1],nP=new Tc({color:KS}),JS=[20,2],QS="pixels",tP="pixels",eP=[64,64],iP="https://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png",rP=new Rc({anchor:JS,anchorOrigin:"bottom-left",anchorXUnits:QS,anchorYUnits:tP,crossOrigin:"anonymous",rotation:0,scale:fP(eP),size:eP,src:iP}),sP="NO_IMAGE",hP=new Nc({color:KS,width:1}),oP=new Nc({color:[51,51,51,1],width:2}),aP=new qc({font:"bold 16px Helvetica",fill:nP,stroke:oP,scale:.8}),uP=new $c({fill:nP,image:rP,text:aP,stroke:hP,zIndex:0}),cP=[uP]),this.dataProjection=Yi("EPSG:4326"),this.Vv=t.defaultStyle?t.defaultStyle:cP,this.Wv=void 0===t.extractStyles||t.extractStyles,this.Zv=void 0===t.writeStyles||t.writeStyles,this.Hv={},this.Kv=void 0===t.showPointNames||t.showPointNames,this.qt=void 0!==t.crossOrigin?t.crossOrigin:"anonymous",this.Yv=t.iconUrlFunction?t.iconUrlFunction:dP,this.supportedMediaTypes=["application/vnd.google-earth.kml+xml"]}Jv(t,e){const i=$u([],Du(BS,{Document:Iu(this.Jv,this),Folder:Iu(this.Jv,this),Placemark:Au(this.Qv,this),Style:this.tg.bind(this),StyleMap:this.eg.bind(this)}),t,e,this);return i||void 0}Qv(t,e){const i=$u({geometry:null},XS,t,e,this);if(!i)return;const n=new pt,s=t.getAttribute("id");null!==s&&n.setId(s);const r=e[0],o=i.geometry;if(o&&cg(o,!1,r),n.setGeometry(o),delete i.geometry,this.Wv){const t=function(t,e,i,n,s){return function(r,o){let h=s,a="",u=[];if(h){const t=r.getGeometry();if(t)if(t instanceof Mg)u=t.getGeometriesArrayRecursive().filter((function(t){const e=t.getType();return"Point"===e||"MultiPoint"===e})),h=u.length>0;else{const e=t.getType();h="Point"===e||"MultiPoint"===e}}h&&(a=r.get("name"),h=h&&!!a,h&&/&[^&]+;/.test(a)&&(lP||(lP=document.createElement("textarea")),lP.innerHTML=a,a=lP.value));let l=i;if(t?l=t:e&&(l=pP(e,i,n)),h){const t=function(t,e){const i=[0,0];let n="start";const s=t.getImage();if(s){const t=s.getSize();if(t&&2==t.length){const e=s.getScaleArray(),r=s.getAnchor();i[0]=e[0]*(t[0]-r[0]),i[1]=e[1]*(t[1]/2-r[1]),n="left"}}let r=t.getText();r?(r=r.clone(),r.setFont(r.getFont()||aP.getFont()),r.setScale(r.getScale()||aP.getScale()),r.setFill(r.getFill()||aP.getFill()),r.setStroke(r.getStroke()||oP)):r=aP.clone();r.setText(e),r.setOffsetX(i[0]),r.setOffsetY(i[1]),r.setTextAlign(n);return new $c({image:s,text:r})}(l[0],a);if(u.length>0){t.setGeometry(new Mg(u));return[t,new $c({geometry:l[0].getGeometry(),image:null,fill:l[0].getFill(),stroke:l[0].getStroke(),text:null})].concat(l.slice(1))}return t}return l}}(i.Style,i.styleUrl,this.Vv,this.Hv,this.Kv);n.setStyle(t)}return delete i.Style,n.setProperties(i,!0),n}tg(t,e){const i=t.getAttribute("id");if(null!==i){const n=BP.call(this,t,e);if(n){let e,s=t.baseURI;if(s&&"about:blank"!=s||(s=window.location.href),s){e=new URL("#"+i,s).href}else e="#"+i;this.Hv[e]=n}}}eg(t,e){const i=t.getAttribute("id");if(null===i)return;const n=bP.call(this,t,e);if(!n)return;let s,r=t.baseURI;if(r&&"about:blank"!=r||(r=window.location.href),r){s=new URL("#"+i,r).href}else s="#"+i;this.Hv[s]=n}readFeatureFromNode(t,e){if(!BS.includes(t.namespaceURI))return null;const i=this.Qv(t,[this.getReadOptions(t,e)]);return i||null}readFeaturesFromNode(t,e){if(!BS.includes(t.namespaceURI))return[];let i;const n=t.localName;if("Document"==n||"Folder"==n)return i=this.Jv(t,[this.getReadOptions(t,e)]),i||[];if("Placemark"==n){const i=this.Qv(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&&v(i,t)}return i}return[]}readName(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readNameFromDocument(e)}return Tu(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(BS.includes(e.namespaceURI)&&"name"==e.localName)return GM(e);for(let e=t.firstElementChild;e;e=e.nextElementSibling){const t=e.localName;if(BS.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=Fu(t);v(e,this.readNetworkLinksFromDocument(i))}else Tu(t)?v(e,this.readNetworkLinksFromDocument(t)):v(e,this.readNetworkLinksFromNode(t));return e}readNetworkLinksFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&v(e,this.readNetworkLinksFromNode(i));return e}readNetworkLinksFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(BS.includes(i.namespaceURI)&&"NetworkLink"==i.localName){const t=$u({},YS,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!BS.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||v(e,this.readNetworkLinksFromNode(i))}return e}readRegion(t){const e=[];if("string"==typeof t){const i=Fu(t);v(e,this.readRegionFromDocument(i))}else Tu(t)?v(e,this.readRegionFromDocument(t)):v(e,this.readRegionFromNode(t));return e}readRegionFromDocument(t){const e=[];for(let i=t.firstChild;i;i=i.nextSibling)i.nodeType==Node.ELEMENT_NODE&&v(e,this.readRegionFromNode(i));return e}readRegionFromNode(t){const e=[];for(let i=t.firstElementChild;i;i=i.nextElementSibling)if(BS.includes(i.namespaceURI)&&"Region"==i.localName){const t=$u({},VS,i,[]);e.push(t)}for(let i=t.firstElementChild;i;i=i.nextElementSibling){const t=i.localName;!BS.includes(i.namespaceURI)||"Document"!=t&&"Folder"!=t&&"kml"!=t||v(e,this.readRegionFromNode(i))}return e}writeFeaturesNode(t,e){e=this.adaptOptions(e);const i=Pu(BS[4],"kml"),n="http://www.w3.org/2000/xmlns/";i.setAttributeNS(n,"xmlns:gx",$S[0]),i.setAttributeNS(n,"xmlns:xsi",Su),i.setAttributeNS(Su,"xsi:schemaLocation","http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd");const s={node:i},r={};t.length>1?r.Document=t:1==t.length&&(r.Placemark=t[0]);const o=WS[i.namespaceURI],h=ju(r,o);return qu(s,HS,Gu,h,[e],o,this),i}};const $_=[null],B_=Du($_,{nd:function(t,e){e[e.length-1].ndrefs.push(t.getAttribute("ref"))},tag:Y_}),q_=Du($_,{node:function(t,e){const i=e[0],n=e[e.length-1],s=t.getAttribute("id"),r=[parseFloat(t.getAttribute("lon")),parseFloat(t.getAttribute("lat"))];n.nodes[s]=r;const o=$u({tags:{}},X_,t,e);if(!_(o.tags)){const t=new Qn(r);cg(t,!1,i);const e=new pt(t);void 0!==s&&e.setId(s),e.setProperties(o.tags,!0),n.features.push(e)}},way:function(t,e){const i=$u({id:t.getAttribute("id"),ndrefs:[],tags:{}},B_,t,e);e[e.length-1].ways.push(i)}});const X_=Du($_,{tag:Y_});function Y_(t,e){e[e.length-1].tags[t.getAttribute("k")]=t.getAttribute("v")}var Z_=class extends EM{constructor(){super(),this.dataProjection=Yi("EPSG:4326")}readFeaturesFromNode(t,e){if(e=this.getReadOptions(t,e),"osm"==t.localName){const i=$u({nodes:{},ways:[],features:[]},q_,t,[e]);for(let t=0;t<i.ways.length;t++){const n=i.ways[t],s=[];for(let t=0,e=n.ndrefs.length;t<e;t++){v(s,i.nodes[n.ndrefs[t]])}let r;r=n.ndrefs[0]==n.ndrefs[n.ndrefs.length-1]?new xs(s,"XY",[s.length]):new $v(s,"XY"),cg(r,!1,e);const o=new pt(r);void 0!==n.id&&o.setId(n.id),o.setProperties(n.tags,!0),i.features.push(o)}if(i.features)return i.features}return[]}};var V_=class{read(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readFromDocument(e)}return Tu(t)?this.readFromDocument(t):this.readFromNode(t)}return null}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){}};function W_(t){return t.getAttributeNS("http://www.w3.org/1999/xlink","href")}const H_=[null,"http://www.opengis.net/ows/1.1"],K_=Du(H_,{ServiceIdentification:Lu((function(t,e){return $u({},uE,t,e)})),ServiceProvider:Lu((function(t,e){return $u({},lE,t,e)})),OperationsMetadata:Lu((function(t,e){return $u({},rE,t,e)}))});const J_=Du(H_,{DeliveryPoint:Lu(GM),City:Lu(GM),AdministrativeArea:Lu(GM),PostalCode:Lu(GM),Country:Lu(GM),ElectronicMailAddress:Lu(GM)}),Q_=Du(H_,{Value:Ru((function(t,e){return GM(t)}))}),tE=Du(H_,{AllowedValues:Lu((function(t,e){return $u({},Q_,t,e)}))}),eE=Du(H_,{Phone:Lu((function(t,e){return $u({},oE,t,e)})),Address:Lu((function(t,e){return $u({},J_,t,e)}))}),iE=Du(H_,{HTTP:Lu((function(t,e){return $u({},nE,t,e)}))}),nE=Du(H_,{Get:Ru((function(t,e){const i=W_(t);if(!i)return;return $u({href:i},hE,t,e)})),Post:void 0}),sE=Du(H_,{DCP:Lu((function(t,e){return $u({},iE,t,e)}))}),rE=Du(H_,{Operation:function(t,e){const i=t.getAttribute("name"),n=$u({},sE,t,e);if(!n)return;e[e.length-1][i]=n}}),oE=Du(H_,{Voice:Lu(GM),Facsimile:Lu(GM)}),hE=Du(H_,{Constraint:Ru((function(t,e){const i=t.getAttribute("name");if(!i)return;return $u({name:i},tE,t,e)}))}),aE=Du(H_,{IndividualName:Lu(GM),PositionName:Lu(GM),ContactInfo:Lu((function(t,e){return $u({},eE,t,e)}))}),uE=Du(H_,{Abstract:Lu(GM),AccessConstraints:Lu(GM),Fees:Lu(GM),Title:Lu(GM),ServiceTypeVersion:Lu(GM),ServiceType:Lu(GM)}),lE=Du(H_,{ProviderName:Lu(GM),ProviderSite:Lu(W_),ServiceContact:Lu((function(t,e){return $u({},aE,t,e)}))});var cE=class extends V_{constructor(){super()}readFromNode(t){const e=$u({},K_,t,[]);return e||null}};function fE(t,e,i){let n;i=i||1e5;const s=new Array(e);for(n=0;n<e;++n)s[n]=0;for(let i=0,r=t.length;i<r;)for(n=0;n<e;++n,++i){const e=t[i],r=e-s[n];s[n]=e,t[i]=r}return pE(t,i)}function dE(t,e,i){let n;i=i||1e5;const s=new Array(e);for(n=0;n<e;++n)s[n]=0;const r=mE(t,i);for(let t=0,i=r.length;t<i;)for(n=0;n<e;++n,++t)s[n]+=r[t],r[t]=s[n];return r}function pE(t,e){e=e||1e5;for(let i=0,n=t.length;i<n;++i)t[i]=Math.round(t[i]*e);return vE(t)}function mE(t,e){e=e||1e5;const i=gE(t);for(let t=0,n=i.length;t<n;++t)i[t]/=e;return i}function vE(t){for(let e=0,i=t.length;e<i;++e){const i=t[e];t[e]=i<0?~(i<<1):i<<1}return yE(t)}function gE(t){const e=wE(t);for(let t=0,i=e.length;t<i;++t){const i=e[t];e[t]=1&i?~(i>>1):i>>1}return e}function yE(t){let e="";for(let i=0,n=t.length;i<n;++i)e+=xE(t[i]);return e}function wE(t){const e=[];let i=0,n=0;for(let s=0,r=t.length;s<r;++s){const r=t.charCodeAt(s)-63;i|=(31&r)<<n,r<32?(e.push(i),i=0,n=0):n+=5}return e}function xE(t){let e,i="";for(;t>=32;)e=63+(32|31&t),i+=String.fromCharCode(e),t>>=5;return e=t+63,i+=String.fromCharCode(e),i}var bE=class extends OS{constructor(t){super(),t=t||{},this.dataProjection=Yi("EPSG:4326"),this.ig=t.factor?t.factor:1e5,this.pp=t.geometryLayout?t.geometryLayout:"XY"}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e);return new pt(i)}readFeaturesFromText(t,e){return[this.readFeatureFromText(t,e)]}readGeometryFromText(t,e){const i=Sn(this.pp),n=dE(t,i,this.ig);yM(n,0,n.length,i,n);const s=qn(n,0,n.length,i);return cg(new $v(s,this.pp),!1,this.adaptOptions(e))}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):(ct(!1,40),"")}writeFeaturesText(t,e){return this.writeFeatureText(t[0],e)}writeGeometryText(t,e){const i=(t=cg(t,!0,this.adaptOptions(e))).getFlatCoordinates(),n=t.getStride();return yM(i,0,i.length,n,i),fE(i,n,this.ig)}};const ME={Point:function(t,e,i){const n=t.coordinates;e&&i&&TE(n,e,i);return new Qn(n)},LineString:function(t,e){const i=SE(t.arcs,e);return new $v(i)},Polygon:function(t,e){const i=[];for(let n=0,s=t.arcs.length;n<s;++n)i[n]=SE(t.arcs[n],e);return new xs(i)},MultiPoint:function(t,e,i){const n=t.coordinates;if(e&&i)for(let t=0,s=n.length;t<s;++t)TE(n[t],e,i);return new zv(n)},MultiLineString:function(t,e){const i=[];for(let n=0,s=t.arcs.length;n<s;++n)i[n]=SE(t.arcs[n],e);return new qv(i)},MultiPolygon:function(t,e){const i=[];for(let n=0,s=t.arcs.length;n<s;++n){const s=t.arcs[n],r=[];for(let t=0,i=s.length;t<i;++t)r[t]=SE(s[t],e);i[n]=r}return new Zv(i)}};function SE(t,e){const i=[];let n;for(let s=0,r=t.length;s<r;++s)if(n=t[s],s>0&&i.pop(),n>=0){const t=e[n];for(let e=0,n=t.length;e<n;++e)i.push(t[e].slice(0))}else{const t=e[~n];for(let e=t.length-1;e>=0;--e)i.push(t[e].slice(0))}return i}function PE(t,e,i,n,s,r,o){const h=t.geometries,a=[];for(let t=0,u=h.length;t<u;++t)a[t]=_E(h[t],e,i,n,s,r,o);return a}function _E(t,e,i,n,s,r,o){let h=null;const a=t.type;if(a){const s=ME[a];h="Point"===a||"MultiPoint"===a?s(t,i,n):s(t,e),h=cg(h,!1,o)}const u=new pt({geometry:h});void 0!==t.id&&u.setId(t.id);let l=t.properties;return s&&(l||(l={}),l[s]=r),l&&u.setProperties(l,!0),u}function EE(t,e,i){let n=0,s=0;for(let r=0,o=t.length;r<o;++r){const o=t[r];n+=o[0],s+=o[1],o[0]=n,o[1]=s,TE(o,e,i)}}function TE(t,e,i){t[0]=t[0]*e[0]+i[0],t[1]=t[1]*e[1]+i[1]}var CE=class extends Pg{constructor(t){super(),t=t||{},this.Fd=t.layerName,this.qu=t.layers?t.layers:null,this.dataProjection=Yi(t.dataProjection?t.dataProjection:"EPSG:4326")}readFeaturesFromObject(t,e){if("Topology"==t.type){const i=t;let n,s=null,r=null;i.transform&&(n=i.transform,s=n.scale,r=n.translate);const o=i.arcs;n&&function(t,e,i){for(let n=0,s=t.length;n<s;++n)EE(t[n],e,i)}(o,s,r);const h=[],a=i.objects,u=this.Fd;let l;for(const t in a)this.qu&&!this.qu.includes(t)||("GeometryCollection"===a[t].type?(l=a[t],h.push.apply(h,PE(l,o,s,r,u,t,e))):(l=a[t],h.push(_E(l,o,s,r,u,t,e))));return h}return[]}readProjectionFromObject(t){return this.dataProjection}};var FE=class{constructor(t){this.ng=t}getTagName(){return this.ng}};var IE=class extends FE{constructor(t,e){super(t),this.conditions=e,ct(this.conditions.length>=2,57)}};var AE=class extends IE{constructor(t){super("And",Array.prototype.slice.call(arguments))}};var kE=class extends FE{constructor(t,e,i){if(super("BBOX"),this.geometryName=t,this.extent=e,4!==e.length)throw new Error("Expected an extent with four values ([minX, minY, maxX, maxY])");this.srsName=i}};var RE=class extends FE{constructor(t,e,i,n){super(t),this.geometryName=e||"the_geom",this.geometry=i,this.srsName=n}};var LE=class extends RE{constructor(t,e,i){super("Contains",t,e,i)}};var NE=class extends RE{constructor(t,e,i,n,s){super("DWithin",t,e,s),this.distance=i,this.unit=n}};var OE=class extends RE{constructor(t,e,i){super("Disjoint",t,e,i)}};var zE=class extends FE{constructor(t,e){super(t),this.propertyName=e}};var GE=class extends zE{constructor(t,e,i){super("During",t),this.begin=e,this.end=i}};var jE=class extends zE{constructor(t,e,i,n){super(t,e),this.expression=i,this.matchCase=n}};var DE=class extends jE{constructor(t,e,i){super("PropertyIsEqualTo",t,e,i)}};var UE=class extends jE{constructor(t,e){super("PropertyIsGreaterThan",t,e)}};var $E=class extends jE{constructor(t,e){super("PropertyIsGreaterThanOrEqualTo",t,e)}};var BE=class extends RE{constructor(t,e,i){super("Intersects",t,e,i)}};var qE=class extends zE{constructor(t,e,i){super("PropertyIsBetween",t),this.lowerBoundary=e,this.upperBoundary=i}};var XE=class extends zE{constructor(t,e,i,n,s,r){super("PropertyIsLike",t),this.pattern=e,this.wildCard=void 0!==i?i:"*",this.singleChar=void 0!==n?n:".",this.escapeChar=void 0!==s?s:"!",this.matchCase=r}};var YE=class extends zE{constructor(t){super("PropertyIsNull",t)}};var ZE=class extends jE{constructor(t,e){super("PropertyIsLessThan",t,e)}};var VE=class extends jE{constructor(t,e){super("PropertyIsLessThanOrEqualTo",t,e)}};var WE=class extends FE{constructor(t){super("Not"),this.condition=t}};var HE=class extends jE{constructor(t,e,i){super("PropertyIsNotEqualTo",t,e,i)}};var KE=class extends IE{constructor(t){super("Or",Array.prototype.slice.call(arguments))}};var JE=class extends FE{constructor(t){super("ResourceId"),this.rid=t}};var QE=class extends RE{constructor(t,e,i){super("Within",t,e,i)}};function tT(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(AE,e))}function eT(t,e,i){return new kE(t,e,i)}const iT={"http://www.opengis.net/gml":{boundedBy:Lu(IM.prototype.readExtentElement,"bounds")},"http://www.opengis.net/wfs/2.0":{member:Au(IM.prototype.readFeaturesInternal)}},nT={"http://www.opengis.net/wfs":{totalInserted:Lu(OM),totalUpdated:Lu(OM),totalDeleted:Lu(OM)},"http://www.opengis.net/wfs/2.0":{totalInserted:Lu(OM),totalUpdated:Lu(OM),totalDeleted:Lu(OM)}},sT={"http://www.opengis.net/wfs":{TransactionSummary:Lu(mT,"transactionSummary"),InsertResults:Lu(wT,"insertIds")},"http://www.opengis.net/wfs/2.0":{TransactionSummary:Lu(mT,"transactionSummary"),InsertResults:Lu(wT,"insertIds")}},rT={"http://www.opengis.net/wfs":{PropertyName:Nu(qM)},"http://www.opengis.net/wfs/2.0":{PropertyName:Nu(qM)}},oT={"http://www.opengis.net/wfs":{Insert:Nu(xT),Update:Nu(PT),Delete:Nu(ST),Property:Nu(_T),Native:Nu(ET)},"http://www.opengis.net/wfs/2.0":{Insert:Nu(xT),Update:Nu(PT),Delete:Nu(ST),Property:Nu(_T),Native:Nu(ET)}},hT="feature",aT="http://www.w3.org/2000/xmlns/",uT={"2.0.0":"http://www.opengis.net/ogc/1.1","1.1.0":"http://www.opengis.net/ogc","1.0.0":"http://www.opengis.net/ogc"},lT={"2.0.0":"http://www.opengis.net/wfs/2.0","1.1.0":"http://www.opengis.net/wfs","1.0.0":"http://www.opengis.net/wfs"},cT={"2.0.0":"http://www.opengis.net/fes/2.0","1.1.0":"http://www.opengis.net/fes","1.0.0":"http://www.opengis.net/fes"},fT={"2.0.0":"http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd","1.1.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd","1.0.0":"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd"},dT={"2.0.0":tS,"1.1.0":HM,"1.0.0":ZM};function pT(t,e,i,n){qu(n,oT,zu(t),e,i)}function mT(t,e){return $u({},nT,t,e)}const vT={"http://www.opengis.net/ogc":{FeatureId:Au((function(t,e){return t.getAttribute("fid")}))},"http://www.opengis.net/ogc/1.1":{FeatureId:Au((function(t,e){return t.getAttribute("fid")}))}};function gT(t,e){Uu(vT,t,e)}const yT={"http://www.opengis.net/wfs":{Feature:gT},"http://www.opengis.net/wfs/2.0":{Feature:gT}};function wT(t,e){return $u([],yT,t,e)}function xT(t,e,i){const n=i[i.length-1],s=n.featureType,r=n.featureNS,o=n.gmlVersion,h=Pu(r,s);t.appendChild(h),2===o?ZM.prototype.writeFeatureElement(h,e,i):3===o?HM.prototype.writeFeatureElement(h,e,i):tS.prototype.writeFeatureElement(h,e,i)}function bT(t,e,i){const n=i[i.length-1].version,s=uT[n],r=Pu(s,"Filter"),o=Pu(s,"FeatureId");r.appendChild(o),o.setAttribute("fid",e),t.appendChild(r)}function MT(t,e){const i=(t=t||hT)+":";return e.startsWith(i)?e:i+e}function ST(t,e,i){const n=i[i.length-1];ct(void 0!==e.getId(),26);const s=n.featureType,r=n.featurePrefix,o=n.featureNS,h=MT(r,s);t.setAttribute("typeName",h),t.setAttributeNS(aT,"xmlns:"+r,o);const a=e.getId();void 0!==a&&bT(t,a,i)}function PT(t,e,i){const n=i[i.length-1];ct(void 0!==e.getId(),27);const s=n.version,r=n.featureType,o=n.featurePrefix,h=n.featureNS,a=MT(o,r),u=e.getGeometryName();t.setAttribute("typeName",a),t.setAttributeNS(aT,"xmlns:"+o,h);const l=e.getId();if(void 0!==l){const r=e.getKeys(),o=[];for(let t=0,i=r.length;t<i;t++){const i=e.get(r[t]);if(void 0!==i){let e=r[t];i&&"function"==typeof i.getSimplifiedGeometry&&(e=u),o.push({name:e,value:i})}}qu({version:s,gmlVersion:n.gmlVersion,node:t,hasZ:n.hasZ,srsName:n.srsName},oT,zu("Property"),o,i),bT(t,l,i)}}function _T(t,e,i){const n=i[i.length-1],s=n.version,r=lT[s],o=Pu(r,"Name"),h=n.gmlVersion;if(t.appendChild(o),qM(o,e.name),void 0!==e.value&&null!==e.value){const n=Pu(r,"Value");t.appendChild(n),e.value&&"function"==typeof e.value.getSimplifiedGeometry?2===h?ZM.prototype.writeGeometryElement(n,e.value,i):3===h?HM.prototype.writeGeometryElement(n,e.value,i):tS.prototype.writeGeometryElement(n,e.value,i):qM(n,e.value)}}function ET(t,e,i){e.vendorId&&t.setAttribute("vendorId",e.vendorId),void 0!==e.safeToIgnore&&t.setAttribute("safeToIgnore",String(e.safeToIgnore)),void 0!==e.value&&qM(t,e.value)}const TT={"http://www.opengis.net/wfs":{Query:Nu(CT)},"http://www.opengis.net/wfs/2.0":{Query:Nu(CT)},"http://www.opengis.net/ogc":{During:Nu(RT),And:Nu(LT),Or:Nu(LT),Not:Nu(NT),BBOX:Nu(IT),Contains:Nu(AT),Intersects:Nu(AT),Within:Nu(AT),DWithin:Nu(kT),PropertyIsEqualTo:Nu(OT),PropertyIsNotEqualTo:Nu(OT),PropertyIsLessThan:Nu(OT),PropertyIsLessThanOrEqualTo:Nu(OT),PropertyIsGreaterThan:Nu(OT),PropertyIsGreaterThanOrEqualTo:Nu(OT),PropertyIsNull:Nu(zT),PropertyIsBetween:Nu(GT),PropertyIsLike:Nu(jT)},"http://www.opengis.net/fes/2.0":{During:Nu(RT),And:Nu(LT),Or:Nu(LT),Not:Nu(NT),BBOX:Nu(IT),Contains:Nu(AT),Disjoint:Nu(AT),Intersects:Nu(AT),ResourceId:Nu((function(t,e,i){t.setAttribute("rid",e.rid)})),Within:Nu(AT),DWithin:Nu(kT),PropertyIsEqualTo:Nu(OT),PropertyIsNotEqualTo:Nu(OT),PropertyIsLessThan:Nu(OT),PropertyIsLessThanOrEqualTo:Nu(OT),PropertyIsGreaterThan:Nu(OT),PropertyIsGreaterThanOrEqualTo:Nu(OT),PropertyIsNull:Nu(zT),PropertyIsBetween:Nu(GT),PropertyIsLike:Nu(jT)}};function CT(t,e,i){const n=i[i.length-1],s=n.version,r=n.featurePrefix,o=n.featureNS,h=n.propertyNames,a=n.srsName;let u,l;u=r?MT(r,e):e,l="2.0.0"===s?"typeNames":"typeName",t.setAttribute(l,u),a&&t.setAttribute("srsName",a),o&&t.setAttributeNS(aT,"xmlns:"+r,o);const c=Object.assign({},n);c.node=t,qu(c,rT,zu("PropertyName"),h,i);const f=n.filter;if(f){const e=Pu(XT(s),"Filter");t.appendChild(e),FT(e,f,i)}}function FT(t,e,i){const n=i[i.length-1],s={node:t};Object.assign(s,{context:n}),qu(s,TT,zu(e.getTagName()),[e],i)}function IT(t,e,i){const n=i[i.length-1],s=n.context.version;n.srsName=e.srsName;const r=dT[s];$T(s,t,e.geometryName),r.prototype.writeGeometryElement(t,e.extent,i)}function AT(t,e,i){const n=i[i.length-1],s=n.context.version;n.srsName=e.srsName;const r=dT[s];$T(s,t,e.geometryName),r.prototype.writeGeometryElement(t,e.geometry,i)}function kT(t,e,i){const n=i[i.length-1].context.version;AT(t,e,i);const s=Pu(XT(n),"Distance");qM(s,e.distance.toString()),"2.0.0"===n?s.setAttribute("uom",e.unit):s.setAttribute("units",e.unit),t.appendChild(s)}function RT(t,e,i){const n=i[i.length-1].context.version;DT(cT[n],"ValueReference",t,e.propertyName);const s=Pu(TM,"TimePeriod");t.appendChild(s);const r=Pu(TM,"begin");s.appendChild(r),BT(r,e.begin);const o=Pu(TM,"end");s.appendChild(o),BT(o,e.end)}function LT(t,e,i){const n=i[i.length-1].context,s={node:t};Object.assign(s,{context:n});const r=e.conditions;for(let t=0,e=r.length;t<e;++t){const e=r[t];qu(s,TT,zu(e.getTagName()),[e],i)}}function NT(t,e,i){const n=i[i.length-1].context,s={node:t};Object.assign(s,{context:n});const r=e.condition;qu(s,TT,zu(r.getTagName()),[r],i)}function OT(t,e,i){const n=i[i.length-1].context.version;void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),$T(n,t,e.propertyName),UT(n,t,""+e.expression)}function zT(t,e,i){$T(i[i.length-1].context.version,t,e.propertyName)}function GT(t,e,i){const n=i[i.length-1].context.version,s=XT(n);$T(n,t,e.propertyName);const r=Pu(s,"LowerBoundary");t.appendChild(r),UT(n,r,""+e.lowerBoundary);const o=Pu(s,"UpperBoundary");t.appendChild(o),UT(n,o,""+e.upperBoundary)}function jT(t,e,i){const n=i[i.length-1].context.version;t.setAttribute("wildCard",e.wildCard),t.setAttribute("singleChar",e.singleChar),t.setAttribute("escapeChar",e.escapeChar),void 0!==e.matchCase&&t.setAttribute("matchCase",e.matchCase.toString()),$T(n,t,e.propertyName),UT(n,t,""+e.pattern)}function DT(t,e,i,n){const s=Pu(t,e);qM(s,n),i.appendChild(s)}function UT(t,e,i){DT(XT(t),"Literal",e,i)}function $T(t,e,i){"2.0.0"===t?DT(cT[t],"ValueReference",e,i):DT(uT[t],"PropertyName",e,i)}function BT(t,e){const i=Pu(TM,"TimeInstant");t.appendChild(i);const n=Pu(TM,"timePosition");i.appendChild(n),qM(n,e)}function qT(t,e,i){const n=i[i.length-1],s=Object.assign({},n);s.node=t,qu(s,TT,zu("Query"),e,i)}function XT(t){let e;return e="2.0.0"===t?cT[t]:uT[t],e}var YT=class extends EM{constructor(t){super(),t=t||{},this.ul=t.version?t.version:"1.1.0",this.sg=t.featureType,this.rg=t.featureNS,this.og=t.gmlFormat?t.gmlFormat:new dT[this.ul],this.hg=t.schemaLocation?t.schemaLocation:fT[this.ul]}getFeatureType(){return this.sg}setFeatureType(t){this.sg=t}readFeaturesFromNode(t,e){const i={node:t};Object.assign(i,{featureType:this.sg,featureNS:this.rg}),Object.assign(i,this.getReadOptions(t,e||{}));const n=[i];let s;s="2.0.0"===this.ul?iT:this.og.FEATURE_COLLECTION_PARSERS;let r=$u([],s,t,n,this.og);return r||(r=[]),r}readTransactionResponse(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readTransactionResponseFromDocument(e)}return Tu(t)?this.readTransactionResponseFromDocument(t):this.readTransactionResponseFromNode(t)}}readFeatureCollectionMetadata(t){if(t){if("string"==typeof t){const e=Fu(t);return this.readFeatureCollectionMetadataFromDocument(e)}return Tu(t)?this.readFeatureCollectionMetadataFromDocument(t):this.readFeatureCollectionMetadataFromNode(t)}}readFeatureCollectionMetadataFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readFeatureCollectionMetadataFromNode(e)}readFeatureCollectionMetadataFromNode(t){const e={},i=zM(t.getAttribute("numberOfFeatures"));return e.numberOfFeatures=i,$u(e,iT,t,[],this.og)}readTransactionResponseFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readTransactionResponseFromNode(e)}readTransactionResponseFromNode(t){return $u({},sT,t,[])}writeGetFeature(t){const e=Pu(lT[this.ul],"GetFeature");e.setAttribute("service","WFS"),e.setAttribute("version",this.ul),t.handle&&e.setAttribute("handle",t.handle),t.outputFormat&&e.setAttribute("outputFormat",t.outputFormat),void 0!==t.maxFeatures&&e.setAttribute("maxFeatures",String(t.maxFeatures)),t.resultType&&e.setAttribute("resultType",t.resultType),void 0!==t.startIndex&&e.setAttribute("startIndex",String(t.startIndex)),void 0!==t.count&&e.setAttribute("count",String(t.count)),void 0!==t.viewParams&&e.setAttribute("viewParams",t.viewParams),e.setAttributeNS(Su,"xsi:schemaLocation",this.hg);const i={node:e};if(Object.assign(i,{version:this.ul,srsName:t.srsName,featureNS:t.featureNS?t.featureNS:this.rg,featurePrefix:t.featurePrefix,propertyNames:t.propertyNames?t.propertyNames:[]}),ct(Array.isArray(t.featureTypes),11),"string"==typeof t.featureTypes[0]){let n=t.filter;t.bbox&&(ct(t.geometryName,12),n=this.combineBboxAndFilter(t.geometryName,t.bbox,t.srsName,n)),Object.assign(i,{geometryName:t.geometryName,filter:n}),qT(e,t.featureTypes,[i])}else t.featureTypes.forEach((n=>{const s=this.combineBboxAndFilter(n.geometryName,n.bbox,t.srsName,t.filter);Object.assign(i,{geometryName:n.geometryName,filter:s}),qT(e,[n.name],[i])}));return e}combineBboxAndFilter(t,e,i,n){const s=eT(t,e,i);return n?tT(n,s):s}writeTransaction(t,e,i,n){const s=[],r=n.version?n.version:this.ul,o=Pu(lT[r],"Transaction");let h;o.setAttribute("service","WFS"),o.setAttribute("version",r),n&&(h=n.gmlOptions?n.gmlOptions:{},n.handle&&o.setAttribute("handle",n.handle)),o.setAttributeNS(Su,"xsi:schemaLocation",fT[r]);const a=function(t,e,i,n){const s=n.featurePrefix?n.featurePrefix:hT;let r;"1.0.0"===i?r=2:"1.1.0"===i?r=3:"2.0.0"===i&&(r=3.2);return Object.assign({node:t},{version:i,featureNS:n.featureNS,featureType:n.featureType,featurePrefix:s,gmlVersion:r,hasZ:n.hasZ,srsName:n.srsName},e)}(o,h,r,n);return t&&pT("Insert",t,s,a),e&&pT("Update",e,s,a),i&&pT("Delete",i,s,a),n.nativeElements&&pT("Native",n.nativeElements,s,a),o}readProjectionFromDocument(t){for(let e=t.firstChild;e;e=e.nextSibling)if(e.nodeType==Node.ELEMENT_NODE)return this.readProjectionFromNode(e);return null}readProjectionFromNode(t){if(t.firstElementChild&&t.firstElementChild.firstElementChild)for(let e=(t=t.firstElementChild.firstElementChild).firstElementChild;e;e=e.nextElementSibling)if(0!==e.childNodes.length&&(1!==e.childNodes.length||3!==e.firstChild.nodeType)){const t=[{}];return this.og.readGeometryElement(e,t),Yi(t.pop().srsName)}return null}};const ZT=1,VT=2,WT=3,HT=4,KT=5,JT=6,QT=7,tC=15,eC=16,iC=17;class nC{constructor(t){this.ag=t,this.ug=0,this.lg=!1,this.cg=!1,this.fg=!1,this.dg=!1,this.pg=null,this.mg="XY"}readUint8(){return this.ag.getUint8(this.ug++)}readUint32(t){return this.ag.getUint32((this.ug+=4)-4,void 0!==t?t:this.cg)}readDouble(t){return this.ag.getFloat64((this.ug+=8)-8,void 0!==t?t:this.cg)}readPoint(){const t=[];return t.push(this.readDouble()),t.push(this.readDouble()),this.fg&&t.push(this.readDouble()),this.dg&&t.push(this.readDouble()),t}readLineString(){const t=this.readUint32(),e=[];for(let i=0;i<t;i++)e.push(this.readPoint());return e}readPolygon(){const t=this.readUint32(),e=[];for(let i=0;i<t;i++)e.push(this.readLineString());return e}readWkbHeader(t){const e=this.readUint8()>0,i=this.readUint32(e),n=Math.floor((268435455&i)/1e3),s=Boolean(2147483648&i)||1===n||3===n,r=Boolean(1073741824&i)||2===n||3===n,o=Boolean(536870912&i),h=(268435455&i)%1e3,a=["XY",s?"Z":"",r?"M":""].join(""),u=o?this.readUint32(e):null;if(void 0!==t&&t!==h)throw new Error("Unexpected WKB geometry type "+h);if(this.lg){if(this.cg!==e)throw new Error("Inconsistent endian");if(this.mg!==a)throw new Error("Inconsistent geometry layout");if(u&&this.pg!==u)throw new Error("Inconsistent coordinate system (SRID)")}else this.cg=e,this.fg=s,this.dg=r,this.mg=a,this.pg=u,this.lg=!0;return h}readWkbPayload(t){switch(t){case ZT:return this.readPoint();case VT:return this.readLineString();case WT:case iC:return this.readPolygon();case HT:return this.readMultiPoint();case KT:return this.readMultiLineString();case JT:case tC:case eC:return this.readMultiPolygon();case QT:return this.readGeometryCollection();default:throw new Error("Unsupported WKB geometry type "+t+" is found")}}readWkbBlock(t){return this.readWkbPayload(this.readWkbHeader(t))}readWkbCollection(t,e){const i=this.readUint32(),n=[];for(let s=0;s<i;s++){const i=t.call(this,e);i&&n.push(i)}return n}readMultiPoint(){return this.readWkbCollection(this.readWkbBlock,ZT)}readMultiLineString(){return this.readWkbCollection(this.readWkbBlock,VT)}readMultiPolygon(){return this.readWkbCollection(this.readWkbBlock,WT)}readGeometryCollection(){return this.readWkbCollection(this.readGeometry)}readGeometry(){const t=this.readWkbHeader(),e=this.readWkbPayload(t);switch(t){case ZT:return new Qn(e,this.mg);case VT:return new $v(e,this.mg);case WT:case iC:return new xs(e,this.mg);case HT:return new zv(e,this.mg);case KT:return new qv(e,this.mg);case JT:case tC:case eC:return new Zv(e,this.mg);case QT:return new Mg(e);default:return null}}getSrid(){return this.pg}}class sC{constructor(t){t=t||{},this.mg=t.layout,this.cg=!1!==t.littleEndian,this.vg=!1!==t.ewkb,this.gg=[],this.yg=Object.assign({X:0,Y:0,Z:0,M:0},t.nodata)}writeUint8(t){this.gg.push([1,t])}writeUint32(t){this.gg.push([4,t])}writeDouble(t){this.gg.push([8,t])}writePoint(t,e){const i=Object.assign.apply(null,e.split("").map(((e,i)=>({[e]:t[i]}))));for(const t of this.mg)this.writeDouble(t in i?i[t]:this.yg[t])}writeLineString(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writePoint(t[i],e)}writePolygon(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeLineString(t[i],e)}writeWkbHeader(t,e){t%=1e3,this.mg.includes("Z")&&(t+=this.vg?2147483648:1e3),this.mg.includes("M")&&(t+=this.vg?1073741824:2e3),this.vg&&Number.isInteger(e)&&(t|=536870912),this.writeUint8(this.cg?1:0),this.writeUint32(t),this.vg&&Number.isInteger(e)&&this.writeUint32(e)}writeMultiPoint(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(1),this.writePoint(t[i],e)}writeMultiLineString(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(2),this.writeLineString(t[i],e)}writeMultiPolygon(t,e){this.writeUint32(t.length);for(let i=0;i<t.length;i++)this.writeWkbHeader(3),this.writePolygon(t[i],e)}writeGeometryCollection(t){this.writeUint32(t.length);for(let e=0;e<t.length;e++)this.writeGeometry(t[e])}findMinimumLayout(t,e="XYZM"){if(t instanceof _n)return(i=t.getLayout())===(n=e)?i:"XYZM"===i?n:"XYZM"===n?i:"XY";var i,n;if(t instanceof Mg){const i=t.getGeometriesArray();for(let t=0;t<i.length&&"XY"!==e;t++)e=this.findMinimumLayout(i[t],e)}return e}writeGeometry(t,e){const i={Point:ZT,LineString:VT,Polygon:WT,MultiPoint:HT,MultiLineString:KT,MultiPolygon:JT,GeometryCollection:QT},n=t.getType(),s=i[n];if(!s)throw new Error("GeometryType "+n+" is not supported");if(this.mg||(this.mg=this.findMinimumLayout(t)),this.writeWkbHeader(s,e),t instanceof _n){({Point:this.writePoint,LineString:this.writeLineString,Polygon:this.writePolygon,MultiPoint:this.writeMultiPoint,MultiLineString:this.writeMultiLineString,MultiPolygon:this.writeMultiPolygon})[n].call(this,t.getCoordinates(),t.getLayout())}else t instanceof Mg&&this.writeGeometryCollection(t.getGeometriesArray())}getBuffer(){const t=this.gg.reduce(((t,e)=>t+e[0]),0),e=new ArrayBuffer(t),i=new DataView(e);let n=0;return this.gg.forEach((t=>{switch(t[0]){case 1:i.setUint8(n,t[1]);break;case 4:i.setUint32(n,t[1],this.cg);break;case 8:i.setFloat64(n,t[1],this.cg)}n+=t[0]})),e}}function rC(t){return"string"==typeof t?function(t){const e=new Uint8Array(t.length/2);for(let i=0;i<t.length/2;i++)e[i]=parseInt(t.substr(2*i,2),16);return new DataView(e.buffer)}(t):ArrayBuffer.isView(t)?t instanceof DataView?t:new DataView(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new DataView(t):null}var oC=class extends lg{constructor(t){super(),t=t||{},this.splitCollection=Boolean(t.splitCollection),this.wg=null,this.xg=!1!==t.hex,this.bg=!1!==t.littleEndian,this.Mg=!1!==t.ewkb,this.mg=t.geometryLayout,this.Sg=t.nodataZ||0,this.Pg=t.nodataM||0,this.pg=t.srid}getType(){return this.xg?"text":"arraybuffer"}readFeature(t,e){return new pt({geometry:this.readGeometry(t,e)})}readFeatures(t,e){let i=[];const n=this.readGeometry(t,e);return i=this.splitCollection&&n instanceof Mg?n.getGeometriesArray():[n],i.map((t=>new pt({geometry:t})))}readGeometry(t,e){const i=rC(t);if(!i)return null;const n=new nC(i).readGeometry();return this.wg=i,e=this.getReadOptions(t,e),this.wg=null,cg(n,!1,e)}readProjection(t){const e=this.wg||rC(t);if(!e)return;const i=new nC(e);return i.readWkbHeader(),i.getSrid()&&Yi("EPSG:"+i.getSrid())||void 0}writeFeature(t,e){return this.writeGeometry(t.getGeometry(),e)}writeFeatures(t,e){return this.writeGeometry(new Mg(t.map((t=>t.getGeometry()))),e)}writeGeometry(t,e){e=this.adaptOptions(e);const i=new sC({layout:this.mg,littleEndian:this.bg,ewkb:this.Mg,nodata:{Z:this.Sg,M:this.Pg}});let n=Number.isInteger(this.pg)?Number(this.pg):null;if(!1!==this.pg&&!Number.isInteger(this.pg)){const t=e.dataProjection&&Yi(e.dataProjection);if(t){const e=t.getCode();e.startsWith("EPSG:")&&(n=Number(e.substring(5)))}}i.writeGeometry(cg(t,!0,e),n);const s=i.getBuffer();return this.xg?function(t){const e=new Uint8Array(t);return Array.from(e.values()).map((t=>(t<16?"0":"")+Number(t).toString(16).toUpperCase())).join("")}(s):s}};const hC={POINT:Qn,LINESTRING:$v,POLYGON:xs,MULTIPOINT:zv,MULTILINESTRING:qv,MULTIPOLYGON:Zv},aC="EMPTY",uC=0,lC=1,cC=2,fC=3,dC=4,pC=5,mC=6,vC={Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION",Circle:"CIRCLE"};class gC{constructor(t){this.wkt=t,this._g=-1}Eg(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}Tg(t,e){return e=void 0!==e&&e,t>="0"&&t<="9"||"."==t&&!e}Cg(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}Fg(){return this.wkt.charAt(++this._g)}nextToken(){const t=this.Fg(),e=this._g;let i,n=t;if("("==t)i=cC;else if(","==t)i=pC;else if(")"==t)i=fC;else if(this.Tg(t)||"-"==t)i=dC,n=this.Ig();else if(this.Eg(t))i=lC,n=this.Ag();else{if(this.Cg(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=mC}return{position:e,value:n,type:i}}Ig(){let t;const e=this._g;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.Fg()}while(this.Tg(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this._g--))}Ag(){let t;const e=this._g;do{t=this.Fg()}while(this.Eg(t));return this.wkt.substring(e,this._g--).toUpperCase()}}class yC{constructor(t){this.kg=t,this.Rg={position:0,type:uC},this.mg="XY"}Lg(){this.Rg=this.kg.nextToken()}isTokenType(t){return this.Rg.type==t}match(t){const e=this.isTokenType(t);return e&&this.Lg(),e}parse(){return this.Lg(),this.Ng()}Og(){let t="XY";const e=this.Rg;if(this.isTokenType(lC)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.Lg()}return t}zg(){if(this.match(cC)){const t=[];do{t.push(this.Ng())}while(this.match(pC));if(this.match(fC))return t}throw new Error(this.Gg())}jg(){if(this.match(cC)){const t=this.Dg();if(this.match(fC))return t}throw new Error(this.Gg())}Ug(){if(this.match(cC)){const t=this.$g();if(this.match(fC))return t}throw new Error(this.Gg())}Bg(){if(this.match(cC)){const t=this.qg();if(this.match(fC))return t}throw new Error(this.Gg())}Xg(){if(this.match(cC)){let t;if(t=this.Rg.type==cC?this.Yg():this.$g(),this.match(fC))return t}throw new Error(this.Gg())}Zg(){if(this.match(cC)){const t=this.qg();if(this.match(fC))return t}throw new Error(this.Gg())}Vg(){if(this.match(cC)){const t=this.Wg();if(this.match(fC))return t}throw new Error(this.Gg())}Dg(){const t=[],e=this.mg.length;for(let i=0;i<e;++i){const e=this.Rg;if(!this.match(dC))break;t.push(e.value)}if(t.length==e)return t;throw new Error(this.Gg())}$g(){const t=[this.Dg()];for(;this.match(pC);)t.push(this.Dg());return t}Yg(){const t=[this.jg()];for(;this.match(pC);)t.push(this.jg());return t}qg(){const t=[this.Ug()];for(;this.match(pC);)t.push(this.Ug());return t}Wg(){const t=[this.Bg()];for(;this.match(pC);)t.push(this.Bg());return t}Hg(){const t=this.isTokenType(lC)&&this.Rg.value==aC;return t&&this.Lg(),t}Gg(){return"Unexpected `"+this.Rg.value+"` at position "+this.Rg.position+" in `"+this.kg.wkt+"`"}Ng(){const t=this.Rg;if(this.match(lC)){const e=t.value;this.mg=this.Og();const i=this.Hg();if("GEOMETRYCOLLECTION"==e){if(i)return new Mg([]);const t=this.zg();return new Mg(t)}{const t=hC[e];if(!t)throw new Error("Invalid geometry type: "+e);let n;if(i)n="POINT"==e?[NaN,NaN]:[];else switch(e){case"POINT":n=this.jg();break;case"LINESTRING":n=this.Ug();break;case"POLYGON":n=this.Bg();break;case"MULTIPOINT":n=this.Xg();break;case"MULTILINESTRING":n=this.Zg();break;case"MULTIPOLYGON":n=this.Vg()}return new t(n,this.mg)}}throw new Error(this.Gg())}}function wC(t){const e=t.getCoordinates();return 0===e.length?"":e.join(" ")}function xC(t){const e=t.getCoordinates(),i=[];for(let t=0,n=e.length;t<n;++t)i.push(e[t].join(" "));return i.join(",")}function bC(t){const e=[],i=t.getLinearRings();for(let t=0,n=i.length;t<n;++t)e.push("("+xC(i[t])+")");return e.join(",")}const MC={Point:wC,LineString:xC,Polygon:bC,MultiPoint:function(t){const e=[],i=t.getPoints();for(let t=0,n=i.length;t<n;++t)e.push("("+wC(i[t])+")");return e.join(",")},MultiLineString:function(t){const e=[],i=t.getLineStrings();for(let t=0,n=i.length;t<n;++t)e.push("("+xC(i[t])+")");return e.join(",")},MultiPolygon:function(t){const e=[],i=t.getPolygons();for(let t=0,n=i.length;t<n;++t)e.push("("+bC(i[t])+")");return e.join(",")},GeometryCollection:function(t){const e=[],i=t.getGeometries();for(let t=0,n=i.length;t<n;++t)e.push(SC(i[t]));return e.join(",")}};function SC(t){const e=t.getType(),i=(0,MC[e])(t);let n=vC[e];if("function"==typeof t.getFlatCoordinates){const e=function(t){const e=t.getLayout();let i="";return"XYZ"!==e&&"XYZM"!==e||(i+="Z"),"XYM"!==e&&"XYZM"!==e||(i+="M"),i}(t);e.length>0&&(n+=" "+e)}return 0===i.length?n+" "+aC:n+"("+i+")"}var PC=class extends OS{constructor(t){super(),t=t||{},this.Kg=void 0!==t.splitCollection&&t.splitCollection}Jg(t){const e=new gC(t);return new yC(e).parse()}readFeatureFromText(t,e){const i=this.readGeometryFromText(t,e),n=new pt;return n.setGeometry(i),n}readFeaturesFromText(t,e){let i=[];const n=this.readGeometryFromText(t,e);i=this.Kg&&"GeometryCollection"==n.getType()?n.getGeometriesArray():[n];const s=[];for(let t=0,e=i.length;t<e;++t){const e=new pt;e.setGeometry(i[t]),s.push(e)}return s}readGeometryFromText(t,e){return cg(this.Jg(t),!1,e)}writeFeatureText(t,e){const i=t.getGeometry();return i?this.writeGeometryText(i,e):""}writeFeaturesText(t,e){if(1==t.length)return this.writeFeatureText(t[0],e);const i=[];for(let e=0,n=t.length;e<n;++e)i.push(t[e].getGeometry());const n=new Mg(i);return this.writeGeometryText(n,e)}writeGeometryText(t,e){return SC(cg(t,!0,e))}};const _C=[null,"http://www.opengis.net/wms"],EC=Du(_C,{Service:Lu((function(t,e){return $u({},CC,t,e)})),Capability:Lu((function(t,e){return $u({},TC,t,e)}))}),TC=Du(_C,{Request:Lu((function(t,e){return $u({},OC,t,e)})),Exception:Lu((function(t,e){return $u([],kC,t,e)})),Layer:Lu((function(t,e){const i=$u({},RC,t,e);if(void 0===i.Layer)return Object.assign(i,BC(t,e));return i}))});const CC=Du(_C,{Name:Lu(GM),Title:Lu(GM),Abstract:Lu(GM),KeywordList:Lu(ZC),OnlineResource:Lu(W_),ContactInformation:Lu((function(t,e){return $u({},FC,t,e)})),Fees:Lu(GM),AccessConstraints:Lu(GM),LayerLimit:Lu(OM),MaxWidth:Lu(OM),MaxHeight:Lu(OM)}),FC=Du(_C,{ContactPersonPrimary:Lu((function(t,e){return $u({},IC,t,e)})),ContactPosition:Lu(GM),ContactAddress:Lu((function(t,e){return $u({},AC,t,e)})),ContactVoiceTelephone:Lu(GM),ContactFacsimileTelephone:Lu(GM),ContactElectronicMailAddress:Lu(GM)}),IC=Du(_C,{ContactPerson:Lu(GM),ContactOrganization:Lu(GM)}),AC=Du(_C,{AddressType:Lu(GM),Address:Lu(GM),City:Lu(GM),StateOrProvince:Lu(GM),PostCode:Lu(GM),Country:Lu(GM)}),kC=Du(_C,{Format:Au(GM)}),RC=Du(_C,{Name:Lu(GM),Title:Lu(GM),Abstract:Lu(GM),KeywordList:Lu(ZC),CRS:Ru(GM),EX_GeographicBoundingBox:Lu((function(t,e){const i=$u({},NC,t,e);if(!i)return;const n=i.westBoundLongitude,s=i.southBoundLatitude,r=i.eastBoundLongitude,o=i.northBoundLatitude;if(void 0===n||void 0===s||void 0===r||void 0===o)return;return[n,s,r,o]})),BoundingBox:Ru((function(t,e){const i=[NM(t.getAttribute("minx")),NM(t.getAttribute("miny")),NM(t.getAttribute("maxx")),NM(t.getAttribute("maxy"))],n=[NM(t.getAttribute("resx")),NM(t.getAttribute("resy"))];return{crs:t.getAttribute("CRS"),extent:i,res:n}})),Dimension:Ru((function(t,e){return{name:t.getAttribute("name"),units:t.getAttribute("units"),unitSymbol:t.getAttribute("unitSymbol"),default:t.getAttribute("default"),multipleValues:kM(t.getAttribute("multipleValues")),nearestValue:kM(t.getAttribute("nearestValue")),current:kM(t.getAttribute("current")),values:GM(t)}})),Attribution:Lu((function(t,e){return $u({},LC,t,e)})),AuthorityURL:Ru((function(t,e){const i=qC(t,e);if(i)return i.name=t.getAttribute("name"),i;return})),Identifier:Ru(GM),MetadataURL:Ru((function(t,e){const i=qC(t,e);if(i)return i.type=t.getAttribute("type"),i;return})),DataURL:Ru(qC),FeatureListURL:Ru(qC),Style:Ru((function(t,e){return $u({},DC,t,e)})),MinScaleDenominator:Lu(LM),MaxScaleDenominator:Lu(LM),Layer:Ru(BC)}),LC=Du(_C,{Title:Lu(GM),OnlineResource:Lu(W_),LogoURL:Lu(YC)}),NC=Du(_C,{westBoundLongitude:Lu(LM),eastBoundLongitude:Lu(LM),southBoundLatitude:Lu(LM),northBoundLatitude:Lu(LM)}),OC=Du(_C,{GetCapabilities:Lu(XC),GetMap:Lu(XC),GetFeatureInfo:Lu(XC)}),zC=Du(_C,{Format:Ru(GM),DCPType:Ru((function(t,e){return $u({},GC,t,e)}))}),GC=Du(_C,{HTTP:Lu((function(t,e){return $u({},jC,t,e)}))}),jC=Du(_C,{Get:Lu(qC),Post:Lu(qC)}),DC=Du(_C,{Name:Lu(GM),Title:Lu(GM),Abstract:Lu(GM),LegendURL:Ru(YC),StyleSheetURL:Lu(qC),StyleURL:Lu(qC)}),UC=Du(_C,{Format:Lu(GM),OnlineResource:Lu(W_)}),$C=Du(_C,{Keyword:Au(GM)});function BC(t,e){const i=e[e.length-1],n=$u({},RC,t,e);if(!n)return;let s=kM(t.getAttribute("queryable"));void 0===s&&(s=i.queryable),n.queryable=void 0!==s&&s;let r=zM(t.getAttribute("cascaded"));void 0===r&&(r=i.cascaded),n.cascaded=r;let o=kM(t.getAttribute("opaque"));void 0===o&&(o=i.opaque),n.opaque=void 0!==o&&o;let h=kM(t.getAttribute("noSubsets"));void 0===h&&(h=i.noSubsets),n.noSubsets=void 0!==h&&h;let a=NM(t.getAttribute("fixedWidth"));a||(a=i.fixedWidth),n.fixedWidth=a;let u=NM(t.getAttribute("fixedHeight"));u||(u=i.fixedHeight),n.fixedHeight=u;["Style","CRS","AuthorityURL"].forEach((function(t){if(t in i){const e=n[t]||[];n[t]=e.concat(i[t])}}));return["EX_GeographicBoundingBox","BoundingBox","Dimension","Attribution","MinScaleDenominator","MaxScaleDenominator"].forEach((function(t){if(!(t in n)){const e=i[t];n[t]=e}})),n}function qC(t,e){return $u({},UC,t,e)}function XC(t,e){return $u({},zC,t,e)}function YC(t,e){const i=qC(t,e);if(i){const e=[zM(t.getAttribute("width")),zM(t.getAttribute("height"))];return i.size=e,i}}function ZC(t,e){return $u([],$C,t,e)}var VC=class extends V_{constructor(){super(),this.version=void 0}readFromNode(t){this.version=t.getAttribute("version").trim();const e=$u({version:this.version},EC,t,[]);return e||null}};var WC=class extends EM{constructor(t){super(),t=t||{},this.rg="http://mapserver.gis.umn.edu/mapserver",this.og=new ZM,this.qu=t.layers?t.layers:null}getLayers(){return this.qu}setLayers(t){this.qu=t}Qg(t,e){t.setAttribute("namespaceURI",this.rg);const i=t.localName;let n=[];if(0===t.childNodes.length)return n;if("msGMLOutput"==i)for(let i=0,s=t.childNodes.length;i<s;i++){const s=t.childNodes[i];if(s.nodeType!==Node.ELEMENT_NODE)continue;const r=s,o=e[0],h="_layer",a=r.localName.replace(h,"");if(this.qu&&!this.qu.includes(a))continue;const u=a+"_feature";o.featureType=u,o.featureNS=this.rg;const l={};l[u]=Au(this.og.readFeatureElement,this.og);const c=Du([o.featureNS,null],l);r.setAttribute("namespaceURI",this.rg);const f=$u([],c,r,e,this.og);f&&v(n,f)}if("FeatureCollection"==i){const e=$u([],this.og.FEATURE_COLLECTION_PARSERS,t,[{}],this.og);e&&(n=e)}return n}readFeaturesFromNode(t,e){const i={};return e&&Object.assign(i,this.getReadOptions(t,e)),this.Qg(t,[i])}};const HC=[null,"http://www.opengis.net/wmts/1.0"],KC=[null,"http://www.opengis.net/ows/1.1"],JC=Du(HC,{Contents:Lu((function(t,e){return $u({},QC,t,e)}))});const QC=Du(HC,{Layer:Ru((function(t,e){return $u({},tF,t,e)})),TileMatrixSet:Ru((function(t,e){return $u({},hF,t,e)}))}),tF=Du(HC,{Style:Ru((function(t,e){const i=$u({},eF,t,e);if(!i)return;const n="true"===t.getAttribute("isDefault");return i.isDefault=n,i})),Format:Ru(GM),TileMatrixSetLink:Ru((function(t,e){return $u({},iF,t,e)})),Dimension:Ru((function(t,e){return $u({},rF,t,e)})),ResourceURL:Ru((function(t,e){const i=t.getAttribute("format"),n=t.getAttribute("template"),s=t.getAttribute("resourceType"),r={};i&&(r.format=i);n&&(r.template=n);s&&(r.resourceType=s);return r}))},Du(KC,{Title:Lu(GM),Abstract:Lu(GM),WGS84BoundingBox:Lu(uF),Identifier:Lu(GM)})),eF=Du(HC,{LegendURL:Ru((function(t,e){const i={};return i.format=t.getAttribute("format"),i.href=W_(t),i}))},Du(KC,{Title:Lu(GM),Identifier:Lu(GM)})),iF=Du(HC,{TileMatrixSet:Lu(GM),TileMatrixSetLimits:Lu((function(t,e){return $u([],nF,t,e)}))}),nF=Du(HC,{TileMatrixLimits:Au((function(t,e){return $u({},sF,t,e)}))}),sF=Du(HC,{TileMatrix:Lu(GM),MinTileRow:Lu(OM),MaxTileRow:Lu(OM),MinTileCol:Lu(OM),MaxTileCol:Lu(OM)}),rF=Du(HC,{Default:Lu(GM),Value:Ru(GM)},Du(KC,{Identifier:Lu(GM)})),oF=Du(KC,{LowerCorner:Au(lF),UpperCorner:Au(lF)}),hF=Du(HC,{WellKnownScaleSet:Lu(GM),TileMatrix:Ru((function(t,e){return $u({},aF,t,e)}))},Du(KC,{SupportedCRS:Lu(GM),Identifier:Lu(GM),BoundingBox:Lu(uF)})),aF=Du(HC,{TopLeftCorner:Lu(lF),ScaleDenominator:Lu(LM),TileWidth:Lu(OM),TileHeight:Lu(OM),MatrixWidth:Lu(OM),MatrixHeight:Lu(OM)},Du(KC,{Identifier:Lu(GM)}));function uF(t,e){const i=$u([],oF,t,e);if(2==i.length)return Zt(i)}function lF(t,e){const i=GM(t).split(/\s+/);if(!i||2!=i.length)return;const n=+i[0],s=+i[1];return isNaN(n)||isNaN(s)?void 0:[n,s]}var cF=class extends V_{constructor(){super(),this.ty=new cE}readFromNode(t){let e=t.getAttribute("version");e&&(e=e.trim());let i=this.ty.readFromNode(t);return i?(i.version=e,i=$u(i,JC,t,[]),i||null):null}};const fF=["fullscreenchange","webkitfullscreenchange","MSFullscreenChange"],dF="enterfullscreen",pF="leavefullscreen";function mF(t){const e=t.body;return!!(e.webkitRequestFullscreen||e.requestFullscreen&&t.fullscreenEnabled)}function vF(t){return!(!t.webkitIsFullScreen&&!t.fullscreenElement)}function gF(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen&&t.webkitRequestFullscreen()}var yF=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.nl=void 0!==t.keys&&t.keys,this.Hd=t.source,this.ey=!1,this.iy=this.ny.bind(this),this.sy=void 0!==t.className?t.className:"ol-full-screen",this.oy=[],this.hy=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.sy+"-true"],this.uy=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.sy+"-false"];const e=void 0!==t.label?t.label:"⤢";this.ly="string"==typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.py="string"==typeof i?document.createTextNode(i):i;const n=t.tipLabel?t.tipLabel:"Toggle full-screen";this.my=document.createElement("button"),this.my.title=n,this.my.setAttribute("type","button"),this.my.appendChild(this.ly),this.my.addEventListener(I,this.qi.bind(this),!1),this.vy(this.my,this.ey),this.element.className=`${this.sy} ol-unselectable ol-control`,this.element.appendChild(this.my)}qi(t){t.preventDefault(),this.gy()}gy(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(mF(e))if(vF(e))!function(t){t.exitFullscreen?t.exitFullscreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}(e);else{let i;i=this.Hd?"string"==typeof this.Hd?e.getElementById(this.Hd):this.Hd:t.getTargetElement(),this.nl?function(t){t.webkitRequestFullscreen?t.webkitRequestFullscreen():gF(t)}(i):gF(i)}}yy(){const t=this.getMap();if(!t)return;const e=this.ey;this.ey=vF(t.getOwnerDocument()),e!==this.ey&&(this.vy(this.my,this.ey),this.ey?(Hs(this.py,this.ly),this.dispatchEvent(dF)):(Hs(this.ly,this.py),this.dispatchEvent(pF)),t.updateSize())}vy(t,e){e?(t.classList.remove(...this.uy),t.classList.add(...this.hy)):(t.classList.remove(...this.hy),t.classList.add(...this.uy))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(Ro,this.iy),super.setMap(t),this.ny(),t&&t.addChangeListener(Ro,this.iy)}ny(){const t=this.oy;for(let e=0,i=t.length;e<i;++e)B(t[e]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();mF(i)?this.element.classList.remove(jr):this.element.classList.add(jr);for(let e=0,n=fF.length;e<n;++e)t.push(U(i,fF[e],this.yy,this));this.yy()}}};const wF="projection",xF="coordinateFormat";var bF=class extends hh{constructor(t){t=t||{};const e=document.createElement("div");e.className=void 0!==t.className?t.className:"ol-mouse-position",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un,this.addChangeListener(wF,this.Ft),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.wy=void 0!==t.placeholder,this.xy=this.wy?t.placeholder:"&#160;",this.My=e.innerHTML,this.Sy=null,this.Tt=null}Ft(){this.Tt=null}getCoordinateFormat(){return this.get(xF)}getProjection(){return this.get(wF)}handleMouseMove(t){const e=this.getMap();this.Py(e.getEventPixel(t))}handleMouseOut(t){this.Py(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();this.listenerKeys.push(U(e,bo,this.handleMouseMove,this)),this.wy&&this.listenerKeys.push(U(e,Po,this.handleMouseOut,this)),this.Py(null)}}setCoordinateFormat(t){this.set(xF,t)}setProjection(t){this.set(wF,Yi(t))}Py(t){let e=this.xy;if(t&&this.Sy){if(!this.Tt){const t=this.getProjection();this.Tt=t?en(this.Sy,t):Bi}const i=this.getMap().getCoordinateFromPixelInternal(t);if(i){const t=an();t&&(this.Tt=en(this.Sy,t)),this.Tt(i,i);const n=this.getCoordinateFormat();e=n?n(i):i.toString()}}this.My&&e===this.My||(this.element.innerHTML=e,this.My=e)}render(t){const e=t.frameState;e?this.Sy!=e.viewState.projection&&(this.Sy=e.viewState.projection,this.Tt=null):this.Sy=null}};const MF=.75,SF=.1;var PF=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this._y=this.Ey.bind(this),this.zi=void 0===t.collapsed||t.collapsed,this.Di=void 0===t.collapsible||t.collapsible,this.Di||(this.zi=!1),this.hh=void 0!==t.rotateWithView&&t.rotateWithView,this.Ty=void 0;const e=void 0!==t.className?t.className:"ol-overviewmap",i=void 0!==t.tipLabel?t.tipLabel:"Overview map",n=void 0!==t.collapseLabel?t.collapseLabel:"‹";"string"==typeof n?(this.Ui=document.createElement("span"),this.Ui.textContent=n):this.Ui=n;const s=void 0!==t.label?t.label:"›";"string"==typeof s?(this.$i=document.createElement("span"),this.$i.textContent=s):this.$i=s;const r=this.Di&&!this.zi?this.Ui:this.$i,o=document.createElement("button");o.setAttribute("type","button"),o.title=i,o.appendChild(r),o.addEventListener(I,this.qi.bind(this),!1),this.Cy=document.createElement("div"),this.Cy.className="ol-overviewmap-map",this.ag=t.view;const h=new ra({view:t.view,controls:new Q,interactions:new Q});this.Fy=h,t.layers&&t.layers.forEach((function(t){h.addLayer(t)}));const a=document.createElement("div");a.className="ol-overviewmap-box",a.style.boxSizing="border-box",this.Iy=new ca({position:[0,0],positioning:"center-center",element:a}),this.Fy.addOverlay(this.Iy);const u=e+" "+"ol-unselectable "+Dr+(this.zi&&this.Di?" ol-collapsed":"")+(this.Di?"":" ol-uncollapsible"),l=this.element;l.className=u,l.appendChild(this.Cy),l.appendChild(o);const c=this,f=this.Iy,d=this.Iy.getElement(),p=function(t){const e={clientX:(i=t).clientX,clientY:i.clientY};var i;const n=h.getEventCoordinateInternal(e);f.setPosition(n)},m=function(t){const e=h.getEventCoordinateInternal(t);c.getMap().getView().setCenterInternal(e),window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",m)};d.addEventListener("mousedown",(function(){window.addEventListener("mousemove",p),window.addEventListener("mouseup",m)}))}setMap(t){const e=this.getMap();if(t!==e){if(e){const t=e.getView();t&&this.Ay(t),this.Fy.setTarget(null)}if(super.setMap(t),t){this.Fy.setTarget(this.Cy),this.listenerKeys.push(U(t,l,this.ky,this));const e=t.getView();e&&(this.Ry(e),e.isDef()&&(this.Fy.updateSize(),this.Ly())),this.Fy.isRendered()||this.Ny()}}}ky(t){if(t.key===Lo){const e=t.oldValue;e&&this.Ay(e);const i=this.getMap().getView();this.Ry(i)}else this.Fy.isRendered()||t.key!==Ro&&t.key!==ko||this.Fy.updateSize()}Ry(t){if(!this.ag){const e=new oh({projection:t.getProjection()});this.Fy.setView(e)}t.addChangeListener(Uo.ROTATION,this._y),this.Ey()}Ay(t){t.removeChangeListener(Uo.ROTATION,this._y)}Ey(){this.hh&&this.Fy.getView().setRotation(this.getMap().getView().getRotation())}Oy(){const t=this.getMap(),e=this.Fy;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(this.Ty&&oe(n,this.Ty))return;this.Ty=n;const s=e.getSize(),r=e.getView().calculateExtentInternal(s),o=e.getPixelFromCoordinateInternal(Pe(n)),h=e.getPixelFromCoordinateInternal(ge(n)),a=Math.abs(o[0]-h[0]),u=Math.abs(o[1]-h[1]),l=s[0],c=s[1];a<l*SF||u<c*SF||a>l*MF||u>c*MF?this.Ly():Jt(r,n)||this.zy()}Ly(){const t=this.getMap(),e=this.Fy,i=t.getSize(),n=t.getView().calculateExtentInternal(i),s=e.getView(),r=Math.log(7.5)/Math.LN2;Ie(n,1/(Math.pow(2,r/2)*SF)),s.fitInternal(Ms(n))}zy(){const t=this.getMap(),e=this.Fy,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())}Gy(){const t=this.getMap(),e=this.Fy;if(!t.isRendered()||!e.isRendered())return;const i=t.getSize(),n=t.getView(),s=e.getView(),r=this.hh?0:-n.getRotation(),o=this.Iy,h=this.Iy.getElement(),a=n.getCenterInternal(),u=n.getResolution(),l=s.getResolution(),c=i[0]*u/l,f=i[1]*u/l;if(o.setPosition(a),h){h.style.width=c+"px",h.style.height=f+"px";const t="rotate("+r+"rad)";h.style.transform=t}}Ny(){this.jy||(this.jy=$(this.Fy,Eo,(function(t){delete this.jy,this.Gy()}),this))}qi(t){t.preventDefault(),this.Vi()}Vi(){this.element.classList.toggle(Ur),this.zi?Hs(this.Ui,this.$i):Hs(this.$i,this.Ui),this.zi=!this.zi;const t=this.Fy;if(!this.zi){if(t.isRendered())return this.Ty=void 0,void t.render();t.updateSize(),this.Ly(),this.Ny()}}getCollapsible(){return this.Di}setCollapsible(t){this.Di!==t&&(this.Di=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.zi&&this.Vi())}setCollapsed(t){this.Di&&this.zi!==t&&this.Vi()}getCollapsed(){return this.zi}getRotateWithView(){return this.hh}setRotateWithView(t){this.hh!==t&&(this.hh=t,0!==this.getMap().getView().getRotation()&&(this.hh?this.Ey():this.Fy.getView().setRotation(0),this.Ty=void 0,this.Oy(),this.Gy()))}getOverviewMap(){return this.Fy}render(t){this.Oy(),this.Gy()}};const _F="units",EF=[1,2,5],TF=25.4/.28;var CF=class extends hh{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.Dy=document.createElement("div"),this.Dy.className=i+"-inner",this.element.className=i+" "+Gr,this.element.appendChild(this.Dy),this.Uy=null,this.$y=void 0!==t.minWidth?t.minWidth:64,this.By=t.maxWidth,this.pe=!1,this.qy=void 0,this.My="",this.addChangeListener(_F,this.Xy),this.setUnits(t.units||"metric"),this.Yy=t.bar||!1,this.Zy=t.steps||4,this.Vy=t.text||!1,this.Wy=t.dpi||void 0}getUnits(){return this.get(_F)}Xy(){this.Zi()}setUnits(t){this.set(_F,t)}setDpi(t){this.Wy=t}Zi(){const t=this.Uy;if(!t)return void(this.pe&&(this.element.style.display="none",this.pe=!1));const e=t.center,i=t.projection,n=this.getUnits(),s="degrees"==n?"degrees":"m";let r=Zi(i,t.resolution,e,s);const o=this.$y*(this.Wy||TF)/TF,h=void 0!==this.By?this.By*(this.Wy||TF)/TF:void 0;let a=o*r,u="";if("degrees"==n){const t=ze.degrees;a*=t,a<t/60?(u="″",r*=3600):a<t?(u="′",r*=60):u="°"}else"imperial"==n?a<.9144?(u="in",r/=.0254):a<1609.344?(u="ft",r/=.3048):(u="mi",r/=1609.344):"nautical"==n?(r/=1852,u="NM"):"metric"==n?a<.001?(u="μm",r*=1e6):a<1?(u="mm",r*=1e3):a<1e3?u="m":(u="km",r/=1e3):"us"==n?a<.9144?(u="in",r*=39.37):a<1609.344?(u="ft",r/=.30480061):(u="mi",r/=1609.3472):ct(!1,33);let l,c,f,d,p,m,v=3*Math.floor(Math.log(o*r)/Math.log(10));for(;;){f=Math.floor(v/3);const t=Math.pow(10,f);if(l=EF[(v%3+3)%3]*t,c=Math.round(l/r),isNaN(c))return this.element.style.display="none",void(this.pe=!1);if(void 0!==h&&c>=h){l=d,c=p,f=m;break}if(c>=o)break;d=l,p=c,m=f,++v}const g=this.Yy?this.createScaleBar(c,l,u):l.toFixed(f<0?-f:0)+" "+u;this.My!=g&&(this.Dy.innerHTML=g,this.My=g),this.qy!=c&&(this.Dy.style.width=c+"px",this.qy=c),this.pe||(this.element.style.display="",this.pe=!0)}createScaleBar(t,e,i){const n=this.getScaleForResolution(),s=n<1?Math.round(1/n).toLocaleString()+" : 1":"1 : "+Math.round(n).toLocaleString(),r=this.Zy,o=t/r,h=[this.createMarker("absolute")];for(let n=0;n<r;++n){const s=n%2==0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";h.push(`<div><div class="ol-scale-singlebar ${s}" style="width: ${o}px;"></div>`+this.createMarker("relative")+(n%2==0||2===r?this.createStepText(n,t,!1,e,i):"")+"</div>")}h.push(this.createStepText(r,t,!0,e,i));return(this.Vy?`<div class="ol-scale-text" style="width: ${t}px;">`+s+"</div>":"")+h.join("")}createMarker(t){return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${"absolute"===t?3:-10}px;"></div>`}createStepText(t,e,i,n,s){const r=(0===t?0:Math.round(n/this.Zy*t*100)/100)+(0===t?"":" "+s);return`<div class="ol-scale-step-text" style="margin-left: ${0===t?-3:e/this.Zy*-1}px;text-align: ${0===t?"left":"center"};min-width: ${0===t?0:e/this.Zy*2}px;left: ${i?e+"px":"unset"};">`+r+"</div>"}getScaleForResolution(){return Zi(this.Uy.projection,this.Uy.resolution,this.Uy.center,"m")*(1e3/25.4)*(this.Wy||TF)}render(t){const e=t.frameState;this.Uy=e?e.viewState:null,this.Zi()}};const FF=0,IF=1;var AF=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render}),this.Fe=[],this.Hy=void 0,this.Ky=FF,this.Ce,this.Jy=0,this.Qy=0,this.tw,this.ew,this.iw=null,this.nw=!1,this.Hi=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 "+Gr;const n=this.element;n.className=e+" "+"ol-unselectable "+Dr,n.appendChild(i),n.addEventListener(Mo,this.sw.bind(this),!1),n.addEventListener(bo,this.rw.bind(this),!1),n.addEventListener(So,this.ow.bind(this),!1),n.addEventListener(I,this.hw.bind(this),!1),i.addEventListener(I,a,!1)}setMap(t){super.setMap(t),t&&t.render()}aw(){const t=this.element;let e=t.offsetWidth,i=t.offsetHeight;if(0===e&&0===i)return this.nw=!1;const n=getComputedStyle(t);e-=parseFloat(n.paddingRight)+parseFloat(n.paddingLeft),i-=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom);const s=t.firstElementChild,r=getComputedStyle(s),o=s.offsetWidth+parseFloat(r.marginRight)+parseFloat(r.marginLeft),h=s.offsetHeight+parseFloat(r.marginTop)+parseFloat(r.marginBottom);return this.iw=[o,h],e>i?(this.Ky=IF,this.Qy=e-o):(this.Ky=FF,this.Jy=i-h),this.nw=!0}hw(t){const e=this.getMap().getView(),i=this.uw(t.offsetX-this.iw[0]/2,t.offsetY-this.iw[1]/2),n=this.lw(i),s=e.getConstrainedZoom(e.getZoomForResolution(n));e.animateInternal({zoom:s,duration:this.Hi,easing:ot})}sw(t){if(!this.Ce&&t.target===this.element.firstElementChild){const e=this.element.firstElementChild;if(this.getMap().getView().beginInteraction(),this.tw=t.clientX-parseFloat(e.style.left),this.ew=t.clientY-parseFloat(e.style.top),this.Ce=!0,0===this.Fe.length){const t=this.rw,e=this.ow,i=this.getMap().getOwnerDocument();this.Fe.push(U(i,bo,t,this),U(i,So,e,this))}}}rw(t){if(this.Ce){const e=t.clientX-this.tw,i=t.clientY-this.ew,n=this.uw(e,i);this.Hy=this.lw(n),this.getMap().getView().setResolution(this.Hy)}}ow(t){if(this.Ce){this.getMap().getView().endInteraction(),this.Ce=!1,this.tw=void 0,this.ew=void 0,this.Fe.forEach(B),this.Fe.length=0}}cw(t){const e=this.fw(t),i=this.element.firstElementChild;this.Ky==IF?i.style.left=this.Qy*e+"px":i.style.top=this.Jy*e+"px"}uw(t,e){let i;return i=this.Ky===IF?t/this.Qy:e/this.Jy,hi(i,0,1)}lw(t){return this.getMap().getView().getResolutionForValueFunction()(1-t)}fw(t){return hi(1-this.getMap().getView().getValueForResolutionFunction()(t),0,1)}render(t){if(!t.frameState)return;if(!this.nw&&!this.aw())return;const e=t.frameState.viewState.resolution;this.Hy=e,this.cw(e)}};var kF=class extends hh{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.extent=t.extent?t.extent:null;const e=void 0!==t.className?t.className:"ol-zoom-extent",i=void 0!==t.label?t.label:"E",n=void 0!==t.tipLabel?t.tipLabel:"Fit to extent",s=document.createElement("button");s.setAttribute("type","button"),s.title=n,s.appendChild("string"==typeof i?document.createTextNode(i):i),s.addEventListener(I,this.qi.bind(this),!1);const r=e+" "+"ol-unselectable "+Dr,o=this.element;o.className=r,o.appendChild(s)}qi(t){t.preventDefault(),this.handleZoomToExtent()}handleZoomToExtent(){const t=this.getMap().getView(),e=this.extent?this.extent:t.getProjection().getExtent();t.fitInternal(Ms(e))}},RF={};RF.AssertionError=h,RF.Collection=Q,RF.Collection.CollectionEvent=J,RF.DataTile=lt,RF.Disposable=c,RF.Feature=pt,RF.Feature.createStyleFunction=dt,RF.Geolocation=Os,RF.Image=qs,RF.Image.listenImage=Bs,RF.ImageBase=zs,RF.ImageCanvas=Xs,RF.ImageTile=tr,RF.Kinetic=er,RF.Map=ra,RF.MapBrowserEvent=wo,RF.MapBrowserEventHandler=_o,RF.MapEvent=yo,RF.Object=V,RF.Object.ObjectEvent=Z,RF.Observable=Y,RF.Observable.unByKey=X,RF.Overlay=ca,RF.Tile=ut,RF.TileCache=xa,RF.TileQueue=zo,RF.TileQueue.getTilePriority=Go,RF.TileRange=Sa,RF.TileRange.createOrUpdate=Ma,RF.VectorRenderTile=_a,RF.VectorTile=Ea,RF.View=oh,RF.View.createCenterConstraint=eh,RF.View.createResolutionConstraint=ih,RF.View.createRotationConstraint=nh,RF.View.isNoopAnimation=sh,RF.array={},RF.array.binarySearch=f,RF.array.equals=g,RF.array.extend=v,RF.array.isSorted=y,RF.array.linearFindNearest=p,RF.array.numberSafeCompareFunction=d,RF.array.remove=function(t,e){const i=t.indexOf(e),n=i>-1;return n&&t.splice(i,1),n},RF.array.reverseSubArray=m,RF.array.stableSort=function(t,e){const i=t.length,n=Array(t.length);let s;for(s=0;s<i;s++)n[s]={index:s,value:t[s]};for(n.sort((function(t,i){return e(t.value,i.value)||t.index-i.index})),s=0;s<t.length;s++)t[s]=n[s].value},RF.asserts={},RF.asserts.assert=ct,RF.centerconstraint={},RF.centerconstraint.createExtent=Bo,RF.centerconstraint.none=qo,RF.color={},RF.color.asArray=hr,RF.color.asString=sr,RF.color.fromString=or,RF.color.isStringColor=lr,RF.color.normalize=ar,RF.color.toString=ur,RF.colorlike={},RF.colorlike.asColorLike=Ta,RF.control={},RF.control.Attribution=ah,RF.control.Control=hh,RF.control.FullScreen=yF,RF.control.MousePosition=bF,RF.control.OverviewMap=PF,RF.control.Rotate=uh,RF.control.ScaleLine=CF,RF.control.Zoom=lh,RF.control.ZoomSlider=AF,RF.control.ZoomToExtent=kF,RF.control.defaults={},RF.control.defaults.defaults=ch,RF.coordinate={},RF.coordinate.add=bi,RF.coordinate.closestOnCircle=Mi,RF.coordinate.closestOnSegment=Si,RF.coordinate.createStringXY=function(t){return function(e){return ki(e,t)}},RF.coordinate.degreesToStringHDMS=Pi,RF.coordinate.distance=Ii,RF.coordinate.equals=Ei,RF.coordinate.format=_i,RF.coordinate.getWorldsAway=Li,RF.coordinate.rotate=Ti,RF.coordinate.scale=Ci,RF.coordinate.squaredDistance=Fi,RF.coordinate.squaredDistanceToSegment=Ai,RF.coordinate.toStringHDMS=function(t,e){return t?Pi("NS",t[1],e)+" "+Pi("EW",t[0],e):""},RF.coordinate.toStringXY=ki,RF.coordinate.wrapX=Ri,RF.css={},RF.css.CLASS_COLLAPSED=Ur,RF.css.CLASS_CONTROL=Dr,RF.css.CLASS_HIDDEN=Or,RF.css.CLASS_SELECTABLE=zr,RF.css.CLASS_UNSELECTABLE=Gr,RF.css.CLASS_UNSUPPORTED=jr,RF.css.getFontParameters=qr,RF.dom={},RF.dom.createCanvasContext2D=Ys,RF.dom.outerHeight=Ws,RF.dom.outerWidth=Vs,RF.dom.releaseCanvas=Zs,RF.dom.removeChildren=Js,RF.dom.removeNode=Ks,RF.dom.replaceChildren=Qs,RF.dom.replaceNode=Hs,RF.easing={},RF.easing.easeIn=rt,RF.easing.easeOut=ot,RF.easing.inAndOut=ht,RF.easing.linear=at,RF.easing.upAndDown=function(t){return t<.5?ht(2*t):1-ht(2*(t-.5))},RF.events={},RF.events.Event=u,RF.events.Event.preventDefault=function(t){t.preventDefault()},RF.events.Event.stopPropagation=a,RF.events.Target=E,RF.events.condition={},RF.events.condition.all=wh,RF.events.condition.altKeyOnly=xh,RF.events.condition.altShiftKeysOnly=bh,RF.events.condition.always=Ph,RF.events.condition.click=function(t){return t.type==xo.CLICK},RF.events.condition.doubleClick=function(t){return t.type==xo.DBLCLICK},RF.events.condition.focus=Mh,RF.events.condition.focusWithTabindex=Sh,RF.events.condition.mouseActionButton=_h,RF.events.condition.mouseOnly=Ah,RF.events.condition.never=Eh,RF.events.condition.noModifierKeys=Ch,RF.events.condition.penOnly=function(t){const e=t.originalEvent;return ct(void 0!==e,56),"pen"===e.pointerType},RF.events.condition.platformModifierKeyOnly=function(t){const e=t.originalEvent;return!e.altKey&&(xt?e.metaKey:e.ctrlKey)&&!e.shiftKey},RF.events.condition.pointerMove=function(t){return"pointermove"==t.type},RF.events.condition.primaryAction=kh,RF.events.condition.shiftKeyOnly=Fh,RF.events.condition.singleClick=Th,RF.events.condition.targetNotEditable=Ih,RF.events.condition.touchOnly=function(t){const e=t.originalEvent;return ct(void 0!==e,56),"touch"===e.pointerType},RF.events.listen=U,RF.events.listenOnce=$,RF.events.unlistenByKey=B,RF.extent={},RF.extent.applyTransform=ke,RF.extent.approximatelyEquals=he,RF.extent.boundingExtent=Zt,RF.extent.buffer=Vt,RF.extent.clone=Wt,RF.extent.closestSquaredDistanceXY=Ht,RF.extent.containsCoordinate=Kt,RF.extent.containsExtent=Jt,RF.extent.containsXY=Qt,RF.extent.coordinateRelationship=te,RF.extent.createEmpty=ee,RF.extent.createOrUpdate=ie,RF.extent.createOrUpdateEmpty=ne,RF.extent.createOrUpdateFromCoordinate=se,RF.extent.createOrUpdateFromCoordinates=function(t,e){return le(ne(e),t)},RF.extent.createOrUpdateFromFlatCoordinates=re,RF.extent.createOrUpdateFromRings=function(t,e){return fe(ne(e),t)},RF.extent.equals=oe,RF.extent.extend=ae,RF.extent.extendCoordinate=ue,RF.extent.extendCoordinates=le,RF.extent.extendFlatCoordinates=ce,RF.extent.extendRings=fe,RF.extent.extendXY=de,RF.extent.forEachCorner=pe,RF.extent.getArea=me,RF.extent.getBottomLeft=ve,RF.extent.getBottomRight=ge,RF.extent.getCenter=ye,RF.extent.getCorner=we,RF.extent.getEnlargedArea=function(t,e){const i=Math.min(t[0],e[0]),n=Math.min(t[1],e[1]);return(Math.max(t[2],e[2])-i)*(Math.max(t[3],e[3])-n)},RF.extent.getForViewAndSize=xe,RF.extent.getHeight=Me,RF.extent.getIntersection=Se,RF.extent.getIntersectionArea=function(t,e){return me(Se(t,e))},RF.extent.getMargin=function(t){return Ee(t)+Me(t)},RF.extent.getRotatedViewport=be,RF.extent.getSize=function(t){return[t[2]-t[0],t[3]-t[1]]},RF.extent.getTopLeft=Pe,RF.extent.getTopRight=_e,RF.extent.getWidth=Ee,RF.extent.intersects=Te,RF.extent.intersectsSegment=Ae,RF.extent.isEmpty=Ce,RF.extent.returnOrUpdate=Fe,RF.extent.scaleFromCenter=Ie,RF.extent.wrapAndSliceX=Le,RF.extent.wrapX=Re,RF.featureloader={},RF.featureloader.loadFeaturesXhr=Ia,RF.featureloader.setWithCredentials=function(t){Fa=t},RF.featureloader.xhr=Aa,RF.format={},RF.format.EsriJSON=_M,RF.format.Feature=lg,RF.format.Feature.transformExtentWithOptions=fg,RF.format.Feature.transformGeometryWithOptions=cg,RF.format.GML=JM,RF.format.GML2=ZM,RF.format.GML3=HM,RF.format.GML32=tS,RF.format.GMLBase=IM,RF.format.GMLBase.GMLNS=TM,RF.format.GPX=LS,RF.format.GeoJSON=Cg,RF.format.IGC=US,RF.format.IIIFInfo=ap,RF.format.JSONFeature=Pg,RF.format.KML=U_,RF.format.KML.getDefaultFillStyle=function(){return nP},RF.format.KML.getDefaultImageStyle=function(){return rP},RF.format.KML.getDefaultStrokeStyle=function(){return hP},RF.format.KML.getDefaultStyle=function(){return uP},RF.format.KML.getDefaultStyleArray=function(){return cP},RF.format.KML.getDefaultTextStyle=function(){return aP},RF.format.KML.readFlatCoordinates=vP,RF.format.MVT=yg,RF.format.OSMXML=Z_,RF.format.OWS=cE,RF.format.Polyline=bE,RF.format.Polyline.decodeDeltas=dE,RF.format.Polyline.decodeFloats=mE,RF.format.Polyline.decodeSignedIntegers=gE,RF.format.Polyline.decodeUnsignedIntegers=wE,RF.format.Polyline.encodeDeltas=fE,RF.format.Polyline.encodeFloats=pE,RF.format.Polyline.encodeSignedIntegers=vE,RF.format.Polyline.encodeUnsignedInteger=xE,RF.format.Polyline.encodeUnsignedIntegers=yE,RF.format.TextFeature=OS,RF.format.TopoJSON=CE,RF.format.WFS=YT,RF.format.WFS.writeFilter=function(t,e){const i=Pu(XT(e=e||"1.1.0"),"Filter"),n={node:i};return Object.assign(n,{version:e,filter:t}),FT(i,t,[n]),i},RF.format.WKB=oC,RF.format.WKT=PC,RF.format.WMSCapabilities=VC,RF.format.WMSGetFeatureInfo=WC,RF.format.WMTSCapabilities=cF,RF.format.XML=V_,RF.format.XMLFeature=EM,RF.format.filter={},RF.format.filter.And=AE,RF.format.filter.Bbox=kE,RF.format.filter.Comparison=zE,RF.format.filter.ComparisonBinary=jE,RF.format.filter.Contains=LE,RF.format.filter.DWithin=NE,RF.format.filter.Disjoint=OE,RF.format.filter.During=GE,RF.format.filter.EqualTo=DE,RF.format.filter.Filter=FE,RF.format.filter.GreaterThan=UE,RF.format.filter.GreaterThanOrEqualTo=$E,RF.format.filter.Intersects=BE,RF.format.filter.IsBetween=qE,RF.format.filter.IsLike=XE,RF.format.filter.IsNull=YE,RF.format.filter.LessThan=ZE,RF.format.filter.LessThanOrEqualTo=VE,RF.format.filter.LogicalNary=IE,RF.format.filter.Not=WE,RF.format.filter.NotEqualTo=HE,RF.format.filter.Or=KE,RF.format.filter.ResourceId=JE,RF.format.filter.Spatial=RE,RF.format.filter.Within=QE,RF.format.filter.and=tT,RF.format.filter.bbox=eT,RF.format.filter.between=function(t,e,i){return new qE(t,e,i)},RF.format.filter.contains=function(t,e,i){return new LE(t,e,i)},RF.format.filter.disjoint=function(t,e,i){return new OE(t,e,i)},RF.format.filter.during=function(t,e,i){return new GE(t,e,i)},RF.format.filter.dwithin=function(t,e,i,n,s){return new NE(t,e,i,n,s)},RF.format.filter.equalTo=function(t,e,i){return new DE(t,e,i)},RF.format.filter.greaterThan=function(t,e){return new UE(t,e)},RF.format.filter.greaterThanOrEqualTo=function(t,e){return new $E(t,e)},RF.format.filter.intersects=function(t,e,i){return new BE(t,e,i)},RF.format.filter.isNull=function(t){return new YE(t)},RF.format.filter.lessThan=function(t,e){return new ZE(t,e)},RF.format.filter.lessThanOrEqualTo=function(t,e){return new VE(t,e)},RF.format.filter.like=function(t,e,i,n,s,r){return new XE(t,e,i,n,s,r)},RF.format.filter.not=function(t){return new WE(t)},RF.format.filter.notEqualTo=function(t,e,i){return new HE(t,e,i)},RF.format.filter.or=function(t){const e=[null].concat(Array.prototype.slice.call(arguments));return new(Function.prototype.bind.apply(KE,e))},RF.format.filter.resourceId=function(t){return new JE(t)},RF.format.filter.within=function(t,e,i){return new QE(t,e,i)},RF.format.xlink={},RF.format.xlink.readHref=W_,RF.format.xsd={},RF.format.xsd.readBoolean=AM,RF.format.xsd.readBooleanString=kM,RF.format.xsd.readDateTime=RM,RF.format.xsd.readDecimal=LM,RF.format.xsd.readDecimalString=NM,RF.format.xsd.readNonNegativeIntegerString=zM,RF.format.xsd.readPositiveInteger=OM,RF.format.xsd.readString=GM,RF.format.xsd.writeBooleanTextNode=jM,RF.format.xsd.writeCDATASection=DM,RF.format.xsd.writeDateTimeTextNode=UM,RF.format.xsd.writeDecimalTextNode=$M,RF.format.xsd.writeNonNegativeIntegerTextNode=BM,RF.format.xsd.writeStringTextNode=qM,RF.functions={},RF.functions.FALSE=x,RF.functions.TRUE=w,RF.functions.VOID=b,RF.functions.memoizeOne=M,RF.functions.toPromise=S,RF.geom={},RF.geom.Circle=Ab,RF.geom.Geometry=Mn,RF.geom.GeometryCollection=Mg,RF.geom.LineString=$v,RF.geom.LinearRing=Kn,RF.geom.MultiLineString=qv,RF.geom.MultiPoint=zv,RF.geom.MultiPolygon=Zv,RF.geom.Point=Qn,RF.geom.Polygon=xs,RF.geom.Polygon.circular=bs,RF.geom.Polygon.fromCircle=Ss,RF.geom.Polygon.fromExtent=Ms,RF.geom.Polygon.makeRegular=Ps,RF.geom.SimpleGeometry=_n,RF.geom.SimpleGeometry.getStrideForLayout=Sn,RF.geom.SimpleGeometry.transformGeom2D=Pn,RF.geom.flat={},RF.geom.flat.area={},RF.geom.flat.area.linearRing=Zn,RF.geom.flat.area.linearRings=Vn,RF.geom.flat.area.linearRingss=Wn,RF.geom.flat.center={},RF.geom.flat.center.linearRingss=Xv,RF.geom.flat.closest={},RF.geom.flat.closest.arrayMaxSquaredDelta=Cn,RF.geom.flat.closest.assignClosestArrayPoint=An,RF.geom.flat.closest.assignClosestMultiArrayPoint=kn,RF.geom.flat.closest.assignClosestPoint=In,RF.geom.flat.closest.maxSquaredDelta=Tn,RF.geom.flat.closest.multiArrayMaxSquaredDelta=Fn,RF.geom.flat.contains={},RF.geom.flat.contains.linearRingContainsExtent=ts,RF.geom.flat.contains.linearRingContainsXY=es,RF.geom.flat.contains.linearRingsContainsXY=is,RF.geom.flat.contains.linearRingssContainsXY=ns,RF.geom.flat.deflate={},RF.geom.flat.deflate.deflateCoordinate=Rn,RF.geom.flat.deflate.deflateCoordinates=Ln,RF.geom.flat.deflate.deflateCoordinatesArray=Nn,RF.geom.flat.deflate.deflateMultiCoordinatesArray=On,RF.geom.flat.flip={},RF.geom.flat.flip.flipXY=yM,RF.geom.flat.geodesic={},RF.geom.flat.geodesic.greatCircleArc=function(t,e,i,n,s,r){const o=Yi("EPSG:4326"),h=Math.cos(fi(e)),a=Math.sin(fi(e)),u=Math.cos(fi(n)),l=Math.sin(fi(n)),c=Math.cos(fi(i-t)),f=Math.sin(fi(i-t)),d=a*l+h*u*c;return Qv((function(e){if(1<=d)return[i,n];const s=e*Math.acos(d),r=Math.cos(s),o=Math.sin(s),p=f*u,m=h*l-a*u*c,v=Math.atan2(p,m),g=Math.asin(a*r+h*o*Math.cos(v));return[ci(fi(t)+Math.atan2(Math.sin(v)*o*h,r-a*Math.sin(g))),ci(g)]}),nn(o,s),r)},RF.geom.flat.geodesic.meridian=tg,RF.geom.flat.geodesic.parallel=eg,RF.geom.flat.inflate={},RF.geom.flat.inflate.inflateCoordinates=qn,RF.geom.flat.inflate.inflateCoordinatesArray=Xn,RF.geom.flat.inflate.inflateMultiCoordinatesArray=Yn,RF.geom.flat.interiorpoint={},RF.geom.flat.interiorpoint.getInteriorPointOfArray=ss,RF.geom.flat.interiorpoint.getInteriorPointsOfMultiArray=rs,RF.geom.flat.interpolate={},RF.geom.flat.interpolate.interpolatePoint=Gv,RF.geom.flat.interpolate.lineStringCoordinateAtM=jv,RF.geom.flat.interpolate.lineStringsCoordinateAtM=Dv,RF.geom.flat.intersectsextent={},RF.geom.flat.intersectsextent.intersectsLineString=hs,RF.geom.flat.intersectsextent.intersectsLineStringArray=as,RF.geom.flat.intersectsextent.intersectsLinearRing=us,RF.geom.flat.intersectsextent.intersectsLinearRingArray=ls,RF.geom.flat.intersectsextent.intersectsLinearRingMultiArray=cs,RF.geom.flat.length={},RF.geom.flat.length.lineStringLength=dv,RF.geom.flat.length.linearRingLength=function(t,e,i,n){let s=dv(t,e,i,n);const r=t[i-n]-t[e],o=t[i-n+1]-t[e+1];return s+=Math.sqrt(r*r+o*o),s},RF.geom.flat.orient={},RF.geom.flat.orient.inflateEnds=ys,RF.geom.flat.orient.linearRingIsClockwise=ds,RF.geom.flat.orient.linearRingsAreOriented=ps,RF.geom.flat.orient.linearRingssAreOriented=ms,RF.geom.flat.orient.orientLinearRings=vs,RF.geom.flat.orient.orientLinearRingsArray=gs,RF.geom.flat.reverse={},RF.geom.flat.reverse.coordinates=fs,RF.geom.flat.segments={},RF.geom.flat.segments.forEach=os,RF.geom.flat.simplify={},RF.geom.flat.simplify.douglasPeucker=zn,RF.geom.flat.simplify.douglasPeuckerArray=Gn,RF.geom.flat.simplify.douglasPeuckerMultiArray=function(t,e,i,n,s,r,o,h){for(let a=0,u=i.length;a<u;++a){const u=i[a],l=[];o=Gn(t,e,u,n,s,r,o,l),h.push(l),e=u[u.length-1]}return o},RF.geom.flat.simplify.quantize=Un,RF.geom.flat.simplify.quantizeArray=$n,RF.geom.flat.simplify.quantizeMultiArray=Bn,RF.geom.flat.simplify.radialDistance=jn,RF.geom.flat.simplify.simplifyLineString=function(t,e,i,n,s,r,o){return o=void 0!==o?o:[],r||(i=jn(t,e,i,n,s,o,0),t=o,e=0,n=2),o.length=zn(t,e,i,n,s,o,0),o},RF.geom.flat.simplify.snap=Dn,RF.geom.flat.straightchunk={},RF.geom.flat.straightchunk.matchingChunk=hv,RF.geom.flat.textpath={},RF.geom.flat.textpath.drawTextOnPath=fv,RF.geom.flat.topology={},RF.geom.flat.topology.lineStringIsClosed=function(t,e,i,n){const s=i-n;return t[e]===t[s]&&t[e+1]===t[s+1]&&(i-e)/n>3&&!!Zn(t,e,i,n)},RF.geom.flat.transform={},RF.geom.flat.transform.rotate=yn,RF.geom.flat.transform.scale=wn,RF.geom.flat.transform.transform2D=gn,RF.geom.flat.transform.translate=xn,RF.has={},RF.has.DEVICE_PIXEL_RATIO=bt,RF.has.FIREFOX=vt,RF.has.IMAGE_DECODE=St,RF.has.MAC=xt,RF.has.PASSIVE_EVENT_LISTENERS=Pt,RF.has.SAFARI=gt,RF.has.SAFARI_BUG_237906=yt,RF.has.WEBKIT=wt,RF.has.WORKER_OFFSCREEN_CANVAS=Mt,RF.interaction={},RF.interaction.DoubleClickZoom=vh,RF.interaction.DragAndDrop=Cb,RF.interaction.DragAndDrop.DragAndDropEvent=Tb,RF.interaction.DragBox=Uh,RF.interaction.DragBox.DragBoxEvent=Dh,RF.interaction.DragPan=Rh,RF.interaction.DragRotate=Lh,RF.interaction.DragRotateAndZoom=Fb,RF.interaction.DragZoom=$h,RF.interaction.Draw=zb,RF.interaction.Draw.DrawEvent=Nb,RF.interaction.Draw.createBox=function(){return function(t,e,i){const n=Zt([t[0],t[t.length-1]].map((function(t){return ln(t,i)}))),s=[[ve(n),ge(n),_e(n),Pe(n),ve(n)]];e?e.setCoordinates(s):e=new xs(s);const r=an();return r&&e.transform(i,r),e}},RF.interaction.Draw.createRegularPolygon=function(t,e){return function(i,n,s){const r=ln(i[0],s),o=ln(i[i.length-1],s),h=Math.sqrt(Fi(r,o));n=n||Ss(new Ab(r),t);let a=e;if(!e&&0!==e){const t=o[0]-r[0],e=o[1]-r[1];a=Math.atan2(e,t)}Ps(n,r,h,a);const u=an();return u&&n.transform(s,u),n}},RF.interaction.Extent=qb,RF.interaction.Extent.ExtentEvent=jb,RF.interaction.Interaction=mh,RF.interaction.Interaction.pan=dh,RF.interaction.Interaction.zoomByDelta=ph,RF.interaction.KeyboardPan=Zh,RF.interaction.KeyboardZoom=Vh,RF.interaction.Link=Vb,RF.interaction.Modify=sM,RF.interaction.Modify.ModifyEvent=Qb,RF.interaction.MouseWheelZoom=Wh,RF.interaction.PinchRotate=Hh,RF.interaction.PinchZoom=Kh,RF.interaction.Pointer=yh,RF.interaction.Pointer.centroid=gh,RF.interaction.Select=uM,RF.interaction.Select.SelectEvent=oM,RF.interaction.Snap=fM,RF.interaction.Translate=gM,RF.interaction.Translate.TranslateEvent=vM,RF.interaction.defaults={},RF.interaction.defaults.defaults=Jh,RF.layer={},RF.layer.Base=_r,RF.layer.BaseImage=zp,RF.layer.BaseTile=Xp,RF.layer.BaseVector=xm,RF.layer.Graticule=sg,RF.layer.Group=go,RF.layer.Group.GroupEvent=po,RF.layer.Heatmap=ug,RF.layer.Image=$p,RF.layer.Layer=kr,RF.layer.Layer.inView=Ar,RF.layer.MapboxVector=xb,RF.layer.Tile=Zp,RF.layer.Vector=Jv,RF.layer.VectorImage=bb,RF.layer.VectorTile=wg,RF.layer.WebGLPoints=Mb,RF.layer.WebGLTile=_b,RF.loadingstrategy={},RF.loadingstrategy.all=ka,RF.loadingstrategy.bbox=function(t,e){return[t]},RF.loadingstrategy.tile=function(t){return function(e,i,n){const s=t.getZForResolution(pn(i,n)),r=t.getTileRangeForExtentAndZ(fn(e,n),s),o=[],h=[s,0,0];for(h[1]=r.minX;h[1]<=r.maxX;++h[1])for(h[2]=r.minY;h[2]<=r.maxY;++h[2])o.push(cn(t.getTileCoordExtent(h),n));return o}},RF.math={},RF.math.ceil=yi,RF.math.clamp=hi,RF.math.floor=gi,RF.math.lerp=pi,RF.math.modulo=di,RF.math.round=vi,RF.math.solveLinearSystem=li,RF.math.squaredDistance=ui,RF.math.squaredSegmentDistance=ai,RF.math.toDegrees=ci,RF.math.toFixed=mi,RF.math.toRadians=fi,RF.net={},RF.net.ClientError=Na,RF.net.ResponseError=La,RF.net.getJSON=Oa,RF.net.jsonp=Ra,RF.net.overrideXHR=function(t){"undefined"!=typeof XMLHttpRequest&&(Ca=XMLHttpRequest),global.XMLHttpRequest=t},RF.net.resolveUrl=za,RF.net.restoreXHR=function(){global.XMLHttpRequest=Ca},RF.obj={},RF.obj.clear=P,RF.obj.isEmpty=_,RF.proj={},RF.proj.Projection=Ge,RF.proj.Units={},RF.proj.Units.METERS_PER_UNIT=ze,RF.proj.Units.fromCode=Oe,RF.proj.addCommon=vn,RF.proj.addCoordinateTransforms=Ji,RF.proj.addEquivalentProjections=Vi,RF.proj.addEquivalentTransforms=Wi,RF.proj.addProjection=qi,RF.proj.addProjections=Xi,RF.proj.clearAllProjections=function(){ti(),si()},RF.proj.clearUserProjection=function(){on=null},RF.proj.cloneTransform=$i,RF.proj.createProjection=Hi,RF.proj.createSafeCoordinateTransform=mn,RF.proj.createTransformFromCoordinateTransform=Ki,RF.proj.disableCoordinateWarning=Ui,RF.proj.epsg3857={},RF.proj.epsg3857.EXTENT=Ue,RF.proj.epsg3857.HALF_SIZE=De,RF.proj.epsg3857.MAX_SAFE_Y=Be,RF.proj.epsg3857.PROJECTIONS=Xe,RF.proj.epsg3857.RADIUS=je,RF.proj.epsg3857.WORLD_EXTENT=$e,RF.proj.epsg3857.fromEPSG4326=Ye,RF.proj.epsg3857.toEPSG4326=Ze,RF.proj.epsg4326={},RF.proj.epsg4326.EXTENT=We,RF.proj.epsg4326.METERS_PER_UNIT=He,RF.proj.epsg4326.PROJECTIONS=Je,RF.proj.epsg4326.RADIUS=Ve,RF.proj.equivalent=tn,RF.proj.fromLonLat=Qi,RF.proj.fromUserCoordinate=ln,RF.proj.fromUserExtent=fn,RF.proj.fromUserResolution=pn,RF.proj.get=Yi,RF.proj.getPointResolution=Zi,RF.proj.getTransform=nn,RF.proj.getTransformFromProjections=en,RF.proj.getUserProjection=an,RF.proj.identityTransform=Bi,RF.proj.proj4={},RF.proj.proj4.register=function(t){const e=Object.keys(t.defs),i=e.length;let n,s;for(n=0;n<i;++n){const i=e[n];if(!Yi(i)){const e=t.defs(i);let n=e.units;n||"longlat"!==e.projName||(n="degrees"),qi(new Ge({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:n}))}}for(n=0;n<i;++n){const r=e[n],o=Yi(r);for(s=0;s<i;++s){const i=e[s],n=Yi(i);if(!oi(r,i))if(t.defs[r]===t.defs[i])Vi([o,n]);else{const e=t(r,i);Ji(o,n,mn(o,n,e.forward),mn(n,o,e.inverse))}}}},RF.proj.projections={},RF.proj.projections.add=ii,RF.proj.projections.clear=ti,RF.proj.projections.get=ei,RF.proj.setUserProjection=hn,RF.proj.toLonLat=function(t,e){const i=sn(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),n=i[0];return(n<-180||n>180)&&(i[0]=di(n+180,360)-180),i},RF.proj.toUserCoordinate=un,RF.proj.toUserExtent=cn,RF.proj.toUserResolution=dn,RF.proj.transform=sn,RF.proj.transformExtent=rn,RF.proj.transformWithProjections=function(t,e,i){return en(e,i)(t)},RF.proj.transforms={},RF.proj.transforms.add=ri,RF.proj.transforms.clear=si,RF.proj.transforms.get=oi,RF.proj.transforms.remove=function(t,e){const i=t.getCode(),n=e.getCode(),s=ni[i][n];return delete ni[i][n],_(ni[i])&&delete ni[i],s},RF.proj.useGeographic=function(){hn("EPSG:4326")},RF.render={},RF.render.Box=Nh,RF.render.Event=Nr,RF.render.Feature=Kv,RF.render.Feature.toFeature=function(t,e){const i=t.getId(),n=Hv(t),s=t.getProperties(),r=new pt;return void 0!==e&&r.setGeometryName(e),r.setGeometry(n),void 0!==i&&r.setId(i),r.setProperties(s,!0),r},RF.render.Feature.toGeometry=Hv,RF.render.VectorContext=Ga,RF.render.canvas={},RF.render.canvas.Builder=nv,RF.render.canvas.BuilderGroup=cv,RF.render.canvas.Executor=Sv,RF.render.canvas.ExecutorGroup=Tv,RF.render.canvas.ExecutorGroup.getPixelIndexArray=Ev,RF.render.canvas.ImageBuilder=sv,RF.render.canvas.Immediate=ja,RF.render.canvas.Instruction={},RF.render.canvas.Instruction.beginPathInstruction=tv,RF.render.canvas.Instruction.closePathInstruction=ev,RF.render.canvas.Instruction.fillInstruction=Jm,RF.render.canvas.Instruction.strokeInstruction=Qm,RF.render.canvas.LineStringBuilder=rv,RF.render.canvas.PolygonBuilder=ov,RF.render.canvas.TextBuilder=uv,RF.render.canvas.checkedFonts=eo,RF.render.canvas.defaultFillStyle=Yr,RF.render.canvas.defaultFont=Xr,RF.render.canvas.defaultLineCap=Zr,RF.render.canvas.defaultLineDash=Vr,RF.render.canvas.defaultLineDashOffset=0,RF.render.canvas.defaultLineJoin=Wr,RF.render.canvas.defaultLineWidth=1,RF.render.canvas.defaultMiterLimit=Hr,RF.render.canvas.defaultPadding=to,RF.render.canvas.defaultStrokeStyle=Kr,RF.render.canvas.defaultTextAlign=Jr,RF.render.canvas.defaultTextBaseline=Qr,RF.render.canvas.drawImageOrLabel=co,RF.render.canvas.getTextDimensions=lo,RF.render.canvas.hitdetect={},RF.render.canvas.hitdetect.HIT_DETECT_RESOLUTION=Cv,RF.render.canvas.hitdetect.createHitDetectionImageData=Fv,RF.render.canvas.hitdetect.hitDetect=Iv,RF.render.canvas.measureAndCacheTextWidth=uo,RF.render.canvas.measureTextHeight=oo,RF.render.canvas.measureTextWidth=ao,RF.render.canvas.registerFont=ro,RF.render.canvas.rotateAtOffset=function(t,e,i,n){0!==e&&(t.translate(i,n),t.rotate(e),t.translate(-i,-n))},RF.render.canvas.textHeights=so,RF.render.getRenderPixel=function(t,e){return At(t.inversePixelTransform,e.slice(0))},RF.render.getVectorContext=Ya,RF.render.toContext=function(t,e){const i=t.canvas,n=(e=e||{}).pixelRatio||bt,s=e.size;s&&(i.width=s[0]*n,i.height=s[1]*n,i.style.width=s[0]+"px",i.style.height=s[1]+"px");const r=[0,0,i.width,i.height],o=Rt([1,0,0,1,0,0],n,n);return new ja(t,n,r,o,0)},RF.render.webgl={},RF.render.webgl.BatchRenderer=Rm,RF.render.webgl.LineStringBatchRenderer=Nm,RF.render.webgl.MixedGeometryBatch=Om,RF.render.webgl.PointBatchRenderer=Gm,RF.render.webgl.PolygonBatchRenderer=Dm,RF.render.webgl.utils={},RF.render.webgl.utils.colorDecodeId=Fm,RF.render.webgl.utils.colorEncodeId=Cm,RF.render.webgl.utils.getBlankImageData=function(){const t=document.createElement("canvas").getContext("2d").createImageData(1,1);return t.data[0]=255,t.data[1]=255,t.data[2]=255,t.data[3]=255,t},RF.render.webgl.utils.writeLineSegmentToBuffers=function(t,e,i,n,s,r,o,h,a,u){const l=5+h.length,c=r.length/l,f=[t[e+0],t[e+1]],d=[t[i],t[i+1]],p=At(u,[...f]),m=At(u,[...d]);function v(t,e,i){const n=1e4;return Math.round(1500*e)+Math.round(1500*i)*n+t*n*n}function g(t,e,i){const n=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),s=[(e[0]-t[0])/n,(e[1]-t[1])/n],r=[-s[1],s[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),h=[(i[0]-t[0])/o,(i[1]-t[1])/o],a=0===n||0===o?0:Math.acos(hi(h[0]*s[0]+h[1]*s[1],-1,1));return h[0]*r[0]+h[1]*r[1]>0?a:2*Math.PI-a}const y=null!==s;let w=0,x=0;if(null!==n){w=g(p,m,At(u,[...[t[n],t[n+1]]]))}if(y){x=g(m,p,At(u,[...[t[s],t[s+1]]]))}r.push(f[0],f[1],d[0],d[1],v(0,w,x)),r.push(...h),r.push(f[0],f[1],d[0],d[1],v(1,w,x)),r.push(...h),r.push(f[0],f[1],d[0],d[1],v(2,w,x)),r.push(...h),r.push(f[0],f[1],d[0],d[1],v(3,w,x)),r.push(...h),o.push(c,c+1,c+2,c+1,c+3,c+2)},RF.render.webgl.utils.writePointFeatureToBuffers=function(t,e,i,n,s,r){const o=3+s,h=t[e+0],a=t[e+1],u=_m;u.length=s;for(let i=0;i<u.length;i++)u[i]=t[e+2+i];let l=r?r.vertexPosition:0,c=r?r.indexPosition:0;const f=l/o;return Tm(i,l,h,a,0),u.length&&i.set(u,l+3),l+=o,Tm(i,l,h,a,1),u.length&&i.set(u,l+3),l+=o,Tm(i,l,h,a,2),u.length&&i.set(u,l+3),l+=o,Tm(i,l,h,a,3),u.length&&i.set(u,l+3),l+=o,n[c++]=f,n[c++]=f+1,n[c++]=f+3,n[c++]=f+1,n[c++]=f+2,n[c++]=f+3,Em.vertexPosition=l,Em.indexPosition=c,Em},RF.render.webgl.utils.writePolygonTrianglesToBuffers=function(t,e,i,n,s){const r=2+s;let o=e;const h=t.slice(o,o+s);o+=s;const a=t[o++];let u=0;const l=new Array(a-1);for(let e=0;e<a;e++)u+=t[o++],e<a-1&&(l[e]=u);const c=t.slice(o,o+2*u),f=Pm(c,l,2);for(let t=0;t<f.length;t++)n.push(f[t]+i.length/r);for(let t=0;t<c.length;t+=2)i.push(c[t],c[t+1],...h);return o+2*u},RF.renderer={},RF.renderer.Composite=fo,RF.renderer.Layer=Tl,RF.renderer.Map=Lr,RF.renderer.canvas={},RF.renderer.canvas.ImageLayer=Up,RF.renderer.canvas.Layer=Dp,RF.renderer.canvas.Layer.canvasPool=Gp,RF.renderer.canvas.TileLayer=Yp,RF.renderer.canvas.VectorImageLayer=kv,RF.renderer.canvas.VectorLayer=Av,RF.renderer.canvas.VectorTileLayer=Nv,RF.renderer.vector={},RF.renderer.vector.defaultOrder=Ua,RF.renderer.vector.getSquaredTolerance=$a,RF.renderer.vector.getTolerance=Ba,RF.renderer.vector.renderFeature=qa,RF.renderer.webgl={},RF.renderer.webgl.Layer=Fl,RF.renderer.webgl.PointsLayer=Am,RF.renderer.webgl.TileLayer=Gl,RF.renderer.webgl.TileLayer.Attributes=Al,RF.renderer.webgl.TileLayer.Uniforms=Il,RF.renderer.webgl.VectorLayer=Hm,RF.renderer.webgl.shaders={},RF.renderer.webgl.shaders.FILL_FRAGMENT_SHADER=qm,RF.renderer.webgl.shaders.FILL_VERTEX_SHADER=Bm,RF.renderer.webgl.shaders.POINT_FRAGMENT_SHADER=Vm,RF.renderer.webgl.shaders.POINT_VERTEX_SHADER=Zm,RF.renderer.webgl.shaders.STROKE_FRAGMENT_SHADER=Ym,RF.renderer.webgl.shaders.STROKE_VERTEX_SHADER=Xm,RF.renderer.webgl.shaders.packColor=Um,RF.reproj={},RF.reproj.Image=cp,RF.reproj.Tile=Ml,RF.reproj.Triangulation=bl,RF.reproj.calculateSourceExtentResolution=Ja,RF.reproj.calculateSourceResolution=Ka,RF.reproj.canvasPool=Va,RF.reproj.common={},RF.reproj.common.ERROR_THRESHOLD=.5,RF.reproj.render=Qa,RF.resolutionconstraint={},RF.resolutionconstraint.createMinMaxResolution=Wo,RF.resolutionconstraint.createSnapToPower=Vo,RF.resolutionconstraint.createSnapToResolutions=Zo,RF.rotationconstraint={},RF.rotationconstraint.createSnapToN=Jo,RF.rotationconstraint.createSnapToZero=Qo,RF.rotationconstraint.disable=Ho,RF.rotationconstraint.none=Ko,RF.size={},RF.size.buffer=Qh,RF.size.hasArea=ta,RF.size.scale=ea,RF.size.toSize=ia,RF.source={},RF.source.BingMaps=ff,RF.source.BingMaps.quadKey=cf,RF.source.CartoDB=pf,RF.source.Cluster=Pf,RF.source.DataTile=_f,RF.source.GeoTIFF=Kd,RF.source.IIIF=lp,RF.source.Image=gp,RF.source.Image.ImageSourceEvent=mp,RF.source.Image.defaultImageLoadFunction=vp,RF.source.ImageArcGISRest=yp,RF.source.ImageCanvas=wp,RF.source.ImageMapGuide=xp,RF.source.ImageStatic=bp,RF.source.ImageWMS=Pp,RF.source.OGCMapTile=Ap,RF.source.OGCVectorTile=Lp,RF.source.OSM=Op,RF.source.OSM.ATTRIBUTION=Np,RF.source.Raster=hm,RF.source.Raster.Processor=Qp,RF.source.Raster.RasterSourceEvent=im,RF.source.Raster.newImageData=Hp,RF.source.Source=sf,RF.source.Stamen=cm,RF.source.Tile=of,RF.source.Tile.TileSourceEvent=rf,RF.source.TileArcGISRest=fm,RF.source.TileDebug=dm,RF.source.TileImage=lf,RF.source.TileJSON=pm,RF.source.TileWMS=mm,RF.source.UTFGrid=gm,RF.source.UTFGrid.CustomTile=vm,RF.source.UrlTile=af,RF.source.Vector=Sf,RF.source.Vector.VectorSourceEvent=Mf,RF.source.VectorTile=kp,RF.source.VectorTile.defaultLoadFunction=Rp,RF.source.WMTS=ym,RF.source.WMTS.optionsFromCapabilities=function(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 s;s=i.TileMatrixSetLink.length>1?"projection"in e?i.TileMatrixSetLink.findIndex((function(t){const i=n.find((function(e){return e.Identifier==t.TileMatrixSet})).SupportedCRS,s=Yi(i),r=Yi(e.projection);return s&&r?tn(s,r):i==e.projection})):i.TileMatrixSetLink.findIndex((function(t){return t.TileMatrixSet==e.matrixSet})):0,s<0&&(s=0);const r=i.TileMatrixSetLink[s].TileMatrixSet,o=i.TileMatrixSetLink[s].TileMatrixSetLimits;let h=i.Format[0];"format"in e&&(h=e.format),s=i.Style.findIndex((function(t){return"style"in e?t.Title==e.style:t.isDefault})),s<0&&(s=0);const a=i.Style[s].Identifier,u={};"Dimension"in i&&i.Dimension.forEach((function(t,e,i){const n=t.Identifier;let s=t.Default;void 0===s&&(s=t.Value[0]),u[n]=s}));const l=t.Contents.TileMatrixSet.find((function(t){return t.Identifier==r}));let c;const f=l.SupportedCRS;if(f&&(c=Yi(f)),"projection"in e){const t=Yi(e.projection);t&&(c&&!tn(t,c)||(c=t))}let d=!1;const p="ne"==c.getAxisOrientation().substr(0,2);let m=l.TileMatrix[0],v={MinTileCol:0,MinTileRow:0,MaxTileCol:m.MatrixWidth-1,MaxTileRow:m.MatrixHeight-1};if(o){v=o[o.length-1];const t=l.TileMatrix.find((t=>t.Identifier===v.TileMatrix||l.Identifier+":"+t.Identifier===v.TileMatrix));t&&(m=t)}const g=28e-5*m.ScaleDenominator/c.getMetersPerUnit(),y=p?[m.TopLeftCorner[1],m.TopLeftCorner[0]]:m.TopLeftCorner,w=m.TileWidth*g,x=m.TileHeight*g;let b=l.BoundingBox;b&&p&&(b=[b[1],b[0],b[3],b[2]]);let M=[y[0]+w*v.MinTileCol,y[1]-x*(1+v.MaxTileRow),y[0]+w*(1+v.MaxTileCol),y[1]-x*v.MinTileRow];if(void 0!==b&&!Jt(b,M)){const t=i.WGS84BoundingBox,e=Yi("EPSG:4326").getExtent();if(M=b,t)d=t[0]===e[0]&&t[2]===e[2];else{const t=rn(b,l.SupportedCRS,"EPSG:4326");d=t[0]-1e-10<=e[0]&&t[2]+1e-10>=e[2]}}const S=wc(l,M,o),P=[];let _=e.requestEncoding;if(_=void 0!==_?_:"","OperationsMetadata"in t&&"GetTile"in t.OperationsMetadata){const e=t.OperationsMetadata.GetTile.DCP.HTTP.Get;for(let t=0,i=e.length;t<i;++t)if(e[t].Constraint){const i=e[t].Constraint.find((function(t){return"GetEncoding"==t.name})).AllowedValues.Value;if(""===_&&(_=i[0]),"KVP"!==_)break;i.includes("KVP")&&P.push(e[t].href)}else e[t].href&&(_="KVP",P.push(e[t].href))}return 0===P.length&&(_="REST",i.ResourceURL.forEach((function(t){"tile"===t.resourceType&&(h=t.format,P.push(t.template))}))),{urls:P,layer:e.layer,matrixSet:r,format:h,projection:c,requestEncoding:_,tileGrid:S,style:a,dimensions:u,wrapX:d,crossOrigin:e.crossOrigin}},RF.source.XYZ=df,RF.source.Zoomify=Qd,RF.source.Zoomify.CustomTile=Jd,RF.source.common={},RF.source.common.DEFAULT_WMS_VERSION="1.3.0",RF.source.ogcTileUtil={},RF.source.ogcTileUtil.getMapTileUrlTemplate=Tp,RF.source.ogcTileUtil.getTileSetInfo=Ip,RF.source.ogcTileUtil.getVectorTileUrlTemplate=Cp,RF.source.sourcesFromTileGrid=function(t,e){const i=new fa(32),n=t.getExtent();return function(s,r){i.expireCache(),n&&(s=Se(n,s));const o=t.getZForResolution(r),h=[];return t.forEachTileCoord(s,o,(t=>{const n=t.toString();if(!i.containsKey(n)){const s=e(t);i.set(n,s)}h.push(i.get(n))})),h}},RF.source.wms={},RF.source.wms.DEFAULT_VERSION=Mp,RF.sphere={},RF.sphere.DEFAULT_RADIUS=Ni,RF.sphere.getArea=function t(e,i){const n=(i=i||{}).radius||Ni,s=i.projection||"EPSG:3857",r=e.getType();"GeometryCollection"!==r&&(e=e.clone().transform(s,"EPSG:4326"));let o,h,a,u,l,c,f=0;switch(r){case"Point":case"MultiPoint":case"LineString":case"MultiLineString":case"LinearRing":break;case"Polygon":for(o=e.getCoordinates(),f=Math.abs(Gi(o[0],n)),a=1,u=o.length;a<u;++a)f-=Math.abs(Gi(o[a],n));break;case"MultiPolygon":for(o=e.getCoordinates(),a=0,u=o.length;a<u;++a)for(h=o[a],f+=Math.abs(Gi(h[0],n)),l=1,c=h.length;l<c;++l)f-=Math.abs(Gi(h[l],n));break;case"GeometryCollection":{const n=e.getGeometries();for(a=0,u=n.length;a<u;++a)f+=t(n[a],i);break}default:throw new Error("Unsupported geometry type: "+r)}return f},RF.sphere.getDistance=Oi,RF.sphere.getLength=function t(e,i){const n=(i=i||{}).radius||Ni,s=i.projection||"EPSG:3857",r=e.getType();"GeometryCollection"!==r&&(e=e.clone().transform(s,"EPSG:4326"));let o,h,a,u,l,c,f=0;switch(r){case"Point":case"MultiPoint":break;case"LineString":case"LinearRing":o=e.getCoordinates(),f=zi(o,n);break;case"MultiLineString":case"Polygon":for(o=e.getCoordinates(),a=0,u=o.length;a<u;++a)f+=zi(o[a],n);break;case"MultiPolygon":for(o=e.getCoordinates(),a=0,u=o.length;a<u;++a)for(h=o[a],l=0,c=h.length;l<c;++l)f+=zi(h[l],n);break;case"GeometryCollection":{const n=e.getGeometries();for(a=0,u=n.length;a<u;++a)f+=t(n[a],i);break}default:throw new Error("Unsupported geometry type: "+r)}return f},RF.sphere.offset=ji,RF.string={},RF.string.compareVersions=xi,RF.string.padNumber=wi,RF.structs={},RF.structs.LRUCache=fa,RF.structs.LinkedList=Hc,RF.structs.PriorityQueue=Oo,RF.structs.PriorityQueue.DROP=No,RF.structs.RBush=Jc,RF.style={},RF.style.Circle=_c,RF.style.Fill=Tc,RF.style.Icon=Rc,RF.style.IconImage=Ac,RF.style.IconImage.get=Ic,RF.style.IconImageCache=dr,RF.style.IconImageCache.shared=pr,RF.style.Image=bc,RF.style.RegularShape=Sc,RF.style.Stroke=Nc,RF.style.Style=$c,RF.style.Style.createDefaultStyle=jc,RF.style.Style.createEditingStyle=Dc,RF.style.Style.toFunction=zc,RF.style.Text=qc,RF.style.expressions={},RF.style.expressions.Operators=Yl,RF.style.expressions.PALETTE_TEXTURE_ARRAY=cc,RF.style.expressions.arrayToGlsl=Hl,RF.style.expressions.colorToGlsl=Kl,RF.style.expressions.expressionToGlsl=tc,RF.style.expressions.getStringNumberEquivalent=Jl,RF.style.expressions.getValueType=Zl,RF.style.expressions.isTypeUnique=Vl,RF.style.expressions.numberToGlsl=Wl,RF.style.expressions.stringToGlsl=Ql,RF.style.expressions.uniformNameForVariable=lc,RF.style.flat={},RF.style.flat.toStyle=Xc,RF.tilecoord={},RF.tilecoord.createOrUpdate=da,RF.tilecoord.fromKey=ga,RF.tilecoord.getCacheKeyForTileKey=va,RF.tilecoord.getKey=ma,RF.tilecoord.getKeyZXY=pa,RF.tilecoord.hash=ya,RF.tilecoord.withinExtentAndZ=wa,RF.tilegrid={},RF.tilegrid.TileGrid=eu,RF.tilegrid.WMTS=yc,RF.tilegrid.WMTS.createFromCapabilitiesMatrixSet=wc,RF.tilegrid.common={};RF.tilegrid.common.DEFAULT_MAX_ZOOM=42,RF.tilegrid.common.DEFAULT_TILE_SIZE=$o,RF.tilegrid.createForExtent=su,RF.tilegrid.createForProjection=hu,RF.tilegrid.createXYZ=ru,RF.tilegrid.extentFromProjection=au,RF.tilegrid.getForProjection=iu,RF.tilegrid.wrapX=nu,RF.tileurlfunction={},RF.tileurlfunction.createFromTemplate=uu,RF.tileurlfunction.createFromTemplates=lu,RF.tileurlfunction.createFromTileUrlFunctions=cu,RF.tileurlfunction.expandUrl=du,RF.tileurlfunction.nullTileUrlFunction=fu,RF.transform={},RF.transform.apply=At,RF.transform.compose=Ot,RF.transform.composeCssTransform=function(t,e,i,n,s,r,o){return Dt(Ot([1,0,0,1,0,0],t,e,i,n,s,r,o))},RF.transform.create=Et,RF.transform.determinant=Gt,RF.transform.invert=function(t){return zt(t,t)},RF.transform.makeInverse=zt,RF.transform.makeScale=Lt,RF.transform.multiply=Ct,RF.transform.reset=Tt,RF.transform.rotate=kt,RF.transform.scale=Rt,RF.transform.set=Ft,RF.transform.setFromArray=It,RF.transform.toString=Dt,RF.transform.translate=Nt,RF.uri={},RF.uri.appendParams=pu,RF.util={},RF.util.VERSION=r,RF.util.abstract=t,RF.util.getUid=i,RF.vec={},RF.vec.mat4={},RF.vec.mat4.create=el,RF.vec.mat4.fromTransform=il,RF.webgl={},RF.webgl.ARRAY_BUFFER=mu,RF.webgl.Buffer=Ku,RF.webgl.Buffer.getArrayClassForType=Hu,RF.webgl.DYNAMIC_DRAW=yu,RF.webgl.ELEMENT_ARRAY_BUFFER=vu,RF.webgl.FLOAT=wu,RF.webgl.Helper=gl,RF.webgl.Helper.computeAttributesStride=ml,RF.webgl.PaletteTexture=yl,RF.webgl.PostProcessingPass=tl,RF.webgl.RenderTarget=xl,RF.webgl.STATIC_DRAW=gu,RF.webgl.STREAM_DRAW=35040,RF.webgl.ShaderBuilder={},RF.webgl.ShaderBuilder.ShaderBuilder=mc,RF.webgl.ShaderBuilder.parseLiteralStyle=vc,RF.webgl.TileTexture=El,RF.webgl.UNSIGNED_BYTE=5121,RF.webgl.UNSIGNED_INT=5125,RF.webgl.UNSIGNED_SHORT=5123,RF.webgl.getContext=bu,RF.webgl.getSupportedExtensions=function(){if(!Mu){const t=bu(document.createElement("canvas"));t&&(Mu=t.getSupportedExtensions())}return Mu},RF.xml={},RF.xml.OBJECT_PROPERTY_NODE_FACTORY=Gu,RF.xml.XML_SCHEMA_INSTANCE_URI=Su,RF.xml.createElementNS=Pu,RF.xml.getAllTextContent=_u,RF.xml.dw=Eu,RF.xml.getAttributeNS=Cu,RF.xml.getDocument=Vu,RF.xml.getXMLSerializer=Zu,RF.xml.isDocument=Tu,RF.xml.makeArrayExtender=Iu,RF.xml.makeArrayPusher=Au,RF.xml.makeArraySerializer=Ou,RF.xml.makeChildAppender=Nu,RF.xml.makeObjectPropertyPusher=Ru,RF.xml.makeObjectPropertySetter=Lu,RF.xml.makeReplacer=ku,RF.xml.makeSequence=ju,RF.xml.makeSimpleNodeFactory=zu,RF.xml.makeStructureNS=Du,RF.xml.parse=Fu,RF.xml.parseNode=Uu,RF.xml.pushParseAndPop=$u,RF.xml.pushSerializeAndPop=qu,RF.xml.registerDocument=function(t){Yu=t},RF.xml.registerXMLSerializer=function(t){Xu=t},RF.xml.serialize=Bu;var LF=RF}(),s=s.default}()}));
//# sourceMappingURL=ol.js.map