map_view_vue2 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/index.d.ts +138 -0
- package/map_view_vue2.common.js +370 -300
- package/map_view_vue2.common.js.map +1 -1
- package/map_view_vue2.css +1 -1
- package/map_view_vue2.umd.js +370 -300
- package/map_view_vue2.umd.js.map +1 -1
- package/map_view_vue2.umd.min.js +1 -1
- package/map_view_vue2.umd.min.js.map +1 -1
- package/package.json +2 -1
package/map_view_vue2.umd.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["map_view_vue2"]=e():t["map_view_vue2"]=e()})("undefined"!==typeof self?self:this,function(){return function(){var t={463:function(t){"use strict";var e=TypeError;t.exports=function(t){if("string"==typeof t)return t;throw new e("Argument is not a string")}},804:function(t){"use strict";var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e+"+/",s=e+"-_",n=function(t){for(var e={},i=0;i<64;i++)e[t.charAt(i)]=i;return e};t.exports={i2c:i,c2i:n(i),i2cUrl:s,c2iUrl:n(s)}},529:function(t){"use strict";t.exports=function(t,e){return{value:t,done:e}}},837:function(t){"use strict";var e=TypeError,i=9007199254740991;t.exports=function(t){if(t>i)throw new e("Maximum allowed index exceeded");return t}},944:function(t){"use strict";var e=TypeError;t.exports=function(t){var i=t&&t.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new e("Incorrect `alphabet` option")}},767:function(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},117:function(t){"use strict";t.exports=function(t){return null===t||void 0===t}},859:function(t){"use strict";t.exports=function(t){t.iterator=t.next=t.nextHandler=t.mapper=t.predicate=t.inner=t.iterables=t.iters=t.openIters=t.padding=t.finishResults=t.buffer=null}},684:function(t){"use strict";t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(s){return!0}}},269:function(t){"use strict";t.exports=Object.create?Object.create(null):{}},741:function(t){"use strict";var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var s=+t;return(s>0?i:e)(s)}},717:function(t,e){"use strict";e.f=Object.getOwnPropertySymbols},750:function(t,e,i){"use strict";var s=i(117),n=TypeError;t.exports=function(t){if(s(t))throw new n("Can't call method on "+t);return t}},835:function(t){"use strict";t.exports=function(t){try{var e=new Set,i={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},s=e[t](i);return 1===s.size&&4===s.values().next().value}catch(n){return!1}}},291:function(t,e,i){"use strict";var s=i(741);t.exports=function(t){var e=+t;return e!==e||0===e?0:s(e)}},14:function(t,e,i){"use strict";var s=i(291),n=Math.min;t.exports=function(t){var e=s(t);return e>0?n(e,9007199254740991):0}},981:function(t,e,i){"use strict";var s=i(750),n=Object;t.exports=function(t){return n(s(t))}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}i.cw=function(t){var e;return function(){if(t){var i=t;t=0,e={exports:{}},i.call(e.exports,e,e.exports)}return e.exports}},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";i.r(s),i.d(s,{default:function(){return Hb}});var t=i.cw(function(t){var e=ft(),i=xe(),s=TypeError;t.exports=function(t){if(e(t))return t;throw new s(i(t)+" is not a function")}}),e=i.cw(function(t){var e=mt(),i=String,s=TypeError;t.exports=function(t){if(e(t))return t;throw new s("Can't set "+i(t)+" as a prototype")}}),n=i.cw(function(t){var e=$t().has;t.exports=function(t){return e(t),t}}),r=function(){return i(463)},o=i.cw(function(t){var e=Pe(),i=Ot(),s=Nt().f,n=e("unscopables"),r=Array.prototype;void 0===r[n]&&s(r,n,{configurable:!0,value:i(null)}),t.exports=function(t){r[n][t]=!0}}),a=i.cw(function(t){var e=zt(),i=TypeError;t.exports=function(t,s){if(e(s,t))return t;throw new i("Incorrect invocation")}}),h=i.cw(function(t){var e=_t(),i=String,s=TypeError;t.exports=function(t){if(void 0===t||e(t))return t;throw new s(i(t)+" is not an object or undefined")}}),l=i.cw(function(t){var e=_t(),i=String,s=TypeError;t.exports=function(t){if(e(t))return t;throw new s(i(t)+" is not an object")}}),c=i.cw(function(t){var e=w(),i=TypeError;t.exports=function(t){if("Uint8Array"===e(t))return t;throw new i("Argument is not an Uint8Array")}}),u=i.cw(function(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView}),d=i.cw(function(t){var e=it(),i=V(),s=x(),n=e.ArrayBuffer,r=e.TypeError;t.exports=n&&i(n.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new r("ArrayBuffer expected");return t.byteLength}}),f=i.cw(function(t){var e=it(),i=u(),s=d(),n=e.DataView;t.exports=function(t){if(!i||0!==s(t))return!1;try{return new n(t),!1}catch(e){return!0}}}),g=i.cw(function(t){var e=f(),i=TypeError;t.exports=function(t){if(e(t))throw new i("ArrayBuffer is detached");return t}}),p=i.cw(function(t){var e,i,s,n=u(),r=G(),o=it(),a=ft(),h=_t(),l=st(),c=w(),d=xe(),f=C(),g=I(),p=R(),_=zt(),m=jt(),y=Xt(),v=Pe(),x=we(),E=lt(),M=E.enforce,S=E.get,b=o.Int8Array,P=b&&b.prototype,T=o.Uint8ClampedArray,A=T&&T.prototype,O=b&&m(b),L=P&&m(P),N=Object.prototype,k=o.TypeError,F=v("toStringTag"),D=x("TYPED_ARRAY_TAG"),j="TypedArrayConstructor",z=n&&!!y&&"Opera"!==c(o.opera),U=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},W={BigInt64Array:8,BigUint64Array:8},X=function(t){if(!h(t))return!1;var e=c(t);return"DataView"===e||l(B,e)||l(W,e)},V=function(t){var e=m(t);if(h(e)){var i=S(e);return i&&l(i,j)?i[j]:V(e)}},q=function(t){if(!h(t))return!1;var e=c(t);return l(B,e)||l(W,e)},Y=function(t){if(q(t))return t;throw new k("Target is not a typed array")},K=function(t){if(a(t)&&(!y||_(O,t)))return t;throw new k(d(t)+" is not a typed array constructor")},H=function(t,e,i,s){if(r){if(i)for(var n in B){var a=o[n];if(a&&l(a.prototype,t))try{delete a.prototype[t]}catch(h){try{a.prototype[t]=e}catch(c){}}}L[t]&&!i||g(L,t,i?e:z&&P[t]||e,s)}},$=function(t,e,i){var s,n;if(r){if(y){if(i)for(s in B)if(n=o[s],n&&l(n,t))try{delete n[t]}catch(a){}if(O[t]&&!i)return;try{return g(O,t,i?e:z&&O[t]||e)}catch(a){}}for(s in B)n=o[s],!n||n[t]&&!i||g(n,t,e)}};for(e in B)i=o[e],s=i&&i.prototype,s?M(s)[j]=i:z=!1;for(e in W)i=o[e],s=i&&i.prototype,s&&(M(s)[j]=i);if((!z||!a(O)||O===Function.prototype)&&(O=function(){throw new k("Incorrect invocation")},z))for(e in B)o[e]&&y(o[e],O);if((!z||!L||L===N)&&(L=O.prototype,z))for(e in B)o[e]&&y(o[e].prototype,L);if(z&&m(A)!==L&&y(A,L),r&&!l(L,F))for(e in U=!0,p(L,F,{configurable:!0,get:function(){return h(this)?this[D]:void 0}}),B)o[e]&&f(o[e].prototype,D,e);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:z,TYPED_ARRAY_TAG:U&&D,aTypedArray:Y,aTypedArrayConstructor:K,exportTypedArrayMethod:H,exportTypedArrayStaticMethod:$,getTypedArrayConstructor:V,isView:X,isTypedArray:q,TypedArray:O,TypedArrayPrototype:L}}),_=i.cw(function(t){var e=fe(),i=ue(),s=Tt(),n=function(t){return function(n,r,o){var a=e(n),h=s(a);if(0===h)return!t&&-1;var l,c=i(o,h);if(t&&r!==r){while(h>c)if(l=a[c++],l!==l)return!0}else for(;h>c;c++)if((t||c in a)&&a[c]===r)return t||c||0;return!t&&-1}};t.exports={m:n(!0),q:n(!1)}}),m=i.cw(function(t){var e=G(),i=ut(),s=TypeError,n=Object.getOwnPropertyDescriptor,r=e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=r?function(t,e){if(i(t)&&!n(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}}),y=function(){return i(804)},v=i.cw(function(t){var e=l(),i=St();t.exports=function(t,s,n,r){try{return r?s(e(n)[0],n[1]):s(n)}catch(o){i(t,"throw",o)}}}),x=i.cw(function(t){var e=Y(),i=e({}.toString),s=e("".slice);t.exports=function(t){return s(i(t),8,-1)}}),w=i.cw(function(t){var e=ve(),i=ft(),s=x(),n=Pe(),r=n("toStringTag"),o=Object,a="Arguments"===s(function(){return arguments}()),h=function(t,e){try{return t[e]}catch(i){}};t.exports=e?s:function(t){var e,n,l;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=h(e=o(t),r))?n:a?s(e):"Object"===(l=s(e))&&i(e.callee)?"Arguments":l}}),E=i.cw(function(t){var e=st(),i=qt(),s=kt(),n=Nt();t.exports=function(t,r,o){for(var a=i(r),h=n.f,l=s.f,c=0;c<a.length;c++){var u=a[c];e(t,u)||o&&e(o,u)||h(t,u,l(r,u))}}}),M=i.cw(function(t){var e=j();t.exports=!e(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}),S=function(){return i(529)},C=i.cw(function(t){var e=G(),i=Nt(),s=b();t.exports=e?function(t,e,n){return i.f(t,e,s(1,n))}:function(t,e,i){return t[e]=i,t}}),b=i.cw(function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}}),P=i.cw(function(t){var e=G(),i=Nt(),s=b();t.exports=function(t,n,r){e?i.f(t,n,s(0,r)):t[n]=r}}),R=i.cw(function(t){var e=At(),i=Nt();t.exports=function(t,s,n){return n.get&&e(n.get,s,{getter:!0}),n.set&&e(n.set,s,{setter:!0}),i.f(t,s,n)}}),I=i.cw(function(t){var e=ft(),i=Nt(),s=At(),n=A();t.exports=function(t,r,o,a){a||(a={});var h=a.enumerable,l=void 0!==a.name?a.name:r;if(e(o)&&s(o,l,a),a.global)h?t[r]=o:n(r,o);else{try{a.unsafe?t[r]&&(h=!0):delete t[r]}catch(c){}h?t[r]=o:i.f(t,r,{value:o,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}}),T=i.cw(function(t){var e=I();t.exports=function(t,i,s){for(var n in i)e(t,n,i[n],s);return t}}),A=i.cw(function(t){var e=it(),i=Object.defineProperty;t.exports=function(t,s){try{i(e,t,{value:s,configurable:!0,writable:!0})}catch(n){e[t]=s}return s}}),G=i.cw(function(t){var e=j();t.exports=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}),O=i.cw(function(t){var e=it(),i=_t(),s=e.document,n=i(s)&&i(s.createElement);t.exports=function(t){return n?s.createElement(t):{}}}),L=function(){return i(837)},N=i.cw(function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),k=i.cw(function(t){var e=it(),i=e.navigator,s=i&&i.userAgent;t.exports=s?String(s):""}),F=i.cw(function(t){var e,i,s=it(),n=k(),r=s.process,o=s.Deno,a=r&&r.versions||o&&o.version,h=a&&a.v8;h&&(e=h.split("."),i=e[0]>0&&e[0]<4?1:+(e[0]+e[1])),!i&&n&&(e=n.match(/Edge\/(\d+)/),(!e||e[1]>=74)&&(e=n.match(/Chrome\/(\d+)/),e&&(i=+e[1]))),t.exports=i}),D=i.cw(function(t){var e=it(),i=kt().f,s=C(),n=I(),r=A(),o=E(),a=gt();t.exports=function(t,h){var l,c,u,d,f,g,p=t.target,_=t.global,m=t.stat;if(c=_?e:m?e[p]||r(p,{}):e[p]&&e[p].prototype,c)for(u in h){if(f=h[u],t.dontCallGetSet?(g=i(c,u),d=g&&g.value):d=c[u],l=a(_?u:p+(m?".":"#")+u,t.forced),!l&&void 0!==d){if(typeof f==typeof d)continue;o(f,d)}(t.sham||d&&d.sham)&&s(f,"sham",!0),n(c,u,f,t)}}}),j=i.cw(function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}}),z=i.cw(function(t){var e=B(),i=Function.prototype,s=i.apply,n=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(e?n.bind(s):function(){return n.apply(s,arguments)})}),U=i.cw(function(e){var i=q(),s=t(),n=B(),r=i(i.bind);e.exports=function(t,e){return s(t),void 0===e?t:n?r(t,e):function(){return t.apply(e,arguments)}}}),B=i.cw(function(t){var e=j();t.exports=!e(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}),W=i.cw(function(t){var e=B(),i=Function.prototype.call;t.exports=e?i.bind(i):function(){return i.apply(i,arguments)}}),X=i.cw(function(t){var e=G(),i=st(),s=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,r=i(s,"name"),o=r&&"something"===function(){}.name,a=r&&(!e||e&&n(s,"name").configurable);t.exports={EXISTS:r,PROPER:o,i2:a}}),V=i.cw(function(e){var i=Y(),s=t();e.exports=function(t,e,n){try{return i(s(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(r){}}}),q=i.cw(function(t){var e=x(),i=Y();t.exports=function(t){if("Function"===e(t))return i(t)}}),Y=i.cw(function(t){var e=B(),i=Function.prototype,s=i.call,n=e&&i.bind.bind(s,s);t.exports=e?n:function(t){return function(){return s.apply(t,arguments)}}}),K=function(){return i(944)},H=i.cw(function(t){var e=it(),i=ft(),s=function(t){return i(t)?t:void 0};t.exports=function(t,i){return arguments.length<2?s(e[t]):e[t]&&e[t][i]}}),$=function(){return i(767)},Z=i.cw(function(t){var e=W(),i=l(),s=$(),n=Q();t.exports=function(t,r){r&&"string"===typeof t||i(t);var o=n(t);return s(i(void 0!==o?e(o,t):t))}}),J=i.cw(function(t){var e=W(),i=ft(),s=l(),n=xe(),r=Q(),o=TypeError;t.exports=function(t,a){var h=arguments.length<2?r(t):a;if(i(h))return s(e(h,t));throw new o(n(t)+" is not iterable")}}),Q=i.cw(function(t){var e=x(),i=pt(),s=tt(),n=Pe(),r=n("iterator"),o=Array.prototype;t.exports=function(t){if(!i(t))return s(t,r)||s(t,"@@iterator")||("Arguments"===e(t)?o[r]:void 0)}}),tt=i.cw(function(e){var i=t(),s=pt();e.exports=function(t,e){var n=t[e];return s(n)?void 0:i(n)}}),et=i.cw(function(e){var i=t(),s=l(),n=W(),r=ge(),o=$(),a="Invalid size",h=RangeError,c=TypeError,u=Math.max,d=function(t,e){this.set=t,this.size=u(e,0),this.has=i(t.has),this.keys=i(t.keys)};d.prototype={getIterator:function(){return o(s(n(this.keys,this.set)))},includes:function(t){return n(this.has,this.set,t)}},e.exports=function(t){s(t);var e=+t.size;if(e!==e)throw new c(a);var i=r(e);if(i<0)throw new h(a);return new d(t,i)}}),it=i.cw(function(t){var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof i.g&&i.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()}),st=i.cw(function(t){var e=Y(),i=_e(),s=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(i(t),e)}}),nt=i.cw(function(t){t.exports={}}),rt=i.cw(function(t){var e=H();t.exports=e("document","documentElement")}),ot=i.cw(function(t){var e=G(),i=j(),s=O();t.exports=!e&&!i(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})}),at=i.cw(function(t){var e=Y(),i=j(),s=x(),n=Object,r=e("".split);t.exports=i(function(){return!n("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?r(t,""):n(t)}:n}),ht=i.cw(function(t){var e=Y(),i=ft(),s=he(),n=e(Function.toString);i(s.inspectSource)||(s.inspectSource=function(t){return n(t)}),t.exports=s.inspectSource}),lt=i.cw(function(t){var e,i,s,n=be(),r=it(),o=_t(),a=C(),h=st(),l=he(),c=ae(),u=nt(),d="Object already initialized",f=r.TypeError,g=r.WeakMap,p=function(t){return s(t)?i(t):e(t,{})},_=function(t){return function(e){var s;if(!o(e)||(s=i(e)).type!==t)throw new f("Incompatible receiver, "+t+" required");return s}};if(n||l.state){var m=l.state||(l.state=new g);m.get=m.get,m.has=m.has,m.set=m.set,e=function(t,e){if(m.has(t))throw new f(d);return e.facade=t,m.set(t,e),e},i=function(t){return m.get(t)||{}},s=function(t){return m.has(t)}}else{var y=c("state");u[y]=!0,e=function(t,e){if(h(t,y))throw new f(d);return e.facade=t,a(t,y,e),e},i=function(t){return h(t,y)?t[y]:{}},s=function(t){return h(t,y)}}t.exports={set:e,get:i,has:s,enforce:p,getterFor:_}}),ct=i.cw(function(t){var e=Pe(),i=It(),s=e("iterator"),n=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||n[s]===t)}}),ut=i.cw(function(t){var e=x();t.exports=Array.isArray||function(t){return"Array"===e(t)}}),dt=i.cw(function(t){var e=w();t.exports=function(t){var i=e(t);return"BigInt64Array"===i||"BigUint64Array"===i}}),ft=i.cw(function(t){var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}}),gt=i.cw(function(t){var e=j(),i=ft(),s=/#|\.prototype\./,n=function(t,s){var n=o[r(t)];return n===h||n!==a&&(i(s)?e(s):!!s)},r=n.normalize=function(t){return String(t).replace(s,".").toLowerCase()},o=n.data={},a=n.NATIVE="N",h=n.POLYFILL="P";t.exports=n}),pt=function(){return i(117)},_t=i.cw(function(t){var e=ft();t.exports=function(t){return"object"==typeof t?null!==t:e(t)}}),mt=i.cw(function(t){var e=_t();t.exports=function(t){return e(t)||null===t}}),yt=i.cw(function(t){t.exports=!1}),vt=i.cw(function(t){var e=H(),i=ft(),s=zt(),n=Se(),r=Object;t.exports=n?function(t){return"symbol"==typeof t}:function(t){var n=e("Symbol");return i(n)&&s(n.prototype,r(t))}}),xt=i.cw(function(t){var e=W();t.exports=function(t,i,s){var n,r,o=s?t:t.iterator,a=t.next;while(!(n=e(a,o)).done)if(r=i(n.value),void 0!==r)return r}}),wt=i.cw(function(t){var e=U(),i=W(),s=l(),n=xe(),r=ct(),o=Tt(),a=zt(),h=J(),c=Q(),u=St(),d=TypeError,f=function(t,e){this.stopped=t,this.result=e},g=f.prototype;t.exports=function(t,l,p){var _,m,y,v,x,w,E,M=p&&p.that,S=!(!p||!p.AS_ENTRIES),C=!(!p||!p.IS_RECORD),b=!(!p||!p.IS_ITERATOR),P=!(!p||!p.INTERRUPTED),R=e(l,M),I=function(t){var e=_;return _=void 0,e&&u(e,"normal"),new f(!0,t)},T=function(t){return S?(s(t),P?R(t[0],t[1],I):R(t[0],t[1])):P?R(t,I):R(t)};if(C)_=t.iterator;else if(b)_=t;else{if(m=c(t),!m)throw new d(n(t)+" is not iterable");if(r(m)){for(y=0,v=o(t);v>y;y++)if(x=T(t[y]),x&&a(g,x))return x;return new f(!1)}_=h(t,m)}w=C?t.next:_.next;while(!(E=i(w,_)).done){var A=E.value;try{x=T(A)}catch(G){if(!_)throw G;u(_,"throw",G)}if("object"==typeof x&&x&&a(g,x))return x}return new f(!1)}}),Et=function(){return i(859)},Mt=i.cw(function(t){var e=St();t.exports=function(t,i,s){for(var n=t.length-1;n>=0;n--)if(void 0!==t[n])try{s=e(t[n].iterator,i,s)}catch(r){i="throw",s=r}if("throw"===i)throw s;return s}}),St=i.cw(function(t){var e=W(),i=l(),s=tt();t.exports=function(t,n,r){var o,a;i(t);try{if(o=s(t,"return"),!o){if("throw"===n)throw r;return r}o=e(o,t)}catch(h){a=!0,o=h}if("throw"===n)throw r;if(a)throw o;return i(o),r}}),Ct=i.cw(function(t){var e=W(),i=Ot(),s=C(),n=T(),r=Pe(),o=lt(),a=tt(),h=Rt().H,l=S(),c=St(),u=Mt(),d=Et(),f=r("toStringTag"),g="IteratorHelper",p="WrapForValidIterator",_="normal",m="throw",y=o.set,v=function(t){var s=o.getterFor(t?p:g);return n(i(h),{next:function(){var e=s(this);if(t)return e.nextHandler();if(e.done)return l(void 0,!0);try{var i=e.nextHandler();return e.done&&d(e),e.returnHandlerResult?i:l(i,e.done)}catch(n){throw e.done=!0,d(e),n}},return:function(){var i=s(this),n=i.iterator,r=i.inner,o=i.openIters,h=i.done;if(i.done=!0,t){var f=a(n,"return");return f?e(f,n):l(void 0,!0)}if(d(i),h)return l(void 0,!0);if(r)try{c(r.iterator,_)}catch(g){return c(n,m,g)}if(o)try{u(o,_)}catch(g){if(n)return c(n,m,g);throw g}return n&&c(n,_),l(void 0,!0)}})},x=v(!0),w=v(!1);s(w,f,"Iterator Helper"),t.exports=function(t,e,i){var s=function(s,n){n?(n.iterator=s.iterator,n.next=s.next):n=s,n.type=e?p:g,n.returnHandlerResult=!!i,n.nextHandler=t,n.counter=0,n.done=!1,y(this,n)};return s.prototype=e?x:w,s}}),bt=function(){return i(684)},Pt=i.cw(function(t){var e=it();t.exports=function(t,i){var s=e.Iterator,n=s&&s.prototype,r=n&&n[t],o=!1;if(r)try{r.call({next:function(){return{done:!0}},return:function(){o=!0}},-1)}catch(a){a instanceof i||(o=!1)}if(!o)return r}}),Rt=i.cw(function(t){var e,i,s,n=j(),r=ft(),o=_t(),a=Ot(),h=jt(),l=I(),c=Pe(),u=yt(),d=c("iterator"),f=!1;[].keys&&(s=[].keys(),"next"in s?(i=h(h(s)),i!==Object.prototype&&(e=i)):f=!0);var g=!o(e)||n(function(){var t={};return e[d].call(t)!==t});g?e={}:u&&(e=a(e)),r(e[d])||l(e,d,function(){return this}),t.exports={H:e,BUGGY_SAFARI_ITERATORS:f}}),It=function(){return i(269)},Tt=i.cw(function(t){var e=pe();t.exports=function(t){return e(t.length)}}),At=i.cw(function(t){var e=Y(),i=j(),s=ft(),n=st(),r=G(),o=X().i2,a=ht(),h=lt(),l=h.enforce,c=h.get,u=String,d=Object.defineProperty,f=e("".slice),g=e("".replace),p=e([].join),_=r&&!i(function(){return 8!==d(function(){},"length",{value:8}).length}),m=String(String).split("String"),y=t.exports=function(t,e,i){"Symbol("===f(u(e),0,7)&&(e="["+g(u(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!n(t,"name")||o&&t.name!==e)&&(r?d(t,"name",{value:e,configurable:!0}):t.name=e),_&&i&&n(i,"arity")&&t.length!==i.arity&&d(t,"length",{value:i.arity});try{i&&n(i,"constructor")&&i.constructor?r&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(a){}var s=l(t);return n(s,"source")||(s.source=p(m,"string"==typeof e?e:"")),t};Function.prototype.toString=y(function(){return s(this)&&c(this).source||a(this)},"toString")}),Gt=i.cw(function(t){var e=Y(),i=Map.prototype;t.exports={Map:Map,set:e(i.set),get:e(i.get),has:e(i.has),remove:e(i["delete"]),proto:i}}),Ot=i.cw(function(t){var e,i=l(),s=Lt(),n=N(),r=nt(),o=rt(),a=O(),h=ae(),c=">",u="<",d="prototype",f="script",g=h("IE_PROTO"),p=function(){},_=function(t){return u+f+c+t+u+"/"+f+c},m=function(t){t.write(_("")),t.close();var e=t.parentWindow.Object;return t=null,e},y=function(){var t,e=a("iframe"),i="java"+f+":";return e.style.display="none",o.appendChild(e),e.src=String(i),t=e.contentWindow.document,t.open(),t.write(_("document.F=Object")),t.close(),t.F},v=function(){try{e=new ActiveXObject("htmlfile")}catch(i){}v="undefined"!=typeof document?document.domain&&e?m(e):y():m(e);var t=n.length;while(t--)delete v[d][n[t]];return v()};r[g]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p[d]=i(t),n=new p,p[d]=null,n[g]=t):n=v(),void 0===e?n:s.f(n,e)}}),Lt=i.cw(function(t,e){var i=G(),s=Ce(),n=Nt(),r=l(),o=fe(),a=Bt();e.f=i&&!s?Object.defineProperties:function(t,e){r(t);var i,s=o(e),h=a(e),l=h.length,c=0;while(l>c)n.f(t,i=h[c++],s[i]);return t}}),Nt=i.cw(function(t,e){var i=G(),s=ot(),n=Ce(),r=l(),o=ye(),a=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",d="configurable",f="writable";e.f=i?n?function(t,e,i){if(r(t),e=o(e),r(i),"function"===typeof t&&"prototype"===e&&"value"in i&&f in i&&!i[f]){var s=c(t,e);s&&s[f]&&(t[e]=i.value,i={configurable:d in i?i[d]:s[d],enumerable:u in i?i[u]:s[u],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(r(t),e=o(e),r(i),s)try{return h(t,e,i)}catch(n){}if("get"in i||"set"in i)throw new a("Accessors not supported");return"value"in i&&(t[e]=i.value),t}}),kt=i.cw(function(t,e){var i=G(),s=W(),n=Wt(),r=b(),o=fe(),a=ye(),h=st(),l=ot(),c=Object.getOwnPropertyDescriptor;e.f=i?c:function(t,e){if(t=o(t),e=a(e),l)try{return c(t,e)}catch(i){}if(h(t,e))return r(!s(n.f,t,e),t[e])}}),Ft=i.cw(function(t,e){var i=Ut(),s=N(),n=s.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,n)}}),Dt=function(){return i(717)},jt=i.cw(function(t){var e=st(),i=ft(),s=_e(),n=ae(),r=M(),o=n("IE_PROTO"),a=Object,h=a.prototype;t.exports=r?a.getPrototypeOf:function(t){var n=s(t);if(e(n,o))return n[o];var r=n.constructor;return i(r)&&n instanceof r?r.prototype:n instanceof a?h:null}}),zt=i.cw(function(t){var e=Y();t.exports=e({}.isPrototypeOf)}),Ut=i.cw(function(t){var e=Y(),i=st(),s=fe(),n=_().q,r=nt(),o=e([].push);t.exports=function(t,e){var a,h=s(t),l=0,c=[];for(a in h)!i(r,a)&&i(h,a)&&o(c,a);while(e.length>l)i(h,a=e[l++])&&(~n(c,a)||o(c,a));return c}}),Bt=i.cw(function(t){var e=Ut(),i=N();t.exports=Object.keys||function(t){return e(t,i)}}),Wt=i.cw(function(t,e){var i={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,n=s&&!i.call({1:2},1);e.f=n?function(t){var e=s(this,t);return!!e&&e.enumerable}:i}),Xt=i.cw(function(t){var i=V(),s=_t(),n=Yt(),r=e();t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,o={};try{t=i(Object.prototype,"__proto__","set"),t(o,[]),e=o instanceof Array}catch(a){}return function(i,o){return n(i),r(o),s(i)?(e?t(i,o):i.__proto__=o,i):i}}():void 0)}),Vt=i.cw(function(t){var e=W(),i=ft(),s=_t(),n=TypeError;t.exports=function(t,r){var o,a;if("string"===r&&i(o=t.toString)&&!s(a=e(o,t)))return a;if(i(o=t.valueOf)&&!s(a=e(o,t)))return a;if("string"!==r&&i(o=t.toString)&&!s(a=e(o,t)))return a;throw new n("Can't convert object to primitive value")}}),qt=i.cw(function(t){var e=H(),i=Y(),s=Ft(),n=Dt(),r=l(),o=i([].concat);t.exports=e("Reflect","ownKeys")||function(t){var e=s.f(r(t)),i=n.f;return i?o(e,i(t)):e}}),Yt=function(){return i(750)},Kt=i.cw(function(t){var e=$t(),i=ee(),s=e.Set,n=e.add;t.exports=function(t){var e=new s;return i(t,function(t){n(e,t)}),e}}),Ht=i.cw(function(t){var e=n(),i=$t(),s=Kt(),r=ne(),o=et(),a=ee(),h=xt(),l=i.has,c=i.remove;t.exports=function(t){var i=e(this),n=o(t),u=s(i);return r(u)<=n.size?a(u,function(t){n.includes(t)&&c(u,t)}):h(n.getIterator(),function(t){l(u,t)&&c(u,t)}),u}}),$t=i.cw(function(t){var e=Y(),i=Set.prototype;t.exports={Set:Set,add:e(i.add),has:e(i.has),remove:e(i["delete"]),proto:i}}),Zt=i.cw(function(t){var e=n(),i=$t(),s=ne(),r=et(),o=ee(),a=xt(),h=i.Set,l=i.add,c=i.has;t.exports=function(t){var i=e(this),n=r(t),u=new h;return s(i)>n.size?a(n.getIterator(),function(t){c(i,t)&&l(u,t)}):o(i,function(t){n.includes(t)&&l(u,t)}),u}}),Jt=i.cw(function(t){var e=n(),i=$t().has,s=ne(),r=et(),o=ee(),a=xt(),h=St();t.exports=function(t){var n=e(this),l=r(t);if(s(n)<=l.size)return!1!==o(n,function(t){if(l.includes(t))return!1},!0);var c=l.getIterator();return!1!==a(c,function(t){if(i(n,t))return h(c.iterator,"normal",!1)})}}),Qt=i.cw(function(t){var e=n(),i=ne(),s=ee(),r=et();t.exports=function(t){var n=e(this),o=r(t);return!(i(n)>o.size)&&!1!==s(n,function(t){if(!o.includes(t))return!1},!0)}}),te=i.cw(function(t){var e=n(),i=$t().has,s=ne(),r=et(),o=xt(),a=St();t.exports=function(t){var n=e(this),h=r(t);if(s(n)<h.size)return!1;var l=h.getIterator();return!1!==o(l,function(t){if(!i(n,t))return a(l.iterator,"normal",!1)})}}),ee=i.cw(function(t){var e=Y(),i=xt(),s=$t(),n=s.Set,r=s.proto,o=e(r.forEach),a=e(r.keys),h=a(new n).next;t.exports=function(t,e,s){return s?i({iterator:a(t),next:h},e):o(t,e)}}),ie=i.cw(function(t){var e=H(),i=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw new Error("e")}}};t.exports=function(t,n){var r=e("Set");try{(new r)[t](i(0));try{return(new r)[t](i(-1)),!1}catch(a){if(!n)return!0;try{return(new r)[t](s(-1/0)),!1}catch(h){var o=new r([1,2]);return n(o[t](s(1/0)))}}}catch(h){return!1}}}),se=function(){return i(835)},ne=i.cw(function(t){var e=V(),i=$t();t.exports=e(i.proto,"size","get")||function(t){return t.size}}),re=i.cw(function(t){var e=n(),i=$t(),s=Kt(),r=et(),o=xt(),a=i.add,h=i.has,l=i.remove;t.exports=function(t){var i=e(this),n=r(t).getIterator(),c=s(i);return o(n,function(t){h(i,t)?l(c,t):a(c,t)}),c}}),oe=i.cw(function(t){var e=n(),i=$t().add,s=Kt(),r=et(),o=xt();t.exports=function(t){var n=e(this),a=r(t).getIterator(),h=s(n);return o(a,function(t){i(h,t)}),h}}),ae=i.cw(function(t){var e=le(),i=we(),s=e("keys");t.exports=function(t){return s[t]||(s[t]=i(t))}}),he=i.cw(function(t){var e=yt(),i=it(),s=A(),n="__core-js_shared__",r=t.exports=i[n]||s(n,{});(r.versions||(r.versions=[])).push({version:"3.51.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.51.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),le=i.cw(function(t){var e=he(),i=Object.create||Object;t.exports=function(t,s){return e[t]||(e[t]=s||i(null))}}),ce=i.cw(function(t){var e=F(),i=j(),s=it(),n=s.String;t.exports=!!Object.getOwnPropertySymbols&&!i(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}),ue=i.cw(function(t){var e=ge(),i=Math.max,s=Math.min;t.exports=function(t,n){var r=e(t);return r<0?i(r+n,0):s(r,n)}}),de=i.cw(function(t){var e=me(),i=TypeError;t.exports=function(t){var s=e(t,"number");if("number"==typeof s)throw new i("Can't convert number to bigint");return BigInt(s)}}),fe=i.cw(function(t){var e=at(),i=Yt();t.exports=function(t){return e(i(t))}}),ge=function(){return i(291)},pe=function(){return i(14)},_e=function(){return i(981)},me=i.cw(function(t){var e=W(),i=_t(),s=vt(),n=tt(),r=Vt(),o=Pe(),a=TypeError,h=o("toPrimitive");t.exports=function(t,o){if(!i(t)||s(t))return t;var l,c=n(t,h);if(c){if(void 0===o&&(o="default"),l=e(c,t,o),!i(l)||s(l))return l;throw new a("Can't convert object to primitive value")}return void 0===o&&(o="number"),r(t,o)}}),ye=i.cw(function(t){var e=me(),i=vt();t.exports=function(t){var s=e(t,"string");return i(s)?s:s+""}}),ve=i.cw(function(t){var e=Pe(),i=e("toStringTag"),s={};s[i]="z",t.exports="[object z]"===String(s)}),xe=i.cw(function(t){var e=String;t.exports=function(t){try{return e(t)}catch(i){return"Object"}}}),we=i.cw(function(t){var e=Y(),i=0,s=Math.random(),n=e(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+n(++i+s,36)}}),Ee=i.cw(function(t){var e=it(),i=Y(),s=h(),n=r(),o=st(),a=y(),l=K(),c=g(),u=a.c2i,d=a.c2iUrl,f=e.SyntaxError,p=e.TypeError,_=e.Array,m=i("".charAt),v=Math.floor,x=function(t,e){for(var i=t.length;e<i;e++){var s=m(t,e);if(" "!==s&&"\t"!==s&&"\n"!==s&&"\f"!==s&&"\r"!==s)break}return e},w=function(t,e,i){var s=t.length;s<4&&(t+=2===s?"AA":"A");var n=(e[m(t,0)]<<18)+(e[m(t,1)]<<12)+(e[m(t,2)]<<6)+e[m(t,3)],r=[n>>16&255,n>>8&255,255&n];if(2===s){if(i&&0!==r[1])throw new f("Extra bits");return[r[0]]}if(3===s){if(i&&0!==r[2])throw new f("Extra bits");return[r[0],r[1]]}return r},E=function(t,e,i){for(var s=e.length,n=0;n<s;n++)t[i+n]=e[n];return i+s};t.exports=function(t,e,i,r){n(t),s(e);var a="base64"===l(e)?u:d,h=e?e.lastChunkHandling:void 0;if(void 0===h&&(h="loose"),"loose"!==h&&"strict"!==h&&"stop-before-partial"!==h)throw new p("Incorrect `lastChunkHandling` option");i&&c(i.buffer);var g=t.length,y=i||_(v(3*g/4)),M=0,S=0,C="",b=0;if(r)while(1){if(b=x(t,b),b===g){if(C.length>0){if("stop-before-partial"===h)break;if("loose"!==h)throw new f("Missing padding");if(1===C.length)throw new f("Malformed padding: exactly one additional character");M=E(y,w(C,a,!1),M)}S=g;break}var P=m(t,b);if(++b,"="===P){if(C.length<2)throw new f("Padding is too early");if(b=x(t,b),2===C.length){if(b===g){if("stop-before-partial"===h)break;throw new f("Malformed padding: only one =")}"="===m(t,b)&&(++b,b=x(t,b))}if(b<g)throw new f("Unexpected character after padding");M=E(y,w(C,a,"strict"===h),M),S=g;break}if(!o(a,P))throw new f("Unexpected character");var R=r-M;if(1===R&&2===C.length||2===R&&3===C.length)break;if(C+=P,4===C.length&&(M=E(y,w(C,a,!1),M),C="",S=b,M===r))break}return i||(y.length=M),{bytes:y,read:S,written:M}}}),Me=i.cw(function(t){var e=it(),i=Y(),s=e.Uint8Array,n=e.SyntaxError,r=Math.min,o=i("".match);t.exports=function(t,e){var i=t.length;if(i%2!==0)throw new n("String should be an even number of characters");for(var a=e?r(e.length,i/2):i/2,h=e||new s(a),l=o(t,/[\S\s]{2}/g),c=0;c<a;c++){var u=+("0x"+l[c]+"0");if(u!==u)throw new n("String should only contain hex characters");h[c]=u>>4}return{bytes:h,read:c<<1}}}),Se=i.cw(function(t){var e=ce();t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}),Ce=i.cw(function(t){var e=G(),i=j();t.exports=e&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}),be=i.cw(function(t){var e=it(),i=ft(),s=e.WeakMap;t.exports=i(s)&&/native code/.test(String(s))}),Pe=i.cw(function(t){var e=it(),i=le(),s=st(),n=we(),r=ce(),o=Se(),a=e.Symbol,h=i("wks"),l=o?a["for"]||a:a&&a.withoutSetter||n;t.exports=function(t){return s(h,t)||(h[t]=r&&s(a,t)?a[t]:l("Symbol."+t)),h[t]}}),Re=i.cw(function(){var t=D(),e=_().m,i=j(),s=o(),n=i(function(){return!Array(1).includes()}),r=i(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:n||r},{includes:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),s("includes")}),Ie=i.cw(function(){var t=D(),e=_e(),i=Tt(),s=m(),n=L(),r=j(),o=r(function(){return 4294967297!==[].push.call({length:4294967296},1)}),a=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},h=o||!a();t({target:"Array",proto:!0,arity:1,forced:h},{push:function(t){var r=e(this),o=i(r),a=arguments.length;n(o+a);for(var h=0;h<a;h++)r[o]=arguments[h],o++;return s(r,o),o}})}),Te=i.cw(function(){var t=D(),e=it(),i=a(),s=l(),n=ft(),r=jt(),o=R(),h=P(),c=j(),u=st(),d=Pe(),f=Rt().H,g=G(),p=yt(),_="constructor",m="Iterator",y=d("toStringTag"),v=TypeError,x=e[m],w=p||!n(x)||x.prototype!==f||!c(function(){x({})}),E=function(){if(i(this,f),r(this)===f)throw new v("Abstract class Iterator not directly constructable")},M=function(t,e){g?o(f,t,{configurable:!0,get:function(){return e},set:function(e){if(s(this),this===f)throw new v("You can't redefine this property");u(this,t)?this[t]=e:h(this,t,e)}}):f[t]=e};u(f,y)||M(y,m),!w&&u(f,_)&&f[_]!==Object||M(_,E),E.prototype=f,t({global:!0,constructor:!0,forced:w},{Iterator:E})}),Ae=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("every",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{every:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return!s(e,function(e,i){if(!t(e,h++))return i()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),Ge=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Ct(),a=v(),h=yt(),c=St(),u=bt(),d=Pt(),f=!h&&!u("filter",function(){}),g=!h&&!f&&d("filter",TypeError),p=h||f||g,_=o(function(){var t,e,s,r=this.iterator,o=this.predicate,h=this.next;while(1){if(t=n(i(h,r)),e=this.done=!!t.done,e)return;if(s=t.value,a(r,o,[s,this.counter++],!0))return s}});e({target:"Iterator",proto:!0,real:!0,forced:p},{filter:function(t){n(this);try{s(t)}catch(e){c(this,"throw",e)}return g?i(g,this,t):new _(r(this),{predicate:t})}})}),Oe=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("find",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{find:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return s(e,function(e,i){if(t(e,h++))return i(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),Le=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Z(),a=Ct(),h=St(),c=j(),u=yt(),d=bt(),f=Pt(),g=!u&&c(function(){return 1!==[1].values().flatMap(function(){return[1]}).find(function(){return!0})}),p=!u&&!g&&!d("flatMap",function(){}),_=!u&&!g&&!p&&f("flatMap",TypeError),m=u||g||p||_,y=a(function(){var t,e,s=this.iterator,r=this.mapper;while(1){if(e=this.inner)try{if(t=n(i(e.next,e.iterator)),!t.done)return t.value;this.inner=null}catch(a){h(s,"throw",a)}if(t=n(i(this.next,s)),this.done=!!t.done)return;try{this.inner=o(r(t.value,this.counter++),!1)}catch(a){h(s,"throw",a)}}});e({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function(t){n(this);try{s(t)}catch(e){h(this,"throw",e)}return _?i(_,this,t):new y(r(this),{mapper:t,inner:null})}})}),Ne=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("forEach",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;s(e,function(e){t(e,h++)},{IS_RECORD:!0})}})}),ke=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Ct(),a=v(),h=St(),c=bt(),u=Pt(),d=yt(),f=!d&&!c("map",function(){}),g=!d&&!f&&u("map",TypeError),p=d||f||g,_=o(function(){var t=this.iterator,e=n(i(this.next,t)),s=this.done=!!e.done;if(!s)return a(t,this.mapper,[e.value,this.counter++],!0)});e({target:"Iterator",proto:!0,real:!0,forced:p},{map:function(t){n(this);try{s(t)}catch(e){h(this,"throw",e)}return g?i(g,this,t):new _(r(this),{mapper:t})}})}),Fe=i.cw(function(){var e=D(),i=wt(),s=t(),n=l(),r=$(),o=St(),a=Pt(),h=z(),c=j(),u=TypeError,d=c(function(){[].keys().reduce(function(){},void 0)}),f=!d&&a("reduce",u);e({target:"Iterator",proto:!0,real:!0,forced:d||f},{reduce:function(t){n(this);try{s(t)}catch(d){o(this,"throw",d)}var e=arguments.length<2,a=e?void 0:arguments[1];if(f)return h(f,this,e?[t]:[t,a]);var l=r(this),c=0;if(i(l,function(i){e?(e=!1,a=i):a=t(a,i,c),c++},{IS_RECORD:!0}),e)throw new u("Reduce of empty iterator with no initial value");return a}})}),De=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("some",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{some:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return s(e,function(e,i){if(t(e,h++))return i()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),je=i.cw(function(){var e=D(),i=t(),s=Gt(),n=yt(),r=s.get,o=s.has,a=s.set;e({target:"Map",proto:!0,real:!0,forced:n},{getOrInsertComputed:function(t,e){var s=o(this,t);if(i(e),s)return r(this,t);0===t&&1/t===-1/0&&(t=0);var n=e(t);return a(this,t,n),n}})}),ze=i.cw(function(){var t=D(),e=Gt(),i=yt(),s=e.get,n=e.has,r=e.set;t({target:"Map",proto:!0,real:!0,forced:i},{getOrInsert:function(t,e){return n(this,t)?s(this,t):(r(this,t,e),e)}})}),Ue=i.cw(function(){var t=D(),e=Ht(),i=j(),s=ie(),n=!s("difference",function(t){return 0===t.size}),r=n||i(function(){var t={size:1,has:function(){return!0},keys:function(){var t=0;return{next:function(){var i=t++>1;return e.has(1)&&e.clear(),{done:i,value:2}}}}},e=new Set([1,2,3,4]);return 3!==e.difference(t).size});t({target:"Set",proto:!0,real:!0,forced:r},{difference:e})}),Be=i.cw(function(){var t=D(),e=j(),i=Zt(),s=ie(),n=!s("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||e(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))});t({target:"Set",proto:!0,real:!0,forced:n},{intersection:i})}),We=i.cw(function(){var t=D(),e=Jt(),i=ie(),s=!i("isDisjointFrom",function(t){return!t});t({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:e})}),Xe=i.cw(function(){var t=D(),e=Qt(),i=ie(),s=!i("isSubsetOf",function(t){return t});t({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:e})}),Ve=i.cw(function(){var t=D(),e=te(),i=ie(),s=!i("isSupersetOf",function(t){return!t});t({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:e})}),qe=i.cw(function(){var t=D(),e=re(),i=se(),s=ie(),n=!s("symmetricDifference")||!i("symmetricDifference");t({target:"Set",proto:!0,real:!0,forced:n},{symmetricDifference:e})}),Ye=i.cw(function(){var t=D(),e=oe(),i=se(),s=ie(),n=!s("union")||!i("union");t({target:"Set",proto:!0,real:!0,forced:n},{union:e})}),Ke=i.cw(function(){var t=p(),e=dt(),i=Tt(),s=ge(),n=de(),r=t.aTypedArray,o=t.getTypedArrayConstructor,a=t.exportTypedArrayMethod,h=RangeError,l=function(){try{new Int8Array(1)["with"](2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),c=l&&function(){try{new Int8Array(1)["with"](-.5,1)}catch(t){return!0}}();a("with",{with:function(t,a){var l=r(this),c=i(l),u=s(t),d=u<0?c+u:u,f=e(l)?n(a):+a;if(d>=c||d<0)throw new h("Incorrect index");for(var g=new(o(l))(c),p=0;p<c;p++)g[p]=p===d?f:l[p];return g}}["with"],!l||c)}),He=i.cw(function(){var t=D(),e=it(),i=Ee(),s=c(),n=e.Uint8Array,r=!n||!n.prototype.setFromBase64||!function(){var t=new n([255,255,255,255,255]);try{return void t.setFromBase64("",null)}catch(e){}try{return void t.setFromBase64("a")}catch(e){}try{t.setFromBase64("MjYyZg===")}catch(e){return 50===t[0]&&54===t[1]&&50===t[2]&&255===t[3]&&255===t[4]}}();n&&t({target:"Uint8Array",proto:!0,forced:r},{setFromBase64:function(t){s(this);var e=i(t,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})}),$e=i.cw(function(){var t=D(),e=it(),i=r(),s=c(),n=g(),o=Me();function a(){try{var t=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(t).setFromHex("cafed00d")}catch(e){return!0}}e.Uint8Array&&t({target:"Uint8Array",proto:!0,forced:a()},{setFromHex:function(t){s(this),i(t),n(this.buffer);var e=o(t,this).read;return{read:e,written:e/2}}})}),Ze=i.cw(function(){var t=D(),e=it(),i=Y(),s=h(),n=c(),r=g(),o=y(),a=K(),l=o.i2c,u=o.i2cUrl,d=Math.floor,f=Math.ceil,p=i("".charAt),_=e.Uint8Array,m=e.Array,v=i([].join),x=!_||!_.prototype.toBase64||!function(){try{var t=new _;t.toBase64(null)}catch(e){return!0}}();_&&t({target:"Uint8Array",proto:!0,forced:x},{toBase64:function(){var t=n(this),e=arguments.length?s(arguments[0]):void 0,i="base64"===a(e)?l:u,o=!!e&&!!e.omitPadding;r(this.buffer);for(var h,c=0,g=t.length,_=m(o?4*d(g/3)+(g%3?g%3+1:0):4*f(g/3)),y=0,x=function(t){return p(i,h>>6*t&63)};c+2<g;c+=3)h=(t[c]<<16)+(t[c+1]<<8)+t[c+2],_[y++]=x(3),_[y++]=x(2),_[y++]=x(1),_[y++]=x(0);return c+2===g?(h=(t[c]<<16)+(t[c+1]<<8),_[y++]=x(3),_[y++]=x(2),_[y++]=x(1),o||(_[y++]="=")):c+1===g&&(h=t[c]<<16,_[y++]=x(3),_[y++]=x(2),o||(_[y++]="=",_[y++]="=")),v(_,"")}})}),Je=i.cw(function(){var t=D(),e=it(),i=Y(),s=c(),n=g(),r=i(1.1.toString),o=i([].join),a=Array,h=e.Uint8Array,l=!h||!h.prototype.toHex||!function(){try{var t=new h([255,255,255,255,255,255,255,255]);return"ffffffffffffffff"===t.toHex()}catch(e){return!1}}();h&&t({target:"Uint8Array",proto:!0,forced:l},{toHex:function(){s(this),n(this.buffer);for(var t=a(this.length),e=0,i=this.length;e<i;e++){var h=r(this[e],16);t[e]=1===h.length?"0"+h:h}return o(t,"")}})});if("undefined"!==typeof window){var Qe=window.document.currentScript,ti=Qe&&Qe.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);ti&&(i.p=ti[1])}Te(),ke();var ei=function(){var t=this,e=t._self._c;return e("div",{ref:"mapViewer",staticClass:"map-viewer-root",class:{"light-theme":t.isLight,"sidebar-collapsed":t.sidebarCollapsed,"panel-right-collapsed":t.panelRightCollapsed},style:t.viewerStyle},[e("aside",{attrs:{id:"sidebar"}},[e("header",{staticClass:"sidebar-header"},[t._m(0),e("button",{ref:"sidebarCollapse",attrs:{id:"sidebar-collapse",title:"收起面板"},on:{click:t.collapseSidebar}},[t._v("‹")])]),e("div",{staticClass:"sidebar-body"},[e("section",{staticClass:"block"},[e("h2",[t._v("当前地图")]),t.mapInfo.active?t._e():e("div",{staticClass:"hint",attrs:{id:"map-info-empty"}},[t._v("暂无地图,请上传地图。")]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.mapInfo.active,expression:"mapInfo.active"}],attrs:{id:"map-info"}},[e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("名称")]),e("span",{attrs:{id:"info-name"}},[t._v(t._s(t.mapInfo.name))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("类型")]),e("span",{attrs:{id:"info-kind"}},[t._v(t._s(t.mapInfo.kind))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("数据坐标系")]),e("span",{attrs:{id:"info-data-crs"}},[t._v(t._s(t.mapInfo.dataCrs))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("显示范围")]),e("span",{attrs:{id:"info-extent"}},[t._v(t._s(t.mapInfo.extent))])])])]),e("section",{directives:[{name:"show",rawName:"v-show",value:t.mapInfo.active,expression:"mapInfo.active"}],staticClass:"block",attrs:{id:"view-crs-block"}},[e("h2",[t._v("视图坐标系")]),e("div",{staticClass:"row"},[e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.viewCrs,expression:"form.viewCrs"}],attrs:{id:"view-crs"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"viewCrs",e.target.multiple?i:i[0])}}},[t._l(t.crsOptions.viewCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0):t._e()],2),e("button",{ref:"btnSwitchView",staticClass:"mini-btn",attrs:{id:"btn-switch-view",type:"button"},on:{click:t.switchViewProjection}},[t._v("切换")])]),e("label",{staticClass:"grid-caption"},[t._v("显示范围")]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{attrs:{type:"number",id:"map-ext-minx",step:"any",readonly:""},domProps:{value:t.mapExtent.minx}})]),e("label",[t._v("Y 最小(南)"),e("input",{attrs:{type:"number",id:"map-ext-miny",step:"any",readonly:""},domProps:{value:t.mapExtent.miny}})]),e("label",[t._v("X 最大(东)"),e("input",{attrs:{type:"number",id:"map-ext-maxx",step:"any",readonly:""},domProps:{value:t.mapExtent.maxx}})]),e("label",[t._v("Y 最大(北)"),e("input",{attrs:{type:"number",id:"map-ext-maxy",step:"any",readonly:""},domProps:{value:t.mapExtent.maxy}})])]),e("label",{staticClass:"grid-caption"},[t._v("当前视野")]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{attrs:{type:"number",id:"view-ext-minx",step:"any",readonly:""},domProps:{value:t.viewExtent.minx}})]),e("label",[t._v("Y 最小(南)"),e("input",{attrs:{type:"number",id:"view-ext-miny",step:"any",readonly:""},domProps:{value:t.viewExtent.miny}})]),e("label",[t._v("X 最大(东)"),e("input",{attrs:{type:"number",id:"view-ext-maxx",step:"any",readonly:""},domProps:{value:t.viewExtent.maxx}})]),e("label",[t._v("Y 最大(北)"),e("input",{attrs:{type:"number",id:"view-ext-maxy",step:"any",readonly:""},domProps:{value:t.viewExtent.maxy}})])])]),e("section",{directives:[{name:"show",rawName:"v-show",value:t.layerListVisible,expression:"layerListVisible"}],staticClass:"block",attrs:{id:"layer-list-block"}},[e("h2",{staticClass:"layer-list-title"},[t._v("图层列表"),t.layerListHint?t._e():e("span",{staticClass:"layer-summary"},[t._v(t._s(t.layerTotal)+" 个图层 · "+t._s(t.layerFeatureTotal)+" 个要素")])]),e("p",{directives:[{name:"show",rawName:"v-show",value:t.layerListHint,expression:"layerListHint"}],staticClass:"layer-list-hint"},[t._v(t._s(t.layerListHint))]),e("ul",{attrs:{id:"layer-list"}},[t._l(t.layerListItems,function(i){return["layer"===i.type?e("li",{key:i.key,staticClass:"layer-item",class:{"hidden-layer":!i.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:i.name}},[t._v(t._s(i.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(i.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到当前图层"},on:{click:function(e){return t.zoomToLayer(i)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层"},on:{click:function(e){return t.removeLayerItem(i)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:i.visible?"隐藏图层":"显示图层"},on:{click:function(e){return t.toggleLayerVisible(i)}}},[t._v(t._s(i.visible?"👁️":"🚫"))])])]):e("li",{key:i.name,staticClass:"layer-item layer-group",class:{"hidden-layer":!i.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:i.name}},[t._v(t._s(i.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(i.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到图层组"},on:{click:function(e){return t.zoomToLayerGroup(i)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层组"},on:{click:function(e){return t.removeLayerGroup(i)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-fold",attrs:{type:"button",title:i.collapsed?"展开图层组":"折叠图层组"},on:{click:function(e){return t.toggleLayerGroupExpanded(i)}}},[t._v(t._s(i.collapsed?"▸":"▾"))]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:i.visible?"隐藏图层组":"显示图层组"},on:{click:function(e){return t.toggleLayerGroupVisible(i)}}},[t._v(t._s(i.visible?"👁️":"🚫"))])])]),"group"!==i.type||i.collapsed?t._e():t._l(i.children,function(s){return e("li",{key:s.key,staticClass:"layer-item layer-child",class:{"hidden-layer":!s.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:s.name}},[t._v(t._s(s.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(s.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到当前图层"},on:{click:function(e){return t.zoomToLayer(s)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层"},on:{click:function(e){return t.removeLayerItem(s)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:s.visible?"隐藏图层":"显示图层"},on:{click:function(e){return t.toggleLayerChildVisible(i,s)}}},[t._v(t._s(s.visible?"👁️":"🚫"))])])])})]})],2)])])]),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.sidebarCollapsed,expression:"!sidebarCollapsed"}],staticClass:"sidebar-resizer",attrs:{title:"拖动调整侧栏宽度"},on:{mousedown:t.startSidebarResize}}),e("button",{ref:"sidebarOpen",attrs:{id:"sidebar-open",title:"展开面板",type:"button"},on:{click:t.expandSidebar}},[t._v("›")]),e("button",{ref:"panelRightOpen",attrs:{id:"panel-right-open",title:"展开面板",type:"button"},on:{click:t.expandPanelRight}},[t._v("‹")]),e("main",{attrs:{id:"map"}}),e("div",{staticClass:"dialog-overlay",class:{show:t.loadDialogVisible},attrs:{id:"load-dialog"}},[e("div",{staticClass:"dialog"},[e("header",{staticClass:"dialog-header"},[t._m(1),e("button",{ref:"btnDialogClose",attrs:{id:"btn-dialog-close",title:"关闭",type:"button"},on:{click:t.closeLoadDialog}},[t._v("✕")])]),e("div",{ref:"dialogBody",staticClass:"dialog-body"},[e("section",{staticClass:"block"},[e("h2",[t._v("数据类型")]),e("div",{ref:"sourceTypeTabs",staticClass:"tabs source-type-tabs",attrs:{id:"source-type-tabs"}},[e("button",{staticClass:"tab-btn source-type-btn",class:{active:"raster"===t.sourceCategory},attrs:{type:"button"},on:{click:function(e){return t.setSourceCategoryAndDefault("raster")}}},[t._v("栅格")]),e("button",{staticClass:"tab-btn source-type-btn",class:{active:"vector"===t.sourceCategory},attrs:{type:"button"},on:{click:function(e){return t.setSourceCategoryAndDefault("vector")}}},[t._v("矢量")])]),e("h2",[t._v("数据源")]),e("div",{staticClass:"tab-pane",class:{active:"image"===t.currentTab},attrs:{id:"tab-image"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择 PNG / JPG 图片 "),e("input",{ref:"imgFile",attrs:{type:"file",id:"img-file",accept:".png,.jpg,.jpeg,.webp,image/png,image/jpeg,image/webp",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"img-file-name"}},[t._v(t._s(t.form.imgFileName))]),e("label",{staticClass:"file-btn secondary"},[t._v(" 坐标信息文件(可选 .pgw / .wld) "),e("input",{ref:"worldFile",attrs:{type:"file",id:"world-file",accept:".pgw,.pwg,.jgw,.gfw,.wld,.pngw,.jpgw,.txt",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"world-file-name"}},[t._v(t._s(t.form.worldFileName))]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{ref:"extMinx",attrs:{type:"number",id:"ext-minx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最小(南)"),e("input",{ref:"extMiny",attrs:{type:"number",id:"ext-miny",step:"any",placeholder:"必填"}})]),e("label",[t._v("X 最大(东)"),e("input",{ref:"extMaxx",attrs:{type:"number",id:"ext-maxx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最大(北)"),e("input",{ref:"extMaxy",attrs:{type:"number",id:"ext-maxy",step:"any",placeholder:"必填"}})])]),e("div",{staticClass:"hint",attrs:{id:"zone-hint"}},[t.form.zoneHint.message?e("span",[t._v(t._s(t.form.zoneHint.message))]):t._e(),t._l(t.form.zoneHint.options,function(i){return e("button",{key:i.code,staticClass:"chip",attrs:{type:"button"},on:{click:function(e){t.form.dataCrs=i.code}}},[t._v(t._s(i.label))])})],2),e("p",{staticClass:"tip"},[t._v("范围必填:四至范围需填写完整,选择坐标信息文件后可自动计算填充。")])]),e("div",{staticClass:"tab-pane",class:{active:"tiles"===t.currentTab},attrs:{id:"tab-tiles"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择切片XYZ目录(z/x/y 结构) "),e("input",{ref:"tilesDir",attrs:{type:"file",id:"tiles-dir",webkitdirectory:"",directory:"",multiple:"",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"tiles-dir-name"}},[t._v(t._s(t.form.tilesDirName))]),e("label",{staticClass:"check"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.tilesTms,expression:"form.tilesTms"}],attrs:{type:"checkbox",id:"tiles-tms"},domProps:{checked:Array.isArray(t.form.tilesTms)?t._i(t.form.tilesTms,null)>-1:t.form.tilesTms},on:{change:[function(e){var i=t.form.tilesTms,s=e.target,n=!!s.checked;if(Array.isArray(i)){var r=null,o=t._i(i,r);s.checked?o<0&&t.$set(t.form,"tilesTms",i.concat([r])):o>-1&&t.$set(t.form,"tilesTms",i.slice(0,o).concat(i.slice(o+1)))}else t.$set(t.form,"tilesTms",n)},function(e){return t.updateTilesInfo()}]}}),t._v(" TMS 顺序(Y 轴从下往上)")]),e("div",{staticClass:"hint",attrs:{id:"tiles-info"}},[t._v(t._s(t.form.tilesInfo))]),e("p",{staticClass:"tip"},[t._v("大多数切片XYZ使用 EPSG:3857(网络墨卡托)网格。")])]),e("div",{staticClass:"tab-pane",class:{active:"geojson"===t.currentTab},attrs:{id:"tab-geojson"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择 GeoJSON + SLD 目录(同名配对) "),e("input",{ref:"geojsonDir",attrs:{type:"file",id:"geojson-dir",webkitdirectory:"",directory:"",multiple:"",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"geojson-dir-name"}},[t._v(t._s(t.form.geojsonDirName))]),e("div",{staticClass:"hint",attrs:{id:"geojson-crs-hint"}},[t.form.geojsonCrsHint?e("span",[t._v(t._s(t.form.geojsonCrsHint))]):t._e(),t._l(t.form.geojsonCrsOptions,function(i){return e("button",{key:i.code,staticClass:"chip",attrs:{type:"button"},on:{click:function(e){t.form.dataCrs=i.code}}},[t._v(t._s(i.label))])})],2),e("div",{staticClass:"hint",attrs:{id:"geojson-info"}},[t._v(t._s(t.form.geojsonInfo))])]),e("div",{staticClass:"tab-pane",class:{active:"url"===t.currentTab},attrs:{id:"tab-url"}},[e("label",[t._v("在线切片XYZ URL 模板 "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlTemplate,expression:"form.urlTemplate"}],attrs:{type:"text",id:"url-template",placeholder:"https://example.com/tiles/{z}/{x}/{y}.png",spellcheck:"false"},domProps:{value:t.form.urlTemplate},on:{change:t.updateUrlTemplateHint,input:function(e){e.target.composing||t.$set(t.form,"urlTemplate",e.target.value)}}})]),e("div",{staticClass:"zoom-range"},[e("label",[t._v("最小层级"),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlMinzoom,expression:"form.urlMinzoom"}],attrs:{type:"number",id:"url-minzoom",min:"0",max:"24",placeholder:"必填"},domProps:{value:t.form.urlMinzoom},on:{input:function(e){e.target.composing||t.$set(t.form,"urlMinzoom",e.target.value)}}})]),e("label",[t._v("最大层级"),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlMaxzoom,expression:"form.urlMaxzoom"}],attrs:{type:"number",id:"url-maxzoom",min:"0",max:"24",placeholder:"必填"},domProps:{value:t.form.urlMaxzoom},on:{input:function(e){e.target.composing||t.$set(t.form,"urlMaxzoom",e.target.value)}}})])]),e("label",[t._v("范围"),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.urlExtentCrs,expression:"form.urlExtentCrs"}],attrs:{id:"url-extent-crs"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"urlExtentCrs",e.target.multiple?i:i[0])}}},[t._l(t.crsOptions.urlExtentCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name)+" ")])}),0):t._e()],2)]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{ref:"urlExtMinx",attrs:{type:"number",id:"url-ext-minx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最小(南)"),e("input",{ref:"urlExtMiny",attrs:{type:"number",id:"url-ext-miny",step:"any",placeholder:"必填"}})]),e("label",[t._v("X 最大(东)"),e("input",{ref:"urlExtMaxx",attrs:{type:"number",id:"url-ext-maxx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最大(北)"),e("input",{ref:"urlExtMaxy",attrs:{type:"number",id:"url-ext-maxy",step:"any",placeholder:"必填"}})])]),e("div",{staticClass:"hint",attrs:{id:"url-info"}},[t._v(t._s(t.form.urlInfo))]),e("p",{staticClass:"tip"},[t._v("必须为完整 http(s) URL,模板变量 {z} {x} {y},TMS 用 {-y}。")])])]),e("section",{staticClass:"block"},[e("h2",[t._v("数据坐标系")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.dataCrs,expression:"form.dataCrs"}],attrs:{id:"data-crs"},on:{change:[function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"dataCrs",e.target.multiple?i:i[0])},function(e){return t.updateTilesInfo()}]}},[t._l(t.crsOptions.dataCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0):t._e()],2),e("div",{staticClass:"custom-crs"},[e("div",{staticClass:"row"},[e("input",{ref:"customEpsg",attrs:{type:"number",id:"custom-epsg",min:"1",step:"1",placeholder:"EPSG 代码,如 4525"}}),e("button",{ref:"btnFetchEpsg",staticClass:"mini-btn",attrs:{id:"btn-fetch-epsg",type:"button"},on:{click:t.fetchAndRegisterEpsg}},[t._v("在线获取")])]),e("p",{staticClass:"tip"},[t._v("在线获取来自 epsg.io,需要联网。")])])]),e("button",{ref:"btnLoad",staticClass:"primary-btn",attrs:{id:"btn-load",type:"button"},on:{click:t.loadToMap}},[t._v("加载到地图")])])])]),e("footer",{attrs:{id:"statusbar"}},[e("span",{ref:"statusCoords",staticClass:"status-seg",attrs:{id:"status-coords"}}),e("span",{ref:"statusScale",staticClass:"status-seg",attrs:{id:"status-scale"}}),e("span",{staticClass:"status-seg",attrs:{id:"status-info"}},[t._v(t._s(t.statusInfo))])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.dropVisible,expression:"dropVisible"}],attrs:{id:"drop-overlay"}},[e("div",[t._v("松开鼠标,加载地图文件")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.toastVisible,expression:"toastVisible"}],attrs:{id:"toast","data-type":t.toastType}},[t._v(t._s(t.toastText))])])},ii=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"brand"},[e("span",{staticClass:"logo"},[t._v("🗺️")]),e("div",[e("h1",[t._v("地图查看器")]),e("p",[t._v("当前地图信息")])])])},function(){var t=this,e=t._self._c;return e("div",{staticClass:"brand"},[e("span",{staticClass:"logo"},[t._v("📥")]),e("div",[e("h1",[t._v("加载地图")]),e("p",[t._v("选择数据源并加载")])])])}];Re(),Ie(),Ae(),Ge(),Oe(),Ne(),Fe(),De(),ze(),je(),Ue(),Be(),We(),Xe(),Ve(),qe(),Ye();var si={ADD:"add",REMOVE:"remove"},ni={PROPERTYCHANGE:"propertychange"};function ri(t){for(const e in t)delete t[e]}function oi(t){let e;for(e in t)return!1;return!e}function ai(t,e,i,s,n){if(n){const n=i;i=function(r){return t.removeEventListener(e,i),n.call(s??this,r)}}else s&&s!==t&&(i=i.bind(s));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function hi(t,e,i,s){return ai(t,e,i,s,!0)}function li(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ri(t))}var ci={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",KEYUP:"keyup",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class ui{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var di=ui;function fi(t,e,i){let s,n;i=i||gi;let r=0,o=t.length,a=!1;while(r<o)s=r+(o-r>>1),n=+i(t[s],e),n<0?r=s+1:(o=s,a=!n);return a?r:~r}function gi(t,e){return t>e?1:t<e?-1:0}function pi(t,e){return t<e?1:t>e?-1:0}function _i(t,e,i){if(t[0]<=e)return 0;const s=t.length;if(e<=t[s-1])return s-1;if("function"===typeof i){for(let n=1;n<s;++n){const s=t[n];if(s===e)return n;if(s<e)return i(e,t[n-1],s)>0?n-1:n}return s-1}if(i>0){for(let i=1;i<s;++i)if(t[i]<e)return i-1;return s-1}if(i<0){for(let i=1;i<s;++i)if(t[i]<=e)return i;return s-1}for(let n=1;n<s;++n){if(t[n]==e)return n;if(t[n]<e)return t[n-1]-e<e-t[n]?n-1:n}return s-1}function mi(t,e,i){while(e<i){const s=t[e];t[e]=t[i],t[i]=s,++e,--i}}function yi(t,e){const i=Array.isArray(e)?e:[e],s=i.length;for(let n=0;n<s;n++)t[t.length]=i[n]}function vi(t,e){const i=t.length;if(i!==e.length)return!1;for(let s=0;s<i;s++)if(t[s]!==e[s])return!1;return!0}function xi(t,e,i){const s=e||gi;return t.every(function(e,n){if(0===n)return!0;const r=s(t[n-1],e);return!(r>0||i&&0===r)})}function wi(){throw new Error("Unimplemented abstract method.")}let Ei=0;function Mi(t){const e=t;return e.ol_uid||(e.ol_uid=String(++Ei))}function Si(t){return!!t&&"function"===typeof t.then&&"function"===typeof t.catch}function Ci(){return!0}function bi(){return!1}function Pi(){}function Ri(t){let e,i,s;return function(){const n=Array.prototype.slice.call(arguments);return i&&this===s&&vi(n,i)||(s=this,i=n,e=t.apply(this,n)),e}}function Ii(t){function e(){let e;try{e=t()}catch(i){return Promise.reject(i)}return Si(e)?e:Promise.resolve(e)}return e()}class Ti{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Ai=Ti;class Gi extends di{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e="string"===typeof t,i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const n=e?new Ai(t):t;n.target||(n.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let h=0,l=s.length;h<l;++h)if(a="handleEvent"in s[h]?s[h].handleEvent(n):s[h].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];delete o[i];while(t--)this.removeEventListener(i,Pi);delete r[i]}return a}disposeInternal(){this.listeners_&&ri(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);-1!==s&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Pi,++this.pendingRemovals_[t]):(i.splice(s,1),0===i.length&&delete this.listeners_[t]))}}var Oi=Gi;class Li extends Oi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ci.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=ai(this,t[n],e);return s}return ai(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let n=0;n<s;++n)i[n]=hi(this,t[n],e)}else i=hi(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)Ni(i);else if(Array.isArray(t))for(let s=0,n=t.length;s<n;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}function Ni(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)li(t[e]);else li(t)}Li.prototype.on,Li.prototype.once,Li.prototype.un;var ki=Li;class Fi extends Ai{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Di extends ki{constructor(t){super(),this.on,this.once,this.un,Mi(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Fi(i,t,e)),i=ni.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Fi(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const i=s[t];s[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],oi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var ji=Di;const zi={LENGTH:"length"};class Ui extends Ai{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Bi extends ji{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){while(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.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(zi.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Ui(si.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Ui(si.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i)return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Ui(si.REMOVE,s,t)),this.dispatchEvent(new Ui(si.ADD,e,t))}updateLength_(){this.set(zi.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,n=i.length;s<n;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}var Wi=Bi;class Xi extends Ai{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}var Vi=Xi;class qi extends Vi{constructor(t,e,i,s,n,r){super(t,e,n),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==s&&s,this.activePointers=r,this.ctrlKey=!1}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var Yi=qi,Ki={SINGLECLICK:"singleclick",CLICK:ci.CLICK,DBLCLICK:ci.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};const Hi="undefined"!==typeof navigator&&"undefined"!==typeof navigator.userAgent?navigator.userAgent.toLowerCase():"",$i=Hi.includes("safari")&&!Hi.includes("chrom"),Zi=($i&&(Hi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Hi)),Hi.includes("webkit")&&!Hi.includes("edge")),Ji=Hi.includes("macintosh"),Qi="undefined"!==typeof devicePixelRatio?devicePixelRatio:1,ts="undefined"!==typeof WorkerGlobalScope&&"undefined"!==typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,es="undefined"!==typeof Image&&Image.prototype.decode,is="function"===typeof createImageBitmap,ss=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}();var ns={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class rs extends Oi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();if(!i)throw new Error("Map viewport is required");this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=ai(i,ns.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=ai(i,ns.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(ci.TOUCHMOVE,this.boundHandleTouchMove_,!!ss&&{passive:!1})}emulateClick_(t){let e=new Yi(Ki.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Yi(Ki.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new Yi(Ki.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Ki.POINTERUP||e.type==Ki.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Ki.POINTERDOWN&&e.type!=Ki.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Yi(Ki.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.down_&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Yi(Ki.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument(),e=this.element_;if(!e)return;if(this.dragListenerKeys_.push(ai(t,Ki.POINTERMOVE,this.handlePointerMove_,this),ai(t,Ki.POINTERUP,this.handlePointerUp_,this),ai(e,Ki.POINTERCANCEL,this.handlePointerUp_,this)),e.getRootNode&&e.getRootNode()!==t){const t=e.getRootNode();this.dragListenerKeys_.push(ai(t,Ki.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Yi(Ki.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Yi(Ki.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"===typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){const e=this.down_;return this.dragging_||null!==e&&(Math.abs(t.clientX-e.clientX)>this.moveTolerance_||Math.abs(t.clientY-e.clientY)>this.moveTolerance_)}disposeInternal(){const t=this.element_;this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=void 0),t&&t.removeEventListener(ci.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=void 0),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}}var os=rs,as={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},hs={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ls={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function cs(t,e){if(!t)throw new Error(e)}const us=1/0;class ds{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ri(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){cs(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=us&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,n=e[t],r=i[t],o=t;while(t<s>>1){const n=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<s&&i[r]<i[n]?r:n;e[t]=e[o],i[t]=i[o],t=o}e[t]=n,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,n=i[e],r=s[e];while(e>t){const t=this.getParentIndex_(e);if(!(s[t]>r))break;i[e]=i[t],s[e]=s[t],e=t}i[e]=n,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const n=e.length;let r,o,a;for(o=0;o<n;++o)r=e[o],a=t(r),a==us?delete this.queuedElements_[this.keyFunction_(r)]:(i[s]=a,e[s++]=r);e.length=s,i.length=s,this.heapify_()}}var fs=ds;class gs extends fs{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){const e=t[0];e.addEventListener(ci.CHANGE,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===ls.LOADED||i===ls.ERROR||i===ls.EMPTY){i!==ls.ERROR&&e.removeEventListener(ci.CHANGE,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;while(this.tilesLoading_<t&&i<e&&this.getCount()>0){const t=this.dequeue()[0],e=t.getKey(),s=t.getState();s!==ls.IDLE||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}var ps=gs;function _s(t,e,i,s,n){if(!t||!(i in t.wantedTiles))return us;if(!t.wantedTiles[i][e.getKey()])return us;const r=t.viewState.center,o=s[0]-r[0],a=s[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}var ms={ANIMATING:0,INTERACTING:1},ys={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function vs(t,e,i){return Math.min(Math.max(t,e),i)}function xs(t,e,i,s,n,r){const o=n-i,a=r-s;if(0!==o||0!==a){const h=((t-i)*o+(e-s)*a)/(o*o+a*a);h>1?(i=n,s=r):h>0&&(i+=o*h,s+=a*h)}return ws(t,e,i,s)}function ws(t,e,i,s){const n=i-t,r=s-e;return n*n+r*r}function Es(t){const e=t.length;for(let s=0;s<e;s++){let i=s,n=Math.abs(t[s][s]);for(let o=s+1;o<e;o++){const e=Math.abs(t[o][s]);e>n&&(n=e,i=o)}if(0===n)return null;const r=t[i];t[i]=t[s],t[s]=r;for(let o=s+1;o<e;o++){const i=-t[o][s]/t[s][s];for(let n=s;n<e+1;n++)s==n?t[o][n]=0:t[o][n]+=i*t[s][n]}}const i=new Array(e);for(let s=e-1;s>=0;s--){i[s]=t[s][e]/t[s][s];for(let n=s-1;n>=0;n--)t[n][e]-=t[n][s]*i[s]}return i}function Ms(t){return 180*t/Math.PI}function Ss(t){return t*Math.PI/180}function Cs(t,e){const i=t%e;return i*e<0?i+e:i}function bs(t,e,i){return t+i*(e-t)}function Ps(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Rs(t,e){return Math.floor(Ps(t,e))}function Is(t,e){return Math.ceil(Ps(t,e))}function Ts(t,e,i){if(t>=e&&t<i)return t;const s=i-e;return((t-e)%s+s)%s+e}function As(t,e,i){return function(s,n,r,o,a){if(!s)return;if(!n&&!e)return s;const h=e?0:r[0]*(n??0),l=e?0:r[1]*(n??0),c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,f=t[2]-h/2+c,g=t[1]+l/2+u,p=t[3]-l/2+u;d>f&&(d=(f+d)/2,f=d),g>p&&(g=(p+g)/2,p=g);let _=vs(s[0],d,f),m=vs(s[1],g,p);if(o&&i&&n){const t=30*n;_+=-t*Math.log(1+Math.max(0,d-s[0])/t)+t*Math.log(1+Math.max(0,s[0]-f)/t),m+=-t*Math.log(1+Math.max(0,g-s[1])/t)+t*Math.log(1+Math.max(0,s[1]-p)/t)}return[_,m]}}function Gs(t){return t}var Os={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Ls(t){const e=Ws();for(let i=0,s=t.length;i<s;++i)$s(e,t[i]);return e}function Ns(t,e,i){const s=Math.min.apply(null,t),n=Math.min.apply(null,e),r=Math.max.apply(null,t),o=Math.max.apply(null,e);return Xs(s,n,r,o,i)}function ks(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 Fs(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Ds(t,e,i){let s,n;return s=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,n=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,s*s+n*n}function js(t,e){return Us(t,e[0],e[1])}function zs(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Us(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Bs(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=e[0],a=e[1];let h=Os.UNKNOWN;return o<i?h|=Os.LEFT:o>n&&(h|=Os.RIGHT),a<s?h|=Os.BELOW:a>r&&(h|=Os.ABOVE),h===Os.UNKNOWN&&(h=Os.INTERSECTING),h}function Ws(){return[1/0,1/0,-1/0,-1/0]}function Xs(t,e,i,s,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=s,n):[t,e,i,s]}function Vs(t){return Xs(1/0,1/0,-1/0,-1/0,t)}function qs(t,e){const i=t[0],s=t[1];return Xs(i,s,i,s,e)}function Ys(t,e,i,s,n){const r=Vs(n);return Zs(r,t,e,i,s)}function Ks(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Hs(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 $s(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 Zs(t,e,i,s,n){for(;i<s;i+=n)Js(t,e[i],e[i+1]);return t}function Js(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 Qs(t,e){let i;return i=e(en(t)),i||(i=e(sn(t)),i||(i=e(dn(t)),i||(i=e(un(t)),i||!1)))}function tn(t){let e=0;return pn(t)||(e=fn(t)*hn(t)),e}function en(t){return[t[0],t[1]]}function sn(t){return[t[2],t[1]]}function nn(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function rn(t,e){let i;if("bottom-left"===e)i=en(t);else if("bottom-right"===e)i=sn(t);else if("top-left"===e)i=un(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=dn(t)}return i}function on(t,e,i,s,n){const[r,o,a,h,l,c,u,d]=an(t,e,i,s);return Xs(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),n)}function an(t,e,i,s){const n=e*s[0]/2,r=e*s[1]/2,o=Math.cos(i),a=Math.sin(i),h=n*o,l=n*a,c=r*o,u=r*a,d=t[0],f=t[1];return[d-h+u,f-l-c,d-h-u,f-l+c,d+h-u,f+l+c,d+h+u,f+l-c,d-h+u,f-l-c]}function hn(t){return t[3]-t[1]}function ln(t,e,i){const s=i||Ws();return gn(t,e)?(t[0]>e[0]?s[0]=t[0]:s[0]=e[0],t[1]>e[1]?s[1]=t[1]:s[1]=e[1],t[2]<e[2]?s[2]=t[2]:s[2]=e[2],t[3]<e[3]?s[3]=t[3]:s[3]=e[3]):Vs(s),s}function cn(t,e){if(!gn(t,e))return[t.slice()];if(zs(e,t))return[];const[i,s,n,r]=t,o=Math.max(i,e[0]),a=Math.max(s,e[1]),h=Math.min(n,e[2]),l=Math.min(r,e[3]),c=[];return o>i&&c.push([i,s,o,r]),h<n&&c.push([h,s,n,r]),a>s&&c.push([o,s,h,a]),l<r&&c.push([o,l,h,r]),c}function un(t){return[t[0],t[3]]}function dn(t){return[t[2],t[3]]}function fn(t){return t[2]-t[0]}function gn(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function pn(t){return t[2]<t[0]||t[3]<t[1]}function _n(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function mn(t,e,i){let s=!1;const n=Bs(t,e),r=Bs(t,i);if(n===Os.INTERSECTING||r===Os.INTERSECTING)s=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],f=i[1],g=(f-u)/(d-c);let p,_;r&Os.ABOVE&&!(n&Os.ABOVE)&&(p=d-(f-l)/g,s=p>=o&&p<=h),s||!(r&Os.RIGHT)||n&Os.RIGHT||(_=f-(d-h)*g,s=_>=a&&_<=l),s||!(r&Os.BELOW)||n&Os.BELOW||(p=d-(f-a)/g,s=p>=o&&p<=h),s||!(r&Os.LEFT)||n&Os.LEFT||(_=f-(d-o)*g,s=_>=a&&_<=l)}return s}function yn(t,e,i,s){if(pn(t))return Vs(i);let n=[];if(void 0!==s&&s>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<s;++r)n.push(t[0]+e*r/s,t[1],t[2],t[1]+i*r/s,t[2]-e*r/s,t[3],t[0],t[3]-i*r/s)}else n=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(n,n,2);const r=[],o=[];for(let a=0,h=n.length;a<h;a+=2)r.push(n[a]),o.push(n[a+1]);return Ns(r,o,i)}function vn(t,e){const i=e.getExtent(),s=nn(t);if(e.canWrapX()&&(s[0]<i[0]||s[0]>=i[2])){const e=fn(i),n=Math.floor((s[0]-i[0])/e),r=n*e;t[0]-=r,t[2]-=r}return t}function xn(t,e,i){if(e.canWrapX()){const s=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[s[0],t[1],s[2],t[3]]];vn(t,e);const n=fn(s);if(fn(t)>n&&!i)return[[s[0],t[1],s[2],t[3]]];if(t[0]<s[0])return[[t[0]+n,t[1],s[2],t[3]],[s[0],t[1],t[2],t[3]]];if(t[2]>s[2])return[[t[0],t[1],s[2],t[3]],[s[0],t[1],t[2]-n,t[3]]]}return[t]}function wn(t,e){let i=[t];for(let s=0,n=e.length;s<n&&i.length>0;++s){const t=[];for(let n=0,r=i.length;n<r;++n)t.push(...cn(i[n],e[s]));i=t}return i}function En(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Mn(t,e){let i=!0;for(let s=t.length-1;s>=0;--s)if(t[s]!=e[s]){i=!1;break}return i}function Sn(t,e){const i=Math.cos(e),s=Math.sin(e),n=t[0]*i-t[1]*s,r=t[1]*i+t[0]*s;return t[0]=n,t[1]=r,t}function Cn(t,e){return t[0]*=e,t[1]*=e,t}function bn(t,e){if(e.canWrapX()){const i=fn(e.getExtent()),s=Rn(t,e,i);s&&(t[0]-=s*i)}return t}function Pn(t,e,i){if(e.canWrapX()){const s=fn(e.getExtent()),n=Math.round((i-t[0])/s);0!==n&&(t[0]+=n*s)}return t}function Rn(t,e,i){const s=e.getExtent();let n=0;return e.canWrapX()&&(t[0]<s[0]||t[0]>s[2])&&(i=i||fn(s),n=Math.floor((t[0]-s[0])/i)),n}function In(t,e,i){const s=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),n=[(e[0]-t[0])/s,(e[1]-t[1])/s],r=[-n[1],n[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let h=0===s||0===o?0:Math.acos(vs(a[0]*n[0]+a[1]*n[1],-1,1));h=Math.max(h,1e-5);const l=a[0]*r[0]+a[1]*r[1]>0;return l?h:2*Math.PI-h}function Tn(t){return Math.pow(t,3)}function An(t){return 1-Tn(1-t)}function Gn(t){return 3*t*t-2*t*t*t}function On(t){return t}const Ln={info:1,warn:2,error:3,none:4};let Nn=Ln.info;function kn(...t){Nn>Ln.warn||console.warn(...t)}const Fn={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Dn{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Fn[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}var jn=Dn;const zn=6378137,Un=Math.PI*zn,Bn=[-Un,-Un,Un,Un],Wn=[-180,-85,180,85],Xn=zn*Math.log(Math.tan(Math.PI/2));class Vn extends jn{constructor(t){super({code:t,units:"m",extent:Bn,global:!0,worldExtent:Wn,getPointResolution:function(t,e){return t/Math.cosh(e[1]/zn)}})}}const qn=[new Vn("EPSG:3857"),new Vn("EPSG:102100"),new Vn("EPSG:102113"),new Vn("EPSG:900913"),new Vn("http://www.opengis.net/def/crs/EPSG/0/3857"),new Vn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Yn(t,e,i,s){const n=t.length;i=void 0!==i&&i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=s){e[r]=Un*t[r]/180;let i=zn*Math.log(Math.tan(Math.PI*(+t[r+1]+90)/360));i>Xn?i=Xn:i<-Xn&&(i=-Xn),e[r+1]=i}return e}function Kn(t,e,i,s){const n=t.length;i=void 0!==i&&i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=s)e[r]=180*t[r]/Un,e[r+1]=360*Math.atan(Math.exp(t[r+1]/zn))/Math.PI-90;return e}const Hn=6378137,$n=[-180,-90,180,90],Zn=Math.PI*Hn/180;class Jn extends jn{constructor(t,e){super({code:t,units:"degrees",extent:$n,axisOrientation:e,global:!0,metersPerUnit:Zn,worldExtent:$n})}}const Qn=[new Jn("CRS:84"),new Jn("EPSG:4326","neu"),new Jn("urn:ogc:def:crs:OGC:1.3:CRS84"),new Jn("urn:ogc:def:crs:OGC:2:84"),new Jn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Jn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Jn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let tr={};function er(t){return tr[t]||tr[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function ir(t,e){tr[t]=e}let sr={};function nr(t,e,i){const s=t.getCode(),n=e.getCode();s in sr||(sr[s]={}),sr[s][n]=i}function rr(t,e){return t in sr&&e in sr[t]?sr[t][e]:null}const or=.9996,ar=.00669438,hr=ar*ar,lr=hr*ar,cr=ar/(1-ar),ur=Math.sqrt(1-ar),dr=(1-ur)/(1+ur),fr=dr*dr,gr=fr*dr,pr=gr*dr,_r=pr*dr,mr=1-ar/4-3*hr/64-5*lr/256,yr=3*ar/8+3*hr/32+45*lr/1024,vr=15*hr/256+45*lr/1024,xr=35*lr/3072,wr=1.5*dr-27/32*gr+269/512*_r,Er=21/16*fr-55/32*pr,Mr=151/96*gr-417/128*_r,Sr=1097/512*pr,Cr=6378137;function br(t,e,i){const s=t-5e5,n=i.north?e:e-1e7,r=n/or,o=r/(Cr*mr),a=o+wr*Math.sin(2*o)+Er*Math.sin(4*o)+Mr*Math.sin(6*o)+Sr*Math.sin(8*o),h=Math.sin(a),l=h*h,c=Math.cos(a),u=h/c,d=u*u,f=d*d,g=1-ar*l,p=Math.sqrt(1-ar*l),_=Cr/p,m=(1-ar)/g,y=cr*c**2,v=y*y,x=s/(_*or),w=x*x,E=w*x,M=E*x,S=M*x,C=S*x,b=a-u/m*(w/2-M/24*(5+3*d+10*y-4*v-9*cr))+C/720*(61+90*d+298*y+45*f-252*cr-3*v);let P=(x-E/6*(1+2*d+y)+S/120*(5-2*y+28*d-3*v+8*cr+24*f))/c;return P=Ts(P+Ss(Gr(i.number)),-Math.PI,Math.PI),[Ms(P),Ms(b)]}const Pr=-80,Rr=84,Ir=-180,Tr=180;function Ar(t,e,i){t=Ts(t,Ir,Tr),e<Pr?e=Pr:e>Rr&&(e=Rr);const s=Ss(e),n=Math.sin(s),r=Math.cos(s),o=n/r,a=o*o,h=a*a,l=Ss(t),c=Gr(i.number),u=Ss(c),d=Cr/Math.sqrt(1-ar*n**2),f=cr*r**2,g=r*Ts(l-u,-Math.PI,Math.PI),p=g*g,_=p*g,m=_*g,y=m*g,v=y*g,x=Cr*(mr*s-yr*Math.sin(2*s)+vr*Math.sin(4*s)-xr*Math.sin(6*s)),w=or*d*(g+_/6*(1-a+f)+y/120*(5-18*a+h+72*f-58*cr))+5e5;let E=or*(x+d*o*(p/2+m/24*(5-a+9*f+4*f**2)+v/720*(61-58*a+h+600*f-330*cr)));return i.north||(E+=1e7),[w,E]}function Gr(t){return 6*(t-1)-180+3}const Or=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Lr(t){let e=0;for(const n of Or){const i=t.match(n);if(i){e=parseInt(i[1]);break}}if(!e)return null;let i=0,s=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(s=!0,i=e-32600),i?{number:i,north:s}:null}function Nr(t,e){return function(i,s,n,r){const o=i.length;n=void 0!==n&&n>1?n:2,r=r??n,s||(s=n>2?i.slice():new Array(o));for(let a=0;a<o;a+=r){const n=i[a],r=i[a+1],o=t(n,r,e);s[a]=o[0],s[a+1]=o[1]}return s}}function kr(t){const e=Lr(t);return e?new jn({code:t,units:"m"}):null}function Fr(t){const e=Lr(t.getCode());return e?{forward:Nr(Ar,e),inverse:Nr(br,e)}:null}const Dr=6371008.8;function jr(t,e,i){i=i||Dr;const s=Ss(t[1]),n=Ss(e[1]),r=(n-s)/2,o=Ss(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(s)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const zr=[Fr],Ur=[kr];let Br=!0;function Wr(t){const e=void 0===t||t;Br=!e}function Xr(t,e){if(void 0!==e)for(let i=0,s=t.length;i<s;++i)e[i]=t[i];else e=t.slice();return e}function Vr(t,e){if(void 0!==e&&t!==e){for(let i=0,s=t.length;i<s;++i)e[i]=t[i];t=e}return t}function qr(t){ir(t.getCode(),t),nr(t,t,Xr)}function Yr(t){t.forEach(qr)}function Kr(t){if("string"!==typeof t)return void 0!==t?t:null;const e=er(t);if(e)return e;for(const i of Ur){const e=i(t);if(e)return e}return null}function Hr(t,e,i,s){const n=Kr(t);if(!n)return e;let r;const o=n.getPointResolutionFunc();if(o){if(r=o(e,i),s&&s!==n.getUnits()){const t=n.getMetersPerUnit();t&&(r=r*t/Fn[s])}}else{const t=n.getUnits();if("degrees"==t&&!s||"degrees"==s)r=e;else{const o=no(n,Kr("EPSG:4326"));if(o||"degrees"===t){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];o&&(t=o(t,t,2));const s=jr(t.slice(0,2),t.slice(2,4)),n=jr(t.slice(4,6),t.slice(6,8));r=(s+n)/2}else r=e*(n.getMetersPerUnit()??1);const a=s?Fn[s]:n.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function $r(t){Yr(t),t.forEach(function(e){t.forEach(function(t){e!==t&&nr(e,t,Xr)})})}function Zr(t,e,i,s){t.forEach(function(t){e.forEach(function(e){nr(t,e,i),nr(e,t,s)})})}function Jr(t,e){return t?"string"===typeof t?Kr(t):t:Kr(e)}function Qr(t){return function(e,i,s,n){const r=e.length;s=void 0!==s?s:2,n=n??s,i=void 0!==i?i:new Array(r);for(let o=0;o<r;o+=n){const r=t(e.slice(o,o+s)),a=r.length;for(let t=0,s=n;t<s;++t)i[o+t]=t>=a?e[o+t]:r[t]}return i}}function to(t,e,i,s){const n=Kr(t),r=Kr(e);n&&r&&(nr(n,r,Qr(i)),nr(r,n,Qr(s)))}function eo(t,e){return Wr(),ao(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function io(t,e){const i=ao(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),s=i[0];return(s<-180||s>180)&&(i[0]=Cs(s+180,360)-180),i}function so(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;const s=no(t,e);return s===Xr&&i}function no(t,e){if(!t||!e)return null;const i=t.getCode(),s=e.getCode();let n=rr(i,s);if(n)return n;let r=null,o=null;for(const h of zr)r||(r=h(t)),o||(o=h(e));if(!r&&!o)return null;const a="EPSG:4326";if(!o&&r){const t=rr(a,s);t&&(n=ro(r.inverse,t))}else if(!r&&o){const t=rr(i,a);t&&(n=ro(t,o.forward))}else r&&o&&(n=ro(r.inverse,o.forward));return n&&(qr(t),qr(e),nr(t,e,n)),n}function ro(t,e){return function(i,s,n,r){return s=t(i,s,n,r),e(s,s,n,r)}}function oo(t,e){const i=Kr(t),s=Kr(e);return no(i,s)}function ao(t,e,i){const s=oo(e,i);if(!s){const t=Kr(e)?.getCode()??String(e),s=Kr(i)?.getCode()??String(i);throw new Error(`No transform available between ${t} and ${s}`)}return s(t,void 0,t.length)}function ho(t,e,i,s){const n=oo(e,i);return n?yn(t,n,void 0,s):t.slice()}let lo=null;function co(){return lo}function uo(t,e){return lo?ao(t,e,lo):t}function fo(t,e){return lo?ao(t,lo,e):(Br&&!Mn(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Br=!1,kn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function go(t,e){return lo?ho(t,e,lo):t}function po(t,e){return lo?ho(t,lo,e):t}function _o(t,e){if(!lo)return t;const i=Kr(e)?.getMetersPerUnit(),s=lo.getMetersPerUnit();return i&&s?t*i/s:t}function mo(t,e,i){return function(s){let n,r;if(t.canWrapX()){const e=t.getExtent(),o=fn(e);s=s.slice(0),r=Rn(s,t,o),r&&(s[0]=s[0]-r*o),s[0]=vs(s[0],e[0],e[2]),s[1]=vs(s[1],e[1],e[3]),n=i(s)}else n=i(s);return r&&e.canWrapX()&&(n[0]+=r*fn(e.getExtent())),n}}function yo(){$r(qn),$r(Qn),Zr(Qn,qn,Yn,Kn)}yo();const vo=[1,0,0,1,0,0];new Array(6);function xo(){return vo.slice(0)}function wo(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 Eo(t,e){const i=e[0],s=e[1];return e[0]=t[0]*i+t[2]*s+t[4],e[1]=t[1]*i+t[3]*s+t[5],e}function Mo(t,e,i,s,n,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=s*l,t[1]=n*h,t[2]=-s*h,t[3]=n*l,t[4]=o*s*l-a*s*h+e,t[5]=o*n*h+a*n*l+i,t}function So(t,e){const i=Co(e);cs(0!==i,"Transformation matrix cannot be inverted");const s=e[0],n=e[1],r=e[2],o=e[3],a=e[4],h=e[5];return t[0]=o/i,t[1]=-n/i,t[2]=-r/i,t[3]=s/i,t[4]=(r*h-o*a)/i,t[5]=-(s*h-n*a)/i,t}function Co(t){return t[0]*t[3]-t[1]*t[2]}const bo=[1e5,1e5,1e5,1e5,2,2];function Po(t){const e="matrix("+t.join(", ")+")";return e}function Ro(t){const e=t.substring(7,t.length-1).split(",");return e.map(parseFloat)}function Io(t,e){const i=Ro(t),s=Ro(e);for(let n=0;n<6;++n)if(0!==Math.round((i[n]-s[n])*bo[n]))return!1;return!0}function To(t,e,i,s,n,r,o){r=r||[],o=o||2;let a=0;for(let h=e;h<i;h+=s){const e=t[h],i=t[h+1];r[a++]=n[0]*e+n[2]*i+n[4],r[a++]=n[1]*e+n[3]*i+n[5];for(let s=2;s<o;s++)r[a++]=t[h+s]}return r&&r.length!=a&&(r.length=a),r}function Ao(t,e,i,s,n,r,o){o=o||[];const a=Math.cos(n),h=Math.sin(n),l=r[0],c=r[1];let u=0;for(let d=e;d<i;d+=s){const e=t[d]-l,i=t[d+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let n=d+2;n<d+s;++n)o[u++]=t[n]}return o&&o.length!=u&&(o.length=u),o}function Go(t,e,i,s,n,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let u=e;u<i;u+=s){const e=t[u]-h,i=t[u+1]-l;a[c++]=h+n*e,a[c++]=l+r*i;for(let n=u+2;n<u+s;++n)a[c++]=t[n]}return a&&a.length!=c&&(a.length=c),a}function Oo(t,e,i,s,n,r,o){o=o||[];let a=0;for(let h=e;h<i;h+=s){o[a++]=t[h]+n,o[a++]=t[h+1]+r;for(let e=h+2;e<h+s;++e)o[a++]=t[e]}return o&&o.length!=a&&(o.length=a),o}const Lo=xo(),No=[NaN,NaN];class ko extends ji{constructor(){super(),this.extent_=Ws(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Ri((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return wi()}closestPointXY(t,e,i,s){return wi()}containsXY(t,e){return 0===this.closestPointXY(t,e,No,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return wi()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Vs(t),this.extentRevision_=this.getRevision()}return _n(this.extent_,t)}rotate(t,e){wi()}scale(t,e,i){wi()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return wi()}getType(){return wi()}applyTransform(t){wi()}intersectsExtent(t){return wi()}translate(t,e){wi()}transform(t,e){const i=Kr(t);if(!i)return this;const s="tile-pixels"==i.getUnits()?function(t,s,n){const r=i.getExtent(),o=i.getWorldExtent(),a=hn(o)/hn(r);Mo(Lo,o[0],o[3],a,-a,0,0,0);const h=To(t,0,t.length,n,Lo,s),l=oo(i,e);return l?l(h,h,n):h}:oo(i,e);return s&&this.applyTransform(s),this}}var Fo=ko;class Do extends Fo{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Ys(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return wi()}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),i=e.getFlatCoordinates();return i.length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=zo(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){wi()}setLayout(t,e,i){let s;if(t)s=zo(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}s=e.length,t=jo(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Ao(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=nn(this.getExtent()));const s=this.getFlatCoordinates();if(s){const n=this.getStride();Go(s,0,s.length,n,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Oo(i,0,i.length,s,t,e,i),this.changed()}}}function jo(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function zo(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Uo(t,e,i){const s=t.getFlatCoordinates();if(!s)return null;const n=t.getStride();return To(s,0,s.length,n,e,i)}var Bo=Do;function Wo(t,e,i,s){let n=0;const r=t[i-s],o=t[i-s+1];let a=0,h=0;for(;e<i;e+=s){const i=t[e]-r,s=t[e+1]-o;n+=h*i-a*s,a=i,h=s}return n/2}function Xo(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Wo(t,e,o,s),e=o}return n}function Vo(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Xo(t,e,o,s),e=o[o.length-1]}return n}function qo(t,e,i,s,n,r,o){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((n-a)*l+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let n=0;n<s;++n)o[n]=bs(t[e+n],t[i+n],d);return void(o.length=s)}u=e}}for(let d=0;d<s;++d)o[d]=t[u+d];o.length=s}function Yo(t,e,i,s,n){let r=t[e],o=t[e+1];for(e+=s;e<i;e+=s){const i=t[e],s=t[e+1],a=ws(r,o,i,s);a>n&&(n=a),r=i,o=s}return n}function Ko(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Yo(t,e,o,s,n),e=o}return n}function Ho(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Ko(t,e,o,s,n),e=o[o.length-1]}return n}function $o(t,e,i,s,n,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===n){if(d=ws(o,a,t[e],t[e+1]),d<l){for(u=0;u<s;++u)h[u]=t[e+u];return h.length=s,d}return l}c=c||[NaN,NaN];let f=e+s;while(f<i)if(qo(t,f-s,f,s,o,a,c),d=ws(o,a,c[0],c[1]),d<l){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s,f+=s}else f+=s*Math.max((Math.sqrt(d)-Math.sqrt(l))/n|0,1);if(r&&(qo(t,i-s,e,s,o,a,c),d=ws(o,a,c[0],c[1]),d<l)){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s}return l}function Zo(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=$o(t,e,d,s,n,r,o,a,h,l,c),e=d}return l}function Jo(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=Zo(t,e,d,s,n,r,o,a,h,l,c),e=d[d.length-1]}return l}function Qo(t,e,i,s){for(let n=0;n<s;++n)t[e++]=i[n];return e}function ta(t,e,i,s){for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0;i<s;++i)t[e++]=r[i]}return e}function ea(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ta(t,e,i[o],s);n[r++]=a,e=a}return n.length=r,n}function ia(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ea(t,e,i[o],s,n[r]);0===a.length&&(a[0]=e),n[r++]=a,e=a[a.length-1]}return n.length=r,n}function sa(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=e;o<i;o+=s)n[r++]=t.slice(o,o+s);return n.length=r,n}function na(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=sa(t,e,a,s,n[r]),e=a}return n.length=r,n}function ra(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=1===a.length&&a[0]===e?[]:na(t,e,a,s,n[r]),e=a[a.length-1]}return n.length=r,n}function oa(t,e,i,s,n){const r=Qs(n,function(n){return!aa(t,e,i,s,n[0],n[1])});return!r}function aa(t,e,i,s,n,r){let o=0,a=t[i-s],h=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];h<=r?s>r&&(i-a)*(r-h)-(n-a)*(s-h)>0&&o++:s<=r&&(i-a)*(r-h)-(n-a)*(s-h)<0&&o--,a=i,h=s}return 0!==o}function ha(t,e,i,s,n,r){if(0===i.length)return!1;if(!aa(t,e,i[0],s,n,r))return!1;for(let o=1,a=i.length;o<a;++o)if(aa(t,i[o-1],i[o],s,n,r))return!1;return!0}function la(t,e,i,s,n,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(ha(t,e,a,s,n,r))return!0;e=a[a.length-1]}return!1}function ca(t,e,i,s,n){let r;for(e+=s;e<i;e+=s)if(r=n(t.slice(e-s,e),t.slice(e,e+s)),r)return r;return!1}function ua(t,e,i,s,n,r){return r=r??Zs(Ws(),t,e,i,s),!!gn(n,r)&&(r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||ca(t,e,i,s,function(t,e){return mn(n,t,e)}))}function da(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){if(ua(t,e,i[r],s,n))return!0;e=i[r]}return!1}function fa(t,e,i,s,n){return!!ua(t,e,i,s,n)||(!!aa(t,e,i,s,n[0],n[1])||(!!aa(t,e,i,s,n[0],n[3])||(!!aa(t,e,i,s,n[2],n[1])||!!aa(t,e,i,s,n[2],n[3]))))}function ga(t,e,i,s,n){if(!fa(t,e,i[0],s,n))return!1;if(1===i.length)return!0;for(let r=1,o=i.length;r<o;++r)if(oa(t,i[r-1],i[r],s,n)&&!ua(t,i[r-1],i[r],s,n))return!1;return!0}function pa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(ga(t,e,o,s,n))return!0;e=o[o.length-1]}return!1}function _a(t,e,i,s,n,r,o){const a=(i-e)/s;if(a<3){for(;e<i;e+=s)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-s];let c=0;while(l.length>0){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],f=t[i+1];for(let e=r+s;e<i;e+=s){const i=t[e],s=t[e+1],n=xs(i,s,a,u,d,f);n>o&&(c=e,o=n)}o>n&&(h[(c-e)/s]=1,r+s<c&&l.push(r,c),c+s<i&&l.push(c,i))}for(let u=0;u<a;++u)h[u]&&(r[o++]=t[e+u*s],r[o++]=t[e+u*s+1]);return o}function ma(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=_a(t,e,l,s,n,r,o),a.push(o),e=l}return o}function ya(t,e){return e*Math.round(t/e)}function va(t,e,i,s,n,r,o){if(e==i)return o;let a,h,l=ya(t[e],n),c=ya(t[e+1],n);e+=s,r[o++]=l,r[o++]=c;do{if(a=ya(t[e],n),h=ya(t[e+1],n),e+=s,e==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);while(e<i){const i=ya(t[e],n),u=ya(t[e+1],n);if(e+=s,i==a&&u==h)continue;const d=a-l,f=h-c,g=i-l,p=u-c;d*p==f*g&&(d<0&&g<d||d==g||d>0&&g>d)&&(f<0&&p<f||f==p||f>0&&p>f)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function xa(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=va(t,e,l,s,n,r,o),a.push(o),e=l}return o}function wa(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h],c=[];o=xa(t,e,l,s,n,r,o,c),a.push(c),e=l[l.length-1]}return o}class Ea extends Bo{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new Ea(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$o(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=_a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Ea(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var Ma=Ea;class Sa extends Bo{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Sa(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const n=this.flatCoordinates,r=ws(t,e,n[0],n[1]);if(r<s){const t=this.stride;for(let e=0;e<t;++e)i[e]=n[e];return i.length=t,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return qs(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Us(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qo(this.flatCoordinates,0,t,this.stride),this.changed()}}var Ca=Sa;function ba(t,e,i,s,n,r,o){let a,h,l,c,u,d,f;const g=n[r+1],p=[];for(let y=0,v=i.length;y<v;++y){const n=i[y];for(c=t[n-s],d=t[n-s+1],a=e;a<n;a+=s)u=t[a],f=t[a+1],(g<=d&&f<=g||d<=g&&g<=f)&&(l=(g-d)/(f-d)*(u-c)+c,p.push(l)),c=u,d=f}let _=NaN,m=-1/0;for(p.sort(gi),c=p[0],a=1,h=p.length;a<h;++a){u=p[a];const n=Math.abs(u-c);n>m&&(l=(c+u)/2,ha(t,e,i,s,l,g)&&(_=l,m=n)),c=u}return isNaN(_)&&(_=n[r]),o?(o.push(_,g,m),o):[_,g,m]}function Pa(t,e,i,s,n){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=ba(t,e,a,s,n,2*o,r),e=a[a.length-1]}return r}function Ra(t,e,i,s){while(e<i-s){for(let n=0;n<s;++n){const r=t[e+n];t[e+n]=t[i-s+n],t[i-s+n]=r}e+=s,i-=s}}function Ia(t,e,i,s){let n=0,r=t[i-s],o=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];n+=(i-r)*(s+o),r=i,o=s}return 0===n?void 0:n>0}function Ta(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ia(t,e,o,s);if(0===r){if(n&&a||!n&&!a)return!1}else if(n&&!a||!n&&a)return!1;e=o}return!0}function Aa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!Ta(t,e,o,s,n))return!1;o.length&&(e=o[o.length-1])}return!0}function Ga(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ia(t,e,o,s),h=0===r?n&&a||!n&&!a:n&&!a||!n&&a;h&&Ra(t,e,o,s),e=o}return e}function Oa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=Ga(t,e,i[r],s,n);return e}function La(t,e){const i=[];let s,n=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],h=Ia(t,n,a,2);if(void 0===s&&(s=h),h===s)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,n=a}return i}class Na extends Bo{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?yi(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new Na(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ko(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return ha(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Xo(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Ga(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,na(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=nn(this.getExtent());this.flatInteriorPoint_=ba(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ca(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Ma(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new Ma(e.slice(n,o),t);s.push(a),n=o}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ta(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Ga(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=xa(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new Na(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return ga(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ea(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var ka=Na;function Fa(t){if(pn(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],s=t[2],n=t[3],r=[e,i,e,n,s,n,s,i,e,i];return new Na(r,"XY",[r.length])}function Da(t,e,i,s){const n=fn(e)/i[0],r=hn(e)/i[1];return s?Math.min(t,Math.max(n,r)):Math.min(t,Math.min(n,r))}function ja(t,e,i){let s=Math.min(t,e);const n=50;return s*=Math.log(1+n*Math.max(0,t/e-1))/n+1,i&&(s=Math.max(s,i),s/=Math.log(1+n*Math.max(0,i/t-1))/n+1),vs(s,i/2,2*e)}function za(t,e,i,s){return e=void 0===e||e,function(n,r,o,a){if(void 0!==n){const h=t[0],l=t[t.length-1],c=i?Da(h,i,o,!!s):h;if(a)return e?ja(n,c,l):vs(n,l,c);const u=Math.min(c,n),d=Math.floor(_i(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}function Ua(t,e,i,s,n,r){return s=void 0===s||s,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=n?Da(e,n,h,!!r):e;if(l)return s?ja(o,c,i):vs(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),f=-a*(.5-u)+.5,g=Math.min(c,o),p=Math.floor(Math.log(e/g)/Math.log(t)+f),_=Math.max(d,p),m=e/Math.pow(t,_);return vs(m,i,c)}}}function Ba(t,e,i,s,n){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=s?Da(t,s,a,!!n):t;return i&&h?ja(r,o,e):vs(r,e,o)}}}function Wa(t){if(void 0!==t)return 0}function Xa(t){if(void 0!==t)return t}function Va(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?(t=Math.floor(t/e+.5)*e,t):void 0}}function qa(t){const e=void 0===t?Ss(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}const Ya=0;class Ka extends ji{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Jr(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&Wr(),t.center&&(t.center=fo(t.center,this.projection_)),t.extent&&(t.extent=po(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const o in ys)delete e[o];this.setProperties(e,!0);const i=Za(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=$a(t),n=i.constraint,r=Ja(t);this.constraints_={center:s,resolution:n,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.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const n=this.getResolution(),r=n/2*(s[3]-e[3]+e[1]-s[1]),o=n/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(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 i=0;i<e.length;++i){let t=arguments[i];t.center&&(t=Object.assign({},t),t.center=fo(t.center,this.getProjection())),t.anchor&&(t=Object.assign({},t),t.anchor=fo(t.anchor,this.getProjection())),e[i]=t}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 s=0;for(;s<i&&!this.isDef();++s){const t=arguments[s];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(s===i)return void(e&&Ha(e,!0));let n=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const h=[];for(;s<i;++s){const t=arguments[s],i={start:n,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Gn,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=a;const e=Cs(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Qa(i)?i.complete=!0:n+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(ms.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ms.ANIMATING]>0}getInteracting(){return this.hints_[ms.INTERACTING]>0}cancelAnimations(){let t;this.setHint(ms.ANIMATING,-this.hints_[ms.ANIMATING]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Ha(i[0].callback,!1),!t)for(let e=0,s=i.length;e<s;++e){const s=i[e];if(!s.complete){t=s.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let n=!0;for(let i=0,r=s.length;i<r;++i){const r=s[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):n=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],s=r.targetCenter[1];this.nextCenter_=r.targetCenter;const n=t+h*(i-t),o=e+h*(s-e);this.targetCenter_=[n,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?Cs(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(n){this.animations_[i]=null,this.setHint(ms.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=s[0].callback;t&&Ha(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return void 0!==s&&(i=[s[0]-e[0],s[1]-e[1]],Sn(i,t-this.getRotation()),En(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),n=this.getResolution();if(void 0!==s&&void 0!==n){const r=e[0]-t*(e[0]-s[0])/n,o=e[1]-t*(e[1]-s[1])/n;i=[r,o]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?uo(t,this.getProjection()):t}getCenterInternal(){return this.get(ys.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return go(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();cs(e,"The view center is not defined");const i=this.getResolution();cs(void 0!==i,"The view resolution is not defined");const s=this.getRotation();return cs(void 0!==s,"The view rotation is not defined"),on(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ys.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(po(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=fn(t)/e[0],s=hn(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return function(i){const n=e/Math.pow(t,i*s);return n}}getRotation(){return this.get(ys.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,n=Math.log(i/s)/e;return function(t){const s=Math.log(i/t)/e/n;return s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const n=this.padding_;if(n){const t=this.getViewportSizeMinusPadding_();s=th(s,this.getViewportSize_(),[t[0]/2+n[3],t[1]/2+n[0]],e,i)}return{center:s.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,s=this.minZoom_||0;if(this.resolutions_){const n=_i(this.resolutions_,t,1);s=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;return s+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=vs(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,vs(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(cs(Array.isArray(t)||"function"===typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){cs(!pn(t),"Cannot fit empty extent provided as `geometry`");const e=po(t,this.getProjection());i=Fa(e)}else if("Circle"===t.getType()){const e=po(t.getExtent(),this.getProjection());i=Fa(e),i.rotate(this.getRotation(),nn(e))}else{const e=co();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),n=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=n.length;c<u;c+=r){const t=n[c]*i-n[c+1]*s,e=n[c]*s+n[c+1]*i;o=Math.min(o,t),a=Math.min(a,e),h=Math.max(h,t),l=Math.max(l,e)}return[o,a,h,l]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=void 0!==e.padding?e.padding:[0,0,0,0],n=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 a=this.getResolutionForExtentInternal(o,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,n?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=nn(o);u[0]+=(s[1]-s[3])/2*a,u[1]+=(s[0]-s[2])/2*a;const d=u[0]*c-u[1]*l,f=u[1]*c+u[0]*l,g=this.getConstrainedCenter([d,f],a),p=e.callback?e.callback:Pi;void 0!==e.duration?this.animateInternal({resolution:a,center:g,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=g,this.applyTargetState_(!1,!0),Ha(p,!0))}centerOn(t,e,i){this.centerOnInternal(fo(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(th(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let n;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=th(t,s,[o[0]/2+r[3],o[1]/2+r[0]],e,i);n=[t[0]-a[0],t[1]-a[1]]}return n}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=uo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&fo(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(n,e)),this.targetResolution_=this.targetResolution_*t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=fo(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_=this.targetRotation_+t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?fo(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),n=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,n,i),o=this.constraints_.center(this.targetCenter_,r,n,i,this.calculateCenterShift(this.targetCenter_,r,s,n));this.get(ys.ROTATION)!==s&&this.set(ys.ROTATION,s),this.get(ys.RESOLUTION)!==r&&(this.set(ys.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ys.CENTER)&&Mn(this.get(ys.CENTER),o)||this.set(ys.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const s=e||0,n=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,s,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,n,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=n,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===n&&this.getCenterInternal()&&Mn(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:a,resolution:o,duration:t,easing:An,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ms.INTERACTING,1)}endInteraction(t,e,i){i=i&&fo(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ms.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.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.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Ha(t,e){setTimeout(function(){t(e)},0)}function $a(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return As(t.extent,t.constrainOnlyCenter,e)}const e=Jr(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,As(t,!1,!1)}return Gs}function Za(t){let e,i,s;const n=28,r=2;let o=void 0!==t.minZoom?t.minZoom:Ya,a=void 0!==t.maxZoom?t.maxZoom:n;const h=void 0!==t.zoomFactor?t.zoomFactor:r,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Jr(t.projection,"EPSG:3857"),f=d.getExtent();let g=t.constrainOnlyCenter,p=t.extent;if(l||p||!d.isGlobal()||(g=!1,p=f),void 0!==t.resolutions){const n=t.resolutions;i=n[o],s=void 0!==n[a]?n[a]:n[n.length-1],e=t.constrainResolution?za(n,c,!g&&p,u):Ba(i,s,c,!g&&p,u)}else{const l=f?Math.max(fn(f),hn(f)):360*Fn.degrees/d.getMetersPerUnit(),_=l/256/Math.pow(r,Ya),m=_/Math.pow(r,n-Ya);i=t.maxResolution,void 0!==i?o=0:i=_/Math.pow(h,o),s=t.minResolution,void 0===s&&(s=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):_/Math.pow(h,a):m),a=o+Math.floor(Math.log(i/s)/Math.log(h)),s=i/Math.pow(h,a-o),e=t.constrainResolution?Ua(h,i,s,c,!g&&p,u):Ba(i,s,c,!g&&p,u)}return{constraint:e,maxResolution:i,minResolution:s,minZoom:o,zoomFactor:h}}function Ja(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?qa():!1===e?Xa:"number"===typeof e?Va(e):Xa}return Wa}function Qa(t){return!(t.sourceCenter&&t.targetCenter&&!Mn(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function th(t,e,i,s,n){const r=Math.cos(-n);let o=Math.sin(-n),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*s,h+=(i[1]-e[1]/2)*s,o=-o;const l=a*r-h*o,c=h*r+a*o;return[l,c]}var eh=Ka;Le();const ih="ol-hidden",sh="ol-unselectable",nh="ol-unsupported",rh="ol-control",oh="ol-collapsed",ah=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-z0-9]+?)\\s*$"].join(""),"i"),hh=["style","variant","weight","size","lineHeight","family"],lh={normal:400,bold:700},ch=function(t){const e=t.match(ah);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let s=0,n=hh.length;s<n;++s){const t=e[s+1];void 0!==t&&(i[hh[s]]="string"===typeof t?t.trim():t)}return isNaN(Number(i.weight))&&i.weight in lh&&(i.weight=lh[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function uh(t){return uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(t)}function dh(t,e){if("object"!=uh(t)||!t)return t;var i;if("undefined"!=typeof Symbol&&void 0!==(i=t[Symbol.toPrimitive])){var s=i.call(t,e||"default");if("object"!=uh(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function fh(t){var e=dh(t,"string");return"symbol"==uh(e)?e:e+""}function gh(t,e,i){return(e=fh(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ph(t,e,i,s){let n;return n=i&&i.length?i.shift():ts?new class extends OffscreenCanvas{constructor(...t){super(...t),gh(this,"style",{})}}(t??300,e??150):document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e),n.getContext("2d",s)}let _h;function mh(){return _h||(_h=ph(1,1)),_h}function yh(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function vh(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function xh(t){while(t.lastChild)t.lastChild.remove()}function wh(t,e){const i=t.childNodes;for(let s=0;1;++s){const n=i[s],r=e[s];if(!n&&!r)break;n!==r&&(n?r?t.insertBefore(r,n):(t.removeChild(n),--s):t.appendChild(r))}}function Eh(){const t=new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}});return t}function Mh(t){return"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class Sh extends ji{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)li(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e&&e.appendChild(this.element),this.render!==Pi&&this.listenerKeys.push(ai(t,as.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"===typeof t?document.getElementById(t):t}}var Ch=Sh;class bh extends Ch{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",s=void 0!==t.expandClassName?t.expandClassName:e+"-expand",n=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"===typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n,this.collapseLabel_.className=r):this.collapseLabel_=n;const o=void 0!==t.label?t.label:"i";"string"===typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=s):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+sh+" "+rh+(this.collapsed_&&this.collapsible_?" "+oh:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap();if(!e)return[];const i=e.getAllLayers(),s=new Set(i.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>s.add(t)):s.add(this.attributions_)),!this.overrideCollapsible_){const t=!i.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(s)}async updateElement_(t){const e=this.element;if(!e)return;if(!t)return void(this.renderedVisible_&&(e.style.display="none",this.renderedVisible_=!1));const i=await Promise.all(this.collectSourceAttributions_(t).map(t=>Ii(()=>t))),s=i.length>0;if(this.renderedVisible_!=s&&(e.style.display=s?"":"none",this.renderedVisible_=s),!vi(i,this.renderedAttributions_)){xh(this.ulElement_);for(let t=0,e=i.length;t<e;++t){const e=document.createElement("li");e.innerHTML=i[t],this.ulElement_.appendChild(e)}this.renderedAttributions_=i}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){const t=this.element;t&&(t.classList.toggle(oh),this.collapsed_?vh(this.collapseLabel_,this.label_):vh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)))}getCollapsible(){return this.collapsible_}setCollapsible(t){if(this.collapsible_===t)return;this.collapsible_=t;const e=this.element;e&&(e.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}var Ph=bh;class Rh extends Ch{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:"⇧",s=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_,"string"===typeof i?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const n=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=n,r.appendChild(this.label_),r.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1);const o=e+" "+sh+" "+rh,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(ih)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=e.getRotation();void 0!==i&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:An}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)",e=this.element;if(this.autoHide_&&e){const t=e.classList.contains(ih);t||0!==i?t&&0!==i&&e.classList.remove(ih):e.classList.add(ih)}this.label_.style.transform=t}this.rotation_=i}}var Ih=Rh;class Th extends Ch{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,s=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",n=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=a,l.appendChild("string"===typeof r?document.createTextNode(r):r),l.addEventListener(ci.CLICK,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"===typeof o?document.createTextNode(o):o),c.addEventListener(ci.CLICK,this.handleClick_.bind(this,-i),!1);const u=e+" "+sh+" "+rh,d=this.element;d.className=u,d.appendChild(l),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap();if(!e)return;const i=e.getView();if(!i)return;const s=i.getZoom();if(void 0!==s){const e=i.getConstrainedZoom(s+t);if(void 0===e)return;this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:An})):i.setZoom(e)}}}var Ah=Th;function Gh(t){t=t||{};const e=new Wi,i=void 0===t.zoom||t.zoom;i&&e.push(new Ah(t.zoomOptions));const s=void 0===t.rotate||t.rotate;s&&e.push(new Ih(t.rotateOptions));const n=void 0===t.attribution||t.attribution;return n&&e.push(new Ph(t.attributionOptions)),e}class Oh{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;while(i>0&&this.points_[i+2]>t)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const n=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,n),this.initialVelocity_=Math.sqrt(n*n+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Lh=Oh,Nh={ACTIVE:"active"};class kh extends ji{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(Nh.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(Nh.ACTIVE,t)}setMap(t){this.map_=t}}function Fh(t,e,i){const s=t.getCenterInternal();if(s){const n=[s[0]+e[0],s[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:On,center:t.getConstrainedCenter(n)})}}function Dh(t,e,i,s){const n=t.getZoom();if(void 0===n)return;const r=t.getConstrainedZoom(n+e);if(void 0===r)return;const o=t.getResolutionForZoom(r);void 0!==o&&(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==s?s:250,easing:An}))}var jh=kh;class zh extends jh{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Ki.DBLCLICK){const i=t.originalEvent,s=t.map,n=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_,o=s.getView();Dh(o,r,n,this.duration_),i.preventDefault(),e=!0}return!e}}var Uh=zh;function Bh(t){const e=arguments;return function(t){let i=!0;for(let s=0,n=e.length;s<n;++s)if(i=i&&e[s](t),!i)break;return i}}const Wh=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Xh=function(t){const e=t.map.getTargetElement();if(!e)return!1;const i=e.getRootNode(),s=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(s):e.contains(s)},Vh=function(t){const e=t.map.getTargetElement();if(!e)return!0;const i=e.getRootNode(),s=i instanceof ShadowRoot?i.host:e;return!s.hasAttribute("tabindex")||Xh(t)},qh=Ci,Yh=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(Zi&&Ji&&e.ctrlKey)},Kh=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Hh=function(t){const e=t.originalEvent;return Ji?e.metaKey:e.ctrlKey},$h=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Zh=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Jh=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},Qh=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};class tl extends jh{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Ki.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Ki.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Ki.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Ki.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function el(t){const e=t.length;let i=0,s=0;for(let n=0;n<e;n++)i+=t[n].clientX,s+=t[n].clientY;return{clientX:i/e,clientY:s/e}}var il=tl;class sl extends il{constructor(t){super({stopDown:bi}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Bh(Kh,Qh);this.condition_=t.onFocusOnly?Bh(Vh,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(el(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const e=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],i=t.map,n=i.getView(),r=n.getResolution();void 0!==r&&(Cn(e,r),Sn(e,n.getRotation()),n.adjustCenterInternal(e))}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),n=i.getCenterInternal();if(n){const r=e.getPixelFromCoordinateInternal(n),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(s),r[1]-t*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:An})}}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map,i=e.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}var nl=sl;class rl extends il{constructor(t){t=t||{},super({stopDown:bi}),this.condition_=t.condition?t.condition:Wh,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Jh(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Wa)return;const s=e.getSize();if(!s)return;const n=t.pixel,r=Math.atan2(s[1]/2-n[1],n[0]-s[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Jh(t))return!0;const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}handleDownEvent(t){if(!Jh(t))return!1;if(Yh(t)&&this.condition_(t)){const e=t.map;return e.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var ol=rl;class al extends di{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_;if(!t||!e)return;const i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){const t=this.map_.getOverlayContainer();t&&t.removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}if(this.map_=t,this.map_){const t=this.map_.getOverlayContainer();t&&t.appendChild(this.element_)}}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_;if(!t||!e)return;const i=[t,[t[0],e[1]],e,[e[0],t[1]]],s=this.map_,n=i.map(t=>s.getCoordinateFromPixelInternal(t)),r=n[0];if(!r)return;n[4]=r.slice();const o=n;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new ka([o])}getGeometry(){return this.geometry_}}var hl=al;const ll={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class cl extends Ai{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class ul extends il{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new hl(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Yh,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],n=i[1]-e[1];return s*s+n*n>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new cl(ll.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new cl(e?ll.BOXEND:ll.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new cl(ll.BOXSTART,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cl(ll.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){const e=this.getMap();e&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cl(ll.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}var dl=ul;class fl extends dl{constructor(t){t=t||{};const e=t.condition?t.condition:$h;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap();if(!e)return;const i=e.getView();let s=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(s),e=i.getResolutionForExtentInternal(t),n=i.getResolution();if(void 0===e||void 0===n)return;const r=n/e;s=s.clone(),s.scale(r*r)}i.fitInternal(s,{duration:this.duration_,easing:An})}}var gl=fl,pl={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class _l extends jh{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Kh(t)&&Zh(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==ci.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==pl.DOWN||s==pl.LEFT||s==pl.RIGHT||s==pl.UP)){const n=t.map,r=n.getView(),o=r.getResolution();if(void 0===o)return!0;const a=o*this.pixelDelta_;let h=0,l=0;s==pl.DOWN?l=-a:s==pl.LEFT?h=-a:s==pl.RIGHT?h=a:l=a;const c=[h,l];Sn(c,r.getRotation()),Fh(r,c,this.duration_),i.preventDefault(),e=!0}}return!e}}var ml=_l;class yl extends jh{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!Hh(t)&&Zh(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==ci.KEYDOWN||t.type==ci.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&("+"===s||"-"===s)){const n=t.map,r="+"===s?this.delta_:-this.delta_,o=n.getView();Dh(o,r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var vl=yl;const xl=40,wl=300,El=3;class Ml extends jh{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:qh;this.condition_=t.onFocusOnly?Bh(Vh,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0)}handleEvent(t){if(!this.condition_(t))return!0;const e=t.type;if(e!==ci.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault();const n=s.ctrlKey&&!t.ctrlKey;this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=xl;break;case WheelEvent.DOM_DELTA_PAGE:r*=wl;break;default:}if(0===r)return!1;this.lastDelta_=r;const o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),n&&(r*=El),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=o,!1;this.totalDelta_+=r;const h=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),h),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-vs(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Dh(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Sl=Ml;class Cl extends il{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=bi),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],n=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=n-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=n;const r=t.map,o=r.getView();o.getConstraints().rotation!==Wa&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(el(this.targetPointers)))??null,this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_??void 0)))}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var bl=Cl;class Pl extends il{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=bi),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],n=i.clientX-s.clientX,r=i.clientY-s.clientY,o=Math.sqrt(n*n+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(el(this.targetPointers)))??null,a.render(),h.adjustResolutionInternal(e,this.anchor_??void 0)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var Rl=Pl;function Il(t){t=t||{};const e=new Wi,i=new Lh(-.005,.05,100),s=void 0===t.altShiftDragRotate||t.altShiftDragRotate;s&&e.push(new ol);const n=void 0===t.doubleClickZoom||t.doubleClickZoom;n&&e.push(new Uh({delta:t.zoomDelta,duration:t.zoomDuration}));const r=void 0===t.dragPan||t.dragPan;r&&e.push(new nl({onFocusOnly:t.onFocusOnly,kinetic:i}));const o=void 0===t.pinchRotate||t.pinchRotate;o&&e.push(new bl);const a=void 0===t.pinchZoom||t.pinchZoom;a&&e.push(new Rl({duration:t.zoomDuration}));const h=void 0===t.keyboard||t.keyboard;h&&(e.push(new ml),e.push(new vl({delta:t.zoomDelta,duration:t.zoomDuration})));const l=void 0===t.mouseWheelZoom||t.mouseWheelZoom;l&&e.push(new Sl({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));const c=void 0===t.shiftDragZoom||t.shiftDragZoom;return c&&e.push(new gl({duration:t.zoomDuration})),e}var Tl={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class Al extends ji{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"===typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Tl.OPACITY]=void 0!==t.opacity?t.opacity:1,cs("number"===typeof e[Tl.OPACITY],"Layer opacity must be a number"),e[Tl.VISIBLE]=void 0===t.visible||t.visible,e[Tl.Z_INDEX]=t.zIndex,e[Tl.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Tl.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[Tl.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[Tl.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=vs(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return wi()}getLayerStatesArray(t){return wi()}getExtent(){return this.get(Tl.EXTENT)}getMaxResolution(){return this.get(Tl.MAX_RESOLUTION)}getMinResolution(){return this.get(Tl.MIN_RESOLUTION)}getMinZoom(){return this.get(Tl.MIN_ZOOM)}getMaxZoom(){return this.get(Tl.MAX_ZOOM)}getOpacity(){return this.get(Tl.OPACITY)}getSourceState(){return wi()}getVisible(){return this.get(Tl.VISIBLE)}getZIndex(){return this.get(Tl.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Tl.EXTENT,t)}setMaxResolution(t){this.set(Tl.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Tl.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Tl.MAX_ZOOM,t)}setMinZoom(t){this.set(Tl.MIN_ZOOM,t)}setOpacity(t){cs("number"===typeof t,"Layer opacity must be a number"),this.set(Tl.OPACITY,t)}setVisible(t){this.set(Tl.VISIBLE,t)}setZIndex(t){this.set(Tl.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var Gl=Al;const Ol={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Ll extends Ai{constructor(t,e){super(t),this.layer=e}}const Nl={LAYERS:"layers"};class kl extends Gl{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Nl.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Wi(i.slice(),{unique:!0}):cs("function"===typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Wi(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(ai(t,si.ADD,this.handleLayersAdd_,this),ai(t,si.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(li);ri(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const t=e[i];this.registerLayerListeners_(t),this.dispatchEvent(new Ll(Ol.ADDLAYER,t))}this.changed()}registerLayerListeners_(t){const e=[ai(t,ni.PROPERTYCHANGE,this.handleLayerChange_,this),ai(t,ci.CHANGE,this.handleLayerChange_,this)];t instanceof kl&&e.push(ai(t,Ol.ADDLAYER,this.handleLayerGroupAdd_,this),ai(t,Ol.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Mi(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Ll(Ol.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Ll(Ol.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Ll(Ol.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=Mi(e);this.listenerKeys_[i].forEach(li),delete this.listenerKeys_[i],this.dispatchEvent(new Ll(Ol.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(Nl.LAYERS)}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 Ll(Ol.REMOVELAYER,t[e]))}this.set(Nl.LAYERS,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 s=this.getLayerState();let n=s.zIndex;t||void 0!==s.zIndex||(n=0);for(let r=i,o=e.length;r<o;r++){const t=e[r];t.opacity*=s.opacity,t.visible=t.visible&&s.visible,t.maxResolution=Math.min(t.maxResolution,s.maxResolution),t.minResolution=Math.max(t.minResolution,s.minResolution),t.minZoom=Math.max(t.minZoom,s.minZoom),t.maxZoom=Math.min(t.maxZoom,s.maxZoom),void 0!==s.extent&&(void 0!==t.extent?t.extent=ln(t.extent,s.extent):t.extent=s.extent),void 0===t.zIndex&&(t.zIndex=n)}return e}getSourceState(){return"ready"}}var Fl=kl,Dl={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class jl extends Gl{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Tl.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Tl.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed();const t=this.getSource();t&&!this.sourceReady_&&"ready"===t.getState()&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=ai(t,ci.CHANGE,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),e=t instanceof eh?{viewState:t.getState(),extent:t.calculateExtent()}:t;const s=e;let n;if(!s.layerStatesArray&&i&&(s.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),s.layerStatesArray){if(n=s.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return zl(n,s.viewState)&&(!r||gn(r,s.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof eh?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Tl.MAP,t)}getMapInternal(){return this.get(Tl.MAP)}setMap(t){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=ai(t,Dl.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=ai(this,ci.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState?.layerStatesArray;if(!e)return;const i=this.getLayerState(!1);cs(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Tl.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function zl(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const s=e.zoom;return s>t.minZoom&&s<=t.maxZoom}var Ul=jl;function Bl(t,e,i=0,s=t.length-1,n=Xl){while(s>i){if(s-i>600){const r=s-i+1,o=e-i+1,a=Math.log(r),h=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*h*(r-h)/r)*(o-r/2<0?-1:1),c=Math.max(i,Math.floor(e-o*h/r+l)),u=Math.min(s,Math.floor(e+(r-o)*h/r+l));Bl(t,e,c,u,n)}const r=t[e];let o=i,a=s;Wl(t,i,e),n(t[s],r)>0&&Wl(t,i,s);while(o<a){Wl(t,o,a),o++,a--;while(n(t[o],r)<0)o++;while(n(t[a],r)>0)a--}0===n(t[i],r)?Wl(t,i,a):(a++,Wl(t,a,s)),a<=e&&(i=a+1),e<=a&&(s=a-1)}}function Wl(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function Xl(t,e){return t<e?-1:t>e?1:0}class Vl{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!sc(t,e))return i;const s=this.toBBox,n=[];while(e){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?s(o):o;sc(t,a)&&(e.leaf?i.push(o):ic(t,a)?this._all(o,i):n.push(o))}e=n.pop()}return i}collides(t){let e=this.data;if(!sc(t,e))return!1;const i=[];while(e){for(let s=0;s<e.children.length;s++){const n=e.children[s],r=e.leaf?this.toBBox(n):n;if(sc(t,r)){if(e.leaf||ic(t,r))return!0;i.push(n)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=nc([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],r=[];let o,a,h;while(i||n.length){if(i||(i=n.pop(),a=n[n.length-1],o=r.pop(),h=!0),i.leaf){const s=ql(t,i.children,e);if(-1!==s)return i.children.splice(s,1),n.push(i),this._condense(n),this}h||i.leaf||!ic(i,s)?a?(o++,i=a.children[o],h=!1):i=null:(n.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];while(t)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const n=i-e+1;let r,o=this._maxEntries;if(n<=o)return r=nc(t.slice(e,i+1)),Yl(r,this.toBBox),r;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),r=nc([]),r.leaf=!1,r.height=s;const a=Math.ceil(n/o),h=a*Math.ceil(Math.sqrt(o));rc(t,e,i,h,this.compareMinX);for(let l=e;l<=i;l+=h){const e=Math.min(l+h-1,i);rc(t,l,e,a,this.compareMinY);for(let i=l;i<=e;i+=a){const n=Math.min(i+a-1,e);r.children.push(this._build(t,i,n,s-1))}}return Yl(r,this.toBBox),r}_chooseSubtree(t,e,i,s){while(1){if(s.push(e),e.leaf||s.length-1===i)break;let n,r=1/0,o=1/0;for(let i=0;i<e.children.length;i++){const s=e.children[i],a=Jl(s),h=tc(t,s)-a;h<o?(o=h,r=a<r?a:r,n=s):h===o&&a<r&&(r=a,n=s)}e=n||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),n=[],r=this._chooseSubtree(s,this.data,e,n);r.children.push(t),Hl(r,s);while(e>=0){if(!(n[e].children.length>this._maxEntries))break;this._split(n,e),e--}this._adjustParentBBoxes(s,n,e)}_split(t,e){const i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);const r=this._chooseSplitIndex(i,n,s),o=nc(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Yl(i,this.toBBox),Yl(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=nc([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Yl(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,n=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Kl(t,0,o,this.toBBox),a=Kl(t,o,i,this.toBBox),h=ec(e,a),l=Jl(e)+Jl(a);h<n?(n=h,s=o,r=l<r?l:r):h===n&&l<r&&(r=l,s=o)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:$l,n=t.leaf?this.compareMinY:Zl,r=this._allDistMargin(t,e,i,s),o=this._allDistMargin(t,e,i,n);r<o&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,r=Kl(t,0,e,n),o=Kl(t,i-e,i,n);let a=Ql(r)+Ql(o);for(let h=e;h<i-e;h++){const e=t.children[h];Hl(r,t.leaf?n(e):e),a+=Ql(r)}for(let h=i-e-1;h>=e;h--){const e=t.children[h];Hl(o,t.leaf?n(e):e),a+=Ql(o)}return a}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Hl(e[s],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Yl(t[i],this.toBBox)}}function ql(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function Yl(t,e){Kl(t,0,t.children.length,e,t)}function Kl(t,e,i,s,n){n||(n=nc(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Hl(n,t.leaf?s(e):e)}return n}function Hl(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 $l(t,e){return t.minX-e.minX}function Zl(t,e){return t.minY-e.minY}function Jl(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ql(t){return t.maxX-t.minX+(t.maxY-t.minY)}function tc(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function ec(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,r-s)}function ic(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function sc(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function nc(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rc(t,e,i,s,n){const r=[e,i];while(r.length){if(i=r.pop(),e=r.pop(),i-e<=s)continue;const o=e+Math.ceil((i-e)/s/2)*s;Bl(t,o,e,i,n),r.push(e,o,o,i)}}const oc=[NaN,NaN,NaN,0];let ac;function hc(){return ac||(ac=ph(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),ac}const lc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function fc(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function gc(t){throw new Error('failed to parse "'+t+'" as color')}function pc(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(cc)||t.match(lc)||t.match(uc);if(e){const t=e[4],i=100/255;return[vs(fc(e[1],i)+.5|0,0,255),vs(fc(e[2],i)+.5|0,0,255),vs(fc(e[3],i)+.5|0,0,255),void 0!==t?vs(fc(t,100),0,1):1]}gc(t)}if(t.startsWith("#")){if(dc.test(t)){const e=t.substring(1),i=e.length<=4?1:2,s=[0,0,0,255];for(let t=0,n=e.length;t<n;t+=i){let n=parseInt(e.substring(t,t+i),16);1===i&&(n+=n<<4),s[t/i]=n}return s[3]=s[3]/255,s}gc(t)}const e=hc();e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&gc(t));const s=e.fillStyle;if(s.startsWith("#")||s.startsWith("rgba"))return pc(s);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const n=Array.from(e.getImageData(0,0,1,1).data);return n[3]=Ps(n[3]/255,3),n}function _c(t){return"string"===typeof t?t:Ic(t)}const mc=1024,yc={};let vc=0;function xc(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function wc(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Ec(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function Mc(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Sc(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Cc(t){const e=Mc(t[0]),i=Mc(t[1]),s=Mc(t[2]),n=Sc(.222488403*e+.716873169*i+.06060791*s),r=500*(Sc(.452247074*e+.399439023*i+.148375274*s)-n),o=200*(n-Sc(.016863605*e+.117638439*i+.865350722*s)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function bc(t){const e=(t[0]+16)/116,i=t[1],s=t[2]*Math.PI/180,n=Ec(e),r=Ec(e+i/500*Math.cos(s)),o=Ec(e-i/200*Math.sin(s)),a=wc(3.021973625*r-1.617392459*n-.404875592*o),h=wc(-.943766287*r+1.916279586*n+.027607165*o),l=wc(.069407491*r-.22898585*n+1.159737864*o);return[vs(a+.5|0,0,255),vs(h+.5|0,0,255),vs(l+.5|0,0,255),t[3]]}function Pc(t){if("none"===t)return oc;if(yc.hasOwnProperty(t))return yc[t];if(vc>=mc){let t=0;for(const e in yc)0===(3&t++)&&(delete yc[e],--vc)}const e=pc(t);4!==e.length&&gc(t);for(const i of e)isNaN(i)&&gc(t);return yc[t]=e,++vc,e}function Rc(t){return Array.isArray(t)?t:Pc(t)}function Ic(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let s=t[2];s!=(0|s)&&(s=s+.5|0);const n=void 0===t[3]?1:Math.round(1e3*t[3])/1e3;return"rgba("+e+","+i+","+s+","+n+")"}function Tc(t){return t[0]>0&&t[1]>0}function Ac(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 Gc(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Oc=0;const Lc=0,Nc=1<<Oc++,kc=1<<Oc++,Fc=1<<Oc++,Dc=1<<Oc++,jc=1<<Oc++,zc=1<<Oc++,Uc=Math.pow(2,Oc)-1,Bc={[Nc]:"boolean",[kc]:"number",[Fc]:"string",[Dc]:"color",[jc]:"number[]",[zc]:"size"},Wc=Object.keys(Bc).map(Number).sort(gi);function Xc(t){return t in Bc}function Vc(t){const e=[];for(const i of Wc)qc(t,i)&&e.push(Bc[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qc(t,e){return(t&e)===e}function Yc(t,e){return!!(t&e)}function Kc(t,e){return t===e}function Hc(t){return t instanceof Error?t.message:String(t)}class $c{constructor(t,e){if(!Xc(t))throw new Error(`literal expressions must have a specific type, got ${Vc(t)}`);this.type=t,this.value=e}}class Zc{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Jc(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function Qc(t,e,i){switch(typeof t){case"boolean":if(Kc(e,Fc))return new $c(Fc,t?"true":"false");if(!qc(e,Nc))throw new Error(`got a boolean, but expected ${Vc(e)}`);return new $c(Nc,t);case"number":if(Kc(e,zc))return new $c(zc,Gc(t));if(Kc(e,Nc))return new $c(Nc,!!t);if(Kc(e,Fc))return new $c(Fc,t.toString());if(!qc(e,kc))throw new Error(`got a number, but expected ${Vc(e)}`);return new $c(kc,t);case"string":if(Kc(e,Dc))return new $c(Dc,Pc(t));if(Kc(e,Nc))return new $c(Nc,!!t);if(!qc(e,Fc))throw new Error(`got a string, but expected ${Vc(e)}`);return new $c(Fc,t);default:}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"===typeof t[0])return Eu(t,e,i);for(const s of t)if("number"!==typeof s)throw new Error("expected an array of numbers");if(Kc(e,zc)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new $c(zc,t)}if(Kc(e,Dc)){if(3===t.length)return new $c(Dc,[...t,1]);if(4===t.length)return new $c(Dc,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qc(e,jc))throw new Error(`got an array of numbers, but expected ${Vc(e)}`);return new $c(jc,t)}const tu={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",InterpolateHcl:"interpolate-hcl",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},eu={[tu.Get]:wu(lu(1,1/0),iu),[tu.Var]:su(),[tu.Has]:wu(lu(1,1/0),iu),[tu.Id]:wu(nu,hu),[tu.Concat]:wu(lu(2,1/0),uu(Fc)),[tu.GeometryType]:wu(ru,hu),[tu.LineMetric]:wu(ou,hu),[tu.Resolution]:wu(au,hu),[tu.Zoom]:wu(au,hu),[tu.Time]:wu(au,hu),[tu.Any]:wu(lu(2,1/0),uu(Nc)),[tu.All]:wu(lu(2,1/0),uu(Nc)),[tu.Not]:wu(lu(1,1),uu(Nc)),[tu.Equal]:wu(lu(2,2),du()),[tu.NotEqual]:wu(lu(2,2),du()),[tu.GreaterThan]:wu(lu(2,2),uu(kc)),[tu.GreaterThanOrEqualTo]:wu(lu(2,2),uu(kc)),[tu.LessThan]:wu(lu(2,2),uu(kc)),[tu.LessThanOrEqualTo]:wu(lu(2,2),uu(kc)),[tu.Multiply]:wu(lu(2,1/0),cu),[tu.Coalesce]:wu(lu(2,1/0),cu),[tu.Divide]:wu(lu(2,2),uu(kc)),[tu.Add]:wu(lu(2,1/0),uu(kc)),[tu.Subtract]:wu(lu(2,2),uu(kc)),[tu.Clamp]:wu(lu(3,3),uu(kc)),[tu.Mod]:wu(lu(2,2),uu(kc)),[tu.Pow]:wu(lu(2,2),uu(kc)),[tu.Abs]:wu(lu(1,1),uu(kc)),[tu.Floor]:wu(lu(1,1),uu(kc)),[tu.Ceil]:wu(lu(1,1),uu(kc)),[tu.Round]:wu(lu(1,1),uu(kc)),[tu.Sin]:wu(lu(1,1),uu(kc)),[tu.Cos]:wu(lu(1,1),uu(kc)),[tu.Atan]:wu(lu(1,2),uu(kc)),[tu.Sqrt]:wu(lu(1,1),uu(kc)),[tu.Match]:wu(lu(4,1/0),gu,pu),[tu.Between]:wu(lu(3,3),uu(kc)),[tu.Interpolate]:wu(lu(6,1/0),gu,mu),[tu.InterpolateHcl]:wu(lu(6,1/0),gu,_u,mu),[tu.Case]:wu(lu(3,1/0),fu,yu),[tu.In]:wu(lu(2,2),vu),[tu.Number]:wu(lu(1,1/0),uu(Uc)),[tu.String]:wu(lu(1,1/0),uu(Uc)),[tu.Array]:wu(lu(1,1/0),uu(kc)),[tu.Color]:wu(lu(1,4),uu(kc)),[tu.Band]:wu(lu(1,3),uu(kc)),[tu.Palette]:wu(lu(2,2),xu),[tu.ToString]:wu(lu(1,1),uu(Nc|kc|Fc|Dc))};function iu(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=t[r+1];switch(typeof s){case"number":n[r]=new $c(kc,s);break;case"string":n[r]=new $c(Fc,s);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${s}`)}0===r&&i.properties.set(String(s),e)}return n}function su(){return function(t,e,i){const s=t[1];if("string"!==typeof s)throw new Error("expected a string argument for var operation");let n=e;const r=i.inputVariables?.[s];if(void 0!==r){const t=Qc(r,Uc,i);if(!(t instanceof $c))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${s}`);let o=t.type;if("string"===typeof r&&Yc(n,Dc)&&!Yc(n,Fc)?o=Dc:Array.isArray(r)&&2===r.length&&Yc(n,zc)&&!Yc(n,jc)&&(o=zc),n&=o,n===Lc)throw new Error(`the type expected from the var operator (${Vc(e)}) did not have any overlap with the type of the corresponding style variables (${Vc(o)}), variable name: ${s}`)}if(i.variables.has(s)){const t=i.variables.get(s);if(n&=t,n===Lc)throw new Error(`a new type expected from the var operator (${Vc(e)}) did not have any overlap with the previous type expected for it (${Vc(t)}), variable name: ${s}`)}return i.variables.set(s,n),new Zc(n,"var",new $c(Fc,s))}}function nu(t,e,i){i.featureId=!0}function ru(t,e,i){i.geometryType=!0}function ou(t,e,i){i.mCoordinate=!0}function au(t,e,i){i.mapState=!0}function hu(t,e,i){const s=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${s} operation`);return[]}function lu(t,e){return function(i,s,n){const r=i[0],o=i.length-1;if(t===e){if(o!==t){const e=1===t?"":"s";throw new Error(`expected ${t} argument${e} for ${r}, got ${o}`)}}else if(o<t||o>e){const i=e===1/0?`${t} or more`:`${t} to ${e}`;throw new Error(`expected ${i} arguments for ${r}, got ${o}`)}}}function cu(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=Qc(t[r+1],e,i);n[r]=s}return n}function uu(t){return function(e,i,s){const n=e.length-1,r=new Array(n);for(let o=0;o<n;++o){const i=Qc(e[o+1],t,s);r[o]=i}return r}}function du(){return function(t,e,i){const s=t[0],n=t.length-1,r=new Array(n);let o=Uc;for(let a=0;a<n;++a){const e=Qc(t[a+1],o,i);o&=e.type}if(o===Lc)throw new Error(`no common type was found among the arguments of ${s}`);for(let a=0;a<n;++a){const e=Qc(t[a+1],o,i);r[a]=e}return r}}function fu(t,e,i){const s=t[0],n=t.length-1;if(n%2===0)throw new Error(`expected an odd number of arguments for ${s}, got ${n} instead`)}function gu(t,e,i){const s=t[0],n=t.length-1;if(n%2===1)throw new Error(`expected an even number of arguments for operation ${s}, got ${n} instead`)}function pu(t,e,i){const s=t.length-1,n=Qc(t[t.length-1],e,i);let r=Fc|kc|Nc;const o=new Array(s-2);for(let l=0;l<s-2;l+=2){try{const e=Qc(t[l+2],r,i);r&=e.type}catch(h){const t=Hc(h);throw new Error(`failed to parse argument ${l+1} of match expression: ${t}`)}if(r===Lc)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<s-2;l+=2){try{const e=Qc(t[l+2],r,i);o[l]=e}catch(h){const t=Hc(h);throw new Error(`failed to parse argument ${l+1} of match expression: ${t}`)}try{const e=Qc(t[l+3],n.type,i);o[l+1]=e}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${Hc(h)}`)}}const a=Qc(t[1],r,i);return[a,...o,n]}function _u(t,e,i){if(!qc(e,Dc))throw new Error(`the ${t[0]} operator can only return a color, got ${Vc(e)}`)}function mu(t,e,i){const s=t[1];let n;switch(s[0]){case"linear":n=1;break;case"exponential":const t=s[1];if("number"!==typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);n=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(s)}`)}const r=new $c(kc,n);let o;try{o=Qc(t[2],kc,i)}catch(h){throw new Error(`failed to parse argument 1 in interpolate expression: ${Hc(h)}`)}const a=new Array(t.length-3);for(let l=0;l<a.length;l+=2){try{const e=Qc(t[l+3],kc,i);a[l]=e}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${Hc(h)}`)}try{const s=Qc(t[l+4],e,i);a[l+1]=s}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${Hc(h)}`)}}return[r,o,...a]}function yu(t,e,i){const s=Qc(t[t.length-1],e,i),n=new Array(t.length-1);for(let o=0;o<n.length-1;o+=2){try{const e=Qc(t[o+1],Nc,i);n[o]=e}catch(r){throw new Error(`failed to parse argument ${o} of case expression: ${Hc(r)}`)}try{const e=Qc(t[o+2],s.type,i);n[o+1]=e}catch(r){throw new Error(`failed to parse argument ${o+1} of case expression: ${Hc(r)}`)}}return n[n.length-1]=s,n}function vu(t,e,i){let s,n=t[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');if("literal"===n[0]){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"===typeof n[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');s="string"===typeof n[0]?Fc:kc;const r=new Array(n.length);for(let h=0;h<r.length;h++)try{const t=Qc(n[h],s,i);r[h]=t}catch(a){throw new Error(`failed to parse haystack item ${h} for "in" expression: ${Hc(a)}`)}const o=Qc(t[1],s,i);return[o,...r]}function xu(t,e,i){let s;try{s=Qc(t[1],kc,i)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${Hc(o)}`)}const n=t[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let a=0;a<r.length;a++){let t;try{t=Qc(n[a],Dc,i)}catch(o){throw new Error(`failed to parse color at index ${a} in palette expression: ${Hc(o)}`)}if(!(t instanceof $c))throw new Error(`the palette color at index ${a} must be a literal value`);r[a]=t}return[s,...r]}function wu(...t){return function(e,i,s){const n=e[0];let r=[];for(let o=0;o<t.length;o++){const n=t[o](e,i,s);if(o==t.length-1){if(!n)throw new Error("expected last argument validator to return the parsed args");r=n}}return new Zc(i,n,...r)}}function Eu(t,e,i){const s=t[0],n=eu[s];if(!n)throw new Error(`unknown operator: ${s}`);return n(t,e,i)}function Mu(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Mu(t.getGeometries()[0]);default:return""}}function Su(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Cu(t,e,i){const s=Qc(t,e,i);return bu(s,i)}function bu(t,e){if(t instanceof $c){if(t.type===Dc&&"string"===typeof t.value){const e=Pc(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case tu.Number:case tu.String:case tu.Coalesce:return Iu(t,e);case tu.Get:case tu.Var:case tu.Has:return Tu(t,e);case tu.Id:return t=>t.featureId??"";case tu.GeometryType:return t=>t.geometryType;case tu.Concat:{const i=t.args.map(t=>bu(t,e));return t=>"".concat(...i.map(e=>(e(t)??"").toString()))}case tu.Resolution:return t=>t.resolution;case tu.Any:case tu.All:case tu.Between:case tu.In:case tu.Not:return Gu(t,e);case tu.Equal:case tu.NotEqual:case tu.LessThan:case tu.LessThanOrEqualTo:case tu.GreaterThan:case tu.GreaterThanOrEqualTo:return Au(t,e);case tu.Multiply:case tu.Divide:case tu.Add:case tu.Subtract:case tu.Clamp:case tu.Mod:case tu.Pow:case tu.Abs:case tu.Floor:case tu.Ceil:case tu.Round:case tu.Sin:case tu.Cos:case tu.Atan:case tu.Sqrt:return Ou(t,e);case tu.Case:return Lu(t,e);case tu.Match:return Nu(t,e);case tu.Interpolate:case tu.InterpolateHcl:return ku(t,e);case tu.ToString:return Fu(t,e);case tu.Array:return Pu(t,e);case tu.Color:return Ru(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Pu(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);if(t.type===Dc&&(3===i||4===i)){const t=4===i?s[3]:null;return e=>[255*s[0](e),255*s[1](e),255*s[2](e),t?t(e):1]}return t=>{const e=new Array(i);for(let n=0;n<i;++n)e[n]=s[n](t);return e}}function Ru(t,e){const i=t.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=bu(t.args[r],e);if(i<3){const t=2===i?s[1]:null;return e=>{const i=s[0](e);return[i,i,i,t?t(e):1]}}const n=4===i?s[3]:null;return t=>[s[0](t),s[1](t),s[2](t),n?n(t):1]}function Iu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Coalesce:return t=>{for(let e=0;e<s;++e){const i=n[e](t);if("undefined"!==typeof i&&null!==i)return i}throw new Error("Expected one of the values to be non-null")};case tu.Number:case tu.String:return t=>{for(let e=0;e<s;++e){const s=n[e](t);if(typeof s===i)return s}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}function Tu(t,e){const i=t.args[0],s=i.value;switch(t.operator){case tu.Get:return e=>{const i=t.args;let n=e.properties[s];for(let t=1,s=i.length;t<s;++t){const e=i[t],s=e.value;n=n[s]}return n};case tu.Var:return t=>t.variables[s];case tu.Has:return e=>{const i=t.args;if(!(s in e.properties))return!1;let n=e.properties[s];for(let t=1,s=i.length;t<s;++t){const e=i[t],s=e.value;if(!n||!Object.hasOwn(n,s))return!1;n=n[s]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}function Au(t,e){const i=t.operator,s=bu(t.args[0],e),n=bu(t.args[1],e);switch(i){case tu.Equal:return t=>s(t)===n(t);case tu.NotEqual:return t=>s(t)!==n(t);case tu.LessThan:return t=>s(t)<n(t);case tu.LessThanOrEqualTo:return t=>s(t)<=n(t);case tu.GreaterThan:return t=>s(t)>n(t);case tu.GreaterThanOrEqualTo:return t=>s(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}function Gu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Any:return t=>{for(let e=0;e<s;++e)if(n[e](t))return!0;return!1};case tu.All:return t=>{for(let e=0;e<s;++e)if(!n[e](t))return!1;return!0};case tu.Between:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case tu.In:return t=>{const e=n[0](t);for(let i=1;i<s;++i)if(e===n[i](t))return!0;return!1};case tu.Not:return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}function Ou(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Multiply:return t=>{let e=1;for(let i=0;i<s;++i)e*=n[i](t);return e};case tu.Divide:return t=>n[0](t)/n[1](t);case tu.Add:return t=>{let e=0;for(let i=0;i<s;++i)e+=n[i](t);return e};case tu.Subtract:return t=>n[0](t)-n[1](t);case tu.Clamp:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const s=n[2](t);return e>s?s:e};case tu.Mod:return t=>n[0](t)%n[1](t);case tu.Pow:return t=>Math.pow(n[0](t),n[1](t));case tu.Abs:return t=>Math.abs(n[0](t));case tu.Floor:return t=>Math.floor(n[0](t));case tu.Ceil:return t=>Math.ceil(n[0](t));case tu.Round:return t=>Math.round(n[0](t));case tu.Sin:return t=>Math.sin(n[0](t));case tu.Cos:return t=>Math.cos(n[0](t));case tu.Atan:return 2===s?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case tu.Sqrt:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}function Lu(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);return t=>{for(let e=0;e<i-1;e+=2){const i=s[e](t);if(i)return s[e+1](t)}return s[i-1](t)}}function Nu(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);return t=>{const e=s[0](t);for(let n=1;n<i-1;n+=2)if(e===s[n](t))return s[n+1](t);return s[i-1](t)}}function ku(t,e){const i=t.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=bu(t.args[r],e);const n=t.operator===tu.InterpolateHcl?zu:ju;return t=>{const e=s[0](t),r=s[1](t);let o,a;for(let h=2;h<i;h+=2){const i=s[h](t);let l=s[h+1](t);const c=Array.isArray(l);if(c&&(l=xc(l)),i>=r)return 2===h?l:c?n(e,r,o,a,i,l):Du(e,r,o,a,i,l);o=i,a=l}return a}}function Fu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.ToString:return e=>{const i=n[0](e);return t.args[0].type===Dc?Ic(i):i.toString()};default:throw new Error(`Unsupported convert operator ${i}`)}}function Du(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=e-i,h=1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1);return s+h*(r-s)}function ju(t,e,i,s,n,r){const o=n-i;return 0===o?s:[Du(t,e,i,s[0],n,r[0]),Du(t,e,i,s[1],n,r[1]),Du(t,e,i,s[2],n,r[2]),Du(t,e,i,s[3],n,r[3])]}function zu(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=Cc(s),h=Cc(r);let l=h[2]-a[2];l>180?l-=360:l<-180&&(l+=360);const c=[Du(t,e,i,a[0],n,h[0]),Du(t,e,i,a[1],n,h[1]),a[2]+Du(t,e,i,0,n,l),Du(t,e,i,s[3],n,r[3])];return bc(c)}var Uu={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Bu extends Oi{constructor(t,e,i,s){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"===typeof s?Uu.IDLE:s,this.image_=null,this.loader="function"===typeof s?s:null}changed(){this.dispatchEvent(ci.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Uu.IDLE){const t=this.loader;if(t){this.state=Uu.LOADING,this.changed();const e=this.getResolution(),i=Array.isArray(e)?e[0]:e;Ii(()=>t(this.getExtent(),i,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&t.extent&&(this.extent=t.extent),"resolution"in t&&void 0!==t.resolution&&(this.resolution=t.resolution),"pixelRatio"in t&&void 0!==t.pixelRatio&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||is&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Uu.LOADED}).catch(t=>{this.state=Uu.ERROR,console.error(t)}).finally(()=>this.changed())}}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Wu(t,e,i){const s=t;let n=!0,r=!1,o=!1;const a=[hi(s,ci.LOAD,function(){o=!0,r||e()})];return s.src&&es?(r=!0,s.decode().then(function(){n&&e()}).catch(function(t){n&&(o?e():i())})):a.push(hi(s,ci.ERROR,i)),function(){n=!1,a.forEach(li)}}function Xu(t,e){return new Promise((i,s)=>{function n(){o(),i(t)}function r(){o(),s(new Error("Image load error"))}function o(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r),e&&(t.src=e)})}function Vu(t,e){return e&&(t.src=e),t.src&&es?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(s=>t.complete&&t.width?e(t):i(s))):Xu(t)}function qu(t,e){return e&&(t.src=e),t.src&&es&&is?t.decode().then(()=>createImageBitmap(t)).catch(e=>{if(t.complete&&t.width)return t;throw e}):Vu(t)}var Yu=Bu;class Ku{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!==(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Hu(t,e),s=i in this.cache_?this.cache_[i]:null;return s}getPattern(t,e){const i=Hu(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const n=Hu(t,e),r=n in this.cache_;if(i&&(this.cache_[n]=i),s&&i)if(i.getImageState()===Uu.IDLE&&i.load(),i.getImageState()===Uu.LOADING)i.ready().then(()=>{const t=mh().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[n]=t)});else{const t=mh().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[n]=t)}r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Hu(t,e){const i=e?Rc(e):"null";return t+":"+i}const $u=new Ku;let Zu=null;class Ju extends Oi{constructor(t,e,i,s,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin??null,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=n,this.imageState_=void 0===s?Uu.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===Uu.LOADED){const t=this.image_;if(!t)return!1;Zu||(Zu=ph(1,1,void 0,{willReadFrequently:!0})),Zu.drawImage(t,0,0);try{Zu.getImageData(0,0,1,1),this.tainted_=!1}catch{Zu=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(ci.CHANGE)}handleImageError_(){this.imageState_=Uu.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Uu.LOADED;const t=this.image_;t&&"width"in t&&"height"in t&&(this.size_=[t.width,t.height]),this.dispatchChangeEvent_()}getImage(t){this.image_||this.initializeImage_(),this.replaceColor_(t);const e=this.image_;return this.canvas_[t]?this.canvas_[t]:e}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_;if(!t)return this.image_;const e=t[0],i=t[1],s=ph(e,i);s.fillRect(0,0,e,i),this.hitDetectionImage_=s.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Uu.IDLE){this.image_||this.initializeImage_(),this.imageState_=Uu.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Vu(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Uu.LOADED)return;const e=this.image_;if(!e)return;const i=ph(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=_c(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===Uu.LOADED||this.imageState_===Uu.ERROR)t();else{const e=()=>{this.imageState_!==Uu.LOADED&&this.imageState_!==Uu.ERROR||(this.removeEventListener(ci.CHANGE,e),t())};this.addEventListener(ci.CHANGE,e)}})),this.ready_}}function Qu(t,e,i,s,n,r){let o=void 0===e?void 0:$u.get(e,n);return o||(o=new Ju(t,t&&"src"in t?t.src||void 0:e,i,s,n),void 0!==e&&$u.set(e,n,o,r)),r&&o&&void 0!==e&&!$u.getPattern(e,n)&&$u.set(e,n,o,r),o}var td=Ju;function ed(t){return t?Array.isArray(t)?Ic(t):"object"===typeof t&&"src"in t?id(t):t:null}function id(t){if(!t.offset||!t.size)return $u.getPattern(t.src,t.color??null);const e=t.src+":"+t.offset,i=$u.getPattern(e,t.color??null);if(i)return i;const s=$u.get(t.src,null);if(!s||s.getImageState()!==Uu.LOADED)return null;const n=ph(t.size[0],t.size[1]);return n.drawImage(s.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Qu(n.canvas,e,{},Uu.LOADED,t.color??null,!0),$u.getPattern(e,t.color??null)}class sd{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Gc(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new sd({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return wi()}getImage(t){return wi()}getHitDetectionImage(){return wi()}getPixelRatio(t){return 1}getImageState(){return wi()}getImageSize(){return wi()}getOrigin(){return wi()}getSize(){return wi()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Gc(t)}listenImageChange(t){wi()}load(){wi()}unlistenImageChange(t){wi()}ready(){return Promise.resolve()}}var nd=sd;class rd extends nd{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.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Uu.LOADING:Uu.LOADED,this.imageState_===Uu.LOADING&&this.ready().then(()=>this.imageState_=Uu.LOADED),this.render()}clone(){const t=this.getScale(),e=new rd({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=$u.get(i,null)?.getImage(1);if(!s){const e=this.renderOptions_,n=Math.ceil(e.size*t),r=ph(n,n);this.draw_(e,r,t),s=r.canvas;const o=new td(s,void 0,{},Uu.LOADED,null);$u.set(i,null,o),createImageBitmap(s).then(t=>{o.setImage(t)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let s=this.radius,n=void 0===this.radius2_?s:this.radius2_;if(s<n){const t=s;s=n,n=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=n*Math.sin(o),h=Math.sqrt(n*n-a*a),l=s-h,c=Math.sqrt(a*a+l*l),u=c/a;if("miter"===t&&u<=i)return u*e;const d=e/2/u,f=e/2*(l/c),g=Math.sqrt((s+d)*(s+d)+f*f),p=g-s;if(void 0===this.radius2_||"bevel"===t)return 2*p;const _=s*Math.sin(o),m=Math.sqrt(s*s-_*_),y=n-m,v=Math.sqrt(_*_+y*y),x=v/_;if(x<=i){const t=x*e/2-n-s;return 2*Math.max(p,t)}return 2*p}createRenderOptions(){let t,e="round",i="round",s=0,n=null,r=0,o=0;this.stroke_&&(t=ed(this.stroke_.getColor()??"#000"),o=this.stroke_.getWidth()??1,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??"round",e=this.stroke_.getLineCap()??"round",s=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,s),h=Math.max(this.radius,this.radius2_||0),l=Math.ceil(2*h+a);return{strokeStyle:t,strokeWidth:o,size:l,lineCap:e,lineDash:n,lineDashOffset:r,lineJoin:i,miterLimit:s}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t="#000"),e.fillStyle=ed(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;"string"===typeof i&&(i=Rc(i)),null===i?s=1:Array.isArray(i)&&(s=4===i.length?i[3]:1),0===s&&(e=ph(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const n=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=n+o*r,a=o%2===0?i:s;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle="#000",e.fill(),t.strokeStyle&&(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())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}var od=rd;class ad extends od{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.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 ad({fill:this.getFill()?.clone(),stroke:this.getStroke()?.clone(),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}}var hd=ad;class ld{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new ld({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"===typeof t&&"src"in t){const e=Qu(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===Uu.IDLE&&e.load(),e.getImageState()===Uu.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Mi(t):"object"===typeof t&&"src"in t?t.src+":"+t.offset:Rc(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}var cd=ld;function ud(t,e,i,s){return void 0!==i&&void 0!==s?[i/t,s/e]:void 0!==i?i/t:void 0!==s?s/e:1}class dd extends nd{constructor(t){t=t||{};const e=void 0!==t.opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,n=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:n,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(cs(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||Mi(r)),cs(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),cs(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Uu.IDLE:void 0!==r&&(o="complete"in r?r.complete?r.src?Uu.LOADED:Uu.IDLE:Uu.LOADING:Uu.LOADED),this.color_=void 0!==t.color?Rc(t.color):null,this.iconImage_=Qu(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const s=this.getImage(1);if(s.width&&s.height)e=s.width,i=s.height;else if(s instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();i&&this.setScale(ud(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ud(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new dd({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?Rc(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),s=void 0!==i?null:this.getHitDetectionImage(),n=void 0!==i?Uu.IDLE:this.iconImage_.getImageState();this.iconImage_=Qu(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},n,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Qu(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Uu.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==Uu.LOADED){const e=this.iconImage_.getSize();if(e)return e[0]*t[0]}}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==Uu.LOADED){const e=this.iconImage_.getSize();if(e)return e[1]*t[1]}}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ci.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ci.CHANGE,t)}ready(){return this.iconImage_.ready()}}var fd=dd;class gd{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new gd({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}var pd=gd;class _d{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=xd,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"===typeof t&&(t=t.clone()),new _d({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"===typeof t?this.geometryFunction_=t:"string"===typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xd,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function md(t){let e;if("function"===typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{cs("function"===typeof t.getZIndex,"Expected an `Style` or an array of `Style`");const e=t;i=[e]}e=function(){return i}}return e}let yd=null;function vd(t,e){if(!yd){const t=new cd({color:"rgba(255,255,255,0.4)"}),e=new pd({color:"#3399CC",width:1.25});yd=[new _d({image:new hd({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return yd}function xd(t){return t.getGeometry()}var wd=_d;const Ed="#333";class Md{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Gc(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new cd({color:Ed}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Md({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof cd?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Gc(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var Sd=Md;function Cd(t){return!0}function bd(t,e){e=e??Jc();const i=Id(t,e),s=Su();return function(t,n){if(s.properties=t.getPropertiesInternal()??{},s.resolution=n,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(s.geometryType=Mu(e))}return i(s)}}function Pd(t,e){e=e??Jc();const i=t.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Td(t[o],e);const n=Su(),r=new Array(i);return function(t,o){if(n.properties=t.getPropertiesInternal()??{},n.resolution=o,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(n.geometryType=Mu(e))}let a=0;for(let e=0;e<i;++e){const t=s[e](n);t&&(r[a]=t,a+=1)}return r.length=a,r}}function Rd(t,e){if(e=e??Jc(),!Array.isArray(t))return Pd([t],e);const i=t.length,s=t[0];if("style"in s){const s=new Array(i);for(let e=0;e<i;++e){const i=t[e];if(!("style"in i))throw new Error("Expected a list of rules with a style property");s[e]=i}return bd(s,e)}const n=t;return Pd(n,e)}function Id(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n){const i=t[n],r="filter"in i&&void 0!==i.filter?Cu(i.filter,Nc,e):Cd;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let s=0;s<t;++s)o[s]=Td(i.style[s],e)}else o=[Td(i.style,e)];s[n]={filter:r,styles:o}}return function(e){const n=[];let r=!1;for(let o=0;o<i;++o){const i=s[o].filter;if(i(e)&&(!t[o].else||!r)){r=!0;for(const t of s[o].styles){const i=t(e);i&&n.push(i)}}}return n}}function Td(t,e){const i=Ad(t,"",e),s=Gd(t,"",e),n=Od(t,e),r=Ld(t,e),o=jd(t,"z-index",e);if(!i&&!s&&!n&&!r&&!oi(t))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new wd;return function(t){let e=!0;if(i){const s=i(t);s&&(e=!1),a.setFill(s)}if(s){const i=s(t);i&&(e=!1),a.setStroke(i)}if(n){const i=n(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ad(t,e,i){let s;if(e+"fill-pattern-src"in t)s=Ud(t,e+"fill-",i);else{if("none"===Dd(t,e+"fill-color"))return t=>null;s=Wd(t,e+"fill-color",i)}if(!s)return null;const n=new cd;return function(t){const e=s(t);return e===oc?null:(n.setColor(e),n)}}function Gd(t,e,i){const s=jd(t,e+"stroke-width",i),n=Wd(t,e+"stroke-color",i);if(!s&&!n)return null;const r=zd(t,e+"stroke-line-cap",i),o=zd(t,e+"stroke-line-join",i),a=Xd(t,e+"stroke-line-dash",i),h=jd(t,e+"stroke-line-dash-offset",i),l=jd(t,e+"stroke-miter-limit",i),c=jd(t,e+"stroke-offset",i),u=new pd;return function(t){if(n){const e=n(t);if(e===oc)return null;u.setColor(e)}if(s&&u.setWidth(s(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),h&&u.setLineDashOffset(h(t)),l&&u.setMiterLimit(l(t)),c&&u.setOffset(c(t)),u}}function Od(t,e){const i="text-",s=zd(t,i+"value",e);if(!s)return null;const n=Ad(t,i,e),r=Ad(t,i+"background-",e),o=Gd(t,i,e),a=Gd(t,i+"background-",e),h=zd(t,i+"font",e),l=jd(t,i+"max-angle",e),c=jd(t,i+"offset-x",e),u=jd(t,i+"offset-y",e),d=Bd(t,i+"overflow",e),f=zd(t,i+"placement",e),g=jd(t,i+"repeat",e),p=Yd(t,i+"scale",e),_=Bd(t,i+"rotate-with-view",e),m=jd(t,i+"rotation",e),y=zd(t,i+"align",e),v=zd(t,i+"justify",e),x=zd(t,i+"baseline",e),w=Bd(t,i+"keep-upright",e),E=Xd(t,i+"padding",e),M=tf(t,i+"declutter-mode"),S=new Sd({declutterMode:M});return function(t){if(S.setText(s(t)),n&&S.setFill(n(t)),r&&S.setBackgroundFill(r(t)),o&&S.setStroke(o(t)),a&&S.setBackgroundStroke(a(t)),h&&S.setFont(h(t)),l&&S.setMaxAngle(l(t)),c&&S.setOffsetX(c(t)),u&&S.setOffsetY(u(t)),d&&S.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");S.setPlacement(e)}if(g&&S.setRepeat(g(t)),p&&S.setScale(p(t)),_&&S.setRotateWithView(_(t)),m&&S.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");S.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(e)}return E&&S.setPadding(E(t)),w&&S.setKeepUpright(w(t)),S}}function Ld(t,e){return"icon-src"in t?Nd(t,e):"shape-points"in t?kd(t,e):"circle-radius"in t?Fd(t,e):null}function Nd(t,e){const i="icon-",s=i+"src",n=sf(Dd(t,s),s),r=Vd(t,i+"anchor",e),o=Yd(t,i+"scale",e),a=jd(t,i+"opacity",e),h=Vd(t,i+"displacement",e),l=jd(t,i+"rotation",e),c=Bd(t,i+"rotate-with-view",e),u=Zd(t,i+"anchor-origin"),d=Jd(t,i+"anchor-x-units"),f=Jd(t,i+"anchor-y-units"),g=Dd(t,i+"color");let p,_=null;if(void 0!==g){const s=Array.isArray(g)&&g.length>0&&"string"===typeof g[0];s?_=Wd(t,i+"color",e):p=rf(g,i+"color")}const m=$d(t,i+"cross-origin"),y=Qd(t,i+"offset"),v=Zd(t,i+"offset-origin"),x=Kd(t,i+"width"),w=Kd(t,i+"height"),E=Hd(t,i+"size"),M=tf(t,i+"declutter-mode"),S={src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:m,offset:y,offsetOrigin:v,height:w,width:x,size:E,declutterMode:M};let C=null;return function(t){if(C)_&&C.setColor(_(t));else{const e=_?_(t):p;C=new fd(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&C.setOpacity(a(t)),h&&C.setDisplacement(h(t)),l&&C.setRotation(l(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),r&&C.setAnchor(r(t)),C}}function kd(t,e){const i="shape-",s=i+"points",n=i+"radius",r=nf(Dd(t,s),s);if(!(n in t))throw new Error(`Expected a number for ${n}`);const o=jd(t,n,e),a=Dd(t,n),h="number"===typeof a?a:5,l=i+"radius2",c=jd(t,l,e),u=Dd(t,l),d="number"===typeof u?u:void 0,f=Ad(t,i,e),g=Gd(t,i,e),p=Yd(t,i+"scale",e),_=Vd(t,i+"displacement",e),m=jd(t,i+"rotation",e),y=Bd(t,i+"rotate-with-view",e),v=Kd(t,i+"angle"),x=tf(t,i+"declutter-mode"),w=new od({points:r,radius:h,radius2:d,angle:v,declutterMode:x});return function(t){return o&&w.setRadius(o(t)),c&&w.setRadius2(c(t)),f&&w.setFill(f(t)),g&&w.setStroke(g(t)),_&&w.setDisplacement(_(t)),m&&w.setRotation(m(t)),y&&w.setRotateWithView(y(t)),p&&w.setScale(p(t)),w}}function Fd(t,e){const i="circle-",s=Ad(t,i,e),n=Gd(t,i,e),r=jd(t,i+"radius",e),o=Yd(t,i+"scale",e),a=Vd(t,i+"displacement",e),h=jd(t,i+"rotation",e),l=Bd(t,i+"rotate-with-view",e),c=tf(t,i+"declutter-mode"),u=new hd({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),s&&u.setFill(s(t)),n&&u.setStroke(n(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}function Dd(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function jd(t,e,i){const s=Dd(t,e);if(void 0===s)return;const n=Cu(s,kc,i);return function(t){return nf(n(t),e)}}function zd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,Fc,i);return function(t){return sf(n(t),e)}}function Ud(t,e,i){const s=zd(t,e+"pattern-src",i),n=qd(t,e+"pattern-offset",i),r=qd(t,e+"pattern-size",i),o=Wd(t,e+"color",i);return function(t){return s?{src:s(t),offset:n?n(t):null,size:r?r(t):null,color:o?o(t):null}:null}}function Bd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,Nc,i);return function(t){const i=n(t);if("boolean"!==typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Wd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,Dc,i);return function(t){return rf(n(t),e)}}function Xd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;if(Array.isArray(s)&&(0===s.length||"string"!==typeof s[0])){const t=s.map((t,s)=>{if("number"===typeof t)return()=>t;const n=Cu(t,kc,i);return function(t){return nf(n(t),`${e}[${s}]`)}});return function(e){const i=new Array(t.length);for(let s=0;s<t.length;++s)i[s]=t[s](e);return i}}const n=Cu(s,jc,i);return function(t){return ef(n(t),e)}}function Vd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc,i);return function(t){const i=ef(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function qd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc,i);return function(t){return of(n(t),e)}}function Yd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc|kc,i);return function(t){return af(n(t),e)}}function Kd(t,e){const i=Dd(t,e);if(void 0!==i){if("number"!==typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Hd(t,e){const i=Dd(t,e);if(void 0!==i){if("number"===typeof i)return Gc(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!==typeof i[0]||"number"!==typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}function $d(t,e){const i=Dd(t,e);if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);return i}}function Zd(t,e){const i=Dd(t,e);if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Jd(t,e){const i=Dd(t,e);if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Qd(t,e){const i=Dd(t,e);if(void 0!==i)return ef(i,e)}function tf(t,e){const i=Dd(t,e);if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function ef(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let s=0;s<i;++s)if("number"!==typeof t[s])throw new Error(`Expected an array of numbers for ${e}`);return t}function sf(t,e){if("string"!==typeof t)throw new Error(`Expected a string for ${e}`);return t}function nf(t,e){if("number"!==typeof t)throw new Error(`Expected a number for ${e}`);return t}function rf(t,e){if("string"===typeof t)return t;const i=ef(t,e),s=i.length;if(s<3||s>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function of(t,e){const i=ef(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}function af(t,e){return"number"===typeof t?t:of(t,e)}const hf={RENDER_ORDER:"renderOrder"};class lf extends Ul{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(hf.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();if(!i)return;t.declutter||(t.declutter={}),i in t.declutter===!1&&(t.declutter[i]=new Vl(9));const s=this.getRenderer();s&&s.renderDeclutter(t,e)}setRenderOrder(t){this.set(hf.RENDER_ORDER,t)}setStyle(t){this.style_=void 0===t?vd:t??null;const e=cf(t);this.styleFunction_=null===t||null===e?void 0:md(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function cf(t){if(void 0===t)return vd;if(!t)return null;if("function"===typeof t)return t;if(t instanceof wd)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof wd){const e=t.length,i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!(e instanceof wd))throw new Error("Expected a list of style instances");i[s]=e}return i}const e=t;return Rd(e)}var uf=lf;class df extends Ai{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s??void 0}}var ff=df;const gf="10px sans-serif",pf=[],_f=[0,0,0,0],mf=new ji;let yf,vf=null;const xf={},wf=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function Ef(t,e,i){return`${t} ${e} 16px "${i}"`}const Mf=function(){const t=100;let e,i;async function s(t){await i.ready;const e=ch(t);if(!e)return!1;const s=e.families[0].toLowerCase(),n=e.weight,r=[];if(i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=lh[t.weight]||t.weight;i===s&&t.style===e.style&&o==n&&r.push(t)}),0===r.length)return!1;const o=await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)));return o.some(t=>t)}async function n(){await i.ready;let r=!0;const o=mf.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let n=o[i];n<t&&(await s(i)?(ri(xf),mf.set(i,t)):(n+=10,mf.set(i,n,!0),n<t&&(r=!1)))}e=void 0,r||(e=setTimeout(n,100))}return async function(t){i||(i=ts?self.fonts:document.fonts);const s=ch(t);if(!s)return;const r=s.families;let o=!1;for(const e of r){if(wf.has(e))continue;const t=Ef(s.style,s.weight,e);void 0===mf.get(t)&&(mf.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(n,100))}}(),Sf=function(){let t;return function(e){let i=xf[e];if(void 0==i){if(ts){const t=ch(e),s=Cf(e,"Žg"),n=!t||isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight);i=n*(s.actualBoundingBoxAscent+s.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);xf[e]=i}return i}}();function Cf(t,e){return vf||(vf=ph(1,1)),t!=yf&&(vf.font=t,yf=vf.font),vf.measureText(e)}function bf(t,e){return Cf(t,e).width}function Pf(t,e,i){if(e in i)return i[e];const s=e.split("\n").reduce((e,i)=>Math.max(e,bf(t,i)),0);return i[e]=s,s}function Rf(t,e){const i=[],s=[],n=[];let r=0,o=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){r=Math.max(r,o),n.push(o),o=0,a+=h,h=0;continue}const d=e[l+1]||t.font,f=bf(d,u);i.push(f),o+=f;const g=Sf(d);s.push(g),h=Math.max(h,g)}return{width:r,height:a,widths:i,heights:s,lineWidths:n}}function If(t,e,i,s,n,r,o,a,h,l,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=function(t){return t.globalAlpha*=i}:t.globalAlpha*=i),e&&t.transform.apply(t,e),s.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),Tf(s,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(s,n,r,o,a,0,0,o,a)):t.drawImage(s,n,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}function Tf(t,e){const i=e,s=t.contextInstructions;for(let n=0,r=s.length;n<r;n+=2)if(Array.isArray(s[n+1])){const t=s[n];i[t].apply(i,s[n+1])}else{const t=s[n];i[t]=s[n+1]}}class Af extends di{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){wi()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Mo(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),So(s,i)}forEachFeatureAtCoordinate(t,e,i,s,n,r,o,a){let h;const l=e.viewState;function c(t,e,i,s){return n.call(r,e,t?i:null,s)}const u=l.projection,d=bn(t.slice(),u),f=[[0,0]];if(u.canWrapX()&&s){const t=u.getExtent(),e=fn(t);f.push([-e,0],[e,0])}const g=e.layerStatesArray,p=g.length,_=[],m=[];for(let v=0;v<f.length;v++)for(let s=p-1;s>=0;--s){const n=g[s],r=n.layer;if(r.hasRenderer()&&zl(n,l)&&o.call(a,r)){const s=r.getRenderer(),o=r.getSource();if(s&&o){const r=o.getWrapX()?d:t,a=c.bind(null,n.managed);m[0]=r[0]+f[v][0],m[1]=r[1]+f[v][1],h=s.forEachFeatureAtCoordinate(m,e,i,a,_)}if(h)return h}}if(0===_.length)return;const y=1/_.length;return _.forEach((t,e)=>t.distanceSq+=e*y),_.sort((t,e)=>t.distanceSq-e.distanceSq),_.some(t=>h=t.callback(t.feature,t.layer,t.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,n,r){const o=this.forEachFeatureAtCoordinate(t,e,i,s,Ci,this,n,r);return void 0!==o}getMap(){return this.map_}renderFrame(t){wi()}scheduleExpireIconCache(t){$u.canExpireCache()&&t.postRenderFunctions.push(Gf)}}function Gf(t,e){$u.expire()}var Of=Af;class Lf extends Of{constructor(t){super(t),this.fontChangeListenerKey_=ai(mf,ni.PROPERTYCHANGE,t.redrawText,t),this.element_=ts?Eh():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=sh+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new ff(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Dl.PRECOMPOSE,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex),i=e.some(t=>t.layer instanceof uf&&t.layer.getDeclutter());i&&(t.declutter={});const s=t.viewState;this.children_.length=0;const n=this.getMap(),r=n.getTargetElement();let o;Mh(r)&&(o=r.getContext("2d"),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r.width,r.height));const a=[];let h=o?r:null;for(let l=0,c=e.length;l<c;++l){const i=e[l];t.layerIndex=l;const n=i.layer,r=n.getSourceState();if(!zl(i,s)||"ready"!=r&&"undefined"!=r){n.unrender();continue}const o=n.render(t,h);o&&(o!==h&&(this.children_.push(o),h=o),a.push(i))}if(this.declutter(t,a),wh(this.element_,this.children_),o)for(const l of this.children_){const t=l.firstElementChild||l,e=l.style.backgroundColor;if(e&&(!Mh(t)||t.width>0)&&(o.fillStyle=e,o.fillRect(0,0,o.canvas.width,o.canvas.height)),!Mh(t)||0===t.width)continue;o.save();const i=l.style.opacity||t.style.opacity;o.globalAlpha=""===i?1:Number(i);const s=t.style.transform;if(s)o.transform(...Ro(s));else{const e=parseFloat(t.style.width)/t.width,i=parseFloat(t.style.height)/t.height;o.transform(e,0,0,i,0,0)}o.drawImage(t,0,0),o.restore()}this.dispatchRenderEvent(Dl.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],n=s.layer;n.getDeclutter()&&n.renderDeclutter(t,s)}e.forEach(e=>e.layer?.renderDeferred(t))}}}var Nf=Lf;function kf(t){t instanceof Ul?t.setMapInternal(null):t instanceof Fl&&t.getLayers().forEach(kf)}function Ff(t,e){if(t instanceof Ul)t.setMapInternal(e);else if(t instanceof Fl){const i=t.getLayers().getArray();for(let t=0,s=i.length;t<s;++t)Ff(i[t],e)}}class Df extends ji{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=jf(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.ctrlKey_=!1,this.boundHandleCtrlKey_=this.handleCtrlKey_.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:Qi,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=xo(),this.pixelToCoordinateTransform_=xo(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,ts||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,ts||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(ts?new Wi:Gh()),this.interactions=e.interactions||(ts?new Wi:Il({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ps(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(hs.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(hs.VIEW,this.handleViewChanged_),this.addChangeListener(hs.SIZE,this.handleSizeChanged_),this.addChangeListener(hs.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof eh||t.view.then(function(t){i.setView(new eh(t))}),this.controls.addEventListener(si.ADD,t=>{t.element.setMap(this)}),this.controls.addEventListener(si.REMOVE,t=>{t.element.setMap(null)}),this.interactions.addEventListener(si.ADD,t=>{t.element.setMap(this)}),this.interactions.addEventListener(si.REMOVE,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(si.ADD,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(si.REMOVE,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){const e=this.getLayerGroup().getLayers();e.push(t)}handleLayerAdd_(t){Ff(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=void 0!==i?i:{};const n=void 0!==i.hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:Ci,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,n,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(i){i instanceof Fl?e(i.getLayers()):t.push(i)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=void 0!==e?e:{};const s=void 0!==e.layerFilter?e.layerFilter:Ci,n=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,n,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_,i=e.getBoundingClientRect(),s=this.getSize(),n=i.width/s[0],r=i.height/s[1],o="changedTouches"in t?t.changedTouches[0]:t;return[(o.clientX-i.left)/n,(o.clientY-i.top)/r]}getTarget(){return this.get(hs.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t,e){const i=uo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection());if(e?.wrapX&&i){const t=co()||this.getView().getProjection();bn(i,t)}return i}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Eo(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(hs.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Wi)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){const t=this.getLayerGroup().getLayers();return t}updateRenderComplete_(){this.renderComplete_=(this.hasListener(as.LOADSTART)||this.hasListener(as.LOADEND)||this.hasListener(Dl.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}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 s=i.layer.getRenderer();if(s&&!s.ready)return!0;const n=i.layer.getSource();if(n&&n.loading)return!0}return!1}getPixelFromCoordinate(t,e){const i=this.getView(),s=i.getProjection();let n=fo(t,s);return e?.wrapX&&this.frameState_&&(n=Pn(n.slice(),s,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(n)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Eo(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(hs.SIZE)}getView(){return this.get(hs.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return _s(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Yi(e,this,t);this.handleMapBrowserEvent(i)}handleCtrlKey_(t){const e=t;this.ctrlKey_="Control"===e.key?e.type===ci.KEYDOWN:e.ctrlKey}handleMapBrowserEvent(t){if(!1===t.originalEvent.ctrlKey&&(this.ctrlKey_=!1),t.ctrlKey=this.ctrlKey_,!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ns.POINTERDOWN||i===ci.WHEEL||i===ci.KEYDOWN){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,s=e.target,n=i instanceof ShadowRoot?i.host===s?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(s)||!n.contains(s))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.getMap()!==this||!s.getActive()||!this.getTargetElement())continue;const n=s.handleEvent(t);if(!n||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,s=i;const n=t?t.viewHints:void 0,r=!!n&&(n[ms.ANIMATING]||n[ms.INTERACTING]);if(r){const e=Date.now()-t.time>8;i=e?0:8,s=e?0:2}if(e.getTilesLoading()<i){const t=e.getCount();e.reprioritize(),e.getCount()<t&&this.updateRenderComplete_(),e.loadMoreTiles(i,s)}}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Dl.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Dl.RENDERCOMPLETE,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Vi(as.LOADEND,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Vi(as.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,n=i.length;s<n;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){const t=this.targetChangeHandlerKeys_;for(let i=0,s=t.length;i<s;++i)li(t[i]);this.targetChangeHandlerKeys_=null;const e=this.getOwnerDocument();e.removeEventListener(ci.KEYDOWN,this.boundHandleCtrlKey_,!0),e.removeEventListener(ci.KEYUP,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(ci.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ci.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Mh(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"===typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(Mh(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Nf(this)),!Mh(e)){this.mapBrowserEventHandler_=new os(this,this.moveTolerance_);for(const e in Ki)this.mapBrowserEventHandler_.addEventListener(Ki[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(ci.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(ci.WHEEL,this.boundHandleBrowserEvent_,!!ss&&{passive:!1});const t=this.getOwnerDocument();let i;if(t.addEventListener(ci.KEYDOWN,this.boundHandleCtrlKey_,!0),t.addEventListener(ci.KEYUP,this.boundHandleCtrlKey_,!0),this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const t=e.getRootNode(),s=t instanceof ShadowRoot?t.host:e;i=s}if(this.targetChangeHandlerKeys_=[ai(i,ci.KEYDOWN,this.handleBrowserEvent,this),ai(i,ci.KEYPRESS,this.handleBrowserEvent,this)],!Mh(e)){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=ai(t,ni.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=ai(t,ci.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Ll("addlayer",t)),this.layerGroupPropertyListenerKeys_=[ai(t,ni.PROPERTYCHANGE,this.render,this),ai(t,ci.CHANGE,this.render,this),ai(t,"addlayer",this.handleLayerAdd_,this),ai(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){const e=this.getLayerGroup().getLayers();return e.remove(t)}handleLayerRemove_(t){kf(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let n=null;if(void 0!==e&&Tc(e)&&i&&i.isDef()){const s=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(n={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:on(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:s,wantedTiles:{},mapId:Mi(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;n.nextExtent=on(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=n,this.renderer_.renderFrame(n),n){if(n.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,n.postRenderFunctions),s){const t=!this.previousExtent_||!pn(this.previousExtent_)&&!Ks(n.extent,this.previousExtent_);t&&(this.dispatchEvent(new Vi(as.MOVESTART,this,s)),this.previousExtent_=Vs(this.previousExtent_))}const t=this.previousExtent_&&!n.viewHints[ms.ANIMATING]&&!n.viewHints[ms.INTERACTING]&&!Ks(n.extent,this.previousExtent_);t&&(this.dispatchEvent(new Vi(as.MOVEEND,this,n)),Fs(n.extent,this.previousExtent_))}this.dispatchEvent(new Vi(as.POSTRENDER,this,n)),this.updateRenderComplete_(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Ll("removelayer",e)),this.set(hs.LAYERGROUP,t)}setSize(t){this.set(hs.SIZE,t)}setTarget(t){this.set(hs.TARGET,t)}setView(t){if(!t||t instanceof eh)return void this.set(hs.VIEW,t);this.set(hs.VIEW,new eh);const e=this;t.then(function(t){e.setView(new eh(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,s;if(Mh(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,s=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e["borderLeftWidth"])-parseFloat(e["paddingLeft"])-parseFloat(e["paddingRight"])-parseFloat(e["borderRightWidth"]),s=t.offsetHeight-parseFloat(e["borderTopWidth"])-parseFloat(e["paddingTop"])-parseFloat(e["paddingBottom"])-parseFloat(e["borderBottomWidth"])}isNaN(i)||isNaN(s)||(e=[Math.max(0,i),Math.max(0,s)],!Tc(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&kn("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&vi(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function jf(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"===typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},s=t.layers&&"function"===typeof t.layers.getLayers?t.layers:new Fl({layers:t.layers});let n,r,o;return i[hs.LAYERGROUP]=s,i[hs.TARGET]=t.target,i[hs.VIEW]=t.view instanceof eh?t.view:new eh,void 0!==t.controls&&(Array.isArray(t.controls)?n=new Wi(t.controls.slice()):(cs("function"===typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),n=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Wi(t.interactions.slice()):(cs("function"===typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new Wi(t.overlays.slice()):(cs("function"===typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Wi,{controls:n,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}var zf=Df;class Uf{constructor(){gh(this,"pushMethodArgs_",(...t)=>{this.push_(this.pendingMethod_,t)}),this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(mh(),{get:(t,e)=>{if("function"===typeof t[e])return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const s=e[i];if("function"===typeof s){s(t);continue}const n=e[++i];"function"===typeof t[s]?t[s](...n):t[s]="function"===typeof n?n(t):n}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}var Bf=Uf;const Wf=5;class Xf extends ki{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Wf,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return wi()}getData(t){return null}prepareFrame(t){return wi()}renderFrame(t,e){return wi()}forEachFeatureAtCoordinate(t,e,i,s,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Uu.LOADED&&e.getState()!==Uu.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Uu.LOADED&&e!=Uu.ERROR&&t.addEventListener(ci.CHANGE,this.boundHandleImageChange_),e==Uu.IDLE&&(t.load(),e=t.getState()),e==Uu.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}}var Vf=Xf;const qf=[];let Yf=null;function Kf(){Yf=ph(1,1,void 0,{willReadFrequently:!0})}class Hf extends Vf{constructor(t){super(t),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=xo(),this.pixelTransform=xo(),this.inversePixelTransform=xo(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){Yf||Kf();const s=Yf;if(!s)return null;let n;s.clearRect(0,0,1,1);try{s.drawImage(t,e,i,1,1,0,0,1,1),n=s.getImageData(0,0,1,1).data}catch{return Yf=null,null}return n}getBackground(t){const e=this.getLayer();let i=e.getBackground();return"function"===typeof i&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i,s,n){if(Mh(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===s&&t.height===n){const e=t,s=e.getContext("2d");if(s)return this.container=t,this.context=s,this.containerReused=!0,void(i&&(s.fillStyle=i,s.fillRect(0,0,e.width,e.height)))}const r=this.getLayer().getClassName();let o,a;if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&vi(Rc(t.style.backgroundColor),Rc(i)))){const e=t.firstElementChild;Mh(e)&&(a=e.getContext("2d"))}if(a&&Io(a.canvas.style.transform,e)?(this.container=t,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=ts?Eh():document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=ph();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=un(i),n=dn(i),r=sn(i),o=en(i);Eo(e.coordinateToPixelTransform,s),Eo(e.coordinateToPixelTransform,n),Eo(e.coordinateToPixelTransform,r),Eo(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Eo(a,s),Eo(a,n),Eo(a,r),Eo(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,n=this.sourceRotates(),r=n?0:t.viewState.rotation,o=t.pixelRatio,a=n?Math.round(t.size[0]*o):Math.round(fn(i)/s*o),h=n?Math.round(t.size[1]*o):Math.round(hn(i)/s*o);Mo(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-h/2),So(this.inversePixelTransform,this.pixelTransform);const l=Po(this.pixelTransform),c=this.getBackground(t);if(this.useContainer(e,l,c,a,h),!this.containerReused){const t=this.context.canvas;t.width!=a||t.height!=h?(t.width=a,t.height=h):this.context.clearRect(0,0,a,h),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const n=new ff(t,this.inversePixelTransform,i,e);s.dispatchEvent(n)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Dl.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Dl.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Bf),t.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){const t=this.context;if(!t)throw new Error("Canvas context not initialized");return t}getContainerElement(){const t=this.container;if(!t)throw new Error("Canvas container not initialized");return t}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Dl.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Dl.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,n,r,o){const a=n/2,h=r/2,l=s/e,c=-l,u=-t[0]+o,d=-t[1];return Mo(this.tempTransform,a,h,l,c,-i,u,d)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}}var $f=Hf;class Zf extends $f{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0,this.renderedRotation=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,n=s.resolution,r=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=ln(a,po(e.extent,s.projection))),!o[ms.ANIMATING]&&!o[ms.INTERACTING]&&!pn(a))if(r){this.getLayer().rendered||this.renderedSourceRevision_===r.getRevision()||(this.image=null),this.renderedSourceRevision_=r.getRevision();const t=s.projection,e=r.getImage(a,n,i,t);e&&(this.loadImage(e)?(this.image=e,this.renderedRotation=this.sourceRotates()?s.rotation:0):e.getState()===Uu.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e||!this.image)return null;const i=this.getLayer(),s=Eo(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!js(n,s))return null;const r=this.image.getExtent(),o=this.image.getImage();if(!o)return null;const a=this.renderedRotation;if(0!==a){const t=nn(r),e=Math.cos(-a),i=Math.sin(-a),n=s[0]-t[0],o=s[1]-t[1];s[0]=t[0]+e*n-i*o,s[1]=t[1]+i*n+e*o}const h=fn(r),l=Math.floor(o.width*((s[0]-r[0])/h));if(l<0||l>=o.width)return null;const c=hn(r),u=Math.floor(o.height*((r[3]-s[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const i=this.image;if(!i)return this.getContainerElement();const s=i.getExtent(),n=i.getResolution(),[r,o]=Array.isArray(n)?n:[n,n],a=i.getPixelRatio(),h=this.renderedRotation,l=this.getLayer().getSource(),c=this.sourceRotates(),u=t.layerStatesArray[t.layerIndex],d=t.pixelRatio,f=t.viewState,g=f.center,p=f.resolution,_=f.rotation,m=d*r/(p*a),y=d*o/(p*a);this.prepareContainer(t,e);const v=this.getCanvasContext().canvas.width,x=this.getCanvasContext().canvas.height,w=this.getRenderContext(t);let E=!1,M=!0;if(u.extent){const e=po(u.extent,f.projection),i=t.extent;M=gn(e,i),E=M&&!zs(e,i),E&&this.clipUnrotated(w,t,e)}const S=i.getImage();if(!S)return this.getContainerElement();let C,b,P;if(c){const t=d/p,e=Math.cos(_),i=Math.sin(_),n=nn(s),r=n[0]-g[0],o=n[1]-g[1];C=Mo(this.tempTransform,v/2+t*(e*r+i*o),x/2+t*(i*r-e*o),m,y,_-h,-S.width/2,-S.height/2),b=S.width*m,P=S.height*y}else C=Mo(this.tempTransform,v/2,x/2,m,y,0,a*(s[0]-g[0])/r,a*(g[1]-s[3])/o),b=S.width*C[0],P=S.height*C[3];if(this.renderedResolution=o*d/a,l?.getInterpolate()||c&&_!==h||(w.imageSmoothingEnabled=!1),this.preRender(w,t),M&&b>=.5&&P>=.5){const t=u.opacity;if(c)w.save(),1!==t&&(w.globalAlpha=t),w.setTransform(C[0],C[1],C[2],C[3],C[4],C[5]),w.drawImage(S,0,0),w.restore();else{const e=C[4],i=C[5];1!==t&&(w.save(),w.globalAlpha=t),w.drawImage(S,0,0,S.width,S.height,e,i,b,P),1!==t&&w.restore()}}return this.postRender(this.getCanvasContext(),t),E&&w.restore(),w.imageSmoothingEnabled=!0,this.getContainerElement()}}var Jf=Zf;class Qf extends Ul{constructor(t){t=t||{},super(t)}}var tg=Qf;class eg extends tg{constructor(t){super(t)}createRenderer(){return new Jf(this)}getData(t){return super.getData(t)}}var ig=eg;Ke(),He(),$e(),Ze(),Je();class sg extends Oi{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(ci.CHANGE)}release(){this.setState(ls.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==ls.EMPTY){if(this.state!==ls.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){wi()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const s=e-i+1e3/60;return s>=this.transition_?1:Tn(s/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}var ng=sg;function rg(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function og(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const ag=new Error("disposed");const hg=[256,256];class lg extends ng{constructor(t){const e=ls.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=rg(this.data_);return t?[t.width,t.height]:hg}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==ls.IDLE&&this.state!==ls.ERROR)return;this.state=ls.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=ls.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=ls.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(ag),this.controller_=null),super.disposeInternal()}}var cg=lg;class ug extends ng{constructor(t,e,i,s,n,r){super(t,e,r),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,ts?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=n}getImage(){return this.image_}setImage(t){this.image_=t,this.state=ls.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=ls.ERROR,this.unlistenImage_(),this.image_=dg(),this.changed()}handleImageLoad_(){if(ts)this.state=ls.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=ls.LOADED:this.state=ls.EMPTY}this.unlistenImage_(),this.changed()}load(){if(this.state==ls.ERROR&&(this.state=ls.IDLE,this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==ls.IDLE){this.state=ls.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_);const t=this.image_;t&&(this.unlisten_=Wu(t,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function dg(){const t=ph(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var fg=ug;class gg{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}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 pg(t,e,i,s,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=s,n):new gg(t,e,i,s)}var _g=gg;let mg;const yg=[];function vg(t,e,i,s,n){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(s,n),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,s)+1,Math.max(i,n)),t.restore()}function xg(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function wg(){if(void 0===mg){const t=ph(6,6,yg);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",vg(t,4,5,4,0),vg(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;mg=xg(e,0)||xg(e,4)||xg(e,8),yh(t),yg.push(t.canvas)}return mg}function Eg(t,e,i,s){const n=ao(i,e,t);let r=Hr(e,s,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||js(h,n)){const e=Hr(t,r,n)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Mg(t,e,i,s){const n=nn(i);let r=Eg(t,e,n,s);return(!isFinite(r)||r<=0)&&Qs(i,function(i){return r=Eg(t,e,i,s),isFinite(r)&&r>0}),r}function Sg(t,e,i,s,n,r,o,a,h,l,c,u,d,f){const g=ph(Math.round(i*t),Math.round(i*e),yg);if(u||(g.imageSmoothingEnabled=!1),0===h.length)return g.canvas;function p(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const _=Ws();let m;h.forEach(function(t,e,i){Hs(_,t.extent)});const y=i/s,v=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==h.length||0!==l){const t=ph(Math.round(fn(_)*y),Math.round(hn(_)*y),yg);if(m=t,u||(t.imageSmoothingEnabled=!1),n&&f){const e=(n[0]-_[0])*y,i=-(n[3]-_[3])*y,s=fn(n)*y,r=hn(n)*y;t.rect(e,i,s,r),t.clip()}h.forEach(function(e,i,s){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){t.save();const i=(e.clipExtent[0]-_[0])*y,s=-(e.clipExtent[3]-_[3])*y,n=fn(e.clipExtent)*y,r=hn(e.clipExtent)*y;t.rect(u?i:Math.round(i),u?s:Math.round(s),u?n:Math.round(i+n)-Math.round(i),u?r:Math.round(s+r)-Math.round(s)),t.clip()}const i=(e.extent[0]-_[0])*y,s=-(e.extent[3]-_[3])*y,n=fn(e.extent)*y,r=hn(e.extent)*y;t.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,u?i:Math.round(i),u?s:Math.round(s),u?n:Math.round(i+n)-Math.round(i),u?r:Math.round(s+r)-Math.round(s)),e.clipExtent&&t.restore()}})}const x=un(o);return a.getTriangles().forEach(function(t,e,i){const s=t.source,n=t.target;let o=s[0][0],a=s[0][1],l=s[1][0],c=s[1][1],d=s[2][0],f=s[2][1];const y=p((n[0][0]-x[0])/r),w=p(-(n[0][1]-x[1])/r),E=p((n[1][0]-x[0])/r),M=p(-(n[1][1]-x[1])/r),S=p((n[2][0]-x[0])/r),C=p(-(n[2][1]-x[1])/r),b=o,P=a;o=0,a=0,l-=b,c-=P,d-=b,f-=P;const R=[[l,c,0,0,E-y],[d,f,0,0,S-y],[0,0,l,c,M-w],[0,0,d,f,C-w]],I=Es(R);if(!I)return;if(g.save(),g.beginPath(),wg()||!u){g.moveTo(E,M);const t=4,e=y-E,i=w-M;for(let s=0;s<t;s++)g.lineTo(E+p((s+1)*e/t),M+p(s*i/(t-1))),s!=t-1&&g.lineTo(E+p((s+1)*e/t),M+p((s+1)*i/(t-1)));g.lineTo(S,C)}else g.moveTo(E,M),g.lineTo(y,w),g.lineTo(S,C);let T;if(g.clip(),g.transform(I[0],I[2],I[1],I[3],y,w),g.translate(_[0]-b,_[3]-P),m)T=m.canvas,g.scale(v,-v);else{const t=h[0],e=t.extent;T=t.image,g.scale(fn(e)/T.width,-hn(e)/T.height)}g.drawImage(T,0,0),g.restore()}),m&&(yh(m),yg.push(m.canvas)),c&&(g.save(),g.globalCompositeOperation="source-over",g.strokeStyle="black",g.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const s=t.target,n=(s[0][0]-x[0])/r,o=-(s[0][1]-x[1])/r,a=(s[1][0]-x[0])/r,h=-(s[1][1]-x[1])/r,l=(s[2][0]-x[0])/r,c=-(s[2][1]-x[1])/r;g.beginPath(),g.moveTo(a,h),g.lineTo(n,o),g.lineTo(l,c),g.closePath(),g.stroke()}),g.restore()),g.canvas}const Cg=10,bg=.25;class Pg{constructor(t,e,i,s,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?Qr(t=>Eo(o,ao(t,this.targetProj_,this.sourceProj_))):oo(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=h(t)),a[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&fn(s)>=fn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?fn(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?fn(this.targetProj_.getExtent()):void 0;const l=un(i),c=dn(i),u=sn(i),d=en(i),f=this.transformInv_(l),g=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=Cg+(r?Math.max(0,Math.ceil(Math.log2(tn(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,f,g,p,_,m),this.wrapsXInSource_){const t=this.sourceWorldWidth_;if(!t)return;let e=1/0;this.triangles_.forEach(function(t,i,s){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(i=>{if(Math.max(i.source[0][0],i.source[1][0],i.source[2][0])-e>t/2){const s=[[i.source[0][0],i.source[0][1]],[i.source[1][0],i.source[1][1]],[i.source[2][0],i.source[2][1]]];s[0][0]-e>t/2&&(s[0][0]-=t),s[1][0]-e>t/2&&(s[1][0]-=t),s[2][0]-e>t/2&&(s[2][0]-=t);const n=Math.min(s[0][0],s[1][0],s[2][0]),r=Math.max(s[0][0],s[1][0],s[2][0]);r-n<t/2&&(i.source=s)}})}a={}}addTriangle_(t,e,i,s,n,r){this.triangles_.push({source:[s,n,r],target:[t,e,i]})}addQuad_(t,e,i,s,n,r,o,a,h){const l=Ls([n,r,o,a]),c=this.sourceWorldWidth_,u=c?fn(l)/c:void 0,d=this.sourceProj_.canWrapX()&&void 0!==u&&u>.5&&u<1;let f=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const n=Ls([t,e,i,s]),r=fn(n)/this.targetWorldWidth_;f=r>bg||f}!d&&this.sourceProj_.isGlobal()&&u&&(f=u>bg||f)}if(!f&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!gn(l,this.maxSourceExtent_))return;let g=0;if(!f&&(!isFinite(n[0])||!isFinite(n[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])))if(h>0)f=!0;else if(g=(isFinite(n[0])&&isFinite(n[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=g&&2!=g&&4!=g&&8!=g)return;if(h>0){if(!f){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],s=this.transformInv_(e);let r;if(d){const t=c,e=(Cs(n[0],t)+Cs(o[0],t))/2;r=e-Cs(s[0],t)}else r=(n[0]+o[0])/2-s[0];const a=(n[1]+o[1])/2-s[1],h=r*r+a*a;f=h>this.errorThresholdSquared_}if(f){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(s[0]+t[0])/2,(s[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,n,r,c,d,h-1),this.addQuad_(u,l,i,s,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+s[0])/2,(i[1]+s[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,s,n,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&g)&&this.addTriangle_(t,i,s,n,o,a),0==(14&g)&&this.addTriangle_(t,i,e,n,o,r),g&&(0==(13&g)&&this.addTriangle_(e,s,t,r,a,n),0==(7&g)&&this.addTriangle_(e,s,i,r,a,o))}calculateSourceExtent(){const t=Ws();return this.triangles_.forEach(function(e,i,s){const n=e.source;$s(t,n[0]),$s(t,n[1]),$s(t,n[2])}),t}getTriangles(){return this.triangles_}}var Rg=Pg;class Ig extends ng{constructor(t,e,i,s,n,r,o,a,h,l,c,u){super(n,ls.IDLE,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()&&t.getExtent()||void 0;const d=s.getTileCoordExtent(this.wrappedTileCoord_),f=this.targetTileGrid_.getExtent();let g=this.sourceTileGrid_.getExtent();const p=f?ln(d,f):d;if(0===tn(p))return void(this.state=ls.EMPTY);const _=t.getExtent();_&&(g=g?ln(g,_):_);const m=s.getResolution(this.wrappedTileCoord_[0]),y=Mg(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=ls.EMPTY);const v=void 0!==l?l:.5;if(this.triangulation_=new Rg(t,i,p,g||void 0,y*v,m),0===this.triangulation_.getTriangles().length)return void(this.state=ls.EMPTY);this.sourceZ_=e.getZForResolution(y);let x=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(x[1]=vs(x[1],g[1],g[3]),x[3]=vs(x[3],g[1],g[3])):x=ln(x,g)),tn(x)){let i=0,s=0;t.canWrapX()&&(i=fn(_),s=Math.floor((x[0]-_[0])/i));const n=xn(x.slice(),t,!0);n.forEach(t=>{const n=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let e=n.minX;e<=n.maxX;e++)for(let t=n.minY;t<=n.maxY;t++){const n=s*i;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,e,t,o),offset:n})}++s}),0===this.sourceTiles_.length&&(this.state=ls.EMPTY)}else this.state=ls.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==ls.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const n=this.clipExtent_?.slice();n&&(n[0]+=e.offset,n[2]+=e.offset);const r=i.getImage();if(!r)return;t.push({extent:s,clipExtent:n,image:r})}}),this.sourceTiles_.length=0,0===t.length)this.state=ls.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s="number"===typeof i?i:i[0],n="number"===typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Sg(s,n,this.pixelRatio_,o,this.sourceTileGrid_.getExtent()??a,r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=ls.LOADED}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==ls.IDLE){this.state=ls.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.tile;if(!i)return;const s=i.getState();if(s==ls.IDLE||s==ls.LOADING){t++;const e=ai(i,ci.CHANGE,()=>{const s=i.getState();s!=ls.LOADED&&s!=ls.ERROR&&s!=ls.EMPTY||(li(e),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(e)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t){const e=t.tile;if(!e)return;const i=e.getState();i==ls.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&(this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null)}release(){this.canvas_&&(yh(this.canvas_.getContext("2d")),yg.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}var Tg=Ig;class Ag{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof di&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){while(this.canExpireCache())this.deleteOldest()}clear(){while(this.oldest_)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;while(e)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return cs(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return cs(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){cs(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}var Gg=Ag;function Og(t,e,i,s){return void 0!==s?(s[0]=t,s[1]=e,s[2]=i,s):[t,e,i]}function Lg(t,e,i){return t+"/"+e+"/"+i}function Ng(t,e,i,s,n){return`${Mi(t)},${e},${Lg(i,s,n)}`}function kg(t){return Fg(t[0],t[1],t[2])}function Fg(t,e,i){return(e<<t)+i}function Dg(t,e){const i=t[0],s=t[1],n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(s,n)}function jg(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const s=t[i],n=s.has(e);return n||s.add(e),!n}function zg(t,e,i){const s=t[i];return!!s&&s.delete(e)}function Ug(t,e){const i=t.layerStatesArray[t.layerIndex];if(i.extent&&(e=ln(e,po(i.extent,t.viewState.projection))),!i.layer)return e;const s=i.layer.getRenderSource();if(!s.getWrapX()){const i=s.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=ln(e,i))}return e}class Bg extends $f{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Ws(),this.tempTileRange_=new _g(0,0,0,0),this.tempTileCoord_=Og(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Gg(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Gg(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const n=this.tileCache_,r=this.getLayer(),o=r.getSource();if(!o)return null;const a=Ng(o,o.getKey(),t,e,i);let h;if(n.containsKey(a)){if(h=n.get(a),!h)return null}else{const r=s.viewState.projection,l=o.getProjection();if(h=o.getTile(t,e,i,s.pixelRatio,r,!l||so(l,r)?void 0:this.getSourceTileCache()),!h)return null;n.set(a,h)}return h}getTile(t,e,i,s){const n=this.getOrCreateTile(t,e,i,s);return n||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Eo(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!js(n,s))return null;const r=e.viewState,o=i.getRenderSource();if(!o)return null;const a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let l=a.getZForResolution(r.resolution);l>=a.getMinZoom();--l){const t=a.getTileCoordForCoordAndZ(s,l),i=this.getTile(l,t[1],t[2],e);if(!i||i.getState()!==ls.LOADED)continue;const n=a.getOrigin(l),c=Gc(a.getTileSize(l)),u=a.getResolution(l);let d=null;if(i instanceof fg||i instanceof Tg)d=i.getImage();else if(i instanceof cg){const t=i.getData();t&&(d=rg(t))}if(!d)continue;const f=Math.floor(h*((s[0]-n[0])/u-t[1]*c[0])),g=Math.floor(h*((n[1]-s[1])/u-t[2]*c[1])),p=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,f+p,g+p)}return null}readData(t){const e=this.getLayer().getRenderSource();if(!e)return null;const i=t.viewState,s=i.projection;if(e.getGutterForProjection(s))throw new Error("readData() does not support sources with a gutter");const n=e.getTileGridForProjection(s),r=i.resolution,o=t.extent,a=n.getZForResolution(r),h={};this.enqueueTiles(t,o,a,h,0);const l=h[a];if(!l)return null;const c=[];let u=!0;if(l.forEach(t=>{const e=t,i=e.getState();i===ls.LOADED?c.push(e):i!==ls.ERROR&&i!==ls.EMPTY&&(u=!1)}),!u||0===c.length)return null;const d=t.size[0],f=t.size[1],g=c[0],p=og(g.getData());if(!p||p instanceof DataView)throw new Error("ol/renderer/canvas/TileLayer#readData only supports typed array tile data");const _=g.getSize(),m=Math.round(p.length/(_[0]*_[1])),y=p.constructor,v=new y(d*f*m);for(const x of c){const t=n.getTileCoordExtent(x.tileCoord,this.tempExtent),e=x.getSize(),i=og(x.getData()),s=(t[0]-o[0])/r-.5,a=(o[3]-t[3])/r-.5,h=fn(t)/r,l=hn(t)/r,c=e[0]/h,u=e[1]/l,g=Math.max(0,Math.ceil(s)),p=Math.min(d,Math.ceil(s+h)),_=Math.max(0,Math.ceil(a)),y=Math.min(f,Math.ceil(a+l));for(let n=_;n<y;++n){const t=Math.min(Math.floor((n-a)*u),e[1]-1);for(let r=g;r<p;++r){const o=Math.min(Math.floor((r-s)*c),e[0]-1),a=(t*e[0]+o)*m,h=(n*d+r)*m;for(let t=0;t<m;++t)v[h+t]=i[a+t]}}}return this.updateCacheSize(l.size),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache(),{data:v,width:d,height:f,bandCount:m}}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,n){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource();if(!a)return;const h=a.getTileGridForProjection(r.projection),l=Mi(a);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=o.getMapInternal(),d=Math.max(i-n,h.getMinZoom(),h.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):h.getResolution(0)),a.zDirection)),f=r.rotation,g=f?an(r.center,r.resolution,f,t.size):void 0;for(let p=i;p>=d;--p){const i=h.getTileRangeForExtentAndZ(e,p,this.tempTileRange_),n=h.getResolution(p);for(let e=i.minX;e<=i.maxX;++e)for(let r=i.minY;r<=i.maxY;++r){if(f&&g&&!h.tileCoordIntersectsViewport([p,e,r],g))continue;const i=this.getTile(p,e,r,t);if(!i)continue;const o=jg(s,i,p);if(!o)continue;const a=i.getKey();if(c[a]=!0,i.getState()===ls.IDLE&&!t.tileQueue.isKeyQueued(a)){const s=Og(p,e,r,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(s),n])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],n=t[1],r=t[2],o=this.getStaleKeys(),a=this.getLayer().getSource();if(!a)return!1;for(let h=0;h<o.length;++h){const t=Ng(a,o[h],s,n,r);if(i.containsKey(t)){const n=i.peek(t);if(n&&n.getState()===ls.LOADED)return n.endTransition(Mi(this)),jg(e,n,s),!0}}return!1}findAltTiles_(t,e,i,s){const n=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!n)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource();if(!a)return!1;const h=a.getKey();for(let l=n.minX;l<=n.maxX;++l)for(let t=n.minY;t<=n.maxY;++t){const e=Ng(a,h,i,l,t);let n=!1;if(o.containsKey(e)){const t=o.peek(e);t&&t.getState()===ls.LOADED&&(jg(s,t,i),n=!0)}n||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,n=s.projection,r=s.resolution,o=s.center,a=t.pixelRatio,h=this.getLayer(),l=h.getSource();if(!l)return this.getContainerElement();const c=l.getTileGridForProjection(n),u=c.getZForResolution(r,l.zDirection),d=c.getResolution(u);this.updateStaleKeys(l.getKey());let f=t.extent;const g=l.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.getCanvasContext().canvas.width,_=this.getCanvasContext().canvas.height;this.layerExtent=i.extent?po(i.extent,n):null,this.layerExtent&&(f=ln(f,this.layerExtent));const m=d*p/2/g,y=d*_/2/g,v=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],x={};this.renderedTiles.length=0;const w=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(s.nextResolution??r,l.zDirection),i=Ug(t,t.nextExtent);this.enqueueTiles(t,i,e,x,w)}const E=Ug(t,f);if(this.enqueueTiles(t,E,u,x,0),w>0&&setTimeout(()=>{this.enqueueTiles(t,E,u-1,x,w-1)},0),!(u in x))return this.getContainerElement();const M=Mi(this),S=t.time;for(const A of x[u]){const e=A.getState();if(e===ls.EMPTY)continue;const i=A.tileCoord;if(e===ls.LOADED){const t=A.getAlpha(M,S);if(1===t){A.endTransition(M);continue}}e!==ls.ERROR&&(this.renderComplete=!1);const s=this.findStaleTile_(i,x);if(s){zg(x,A,u),t.animate=!0;continue}const n=this.findAltTiles_(c,i,u+1,x);if(n)continue;const r=c.getMinZoom();for(let t=u-1;t>=r;--t){const e=this.findAltTiles_(c,i,t,x);if(e)break}}const C=d/r*a/g,b=this.getRenderContext(t);Mo(this.tempTransform,p/2,_/2,C,C,0,-p/2,-_/2),this.layerExtent&&this.clipUnrotated(b,t,this.layerExtent),l.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const P=Object.keys(x).map(Number);P.sort(gi);const R=[],I=[],T=[];for(let A=P.length-1;A>=0;--A){const e=P[A],i=l.getTilePixelSize(e,a,n),s=c.getResolution(e),r=s/d,o=i[0]*r*C,h=i[1]*r*C,f=c.getTileCoordForCoordAndZ(un(v),e),p=c.getTileCoordExtent(f),_=Eo(this.tempTransform,[g*(p[0]-v[0])/d,g*(v[3]-p[3])/d]),m=g*l.getGutterForProjection(n);for(const n of x[e]){if(n.getState()!==ls.LOADED)continue;const i=n.tileCoord,s=f[1]-i[1],r=Math.round(_[0]-(s-1)*o),a=f[2]-i[2],c=Math.round(_[1]-(a-1)*h),d=Math.round(_[0]-s*o),g=Math.round(_[1]-a*h),p=r-d,y=c-g,v=e===u;if(v&&n.inTransition(M)){T.push({tile:n,x:d,y:g,w:p,h:y,gutter:m}),this.renderedTiles.unshift(n),this.updateUsedTiles(t.usedTiles,l,n);continue}const x=[d,g,d+p,g+y],w=[];for(let t=0,n=R.length;t<n;++t)e<I[t]&&gn(x,R[t])&&w.push(R[t]);let E;w.length>0&&(E=wn(x,w)),R.push(x),I.push(e),this.drawTile(n,t,d,g,p,y,m,v,E),this.renderedTiles.unshift(n),this.updateUsedTiles(t.usedTiles,l,n)}}for(let A=0,G=T.length;A<G;++A){const{tile:e,x:i,y:s,w:n,h:r,gutter:o}=T[A];this.drawTile(e,t,i,s,n,r,o,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Ks(this.renderedExtent_,v),this.renderedExtent_=v,this.renderedPixelRatio=a,this.postRender(this.getCanvasContext(),t),this.layerExtent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=Mi(l),s=e.wantedTiles[i],n=s?Object.keys(s).length:0;this.updateCacheSize(n),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.getContainerElement()}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,s,n,r,o,a,h){let l;if(t instanceof cg){const e=t.getData();if(!e)return;if(l=rg(e),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const c=this.getRenderContext(e),u=Mi(this),d=e.layerStatesArray[e.layerIndex],f=d.opacity*(a?t.getAlpha(u,e.time):1),g=f!==c.globalAlpha;g&&(c.save(),c.globalAlpha=f);const p=l.width-2*o,_=l.height-2*o;if(h){const t=p/n,e=_/r;for(let n=0,r=h.length;n<r;++n){const r=h[n],a=r[0],u=r[1],d=r[2]-r[0],f=r[3]-r[1];c.drawImage(l,o+(a-i)*t,o+(u-s)*e,d*t,f*e,a,u,d,f)}}else c.drawImage(l,o,o,p,_,i,s,n,r);g&&c.restore(),f!==d.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.getCanvasContext();return t?t.canvas:null}getTileImage(t){return t.getImage()??null}updateUsedTiles(t,e,i){const s=Mi(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}var Wg=Bg,Xg={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Vg extends Ul{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Xg.PRELOAD)}setPreload(t){this.set(Xg.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Xg.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Xg.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var qg=Vg;class Yg extends qg{constructor(t){super(t)}createRenderer(){return new Wg(this,{cacheSize:this.getCacheSize()})}}var Kg=Yg;class Hg{drawCustom(t,e,i,s,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}var $g=Hg;const Zg={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},Jg=[Zg.FILL],Qg=[Zg.STROKE],tp=[Zg.BEGIN_PATH],ep=[Zg.CLOSE_PATH];var ip=Zg;class sp extends $g{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],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(),s=this.tmpCoordinate_,n=this.coordinates;let r=n.length;for(let o=0,a=t.length;o<a;o+=e)s[0]=t[o],s[1]=t[o+1],js(i,s)&&(n[r++]=s[0],n[r++]=s[1]);return r}appendFlatLineCoordinates(t,e,i,s,n,r){const o=this.coordinates;let a=o.length;const h=this.getBufferedMaxExtent();r&&(e+=s);let l=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,f,g,p=!0;for(d=e+s;d<i;d+=s)u[0]=t[d],u[1]=t[d+1],g=Bs(h,u),g!==f?(p&&(o[a++]=l,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):g===Os.INTERSECTING?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,l=u[0],c=u[1],f=g;return(n&&p||d===e+s)&&(o[a++]=l,o[a++]=c),a}drawCustomCoordinates_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,s,!1,!1);n.push(a),e=o}return e}drawCustom(t,e,i,s,n){this.beginGeometry(t,e,n);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let h,l,c,u,d;switch(r){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(h,d,e[t],o,i),c.push(i)}this.instructions.push([ip.CUSTOM,a,c,t,i,ra,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,c,t,s||i,ra,n]);break;case"Polygon":case"MultiLineString":u=[],h="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(h,0,t.getEnds(),o,u),this.instructions.push([ip.CUSTOM,a,u,t,i,na,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,u,t,s||i,na,n]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(h,0,h.length,o,!1,!1),this.instructions.push([ip.CUSTOM,a,l,t,i,sa,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,sa,n]);break;case"MultiPoint":h=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(h,o),l>a&&(this.instructions.push([ip.CUSTOM,a,l,t,i,sa,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,sa,n]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),l=this.coordinates.length,this.instructions.push([ip.CUSTOM,a,l,t,i,void 0,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,void 0,n]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[ip.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ip.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let s,n,r=-1;for(e=0;e<i;++e)s=t[e],n=s[0],n==ip.END_GEOMETRY?r=e:n==ip.BEGIN_GEOMETRY&&(s[2]=e,mi(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"===typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=ed(i||"#000")??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=ed(i||"#000")??void 0;const s=t.getLineCap();e.lineCap=void 0!==s?s:"round";const n=t.getLineDash();e.lineDash=n?n.slice():pf;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:"round";const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const h=t.getMiterLimit();e.miterLimit=void 0!==h?h:10;const l=t.getOffset();e.strokeOffset=l??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[ip.SET_FILL_STYLE,e];return"string"!==typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[ip.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!==typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,n=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit,l=t.strokeOffset;t.currentStrokeStyle==i&&t.currentLineCap==s&&(n==t.currentLineDash||n&&t.currentLineDash&&vi(t.currentLineDash,n))&&t.currentLineDashOffset==r&&t.currentLineJoin==o&&t.currentLineWidth==a&&t.currentMiterLimit==h&&t.currentStrokeOffset==l||(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=n,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=h,t.currentStrokeOffset=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[ip.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Fs(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;ks(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var np=sp;class rp extends np{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!js(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i??0);const s=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,n),a=this.imagePixelRatio_??1,h=this.anchorX_??0,l=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,f=this.scale_??[1,1],g=this.width_??0;this.instructions.push([ip.DRAW_IMAGE,r,o,this.image_,h*a,l*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[f[0]*this.pixelRatio/a,f[1]*this.pixelRatio/a],Math.ceil(g*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i??0);const s=t.getFlatCoordinates(),n=[];for(let p=0,_=s.length;p<_;p+=t.getStride())this.maxExtent&&!js(this.maxExtent,s.slice(p,p+2))||n.push(s[p],s[p+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,2),a=this.imagePixelRatio_??1,h=this.anchorX_??0,l=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,f=this.scale_??[1,1],g=this.width_??0;this.instructions.push([ip.DRAW_IMAGE,r,o,this.image_,h*a,l*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[f[0]*this.pixelRatio/a,f[1]*this.pixelRatio/a],Math.ceil(g*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),n=t.getOrigin();i&&s&&n&&(this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e)}}var op=rp;class ap extends np{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,n){const r=(n??0)*this.pixelRatio,o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([ip.MOVE_TO_LINE_TO,o,a,r]),this.hitDetectionInstructions.push([ip.MOVE_TO_LINE_TO,o,a,n??0]),i}drawLineString(t,e,i){const s=this.state;if(!s)return;const n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,pf,0],tp);const a=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(a,0,a.length,h,o),this.hitDetectionInstructions.push(Qg),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state;if(!s)return;const n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,pf,0],tp);const a=t.getEnds()??[],h=t.getFlatCoordinates(),l=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(h,c,a[u],l,o);this.hitDetectionInstructions.push(Qg),this.endGeometry(e)}finish(){const t=this.state;return t&&void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qg),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qg),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(tp)}}var hp=ap;class lp extends np{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,n){const r=this.state,o=n??0,a=void 0!==r.fillStyle,h=void 0!==r.strokeStyle,l=i.length;this.instructions.push(tp),this.hitDetectionInstructions.push(tp);for(let c=0;c<l;++c){const n=i[c],r=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,n,s,!0,!h);this.instructions.push([ip.MOVE_TO_LINE_TO,r,a,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([ip.MOVE_TO_LINE_TO,r,a,o,!0]),h&&(this.instructions.push(ep),this.hitDetectionInstructions.push(ep)),e=n}return a&&(this.instructions.push(Jg),this.hitDetectionInstructions.push(Jg)),h&&(this.instructions.push(Qg),this.hitDetectionInstructions.push(Qg)),e}drawCircle(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,pf,0]);const a=t.getFlatCoordinates(),h=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,h,!1,!1);const c=[ip.CIRCLE,l,o];this.instructions.push(tp,c),this.hitDetectionInstructions.push(tp,c),void 0!==s.fillStyle&&(this.instructions.push(Jg),this.hitDetectionInstructions.push(Jg)),void 0!==s.strokeStyle&&(this.instructions.push(Qg),this.hitDetectionInstructions.push(Qg)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,pf,0]);const a=t.getEnds(),h=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(h,0,a,l,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,pf,0]);const a=t.getEndss(),h=t.getOrientedFlatCoordinates(),l=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(h,c,a[u],l,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=ya(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t&&(this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke))}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,n=e.strokeOffset??0;return Math.abs(n)>0&&void 0!==i&&void 0!==s&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=n,t(),e.fillStyle=i,!0)}}var cp=lp;let up=0,dp=1;function fp(t,e,i,s,n,r,o,a){const h=o-n,l=a-r;let c=0,u=1;if(0===h){if(n<t||n>i)return!1}else{let e=(t-n)/h,s=(i-n)/h;if(e>s){const t=e;e=s,s=t}if(e>c&&(c=e),s<u&&(u=s),c>u)return!1}if(0===l){if(r<e||r>s)return!1}else{let t=(e-r)/l,i=(s-r)/l;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return up=c,dp=u,!0}function gp(t,e,i,s){const n=s[0],r=s[1],o=s[2],a=s[3],h=[],l=[];let c,u,d=!1,f=0;for(let g=0,p=e.length;g<p;++g){const s=e[g];let p=t[f],_=t[f+1],m=!1;for(let e=f+i;e<s;e+=i){const i=t[e],s=t[e+1];if(fp(n,r,o,a,p,_,i,s)){const t=i-p,e=s-_,n=p+up*t,r=_+up*e,o=p+dp*t,a=_+dp*e;d&&m&&n===c&&r===u?h.push(o,a):(d&&l.push(h.length),h.push(n,r,o,a),d=!0),c=o,u=a,m=!0}p=i,_=s}f=s}return d&&l.push(h.length),{flatCoordinates:h,ends:l}}function pp(t,e,i,s,n){const r=[];let o=i,a=0,h=e.slice(i,2);while(a<t&&o+n<s){const[i,s]=h.slice(-2),l=e[o+n],c=e[o+n+1],u=Math.sqrt((l-i)*(l-i)+(c-s)*(c-s));if(a+=u,a>=t){const e=(t-a+u)/u,d=bs(i,l,e),f=bs(s,c,e);h.push(d,f),r.push(h),h=[d,f],a==t&&(o+=n),a=0}else if(a<t)h.push(e[o+n],e[o+n+1]),o+=n;else{const t=u-a,e=bs(i,l,t/u),d=bs(s,c,t/u);h.push(e,d),r.push(h),h=[e,d],a=0,o+=n}}return a>0&&r.push(h),r}function _p(t,e,i,s,n){let r,o,a,h,l,c,u,d,f,g,p=i,_=i,m=0,y=0,v=i;for(o=i;o<s;o+=n){const i=e[o],s=e[o+1];void 0!==l&&void 0!==c&&(f=i-l,g=s-c,h=Math.sqrt(f*f+g*g),void 0!==u&&void 0!==d&&void 0!==a&&(y+=a,r=Math.acos((u*f+d*g)/(a*h)),r>t&&(y>m&&(m=y,p=v,_=o),y=0,v=o-n)),a=h,u=f,d=g),l=i,c=s}return y+=h||0,y>m?[v,o]:[p,_]}const mp={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class yp extends np{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates["#000"]={fillStyle:"#000"},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!s&&!n)return;const o=this.coordinates;let a=o.length;const h=t.getType();let l=null,c=t.getStride();if("line"!==r.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let s=r.overflow?null:[];switch(h){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),c=2;break;case"Polygon":l=t.getFlatInteriorPoint(),!r.overflow&&s&&s.push(l[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,i=e.length;t<i;t+=3)!r.overflow&&s&&s.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;c=2;break;default:return}if(!l)return;const n=this.appendFlatPointCoordinates(l,c);if(n===a)return;if(s&&(n-a)/2!==l.length/c){const t=l;let e=a/2;s=s.filter((i,s)=>{const n=o[2*(e+s)]===t[s*c]&&o[2*(e+s)+1]===t[s*c+1];return n||--e,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i??0);const f=r.scale??[1,1];let g=r.padding??_f;if(g!=_f&&(f[0]<0||f[1]<0)){let t=g[0],e=g[1],i=g[2],s=g[3];f[0]<0&&(e=-e,s=-s),f[1]<0&&(t=-t,i=-i),g=[t,e,i,s]}const p=this.pixelRatio;this.instructions.push([ip.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,g==_f?_f:g.map(function(t){return t*p}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]);const _=1/p,m=u?u.slice(0):null;m&&(m[1]="#000"),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,g,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?"#000":this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]),this.endGeometry(e)}else{const s=t.getExtent();if(!gn(this.maxExtent,s))return;let n=[];if(l=t.getFlatCoordinates(),"LineString"==h)n=[l.length];else if("MultiLineString"==h)n=t.getEnds();else if("Polygon"==h)n=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}if(void 0===r.textAlign&&("LineString"==h||"MultiLineString"==h)&&!zs(this.getBufferedMaxExtent(),s)){const t=gp(l,n,c,this.getBufferedMaxExtent());if(l=t.flatCoordinates,n=t.ends,c=2,0===n.length)return}this.beginGeometry(t,e,i??0);const u=r.repeat,d=u?void 0:r.textAlign;let f=0;for(let t=0,e=n.length;t<e;++t){let e;e=u?pp(u*this.resolution,l,f,n[t],c):[l.slice(f,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let h=0,l=s.length;if(void 0==d){const t=_p(r.maxAngle??Math.PI/4,s,0,s.length,2);h=t[0],l=t[1]}for(let t=h;t<l;t+=c)o.push(s[t],s[t+1]);const u=o.length;f=n[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const n=this.textKey_;n in this.textStates||(this.textStates[n]={font:e.font,textAlign:e.textAlign||"center",justify:e.justify,textBaseline:e.textBaseline||"middle",scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,n=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=mp[s.textBaseline||"middle"],l=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=s.scale??[1,1],f=i?i.lineWidth*Math.abs(d[0])/2:0;this.instructions.push([ip.DRAW_CHARS,t,e,h,s.overflow,o,s.maxAngle,a,c,n,f*a,u,r,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([ip.DRAW_CHARS,t,e,h,s.overflow,o?"#000":o,s.maxAngle,a,c,n,f*a,u,r,1/a,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(t,e){let i,s,n;if(t){const e=t.getFill();e?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ed(e.getColor()||"#000")||"#000"):(s=null,this.textFillState_=s);const r=t.getStroke();if(r){n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),s=r.getMiterLimit();n.lineCap=r.getLineCap()||"round",n.lineDash=t?t.slice():pf,n.lineDashOffset=void 0===e?0:e,n.lineJoin=r.getLineJoin()||"round",n.lineWidth=void 0===i?1:i,n.miterLimit=void 0===s?10:s,n.strokeStyle=ed(r.getColor()||"#000")||"#000"}else n=null,this.textStrokeState_=n;i=this.textState_;const o=t.getFont()||gf;Mf(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||"middle",i.backgroundFill=t.getBackgroundFill()??void 0,i.backgroundStroke=t.getBackgroundStroke()??void 0,i.padding=t.getPadding()||_f,i.scale=void 0===a?[1,1]:a;const h=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===h?0:h,this.textOffsetY_=void 0===l?0:l,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:Mi(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?"string"==typeof s.fillStyle?s.fillStyle:"|"+Mi(s.fillStyle):""}else this.text_="";this.declutterMode_=t?t.getDeclutterMode():void 0,this.declutterImageWithText_=e}}var vp=yp;const xp={Circle:cp,Default:np,Image:op,LineString:hp,Polygon:cp,Text:vp};class wp{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const n=i[s].finish();t[e][s]=n}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let s=this.buildersByZIndex_[i];void 0===s&&(s={},this.buildersByZIndex_[i]=s);let n=s[e];if(void 0===n){const t=xp[e];n=new t(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=n}return n}}var Ep=wp;function Mp(t,e,i,s){let n=t[e],r=t[e+1],o=0;for(let a=e+s;a<i;a+=s){const e=t[a],i=t[a+1];o+=Math.sqrt((e-n)*(e-n)+(i-r)*(i-r)),n=e,r=i}return o}function Sp(t,e,i,s,n,r,o,a){o=o??[],a=a??s;const h=t[e+s],l=t[e+s+1],c=t[i-2*s],u=t[i-2*s+1];let d,f,g,p,_,m,y,v,x=0;for(let w=e;w<i;w+=s){g=d,p=f,_=void 0,m=void 0,w+s<i&&(_=t[w+s],m=t[w+s+1]),r&&w===e&&(g=c,p=u),r&&w===i-s&&(_=h,m=l),d=t[w],f=t[w+1],[y,v]=Cp(d,f,g,p,_,m,n),o[x++]=y,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function Cp(t,e,i,s,n,r,o){let a,h;void 0!==i&&void 0!==s?(a=t-i,h=e-s):void 0!==n&&void 0!==r?(a=n-t,h=r-e):(a=1,h=0);const l=Math.hypot(a,h),c=a/l,u=h/l;if(a=-u,h=c,void 0===i||void 0===s)return[t+a*o,e+h*o];if(void 0===n||void 0===r)return[t+a*o,e+h*o];const d=In([t,e],[i,s],[n,r]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const f=Math.cos(d/2),g=Math.sin(d/2),p=g*a+f*h,_=-f*a+g*h,m=p*(1/g),y=_*(1/g);return[t+m*o,e+y*o]}function bp(t,e,i=!1){for(let s=0,n=t.length-2;s<n;s+=e){const n=i&&0===s?t.length-3*e:t.length-2*e;for(let i=n;i>s+e;i-=e){const n=t[s],r=t[s+1],o=t[s+e],a=t[s+e+1],h=t[i],l=t[i+1],c=t[i+e],u=t[i+e+1],d=(u-l)*(o-n)-(c-h)*(a-r);if(0===d)continue;const f=((c-h)*(r-l)-(u-l)*(n-h))/d,g=((o-n)*(r-l)-(a-r)*(n-h))/d;if(f>0&&f<1&&g>0&&g<1){const h=n+f*(o-n),l=r+f*(a-r);t[s+e]=h,t[s+e+1]=l,t.splice(s+2*e,i-s-e);break}}}return t}let Pp;const Rp=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 Ip(){return Pp||(Pp=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Pp}function Tp(t,e,i,s,n,r,o,a,h,l,c,u,d=!0){let f=t[e],g=t[e+1],p=0,_=0,m=0,y=0;function v(){p=f,_=g,e+=s,f=t[e],g=t[e+1],y+=m,m=Math.sqrt((f-p)*(f-p)+(g-_)*(g-_))}do{v()}while(e<i-s&&y+m<r);let x=0===m?0:(r-y)/m;const w=bs(p,f,x),E=bs(_,g,x),M=e-s,S=y,C=r+a*h(l,n,c);while(e<i-s&&y+m<C)v();x=0===m?0:(C-y)/m;const b=bs(p,f,x),P=bs(_,g,x);let R=!1;if(d)if(u){const t=[w,E,b,P];Ao(t,0,4,2,u,t,t),R=t[0]>t[2]}else R=w>b;const I=Math.PI,T=[],A=M+s===e;let G;if(e=M,m=0,y=S,f=t[e],g=t[e+1],A){v(),G=Math.atan2(g-_,f-p),R&&(G+=G>0?-I:I);const t=(b+w)/2,e=(P+E)/2;return T[0]=[t,e,(C-r)/2,G,n],T}n=n.replace(/\n/g," ");const O=Array.from(Ip().segment(n),t=>t.segment),L=R!==Rp.test(n);for(let N=0,k=O.length;N<k;){v();let t=Math.atan2(g-_,f-p);if(R&&(t+=t>0?-I:I),void 0!==G){let e=t-G;if(e+=e>I?-2*I:e<-I?2*I:0,Math.abs(e)>o)return null}G=t;const n=N;let u=0;for(;N<k;++N){const t=L?k-N-1:N,n=a*h(l,O[t],c);if(e+s<i&&y+m<r+u+n/2)break;u+=n}if(N===n)continue;const d=(L?O.slice(k-N,k-n):O.slice(n,N)).join("");x=0===m?0:(r+u/2-y)/m;const w=bs(p,f,x),E=bs(_,g,x);T.push([w,E,u/2,t,d]),r+=u}return T}const Ap=Ws(),Gp=[],Op=[],Lp=[],Np=[];function kp(t){return t[3].declutterBox}function Fp(t,e){return"start"===e?e=Rp.test(t)?"right":"left":"end"===e&&(e=Rp.test(t)?"left":"right"),mp[e]}function Dp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function jp(t,e,i){return i%2===0&&(t+=e),t}class zp{constructor(t,e,i,s,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=xo(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new Bf:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const n=t+e+i+s;if(this.labels_[n])return this.labels_[n];const r=s?this.strokeStates[s]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=a.justify?mp[a.justify]:Fp(Array.isArray(t)?t[0]:t,a.textAlign||"center"),u=s&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Dp,[]),{width:f,height:g,widths:p,heights:_,lineWidths:m}=Rf(a,d),y=f+u,v=[],x=(y+2)*l[0],w=(g+u)*l[1],E={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==l[0]&&1==l[1]||v.push("scale",l),s&&r&&(v.push("strokeStyle",r.strokeStyle),v.push("lineWidth",u),v.push("lineCap",r.lineCap),v.push("lineJoin",r.lineJoin),v.push("miterLimit",r.miterLimit),v.push("setLineDash",[r.lineDash]),v.push("lineDashOffset",r.lineDashOffset)),i&&o&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const M=.5-c;let S=c*y+M*u;const C=[],b=[];let P,R=0,I=0,T=0,A=0;for(let G=0,O=d.length;G<O;G+=2){const t=d[G];if("\n"===t){I+=R,R=0,S=c*y+M*u,++A;continue}const e=d[G+1]||a.font;e!==P&&(s&&C.push("font",e),i&&b.push("font",e),P=e),R=Math.max(R,_[T]);const n=[t,S+M*p[T]+c*(p[T]-m[A]),.5*(u+R)+I];S+=p[T],s&&C.push("strokeText",n),i&&b.push("fillText",n),++T}return Array.prototype.push.apply(v,C),Array.prototype.push.apply(v,b),this.labels_[n]=E,E}replayTextBackground_(t,e,i,s,n,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,n),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,n,r,o,a,h,l,c,u,d,f,g,p){o*=u[0],a*=u[1];let _=i-o,m=s-a;const y=n+h>t?t-h:n,v=r+l>e?e-l:r,x=f[3]+y*u[0]+f[1],w=f[0]+v*u[1]+f[2],E=_-f[3],M=m-f[0];let S;return(g||0!==c)&&(Gp[0]=E,Np[0]=E,Gp[1]=M,Op[1]=M,Op[0]=E+x,Lp[0]=Op[0],Lp[1]=M+w,Np[1]=Lp[1]),0!==c?(S=Mo(xo(),i,s,1,1,c,-i,-s),Eo(S,Gp),Eo(S,Op),Eo(S,Lp),Eo(S,Np),Xs(Math.min(Gp[0],Op[0],Lp[0],Np[0]),Math.min(Gp[1],Op[1],Lp[1],Np[1]),Math.max(Gp[0],Op[0],Lp[0],Np[0]),Math.max(Gp[1],Op[1],Lp[1],Np[1]),Ap)):Xs(Math.min(E,E+x),Math.min(M,M+w),Math.max(E,E+x),Math.max(M,M+w),Ap),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:v,originX:h,originY:l,declutterBox:{minX:Ap[0],minY:Ap[1],maxX:Ap[2],maxY:Ap[3],value:p},canvasTransform:S,scale:u}}replayImageOrLabelArgs_(t){return this.replayImageOrLabel_(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}replayImageOrLabel_(t,e,i,s,n,r,o){const a=!(!r&&!o),h=s.declutterBox,l=o?o[2]*s.scale[0]/2:0,c=h.minX-l<=e[0]&&h.maxX+l>=0&&h.minY-l<=e[1]&&h.maxY+l>=0;return c&&(a&&this.replayTextBackground_(t,Gp,Op,Lp,Np,r,o),If(t,s.canvasTransform,n,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Eo(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const n=this.textStates[e],r=this.createLabel(t,e,s,i),o=this.strokeStates[i],a=this.pixelRatio,h=Fp(Array.isArray(t)?t[0]:t,n.textAlign||"center"),l=mp[n.textBaseline||"middle"],c=o&&o.lineWidth?o.lineWidth:0,u=r.width/a-2*n.scale[0],d=h*u+2*(.5-h)*c,f=l*r.height/a+2*(.5-l)*c;return{label:r,anchorX:d,anchorY:f}}execute_(t,e,i,s,n,r,o,a){const h=this.zIndexContext_;let l;this.pixelCoordinates_&&vi(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=To(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),wo(this.renderedTransform_,i));let c=0;const u=s.length;let d,f=0;const g=[];let p,_,m,y,v,x,w,E,M,S,C,b,P,R=0,I=0;const T=this.coordinateCache_,A=this.viewRotation_,G=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},L=this.instructions!=s||this.overlaps?0:200;let N,k,F,D;while(c<u){const i=s[c],u=i[0];switch(u){case ip.BEGIN_GEOMETRY:N=i[1],D=i[3],N.getGeometry()?void 0===o||gn(o,D.getExtent())?++c:c=i[2]+1:c=i[2],h&&(h.zIndex=i[4]);break;case ip.BEGIN_PATH:R>L&&(this.fill_(t),R=0),I>L&&(t.stroke(),I=0),R||I||(t.beginPath(),v=NaN,x=NaN),++c;break;case ip.CIRCLE:f=i[1],m=i[2]??0;const s=l[f],u=l[f+1],j=l[f+2]-m,z=l[f+3]-m,U=j-s,B=z-u,W=Math.sqrt(U*U+B*B);t.moveTo(s+W,u),t.arc(s,u,W,0,2*Math.PI,!0),++c;break;case ip.CLOSE_PATH:t.closePath(),++c;break;case ip.CUSTOM:f=i[1],d=i[2];const X=i[3],V=i[4],q=i[5];O.geometry=X,O.feature=N,c in T||(T[c]=[]);const Y=T[c];q?q(l,f,d,2,Y):(Y[0]=l[f],Y[1]=l[f+1],Y.length=2),h&&(h.zIndex=i[6]),V(Y,O),++c;break;case ip.DRAW_IMAGE:f=i[1],d=i[2],M=i[3],p=i[4],_=i[5];let K=i[6];const H=i[7],$=i[8],Z=i[9],J=i[10];let Q=i[11];const tt=i[12];let et=i[13];y=i[14]||"declutter";const it=i[15];if(!M&&i.length>=20){S=i[19],C=i[20],b=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(S,C,b,P);M=t.label,i[3]=M;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const s=i[24];_=(t.anchorY-s)*this.pixelRatio,i[5]=_,K=M.height,i[6]=K,et=M.width,i[13]=et}let st,nt,rt,ot;i.length>25&&(st=i[25]),i.length>17?(nt=i[16],rt=i[17],ot=i[18]):(nt=_f,rt=null,ot=null),J&&G?Q+=A:J||G||(Q-=A);let at=0;for(;f<d;f+=2){if(st&&st[at++]<et/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(M.width,M.height,l[f],l[f+1],et,K,p,_,$,Z,Q,tt,n,nt,!!rt||!!ot,N),s=[t,e,M,i,H,rt,ot];if(a){let t,e,n,r,o;if(it){const i=d-f;if(!it[i]){it[i]={args:s,declutterMode:y};continue}const r=it[i];t=r.args,e=r.declutterMode,delete it[i],n=kp(t)}if(!t||"declutter"===e&&a.collides(n)||(r=!0),"declutter"===y&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===y){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(n),this.replayImageOrLabelArgs_(t)),o&&("none"!==y&&a.insert(i.declutterBox),this.replayImageOrLabelArgs_(s))}else this.replayImageOrLabelArgs_(s)}++c;break;case ip.DRAW_CHARS:const ht=i[1],lt=i[2],ct=i[3],ut=i[4];P=i[5];const dt=i[6],ft=i[7],gt=i[8];b=i[9];const pt=i[10];S=i[11],Array.isArray(S)&&(S=S.reduce(jp,"")),C=i[12];const _t=[i[13],i[13]];y=i[14]||"declutter";const mt=i[15],yt=i[16],vt=this.textStates[C],xt=vt.font,wt=[vt.scale[0]*ft,vt.scale[1]*ft];let Et;xt in this.widths_?Et=this.widths_[xt]:(Et={},this.widths_[xt]=Et);const Mt=Mp(l,ht,lt,2),St=Math.abs(wt[0])*Pf(xt,S,Et);if(ut||St<=Mt){const i=this.textStates[C].textAlign,s=(Mt-St)*Fp(S,i),n=Tp(l,ht,lt,2,S,s,dt,Math.abs(wt[0]),Pf,xt,Et,G?0:this.viewRotation_,mt);t:if(n){const i=[];let s,r,o,h,l;if(b)for(s=0,r=n.length;s<r;++s){l=n[s],o=l[4],h=this.createLabel(o,C,"",b),p=l[2]+(wt[0]<0?-pt:pt)-yt,_=ct*h.height+2*(.5-ct)*pt*wt[1]/wt[0]-gt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,p,_,0,0,l[3],_t,!1,_f,!1,N);if(a&&"declutter"===y&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}if(P)for(s=0,r=n.length;s<r;++s){l=n[s],o=l[4],h=this.createLabel(o,C,P,""),p=l[2]-yt,_=ct*h.height-gt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,p,_,0,0,l[3],_t,!1,_f,!1,N);if(a&&"declutter"===y&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}a&&"none"!==y&&a.load(i.map(kp));for(let t=0,e=i.length;t<e;++t)this.replayImageOrLabelArgs_(i[t])}}++c;break;case ip.END_GEOMETRY:if(void 0!==r){N=i[1];const t=r(N,D,y);if(t)return t}++c;break;case ip.FILL:L?R++:this.fill_(t),++c;break;case ip.MOVE_TO_LINE_TO:let Ct,bt,Pt;if(f=i[1],d=i[2],m=i[3],m){const t=i[4]??!1,e=t||Math.abs(l[f]-l[d-2])<1e-6&&Math.abs(l[f+1]-l[d-1])<1e-6;Sp(l,f,d,2,m,e,g),bp(g,2,e),Ct=g,bt=0,Pt=Ct.length}else Ct=l,bt=f,Pt=d;k=Ct[bt],F=Ct[bt+1],t.moveTo(k,F),v=k+.5|0,x=F+.5|0;for(let e=bt+2;e<Pt;e+=2)k=Ct[e],F=Ct[e+1],w=k+.5|0,E=F+.5|0,e!=Pt-2&&w===v&&E===x||(t.lineTo(k,F),v=w,x=E);++c;break;case ip.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],R?(this.fill_(t),R=0,I&&(t.stroke(),I=0)):I&&i[1]&&(t.stroke(),I=0),t.fillStyle=i[1],++c;break;case ip.SET_STROKE_STYLE:R&&i[1]&&(this.fill_(t),R=0),I&&(t.stroke(),I=0),this.setStrokeStyle_(t,i),++c;break;case ip.STROKE:L?I++:t.stroke(),++c;break;default:++c;break}}R&&this.fill_(t),I&&t.stroke()}execute(t,e,i,s,n,r){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,n,void 0,void 0,r)}executeHitDetection(t,e,i,s,n){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,n)}}var Up=zp;const Bp=["Polygon","Circle","LineString","Image","Text","Default"],Wp=["Image","Text"],Xp=Bp.filter(t=>!Wp.includes(t));let Vp=!1,qp=!1;function Yp(){let t=0;const e=e=>{const i=ph(1,1,null,{willReadFrequently:e});let s=0;const n=performance.now();for(;performance.now()-n<50;++s)i.fillStyle=`rgba(255,0,${s%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=s>t?s:t,s},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};Vp=i[t],qp=!0}class Kp{constructor(t,e,i,s,n,r,o){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=xo(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,!!o)}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()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];void 0===s&&(s={},this.executorsByZIndex_[i]=s);const n=t[i];for(const t in n){const i=n[t];s[t]=new Up(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,s=t.length;e<s;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,n,r){!1===qp&&Yp(),s=Math.round(s);const o=2*s+1,a=Mo(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ph(o,o,null,{willReadFrequently:Vp}));const l=this.hitDetectionContext_;let c;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):h||l.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=Ws(),$s(c,t),ks(c,e*(this.renderBuffer_+s),c));const u=$p(s);let d;const f=l;function g(t,e,i){const a=f.getImageData(0,0,o,o).data;for(let h=0,l=u.length;h<l;h++)if(a[u[h]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[h]-3)/4,r=s-i%o,a=s-(i/o|0),l=n(t,e,r*r+a*a);if(l)return l}f.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let _,m,y,v,x;for(p.sort(gi),_=p.length-1;_>=0;--_){const t=p[_].toString();for(y=this.executorsByZIndex_[t],m=Bp.length-1;m>=0;--m)if(d=Bp[m],v=y[d],void 0!==v&&(x=v.executeHitDetection(l,a,i,g,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],n=e[2],r=e[3],o=[i,s,i,r,n,r,n,s];return To(o,0,8,2,t,o),o}isEmpty(){return oi(this.executorsByZIndex_)}execute(t,e,i,s,n,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?pi:gi),r=r||Bp;const h=Bp.length;for(let l=0,c=a.length;l<c;++l){const c=a[l].toString(),u=this.executorsByZIndex_[c];for(let d=0,f=r.length;d<f;++d){const c=r[d],f=u[c];if(void 0!==f){const r=null===o?void 0:f.getZIndexContext(),u=r?r.getContext():t,d=this.maxExtent_&&"Image"!==c&&"Text"!==c;if(d&&(u.save(),this.clip(u,i)),r&&"Text"!==c&&"Image"!==c?r.pushFunction(t=>f.execute(t,e,i,s,n,o)):f.execute(u,e,i,s,n,o),d&&u.restore(),r){r.offset();const t=a[l]*h+Bp.indexOf(c);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(gi);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}}const Hp={};function $p(t){if(void 0!==Hp[t])return Hp[t];const e=2*t+1,i=t*t,s=new Array(i+1);for(let r=0;r<=t;++r)for(let n=0;n<=t;++n){const o=r*r+n*n;if(o>i)break;let a=s[o];a||(a=[],s[o]=a),a.push(4*((t+r)*e+(t+n))+3),r>0&&a.push(4*((t-r)*e+(t+n))+3),n>0&&(a.push(4*((t+r)*e+(t-n))+3),r>0&&a.push(4*((t-r)*e+(t-n))+3))}const n=[];for(let r=0,o=s.length;r<o;++r)s[r]&&n.push(...s[r]);return Hp[t]=n,n}var Zp=Kp;class Jp extends $g{constructor(t,e,i,s,n,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Ps(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=xo()}drawImages_(t,e,i,s){if(!this.image_)return;const n=To(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,c=n.length;l<c;l+=2){const t=n[l]-this.imageAnchorX_,e=n[l+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const i=t+this.imageAnchorX_,s=e+this.imageAnchorY_;Mo(o,i,s,1,1,h,-i,-s),r.save(),r.transform.apply(r,o),r.translate(i,s),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,e,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,s){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const n=To(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=s){const t=n[e]+this.textOffsetX_,i=n[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,s,n,r){const o=this.context_,a=r??0;let h=To(t,e,i,s,this.transform_,this.pixelCoordinates_);if(Math.abs(a)>0){const t=h.length,e=n||Math.abs(h[0]-h[t-2])<1e-6&&Math.abs(h[1]-h[t-1])<1e-6;h=Sp(h,0,t,2,a,e,h),bp(h,2,e)}o.moveTo(h[0],h[1]);let l=h.length;n&&(l-=2);for(let c=2;c<l;c+=2)o.lineTo(h[c],h[c+1]);return n&&o.closePath(),i}drawRings_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0,n);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),gn(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Uo(t,this.transform_,this.pixelCoordinates_);if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=Math.sqrt(i*i+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],n,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill()??null,t.getStroke()??null),this.setImageStyle(t.getImage()??null),this.setTextStyle(t.getText()??null)}setTransform(t){this.transform_=t}drawGeometry(t){const e=t.getType();switch(e){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);break;default:}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),gn(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(gn(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let s=0;const n=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,o=n.length;t<o;++t)s=this.moveToLineTo_(i,s,n[t],r,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),gn(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),gn(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const n=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,o=n.length;t<o;++t){const e=n[t];s=this.drawRings_(i,s,e,r,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),vi(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.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:"center";i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:ed(e||"#000")||"#000"}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),s=e.getLineDash(),n=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),h=s||pf,l=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:"round",lineDash:1===this.pixelRatio_?h:h.map(t=>t*this.pixelRatio_),lineDashOffset:(n||0)*this.pixelRatio_,lineJoin:void 0!==r?r:"round",lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:ed(t||"#000")||"#000",strokeOffset:(l??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),n=t.getOrigin();if(!s||!n)return void(this.image_=null);this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:ed(t||"#000")||"#000"}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),s=i.getLineDash(),n=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:"round",lineDash:s||pf,lineDashOffset:n||0,lineJoin:void 0!==r?r:"round",lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:ed(t||"#000")||"#000"}}else this.textStrokeState_=null;const s=t.getFont(),n=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==s?s:gf,textAlign:void 0!==c?c:"center",textBaseline:void 0!==u?u:"middle"},this.text_=void 0!==l?Array.isArray(l)?l.reduce((t,e,i)=>t+(i%2?" ":e),""):l:"",this.textOffsetX_=void 0!==n?this.pixelRatio_*n:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}}var Qp=Jp;const t_=.5;function e_(t,e,i,s,n,r,o,a,h){const l=h?go(n,h):n,c=t[0]*t_,u=t[1]*t_,d=ph(c,u);d.imageSmoothingEnabled=!1;const f=d.canvas,g=new Qp(d,t_,n,[1,0,0,1,0,0],o,a??0,h?no(co(),h)??void 0:void 0),p=i.length,_=Math.floor(16777215/p),m={};for(let v=1;v<=p;++v){const t=i[v-1],e=t.getStyleFunction()||s;if(!e)continue;let n=e(t,r);if(!n)continue;Array.isArray(n)||(n=[n]);const o=v*_,a=o.toString(16).padStart(7,"#00000");for(let i=0,s=n.length;i<s;++i){const e=n[i],s=e.getGeometryFunction()(t);if(!s||!gn(l,s.getExtent()))continue;const r=e.clone(),o=r.getFill();o&&o.setColor(a);const h=r.getStroke();h&&(h.setColor(a),h.setLineDash(null)),r.setText(null);const c=e.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=ph(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 fd({img:i,anchor:c.getAnchor()??void 0,anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin()??void 0,opacity:1,size:c.getSize()??void 0,scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=r.getZIndex()||0;let d=m[u];d||(d={},m[u]=d,d["Polygon"]=[],d["Circle"]=[],d["LineString"]=[],d["Point"]=[]);const f=s.getType();if("GeometryCollection"===f){const t=s.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[f.replace("Multi","")].push(s,r)}}const y=Object.keys(m).map(Number).sort(gi);for(let v=0,x=y.length;v<x;++v){const t=m[y[v]];for(const i in t){const s=t[i];for(let t=0,i=s.length;t<i;t+=2){g.setStyle(s[t+1]);for(let i=0,n=e.length;i<n;++i)g.setTransform(e[i]),g.drawGeometry(s[t])}}}return d.getImageData(0,0,f.width,f.height)}function i_(t,e,i){const s=[];if(i){const n=Math.floor(Math.round(t[0])*t_),r=Math.floor(Math.round(t[1])*t_),o=4*(vs(n,0,i.width-1)+vs(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2],c=l+256*(h+256*a),u=Math.floor(16777215/e.length);c&&c%u===0&&s.push(e[c/u-1])}return s}const s_=.5,n_={Point:__,LineString:f_,Polygon:y_,MultiPoint:m_,MultiLineString:g_,MultiPolygon:p_,GeometryCollection:d_,Circle:h_};function r_(t,e){return parseInt(Mi(t),10)-parseInt(Mi(e),10)}function o_(t,e){const i=a_(t,e);return i*i}function a_(t,e){return s_*t/e}function h_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}function l_(t,e,i,s,n,r,o,a){const h=[],l=i.getImage();if(l){let t=!0;const e=l.getImageState();e==Uu.LOADED||e==Uu.ERROR?t=!1:e==Uu.IDLE&&l.load(),t&&h.push(l.ready())}const c=i.getFill();c&&c.loading()&&h.push(c.ready());const u=h.length>0;return u&&Promise.all(h).then(()=>n(null)),c_(t,e,i,s,r,o,a),u}function c_(t,e,i,s,n,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const h=a.simplifyTransformed(s,n),l=i.getRenderer();if(l)u_(t,h,i,e,o);else{const s=n_[h.getType()];s(t,h,i,e,o,r)}}function u_(t,e,i,s,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)u_(t,r[e],i,s,n);return}const r=t.getBuilder(i.getZIndex(),"Default");r.drawCustom(e,s,i.getRenderer(),i.getHitDetectionRenderer(),n)}function d_(t,e,i,s,n,r){const o=e.getGeometriesArray();let a,h;for(a=0,h=o.length;a<h;++a){const e=n_[o[a].getType()];e(t,o[a],i,s,n,r)}}function f_(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}}function g_(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}}function p_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}function __(t,e,i,s,n,r){const o=i.getImage(),a=i.getText(),h=a&&a.getText(),l=r&&o&&h?{}:void 0;if(o){if(o.getImageState()!=Uu.LOADED)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,l),r.drawPoint(e,s,n)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,l),r.drawText(e,s,n)}}function m_(t,e,i,s,n,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),h=i.getText(),l=h&&h.getText(),c=r&&a&&l?{}:void 0;if(a){if(o.getImageState()!=Uu.LOADED)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,s,n)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(h,c),r.drawText(e,s,n)}}function y_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}class v_ extends $f{constructor(t,e){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Ws(),this.wrappedRenderedExtent_=Ws(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1,void 0!==e?.wantRotation&&(this.wantRotation=e.wantRotation)}renderWorlds(t,e,i){const s=e.extent,n=e.viewState,r=n.center,o=n.resolution,a=n.projection,h=n.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,f=e.viewHints,g=!(f[ms.ANIMATING]||f[ms.INTERACTING]),p=this.context,_=p.canvas.width,m=p.canvas.height,y=c.getWrapX()&&a.canWrapX(),v=y?fn(l):null,x=s,w=y?Math.ceil((x[2]-l[2])/v)+(this.extendX_?2:1):1;let E=y?Math.floor((x[0]-l[0])/v)-(this.extendX_?1:0):0;do{let s=this.getRenderTransform(r,o,this.sourceRotates()?h:0,d,_,m,E*v);e.declutter&&(s=s.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],s,h,g,void 0===i?Bp:i?Wp:Xp,i?u&&e.declutter[u]:void 0)}while(++E<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=ph(this.context.canvas.width,this.context.canvas.height,qf))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,yh(this.context),qf.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const n=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){const t=this.getLayer().hasListener(Dl.PRERENDER)||this.getLayer().hasListener(Dl.POSTRENDER);if(!t)return this.container}this.setDrawContext_(),this.preRender(n,t);const a=s.projection;this.clipExtent_=null;let h=!1;if(o&&i.extent&&this.clipping){const e=po(i.extent,a);o=gn(e,t.extent);const s=o&&!zs(e,t.extent);s&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(n,t,e),h=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),h&&n.restore(),this.postRender(n,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,s=this.renderedRotation_,n=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=.5*t[0],l=.5*t[1];a.push(this.getRenderTransform(e,i,s,.5,h,l,0).slice());const c=o.getSource(),u=n.getExtent();if(c.getWrapX()&&n.canWrapX()&&!zs(u,r)){let t=r[0];const n=fn(u);let o,c=0;while(t<u[0])--c,o=n*c,a.push(this.getRenderTransform(e,i,s,.5,h,l,o).slice()),t+=n;c=0,t=r[2];while(t>u[2])++c,o=n*c,a.push(this.getRenderTransform(e,i,s,.5,h,l,o).slice()),t-=n}const d=co();this.hitDetectionImageData_=e_(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,s,o_(i,this.renderedPixelRatio_),d?n:null)}e(i_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,n){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=function(t,e,i){const r=Mi(t),o=h[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return h[r]=!0,n.splice(n.lastIndexOf(o),1),s(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return h[r]=!0,s(t,a,e);n.push(h[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:s})}},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,l,c?e.declutter?.[c]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[ms.ANIMATING],n=t.viewHints[ms.INTERACTING],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!o&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),f=e.getRenderBuffer();let g=e.getRenderOrder();void 0===g&&(g=r_);const p=h.center.slice(),_=ks(a,f*c),m=_.slice(),y=[_.slice()],v=l.getExtent(),x=i.getWrapX()&&l.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!pn(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!zs(v,t.extent)||this.extendX_)){const t=fn(v),e=Math.max(fn(_)/2,t);let i=v[0],s=v[2];this.extendX_&&(i-=t,s+=t),_[0]=i-e,_[2]=s+e,bn(p,l);const n=vn(y[0],l);n[0]<v[0]&&n[2]<v[2]?y.push([n[0]+t,n[1],n[2]+t,n[3]]):n[0]>v[0]&&n[2]>v[2]&&y.push([n[0]-t,n[1],n[2]-t,n[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==g&&this.renderedFrameDeclutter_===!!t.declutter&&zs(this.wrappedRenderedExtent_,_))return vi(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Ep(a_(c,u),_,c,u),E=co();let M;if(E){for(let t=0,e=y.length;t<e;++t){const e=y[t],s=go(e,l);i.loadFeatures(s,_o(c,l),E)}M=no(E,l)}else for(let A=0,G=y.length;A<G;++A)i.loadFeatures(y[A],c,l);const S=o_(c,u);let C=!0;const b=(t,i)=>{let s;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(s=n(t,c)),s){const e=this.renderFeature(t,S,s,w,M,this.getLayer().getDeclutter(),i);C=C&&!e}},P=go(_,l),R=i.getFeaturesInExtent(P);g&&R.sort(g);for(let A=0,G=R.length;A<G;++A)b(R[A],A);this.renderedFeatures_=R,this.ready=C;const I=w.finish(),T=new Zp(_,c,u,i.getOverlaps(),I,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=g,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=l,this.renderedPixelRatio_=u,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let h=0,l=i.length;h<l;++h)a=l_(s,t,i[h],e,this.boundHandleStyleImageChange_,n,r,o)||a;else a=l_(s,t,i,e,this.boundHandleStyleImageChange_,n,r,o);return a}}var x_=v_;class w_ extends uf{constructor(t){super(t)}createRenderer(){return new x_(this)}}var E_=w_;function M_(t){return Array.isArray(t)?Math.min(...t):t}class S_ extends Yu{constructor(t,e,i,s,n,r,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const l=h?ln(i,h):i,c=nn(l),u=Eg(t,e,c,s),d=.5,f=new Rg(t,e,l,a,u*d,s),g=f.calculateSourceExtent(),p=pn(g)?null:r(g,u,n),_=p?Uu.IDLE:Uu.EMPTY,m=p?p.getPixelRatio():1;super(i,s,m,_),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=f,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=p,this.sourcePixelRatio_=m,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Uu.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_;if(!t)return;const e=t.getState();if(e==Uu.LOADED){const e=fn(this.targetExtent_)/this.targetResolution_,i=hn(this.targetExtent_)/this.targetResolution_,s=t.getImage();if(!s)return;this.canvas_=Sg(e,i,this.sourcePixelRatio_,M_(t.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:t.getExtent(),image:s}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==Uu.IDLE){const t=this.sourceImage_;if(!t)return;this.state=Uu.LOADING,this.changed();const e=t.getState();e==Uu.LOADED||e==Uu.ERROR?this.reproject_():(this.sourceListenerKey_=ai(t,ci.CHANGE,()=>{const e=t.getState();e!=Uu.LOADED&&e!=Uu.ERROR||(this.unlistenSource_(),this.reproject_())}),t.load())}}unlistenSource_(){li(this.sourceListenerKey_),this.sourceListenerKey_=null}}var C_=S_;class b_ extends ji{constructor(t){super(),this.projection=Kr(t.projection),this.attributions_=P_(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.canRotate=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const i=()=>{const s=this.getState();"ready"===s?(this.un("change",i),t()):"error"===s&&(this.un("change",i),e(new Error("Source failed to load")))};this.on("change",i)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=P_(t),this.changed()}setState(t){this.state_=t,this.changed()}}function P_(t){return t?"function"===typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var R_=b_;const I_={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class T_ extends Ai{constructor(t,e){super(t),this.image=e}}class A_ extends R_{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.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=_i(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const n=this.getProjection();if(!n||!s||so(n,s))return n&&(s=n),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&so(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ks(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new C_(n,s,t,e,i,(t,e,i)=>this.getImageInternal(t,e,i,n),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const n=O_(t,e,i,1),r=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&zs(this.wantedExtent_,n)||zs(this.image.getExtent(),n))&&(this.wantedResolution_&&M_(this.wantedResolution_)===r||M_(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=n,this.wantedResolution_=r,this.image=new Yu(n,r,i,this.loader),this.image.addEventListener(ci.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Uu.LOADING:this.loading=!0,i=I_.IMAGELOADSTART;break;case Uu.LOADED:this.loading=!1,i=I_.IMAGELOADEND;break;case Uu.ERROR:this.loading=!1,i=I_.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new T_(i,e))}}function G_(t,e){t.getImage().src=e}function O_(t,e,i,s){const n=e/i,r=nn(t),o=Is(fn(t)/n,4),a=Is(hn(t)/n,4),h=Is((s-1)*o/2,4),l=o+2*h,c=Is((s-1)*a/2,4),u=a+2*c;return on(r,n,0,[l,u])}var L_=A_;function N_(t){const e=t.load||qu,i=t.imageExtent,s=t.crossOrigin??null;return()=>{const n=new Image;return n.crossOrigin=s,void 0!==t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),e(n,t.url).then(t=>{const e=fn(i)/t.width,s=hn(i)/t.height,n=e!==s?[e,s]:s;return{image:t,extent:i,resolution:n,pixelRatio:1}})}}class k_ extends L_{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:G_;super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new Yu(this.imageExtent_,void 0,1,N_({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,referrerPolicy:t.referrerPolicy,load:(t,e)=>{const s=this.image;return s.setImage(t),i(s,e),qu(t)}}));const s=this.image;s.addEventListener(ci.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){const n=this.image;return n&&gn(t,n.getExtent())?n:null}getUrl(){return this.url_}}var F_=k_;const D_=[0,0,0],j_=5;class z_{constructor(t){let e=t.minZoom;const i=t.resolutions;let s;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,cs(xi(this.resolutions_,(t,e)=>e-t,!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let r=0,o=this.resolutions_.length-1;r<o;++r)if(s){if(this.resolutions_[r]/this.resolutions_[r+1]!==s){s=void 0;break}}else s=this.resolutions_[r]/this.resolutions_[r+1];this.zoomFactor_=s,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,cs(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=un(n)),cs(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,cs(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,cs(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const i=new _g(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(n){const t=this.getTileRangeForExtentAndZ(n,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let n=s.minX,r=s.maxX;n<=r;++n)for(let t=s.minY,o=s.maxY;t<=o;++t)i([e,n,t])}forEachTileCoordParentTileRange(t,e,i,s){let n,r,o,a=null,h=t[0]-1;2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,s);while(h>=this.minZoom){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),n=pg(r,r,o,o,i)):n=this.getTileRangeForExtentAndZ(a,h,i),e(h,n))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_?this.origins_[t]:[0,0]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],s=2*t[2];return pg(i,i+1,s,s+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],n=t[1],r=t[2];if(e===s)return pg(n,n,r,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-s),o=Math.floor(n*t),a=Math.floor(r*t);if(e<s)return pg(o,o,a,a,i);const h=Math.floor(t*(n+1))-1,l=Math.floor(t*(r+1))-1;return pg(o,h,a,l,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,D_);const s=D_[1],n=D_[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,D_);const r=D_[1],o=D_[2];return pg(s,r,n,o,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Gc(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),n=Gc(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*n[0]*s,o=i[1]-(t[2]+1)*n[1]*s,a=r+n[0]*s,h=o+n[1]*s;return Xs(r,o,a,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,n){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=Gc(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return s?(l=Is(l,j_)-1,c=Is(c,j_)-1):(l=Rs(l,j_),c=Rs(c,j_)),Og(r,l,c,n)}getTileCoordForXYAndZ_(t,e,i,s,n){const r=this.getOrigin(i),o=this.getResolution(i),a=Gc(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return s?(h=Is(h,j_)-1,l=Is(l,j_)-1):(h=Rs(h,j_),l=Rs(l,j_)),Og(i,h,l,n)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_?this.tileSizes_[t]:256}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=_i(this.resolutions_,t,e||0);return vs(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return fa(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}var U_=z_;function B_(t){let e=t.getDefaultTileGrid();return e||(e=Y_(t),t.setDefaultTileGrid(e)),e}function W_(t,e,i){const s=e[0],n=t.getTileCoordCenter(e),r=K_(i);if(!js(r,n)){const e=fn(r),i=Math.ceil((r[0]-n[0])/e);return n[0]+=e*i,t.getTileCoordForCoordAndZ(n,s)}return e}function X_(t,e,i,s){s=void 0!==s?s:"top-left";const n=q_(t,e,i);return new U_({extent:t,origin:rn(t,s),resolutions:n,tileSize:i})}function V_(t){const e=t||{},i=e.extent||Kr("EPSG:3857")?.getExtent();if(!i)throw new Error("Unable to determine extent for XYZ tile grid");const s={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:q_(i,e.maxZoom,e.tileSize,e.maxResolution)};return new U_(s)}function q_(t,e,i,s){e=void 0!==e?e:42,i=Gc(void 0!==i?i:256);const n=hn(t),r=fn(t);s=void 0!==s&&s>0?s:Math.max(r/i[0],n/i[1]);const o=e+1,a=new Array(o);for(let h=0;h<o;++h)a[h]=s/Math.pow(2,h);return a}function Y_(t,e,i,s){const n=K_(t);return X_(n,e,i,s)}function K_(t){const e=Kr(t);if(!e)throw new Error("Unable to determine extent from unknown projection");let i=e.getExtent();if(!i){const t=e.getMetersPerUnit();if(void 0===t)throw new Error("Unable to determine extent from projection without units");const s=180*Fn.degrees/t;i=Xs(-s,-s,s,s)}return i}const H_=/\{z\}/g,$_=/\{x\}/g,Z_=/\{y\}/g,J_=/\{-y\}/g;function Q_(t,e,i,s,n){return t.replace(H_,e.toString()).replace($_,i.toString()).replace(Z_,s.toString()).replace(J_,function(){if(void 0===n)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-s).toString()})}function tm(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const s=i[1].charCodeAt(0),n=i[2].charCodeAt(0);let r;for(r=s;r<=n;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const s=parseInt(i[2],10);for(let n=parseInt(i[1],10);n<=s;n++)e.push(t.replace(i[0],n.toString()));return e}return e.push(t),e}function em(t,e){return function(i,s,n){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return Q_(t,o,i[1],i[2],r)}}function im(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=em(t[n],e);return sm(s)}function sm(t){return 1===t.length?t[0]:function(e,i,s){if(!e)return;const n=kg(e),r=Cs(n,t.length);return t[r](e,i,s)}}class nm extends R_{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.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&Gc(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||Mi(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,n,r){return wi()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:B_(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),r=Gc(s.getTileSize(t),this.tmpSize);return 1==n?r:Ac(r,n,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),s=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=W_(s,t,i)),Dg(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class rm extends Ai{constructor(t,e){super(t),this.tile=e}}var om=nm,am={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class hm extends om{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===hm.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=Mi(e),s=e.getState();let n;s==ls.LOADING?(this.tileLoadingKeys_[i]=!0,n=am.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],n=s==ls.ERROR?am.TILELOADERROR:s==ls.LOADED?am.TILELOADEND:void 0),void 0!=n&&this.dispatchEvent(new rm(n,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,"undefined"!==typeof e?this.setKey(e):this.changed()}setUrl(t){const e=tm(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(im(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}var lm=hm;class cm extends lm{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:um,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.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:fg,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){const e=this.getProjection();return e&&t&&!so(e,t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||so(e,t)))return this.tileGrid;const i=Mi(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=B_(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,n,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,n),h=a?this.tileUrlFunction(a,s,n):void 0,l=new this.tileClass(o,void 0!==h?ls.IDLE:ls.EMPTY,void 0!==h?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(ci.CHANGE,this.handleTileChange.bind(this)),l}getTile(t,e,i,s,n,r){const o=this.getProjection();if(!o||!n||so(o,n))return this.getTileInternal(t,e,i,s,o||n);const a=[t,e,i],h=this.getKey(),l=this.getTileGridForProjection(o),c=this.getTileGridForProjection(n),u=this.getTileCoordForTileUrlFunction(a,n)||a,d=new Tg(o,l,n,c,a,u,this.getTilePixelRatio(s),this.getGutter(),(t,e,i,s)=>this.getTileInternal(t,e,i,s,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=h,d}getTileInternal(t,e,i,s,n,r){const o=this.getKey(),a=Ng(this,o,t,e,i);if(r&&r.containsKey(a)){const t=r.get(a);return t}const h=this.createTile_(t,e,i,s,n,o);return r?.set(a,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Kr(t);if(i){const t=Mi(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function um(t,e){if(ts){const i=t.getCrossOrigin();let s="same-origin",n="same-origin";"anonymous"===i||""===i?(s="cors",n="omit"):"use-credentials"===i&&(s="cors",n="include");const r={mode:s,credentials:n,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,r).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();if(!i)return;i.width=e.width,i.height=e.height;const s=i.getContext("2d");s&&(s.drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load")))}).catch(()=>{const e=t.getImage();e?.dispatchEvent(new Event("error"))})}t.getImage().src=e}var dm=cm;class fm extends dm{constructor(t){t=t||{};const e=void 0!==t.projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:V_({extent:K_(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,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.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}var gm=fm;let pm=!1;function _m(t,e,i,s,n,r,o){const a=new XMLHttpRequest;a.open("GET","function"===typeof t?t(i,s,n):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=pm,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let s;"text"==t||"json"==t?s=a.responseText:"xml"==t?s=a.responseXML||a.responseText:"arraybuffer"==t&&(s=a.response),s?r(e.readFeatures(s,{extent:i,featureProjection:n}),e.readProjection(s)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function mm(t,e){return function(i,s,n,r,o){_m(t,e,i,s,n,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function ym(t,e){return[[-1/0,-1/0,1/0,1/0]]}function vm(t,e,i,s){const n=[];let r=Ws();for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Ys(t,e,a[0],s),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return n}function xm(t,e,i,s,n,r,o){let a,h;const l=(i-e)/s;if(1===l)a=e;else if(2===l)a=e,h=n;else if(0!==l){let r=t[e],o=t[e+1],l=0;const c=[0];for(let n=e+s;n<i;n+=s){const e=t[n],i=t[n+1];l+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(l),r=e,o=i}const u=n*l,d=fi(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*s):a=e+d*s}o=void 0!==o&&o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=void 0===a?NaN:void 0===h?t[a+c]:bs(t[a+c],t[a+s+c],h);return r}function wm(t,e,i,s,n,r){if(i==e)return null;let o;if(n<t[e+s-1])return r?(o=t.slice(e,e+s),o[s-1]=n,o):null;if(t[i-1]<n)return r?(o=t.slice(i-s,i),o[s-1]=n,o):null;if(n==t[e+s-1])return t.slice(e,e+s);let a=e/s,h=i/s;while(a<h){const e=a+h>>1;n<t[(e+1)*s-1]?h=e:a=e+1}const l=t[a*s-1];if(n==l)return t.slice((a-1)*s,(a-1)*s+s);const c=t[(a+1)*s-1],u=(n-l)/(c-l);o=[];for(let d=0;d<s-1;++d)o.push(bs(t[(a-1)*s+d],t[a*s+d],u));return o.push(n),o}function Em(t,e,i,s,n,r,o){if(o)return wm(t,e,i[i.length-1],s,n,r);let a;if(n<t[s-1])return r?(a=t.slice(0,s),a[s-1]=n,a):null;if(t[t.length-1]<n)return r?(a=t.slice(t.length-s),a[s-1]=n,a):null;for(let h=0,l=i.length;h<l;++h){const r=i[h];if(e!=r){if(n<t[e+s-1])return null;if(n<=t[r-1])return wm(t,e,r,s,n,!1);e=r}}return null}const Mm=xo();class Sm{constructor(t,e,i,s,n,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=n,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?qs(this.flatCoordinates_):Ys(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=nn(this.getExtent());this.flatInteriorPoints_=ba(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=La(this.flatCoordinates_,this.ends_),e=vm(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Pa(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=xm(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,n=i.length;s<n;++s){const n=i[s],r=xm(t,e,n,this.stride_,.5);yi(this.flatMidpoints_,r),e=n}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Kr(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const t=hn(i)/hn(e);Mo(Mm,i[0],i[3],t,-t,0,0,0),To(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Mm,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Sm(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Ri((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=_a(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=ma(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=xa(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break;default:}return s&&(this.simplifiedGeometry_=new Sm(this.type_,i,s,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Sm.prototype.getFlatCoordinates=Sm.prototype.getOrientedFlatCoordinates;var Cm=Sm;class bm{constructor(t){this.rbush_=new Vl(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[Mi(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,n=e.length;s<n;s++){const n=t[s],r=e[s],o={minX:n[0],minY:n[1],maxX:n[2],maxY:n[3],value:r};i[s]=o,this.items_[Mi(r)]=o}this.rbush_.load(i)}remove(t){const e=Mi(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[Mi(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Ks(s,t)||(this.remove(e),this.insert(t,e))}getAll(){const t=this.rbush_.all();return t.map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]},i=this.rbush_.search(e);return i.map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,n=t.length;s<n;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return oi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Xs(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}var Pm=bm,Rm={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Im extends Ai{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Tm extends R_{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.canRotate=!0,this.on,this.once,this.un,this.loader_=Pi,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(cs(this.format_,"`format` must be set when `url` is set"),this.loader_=mm(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ym;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,s;this.featuresRtree_=e?new Pm:null,this.loadedExtentsRtree_=new Pm,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),e||void 0!==i||(i=new Wi(s)),void 0!==s&&this.addFeaturesInternal(s),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Mi(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Im(Rm.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Cm||(this.featureChangeKeys_[t]=[ai(e,ci.CHANGE,this.handleFeatureChange_,this),ai(e,ni.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Cm){const s=this.idIndex_[t];s instanceof Cm?Array.isArray(s)?s.push(e):this.idIndex_[t]=[s,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(cs(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let n=0,r=t.length;n<r;n++){const e=t[n],s=Mi(e);this.addToIndex_(s,e)&&i.push(e)}for(let n=0,r=i.length;n<r;n++){const t=i[n],r=Mi(t);this.setupChangeEvents_(r,t);const o=t.getGeometry();if(o){const i=o.getExtent();e.push(i),s.push(t)}else this.nullGeometryFeatures_[r]=t}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Rm.ADDFEATURE))for(let n=0,r=i.length;n<r;n++)this.dispatchEvent(new Im(Rm.ADDFEATURE,i[n]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Rm.ADDFEATURE,function(i){!e&&i.feature&&(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Rm.REMOVEFEATURE,function(i){!e&&i.feature&&(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(si.ADD,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(si.REMOVE,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){const e=this.featureChangeKeys_[t];e.forEach(li)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Im(Rm.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const s=i.getGeometry();if(s instanceof Cm||s&&s.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof Cm||s&&s.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),oi(this.nullGeometryFeatures_)||yi(t,Object.values(this.nullGeometryFeatures_))),t||[]}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){const i=e&&e.canWrapX()&&this.getWrapX();if(!i)return this.featuresRtree_.getInExtent(t);const s=this.featuresRtree_,n=xn(t,e);return n.flatMap(t=>s.getInExtent(t))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let n=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];e=e||Ci;const h=this.featuresRtree_;return h?(h.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry();if(!e)return;const h=o;if(o=e instanceof Cm?0:e.closestPointXY(i,s,r,o),o<h){n=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=s-e,a[2]=i+e,a[3]=s+e}}}),n):null}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=Mi(e),s=e.getGeometry();if(s){const t=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const n=e.getId();if(void 0!==n){const t=n.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Im(Rm.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();if(void 0!==e){const i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return Mi(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&oi(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,n=this.strategy_(t,e,i);for(let r=0,o=n.length;r<o;++r){const t=n[r],o=s.forEachInExtent(t,function(e){return zs(e.extent,t)});if(!o){this.loading=Number(this.loading)+1,this.dispatchEvent(new Im(Rm.FEATURESLOADSTART));const n=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Im(Rm.FEATURESLOADEND,void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Im(Rm.FEATURESLOADERROR))};let o=!1;const a=this.loader_.call(this,t,e,i,t=>o||n(t),()=>o||r());Si(a)?(o=!0,a.then(t=>{const e=t;this.addFeatures(e),n(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),s.insert(t,{extent:t.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(t){i.push(t)}),i.forEach(i=>{e.remove(i);const s=cn(i.extent,t);for(const t of s)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;const e=this.removeFeatureInternal(t);e&&this.changed()}removeFeatureInternal(t){const e=Mi(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(li),delete this.featureChangeKeys_[e];const s=t.getId();if(void 0!==s){const e=s.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(Rm.REMOVEFEATURE)&&this.dispatchEvent(new Im(Rm.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){cs(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(mm(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}var Am=Tm;class Gm extends ji{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"===typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Gm,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const s=this.getGeometry();for(const n in i)n===e&&s?t.set(n,s.clone()):t.set(n,i[n],!0)}const s=this.getStyle();return s&&t.setStyle(s),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=ai(t,ci.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t??null,this.styleFunction_=t?Om(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}function Om(t){if("function"===typeof t)return t;let e;if(Array.isArray(t))e=t;else{cs("function"===typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");const i=t;e=[i]}return function(){return e}}var Lm=Gm;class Nm extends Fo{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(li),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(ai(t[e],ci.CHANGE,this.changed,this))}clone(){const t=new Nm(km(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Ds(this.getExtent(),t,e))return s;const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)s=n[r].closestPointXY(t,e,i,s);return s}containsXY(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)if(i[s].containsXY(t,e))return!0;return!1}computeExtent(t){Vs(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)Hs(t,e[i].getExtent());return t}getGeometries(){return km(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,s=e.length;i<s;++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.geometries_;let s=!1;for(let n=0,r=i.length;n<r;++n){const r=i[n],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(s=!0)}if(s){const t=new Nm(e);return t}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].rotate(t,e);this.changed()}scale(t,e,i){i||(i=nn(this.getExtent()));const s=this.geometries_;for(let n=0,r=s.length;n<r;++n)s[n].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(km(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function km(t){return t.map(t=>t.clone())}var Fm=Nm;class Dm extends Bo{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){yi(this.flatCoordinates,t),this.changed()}clone(){const t=new Dm(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$o(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return ca(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,wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Mp(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=_a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Dm(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var jm=Dm;class zm extends Bo{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],s=[];for(let t=0,r=e.length;t<r;++t){const n=e[t];yi(i,n.getFlatCoordinates()),s.push(i.length)}const n=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(n,i),this.ends_=s}}appendLineString(t){yi(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new zm(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ko(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}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,Em(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return na(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new jm(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let n=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new jm(t.slice(n,o),i);s.push(a),n=o}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,n=t.length;s<n;++s)i+=Mp(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,n=this.stride;for(let r=0,o=s.length;r<o;++r){const o=s[r],a=xm(e,i,o,n,.5);yi(t,a),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=ma(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new zm(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return da(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ea(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Um=zm;class Bm extends Bo{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){yi(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Bm(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Ds(this.getExtent(),t,e))return s;const n=this.flatCoordinates,r=this.stride;for(let o=0,a=n.length;o<a;o+=r){const a=ws(t,e,n[o],n[o+1]);if(a<s){s=a;for(let t=0;t<r;++t)i[t]=n[o+t];i.length=r}}return s}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Ca(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let n=0,r=t.length;n<r;n+=i){const r=new Ca(t.slice(n,n+i),e);s.push(r)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,n=e.length;s<n;s+=i){const i=e[s],n=e[s+1];if(Us(t,i,n))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var Wm=Bm;class Xm extends Bo{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const s=t,n=[],r=[];for(let t=0,e=s.length;t<e;++t){const e=s[t],i=n.length,o=e.getEnds();for(let t=0,s=o.length;t<s;++t)o[t]+=i;yi(n,e.getFlatCoordinates()),r.push(o)}e=0===s.length?this.getLayout():s[0].getLayout(),t=n,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;yi(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,s=e.length;t<s;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const i=new Xm(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return la(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Vo(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Oa(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,ra(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=vm(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Pa(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Wm(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Aa(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Oa(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=wa(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Xm(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(0!==e)for(let n=0,r=i.length;n<r;++n)i[n]-=e;return new ka(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==n)for(let t=0,e=o.length;t<e;++t)o[t]-=n;const h=new ka(e.slice(n,a),t,o);s.push(h),n=a}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return pa(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=ia(this.flatCoordinates,0,t,this.stride,this.endss_);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 Vm=Xm;class qm{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Lm,this.supportedMediaTypes=void 0}getReadOptions(t,e){if(e){let i=e.dataProjection?Kr(e.dataProjection):this.readProjection(t);if(e.extent&&i&&"tile-pixels"===i.getUnits()){const t=Kr(i);t&&(t.setWorldExtent(e.extent),i=t)}e={dataProjection:i??void 0,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return wi()}readFeature(t,e){return wi()}readFeatures(t,e){return wi()}readGeometry(t,e){return wi()}readProjection(t){return wi()}writeFeature(t,e){return wi()}writeFeatures(t,e){return wi()}writeGeometry(t,e){return wi()}}var Ym=qm;function Km(t,e,i){const s=i?Kr(i.featureProjection):null,n=i?Kr(i.dataProjection):null;let r=t;if(s&&n&&!so(s,n)){e&&(r=t.clone());const i=e?s:n,o=e?n:s;if("tile-pixels"===i.getUnits())r.transform(i,o);else{const t=oo(i,o);t&&r.applyTransform(t)}}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),s=function(t){for(let i=0,s=t.length;i<s;++i)t[i]=Math.round(t[i]*e)/e;return t};r===t&&(r=t.clone()),r.applyTransform(s)}return r}function Hm(t,e,i){if(Array.isArray(e[0])){const s=e;return Aa(t,0,s,i)||(t=t.slice(),Oa(t,0,s,i)),t}const s=e;return Ta(t,0,s,i)||(t=t.slice(),Ga(t,0,s,i)),t}function $m(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>$m({...t,geometry:e})).flat();const s="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===s||"Circle"===s)throw new Error("Unsupported geometry type: "+s);const n=(i.layout??"XY").length;return Km(new Cm(s,"Polygon"===s?Hm(i.flatCoordinates,i.ends,n):i.flatCoordinates,i.ends?.flat()??[],n,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Zm(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Zm(t,e));return new Fm(i)}const i=t.type,s=t.layout||"XY";let n;switch(i){case"Point":n=new Ca(t.flatCoordinates,s);break;case"LineString":n=new jm(t.flatCoordinates,s);break;case"Polygon":n=new ka(t.flatCoordinates,s,t.ends);break;case"MultiPoint":n=new Wm(t.flatCoordinates,s);break;case"MultiLineString":n=new Um(t.flatCoordinates,s,t.ends);break;case"MultiPolygon":n=new Vm(t.flatCoordinates,s,t.ends);break;default:throw new Error("Unsupported geometry type: "+i)}return Km(n,!1,e)}class Jm extends Ym{constructor(){super()}getType(){return"json"}readFeature(t,e){const i=Qm(t);return i?this.readFeatureFromObject(i,this.getReadOptions(t,e)):[]}readFeatures(t,e){const i=Qm(t);return i?this.readFeaturesFromObject(i,this.getReadOptions(t,e)):[]}readFeatureFromObject(t,e){return wi()}readFeaturesFromObject(t,e){return wi()}readGeometry(t,e){const i=Qm(t);if(!i)throw new Error("Expected a JSON object");return this.readGeometryFromObject(i,this.getReadOptions(t,e))}readGeometryFromObject(t,e){return wi()}readProjection(t){const e=Qm(t);if(!e)throw new Error("Expected a JSON object");return this.readProjectionFromObject(e)}readProjectionFromObject(t){return wi()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return wi()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return wi()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return wi()}}function Qm(t){if("string"===typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}var ty=Jm;class ey extends ty{constructor(t){t=t||{},super(),this.dataProjection=Kr(t.dataProjection?t.dataProjection:"EPSG:4326")??void 0,t.featureProjection&&(this.defaultFeatureProjection=Kr(t.featureProjection)??void 0),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){const i=t;let s;s="Feature"===i["type"]?i:{type:"Feature",geometry:t,properties:null};const n=iy(s["geometry"],e);if(this.featureClass===Cm)return $m({geometry:n??void 0,id:s["id"],properties:s["properties"]??void 0},e);const r=this.featureClass,o=new r;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in s&&s["geometry_name"]&&o.setGeometryName(s["geometry_name"]),o.setGeometry(Zm(n,e)),"id"in s&&o.setId(s["id"]),s["properties"]&&o.setProperties(s["properties"],!0),o}readFeaturesFromObject(t,e){const i=t;let s=null;if("FeatureCollection"===i["type"]){const i=t;s=[];const n=i["features"];for(let t=0,r=n.length;t<r;++t){const i=this.readFeatureFromObject(n[t],e);i&&s.push(i)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return sy(t,e)}readProjectionFromObject(t){const e=t,i=e["crs"];let s;if(i)if("name"==i["type"])s=Kr(i["properties"]["name"]);else{if("EPSG"!==i["type"])throw new Error("Unknown SRS type");s=Kr("EPSG:"+i["properties"]["code"])}else s=this.dataProjection;return s}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},s=t.getId();if(void 0!==s&&(i.id=s),!t.hasProperties())return i;const n=t.getProperties(),r=t.getGeometry();return r&&(i.geometry=uy(r,e),delete n[t.getGeometryName()]),oi(n)||(i.properties=n),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let s=0,n=t.length;s<n;++s)i.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return uy(t,this.adaptOptions(e))}}function iy(t,e){if(!t||"GeometryCollection"!==t.type&&Array.isArray(t.coordinates)&&!t.coordinates.length)return null;let i;switch(t["type"]){case"Point":i=ry(t);break;case"LineString":i=oy(t);break;case"Polygon":i=cy(t);break;case"MultiPoint":i=hy(t);break;case"MultiLineString":i=ay(t);break;case"MultiPolygon":i=ly(t);break;case"GeometryCollection":i=ny(t);break;default:throw new Error("Unsupported GeoJSON type: "+t["type"])}return i}function sy(t,e){const i=iy(t,e);return i?Zm(i,e):null}function ny(t,e){const i=t["geometries"],s=[];for(const n of i){const t=iy(n,e);t&&s.push(t)}return s}function ry(t){const e=t["coordinates"];return{type:"Point",flatCoordinates:e,layout:jo(e.length)}}function oy(t){const e=t["coordinates"],i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:jo(e[0]?.length||2)}}function ay(t){const e=t["coordinates"],i=e[0]?.[0]?.length||2,s=[],n=ea(s,0,e,i);return{type:"MultiLineString",flatCoordinates:s,ends:n,layout:jo(i)}}function hy(t){const e=t["coordinates"];return{type:"MultiPoint",flatCoordinates:e.flat(),layout:jo(e[0]?.length||2)}}function ly(t){const e=t["coordinates"],i=[],s=e[0]?.[0]?.[0].length||2,n=ia(i,0,e,s);return{type:"MultiPolygon",flatCoordinates:i,ends:n,layout:jo(s)}}function cy(t){const e=t["coordinates"],i=[],s=e[0]?.[0]?.length,n=ea(i,0,e,s);return{type:"Polygon",flatCoordinates:i,ends:n,layout:jo(s)}}function uy(t,e){t=Km(t,!0,e);const i=t.getType();let s;switch(i){case"Point":s=my(t,e);break;case"LineString":s=fy(t,e);break;case"Polygon":s=yy(t,e);break;case"MultiPoint":s=py(t,e);break;case"MultiLineString":s=gy(t,e);break;case"MultiPolygon":s=_y(t,e);break;case"GeometryCollection":s=dy(t,e);break;case"Circle":s={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return s}function dy(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map(function(t){return uy(t,e)});return{type:"GeometryCollection",geometries:i}}function fy(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}function gy(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}function py(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}function _y(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}function my(t,e){return{type:"Point",coordinates:t.getCoordinates()}}function yy(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}var vy=ey;const xy=["fullscreenchange","webkitfullscreenchange"],wy={ENTERFULLSCREEN:"enterfullscreen",LEAVEFULLSCREEN:"leavefullscreen"};class Ey extends Ch{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⛶";this.labelNode_="string"===typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"===typeof i?document.createTextNode(i):i;const s=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=s,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_);const n=this.element;n.className=`${this.cssClassName_} ${sh} ${rh}`,n.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(My(e))if(Sy(e))Py(e);else{let i;if(i=this.source_?"string"===typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),!i)return;this.keys_?by(i):Cy(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=Sy(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(vh(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(wy.ENTERFULLSCREEN)):(vh(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(wy.LEAVEFULLSCREEN)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(hs.TARGET,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(hs.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let i=0,s=t.length;i<s;++i)li(t[i]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();My(i)?this.element.classList.remove(nh):this.element.classList.add(nh);for(let e=0,s=xy.length;e<s;++e)t.push(ai(i,xy[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function My(t){const e=t.body;return!!(e.webkitRequestFullscreen||"requestFullscreen"in e&&t.fullscreenEnabled)}function Sy(t){const e=t;return!(!e.webkitIsFullScreen&&!t.fullscreenElement)}function Cy(t){const e=t;t.requestFullscreen?t.requestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function by(t){const e=t;e.webkitRequestFullscreen?e.webkitRequestFullscreen():Cy(t)}function Py(t){const e=t;t.exitFullscreen?t.exitFullscreen():e.webkitExitFullscreen&&e.webkitExitFullscreen()}var Ry=Ey;const Iy="units",Ty=[1,2,5],Ay=25.4/.28;class Gy extends Ch{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+sh,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Iy,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(Iy)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(Iy,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t){const t=this.element;return void(this.renderedVisible_&&t&&(t.style.display="none",this.renderedVisible_=!1))}const e=t.center,i=t.projection,s=this.getUnits(),n="degrees"==s?"degrees":"m";let r=Hr(i,t.resolution,e,n);const o=this.minWidth_*(this.dpi_||Ay)/Ay,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||Ay)/Ay:void 0;let h=o*r,l="";if("degrees"==s){const t=Fn.degrees;h*=t,h<t/60?(l="″",r*=3600):h<t?(l="′",r*=60):l="°"}else if("imperial"==s)h<.9144?(l="in",r/=.0254):h<1609.344?(l="ft",r/=.3048):(l="mi",r/=1609.344);else if("nautical"==s)r/=1852,l="NM";else if("metric"==s)h<1e-6?(l="nm",r*=1e9):h<.001?(l="μm",r*=1e6):h<1?(l="mm",r*=1e3):h<1e3?l="m":(l="km",r/=1e3);else{if("us"!=s)throw new Error("Invalid units");h<.9144?(l="in",r*=39.37):h<1609.344?(l="ft",r/=.30480061):(l="mi",r/=1609.3472)}let c,u,d,f,g=3*Math.floor(Math.log(o*r)/Math.log(10)),p=0,_=0;while(1){p=Math.floor(g/3);const t=Math.pow(10,p);if(c=Ty[(g%3+3)%3]*t,u=Math.round(c/r),isNaN(u)){const t=this.element;return t&&(t.style.display="none"),void(this.renderedVisible_=!1)}if(void 0!==a&&u>=a){c=_,u=d,p=f;break}if(u>=o)break;_=c,d=u,f=p,++g}const m=this.scaleBar_?this.createScaleBar(u,c,l):c.toFixed(p<0?-p:0)+" "+l;if(this.renderedHTML_!=m&&(this.innerElement_.innerHTML=m,this.renderedHTML_=m),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),!this.renderedVisible_){const t=this.element;t&&(t.style.display=""),this.renderedVisible_=!0}}createScaleBar(t,e,i){const s=this.getScaleForResolution(),n=s<1?Math.round(1/s).toLocaleString()+" : 1":"1 : "+Math.round(s).toLocaleString(),r=this.scaleBarSteps_,o=t/r,a=[this.createMarker("absolute")];for(let l=0;l<r;++l){const s=l%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";a.push(`<div><div class="ol-scale-singlebar ${s}" style="width: ${o}px;"></div>`+this.createMarker("relative")+(l%2===0||2===r?this.createStepText(l,t,!1,e,i):"")+"</div>")}a.push(this.createStepText(r,t,!0,e,i));const h=this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+n+"</div>":"";return h+a.join("")}createMarker(t){const e="absolute"===t?3:-10;return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${e}px;"></div>`}createStepText(t,e,i,s,n){const r=0===t?0:Math.round(s/this.scaleBarSteps_*t*100)/100,o=r+(0===t?"":" "+n),a=0===t?-3:e/this.scaleBarSteps_*-1,h=0===t?0:e/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${a}px;text-align: ${0===t?"left":"center"};min-width: ${h}px;left: ${i?e+"px":"unset"};">`+o+"</div>"}getScaleForResolution(){const t=this.viewState_;if(!t)return 0;const e=Hr(t.projection,t.resolution,t.center,"m"),i=this.dpi_||Ay,s=1e3/25.4;return e*s*i}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}}var Oy=Gy;const Ly="projection",Ny="coordinateFormat";class ky extends Ch{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(Ly,this.handleProjectionChanged_),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.renderOnMouseOut_=void 0!==t.placeholder,this.placeholder_=this.renderOnMouseOut_?t.placeholder:" ",this.renderedHTML_=e.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=!1!==t.wrapX}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(Ny)}getProjection(){return this.get(Ly)}handleMouseMove(t){const e=this.getMap();e&&this.updateHTML_(e.getEventPixel(t))}handleMouseOut(t){this.updateHTML_(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();if(!e)return;this.listenerKeys.push(ai(e,ns.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(ai(e,ns.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(t){this.set(Ny,t)}setProjection(t){this.set(Ly,Kr(t))}updateHTML_(t){let e=this.placeholder_;if(t&&this.mapProjection_){if(!this.transform_){const t=this.getProjection();this.transform_=t?no(this.mapProjection_,t):Vr}const i=this.getMap();if(!i)return;const s=i.getCoordinateFromPixelInternal(t);if(s){const t=co();t&&(this.transform_=no(this.mapProjection_,t));const i=this.transform_;if(i&&i(s,s),this.wrapX_){const e=t||this.getProjection()||this.mapProjection_;bn(s,e)}const n=this.getCoordinateFormat();e=n?n(s):s.toString()}}if(!this.renderedHTML_||e!==this.renderedHTML_){const t=this.element;t&&(t.innerHTML=e,this.renderedHTML_=e)}}render(t){const e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}}var Fy=ky;function Dy(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var jy=1,zy=2,Uy=3,By=4,Wy=5,Xy=6378137,Vy=6356752.314,qy=.0066943799901413165,Yy=484813681109536e-20,Ky=Math.PI/2,Hy=.16666666666666666,$y=.04722222222222222,Zy=.022156084656084655,Jy=1e-10,Qy=.017453292519943295,tv=57.29577951308232,ev=Math.PI/4,iv=2*Math.PI,sv=3.14159265359,nv={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},rv=nv,ov={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},av=/[\s_\-\/\(\)]/g;function hv(t,e){if(t[e])return t[e];var i,s,n=Object.keys(t),r=e.toLowerCase().replace(av,""),o=-1;while(++o<n.length)if(i=n[o],s=i.toLowerCase().replace(av,""),s===r)return t[i]}function lv(t){var e,i,s,n={},r=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:function(t){n.projName=["lonlat","latlon","latlong"].includes(t)?"longlat":t},datum:"datumCode",rf:function(t){n.rf=parseFloat(t)},lat_0:function(t){n.lat0=t*Qy},lat_1:function(t){n.lat1=t*Qy},lat_2:function(t){n.lat2=t*Qy},lat_ts:function(t){n.lat_ts=t*Qy},lon_0:function(t){n.long0=t*Qy},lon_wrap:function(t){n.long_wrap=parseFloat(t)*Qy},lon_1:function(t){n.long1=t*Qy},lon_2:function(t){n.long2=t*Qy},alpha:function(t){n.alpha=parseFloat(t)*Qy},gamma:function(t){n.rectified_grid_angle=parseFloat(t)*Qy},lonc:function(t){n.longc=t*Qy},x_0:function(t){n.x0=parseFloat(t)},y_0:function(t){n.y0=parseFloat(t)},k_0:function(t){n.k0=parseFloat(t)},k:function(t){n.k0=parseFloat(t)},a:function(t){n.a=parseFloat(t)},b:function(t){n.b=parseFloat(t)},r:function(t){n.a=n.b=parseFloat(t)},r_a:function(){n.R_A=!0},zone:function(t){n.zone=parseInt(t,10)},south:function(){n.utmSouth=!0},towgs84:function(t){n.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){n.to_meter=parseFloat(t)},units:function(t){n.units=t;var e=hv(ov,t);e&&(n.to_meter=e.to_meter)},from_greenwich:function(t){n.from_greenwich=t*Qy},pm:function(t){var e=hv(rv,t);n.from_greenwich=(e||parseFloat(t))*Qy},nadgrids:function(t){"@null"===t?n.datumCode="none":n.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(n.axis=t)},approx:function(){n.approx=!0},over:function(){n.over=!0}};for(e in r)i=r[e],e in o?(s=o[e],"function"===typeof s?s(i):n[s]=i):n[e]=i;return"string"===typeof n.datumCode&&"WGS84"!==n.datumCode&&(n.datumCode=n.datumCode.toLowerCase()),n["projStr"]=t,n}class cv{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],s=parseFloat(t[2])||null,n=t.find(t=>Array.isArray(t)&&"ID"===t[0]),r=n?{authority:n[1],code:parseInt(n[2],10)}:null;return{type:e,name:i,conversion_factor:s,id:r}}static convertAxis(t){const e=t[1]||"Unknown";let i;const s=e.match(/^\((.)\)$/);if(s){const e=s[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const n=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),r=n?parseInt(n[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0])),a=this.convertUnit(o);return{name:e,direction:i,unit:a,order:r}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(s){const t=this.convertUnit(s);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const n=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(n){const i=this.convert(n);"ENSEMBLE"===n[0]?e.datum_ensemble=i:e.datum=i;const s=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);s&&"Greenwich"!==s[1]&&(i.prime_meridian={name:s[1],longitude:parseFloat(s[2])})}const r=t.find(t=>Array.isArray(t)&&"CS"===t[0]);e.coordinate_system={subtype:r?r[1]:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const o=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);o&&(e.accuracy=parseFloat(o[1]));const a=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);a&&(e.ellipsoid=this.convert(a)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]);t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const h=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(h){const t=h.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const c=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=c?this.convert(c):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0];break}return e}}var uv=cv;function dv(t){return uv.convert(t)}function fv(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}var gv=Pv,pv=1,_v=2,mv=3,yv=4,vv=5,xv=-1,wv=/\s/,Ev=/[A-Za-z]/,Mv=/[A-Za-z84_]/,Sv=/[,\]]/,Cv=/[\d\.E\-\+]/;function bv(t){if("string"!==typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=pv}function Pv(t){var e=new bv(t);return e.output()}function Rv(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,n=i.reduce(function(t,e){return Iv(e,t),t},s);e&&(t[e]=n)}function Iv(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Iv(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var s;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Iv(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Iv(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Rv(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Rv(e,i,t),void(e[i].type=i);default:s=-1;while(++s<t.length)if(!Array.isArray(t[s]))return Iv(t,e[i]);return Rv(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}bv.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==yv)while(wv.test(t)){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case pv:return this.neutral(t);case _v:return this.keyword(t);case yv:return this.quoted(t);case vv:return this.afterquote(t);case mv:return this.number(t);case xv:return}},bv.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=yv);if(Sv.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},bv.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=pv)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=pv,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=xv))):void 0},bv.prototype.number=function(t){if(!Cv.test(t)){if(Sv.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},bv.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=vv},bv.prototype.keyword=function(t){if(Mv.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=pv)}if(!Sv.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},bv.prototype.neutral=function(t){if(Ev.test(t))return this.word=t,void(this.state=_v);if('"'===t)return this.word="",void(this.state=yv);if(Cv.test(t))return this.word=t,void(this.state=mv);if(!Sv.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},bv.prototype.output=function(){while(this.place<this.text.length)this.readCharicter();if(this.state===xv)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Tv=.017453292519943295;function Av(t){return t*Tv}function Gv(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Av(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Av(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Ov(t){let e={units:null,to_meter:void 0};return"string"===typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Lv(t){return"object"===typeof t?t.value*t.unit.conversion_factor:t}function Nv(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Lv(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Lv(t.ellipsoid.semi_minor_axis))))}function kv(t,e={}){return t&&"object"===typeof t?"BoundCRS"===t.type?(kv(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const s=t[i];if(null!==s)switch(i){case"name":if(e.srsCode)break;e.name=s,e.srsCode=s;break;case"type":"GeographicCRS"===s?e.projName="longlat":"GeodeticCRS"===s?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===s&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":s.ellipsoid&&(e.ellps=s.ellipsoid.name,Nv(s,e)),s.prime_meridian&&(e.from_greenwich=s.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=s.name,Nv(s,e);break;case"prime_meridian":e.long0=(s.longitude||0)*Math.PI/180;break;case"coordinate_system":if(s.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=s.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),s.unit){const{units:t,to_meter:i}=Ov(s.unit);e.units=t,e.to_meter=i}else if(s.axis[0]&&s.axis[0].unit){const{units:t,to_meter:i}=Ov(s.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":s.authority&&s.code&&(e.title=s.authority+":"+s.code);break;case"conversion":s.method&&s.method.name&&(e.projName=s.method.name),s.parameters&&s.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),s=t.value;t.unit&&t.unit.conversion_factor?e[i]=s*t.unit.conversion_factor:"degree"===t.unit?e[i]=s*Math.PI/180:e[i]=s});break;case"unit":s.name&&(e.units=s.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),s.conversion_factor&&(e.to_meter=s.conversion_factor);break;case"base_crs":kv(s,e),e.datumCode=s.id?s.id.authority+"_"+s.id.code:s.name;break;default:break}}),e.datumCode||"GeographicCRS"!==t.type&&"GeodeticCRS"!==t.type||!t.id||(e.datumCode=t.id.authority+"_"+t.id.code),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Gv(e),e):t}var Fv=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Dv(t,e){var i=e[0],s=e[1];!(i in t)&&s in t&&(t[i]=t[s],3===e.length&&(t[i]=e[2](t[i])))}function jv(t){for(var e=Object.keys(t),i=0,s=e.length;i<s;++i){var n=e[i];-1!==Fv.indexOf(n)&&zv(t[n]),"object"===typeof t[n]&&jv(t[n])}}function zv(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"===typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",s=0,n=t.AXIS.length;s<n;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];-1!==r[0].indexOf("north")||("y"===r[0]||"lat"===r[0])&&"north"===r[1]?i+="n":-1!==r[0].indexOf("south")||("y"===r[0]||"lat"===r[0])&&"south"===r[1]?i+="s":-1!==r[0].indexOf("east")||("x"===r[0]||"lon"===r[0])&&"east"===r[1]?i+="e":-1===r[0].indexOf("west")&&("x"!==r[0]&&"lon"!==r[0]||"west"!==r[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){var i=t.to_meter||1;return e*i}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Av(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Av(t.rectified_grid_angle));var h=function(e){return Dv(t,e)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Av],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Av],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Av],["lat0","latitude_of_origin",Av],["lat0","standard_parallel_1",Av],["lat1","standard_parallel_1",Av],["lat2","standard_parallel_2",Av],["azimuth","Azimuth"],["alpha","azimuth",Av],["srsCode","name"]];l.forEach(h),Gv(t)}function Uv(t){if("object"===typeof t)return kv(t);const e=fv(t);var i=gv(t);if("WKT2"===e){const t=dv(i);return kv(t)}var s=i[0],n={};return Iv(i,n),jv(n),n[s]}function Bv(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"===typeof i?"+"===i.charAt(0)?Bv[t]=lv(arguments[1]):Bv[t]=Uv(arguments[1]):i&&"object"===typeof i&&!("projName"in i)?Bv[t]=Uv(arguments[1]):(Bv[t]=i,i||delete Bv[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Bv.apply(e,t):Bv(t)});if("string"===typeof t){if(t in Bv)return Bv[t]}else"EPSG"in t?Bv["EPSG:"+t.EPSG]=t:"ESRI"in t?Bv["ESRI:"+t.ESRI]=t:"IAU2000"in t?Bv["IAU2000:"+t.IAU2000]=t:console.log(t);return}}Dy(Bv);var Wv=Bv;function Xv(t){return"string"===typeof t}function Vv(t){return t in Wv}function qv(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"===typeof t&&!("srsCode"in t)}var Yv=["3857","900913","3785","102113"];function Kv(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Yv.indexOf(t.title.substr(5))>-1;var e=hv(t,"authority");if(e){var i=hv(e,"epsg");return i&&Yv.indexOf(i)>-1}}function Hv(t){var e=hv(t,"extension");if(e)return hv(e,"proj4")}function $v(t){return"+"===t[0]}function Zv(t){let e;if(Xv(t))if(Vv(t))e=Wv[t];else if(qv(t)){e=Uv(t);var i=Hv(e);i&&(e=lv(i))}else $v(t)&&(e=lv(t));else e="projName"in t?t:Uv(t);return e&&Kv(e)?Wv["EPSG:3857"]:e}var Jv=Zv;function Qv(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)i=e[s],void 0!==i&&(t[s]=i);return t}function tx(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function ex(t){return t<0?-1:1}function ix(t,e){return e||Math.abs(t)<=sv?t:t-ex(t)*iv}function sx(t,e,i){var s=t*i,n=.5*t;return s=Math.pow((1-s)/(1+s),n),Math.tan(.5*(Ky-e))/s}function nx(t,e){for(var i,s,n=.5*t,r=Ky-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(r),s=Ky-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-r,r+=s,Math.abs(s)<=1e-10)return r;return-9999}function rx(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function ox(t){var e,i,s=t.x,n=t.y;if(n*tv>90&&n*tv<-90&&s*tv>180&&s*tv<-180)return null;if(Math.abs(Math.abs(n)-Ky)<=Jy)return null;if(this.sphere)e=this.x0+this.a*this.k0*ix(s-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(ev+.5*n));else{var r=Math.sin(n),o=sx(this.e,n,r);e=this.x0+this.a*this.k0*ix(s-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t}function ax(t){var e,i,s=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Ky-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var r=Math.exp(-n/(this.a*this.k0));if(i=nx(this.e,r),-9999===i)return null}return e=ix(this.long0+s/(this.a*this.k0),this.over),t.x=e,t.y=i,t}var hx=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"],lx={init:rx,forward:ox,inverse:ax,names:hx};function cx(){}function ux(t){return t}var dx=["longlat","identity","lonlat","latlon","latlong"],fx={init:cx,forward:ux,inverse:ux,names:dx},gx=[lx,fx],px={},_x=[];function mx(t,e){var i=_x.length;return t.names?(_x[i]=t,t.names.forEach(function(t){px[t.toLowerCase()]=i}),this):(console.log(e),!0)}function yx(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function vx(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!==typeof px[e]&&_x[px[e]]?_x[px[e]]:(e=yx(e),e in px&&_x[px[e]]?_x[px[e]]:void 0)}function xx(){gx.forEach(mx)}var wx={start:xx,add:mx,get:vx},Ex={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Mx=Ex;const Sx=Mx.WGS84;function Cx(t,e,i,s){var n=t*t,r=e*e,o=(n-r)/n,a=0;s?(t*=1-o*(Hy+o*($y+o*Zy)),n=t*t,o=0):a=Math.sqrt(o);var h=(n-r)/r;return{es:o,e:a,ep2:h}}function bx(t,e,i,s,n){if(!t){var r=hv(Mx,s);r||(r=Sx),t=r.a,e=r.b,i=r.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<Jy)&&(n=!0,e=t),{a:t,b:e,rf:i,sphere:n}}var Px={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var Rx in Px){var Ix=Px[Rx];Ix.datumName&&(Px[Ix.datumName]=Ix)}var Tx=Px;function Ax(t,e,i,s,n,r,o){var a={};return a.datum_type=Wy,e&&(a.datum_type=By,a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=jy),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=zy,a.datum_params[3]*=Yy,a.datum_params[4]*=Yy,a.datum_params[5]*=Yy,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=Uy,a.grids=o),a.a=i,a.b=s,a.es=n,a.ep2=r,a}var Gx=Ax,Ox={};function Lx(t,e,i){return e instanceof ArrayBuffer?Nx(t,e,i):{ready:kx(t,e)}}function Nx(t,e,i){var s=!0;void 0!==i&&!1===i.includeErrorFields&&(s=!1);var n=new DataView(e),r=Ux(n),o=Bx(n,r),a=Xx(n,o,r,s),h={header:o,subgrids:a};return Ox[t]=h,h}async function kx(t,e){for(var i=[],s=await e.getImageCount(),n=s-1;n>=0;n--){var r=await e.getImage(n),o=await r.readRasters(),a=o,h=[r.getWidth(),r.getHeight()],l=r.getBoundingBox().map(jx),c="function"===typeof r.fileDirectory.getValue?r.fileDirectory.getValue("ModelPixelScale"):r.fileDirectory.ModelPixelScale,u=[c[0],c[1]].map(jx),d=l[0]+(h[0]-1)*u[0],f=l[3]-(h[1]-1)*u[1],g=a[0],p=a[1],_=[];for(let t=h[1]-1;t>=0;t--)for(let e=h[0]-1;e>=0;e--){var m=t*h[0]+e;_.push([-zx(p[m]),zx(g[m])])}i.push({del:u,lim:h,ll:[-d,f],cvs:_})}var y={header:{nSubgrids:s},subgrids:i};return Ox[t]=y,y}function Fx(t){if(void 0===t)return null;var e=t.split(",");return e.map(Dx)}function Dx(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:Ox[t]||null,isNull:!1}}function jx(t){return t*Math.PI/180}function zx(t){return t/3600*Math.PI/180}function Ux(t){var e=t.getInt32(8,!1);return 11!==e&&(e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function Bx(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:Wx(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}function Wx(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function Xx(t,e,i,s){for(var n=176,r=[],o=0;o<e.nSubgrids;o++){var a=qx(t,n,i),h=Yx(t,n,a,i,s),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),c=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[zx(a.lowerLongitude),zx(a.lowerLatitude)],del:[zx(a.longitudeInterval),zx(a.latitudeInterval)],lim:[l,c],count:a.gridNodeCount,cvs:Vx(h)});var u=16;!1===s&&(u=8),n+=176+a.gridNodeCount*u}return r}function Vx(t){return t.map(function(t){return[zx(t.longitudeShift),zx(t.latitudeShift)]})}function qx(t,e,i){return{name:Wx(t,e+8,e+16).trim(),parent:Wx(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function Yx(t,e,i,s,n){var r=e+176,o=16;!1===n&&(o=8);for(var a=[],h=0;h<i.gridNodeCount;h++){var l={latitudeShift:t.getFloat32(r+h*o,s),longitudeShift:t.getFloat32(r+h*o+4,s)};!1!==n&&(l.latitudeAccuracy=t.getFloat32(r+h*o+8,s),l.longitudeAccuracy=t.getFloat32(r+h*o+12,s)),a.push(l)}return a}function Kx(t,e){if(!(this instanceof Kx))return new Kx(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=Jv(t);if("object"===typeof i){var s=Kx.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var n=hv(Tx,i.datumCode);n&&(i.datum_params=i.datum_params||(n.towgs84?n.towgs84.split(","):null),i.ellps=n.ellipse,i.datumName=n.datumName?n.datumName:i.datumCode)}i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r=bx(i.a,i.b,i.rf,i.ellps,i.sphere),o=Cx(r.a,r.b,r.rf,i.R_A),a=Fx(i.nadgrids),h=i.datum||Gx(i.datumCode,i.datum_params,r.a,r.b,o.es,o.ep2,a);Qv(this,i),Qv(this,s),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=h,"init"in this&&"function"===typeof this.init&&this.init(),this.k0||(this.k0=1),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}Kx.projections=wx,Kx.projections.start();var Hx=Kx;function $x(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===jy?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==zy||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function Zx(t,e,i){var s,n,r,o,a=t.x,h=t.y,l=t.z?t.z:0;if(h<-Ky&&h>-1.001*Ky)h=-Ky;else if(h>Ky&&h<1.001*Ky)h=Ky;else{if(h<-Ky)return{x:-1/0,y:-1/0,z:t.z};if(h>Ky)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(h),o=Math.cos(h),r=n*n,s=i/Math.sqrt(1-e*r),{x:(s+l)*o*Math.cos(a),y:(s+l)*o*Math.sin(a),z:(s*(1-e)+l)*n}}function Jx(t,e,i,s){var n,r,o,a,h,l,c,u,d,f,g,p,_,m,y,v,x=1e-12,w=x*x,E=30,M=t.x,S=t.y,C=t.z?t.z:0;if(n=Math.sqrt(M*M+S*S),r=Math.sqrt(M*M+S*S+C*C),n/i<x){if(m=0,r/i<x)return y=Ky,v=-s,{x:t.x,y:t.y,z:t.z}}else m=Math.atan2(S,M);o=C/r,a=n/r,h=1/Math.sqrt(1-e*(2-e)*a*a),u=a*(1-e)*h,d=o*h,_=0;do{_++,c=i/Math.sqrt(1-e*d*d),v=n*u+C*d-c*(1-e*d*d),l=e*c/(c+v),h=1/Math.sqrt(1-l*(2-l)*a*a),f=a*(1-l)*h,g=o*h,p=g*u-f*d,u=f,d=g}while(p*p>w&&_<E);return y=Math.atan(g/Math.abs(f)),{x:m,y:y,z:v}}function Qx(t,e,i){if(e===jy)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===zy){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6];return{x:l*(t.x-h*t.y+a*t.z)+s,y:l*(h*t.x+t.y-o*t.z)+n,z:l*(-a*t.x+o*t.y+t.z)+r}}}function tw(t,e,i){if(e===jy)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===zy){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=(t.x-s)/l,u=(t.y-n)/l,d=(t.z-r)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}function ew(t){return t===jy||t===zy}function iw(t,e,i){if($x(t,e))return i;if(t.datum_type===Wy||e.datum_type===Wy)return i;var s=t.a,n=t.es;if(t.datum_type===Uy){var r=sw(t,!1,i);if(0!==r)return;s=Xy,n=qy}var o=e.a,a=e.b,h=e.es;if(e.datum_type===Uy&&(o=Xy,a=Vy,h=qy),n===h&&s===o&&!ew(t.datum_type)&&!ew(e.datum_type))return i;if(i=Zx(i,n,s),ew(t.datum_type)&&(i=Qx(i,t.datum_type,t.datum_params)),ew(e.datum_type)&&(i=tw(i,e.datum_type,e.datum_params)),i=Jx(i,h,o,a),e.datum_type===Uy){var l=sw(e,!0,i);if(0!==l)return}return i}function sw(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var s={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},r=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(r.push(a.name),a.isNull){n=s;break}if(null!==a.grid)for(var h=a.grid.subgrids,l=0,c=h.length;l<c;l++){var u=h[l],d=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,f=u.ll[0]-d,g=u.ll[1]-d,p=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,_=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(g>s.y||f>s.x||_<s.y||p<s.x)&&(n=nw(s,e,u),!isNaN(n.x)))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(n.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*tv+" "+s.y*tv+" tried: '"+r+"'"),-1):(i.x=-n.x,i.y=n.y,0)}function nw(t,e,i){var s={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return s;var n={x:t.x,y:t.y};n.x-=i.ll[0],n.y-=i.ll[1],n.x=ix(n.x-Math.PI)+Math.PI;var r=rw(n,i);if(e){if(isNaN(r.x))return s;r.x=n.x-r.x,r.y=n.y-r.y;var o,a,h=9,l=1e-12;do{if(a=rw(r,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:n.x-(a.x+r.x),y:n.y-(a.y+r.y)},r.x+=o.x,r.y+=o.y}while(h--&&Math.abs(o.x)>l&&Math.abs(o.y)>l);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=ix(r.x+i.ll[0]),s.y=r.y+i.ll[1]}else isNaN(r.x)||(s.x=t.x+r.x,s.y=t.y+r.y);return s}function rw(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},n={x:Math.floor(s.x),y:Math.floor(s.y)},r={x:s.x-1*n.x,y:s.y-1*n.y},o={x:Number.NaN,y:Number.NaN};if(n.x<0||n.x>=e.lim[0])return o;if(n.y<0||n.y>=e.lim[1])return o;i=n.y*e.lim[0]+n.x;var a={x:e.cvs[i][0],y:e.cvs[i][1]};i++;var h={x:e.cvs[i][0],y:e.cvs[i][1]};i+=e.lim[0];var l={x:e.cvs[i][0],y:e.cvs[i][1]};i--;var c={x:e.cvs[i][0],y:e.cvs[i][1]},u=r.x*r.y,d=r.x*(1-r.y),f=(1-r.x)*(1-r.y),g=(1-r.x)*r.y;return o.x=f*a.x+d*h.x+g*c.x+u*l.x,o.y=f*a.y+d*h.y+g*c.y+u*l.y,o}var ow=["x","y","z"];function aw(t,e){const i={};for(let s=0,n=t.axis.length;s<n;s++){if(2===s&&void 0===e.z)continue;let n=e[ow[s]];switch(t.axis[s]){case"e":i.x=n;break;case"w":i.x=-n;break;case"n":i.y=n;break;case"s":i.y=-n;break;case"u":i.z=n;break;case"d":i.z=-n;break;default:return null}}return i}function hw(t,e){const i={};for(let s=0,n=t.axis.length;s<n;s++)if(2!==s||void 0!==e.z)switch(t.axis[s]){case"e":i[ow[s]]=e.x;break;case"w":i[ow[s]]=-e.x;break;case"n":i[ow[s]]=e.y;break;case"s":i[ow[s]]=-e.y;break;case"u":i[ow[s]]=e.z;break;case"d":i[ow[s]]=-e.z;break;default:return null}return i}function lw(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function cw(t){uw(t.x),uw(t.y)}function uw(t){if("function"===typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!==typeof t||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function dw(t,e){return(t.datum.datum_type===jy||t.datum.datum_type===zy||t.datum.datum_type===Uy)&&"WGS84"!==e.datumCode||(e.datum.datum_type===jy||e.datum.datum_type===zy||e.datum.datum_type===Uy)&&"WGS84"!==t.datumCode}function fw(t,e,i,s){var n,r=void 0!==i.z;if(cw(i),t.datum&&e.datum&&dw(t,e)&&(n=new Hx("WGS84"),i=fw(t,n,i,s),t=n),s&&"enu"!==t.axis&&(i=aw(t,i)),"longlat"===t.projName)i={x:i.x*Qy,y:i.y*Qy,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),i=t.inverse(i),!i)return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=iw(t.datum,e.datum,i),i)return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?(void 0!==e.long_wrap&&(i.x=e.long_wrap+ix(i.x-e.long_wrap)),i={x:i.x*tv,y:i.y*tv,z:i.z||0}):(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),s&&"enu"!==e.axis?hw(e,i):(i&&!r&&"geocent"!==e.projName&&delete i.z,i)}function gw(t,e,i,s){var n;return n=Array.isArray(i)?lw(i):{x:i.x,y:i.y,z:i.z,m:i.m},fw(t,e,n,s)}var pw=Hx("WGS84");function _w(t,e,i,s){var n,r,o;return Array.isArray(i)?(n=fw(t,e,lw(i),s)||{x:NaN,y:NaN},i.length>2?(r="undefined"!==typeof t.name&&"geocent"===t.name||"undefined"!==typeof e.name&&"geocent"===e.name,r?"number"===typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y,i[2]].concat(i.slice(3)):s&&"number"===typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y].concat(i.slice(2))):[n.x,n.y]):(n=fw(t,e,{x:i.x,y:i.y,z:i.z,m:i.m},s)||{x:NaN,y:NaN},o=Object.keys(i),2===o.length||(r="undefined"!==typeof t.name&&"geocent"===t.name||"undefined"!==typeof e.name&&"geocent"===e.name,o.forEach(function(t){"x"!==t&&"y"!==t&&("z"===t&&(r||s)||(n[t]=i[t]))})),n)}function mw(t){return t instanceof Hx?t:"object"===typeof t&&"oProj"in t?t.oProj:Hx(t)}function yw(t,e,i){var s,n,r,o=!1;return"undefined"===typeof e?(n=mw(t),s=pw,o=!0):("undefined"!==typeof e.x||Array.isArray(e))&&(i=e,n=mw(t),s=pw,o=!0),s||(s=mw(t)),n||(n=mw(e)),i?_w(s,n,i):(r={forward:function(t,e){return _w(s,n,t,e)},inverse:function(t,e){return _w(n,s,t,e)}},o&&(r.oProj=n),r)}var vw=yw,xw=6,ww="AJSAJS",Ew="AFAFAF",Mw=65,Sw=73,Cw=79,bw=86,Pw=90,Rw={forward:Iw,inverse:Tw,toPoint:Aw};function Iw(t,e){return e=e||5,Fw(Lw({lat:t[1],lon:t[0]}),e)}function Tw(t){var e=Nw(Uw(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function Aw(t){var e=Nw(Uw(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Gw(t){return t*(Math.PI/180)}function Ow(t){return t/Math.PI*180}function Lw(t){var e,i,s,n,r,o,a,h,l,c=t.lat,u=t.lon,d=6378137,f=.00669438,g=.9996,p=Gw(c),_=Gw(u);l=Math.floor((u+180)/6)+1,180===u&&(l=60),c>=56&&c<64&&u>=3&&u<12&&(l=32),c>=72&&c<84&&(u>=0&&u<9?l=31:u>=9&&u<21?l=33:u>=21&&u<33?l=35:u>=33&&u<42&&(l=37)),e=6*(l-1)-180+3,h=Gw(e),i=f/(1-f),s=d/Math.sqrt(1-f*Math.sin(p)*Math.sin(p)),n=Math.tan(p)*Math.tan(p),r=i*Math.cos(p)*Math.cos(p),o=Math.cos(p)*(_-h),a=d*((1-f/4-3*f*f/64-5*f*f*f/256)*p-(3*f/8+3*f*f/32+45*f*f*f/1024)*Math.sin(2*p)+(15*f*f/256+45*f*f*f/1024)*Math.sin(4*p)-35*f*f*f/3072*Math.sin(6*p));var m=g*s*(o+(1-n+r)*o*o*o/6+(5-18*n+n*n+72*r-58*i)*o*o*o*o*o/120)+5e5,y=g*(a+s*Math.tan(p)*(o*o/2+(5-n+9*r+4*r*r)*o*o*o*o/24+(61-58*n+n*n+600*r-330*i)*o*o*o*o*o*o/720));return c<0&&(y+=1e7),{northing:Math.round(y),easting:Math.round(m),zoneNumber:l,zoneLetter:kw(c)}}function Nw(t){var e=t.northing,i=t.easting,s=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var r,o,a,h,l,c,u,d,f,g,p=.9996,_=6378137,m=.00669438,y=(1-Math.sqrt(1-m))/(1+Math.sqrt(1-m)),v=i-5e5,x=e;s<"N"&&(x-=1e7),d=6*(n-1)-180+3,r=m/(1-m),u=x/p,f=u/(_*(1-m/4-3*m*m/64-5*m*m*m/256)),g=f+(3*y/2-27*y*y*y/32)*Math.sin(2*f)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*f)+151*y*y*y/96*Math.sin(6*f),o=_/Math.sqrt(1-m*Math.sin(g)*Math.sin(g)),a=Math.tan(g)*Math.tan(g),h=r*Math.cos(g)*Math.cos(g),l=_*(1-m)/Math.pow(1-m*Math.sin(g)*Math.sin(g),1.5),c=v/(o*p);var w=g-o*Math.tan(g)/l*(c*c/2-(5+3*a+10*h-4*h*h-9*r)*c*c*c*c/24+(61+90*a+298*h+45*a*a-252*r-3*h*h)*c*c*c*c*c*c/720);w=Ow(w);var E,M=(c-(1+2*a+h)*c*c*c/6+(5-2*h+28*a-3*h*h+8*r+24*a*a)*c*c*c*c*c/120)/Math.cos(g);if(M=d+Ow(M),t.accuracy){var S=Nw({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});E={top:S.lat,right:S.lon,bottom:w,left:M}}else E={lat:w,lon:M};return E}function kw(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Fw(t,e){var i="00000"+t.easting,s="00000"+t.northing;return t.zoneNumber+t.zoneLetter+Dw(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+s.substr(s.length-5,e)}function Dw(t,e,i){var s=jw(i),n=Math.floor(t/1e5),r=Math.floor(e/1e5)%20;return zw(n,r,s)}function jw(t){var e=t%xw;return 0===e&&(e=xw),e}function zw(t,e,i){var s=i-1,n=ww.charCodeAt(s),r=Ew.charCodeAt(s),o=n+t-1,a=r+e,h=!1;o>Pw&&(o=o-Pw+Mw-1,h=!0),(o===Sw||n<Sw&&o>Sw||(o>Sw||n<Sw)&&h)&&o++,(o===Cw||n<Cw&&o>Cw||(o>Cw||n<Cw)&&h)&&(o++,o===Sw&&o++),o>Pw&&(o=o-Pw+Mw-1),a>bw?(a=a-bw+Mw-1,h=!0):h=!1,(a===Sw||r<Sw&&a>Sw||(a>Sw||r<Sw)&&h)&&a++,(a===Cw||r<Cw&&a>Cw||(a>Cw||r<Cw)&&h)&&(a++,a===Sw&&a++),a>bw&&(a=a-bw+Mw-1);var l=String.fromCharCode(o)+String.fromCharCode(a);return l}function Uw(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";var e,i=t.length,s=null,n="",r=0;while(!/[A-Z]/.test(e=t.charAt(r))){if(r>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,r++}var o=parseInt(n,10);if(0===r||r+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(r++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;s=t.substring(r,r+=2);var h=jw(o),l=Bw(s.charAt(0),h),c=Ww(s.charAt(1),h);while(c<Xw(a))c+=2e6;var u=i-r;if(u%2!==0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,f,g,p,_,m=u/2,y=0,v=0;return m>0&&(d=1e5/Math.pow(10,m),f=t.substring(r,r+m),y=parseFloat(f)*d,g=t.substring(r+m),v=parseFloat(g)*d),p=y+l,_=v+c,{easting:p,northing:_,zoneLetter:a,zoneNumber:o,accuracy:d}}function Bw(t,e){var i=ww.charCodeAt(e-1),s=1e5,n=!1;while(i!==t.charCodeAt(0)){if(i++,i===Sw&&i++,i===Cw&&i++,i>Pw){if(n)throw"Bad character: "+t;i=Mw,n=!0}s+=1e5}return s}function Ww(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Ew.charCodeAt(e-1),s=0,n=!1;while(i!==t.charCodeAt(0)){if(i++,i===Sw&&i++,i===Cw&&i++,i>bw){if(n)throw"Bad character: "+t;i=Mw,n=!0}s+=1e5}return s}function Xw(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Vw(t,e,i){if(!(this instanceof Vw))return new Vw(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"===typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"===typeof t&&"undefined"===typeof e){var s=t.split(",");this.x=parseFloat(s[0]),this.y=parseFloat(s[1]),this.z=parseFloat(s[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Vw.fromMGRS=function(t){return new Vw(Aw(t))},Vw.prototype.toMGRS=function(t){return Iw([this.x,this.y],t)};var qw=Vw,Yw=1,Kw=.25,Hw=.046875,$w=.01953125,Zw=.01068115234375,Jw=.75,Qw=.46875,tE=.013020833333333334,eE=.007120768229166667,iE=.3645833333333333,sE=.005696614583333333,nE=.3076171875;function rE(t){var e=[];e[0]=Yw-t*(Kw+t*(Hw+t*($w+t*Zw))),e[1]=t*(Jw-t*(Hw+t*($w+t*Zw)));var i=t*t;return e[2]=i*(Qw-t*(tE+t*eE)),i*=t,e[3]=i*(iE-t*sE),e[4]=i*t*nE,e}function oE(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}var aE=20;function hE(t,e,i){for(var s=1/(1-e),n=t,r=aE;r;--r){var o=Math.sin(n),a=1-e*o*o;if(a=(oE(n,o,Math.cos(n),i)-t)*(a*Math.sqrt(a))*s,n-=a,Math.abs(a)<Jy)return n}return n}function lE(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=rE(this.es),this.ml0=oE(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function cE(t){var e,i,s,n=t.x,r=t.y,o=ix(n-this.long0,this.over),a=Math.sin(r),h=Math.cos(r);if(this.es){var l=h*o,c=Math.pow(l,2),u=this.ep2*Math.pow(h,2),d=Math.pow(u,2),f=Math.abs(h)>Jy?Math.tan(r):0,g=Math.pow(f,2),p=Math.pow(g,2);e=1-this.es*Math.pow(a,2),l/=Math.sqrt(e);var _=oE(r,a,h,this.en);i=this.a*(this.k0*l*(1+c/6*(1-g+u+c/20*(5-18*g+p+14*u-58*g*u+c/42*(61+179*p-p*g-479*g)))))+this.x0,s=this.a*(this.k0*(_-this.ml0+a*o*l/2*(1+c/12*(5-g+9*u+4*d+c/30*(61+p-58*g+270*u-330*g*u+c/56*(1385+543*p-p*g-3111*g))))))+this.y0}else{var m=h*Math.sin(o);if(Math.abs(Math.abs(m)-1)<Jy)return 93;if(i=.5*this.a*this.k0*Math.log((1+m)/(1-m))+this.x0,s=h*Math.cos(o)/Math.sqrt(1-Math.pow(m,2)),m=Math.abs(s),m>=1){if(m-1>Jy)return 93;s=0}else s=Math.acos(s);r<0&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return t.x=i,t.y=s,t}function uE(t){var e,i,s,n,r=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+o/this.k0,i=hE(e,this.es,this.en),Math.abs(i)<Ky){var a=Math.sin(i),h=Math.cos(i),l=Math.abs(h)>Jy?Math.tan(i):0,c=this.ep2*Math.pow(h,2),u=Math.pow(c,2),d=Math.pow(l,2),f=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var g=r*Math.sqrt(e)/this.k0,p=Math.pow(g,2);e*=l,s=i-e*p/(1-this.es)*.5*(1-p/12*(5+3*d-9*c*d+c-4*u-p/30*(61+90*d-252*c*d+45*f+46*c-p/56*(1385+3633*d+4095*f+1574*f*d)))),n=ix(this.long0+g*(1-p/6*(1+2*d+c-p/20*(5+28*d+24*f+8*c*d+6*c-p/42*(61+662*d+1320*f+720*f*d))))/h,this.over)}else s=Ky*ex(o),n=0;else{var _=Math.exp(r/this.k0),m=.5*(_-1/_),y=this.lat0+o/this.k0,v=Math.cos(y);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(m,2))),s=Math.asin(e),o<0&&(s=-s),n=0===m&&0===v?0:ix(Math.atan2(m,v)+this.long0,this.over)}return t.x=n,t.y=s,t}var dE=["Fast_Transverse_Mercator","Fast Transverse Mercator"],fE={init:lE,forward:cE,inverse:uE,names:dE};function gE(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function pE(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),s=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(s,2))}function _E(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}function mE(t){var e=Math.abs(t);return e=_E(e*(1+e/(pE(1,e)+1))),t<0?-e:e}function yE(t,e){var i,s=2*Math.cos(2*e),n=t.length-1,r=t[n],o=0;while(--n>=0)i=s*r-o+t[n],o=r,r=i;return e+i*Math.sin(2*e)}function vE(t,e){var i,s=2*Math.cos(e),n=t.length-1,r=t[n],o=0;while(--n>=0)i=s*r-o+t[n],o=r,r=i;return Math.sin(e)*i}function xE(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function wE(t,e,i){var s,n,r=Math.sin(e),o=Math.cos(e),a=gE(i),h=xE(i),l=2*o*h,c=-2*r*a,u=t.length-1,d=t[u],f=0,g=0,p=0;while(--u>=0)s=g,n=f,g=d,f=p,d=l*g-s-c*f+t[u],p=c*g-n+l*f;return l=r*h,c=o*a,[l*d-c*p,l*p+c*d]}function EE(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(fE.init.apply(this),this.forward=fE.forward,this.inverse=fE.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.k0=void 0!==this.k0?this.k0:1,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=yE(this.cbg,this.lat0);this.Zb=-this.Qn*(s+vE(this.gtu,2*s))}function ME(t){var e=ix(t.x-this.long0,this.over),i=t.y;i=yE(this.cbg,i);var s=Math.sin(i),n=Math.cos(i),r=Math.sin(e),o=Math.cos(e);i=Math.atan2(s,o*n),e=Math.atan2(r*n,pE(s,n*o)),e=mE(Math.tan(e));var a,h,l=wE(this.gtu,2*i,2*e);return i+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,h=1/0),t.x=a,t.y=h,t}function SE(t){var e,i,s=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(n=(n-this.Zb)/this.Qn,s/=this.Qn,Math.abs(s)<=2.623395162778){var r=wE(this.utg,2*n,2*s);n+=r[0],s+=r[1],s=Math.atan(gE(s));var o=Math.sin(n),a=Math.cos(n),h=Math.sin(s),l=Math.cos(s);n=Math.atan2(o*l,pE(h,l*a)),s=Math.atan2(h,l*a),e=ix(s+this.long0,this.over),i=yE(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t}var CE=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"],bE={init:EE,forward:ME,inverse:SE,names:CE};function PE(t,e){if(void 0===t){if(t=Math.floor(30*(ix(e)+Math.PI)/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var RE="etmerc";function IE(){var t=PE(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Qy,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,bE.init.apply(this),this.forward=bE.forward,this.inverse=bE.inverse}var TE=["Universal Transverse Mercator System","utm"],AE={init:IE,names:TE,dependsOn:RE};function GE(t,e){return Math.pow((1-t)/(1+t),e)}var OE=20;function LE(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ev)/(Math.pow(Math.tan(.5*this.lat0+ev),this.C)*GE(this.e*t,this.ratexp))}function NE(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ev),this.C)*GE(this.e*Math.sin(i),this.ratexp))-Ky,t.x=this.C*e,t}function kE(t){for(var e=1e-14,i=t.x/this.C,s=t.y,n=Math.pow(Math.tan(.5*s+ev)/this.K,1/this.C),r=OE;r>0;--r){if(s=2*Math.atan(n*GE(this.e*Math.sin(t.y),-.5*this.e))-Ky,Math.abs(s-t.y)<e)break;t.y=s}return r?(t.x=i,t.y=s,t):null}var FE=["gauss"],DE={init:LE,forward:NE,inverse:kE,names:FE};function jE(){DE.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function zE(t){var e,i,s,n;return t.x=ix(t.x-this.long0,this.over),DE.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),s=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*s),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*s),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function UE(t){var e,i,s,n,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=pE(t.x,t.y)){var o=2*Math.atan2(r,this.R2);e=Math.sin(o),i=Math.cos(o),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/r),s=Math.atan2(t.x*e,r*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,s=0;return t.x=s,t.y=n,DE.inverse.apply(this,[t]),t.x=ix(t.x+this.long0,this.over),t}var BE=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],WE={init:jE,forward:zE,inverse:UE,names:BE};function XE(t,e,i){return e*=i,Math.tan(.5*(Ky+t))*Math.pow((1-e)/(1+e),.5*i)}function VE(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Jy&&(this.k0=.5*(1+ex(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Jy&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Jy&&Math.abs(Math.cos(this.lat_ts))>Jy&&(this.k0=.5*this.cons*tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/sx(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=tx(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(XE(this.lat0,this.sinlat0,this.e))-Ky,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function qE(t){var e,i,s,n,r,o,a=t.x,h=t.y,l=Math.sin(h),c=Math.cos(h),u=ix(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Jy&&Math.abs(h+this.lat0)<=Jy?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(u)),t.x=this.a*e*c*Math.sin(u)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(XE(h,l,this.e))-Ky,n=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=Jy?(r=sx(this.e,h*this.con,this.con*l),o=2*this.a*this.k0*r/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<Jy?(e=2*this.a*this.k0/(1+n*Math.cos(u)),t.y=e*s):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*n*Math.cos(u))),t.y=e*(this.cosX0*s-this.sinX0*n*Math.cos(u))+this.y0),t.x=e*n*Math.sin(u)+this.x0,t))}function YE(t){var e,i,s,n,r;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=Jy?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<Jy?this.lat0>0?ix(this.long0+Math.atan2(t.x,-1*t.y),this.over):ix(this.long0+Math.atan2(t.x,t.y),this.over):ix(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Jy){if(o<=Jy)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,s=o*this.cons/(2*this.a*this.k0),i=this.con*nx(this.e,s),e=this.con*ix(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=Jy?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=ix(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)),this.over)),i=-1*nx(this.e,Math.tan(.5*(Ky+r)));return t.x=e,t.y=i,t}var KE=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],HE={init:VE,forward:qE,inverse:YE,names:KE,ssfn_:XE};function $E(){this.k0||(this.k0=1);var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=this.rf,n=1/s,r=2*n-Math.pow(n,2),o=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+o*e)/(1-o*e));this.K=a-this.alpha*h+this.alpha*o/2*l}function ZE(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),s=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(s))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(r))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t}function JE(t){var e=t.x-this.x0,i=t.y-this.y0,s=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(s)),o=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+o/this.alpha,h=0,l=r,c=-1e3,u=0;while(Math.abs(l-c)>1e-7){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=a,t.y=l,t}var QE=["somerc"],tM={init:$E,forward:ZE,inverse:JE,names:QE},eM=1e-7;function iM(t){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],i="object"===typeof t.projName?Object.keys(t.projName)[0]:t.projName;return"no_uoff"in t||"no_off"in t||-1!==e.indexOf(i)||-1!==e.indexOf(yx(i))}function sM(){var t,e,i,s,n,r,o,a,h,l,c,u=0,d=0,f=0,g=0,p=0,_=0,m=0;this.k0||(this.k0=1),this.no_off=iM(this),this.no_rot="no_rot"in this;var y=!1;"alpha"in this&&(y=!0);var v=!1;if("rectified_grid_angle"in this&&(v=!0),y&&(m=this.alpha),v&&(u=this.rectified_grid_angle,y||(m=0,y=!0)),y||v)d=this.longc;else if(f=this.long1,p=this.lat1,g=this.long2,_=this.lat2,Math.abs(p-_)<=eM||(t=Math.abs(p))<=eM||Math.abs(t-Ky)<=eM||Math.abs(Math.abs(this.lat0)-Ky)<=eM||Math.abs(Math.abs(_)-Ky)<=eM)throw new Error;var x=1-this.es;e=Math.sqrt(x),Math.abs(this.lat0)>Jy?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/x),this.A=this.B*this.k0*e/t,s=this.B*e/(i*Math.sqrt(t)),n=s*s-1,n<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=s,this.E*=Math.pow(sx(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=n=1),y||v?(y?(c=Math.asin(Math.sin(m)/s),v||(u=m)):(c=u,m=Math.asin(s*Math.sin(c))),this.lam0=d-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B):(r=Math.pow(sx(this.e,p,Math.sin(p)),this.B),o=Math.pow(sx(this.e,_,Math.sin(_)),this.B),n=this.E/r,h=(o-r)/(o+r),l=this.E*this.E,l=(l-o*r)/(l+o*r),t=f-g,t<-Math.PI?g-=iv:t>Math.PI&&(g+=iv),this.lam0=ix(.5*(f+g)-Math.atan(l*Math.tan(.5*this.B*(f-g))/h)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*ix(f-this.lam0,this.over))/(n-1/n)),u=m=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(m))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(ev-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(ev+n))}function nM(t){var e,i,s,n,r,o,a,h,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-Ky)>Jy){if(r=this.E/Math.pow(sx(this.e,t.y,Math.sin(t.y)),this.B),o=1/r,e=.5*(r-o),i=.5*(r+o),n=Math.sin(this.B*t.x),s=(e*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)<Jy)throw new Error;h=.5*this.ArB*Math.log((1-s)/(1+s)),o=Math.cos(this.B*t.x),a=Math.abs(o)<eM?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+n*this.singam,o)}else h=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(l.x=a,l.y=h):(a-=this.u_0,l.x=h*this.cosrot+a*this.sinrot,l.y=a*this.cosrot-h*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,void 0!==t.z&&(l.z=t.z),void 0!==t.m&&(l.m=t.m),l}function rM(t){var e,i,s,n,r,o,a,h={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),s=Math.exp(-this.BrA*i),n=.5*(s-1/s),r=.5*(s+1/s),o=Math.sin(this.BrA*e),a=(o*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(a)-1)<Jy)h.x=0,h.y=a<0?-Ky:Ky;else{if(h.y=this.E/Math.sqrt((1+a)/(1-a)),h.y=nx(this.e,Math.pow(h.y,1/this.B)),h.y===1/0)throw new Error;h.x=-this.rB*Math.atan2(n*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return h.x+=this.lam0,void 0!==t.z&&(h.z=t.z),void 0!==t.m&&(h.m=t.m),h}var oM=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],aM={init:sM,forward:nM,inverse:rM,names:oM};function hM(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<Jy)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),s=tx(this.e,e,i),n=sx(this.e,this.lat1,e),r=Math.sin(this.lat2),o=Math.cos(this.lat2),a=tx(this.e,r,o),h=sx(this.e,this.lat2,r),l=sx(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>Jy?this.ns=Math.log(s/a)/Math.log(n/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(n,this.ns)),this.rh=Math.abs(Math.abs(this.lat0)-Ky)<Jy?0:this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function lM(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Jy&&(i=ex(i)*(Ky-2*Jy));var s,n,r=Math.abs(Math.abs(i)-Ky);if(r>Jy)s=sx(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(r=i*this.ns,r<=0)return null;n=0}var o=this.ns*ix(e-this.long0,this.over);return t.x=this.k0*(n*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,t}function cM(t){var e,i,s,n,r,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var h=0;if(0!==e&&(h=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,s=Math.pow(e/(this.a*this.f0),i),n=nx(this.e,s),-9999===n)return null}else n=-Ky;return r=ix(h/this.ns+this.long0,this.over),t.x=r,t.y=n,t}var uM=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],dM={init:hM,forward:lM,inverse:cM,names:uM};function fM(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function gM(t){var e,i,s,n,r,o,a,h=t.x,l=t.y,c=ix(h-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(n)),o=this.n*r,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t}function pM(t){var e,i,s,n,r,o,a,h,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),o=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x),n=r/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(n)),i=Math.asin(Math.cos(s)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,h=0;var c=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(h=1),a=t.y,c+=1}while(0===h&&c<15);return c>=15?null:t}var _M=["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"],mM={init:fM,forward:gM,inverse:pM,names:_M};function yM(t,e,i,s,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)}function vM(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function xM(t){return.375*t*(1+.25*t*(1+.46875*t))}function wM(t){return.05859375*t*t*(1+.75*t)}function EM(t){return t*t*t*(35/3072)}function MM(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function SM(t){return Math.abs(t)<Ky?t:t-ex(t)*Math.PI}function CM(t,e,i,s,n){var r,o;r=t/e;for(var a=0;a<15;a++)if(o=(t-(e*r-i*Math.sin(2*r)+s*Math.sin(4*r)-n*Math.sin(6*r)))/(e-2*i*Math.cos(2*r)+4*s*Math.cos(4*r)-6*n*Math.cos(6*r)),r+=o,Math.abs(o)<=1e-10)return r;return NaN}function bM(){this.sphere||(this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.ml0=this.a*yM(this.e0,this.e1,this.e2,this.e3,this.lat0))}function PM(t){var e,i,s=t.x,n=t.y;if(s=ix(s-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(s)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(s))-this.lat0);else{var r=Math.sin(n),o=Math.cos(n),a=MM(this.a,this.e,r),h=Math.tan(n)*Math.tan(n),l=s*Math.cos(n),c=l*l,u=this.es*o*o/(1-this.es),d=this.a*yM(this.e0,this.e1,this.e2,this.e3,n);e=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),i=d-this.ml0+a*r/o*c*(.5+(5-h+6*u)*c/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function RM(t){t.x-=this.x0,t.y-=this.y0;var e,i,s=t.x/this.a,n=t.y/this.a;if(this.sphere){var r=n+this.lat0;e=Math.asin(Math.sin(r)*Math.cos(s)),i=Math.atan2(Math.tan(s),Math.cos(r))}else{var o=this.ml0/this.a+n,a=CM(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Ky)<=Jy)return t.x=this.long0,t.y=Ky,n<0&&(t.y*=-1),t;var h=MM(this.a,this.e,Math.sin(a)),l=h*h*h/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(a),2),u=s*this.a/h,d=u*u;e=a-h*Math.tan(a)/l*u*u*(.5-(1+3*c)*u*u/24),i=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(a)}return t.x=ix(i+this.long0,this.over),t.y=SM(e),t}var IM=["Cassini","Cassini_Soldner","cass"],TM={init:bM,forward:PM,inverse:RM,names:IM};function AM(t,e){var i;return t>1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e}var GM=.3333333333333333,OM=.17222222222222222,LM=.10257936507936508,NM=.06388888888888888,kM=.0664021164021164,FM=.016415012942191543;function DM(t){var e,i=[];return i[0]=t*GM,e=t*t,i[0]+=e*OM,i[1]=e*NM,e*=t,i[0]+=e*LM,i[1]+=e*kM,i[2]=e*FM,i}function jM(t,e){var i=t+t;return t+e[0]*Math.sin(i)+e[1]*Math.sin(i+i)+e[2]*Math.sin(i+i+i)}var zM=1,UM=2,BM=3,WM=4;function XM(){var t,e=Math.abs(this.lat0);if(Math.abs(e-Ky)<Jy?this.mode=this.lat0<0?zM:UM:Math.abs(e)<Jy?this.mode=BM:this.mode=WM,this.es>0)switch(this.qp=AM(this.e,1),this.mmf=.5/(1-this.es),this.apa=DM(this.es),this.mode){case UM:this.dd=1;break;case zM:this.dd=1;break;case BM:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case WM:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=AM(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}else this.mode===WM&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function VM(t){var e,i,s,n,r,o,a,h,l,c,u=t.x,d=t.y;if(u=ix(u-this.long0,this.over),this.sphere){if(r=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(i=this.mode===this.EQUIT?1+c*s:1+this.sinph0*r+this.cosph0*c*s,i<=Jy)return null;i=Math.sqrt(2/i),e=i*c*Math.sin(u),i*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<Jy)return null;i=ev-.5*d,i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)),e=i*Math.sin(u),i*=s}}else{switch(a=0,h=0,l=0,s=Math.cos(u),n=Math.sin(u),r=Math.sin(d),o=AM(this.e,r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*s;break;case this.EQUIT:l=1+h*s;break;case this.N_POLE:l=Ky+d,o=this.qp-o;break;case this.S_POLE:l=d-Ky,o=this.qp+o;break}if(Math.abs(l)<Jy)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*a-this.sinb1*h*s):(l=Math.sqrt(2/(1+h*s)))*a*this.ymf,e=this.xmf*l*h*n;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(l=Math.sqrt(o))*n,i=s*(this.mode===this.S_POLE?l:-l)):e=i=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function qM(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,n,r,o,a,h=t.x/this.a,l=t.y/this.a;if(this.sphere){var c,u=0,d=0;if(c=Math.sqrt(h*h+l*l),i=.5*c,i>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(c)<=Jy?0:Math.asin(l*d/c),h*=d,l=u*c;break;case this.OBLIQ:i=Math.abs(c)<=Jy?this.lat0:Math.asin(u*this.sinph0+l*d*this.cosph0/c),h*=d*this.cosph0,l=(u-Math.sin(i)*this.sinph0)*c;break;case this.N_POLE:l=-l,i=Ky-i;break;case this.S_POLE:i-=Ky;break}e=0!==l||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(h,l):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h/=this.dd,l*=this.dd,o=Math.sqrt(h*h+l*l),o<Jy)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),s=Math.cos(n),h*=n=Math.sin(n),this.mode===this.OBLIQ?(a=s*this.sinb1+l*n*this.cosb1/o,r=this.qp*a,l=o*this.cosb1*s-l*this.sinb1*n):(a=l*n/o,r=this.qp*a,l=o*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(l=-l),r=h*h+l*l,!r)return t.x=this.long0,t.y=this.lat0,t;a=1-r/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(h,l),i=jM(Math.asin(a),this.apa)}return t.x=ix(this.long0+e,this.over),t.y=i,t}var YM=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],KM={init:XM,forward:VM,inverse:qM,names:YM,S_POLE:zM,N_POLE:UM,EQUIT:BM,OBLIQ:WM};function HM(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function $M(){Math.abs(this.lat1+this.lat2)<Jy||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=tx(this.e3,this.sin_po,this.cos_po),this.qs1=AM(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=tx(this.e3,this.sin_po,this.cos_po),this.qs2=AM(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=AM(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>Jy?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function ZM(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=AM(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,r=this.ns0*ix(e-this.long0,this.over),o=n*Math.sin(r)+this.x0,a=this.rh-n*Math.cos(r)+this.y0;return t.x=o,t.y=a,t}function JM(t){var e,i,s,n,r,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1),n=0,0!==e&&(n=Math.atan2(s*t.x,s*t.y)),s=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-s*s)/(2*this.ns0)):(i=(this.c-s*s)/this.ns0,o=this.phi1z(this.e3,i)),r=ix(n/this.ns0+this.long0,this.over),t.x=r,t.y=o,t}function QM(t,e){var i,s,n,r,o,a=HM(.5*e);if(t<Jy)return a;for(var h=t*t,l=1;l<=25;l++)if(i=Math.sin(a),s=Math.cos(a),n=t*i,r=1-n*n,o=.5*r*r/s*(e/(1-h)-i/r+.5/t*Math.log((1-n)/(1+n))),a+=o,Math.abs(o)<=1e-7)return a;return null}var tS=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],eS={init:$M,forward:ZM,inverse:JM,names:tS,phi1z:QM};function iS(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function sS(t){var e,i,s,n,r,o,a,h,l=t.x,c=t.y;return s=ix(l-this.long0,this.over),e=Math.sin(c),i=Math.cos(c),n=Math.cos(s),o=this.sin_p14*e+this.cos_p14*i*n,r=1,o>0||Math.abs(o)<=Jy?(a=this.x0+this.a*r*i*Math.sin(s)/o,h=this.y0+this.a*r*(this.cos_p14*e-this.sin_p14*i*n)/o):(a=this.x0+this.infinity_dist*i*Math.sin(s),h=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=h,t}function nS(t){var e,i,s,n,r,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),s=Math.cos(n),o=HM(s*this.sin_p14+t.y*i*this.cos_p14/e),r=Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i),r=ix(this.long0+r,this.over)):(o=this.phic0,r=0),t.x=r,t.y=o,t}var rS=["gnom"],oS={init:iS,forward:sS,inverse:nS,names:rS};function aS(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Ky:Ky;for(var s,n,r,o,a=Math.asin(.5*e),h=0;h<30;h++)if(n=Math.sin(a),r=Math.cos(a),o=t*n,s=Math.pow(1-o*o,2)/(2*r)*(e/(1-t*t)-n/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),a+=s,Math.abs(s)<=1e-10)return a;return NaN}function hS(){this.sphere||(this.k0=tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function lS(t){var e,i,s=t.x,n=t.y,r=ix(s-this.long0,this.over);if(this.sphere)e=this.x0+this.a*r*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=AM(this.e,Math.sin(n));e=this.x0+this.a*this.k0*r,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t}function cS(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=ix(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=aS(this.e,2*t.y*this.k0/this.a),e=ix(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t}var uS=["cea"],dS={init:hS,forward:lS,inverse:cS,names:uS};function fS(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function gS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=SM(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*n,t}function pS(t){var e=t.x,i=t.y;return t.x=ix(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=SM(this.lat0+(i-this.y0)/this.a),t}var _S=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"],mS={init:fS,forward:gS,inverse:pS,names:_S},yS=20;function vS(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.ml0=this.a*yM(this.e0,this.e1,this.e2,this.e3,this.lat0)}function xS(t){var e,i,s,n=t.x,r=t.y,o=ix(n-this.long0,this.over);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=Jy?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(r),i=this.a*(SM(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=Jy)e=this.a*o,i=-1*this.ml0;else{var a=MM(this.a,this.e,Math.sin(r))/Math.tan(r);e=a*Math.sin(s),i=this.a*yM(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(s))}return t.x=e+this.x0,t.y=i+this.y0,t}function wS(t){var e,i,s,n,r,o,a,h,l;if(s=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Jy)e=ix(s/this.a+this.long0,this.over),i=0;else{var c;for(o=this.lat0+n/this.a,a=s*s/this.a/this.a+o*o,h=o,r=yS;r;--r)if(c=Math.tan(h),l=-1*(o*(h*c+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),h+=l,Math.abs(l)<=Jy){i=h;break}e=ix(this.long0+Math.asin(s*Math.tan(h)/this.a)/Math.sin(i),this.over)}else if(Math.abs(n+this.ml0)<=Jy)i=0,e=ix(this.long0+s/this.a,this.over);else{var u,d,f,g,p;for(o=(this.ml0+n)/this.a,a=s*s/this.a/this.a+o*o,h=o,r=yS;r;--r)if(p=this.e*Math.sin(h),u=Math.sqrt(1-p*p)*Math.tan(h),d=this.a*yM(this.e0,this.e1,this.e2,this.e3,h),f=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),g=d/this.a,l=(o*(u*g+1)-g-.5*u*(g*g+a))/(this.es*Math.sin(2*h)*(g*g+a-2*o*g)/(4*u)+(o-g)*(u*f-2/Math.sin(2*h))-f),h-=l,Math.abs(l)<=Jy){i=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=ix(this.long0+Math.asin(s*u/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t}var ES=["Polyconic","American_Polyconic","poly"],MS={init:vS,forward:xS,inverse:wS,names:ES},SS=1;function CS(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function bS(t){var e,i=t.x,s=t.y,n=s-this.lat0,r=i-this.long0,o=n/Yy*1e-5,a=r,h=1,l=0;for(e=1;e<=10;e++)h*=o,l+=this.A[e]*h;var c,u,d=l,f=a,g=1,p=0,_=0,m=0;for(e=1;e<=6;e++)c=g*d-p*f,u=p*d+g*f,g=c,p=u,_=_+this.B_re[e]*g-this.B_im[e]*p,m=m+this.B_im[e]*g+this.B_re[e]*p;return t.x=m*this.a+this.x0,t.y=_*this.a+this.y0,t}function PS(t){var e,i,s,n=t.x,r=t.y,o=n-this.x0,a=r-this.y0,h=a/this.a,l=o/this.a,c=1,u=0,d=0,f=0;for(e=1;e<=6;e++)i=c*h-u*l,s=u*h+c*l,c=i,u=s,d=d+this.C_re[e]*c-this.C_im[e]*u,f=f+this.C_im[e]*c+this.C_re[e]*u;for(var g=0;g<this.iterations;g++){var p,_,m=d,y=f,v=h,x=l;for(e=2;e<=6;e++)p=m*d-y*f,_=y*d+m*f,m=p,y=_,v+=(e-1)*(this.B_re[e]*m-this.B_im[e]*y),x+=(e-1)*(this.B_im[e]*m+this.B_re[e]*y);m=1,y=0;var w=this.B_re[1],E=this.B_im[1];for(e=2;e<=6;e++)p=m*d-y*f,_=y*d+m*f,m=p,y=_,w+=e*(this.B_re[e]*m-this.B_im[e]*y),E+=e*(this.B_im[e]*m+this.B_re[e]*y);var M=w*w+E*E;d=(v*w+x*E)/M,f=(x*w-v*E)/M}var S=d,C=f,b=1,P=0;for(e=1;e<=9;e++)b*=S,P+=this.D[e]*b;var R=this.lat0+P*Yy*1e5,I=this.long0+C;return t.x=I,t.y=R,t}var RS=["New_Zealand_Map_Grid","nzmg"],IS={init:CS,forward:bS,inverse:PS,names:RS,iterations:SS};function TS(){}function AS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=this.x0+this.a*s,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=n,t.y=r,t}function GS(t){t.x-=this.x0,t.y-=this.y0;var e=ix(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t}var OS=["Miller_Cylindrical","mill"],LS={init:TS,forward:AS,inverse:GS,names:OS},NS=20;function kS(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=rE(this.es)}function FS(t){var e,i,s=t.x,n=t.y;if(s=ix(s-this.long0,this.over),this.sphere){if(this.m)for(var r=this.n*Math.sin(n),o=NS;o;--o){var a=(this.m*n+Math.sin(n)-r)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<Jy)break}else n=1!==this.n?Math.asin(this.n*Math.sin(n)):n;e=this.a*this.C_x*s*(this.m+Math.cos(n)),i=this.a*this.C_y*n}else{var h=Math.sin(n),l=Math.cos(n);i=this.a*oE(n,h,l,this.en),e=this.a*s*l/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=i,t}function DS(t){var e,i,s,n;return t.x-=this.x0,s=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,s/=this.C_x*(this.m+Math.cos(e)),this.m?e=HM((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=HM(Math.sin(e)/this.n)),s=ix(s+this.long0,this.over),e=SM(e)):(e=hE(t.y/this.a,this.es,this.en),n=Math.abs(e),n<Ky?(n=Math.sin(e),i=this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),s=ix(i,this.over)):n-Jy<Ky&&(s=this.long0)),t.x=s,t.y=e,t}var jS=["Sinusoidal","sinu"],zS={init:kS,forward:FS,inverse:DS,names:jS};function US(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var BS=FS,WS=DS,XS=["Eckert_VI","eck6"],VS={init:US,forward:BS,inverse:WS,names:XS};function qS(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0}function YS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=i,r=Math.PI*Math.sin(i);while(1){var o=-(n+Math.sin(n)-r)/(1+Math.cos(n));if(n+=o,Math.abs(o)<Jy)break}n/=2,Math.PI/2-Math.abs(i)<Jy&&(s=0);var a=.900316316158*this.a*s*Math.cos(n)+this.x0,h=1.4142135623731*this.a*Math.sin(n)+this.y0;return t.x=a,t.y=h,t}function KS(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var s=ix(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=s,t.y=n,t}var HS=["Mollweide","moll"],$S={init:qS,forward:YS,inverse:KS,names:HS};function ZS(){Math.abs(this.lat1+this.lat2)<Jy||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=tx(this.e,this.sin_phi,this.cos_phi),this.ml1=yM(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<Jy?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=tx(this.e,this.sin_phi,this.cos_phi),this.ml2=yM(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=yM(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function JS(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var n=yM(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-n)}var r=this.ns*ix(i-this.long0,this.over),o=this.x0+e*Math.sin(r),a=this.y0+this.rh-e*Math.cos(r);return t.x=o,t.y=a,t}function QS(t){var e,i,s,n;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var r=0;if(0!==i&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=ix(this.long0+r/this.ns,this.over),s=SM(this.g-i/this.a),t.x=n,t.y=s,t;var o=this.g-i/this.a;return s=CM(o,this.e0,this.e1,this.e2,this.e3),n=ix(this.long0+r/this.ns,this.over),t.x=n,t.y=s,t}var tC=["Equidistant_Conic","eqdc"],eC={init:ZS,forward:JS,inverse:QS,names:tC};function iC(){this.R=this.a}function sC(t){var e,i,s=t.x,n=t.y,r=ix(s-this.long0,this.over);if(Math.abs(n)<=Jy)return e=this.x0+this.R*r,i=this.y0,t.x=e,t.y=i,t;var o=HM(2*Math.abs(n/Math.PI));if(Math.abs(r)<=Jy||Math.abs(Math.abs(n)-Ky)<=Jy)return e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),t.x=e,t.y=i,t;var a=.5*Math.abs(Math.PI/r-r/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,f=u*(2/l-1),g=f*f,p=Math.PI*this.R*(a*(u-g)+Math.sqrt(h*(u-g)*(u-g)-(g+h)*(d-g)))/(g+h);r<0&&(p=-p),e=this.x0+p;var _=h+u;return p=Math.PI*this.R*(f*_-a*Math.sqrt((g+h)*(h+1)-_*_))/(g+h),i=n>=0?this.y0+p:this.y0-p,t.x=e,t.y=i,t}function nC(t){var e,i,s,n,r,o,a,h,l,c,u,d,f;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,s=t.x/u,n=t.y/u,r=s*s+n*n,o=-Math.abs(n)*(1+r),a=o-2*n*n+s*s,h=-2*o+1+2*n*n+r*r,f=n*n/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,l=(o-a*a/3/h)/h,c=2*Math.sqrt(-l/3),u=3*f/l/c,Math.abs(u)>1&&(u=u>=0?1:-1),d=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,e=Math.abs(s)<Jy?this.long0:ix(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(s*s-n*n)+r*r))/2/s,this.over),t.x=e,t.y=i,t}var rC=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"],oC={init:iC,forward:sC,inverse:nC,names:rC};function aC(t,e,i,s,n,r){const o=s-e,a=Math.atan((1-r)*Math.tan(t)),h=Math.atan((1-r)*Math.tan(i)),l=Math.sin(a),c=Math.cos(a),u=Math.sin(h),d=Math.cos(h);let f,g,p,_,m,y,v,x,w,E,M,S,C,b,P,R=o,I=100;do{if(g=Math.sin(R),p=Math.cos(R),_=Math.sqrt(d*g*(d*g)+(c*u-l*d*p)*(c*u-l*d*p)),0===_)return{azi1:0,s12:0};m=l*u+c*d*p,y=Math.atan2(_,m),v=c*d*g/_,x=1-v*v,w=0!==x?m-2*l*u/x:0,E=r/16*x*(4+r*(4-3*x)),f=R,R=o+(1-E)*r*v*(y+E*_*(w+E*m*(2*w*w-1)))}while(Math.abs(R-f)>1e-12&&--I>0);if(0===I)return{azi1:NaN,s12:NaN};M=x*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),S=1+M/16384*(4096+M*(M*(320-175*M)-768)),C=M/1024*(256+M*(M*(74-47*M)-128)),b=C*_*(w+C/4*(m*(2*w*w-1)-C/6*w*(4*_*_-3)*(4*w*w-3))),P=n*(1-r)*S*(y-b);const T=Math.atan2(d*g,c*u-l*d*p);return{azi1:T,s12:P}}function hC(t,e,i,s,n,r){const o=Math.atan((1-r)*Math.tan(t)),a=Math.sin(o),h=Math.cos(o),l=Math.sin(i),c=Math.cos(i),u=Math.atan2(a,h*c),d=h*l,f=1-d*d,g=f*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),p=1+g/16384*(4096+g*(g*(320-175*g)-768)),_=g/1024*(256+g*(g*(74-47*g)-128));let m,y,v,x,w,E=s/(n*(1-r)*p),M=100;do{y=Math.cos(2*u+E),v=Math.sin(E),x=Math.cos(E),w=_*v*(y+_/4*(x*(2*y*y-1)-_/6*y*(4*v*v-3)*(4*y*y-3))),m=E,E=s/(n*(1-r)*p)+w}while(Math.abs(E-m)>1e-12&&--M>0);if(0===M)return{lat2:NaN,lon2:NaN};const S=a*v-h*x*c,C=Math.atan2(a*x+h*v*c,(1-r)*Math.sqrt(d*d+S*S)),b=Math.atan2(v*l,h*x-a*v*c),P=r/16*f*(4+r*(4-3*f)),R=b-(1-P)*r*d*(E+P*v*(y+P*x*(2*y*y-1))),I=e+R;return{lat2:C,lon2:I}}function lC(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function cC(t){var e,i,s,n,r,o,a,h,l,c,u,d=t.x,f=t.y,g=Math.sin(t.y),p=Math.cos(t.y),_=ix(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=Jy?(t.x=this.x0+this.a*(Ky-f)*Math.sin(_),t.y=this.y0-this.a*(Ky-f)*Math.cos(_),t):Math.abs(this.sin_p12+1)<=Jy?(t.x=this.x0+this.a*(Ky+f)*Math.sin(_),t.y=this.y0+this.a*(Ky+f)*Math.cos(_),t):(l=this.sin_p12*g+this.cos_p12*p*Math.cos(_),a=Math.acos(l),h=a?a/Math.sin(a):1,t.x=this.x0+this.a*h*p*Math.sin(_),t.y=this.y0+this.a*h*(this.cos_p12*g-this.sin_p12*p*Math.cos(_)),t):(e=vM(this.es),i=xM(this.es),s=wM(this.es),n=EM(this.es),Math.abs(this.sin_p12-1)<=Jy?(r=this.a*yM(e,i,s,n,Ky),o=this.a*yM(e,i,s,n,f),t.x=this.x0+(r-o)*Math.sin(_),t.y=this.y0-(r-o)*Math.cos(_),t):Math.abs(this.sin_p12+1)<=Jy?(r=this.a*yM(e,i,s,n,Ky),o=this.a*yM(e,i,s,n,f),t.x=this.x0+(r+o)*Math.sin(_),t.y=this.y0+(r+o)*Math.cos(_),t):Math.abs(d)<Jy&&Math.abs(f-this.lat0)<Jy?(t.x=this.x0,t.y=this.y0,t):(c=aC(this.lat0,this.long0,f,d,this.a,this.f),u=c.azi1,t.x=this.x0+c.s12*Math.sin(u),t.y=this.y0+c.s12*Math.cos(u),t))}function uC(t){var e,i,s,n,r,o,a,h,l,c,u,d,f,g,p,_;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*Ky*this.a)return;return i=e/this.a,s=Math.sin(i),n=Math.cos(i),r=this.long0,Math.abs(e)<=Jy?o=this.lat0:(o=HM(n*this.sin_p12+t.y*s*this.cos_p12/e),a=Math.abs(this.lat0)-Ky,r=Math.abs(a)<=Jy?this.lat0>=0?ix(this.long0+Math.atan2(t.x,-t.y),this.over):ix(this.long0-Math.atan2(-t.x,t.y),this.over):ix(this.long0+Math.atan2(t.x*s,e*this.cos_p12*n-t.y*this.sin_p12*s),this.over)),t.x=r,t.y=o,t}return h=vM(this.es),l=xM(this.es),c=wM(this.es),u=EM(this.es),Math.abs(this.sin_p12-1)<=Jy?(d=this.a*yM(h,l,c,u,Ky),e=Math.sqrt(t.x*t.x+t.y*t.y),f=d-e,o=CM(f/this.a,h,l,c,u),r=ix(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=o,t):Math.abs(this.sin_p12+1)<=Jy?(d=this.a*yM(h,l,c,u,Ky),e=Math.sqrt(t.x*t.x+t.y*t.y),f=e-d,o=CM(f/this.a,h,l,c,u),r=ix(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=o,t):(g=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),_=hC(this.lat0,this.long0,g,p,this.a,this.f),t.x=_.lon2,t.y=_.lat2,t)}var dC=["Azimuthal_Equidistant","aeqd"],fC={init:lC,forward:cC,inverse:uC,names:dC};function gC(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function pC(t){var e,i,s,n,r,o,a,h,l=t.x,c=t.y;return s=ix(l-(this.long0||0),this.over),e=Math.sin(c),i=Math.cos(c),n=Math.cos(s),o=this.sin_p14*e+this.cos_p14*i*n,r=1,(o>0||Math.abs(o)<=Jy)&&(a=(this.x0||0)+this.a*r*i*Math.sin(s),h=(this.y0||0)+this.a*r*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=h,t}function _C(t){var e,i,s,n,r,o,a,h,l;return t.x-=this.x0||0,t.y-=this.y0||0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=HM(e/this.a),s=Math.sin(i),n=Math.cos(i),h=this.long0||0,l=this.lat0||0,o=h,Math.abs(e)<=Jy?(a=l,t.x=o,t.y=a,t):(a=HM(n*this.sin_p14+t.y*s*this.cos_p14/e),r=Math.abs(l)-Ky,Math.abs(r)<=Jy?(o=ix(l>=0?h+Math.atan2(t.x,-t.y):h-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=ix(h+Math.atan2(t.x*s,e*this.cos_p14*n-t.y*this.sin_p14*s),this.over),t.x=o,t.y=a,t))}var mC=["ortho"],yC={init:gC,forward:pC,inverse:_C,names:mC},vC={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},xC={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function wC(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Ky-ev/2?this.face=vC.TOP:this.lat0<=-(Ky-ev/2)?this.face=vC.BOTTOM:Math.abs(this.long0)<=ev?this.face=vC.FRONT:Math.abs(this.long0)<=Ky+ev?this.face=this.long0>0?vC.RIGHT:vC.LEFT:this.face=vC.BACK,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function EC(t){var e,i,s,n,r,o,a={x:0,y:0},h={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===vC.TOP)n=Ky-e,i>=ev&&i<=Ky+ev?(h.value=xC.AREA_0,s=i-Ky):i>Ky+ev||i<=-(Ky+ev)?(h.value=xC.AREA_1,s=i>0?i-sv:i+sv):i>-(Ky+ev)&&i<=-ev?(h.value=xC.AREA_2,s=i+Ky):(h.value=xC.AREA_3,s=i);else if(this.face===vC.BOTTOM)n=Ky+e,i>=ev&&i<=Ky+ev?(h.value=xC.AREA_0,s=-i+Ky):i<ev&&i>=-ev?(h.value=xC.AREA_1,s=-i):i<-ev&&i>=-(Ky+ev)?(h.value=xC.AREA_2,s=-i-Ky):(h.value=xC.AREA_3,s=i>0?-i+sv:-i-sv);else{var l,c,u,d,f,g,p;this.face===vC.RIGHT?i=CC(i,+Ky):this.face===vC.BACK?i=CC(i,+sv):this.face===vC.LEFT&&(i=CC(i,-Ky)),d=Math.sin(e),f=Math.cos(e),g=Math.sin(i),p=Math.cos(i),l=f*p,c=f*g,u=d,this.face===vC.FRONT?(n=Math.acos(l),s=SC(n,u,c,h)):this.face===vC.RIGHT?(n=Math.acos(c),s=SC(n,u,-l,h)):this.face===vC.BACK?(n=Math.acos(-l),s=SC(n,u,-c,h)):this.face===vC.LEFT?(n=Math.acos(-c),s=SC(n,u,l,h)):(n=s=0,h.value=xC.AREA_0)}return o=Math.atan(12/sv*(s+Math.acos(Math.sin(s)*Math.cos(ev))-Ky)),r=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===xC.AREA_1?o+=Ky:h.value===xC.AREA_2?o+=sv:h.value===xC.AREA_3&&(o+=1.5*sv),a.x=r*Math.cos(o),a.y=r*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t}function MC(t){var e,i,s,n,r,o,a,h,l,c,u,d,f={lam:0,phi:0},g={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?g.value=xC.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(g.value=xC.AREA_1,e-=Ky):t.x<0&&-t.x>=Math.abs(t.y)?(g.value=xC.AREA_2,e=e<0?e+sv:e-sv):(g.value=xC.AREA_3,e+=Ky),l=sv/12*Math.tan(e),r=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(r),s=Math.cos(e),n=Math.tan(i),a=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(o)))),a<-1?a=-1:a>1&&(a=1),this.face===vC.TOP)h=Math.acos(a),f.phi=Ky-h,g.value===xC.AREA_0?f.lam=o+Ky:g.value===xC.AREA_1?f.lam=o<0?o+sv:o-sv:g.value===xC.AREA_2?f.lam=o-Ky:f.lam=o;else if(this.face===vC.BOTTOM)h=Math.acos(a),f.phi=h-Ky,g.value===xC.AREA_0?f.lam=-o+Ky:g.value===xC.AREA_1?f.lam=-o:g.value===xC.AREA_2?f.lam=-o-Ky:f.lam=o<0?-o-sv:-o+sv;else{var p,_,m;p=a,l=p*p,m=l>=1?0:Math.sqrt(1-l)*Math.sin(o),l+=m*m,_=l>=1?0:Math.sqrt(1-l),g.value===xC.AREA_1?(l=_,_=-m,m=l):g.value===xC.AREA_2?(_=-_,m=-m):g.value===xC.AREA_3&&(l=_,_=m,m=-l),this.face===vC.RIGHT?(l=p,p=-_,_=l):this.face===vC.BACK?(p=-p,_=-_):this.face===vC.LEFT&&(l=p,p=_,_=-l),f.phi=Math.acos(-m)-Ky,f.lam=Math.atan2(_,p),this.face===vC.RIGHT?f.lam=CC(f.lam,-Ky):this.face===vC.BACK?f.lam=CC(f.lam,-sv):this.face===vC.LEFT&&(f.lam=CC(f.lam,+Ky))}0!==this.es&&(c=f.phi<0?1:0,u=Math.tan(f.phi),d=this.b/Math.sqrt(u*u+this.one_minus_f_squared),f.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),c&&(f.phi=-f.phi));return f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t}function SC(t,e,i,s){var n;return t<Jy?(s.value=xC.AREA_0,n=0):(n=Math.atan2(e,i),Math.abs(n)<=ev?s.value=xC.AREA_0:n>ev&&n<=Ky+ev?(s.value=xC.AREA_1,n-=Ky):n>Ky+ev||n<=-(Ky+ev)?(s.value=xC.AREA_2,n=n>=0?n-sv:n+sv):(s.value=xC.AREA_3,n+=Ky)),n}function CC(t,e){var i=t+e;return i<-sv?i+=iv:i>+sv&&(i-=iv),i}var bC=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],PC={init:wC,forward:EC,inverse:MC,names:bC},RC=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],IC=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],TC=.8487,AC=1.3523,GC=tv/5,OC=1/GC,LC=18,NC=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},kC=function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])};function FC(t,e,i,s){for(var n=e;s;--s){var r=t(n);if(n-=r,Math.abs(r)<i)break}return n}function DC(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function jC(t){var e=ix(t.x-this.long0,this.over),i=Math.abs(t.y),s=Math.floor(i*GC);s<0?s=0:s>=LC&&(s=LC-1),i=tv*(i-OC*s);var n={x:NC(RC[s],i)*e,y:NC(IC[s],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*TC+this.x0,n.y=n.y*this.a*AC+this.y0,void 0!==t.z&&(n.z=t.z),void 0!==t.m&&(n.m=t.m),n}function zC(t){var e={x:(t.x-this.x0)/(this.a*TC),y:Math.abs(t.y-this.y0)/(this.a*AC)};if(e.y>=1)e.x/=RC[LC][0],e.y=t.y<0?-Ky:Ky;else{var i=Math.floor(e.y*LC);for(i<0?i=0:i>=LC&&(i=LC-1);;)if(IC[i][0]>e.y)--i;else{if(!(IC[i+1][0]<=e.y))break;++i}var s=IC[i],n=5*(e.y-s[0])/(IC[i+1][0]-s[0]);n=FC(function(t){return(NC(s,t)-e.y)/kC(s,t)},n,Jy,100),e.x/=NC(RC[i],n),e.y=(5*i+n)*Qy,t.y<0&&(e.y=-e.y)}return e.x=ix(e.x+this.long0,this.over),void 0!==t.z&&(e.z=t.z),void 0!==t.m&&(e.m=t.m),e}var UC=["Robinson","robin"],BC={init:DC,forward:jC,inverse:zC,names:UC};function WC(){this.name="geocent"}function XC(t){var e=Zx(t,this.es,this.a);return e}function VC(t){var e=Jx(t,this.es,this.a,this.b);return e}var qC=["Geocentric","geocentric","geocent","Geocent"],YC={init:WC,forward:XC,inverse:VC,names:qC},KC={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},HC={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function $C(){if(Object.keys(HC).forEach(function(t){if("undefined"===typeof this[t])this[t]=HC[t].def;else{if(HC[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);HC[t].num&&(this[t]=parseFloat(this[t]))}HC[t].degrees&&(this[t]=this[t]*Qy)}.bind(this)),Math.abs(Math.abs(this.lat0)-Ky)<Jy?this.mode=this.lat0<0?KC.S_POLE:KC.N_POLE:Math.abs(this.lat0)<Jy?this.mode=KC.EQUIT:(this.mode=KC.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)}function ZC(t){t.x-=this.long0;var e,i,s,n,r=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case KC.OBLIQ:i=this.sinph0*r+this.cosph0*o*a;break;case KC.EQUIT:i=o*a;break;case KC.S_POLE:i=-r;break;case KC.N_POLE:i=r;break}switch(i=this.pn1/(this.p-i),e=i*o*Math.sin(t.x),this.mode){case KC.OBLIQ:i*=this.cosph0*r-this.sinph0*o*a;break;case KC.EQUIT:i*=r;break;case KC.N_POLE:i*=-o*a;break;case KC.S_POLE:i*=o*a;break}return s=i*this.cg+e*this.sg,n=1/(s*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*n,i=s*n,t.x=e*this.a,t.y=i*this.a,t}function JC(t){t.x/=this.a,t.y/=this.a;var e,i,s,n={x:t.x,y:t.y};s=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*s,i=this.pn1*t.y*this.cw*s,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var r=pE(t.x,t.y);if(Math.abs(r)<Jy)n.x=0,n.y=t.y;else{var o,a;switch(a=1-r*r*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/r+r/this.pn1),o=Math.sqrt(1-a*a),this.mode){case KC.OBLIQ:n.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/r),t.y=(o-this.sinph0*Math.sin(n.y))*r,t.x*=a*this.cosph0;break;case KC.EQUIT:n.y=Math.asin(t.y*a/r),t.y=o*r,t.x*=a;break;case KC.N_POLE:n.y=Math.asin(o),t.y=-t.y;break;case KC.S_POLE:n.y=-Math.asin(o);break}n.x=Math.atan2(t.x,t.y)}return t.x=n.x+this.long0,t.y=n.y,t}var QC=["Tilted_Perspective","tpers"],tb={init:$C,forward:ZC,inverse:JC,names:QC};function eb(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function ib(t){var e,i,s,n,r=t.x,o=t.y;if(r-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/pE(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(r)*Math.cos(o),s=a*Math.sin(r)*Math.cos(o),n=a*Math.sin(o),(this.radius_g-i)*i-s*s-n*n*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/pE(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/pE(s,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(r)*e,s=Math.sin(r)*e,n=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/pE(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/pE(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t}function sb(t){var e,i,s,n,r=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*pE(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*pE(1,o));var h=a/this.radius_p;if(e=o*o+h*h+r*r,i=2*this.radius_g*r,s=i*i-4*e*this.C,s<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+r*r,i=2*this.radius_g*r,s=i*i-4*e*this.C,s<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r)}return t.x=t.x+this.long0,t}var nb=["Geostationary Satellite View","Geostationary_Satellite","geos"],rb={init:eb,forward:ib,inverse:sb,names:nb},ob=1.340264,ab=-.081106,hb=893e-6,lb=.003796,cb=Math.sqrt(3)/2;function ub(){this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,0!==this.es&&(this.apa=DM(this.es),this.qp=AM(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function db(t){var e=ix(t.x-this.long0,this.over),i=t.y,s=Math.sin(i);0!==this.es&&(s=AM(this.e,s)/this.qp);var n=Math.asin(cb*s),r=n*n,o=r*r*r;return t.x=e*Math.cos(n)/(cb*(ob+3*ab*r+o*(7*hb+9*lb*r))),t.y=n*(ob+ab*r+o*(hb+lb*r)),0!==this.es&&(t.x*=this.rqda,t.y*=this.rqda),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function fb(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,0!==this.es&&(t.x/=this.rqda,t.y/=this.rqda);var e,i,s,n,r,o,a=1e-9,h=12,l=t.y;for(o=0;o<h;++o)if(e=l*l,i=e*e*e,s=l*(ob+ab*e+i*(hb+lb*e))-t.y,n=ob+3*ab*e+i*(7*hb+9*lb*e),l-=r=s/n,Math.abs(r)<a)break;return e=l*l,i=e*e*e,t.x=cb*t.x*(ob+3*ab*e+i*(7*hb+9*lb*e))/Math.cos(l),t.y=Math.asin(Math.sin(l)/cb),0!==this.es&&(t.y=jM(t.y,this.apa)),t.x=ix(t.x+this.long0,this.over),t}var gb=["eqearth","Equal Earth","Equal_Earth"],pb={init:ub,forward:db,inverse:fb,names:gb},_b=1e-10;function mb(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<_b)throw new Error;this.es?(this.en=rE(this.es),this.m1=oE(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=vb,this.forward=yb):(Math.abs(this.phi1)+_b>=Ky?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=wb,this.forward=xb)}function yb(t){var e,i,s,n=ix(t.x-(this.long0||0),this.over),r=t.y;return e=this.am1+this.m1-oE(r,i=Math.sin(r),s=Math.cos(r),this.en),i=s*n/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function vb(t){var e,i,s,n;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=pE(t.x,t.y=this.am1-t.y),n=hE(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(n))<Ky)e=Math.sin(n),s=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(n);else{if(!(Math.abs(e-Ky)<=_b))throw new Error;s=0}return t.x=ix(s+(this.long0||0),this.over),t.y=SM(n),t}function xb(t){var e,i,s=ix(t.x-(this.long0||0),this.over),n=t.y;return i=this.cphi1+this.phi1-n,Math.abs(i)>_b?(t.x=i*Math.sin(e=s*Math.cos(n)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function wb(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var s=pE(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>Ky)throw new Error;return e=Math.abs(Math.abs(i)-Ky)<=_b?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=ix(e+(this.long0||0),this.over),t.y=SM(i),t}var Eb=["bonne","Bonne (Werner lat_1=90)"],Mb={init:mb,names:Eb};const Sb={OBLIQUE:{forward:Tb,inverse:Gb},TRANSVERSE:{forward:Ab,inverse:Ob}},Cb={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function bb(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=dx.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=Hx(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const s=Object.keys(Cb),n=t=>{if("undefined"===typeof this[t])return;const e=parseFloat(this[t])*Qy;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let a=0;a<s.length;a++){const t=s[a],e=Cb[t],r=Object.entries(e),o=r.some(([t])=>"undefined"!==typeof this[t]);if(o){i=e;for(let t=0;t<r.length;t++){const[e,i]=r[t],s=n(e);if("undefined"===typeof s)throw new Error("Missing parameter: "+e+".");this[i]=s}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:r,phip:o}=Ib(this,i);this.lamp=r,Math.abs(o)>Jy?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=Sb.OBLIQUE):this.projectionType=Sb.TRANSVERSE}function Pb(t){return this.projectionType.forward(this,t)}function Rb(t){return this.projectionType.inverse(this,t)}function Ib(t,e){let i,s;if(e===Cb.ROTATE){let e=t.oLongC,n=t.oLatC,r=t.oAlpha;if(Math.abs(Math.abs(n)-Ky)<=Jy)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");s=e+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(n)),i=Math.asin(Math.cos(n)*Math.sin(r))}else if(e===Cb.NEW_POLE)s=t.oLongP,i=t.oLatP;else{let e=t.oLong1,n=t.oLat1,r=t.oLong2,o=t.oLat2,a=Math.abs(n);if(Math.abs(n)>Ky-Jy)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>Ky-Jy)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(n-o)<Jy)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<Jy)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");s=Math.atan2(Math.cos(n)*Math.sin(o)*Math.cos(e)-Math.sin(n)*Math.cos(o)*Math.cos(r),Math.sin(n)*Math.cos(o)*Math.sin(r)-Math.cos(n)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(s-e)/Math.tan(n))}return{lamp:s,phip:i}}function Tb(t,e){let{x:i,y:s}=e;i=ix(i-t.long0,t.over);const n=Math.cos(i),r=Math.sin(s),o=Math.cos(s);e.x=ix(Math.atan2(o*Math.sin(i),t.sphip*o*n+t.cphip*r)+t.lamp),e.y=Math.asin(t.sphip*r-t.cphip*o*n);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=tv,a.y*=tv),a}function Ab(t,e){let{x:i,y:s}=e;i=ix(i-t.long0,t.over);const n=Math.cos(s),r=Math.cos(i);e.x=ix(Math.atan2(n*Math.sin(i),Math.sin(s))+t.lamp),e.y=Math.asin(-1*n*r);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=tv,o.y*=tv),o}function Gb(t,e){t.isIdentity&&(e.x*=Qy,e.y*=Qy);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){s-=t.lamp;const i=Math.cos(s),r=Math.sin(n),o=Math.cos(n);e.x=Math.atan2(o*Math.sin(s),t.sphip*o*i-t.cphip*r),e.y=Math.asin(t.sphip*r+t.cphip*o*i)}return e.x=ix(e.x+t.long0),e}function Ob(t,e){t.isIdentity&&(e.x*=Qy,e.y*=Qy);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){const i=Math.cos(n);s-=t.lamp,e.x=Math.atan2(i*Math.sin(s),-1*Math.sin(n)),e.y=Math.asin(i*Math.cos(s))}return e.x=ix(e.x+t.long0),e}var Lb=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"],Nb={init:bb,forward:Pb,inverse:Rb,names:Lb};function kb(t){t.Proj.projections.add(fE),t.Proj.projections.add(bE),t.Proj.projections.add(AE),t.Proj.projections.add(WE),t.Proj.projections.add(HE),t.Proj.projections.add(tM),t.Proj.projections.add(aM),t.Proj.projections.add(dM),t.Proj.projections.add(mM),t.Proj.projections.add(TM),t.Proj.projections.add(KM),t.Proj.projections.add(eS),t.Proj.projections.add(oS),t.Proj.projections.add(dS),t.Proj.projections.add(mS),t.Proj.projections.add(MS),t.Proj.projections.add(IS),t.Proj.projections.add(LS),t.Proj.projections.add(zS),t.Proj.projections.add(VS),t.Proj.projections.add($S),t.Proj.projections.add(eC),t.Proj.projections.add(oC),t.Proj.projections.add(fC),t.Proj.projections.add(yC),t.Proj.projections.add(PC),t.Proj.projections.add(BC),t.Proj.projections.add(YC),t.Proj.projections.add(tb),t.Proj.projections.add(rb),t.Proj.projections.add(pb),t.Proj.projections.add(Mb),t.Proj.projections.add(Nb)}const Fb=Object.assign(vw,{defaultDatum:"WGS84",Proj:Hx,WGS84:new Hx("WGS84"),Point:qw,toPoint:lw,defs:Wv,nadgrid:Lx,transform:gw,mgrs:Rw,version:"__VERSION__"});kb(Fb);var Db=Fb;let jb=null;function zb(t){jb=t;const e=Object.keys(t.defs),i=e.length;let s,n;for(s=0;s<i;++s){const i=e[s];if(!er(i)){const e=t.defs(i);let s=e.units;s||"longlat"!==e.projName||(s="degrees"),qr(new jn({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:s}))}}for(s=0;s<i;++s){const r=e[s],o=er(r);for(n=0;n<i;++n){const i=e[n],s=er(i);if(o&&s&&!rr(r,i))if(t.defs(r)===t.defs(i))$r([o,s]);else{const e=t(r,i);to(o,s,mo(o,s,e.forward),mo(s,o,e.inverse))}}}}zb(Db);var Ub={name:"mapView",props:{theme:{type:String,default:"light"},dataCrs:{type:String,default:"EPSG:3857"},zoom:{type:Number,default:4.2},hidePanels:{type:Boolean,default:!1},showLoader:{type:Boolean,default:!0},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},mapBackground:{type:String,default:null},autoLoad:{type:Object,default:null}},data(){return{viewerReady:!1,sidebarWidth:342,dropVisible:!1,sourceCategory:"raster",currentTab:"image",loadDialogVisible:!1,sidebarCollapsed:!1,panelRightCollapsed:!1,isLight:!1,themeIcon:"☀️",themeTitle:"切换到深色主题",statusInfo:"",toastText:"",toastType:"info",toastVisible:!1,mapInfo:{active:!1,name:"",kind:"",dataCrs:"",extent:"未知"},mapListItems:[],layerListVisible:!1,layerListHint:"",layerTotal:0,layerFeatureTotal:0,layerListItems:[],crsOptions:{dataCrs:[],viewCrs:[],urlExtentCrs:[]},customCrsOptions:[],mapExtent:{minx:"",miny:"",maxx:"",maxy:""},viewExtent:{minx:"",miny:"",maxx:"",maxy:""},form:{dataCrs:this.dataCrs,viewCrs:"EPSG:3857",urlExtentCrs:this.dataCrs,imgFileName:"未选择文件",worldFileName:"未选择文件",zoneHint:{message:"",options:[]},tilesDirName:"未选择目录",tilesInfo:"支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。",tilesTms:!1,geojsonDirName:"未选择目录",geojsonInfo:"支持按文件名配对的 .geojson 与 .sld。",geojsonCrsHint:"未选择 GeoJSON。",geojsonCrsOptions:[],urlTemplate:"",urlInfo:"",urlMinzoom:"",urlMaxzoom:"",customEpsg:""}}},computed:{viewerStyle(){const t=t=>null==t||""===t?null:"number"===typeof t?t+"px":String(t),e={},i=t(this.width),s=t(this.height);return i&&(e.width=i),s&&(e.height=s),e["--sidebar-width"]=this.sidebarWidth+"px",this.mapBackground&&(e["--map-bg"]=this.mapBackground),e}},mounted(){this.initViewer(),this.processAutoLoad().catch(t=>{console.error("[autoLoad] 自动加载失败:",t),this.toast("自动加载失败:"+t.message,"err")}),this.hidePanels&&(this.collapseSidebar(),this.collapsePanelRight())},beforeDestroy(){this.destroyViewer()},methods:{initViewer(){if(this.viewerReady)return;this.map=null,this.viewerAbortController=new AbortController,this.PIXEL=new jn({code:"PIXEL",units:"pixels"}),qr(this.PIXEL),this.CRS_GROUPS=[],this.addGroup("常用",[{code:"EPSG:3857",name:"EPSG:3857 · WGS84 伪墨卡托(网络地图)"},{code:"EPSG:4326",name:"EPSG:4326 · WGS84 经纬度"},{code:"EPSG:4490",name:"EPSG:4490 · CGCS2000 经纬度(2000国家大地坐标系)",def:"+proj=longlat +ellps=GRS80 +no_defs"},{code:"PIXEL",name:"像素坐标(未配准图片)",pixel:!0}]);const t=[],e=[],i=[],s=[];for(let o=25;o<=45;o++){const e=3*o;t.push({code:"EPSG:"+(4513+o-25),name:`EPSG:${4513+o-25} · CGCS2000 3度带 ${o}(CM ${e}°E)`,def:this.gkDef(e,5e5+1e6*o),geoBox:[e-1.5,16,e+1.5,56]})}for(let o=13;o<=23;o++){const t=6*o-3;i.push({code:"EPSG:"+(4491+o-13),name:`EPSG:${4491+o-13} · CGCS2000 6度带 ${o}(CM ${t}°E)`,def:this.gkDef(t,5e5+1e6*o),geoBox:[t-3,16,t+3,56]})}this.addGroup("CGCS2000 3度带(含带号)",t),this.addGroup("CGCS2000 3度带(中央经线)",e),this.addGroup("CGCS2000 6度带(含带号)",i),this.addGroup("CGCS2000 6度带(中央经线)",s);const n=[],r=[];for(let o=1;o<=60;o++){const t=6*o-183;n.push({code:`EPSG:${32600+o}`,name:`EPSG:${32600+o} · WGS84 / UTM ${o}N(CM ${t}°E)`,def:`+proj=utm +zone=${o} +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]}),r.push({code:`EPSG:${32700+o}`,name:`EPSG:${32700+o} · WGS84 / UTM ${o}S(CM ${t}°E)`,def:`+proj=utm +zone=${o} +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]})}this.addGroup("UTM 北半球",n),this.addGroup("UTM 南半球",r),this.presetByCode=new Map;for(const o of this.CRS_GROUPS)for(const t of o.items)this.presetByCode.set(t.code,t);this.customPresets=[],this.map=new zf({target:"map",layers:[],view:new eh({projection:this.form.viewCrs,center:eo([108.5,36.5],this.form.viewCrs),zoom:this.zoom}),controls:[new Ah({zoomInTipLabel:"放大",zoomOutTipLabel:"缩小"}),new Ry({tipLabel:"全屏"}),new Oy({units:"metric",target:this.$refs.statusScale}),new Fy({coordinateFormat:t=>this.formatCoord(t),undefinedHTML:"—",target:this.$refs.statusCoords}),this.createFitAllControl()]}),this.attachViewListener(),this.map.on("moveend",()=>{this.updateStatus(),this.$emit("view-changed",this.getViewState())}),this.toastTimer=null,this.mapEntries=[],this.activeEntry=null,this.entrySeq=0,this.KIND_LABELS={image:"图片",tiles:"本地切片XYZ",xyz:"在线切片XYZ",geojson:"GeoJSON / SLD"},this.TILE_PATH_RE=/(\d+)[\\/](\d+)[\\/](\d+)\.(png|jpe?g|webp)$/i,this.pickedImage=null,this.pickedWorldFile=null,this.pickedTiles=null,this.VECTOR_COLORS=["#3f8cff","#39c26d","#e8b339","#e8718d","#9b6fd8","#31b8b5","#f28f3b","#729b6f"],this.GEOJSON_FILE_RE=/\.(geojson|json)$/i,this.SLD_FILE_RE=/\.(sld|xml)$/i,this.pickedGeoJson=null,this.geoJsonCrsDetectionSeq=0,this.currentTab="image",this.$refs.imgFile.addEventListener("change",()=>{const t=this.$refs.imgFile.files&&this.$refs.imgFile.files[0];t&&this.onImageFileChosen(t)}),this.$refs.worldFile.addEventListener("change",async()=>{const t=this.$refs.worldFile.files&&this.$refs.worldFile.files[0];if(t)try{const e=await t.text();this.pickedWorldFile={text:e,name:t.name},this.form.worldFileName=t.name,this.applyWorldFileToExtent()}catch{this.toast("世界文件读取失败","err")}}),this.$refs.tilesDir.addEventListener("change",()=>this.onTilesDirChosen(this.$refs.tilesDir.files)),this.$refs.geojsonDir.addEventListener("change",()=>this.onGeoJsonDirChosen(this.$refs.geojsonDir.files)),this.applyTheme(this.theme),["dragenter","dragover"].forEach(t=>document.addEventListener(t,t=>{t.preventDefault(),t.dataTransfer&&[...t.dataTransfer.types].includes("Files")&&(this.dropVisible=!0)},{signal:this.viewerAbortController.signal})),document.addEventListener("dragleave",t=>{t.relatedTarget||(this.dropVisible=!1)},{signal:this.viewerAbortController.signal}),document.addEventListener("drop",async t=>{t.preventDefault(),this.dropVisible=!1;const e=await this.filesFromDataTransfer(t.dataTransfer);if(!e.length)return;if(e.some(t=>this.GEOJSON_FILE_RE.test(t.name)||this.SLD_FILE_RE.test(t.name)))return this.onGeoJsonDirChosen(e),this.setActiveTab("geojson"),void await this.loadGeoJsonLayers();const i=e.find(t=>/\.(png|jpe?g|webp)$/i.test(t.name));if(!i)return void this.toast("请拖放图片或 GeoJSON/SLD","warn");const s=e.find(t=>/\.(pgw|pwg|jgw|gfw|wld|pngw|jpgw)$/i.test(t.name));if(await this.onImageFileChosen(i),s)try{this.pickedWorldFile={text:await s.text(),name:s.name},this.form.worldFileName=s.name,this.applyWorldFileToExtent()}catch{}this.setActiveTab("image"),this.toast("图片已就绪,点击“加载到地图”","ok")},{signal:this.viewerAbortController.signal}),this.refillCrsSelects(),this.form.viewCrs="EPSG:3857",(async()=>{const t=new URLSearchParams(location.search),e=this.normalizeEpsg(t.get("epsg"));e&&this.ensureProjection(e)&&(this.form.dataCrs=e);const i=t.get("xyz"),s=t.get("img");if(i){this.form.urlTemplate=i,t.get("minzoom")&&(this.form.urlMinzoom=t.get("minzoom")),t.get("maxzoom")&&(this.form.urlMaxzoom=t.get("maxzoom"));const e=(t.get("extent")||"").split(",").map(t=>parseFloat(t.trim()));4===e.length&&e.every(Number.isFinite)&&(this.$refs.urlExtMinx.value=e[0],this.$refs.urlExtMiny.value=e[1],this.$refs.urlExtMaxx.value=e[2],this.$refs.urlExtMaxy.value=e[3]);const s=this.normalizeEpsg(t.get("extentepsg"));s&&(this.form.urlExtentCrs=s),this.setActiveTab("url"),this.loadUrlLayer()}else if(s){this.setActiveTab("image");let e=null;const i=t.get("worldfile");if(i)try{const t=await fetch(i);t.ok&&(e=await t.text())}catch{}let n=null;const r=t.get("extent");if(r){const t=r.split(",").map(Number);4===t.length&&t.every(isFinite)&&(n=t)}await this.addImageFromUrl({url:s,name:decodeURIComponent(s.split("/").pop()||"图片"),worldText:e,extent:n})}})(),this.updateStatus(),this.updateUrlTemplateHint(),this.viewerReady=!0},startSidebarResize(t){t.preventDefault();const e=t.clientX,i=this.sidebarWidth,s=t=>{this.sidebarWidth=Math.min(620,Math.max(280,i+(t.clientX-e)))},n=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",s),window.addEventListener("mouseup",n)},collapseSidebar(){this.$refs.mapViewer.classList.add("sidebar-collapsed")},expandSidebar(){this.$refs.mapViewer.classList.remove("sidebar-collapsed")},collapsePanelRight(){this.$refs.mapViewer.classList.add("panel-right-collapsed")},expandPanelRight(){this.$refs.mapViewer.classList.remove("panel-right-collapsed")},toggleTheme(){this.applyTheme(this.$refs.mapViewer.classList.contains("light-theme")?"dark":"light")},async loadToMap(){const t=this.mapEntries.length;"image"===this.currentTab?await this.loadImageLayer():"tiles"===this.currentTab?this.loadTilesLayer():"geojson"===this.currentTab?await this.loadGeoJsonForCurrentSource():await this.loadUrlLayer(),this.mapEntries.length>t&&this.closeLoadDialog()},destroyViewer(){this.viewerAbortController&&(this.viewerAbortController.abort(),this.viewerAbortController=null),this.map&&(this.map.setTarget(null),this.map=null),this.viewerReady=!1},createFitAllControl(){const t=document.createElement("button");t.innerHTML="⤢",t.title="复位视图";const e=document.createElement("div");return e.className="ol-fit-all ol-control",e.appendChild(t),t.addEventListener("click",()=>this.fitActiveMap()),new Ch({element:e})},gkDef(t,e){return`+proj=tmerc +lat_0=0 +lon_0=${t} +k=1 +x_0=${e} +y_0=0 +ellps=GRS80 +units=m +no_defs`},addGroup(t,e){this.CRS_GROUPS.push({label:t,items:e})},buildCrsOptionGroups(t){const e=this.CRS_GROUPS.map(e=>({label:e.label,items:e.items.filter(e=>t||!e.pixel)})).filter(t=>t.items.length),i=this.customPresets.map(t=>({code:t.code,name:`${t.code} · 自定义`}));return{groups:e,custom:i}},refillCrsSelects(){const t=this.buildCrsOptionGroups(!0),e=this.buildCrsOptionGroups(!1);this.crsOptions.dataCrs=t.groups,this.crsOptions.viewCrs=e.groups,this.crsOptions.urlExtentCrs=e.groups,this.customCrsOptions=t.custom,this.form.urlExtentCrs||(this.form.urlExtentCrs="EPSG:3857")},ensureProjection(t){if(!t)return null;if("PIXEL"===t)return this.PIXEL;let e=Kr(t);if(e)return e;const i=this.presetByCode.get(t)||this.customPresets.find(e=>e.code===t);if(!i||!i.def)return null;if(Db.defs(t,i.def),zb(Db),e=Kr(t),e&&i.geoBox&&!e.getExtent())try{const s=ho(i.geoBox,"EPSG:4326",t);s.every(isFinite)&&e.setExtent(s)}catch{}return e},formatCoord(t){const e=this.map.getView();if(!e||!t)return"";const i=e.getProjection(),s="degrees"===i.getUnits(),n=t.map(t=>s?t.toFixed(6):t.toFixed(2)).join(", ");if("PIXEL"===i.getCode())return`${n} px`;try{const e=io(t,i);return isFinite(e[0])&&isFinite(e[1])?`${n} | ${e[0].toFixed(6)}, ${e[1].toFixed(6)}°`:n}catch{return n}},attachViewListener(){this.map.getView().on("change:resolution",()=>this.updateStatus())},fmtRes(t){return isFinite(t)?t>=1e3?t.toFixed(0):t>=1?t.toPrecision(4):t.toExponential(1):"-"},updateStatus(){const t=this.map&&this.map.getView();if(!t)return;const e=t.getZoom(),i=t.getResolution(),s=t.getProjection(),n="degrees"===s.getUnits()?"°/px":"PIXEL"===s.getCode()?"px":"m/px";this.statusInfo=`${s.getCode()} · 级别 ${null==e?"-":e.toFixed(1)} · 分辨率 ${this.fmtRes(i)} ${n}`,this.updateViewExtent(),this.updateMapExtent()},updateMapExtent(){const t=this.map&&this.map.getView(),e=t?t.getProjection():null;if(!this.activeEntry||!this.activeEntry.extent||!e)return void(this.mapExtent={minx:"",miny:"",maxx:"",maxy:""});let i=this.activeEntry.extent;if(this.activeEntry.projection.getCode()!==e.getCode()){try{i=ho(i,this.activeEntry.projection,e)}catch{i=null}if(!i||!i.every(isFinite))return void(this.mapExtent={minx:"",miny:"",maxx:"",maxy:""})}this.mapExtent={minx:this.fmtExtentInput(i[0]),miny:this.fmtExtentInput(i[1]),maxx:this.fmtExtentInput(i[2]),maxy:this.fmtExtentInput(i[3])}},updateViewExtent(){const t=this.map&&this.map.getView(),e=this.map&&this.map.getSize();if(!t||!e||!this.activeEntry||null==t.getResolution())return void(this.viewExtent={minx:"",miny:"",maxx:"",maxy:""});const i=t.calculateExtent(e);i&&i.every(isFinite)?this.viewExtent={minx:this.fmtExtentInput(i[0]),miny:this.fmtExtentInput(i[1]),maxx:this.fmtExtentInput(i[2]),maxy:this.fmtExtentInput(i[3])}:this.viewExtent={minx:"",miny:"",maxx:"",maxy:""}},fmtExtentInput(t){return isFinite(t)?String(+(Math.abs(t)>=1e3?t.toFixed(2):t.toFixed(6))):""},toast(t,e="info"){this.toastText=t,this.toastType=e,this.toastVisible=!0,clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{this.toastVisible=!1},3200)},kindIcon(t){return{image:"🖼️",tiles:"🧩",xyz:"🌐",geojson:"🌍"}[t]||"🗺️"},selectAndFitMap(t){this.selectMapEntry(t),this.activeEntry===t&&this.fitToExtent(t.extent,t.projection)},renderMapList(){this.mapListItems=this.mapEntries.map(t=>({id:t.id,entry:t,active:t===this.activeEntry,icon:this.kindIcon(t.kind),name:t.name,meta:`${t.projection.getCode()} · ${t.viewProjectionCode}`}))},renderMapInfo(){if(this.renderLayerList(),!this.activeEntry)return void(this.mapInfo.active=!1);const t=this.activeEntry,e=t.projection.getCode();this.mapInfo={active:!0,name:t.name,kind:`${this.kindIcon(t.kind)} ${this.KIND_LABELS[t.kind]||"地图"}`,dataCrs:t.sourceCrs&&t.sourceCrs!==e?`${e}(源:${t.sourceCrs})`:e,extent:t.extent?`X ${this.fmtExtentNum(t.extent[0])} ~ ${this.fmtExtentNum(t.extent[2])};Y ${this.fmtExtentNum(t.extent[1])} ~ ${this.fmtExtentNum(t.extent[3])}`:"未知"}},inferGeoJsonGroup(t){for(const e of t){const t=e.get("layer"),i="string"===typeof t?t.trim():"";if(i)return i}return null},buildLayerGroups(t){const e=[];let i=0;while(i<t.length){const s=t[i];if(!s.group){e.push({type:"layer",sublayer:s}),i+=1;continue}const n=i,r=[];while(i<t.length&&t[i].group===s.group)r.push(t[i]),i+=1;e.push({type:"group",key:`${n}:${s.group}`,name:s.group,children:r})}return e},isLayerEffectivelyVisible(t){return t.visible&&!1!==t.groupVisible},renderLayerList(){if(this.activeEntry&&"image"===this.activeEntry.kind)return this.layerListHint="PNG 格式地图无可操作图层",this.layerListVisible=!0,this.layerListItems=[],this.layerTotal=0,void(this.layerFeatureTotal=0);this.layerListHint="";const t=this.activeEntry&&this.activeEntry.sublayers?this.activeEntry.sublayers:[];this.layerTotal=t.length,this.layerFeatureTotal=t.reduce((t,e)=>t+(Number.isFinite(e.featureCount)?e.featureCount:0),0);const e=Boolean(t.length);if(this.layerListVisible=e,!e)return void(this.layerListItems=[]);const i=this.buildLayerGroups(this.activeEntry.sublayers).reverse();this.layerListItems=i.map((t,e)=>{if("layer"===t.type){const i=t.sublayer,s=this.isLayerEffectivelyVisible(i);return{type:"layer",key:`layer-${e}`,name:i.name,meta:`${this.kindIcon(i.kind)} ${this.KIND_LABELS[i.kind]||"图层"}${Number.isFinite(i.featureCount)?` · ${i.featureCount} 要素`:""}`,visible:s,sublayer:i}}const i=t.children.map((t,i)=>({key:`child-${e}-${i}`,name:t.name,meta:`${this.kindIcon(t.kind)} ${this.KIND_LABELS[t.kind]||"图层"}${Number.isFinite(t.featureCount)?` · ${t.featureCount} 要素`:""}`,visible:this.isLayerEffectivelyVisible(t),sublayer:t}));return{type:"group",key:`group-${t.key}-${e}`,name:t.name,collapsed:!this.activeEntry.expandedLayerGroups.has(t.key),visible:i.every(t=>!1!==t.sublayer.groupVisible),group:t,children:i}})},toggleLayerVisible(t){const e=t.sublayer;t.visible?(e.visible=!1,e.layer.setVisible(!1)):(e.visible=!0,e.layer.setVisible(!0)),this.renderLayerList()},toggleLayerGroupExpanded(t){t.collapsed?this.activeEntry.expandedLayerGroups.add(t.group.key):this.activeEntry.expandedLayerGroups.delete(t.group.key),this.renderLayerList()},toggleLayerGroupVisible(t){const e=!t.visible;t.children.forEach(t=>{t.sublayer.groupVisible=e,t.sublayer.layer.setVisible(e&&t.sublayer.visible)}),this.renderLayerList()},toggleLayerChildVisible(t,e){const i=e.sublayer;e.visible?(i.visible=!1,i.layer.setVisible(!1)):(i.visible=!0,t.children.forEach(t=>{t.sublayer.groupVisible=!0,t.sublayer.layer.setVisible(t.sublayer.visible)})),this.renderLayerList()},getVectorSourceExtent(t){if(!t||"geojson"!==t.kind)return null;try{const e=t.source||t.layer.getSource(),i=e&&"function"===typeof e.getExtent?e.getExtent():null;if(Array.isArray(i)&&i.every(isFinite)&&i[2]>i[0]&&i[3]>i[1])return i.slice()}catch(e){}return null},zoomToLayer(t){const e=this.activeEntry,i=t&&t.sublayer;if(!e||!i)return;const s=this.getVectorSourceExtent(i);s?this.fitToExtent(s,this.map.getView().getProjection()):Array.isArray(e.extent)&&e.extent.every(isFinite)&&e.extent[2]>e.extent[0]&&e.extent[3]>e.extent[1]?this.fitToExtent(e.extent,e.projection):this.toast("该图层暂无有效范围","warn")},zoomToLayerGroup(t){const e=this.activeEntry;if(!e||!t||!Array.isArray(t.children)||!t.children.length)return;const i=Ws();let s=!1;t.children.forEach(t=>{const e=this.getVectorSourceExtent(t.sublayer);e&&(Hs(i,e),s=!0)}),s&&i.every(isFinite)&&i[2]>i[0]&&i[3]>i[1]?this.fitToExtent(i,this.map.getView().getProjection()):this.fitToExtent(e.extent,e.projection)},removeSublayerInternal(t){const e=this.activeEntry;if(!e||!t)return!1;const i=e.sublayers.indexOf(t);if(i<0)return!1;if(e.sublayers.splice(i,1),Array.isArray(e.sources)){const i=e.sources.indexOf(t.source);i>=0&&e.sources.splice(i,1)}if(e.layer&&"function"===typeof e.layer.getLayers){e.layer.getLayers().remove(t.layer);try{t.layer.dispose()}catch(s){}}return!0},afterLayersRemoved(t){const e=this.activeEntry;if(e&&!e.sublayers.length)return this.deleteMapEntry(e),void(t&&this.toast(t,"ok"));this.renderMapList(),this.renderMapInfo(),t&&this.toast(t,"ok")},removeLayerItem(t){const e=t&&t.sublayer;e&&this.removeSublayerInternal(e)&&(this.$emit("layer-removed",{isGroup:!1,name:e.name,layerCount:null,group:e.group}),console.log("row",t),this.afterLayersRemoved("已删除图层:"+e.name))},removeLayerGroup(t){if(!t||!Array.isArray(t.children)||!t.children.length)return;const e=t.children.length;t.children.forEach(t=>this.removeSublayerInternal(t.sublayer)),console.log("row",t),this.$emit("layer-removed",{isGroup:!0,name:t.name,layerCount:e,group:null}),this.afterLayersRemoved("已删除图层组("+e+" 个图层)")},normalizeSublayers(t){Array.isArray(t.sublayers)||(t.sublayers=[{name:t.name,kind:t.kind,layer:t.layer,visible:!0}]);for(const e of t.sublayers)e.name=e.name||t.name,e.kind=e.kind||t.kind,e.group=e.group||null,e.groupVisible=!e.group||!1!==e.groupVisible,e.visible=!1!==e.visible,e.layer.setVisible(this.isLayerEffectivelyVisible(e)),e.layer.set("title",e.name);return t.sublayers},saveActiveViewState(){if(!this.activeEntry)return;const t=this.map.getView();this.activeEntry.viewState={center:t.getCenter(),resolution:t.getResolution()},this.activeEntry.viewProjectionCode=t.getProjection().getCode()},selectMapEntry(t){if(!t||t===this.activeEntry)return;this.saveActiveViewState(),this.activeEntry&&this.map.removeLayer(this.activeEntry.layer),this.activeEntry=t,this.map.addLayer(t.layer);const e=this.ensureProjection(t.viewProjectionCode)||t.projection,i=t.viewState;i&&i.center&&i.center.every(isFinite)?this.setViewProjection(e,{center:i.center,resolution:i.resolution}):(this.setViewProjection(e),this.fitToExtent(t.extent,t.projection)),this.renderMapList(),this.updateStatus(),this.renderMapInfo(),this.$emit("active-map-changed",{id:t.id,name:t.name,kind:t.kind})},addMapEntry(t){t.id=++this.entrySeq,t.expandedLayerGroups=new Set,t.sublayers=this.normalizeSublayers(t),t.layer.set("title",t.name),t.viewProjectionCode=t.projection.getCode(),t.viewState=null,this.mapEntries.unshift(t),this.selectMapEntry(t)},deleteMapEntry(t){const e=this.mapEntries.indexOf(t);e>=0&&this.mapEntries.splice(e,1),this.activeEntry===t?(this.map.removeLayer(t.layer),this.activeEntry=null,this.mapEntries.length?this.selectMapEntry(this.mapEntries[0]):(this.renderMapList(),this.renderMapInfo(),this.updateStatus())):this.renderMapList();try{t.cleanup&&t.cleanup()}catch{}this.$emit("map-removed",{id:t.id,name:t.name,kind:t.kind})},fitActiveMap(){this.activeEntry?this.fitToExtent(this.activeEntry.extent,this.activeEntry.projection):this.toast("暂无地图","warn")},fitToExtent(t,e){const i=this.map.getView(),s=i.getProjection();let n=t;if(e&&e.getCode()!==s.getCode()){try{n=ho(t,e,s)}catch{n=null}if(!n||!n.every(isFinite))return void this.toast("无法将数据范围转换到当前视图坐标系","warn")}!n||n[2]<=n[0]||n[3]<=n[1]||i.fit(n,{padding:[60,60,60,60],maxZoom:28,duration:300})},syncViewCrsSelect(){this.form.viewCrs=this.map.getView().getProjection().getCode()},computeViewTransition(t){const e=this.map.getView(),i=e.getProjection(),s=e.getCenter(),n=e.getResolution();let r=null,o=null;try{r=ao(s,i,t);const e=Hr(i,1,s,"m"),a=Hr(t,1,r,"m");r.every(isFinite)&&[e,a].every(isFinite)&&a>0?o=n*e/a:r=null}catch{r=null}return{center:r,resolution:o}},setViewProjection(t,{center:e,resolution:i}={}){const s=new eh({projection:t});if(this.map.setView(s),e&&e.every(isFinite))s.setCenter(e);else{const e=t.getExtent();e?s.setCenter([(e[0]+e[2])/2,(e[1]+e[3])/2]):s.setCenter([0,0])}if(i&&isFinite(i)&&i>0)try{s.setResolution(i)}catch{}this.attachViewListener(),this.syncViewCrsSelect(),this.activeEntry&&Array.isArray(this.activeEntry.sources)&&this.activeEntry.sources.forEach(t=>t.refresh()),this.updateStatus()},worldSquareExtent(t){let e=t.getExtent();if(!e||!e.every(isFinite))try{e=ho([-180,-90,180,90],"EPSG:4326",t)}catch{e=[-1,-1,1,1]}const i=e[2]-e[0],s=e[3]-e[1],n=Math.max(i,s),r=(e[0]+e[2])/2,o=(e[1]+e[3])/2;return[r-n/2,o-n/2,r+n/2,o+n/2]},buildTileGrid(t,e,i=0,s=null){const n=this.worldSquareExtent(t),r=(n[2]-n[0])/256,o=[];for(let a=0;a<=e;a++)o.push(r/Math.pow(2,a));return new U_({extent:s||n,origin:[n[0],n[3]],resolutions:o,tileSize:[256,256],minZoom:i,maxZoom:e})},tilesExtent(t,e){const i=t.getResolution(e.minZ),[s,n]=t.getOrigin(e.minZ);return[s+256*e.x0*i,n-256*(e.y1+1)*i,s+256*(e.x1+1)*i,n-256*e.y0*i]},fmtExtentNum(t){return isFinite(t)?Math.abs(t)>=1e3?Math.round(t).toLocaleString("zh-CN"):String(+t.toFixed(6)):"-"},extentText(t){return`X ${this.fmtExtentNum(t[0])} ~ ${this.fmtExtentNum(t[2])};Y ${this.fmtExtentNum(t[1])} ~ ${this.fmtExtentNum(t[3])}`},extentFromTileMap(t,e){const i=this.ensureProjection(e);if(!i||"PIXEL"===i.getCode())return null;const s=this.tileStats(t);if(!s)return null;const n=this.buildTileGrid(i,s.maxZ,s.minZ);return this.tilesExtent(n,s)},scanTileFiles(t,e){const i=new Map;for(const s of t){const t=s.webkitRelativePath||s.name,n=t.match(this.TILE_PATH_RE);if(!n)continue;let r=+n[1],o=+n[2],a=+n[3];e&&(a=(1<<r)-1-a),i.set(`${r}/${o}/${a}`,s)}return i},tileStats(t){if(!t.size)return null;let e=1/0,i=-1/0;const s=new Map;for(const n of t.keys()){const[t,r,o]=n.split("/").map(Number);t<e&&(e=t),t>i&&(i=t);let a=s.get(t);a||(a={x0:1/0,x1:-1/0,y0:1/0,y1:-1/0},s.set(t,a)),a.x0=Math.min(a.x0,r),a.x1=Math.max(a.x1,r),a.y0=Math.min(a.y0,o),a.y1=Math.max(a.y1,o)}return{minZ:e,maxZ:i,...s.get(e),ranges:s}},clampInt(t,e,i,s){const n=parseInt(t,10);return Number.isFinite(n)?Math.min(i,Math.max(e,n)):s},getImageSize(t){return new Promise((e,i)=>{const s=new Image;s.onload=()=>e({width:s.naturalWidth,height:s.naturalHeight}),s.onerror=()=>i(new Error("图片加载失败")),s.src=t})},parseWorldFile(t){const e=t.trim().split(/\r?\n/).map(t=>parseFloat(t.trim()));if(e.length<6||e.slice(0,6).some(t=>!isFinite(t)))throw new Error("世界文件格式无法解析");return e.slice(0,6)},extentFromWorldFile(t,e,i){const[s,n,r,o,a,h]=i;if(n||r)throw new Error("不支持带旋转的世界文件");return[a-s/2,h+(e-.5)*o,a+(t-.5)*s,h-o/2]},updateZoneHint(t){if(this.form.zoneHint={message:"",options:[]},!t)return;const e=t[2];if(e<=1e6||e>=7e7)return;const i=Math.round(e/1e6),s=[];i>=25&&i<=45&&s.push({code:"EPSG:"+(4513+i-25),label:`3度带 ${i},中央经线 ${3*i}°E(EPSG:${4513+i-25},含带号)`}),i>=13&&i<=23&&s.push({code:"EPSG:"+(4491+i-13),label:`6度带 ${i},中央经线 ${6*i-3}°E(EPSG:${4491+i-13},含带号)`}),s.length&&(this.form.dataCrs=s[0].code,this.form.zoneHint={message:"检测到高斯带号坐标,可能是:",options:s})},applyWorldFileToExtent(){if(this.pickedImage&&this.pickedImage.width&&this.pickedWorldFile)try{const t=this.parseWorldFile(this.pickedWorldFile.text),e=this.extentFromWorldFile(this.pickedImage.width,this.pickedImage.height,t);this.$refs.extMinx.value=e[0],this.$refs.extMiny.value=e[1],this.$refs.extMaxx.value=e[2],this.$refs.extMaxy.value=e[3],this.updateZoneHint(e),this.toast("已根据世界文件计算显示范围","ok")}catch(t){this.toast(`世界文件解析失败:${t.message}`,"err")}},async onImageFileChosen(t){this.pickedImage&&this.pickedImage.objectUrl&&URL.revokeObjectURL(this.pickedImage.objectUrl);const e=URL.createObjectURL(t);this.pickedImage={file:t,objectUrl:e,name:t.name,width:null,height:null},this.form.imgFileName=t.name,this.$refs.extMinx.value=this.$refs.extMiny.value=this.$refs.extMaxx.value=this.$refs.extMaxy.value="",this.updateZoneHint(null);try{const t=await this.getImageSize(e);this.pickedImage.width=t.width,this.pickedImage.height=t.height,this.applyWorldFileToExtent()}catch{this.toast("图片无法读取","err")}},readExtentInputs(){const t=[this.$refs.extMinx,this.$refs.extMiny,this.$refs.extMaxx,this.$refs.extMaxy].map(t=>t.value.trim());if(t.some(t=>""===t))return this.toast("请填写完整的四至范围:X/Y 的最小值和最大值","warn"),{ok:!1,extent:null};const e=t.map(Number);return e.some(t=>!isFinite(t))?(this.toast("范围数值无效","warn"),{ok:!1,extent:null}):e[2]>e[0]&&e[3]>e[1]?{ok:!0,extent:e}:(this.toast("范围无效:需要 X最大 > X最小 且 Y最大 > Y最小","warn"),{ok:!1,extent:null})},async loadImageLayer(){if(!this.pickedImage)return void this.toast("请先选择图片文件","warn");const t=this.ensureProjection(this.form.dataCrs);if(!t)return void this.toast("请先选择或注册有效的坐标系","warn");let{width:e,height:i}=this.pickedImage;if(!e||!i)try{const t=await this.getImageSize(this.pickedImage.objectUrl);e=this.pickedImage.width=t.width,i=this.pickedImage.height=t.height}catch{return void this.toast("无法读取图片尺寸","err")}const s=this.readExtentInputs();if(!s.ok)return;const n=s.extent,r=URL.createObjectURL(this.pickedImage.file),o=new ig({source:new F_({url:r,imageExtent:n,projection:t})});this.addMapEntry({name:this.pickedImage.name,kind:"image",layer:o,extent:n,projection:t,cleanup(){URL.revokeObjectURL(r)}})},async addImageFromUrl({url:t,name:e,worldText:i,extent:s}){let n;try{n=await this.getImageSize(t)}catch{return void this.toast(`无法加载图片:${t}`,"err")}if(i)try{const t=this.parseWorldFile(i);s=this.extentFromWorldFile(n.width,n.height,t)}catch(a){this.toast(`世界文件解析失败:${a.message}`,"err")}s=s||[0,-n.height,n.width,0];const r=this.ensureProjection(this.form.dataCrs)||this.PIXEL,o=new ig({source:new F_({url:t,imageExtent:s,projection:r})});this.$refs.extMinx.value=s[0],this.$refs.extMiny.value=s[1],this.$refs.extMaxx.value=s[2],this.$refs.extMaxy.value=s[3],this.updateZoneHint(s),this.addMapEntry({name:e,kind:"image",layer:o,extent:s,projection:r,cleanup(){}})},onTilesDirChosen(t){const e=Array.from(t||[]);if(!e.length)return;const i=(e[0].webkitRelativePath||"").split(/[\\/]/)[0]||"本地切片XYZ目录";this.pickedTiles={name:i,files:e},this.form.tilesDirName=`${i}(${e.length} 个文件)`,this.updateTilesInfo()},updateTilesInfo(){if(!this.pickedTiles)return;const t=this.scanTileFiles(this.pickedTiles.files,this.form.tilesTms),e=this.tileStats(t);if(!e)return void(this.form.tilesInfo="未识别到本地切片XYZ(需要 z/x/y.png 目录结构)");const i=this.extentFromTileMap(t,this.form.dataCrs);this.form.tilesInfo=i?`已识别 ${t.size} 张切片,层级 ${e.minZ}–${e.maxZ}。显示范围(${this.form.dataCrs}):${this.extentText(i)}`:`已识别 ${t.size} 张切片,层级 ${e.minZ}–${e.maxZ}。`},loadTilesLayer(){if(!this.pickedTiles||!this.pickedTiles.files.length)return void this.toast("请先选择本地切片XYZ目录","warn");const t=this.ensureProjection(this.form.dataCrs);if(!t)return void this.toast("请先选择或注册有效的坐标系","warn");const e=this.scanTileFiles(this.pickedTiles.files,this.form.tilesTms);if(!e.size)return void this.toast("所选目录中未找到 z/x/y 结构的切片文件","err");const i=this.tileStats(e),s=this.buildTileGrid(t,i.maxZ,i.minZ),n=this.tilesExtent(s,i),r=this.buildTileGrid(t,i.maxZ,i.minZ,n),o=new Map,a=new gm({projection:t,tileGrid:r,wrapX:!1,minZoom:i.minZ,maxZoom:i.maxZ,tileUrlFunction:([t,i,s])=>{const n=e.get(`${t}/${i}/${s}`);if(!n)return;let r=o.get(n);return r||(r=URL.createObjectURL(n),o.set(n,r)),r}});this.addMapEntry({name:this.pickedTiles.name,kind:"tiles",layer:new Kg({source:a}),extent:n,projection:t,cleanup(){o.forEach(t=>URL.revokeObjectURL(t))}})},updateUrlTemplateHint(){const t=String(this.form.urlTemplate||"").trim();this.form.urlInfo="",t&&(/^https?:\/\//i.test(t)?/\{z\}/.test(t)&&/\{x\}/.test(t)&&/(\{y\}|\{-y\})/.test(t)||(this.form.urlInfo="模板需包含 {z}、{x} 和 {y}(或 {-y})。"):this.form.urlInfo="URL 模板需以 http:// 或 https:// 开头。")},async createXyzEntry(t,e,i,s,n=null){if(!t||!/^https?:\/\//i.test(t))return{error:"URL 模板需以 http:// 或 https:// 开头"};if(!/\{z\}/.test(t)||!/\{x\}/.test(t)||!/(\{y\}|\{-y\})/.test(t))return{error:"模板需包含 {z}、{x} 和 {y}(或 {-y})"};const r=this.ensureProjection(e);if(!r)return{error:"请先选择或注册有效的坐标系"};let o=null;if(n){const t=this.ensureProjection(n.crs);if(!t)return{error:"范围坐标系无效"};const e=n.extent;if(!e||!e.every(Number.isFinite))return{error:"范围数值无效"};if(e[0]>=e[2]||e[1]>=e[3])return{error:"范围需满足:X最小 < X最大,Y最小 < Y最大"};try{o=ho(e,t,r)}catch{return{error:"范围坐标系换算失败"}}if(!o||!o.every(Number.isFinite))return{error:"范围坐标系换算失败"}}const a=null!=s?s:this.clampInt(this.form.urlMaxzoom,0,24,22),h=null!=i?i:this.clampInt(this.form.urlMinzoom,0,24,0),l=this.buildTileGrid(r,Math.max(a,h),h,o),c={projection:r,tileGrid:l,minZoom:h,maxZoom:a,url:t};o&&(c.wrapX=!1);const u=t.length>28?t.slice(0,28)+"…":t;return{entry:{name:`在线切片XYZ · ${u}`,kind:"xyz",layer:new Kg({source:new gm(c)}),extent:o,projection:r,cleanup(){}}}},async loadUrlLayer(){const t=String(this.form.urlTemplate||"").trim();if(!t)return void this.toast("请填写在线切片XYZ URL 模板","warn");if(""===String(this.form.urlMinzoom||"").trim())return void this.toast("请填写最小层级","warn");if(""===String(this.form.urlMaxzoom||"").trim())return void this.toast("请填写最大层级","warn");const e=[this.$refs.urlExtMinx.value,this.$refs.urlExtMiny.value,this.$refs.urlExtMaxx.value,this.$refs.urlExtMaxy.value];if(e.some(t=>""===t.trim()))return void this.toast("请填写完整的范围:X/Y 的最小值和最大值","warn");const i=e.map(Number);if(!i.every(Number.isFinite))return void this.toast("范围数值无效","warn");const s={extent:i,crs:this.form.urlExtentCrs},n=await this.createXyzEntry(t,this.form.dataCrs,null,null,s);n.entry?(this.form.urlInfo="使用指定范围加载,已自动定位。",this.addMapEntry(n.entry)):this.toast(n.error||"加载失败","warn")},vectorColor(t){let e=0;const i=String(t||"vector");for(let s=0;s<i.length;s++)e=31*e+i.charCodeAt(s)>>>0;return this.VECTOR_COLORS[e%this.VECTOR_COLORS.length]},descendants(t,e){return Array.from(t.getElementsByTagName("*")).filter(t=>t.localName===e)},svgParameters(t){const e=new Map,i=[...this.descendants(t,"SvgParameter"),...this.descendants(t,"CssParameter")];for(const s of i){const t=s.getAttribute("name");t&&e.set(t.toLowerCase(),(s.textContent||"").trim())}return e},strokeFromParams(t,e="stroke"){const i=t.get(e);if(i)return new pd({color:i,width:Number(t.get(e+"-width"))||1,lineCap:"square"===t.get(e+"-linecap")?"square":void 0,lineJoin:"mitre"===t.get(e+"-linejoin")?"miter":void 0,lineDash:(t.get(e+"-dasharray")||"").split(/[\s,]+/).filter(Boolean).map(Number).filter(Number.isFinite)})},parseSldStyles(t){const e=(new DOMParser).parseFromString(t,"application/xml");if(e.getElementsByTagName("parsererror").length)return null;const i=[];let s=null;const n=this.descendants(e,"TextSymbolizer").length>0;for(const r of this.descendants(e,"PointSymbolizer")){if(n)continue;const t=this.svgParameters(r),e=t.has("fill")?new cd({color:t.get("fill")}):void 0,o=this.strokeFromParams(t),a=Number((this.descendants(r,"Size")[0]||{}).textContent)||8,h=((this.descendants(r,"WellKnownName")[0]||{}).textContent||"circle").toLowerCase(),l={radius:a/2,fill:e,stroke:o};let c;c="square"===h?new od({...l,points:4,angle:Math.PI/4}):"triangle"===h?new od({...l,points:3,angle:0}):"cross"===h?new od({...l,points:4,angle:0,radius2:a/6}):new hd(l);const u=new wd({image:c});i.push(u),s||(s=u)}for(const r of this.descendants(e,"LineSymbolizer")){const t=this.strokeFromParams(this.svgParameters(r));t&&i.push(new wd({stroke:t}))}for(const r of this.descendants(e,"PolygonSymbolizer")){const t=this.svgParameters(r),e=t.has("fill")?new cd({color:t.get("fill")}):void 0,s=this.strokeFromParams(t);(e||s)&&i.push(new wd({fill:e,stroke:s}))}for(const r of this.descendants(e,"TextSymbolizer")){const t=this.descendants(r,"PropertyName")[0],e=t?t.textContent.trim():"",n=this.svgParameters(this.descendants(r,"Font")[0]||r),o=Number(n.get("font-size"))||10,a=n.get("font-family")||"SimSun",h=n.get("font-weight")||"normal",l=n.get("font-style")||"normal",c=new Sd({font:l+" "+h+" "+o+'px "'+a+'", sans-serif',fill:new cd({color:this.svgParameters(r).get("fill")||"#000000"}),text:e?" ":""});s?s.setText(c):i.push(new wd({text:c}))}return i.length?i:null},sldLabelProperty(t){const e=(new DOMParser).parseFromString(t,"application/xml");for(const i of this.descendants(e,"TextSymbolizer")){const t=this.descendants(i,"PropertyName")[0];if(t)return t.textContent.trim()}return""},parseCadColor(t){if("string"!==typeof t)return null;const e=t.trim().split(",").map(t=>Number(t.trim()));if(e.length<3)return null;if(e.slice(0,3).some(t=>!Number.isFinite(t)||t<0||t>255))return null;const i=e.length>=4&&Number.isFinite(e[3])&&e[3]>=0&&e[3]<=255?e[3]/255:1;return[e[0],e[1],e[2],i]},parseCadColor24(t){const e=Number(t);return!Number.isFinite(e)||e<0||e>16777215?null:[e>>16&255,e>>8&255,255&e,1]},resolveGeoJsonCadColor(t){return this.parseCadColor(t.get("color"))||this.parseCadColor24(t.get("color24"))||null},setStyleColor(t,e,i){if(!e)return;const s=t.getStroke(),n=t.getFill(),r=t.getText();i.includes("Polygon")?(s&&t.setStroke(new pd({color:e,width:s.getWidth(),lineCap:s.getLineCap(),lineJoin:s.getLineJoin(),lineDash:s.getLineDash(),lineDashOffset:s.getLineDashOffset(),miterLimit:s.getMiterLimit()})),n&&t.setFill(new cd({color:e}))):i.includes("LineString")||i.includes("Curve")?s&&t.setStroke(new pd({color:e,width:s.getWidth(),lineCap:s.getLineCap(),lineJoin:s.getLineJoin(),lineDash:s.getLineDash(),lineDashOffset:s.getLineDashOffset(),miterLimit:s.getMiterLimit()})):i.includes("Point")&&(n&&t.setFill(new cd({color:e})),r&&r.setFill(new cd({color:e}))),r&&(i.includes("Point")||i.includes("Polygon"))&&r.setFill(new cd({color:e}))},makeSldStyleFunction(t,e){const i=new Map;return(s,n)=>{const r=s.getGeometry(),o=r?r.getType():"",a=e?s.get(e):null,h=this.resolveGeoJsonCadColor(s),l=h?h.join(","):"sld",c=r&&r.getFirstCoordinate?r.getFirstCoordinate():this.map.getView().getCenter(),u=Hr(this.map.getView().getProjection(),Number.isFinite(n)&&n>0?n:1,c,"m"),d=Number(s.get("height")),f=Number.isFinite(d)&&d>0?Math.max(3,Math.min(128,d/u)):null,g=Math.round(4*Math.log2(u)),p=Number(s.get("angle")),_=Number.isFinite(p)?p*Math.PI/180:null,m=o+"|"+l+"|"+g+"|"+String(null==a?"":a)+"|"+_;let y=i.get(m);return y||(y=t.map(t=>{const i=t.clone();this.setStyleColor(i,h,o);const s=i.getText();if(s&&e&&null!=a&&""!==a){if(s.setText(String(a)),null!=f){const t=s.getFont()||'normal normal 10px "SimSun", sans-serif';s.setFont(t.replace(/([0-9]+(?:\.[0-9]+)?)px/,f.toFixed(2)+"px"))}null!=_&&s.setRotation(_)}return i}),i.set(m,y)),y}},defaultVectorStyle(t,e){const i=t.get("_sldStyle");if(i)return"function"===typeof i?i(t,e):i;const s=t.getGeometry(),n=s?s.getType():"",r=t.get("_styleColor")||this.vectorColor(t.get("layer")||t.get("_layerName")),o=t.get("_labelProperty")?t.get(t.get("_labelProperty")):t.get("text"),a=null!=o&&""!==o?new Sd({font:'12px "Microsoft YaHei", sans-serif',fill:new cd({color:"#1c2833"}),text:String(o)}):void 0;return n.includes("Polygon")?new wd({fill:new cd({color:r+"26"}),stroke:new pd({color:r,width:1.5}),text:a}):n.includes("LineString")||n.includes("Curve")?new wd({stroke:new pd({color:r,width:1.4}),text:a}):new wd({image:new hd({radius:4.5,fill:new cd({color:r}),stroke:new pd({color:"#ffffff",width:1})}),text:a})},featuresExtent(t){let e=Ws();for(const i of t){const t=i.getGeometry();t&&Hs(e,t.getExtent())}return e},createReprojectingVectorSource(t,e){return new Am({loader(i,s,n){const r=t.map(t=>{const i=t.clone(),s=i.getGeometry();return s&&s.transform(e,n),i});return this.addFeatures(r),r}})},geoJsonCrsCode(t){const e=t&&t.crs&&t.crs.properties&&t.crs.properties.name;if(!e)return null;if(/CRS84$/i.test(e))return"EPSG:4326";const i=String(e).match(/EPSG[:\s]+(\d+)/i);return i?"EPSG:"+i[1]:null},geoJsonCrsChipLabel(t,e){const i="EPSG:4326"===t?"EPSG:4326(WGS84 / CRS84)":t;return e?i+"("+e+" 个文件)":i},updateGeoJsonCrsHint(t,e){return e?t&&t.size?(this.form.geojsonCrsHint=`检测到 ${t.size} 种 CRS:`,void(this.form.geojsonCrsOptions=[...t].map(([t,e])=>({code:t,label:this.geoJsonCrsChipLabel(t,e)})))):(this.form.geojsonCrsHint=`已检查 ${e} 个 GeoJSON,未发现 CRS 声明。`,void(this.form.geojsonCrsOptions=[])):(this.form.geojsonCrsHint="未识别到 GeoJSON,无法检测 CRS。",void(this.form.geojsonCrsOptions=[]))},async detectGeoJsonCrsHints(t,e){const i=new Map;let s=0;for(const n of t){if(e!==this.geoJsonCrsDetectionSeq)return;try{const t=JSON.parse(await n.file.text()),e=this.geoJsonCrsCode(t);e&&i.set(e,(i.get(e)||0)+1)}catch{}s+=1,this.updateGeoJsonCrsHint(i,s)}if(e===this.geoJsonCrsDetectionSeq&&(this.updateGeoJsonCrsHint(i,s),i.size)){const t=[...i.entries()].sort((t,e)=>e[1]-t[1]);this.form.dataCrs=t[0][0]}},isMetadataJson(t){return/^metadata\.json$/i.test(t.name)},matchGeoJsonPairs(t){const e=t.filter(t=>this.GEOJSON_FILE_RE.test(t.name)&&!this.isMetadataJson(t)),i=new Map;for(const s of t)this.SLD_FILE_RE.test(s.name)&&i.set(s.name.replace(/\.[^.]+$/,""),s);return e.map(t=>({file:t,sld:i.get(t.name.replace(/\.[^.]+$/,""))||null}))},async orderGeoJsonPairsByMetadata(t,e){if(!e)return{pairs:t,metadata:null};const i=JSON.parse(await e.text());if(!i||!Array.isArray(i.layers))throw new Error("metadata.json 缺少 layers 数组");const s=new Map(t.map(t=>[t.file.name,t])),n=[],r=new Set;for(const o of i.layers){const t=o&&o.geojson,e=s.get(t);e&&!r.has(t)&&(e.layerTitle=o.title||"",n.push(e),r.add(t))}for(const o of t)r.has(o.file.name)||n.push(o);return{pairs:n,metadata:i}},onGeoJsonDirChosen(t){const e=Array.from(t||[]),i=e.length?(e[0].webkitRelativePath||"").split(/[\\/]/)[0]:"GeoJSON 目录",s=this.matchGeoJsonPairs(e),n=e.find(this.isMetadataJson)||null;this.pickedGeoJson={name:i,files:e,pairs:s,metadataFile:n,metadataName:null},this.form.geojsonDirName=s.length?i+"("+s.length+" 个 GeoJSON,"+s.filter(t=>t.sld).length+" 个 SLD)":"未识别到 GeoJSON 文件",this.form.geojsonInfo=s.length?(n?"已识别 metadata.json,将按其中的图层顺序加载;":"")+"未配对的 .sld 使用默认矢量样式。":"请选择包含 .geojson(或 .json)和可选同名 .sld 的目录。",this.geoJsonCrsDetectionSeq+=1,s.length?(this.form.geojsonCrsHint="正在检测 GeoJSON CRS…",this.detectGeoJsonCrsHints(s,this.geoJsonCrsDetectionSeq)):this.form.geojsonCrsHint="未选择 GeoJSON。"},async loadGeoJsonLayers(){if(!this.pickedGeoJson||!this.pickedGeoJson.pairs.length)return void this.toast("请先选择包含 GeoJSON 文件的目录","warn");const t=new vy,e=[];let i=null,s=null,n=0,r=this.pickedGeoJson.pairs;const o=[];try{if(this.pickedGeoJson.metadataFile){const t=await this.orderGeoJsonPairsByMetadata(this.pickedGeoJson.pairs,this.pickedGeoJson.metadataFile);r=t.pairs,this.pickedGeoJson.metadataName=t.metadata&&t.metadata.name?t.metadata.name:null}for(const a of r){const r=await a.file.text(),h=JSON.parse(r),l=this.geoJsonCrsCode(h)||this.form.dataCrs,c=this.ensureProjection(l);if(!c)throw new Error("无效坐标系:"+l);let u=t.readFeatures(h,{dataProjection:l,featureProjection:l});if(i){if(c.getCode()!==s)for(const t of u){const e=t.getGeometry();e&&e.transform(c,i)}}else i=c,s=c.getCode();if(a.sld){const t=await a.sld.text(),e=this.parseSldStyles(t);if(e){const i=this.sldLabelProperty(t),s=this.makeSldStyleFunction(e,i);for(const t of u)t.set("_sldStyle",s,!0),a.layerTitle&&t.set("_layerName",a.layerTitle,!0);n++}}o.push({pair:a,features:u}),e.push(...u)}}catch(l){return void this.toast("GeoJSON 加载失败:"+l.message,"err")}if(!e.length)return void this.toast("所选文件中没有有效要素","warn");const a=o.map(({pair:t,features:e})=>{const s=this.createReprojectingVectorSource(e,i),n=new E_({source:s,style:(t,e)=>this.defaultVectorStyle(t,e)});return{name:t.layerTitle||t.file.name,kind:"geojson",layer:n,featureCount:e.length,visible:!0,group:this.inferGeoJsonGroup(e),groupVisible:!0,source:s}});if(a.some(t=>"0"===t.group))for(const c of a)c.group||(c.group="0");const h=new Fl({layers:a.map(t=>t.layer)});this.addMapEntry({name:this.pickedGeoJson.metadataName||this.pickedGeoJson.name,kind:"geojson",layer:h,sublayers:a.map(t=>{const e={...t};return delete e.source,e}),extent:this.featuresExtent(e),projection:i,sourceCrs:s,sources:a.map(t=>t.source),cleanup(){}}),this.form.geojsonInfo="已按 metadata.json 顺序加载 "+r.length+" 个图层、"+e.length+" 个要素,应用 "+n+" 个 SLD 样式,数据坐标系 "+s+"。"},switchViewProjection(){const t=this.form.viewCrs,e=this.map.getView(),i=e.getProjection();if(i.getCode()===t)return void this.toast("当前视图已使用该坐标系","info");if("PIXEL"===i.getCode()||"PIXEL"===t)return void this.toast("像素坐标无法与其他坐标系互转","warn");const s=this.ensureProjection(t);if(!s)return void this.toast("目标坐标系未注册","warn");const{center:n,resolution:r}=this.computeViewTransition(s);this.setViewProjection(s,{center:n,resolution:r}),n&&!r&&this.activeEntry&&this.fitActiveMap(),this.activeEntry&&(this.activeEntry.viewProjectionCode=s.getCode(),this.renderMapList())},registerCustom(t,e){try{if(Kr(t)||(Db.defs(t,e),zb(Db)),!Kr(t))throw new Error("注册失败")}catch(i){return this.toast(`坐标系注册失败:${i.message}`,"err"),!1}return this.customPresets.some(e=>e.code===t)||this.customPresets.push({code:t,name:`${t} · 自定义`,def:e}),this.refillCrsSelects(),this.form.dataCrs=t,!0},async fetchAndRegisterEpsg(){const t=String(parseInt(this.$refs.customEpsg.value.trim(),10));if(!t||"NaN"===t)return void this.toast("请输入有效的 EPSG 代码","warn");const e=`EPSG:${t}`;this.toast(`正在从 epsg.io 获取 ${e} …`);try{const i=await fetch(`https://epsg.io/${t}.proj4`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const s=(await i.text()).trim();if(!s.startsWith("+"))throw new Error("返回内容不是 proj4 定义");this.registerCustom(e,s)&&this.toast(`已注册并应用 ${e}`,"ok")}catch(i){this.toast(`获取失败(${i.message}),请检查网络后重试`,"err")}},setSourceCategory(t){this.sourceCategory=t},setActiveTab(t){this.currentTab=t,this.sourceCategory=["image","tiles","url"].includes(t)?"raster":"vector"},setSourceCategoryAndDefault(t){this.setSourceCategory(t),this.setActiveTab("raster"===t?"image":"geojson")},resetLoadDialog(){this.pickedImage&&this.pickedImage.objectUrl&&URL.revokeObjectURL(this.pickedImage.objectUrl),this.pickedImage=null,this.pickedWorldFile=null,this.pickedTiles=null,this.pickedGeoJson=null,this.$refs.imgFile.value="",this.$refs.worldFile.value="",this.$refs.tilesDir.value="",this.$refs.geojsonDir.value="",this.form.imgFileName="未选择文件",this.form.worldFileName="未选择文件",this.form.tilesDirName="未选择目录",this.form.tilesInfo="支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。",this.form.tilesTms=!1,this.form.geojsonDirName="未选择目录",this.form.geojsonInfo="支持按文件名配对的 .geojson 与 .sld。",this.geoJsonCrsDetectionSeq+=1,this.form.geojsonCrsHint="未选择 GeoJSON。",this.form.geojsonCrsOptions=[],this.$refs.extMinx.value=this.$refs.extMiny.value=this.$refs.extMaxx.value=this.$refs.extMaxy.value="",this.form.zoneHint={message:"",options:[]},this.form.urlTemplate="",this.form.urlMinzoom=this.form.urlMaxzoom="",this.$refs.urlExtMinx.value=this.$refs.urlExtMiny.value=this.$refs.urlExtMaxx.value=this.$refs.urlExtMaxy.value="",this.form.urlExtentCrs="EPSG:3857",this.form.urlInfo="",this.form.customEpsg="",this.form.dataCrs="EPSG:3857",this.setActiveTab("image")},openLoadDialog(){this.resetLoadDialog(),this.loadDialogVisible=!0},closeLoadDialog(){this.loadDialogVisible=!1},getViewState(){if(!this.map)return null;const t=this.map.getView();return{center:t.getCenter(),zoom:t.getZoom(),crs:t.getProjection().getCode()}},getActiveMapInfo(){const t=this.activeEntry;if(!t)return null;const e=this.map.getView();return{id:t.id,name:t.name,kind:t.kind,dataCrs:t.projection.getCode(),viewCrs:t.viewProjectionCode,extent:t.extent,sublayerCount:t.sublayers.length,center:e.getCenter(),zoom:e.getZoom()}},async addXyzLayer({url:t,crs:e="EPSG:3857",minZoom:i=0,maxZoom:s=22,extent:n=null,extentCrs:r=null}={}){this.viewerReady||await this.waitViewerReady();const o=n&&4===n.length?{extent:n,crs:r||e}:null,a=await this.createXyzEntry(t,e,i,s,o);return a.entry?(this.addMapEntry(a.entry),a.entry):(this.toast(a.error||"加载失败","warn"),null)},async loadImageFromUrl({url:t,name:e=null,crs:i="EPSG:3857",worldFileUrl:s=null,worldText:n=null,extent:r=null}={}){if(this.viewerReady||await this.waitViewerReady(),this.form.dataCrs=i,!n&&s)try{const t=await fetch(s);t.ok&&(n=await t.text())}catch{}return await this.addImageFromUrl({url:t,name:e||decodeURIComponent(String(t).split("/").pop()||"图片"),worldText:n,extent:r}),this.activeEntry},async loadGeoJsonFromFiles(t){return this.viewerReady||await this.waitViewerReady(),this.onGeoJsonDirChosen(t),await this.loadGeoJsonLayers(),this.activeEntry},async loadGeoJsonFromManifest(t,e=""){this.viewerReady||await this.waitViewerReady();const i=this.manifestEntries(t);if(!i.length)return this.toast("清单中没有文件","warn"),null;const s=[],n=[];for(const o of i){const t=this.resolveManifestUrl(o.url,e);try{const e=await fetch(t);if(!e.ok)throw new Error("HTTP "+e.status);const i=await e.blob();s.push(new File([i],this.manifestUrlName(t),{type:i.type||"application/octet-stream"}))}catch(r){console.error("[manifest] 文件加载失败:",t,r),n.push(this.manifestUrlName(t)+":"+r.message)}}if(n.length&&this.toast("有 "+n.length+" 个文件加载失败:"+n.slice(0,3).join(";")+(n.length>3?" 等":""),"warn"),!s.length)throw new Error("矢量文件全部加载失败(共 "+n.length+" 个)");return this.loadGeoJsonFromFiles(s)},manifestEntries(t){const e=t=>{if("string"===typeof t)return{url:t};if(!t||"object"!==typeof t)return null;const e=t.url||t.geojson||t.image||t.png||null;return e?{url:e,type:t.type||null,name:t.name||t.title||null,crs:t.crs||null,worldFile:t.worldFile||t.worldfile||null,worldText:t.worldText||null,extent:Array.isArray(t.extent)&&4===t.extent.length?t.extent:null,sld:t.sld||null}:null},i=t=>{const i=[],s=e(t);return s&&i.push(s),t&&"object"===typeof t&&"string"===typeof t.sld&&t.sld&&(s&&s.url===t.sld||i.push({url:t.sld})),i};if(Array.isArray(t))return[].concat.apply([],t.map(i));if(!t)return[];if(Array.isArray(t.files))return[].concat.apply([],t.files.map(i));if(Array.isArray(t.layers)){const i=[];for(const s of t.layers)s&&s.geojson&&i.push(e(Object.assign({},s,{url:s.geojson,sld:null}))),s&&s.sld&&i.push({url:s.sld});return i.push({url:"metadata.json"}),i}return[]},resolveManifestUrl(t,e){const i=String(t);return/^https?:\/\//i.test(i)||!e?i:e.replace(/\/$/,"")+"/"+i.replace(/^\//,"")},manifestUrlName(t){return decodeURIComponent(String(t).split("/").pop().split("?")[0]||"未命名")},async loadGeoJsonFromData(t){if(this.viewerReady||await this.waitViewerReady(),!Array.isArray(t)||!t.length)return this.toast("没有可加载的图层数据","warn"),null;const e=[];for(const i of t){if(!i||!i.geojson)continue;const t="string"===typeof i.geojson?i.geojson:JSON.stringify(i.geojson);if(e.push(new File([t],i.name+".geojson",{type:"application/geo+json"})),i.sld){const t="string"===typeof i.sld?i.sld:JSON.stringify(i.sld);e.push(new File([t],i.name+".sld",{type:"application/xml"}))}}return e.length?this.loadGeoJsonFromFiles(e):(this.toast("没有可加载的图层数据","warn"),null)},async loadGeoJsonForCurrentSource(){await this.loadGeoJsonLayers()},waitViewerReady(){return this.viewerReady?Promise.resolve():new Promise(t=>{const e=setInterval(()=>{this.viewerReady&&(clearInterval(e),t())},50)})},async processAutoLoad(){const t=this.autoLoad;if(t&&t.url)if("manifest"===t.type){const e=await fetch(t.url);if(!e.ok)throw new Error("获取失败:"+t.url+"("+e.status+")");const i=await e.json();await this.loadGeoJsonFromManifest(i,t.baseUrl||"")}else"image"===t.type&&await this.loadImageFromUrl({url:t.url,name:t.name||null,crs:t.crs||"EPSG:3857",worldFileUrl:t.worldFile||null,worldText:t.worldText||null,extent:t.extent||null})},applyTheme(t){this.isLight="light"===t,this.themeIcon=this.isLight?"🌙":"☀️",this.themeTitle=this.isLight?"切换到深色主题":"切换到浅色主题",this.$emit("theme-changed",t)},async readDroppedEntry(t,e=""){if(!t)return[];if(t.isFile)return await new Promise(i=>{t.file(s=>{try{Object.defineProperty(s,"webkitRelativePath",{value:e+t.name})}catch{}i([s])},()=>i([]))});const i=t.createReader(),s=[];for(;;){const t=await new Promise(t=>i.readEntries(t,()=>t([])));if(!t.length)break;s.push(...t)}const n=[];for(const r of s)n.push(...await this.readDroppedEntry(r,e+t.name+"/"));return n},async filesFromDataTransfer(t){const e=Array.from(t&&t.files||[]);if(e.length)return e;const i=Array.from(t&&t.items||[]),s=i.map(t=>t.webkitGetAsEntry&&t.webkitGetAsEntry()).filter(Boolean);if(!s.length)return[];const n=await Promise.all(s.map(t=>this.readDroppedEntry(t)));return n.flat()},normalizeEpsg(t){return t=String(t||"").trim(),/^\d+$/.test(t)?`EPSG:${t}`:/^epsg:\d+$/i.test(t)?t.toUpperCase():null}}},Bb=Ub;function Wb(t,e,i,s,n,r,o,a){var h,l="function"===typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=i,l._compiled=!0),s&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),o?(h=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},l._ssrRegister=h):n&&(h=a?function(){n.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:n),h)if(l.functional){l._injectStyles=h;var c=l.render;l.render=function(t,e){return h.call(e),c(t,e)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,h):[h]}return{exports:t,options:l}}var Xb=Wb(Bb,ei,ii,!1,null,null,null),Vb=Xb.exports;const qb=[Vb],Yb=function(t){qb.forEach(e=>{t.component(e.name,e)})};var Kb={install:Yb},Hb=Kb}(),s}()});
|
|
1
|
+
(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["map_view_vue2"]=e():t["map_view_vue2"]=e()})("undefined"!==typeof self?self:this,function(){return function(){var t={463:function(t){"use strict";var e=TypeError;t.exports=function(t){if("string"==typeof t)return t;throw new e("Argument is not a string")}},804:function(t){"use strict";var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e+"+/",s=e+"-_",n=function(t){for(var e={},i=0;i<64;i++)e[t.charAt(i)]=i;return e};t.exports={i2c:i,c2i:n(i),i2cUrl:s,c2iUrl:n(s)}},529:function(t){"use strict";t.exports=function(t,e){return{value:t,done:e}}},837:function(t){"use strict";var e=TypeError,i=9007199254740991;t.exports=function(t){if(t>i)throw new e("Maximum allowed index exceeded");return t}},944:function(t){"use strict";var e=TypeError;t.exports=function(t){var i=t&&t.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new e("Incorrect `alphabet` option")}},767:function(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},117:function(t){"use strict";t.exports=function(t){return null===t||void 0===t}},859:function(t){"use strict";t.exports=function(t){t.iterator=t.next=t.nextHandler=t.mapper=t.predicate=t.inner=t.iterables=t.iters=t.openIters=t.padding=t.finishResults=t.buffer=null}},684:function(t){"use strict";t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(s){return!0}}},269:function(t){"use strict";t.exports=Object.create?Object.create(null):{}},741:function(t){"use strict";var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var s=+t;return(s>0?i:e)(s)}},717:function(t,e){"use strict";e.f=Object.getOwnPropertySymbols},750:function(t,e,i){"use strict";var s=i(117),n=TypeError;t.exports=function(t){if(s(t))throw new n("Can't call method on "+t);return t}},835:function(t){"use strict";t.exports=function(t){try{var e=new Set,i={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},s=e[t](i);return 1===s.size&&4===s.values().next().value}catch(n){return!1}}},291:function(t,e,i){"use strict";var s=i(741);t.exports=function(t){var e=+t;return e!==e||0===e?0:s(e)}},14:function(t,e,i){"use strict";var s=i(291),n=Math.min;t.exports=function(t){var e=s(t);return e>0?n(e,9007199254740991):0}},981:function(t,e,i){"use strict";var s=i(750),n=Object;t.exports=function(t){return n(s(t))}}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}i.cw=function(t){var e;return function(){if(t){var i=t;t=0,e={exports:{}},i.call(e.exports,e,e.exports)}return e.exports}},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";i.r(s),i.d(s,{default:function(){return Hb}});var t=i.cw(function(t){var e=gt(),i=xe(),s=TypeError;t.exports=function(t){if(e(t))return t;throw new s(i(t)+" is not a function")}}),e=i.cw(function(t){var e=mt(),i=String,s=TypeError;t.exports=function(t){if(e(t))return t;throw new s("Can't set "+i(t)+" as a prototype")}}),n=i.cw(function(t){var e=$t().has;t.exports=function(t){return e(t),t}}),r=function(){return i(463)},o=i.cw(function(t){var e=Pe(),i=Ot(),s=kt().f,n=e("unscopables"),r=Array.prototype;void 0===r[n]&&s(r,n,{configurable:!0,value:i(null)}),t.exports=function(t){r[n][t]=!0}}),a=i.cw(function(t){var e=zt(),i=TypeError;t.exports=function(t,s){if(e(s,t))return t;throw new i("Incorrect invocation")}}),h=i.cw(function(t){var e=_t(),i=String,s=TypeError;t.exports=function(t){if(void 0===t||e(t))return t;throw new s(i(t)+" is not an object or undefined")}}),l=i.cw(function(t){var e=_t(),i=String,s=TypeError;t.exports=function(t){if(e(t))return t;throw new s(i(t)+" is not an object")}}),c=i.cw(function(t){var e=w(),i=TypeError;t.exports=function(t){if("Uint8Array"===e(t))return t;throw new i("Argument is not an Uint8Array")}}),u=i.cw(function(t){t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView}),d=i.cw(function(t){var e=it(),i=V(),s=x(),n=e.ArrayBuffer,r=e.TypeError;t.exports=n&&i(n.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new r("ArrayBuffer expected");return t.byteLength}}),g=i.cw(function(t){var e=it(),i=u(),s=d(),n=e.DataView;t.exports=function(t){if(!i||0!==s(t))return!1;try{return new n(t),!1}catch(e){return!0}}}),f=i.cw(function(t){var e=g(),i=TypeError;t.exports=function(t){if(e(t))throw new i("ArrayBuffer is detached");return t}}),p=i.cw(function(t){var e,i,s,n=u(),r=L(),o=it(),a=gt(),h=_t(),l=st(),c=w(),d=xe(),g=C(),f=I(),p=R(),_=zt(),m=jt(),y=Xt(),v=Pe(),x=we(),E=lt(),M=E.enforce,S=E.get,b=o.Int8Array,P=b&&b.prototype,T=o.Uint8ClampedArray,A=T&&T.prototype,O=b&&m(b),G=P&&m(P),k=Object.prototype,N=o.TypeError,F=v("toStringTag"),D=x("TYPED_ARRAY_TAG"),j="TypedArrayConstructor",z=n&&!!y&&"Opera"!==c(o.opera),U=!1,B={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},W={BigInt64Array:8,BigUint64Array:8},X=function(t){if(!h(t))return!1;var e=c(t);return"DataView"===e||l(B,e)||l(W,e)},V=function(t){var e=m(t);if(h(e)){var i=S(e);return i&&l(i,j)?i[j]:V(e)}},q=function(t){if(!h(t))return!1;var e=c(t);return l(B,e)||l(W,e)},Y=function(t){if(q(t))return t;throw new N("Target is not a typed array")},K=function(t){if(a(t)&&(!y||_(O,t)))return t;throw new N(d(t)+" is not a typed array constructor")},H=function(t,e,i,s){if(r){if(i)for(var n in B){var a=o[n];if(a&&l(a.prototype,t))try{delete a.prototype[t]}catch(h){try{a.prototype[t]=e}catch(c){}}}G[t]&&!i||f(G,t,i?e:z&&P[t]||e,s)}},$=function(t,e,i){var s,n;if(r){if(y){if(i)for(s in B)if(n=o[s],n&&l(n,t))try{delete n[t]}catch(a){}if(O[t]&&!i)return;try{return f(O,t,i?e:z&&O[t]||e)}catch(a){}}for(s in B)n=o[s],!n||n[t]&&!i||f(n,t,e)}};for(e in B)i=o[e],s=i&&i.prototype,s?M(s)[j]=i:z=!1;for(e in W)i=o[e],s=i&&i.prototype,s&&(M(s)[j]=i);if((!z||!a(O)||O===Function.prototype)&&(O=function(){throw new N("Incorrect invocation")},z))for(e in B)o[e]&&y(o[e],O);if((!z||!G||G===k)&&(G=O.prototype,z))for(e in B)o[e]&&y(o[e].prototype,G);if(z&&m(A)!==G&&y(A,G),r&&!l(G,F))for(e in U=!0,p(G,F,{configurable:!0,get:function(){return h(this)?this[D]:void 0}}),B)o[e]&&g(o[e].prototype,D,e);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:z,TYPED_ARRAY_TAG:U&&D,aTypedArray:Y,aTypedArrayConstructor:K,exportTypedArrayMethod:H,exportTypedArrayStaticMethod:$,getTypedArrayConstructor:V,isView:X,isTypedArray:q,TypedArray:O,TypedArrayPrototype:G}}),_=i.cw(function(t){var e=ge(),i=ue(),s=Tt(),n=function(t){return function(n,r,o){var a=e(n),h=s(a);if(0===h)return!t&&-1;var l,c=i(o,h);if(t&&r!==r){while(h>c)if(l=a[c++],l!==l)return!0}else for(;h>c;c++)if((t||c in a)&&a[c]===r)return t||c||0;return!t&&-1}};t.exports={m:n(!0),q:n(!1)}}),m=i.cw(function(t){var e=L(),i=ut(),s=TypeError,n=Object.getOwnPropertyDescriptor,r=e&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=r?function(t,e){if(i(t)&&!n(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}}),y=function(){return i(804)},v=i.cw(function(t){var e=l(),i=St();t.exports=function(t,s,n,r){try{return r?s(e(n)[0],n[1]):s(n)}catch(o){i(t,"throw",o)}}}),x=i.cw(function(t){var e=Y(),i=e({}.toString),s=e("".slice);t.exports=function(t){return s(i(t),8,-1)}}),w=i.cw(function(t){var e=ve(),i=gt(),s=x(),n=Pe(),r=n("toStringTag"),o=Object,a="Arguments"===s(function(){return arguments}()),h=function(t,e){try{return t[e]}catch(i){}};t.exports=e?s:function(t){var e,n,l;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=h(e=o(t),r))?n:a?s(e):"Object"===(l=s(e))&&i(e.callee)?"Arguments":l}}),E=i.cw(function(t){var e=st(),i=qt(),s=Nt(),n=kt();t.exports=function(t,r,o){for(var a=i(r),h=n.f,l=s.f,c=0;c<a.length;c++){var u=a[c];e(t,u)||o&&e(o,u)||h(t,u,l(r,u))}}}),M=i.cw(function(t){var e=j();t.exports=!e(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})}),S=function(){return i(529)},C=i.cw(function(t){var e=L(),i=kt(),s=b();t.exports=e?function(t,e,n){return i.f(t,e,s(1,n))}:function(t,e,i){return t[e]=i,t}}),b=i.cw(function(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}}),P=i.cw(function(t){var e=L(),i=kt(),s=b();t.exports=function(t,n,r){e?i.f(t,n,s(0,r)):t[n]=r}}),R=i.cw(function(t){var e=At(),i=kt();t.exports=function(t,s,n){return n.get&&e(n.get,s,{getter:!0}),n.set&&e(n.set,s,{setter:!0}),i.f(t,s,n)}}),I=i.cw(function(t){var e=gt(),i=kt(),s=At(),n=A();t.exports=function(t,r,o,a){a||(a={});var h=a.enumerable,l=void 0!==a.name?a.name:r;if(e(o)&&s(o,l,a),a.global)h?t[r]=o:n(r,o);else{try{a.unsafe?t[r]&&(h=!0):delete t[r]}catch(c){}h?t[r]=o:i.f(t,r,{value:o,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}}),T=i.cw(function(t){var e=I();t.exports=function(t,i,s){for(var n in i)e(t,n,i[n],s);return t}}),A=i.cw(function(t){var e=it(),i=Object.defineProperty;t.exports=function(t,s){try{i(e,t,{value:s,configurable:!0,writable:!0})}catch(n){e[t]=s}return s}}),L=i.cw(function(t){var e=j();t.exports=!e(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}),O=i.cw(function(t){var e=it(),i=_t(),s=e.document,n=i(s)&&i(s.createElement);t.exports=function(t){return n?s.createElement(t):{}}}),G=function(){return i(837)},k=i.cw(function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]}),N=i.cw(function(t){var e=it(),i=e.navigator,s=i&&i.userAgent;t.exports=s?String(s):""}),F=i.cw(function(t){var e,i,s=it(),n=N(),r=s.process,o=s.Deno,a=r&&r.versions||o&&o.version,h=a&&a.v8;h&&(e=h.split("."),i=e[0]>0&&e[0]<4?1:+(e[0]+e[1])),!i&&n&&(e=n.match(/Edge\/(\d+)/),(!e||e[1]>=74)&&(e=n.match(/Chrome\/(\d+)/),e&&(i=+e[1]))),t.exports=i}),D=i.cw(function(t){var e=it(),i=Nt().f,s=C(),n=I(),r=A(),o=E(),a=ft();t.exports=function(t,h){var l,c,u,d,g,f,p=t.target,_=t.global,m=t.stat;if(c=_?e:m?e[p]||r(p,{}):e[p]&&e[p].prototype,c)for(u in h){if(g=h[u],t.dontCallGetSet?(f=i(c,u),d=f&&f.value):d=c[u],l=a(_?u:p+(m?".":"#")+u,t.forced),!l&&void 0!==d){if(typeof g==typeof d)continue;o(g,d)}(t.sham||d&&d.sham)&&s(g,"sham",!0),n(c,u,g,t)}}}),j=i.cw(function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}}),z=i.cw(function(t){var e=B(),i=Function.prototype,s=i.apply,n=i.call;t.exports="object"==typeof Reflect&&Reflect.apply||(e?n.bind(s):function(){return n.apply(s,arguments)})}),U=i.cw(function(e){var i=q(),s=t(),n=B(),r=i(i.bind);e.exports=function(t,e){return s(t),void 0===e?t:n?r(t,e):function(){return t.apply(e,arguments)}}}),B=i.cw(function(t){var e=j();t.exports=!e(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})}),W=i.cw(function(t){var e=B(),i=Function.prototype.call;t.exports=e?i.bind(i):function(){return i.apply(i,arguments)}}),X=i.cw(function(t){var e=L(),i=st(),s=Function.prototype,n=e&&Object.getOwnPropertyDescriptor,r=i(s,"name"),o=r&&"something"===function(){}.name,a=r&&(!e||e&&n(s,"name").configurable);t.exports={EXISTS:r,PROPER:o,i2:a}}),V=i.cw(function(e){var i=Y(),s=t();e.exports=function(t,e,n){try{return i(s(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(r){}}}),q=i.cw(function(t){var e=x(),i=Y();t.exports=function(t){if("Function"===e(t))return i(t)}}),Y=i.cw(function(t){var e=B(),i=Function.prototype,s=i.call,n=e&&i.bind.bind(s,s);t.exports=e?n:function(t){return function(){return s.apply(t,arguments)}}}),K=function(){return i(944)},H=i.cw(function(t){var e=it(),i=gt(),s=function(t){return i(t)?t:void 0};t.exports=function(t,i){return arguments.length<2?s(e[t]):e[t]&&e[t][i]}}),$=function(){return i(767)},Z=i.cw(function(t){var e=W(),i=l(),s=$(),n=Q();t.exports=function(t,r){r&&"string"===typeof t||i(t);var o=n(t);return s(i(void 0!==o?e(o,t):t))}}),J=i.cw(function(t){var e=W(),i=gt(),s=l(),n=xe(),r=Q(),o=TypeError;t.exports=function(t,a){var h=arguments.length<2?r(t):a;if(i(h))return s(e(h,t));throw new o(n(t)+" is not iterable")}}),Q=i.cw(function(t){var e=x(),i=pt(),s=tt(),n=Pe(),r=n("iterator"),o=Array.prototype;t.exports=function(t){if(!i(t))return s(t,r)||s(t,"@@iterator")||("Arguments"===e(t)?o[r]:void 0)}}),tt=i.cw(function(e){var i=t(),s=pt();e.exports=function(t,e){var n=t[e];return s(n)?void 0:i(n)}}),et=i.cw(function(e){var i=t(),s=l(),n=W(),r=fe(),o=$(),a="Invalid size",h=RangeError,c=TypeError,u=Math.max,d=function(t,e){this.set=t,this.size=u(e,0),this.has=i(t.has),this.keys=i(t.keys)};d.prototype={getIterator:function(){return o(s(n(this.keys,this.set)))},includes:function(t){return n(this.has,this.set,t)}},e.exports=function(t){s(t);var e=+t.size;if(e!==e)throw new c(a);var i=r(e);if(i<0)throw new h(a);return new d(t,i)}}),it=i.cw(function(t){var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof i.g&&i.g)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()}),st=i.cw(function(t){var e=Y(),i=_e(),s=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(i(t),e)}}),nt=i.cw(function(t){t.exports={}}),rt=i.cw(function(t){var e=H();t.exports=e("document","documentElement")}),ot=i.cw(function(t){var e=L(),i=j(),s=O();t.exports=!e&&!i(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})}),at=i.cw(function(t){var e=Y(),i=j(),s=x(),n=Object,r=e("".split);t.exports=i(function(){return!n("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?r(t,""):n(t)}:n}),ht=i.cw(function(t){var e=Y(),i=gt(),s=he(),n=e(Function.toString);i(s.inspectSource)||(s.inspectSource=function(t){return n(t)}),t.exports=s.inspectSource}),lt=i.cw(function(t){var e,i,s,n=be(),r=it(),o=_t(),a=C(),h=st(),l=he(),c=ae(),u=nt(),d="Object already initialized",g=r.TypeError,f=r.WeakMap,p=function(t){return s(t)?i(t):e(t,{})},_=function(t){return function(e){var s;if(!o(e)||(s=i(e)).type!==t)throw new g("Incompatible receiver, "+t+" required");return s}};if(n||l.state){var m=l.state||(l.state=new f);m.get=m.get,m.has=m.has,m.set=m.set,e=function(t,e){if(m.has(t))throw new g(d);return e.facade=t,m.set(t,e),e},i=function(t){return m.get(t)||{}},s=function(t){return m.has(t)}}else{var y=c("state");u[y]=!0,e=function(t,e){if(h(t,y))throw new g(d);return e.facade=t,a(t,y,e),e},i=function(t){return h(t,y)?t[y]:{}},s=function(t){return h(t,y)}}t.exports={set:e,get:i,has:s,enforce:p,getterFor:_}}),ct=i.cw(function(t){var e=Pe(),i=It(),s=e("iterator"),n=Array.prototype;t.exports=function(t){return void 0!==t&&(i.Array===t||n[s]===t)}}),ut=i.cw(function(t){var e=x();t.exports=Array.isArray||function(t){return"Array"===e(t)}}),dt=i.cw(function(t){var e=w();t.exports=function(t){var i=e(t);return"BigInt64Array"===i||"BigUint64Array"===i}}),gt=i.cw(function(t){var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}}),ft=i.cw(function(t){var e=j(),i=gt(),s=/#|\.prototype\./,n=function(t,s){var n=o[r(t)];return n===h||n!==a&&(i(s)?e(s):!!s)},r=n.normalize=function(t){return String(t).replace(s,".").toLowerCase()},o=n.data={},a=n.NATIVE="N",h=n.POLYFILL="P";t.exports=n}),pt=function(){return i(117)},_t=i.cw(function(t){var e=gt();t.exports=function(t){return"object"==typeof t?null!==t:e(t)}}),mt=i.cw(function(t){var e=_t();t.exports=function(t){return e(t)||null===t}}),yt=i.cw(function(t){t.exports=!1}),vt=i.cw(function(t){var e=H(),i=gt(),s=zt(),n=Se(),r=Object;t.exports=n?function(t){return"symbol"==typeof t}:function(t){var n=e("Symbol");return i(n)&&s(n.prototype,r(t))}}),xt=i.cw(function(t){var e=W();t.exports=function(t,i,s){var n,r,o=s?t:t.iterator,a=t.next;while(!(n=e(a,o)).done)if(r=i(n.value),void 0!==r)return r}}),wt=i.cw(function(t){var e=U(),i=W(),s=l(),n=xe(),r=ct(),o=Tt(),a=zt(),h=J(),c=Q(),u=St(),d=TypeError,g=function(t,e){this.stopped=t,this.result=e},f=g.prototype;t.exports=function(t,l,p){var _,m,y,v,x,w,E,M=p&&p.that,S=!(!p||!p.AS_ENTRIES),C=!(!p||!p.IS_RECORD),b=!(!p||!p.IS_ITERATOR),P=!(!p||!p.INTERRUPTED),R=e(l,M),I=function(t){var e=_;return _=void 0,e&&u(e,"normal"),new g(!0,t)},T=function(t){return S?(s(t),P?R(t[0],t[1],I):R(t[0],t[1])):P?R(t,I):R(t)};if(C)_=t.iterator;else if(b)_=t;else{if(m=c(t),!m)throw new d(n(t)+" is not iterable");if(r(m)){for(y=0,v=o(t);v>y;y++)if(x=T(t[y]),x&&a(f,x))return x;return new g(!1)}_=h(t,m)}w=C?t.next:_.next;while(!(E=i(w,_)).done){var A=E.value;try{x=T(A)}catch(L){if(!_)throw L;u(_,"throw",L)}if("object"==typeof x&&x&&a(f,x))return x}return new g(!1)}}),Et=function(){return i(859)},Mt=i.cw(function(t){var e=St();t.exports=function(t,i,s){for(var n=t.length-1;n>=0;n--)if(void 0!==t[n])try{s=e(t[n].iterator,i,s)}catch(r){i="throw",s=r}if("throw"===i)throw s;return s}}),St=i.cw(function(t){var e=W(),i=l(),s=tt();t.exports=function(t,n,r){var o,a;i(t);try{if(o=s(t,"return"),!o){if("throw"===n)throw r;return r}o=e(o,t)}catch(h){a=!0,o=h}if("throw"===n)throw r;if(a)throw o;return i(o),r}}),Ct=i.cw(function(t){var e=W(),i=Ot(),s=C(),n=T(),r=Pe(),o=lt(),a=tt(),h=Rt().H,l=S(),c=St(),u=Mt(),d=Et(),g=r("toStringTag"),f="IteratorHelper",p="WrapForValidIterator",_="normal",m="throw",y=o.set,v=function(t){var s=o.getterFor(t?p:f);return n(i(h),{next:function(){var e=s(this);if(t)return e.nextHandler();if(e.done)return l(void 0,!0);try{var i=e.nextHandler();return e.done&&d(e),e.returnHandlerResult?i:l(i,e.done)}catch(n){throw e.done=!0,d(e),n}},return:function(){var i=s(this),n=i.iterator,r=i.inner,o=i.openIters,h=i.done;if(i.done=!0,t){var g=a(n,"return");return g?e(g,n):l(void 0,!0)}if(d(i),h)return l(void 0,!0);if(r)try{c(r.iterator,_)}catch(f){return c(n,m,f)}if(o)try{u(o,_)}catch(f){if(n)return c(n,m,f);throw f}return n&&c(n,_),l(void 0,!0)}})},x=v(!0),w=v(!1);s(w,g,"Iterator Helper"),t.exports=function(t,e,i){var s=function(s,n){n?(n.iterator=s.iterator,n.next=s.next):n=s,n.type=e?p:f,n.returnHandlerResult=!!i,n.nextHandler=t,n.counter=0,n.done=!1,y(this,n)};return s.prototype=e?x:w,s}}),bt=function(){return i(684)},Pt=i.cw(function(t){var e=it();t.exports=function(t,i){var s=e.Iterator,n=s&&s.prototype,r=n&&n[t],o=!1;if(r)try{r.call({next:function(){return{done:!0}},return:function(){o=!0}},-1)}catch(a){a instanceof i||(o=!1)}if(!o)return r}}),Rt=i.cw(function(t){var e,i,s,n=j(),r=gt(),o=_t(),a=Ot(),h=jt(),l=I(),c=Pe(),u=yt(),d=c("iterator"),g=!1;[].keys&&(s=[].keys(),"next"in s?(i=h(h(s)),i!==Object.prototype&&(e=i)):g=!0);var f=!o(e)||n(function(){var t={};return e[d].call(t)!==t});f?e={}:u&&(e=a(e)),r(e[d])||l(e,d,function(){return this}),t.exports={H:e,BUGGY_SAFARI_ITERATORS:g}}),It=function(){return i(269)},Tt=i.cw(function(t){var e=pe();t.exports=function(t){return e(t.length)}}),At=i.cw(function(t){var e=Y(),i=j(),s=gt(),n=st(),r=L(),o=X().i2,a=ht(),h=lt(),l=h.enforce,c=h.get,u=String,d=Object.defineProperty,g=e("".slice),f=e("".replace),p=e([].join),_=r&&!i(function(){return 8!==d(function(){},"length",{value:8}).length}),m=String(String).split("String"),y=t.exports=function(t,e,i){"Symbol("===g(u(e),0,7)&&(e="["+f(u(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!n(t,"name")||o&&t.name!==e)&&(r?d(t,"name",{value:e,configurable:!0}):t.name=e),_&&i&&n(i,"arity")&&t.length!==i.arity&&d(t,"length",{value:i.arity});try{i&&n(i,"constructor")&&i.constructor?r&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(a){}var s=l(t);return n(s,"source")||(s.source=p(m,"string"==typeof e?e:"")),t};Function.prototype.toString=y(function(){return s(this)&&c(this).source||a(this)},"toString")}),Lt=i.cw(function(t){var e=Y(),i=Map.prototype;t.exports={Map:Map,set:e(i.set),get:e(i.get),has:e(i.has),remove:e(i["delete"]),proto:i}}),Ot=i.cw(function(t){var e,i=l(),s=Gt(),n=k(),r=nt(),o=rt(),a=O(),h=ae(),c=">",u="<",d="prototype",g="script",f=h("IE_PROTO"),p=function(){},_=function(t){return u+g+c+t+u+"/"+g+c},m=function(t){t.write(_("")),t.close();var e=t.parentWindow.Object;return t=null,e},y=function(){var t,e=a("iframe"),i="java"+g+":";return e.style.display="none",o.appendChild(e),e.src=String(i),t=e.contentWindow.document,t.open(),t.write(_("document.F=Object")),t.close(),t.F},v=function(){try{e=new ActiveXObject("htmlfile")}catch(i){}v="undefined"!=typeof document?document.domain&&e?m(e):y():m(e);var t=n.length;while(t--)delete v[d][n[t]];return v()};r[f]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(p[d]=i(t),n=new p,p[d]=null,n[f]=t):n=v(),void 0===e?n:s.f(n,e)}}),Gt=i.cw(function(t,e){var i=L(),s=Ce(),n=kt(),r=l(),o=ge(),a=Bt();e.f=i&&!s?Object.defineProperties:function(t,e){r(t);var i,s=o(e),h=a(e),l=h.length,c=0;while(l>c)n.f(t,i=h[c++],s[i]);return t}}),kt=i.cw(function(t,e){var i=L(),s=ot(),n=Ce(),r=l(),o=ye(),a=TypeError,h=Object.defineProperty,c=Object.getOwnPropertyDescriptor,u="enumerable",d="configurable",g="writable";e.f=i?n?function(t,e,i){if(r(t),e=o(e),r(i),"function"===typeof t&&"prototype"===e&&"value"in i&&g in i&&!i[g]){var s=c(t,e);s&&s[g]&&(t[e]=i.value,i={configurable:d in i?i[d]:s[d],enumerable:u in i?i[u]:s[u],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(r(t),e=o(e),r(i),s)try{return h(t,e,i)}catch(n){}if("get"in i||"set"in i)throw new a("Accessors not supported");return"value"in i&&(t[e]=i.value),t}}),Nt=i.cw(function(t,e){var i=L(),s=W(),n=Wt(),r=b(),o=ge(),a=ye(),h=st(),l=ot(),c=Object.getOwnPropertyDescriptor;e.f=i?c:function(t,e){if(t=o(t),e=a(e),l)try{return c(t,e)}catch(i){}if(h(t,e))return r(!s(n.f,t,e),t[e])}}),Ft=i.cw(function(t,e){var i=Ut(),s=k(),n=s.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return i(t,n)}}),Dt=function(){return i(717)},jt=i.cw(function(t){var e=st(),i=gt(),s=_e(),n=ae(),r=M(),o=n("IE_PROTO"),a=Object,h=a.prototype;t.exports=r?a.getPrototypeOf:function(t){var n=s(t);if(e(n,o))return n[o];var r=n.constructor;return i(r)&&n instanceof r?r.prototype:n instanceof a?h:null}}),zt=i.cw(function(t){var e=Y();t.exports=e({}.isPrototypeOf)}),Ut=i.cw(function(t){var e=Y(),i=st(),s=ge(),n=_().q,r=nt(),o=e([].push);t.exports=function(t,e){var a,h=s(t),l=0,c=[];for(a in h)!i(r,a)&&i(h,a)&&o(c,a);while(e.length>l)i(h,a=e[l++])&&(~n(c,a)||o(c,a));return c}}),Bt=i.cw(function(t){var e=Ut(),i=k();t.exports=Object.keys||function(t){return e(t,i)}}),Wt=i.cw(function(t,e){var i={}.propertyIsEnumerable,s=Object.getOwnPropertyDescriptor,n=s&&!i.call({1:2},1);e.f=n?function(t){var e=s(this,t);return!!e&&e.enumerable}:i}),Xt=i.cw(function(t){var i=V(),s=_t(),n=Yt(),r=e();t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,o={};try{t=i(Object.prototype,"__proto__","set"),t(o,[]),e=o instanceof Array}catch(a){}return function(i,o){return n(i),r(o),s(i)?(e?t(i,o):i.__proto__=o,i):i}}():void 0)}),Vt=i.cw(function(t){var e=W(),i=gt(),s=_t(),n=TypeError;t.exports=function(t,r){var o,a;if("string"===r&&i(o=t.toString)&&!s(a=e(o,t)))return a;if(i(o=t.valueOf)&&!s(a=e(o,t)))return a;if("string"!==r&&i(o=t.toString)&&!s(a=e(o,t)))return a;throw new n("Can't convert object to primitive value")}}),qt=i.cw(function(t){var e=H(),i=Y(),s=Ft(),n=Dt(),r=l(),o=i([].concat);t.exports=e("Reflect","ownKeys")||function(t){var e=s.f(r(t)),i=n.f;return i?o(e,i(t)):e}}),Yt=function(){return i(750)},Kt=i.cw(function(t){var e=$t(),i=ee(),s=e.Set,n=e.add;t.exports=function(t){var e=new s;return i(t,function(t){n(e,t)}),e}}),Ht=i.cw(function(t){var e=n(),i=$t(),s=Kt(),r=ne(),o=et(),a=ee(),h=xt(),l=i.has,c=i.remove;t.exports=function(t){var i=e(this),n=o(t),u=s(i);return r(u)<=n.size?a(u,function(t){n.includes(t)&&c(u,t)}):h(n.getIterator(),function(t){l(u,t)&&c(u,t)}),u}}),$t=i.cw(function(t){var e=Y(),i=Set.prototype;t.exports={Set:Set,add:e(i.add),has:e(i.has),remove:e(i["delete"]),proto:i}}),Zt=i.cw(function(t){var e=n(),i=$t(),s=ne(),r=et(),o=ee(),a=xt(),h=i.Set,l=i.add,c=i.has;t.exports=function(t){var i=e(this),n=r(t),u=new h;return s(i)>n.size?a(n.getIterator(),function(t){c(i,t)&&l(u,t)}):o(i,function(t){n.includes(t)&&l(u,t)}),u}}),Jt=i.cw(function(t){var e=n(),i=$t().has,s=ne(),r=et(),o=ee(),a=xt(),h=St();t.exports=function(t){var n=e(this),l=r(t);if(s(n)<=l.size)return!1!==o(n,function(t){if(l.includes(t))return!1},!0);var c=l.getIterator();return!1!==a(c,function(t){if(i(n,t))return h(c.iterator,"normal",!1)})}}),Qt=i.cw(function(t){var e=n(),i=ne(),s=ee(),r=et();t.exports=function(t){var n=e(this),o=r(t);return!(i(n)>o.size)&&!1!==s(n,function(t){if(!o.includes(t))return!1},!0)}}),te=i.cw(function(t){var e=n(),i=$t().has,s=ne(),r=et(),o=xt(),a=St();t.exports=function(t){var n=e(this),h=r(t);if(s(n)<h.size)return!1;var l=h.getIterator();return!1!==o(l,function(t){if(!i(n,t))return a(l.iterator,"normal",!1)})}}),ee=i.cw(function(t){var e=Y(),i=xt(),s=$t(),n=s.Set,r=s.proto,o=e(r.forEach),a=e(r.keys),h=a(new n).next;t.exports=function(t,e,s){return s?i({iterator:a(t),next:h},e):o(t,e)}}),ie=i.cw(function(t){var e=H(),i=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw new Error("e")}}};t.exports=function(t,n){var r=e("Set");try{(new r)[t](i(0));try{return(new r)[t](i(-1)),!1}catch(a){if(!n)return!0;try{return(new r)[t](s(-1/0)),!1}catch(h){var o=new r([1,2]);return n(o[t](s(1/0)))}}}catch(h){return!1}}}),se=function(){return i(835)},ne=i.cw(function(t){var e=V(),i=$t();t.exports=e(i.proto,"size","get")||function(t){return t.size}}),re=i.cw(function(t){var e=n(),i=$t(),s=Kt(),r=et(),o=xt(),a=i.add,h=i.has,l=i.remove;t.exports=function(t){var i=e(this),n=r(t).getIterator(),c=s(i);return o(n,function(t){h(i,t)?l(c,t):a(c,t)}),c}}),oe=i.cw(function(t){var e=n(),i=$t().add,s=Kt(),r=et(),o=xt();t.exports=function(t){var n=e(this),a=r(t).getIterator(),h=s(n);return o(a,function(t){i(h,t)}),h}}),ae=i.cw(function(t){var e=le(),i=we(),s=e("keys");t.exports=function(t){return s[t]||(s[t]=i(t))}}),he=i.cw(function(t){var e=yt(),i=it(),s=A(),n="__core-js_shared__",r=t.exports=i[n]||s(n,{});(r.versions||(r.versions=[])).push({version:"3.51.0",mode:e?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.51.0/LICENSE",source:"https://github.com/zloirock/core-js"})}),le=i.cw(function(t){var e=he(),i=Object.create||Object;t.exports=function(t,s){return e[t]||(e[t]=s||i(null))}}),ce=i.cw(function(t){var e=F(),i=j(),s=it(),n=s.String;t.exports=!!Object.getOwnPropertySymbols&&!i(function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41})}),ue=i.cw(function(t){var e=fe(),i=Math.max,s=Math.min;t.exports=function(t,n){var r=e(t);return r<0?i(r+n,0):s(r,n)}}),de=i.cw(function(t){var e=me(),i=TypeError;t.exports=function(t){var s=e(t,"number");if("number"==typeof s)throw new i("Can't convert number to bigint");return BigInt(s)}}),ge=i.cw(function(t){var e=at(),i=Yt();t.exports=function(t){return e(i(t))}}),fe=function(){return i(291)},pe=function(){return i(14)},_e=function(){return i(981)},me=i.cw(function(t){var e=W(),i=_t(),s=vt(),n=tt(),r=Vt(),o=Pe(),a=TypeError,h=o("toPrimitive");t.exports=function(t,o){if(!i(t)||s(t))return t;var l,c=n(t,h);if(c){if(void 0===o&&(o="default"),l=e(c,t,o),!i(l)||s(l))return l;throw new a("Can't convert object to primitive value")}return void 0===o&&(o="number"),r(t,o)}}),ye=i.cw(function(t){var e=me(),i=vt();t.exports=function(t){var s=e(t,"string");return i(s)?s:s+""}}),ve=i.cw(function(t){var e=Pe(),i=e("toStringTag"),s={};s[i]="z",t.exports="[object z]"===String(s)}),xe=i.cw(function(t){var e=String;t.exports=function(t){try{return e(t)}catch(i){return"Object"}}}),we=i.cw(function(t){var e=Y(),i=0,s=Math.random(),n=e(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+n(++i+s,36)}}),Ee=i.cw(function(t){var e=it(),i=Y(),s=h(),n=r(),o=st(),a=y(),l=K(),c=f(),u=a.c2i,d=a.c2iUrl,g=e.SyntaxError,p=e.TypeError,_=e.Array,m=i("".charAt),v=Math.floor,x=function(t,e){for(var i=t.length;e<i;e++){var s=m(t,e);if(" "!==s&&"\t"!==s&&"\n"!==s&&"\f"!==s&&"\r"!==s)break}return e},w=function(t,e,i){var s=t.length;s<4&&(t+=2===s?"AA":"A");var n=(e[m(t,0)]<<18)+(e[m(t,1)]<<12)+(e[m(t,2)]<<6)+e[m(t,3)],r=[n>>16&255,n>>8&255,255&n];if(2===s){if(i&&0!==r[1])throw new g("Extra bits");return[r[0]]}if(3===s){if(i&&0!==r[2])throw new g("Extra bits");return[r[0],r[1]]}return r},E=function(t,e,i){for(var s=e.length,n=0;n<s;n++)t[i+n]=e[n];return i+s};t.exports=function(t,e,i,r){n(t),s(e);var a="base64"===l(e)?u:d,h=e?e.lastChunkHandling:void 0;if(void 0===h&&(h="loose"),"loose"!==h&&"strict"!==h&&"stop-before-partial"!==h)throw new p("Incorrect `lastChunkHandling` option");i&&c(i.buffer);var f=t.length,y=i||_(v(3*f/4)),M=0,S=0,C="",b=0;if(r)while(1){if(b=x(t,b),b===f){if(C.length>0){if("stop-before-partial"===h)break;if("loose"!==h)throw new g("Missing padding");if(1===C.length)throw new g("Malformed padding: exactly one additional character");M=E(y,w(C,a,!1),M)}S=f;break}var P=m(t,b);if(++b,"="===P){if(C.length<2)throw new g("Padding is too early");if(b=x(t,b),2===C.length){if(b===f){if("stop-before-partial"===h)break;throw new g("Malformed padding: only one =")}"="===m(t,b)&&(++b,b=x(t,b))}if(b<f)throw new g("Unexpected character after padding");M=E(y,w(C,a,"strict"===h),M),S=f;break}if(!o(a,P))throw new g("Unexpected character");var R=r-M;if(1===R&&2===C.length||2===R&&3===C.length)break;if(C+=P,4===C.length&&(M=E(y,w(C,a,!1),M),C="",S=b,M===r))break}return i||(y.length=M),{bytes:y,read:S,written:M}}}),Me=i.cw(function(t){var e=it(),i=Y(),s=e.Uint8Array,n=e.SyntaxError,r=Math.min,o=i("".match);t.exports=function(t,e){var i=t.length;if(i%2!==0)throw new n("String should be an even number of characters");for(var a=e?r(e.length,i/2):i/2,h=e||new s(a),l=o(t,/[\S\s]{2}/g),c=0;c<a;c++){var u=+("0x"+l[c]+"0");if(u!==u)throw new n("String should only contain hex characters");h[c]=u>>4}return{bytes:h,read:c<<1}}}),Se=i.cw(function(t){var e=ce();t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}),Ce=i.cw(function(t){var e=L(),i=j();t.exports=e&&i(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}),be=i.cw(function(t){var e=it(),i=gt(),s=e.WeakMap;t.exports=i(s)&&/native code/.test(String(s))}),Pe=i.cw(function(t){var e=it(),i=le(),s=st(),n=we(),r=ce(),o=Se(),a=e.Symbol,h=i("wks"),l=o?a["for"]||a:a&&a.withoutSetter||n;t.exports=function(t){return s(h,t)||(h[t]=r&&s(a,t)?a[t]:l("Symbol."+t)),h[t]}}),Re=i.cw(function(){var t=D(),e=_().m,i=j(),s=o(),n=i(function(){return!Array(1).includes()}),r=i(function(){return[,1].includes(void 0,1)});t({target:"Array",proto:!0,forced:n||r},{includes:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}}),s("includes")}),Ie=i.cw(function(){var t=D(),e=_e(),i=Tt(),s=m(),n=G(),r=j(),o=r(function(){return 4294967297!==[].push.call({length:4294967296},1)}),a=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},h=o||!a();t({target:"Array",proto:!0,arity:1,forced:h},{push:function(t){var r=e(this),o=i(r),a=arguments.length;n(o+a);for(var h=0;h<a;h++)r[o]=arguments[h],o++;return s(r,o),o}})}),Te=i.cw(function(){var t=D(),e=it(),i=a(),s=l(),n=gt(),r=jt(),o=R(),h=P(),c=j(),u=st(),d=Pe(),g=Rt().H,f=L(),p=yt(),_="constructor",m="Iterator",y=d("toStringTag"),v=TypeError,x=e[m],w=p||!n(x)||x.prototype!==g||!c(function(){x({})}),E=function(){if(i(this,g),r(this)===g)throw new v("Abstract class Iterator not directly constructable")},M=function(t,e){f?o(g,t,{configurable:!0,get:function(){return e},set:function(e){if(s(this),this===g)throw new v("You can't redefine this property");u(this,t)?this[t]=e:h(this,t,e)}}):g[t]=e};u(g,y)||M(y,m),!w&&u(g,_)&&g[_]!==Object||M(_,E),E.prototype=g,t({global:!0,constructor:!0,forced:w},{Iterator:E})}),Ae=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("every",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{every:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return!s(e,function(e,i){if(!t(e,h++))return i()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),Le=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Ct(),a=v(),h=yt(),c=St(),u=bt(),d=Pt(),g=!h&&!u("filter",function(){}),f=!h&&!g&&d("filter",TypeError),p=h||g||f,_=o(function(){var t,e,s,r=this.iterator,o=this.predicate,h=this.next;while(1){if(t=n(i(h,r)),e=this.done=!!t.done,e)return;if(s=t.value,a(r,o,[s,this.counter++],!0))return s}});e({target:"Iterator",proto:!0,real:!0,forced:p},{filter:function(t){n(this);try{s(t)}catch(e){c(this,"throw",e)}return f?i(f,this,t):new _(r(this),{predicate:t})}})}),Oe=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("find",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{find:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return s(e,function(e,i){if(t(e,h++))return i(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})}),Ge=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Z(),a=Ct(),h=St(),c=j(),u=yt(),d=bt(),g=Pt(),f=!u&&c(function(){return 1!==[1].values().flatMap(function(){return[1]}).find(function(){return!0})}),p=!u&&!f&&!d("flatMap",function(){}),_=!u&&!f&&!p&&g("flatMap",TypeError),m=u||f||p||_,y=a(function(){var t,e,s=this.iterator,r=this.mapper;while(1){if(e=this.inner)try{if(t=n(i(e.next,e.iterator)),!t.done)return t.value;this.inner=null}catch(a){h(s,"throw",a)}if(t=n(i(this.next,s)),this.done=!!t.done)return;try{this.inner=o(r(t.value,this.counter++),!1)}catch(a){h(s,"throw",a)}}});e({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function(t){n(this);try{s(t)}catch(e){h(this,"throw",e)}return _?i(_,this,t):new y(r(this),{mapper:t,inner:null})}})}),ke=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("forEach",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{forEach:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;s(e,function(e){t(e,h++)},{IS_RECORD:!0})}})}),Ne=i.cw(function(){var e=D(),i=W(),s=t(),n=l(),r=$(),o=Ct(),a=v(),h=St(),c=bt(),u=Pt(),d=yt(),g=!d&&!c("map",function(){}),f=!d&&!g&&u("map",TypeError),p=d||g||f,_=o(function(){var t=this.iterator,e=n(i(this.next,t)),s=this.done=!!e.done;if(!s)return a(t,this.mapper,[e.value,this.counter++],!0)});e({target:"Iterator",proto:!0,real:!0,forced:p},{map:function(t){n(this);try{s(t)}catch(e){h(this,"throw",e)}return f?i(f,this,t):new _(r(this),{mapper:t})}})}),Fe=i.cw(function(){var e=D(),i=wt(),s=t(),n=l(),r=$(),o=St(),a=Pt(),h=z(),c=j(),u=TypeError,d=c(function(){[].keys().reduce(function(){},void 0)}),g=!d&&a("reduce",u);e({target:"Iterator",proto:!0,real:!0,forced:d||g},{reduce:function(t){n(this);try{s(t)}catch(d){o(this,"throw",d)}var e=arguments.length<2,a=e?void 0:arguments[1];if(g)return h(g,this,e?[t]:[t,a]);var l=r(this),c=0;if(i(l,function(i){e?(e=!1,a=i):a=t(a,i,c),c++},{IS_RECORD:!0}),e)throw new u("Reduce of empty iterator with no initial value");return a}})}),De=i.cw(function(){var e=D(),i=W(),s=wt(),n=t(),r=l(),o=$(),a=St(),h=Pt(),c=h("some",TypeError);e({target:"Iterator",proto:!0,real:!0,forced:c},{some:function(t){r(this);try{n(t)}catch(l){a(this,"throw",l)}if(c)return i(c,this,t);var e=o(this),h=0;return s(e,function(e,i){if(t(e,h++))return i()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})}),je=i.cw(function(){var e=D(),i=t(),s=Lt(),n=yt(),r=s.get,o=s.has,a=s.set;e({target:"Map",proto:!0,real:!0,forced:n},{getOrInsertComputed:function(t,e){var s=o(this,t);if(i(e),s)return r(this,t);0===t&&1/t===-1/0&&(t=0);var n=e(t);return a(this,t,n),n}})}),ze=i.cw(function(){var t=D(),e=Lt(),i=yt(),s=e.get,n=e.has,r=e.set;t({target:"Map",proto:!0,real:!0,forced:i},{getOrInsert:function(t,e){return n(this,t)?s(this,t):(r(this,t,e),e)}})}),Ue=i.cw(function(){var t=D(),e=Ht(),i=j(),s=ie(),n=!s("difference",function(t){return 0===t.size}),r=n||i(function(){var t={size:1,has:function(){return!0},keys:function(){var t=0;return{next:function(){var i=t++>1;return e.has(1)&&e.clear(),{done:i,value:2}}}}},e=new Set([1,2,3,4]);return 3!==e.difference(t).size});t({target:"Set",proto:!0,real:!0,forced:r},{difference:e})}),Be=i.cw(function(){var t=D(),e=j(),i=Zt(),s=ie(),n=!s("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||e(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))});t({target:"Set",proto:!0,real:!0,forced:n},{intersection:i})}),We=i.cw(function(){var t=D(),e=Jt(),i=ie(),s=!i("isDisjointFrom",function(t){return!t});t({target:"Set",proto:!0,real:!0,forced:s},{isDisjointFrom:e})}),Xe=i.cw(function(){var t=D(),e=Qt(),i=ie(),s=!i("isSubsetOf",function(t){return t});t({target:"Set",proto:!0,real:!0,forced:s},{isSubsetOf:e})}),Ve=i.cw(function(){var t=D(),e=te(),i=ie(),s=!i("isSupersetOf",function(t){return!t});t({target:"Set",proto:!0,real:!0,forced:s},{isSupersetOf:e})}),qe=i.cw(function(){var t=D(),e=re(),i=se(),s=ie(),n=!s("symmetricDifference")||!i("symmetricDifference");t({target:"Set",proto:!0,real:!0,forced:n},{symmetricDifference:e})}),Ye=i.cw(function(){var t=D(),e=oe(),i=se(),s=ie(),n=!s("union")||!i("union");t({target:"Set",proto:!0,real:!0,forced:n},{union:e})}),Ke=i.cw(function(){var t=p(),e=dt(),i=Tt(),s=fe(),n=de(),r=t.aTypedArray,o=t.getTypedArrayConstructor,a=t.exportTypedArrayMethod,h=RangeError,l=function(){try{new Int8Array(1)["with"](2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),c=l&&function(){try{new Int8Array(1)["with"](-.5,1)}catch(t){return!0}}();a("with",{with:function(t,a){var l=r(this),c=i(l),u=s(t),d=u<0?c+u:u,g=e(l)?n(a):+a;if(d>=c||d<0)throw new h("Incorrect index");for(var f=new(o(l))(c),p=0;p<c;p++)f[p]=p===d?g:l[p];return f}}["with"],!l||c)}),He=i.cw(function(){var t=D(),e=it(),i=Ee(),s=c(),n=e.Uint8Array,r=!n||!n.prototype.setFromBase64||!function(){var t=new n([255,255,255,255,255]);try{return void t.setFromBase64("",null)}catch(e){}try{return void t.setFromBase64("a")}catch(e){}try{t.setFromBase64("MjYyZg===")}catch(e){return 50===t[0]&&54===t[1]&&50===t[2]&&255===t[3]&&255===t[4]}}();n&&t({target:"Uint8Array",proto:!0,forced:r},{setFromBase64:function(t){s(this);var e=i(t,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})}),$e=i.cw(function(){var t=D(),e=it(),i=r(),s=c(),n=f(),o=Me();function a(){try{var t=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(t).setFromHex("cafed00d")}catch(e){return!0}}e.Uint8Array&&t({target:"Uint8Array",proto:!0,forced:a()},{setFromHex:function(t){s(this),i(t),n(this.buffer);var e=o(t,this).read;return{read:e,written:e/2}}})}),Ze=i.cw(function(){var t=D(),e=it(),i=Y(),s=h(),n=c(),r=f(),o=y(),a=K(),l=o.i2c,u=o.i2cUrl,d=Math.floor,g=Math.ceil,p=i("".charAt),_=e.Uint8Array,m=e.Array,v=i([].join),x=!_||!_.prototype.toBase64||!function(){try{var t=new _;t.toBase64(null)}catch(e){return!0}}();_&&t({target:"Uint8Array",proto:!0,forced:x},{toBase64:function(){var t=n(this),e=arguments.length?s(arguments[0]):void 0,i="base64"===a(e)?l:u,o=!!e&&!!e.omitPadding;r(this.buffer);for(var h,c=0,f=t.length,_=m(o?4*d(f/3)+(f%3?f%3+1:0):4*g(f/3)),y=0,x=function(t){return p(i,h>>6*t&63)};c+2<f;c+=3)h=(t[c]<<16)+(t[c+1]<<8)+t[c+2],_[y++]=x(3),_[y++]=x(2),_[y++]=x(1),_[y++]=x(0);return c+2===f?(h=(t[c]<<16)+(t[c+1]<<8),_[y++]=x(3),_[y++]=x(2),_[y++]=x(1),o||(_[y++]="=")):c+1===f&&(h=t[c]<<16,_[y++]=x(3),_[y++]=x(2),o||(_[y++]="=",_[y++]="=")),v(_,"")}})}),Je=i.cw(function(){var t=D(),e=it(),i=Y(),s=c(),n=f(),r=i(1.1.toString),o=i([].join),a=Array,h=e.Uint8Array,l=!h||!h.prototype.toHex||!function(){try{var t=new h([255,255,255,255,255,255,255,255]);return"ffffffffffffffff"===t.toHex()}catch(e){return!1}}();h&&t({target:"Uint8Array",proto:!0,forced:l},{toHex:function(){s(this),n(this.buffer);for(var t=a(this.length),e=0,i=this.length;e<i;e++){var h=r(this[e],16);t[e]=1===h.length?"0"+h:h}return o(t,"")}})});if("undefined"!==typeof window){var Qe=window.document.currentScript,ti=Qe&&Qe.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);ti&&(i.p=ti[1])}Te(),Ne();var ei=function(){var t=this,e=t._self._c;return e("div",{ref:"mapViewer",staticClass:"map-viewer-root",class:{"light-theme":t.isLight,"sidebar-collapsed":t.sidebarCollapsed,"panel-right-collapsed":t.panelRightCollapsed},style:t.viewerStyle},[e("aside",{attrs:{id:"sidebar"}},[e("header",{staticClass:"sidebar-header"},[t._m(0),e("button",{ref:"sidebarCollapse",attrs:{id:"sidebar-collapse",title:"收起面板"},on:{click:t.collapseSidebar}},[t._v("‹")])]),e("div",{staticClass:"sidebar-body"},[e("section",{staticClass:"block"},[e("h2",[t._v("当前地图")]),t.mapInfo.active?t._e():e("div",{staticClass:"hint",attrs:{id:"map-info-empty"}},[t._v("暂无地图,请上传地图。")]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.mapInfo.active,expression:"mapInfo.active"}],attrs:{id:"map-info"}},[e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("名称")]),e("span",{attrs:{id:"info-name"}},[t._v(t._s(t.mapInfo.name))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("类型")]),e("span",{attrs:{id:"info-kind"}},[t._v(t._s(t.mapInfo.kind))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("数据坐标系")]),e("span",{attrs:{id:"info-data-crs"}},[t._v(t._s(t.mapInfo.dataCrs))])]),e("div",{staticClass:"map-detail"},[e("span",{staticClass:"detail-label"},[t._v("显示范围")]),e("span",{attrs:{id:"info-extent"}},[t._v(t._s(t.mapInfo.extent))])])])]),e("section",{directives:[{name:"show",rawName:"v-show",value:t.mapInfo.active,expression:"mapInfo.active"}],staticClass:"block",attrs:{id:"view-crs-block"}},[e("h2",[t._v("视图坐标系")]),e("div",{staticClass:"row"},[e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.viewCrs,expression:"form.viewCrs"}],attrs:{id:"view-crs"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"viewCrs",e.target.multiple?i:i[0])}}},[t._l(t.crsOptions.viewCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0):t._e()],2),e("button",{ref:"btnSwitchView",staticClass:"mini-btn",attrs:{id:"btn-switch-view",type:"button"},on:{click:t.switchViewProjection}},[t._v("切换")])]),e("label",{staticClass:"grid-caption"},[t._v("显示范围")]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{attrs:{type:"number",id:"map-ext-minx",step:"any",readonly:""},domProps:{value:t.mapExtent.minx}})]),e("label",[t._v("Y 最小(南)"),e("input",{attrs:{type:"number",id:"map-ext-miny",step:"any",readonly:""},domProps:{value:t.mapExtent.miny}})]),e("label",[t._v("X 最大(东)"),e("input",{attrs:{type:"number",id:"map-ext-maxx",step:"any",readonly:""},domProps:{value:t.mapExtent.maxx}})]),e("label",[t._v("Y 最大(北)"),e("input",{attrs:{type:"number",id:"map-ext-maxy",step:"any",readonly:""},domProps:{value:t.mapExtent.maxy}})])]),e("label",{staticClass:"grid-caption"},[t._v("当前视野")]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{attrs:{type:"number",id:"view-ext-minx",step:"any",readonly:""},domProps:{value:t.viewExtent.minx}})]),e("label",[t._v("Y 最小(南)"),e("input",{attrs:{type:"number",id:"view-ext-miny",step:"any",readonly:""},domProps:{value:t.viewExtent.miny}})]),e("label",[t._v("X 最大(东)"),e("input",{attrs:{type:"number",id:"view-ext-maxx",step:"any",readonly:""},domProps:{value:t.viewExtent.maxx}})]),e("label",[t._v("Y 最大(北)"),e("input",{attrs:{type:"number",id:"view-ext-maxy",step:"any",readonly:""},domProps:{value:t.viewExtent.maxy}})])])]),e("section",{directives:[{name:"show",rawName:"v-show",value:t.layerListVisible,expression:"layerListVisible"}],staticClass:"block",attrs:{id:"layer-list-block"}},[e("h2",{staticClass:"layer-list-title"},[t._v("图层列表"),t.layerListHint?t._e():e("span",{staticClass:"layer-summary"},[t._v(t._s(t.layerTotal)+" 个图层 · "+t._s(t.layerFeatureTotal)+" 个要素")])]),e("p",{directives:[{name:"show",rawName:"v-show",value:t.layerListHint,expression:"layerListHint"}],staticClass:"layer-list-hint"},[t._v(t._s(t.layerListHint))]),e("ul",{attrs:{id:"layer-list"}},[t._l(t.layerListItems,function(i){return["layer"===i.type?e("li",{key:i.key,staticClass:"layer-item",class:{"hidden-layer":!i.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:i.name}},[t._v(t._s(i.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(i.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到当前图层"},on:{click:function(e){return t.zoomToLayer(i)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层"},on:{click:function(e){return t.removeLayerItem(i)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:i.visible?"隐藏图层":"显示图层"},on:{click:function(e){return t.toggleLayerVisible(i)}}},[t._v(t._s(i.visible?"👁️":"🚫"))])])]):e("li",{key:i.name,staticClass:"layer-item layer-group",class:{"hidden-layer":!i.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:i.name}},[t._v(t._s(i.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(i.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到图层组"},on:{click:function(e){return t.zoomToLayerGroup(i)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层组"},on:{click:function(e){return t.removeLayerGroup(i)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-fold",attrs:{type:"button",title:i.collapsed?"展开图层组":"折叠图层组"},on:{click:function(e){return t.toggleLayerGroupExpanded(i)}}},[t._v(t._s(i.collapsed?"▸":"▾"))]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:i.visible?"隐藏图层组":"显示图层组"},on:{click:function(e){return t.toggleLayerGroupVisible(i)}}},[t._v(t._s(i.visible?"👁️":"🚫"))])])]),"group"!==i.type||i.collapsed?t._e():t._l(i.children,function(s){return e("li",{key:s.key,staticClass:"layer-item layer-child",class:{"hidden-layer":!s.visible}},[e("div",{staticClass:"layer-info"},[e("span",{staticClass:"layer-name",attrs:{title:s.name}},[t._v(t._s(s.name))]),e("span",{staticClass:"layer-meta"},[t._v(t._s(s.meta))])]),e("div",{staticClass:"layer-controls"},[e("button",{staticClass:"icon-btn layer-zoom",attrs:{type:"button",title:"缩放到当前图层"},on:{click:function(e){return t.zoomToLayer(s)}}},[t._v("🔍")]),e("button",{staticClass:"icon-btn layer-delete",attrs:{type:"button",title:"删除图层"},on:{click:function(e){return t.removeLayerItem(s)}}},[t._v("🗑")]),e("button",{staticClass:"icon-btn layer-toggle",attrs:{type:"button",title:s.visible?"隐藏图层":"显示图层"},on:{click:function(e){return t.toggleLayerChildVisible(i,s)}}},[t._v(t._s(s.visible?"👁️":"🚫"))])])])})]})],2)])])]),e("div",{directives:[{name:"show",rawName:"v-show",value:!t.sidebarCollapsed,expression:"!sidebarCollapsed"}],staticClass:"sidebar-resizer",attrs:{title:"拖动调整侧栏宽度"},on:{mousedown:t.startSidebarResize}}),e("button",{ref:"sidebarOpen",attrs:{id:"sidebar-open",title:"展开面板",type:"button"},on:{click:t.expandSidebar}},[t._v("›")]),e("button",{ref:"panelRightOpen",attrs:{id:"panel-right-open",title:"展开面板",type:"button"},on:{click:t.expandPanelRight}},[t._v("‹")]),e("main",{attrs:{id:"map"}}),e("div",{directives:[{name:"show",rawName:"v-show",value:t.mapLoading,expression:"mapLoading"}],staticClass:"map-loading-mask"},[e("span",{staticClass:"map-loading-spinner"}),e("span",{staticClass:"map-loading-text"},[t._v("地图加载中...")])]),e("div",{staticClass:"dialog-overlay",class:{show:t.loadDialogVisible},attrs:{id:"load-dialog"}},[e("div",{staticClass:"dialog"},[e("header",{staticClass:"dialog-header"},[t._m(1),e("button",{ref:"btnDialogClose",attrs:{id:"btn-dialog-close",title:"关闭",type:"button"},on:{click:t.closeLoadDialog}},[t._v("✕")])]),e("div",{ref:"dialogBody",staticClass:"dialog-body"},[e("section",{staticClass:"block"},[e("h2",[t._v("数据类型")]),e("div",{ref:"sourceTypeTabs",staticClass:"tabs source-type-tabs",attrs:{id:"source-type-tabs"}},[e("button",{staticClass:"tab-btn source-type-btn",class:{active:"raster"===t.sourceCategory},attrs:{type:"button"},on:{click:function(e){return t.setSourceCategoryAndDefault("raster")}}},[t._v("栅格")]),e("button",{staticClass:"tab-btn source-type-btn",class:{active:"vector"===t.sourceCategory},attrs:{type:"button"},on:{click:function(e){return t.setSourceCategoryAndDefault("vector")}}},[t._v("矢量")])]),e("h2",[t._v("数据源")]),e("div",{staticClass:"tab-pane",class:{active:"image"===t.currentTab},attrs:{id:"tab-image"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择 PNG / JPG 图片 "),e("input",{ref:"imgFile",attrs:{type:"file",id:"img-file",accept:".png,.jpg,.jpeg,.webp,image/png,image/jpeg,image/webp",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"img-file-name"}},[t._v(t._s(t.form.imgFileName))]),e("label",{staticClass:"file-btn secondary"},[t._v(" 坐标信息文件(可选 .pgw / .wld) "),e("input",{ref:"worldFile",attrs:{type:"file",id:"world-file",accept:".pgw,.pwg,.jgw,.gfw,.wld,.pngw,.jpgw,.txt",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"world-file-name"}},[t._v(t._s(t.form.worldFileName))]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{ref:"extMinx",attrs:{type:"number",id:"ext-minx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最小(南)"),e("input",{ref:"extMiny",attrs:{type:"number",id:"ext-miny",step:"any",placeholder:"必填"}})]),e("label",[t._v("X 最大(东)"),e("input",{ref:"extMaxx",attrs:{type:"number",id:"ext-maxx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最大(北)"),e("input",{ref:"extMaxy",attrs:{type:"number",id:"ext-maxy",step:"any",placeholder:"必填"}})])]),e("div",{staticClass:"hint",attrs:{id:"zone-hint"}},[t.form.zoneHint.message?e("span",[t._v(t._s(t.form.zoneHint.message))]):t._e(),t._l(t.form.zoneHint.options,function(i){return e("button",{key:i.code,staticClass:"chip",attrs:{type:"button"},on:{click:function(e){t.form.dataCrs=i.code}}},[t._v(t._s(i.label))])})],2),e("p",{staticClass:"tip"},[t._v("范围必填:四至范围需填写完整,选择坐标信息文件后可自动计算填充。")])]),e("div",{staticClass:"tab-pane",class:{active:"tiles"===t.currentTab},attrs:{id:"tab-tiles"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择切片XYZ目录(z/x/y 结构) "),e("input",{ref:"tilesDir",attrs:{type:"file",id:"tiles-dir",webkitdirectory:"",directory:"",multiple:"",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"tiles-dir-name"}},[t._v(t._s(t.form.tilesDirName))]),e("label",{staticClass:"check"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.tilesTms,expression:"form.tilesTms"}],attrs:{type:"checkbox",id:"tiles-tms"},domProps:{checked:Array.isArray(t.form.tilesTms)?t._i(t.form.tilesTms,null)>-1:t.form.tilesTms},on:{change:[function(e){var i=t.form.tilesTms,s=e.target,n=!!s.checked;if(Array.isArray(i)){var r=null,o=t._i(i,r);s.checked?o<0&&t.$set(t.form,"tilesTms",i.concat([r])):o>-1&&t.$set(t.form,"tilesTms",i.slice(0,o).concat(i.slice(o+1)))}else t.$set(t.form,"tilesTms",n)},function(e){return t.updateTilesInfo()}]}}),t._v(" TMS 顺序(Y 轴从下往上)")]),e("div",{staticClass:"hint",attrs:{id:"tiles-info"}},[t._v(t._s(t.form.tilesInfo))]),e("p",{staticClass:"tip"},[t._v("大多数切片XYZ使用 EPSG:3857(网络墨卡托)网格。")])]),e("div",{staticClass:"tab-pane",class:{active:"geojson"===t.currentTab},attrs:{id:"tab-geojson"}},[e("label",{staticClass:"file-btn"},[t._v(" 选择 GeoJSON + SLD 目录(同名配对) "),e("input",{ref:"geojsonDir",attrs:{type:"file",id:"geojson-dir",webkitdirectory:"",directory:"",multiple:"",hidden:""}})]),e("div",{staticClass:"file-name",attrs:{id:"geojson-dir-name"}},[t._v(t._s(t.form.geojsonDirName))]),e("div",{staticClass:"hint",attrs:{id:"geojson-crs-hint"}},[t.form.geojsonCrsHint?e("span",[t._v(t._s(t.form.geojsonCrsHint))]):t._e(),t._l(t.form.geojsonCrsOptions,function(i){return e("button",{key:i.code,staticClass:"chip",attrs:{type:"button"},on:{click:function(e){t.form.dataCrs=i.code}}},[t._v(t._s(i.label))])})],2),e("div",{staticClass:"hint",attrs:{id:"geojson-info"}},[t._v(t._s(t.form.geojsonInfo))])]),e("div",{staticClass:"tab-pane",class:{active:"url"===t.currentTab},attrs:{id:"tab-url"}},[e("label",[t._v("在线切片XYZ URL 模板 "),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlTemplate,expression:"form.urlTemplate"}],attrs:{type:"text",id:"url-template",placeholder:"https://example.com/tiles/{z}/{x}/{y}.png",spellcheck:"false"},domProps:{value:t.form.urlTemplate},on:{change:t.updateUrlTemplateHint,input:function(e){e.target.composing||t.$set(t.form,"urlTemplate",e.target.value)}}})]),e("div",{staticClass:"zoom-range"},[e("label",[t._v("最小层级"),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlMinzoom,expression:"form.urlMinzoom"}],attrs:{type:"number",id:"url-minzoom",min:"0",max:"24",placeholder:"必填"},domProps:{value:t.form.urlMinzoom},on:{input:function(e){e.target.composing||t.$set(t.form,"urlMinzoom",e.target.value)}}})]),e("label",[t._v("最大层级"),e("input",{directives:[{name:"model",rawName:"v-model",value:t.form.urlMaxzoom,expression:"form.urlMaxzoom"}],attrs:{type:"number",id:"url-maxzoom",min:"0",max:"24",placeholder:"必填"},domProps:{value:t.form.urlMaxzoom},on:{input:function(e){e.target.composing||t.$set(t.form,"urlMaxzoom",e.target.value)}}})])]),e("label",[t._v("范围"),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.urlExtentCrs,expression:"form.urlExtentCrs"}],attrs:{id:"url-extent-crs"},on:{change:function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"urlExtentCrs",e.target.multiple?i:i[0])}}},[t._l(t.crsOptions.urlExtentCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name)+" ")])}),0):t._e()],2)]),e("div",{staticClass:"extent-grid"},[e("label",[t._v("X 最小(西)"),e("input",{ref:"urlExtMinx",attrs:{type:"number",id:"url-ext-minx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最小(南)"),e("input",{ref:"urlExtMiny",attrs:{type:"number",id:"url-ext-miny",step:"any",placeholder:"必填"}})]),e("label",[t._v("X 最大(东)"),e("input",{ref:"urlExtMaxx",attrs:{type:"number",id:"url-ext-maxx",step:"any",placeholder:"必填"}})]),e("label",[t._v("Y 最大(北)"),e("input",{ref:"urlExtMaxy",attrs:{type:"number",id:"url-ext-maxy",step:"any",placeholder:"必填"}})])]),e("div",{staticClass:"hint",attrs:{id:"url-info"}},[t._v(t._s(t.form.urlInfo))]),e("p",{staticClass:"tip"},[t._v("必须为完整 http(s) URL,模板变量 {z} {x} {y},TMS 用 {-y}。")])])]),e("section",{staticClass:"block"},[e("h2",[t._v("数据坐标系")]),e("select",{directives:[{name:"model",rawName:"v-model",value:t.form.dataCrs,expression:"form.dataCrs"}],attrs:{id:"data-crs"},on:{change:[function(e){var i=Array.prototype.filter.call(e.target.options,function(t){return t.selected}).map(function(t){var e="_value"in t?t._value:t.value;return e});t.$set(t.form,"dataCrs",e.target.multiple?i:i[0])},function(e){return t.updateTilesInfo()}]}},[t._l(t.crsOptions.dataCrs,function(i){return e("optgroup",{key:i.label,attrs:{label:i.label}},t._l(i.items,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0)}),t.customCrsOptions.length?e("optgroup",{attrs:{label:"自定义"}},t._l(t.customCrsOptions,function(i){return e("option",{key:i.code,domProps:{value:i.code}},[t._v(t._s(i.name))])}),0):t._e()],2),e("div",{staticClass:"custom-crs"},[e("div",{staticClass:"row"},[e("input",{ref:"customEpsg",attrs:{type:"number",id:"custom-epsg",min:"1",step:"1",placeholder:"EPSG 代码,如 4525"}}),e("button",{ref:"btnFetchEpsg",staticClass:"mini-btn",attrs:{id:"btn-fetch-epsg",type:"button"},on:{click:t.fetchAndRegisterEpsg}},[t._v("在线获取")])]),e("p",{staticClass:"tip"},[t._v("在线获取来自 epsg.io,需要联网。")])])]),e("button",{ref:"btnLoad",staticClass:"primary-btn",attrs:{id:"btn-load",type:"button"},on:{click:t.loadToMap}},[t._v("加载到地图")])])])]),e("footer",{attrs:{id:"statusbar"}},[e("span",{ref:"statusCoords",staticClass:"status-seg",attrs:{id:"status-coords"}}),e("span",{ref:"statusScale",staticClass:"status-seg",attrs:{id:"status-scale"}}),e("span",{staticClass:"status-seg",attrs:{id:"status-info"}},[t._v(t._s(t.statusInfo))])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.dropVisible,expression:"dropVisible"}],attrs:{id:"drop-overlay"}},[e("div",[t._v("松开鼠标,加载地图文件")])]),e("div",{directives:[{name:"show",rawName:"v-show",value:t.toastVisible,expression:"toastVisible"}],attrs:{id:"toast","data-type":t.toastType}},[t._v(t._s(t.toastText))])])},ii=[function(){var t=this,e=t._self._c;return e("div",{staticClass:"brand"},[e("span",{staticClass:"logo"},[t._v("🗺️")]),e("div",[e("h1",[t._v("地图查看器")]),e("p",[t._v("当前地图信息")])])])},function(){var t=this,e=t._self._c;return e("div",{staticClass:"brand"},[e("span",{staticClass:"logo"},[t._v("📥")]),e("div",[e("h1",[t._v("加载地图")]),e("p",[t._v("选择数据源并加载")])])])}];Re(),Ie(),Ae(),Le(),Oe(),ke(),Fe(),De(),ze(),je(),Ue(),Be(),We(),Xe(),Ve(),qe(),Ye();var si={ADD:"add",REMOVE:"remove"},ni={PROPERTYCHANGE:"propertychange"};function ri(t){for(const e in t)delete t[e]}function oi(t){let e;for(e in t)return!1;return!e}function ai(t,e,i,s,n){if(n){const n=i;i=function(r){return t.removeEventListener(e,i),n.call(s??this,r)}}else s&&s!==t&&(i=i.bind(s));const r={target:t,type:e,listener:i};return t.addEventListener(e,i),r}function hi(t,e,i,s){return ai(t,e,i,s,!0)}function li(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),ri(t))}var ci={CHANGE:"change",ERROR:"error",BLUR:"blur",CLEAR:"clear",CONTEXTMENU:"contextmenu",CLICK:"click",DBLCLICK:"dblclick",DRAGENTER:"dragenter",DRAGOVER:"dragover",DROP:"drop",FOCUS:"focus",KEYDOWN:"keydown",KEYPRESS:"keypress",KEYUP:"keyup",LOAD:"load",RESIZE:"resize",TOUCHMOVE:"touchmove",WHEEL:"wheel"};class ui{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}}var di=ui;function gi(t,e,i){let s,n;i=i||fi;let r=0,o=t.length,a=!1;while(r<o)s=r+(o-r>>1),n=+i(t[s],e),n<0?r=s+1:(o=s,a=!n);return a?r:~r}function fi(t,e){return t>e?1:t<e?-1:0}function pi(t,e){return t<e?1:t>e?-1:0}function _i(t,e,i){if(t[0]<=e)return 0;const s=t.length;if(e<=t[s-1])return s-1;if("function"===typeof i){for(let n=1;n<s;++n){const s=t[n];if(s===e)return n;if(s<e)return i(e,t[n-1],s)>0?n-1:n}return s-1}if(i>0){for(let i=1;i<s;++i)if(t[i]<e)return i-1;return s-1}if(i<0){for(let i=1;i<s;++i)if(t[i]<=e)return i;return s-1}for(let n=1;n<s;++n){if(t[n]==e)return n;if(t[n]<e)return t[n-1]-e<e-t[n]?n-1:n}return s-1}function mi(t,e,i){while(e<i){const s=t[e];t[e]=t[i],t[i]=s,++e,--i}}function yi(t,e){const i=Array.isArray(e)?e:[e],s=i.length;for(let n=0;n<s;n++)t[t.length]=i[n]}function vi(t,e){const i=t.length;if(i!==e.length)return!1;for(let s=0;s<i;s++)if(t[s]!==e[s])return!1;return!0}function xi(t,e,i){const s=e||fi;return t.every(function(e,n){if(0===n)return!0;const r=s(t[n-1],e);return!(r>0||i&&0===r)})}function wi(){throw new Error("Unimplemented abstract method.")}let Ei=0;function Mi(t){const e=t;return e.ol_uid||(e.ol_uid=String(++Ei))}function Si(t){return!!t&&"function"===typeof t.then&&"function"===typeof t.catch}function Ci(){return!0}function bi(){return!1}function Pi(){}function Ri(t){let e,i,s;return function(){const n=Array.prototype.slice.call(arguments);return i&&this===s&&vi(n,i)||(s=this,i=n,e=t.apply(this,n)),e}}function Ii(t){function e(){let e;try{e=t()}catch(i){return Promise.reject(i)}return Si(e)?e:Promise.resolve(e)}return e()}class Ti{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}}var Ai=Ti;class Li extends di{constructor(t){super(),this.eventTarget_=t,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(t,e){if(!t||!e)return;const i=this.listeners_||(this.listeners_={}),s=i[t]||(i[t]=[]);s.includes(e)||s.push(e)}dispatchEvent(t){const e="string"===typeof t,i=e?t:t.type,s=this.listeners_&&this.listeners_[i];if(!s)return;const n=e?new Ai(t):t;n.target||(n.target=this.eventTarget_||this);const r=this.dispatching_||(this.dispatching_={}),o=this.pendingRemovals_||(this.pendingRemovals_={});let a;i in r||(r[i]=0,o[i]=0),++r[i];for(let h=0,l=s.length;h<l;++h)if(a="handleEvent"in s[h]?s[h].handleEvent(n):s[h].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];delete o[i];while(t--)this.removeEventListener(i,Pi);delete r[i]}return a}disposeInternal(){this.listeners_&&ri(this.listeners_)}getListeners(t){return this.listeners_&&this.listeners_[t]||void 0}hasListener(t){return!!this.listeners_&&(t?t in this.listeners_:Object.keys(this.listeners_).length>0)}removeEventListener(t,e){if(!this.listeners_)return;const i=this.listeners_[t];if(!i)return;const s=i.indexOf(e);-1!==s&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[s]=Pi,++this.pendingRemovals_[t]):(i.splice(s,1),0===i.length&&delete this.listeners_[t]))}}var Oi=Li;class Gi extends Oi{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ci.CHANGE)}getRevision(){return this.revision_}onInternal(t,e){if(Array.isArray(t)){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=ai(this,t[n],e);return s}return ai(this,t,e)}onceInternal(t,e){let i;if(Array.isArray(t)){const s=t.length;i=new Array(s);for(let n=0;n<s;++n)i[n]=hi(this,t[n],e)}else i=hi(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)ki(i);else if(Array.isArray(t))for(let s=0,n=t.length;s<n;++s)this.removeEventListener(t[s],e);else this.removeEventListener(t,e)}}function ki(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)li(t[e]);else li(t)}Gi.prototype.on,Gi.prototype.once,Gi.prototype.un;var Ni=Gi;class Fi extends Ai{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}class Di extends Ni{constructor(t){super(),this.on,this.once,this.un,Mi(this),this.values_=null,void 0!==t&&this.setProperties(t)}get(t){let e;return this.values_&&this.values_.hasOwnProperty(t)&&(e=this.values_[t]),e}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(t,e){let i;i=`change:${t}`,this.hasListener(i)&&this.dispatchEvent(new Fi(i,t,e)),i=ni.PROPERTYCHANGE,this.hasListener(i)&&this.dispatchEvent(new Fi(i,t,e))}addChangeListener(t,e){this.addEventListener(`change:${t}`,e)}removeChangeListener(t,e){this.removeEventListener(`change:${t}`,e)}set(t,e,i){const s=this.values_||(this.values_={});if(i)s[t]=e;else{const i=s[t];s[t]=e,i!==e&&this.notify(t,i)}}setProperties(t,e){for(const i in t)this.set(i,t[i],e)}applyProperties(t){t.values_&&Object.assign(this.values_||(this.values_={}),t.values_)}unset(t,e){if(this.values_&&t in this.values_){const i=this.values_[t];delete this.values_[t],oi(this.values_)&&(this.values_=null),e||this.notify(t,i)}}}var ji=Di;const zi={LENGTH:"length"};class Ui extends Ai{constructor(t,e,i){super(t),this.element=e,this.index=i}}class Bi extends ji{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let i=1,s=this.array_.length;i<s;++i)this.assertUnique_(this.array_[i],i);this.updateLength_()}clear(){while(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.array_;for(let i=0,s=e.length;i<s;++i)t(e[i],i,e)}getArray(){return this.array_}item(t){return this.array_[t]}getLength(){return this.get(zi.LENGTH)}insertAt(t,e){if(t<0||t>this.getLength())throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e),this.array_.splice(t,0,e),this.updateLength_(),this.dispatchEvent(new Ui(si.ADD,e,t))}pop(){return this.removeAt(this.getLength()-1)}push(t){const e=this.getLength();return this.insertAt(e,t),this.getLength()}remove(t){const e=this.array_;for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return this.removeAt(i)}removeAt(t){if(t<0||t>=this.getLength())return;const e=this.array_[t];return this.array_.splice(t,1),this.updateLength_(),this.dispatchEvent(new Ui(si.REMOVE,e,t)),e}setAt(t,e){const i=this.getLength();if(t>=i)return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const s=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Ui(si.REMOVE,s,t)),this.dispatchEvent(new Ui(si.ADD,e,t))}updateLength_(){this.set(zi.LENGTH,this.array_.length)}assertUnique_(t,e){const i=this.array_;for(let s=0,n=i.length;s<n;++s)if(i[s]===t&&s!==e)throw new Error("Duplicate item added to a unique collection")}}var Wi=Bi;class Xi extends Ai{constructor(t,e,i){super(t),this.map=e,this.frameState=void 0!==i?i:null}}var Vi=Xi;class qi extends Vi{constructor(t,e,i,s,n,r){super(t,e,n),this.originalEvent=i,this.pixel_=null,this.coordinate_=null,this.dragging=void 0!==s&&s,this.activePointers=r,this.ctrlKey=!1}get pixel(){return this.pixel_||(this.pixel_=this.map.getEventPixel(this.originalEvent)),this.pixel_}set pixel(t){this.pixel_=t}get coordinate(){return this.coordinate_||(this.coordinate_=this.map.getCoordinateFromPixel(this.pixel)),this.coordinate_}set coordinate(t){this.coordinate_=t}preventDefault(){super.preventDefault(),"preventDefault"in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),"stopPropagation"in this.originalEvent&&this.originalEvent.stopPropagation()}}var Yi=qi,Ki={SINGLECLICK:"singleclick",CLICK:ci.CLICK,DBLCLICK:ci.DBLCLICK,POINTERDRAG:"pointerdrag",POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};const Hi="undefined"!==typeof navigator&&"undefined"!==typeof navigator.userAgent?navigator.userAgent.toLowerCase():"",$i=Hi.includes("safari")&&!Hi.includes("chrom"),Zi=($i&&(Hi.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(Hi)),Hi.includes("webkit")&&!Hi.includes("edge")),Ji=Hi.includes("macintosh"),Qi="undefined"!==typeof devicePixelRatio?devicePixelRatio:1,ts="undefined"!==typeof WorkerGlobalScope&&"undefined"!==typeof OffscreenCanvas&&self instanceof WorkerGlobalScope,es="undefined"!==typeof Image&&Image.prototype.decode,is="function"===typeof createImageBitmap,ss=function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}return t}();var ns={POINTERMOVE:"pointermove",POINTERDOWN:"pointerdown",POINTERUP:"pointerup",POINTEROVER:"pointerover",POINTEROUT:"pointerout",POINTERENTER:"pointerenter",POINTERLEAVE:"pointerleave",POINTERCANCEL:"pointercancel"};class rs extends Oi{constructor(t,e){super(t),this.map_=t,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=void 0===e?1:e,this.down_=null;const i=this.map_.getViewport();if(!i)throw new Error("Map viewport is required");this.activePointers_=[],this.trackedTouches_={},this.element_=i,this.pointerdownListenerKey_=ai(i,ns.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=ai(i,ns.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(ci.TOUCHMOVE,this.boundHandleTouchMove_,!!ss&&{passive:!1})}emulateClick_(t){let e=new Yi(Ki.CLICK,this.map_,t);this.dispatchEvent(e),void 0!==this.clickTimeoutId_?(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,e=new Yi(Ki.DBLCLICK,this.map_,t),this.dispatchEvent(e)):this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;const e=new Yi(Ki.SINGLECLICK,this.map_,t);this.dispatchEvent(e)},250)}updateActivePointers_(t){const e=t,i=e.pointerId;if(e.type==Ki.POINTERUP||e.type==Ki.POINTERCANCEL){delete this.trackedTouches_[i];for(const t in this.trackedTouches_)if(this.trackedTouches_[t].target!==e.target){delete this.trackedTouches_[t];break}}else e.type!=Ki.POINTERDOWN&&e.type!=Ki.POINTERMOVE||(this.trackedTouches_[i]=e);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(t){this.updateActivePointers_(t);const e=new Yi(Ki.POINTERUP,this.map_,t,void 0,void 0,this.activePointers_);this.dispatchEvent(e),this.emulateClicks_&&!e.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(t)&&this.down_&&this.emulateClick_(this.down_),0===this.activePointers_.length&&(this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(t){return 0===t.button}handlePointerDown_(t){this.emulateClicks_=0===this.activePointers_.length,this.updateActivePointers_(t);const e=new Yi(Ki.POINTERDOWN,this.map_,t,void 0,void 0,this.activePointers_);if(this.dispatchEvent(e),this.down_=new PointerEvent(t.type,t),Object.defineProperty(this.down_,"target",{writable:!1,value:t.target}),0===this.dragListenerKeys_.length){const t=this.map_.getOwnerDocument(),e=this.element_;if(!e)return;if(this.dragListenerKeys_.push(ai(t,Ki.POINTERMOVE,this.handlePointerMove_,this),ai(t,Ki.POINTERUP,this.handlePointerUp_,this),ai(e,Ki.POINTERCANCEL,this.handlePointerUp_,this)),e.getRootNode&&e.getRootNode()!==t){const t=e.getRootNode();this.dragListenerKeys_.push(ai(t,Ki.POINTERUP,this.handlePointerUp_,this))}}}handlePointerMove_(t){if(this.isMoving_(t)){this.updateActivePointers_(t),this.dragging_=!0;const e=new Yi(Ki.POINTERDRAG,this.map_,t,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(e)}}relayMoveEvent_(t){this.originalPointerMoveEvent_=t;const e=!(!this.down_||!this.isMoving_(t));this.dispatchEvent(new Yi(Ki.POINTERMOVE,this.map_,t,e))}handleTouchMove_(t){const e=this.originalPointerMoveEvent_;e&&!e.defaultPrevented||"boolean"===typeof t.cancelable&&!0!==t.cancelable||t.preventDefault()}isMoving_(t){const e=this.down_;return this.dragging_||null!==e&&(Math.abs(t.clientX-e.clientX)>this.moveTolerance_||Math.abs(t.clientY-e.clientY)>this.moveTolerance_)}disposeInternal(){const t=this.element_;this.relayedListenerKey_&&(li(this.relayedListenerKey_),this.relayedListenerKey_=void 0),t&&t.removeEventListener(ci.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(li(this.pointerdownListenerKey_),this.pointerdownListenerKey_=void 0),this.dragListenerKeys_.forEach(li),this.dragListenerKeys_.length=0,this.element_=void 0,super.disposeInternal()}}var os=rs,as={POSTRENDER:"postrender",MOVESTART:"movestart",MOVEEND:"moveend",LOADSTART:"loadstart",LOADEND:"loadend"},hs={LAYERGROUP:"layergroup",SIZE:"size",TARGET:"target",VIEW:"view"},ls={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function cs(t,e){if(!t)throw new Error(e)}const us=1/0;class ds{constructor(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,ri(this.queuedElements_)}dequeue(){const t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));const s=this.keyFunction_(i);return delete this.queuedElements_[s],i}enqueue(t){cs(!(this.keyFunction_(t)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");const e=this.priorityFunction_(t);return e!=us&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(t){return 2*t+1}getRightChildIndex_(t){return 2*t+2}getParentIndex_(t){return t-1>>1}heapify_(){let t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)}isEmpty(){return 0===this.elements_.length}isKeyQueued(t){return t in this.queuedElements_}isQueued(t){return this.isKeyQueued(this.keyFunction_(t))}siftUp_(t){const e=this.elements_,i=this.priorities_,s=e.length,n=e[t],r=i[t],o=t;while(t<s>>1){const n=this.getLeftChildIndex_(t),r=this.getRightChildIndex_(t),o=r<s&&i[r]<i[n]?r:n;e[t]=e[o],i[t]=i[o],t=o}e[t]=n,i[t]=r,this.siftDown_(o,t)}siftDown_(t,e){const i=this.elements_,s=this.priorities_,n=i[e],r=s[e];while(e>t){const t=this.getParentIndex_(e);if(!(s[t]>r))break;i[e]=i[t],s[e]=s[t],e=t}i[e]=n,s[e]=r}reprioritize(){const t=this.priorityFunction_,e=this.elements_,i=this.priorities_;let s=0;const n=e.length;let r,o,a;for(o=0;o<n;++o)r=e[o],a=t(r),a==us?delete this.queuedElements_[this.keyFunction_(r)]:(i[s]=a,e[s++]=r);e.length=s,i.length=s,this.heapify_()}}var gs=ds;class fs extends gs{constructor(t,e){super(e=>t.apply(null,e),t=>t[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=e,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(t){const e=super.enqueue(t);if(e){const e=t[0];e.addEventListener(ci.CHANGE,this.boundHandleTileChange_)}return e}getTilesLoading(){return this.tilesLoading_}handleTileChange(t){const e=t.target,i=e.getState();if(i===ls.LOADED||i===ls.ERROR||i===ls.EMPTY){i!==ls.ERROR&&e.removeEventListener(ci.CHANGE,this.boundHandleTileChange_);const t=e.getKey();t in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[t],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(t,e){let i=0;while(this.tilesLoading_<t&&i<e&&this.getCount()>0){const t=this.dequeue()[0],e=t.getKey(),s=t.getState();s!==ls.IDLE||e in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[e]=!0,++this.tilesLoading_,++i,t.load())}}}var ps=fs;function _s(t,e,i,s,n){if(!t||!(i in t.wantedTiles))return us;if(!t.wantedTiles[i][e.getKey()])return us;const r=t.viewState.center,o=s[0]-r[0],a=s[1]-r[1];return 65536*Math.log(n)+Math.sqrt(o*o+a*a)/n}var ms={ANIMATING:0,INTERACTING:1},ys={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function vs(t,e,i){return Math.min(Math.max(t,e),i)}function xs(t,e,i,s,n,r){const o=n-i,a=r-s;if(0!==o||0!==a){const h=((t-i)*o+(e-s)*a)/(o*o+a*a);h>1?(i=n,s=r):h>0&&(i+=o*h,s+=a*h)}return ws(t,e,i,s)}function ws(t,e,i,s){const n=i-t,r=s-e;return n*n+r*r}function Es(t){const e=t.length;for(let s=0;s<e;s++){let i=s,n=Math.abs(t[s][s]);for(let o=s+1;o<e;o++){const e=Math.abs(t[o][s]);e>n&&(n=e,i=o)}if(0===n)return null;const r=t[i];t[i]=t[s],t[s]=r;for(let o=s+1;o<e;o++){const i=-t[o][s]/t[s][s];for(let n=s;n<e+1;n++)s==n?t[o][n]=0:t[o][n]+=i*t[s][n]}}const i=new Array(e);for(let s=e-1;s>=0;s--){i[s]=t[s][e]/t[s][s];for(let n=s-1;n>=0;n--)t[n][e]-=t[n][s]*i[s]}return i}function Ms(t){return 180*t/Math.PI}function Ss(t){return t*Math.PI/180}function Cs(t,e){const i=t%e;return i*e<0?i+e:i}function bs(t,e,i){return t+i*(e-t)}function Ps(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function Rs(t,e){return Math.floor(Ps(t,e))}function Is(t,e){return Math.ceil(Ps(t,e))}function Ts(t,e,i){if(t>=e&&t<i)return t;const s=i-e;return((t-e)%s+s)%s+e}function As(t,e,i){return function(s,n,r,o,a){if(!s)return;if(!n&&!e)return s;const h=e?0:r[0]*(n??0),l=e?0:r[1]*(n??0),c=a?a[0]:0,u=a?a[1]:0;let d=t[0]+h/2+c,g=t[2]-h/2+c,f=t[1]+l/2+u,p=t[3]-l/2+u;d>g&&(d=(g+d)/2,g=d),f>p&&(f=(p+f)/2,p=f);let _=vs(s[0],d,g),m=vs(s[1],f,p);if(o&&i&&n){const t=30*n;_+=-t*Math.log(1+Math.max(0,d-s[0])/t)+t*Math.log(1+Math.max(0,s[0]-g)/t),m+=-t*Math.log(1+Math.max(0,f-s[1])/t)+t*Math.log(1+Math.max(0,s[1]-p)/t)}return[_,m]}}function Ls(t){return t}var Os={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function Gs(t){const e=Ws();for(let i=0,s=t.length;i<s;++i)$s(e,t[i]);return e}function ks(t,e,i){const s=Math.min.apply(null,t),n=Math.min.apply(null,e),r=Math.max.apply(null,t),o=Math.max.apply(null,e);return Xs(s,n,r,o,i)}function Ns(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 Fs(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t.slice()}function Ds(t,e,i){let s,n;return s=e<t[0]?t[0]-e:t[2]<e?e-t[2]:0,n=i<t[1]?t[1]-i:t[3]<i?i-t[3]:0,s*s+n*n}function js(t,e){return Us(t,e[0],e[1])}function zs(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function Us(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Bs(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=e[0],a=e[1];let h=Os.UNKNOWN;return o<i?h|=Os.LEFT:o>n&&(h|=Os.RIGHT),a<s?h|=Os.BELOW:a>r&&(h|=Os.ABOVE),h===Os.UNKNOWN&&(h=Os.INTERSECTING),h}function Ws(){return[1/0,1/0,-1/0,-1/0]}function Xs(t,e,i,s,n){return n?(n[0]=t,n[1]=e,n[2]=i,n[3]=s,n):[t,e,i,s]}function Vs(t){return Xs(1/0,1/0,-1/0,-1/0,t)}function qs(t,e){const i=t[0],s=t[1];return Xs(i,s,i,s,e)}function Ys(t,e,i,s,n){const r=Vs(n);return Zs(r,t,e,i,s)}function Ks(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Hs(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 $s(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 Zs(t,e,i,s,n){for(;i<s;i+=n)Js(t,e[i],e[i+1]);return t}function Js(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 Qs(t,e){let i;return i=e(en(t)),i||(i=e(sn(t)),i||(i=e(dn(t)),i||(i=e(un(t)),i||!1)))}function tn(t){let e=0;return pn(t)||(e=gn(t)*hn(t)),e}function en(t){return[t[0],t[1]]}function sn(t){return[t[2],t[1]]}function nn(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function rn(t,e){let i;if("bottom-left"===e)i=en(t);else if("bottom-right"===e)i=sn(t);else if("top-left"===e)i=un(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=dn(t)}return i}function on(t,e,i,s,n){const[r,o,a,h,l,c,u,d]=an(t,e,i,s);return Xs(Math.min(r,a,l,u),Math.min(o,h,c,d),Math.max(r,a,l,u),Math.max(o,h,c,d),n)}function an(t,e,i,s){const n=e*s[0]/2,r=e*s[1]/2,o=Math.cos(i),a=Math.sin(i),h=n*o,l=n*a,c=r*o,u=r*a,d=t[0],g=t[1];return[d-h+u,g-l-c,d-h-u,g-l+c,d+h-u,g+l+c,d+h+u,g+l-c,d-h+u,g-l-c]}function hn(t){return t[3]-t[1]}function ln(t,e,i){const s=i||Ws();return fn(t,e)?(t[0]>e[0]?s[0]=t[0]:s[0]=e[0],t[1]>e[1]?s[1]=t[1]:s[1]=e[1],t[2]<e[2]?s[2]=t[2]:s[2]=e[2],t[3]<e[3]?s[3]=t[3]:s[3]=e[3]):Vs(s),s}function cn(t,e){if(!fn(t,e))return[t.slice()];if(zs(e,t))return[];const[i,s,n,r]=t,o=Math.max(i,e[0]),a=Math.max(s,e[1]),h=Math.min(n,e[2]),l=Math.min(r,e[3]),c=[];return o>i&&c.push([i,s,o,r]),h<n&&c.push([h,s,n,r]),a>s&&c.push([o,s,h,a]),l<r&&c.push([o,l,h,r]),c}function un(t){return[t[0],t[3]]}function dn(t){return[t[2],t[3]]}function gn(t){return t[2]-t[0]}function fn(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function pn(t){return t[2]<t[0]||t[3]<t[1]}function _n(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}function mn(t,e,i){let s=!1;const n=Bs(t,e),r=Bs(t,i);if(n===Os.INTERSECTING||r===Os.INTERSECTING)s=!0;else{const o=t[0],a=t[1],h=t[2],l=t[3],c=e[0],u=e[1],d=i[0],g=i[1],f=(g-u)/(d-c);let p,_;r&Os.ABOVE&&!(n&Os.ABOVE)&&(p=d-(g-l)/f,s=p>=o&&p<=h),s||!(r&Os.RIGHT)||n&Os.RIGHT||(_=g-(d-h)*f,s=_>=a&&_<=l),s||!(r&Os.BELOW)||n&Os.BELOW||(p=d-(g-a)/f,s=p>=o&&p<=h),s||!(r&Os.LEFT)||n&Os.LEFT||(_=g-(d-o)*f,s=_>=a&&_<=l)}return s}function yn(t,e,i,s){if(pn(t))return Vs(i);let n=[];if(void 0!==s&&s>1){const e=t[2]-t[0],i=t[3]-t[1];for(let r=0;r<s;++r)n.push(t[0]+e*r/s,t[1],t[2],t[1]+i*r/s,t[2]-e*r/s,t[3],t[0],t[3]-i*r/s)}else n=[t[0],t[1],t[2],t[1],t[2],t[3],t[0],t[3]];e(n,n,2);const r=[],o=[];for(let a=0,h=n.length;a<h;a+=2)r.push(n[a]),o.push(n[a+1]);return ks(r,o,i)}function vn(t,e){const i=e.getExtent(),s=nn(t);if(e.canWrapX()&&(s[0]<i[0]||s[0]>=i[2])){const e=gn(i),n=Math.floor((s[0]-i[0])/e),r=n*e;t[0]-=r,t[2]-=r}return t}function xn(t,e,i){if(e.canWrapX()){const s=e.getExtent();if(!isFinite(t[0])||!isFinite(t[2]))return[[s[0],t[1],s[2],t[3]]];vn(t,e);const n=gn(s);if(gn(t)>n&&!i)return[[s[0],t[1],s[2],t[3]]];if(t[0]<s[0])return[[t[0]+n,t[1],s[2],t[3]],[s[0],t[1],t[2],t[3]]];if(t[2]>s[2])return[[t[0],t[1],s[2],t[3]],[s[0],t[1],t[2]-n,t[3]]]}return[t]}function wn(t,e){let i=[t];for(let s=0,n=e.length;s<n&&i.length>0;++s){const t=[];for(let n=0,r=i.length;n<r;++n)t.push(...cn(i[n],e[s]));i=t}return i}function En(t,e){return t[0]+=+e[0],t[1]+=+e[1],t}function Mn(t,e){let i=!0;for(let s=t.length-1;s>=0;--s)if(t[s]!=e[s]){i=!1;break}return i}function Sn(t,e){const i=Math.cos(e),s=Math.sin(e),n=t[0]*i-t[1]*s,r=t[1]*i+t[0]*s;return t[0]=n,t[1]=r,t}function Cn(t,e){return t[0]*=e,t[1]*=e,t}function bn(t,e){if(e.canWrapX()){const i=gn(e.getExtent()),s=Rn(t,e,i);s&&(t[0]-=s*i)}return t}function Pn(t,e,i){if(e.canWrapX()){const s=gn(e.getExtent()),n=Math.round((i-t[0])/s);0!==n&&(t[0]+=n*s)}return t}function Rn(t,e,i){const s=e.getExtent();let n=0;return e.canWrapX()&&(t[0]<s[0]||t[0]>s[2])&&(i=i||gn(s),n=Math.floor((t[0]-s[0])/i)),n}function In(t,e,i){const s=Math.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),n=[(e[0]-t[0])/s,(e[1]-t[1])/s],r=[-n[1],n[0]],o=Math.sqrt((i[0]-t[0])*(i[0]-t[0])+(i[1]-t[1])*(i[1]-t[1])),a=[(i[0]-t[0])/o,(i[1]-t[1])/o];let h=0===s||0===o?0:Math.acos(vs(a[0]*n[0]+a[1]*n[1],-1,1));h=Math.max(h,1e-5);const l=a[0]*r[0]+a[1]*r[1]>0;return l?h:2*Math.PI-h}function Tn(t){return Math.pow(t,3)}function An(t){return 1-Tn(1-t)}function Ln(t){return 3*t*t-2*t*t*t}function On(t){return t}const Gn={info:1,warn:2,error:3,none:4};let kn=Gn.info;function Nn(...t){kn>Gn.warn||console.warn(...t)}const Fn={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937};class Dn{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Fn[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(t){this.defaultTileGrid_=t}setExtent(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)}setWorldExtent(t){this.worldExtent_=t}setGetPointResolution(t){this.getPointResolutionFunc_=t}getPointResolutionFunc(){return this.getPointResolutionFunc_}}var jn=Dn;const zn=6378137,Un=Math.PI*zn,Bn=[-Un,-Un,Un,Un],Wn=[-180,-85,180,85],Xn=zn*Math.log(Math.tan(Math.PI/2));class Vn extends jn{constructor(t){super({code:t,units:"m",extent:Bn,global:!0,worldExtent:Wn,getPointResolution:function(t,e){return t/Math.cosh(e[1]/zn)}})}}const qn=[new Vn("EPSG:3857"),new Vn("EPSG:102100"),new Vn("EPSG:102113"),new Vn("EPSG:900913"),new Vn("http://www.opengis.net/def/crs/EPSG/0/3857"),new Vn("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Yn(t,e,i,s){const n=t.length;i=void 0!==i&&i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=s){e[r]=Un*t[r]/180;let i=zn*Math.log(Math.tan(Math.PI*(+t[r+1]+90)/360));i>Xn?i=Xn:i<-Xn&&(i=-Xn),e[r+1]=i}return e}function Kn(t,e,i,s){const n=t.length;i=void 0!==i&&i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let r=0;r<n;r+=s)e[r]=180*t[r]/Un,e[r+1]=360*Math.atan(Math.exp(t[r+1]/zn))/Math.PI-90;return e}const Hn=6378137,$n=[-180,-90,180,90],Zn=Math.PI*Hn/180;class Jn extends jn{constructor(t,e){super({code:t,units:"degrees",extent:$n,axisOrientation:e,global:!0,metersPerUnit:Zn,worldExtent:$n})}}const Qn=[new Jn("CRS:84"),new Jn("EPSG:4326","neu"),new Jn("urn:ogc:def:crs:OGC:1.3:CRS84"),new Jn("urn:ogc:def:crs:OGC:2:84"),new Jn("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new Jn("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new Jn("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let tr={};function er(t){return tr[t]||tr[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}function ir(t,e){tr[t]=e}let sr={};function nr(t,e,i){const s=t.getCode(),n=e.getCode();s in sr||(sr[s]={}),sr[s][n]=i}function rr(t,e){return t in sr&&e in sr[t]?sr[t][e]:null}const or=.9996,ar=.00669438,hr=ar*ar,lr=hr*ar,cr=ar/(1-ar),ur=Math.sqrt(1-ar),dr=(1-ur)/(1+ur),gr=dr*dr,fr=gr*dr,pr=fr*dr,_r=pr*dr,mr=1-ar/4-3*hr/64-5*lr/256,yr=3*ar/8+3*hr/32+45*lr/1024,vr=15*hr/256+45*lr/1024,xr=35*lr/3072,wr=1.5*dr-27/32*fr+269/512*_r,Er=21/16*gr-55/32*pr,Mr=151/96*fr-417/128*_r,Sr=1097/512*pr,Cr=6378137;function br(t,e,i){const s=t-5e5,n=i.north?e:e-1e7,r=n/or,o=r/(Cr*mr),a=o+wr*Math.sin(2*o)+Er*Math.sin(4*o)+Mr*Math.sin(6*o)+Sr*Math.sin(8*o),h=Math.sin(a),l=h*h,c=Math.cos(a),u=h/c,d=u*u,g=d*d,f=1-ar*l,p=Math.sqrt(1-ar*l),_=Cr/p,m=(1-ar)/f,y=cr*c**2,v=y*y,x=s/(_*or),w=x*x,E=w*x,M=E*x,S=M*x,C=S*x,b=a-u/m*(w/2-M/24*(5+3*d+10*y-4*v-9*cr))+C/720*(61+90*d+298*y+45*g-252*cr-3*v);let P=(x-E/6*(1+2*d+y)+S/120*(5-2*y+28*d-3*v+8*cr+24*g))/c;return P=Ts(P+Ss(Lr(i.number)),-Math.PI,Math.PI),[Ms(P),Ms(b)]}const Pr=-80,Rr=84,Ir=-180,Tr=180;function Ar(t,e,i){t=Ts(t,Ir,Tr),e<Pr?e=Pr:e>Rr&&(e=Rr);const s=Ss(e),n=Math.sin(s),r=Math.cos(s),o=n/r,a=o*o,h=a*a,l=Ss(t),c=Lr(i.number),u=Ss(c),d=Cr/Math.sqrt(1-ar*n**2),g=cr*r**2,f=r*Ts(l-u,-Math.PI,Math.PI),p=f*f,_=p*f,m=_*f,y=m*f,v=y*f,x=Cr*(mr*s-yr*Math.sin(2*s)+vr*Math.sin(4*s)-xr*Math.sin(6*s)),w=or*d*(f+_/6*(1-a+g)+y/120*(5-18*a+h+72*g-58*cr))+5e5;let E=or*(x+d*o*(p/2+m/24*(5-a+9*g+4*g**2)+v/720*(61-58*a+h+600*g-330*cr)));return i.north||(E+=1e7),[w,E]}function Lr(t){return 6*(t-1)-180+3}const Or=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function Gr(t){let e=0;for(const n of Or){const i=t.match(n);if(i){e=parseInt(i[1]);break}}if(!e)return null;let i=0,s=!1;return e>32700&&e<32761?i=e-32700:e>32600&&e<32661&&(s=!0,i=e-32600),i?{number:i,north:s}:null}function kr(t,e){return function(i,s,n,r){const o=i.length;n=void 0!==n&&n>1?n:2,r=r??n,s||(s=n>2?i.slice():new Array(o));for(let a=0;a<o;a+=r){const n=i[a],r=i[a+1],o=t(n,r,e);s[a]=o[0],s[a+1]=o[1]}return s}}function Nr(t){const e=Gr(t);return e?new jn({code:t,units:"m"}):null}function Fr(t){const e=Gr(t.getCode());return e?{forward:kr(Ar,e),inverse:kr(br,e)}:null}const Dr=6371008.8;function jr(t,e,i){i=i||Dr;const s=Ss(t[1]),n=Ss(e[1]),r=(n-s)/2,o=Ss(e[0]-t[0])/2,a=Math.sin(r)*Math.sin(r)+Math.sin(o)*Math.sin(o)*Math.cos(s)*Math.cos(n);return 2*i*Math.atan2(Math.sqrt(a),Math.sqrt(1-a))}const zr=[Fr],Ur=[Nr];let Br=!0;function Wr(t){const e=void 0===t||t;Br=!e}function Xr(t,e){if(void 0!==e)for(let i=0,s=t.length;i<s;++i)e[i]=t[i];else e=t.slice();return e}function Vr(t,e){if(void 0!==e&&t!==e){for(let i=0,s=t.length;i<s;++i)e[i]=t[i];t=e}return t}function qr(t){ir(t.getCode(),t),nr(t,t,Xr)}function Yr(t){t.forEach(qr)}function Kr(t){if("string"!==typeof t)return void 0!==t?t:null;const e=er(t);if(e)return e;for(const i of Ur){const e=i(t);if(e)return e}return null}function Hr(t,e,i,s){const n=Kr(t);if(!n)return e;let r;const o=n.getPointResolutionFunc();if(o){if(r=o(e,i),s&&s!==n.getUnits()){const t=n.getMetersPerUnit();t&&(r=r*t/Fn[s])}}else{const t=n.getUnits();if("degrees"==t&&!s||"degrees"==s)r=e;else{const o=no(n,Kr("EPSG:4326"));if(o||"degrees"===t){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];o&&(t=o(t,t,2));const s=jr(t.slice(0,2),t.slice(2,4)),n=jr(t.slice(4,6),t.slice(6,8));r=(s+n)/2}else r=e*(n.getMetersPerUnit()??1);const a=s?Fn[s]:n.getMetersPerUnit();void 0!==a&&(r/=a)}}return r}function $r(t){Yr(t),t.forEach(function(e){t.forEach(function(t){e!==t&&nr(e,t,Xr)})})}function Zr(t,e,i,s){t.forEach(function(t){e.forEach(function(e){nr(t,e,i),nr(e,t,s)})})}function Jr(t,e){return t?"string"===typeof t?Kr(t):t:Kr(e)}function Qr(t){return function(e,i,s,n){const r=e.length;s=void 0!==s?s:2,n=n??s,i=void 0!==i?i:new Array(r);for(let o=0;o<r;o+=n){const r=t(e.slice(o,o+s)),a=r.length;for(let t=0,s=n;t<s;++t)i[o+t]=t>=a?e[o+t]:r[t]}return i}}function to(t,e,i,s){const n=Kr(t),r=Kr(e);n&&r&&(nr(n,r,Qr(i)),nr(r,n,Qr(s)))}function eo(t,e){return Wr(),ao(t,"EPSG:4326",void 0!==e?e:"EPSG:3857")}function io(t,e){const i=ao(t,void 0!==e?e:"EPSG:3857","EPSG:4326"),s=i[0];return(s<-180||s>180)&&(i[0]=Cs(s+180,360)-180),i}function so(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();if(t.getCode()===e.getCode())return i;const s=no(t,e);return s===Xr&&i}function no(t,e){if(!t||!e)return null;const i=t.getCode(),s=e.getCode();let n=rr(i,s);if(n)return n;let r=null,o=null;for(const h of zr)r||(r=h(t)),o||(o=h(e));if(!r&&!o)return null;const a="EPSG:4326";if(!o&&r){const t=rr(a,s);t&&(n=ro(r.inverse,t))}else if(!r&&o){const t=rr(i,a);t&&(n=ro(t,o.forward))}else r&&o&&(n=ro(r.inverse,o.forward));return n&&(qr(t),qr(e),nr(t,e,n)),n}function ro(t,e){return function(i,s,n,r){return s=t(i,s,n,r),e(s,s,n,r)}}function oo(t,e){const i=Kr(t),s=Kr(e);return no(i,s)}function ao(t,e,i){const s=oo(e,i);if(!s){const t=Kr(e)?.getCode()??String(e),s=Kr(i)?.getCode()??String(i);throw new Error(`No transform available between ${t} and ${s}`)}return s(t,void 0,t.length)}function ho(t,e,i,s){const n=oo(e,i);return n?yn(t,n,void 0,s):t.slice()}let lo=null;function co(){return lo}function uo(t,e){return lo?ao(t,e,lo):t}function go(t,e){return lo?ao(t,lo,e):(Br&&!Mn(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Br=!1,Nn("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t)}function fo(t,e){return lo?ho(t,e,lo):t}function po(t,e){return lo?ho(t,lo,e):t}function _o(t,e){if(!lo)return t;const i=Kr(e)?.getMetersPerUnit(),s=lo.getMetersPerUnit();return i&&s?t*i/s:t}function mo(t,e,i){return function(s){let n,r;if(t.canWrapX()){const e=t.getExtent(),o=gn(e);s=s.slice(0),r=Rn(s,t,o),r&&(s[0]=s[0]-r*o),s[0]=vs(s[0],e[0],e[2]),s[1]=vs(s[1],e[1],e[3]),n=i(s)}else n=i(s);return r&&e.canWrapX()&&(n[0]+=r*gn(e.getExtent())),n}}function yo(){$r(qn),$r(Qn),Zr(Qn,qn,Yn,Kn)}yo();const vo=[1,0,0,1,0,0];new Array(6);function xo(){return vo.slice(0)}function wo(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 Eo(t,e){const i=e[0],s=e[1];return e[0]=t[0]*i+t[2]*s+t[4],e[1]=t[1]*i+t[3]*s+t[5],e}function Mo(t,e,i,s,n,r,o,a){const h=Math.sin(r),l=Math.cos(r);return t[0]=s*l,t[1]=n*h,t[2]=-s*h,t[3]=n*l,t[4]=o*s*l-a*s*h+e,t[5]=o*n*h+a*n*l+i,t}function So(t,e){const i=Co(e);cs(0!==i,"Transformation matrix cannot be inverted");const s=e[0],n=e[1],r=e[2],o=e[3],a=e[4],h=e[5];return t[0]=o/i,t[1]=-n/i,t[2]=-r/i,t[3]=s/i,t[4]=(r*h-o*a)/i,t[5]=-(s*h-n*a)/i,t}function Co(t){return t[0]*t[3]-t[1]*t[2]}const bo=[1e5,1e5,1e5,1e5,2,2];function Po(t){const e="matrix("+t.join(", ")+")";return e}function Ro(t){const e=t.substring(7,t.length-1).split(",");return e.map(parseFloat)}function Io(t,e){const i=Ro(t),s=Ro(e);for(let n=0;n<6;++n)if(0!==Math.round((i[n]-s[n])*bo[n]))return!1;return!0}function To(t,e,i,s,n,r,o){r=r||[],o=o||2;let a=0;for(let h=e;h<i;h+=s){const e=t[h],i=t[h+1];r[a++]=n[0]*e+n[2]*i+n[4],r[a++]=n[1]*e+n[3]*i+n[5];for(let s=2;s<o;s++)r[a++]=t[h+s]}return r&&r.length!=a&&(r.length=a),r}function Ao(t,e,i,s,n,r,o){o=o||[];const a=Math.cos(n),h=Math.sin(n),l=r[0],c=r[1];let u=0;for(let d=e;d<i;d+=s){const e=t[d]-l,i=t[d+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let n=d+2;n<d+s;++n)o[u++]=t[n]}return o&&o.length!=u&&(o.length=u),o}function Lo(t,e,i,s,n,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let u=e;u<i;u+=s){const e=t[u]-h,i=t[u+1]-l;a[c++]=h+n*e,a[c++]=l+r*i;for(let n=u+2;n<u+s;++n)a[c++]=t[n]}return a&&a.length!=c&&(a.length=c),a}function Oo(t,e,i,s,n,r,o){o=o||[];let a=0;for(let h=e;h<i;h+=s){o[a++]=t[h]+n,o[a++]=t[h+1]+r;for(let e=h+2;e<h+s;++e)o[a++]=t[e]}return o&&o.length!=a&&(o.length=a),o}const Go=xo(),ko=[NaN,NaN];class No extends ji{constructor(){super(),this.extent_=Ws(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=Ri((t,e,i)=>{if(!i)return this.getSimplifiedGeometry(e);const s=this.clone();return s.applyTransform(i),s.getSimplifiedGeometry(e)})}simplifyTransformed(t,e){return this.simplifyTransformedInternal(this.getRevision(),t,e)}clone(){return wi()}closestPointXY(t,e,i,s){return wi()}containsXY(t,e){return 0===this.closestPointXY(t,e,ko,Number.MIN_VALUE)}getClosestPoint(t,e){return e=e||[NaN,NaN],this.closestPointXY(t[0],t[1],e,1/0),e}intersectsCoordinate(t){return this.containsXY(t[0],t[1])}computeExtent(t){return wi()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&Vs(t),this.extentRevision_=this.getRevision()}return _n(this.extent_,t)}rotate(t,e){wi()}scale(t,e,i){wi()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return wi()}getType(){return wi()}applyTransform(t){wi()}intersectsExtent(t){return wi()}translate(t,e){wi()}transform(t,e){const i=Kr(t);if(!i)return this;const s="tile-pixels"==i.getUnits()?function(t,s,n){const r=i.getExtent(),o=i.getWorldExtent(),a=hn(o)/hn(r);Mo(Go,o[0],o[3],a,-a,0,0,0);const h=To(t,0,t.length,n,Go,s),l=oo(i,e);return l?l(h,h,n):h}:oo(i,e);return s&&this.applyTransform(s),this}}var Fo=No;class Do extends Fo{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Ys(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return wi()}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),i=e.getFlatCoordinates();return i.length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=zo(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){wi()}setLayout(t,e,i){let s;if(t)s=zo(t);else{for(let t=0;t<i;++t){if(0===e.length)return this.layout="XY",void(this.stride=2);e=e[0]}s=e.length,t=jo(s)}this.layout=t,this.stride=s}applyTransform(t){this.flatCoordinates&&(t(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith("XYZ")?3:2,this.stride),this.changed())}rotate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Ao(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=nn(this.getExtent()));const s=this.getFlatCoordinates();if(s){const n=this.getStride();Lo(s,0,s.length,n,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();Oo(i,0,i.length,s,t,e,i),this.changed()}}}function jo(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function zo(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}function Uo(t,e,i){const s=t.getFlatCoordinates();if(!s)return null;const n=t.getStride();return To(s,0,s.length,n,e,i)}var Bo=Do;function Wo(t,e,i,s){let n=0;const r=t[i-s],o=t[i-s+1];let a=0,h=0;for(;e<i;e+=s){const i=t[e]-r,s=t[e+1]-o;n+=h*i-a*s,a=i,h=s}return n/2}function Xo(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Wo(t,e,o,s),e=o}return n}function Vo(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Xo(t,e,o,s),e=o[o.length-1]}return n}function qo(t,e,i,s,n,r,o){const a=t[e],h=t[e+1],l=t[i]-a,c=t[i+1]-h;let u;if(0===l&&0===c)u=e;else{const d=((n-a)*l+(r-h)*c)/(l*l+c*c);if(d>1)u=i;else{if(d>0){for(let n=0;n<s;++n)o[n]=bs(t[e+n],t[i+n],d);return void(o.length=s)}u=e}}for(let d=0;d<s;++d)o[d]=t[u+d];o.length=s}function Yo(t,e,i,s,n){let r=t[e],o=t[e+1];for(e+=s;e<i;e+=s){const i=t[e],s=t[e+1],a=ws(r,o,i,s);a>n&&(n=a),r=i,o=s}return n}function Ko(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Yo(t,e,o,s,n),e=o}return n}function Ho(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Ko(t,e,o,s,n),e=o[o.length-1]}return n}function $o(t,e,i,s,n,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===n){if(d=ws(o,a,t[e],t[e+1]),d<l){for(u=0;u<s;++u)h[u]=t[e+u];return h.length=s,d}return l}c=c||[NaN,NaN];let g=e+s;while(g<i)if(qo(t,g-s,g,s,o,a,c),d=ws(o,a,c[0],c[1]),d<l){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s,g+=s}else g+=s*Math.max((Math.sqrt(d)-Math.sqrt(l))/n|0,1);if(r&&(qo(t,i-s,e,s,o,a,c),d=ws(o,a,c[0],c[1]),d<l)){for(l=d,u=0;u<s;++u)h[u]=c[u];h.length=s}return l}function Zo(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=$o(t,e,d,s,n,r,o,a,h,l,c),e=d}return l}function Jo(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let u=0,d=i.length;u<d;++u){const d=i[u];l=Zo(t,e,d,s,n,r,o,a,h,l,c),e=d[d.length-1]}return l}function Qo(t,e,i,s){for(let n=0;n<s;++n)t[e++]=i[n];return e}function ta(t,e,i,s){for(let n=0,r=i.length;n<r;++n){const r=i[n];for(let i=0;i<s;++i)t[e++]=r[i]}return e}function ea(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ta(t,e,i[o],s);n[r++]=a,e=a}return n.length=r,n}function ia(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=ea(t,e,i[o],s,n[r]);0===a.length&&(a[0]=e),n[r++]=a,e=a[a.length-1]}return n.length=r,n}function sa(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=e;o<i;o+=s)n[r++]=t.slice(o,o+s);return n.length=r,n}function na(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=sa(t,e,a,s,n[r]),e=a}return n.length=r,n}function ra(t,e,i,s,n){n=void 0!==n?n:[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=i[o];n[r++]=1===a.length&&a[0]===e?[]:na(t,e,a,s,n[r]),e=a[a.length-1]}return n.length=r,n}function oa(t,e,i,s,n){const r=Qs(n,function(n){return!aa(t,e,i,s,n[0],n[1])});return!r}function aa(t,e,i,s,n,r){let o=0,a=t[i-s],h=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];h<=r?s>r&&(i-a)*(r-h)-(n-a)*(s-h)>0&&o++:s<=r&&(i-a)*(r-h)-(n-a)*(s-h)<0&&o--,a=i,h=s}return 0!==o}function ha(t,e,i,s,n,r){if(0===i.length)return!1;if(!aa(t,e,i[0],s,n,r))return!1;for(let o=1,a=i.length;o<a;++o)if(aa(t,i[o-1],i[o],s,n,r))return!1;return!0}function la(t,e,i,s,n,r){if(0===i.length)return!1;for(let o=0,a=i.length;o<a;++o){const a=i[o];if(ha(t,e,a,s,n,r))return!0;e=a[a.length-1]}return!1}function ca(t,e,i,s,n){let r;for(e+=s;e<i;e+=s)if(r=n(t.slice(e-s,e),t.slice(e,e+s)),r)return r;return!1}function ua(t,e,i,s,n,r){return r=r??Zs(Ws(),t,e,i,s),!!fn(n,r)&&(r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||ca(t,e,i,s,function(t,e){return mn(n,t,e)}))}function da(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){if(ua(t,e,i[r],s,n))return!0;e=i[r]}return!1}function ga(t,e,i,s,n){return!!ua(t,e,i,s,n)||(!!aa(t,e,i,s,n[0],n[1])||(!!aa(t,e,i,s,n[0],n[3])||(!!aa(t,e,i,s,n[2],n[1])||!!aa(t,e,i,s,n[2],n[3]))))}function fa(t,e,i,s,n){if(!ga(t,e,i[0],s,n))return!1;if(1===i.length)return!0;for(let r=1,o=i.length;r<o;++r)if(oa(t,i[r-1],i[r],s,n)&&!ua(t,i[r-1],i[r],s,n))return!1;return!0}function pa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(fa(t,e,o,s,n))return!0;e=o[o.length-1]}return!1}function _a(t,e,i,s,n,r,o){const a=(i-e)/s;if(a<3){for(;e<i;e+=s)r[o++]=t[e],r[o++]=t[e+1];return o}const h=new Array(a);h[0]=1,h[a-1]=1;const l=[e,i-s];let c=0;while(l.length>0){const i=l.pop(),r=l.pop();let o=0;const a=t[r],u=t[r+1],d=t[i],g=t[i+1];for(let e=r+s;e<i;e+=s){const i=t[e],s=t[e+1],n=xs(i,s,a,u,d,g);n>o&&(c=e,o=n)}o>n&&(h[(c-e)/s]=1,r+s<c&&l.push(r,c),c+s<i&&l.push(c,i))}for(let u=0;u<a;++u)h[u]&&(r[o++]=t[e+u*s],r[o++]=t[e+u*s+1]);return o}function ma(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=_a(t,e,l,s,n,r,o),a.push(o),e=l}return o}function ya(t,e){return e*Math.round(t/e)}function va(t,e,i,s,n,r,o){if(e==i)return o;let a,h,l=ya(t[e],n),c=ya(t[e+1],n);e+=s,r[o++]=l,r[o++]=c;do{if(a=ya(t[e],n),h=ya(t[e+1],n),e+=s,e==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);while(e<i){const i=ya(t[e],n),u=ya(t[e+1],n);if(e+=s,i==a&&u==h)continue;const d=a-l,g=h-c,f=i-l,p=u-c;d*p==g*f&&(d<0&&f<d||d==f||d>0&&f>d)&&(g<0&&p<g||g==p||g>0&&p>g)?(a=i,h=u):(r[o++]=a,r[o++]=h,l=a,c=h,a=i,h=u)}return r[o++]=a,r[o++]=h,o}function xa(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=va(t,e,l,s,n,r,o),a.push(o),e=l}return o}function wa(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h],c=[];o=xa(t,e,l,s,n,r,o,c),a.push(c),e=l[l.length-1]}return o}class Ea extends Bo{constructor(t,e){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}clone(){return new Ea(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$o(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Wo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=_a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Ea(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var Ma=Ea;class Sa extends Bo{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new Sa(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const n=this.flatCoordinates,r=ws(t,e,n[0],n[1]);if(r<s){const t=this.stride;for(let e=0;e<t;++e)i[e]=n[e];return i.length=t,r}return s}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(t){return qs(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return Us(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qo(this.flatCoordinates,0,t,this.stride),this.changed()}}var Ca=Sa;function ba(t,e,i,s,n,r,o){let a,h,l,c,u,d,g;const f=n[r+1],p=[];for(let y=0,v=i.length;y<v;++y){const n=i[y];for(c=t[n-s],d=t[n-s+1],a=e;a<n;a+=s)u=t[a],g=t[a+1],(f<=d&&g<=f||d<=f&&f<=g)&&(l=(f-d)/(g-d)*(u-c)+c,p.push(l)),c=u,d=g}let _=NaN,m=-1/0;for(p.sort(fi),c=p[0],a=1,h=p.length;a<h;++a){u=p[a];const n=Math.abs(u-c);n>m&&(l=(c+u)/2,ha(t,e,i,s,l,f)&&(_=l,m=n)),c=u}return isNaN(_)&&(_=n[r]),o?(o.push(_,f,m),o):[_,f,m]}function Pa(t,e,i,s,n){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=ba(t,e,a,s,n,2*o,r),e=a[a.length-1]}return r}function Ra(t,e,i,s){while(e<i-s){for(let n=0;n<s;++n){const r=t[e+n];t[e+n]=t[i-s+n],t[i-s+n]=r}e+=s,i-=s}}function Ia(t,e,i,s){let n=0,r=t[i-s],o=t[i-s+1];for(;e<i;e+=s){const i=t[e],s=t[e+1];n+=(i-r)*(s+o),r=i,o=s}return 0===n?void 0:n>0}function Ta(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ia(t,e,o,s);if(0===r){if(n&&a||!n&&!a)return!1}else if(n&&!a||!n&&a)return!1;e=o}return!0}function Aa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!Ta(t,e,o,s,n))return!1;o.length&&(e=o[o.length-1])}return!0}function La(t,e,i,s,n){n=void 0!==n&&n;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=Ia(t,e,o,s),h=0===r?n&&a||!n&&!a:n&&!a||!n&&a;h&&Ra(t,e,o,s),e=o}return e}function Oa(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=La(t,e,i[r],s,n);return e}function Ga(t,e){const i=[];let s,n=0,r=0;for(let o=0,a=e.length;o<a;++o){const a=e[o],h=Ia(t,n,a,2);if(void 0===s&&(s=h),h===s)i.push(e.slice(r,o+1));else{if(0===i.length)continue;i[i.length-1].push(e[r])}r=o+1,n=a}return i}class ka extends Bo{constructor(t,e,i){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,void 0!==e&&i?(this.setFlatCoordinates(e,t),this.ends_=i):this.setCoordinates(t,e)}appendLinearRing(t){this.flatCoordinates?yi(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new ka(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ko(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return ha(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Xo(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),La(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,na(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=nn(this.getExtent());this.flatInteriorPoint_=ba(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Ca(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new Ma(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLinearRings(){const t=this.layout,e=this.flatCoordinates,i=this.ends_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r],a=new Ma(e.slice(n,o),t);s.push(a),n=o}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Ta(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=La(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=xa(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new ka(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return fa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ea(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Na=ka;function Fa(t){if(pn(t))throw new Error("Cannot create polygon from empty extent");const e=t[0],i=t[1],s=t[2],n=t[3],r=[e,i,e,n,s,n,s,i,e,i];return new ka(r,"XY",[r.length])}function Da(t,e,i,s){const n=gn(e)/i[0],r=hn(e)/i[1];return s?Math.min(t,Math.max(n,r)):Math.min(t,Math.min(n,r))}function ja(t,e,i){let s=Math.min(t,e);const n=50;return s*=Math.log(1+n*Math.max(0,t/e-1))/n+1,i&&(s=Math.max(s,i),s/=Math.log(1+n*Math.max(0,i/t-1))/n+1),vs(s,i/2,2*e)}function za(t,e,i,s){return e=void 0===e||e,function(n,r,o,a){if(void 0!==n){const h=t[0],l=t[t.length-1],c=i?Da(h,i,o,!!s):h;if(a)return e?ja(n,c,l):vs(n,l,c);const u=Math.min(c,n),d=Math.floor(_i(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}function Ua(t,e,i,s,n,r){return s=void 0===s||s,i=void 0!==i?i:0,function(o,a,h,l){if(void 0!==o){const c=n?Da(e,n,h,!!r):e;if(l)return s?ja(o,c,i):vs(o,i,c);const u=1e-9,d=Math.ceil(Math.log(e/c)/Math.log(t)-u),g=-a*(.5-u)+.5,f=Math.min(c,o),p=Math.floor(Math.log(e/f)/Math.log(t)+g),_=Math.max(d,p),m=e/Math.pow(t,_);return vs(m,i,c)}}}function Ba(t,e,i,s,n){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=s?Da(t,s,a,!!n):t;return i&&h?ja(r,o,e):vs(r,e,o)}}}function Wa(t){if(void 0!==t)return 0}function Xa(t){if(void 0!==t)return t}function Va(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?(t=Math.floor(t/e+.5)*e,t):void 0}}function qa(t){const e=void 0===t?Ss(5):t;return function(t,i){return i||void 0===t?t:Math.abs(t)<=e?0:t}}const Ya=0;class Ka extends ji{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Jr(t.projection,"EPSG:3857"),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,t.projection&&Wr(),t.center&&(t.center=go(t.center,this.projection_)),t.extent&&(t.extent=po(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const o in ys)delete e[o];this.setProperties(e,!0);const i=Za(t);this.maxResolution_=i.maxResolution,this.minResolution_=i.minResolution,this.zoomFactor_=i.zoomFactor,this.resolutions_=t.resolutions,this.padding_=t.padding,this.minZoom_=i.minZoom;const s=$a(t),n=i.constraint,r=Ja(t);this.constraints_={center:s,resolution:n,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.padding_}set padding(t){let e=this.padding_;this.padding_=t;const i=this.getCenterInternal();if(i){const s=t||[0,0,0,0];e=e||[0,0,0,0];const n=this.getResolution(),r=n/2*(s[3]-e[3]+e[1]-s[1]),o=n/2*(s[0]-e[0]+e[2]-s[2]);this.setCenterInternal([i[0]+r,i[1]-o])}}getUpdatedOptions_(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 i=0;i<e.length;++i){let t=arguments[i];t.center&&(t=Object.assign({},t),t.center=go(t.center,this.getProjection())),t.anchor&&(t=Object.assign({},t),t.anchor=go(t.anchor,this.getProjection())),e[i]=t}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 s=0;for(;s<i&&!this.isDef();++s){const t=arguments[s];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(s===i)return void(e&&Ha(e,!0));let n=Date.now(),r=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_;const h=[];for(;s<i;++s){const t=arguments[s],i={start:n,complete:!1,anchor:t.anchor,duration:void 0!==t.duration?t.duration:1e3,easing:t.easing||Ln,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=a;const e=Cs(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}Qa(i)?i.complete=!0:n+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(ms.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[ms.ANIMATING]>0}getInteracting(){return this.hints_[ms.INTERACTING]>0}cancelAnimations(){let t;this.setHint(ms.ANIMATING,-this.hints_[ms.ANIMATING]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&Ha(i[0].callback,!1),!t)for(let e=0,s=i.length;e<s;++e){const s=i[e];if(!s.complete){t=s.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=t,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(void 0!==this.updateAnimationKey_&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;const t=Date.now();let e=!1;for(let i=this.animations_.length-1;i>=0;--i){const s=this.animations_[i];let n=!0;for(let i=0,r=s.length;i<r;++i){const r=s[i];if(r.complete)continue;const o=t-r.start;let a=r.duration>0?o/r.duration:1;a>=1?(r.complete=!0,a=1):n=!1;const h=r.easing(a);if(r.sourceCenter){const t=r.sourceCenter[0],e=r.sourceCenter[1],i=r.targetCenter[0],s=r.targetCenter[1];this.nextCenter_=r.targetCenter;const n=t+h*(i-t),o=e+h*(s-e);this.targetCenter_=[n,o]}if(r.sourceResolution&&r.targetResolution){const t=1===h?r.targetResolution:r.sourceResolution+h*(r.targetResolution-r.sourceResolution);if(r.anchor){const e=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(t,0,e,!0);this.targetCenter_=this.calculateCenterZoom(i,r.anchor)}this.nextResolution_=r.targetResolution,this.targetResolution_=t,this.applyTargetState_(!0)}if(void 0!==r.sourceRotation&&void 0!==r.targetRotation){const t=1===h?Cs(r.targetRotation+Math.PI,2*Math.PI)-Math.PI:r.sourceRotation+h*(r.targetRotation-r.sourceRotation);if(r.anchor){const e=this.constraints_.rotation(t,!0);this.targetCenter_=this.calculateCenterRotate(e,r.anchor)}this.nextRotation_=r.targetRotation,this.targetRotation_=t}if(this.applyTargetState_(!0),e=!0,!r.complete)break}if(n){this.animations_[i]=null,this.setHint(ms.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=s[0].callback;t&&Ha(t,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(t,e){let i;const s=this.getCenterInternal();return void 0!==s&&(i=[s[0]-e[0],s[1]-e[1]],Sn(i,t-this.getRotation()),En(i,e)),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),n=this.getResolution();if(void 0!==s&&void 0!==n){const r=e[0]-t*(e[0]-s[0])/n,o=e[1]-t*(e[1]-s[1])/n;i=[r,o]}return i}getViewportSize_(t){const e=this.viewportSize_;if(t){const i=e[0],s=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(s*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(s*Math.cos(t))]}return e}setViewportSize(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){const t=this.getCenterInternal();return t?uo(t,this.getProjection()):t}getCenterInternal(){return this.get(ys.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get("constrainResolution")}getHints(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()}calculateExtent(t){const e=this.calculateExtentInternal(t);return fo(e,this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();cs(e,"The view center is not defined");const i=this.getResolution();cs(void 0!==i,"The view resolution is not defined");const s=this.getRotation();return cs(void 0!==s,"The view rotation is not defined"),on(e,i,s,t)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))}setConstrainResolution(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))}getProjection(){return this.projection_}getResolution(){return this.get(ys.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(po(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=gn(t)/e[0],s=hn(t)/e[1];return Math.max(i,s)}getResolutionForValueFunction(t){t=t||2;const e=this.getConstrainedResolution(this.maxResolution_),i=this.minResolution_,s=Math.log(e/i)/Math.log(t);return function(i){const n=e/Math.pow(t,i*s);return n}}getRotation(){return this.get(ys.ROTATION)}getValueForResolutionFunction(t){const e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),s=this.minResolution_,n=Math.log(i/s)/e;return function(t){const s=Math.log(i/t)/e/n;return s}}getViewportSizeMinusPadding_(t){let e=this.getViewportSize_(t);const i=this.padding_;return i&&(e=[e[0]-i[1]-i[3],e[1]-i[0]-i[2]]),e}getState(){const t=this.getProjection(),e=this.getResolution(),i=this.getRotation();let s=this.getCenterInternal();const n=this.padding_;if(n){const t=this.getViewportSizeMinusPadding_();s=th(s,this.getViewportSize_(),[t[0]/2+n[3],t[1]/2+n[0]],e,i)}return{center:s.slice(0),projection:void 0!==t?t:null,resolution:e,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:i,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let t;const e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t}getZoomForResolution(t){let e,i,s=this.minZoom_||0;if(this.resolutions_){const n=_i(this.resolutions_,t,1);s=n,e=this.resolutions_[n],i=n==this.resolutions_.length-1?2:e/this.resolutions_[n+1]}else e=this.maxResolution_,i=this.zoomFactor_;return s+Math.log(e/t)/Math.log(i)}getResolutionForZoom(t){if(this.resolutions_?.length){if(1===this.resolutions_.length)return this.resolutions_[0];const e=vs(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,vs(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(cs(Array.isArray(t)||"function"===typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t)){cs(!pn(t),"Cannot fit empty extent provided as `geometry`");const e=po(t,this.getProjection());i=Fa(e)}else if("Circle"===t.getType()){const e=po(t.getExtent(),this.getProjection());i=Fa(e),i.rotate(this.getRotation(),nn(e))}else{const e=co();i=e?t.clone().transform(e,this.getProjection()):t}this.fitInternal(i,e)}rotatedExtentForGeometry(t){const e=this.getRotation(),i=Math.cos(e),s=Math.sin(-e),n=t.getFlatCoordinates(),r=t.getStride();let o=1/0,a=1/0,h=-1/0,l=-1/0;for(let c=0,u=n.length;c<u;c+=r){const t=n[c]*i-n[c+1]*s,e=n[c]*s+n[c+1]*i;o=Math.min(o,t),a=Math.min(a,e),h=Math.max(h,t),l=Math.max(l,e)}return[o,a,h,l]}fitInternal(t,e){e=e||{};let i=e.size;i||(i=this.getViewportSizeMinusPadding_());const s=void 0!==e.padding?e.padding:[0,0,0,0],n=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 a=this.getResolutionForExtentInternal(o,[i[0]-s[1]-s[3],i[1]-s[0]-s[2]]);a=isNaN(a)?r:Math.max(a,r),a=this.getConstrainedResolution(a,n?0:1);const h=this.getRotation(),l=Math.sin(h),c=Math.cos(h),u=nn(o);u[0]+=(s[1]-s[3])/2*a,u[1]+=(s[0]-s[2])/2*a;const d=u[0]*c-u[1]*l,g=u[1]*c+u[0]*l,f=this.getConstrainedCenter([d,g],a),p=e.callback?e.callback:Pi;void 0!==e.duration?this.animateInternal({resolution:a,center:f,duration:e.duration,easing:e.easing},p):(this.targetResolution_=a,this.targetCenter_=f,this.applyTargetState_(!1,!0),Ha(p,!0))}centerOn(t,e,i){this.centerOnInternal(go(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(th(t,e,i,this.getResolution(),this.getRotation()))}calculateCenterShift(t,e,i,s){let n;const r=this.padding_;if(r&&t){const o=this.getViewportSizeMinusPadding_(-i),a=th(t,s,[o[0]/2+r[3],o[1]/2+r[0]],e,i);n=[t[0]-a[0],t[1]-a[1]]}return n}isDef(){return!!this.getCenterInternal()&&void 0!==this.getResolution()}adjustCenter(t){const e=uo(this.targetCenter_,this.getProjection());this.setCenter([e[0]+t[0],e[1]+t[1]])}adjustCenterInternal(t){const e=this.targetCenter_;this.setCenterInternal([e[0]+t[0],e[1]+t[1]])}adjustResolution(t,e){e=e&&go(e,this.getProjection()),this.adjustResolutionInternal(t,e)}adjustResolutionInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(this.targetResolution_*t,0,s,i);e&&(this.targetCenter_=this.calculateCenterZoom(n,e)),this.targetResolution_=this.targetResolution_*t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=go(e,this.getProjection())),this.adjustRotationInternal(t,e)}adjustRotationInternal(t,e){const i=this.getAnimating()||this.getInteracting(),s=this.constraints_.rotation(this.targetRotation_+t,i);e&&(this.targetCenter_=this.calculateCenterRotate(s,e)),this.targetRotation_=this.targetRotation_+t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?go(t,this.getProjection()):t)}setCenterInternal(t){this.targetCenter_=t,this.applyTargetState_()}setHint(t,e){return this.hints_[t]+=e,this.changed(),this.hints_[t]}setResolution(t){this.targetResolution_=t,this.applyTargetState_()}setRotation(t){this.targetRotation_=t,this.applyTargetState_()}setZoom(t){this.setResolution(this.getResolutionForZoom(t))}applyTargetState_(t,e){const i=this.getAnimating()||this.getInteracting()||e,s=this.constraints_.rotation(this.targetRotation_,i),n=this.getViewportSize_(s),r=this.constraints_.resolution(this.targetResolution_,0,n,i),o=this.constraints_.center(this.targetCenter_,r,n,i,this.calculateCenterShift(this.targetCenter_,r,s,n));this.get(ys.ROTATION)!==s&&this.set(ys.ROTATION,s),this.get(ys.RESOLUTION)!==r&&(this.set(ys.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(ys.CENTER)&&Mn(this.get(ys.CENTER),o)||this.set(ys.CENTER,o),this.getAnimating()&&!t&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(t,e,i){t=void 0!==t?t:200;const s=e||0,n=this.constraints_.rotation(this.targetRotation_),r=this.getViewportSize_(n),o=this.constraints_.resolution(this.targetResolution_,s,r),a=this.constraints_.center(this.targetCenter_,o,r,!1,this.calculateCenterShift(this.targetCenter_,o,n,r));if(0===t&&!this.cancelAnchor_)return this.targetResolution_=o,this.targetRotation_=n,this.targetCenter_=a,void this.applyTargetState_();i=i||(0===t?this.cancelAnchor_:void 0),this.cancelAnchor_=void 0,this.getResolution()===o&&this.getRotation()===n&&this.getCenterInternal()&&Mn(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:a,resolution:o,duration:t,easing:An,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(ms.INTERACTING,1)}endInteraction(t,e,i){i=i&&go(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(ms.INTERACTING,-1),this.resolveConstraints(t,e,i))}getConstrainedCenter(t,e){const i=this.getViewportSize_(this.getRotation());return this.constraints_.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.getViewportSize_(this.getRotation());return this.constraints_.resolution(t,e,i)}}function Ha(t,e){setTimeout(function(){t(e)},0)}function $a(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return As(t.extent,t.constrainOnlyCenter,e)}const e=Jr(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,As(t,!1,!1)}return Ls}function Za(t){let e,i,s;const n=28,r=2;let o=void 0!==t.minZoom?t.minZoom:Ya,a=void 0!==t.maxZoom?t.maxZoom:n;const h=void 0!==t.zoomFactor?t.zoomFactor:r,l=void 0!==t.multiWorld&&t.multiWorld,c=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,u=void 0!==t.showFullExtent&&t.showFullExtent,d=Jr(t.projection,"EPSG:3857"),g=d.getExtent();let f=t.constrainOnlyCenter,p=t.extent;if(l||p||!d.isGlobal()||(f=!1,p=g),void 0!==t.resolutions){const n=t.resolutions;i=n[o],s=void 0!==n[a]?n[a]:n[n.length-1],e=t.constrainResolution?za(n,c,!f&&p,u):Ba(i,s,c,!f&&p,u)}else{const l=g?Math.max(gn(g),hn(g)):360*Fn.degrees/d.getMetersPerUnit(),_=l/256/Math.pow(r,Ya),m=_/Math.pow(r,n-Ya);i=t.maxResolution,void 0!==i?o=0:i=_/Math.pow(h,o),s=t.minResolution,void 0===s&&(s=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(h,a):_/Math.pow(h,a):m),a=o+Math.floor(Math.log(i/s)/Math.log(h)),s=i/Math.pow(h,a-o),e=t.constrainResolution?Ua(h,i,s,c,!f&&p,u):Ba(i,s,c,!f&&p,u)}return{constraint:e,maxResolution:i,minResolution:s,minZoom:o,zoomFactor:h}}function Ja(t){const e=void 0===t.enableRotation||t.enableRotation;if(e){const e=t.constrainRotation;return void 0===e||!0===e?qa():!1===e?Xa:"number"===typeof e?Va(e):Xa}return Wa}function Qa(t){return!(t.sourceCenter&&t.targetCenter&&!Mn(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}function th(t,e,i,s,n){const r=Math.cos(-n);let o=Math.sin(-n),a=t[0]*r-t[1]*o,h=t[1]*r+t[0]*o;a+=(e[0]/2-i[0])*s,h+=(i[1]-e[1]/2)*s,o=-o;const l=a*r-h*o,c=h*r+a*o;return[l,c]}var eh=Ka;Ge();const ih="ol-hidden",sh="ol-unselectable",nh="ol-unsupported",rh="ol-control",oh="ol-collapsed",ah=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-z0-9]+?)\\s*$"].join(""),"i"),hh=["style","variant","weight","size","lineHeight","family"],lh={normal:400,bold:700},ch=function(t){const e=t.match(ah);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let s=0,n=hh.length;s<n;++s){const t=e[s+1];void 0!==t&&(i[hh[s]]="string"===typeof t?t.trim():t)}return isNaN(Number(i.weight))&&i.weight in lh&&(i.weight=lh[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i};function uh(t){return uh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(t)}function dh(t,e){if("object"!=uh(t)||!t)return t;var i;if("undefined"!=typeof Symbol&&void 0!==(i=t[Symbol.toPrimitive])){var s=i.call(t,e||"default");if("object"!=uh(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function gh(t){var e=dh(t,"string");return"symbol"==uh(e)?e:e+""}function fh(t,e,i){return(e=gh(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ph(t,e,i,s){let n;return n=i&&i.length?i.shift():ts?new class extends OffscreenCanvas{constructor(...t){super(...t),fh(this,"style",{})}}(t??300,e??150):document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e),n.getContext("2d",s)}let _h;function mh(){return _h||(_h=ph(1,1)),_h}function yh(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function vh(t,e){const i=e.parentNode;i&&i.replaceChild(t,e)}function xh(t){while(t.lastChild)t.lastChild.remove()}function wh(t,e){const i=t.childNodes;for(let s=0;1;++s){const n=i[s],r=e[s];if(!n&&!r)break;n!==r&&(n?r?t.insertBefore(r,n):(t.removeChild(n),--s):t.appendChild(r))}}function Eh(){const t=new Proxy({childNodes:[],appendChild:function(t){return this.childNodes.push(t),t},remove:function(){},removeChild:function(t){const e=this.childNodes.indexOf(t);if(-1===e)throw new Error("Node to remove was not found");return this.childNodes.splice(e,1),t},insertBefore:function(t,e){const i=this.childNodes.indexOf(e);if(-1===i)throw new Error("Reference node not found");return this.childNodes.splice(i,0,t),t},style:{}},{get(t,e,i){return"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}});return t}function Mh(t){return"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof OffscreenCanvas&&t instanceof OffscreenCanvas}class Sh extends ji{constructor(t){super();const e=t.element;!e||t.target||e.style.pointerEvents||(e.style.pointerEvents="auto"),this.element=e||null,this.target_=null,this.map_=null,this.listenerKeys=[],t.render&&(this.render=t.render),t.target&&this.setTarget(t.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(t){this.map_&&this.element?.remove();for(let e=0,i=this.listenerKeys.length;e<i;++e)li(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=t,t){const e=this.target_??t.getOverlayContainerStopEvent();this.element&&e&&e.appendChild(this.element),this.render!==Pi&&this.listenerKeys.push(ai(t,as.POSTRENDER,this.render,this)),t.render()}}render(t){}setTarget(t){this.target_="string"===typeof t?document.getElementById(t):t}}var Ch=Sh;class bh extends Ch{constructor(t){t=t||{},super({element:document.createElement("div"),render:t.render,target:t.target}),this.ulElement_=document.createElement("ul"),this.collapsed_=void 0===t.collapsed||t.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=void 0!==t.collapsible,this.collapsible_=void 0===t.collapsible||t.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=t.attributions;const e=void 0!==t.className?t.className:"ol-attribution",i=void 0!==t.tipLabel?t.tipLabel:"Attributions",s=void 0!==t.expandClassName?t.expandClassName:e+"-expand",n=void 0!==t.collapseLabel?t.collapseLabel:"›",r=void 0!==t.collapseClassName?t.collapseClassName:e+"-collapse";"string"===typeof n?(this.collapseLabel_=document.createElement("span"),this.collapseLabel_.textContent=n,this.collapseLabel_.className=r):this.collapseLabel_=n;const o=void 0!==t.label?t.label:"i";"string"===typeof o?(this.label_=document.createElement("span"),this.label_.textContent=o,this.label_.className=s):this.label_=o;const a=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement("button"),this.toggleButton_.setAttribute("type","button"),this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)),this.toggleButton_.title=i,this.toggleButton_.appendChild(a),this.toggleButton_.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1);const h=e+" "+sh+" "+rh+(this.collapsed_&&this.collapsible_?" "+oh:"")+(this.collapsible_?"":" ol-uncollapsible"),l=this.element;l.className=h,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(t){const e=this.getMap();if(!e)return[];const i=e.getAllLayers(),s=new Set(i.flatMap(e=>e.getAttributions(t)));if(void 0!==this.attributions_&&(Array.isArray(this.attributions_)?this.attributions_.forEach(t=>s.add(t)):s.add(this.attributions_)),!this.overrideCollapsible_){const t=!i.some(t=>!1===t.getSource()?.getAttributionsCollapsible());this.setCollapsible(t)}return Array.from(s)}async updateElement_(t){const e=this.element;if(!e)return;if(!t)return void(this.renderedVisible_&&(e.style.display="none",this.renderedVisible_=!1));const i=await Promise.all(this.collectSourceAttributions_(t).map(t=>Ii(()=>t))),s=i.length>0;if(this.renderedVisible_!=s&&(e.style.display=s?"":"none",this.renderedVisible_=s),!vi(i,this.renderedAttributions_)){xh(this.ulElement_);for(let t=0,e=i.length;t<e;++t){const e=document.createElement("li");e.innerHTML=i[t],this.ulElement_.appendChild(e)}this.renderedAttributions_=i}}handleClick_(t){t.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){const t=this.element;t&&(t.classList.toggle(oh),this.collapsed_?vh(this.collapseLabel_,this.label_):vh(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute("aria-expanded",String(!this.collapsed_)))}getCollapsible(){return this.collapsible_}setCollapsible(t){if(this.collapsible_===t)return;this.collapsible_=t;const e=this.element;e&&(e.classList.toggle("ol-uncollapsible"),this.userCollapsed_&&this.handleToggle_())}setCollapsed(t){this.userCollapsed_=t,this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(t){this.updateElement_(t.frameState)}}var Ph=bh;class Rh extends Ch{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:"⇧",s=void 0!==t.compassClassName?t.compassClassName:"ol-compass";this.label_,"string"===typeof i?(this.label_=document.createElement("span"),this.label_.className=s,this.label_.textContent=i):(this.label_=i,this.label_.classList.add(s));const n=t.tipLabel?t.tipLabel:"Reset rotation",r=document.createElement("button");r.className=e+"-reset",r.setAttribute("type","button"),r.title=n,r.appendChild(this.label_),r.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1);const o=e+" "+sh+" "+rh,a=this.element;a.className=o,a.appendChild(r),this.callResetNorth_=t.resetNorth?t.resetNorth:void 0,this.duration_=void 0!==t.duration?t.duration:250,this.autoHide_=void 0===t.autoHide||t.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(ih)}handleClick_(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()}resetNorth_(){const t=this.getMap();if(!t)return;const e=t.getView();if(!e)return;const i=e.getRotation();void 0!==i&&(this.duration_>0&&i%(2*Math.PI)!==0?e.animate({rotation:0,duration:this.duration_,easing:An}):e.setRotation(0))}render(t){const e=t.frameState;if(!e)return;const i=e.viewState.rotation;if(i!=this.rotation_){const t="rotate("+i+"rad)",e=this.element;if(this.autoHide_&&e){const t=e.classList.contains(ih);t||0!==i?t&&0!==i&&e.classList.remove(ih):e.classList.add(ih)}this.label_.style.transform=t}this.rotation_=i}}var Ih=Rh;class Th extends Ch{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,s=void 0!==t.zoomInClassName?t.zoomInClassName:e+"-in",n=void 0!==t.zoomOutClassName?t.zoomOutClassName:e+"-out",r=void 0!==t.zoomInLabel?t.zoomInLabel:"+",o=void 0!==t.zoomOutLabel?t.zoomOutLabel:"–",a=void 0!==t.zoomInTipLabel?t.zoomInTipLabel:"Zoom in",h=void 0!==t.zoomOutTipLabel?t.zoomOutTipLabel:"Zoom out",l=document.createElement("button");l.className=s,l.setAttribute("type","button"),l.title=a,l.appendChild("string"===typeof r?document.createTextNode(r):r),l.addEventListener(ci.CLICK,this.handleClick_.bind(this,i),!1);const c=document.createElement("button");c.className=n,c.setAttribute("type","button"),c.title=h,c.appendChild("string"===typeof o?document.createTextNode(o):o),c.addEventListener(ci.CLICK,this.handleClick_.bind(this,-i),!1);const u=e+" "+sh+" "+rh,d=this.element;d.className=u,d.appendChild(l),d.appendChild(c),this.duration_=void 0!==t.duration?t.duration:250}handleClick_(t,e){e.preventDefault(),this.zoomByDelta_(t)}zoomByDelta_(t){const e=this.getMap();if(!e)return;const i=e.getView();if(!i)return;const s=i.getZoom();if(void 0!==s){const e=i.getConstrainedZoom(s+t);if(void 0===e)return;this.duration_>0?(i.getAnimating()&&i.cancelAnimations(),i.animate({zoom:e,duration:this.duration_,easing:An})):i.setZoom(e)}}}var Ah=Th;function Lh(t){t=t||{};const e=new Wi,i=void 0===t.zoom||t.zoom;i&&e.push(new Ah(t.zoomOptions));const s=void 0===t.rotate||t.rotate;s&&e.push(new Ih(t.rotateOptions));const n=void 0===t.attribution||t.attribution;return n&&e.push(new Ph(t.attributionOptions)),e}class Oh{constructor(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(t,e){this.points_.push(t,e,Date.now())}end(){if(this.points_.length<6)return!1;const t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]<t)return!1;let i=e-3;while(i>0&&this.points_[i+2]>t)i-=3;const s=this.points_[e+2]-this.points_[i+2];if(s<1e3/60)return!1;const n=this.points_[e]-this.points_[i],r=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(r,n),this.initialVelocity_=Math.sqrt(n*n+r*r)/s,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}}var Gh=Oh,kh={ACTIVE:"active"};class Nh extends ji{constructor(t){super(),this.on,this.once,this.un,t&&t.handleEvent&&(this.handleEvent=t.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get(kh.ACTIVE)}getMap(){return this.map_}handleEvent(t){return!0}setActive(t){this.set(kh.ACTIVE,t)}setMap(t){this.map_=t}}function Fh(t,e,i){const s=t.getCenterInternal();if(s){const n=[s[0]+e[0],s[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:On,center:t.getConstrainedCenter(n)})}}function Dh(t,e,i,s){const n=t.getZoom();if(void 0===n)return;const r=t.getConstrainedZoom(n+e);if(void 0===r)return;const o=t.getResolutionForZoom(r);void 0!==o&&(t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==s?s:250,easing:An}))}var jh=Nh;class zh extends jh{constructor(t){super(),t=t||{},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:250}handleEvent(t){let e=!1;if(t.type==Ki.DBLCLICK){const i=t.originalEvent,s=t.map,n=t.coordinate,r=i.shiftKey?-this.delta_:this.delta_,o=s.getView();Dh(o,r,n,this.duration_),i.preventDefault(),e=!0}return!e}}var Uh=zh;function Bh(t){const e=arguments;return function(t){let i=!0;for(let s=0,n=e.length;s<n;++s)if(i=i&&e[s](t),!i)break;return i}}const Wh=function(t){const e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Xh=function(t){const e=t.map.getTargetElement();if(!e)return!1;const i=e.getRootNode(),s=t.map.getOwnerDocument().activeElement;return i instanceof ShadowRoot?i.host.contains(s):e.contains(s)},Vh=function(t){const e=t.map.getTargetElement();if(!e)return!0;const i=e.getRootNode(),s=i instanceof ShadowRoot?i.host:e;return!s.hasAttribute("tabindex")||Xh(t)},qh=Ci,Yh=function(t){const e=t.originalEvent;return"pointerId"in e&&0==e.button&&!(Zi&&Ji&&e.ctrlKey)},Kh=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey},Hh=function(t){const e=t.originalEvent;return Ji?e.metaKey:e.ctrlKey},$h=function(t){const e=t.originalEvent;return!e.altKey&&!(e.metaKey||e.ctrlKey)&&e.shiftKey},Zh=function(t){const e=t.originalEvent,i=e.target.tagName;return"INPUT"!==i&&"SELECT"!==i&&"TEXTAREA"!==i&&!e.target.isContentEditable},Jh=function(t){const e=t.originalEvent;return"pointerId"in e&&"mouse"==e.pointerType},Qh=function(t){const e=t.originalEvent;return"pointerId"in e&&e.isPrimary&&0===e.button};class tl extends jh{constructor(t){t=t||{},super(t),t.handleDownEvent&&(this.handleDownEvent=t.handleDownEvent),t.handleDragEvent&&(this.handleDragEvent=t.handleDragEvent),t.handleMoveEvent&&(this.handleMoveEvent=t.handleMoveEvent),t.handleUpEvent&&(this.handleUpEvent=t.handleUpEvent),t.stopDown&&(this.stopDown=t.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(t){return!1}handleDragEvent(t){}handleEvent(t){if(!t.originalEvent)return!0;let e=!1;if(this.updateTrackedPointers_(t),this.handlingDownUpSequence){if(t.type==Ki.POINTERDRAG)this.handleDragEvent(t),t.originalEvent.preventDefault();else if(t.type==Ki.POINTERUP){const e=this.handleUpEvent(t);this.handlingDownUpSequence=e&&this.targetPointers.length>0}}else if(t.type==Ki.POINTERDOWN){const i=this.handleDownEvent(t);this.handlingDownUpSequence=i,e=this.stopDown(i)}else t.type==Ki.POINTERMOVE&&this.handleMoveEvent(t);return!e}handleMoveEvent(t){}handleUpEvent(t){return!1}stopDown(t){return t}updateTrackedPointers_(t){t.activePointers&&(this.targetPointers=t.activePointers)}}function el(t){const e=t.length;let i=0,s=0;for(let n=0;n<e;n++)i+=t[n].clientX,s+=t[n].clientY;return{clientX:i/e,clientY:s/e}}var il=tl;class sl extends il{constructor(t){super({stopDown:bi}),t=t||{},this.kinetic_=t.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;const e=t.condition?t.condition:Bh(Kh,Qh);this.condition_=t.onFocusOnly?Bh(Vh,e):e,this.noKinetic_=!1}handleDragEvent(t){const e=t.map;this.panning_||(this.panning_=!0,e.getView().beginInteraction());const i=this.targetPointers,s=e.getEventPixel(el(i));if(i.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(s[0],s[1]),this.lastCentroid){const e=[this.lastCentroid[0]-s[0],s[1]-this.lastCentroid[1]],i=t.map,n=i.getView(),r=n.getResolution();void 0!==r&&(Cn(e,r),Sn(e,n.getRotation()),n.adjustCenterInternal(e))}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=s,this.lastPointersCount_=i.length,t.originalEvent.preventDefault()}handleUpEvent(t){const e=t.map,i=e.getView();if(0===this.targetPointers.length){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){const t=this.kinetic_.getDistance(),s=this.kinetic_.getAngle(),n=i.getCenterInternal();if(n){const r=e.getPixelFromCoordinateInternal(n),o=e.getCoordinateFromPixelInternal([r[0]-t*Math.cos(s),r[1]-t*Math.sin(s)]);i.animateInternal({center:i.getConstrainedCenter(o),duration:500,easing:An})}}return this.panning_&&(this.panning_=!1,i.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(t){if(this.targetPointers.length>0&&this.condition_(t)){const e=t.map,i=e.getView();return this.lastCentroid=null,i.getAnimating()&&i.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}}var nl=sl;class rl extends il{constructor(t){t=t||{},super({stopDown:bi}),this.condition_=t.condition?t.condition:Wh,this.lastAngle_=void 0,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){if(!Jh(t))return;const e=t.map,i=e.getView();if(i.getConstraints().rotation===Wa)return;const s=e.getSize();if(!s)return;const n=t.pixel,r=Math.atan2(s[1]/2-n[1],n[0]-s[0]/2);if(void 0!==this.lastAngle_){const t=r-this.lastAngle_;i.adjustRotationInternal(-t)}this.lastAngle_=r}handleUpEvent(t){if(!Jh(t))return!0;const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}handleDownEvent(t){if(!Jh(t))return!1;if(Yh(t)&&this.condition_(t)){const e=t.map;return e.getView().beginInteraction(),this.lastAngle_=void 0,!0}return!1}}var ol=rl;class al extends di{constructor(t){super(),this.geometry_=null,this.element_=document.createElement("div"),this.element_.style.position="absolute",this.element_.style.pointerEvents="auto",this.element_.className="ol-box "+t,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){const t=this.startPixel_,e=this.endPixel_;if(!t||!e)return;const i="px",s=this.element_.style;s.left=Math.min(t[0],e[0])+i,s.top=Math.min(t[1],e[1])+i,s.width=Math.abs(e[0]-t[0])+i,s.height=Math.abs(e[1]-t[1])+i}setMap(t){if(this.map_){const t=this.map_.getOverlayContainer();t&&t.removeChild(this.element_);const e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}if(this.map_=t,this.map_){const t=this.map_.getOverlayContainer();t&&t.appendChild(this.element_)}}setPixels(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;const t=this.startPixel_,e=this.endPixel_;if(!t||!e)return;const i=[t,[t[0],e[1]],e,[e[0],t[1]]],s=this.map_,n=i.map(t=>s.getCoordinateFromPixelInternal(t)),r=n[0];if(!r)return;n[4]=r.slice();const o=n;this.geometry_?this.geometry_.setCoordinates([o]):this.geometry_=new Na([o])}getGeometry(){return this.geometry_}}var hl=al;const ll={BOXSTART:"boxstart",BOXDRAG:"boxdrag",BOXEND:"boxend",BOXCANCEL:"boxcancel"};class cl extends Ai{constructor(t,e,i){super(t),this.coordinate=e,this.mapBrowserEvent=i}}class ul extends il{constructor(t){super(),this.on,this.once,this.un,t=t??{},this.box_=new hl(t.className||"ol-dragbox"),this.minArea_=t.minArea??64,t.onBoxEnd&&(this.onBoxEnd=t.onBoxEnd),this.startPixel_=null,this.condition_=t.condition??Yh,this.boxEndCondition_=t.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(t,e,i){const s=i[0]-e[0],n=i[1]-e[1];return s*s+n*n>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(t){this.startPixel_&&(this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new cl(ll.BOXDRAG,t.coordinate,t)))}handleUpEvent(t){if(!this.startPixel_)return!1;const e=this.boxEndCondition_(t,this.startPixel_,t.pixel);return e&&this.onBoxEnd(t),this.dispatchEvent(new cl(e?ll.BOXEND:ll.BOXCANCEL,t.coordinate,t)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new cl(ll.BOXSTART,t.coordinate,t)),!0)}onBoxEnd(t){}setActive(t){t||(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cl(ll.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setActive(t)}setMap(t){const e=this.getMap();e&&(this.box_.setMap(null),this.startPixel_&&(this.dispatchEvent(new cl(ll.BOXCANCEL,this.startPixel_,null)),this.startPixel_=null)),super.setMap(t)}}var dl=ul;class gl extends dl{constructor(t){t=t||{};const e=t.condition?t.condition:$h;super({condition:e,className:t.className||"ol-dragzoom",minArea:t.minArea}),this.duration_=void 0!==t.duration?t.duration:200,this.out_=void 0!==t.out&&t.out}onBoxEnd(t){const e=this.getMap();if(!e)return;const i=e.getView();let s=this.getGeometry();if(this.out_){const t=i.rotatedExtentForGeometry(s),e=i.getResolutionForExtentInternal(t),n=i.getResolution();if(void 0===e||void 0===n)return;const r=n/e;s=s.clone(),s.scale(r*r)}i.fitInternal(s,{duration:this.duration_,easing:An})}}var fl=gl,pl={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown"};class _l extends jh{constructor(t){super(),t=t||{},this.defaultCondition_=function(t){return Kh(t)&&Zh(t)},this.condition_=void 0!==t.condition?t.condition:this.defaultCondition_,this.duration_=void 0!==t.duration?t.duration:100,this.pixelDelta_=void 0!==t.pixelDelta?t.pixelDelta:128}handleEvent(t){let e=!1;if(t.type==ci.KEYDOWN){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&(s==pl.DOWN||s==pl.LEFT||s==pl.RIGHT||s==pl.UP)){const n=t.map,r=n.getView(),o=r.getResolution();if(void 0===o)return!0;const a=o*this.pixelDelta_;let h=0,l=0;s==pl.DOWN?l=-a:s==pl.LEFT?h=-a:s==pl.RIGHT?h=a:l=a;const c=[h,l];Sn(c,r.getRotation()),Fh(r,c,this.duration_),i.preventDefault(),e=!0}}return!e}}var ml=_l;class yl extends jh{constructor(t){super(),t=t||{},this.condition_=t.condition?t.condition:function(t){return!Hh(t)&&Zh(t)},this.delta_=t.delta?t.delta:1,this.duration_=void 0!==t.duration?t.duration:100}handleEvent(t){let e=!1;if(t.type==ci.KEYDOWN||t.type==ci.KEYPRESS){const i=t.originalEvent,s=i.key;if(this.condition_(t)&&("+"===s||"-"===s)){const n=t.map,r="+"===s?this.delta_:-this.delta_,o=n.getView();Dh(o,r,void 0,this.duration_),i.preventDefault(),e=!0}}return!e}}var vl=yl;const xl=40,wl=300,El=3;class Ml extends jh{constructor(t){t=t||{},super(t),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=void 0!==t.maxDelta?t.maxDelta:1,this.duration_=void 0!==t.duration?t.duration:250,this.timeout_=void 0!==t.timeout?t.timeout:80,this.useAnchor_=void 0===t.useAnchor||t.useAnchor,this.constrainResolution_=void 0!==t.constrainResolution&&t.constrainResolution;const e=t.condition?t.condition:qh;this.condition_=t.onFocusOnly?Bh(Vh,e):e,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300}endInteraction_(){this.trackpadTimeoutId_=void 0;const t=this.getMap();if(!t)return;const e=t.getView(),i=this.lastDelta_?this.lastDelta_>0?1:-1:0;e.endInteraction(this.constrainResolution_||e.getConstrainResolution()?100:void 0,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0)}handleEvent(t){if(!this.condition_(t))return!0;const e=t.type;if(e!==ci.WHEEL)return!0;const i=t.map,s=t.originalEvent;s.preventDefault();const n=s.ctrlKey&&!t.ctrlKey;this.useAnchor_&&(this.lastAnchor_=t.pixel);let r=s.deltaY;switch(s.deltaMode){case WheelEvent.DOM_DELTA_LINE:r*=xl;break;case WheelEvent.DOM_DELTA_PAGE:r*=wl;break;default:}if(0===r)return!1;this.lastDelta_=r;const o=Date.now();void 0===this.startTime_&&(this.startTime_=o),(!this.mode_||o-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(r)<4?"trackpad":"wheel");const a=i.getView();if("trackpad"===this.mode_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(a.getAnimating()&&a.cancelAnimations(),a.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),n&&(r*=El),a.adjustZoom(-r/this.deltaPerZoom_,this.lastAnchor_?i.getCoordinateFromPixel(this.lastAnchor_):void 0),this.startTime_=o,!1;this.totalDelta_+=r;const h=Math.max(this.timeout_-(o-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),h),!1}handleWheelZoom_(t){const e=t.getView();e.getAnimating()&&e.cancelAnimations();let i=-vs(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),Dh(e,i,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):void 0,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(t){this.useAnchor_=t,t||(this.lastAnchor_=null)}}var Sl=Ml;class Cl extends il{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=bi),super(e),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=void 0!==t.threshold?t.threshold:.3,this.duration_=void 0!==t.duration?t.duration:250}handleDragEvent(t){let e=0;const i=this.targetPointers[0],s=this.targetPointers[1],n=Math.atan2(s.clientY-i.clientY,s.clientX-i.clientX);if(void 0!==this.lastAngle_){const t=n-this.lastAngle_;this.rotationDelta_+=t,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=t}this.lastAngle_=n;const r=t.map,o=r.getView();o.getConstraints().rotation!==Wa&&(this.anchor_=r.getCoordinateFromPixelInternal(r.getEventPixel(el(this.targetPointers)))??null,this.rotating_&&(r.render(),o.adjustRotationInternal(e,this.anchor_??void 0)))}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView();return i.endInteraction(this.duration_),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var bl=Cl;class Pl extends il{constructor(t){t=t||{};const e=t;e.stopDown||(e.stopDown=bi),super(e),this.anchor_=null,this.duration_=void 0!==t.duration?t.duration:400,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(t){let e=1;const i=this.targetPointers[0],s=this.targetPointers[1],n=i.clientX-s.clientX,r=i.clientY-s.clientY,o=Math.sqrt(n*n+r*r);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;const a=t.map,h=a.getView();1!=e&&(this.lastScaleDelta_=e),this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(el(this.targetPointers)))??null,a.render(),h.adjustResolutionInternal(e,this.anchor_??void 0)}handleUpEvent(t){if(this.targetPointers.length<2){const e=t.map,i=e.getView(),s=this.lastScaleDelta_>1?1:-1;return i.endInteraction(this.duration_,s),!1}return!0}handleDownEvent(t){if(this.targetPointers.length>=2){const e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1}}var Rl=Pl;function Il(t){t=t||{};const e=new Wi,i=new Gh(-.005,.05,100),s=void 0===t.altShiftDragRotate||t.altShiftDragRotate;s&&e.push(new ol);const n=void 0===t.doubleClickZoom||t.doubleClickZoom;n&&e.push(new Uh({delta:t.zoomDelta,duration:t.zoomDuration}));const r=void 0===t.dragPan||t.dragPan;r&&e.push(new nl({onFocusOnly:t.onFocusOnly,kinetic:i}));const o=void 0===t.pinchRotate||t.pinchRotate;o&&e.push(new bl);const a=void 0===t.pinchZoom||t.pinchZoom;a&&e.push(new Rl({duration:t.zoomDuration}));const h=void 0===t.keyboard||t.keyboard;h&&(e.push(new ml),e.push(new vl({delta:t.zoomDelta,duration:t.zoomDuration})));const l=void 0===t.mouseWheelZoom||t.mouseWheelZoom;l&&e.push(new Sl({onFocusOnly:t.onFocusOnly,duration:t.zoomDuration}));const c=void 0===t.shiftDragZoom||t.shiftDragZoom;return c&&e.push(new fl({duration:t.zoomDuration})),e}var Tl={OPACITY:"opacity",VISIBLE:"visible",EXTENT:"extent",Z_INDEX:"zIndex",MAX_RESOLUTION:"maxResolution",MIN_RESOLUTION:"minResolution",MAX_ZOOM:"maxZoom",MIN_ZOOM:"minZoom",SOURCE:"source",MAP:"map"};class Al extends ji{constructor(t){super(),this.on,this.once,this.un,this.background_=t.background;const e=Object.assign({},t);"object"===typeof t.properties&&(delete e.properties,Object.assign(e,t.properties)),e[Tl.OPACITY]=void 0!==t.opacity?t.opacity:1,cs("number"===typeof e[Tl.OPACITY],"Layer opacity must be a number"),e[Tl.VISIBLE]=void 0===t.visible||t.visible,e[Tl.Z_INDEX]=t.zIndex,e[Tl.MAX_RESOLUTION]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Tl.MIN_RESOLUTION]=void 0!==t.minResolution?t.minResolution:0,e[Tl.MIN_ZOOM]=void 0!==t.minZoom?t.minZoom:-1/0,e[Tl.MAX_ZOOM]=void 0!==t.maxZoom?t.maxZoom:1/0,this.className_=void 0!==e.className?e.className:"ol-layer",delete e.className,this.setProperties(e),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(t){const e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=vs(Math.round(100*this.getOpacity())/100,0,1),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i||e.managed?i:1/0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e}getLayersArray(t){return wi()}getLayerStatesArray(t){return wi()}getExtent(){return this.get(Tl.EXTENT)}getMaxResolution(){return this.get(Tl.MAX_RESOLUTION)}getMinResolution(){return this.get(Tl.MIN_RESOLUTION)}getMinZoom(){return this.get(Tl.MIN_ZOOM)}getMaxZoom(){return this.get(Tl.MAX_ZOOM)}getOpacity(){return this.get(Tl.OPACITY)}getSourceState(){return wi()}getVisible(){return this.get(Tl.VISIBLE)}getZIndex(){return this.get(Tl.Z_INDEX)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(Tl.EXTENT,t)}setMaxResolution(t){this.set(Tl.MAX_RESOLUTION,t)}setMinResolution(t){this.set(Tl.MIN_RESOLUTION,t)}setMaxZoom(t){this.set(Tl.MAX_ZOOM,t)}setMinZoom(t){this.set(Tl.MIN_ZOOM,t)}setOpacity(t){cs("number"===typeof t,"Layer opacity must be a number"),this.set(Tl.OPACITY,t)}setVisible(t){this.set(Tl.VISIBLE,t)}setZIndex(t){this.set(Tl.Z_INDEX,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}}var Ll=Al;const Ol={ADDLAYER:"addlayer",REMOVELAYER:"removelayer"};class Gl extends Ai{constructor(t,e){super(t),this.layer=e}}const kl={LAYERS:"layers"};class Nl extends Ll{constructor(t){t=t||{};const e=Object.assign({},t);delete e.layers;let i=t.layers;super(e),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(kl.LAYERS,this.handleLayersChanged_),i?Array.isArray(i)?i=new Wi(i.slice(),{unique:!0}):cs("function"===typeof i.getArray,"Expected `layers` to be an array or a `Collection`"):i=new Wi(void 0,{unique:!0}),this.setLayers(i)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(li),this.layersListenerKeys_.length=0;const t=this.getLayers();this.layersListenerKeys_.push(ai(t,si.ADD,this.handleLayersAdd_,this),ai(t,si.REMOVE,this.handleLayersRemove_,this));for(const i in this.listenerKeys_)this.listenerKeys_[i].forEach(li);ri(this.listenerKeys_);const e=t.getArray();for(let i=0,s=e.length;i<s;i++){const t=e[i];this.registerLayerListeners_(t),this.dispatchEvent(new Gl(Ol.ADDLAYER,t))}this.changed()}registerLayerListeners_(t){const e=[ai(t,ni.PROPERTYCHANGE,this.handleLayerChange_,this),ai(t,ci.CHANGE,this.handleLayerChange_,this)];t instanceof Nl&&e.push(ai(t,Ol.ADDLAYER,this.handleLayerGroupAdd_,this),ai(t,Ol.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[Mi(t)]=e}handleLayerGroupAdd_(t){this.dispatchEvent(new Gl(Ol.ADDLAYER,t.layer))}handleLayerGroupRemove_(t){this.dispatchEvent(new Gl(Ol.REMOVELAYER,t.layer))}handleLayersAdd_(t){const e=t.element;this.registerLayerListeners_(e),this.dispatchEvent(new Gl(Ol.ADDLAYER,e)),this.changed()}handleLayersRemove_(t){const e=t.element,i=Mi(e);this.listenerKeys_[i].forEach(li),delete this.listenerKeys_[i],this.dispatchEvent(new Gl(Ol.REMOVELAYER,e)),this.changed()}getLayers(){return this.get(kl.LAYERS)}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 Gl(Ol.REMOVELAYER,t[e]))}this.set(kl.LAYERS,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 s=this.getLayerState();let n=s.zIndex;t||void 0!==s.zIndex||(n=0);for(let r=i,o=e.length;r<o;r++){const t=e[r];t.opacity*=s.opacity,t.visible=t.visible&&s.visible,t.maxResolution=Math.min(t.maxResolution,s.maxResolution),t.minResolution=Math.max(t.minResolution,s.minResolution),t.minZoom=Math.max(t.minZoom,s.minZoom),t.maxZoom=Math.min(t.maxZoom,s.maxZoom),void 0!==s.extent&&(void 0!==t.extent?t.extent=ln(t.extent,s.extent):t.extent=s.extent),void 0===t.zIndex&&(t.zIndex=n)}return e}getSourceState(){return"ready"}}var Fl=Nl,Dl={PRERENDER:"prerender",POSTRENDER:"postrender",PRECOMPOSE:"precompose",POSTCOMPOSE:"postcompose",RENDERCOMPLETE:"rendercomplete"};class jl extends Ll{constructor(t){const e=Object.assign({},t);delete e.source,super(e),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,t.render&&(this.render=t.render),t.map&&this.setMap(t.map),this.addChangeListener(Tl.SOURCE,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return t=t||[],t.push(this),t}getLayerStatesArray(t){return t=t||[],t.push(this.getLayerState()),t}getSource(){return this.get(Tl.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed();const t=this.getSource();t&&!this.sourceReady_&&"ready"===t.getState()&&(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(li(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=ai(t,ci.CHANGE,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();!t&&i&&(t=i.getView()),e=t instanceof eh?{viewState:t.getState(),extent:t.calculateExtent()}:t;const s=e;let n;if(!s.layerStatesArray&&i&&(s.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),s.layerStatesArray){if(n=s.layerStatesArray.find(t=>t.layer===this),!n)return!1}else n=this.getLayerState();const r=this.getExtent();return zl(n,s.viewState)&&(!r||fn(r,s.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];const i=t instanceof eh?t.getViewStateAndExtent():t;let s=e(i);return Array.isArray(s)||(s=[s]),s}render(t,e){const i=this.getRenderer();return i.prepareFrame(t)?(this.rendered=!0,i.renderFrame(t,e)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(t,e){}renderDeferred(t){const e=this.getRenderer();e&&e.renderDeferred(t)}setMapInternal(t){t||this.unrender(),this.set(Tl.MAP,t)}getMapInternal(){return this.get(Tl.MAP)}setMap(t){this.mapPrecomposeKey_&&(li(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(li(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=ai(t,Dl.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=ai(this,ci.CHANGE,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState?.layerStatesArray;if(!e)return;const i=this.getLayerState(!1);cs(!e.some(t=>t.layer===i.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),e.push(i)}setSource(t){this.set(Tl.SOURCE,t)}getRenderer(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}}function zl(t,e){if(!t.visible)return!1;const i=e.resolution;if(i<t.minResolution||i>=t.maxResolution)return!1;const s=e.zoom;return s>t.minZoom&&s<=t.maxZoom}var Ul=jl;function Bl(t,e,i=0,s=t.length-1,n=Xl){while(s>i){if(s-i>600){const r=s-i+1,o=e-i+1,a=Math.log(r),h=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*h*(r-h)/r)*(o-r/2<0?-1:1),c=Math.max(i,Math.floor(e-o*h/r+l)),u=Math.min(s,Math.floor(e+(r-o)*h/r+l));Bl(t,e,c,u,n)}const r=t[e];let o=i,a=s;Wl(t,i,e),n(t[s],r)>0&&Wl(t,i,s);while(o<a){Wl(t,o,a),o++,a--;while(n(t[o],r)<0)o++;while(n(t[a],r)>0)a--}0===n(t[i],r)?Wl(t,i,a):(a++,Wl(t,a,s)),a<=e&&(i=a+1),e<=a&&(s=a-1)}}function Wl(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function Xl(t,e){return t<e?-1:t>e?1:0}class Vl{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}all(){return this._all(this.data,[])}search(t){let e=this.data;const i=[];if(!sc(t,e))return i;const s=this.toBBox,n=[];while(e){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?s(o):o;sc(t,a)&&(e.leaf?i.push(o):ic(t,a)?this._all(o,i):n.push(o))}e=n.pop()}return i}collides(t){let e=this.data;if(!sc(t,e))return!1;const i=[];while(e){for(let s=0;s<e.children.length;s++){const n=e.children[s],r=e.leaf?this.toBBox(n):n;if(sc(t,r)){if(e.leaf||ic(t,r))return!0;i.push(n)}}e=i.pop()}return!1}load(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(let e=0;e<t.length;e++)this.insert(t[e]);return this}let e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){const t=this.data;this.data=e,e=t}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=nc([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],r=[];let o,a,h;while(i||n.length){if(i||(i=n.pop(),a=n[n.length-1],o=r.pop(),h=!0),i.leaf){const s=ql(t,i.children,e);if(-1!==s)return i.children.splice(s,1),n.push(i),this._condense(n),this}h||i.leaf||!ic(i,s)?a?(o++,i=a.children[o],h=!1):i=null:(n.push(i),r.push(o),o=0,a=i,i=i.children[0])}return this}toBBox(t){return t}compareMinX(t,e){return t.minX-e.minX}compareMinY(t,e){return t.minY-e.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,e){const i=[];while(t)t.leaf?e.push(...t.children):i.push(...t.children),t=i.pop();return e}_build(t,e,i,s){const n=i-e+1;let r,o=this._maxEntries;if(n<=o)return r=nc(t.slice(e,i+1)),Yl(r,this.toBBox),r;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),r=nc([]),r.leaf=!1,r.height=s;const a=Math.ceil(n/o),h=a*Math.ceil(Math.sqrt(o));rc(t,e,i,h,this.compareMinX);for(let l=e;l<=i;l+=h){const e=Math.min(l+h-1,i);rc(t,l,e,a,this.compareMinY);for(let i=l;i<=e;i+=a){const n=Math.min(i+a-1,e);r.children.push(this._build(t,i,n,s-1))}}return Yl(r,this.toBBox),r}_chooseSubtree(t,e,i,s){while(1){if(s.push(e),e.leaf||s.length-1===i)break;let n,r=1/0,o=1/0;for(let i=0;i<e.children.length;i++){const s=e.children[i],a=Jl(s),h=tc(t,s)-a;h<o?(o=h,r=a<r?a:r,n=s):h===o&&a<r&&(r=a,n=s)}e=n||e.children[0]}return e}_insert(t,e,i){const s=i?t:this.toBBox(t),n=[],r=this._chooseSubtree(s,this.data,e,n);r.children.push(t),Hl(r,s);while(e>=0){if(!(n[e].children.length>this._maxEntries))break;this._split(n,e),e--}this._adjustParentBBoxes(s,n,e)}_split(t,e){const i=t[e],s=i.children.length,n=this._minEntries;this._chooseSplitAxis(i,n,s);const r=this._chooseSplitIndex(i,n,s),o=nc(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Yl(i,this.toBBox),Yl(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=nc([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Yl(this.data,this.toBBox)}_chooseSplitIndex(t,e,i){let s,n=1/0,r=1/0;for(let o=e;o<=i-e;o++){const e=Kl(t,0,o,this.toBBox),a=Kl(t,o,i,this.toBBox),h=ec(e,a),l=Jl(e)+Jl(a);h<n?(n=h,s=o,r=l<r?l:r):h===n&&l<r&&(r=l,s=o)}return s||i-e}_chooseSplitAxis(t,e,i){const s=t.leaf?this.compareMinX:$l,n=t.leaf?this.compareMinY:Zl,r=this._allDistMargin(t,e,i,s),o=this._allDistMargin(t,e,i,n);r<o&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,r=Kl(t,0,e,n),o=Kl(t,i-e,i,n);let a=Ql(r)+Ql(o);for(let h=e;h<i-e;h++){const e=t.children[h];Hl(r,t.leaf?n(e):e),a+=Ql(r)}for(let h=i-e-1;h>=e;h--){const e=t.children[h];Hl(o,t.leaf?n(e):e),a+=Ql(o)}return a}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Hl(e[s],t)}_condense(t){for(let e,i=t.length-1;i>=0;i--)0===t[i].children.length?i>0?(e=t[i-1].children,e.splice(e.indexOf(t[i]),1)):this.clear():Yl(t[i],this.toBBox)}}function ql(t,e,i){if(!i)return e.indexOf(t);for(let s=0;s<e.length;s++)if(i(t,e[s]))return s;return-1}function Yl(t,e){Kl(t,0,t.children.length,e,t)}function Kl(t,e,i,s,n){n||(n=nc(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let r=e;r<i;r++){const e=t.children[r];Hl(n,t.leaf?s(e):e)}return n}function Hl(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 $l(t,e){return t.minX-e.minX}function Zl(t,e){return t.minY-e.minY}function Jl(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Ql(t){return t.maxX-t.minX+(t.maxY-t.minY)}function tc(t,e){return(Math.max(e.maxX,t.maxX)-Math.min(e.minX,t.minX))*(Math.max(e.maxY,t.maxY)-Math.min(e.minY,t.minY))}function ec(t,e){const i=Math.max(t.minX,e.minX),s=Math.max(t.minY,e.minY),n=Math.min(t.maxX,e.maxX),r=Math.min(t.maxY,e.maxY);return Math.max(0,n-i)*Math.max(0,r-s)}function ic(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function sc(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function nc(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rc(t,e,i,s,n){const r=[e,i];while(r.length){if(i=r.pop(),e=r.pop(),i-e<=s)continue;const o=e+Math.ceil((i-e)/s/2)*s;Bl(t,o,e,i,n),r.push(e,o,o,i)}}const oc=[NaN,NaN,NaN,0];let ac;function hc(){return ac||(ac=ph(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),ac}const lc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,cc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,uc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function gc(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function fc(t){throw new Error('failed to parse "'+t+'" as color')}function pc(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(cc)||t.match(lc)||t.match(uc);if(e){const t=e[4],i=100/255;return[vs(gc(e[1],i)+.5|0,0,255),vs(gc(e[2],i)+.5|0,0,255),vs(gc(e[3],i)+.5|0,0,255),void 0!==t?vs(gc(t,100),0,1):1]}fc(t)}if(t.startsWith("#")){if(dc.test(t)){const e=t.substring(1),i=e.length<=4?1:2,s=[0,0,0,255];for(let t=0,n=e.length;t<n;t+=i){let n=parseInt(e.substring(t,t+i),16);1===i&&(n+=n<<4),s[t/i]=n}return s[3]=s[3]/255,s}fc(t)}const e=hc();e.fillStyle="#abcdef";let i=e.fillStyle;e.fillStyle=t,e.fillStyle===i&&(e.fillStyle="#fedcba",i=e.fillStyle,e.fillStyle=t,e.fillStyle===i&&fc(t));const s=e.fillStyle;if(s.startsWith("#")||s.startsWith("rgba"))return pc(s);e.clearRect(0,0,1,1),e.fillRect(0,0,1,1);const n=Array.from(e.getImageData(0,0,1,1).data);return n[3]=Ps(n[3]/255,3),n}function _c(t){return"string"===typeof t?t:Ic(t)}const mc=1024,yc={};let vc=0;function xc(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function wc(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Ec(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function Mc(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function Sc(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Cc(t){const e=Mc(t[0]),i=Mc(t[1]),s=Mc(t[2]),n=Sc(.222488403*e+.716873169*i+.06060791*s),r=500*(Sc(.452247074*e+.399439023*i+.148375274*s)-n),o=200*(n-Sc(.016863605*e+.117638439*i+.865350722*s)),a=Math.atan2(o,r)*(180/Math.PI);return[116*n-16,Math.sqrt(r*r+o*o),a<0?a+360:a,t[3]]}function bc(t){const e=(t[0]+16)/116,i=t[1],s=t[2]*Math.PI/180,n=Ec(e),r=Ec(e+i/500*Math.cos(s)),o=Ec(e-i/200*Math.sin(s)),a=wc(3.021973625*r-1.617392459*n-.404875592*o),h=wc(-.943766287*r+1.916279586*n+.027607165*o),l=wc(.069407491*r-.22898585*n+1.159737864*o);return[vs(a+.5|0,0,255),vs(h+.5|0,0,255),vs(l+.5|0,0,255),t[3]]}function Pc(t){if("none"===t)return oc;if(yc.hasOwnProperty(t))return yc[t];if(vc>=mc){let t=0;for(const e in yc)0===(3&t++)&&(delete yc[e],--vc)}const e=pc(t);4!==e.length&&fc(t);for(const i of e)isNaN(i)&&fc(t);return yc[t]=e,++vc,e}function Rc(t){return Array.isArray(t)?t:Pc(t)}function Ic(t){let e=t[0];e!=(0|e)&&(e=e+.5|0);let i=t[1];i!=(0|i)&&(i=i+.5|0);let s=t[2];s!=(0|s)&&(s=s+.5|0);const n=void 0===t[3]?1:Math.round(1e3*t[3])/1e3;return"rgba("+e+","+i+","+s+","+n+")"}function Tc(t){return t[0]>0&&t[1]>0}function Ac(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 Lc(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}let Oc=0;const Gc=0,kc=1<<Oc++,Nc=1<<Oc++,Fc=1<<Oc++,Dc=1<<Oc++,jc=1<<Oc++,zc=1<<Oc++,Uc=Math.pow(2,Oc)-1,Bc={[kc]:"boolean",[Nc]:"number",[Fc]:"string",[Dc]:"color",[jc]:"number[]",[zc]:"size"},Wc=Object.keys(Bc).map(Number).sort(fi);function Xc(t){return t in Bc}function Vc(t){const e=[];for(const i of Wc)qc(t,i)&&e.push(Bc[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function qc(t,e){return(t&e)===e}function Yc(t,e){return!!(t&e)}function Kc(t,e){return t===e}function Hc(t){return t instanceof Error?t.message:String(t)}class $c{constructor(t,e){if(!Xc(t))throw new Error(`literal expressions must have a specific type, got ${Vc(t)}`);this.type=t,this.value=e}}class Zc{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Jc(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function Qc(t,e,i){switch(typeof t){case"boolean":if(Kc(e,Fc))return new $c(Fc,t?"true":"false");if(!qc(e,kc))throw new Error(`got a boolean, but expected ${Vc(e)}`);return new $c(kc,t);case"number":if(Kc(e,zc))return new $c(zc,Lc(t));if(Kc(e,kc))return new $c(kc,!!t);if(Kc(e,Fc))return new $c(Fc,t.toString());if(!qc(e,Nc))throw new Error(`got a number, but expected ${Vc(e)}`);return new $c(Nc,t);case"string":if(Kc(e,Dc))return new $c(Dc,Pc(t));if(Kc(e,kc))return new $c(kc,!!t);if(!qc(e,Fc))throw new Error(`got a string, but expected ${Vc(e)}`);return new $c(Fc,t);default:}if(!Array.isArray(t))throw new Error("expression must be an array or a primitive value");if(0===t.length)throw new Error("empty expression");if("string"===typeof t[0])return Eu(t,e,i);for(const s of t)if("number"!==typeof s)throw new Error("expected an array of numbers");if(Kc(e,zc)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new $c(zc,t)}if(Kc(e,Dc)){if(3===t.length)return new $c(Dc,[...t,1]);if(4===t.length)return new $c(Dc,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!qc(e,jc))throw new Error(`got an array of numbers, but expected ${Vc(e)}`);return new $c(jc,t)}const tu={Get:"get",Var:"var",Concat:"concat",GeometryType:"geometry-type",LineMetric:"line-metric",Any:"any",All:"all",Not:"!",Resolution:"resolution",Zoom:"zoom",Time:"time",Equal:"==",NotEqual:"!=",GreaterThan:">",GreaterThanOrEqualTo:">=",LessThan:"<",LessThanOrEqualTo:"<=",Multiply:"*",Divide:"/",Add:"+",Subtract:"-",Clamp:"clamp",Mod:"%",Pow:"^",Abs:"abs",Floor:"floor",Ceil:"ceil",Round:"round",Sin:"sin",Cos:"cos",Atan:"atan",Sqrt:"sqrt",Match:"match",Between:"between",Interpolate:"interpolate",InterpolateHcl:"interpolate-hcl",Coalesce:"coalesce",Case:"case",In:"in",Number:"number",String:"string",Array:"array",Color:"color",Id:"id",Band:"band",Palette:"palette",ToString:"to-string",Has:"has"},eu={[tu.Get]:wu(lu(1,1/0),iu),[tu.Var]:su(),[tu.Has]:wu(lu(1,1/0),iu),[tu.Id]:wu(nu,hu),[tu.Concat]:wu(lu(2,1/0),uu(Fc)),[tu.GeometryType]:wu(ru,hu),[tu.LineMetric]:wu(ou,hu),[tu.Resolution]:wu(au,hu),[tu.Zoom]:wu(au,hu),[tu.Time]:wu(au,hu),[tu.Any]:wu(lu(2,1/0),uu(kc)),[tu.All]:wu(lu(2,1/0),uu(kc)),[tu.Not]:wu(lu(1,1),uu(kc)),[tu.Equal]:wu(lu(2,2),du()),[tu.NotEqual]:wu(lu(2,2),du()),[tu.GreaterThan]:wu(lu(2,2),uu(Nc)),[tu.GreaterThanOrEqualTo]:wu(lu(2,2),uu(Nc)),[tu.LessThan]:wu(lu(2,2),uu(Nc)),[tu.LessThanOrEqualTo]:wu(lu(2,2),uu(Nc)),[tu.Multiply]:wu(lu(2,1/0),cu),[tu.Coalesce]:wu(lu(2,1/0),cu),[tu.Divide]:wu(lu(2,2),uu(Nc)),[tu.Add]:wu(lu(2,1/0),uu(Nc)),[tu.Subtract]:wu(lu(2,2),uu(Nc)),[tu.Clamp]:wu(lu(3,3),uu(Nc)),[tu.Mod]:wu(lu(2,2),uu(Nc)),[tu.Pow]:wu(lu(2,2),uu(Nc)),[tu.Abs]:wu(lu(1,1),uu(Nc)),[tu.Floor]:wu(lu(1,1),uu(Nc)),[tu.Ceil]:wu(lu(1,1),uu(Nc)),[tu.Round]:wu(lu(1,1),uu(Nc)),[tu.Sin]:wu(lu(1,1),uu(Nc)),[tu.Cos]:wu(lu(1,1),uu(Nc)),[tu.Atan]:wu(lu(1,2),uu(Nc)),[tu.Sqrt]:wu(lu(1,1),uu(Nc)),[tu.Match]:wu(lu(4,1/0),fu,pu),[tu.Between]:wu(lu(3,3),uu(Nc)),[tu.Interpolate]:wu(lu(6,1/0),fu,mu),[tu.InterpolateHcl]:wu(lu(6,1/0),fu,_u,mu),[tu.Case]:wu(lu(3,1/0),gu,yu),[tu.In]:wu(lu(2,2),vu),[tu.Number]:wu(lu(1,1/0),uu(Uc)),[tu.String]:wu(lu(1,1/0),uu(Uc)),[tu.Array]:wu(lu(1,1/0),uu(Nc)),[tu.Color]:wu(lu(1,4),uu(Nc)),[tu.Band]:wu(lu(1,3),uu(Nc)),[tu.Palette]:wu(lu(2,2),xu),[tu.ToString]:wu(lu(1,1),uu(kc|Nc|Fc|Dc))};function iu(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=t[r+1];switch(typeof s){case"number":n[r]=new $c(Nc,s);break;case"string":n[r]=new $c(Fc,s);break;default:throw new Error(`expected a string key or numeric array index for a get operation, got ${s}`)}0===r&&i.properties.set(String(s),e)}return n}function su(){return function(t,e,i){const s=t[1];if("string"!==typeof s)throw new Error("expected a string argument for var operation");let n=e;const r=i.inputVariables?.[s];if(void 0!==r){const t=Qc(r,Uc,i);if(!(t instanceof $c))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${s}`);let o=t.type;if("string"===typeof r&&Yc(n,Dc)&&!Yc(n,Fc)?o=Dc:Array.isArray(r)&&2===r.length&&Yc(n,zc)&&!Yc(n,jc)&&(o=zc),n&=o,n===Gc)throw new Error(`the type expected from the var operator (${Vc(e)}) did not have any overlap with the type of the corresponding style variables (${Vc(o)}), variable name: ${s}`)}if(i.variables.has(s)){const t=i.variables.get(s);if(n&=t,n===Gc)throw new Error(`a new type expected from the var operator (${Vc(e)}) did not have any overlap with the previous type expected for it (${Vc(t)}), variable name: ${s}`)}return i.variables.set(s,n),new Zc(n,"var",new $c(Fc,s))}}function nu(t,e,i){i.featureId=!0}function ru(t,e,i){i.geometryType=!0}function ou(t,e,i){i.mCoordinate=!0}function au(t,e,i){i.mapState=!0}function hu(t,e,i){const s=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${s} operation`);return[]}function lu(t,e){return function(i,s,n){const r=i[0],o=i.length-1;if(t===e){if(o!==t){const e=1===t?"":"s";throw new Error(`expected ${t} argument${e} for ${r}, got ${o}`)}}else if(o<t||o>e){const i=e===1/0?`${t} or more`:`${t} to ${e}`;throw new Error(`expected ${i} arguments for ${r}, got ${o}`)}}}function cu(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=Qc(t[r+1],e,i);n[r]=s}return n}function uu(t){return function(e,i,s){const n=e.length-1,r=new Array(n);for(let o=0;o<n;++o){const i=Qc(e[o+1],t,s);r[o]=i}return r}}function du(){return function(t,e,i){const s=t[0],n=t.length-1,r=new Array(n);let o=Uc;for(let a=0;a<n;++a){const e=Qc(t[a+1],o,i);o&=e.type}if(o===Gc)throw new Error(`no common type was found among the arguments of ${s}`);for(let a=0;a<n;++a){const e=Qc(t[a+1],o,i);r[a]=e}return r}}function gu(t,e,i){const s=t[0],n=t.length-1;if(n%2===0)throw new Error(`expected an odd number of arguments for ${s}, got ${n} instead`)}function fu(t,e,i){const s=t[0],n=t.length-1;if(n%2===1)throw new Error(`expected an even number of arguments for operation ${s}, got ${n} instead`)}function pu(t,e,i){const s=t.length-1,n=Qc(t[t.length-1],e,i);let r=Fc|Nc|kc;const o=new Array(s-2);for(let l=0;l<s-2;l+=2){try{const e=Qc(t[l+2],r,i);r&=e.type}catch(h){const t=Hc(h);throw new Error(`failed to parse argument ${l+1} of match expression: ${t}`)}if(r===Gc)throw new Error("no common type was found among the arguments of match expression")}for(let l=0;l<s-2;l+=2){try{const e=Qc(t[l+2],r,i);o[l]=e}catch(h){const t=Hc(h);throw new Error(`failed to parse argument ${l+1} of match expression: ${t}`)}try{const e=Qc(t[l+3],n.type,i);o[l+1]=e}catch(h){throw new Error(`failed to parse argument ${l+2} of match expression: ${Hc(h)}`)}}const a=Qc(t[1],r,i);return[a,...o,n]}function _u(t,e,i){if(!qc(e,Dc))throw new Error(`the ${t[0]} operator can only return a color, got ${Vc(e)}`)}function mu(t,e,i){const s=t[1];let n;switch(s[0]){case"linear":n=1;break;case"exponential":const t=s[1];if("number"!==typeof t||t<=0)throw new Error(`expected a number base for exponential interpolation, got ${JSON.stringify(t)} instead`);n=t;break;default:throw new Error(`invalid interpolation type: ${JSON.stringify(s)}`)}const r=new $c(Nc,n);let o;try{o=Qc(t[2],Nc,i)}catch(h){throw new Error(`failed to parse argument 1 in interpolate expression: ${Hc(h)}`)}const a=new Array(t.length-3);for(let l=0;l<a.length;l+=2){try{const e=Qc(t[l+3],Nc,i);a[l]=e}catch(h){throw new Error(`failed to parse argument ${l+2} for interpolate expression: ${Hc(h)}`)}try{const s=Qc(t[l+4],e,i);a[l+1]=s}catch(h){throw new Error(`failed to parse argument ${l+3} for interpolate expression: ${Hc(h)}`)}}return[r,o,...a]}function yu(t,e,i){const s=Qc(t[t.length-1],e,i),n=new Array(t.length-1);for(let o=0;o<n.length-1;o+=2){try{const e=Qc(t[o+1],kc,i);n[o]=e}catch(r){throw new Error(`failed to parse argument ${o} of case expression: ${Hc(r)}`)}try{const e=Qc(t[o+2],s.type,i);n[o+1]=e}catch(r){throw new Error(`failed to parse argument ${o+1} of case expression: ${Hc(r)}`)}}return n[n.length-1]=s,n}function vu(t,e,i){let s,n=t[2];if(!Array.isArray(n))throw new Error('the second argument for the "in" operator must be an array');if("literal"===n[0]){if(n=n[1],!Array.isArray(n))throw new Error('failed to parse "in" expression: the literal operator must be followed by an array')}else if("string"===typeof n[0])throw new Error('for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions');s="string"===typeof n[0]?Fc:Nc;const r=new Array(n.length);for(let h=0;h<r.length;h++)try{const t=Qc(n[h],s,i);r[h]=t}catch(a){throw new Error(`failed to parse haystack item ${h} for "in" expression: ${Hc(a)}`)}const o=Qc(t[1],s,i);return[o,...r]}function xu(t,e,i){let s;try{s=Qc(t[1],Nc,i)}catch(o){throw new Error(`failed to parse first argument in palette expression: ${Hc(o)}`)}const n=t[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let a=0;a<r.length;a++){let t;try{t=Qc(n[a],Dc,i)}catch(o){throw new Error(`failed to parse color at index ${a} in palette expression: ${Hc(o)}`)}if(!(t instanceof $c))throw new Error(`the palette color at index ${a} must be a literal value`);r[a]=t}return[s,...r]}function wu(...t){return function(e,i,s){const n=e[0];let r=[];for(let o=0;o<t.length;o++){const n=t[o](e,i,s);if(o==t.length-1){if(!n)throw new Error("expected last argument validator to return the parsed args");r=n}}return new Zc(i,n,...r)}}function Eu(t,e,i){const s=t[0],n=eu[s];if(!n)throw new Error(`unknown operator: ${s}`);return n(t,e,i)}function Mu(t){if(!t)return"";const e=t.getType();switch(e){case"Point":case"LineString":case"Polygon":return e;case"MultiPoint":case"MultiLineString":case"MultiPolygon":return e.substring(5);case"Circle":return"Polygon";case"GeometryCollection":return Mu(t.getGeometries()[0]);default:return""}}function Su(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""}}function Cu(t,e,i){const s=Qc(t,e,i);return bu(s,i)}function bu(t,e){if(t instanceof $c){if(t.type===Dc&&"string"===typeof t.value){const e=Pc(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case tu.Number:case tu.String:case tu.Coalesce:return Iu(t,e);case tu.Get:case tu.Var:case tu.Has:return Tu(t,e);case tu.Id:return t=>t.featureId??"";case tu.GeometryType:return t=>t.geometryType;case tu.Concat:{const i=t.args.map(t=>bu(t,e));return t=>"".concat(...i.map(e=>(e(t)??"").toString()))}case tu.Resolution:return t=>t.resolution;case tu.Any:case tu.All:case tu.Between:case tu.In:case tu.Not:return Lu(t,e);case tu.Equal:case tu.NotEqual:case tu.LessThan:case tu.LessThanOrEqualTo:case tu.GreaterThan:case tu.GreaterThanOrEqualTo:return Au(t,e);case tu.Multiply:case tu.Divide:case tu.Add:case tu.Subtract:case tu.Clamp:case tu.Mod:case tu.Pow:case tu.Abs:case tu.Floor:case tu.Ceil:case tu.Round:case tu.Sin:case tu.Cos:case tu.Atan:case tu.Sqrt:return Ou(t,e);case tu.Case:return Gu(t,e);case tu.Match:return ku(t,e);case tu.Interpolate:case tu.InterpolateHcl:return Nu(t,e);case tu.ToString:return Fu(t,e);case tu.Array:return Pu(t,e);case tu.Color:return Ru(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function Pu(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);if(t.type===Dc&&(3===i||4===i)){const t=4===i?s[3]:null;return e=>[255*s[0](e),255*s[1](e),255*s[2](e),t?t(e):1]}return t=>{const e=new Array(i);for(let n=0;n<i;++n)e[n]=s[n](t);return e}}function Ru(t,e){const i=t.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=bu(t.args[r],e);if(i<3){const t=2===i?s[1]:null;return e=>{const i=s[0](e);return[i,i,i,t?t(e):1]}}const n=4===i?s[3]:null;return t=>[s[0](t),s[1](t),s[2](t),n?n(t):1]}function Iu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Coalesce:return t=>{for(let e=0;e<s;++e){const i=n[e](t);if("undefined"!==typeof i&&null!==i)return i}throw new Error("Expected one of the values to be non-null")};case tu.Number:case tu.String:return t=>{for(let e=0;e<s;++e){const s=n[e](t);if(typeof s===i)return s}throw new Error(`Expected one of the values to be a ${i}`)};default:throw new Error(`Unsupported assertion operator ${i}`)}}function Tu(t,e){const i=t.args[0],s=i.value;switch(t.operator){case tu.Get:return e=>{const i=t.args;let n=e.properties[s];for(let t=1,s=i.length;t<s;++t){const e=i[t],s=e.value;n=n[s]}return n};case tu.Var:return t=>t.variables[s];case tu.Has:return e=>{const i=t.args;if(!(s in e.properties))return!1;let n=e.properties[s];for(let t=1,s=i.length;t<s;++t){const e=i[t],s=e.value;if(!n||!Object.hasOwn(n,s))return!1;n=n[s]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}function Au(t,e){const i=t.operator,s=bu(t.args[0],e),n=bu(t.args[1],e);switch(i){case tu.Equal:return t=>s(t)===n(t);case tu.NotEqual:return t=>s(t)!==n(t);case tu.LessThan:return t=>s(t)<n(t);case tu.LessThanOrEqualTo:return t=>s(t)<=n(t);case tu.GreaterThan:return t=>s(t)>n(t);case tu.GreaterThanOrEqualTo:return t=>s(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}function Lu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Any:return t=>{for(let e=0;e<s;++e)if(n[e](t))return!0;return!1};case tu.All:return t=>{for(let e=0;e<s;++e)if(!n[e](t))return!1;return!0};case tu.Between:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case tu.In:return t=>{const e=n[0](t);for(let i=1;i<s;++i)if(e===n[i](t))return!0;return!1};case tu.Not:return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}function Ou(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.Multiply:return t=>{let e=1;for(let i=0;i<s;++i)e*=n[i](t);return e};case tu.Divide:return t=>n[0](t)/n[1](t);case tu.Add:return t=>{let e=0;for(let i=0;i<s;++i)e+=n[i](t);return e};case tu.Subtract:return t=>n[0](t)-n[1](t);case tu.Clamp:return t=>{const e=n[0](t),i=n[1](t);if(e<i)return i;const s=n[2](t);return e>s?s:e};case tu.Mod:return t=>n[0](t)%n[1](t);case tu.Pow:return t=>Math.pow(n[0](t),n[1](t));case tu.Abs:return t=>Math.abs(n[0](t));case tu.Floor:return t=>Math.floor(n[0](t));case tu.Ceil:return t=>Math.ceil(n[0](t));case tu.Round:return t=>Math.round(n[0](t));case tu.Sin:return t=>Math.sin(n[0](t));case tu.Cos:return t=>Math.cos(n[0](t));case tu.Atan:return 2===s?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case tu.Sqrt:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}function Gu(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);return t=>{for(let e=0;e<i-1;e+=2){const i=s[e](t);if(i)return s[e+1](t)}return s[i-1](t)}}function ku(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=bu(t.args[n],e);return t=>{const e=s[0](t);for(let n=1;n<i-1;n+=2)if(e===s[n](t))return s[n+1](t);return s[i-1](t)}}function Nu(t,e){const i=t.args.length,s=new Array(i);for(let r=0;r<i;++r)s[r]=bu(t.args[r],e);const n=t.operator===tu.InterpolateHcl?zu:ju;return t=>{const e=s[0](t),r=s[1](t);let o,a;for(let h=2;h<i;h+=2){const i=s[h](t);let l=s[h+1](t);const c=Array.isArray(l);if(c&&(l=xc(l)),i>=r)return 2===h?l:c?n(e,r,o,a,i,l):Du(e,r,o,a,i,l);o=i,a=l}return a}}function Fu(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let r=0;r<s;++r)n[r]=bu(t.args[r],e);switch(i){case tu.ToString:return e=>{const i=n[0](e);return t.args[0].type===Dc?Ic(i):i.toString()};default:throw new Error(`Unsupported convert operator ${i}`)}}function Du(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=e-i,h=1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1);return s+h*(r-s)}function ju(t,e,i,s,n,r){const o=n-i;return 0===o?s:[Du(t,e,i,s[0],n,r[0]),Du(t,e,i,s[1],n,r[1]),Du(t,e,i,s[2],n,r[2]),Du(t,e,i,s[3],n,r[3])]}function zu(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=Cc(s),h=Cc(r);let l=h[2]-a[2];l>180?l-=360:l<-180&&(l+=360);const c=[Du(t,e,i,a[0],n,h[0]),Du(t,e,i,a[1],n,h[1]),a[2]+Du(t,e,i,0,n,l),Du(t,e,i,s[3],n,r[3])];return bc(c)}var Uu={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};class Bu extends Oi{constructor(t,e,i,s){super(),this.extent=t,this.pixelRatio_=i,this.resolution=e,this.state="function"===typeof s?Uu.IDLE:s,this.image_=null,this.loader="function"===typeof s?s:null}changed(){this.dispatchEvent(ci.CHANGE)}getExtent(){return this.extent}getImage(){return this.image_}getPixelRatio(){return this.pixelRatio_}getResolution(){return this.resolution}getState(){return this.state}load(){if(this.state==Uu.IDLE){const t=this.loader;if(t){this.state=Uu.LOADING,this.changed();const e=this.getResolution(),i=Array.isArray(e)?e[0]:e;Ii(()=>t(this.getExtent(),i,this.getPixelRatio())).then(t=>{"image"in t&&(this.image_=t.image),"extent"in t&&t.extent&&(this.extent=t.extent),"resolution"in t&&void 0!==t.resolution&&(this.resolution=t.resolution),"pixelRatio"in t&&void 0!==t.pixelRatio&&(this.pixelRatio_=t.pixelRatio),(t instanceof HTMLImageElement||is&&t instanceof ImageBitmap||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement)&&(this.image_=t),this.state=Uu.LOADED}).catch(t=>{this.state=Uu.ERROR,console.error(t)}).finally(()=>this.changed())}}}setImage(t){this.image_=t}setResolution(t){this.resolution=t}}function Wu(t,e,i){const s=t;let n=!0,r=!1,o=!1;const a=[hi(s,ci.LOAD,function(){o=!0,r||e()})];return s.src&&es?(r=!0,s.decode().then(function(){n&&e()}).catch(function(t){n&&(o?e():i())})):a.push(hi(s,ci.ERROR,i)),function(){n=!1,a.forEach(li)}}function Xu(t,e){return new Promise((i,s)=>{function n(){o(),i(t)}function r(){o(),s(new Error("Image load error"))}function o(){t.removeEventListener("load",n),t.removeEventListener("error",r)}t.addEventListener("load",n),t.addEventListener("error",r),e&&(t.src=e)})}function Vu(t,e){return e&&(t.src=e),t.src&&es?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(s=>t.complete&&t.width?e(t):i(s))):Xu(t)}function qu(t,e){return e&&(t.src=e),t.src&&es&&is?t.decode().then(()=>createImageBitmap(t)).catch(e=>{if(t.complete&&t.width)return t;throw e}):Vu(t)}var Yu=Bu;class Ku{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let t=0;for(const e in this.cache_){const i=this.cache_[e];0!==(3&t++)||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=Hu(t,e),s=i in this.cache_?this.cache_[i]:null;return s}getPattern(t,e){const i=Hu(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const n=Hu(t,e),r=n in this.cache_;if(i&&(this.cache_[n]=i),s&&i)if(i.getImageState()===Uu.IDLE&&i.load(),i.getImageState()===Uu.LOADING)i.ready().then(()=>{const t=mh().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[n]=t)});else{const t=mh().createPattern(i.getImage(1),"repeat");t&&(this.patternCache_[n]=t)}r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}}function Hu(t,e){const i=e?Rc(e):"null";return t+":"+i}const $u=new Ku;let Zu=null;class Ju extends Oi{constructor(t,e,i,s,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin??null,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=n,this.imageState_=void 0===s?Uu.IDLE:s,this.size_=t&&t.width&&t.height?[t.width,t.height]:null,this.src_=e,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(void 0===this.tainted_&&this.imageState_===Uu.LOADED){const t=this.image_;if(!t)return!1;Zu||(Zu=ph(1,1,void 0,{willReadFrequently:!0})),Zu.drawImage(t,0,0);try{Zu.getImageData(0,0,1,1),this.tainted_=!1}catch{Zu=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(ci.CHANGE)}handleImageError_(){this.imageState_=Uu.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=Uu.LOADED;const t=this.image_;t&&"width"in t&&"height"in t&&(this.size_=[t.width,t.height]),this.dispatchChangeEvent_()}getImage(t){this.image_||this.initializeImage_(),this.replaceColor_(t);const e=this.image_;return this.canvas_[t]?this.canvas_[t]:e}setImage(t){this.image_=t}getPixelRatio(t){return this.replaceColor_(t),this.canvas_[t]?t:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_)if(this.isTainted_()){const t=this.size_;if(!t)return this.image_;const e=t[0],i=t[1],s=ph(e,i);s.fillRect(0,0,e,i),this.hitDetectionImage_=s.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===Uu.IDLE){this.image_||this.initializeImage_(),this.imageState_=Uu.LOADING;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Vu(this.image_,this.src_).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(t){if(!this.color_||this.canvas_[t]||this.imageState_!==Uu.LOADED)return;const e=this.image_;if(!e)return;const i=ph(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle=_c(this.color_),i.fillRect(0,0,s.width/t,s.height/t),i.globalCompositeOperation="destination-in",i.drawImage(e,0,0),this.canvas_[t]=s}ready(){return this.ready_||(this.ready_=new Promise(t=>{if(this.imageState_===Uu.LOADED||this.imageState_===Uu.ERROR)t();else{const e=()=>{this.imageState_!==Uu.LOADED&&this.imageState_!==Uu.ERROR||(this.removeEventListener(ci.CHANGE,e),t())};this.addEventListener(ci.CHANGE,e)}})),this.ready_}}function Qu(t,e,i,s,n,r){let o=void 0===e?void 0:$u.get(e,n);return o||(o=new Ju(t,t&&"src"in t?t.src||void 0:e,i,s,n),void 0!==e&&$u.set(e,n,o,r)),r&&o&&void 0!==e&&!$u.getPattern(e,n)&&$u.set(e,n,o,r),o}var td=Ju;function ed(t){return t?Array.isArray(t)?Ic(t):"object"===typeof t&&"src"in t?id(t):t:null}function id(t){if(!t.offset||!t.size)return $u.getPattern(t.src,t.color??null);const e=t.src+":"+t.offset,i=$u.getPattern(e,t.color??null);if(i)return i;const s=$u.get(t.src,null);if(!s||s.getImageState()!==Uu.LOADED)return null;const n=ph(t.size[0],t.size[1]);return n.drawImage(s.getImage(1),t.offset[0],t.offset[1],t.size[0],t.size[1],0,0,t.size[0],t.size[1]),Qu(n.canvas,e,{},Uu.LOADED,t.color??null,!0),$u.getPattern(e,t.color??null)}class sd{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=Lc(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new sd({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return wi()}getImage(t){return wi()}getHitDetectionImage(){return wi()}getPixelRatio(t){return 1}getImageState(){return wi()}getImageSize(){return wi()}getOrigin(){return wi()}getSize(){return wi()}setDisplacement(t){this.displacement_=t}setOpacity(t){this.opacity_=t}setRotateWithView(t){this.rotateWithView_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Lc(t)}listenImageChange(t){wi()}load(){wi()}unlistenImageChange(t){wi()}ready(){return Promise.resolve()}}var nd=sd;class rd extends nd{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.hitDetectionCanvas_=null,this.fill_=void 0!==t.fill?t.fill:null,this.origin_=[0,0],this.points_=t.points,this.radius=t.radius,this.radius2_=t.radius2,this.angle_=void 0!==t.angle?t.angle:0,this.stroke_=void 0!==t.stroke?t.stroke:null,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?Uu.LOADING:Uu.LOADED,this.imageState_===Uu.LOADING&&this.ready().then(()=>this.imageState_=Uu.LOADED),this.render()}clone(){const t=this.getScale(),e=new rd({fill:this.getFill()?.clone(),points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?.clone(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=$u.get(i,null)?.getImage(1);if(!s){const e=this.renderOptions_,n=Math.ceil(e.size*t),r=ph(n,n);this.draw_(e,r,t),s=r.canvas;const o=new td(s,void 0,{},Uu.LOADED,null);$u.set(i,null,o),createImageBitmap(s).then(t=>{o.setImage(t)})}return s}getPixelRatio(t){return t}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(t){this.radius!==t&&(this.radius=t,this.render())}getRadius2(){return this.radius2_}setRadius2(t){this.radius2_!==t&&(this.radius2_=t,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t,this.render()}listenImageChange(t){}load(){}unlistenImageChange(t){}calculateLineJoinSize_(t,e,i){if(0===e||this.points_===1/0||"bevel"!==t&&"miter"!==t)return e;let s=this.radius,n=void 0===this.radius2_?s:this.radius2_;if(s<n){const t=s;s=n,n=t}const r=void 0===this.radius2_?this.points_:2*this.points_,o=2*Math.PI/r,a=n*Math.sin(o),h=Math.sqrt(n*n-a*a),l=s-h,c=Math.sqrt(a*a+l*l),u=c/a;if("miter"===t&&u<=i)return u*e;const d=e/2/u,g=e/2*(l/c),f=Math.sqrt((s+d)*(s+d)+g*g),p=f-s;if(void 0===this.radius2_||"bevel"===t)return 2*p;const _=s*Math.sin(o),m=Math.sqrt(s*s-_*_),y=n-m,v=Math.sqrt(_*_+y*y),x=v/_;if(x<=i){const t=x*e/2-n-s;return 2*Math.max(p,t)}return 2*p}createRenderOptions(){let t,e="round",i="round",s=0,n=null,r=0,o=0;this.stroke_&&(t=ed(this.stroke_.getColor()??"#000"),o=this.stroke_.getWidth()??1,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??"round",e=this.stroke_.getLineCap()??"round",s=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,s),h=Math.max(this.radius,this.radius2_||0),l=Math.ceil(2*h+a);return{strokeStyle:t,strokeWidth:o,size:l,lineCap:e,lineDash:n,lineDashOffset:r,lineJoin:i,miterLimit:s}}render(){this.renderOptions_=this.createRenderOptions();const t=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[t,t]}draw_(t,e,i){if(e.scale(i,i),e.translate(t.size/2,t.size/2),this.createPath_(e),this.fill_){let t=this.fill_.getColor();null===t&&(t="#000"),e.fillStyle=ed(t),e.fill()}t.strokeStyle&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke())}createHitDetectionCanvas_(t){let e;if(this.fill_){let i=this.fill_.getColor(),s=0;"string"===typeof i&&(i=Rc(i)),null===i?s=1:Array.isArray(i)&&(s=4===i.length?i[3]:1),0===s&&(e=ph(t.size,t.size),this.drawHitDetectionCanvas_(t,e))}return e?e.canvas:this.getImage(1)}createPath_(t){let e=this.points_;const i=this.radius;if(e===1/0)t.arc(0,0,i,0,2*Math.PI);else{const s=void 0===this.radius2_?i:this.radius2_;void 0!==this.radius2_&&(e*=2);const n=this.angle_-Math.PI/2,r=2*Math.PI/e;for(let o=0;o<e;o++){const e=n+o*r,a=o%2===0?i:s;t.lineTo(a*Math.cos(e),a*Math.sin(e))}t.closePath()}}drawHitDetectionCanvas_(t,e){e.translate(t.size/2,t.size/2),this.createPath_(e),e.fillStyle="#000",e.fill(),t.strokeStyle&&(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())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}}var od=rd;class ad extends od{constructor(t){t=t||{radius:5},super({points:1/0,fill:t.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 ad({fill:this.getFill()?.clone(),stroke:this.getStroke()?.clone(),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}}var hd=ad;class ld{constructor(t){t=t||{},this.patternImage_=null,this.color_=null,void 0!==t.color&&this.setColor(t.color)}clone(){const t=this.getColor();return new ld({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(t){if(null!==t&&"object"===typeof t&&"src"in t){const e=Qu(null,t.src,{crossOrigin:"anonymous"},void 0,t.offset?null:t.color?t.color:null,!(t.offset&&t.size));e.ready().then(()=>{this.patternImage_=null}),e.getImageState()===Uu.IDLE&&e.load(),e.getImageState()===Uu.LOADING&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Mi(t):"object"===typeof t&&"src"in t?t.src+":"+t.offset:Rc(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}var cd=ld;function ud(t,e,i,s){return void 0!==i&&void 0!==s?[i/t,s/e]:void 0!==i?i/t:void 0!==s?s/e:1}class dd extends nd{constructor(t){t=t||{};const e=void 0!==t.opacity?t.opacity:1,i=void 0!==t.rotation?t.rotation:0,s=void 0!==t.scale?t.scale:1,n=void 0!==t.rotateWithView&&t.rotateWithView;super({opacity:e,rotation:i,scale:s,displacement:void 0!==t.displacement?t.displacement:[0,0],rotateWithView:n,declutterMode:t.declutterMode}),this.anchor_=void 0!==t.anchor?t.anchor:[.5,.5],this.normalizedAnchor_=null,this.anchorOrigin_=void 0!==t.anchorOrigin?t.anchorOrigin:"top-left",this.anchorXUnits_=void 0!==t.anchorXUnits?t.anchorXUnits:"fraction",this.anchorYUnits_=void 0!==t.anchorYUnits?t.anchorYUnits:"fraction",this.crossOrigin_=void 0!==t.crossOrigin?t.crossOrigin:null,this.referrerPolicy_=t.referrerPolicy;const r=void 0!==t.img?t.img:null;let o,a=t.src;if(cs(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||Mi(r)),cs(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),cs(!((void 0!==t.width||void 0!==t.height)&&void 0!==t.scale),"`width` or `height` cannot be provided together with `scale`"),void 0!==t.src?o=Uu.IDLE:void 0!==r&&(o="complete"in r?r.complete?r.src?Uu.LOADED:Uu.IDLE:Uu.LOADING:Uu.LOADED),this.color_=void 0!==t.color?Rc(t.color):null,this.iconImage_=Qu(r,a,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},o,this.color_),this.offset_=void 0!==t.offset?t.offset:[0,0],this.offsetOrigin_=void 0!==t.offsetOrigin?t.offsetOrigin:"top-left",this.origin_=null,this.size_=void 0!==t.size?t.size:null,this.initialOptions_,void 0!==t.width||void 0!==t.height){let e,i;if(t.size)[e,i]=t.size;else{const s=this.getImage(1);if(s.width&&s.height)e=s.width,i=s.height;else if(s instanceof HTMLImageElement){this.initialOptions_=t;const e=()=>{if(this.unlistenImageChange(e),!this.initialOptions_)return;const i=this.iconImage_.getSize();i&&this.setScale(ud(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(ud(e,i,t.width,t.height))}}clone(){let t,e,i;return this.initialOptions_?(e=this.initialOptions_.width,i=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new dd({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:e,height:i,size:null!==this.size_?this.size_.slice():void 0,src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let t=this.normalizedAnchor_;if(!t){t=this.anchor_;const e=this.getSize();if("fraction"==this.anchorXUnits_||"fraction"==this.anchorYUnits_){if(!e)return null;t=this.anchor_.slice(),"fraction"==this.anchorXUnits_&&(t[0]*=e[0]),"fraction"==this.anchorYUnits_&&(t[1]*=e[1])}if("top-left"!=this.anchorOrigin_){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),"top-right"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[0]=-t[0]+e[0]),"bottom-left"!=this.anchorOrigin_&&"bottom-right"!=this.anchorOrigin_||(t[1]=-t[1]+e[1])}this.normalizedAnchor_=t}const e=this.getDisplacement(),i=this.getScaleArray();return[t[0]-e[0]/i[0],t[1]+e[1]/i[1]]}setAnchor(t){this.anchor_=t,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(t){const e=t?Rc(t):null;if(this.color_===e||this.color_&&e&&this.color_.length===e.length&&this.color_.every((t,i)=>t===e[i]))return;this.color_=e;const i=this.getSrc(),s=void 0!==i?null:this.getHitDetectionImage(),n=void 0!==i?Uu.IDLE:this.iconImage_.getImageState();this.iconImage_=Qu(s,i,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},n,this.color_)}getImage(t){return this.iconImage_.getImage(t)}getPixelRatio(t){return this.iconImage_.getPixelRatio(t)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let t=this.offset_;if("top-left"!=this.offsetOrigin_){const e=this.getSize(),i=this.iconImage_.getSize();if(!e||!i)return null;t=t.slice(),"top-right"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[0]=i[0]-e[0]-t[0]),"bottom-left"!=this.offsetOrigin_&&"bottom-right"!=this.offsetOrigin_||(t[1]=i[1]-e[1]-t[1])}return this.origin_=t,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(t){this.iconImage_=Qu(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},Uu.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();if(this.size_)return this.size_[0]*t[0];if(this.iconImage_.getImageState()==Uu.LOADED){const e=this.iconImage_.getSize();if(e)return e[0]*t[0]}}getHeight(){const t=this.getScaleArray();if(this.size_)return this.size_[1]*t[1];if(this.iconImage_.getImageState()==Uu.LOADED){const e=this.iconImage_.getSize();if(e)return e[1]*t[1]}}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ci.CHANGE,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ci.CHANGE,t)}ready(){return this.iconImage_.ready()}}var gd=dd;class fd{constructor(t){t=t||{},this.color_=void 0!==t.color?t.color:null,this.lineCap_=t.lineCap,this.lineDash_=void 0!==t.lineDash?t.lineDash:null,this.lineDashOffset_=t.lineDashOffset,this.lineJoin_=t.lineJoin,this.miterLimit_=t.miterLimit,this.offset_=t.offset,this.width_=t.width}clone(){const t=this.getColor();return new fd({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?.slice(),lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(t){this.color_=t}setLineCap(t){this.lineCap_=t}setLineDash(t){this.lineDash_=t}setLineDashOffset(t){this.lineDashOffset_=t}setLineJoin(t){this.lineJoin_=t}setMiterLimit(t){this.miterLimit_=t}setOffset(t){this.offset_=t}setWidth(t){this.width_=t}}var pd=fd;class _d{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=xd,void 0!==t.geometry&&this.setGeometry(t.geometry),this.fill_=void 0!==t.fill?t.fill:null,this.image_=void 0!==t.image?t.image:null,this.renderer_=void 0!==t.renderer?t.renderer:null,this.hitDetectionRenderer_=void 0!==t.hitDetectionRenderer?t.hitDetectionRenderer:null,this.stroke_=void 0!==t.stroke?t.stroke:null,this.text_=void 0!==t.text?t.text:null,this.zIndex_=t.zIndex}clone(){let t=this.getGeometry();return t&&"object"===typeof t&&(t=t.clone()),new _d({geometry:t??void 0,fill:this.getFill()?.clone(),image:this.getImage()?.clone(),renderer:this.getRenderer()??void 0,stroke:this.getStroke()?.clone(),text:this.getText()?.clone(),zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(t){this.renderer_=t}setHitDetectionRenderer(t){this.hitDetectionRenderer_=t}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(t){this.fill_=t}getImage(){return this.image_}setImage(t){this.image_=t}getStroke(){return this.stroke_}setStroke(t){this.stroke_=t}getText(){return this.text_}setText(t){this.text_=t}getZIndex(){return this.zIndex_}setGeometry(t){"function"===typeof t?this.geometryFunction_=t:"string"===typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=xd,this.geometry_=t}setZIndex(t){this.zIndex_=t}}function md(t){let e;if("function"===typeof t)e=t;else{let i;if(Array.isArray(t))i=t;else{cs("function"===typeof t.getZIndex,"Expected an `Style` or an array of `Style`");const e=t;i=[e]}e=function(){return i}}return e}let yd=null;function vd(t,e){if(!yd){const t=new cd({color:"rgba(255,255,255,0.4)"}),e=new pd({color:"#3399CC",width:1.25});yd=[new _d({image:new hd({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return yd}function xd(t){return t.getGeometry()}var wd=_d;const Ed="#333";class Md{constructor(t){t=t||{},this.font_=t.font,this.rotation_=t.rotation,this.rotateWithView_=t.rotateWithView,this.keepUpright_=t.keepUpright,this.scale_=t.scale,this.scaleArray_=Lc(void 0!==t.scale?t.scale:1),this.text_=t.text,this.textAlign_=t.textAlign,this.justify_=t.justify,this.repeat_=t.repeat,this.textBaseline_=t.textBaseline,this.fill_=void 0!==t.fill?t.fill:new cd({color:Ed}),this.maxAngle_=void 0!==t.maxAngle?t.maxAngle:Math.PI/4,this.placement_=void 0!==t.placement?t.placement:"point",this.overflow_=!!t.overflow,this.stroke_=void 0!==t.stroke?t.stroke:null,this.offsetX_=void 0!==t.offsetX?t.offsetX:0,this.offsetY_=void 0!==t.offsetY?t.offsetY:0,this.backgroundFill_=t.backgroundFill?t.backgroundFill:null,this.backgroundStroke_=t.backgroundStroke?t.backgroundStroke:null,this.padding_=void 0===t.padding?null:t.padding,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new Md({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof cd?this.getFill().clone():this.getFill(),stroke:this.getStroke()?.clone(),offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?.clone(),backgroundStroke:this.getBackgroundStroke()?.clone(),padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(t){this.overflow_=t}setFont(t){this.font_=t}setMaxAngle(t){this.maxAngle_=t}setOffsetX(t){this.offsetX_=t}setOffsetY(t){this.offsetY_=t}setPlacement(t){this.placement_=t}setRepeat(t){this.repeat_=t}setRotateWithView(t){this.rotateWithView_=t}setKeepUpright(t){this.keepUpright_=t}setFill(t){this.fill_=t}setRotation(t){this.rotation_=t}setScale(t){this.scale_=t,this.scaleArray_=Lc(void 0!==t?t:1)}setStroke(t){this.stroke_=t}setText(t){this.text_=t}setTextAlign(t){this.textAlign_=t}setJustify(t){this.justify_=t}setTextBaseline(t){this.textBaseline_=t}setBackgroundFill(t){this.backgroundFill_=t}setBackgroundStroke(t){this.backgroundStroke_=t}setPadding(t){this.padding_=t}}var Sd=Md;function Cd(t){return!0}function bd(t,e){e=e??Jc();const i=Id(t,e),s=Su();return function(t,n){if(s.properties=t.getPropertiesInternal()??{},s.resolution=n,e.featureId){const e=t.getId();s.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(s.geometryType=Mu(e))}return i(s)}}function Pd(t,e){e=e??Jc();const i=t.length,s=new Array(i);for(let o=0;o<i;++o)s[o]=Td(t[o],e);const n=Su(),r=new Array(i);return function(t,o){if(n.properties=t.getPropertiesInternal()??{},n.resolution=o,e.featureId){const e=t.getId();n.featureId=void 0!==e?e:null}if(e.geometryType){const e=t.getGeometry();e&&(n.geometryType=Mu(e))}let a=0;for(let e=0;e<i;++e){const t=s[e](n);t&&(r[a]=t,a+=1)}return r.length=a,r}}function Rd(t,e){if(e=e??Jc(),!Array.isArray(t))return Pd([t],e);const i=t.length,s=t[0];if("style"in s){const s=new Array(i);for(let e=0;e<i;++e){const i=t[e];if(!("style"in i))throw new Error("Expected a list of rules with a style property");s[e]=i}return bd(s,e)}const n=t;return Pd(n,e)}function Id(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n){const i=t[n],r="filter"in i&&void 0!==i.filter?Cu(i.filter,kc,e):Cd;let o;if(Array.isArray(i.style)){const t=i.style.length;o=new Array(t);for(let s=0;s<t;++s)o[s]=Td(i.style[s],e)}else o=[Td(i.style,e)];s[n]={filter:r,styles:o}}return function(e){const n=[];let r=!1;for(let o=0;o<i;++o){const i=s[o].filter;if(i(e)&&(!t[o].else||!r)){r=!0;for(const t of s[o].styles){const i=t(e);i&&n.push(i)}}}return n}}function Td(t,e){const i=Ad(t,"",e),s=Ld(t,"",e),n=Od(t,e),r=Gd(t,e),o=jd(t,"z-index",e);if(!i&&!s&&!n&&!r&&!oi(t))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new wd;return function(t){let e=!0;if(i){const s=i(t);s&&(e=!1),a.setFill(s)}if(s){const i=s(t);i&&(e=!1),a.setStroke(i)}if(n){const i=n(t);i&&(e=!1),a.setText(i)}if(r){const i=r(t);i&&(e=!1),a.setImage(i)}return o&&a.setZIndex(o(t)),e?null:a}}function Ad(t,e,i){let s;if(e+"fill-pattern-src"in t)s=Ud(t,e+"fill-",i);else{if("none"===Dd(t,e+"fill-color"))return t=>null;s=Wd(t,e+"fill-color",i)}if(!s)return null;const n=new cd;return function(t){const e=s(t);return e===oc?null:(n.setColor(e),n)}}function Ld(t,e,i){const s=jd(t,e+"stroke-width",i),n=Wd(t,e+"stroke-color",i);if(!s&&!n)return null;const r=zd(t,e+"stroke-line-cap",i),o=zd(t,e+"stroke-line-join",i),a=Xd(t,e+"stroke-line-dash",i),h=jd(t,e+"stroke-line-dash-offset",i),l=jd(t,e+"stroke-miter-limit",i),c=jd(t,e+"stroke-offset",i),u=new pd;return function(t){if(n){const e=n(t);if(e===oc)return null;u.setColor(e)}if(s&&u.setWidth(s(t)),r){const e=r(t);if("butt"!==e&&"round"!==e&&"square"!==e)throw new Error("Expected butt, round, or square line cap");u.setLineCap(e)}if(o){const e=o(t);if("bevel"!==e&&"round"!==e&&"miter"!==e)throw new Error("Expected bevel, round, or miter line join");u.setLineJoin(e)}return a&&u.setLineDash(a(t)),h&&u.setLineDashOffset(h(t)),l&&u.setMiterLimit(l(t)),c&&u.setOffset(c(t)),u}}function Od(t,e){const i="text-",s=zd(t,i+"value",e);if(!s)return null;const n=Ad(t,i,e),r=Ad(t,i+"background-",e),o=Ld(t,i,e),a=Ld(t,i+"background-",e),h=zd(t,i+"font",e),l=jd(t,i+"max-angle",e),c=jd(t,i+"offset-x",e),u=jd(t,i+"offset-y",e),d=Bd(t,i+"overflow",e),g=zd(t,i+"placement",e),f=jd(t,i+"repeat",e),p=Yd(t,i+"scale",e),_=Bd(t,i+"rotate-with-view",e),m=jd(t,i+"rotation",e),y=zd(t,i+"align",e),v=zd(t,i+"justify",e),x=zd(t,i+"baseline",e),w=Bd(t,i+"keep-upright",e),E=Xd(t,i+"padding",e),M=tg(t,i+"declutter-mode"),S=new Sd({declutterMode:M});return function(t){if(S.setText(s(t)),n&&S.setFill(n(t)),r&&S.setBackgroundFill(r(t)),o&&S.setStroke(o(t)),a&&S.setBackgroundStroke(a(t)),h&&S.setFont(h(t)),l&&S.setMaxAngle(l(t)),c&&S.setOffsetX(c(t)),u&&S.setOffsetY(u(t)),d&&S.setOverflow(d(t)),g){const e=g(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");S.setPlacement(e)}if(f&&S.setRepeat(f(t)),p&&S.setScale(p(t)),_&&S.setRotateWithView(_(t)),m&&S.setRotation(m(t)),y){const e=y(t);if("left"!==e&&"center"!==e&&"right"!==e&&"end"!==e&&"start"!==e)throw new Error("Expected left, right, center, start, or end for text-align");S.setTextAlign(e)}if(v){const e=v(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");S.setJustify(e)}if(x){const e=x(t);if("bottom"!==e&&"top"!==e&&"middle"!==e&&"alphabetic"!==e&&"hanging"!==e)throw new Error("Expected bottom, top, middle, alphabetic, or hanging for text-baseline");S.setTextBaseline(e)}return E&&S.setPadding(E(t)),w&&S.setKeepUpright(w(t)),S}}function Gd(t,e){return"icon-src"in t?kd(t,e):"shape-points"in t?Nd(t,e):"circle-radius"in t?Fd(t,e):null}function kd(t,e){const i="icon-",s=i+"src",n=ig(Dd(t,s),s),r=Vd(t,i+"anchor",e),o=Yd(t,i+"scale",e),a=jd(t,i+"opacity",e),h=Vd(t,i+"displacement",e),l=jd(t,i+"rotation",e),c=Bd(t,i+"rotate-with-view",e),u=Zd(t,i+"anchor-origin"),d=Jd(t,i+"anchor-x-units"),g=Jd(t,i+"anchor-y-units"),f=Dd(t,i+"color");let p,_=null;if(void 0!==f){const s=Array.isArray(f)&&f.length>0&&"string"===typeof f[0];s?_=Wd(t,i+"color",e):p=ng(f,i+"color")}const m=$d(t,i+"cross-origin"),y=Qd(t,i+"offset"),v=Zd(t,i+"offset-origin"),x=Kd(t,i+"width"),w=Kd(t,i+"height"),E=Hd(t,i+"size"),M=tg(t,i+"declutter-mode"),S={src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:g,crossOrigin:m,offset:y,offsetOrigin:v,height:w,width:x,size:E,declutterMode:M};let C=null;return function(t){if(C)_&&C.setColor(_(t));else{const e=_?_(t):p;C=new gd(void 0!==e?Object.assign({},S,{color:e}):Object.assign({},S))}return a&&C.setOpacity(a(t)),h&&C.setDisplacement(h(t)),l&&C.setRotation(l(t)),c&&C.setRotateWithView(c(t)),o&&C.setScale(o(t)),r&&C.setAnchor(r(t)),C}}function Nd(t,e){const i="shape-",s=i+"points",n=i+"radius",r=sg(Dd(t,s),s);if(!(n in t))throw new Error(`Expected a number for ${n}`);const o=jd(t,n,e),a=Dd(t,n),h="number"===typeof a?a:5,l=i+"radius2",c=jd(t,l,e),u=Dd(t,l),d="number"===typeof u?u:void 0,g=Ad(t,i,e),f=Ld(t,i,e),p=Yd(t,i+"scale",e),_=Vd(t,i+"displacement",e),m=jd(t,i+"rotation",e),y=Bd(t,i+"rotate-with-view",e),v=Kd(t,i+"angle"),x=tg(t,i+"declutter-mode"),w=new od({points:r,radius:h,radius2:d,angle:v,declutterMode:x});return function(t){return o&&w.setRadius(o(t)),c&&w.setRadius2(c(t)),g&&w.setFill(g(t)),f&&w.setStroke(f(t)),_&&w.setDisplacement(_(t)),m&&w.setRotation(m(t)),y&&w.setRotateWithView(y(t)),p&&w.setScale(p(t)),w}}function Fd(t,e){const i="circle-",s=Ad(t,i,e),n=Ld(t,i,e),r=jd(t,i+"radius",e),o=Yd(t,i+"scale",e),a=Vd(t,i+"displacement",e),h=jd(t,i+"rotation",e),l=Bd(t,i+"rotate-with-view",e),c=tg(t,i+"declutter-mode"),u=new hd({radius:5,declutterMode:c});return function(t){return r&&u.setRadius(r(t)),s&&u.setFill(s(t)),n&&u.setStroke(n(t)),a&&u.setDisplacement(a(t)),h&&u.setRotation(h(t)),l&&u.setRotateWithView(l(t)),o&&u.setScale(o(t)),u}}function Dd(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function jd(t,e,i){const s=Dd(t,e);if(void 0===s)return;const n=Cu(s,Nc,i);return function(t){return sg(n(t),e)}}function zd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,Fc,i);return function(t){return ig(n(t),e)}}function Ud(t,e,i){const s=zd(t,e+"pattern-src",i),n=qd(t,e+"pattern-offset",i),r=qd(t,e+"pattern-size",i),o=Wd(t,e+"color",i);return function(t){return s?{src:s(t),offset:n?n(t):null,size:r?r(t):null,color:o?o(t):null}:null}}function Bd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,kc,i);return function(t){const i=n(t);if("boolean"!==typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Wd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,Dc,i);return function(t){return ng(n(t),e)}}function Xd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;if(Array.isArray(s)&&(0===s.length||"string"!==typeof s[0])){const t=s.map((t,s)=>{if("number"===typeof t)return()=>t;const n=Cu(t,Nc,i);return function(t){return sg(n(t),`${e}[${s}]`)}});return function(e){const i=new Array(t.length);for(let s=0;s<t.length;++s)i[s]=t[s](e);return i}}const n=Cu(s,jc,i);return function(t){return eg(n(t),e)}}function Vd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc,i);return function(t){const i=eg(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function qd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc,i);return function(t){return rg(n(t),e)}}function Yd(t,e,i){const s=Dd(t,e);if(void 0===s)return null;const n=Cu(s,jc|Nc,i);return function(t){return og(n(t),e)}}function Kd(t,e){const i=Dd(t,e);if(void 0!==i){if("number"!==typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Hd(t,e){const i=Dd(t,e);if(void 0!==i){if("number"===typeof i)return Lc(i);if(!Array.isArray(i))throw new Error(`Expected a number or size array for ${e}`);if(2!==i.length||"number"!==typeof i[0]||"number"!==typeof i[1])throw new Error(`Expected a number or size array for ${e}`);return i}}function $d(t,e){const i=Dd(t,e);if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);return i}}function Zd(t,e){const i=Dd(t,e);if(void 0!==i){if("bottom-left"!==i&&"bottom-right"!==i&&"top-left"!==i&&"top-right"!==i)throw new Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${e}`);return i}}function Jd(t,e){const i=Dd(t,e);if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Qd(t,e){const i=Dd(t,e);if(void 0!==i)return eg(i,e)}function tg(t,e){const i=Dd(t,e);if(void 0!==i){if("string"!==typeof i)throw new Error(`Expected a string for ${e}`);if("declutter"!==i&&"obstacle"!==i&&"none"!==i)throw new Error(`Expected declutter, obstacle, or none for ${e}`);return i}}function eg(t,e){if(!Array.isArray(t))throw new Error(`Expected an array for ${e}`);const i=t.length;for(let s=0;s<i;++s)if("number"!==typeof t[s])throw new Error(`Expected an array of numbers for ${e}`);return t}function ig(t,e){if("string"!==typeof t)throw new Error(`Expected a string for ${e}`);return t}function sg(t,e){if("number"!==typeof t)throw new Error(`Expected a number for ${e}`);return t}function ng(t,e){if("string"===typeof t)return t;const i=eg(t,e),s=i.length;if(s<3||s>4)throw new Error(`Expected a color with 3 or 4 values for ${e}`);return i}function rg(t,e){const i=eg(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}function og(t,e){return"number"===typeof t?t:rg(t,e)}const ag={RENDER_ORDER:"renderOrder"};class hg extends Ul{constructor(t){t=t||{};const e=Object.assign({},t);delete e.style,delete e.renderBuffer,delete e.updateWhileAnimating,delete e.updateWhileInteracting,super(e),this.declutter_=t.declutter?String(t.declutter):void 0,this.renderBuffer_=void 0!==t.renderBuffer?t.renderBuffer:100,this.style_=null,this.styleFunction_=void 0,this.setStyle(t.style),this.updateWhileAnimating_=void 0!==t.updateWhileAnimating&&t.updateWhileAnimating,this.updateWhileInteracting_=void 0!==t.updateWhileInteracting&&t.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(t){return super.getFeatures(t)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(ag.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();if(!i)return;t.declutter||(t.declutter={}),i in t.declutter===!1&&(t.declutter[i]=new Vl(9));const s=this.getRenderer();s&&s.renderDeclutter(t,e)}setRenderOrder(t){this.set(ag.RENDER_ORDER,t)}setStyle(t){this.style_=void 0===t?vd:t??null;const e=lg(t);this.styleFunction_=null===t||null===e?void 0:md(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}}function lg(t){if(void 0===t)return vd;if(!t)return null;if("function"===typeof t)return t;if(t instanceof wd)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof wd){const e=t.length,i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!(e instanceof wd))throw new Error("Expected a list of style instances");i[s]=e}return i}const e=t;return Rd(e)}var cg=hg;class ug extends Ai{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s??void 0}}var dg=ug;const gg="10px sans-serif",fg=[],pg=[0,0,0,0],_g=new ji;let mg,yg=null;const vg={},xg=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function wg(t,e,i){return`${t} ${e} 16px "${i}"`}const Eg=function(){const t=100;let e,i;async function s(t){await i.ready;const e=ch(t);if(!e)return!1;const s=e.families[0].toLowerCase(),n=e.weight,r=[];if(i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=lh[t.weight]||t.weight;i===s&&t.style===e.style&&o==n&&r.push(t)}),0===r.length)return!1;const o=await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)));return o.some(t=>t)}async function n(){await i.ready;let r=!0;const o=_g.getProperties(),a=Object.keys(o).filter(e=>o[e]<t);for(let e=a.length-1;e>=0;--e){const i=a[e];let n=o[i];n<t&&(await s(i)?(ri(vg),_g.set(i,t)):(n+=10,_g.set(i,n,!0),n<t&&(r=!1)))}e=void 0,r||(e=setTimeout(n,100))}return async function(t){i||(i=ts?self.fonts:document.fonts);const s=ch(t);if(!s)return;const r=s.families;let o=!1;for(const e of r){if(xg.has(e))continue;const t=wg(s.style,s.weight,e);void 0===_g.get(t)&&(_g.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(n,100))}}(),Mg=function(){let t;return function(e){let i=vg[e];if(void 0==i){if(ts){const t=ch(e),s=Sg(e,"Žg"),n=!t||isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight);i=n*(s.actualBoundingBoxAscent+s.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);vg[e]=i}return i}}();function Sg(t,e){return yg||(yg=ph(1,1)),t!=mg&&(yg.font=t,mg=yg.font),yg.measureText(e)}function Cg(t,e){return Sg(t,e).width}function bg(t,e,i){if(e in i)return i[e];const s=e.split("\n").reduce((e,i)=>Math.max(e,Cg(t,i)),0);return i[e]=s,s}function Pg(t,e){const i=[],s=[],n=[];let r=0,o=0,a=0,h=0;for(let l=0,c=e.length;l<=c;l+=2){const u=e[l];if("\n"===u||l===c){r=Math.max(r,o),n.push(o),o=0,a+=h,h=0;continue}const d=e[l+1]||t.font,g=Cg(d,u);i.push(g),o+=g;const f=Mg(d);s.push(f),h=Math.max(h,f)}return{width:r,height:a,widths:i,heights:s,lineWidths:n}}function Rg(t,e,i,s,n,r,o,a,h,l,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=function(t){return t.globalAlpha*=i}:t.globalAlpha*=i),e&&t.transform.apply(t,e),s.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),Ig(s,t)):c[0]<0||c[1]<0?(t.translate(h,l),t.scale(c[0],c[1]),t.drawImage(s,n,r,o,a,0,0,o,a)):t.drawImage(s,n,r,o,a,h,l,o*c[0],a*c[1]),t.restore()}function Ig(t,e){const i=e,s=t.contextInstructions;for(let n=0,r=s.length;n<r;n+=2)if(Array.isArray(s[n+1])){const t=s[n];i[t].apply(i,s[n+1])}else{const t=s[n];i[t]=s[n+1]}}class Tg extends di{constructor(t){super(),this.map_=t}dispatchRenderEvent(t,e){wi()}calculateMatrices2D(t){const e=t.viewState,i=t.coordinateToPixelTransform,s=t.pixelToCoordinateTransform;Mo(i,t.size[0]/2,t.size[1]/2,1/e.resolution,-1/e.resolution,-e.rotation,-e.center[0],-e.center[1]),So(s,i)}forEachFeatureAtCoordinate(t,e,i,s,n,r,o,a){let h;const l=e.viewState;function c(t,e,i,s){return n.call(r,e,t?i:null,s)}const u=l.projection,d=bn(t.slice(),u),g=[[0,0]];if(u.canWrapX()&&s){const t=u.getExtent(),e=gn(t);g.push([-e,0],[e,0])}const f=e.layerStatesArray,p=f.length,_=[],m=[];for(let v=0;v<g.length;v++)for(let s=p-1;s>=0;--s){const n=f[s],r=n.layer;if(r.hasRenderer()&&zl(n,l)&&o.call(a,r)){const s=r.getRenderer(),o=r.getSource();if(s&&o){const r=o.getWrapX()?d:t,a=c.bind(null,n.managed);m[0]=r[0]+g[v][0],m[1]=r[1]+g[v][1],h=s.forEachFeatureAtCoordinate(m,e,i,a,_)}if(h)return h}}if(0===_.length)return;const y=1/_.length;return _.forEach((t,e)=>t.distanceSq+=e*y),_.sort((t,e)=>t.distanceSq-e.distanceSq),_.some(t=>h=t.callback(t.feature,t.layer,t.geometry)),h}hasFeatureAtCoordinate(t,e,i,s,n,r){const o=this.forEachFeatureAtCoordinate(t,e,i,s,Ci,this,n,r);return void 0!==o}getMap(){return this.map_}renderFrame(t){wi()}scheduleExpireIconCache(t){$u.canExpireCache()&&t.postRenderFunctions.push(Ag)}}function Ag(t,e){$u.expire()}var Lg=Tg;class Og extends Lg{constructor(t){super(t),this.fontChangeListenerKey_=ai(_g,ni.PROPERTYCHANGE,t.redrawText,t),this.element_=ts?Eh():document.createElement("div");const e=this.element_.style;e.position="absolute",e.width="100%",e.height="100%",e.zIndex="0",this.element_.className=sh+" ol-layers";const i=t.getViewport();i&&i.insertBefore(this.element_,i.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(t,e){const i=this.getMap();if(i.hasListener(t)){const s=new dg(t,void 0,e);i.dispatchEvent(s)}}disposeInternal(){li(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(t){if(!t)return void(this.renderedVisible_&&(this.element_.style.display="none",this.renderedVisible_=!1));this.calculateMatrices2D(t),this.dispatchRenderEvent(Dl.PRECOMPOSE,t);const e=t.layerStatesArray.sort((t,e)=>t.zIndex-e.zIndex),i=e.some(t=>t.layer instanceof cg&&t.layer.getDeclutter());i&&(t.declutter={});const s=t.viewState;this.children_.length=0;const n=this.getMap(),r=n.getTargetElement();let o;Mh(r)&&(o=r.getContext("2d"),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,r.width,r.height));const a=[];let h=o?r:null;for(let l=0,c=e.length;l<c;++l){const i=e[l];t.layerIndex=l;const n=i.layer,r=n.getSourceState();if(!zl(i,s)||"ready"!=r&&"undefined"!=r){n.unrender();continue}const o=n.render(t,h);o&&(o!==h&&(this.children_.push(o),h=o),a.push(i))}if(this.declutter(t,a),wh(this.element_,this.children_),o)for(const l of this.children_){const t=l.firstElementChild||l,e=l.style.backgroundColor;if(e&&(!Mh(t)||t.width>0)&&(o.fillStyle=e,o.fillRect(0,0,o.canvas.width,o.canvas.height)),!Mh(t)||0===t.width)continue;o.save();const i=l.style.opacity||t.style.opacity;o.globalAlpha=""===i?1:Number(i);const s=t.style.transform;if(s)o.transform(...Ro(s));else{const e=parseFloat(t.style.width)/t.width,i=parseFloat(t.style.height)/t.height;o.transform(e,0,0,i,0,0)}o.drawImage(t,0,0),o.restore()}this.dispatchRenderEvent(Dl.POSTCOMPOSE,t),this.renderedVisible_||(this.element_.style.display="",this.renderedVisible_=!0),this.scheduleExpireIconCache(t)}declutter(t,e){if(t.declutter){for(let i=e.length-1;i>=0;--i){const s=e[i],n=s.layer;n.getDeclutter()&&n.renderDeclutter(t,s)}e.forEach(e=>e.layer?.renderDeferred(t))}}}var Gg=Og;function kg(t){t instanceof Ul?t.setMapInternal(null):t instanceof Fl&&t.getLayers().forEach(kg)}function Ng(t,e){if(t instanceof Ul)t.setMapInternal(e);else if(t instanceof Fl){const i=t.getLayers().getArray();for(let t=0,s=i.length;t<s;++t)Ng(i[t],e)}}class Fg extends ji{constructor(t){super(),t=t||{},this.on,this.once,this.un;const e=Dg(t);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.ctrlKey_=!1,this.boundHandleCtrlKey_=this.handleCtrlKey_.bind(this),this.maxTilesLoading_=void 0!==t.maxTilesLoading?t.maxTilesLoading:16,this.pixelRatio_=void 0!==t.pixelRatio?t.pixelRatio:Qi,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=xo(),this.pixelToCoordinateTransform_=xo(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,this.viewport_,this.overlayContainer_,this.overlayContainerStopEvent_,ts||(this.viewport_=document.createElement("div"),this.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),this.viewport_.style.position="relative",this.viewport_.style.overflow="hidden",this.viewport_.style.width="100%",this.viewport_.style.height="100%",this.overlayContainer_=document.createElement("div"),this.overlayContainer_.style.position="absolute",this.overlayContainer_.style.zIndex="0",this.overlayContainer_.style.width="100%",this.overlayContainer_.style.height="100%",this.overlayContainer_.style.pointerEvents="none",this.overlayContainer_.className="ol-overlaycontainer",this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement("div"),this.overlayContainerStopEvent_.style.position="absolute",this.overlayContainerStopEvent_.style.zIndex="0",this.overlayContainerStopEvent_.style.width="100%",this.overlayContainerStopEvent_.style.height="100%",this.overlayContainerStopEvent_.style.pointerEvents="none",this.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=t.moveTolerance,this.keyboardEventTarget_=e.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,ts||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=e.controls||(ts?new Wi:Lh()),this.interactions=e.interactions||(ts?new Wi:Il({onFocusOnly:!0})),this.overlays_=e.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new ps(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(hs.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(hs.VIEW,this.handleViewChanged_),this.addChangeListener(hs.SIZE,this.handleSizeChanged_),this.addChangeListener(hs.TARGET,this.handleTargetChanged_),this.setProperties(e.values);const i=this;!t.view||t.view instanceof eh||t.view.then(function(t){i.setView(new eh(t))}),this.controls.addEventListener(si.ADD,t=>{t.element.setMap(this)}),this.controls.addEventListener(si.REMOVE,t=>{t.element.setMap(null)}),this.interactions.addEventListener(si.ADD,t=>{t.element.setMap(this)}),this.interactions.addEventListener(si.REMOVE,t=>{t.element.setMap(null)}),this.overlays_.addEventListener(si.ADD,t=>{this.addOverlayInternal_(t.element)}),this.overlays_.addEventListener(si.REMOVE,t=>{const e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}),this.controls.forEach(t=>{t.setMap(this)}),this.interactions.forEach(t=>{t.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(t){this.getControls().push(t)}addInteraction(t){this.getInteractions().push(t)}addLayer(t){const e=this.getLayerGroup().getLayers();e.push(t)}handleLayerAdd_(t){Ng(t.layer,this)}addOverlay(t){this.getOverlays().push(t)}addOverlayInternal_(t){const e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(t,e,i){if(!this.frameState_||!this.renderer_)return;const s=this.getCoordinateFromPixelInternal(t);i=void 0!==i?i:{};const n=void 0!==i.hitTolerance?i.hitTolerance:0,r=void 0!==i.layerFilter?i.layerFilter:Ci,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(s,this.frameState_,n,o,e,null,r,null)}getFeaturesAtPixel(t,e){const i=[];return this.forEachFeatureAtPixel(t,function(t){i.push(t)},e),i}getAllLayers(){const t=[];function e(i){i.forEach(function(i){i instanceof Fl?e(i.getLayers()):t.push(i)})}return e(this.getLayers()),t}hasFeatureAtPixel(t,e){if(!this.frameState_||!this.renderer_)return!1;const i=this.getCoordinateFromPixelInternal(t);e=void 0!==e?e:{};const s=void 0!==e.layerFilter?e.layerFilter:Ci,n=void 0!==e.hitTolerance?e.hitTolerance:0,r=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,n,r,s,null)}getEventCoordinate(t){return this.getCoordinateFromPixel(this.getEventPixel(t))}getEventCoordinateInternal(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))}getEventPixel(t){const e=this.viewport_,i=e.getBoundingClientRect(),s=this.getSize(),n=i.width/s[0],r=i.height/s[1],o="changedTouches"in t?t.changedTouches[0]:t;return[(o.clientX-i.left)/n,(o.clientY-i.top)/r]}getTarget(){return this.get(hs.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(t,e){const i=uo(this.getCoordinateFromPixelInternal(t),this.getView().getProjection());if(e?.wrapX&&i){const t=co()||this.getView().getProjection();bn(i,t)}return i}getCoordinateFromPixelInternal(t){const e=this.frameState_;return e?Eo(e.pixelToCoordinateTransform,t.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(t){const e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null}getInteractions(){return this.interactions}getLayerGroup(){return this.get(hs.LAYERGROUP)}setLayers(t){const e=this.getLayerGroup();if(t instanceof Wi)return void e.setLayers(t);const i=e.getLayers();i.clear(),i.extend(t)}getLayers(){const t=this.getLayerGroup().getLayers();return t}updateRenderComplete_(){this.renderComplete_=(this.hasListener(as.LOADSTART)||this.hasListener(as.LOADEND)||this.hasListener(Dl.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady()}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 s=i.layer.getRenderer();if(s&&!s.ready)return!0;const n=i.layer.getSource();if(n&&n.loading)return!0}return!1}getPixelFromCoordinate(t,e){const i=this.getView(),s=i.getProjection();let n=go(t,s);return e?.wrapX&&this.frameState_&&(n=Pn(n.slice(),s,this.frameState_.viewState.center[0])),this.getPixelFromCoordinateInternal(n)}getPixelFromCoordinateInternal(t){const e=this.frameState_;return e?Eo(e.coordinateToPixelTransform,t.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(t){this.pixelRatio_!==t&&(this.pixelRatio_=t,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(hs.SIZE)}getView(){return this.get(hs.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){const t=this.getTargetElement();return t?t.ownerDocument:document}getTilePriority(t,e,i,s){return _s(this.frameState_,t,e,i,s)}handleBrowserEvent(t,e){e=e||t.type;const i=new Yi(e,this,t);this.handleMapBrowserEvent(i)}handleCtrlKey_(t){const e=t;this.ctrlKey_="Control"===e.key?e.type===ci.KEYDOWN:e.ctrlKey}handleMapBrowserEvent(t){if(!1===t.originalEvent.ctrlKey&&(this.ctrlKey_=!1),t.ctrlKey=this.ctrlKey_,!this.frameState_)return;const e=t.originalEvent,i=e.type;if(i===ns.POINTERDOWN||i===ci.WHEEL||i===ci.KEYDOWN){const t=this.getOwnerDocument(),i=this.viewport_.getRootNode?this.viewport_.getRootNode():t,s=e.target,n=i instanceof ShadowRoot?i.host===s?i.host.ownerDocument:i:i===t?t.documentElement:i;if(this.overlayContainerStopEvent_.contains(s)||!n.contains(s))return}if(t.frameState=this.frameState_,!1!==this.dispatchEvent(t)){const e=this.getInteractions().getArray().slice();for(let i=e.length-1;i>=0;i--){const s=e[i];if(s.getMap()!==this||!s.getActive()||!this.getTargetElement())continue;const n=s.handleEvent(t);if(!n||t.propagationStopped)break}}}handlePostRender(){const t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){let i=this.maxTilesLoading_,s=i;const n=t?t.viewHints:void 0,r=!!n&&(n[ms.ANIMATING]||n[ms.INTERACTING]);if(r){const e=Date.now()-t.time>8;i=e?0:8,s=e?0:2}if(e.getTilesLoading()<i){const t=e.getCount();e.reprioritize(),e.getCount()<t&&this.updateRenderComplete_(),e.loadMoreTiles(i,s)}}t&&this.renderer_&&!t.animate&&(this.renderComplete_?(this.hasListener(Dl.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Dl.RENDERCOMPLETE,t),!1===this.loaded_&&(this.loaded_=!0,this.dispatchEvent(new Vi(as.LOADEND,this,t)))):!0===this.loaded_&&(this.loaded_=!1,this.dispatchEvent(new Vi(as.LOADSTART,this,t))));const i=this.postRenderFunctions_;if(t)for(let s=0,n=i.length;s<n;++s)i[s](this,t);i.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){const t=this.targetChangeHandlerKeys_;for(let i=0,s=t.length;i<s;++i)li(t[i]);this.targetChangeHandlerKeys_=null;const e=this.getOwnerDocument();e.removeEventListener(ci.KEYDOWN,this.boundHandleCtrlKey_,!0),e.removeEventListener(ci.KEYUP,this.boundHandleCtrlKey_,!0),this.ctrlKey_=!1,this.viewport_.removeEventListener(ci.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(ci.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Mh(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);const t=this.targetElement_.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.unobserve(t.host),this.setSize(void 0)}const t=this.getTarget(),e="string"===typeof t?document.getElementById(t):t;if(this.targetElement_=e,e){if(Mh(e)||e.appendChild(this.viewport_),this.renderer_||(this.renderer_=new Gg(this)),!Mh(e)){this.mapBrowserEventHandler_=new os(this,this.moveTolerance_);for(const e in Ki)this.mapBrowserEventHandler_.addEventListener(Ki[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(ci.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(ci.WHEEL,this.boundHandleBrowserEvent_,!!ss&&{passive:!1});const t=this.getOwnerDocument();let i;if(t.addEventListener(ci.KEYDOWN,this.boundHandleCtrlKey_,!0),t.addEventListener(ci.KEYUP,this.boundHandleCtrlKey_,!0),this.keyboardEventTarget_)i=this.keyboardEventTarget_;else{const t=e.getRootNode(),s=t instanceof ShadowRoot?t.host:e;i=s}if(this.targetChangeHandlerKeys_=[ai(i,ci.KEYDOWN,this.handleBrowserEvent,this),ai(i,ci.KEYPRESS,this.handleBrowserEvent,this)],!Mh(e)){const t=e.getRootNode();t instanceof ShadowRoot&&this.resizeObserver_.observe(t.host),this.resizeObserver_?.observe(e)}}this.updateSize()}else this.renderer_&&(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),this.renderer_=null),this.animationDelayKey_&&(cancelAnimationFrame(this.animationDelayKey_),this.animationDelayKey_=void 0)}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&(li(this.viewPropertyListenerKey_),this.viewPropertyListenerKey_=null),this.viewChangeListenerKey_&&(li(this.viewChangeListenerKey_),this.viewChangeListenerKey_=null);const t=this.getView();t&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=ai(t,ni.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=ai(t,ci.CHANGE,this.handleViewPropertyChanged_,this),t.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&(this.layerGroupPropertyListenerKeys_.forEach(li),this.layerGroupPropertyListenerKeys_=null);const t=this.getLayerGroup();t&&(this.handleLayerAdd_(new Gl("addlayer",t)),this.layerGroupPropertyListenerKeys_=[ai(t,ni.PROPERTYCHANGE,this.render,this),ai(t,ci.CHANGE,this.render,this),ai(t,"addlayer",this.handleLayerAdd_,this),ai(t,"removelayer",this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;const t=this.frameState_.layerStatesArray;for(let e=0,i=t.length;e<i;++e){const i=t[e].layer;i.hasRenderer()&&i.getRenderer().handleFontsChanged()}}render(){this.renderer_&&void 0===this.animationDelayKey_&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(t){return this.getControls().remove(t)}removeInteraction(t){return this.getInteractions().remove(t)}removeLayer(t){const e=this.getLayerGroup().getLayers();return e.remove(t)}handleLayerRemove_(t){kg(t.layer)}removeOverlay(t){return this.getOverlays().remove(t)}renderFrame_(t){const e=this.getSize(),i=this.getView(),s=this.frameState_;let n=null;if(void 0!==e&&Tc(e)&&i&&i.isDef()){const s=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),r=i.getState();if(n={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:on(r.center,r.resolution,r.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:r,viewHints:s,wantedTiles:{},mapId:Mi(this),renderTargets:{}},r.nextCenter&&r.nextResolution){const t=isNaN(r.nextRotation)?r.rotation:r.nextRotation;n.nextExtent=on(r.nextCenter,r.nextResolution,t,e)}}if(this.frameState_=n,this.renderer_.renderFrame(n),n){if(n.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,n.postRenderFunctions),s){const t=!this.previousExtent_||!pn(this.previousExtent_)&&!Ks(n.extent,this.previousExtent_);t&&(this.dispatchEvent(new Vi(as.MOVESTART,this,s)),this.previousExtent_=Vs(this.previousExtent_))}const t=this.previousExtent_&&!n.viewHints[ms.ANIMATING]&&!n.viewHints[ms.INTERACTING]&&!Ks(n.extent,this.previousExtent_);t&&(this.dispatchEvent(new Vi(as.MOVEEND,this,n)),Fs(n.extent,this.previousExtent_))}this.dispatchEvent(new Vi(as.POSTRENDER,this,n)),this.updateRenderComplete_(),this.postRenderTimeoutHandle_||(this.postRenderTimeoutHandle_=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0))}setLayerGroup(t){const e=this.getLayerGroup();e&&this.handleLayerRemove_(new Gl("removelayer",e)),this.set(hs.LAYERGROUP,t)}setSize(t){this.set(hs.SIZE,t)}setTarget(t){this.set(hs.TARGET,t)}setView(t){if(!t||t instanceof eh)return void this.set(hs.VIEW,t);this.set(hs.VIEW,new eh);const e=this;t.then(function(t){e.setView(new eh(t))})}updateSize(){const t=this.getTargetElement();let e;if(t){let i,s;if(Mh(t)){const e=t.getContext("2d").getTransform();i=t.width/e.a,s=t.height/e.d}else{const e=getComputedStyle(t);i=t.offsetWidth-parseFloat(e["borderLeftWidth"])-parseFloat(e["paddingLeft"])-parseFloat(e["paddingRight"])-parseFloat(e["borderRightWidth"]),s=t.offsetHeight-parseFloat(e["borderTopWidth"])-parseFloat(e["paddingTop"])-parseFloat(e["paddingBottom"])-parseFloat(e["borderBottomWidth"])}isNaN(i)||isNaN(s)||(e=[Math.max(0,i),Math.max(0,s)],!Tc(e)&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)&&Nn("No map visible because the map container's width or height are 0."))}const i=this.getSize();!e||i&&vi(e,i)||(this.updateViewportSize_(e),this.setSize(e))}updateViewportSize_(t){const e=this.getView();e&&e.setViewportSize(t)}}function Dg(t){let e=null;void 0!==t.keyboardEventTarget&&(e="string"===typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);const i={},s=t.layers&&"function"===typeof t.layers.getLayers?t.layers:new Fl({layers:t.layers});let n,r,o;return i[hs.LAYERGROUP]=s,i[hs.TARGET]=t.target,i[hs.VIEW]=t.view instanceof eh?t.view:new eh,void 0!==t.controls&&(Array.isArray(t.controls)?n=new Wi(t.controls.slice()):(cs("function"===typeof t.controls.getArray,"Expected `controls` to be an array or an `ol/Collection.js`"),n=t.controls)),void 0!==t.interactions&&(Array.isArray(t.interactions)?r=new Wi(t.interactions.slice()):(cs("function"===typeof t.interactions.getArray,"Expected `interactions` to be an array or an `ol/Collection.js`"),r=t.interactions)),void 0!==t.overlays?Array.isArray(t.overlays)?o=new Wi(t.overlays.slice()):(cs("function"===typeof t.overlays.getArray,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=t.overlays):o=new Wi,{controls:n,interactions:r,keyboardEventTarget:e,overlays:o,values:i}}var jg=Fg;class zg{constructor(){fh(this,"pushMethodArgs_",(...t)=>{this.push_(this.pendingMethod_,t)}),this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(mh(),{get:(t,e)=>{if("function"===typeof t[e])return this.pendingMethod_=e,this.pushMethodArgs_},set:(t,e,i)=>(this.push_(e,i),!0)})}push_(...t){const e=this.instructions_,i=this.zIndex+this.offset_;e[i]||(e[i]=[]),e[i].push(...t)}pushFunction(t){this.push_(t)}getContext(){return this.context_}draw(t){this.instructions_.forEach(e=>{for(let i=0,s=e.length;i<s;++i){const s=e[i];if("function"===typeof s){s(t);continue}const n=e[++i];"function"===typeof t[s]?t[s](...n):t[s]="function"===typeof n?n(t):n}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}}var Ug=zg;const Bg=5;class Wg extends Ni{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=Bg,this.renderedSourceKey_}getStaleKeys(){return this.staleKeys_}prependStaleKey(t){this.staleKeys_.unshift(t),this.staleKeys_.length>this.maxStaleKeys&&(this.staleKeys_.length=this.maxStaleKeys)}updateStaleKeys(t){this.renderedSourceKey_?this.renderedSourceKey_!==t&&(this.prependStaleKey(this.renderedSourceKey_),this.renderedSourceKey_=t):this.renderedSourceKey_=t}getFeatures(t){return wi()}getData(t){return null}prepareFrame(t){return wi()}renderFrame(t,e){return wi()}forEachFeatureAtCoordinate(t,e,i,s,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;e.getState()!==Uu.LOADED&&e.getState()!==Uu.ERROR||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return e!=Uu.LOADED&&e!=Uu.ERROR&&t.addEventListener(ci.CHANGE,this.boundHandleImageChange_),e==Uu.IDLE&&(t.load(),e=t.getState()),e==Uu.LOADED}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){this.layer_=void 0,super.disposeInternal()}}var Xg=Wg;const Vg=[];let qg=null;function Yg(){qg=ph(1,1,void 0,{willReadFrequently:!0})}class Kg extends Xg{constructor(t){super(t),this.wantRotation=!1,this.container=null,this.renderedResolution,this.tempTransform=xo(),this.pixelTransform=xo(),this.inversePixelTransform=xo(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){qg||Yg();const s=qg;if(!s)return null;let n;s.clearRect(0,0,1,1);try{s.drawImage(t,e,i,1,1,0,0,1,1),n=s.getImageData(0,0,1,1).data}catch{return qg=null,null}return n}getBackground(t){const e=this.getLayer();let i=e.getBackground();return"function"===typeof i&&(i=i(t.viewState.resolution)),i||void 0}useContainer(t,e,i,s,n){if(Mh(t)&&0===this.pixelTransform[1]&&0===this.pixelTransform[2]&&0===this.pixelTransform[4]&&0===this.pixelTransform[5]&&t.width===s&&t.height===n){const e=t,s=e.getContext("2d");if(s)return this.container=t,this.context=s,this.containerReused=!0,void(i&&(s.fillStyle=i,s.fillRect(0,0,e.width,e.height)))}const r=this.getLayer().getClassName();let o,a;if(t&&t.className===r&&(!i||t&&t.style.backgroundColor&&vi(Rc(t.style.backgroundColor),Rc(i)))){const e=t.firstElementChild;Mh(e)&&(a=e.getContext("2d"))}if(a&&Io(a.canvas.style.transform,e)?(this.container=t,this.context=a,this.containerReused=!0):this.containerReused?(this.container=null,this.context=null,this.containerReused=!1):this.container&&(this.container.style.backgroundColor=null),!this.container){o=ts?Eh():document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=ph();const e=a.canvas;o.appendChild(e),t=e.style,t.position="absolute",t.left="0",t.transformOrigin="top left",this.container=o,this.context=a}this.containerReused||!i||this.container.style.backgroundColor||(this.container.style.backgroundColor=i)}clipUnrotated(t,e,i){const s=un(i),n=dn(i),r=sn(i),o=en(i);Eo(e.coordinateToPixelTransform,s),Eo(e.coordinateToPixelTransform,n),Eo(e.coordinateToPixelTransform,r),Eo(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Eo(a,s),Eo(a,n),Eo(a,r),Eo(a,o),t.save(),t.beginPath(),t.moveTo(Math.round(s[0]),Math.round(s[1])),t.lineTo(Math.round(n[0]),Math.round(n[1])),t.lineTo(Math.round(r[0]),Math.round(r[1])),t.lineTo(Math.round(o[0]),Math.round(o[1])),t.clip()}prepareContainer(t,e){const i=t.extent,s=t.viewState.resolution,n=this.sourceRotates(),r=n?0:t.viewState.rotation,o=t.pixelRatio,a=n?Math.round(t.size[0]*o):Math.round(gn(i)/s*o),h=n?Math.round(t.size[1]*o):Math.round(hn(i)/s*o);Mo(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/o,1/o,r,-a/2,-h/2),So(this.inversePixelTransform,this.pixelTransform);const l=Po(this.pixelTransform),c=this.getBackground(t);if(this.useContainer(e,l,c,a,h),!this.containerReused){const t=this.context.canvas;t.width!=a||t.height!=h?(t.width=a,t.height=h):this.context.clearRect(0,0,a,h),l!==t.style.transform&&(t.style.transform=l)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const n=new dg(t,this.inversePixelTransform,i,e);s.dispatchEvent(n)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(Dl.PRERENDER,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(Dl.POSTRENDER,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Ug),t.declutter?this.deferredContext_.getContext():this.context}getCanvasContext(){const t=this.context;if(!t)throw new Error("Canvas context not initialized");return t}getContainerElement(){const t=this.container;if(!t)throw new Error("Canvas container not initialized");return t}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(Dl.PRERENDER,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(Dl.POSTRENDER,this.context,t))}getRenderTransform(t,e,i,s,n,r,o){const a=n/2,h=r/2,l=s/e,c=-l,u=-t[0]+o,d=-t[1];return Mo(this.tempTransform,a,h,l,c,-i,u,d)}sourceRotates(){return this.wantRotation&&!!this.getLayer().getSource()?.canRotate}disposeInternal(){delete this.frameState,super.disposeInternal()}}var Hg=Kg;class $g extends Hg{constructor(t){super(t),this.image=null,this.renderedSourceRevision_=0,this.renderedRotation=0}getImage(){return this.image?this.image.getImage():null}prepareFrame(t){const e=t.layerStatesArray[t.layerIndex],i=t.pixelRatio,s=t.viewState,n=s.resolution,r=this.getLayer().getSource(),o=t.viewHints;let a=t.extent;if(void 0!==e.extent&&(a=ln(a,po(e.extent,s.projection))),!o[ms.ANIMATING]&&!o[ms.INTERACTING]&&!pn(a))if(r){this.getLayer().rendered||this.renderedSourceRevision_===r.getRevision()||(this.image=null),this.renderedSourceRevision_=r.getRevision();const t=s.projection,e=r.getImage(a,n,i,t);e&&(this.loadImage(e)?(this.image=e,this.renderedRotation=this.sourceRotates()?s.rotation:0):e.getState()===Uu.EMPTY&&(this.image=null))}else this.image=null;return!!this.image}getData(t){const e=this.frameState;if(!e||!this.image)return null;const i=this.getLayer(),s=Eo(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!js(n,s))return null;const r=this.image.getExtent(),o=this.image.getImage();if(!o)return null;const a=this.renderedRotation;if(0!==a){const t=nn(r),e=Math.cos(-a),i=Math.sin(-a),n=s[0]-t[0],o=s[1]-t[1];s[0]=t[0]+e*n-i*o,s[1]=t[1]+i*n+e*o}const h=gn(r),l=Math.floor(o.width*((s[0]-r[0])/h));if(l<0||l>=o.width)return null;const c=hn(r),u=Math.floor(o.height*((r[3]-s[1])/c));return u<0||u>=o.height?null:this.getImageData(o,l,u)}renderFrame(t,e){const i=this.image;if(!i)return this.getContainerElement();const s=i.getExtent(),n=i.getResolution(),[r,o]=Array.isArray(n)?n:[n,n],a=i.getPixelRatio(),h=this.renderedRotation,l=this.getLayer().getSource(),c=this.sourceRotates(),u=t.layerStatesArray[t.layerIndex],d=t.pixelRatio,g=t.viewState,f=g.center,p=g.resolution,_=g.rotation,m=d*r/(p*a),y=d*o/(p*a);this.prepareContainer(t,e);const v=this.getCanvasContext().canvas.width,x=this.getCanvasContext().canvas.height,w=this.getRenderContext(t);let E=!1,M=!0;if(u.extent){const e=po(u.extent,g.projection),i=t.extent;M=fn(e,i),E=M&&!zs(e,i),E&&this.clipUnrotated(w,t,e)}const S=i.getImage();if(!S)return this.getContainerElement();let C,b,P;if(c){const t=d/p,e=Math.cos(_),i=Math.sin(_),n=nn(s),r=n[0]-f[0],o=n[1]-f[1];C=Mo(this.tempTransform,v/2+t*(e*r+i*o),x/2+t*(i*r-e*o),m,y,_-h,-S.width/2,-S.height/2),b=S.width*m,P=S.height*y}else C=Mo(this.tempTransform,v/2,x/2,m,y,0,a*(s[0]-f[0])/r,a*(f[1]-s[3])/o),b=S.width*C[0],P=S.height*C[3];if(this.renderedResolution=o*d/a,l?.getInterpolate()||c&&_!==h||(w.imageSmoothingEnabled=!1),this.preRender(w,t),M&&b>=.5&&P>=.5){const t=u.opacity;if(c)w.save(),1!==t&&(w.globalAlpha=t),w.setTransform(C[0],C[1],C[2],C[3],C[4],C[5]),w.drawImage(S,0,0),w.restore();else{const e=C[4],i=C[5];1!==t&&(w.save(),w.globalAlpha=t),w.drawImage(S,0,0,S.width,S.height,e,i,b,P),1!==t&&w.restore()}}return this.postRender(this.getCanvasContext(),t),E&&w.restore(),w.imageSmoothingEnabled=!0,this.getContainerElement()}}var Zg=$g;class Jg extends Ul{constructor(t){t=t||{},super(t)}}var Qg=Jg;class tf extends Qg{constructor(t){super(t)}createRenderer(){return new Zg(this)}getData(t){return super.getData(t)}}var ef=tf;Ke(),He(),$e(),Ze(),Je();class sf extends Oi{constructor(t,e,i){super(),i=i||{},this.tileCoord=t,this.state=e,this.key="",this.transition_=void 0===i.transition?250:i.transition,this.transitionStarts_={},this.interpolate=!!i.interpolate}changed(){this.dispatchEvent(ci.CHANGE)}release(){this.setState(ls.EMPTY)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(this.state!==ls.EMPTY){if(this.state!==ls.ERROR&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){wi()}getAlpha(t,e){if(!this.transition_)return 1;let i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;const s=e-i+1e3/60;return s>=this.transition_?1:Tn(s/this.transition_)}inTransition(t){return!!this.transition_&&-1!==this.transitionStarts_[t]}endTransition(t){this.transition_&&(this.transitionStarts_[t]=-1)}disposeInternal(){this.release(),super.disposeInternal()}}var nf=sf;function rf(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}function of(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t instanceof DataView?t:null}const af=new Error("disposed");const hf=[256,256];class lf extends nf{constructor(t){const e=ls.IDLE;super(t.tileCoord,e,{transition:t.transition,interpolate:t.interpolate}),this.loader_=t.loader,this.data_=null,this.error_=null,this.size_=t.size||null,this.controller_=t.controller||null}getSize(){if(this.size_)return this.size_;const t=rf(this.data_);return t?[t.width,t.height]:hf}getData(){return this.data_}getError(){return this.error_}load(){if(this.state!==ls.IDLE&&this.state!==ls.ERROR)return;this.state=ls.LOADING,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=ls.LOADED,t.changed()}).catch(function(e){t.error_=e,t.state=ls.ERROR,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(af),this.controller_=null),super.disposeInternal()}}var cf=lf;class uf extends nf{constructor(t,e,i,s,n,r){super(t,e,r),this.crossOrigin_=s?.crossOrigin,this.referrerPolicy_=s?.referrerPolicy,this.src_=i,this.key=i,this.image_,ts?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.unlisten_=null,this.tileLoadFunction_=n}getImage(){return this.image_}setImage(t){this.image_=t,this.state=ls.LOADED,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_??null}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=ls.ERROR,this.unlistenImage_(),this.image_=df(),this.changed()}handleImageLoad_(){if(ts)this.state=ls.LOADED;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=ls.LOADED:this.state=ls.EMPTY}this.unlistenImage_(),this.changed()}load(){if(this.state==ls.ERROR&&(this.state=ls.IDLE,this.image_=new Image,null!==this.crossOrigin_&&void 0!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),this.state==ls.IDLE){this.state=ls.LOADING,this.changed(),this.tileLoadFunction_(this,this.src_);const t=this.image_;t&&(this.unlisten_=Wu(t,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}}function df(){const t=ph(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}var gf=uf;class ff{constructor(t,e,i,s){this.minX=t,this.maxX=e,this.minY=i,this.maxY=s}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 pf(t,e,i,s,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=s,n):new ff(t,e,i,s)}var _f=ff;let mf;const yf=[];function vf(t,e,i,s,n){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(s,n),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,s)+1,Math.max(i,n)),t.restore()}function xf(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function wf(){if(void 0===mf){const t=ph(6,6,yf);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",vf(t,4,5,4,0),vf(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;mf=xf(e,0)||xf(e,4)||xf(e,8),yh(t),yf.push(t.canvas)}return mf}function Ef(t,e,i,s){const n=ao(i,e,t);let r=Hr(e,s,i);const o=e.getMetersPerUnit();void 0!==o&&(r*=o);const a=t.getMetersPerUnit();void 0!==a&&(r/=a);const h=t.getExtent();if(!h||js(h,n)){const e=Hr(t,r,n)/r;isFinite(e)&&e>0&&(r/=e)}return r}function Mf(t,e,i,s){const n=nn(i);let r=Ef(t,e,n,s);return(!isFinite(r)||r<=0)&&Qs(i,function(i){return r=Ef(t,e,i,s),isFinite(r)&&r>0}),r}function Sf(t,e,i,s,n,r,o,a,h,l,c,u,d,g){const f=ph(Math.round(i*t),Math.round(i*e),yf);if(u||(f.imageSmoothingEnabled=!1),0===h.length)return f.canvas;function p(t){return Math.round(t*i)/i}f.scale(i,i),f.globalCompositeOperation="lighter";const _=Ws();let m;h.forEach(function(t,e,i){Hs(_,t.extent)});const y=i/s,v=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==h.length||0!==l){const t=ph(Math.round(gn(_)*y),Math.round(hn(_)*y),yf);if(m=t,u||(t.imageSmoothingEnabled=!1),n&&g){const e=(n[0]-_[0])*y,i=-(n[3]-_[3])*y,s=gn(n)*y,r=hn(n)*y;t.rect(e,i,s,r),t.clip()}h.forEach(function(e,i,s){if(e.image.width>0&&e.image.height>0){if(e.clipExtent){t.save();const i=(e.clipExtent[0]-_[0])*y,s=-(e.clipExtent[3]-_[3])*y,n=gn(e.clipExtent)*y,r=hn(e.clipExtent)*y;t.rect(u?i:Math.round(i),u?s:Math.round(s),u?n:Math.round(i+n)-Math.round(i),u?r:Math.round(s+r)-Math.round(s)),t.clip()}const i=(e.extent[0]-_[0])*y,s=-(e.extent[3]-_[3])*y,n=gn(e.extent)*y,r=hn(e.extent)*y;t.drawImage(e.image,l,l,e.image.width-2*l,e.image.height-2*l,u?i:Math.round(i),u?s:Math.round(s),u?n:Math.round(i+n)-Math.round(i),u?r:Math.round(s+r)-Math.round(s)),e.clipExtent&&t.restore()}})}const x=un(o);return a.getTriangles().forEach(function(t,e,i){const s=t.source,n=t.target;let o=s[0][0],a=s[0][1],l=s[1][0],c=s[1][1],d=s[2][0],g=s[2][1];const y=p((n[0][0]-x[0])/r),w=p(-(n[0][1]-x[1])/r),E=p((n[1][0]-x[0])/r),M=p(-(n[1][1]-x[1])/r),S=p((n[2][0]-x[0])/r),C=p(-(n[2][1]-x[1])/r),b=o,P=a;o=0,a=0,l-=b,c-=P,d-=b,g-=P;const R=[[l,c,0,0,E-y],[d,g,0,0,S-y],[0,0,l,c,M-w],[0,0,d,g,C-w]],I=Es(R);if(!I)return;if(f.save(),f.beginPath(),wf()||!u){f.moveTo(E,M);const t=4,e=y-E,i=w-M;for(let s=0;s<t;s++)f.lineTo(E+p((s+1)*e/t),M+p(s*i/(t-1))),s!=t-1&&f.lineTo(E+p((s+1)*e/t),M+p((s+1)*i/(t-1)));f.lineTo(S,C)}else f.moveTo(E,M),f.lineTo(y,w),f.lineTo(S,C);let T;if(f.clip(),f.transform(I[0],I[2],I[1],I[3],y,w),f.translate(_[0]-b,_[3]-P),m)T=m.canvas,f.scale(v,-v);else{const t=h[0],e=t.extent;T=t.image,f.scale(gn(e)/T.width,-hn(e)/T.height)}f.drawImage(T,0,0),f.restore()}),m&&(yh(m),yf.push(m.canvas)),c&&(f.save(),f.globalCompositeOperation="source-over",f.strokeStyle="black",f.lineWidth=1,a.getTriangles().forEach(function(t,e,i){const s=t.target,n=(s[0][0]-x[0])/r,o=-(s[0][1]-x[1])/r,a=(s[1][0]-x[0])/r,h=-(s[1][1]-x[1])/r,l=(s[2][0]-x[0])/r,c=-(s[2][1]-x[1])/r;f.beginPath(),f.moveTo(a,h),f.lineTo(n,o),f.lineTo(l,c),f.closePath(),f.stroke()}),f.restore()),f.canvas}const Cf=10,bf=.25;class Pf{constructor(t,e,i,s,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?Qr(t=>Eo(o,ao(t,this.targetProj_,this.sourceProj_))):oo(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){const e=t[0]+"/"+t[1];return a[e]||(a[e]=h(t)),a[e]},this.maxSourceExtent_=s,this.errorThresholdSquared_=n*n,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!s&&!!this.sourceProj_.getExtent()&&gn(s)>=gn(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?gn(this.sourceProj_.getExtent()):void 0,this.targetWorldWidth_=this.targetProj_.getExtent()?gn(this.targetProj_.getExtent()):void 0;const l=un(i),c=dn(i),u=sn(i),d=en(i),g=this.transformInv_(l),f=this.transformInv_(c),p=this.transformInv_(u),_=this.transformInv_(d),m=Cf+(r?Math.max(0,Math.ceil(Math.log2(tn(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,g,f,p,_,m),this.wrapsXInSource_){const t=this.sourceWorldWidth_;if(!t)return;let e=1/0;this.triangles_.forEach(function(t,i,s){e=Math.min(e,t.source[0][0],t.source[1][0],t.source[2][0])}),this.triangles_.forEach(i=>{if(Math.max(i.source[0][0],i.source[1][0],i.source[2][0])-e>t/2){const s=[[i.source[0][0],i.source[0][1]],[i.source[1][0],i.source[1][1]],[i.source[2][0],i.source[2][1]]];s[0][0]-e>t/2&&(s[0][0]-=t),s[1][0]-e>t/2&&(s[1][0]-=t),s[2][0]-e>t/2&&(s[2][0]-=t);const n=Math.min(s[0][0],s[1][0],s[2][0]),r=Math.max(s[0][0],s[1][0],s[2][0]);r-n<t/2&&(i.source=s)}})}a={}}addTriangle_(t,e,i,s,n,r){this.triangles_.push({source:[s,n,r],target:[t,e,i]})}addQuad_(t,e,i,s,n,r,o,a,h){const l=Gs([n,r,o,a]),c=this.sourceWorldWidth_,u=c?gn(l)/c:void 0,d=this.sourceProj_.canWrapX()&&void 0!==u&&u>.5&&u<1;let g=!1;if(h>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_){const n=Gs([t,e,i,s]),r=gn(n)/this.targetWorldWidth_;g=r>bf||g}!d&&this.sourceProj_.isGlobal()&&u&&(g=u>bf||g)}if(!g&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!fn(l,this.maxSourceExtent_))return;let f=0;if(!g&&(!isFinite(n[0])||!isFinite(n[1])||!isFinite(r[0])||!isFinite(r[1])||!isFinite(o[0])||!isFinite(o[1])||!isFinite(a[0])||!isFinite(a[1])))if(h>0)g=!0;else if(f=(isFinite(n[0])&&isFinite(n[1])?0:8)+(isFinite(r[0])&&isFinite(r[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1),1!=f&&2!=f&&4!=f&&8!=f)return;if(h>0){if(!g){const e=[(t[0]+i[0])/2,(t[1]+i[1])/2],s=this.transformInv_(e);let r;if(d){const t=c,e=(Cs(n[0],t)+Cs(o[0],t))/2;r=e-Cs(s[0],t)}else r=(n[0]+o[0])/2-s[0];const a=(n[1]+o[1])/2-s[1],h=r*r+a*a;g=h>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){const l=[(e[0]+i[0])/2,(e[1]+i[1])/2],c=this.transformInv_(l),u=[(s[0]+t[0])/2,(s[1]+t[1])/2],d=this.transformInv_(u);this.addQuad_(t,e,l,u,n,r,c,d,h-1),this.addQuad_(u,l,i,s,d,c,o,a,h-1)}else{const l=[(t[0]+e[0])/2,(t[1]+e[1])/2],c=this.transformInv_(l),u=[(i[0]+s[0])/2,(i[1]+s[1])/2],d=this.transformInv_(u);this.addQuad_(t,l,u,s,n,c,d,a,h-1),this.addQuad_(l,e,i,u,c,r,o,d,h-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&f)&&this.addTriangle_(t,i,s,n,o,a),0==(14&f)&&this.addTriangle_(t,i,e,n,o,r),f&&(0==(13&f)&&this.addTriangle_(e,s,t,r,a,n),0==(7&f)&&this.addTriangle_(e,s,i,r,a,o))}calculateSourceExtent(){const t=Ws();return this.triangles_.forEach(function(e,i,s){const n=e.source;$s(t,n[0]),$s(t,n[1]),$s(t,n[2])}),t}getTriangles(){return this.triangles_}}var Rf=Pf;class If extends nf{constructor(t,e,i,s,n,r,o,a,h,l,c,u){super(n,ls.IDLE,u),this.renderEdges_=void 0!==c&&c,this.pixelRatio_=o,this.gutter_=a,this.canvas_=null,this.sourceTileGrid_=e,this.targetTileGrid_=s,this.wrappedTileCoord_=r||n,this.sourceTiles_=[],this.sourcesListenerKeys_=null,this.sourceZ_=0,this.clipExtent_=t.canWrapX()&&t.getExtent()||void 0;const d=s.getTileCoordExtent(this.wrappedTileCoord_),g=this.targetTileGrid_.getExtent();let f=this.sourceTileGrid_.getExtent();const p=g?ln(d,g):d;if(0===tn(p))return void(this.state=ls.EMPTY);const _=t.getExtent();_&&(f=f?ln(f,_):_);const m=s.getResolution(this.wrappedTileCoord_[0]),y=Mf(t,i,p,m);if(!isFinite(y)||y<=0)return void(this.state=ls.EMPTY);const v=void 0!==l?l:.5;if(this.triangulation_=new Rf(t,i,p,f||void 0,y*v,m),0===this.triangulation_.getTriangles().length)return void(this.state=ls.EMPTY);this.sourceZ_=e.getZForResolution(y);let x=this.triangulation_.calculateSourceExtent();if(f&&(t.canWrapX()?(x[1]=vs(x[1],f[1],f[3]),x[3]=vs(x[3],f[1],f[3])):x=ln(x,f)),tn(x)){let i=0,s=0;t.canWrapX()&&(i=gn(_),s=Math.floor((x[0]-_[0])/i));const n=xn(x.slice(),t,!0);n.forEach(t=>{const n=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let e=n.minX;e<=n.maxX;e++)for(let t=n.minY;t<=n.maxY;t++){const n=s*i;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,e,t,o),offset:n})}++s}),0===this.sourceTiles_.length&&(this.state=ls.EMPTY)}else this.state=ls.EMPTY}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&i.getState()==ls.LOADED){const s=this.sourceTileGrid_.getTileCoordExtent(i.tileCoord);s[0]+=e.offset,s[2]+=e.offset;const n=this.clipExtent_?.slice();n&&(n[0]+=e.offset,n[2]+=e.offset);const r=i.getImage();if(!r)return;t.push({extent:s,clipExtent:n,image:r})}}),this.sourceTiles_.length=0,0===t.length)this.state=ls.ERROR;else{const e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),s="number"===typeof i?i:i[0],n="number"===typeof i?i:i[1],r=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Sf(s,n,this.pixelRatio_,o,this.sourceTileGrid_.getExtent()??a,r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=ls.LOADED}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(this.state==ls.IDLE){this.state=ls.LOADING,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(e=>{const i=e.tile;if(!i)return;const s=i.getState();if(s==ls.IDLE||s==ls.LOADING){t++;const e=ai(i,ci.CHANGE,()=>{const s=i.getState();s!=ls.LOADED&&s!=ls.ERROR&&s!=ls.EMPTY||(li(e),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(e)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function(t){const e=t.tile;if(!e)return;const i=e.getState();i==ls.IDLE&&e.load()})}}unlistenSources_(){this.sourcesListenerKeys_&&(this.sourcesListenerKeys_.forEach(li),this.sourcesListenerKeys_=null)}release(){this.canvas_&&(yh(this.canvas_.getContext("2d")),yf.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}}var Tf=If;class Af{constructor(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}deleteOldest(){const t=this.pop();t instanceof di&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){while(this.canExpireCache())this.deleteOldest()}clear(){while(this.oldest_)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;while(e)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return cs(void 0!==i,"Tried to get a value for a key that does not exist in the cache"),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_}remove(t){const e=this.entries_[t];return cs(void 0!==e,"Tried to get a value for a key that does not exist in the cache"),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_}getCount(){return this.count_}getKeys(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.key_;return t}getValues(){const t=new Array(this.count_);let e,i=0;for(e=this.newest_;e;e=e.older)t[i++]=e.value_;return t}peekLast(){return this.oldest_.value_}peekLastKey(){return this.oldest_.key_}peekFirstKey(){return this.newest_.key_}peek(t){return this.entries_[t]?.value_}pop(){const t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_}replace(t,e){this.get(t),this.entries_[t].value_=e}set(t,e){cs(!(t in this.entries_),"Tried to set a value for a key that is used already");const i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_}setSize(t){this.highWaterMark=t}}var Lf=Af;function Of(t,e,i,s){return void 0!==s?(s[0]=t,s[1]=e,s[2]=i,s):[t,e,i]}function Gf(t,e,i){return t+"/"+e+"/"+i}function kf(t,e,i,s,n){return`${Mi(t)},${e},${Gf(i,s,n)}`}function Nf(t){return Ff(t[0],t[1],t[2])}function Ff(t,e,i){return(e<<t)+i}function Df(t,e){const i=t[0],s=t[1],n=t[2];if(e.getMinZoom()>i||i>e.getMaxZoom())return!1;const r=e.getFullTileRange(i);return!r||r.containsXY(s,n)}function jf(t,e,i){if(!(i in t))return t[i]=new Set([e]),!0;const s=t[i],n=s.has(e);return n||s.add(e),!n}function zf(t,e,i){const s=t[i];return!!s&&s.delete(e)}function Uf(t,e){const i=t.layerStatesArray[t.layerIndex];if(i.extent&&(e=ln(e,po(i.extent,t.viewState.projection))),!i.layer)return e;const s=i.layer.getRenderSource();if(!s.getWrapX()){const i=s.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=ln(e,i))}return e}class Bf extends Hg{constructor(t,e){super(t),e=e||{},this.extentChanged=!0,this.renderComplete=!1,this.renderedExtent_=null,this.renderedPixelRatio,this.renderedProjection=null,this.renderedTiles=[],this.renderedSourceRevision_,this.tempExtent=Ws(),this.tempTileRange_=new _f(0,0,0,0),this.tempTileCoord_=Of(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new Lf(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new Lf(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const n=this.tileCache_,r=this.getLayer(),o=r.getSource();if(!o)return null;const a=kf(o,o.getKey(),t,e,i);let h;if(n.containsKey(a)){if(h=n.get(a),!h)return null}else{const r=s.viewState.projection,l=o.getProjection();if(h=o.getTile(t,e,i,s.pixelRatio,r,!l||so(l,r)?void 0:this.getSourceTileCache()),!h)return null;n.set(a,h)}return h}getTile(t,e,i,s){const n=this.getOrCreateTile(t,e,i,s);return n||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Eo(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!js(n,s))return null;const r=e.viewState,o=i.getRenderSource();if(!o)return null;const a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let l=a.getZForResolution(r.resolution);l>=a.getMinZoom();--l){const t=a.getTileCoordForCoordAndZ(s,l),i=this.getTile(l,t[1],t[2],e);if(!i||i.getState()!==ls.LOADED)continue;const n=a.getOrigin(l),c=Lc(a.getTileSize(l)),u=a.getResolution(l);let d=null;if(i instanceof gf||i instanceof Tf)d=i.getImage();else if(i instanceof cf){const t=i.getData();t&&(d=rf(t))}if(!d)continue;const g=Math.floor(h*((s[0]-n[0])/u-t[1]*c[0])),f=Math.floor(h*((n[1]-s[1])/u-t[2]*c[1])),p=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,g+p,f+p)}return null}readData(t){const e=this.getLayer().getRenderSource();if(!e)return null;const i=t.viewState,s=i.projection;if(e.getGutterForProjection(s))throw new Error("readData() does not support sources with a gutter");const n=e.getTileGridForProjection(s),r=i.resolution,o=t.extent,a=n.getZForResolution(r),h={};this.enqueueTiles(t,o,a,h,0);const l=h[a];if(!l)return null;const c=[];let u=!0;if(l.forEach(t=>{const e=t,i=e.getState();i===ls.LOADED?c.push(e):i!==ls.ERROR&&i!==ls.EMPTY&&(u=!1)}),!u||0===c.length)return null;const d=t.size[0],g=t.size[1],f=c[0],p=of(f.getData());if(!p||p instanceof DataView)throw new Error("ol/renderer/canvas/TileLayer#readData only supports typed array tile data");const _=f.getSize(),m=Math.round(p.length/(_[0]*_[1])),y=p.constructor,v=new y(d*g*m);for(const x of c){const t=n.getTileCoordExtent(x.tileCoord,this.tempExtent),e=x.getSize(),i=of(x.getData()),s=(t[0]-o[0])/r-.5,a=(o[3]-t[3])/r-.5,h=gn(t)/r,l=hn(t)/r,c=e[0]/h,u=e[1]/l,f=Math.max(0,Math.ceil(s)),p=Math.min(d,Math.ceil(s+h)),_=Math.max(0,Math.ceil(a)),y=Math.min(g,Math.ceil(a+l));for(let n=_;n<y;++n){const t=Math.min(Math.floor((n-a)*u),e[1]-1);for(let r=f;r<p;++r){const o=Math.min(Math.floor((r-s)*c),e[0]-1),a=(t*e[0]+o)*m,h=(n*d+r)*m;for(let t=0;t<m;++t)v[h+t]=i[a+t]}}}return this.updateCacheSize(l.size),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache(),{data:v,width:d,height:g,bandCount:m}}prepareFrame(t){this.renderedProjection?t.viewState.projection!==this.renderedProjection&&(this.tileCache_.clear(),this.renderedProjection=t.viewState.projection):this.renderedProjection=t.viewState.projection;const e=this.getLayer().getSource();if(!e)return!1;const i=e.getRevision();return this.renderedSourceRevision_?this.renderedSourceRevision_!==i&&(this.renderedSourceRevision_=i,this.renderedSourceKey_===e.getKey()&&(this.tileCache_.clear(),this.sourceTileCache_?.clear())):this.renderedSourceRevision_=i,!0}enqueueTilesForNextExtent(){return!0}enqueueTiles(t,e,i,s,n){const r=t.viewState,o=this.getLayer(),a=o.getRenderSource();if(!a)return;const h=a.getTileGridForProjection(r.projection),l=Mi(a);l in t.wantedTiles||(t.wantedTiles[l]={});const c=t.wantedTiles[l],u=o.getMapInternal(),d=Math.max(i-n,h.getMinZoom(),h.getZForResolution(Math.min(o.getMaxResolution(),u?u.getView().getResolutionForZoom(Math.max(o.getMinZoom(),0)):h.getResolution(0)),a.zDirection)),g=r.rotation,f=g?an(r.center,r.resolution,g,t.size):void 0;for(let p=i;p>=d;--p){const i=h.getTileRangeForExtentAndZ(e,p,this.tempTileRange_),n=h.getResolution(p);for(let e=i.minX;e<=i.maxX;++e)for(let r=i.minY;r<=i.maxY;++r){if(g&&f&&!h.tileCoordIntersectsViewport([p,e,r],f))continue;const i=this.getTile(p,e,r,t);if(!i)continue;const o=jf(s,i,p);if(!o)continue;const a=i.getKey();if(c[a]=!0,i.getState()===ls.IDLE&&!t.tileQueue.isKeyQueued(a)){const s=Of(p,e,r,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(s),n])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],n=t[1],r=t[2],o=this.getStaleKeys(),a=this.getLayer().getSource();if(!a)return!1;for(let h=0;h<o.length;++h){const t=kf(a,o[h],s,n,r);if(i.containsKey(t)){const n=i.peek(t);if(n&&n.getState()===ls.LOADED)return n.endTransition(Mi(this)),jf(e,n,s),!0}}return!1}findAltTiles_(t,e,i,s){const n=t.getTileRangeForTileCoordAndZ(e,i,this.tempTileRange_);if(!n)return!1;let r=!0;const o=this.tileCache_,a=this.getLayer().getRenderSource();if(!a)return!1;const h=a.getKey();for(let l=n.minX;l<=n.maxX;++l)for(let t=n.minY;t<=n.maxY;++t){const e=kf(a,h,i,l,t);let n=!1;if(o.containsKey(e)){const t=o.peek(e);t&&t.getState()===ls.LOADED&&(jf(s,t,i),n=!0)}n||(r=!1)}return r}renderFrame(t,e){this.renderComplete=!0;const i=t.layerStatesArray[t.layerIndex],s=t.viewState,n=s.projection,r=s.resolution,o=s.center,a=t.pixelRatio,h=this.getLayer(),l=h.getSource();if(!l)return this.getContainerElement();const c=l.getTileGridForProjection(n),u=c.getZForResolution(r,l.zDirection),d=c.getResolution(u);this.updateStaleKeys(l.getKey());let g=t.extent;const f=l.getTilePixelRatio(a);this.prepareContainer(t,e);const p=this.getCanvasContext().canvas.width,_=this.getCanvasContext().canvas.height;this.layerExtent=i.extent?po(i.extent,n):null,this.layerExtent&&(g=ln(g,this.layerExtent));const m=d*p/2/f,y=d*_/2/f,v=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],x={};this.renderedTiles.length=0;const w=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(s.nextResolution??r,l.zDirection),i=Uf(t,t.nextExtent);this.enqueueTiles(t,i,e,x,w)}const E=Uf(t,g);if(this.enqueueTiles(t,E,u,x,0),w>0&&setTimeout(()=>{this.enqueueTiles(t,E,u-1,x,w-1)},0),!(u in x))return this.getContainerElement();const M=Mi(this),S=t.time;for(const A of x[u]){const e=A.getState();if(e===ls.EMPTY)continue;const i=A.tileCoord;if(e===ls.LOADED){const t=A.getAlpha(M,S);if(1===t){A.endTransition(M);continue}}e!==ls.ERROR&&(this.renderComplete=!1);const s=this.findStaleTile_(i,x);if(s){zf(x,A,u),t.animate=!0;continue}const n=this.findAltTiles_(c,i,u+1,x);if(n)continue;const r=c.getMinZoom();for(let t=u-1;t>=r;--t){const e=this.findAltTiles_(c,i,t,x);if(e)break}}const C=d/r*a/f,b=this.getRenderContext(t);Mo(this.tempTransform,p/2,_/2,C,C,0,-p/2,-_/2),this.layerExtent&&this.clipUnrotated(b,t,this.layerExtent),l.getInterpolate()||(b.imageSmoothingEnabled=!1),this.preRender(b,t);const P=Object.keys(x).map(Number);P.sort(fi);const R=[],I=[],T=[];for(let A=P.length-1;A>=0;--A){const e=P[A],i=l.getTilePixelSize(e,a,n),s=c.getResolution(e),r=s/d,o=i[0]*r*C,h=i[1]*r*C,g=c.getTileCoordForCoordAndZ(un(v),e),p=c.getTileCoordExtent(g),_=Eo(this.tempTransform,[f*(p[0]-v[0])/d,f*(v[3]-p[3])/d]),m=f*l.getGutterForProjection(n);for(const n of x[e]){if(n.getState()!==ls.LOADED)continue;const i=n.tileCoord,s=g[1]-i[1],r=Math.round(_[0]-(s-1)*o),a=g[2]-i[2],c=Math.round(_[1]-(a-1)*h),d=Math.round(_[0]-s*o),f=Math.round(_[1]-a*h),p=r-d,y=c-f,v=e===u;if(v&&n.inTransition(M)){T.push({tile:n,x:d,y:f,w:p,h:y,gutter:m}),this.renderedTiles.unshift(n),this.updateUsedTiles(t.usedTiles,l,n);continue}const x=[d,f,d+p,f+y],w=[];for(let t=0,n=R.length;t<n;++t)e<I[t]&&fn(x,R[t])&&w.push(R[t]);let E;w.length>0&&(E=wn(x,w)),R.push(x),I.push(e),this.drawTile(n,t,d,f,p,y,m,v,E),this.renderedTiles.unshift(n),this.updateUsedTiles(t.usedTiles,l,n)}}for(let A=0,L=T.length;A<L;++A){const{tile:e,x:i,y:s,w:n,h:r,gutter:o}=T[A];this.drawTile(e,t,i,s,n,r,o,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Ks(this.renderedExtent_,v),this.renderedExtent_=v,this.renderedPixelRatio=a,this.postRender(this.getCanvasContext(),t),this.layerExtent&&b.restore(),b.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=Mi(l),s=e.wantedTiles[i],n=s?Object.keys(s).length:0;this.updateCacheSize(n),this.tileCache_.expireCache(),this.sourceTileCache_?.expireCache()};t.postRenderFunctions.push(e)}return this.getContainerElement()}updateCacheSize(t){this.tileCache_.highWaterMark=Math.max(this.tileCache_.highWaterMark,2*t)}drawTile(t,e,i,s,n,r,o,a,h){let l;if(t instanceof cf){const e=t.getData();if(!e)return;if(l=rf(e),!l)throw new Error("Rendering array data is not yet supported")}else l=this.getTileImage(t);if(!l)return;const c=this.getRenderContext(e),u=Mi(this),d=e.layerStatesArray[e.layerIndex],g=d.opacity*(a?t.getAlpha(u,e.time):1),f=g!==c.globalAlpha;f&&(c.save(),c.globalAlpha=g);const p=l.width-2*o,_=l.height-2*o;if(h){const t=p/n,e=_/r;for(let n=0,r=h.length;n<r;++n){const r=h[n],a=r[0],u=r[1],d=r[2]-r[0],g=r[3]-r[1];c.drawImage(l,o+(a-i)*t,o+(u-s)*e,d*t,g*e,a,u,d,g)}}else c.drawImage(l,o,o,p,_,i,s,n,r);f&&c.restore(),g!==d.opacity?e.animate=!0:a&&t.endTransition(u)}getImage(){const t=this.getCanvasContext();return t?t.canvas:null}getTileImage(t){return t.getImage()??null}updateUsedTiles(t,e,i){const s=Mi(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}}var Wf=Bf,Xf={PRELOAD:"preload",USE_INTERIM_TILES_ON_ERROR:"useInterimTilesOnError"};class Vf extends Ul{constructor(t){t=t||{};const e=Object.assign({},t),i=t.cacheSize;delete t.cacheSize,delete e.preload,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i,this.setPreload(void 0!==t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError)}getCacheSize(){return this.cacheSize_}getPreload(){return this.get(Xf.PRELOAD)}setPreload(t){this.set(Xf.PRELOAD,t)}getUseInterimTilesOnError(){return this.get(Xf.USE_INTERIM_TILES_ON_ERROR)}setUseInterimTilesOnError(t){this.set(Xf.USE_INTERIM_TILES_ON_ERROR,t)}getData(t){return super.getData(t)}}var qf=Vf;class Yf extends qf{constructor(t){super(t)}createRenderer(){return new Wf(this,{cacheSize:this.getCacheSize()})}}var Kf=Yf;class Hf{drawCustom(t,e,i,s,n){}drawGeometry(t){}setStyle(t){}drawCircle(t,e,i){}drawFeature(t,e,i){}drawGeometryCollection(t,e,i){}drawLineString(t,e,i){}drawMultiLineString(t,e,i){}drawMultiPoint(t,e,i){}drawMultiPolygon(t,e,i){}drawPoint(t,e,i){}drawPolygon(t,e,i){}drawText(t,e,i){}setFillStrokeStyle(t,e){}setImageStyle(t,e){}setTextStyle(t,e){}}var $f=Hf;const Zf={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},Jf=[Zf.FILL],Qf=[Zf.STROKE],tp=[Zf.BEGIN_PATH],ep=[Zf.CLOSE_PATH];var ip=Zf;class sp extends $f{constructor(t,e,i,s){super(),this.tolerance=t,this.maxExtent=e,this.pixelRatio=s,this.maxLineWidth=0,this.resolution=i,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],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(),s=this.tmpCoordinate_,n=this.coordinates;let r=n.length;for(let o=0,a=t.length;o<a;o+=e)s[0]=t[o],s[1]=t[o+1],js(i,s)&&(n[r++]=s[0],n[r++]=s[1]);return r}appendFlatLineCoordinates(t,e,i,s,n,r){const o=this.coordinates;let a=o.length;const h=this.getBufferedMaxExtent();r&&(e+=s);let l=t[e],c=t[e+1];const u=this.tmpCoordinate_;let d,g,f,p=!0;for(d=e+s;d<i;d+=s)u[0]=t[d],u[1]=t[d+1],f=Bs(h,u),f!==g?(p&&(o[a++]=l,o[a++]=c,p=!1),o[a++]=u[0],o[a++]=u[1]):f===Os.INTERSECTING?(o[a++]=u[0],o[a++]=u[1],p=!1):p=!0,l=u[0],c=u[1],g=f;return(n&&p||d===e+s)&&(o[a++]=l,o[a++]=c),a}drawCustomCoordinates_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r],a=this.appendFlatLineCoordinates(t,e,o,s,!1,!1);n.push(a),e=o}return e}drawCustom(t,e,i,s,n){this.beginGeometry(t,e,n);const r=t.getType(),o=t.getStride(),a=this.coordinates.length;let h,l,c,u,d;switch(r){case"MultiPolygon":h=t.getOrientedFlatCoordinates(),c=[];const e=t.getEndss();d=0;for(let t=0,i=e.length;t<i;++t){const i=[];d=this.drawCustomCoordinates_(h,d,e[t],o,i),c.push(i)}this.instructions.push([ip.CUSTOM,a,c,t,i,ra,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,c,t,s||i,ra,n]);break;case"Polygon":case"MultiLineString":u=[],h="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(h,0,t.getEnds(),o,u),this.instructions.push([ip.CUSTOM,a,u,t,i,na,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,u,t,s||i,na,n]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(h,0,h.length,o,!1,!1),this.instructions.push([ip.CUSTOM,a,l,t,i,sa,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,sa,n]);break;case"MultiPoint":h=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(h,o),l>a&&(this.instructions.push([ip.CUSTOM,a,l,t,i,sa,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,sa,n]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),l=this.coordinates.length,this.instructions.push([ip.CUSTOM,a,l,t,i,void 0,n]),this.hitDetectionInstructions.push([ip.CUSTOM,a,l,t,s||i,void 0,n]);break;default:}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[ip.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[ip.BEGIN_GEOMETRY,e,0,t,i],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){const t=this.hitDetectionInstructions;let e;t.reverse();const i=t.length;let s,n,r=-1;for(e=0;e<i;++e)s=t[e],n=s[0],n==ip.END_GEOMETRY?r=e:n==ip.BEGIN_GEOMETRY&&(s[2]=e,mi(this.hitDetectionInstructions,r,e),r=-1)}fillStyleToState(t,e={}){if(t){const i=t.getColor();e.fillPatternScale=i&&"object"===typeof i&&"src"in i?this.pixelRatio:1,e.fillStyle=ed(i||"#000")??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=ed(i||"#000")??void 0;const s=t.getLineCap();e.lineCap=void 0!==s?s:"round";const n=t.getLineDash();e.lineDash=n?n.slice():fg;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:"round";const a=t.getWidth();e.lineWidth=void 0!==a?a:1;const h=t.getMiterLimit();e.miterLimit=void 0!==h?h:10;const l=t.getOffset();e.strokeOffset=l??0,e.lineWidth>this.maxLineWidth&&(this.maxLineWidth=e.lineWidth,this.bufferedMaxExtent_=null)}else e.strokeStyle=void 0,e.lineCap=void 0,e.lineDash=null,e.lineDashOffset=void 0,e.lineJoin=void 0,e.lineWidth=void 0,e.miterLimit=void 0,e.strokeOffset=void 0;return e}setFillStrokeStyle(t,e){const i=this.state;this.fillStyleToState(t,i),this.strokeStyleToState(e,i)}createFill(t){const e=t.fillStyle,i=[ip.SET_FILL_STYLE,e];return"string"!==typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[ip.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,t.lineDash?this.applyPixelRatio(t.lineDash):null,t.lineDashOffset*this.pixelRatio]}updateFillStyle(t,e){const i=t.fillStyle;(void 0!==i&&"string"!==typeof i||t.currentFillStyle!=i)&&(this.instructions.push(e.call(this,t)),t.currentFillStyle=i)}updateStrokeStyle(t,e){const i=t.strokeStyle,s=t.lineCap,n=t.lineDash,r=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,h=t.miterLimit,l=t.strokeOffset;t.currentStrokeStyle==i&&t.currentLineCap==s&&(n==t.currentLineDash||n&&t.currentLineDash&&vi(t.currentLineDash,n))&&t.currentLineDashOffset==r&&t.currentLineJoin==o&&t.currentLineWidth==a&&t.currentMiterLimit==h&&t.currentStrokeOffset==l||(e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=s,t.currentLineDash=n,t.currentLineDashOffset=r,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=h,t.currentStrokeOffset=l)}endGeometry(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;const e=[ip.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Fs(this.maxExtent),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;Ns(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}}var np=sp;class rp extends np{constructor(t,e,i,s){super(t,e,i,s),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(t,e,i){if(!this.image_||this.maxExtent&&!js(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i??0);const s=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,n),a=this.imagePixelRatio_??1,h=this.anchorX_??0,l=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([ip.DRAW_IMAGE,r,o,this.image_,h*a,l*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}drawMultiPoint(t,e,i){if(!this.image_)return;this.beginGeometry(t,e,i??0);const s=t.getFlatCoordinates(),n=[];for(let p=0,_=s.length;p<_;p+=t.getStride())this.maxExtent&&!js(this.maxExtent,s.slice(p,p+2))||n.push(s[p],s[p+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,2),a=this.imagePixelRatio_??1,h=this.anchorX_??0,l=this.anchorY_??0,c=this.height_??0,u=this.originX_??0,d=this.originY_??0,g=this.scale_??[1,1],f=this.width_??0;this.instructions.push([ip.DRAW_IMAGE,r,o,this.image_,h*a,l*a,Math.ceil(c*a),this.opacity_,u*a,d*a,this.rotateWithView_,this.rotation_,[g[0]*this.pixelRatio/a,g[1]*this.pixelRatio/a],Math.ceil(f*a),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,r,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(e)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(t,e){const i=t.getAnchor(),s=t.getSize(),n=t.getOrigin();i&&s&&n&&(this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.hitDetectionImage_=t.getHitDetectionImage(),this.image_=t.getImage(this.pixelRatio),this.height_=s[1],this.opacity_=t.getOpacity(),this.originX_=n[0],this.originY_=n[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=s[0],this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e)}}var op=rp;class ap extends np{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,n){const r=(n??0)*this.pixelRatio,o=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([ip.MOVE_TO_LINE_TO,o,a,r]),this.hitDetectionInstructions.push([ip.MOVE_TO_LINE_TO,o,a,n??0]),i}drawLineString(t,e,i){const s=this.state;if(!s)return;const n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,fg,0],tp);const a=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(a,0,a.length,h,o),this.hitDetectionInstructions.push(Qf),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state;if(!s)return;const n=s.strokeStyle,r=s.lineWidth,o=s.strokeOffset;if(void 0===n||void 0===r)return;this.updateStrokeStyle(s,this.applyStroke),this.beginGeometry(t,e,i??0),this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,fg,0],tp);const a=t.getEnds()??[],h=t.getFlatCoordinates(),l=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinates_(h,c,a[u],l,o);this.hitDetectionInstructions.push(Qf),this.endGeometry(e)}finish(){const t=this.state;return t&&void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(Qf),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){void 0!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(Qf),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(tp)}}var hp=ap;class lp extends np{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,n){const r=this.state,o=n??0,a=void 0!==r.fillStyle,h=void 0!==r.strokeStyle,l=i.length;this.instructions.push(tp),this.hitDetectionInstructions.push(tp);for(let c=0;c<l;++c){const n=i[c],r=this.coordinates.length,a=this.appendFlatLineCoordinates(t,e,n,s,!0,!h);this.instructions.push([ip.MOVE_TO_LINE_TO,r,a,o*this.pixelRatio,!0]),this.hitDetectionInstructions.push([ip.MOVE_TO_LINE_TO,r,a,o,!0]),h&&(this.instructions.push(ep),this.hitDetectionInstructions.push(ep)),e=n}return a&&(this.instructions.push(Jf),this.hitDetectionInstructions.push(Jf)),h&&(this.instructions.push(Qf),this.hitDetectionInstructions.push(Qf)),e}drawCircle(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawCircle(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,fg,0]);const a=t.getFlatCoordinates(),h=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,h,!1,!1);const c=[ip.CIRCLE,l,o];this.instructions.push(tp,c),this.hitDetectionInstructions.push(tp,c),void 0!==s.fillStyle&&(this.instructions.push(Jf),this.hitDetectionInstructions.push(Jf)),void 0!==s.strokeStyle&&(this.instructions.push(Qf),this.hitDetectionInstructions.push(Qf)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,fg,0]);const a=t.getEnds(),h=t.getOrientedFlatCoordinates(),l=t.getStride();this.drawFlatCoordinatess_(h,0,a,l,o),this.endGeometry(e)}drawMultiPolygon(t,e,i){const s=this.state;if(!s)return;const n=s.fillStyle,r=s.strokeStyle,o=s.strokeOffset;if(void 0===n&&void 0===r)return;if(this.handleStrokeOffset_(()=>this.drawMultiPolygon(t,e,i)))return;this.setFillStrokeStyles_(),this.beginGeometry(t,e,i??0),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([ip.SET_FILL_STYLE,"#000"]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([ip.SET_STROKE_STYLE,"#000",s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,fg,0]);const a=t.getEndss(),h=t.getOrientedFlatCoordinates(),l=t.getStride();let c=0;for(let u=0,d=a.length;u<d;++u)c=this.drawFlatCoordinatess_(h,c,a[u],l,o);this.endGeometry(e)}finish(){this.reverseHitDetectionInstructions(),this.state=null;const t=this.tolerance;if(0!==t){const e=this.coordinates;for(let i=0,s=e.length;i<s;++i)e[i]=ya(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;t&&(this.updateFillStyle(t,this.createFill),this.updateStrokeStyle(t,this.applyStroke))}handleStrokeOffset_(t){const e=this.state,i=e.fillStyle,s=e.strokeStyle,n=e.strokeOffset??0;return Math.abs(n)>0&&void 0!==i&&void 0!==s&&(e.strokeStyle=void 0,e.strokeOffset=0,t(),e.fillStyle=void 0,e.strokeStyle=s,e.strokeOffset=n,t(),e.fillStyle=i,!0)}}var cp=lp;let up=0,dp=1;function gp(t,e,i,s,n,r,o,a){const h=o-n,l=a-r;let c=0,u=1;if(0===h){if(n<t||n>i)return!1}else{let e=(t-n)/h,s=(i-n)/h;if(e>s){const t=e;e=s,s=t}if(e>c&&(c=e),s<u&&(u=s),c>u)return!1}if(0===l){if(r<e||r>s)return!1}else{let t=(e-r)/l,i=(s-r)/l;if(t>i){const e=t;t=i,i=e}if(t>c&&(c=t),i<u&&(u=i),c>u)return!1}return up=c,dp=u,!0}function fp(t,e,i,s){const n=s[0],r=s[1],o=s[2],a=s[3],h=[],l=[];let c,u,d=!1,g=0;for(let f=0,p=e.length;f<p;++f){const s=e[f];let p=t[g],_=t[g+1],m=!1;for(let e=g+i;e<s;e+=i){const i=t[e],s=t[e+1];if(gp(n,r,o,a,p,_,i,s)){const t=i-p,e=s-_,n=p+up*t,r=_+up*e,o=p+dp*t,a=_+dp*e;d&&m&&n===c&&r===u?h.push(o,a):(d&&l.push(h.length),h.push(n,r,o,a),d=!0),c=o,u=a,m=!0}p=i,_=s}g=s}return d&&l.push(h.length),{flatCoordinates:h,ends:l}}function pp(t,e,i,s,n){const r=[];let o=i,a=0,h=e.slice(i,2);while(a<t&&o+n<s){const[i,s]=h.slice(-2),l=e[o+n],c=e[o+n+1],u=Math.sqrt((l-i)*(l-i)+(c-s)*(c-s));if(a+=u,a>=t){const e=(t-a+u)/u,d=bs(i,l,e),g=bs(s,c,e);h.push(d,g),r.push(h),h=[d,g],a==t&&(o+=n),a=0}else if(a<t)h.push(e[o+n],e[o+n+1]),o+=n;else{const t=u-a,e=bs(i,l,t/u),d=bs(s,c,t/u);h.push(e,d),r.push(h),h=[e,d],a=0,o+=n}}return a>0&&r.push(h),r}function _p(t,e,i,s,n){let r,o,a,h,l,c,u,d,g,f,p=i,_=i,m=0,y=0,v=i;for(o=i;o<s;o+=n){const i=e[o],s=e[o+1];void 0!==l&&void 0!==c&&(g=i-l,f=s-c,h=Math.sqrt(g*g+f*f),void 0!==u&&void 0!==d&&void 0!==a&&(y+=a,r=Math.acos((u*g+d*f)/(a*h)),r>t&&(y>m&&(m=y,p=v,_=o),y=0,v=o-n)),a=h,u=g,d=f),l=i,c=s}return y+=h||0,y>m?[v,o]:[p,_]}const mp={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1};class yp extends np{constructor(t,e,i,s){super(t,e,i,s),this.labels_=null,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates["#000"]={fillStyle:"#000"},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_="",this.fillKey_="",this.strokeKey_="",this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){const t=super.finish();return t.textStates=this.textStates,t.fillStates=this.fillStates,t.strokeStates=this.strokeStates,t}drawText(t,e,i){const s=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""===this.text_||!r||!s&&!n)return;const o=this.coordinates;let a=o.length;const h=t.getType();let l=null,c=t.getStride();if("line"!==r.placement||"LineString"!=h&&"MultiLineString"!=h&&"Polygon"!=h&&"MultiPolygon"!=h){let s=r.overflow?null:[];switch(h){case"Point":case"MultiPoint":l=t.getFlatCoordinates();break;case"LineString":l=t.getFlatMidpoint();break;case"Circle":l=t.getCenter();break;case"MultiLineString":l=t.getFlatMidpoints(),c=2;break;case"Polygon":l=t.getFlatInteriorPoint(),!r.overflow&&s&&s.push(l[2]/this.resolution),c=3;break;case"MultiPolygon":const e=t.getFlatInteriorPoints();l=[];for(let t=0,i=e.length;t<i;t+=3)!r.overflow&&s&&s.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;c=2;break;default:return}if(!l)return;const n=this.appendFlatPointCoordinates(l,c);if(n===a)return;if(s&&(n-a)/2!==l.length/c){const t=l;let e=a/2;s=s.filter((i,s)=>{const n=o[2*(e+s)]===t[s*c]&&o[2*(e+s)+1]===t[s*c+1];return n||--e,n})}this.saveTextStates_();const u=r.backgroundFill?this.createFill(this.fillStyleToState(r.backgroundFill)):null,d=r.backgroundStroke?this.createStroke(this.strokeStyleToState(r.backgroundStroke)):null;this.beginGeometry(t,e,i??0);const g=r.scale??[1,1];let f=r.padding??pg;if(f!=pg&&(g[0]<0||g[1]<0)){let t=f[0],e=f[1],i=f[2],s=f[3];g[0]<0&&(e=-e,s=-s),g[1]<0&&(t=-t,i=-i),f=[t,e,i,s]}const p=this.pixelRatio;this.instructions.push([ip.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==pg?pg:f.map(function(t){return t*p}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]);const _=1/p,m=u?u.slice(0):null;m&&(m[1]="#000"),this.hitDetectionInstructions.push([ip.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,f,m,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?"#000":this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]),this.endGeometry(e)}else{const s=t.getExtent();if(!fn(this.maxExtent,s))return;let n=[];if(l=t.getFlatCoordinates(),"LineString"==h)n=[l.length];else if("MultiLineString"==h)n=t.getEnds();else if("Polygon"==h)n=t.getEnds().slice(0,1);else if("MultiPolygon"==h){const e=t.getEndss();n=[];for(let t=0,i=e.length;t<i;++t)n.push(e[t][0])}if(void 0===r.textAlign&&("LineString"==h||"MultiLineString"==h)&&!zs(this.getBufferedMaxExtent(),s)){const t=fp(l,n,c,this.getBufferedMaxExtent());if(l=t.flatCoordinates,n=t.ends,c=2,0===n.length)return}this.beginGeometry(t,e,i??0);const u=r.repeat,d=u?void 0:r.textAlign;let g=0;for(let t=0,e=n.length;t<e;++t){let e;e=u?pp(u*this.resolution,l,g,n[t],c):[l.slice(g,n[t])];for(let i=0,s=e.length;i<s;++i){const s=e[i];let h=0,l=s.length;if(void 0==d){const t=_p(r.maxAngle??Math.PI/4,s,0,s.length,2);h=t[0],l=t[1]}for(let t=h;t<l;t+=c)o.push(s[t],s[t+1]);const u=o.length;g=n[t],this.drawChars_(a,u),a=u}}this.endGeometry(e)}}saveTextStates_(){const t=this.textStrokeState_,e=this.textState_,i=this.textFillState_,s=this.strokeKey_;t&&(s in this.strokeStates||(this.strokeStates[s]={strokeStyle:t.strokeStyle,lineCap:t.lineCap,lineDashOffset:t.lineDashOffset,lineWidth:t.lineWidth,lineJoin:t.lineJoin,miterLimit:t.miterLimit,lineDash:t.lineDash}));const n=this.textKey_;n in this.textStates||(this.textStates[n]={font:e.font,textAlign:e.textAlign||"center",justify:e.justify,textBaseline:e.textBaseline||"middle",scale:e.scale});const r=this.fillKey_;i&&(r in this.fillStates||(this.fillStates[r]={fillStyle:i.fillStyle}))}drawChars_(t,e){const i=this.textStrokeState_,s=this.textState_,n=this.strokeKey_,r=this.textKey_,o=this.fillKey_;this.saveTextStates_();const a=this.pixelRatio,h=mp[s.textBaseline||"middle"],l=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=s.scale??[1,1],g=i?i.lineWidth*Math.abs(d[0])/2:0;this.instructions.push([ip.DRAW_CHARS,t,e,h,s.overflow,o,s.maxAngle,a,c,n,g*a,u,r,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([ip.DRAW_CHARS,t,e,h,s.overflow,o?"#000":o,s.maxAngle,a,c,n,g*a,u,r,1/a,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(t,e){let i,s,n;if(t){const e=t.getFill();e?(s=this.textFillState_,s||(s={},this.textFillState_=s),s.fillStyle=ed(e.getColor()||"#000")||"#000"):(s=null,this.textFillState_=s);const r=t.getStroke();if(r){n=this.textStrokeState_,n||(n={},this.textStrokeState_=n);const t=r.getLineDash(),e=r.getLineDashOffset(),i=r.getWidth(),s=r.getMiterLimit();n.lineCap=r.getLineCap()||"round",n.lineDash=t?t.slice():fg,n.lineDashOffset=void 0===e?0:e,n.lineJoin=r.getLineJoin()||"round",n.lineWidth=void 0===i?1:i,n.miterLimit=void 0===s?10:s,n.strokeStyle=ed(r.getColor()||"#000")||"#000"}else n=null,this.textStrokeState_=n;i=this.textState_;const o=t.getFont()||gg;Eg(o);const a=t.getScaleArray();i.overflow=t.getOverflow(),i.font=o,i.maxAngle=t.getMaxAngle(),i.placement=t.getPlacement(),i.textAlign=t.getTextAlign(),i.repeat=t.getRepeat(),i.justify=t.getJustify(),i.textBaseline=t.getTextBaseline()||"middle",i.backgroundFill=t.getBackgroundFill()??void 0,i.backgroundStroke=t.getBackgroundStroke()??void 0,i.padding=t.getPadding()||pg,i.scale=void 0===a?[1,1]:a;const h=t.getOffsetX(),l=t.getOffsetY(),c=t.getRotateWithView(),u=t.getKeepUpright(),d=t.getRotation();this.text_=t.getText()||"",this.textOffsetX_=void 0===h?0:h,this.textOffsetY_=void 0===l?0:l,this.textRotateWithView_=void 0!==c&&c,this.textKeepUpright_=void 0===u||u,this.textRotation_=void 0===d?0:d,this.strokeKey_=n?("string"==typeof n.strokeStyle?n.strokeStyle:Mi(n.strokeStyle))+n.lineCap+n.lineDashOffset+"|"+n.lineWidth+n.lineJoin+n.miterLimit+"["+n.lineDash.join()+"]":"",this.textKey_=i.font+i.scale+(i.textAlign||"?")+(i.repeat||"?")+(i.justify||"?")+(i.textBaseline||"?"),this.fillKey_=s&&s.fillStyle?"string"==typeof s.fillStyle?s.fillStyle:"|"+Mi(s.fillStyle):""}else this.text_="";this.declutterMode_=t?t.getDeclutterMode():void 0,this.declutterImageWithText_=e}}var vp=yp;const xp={Circle:cp,Default:np,Image:op,LineString:hp,Polygon:cp,Text:vp};class wp{constructor(t,e,i,s){this.tolerance_=t,this.maxExtent_=e,this.pixelRatio_=s,this.resolution_=i,this.buildersByZIndex_={}}finish(){const t={};for(const e in this.buildersByZIndex_){t[e]=t[e]||{};const i=this.buildersByZIndex_[e];for(const s in i){const n=i[s].finish();t[e][s]=n}}return t}getBuilder(t,e){const i=void 0!==t?t.toString():"0";let s=this.buildersByZIndex_[i];void 0===s&&(s={},this.buildersByZIndex_[i]=s);let n=s[e];if(void 0===n){const t=xp[e];n=new t(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=n}return n}}var Ep=wp;function Mp(t,e,i,s){let n=t[e],r=t[e+1],o=0;for(let a=e+s;a<i;a+=s){const e=t[a],i=t[a+1];o+=Math.sqrt((e-n)*(e-n)+(i-r)*(i-r)),n=e,r=i}return o}function Sp(t,e,i,s,n,r,o,a){o=o??[],a=a??s;const h=t[e+s],l=t[e+s+1],c=t[i-2*s],u=t[i-2*s+1];let d,g,f,p,_,m,y,v,x=0;for(let w=e;w<i;w+=s){f=d,p=g,_=void 0,m=void 0,w+s<i&&(_=t[w+s],m=t[w+s+1]),r&&w===e&&(f=c,p=u),r&&w===i-s&&(_=h,m=l),d=t[w],g=t[w+1],[y,v]=Cp(d,g,f,p,_,m,n),o[x++]=y,o[x++]=v;for(let e=2;e<a;e++)o[x++]=t[w+e]}return o.length!=x&&(o.length=x),o}function Cp(t,e,i,s,n,r,o){let a,h;void 0!==i&&void 0!==s?(a=t-i,h=e-s):void 0!==n&&void 0!==r?(a=n-t,h=r-e):(a=1,h=0);const l=Math.hypot(a,h),c=a/l,u=h/l;if(a=-u,h=c,void 0===i||void 0===s)return[t+a*o,e+h*o];if(void 0===n||void 0===r)return[t+a*o,e+h*o];const d=In([t,e],[i,s],[n,r]);if(Math.cos(d)>.998)return[t+c*o,e+u*o];const g=Math.cos(d/2),f=Math.sin(d/2),p=f*a+g*h,_=-g*a+f*h,m=p*(1/f),y=_*(1/f);return[t+m*o,e+y*o]}function bp(t,e,i=!1){for(let s=0,n=t.length-2;s<n;s+=e){const n=i&&0===s?t.length-3*e:t.length-2*e;for(let i=n;i>s+e;i-=e){const n=t[s],r=t[s+1],o=t[s+e],a=t[s+e+1],h=t[i],l=t[i+1],c=t[i+e],u=t[i+e+1],d=(u-l)*(o-n)-(c-h)*(a-r);if(0===d)continue;const g=((c-h)*(r-l)-(u-l)*(n-h))/d,f=((o-n)*(r-l)-(a-r)*(n-h))/d;if(g>0&&g<1&&f>0&&f<1){const h=n+g*(o-n),l=r+g*(a-r);t[s+e]=h,t[s+e+1]=l,t.splice(s+2*e,i-s-e);break}}}return t}let Pp;const Rp=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 Ip(){return Pp||(Pp=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Pp}function Tp(t,e,i,s,n,r,o,a,h,l,c,u,d=!0){let g=t[e],f=t[e+1],p=0,_=0,m=0,y=0;function v(){p=g,_=f,e+=s,g=t[e],f=t[e+1],y+=m,m=Math.sqrt((g-p)*(g-p)+(f-_)*(f-_))}do{v()}while(e<i-s&&y+m<r);let x=0===m?0:(r-y)/m;const w=bs(p,g,x),E=bs(_,f,x),M=e-s,S=y,C=r+a*h(l,n,c);while(e<i-s&&y+m<C)v();x=0===m?0:(C-y)/m;const b=bs(p,g,x),P=bs(_,f,x);let R=!1;if(d)if(u){const t=[w,E,b,P];Ao(t,0,4,2,u,t,t),R=t[0]>t[2]}else R=w>b;const I=Math.PI,T=[],A=M+s===e;let L;if(e=M,m=0,y=S,g=t[e],f=t[e+1],A){v(),L=Math.atan2(f-_,g-p),R&&(L+=L>0?-I:I);const t=(b+w)/2,e=(P+E)/2;return T[0]=[t,e,(C-r)/2,L,n],T}n=n.replace(/\n/g," ");const O=Array.from(Ip().segment(n),t=>t.segment),G=R!==Rp.test(n);for(let k=0,N=O.length;k<N;){v();let t=Math.atan2(f-_,g-p);if(R&&(t+=t>0?-I:I),void 0!==L){let e=t-L;if(e+=e>I?-2*I:e<-I?2*I:0,Math.abs(e)>o)return null}L=t;const n=k;let u=0;for(;k<N;++k){const t=G?N-k-1:k,n=a*h(l,O[t],c);if(e+s<i&&y+m<r+u+n/2)break;u+=n}if(k===n)continue;const d=(G?O.slice(N-k,N-n):O.slice(n,k)).join("");x=0===m?0:(r+u/2-y)/m;const w=bs(p,g,x),E=bs(_,f,x);T.push([w,E,u/2,t,d]),r+=u}return T}const Ap=Ws(),Lp=[],Op=[],Gp=[],kp=[];function Np(t){return t[3].declutterBox}function Fp(t,e){return"start"===e?e=Rp.test(t)?"right":"left":"end"===e&&(e=Rp.test(t)?"left":"right"),mp[e]}function Dp(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function jp(t,e,i){return i%2===0&&(t+=e),t}class zp{constructor(t,e,i,s,n){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignAndScaleFill_,this.instructions=s.instructions,this.coordinates=s.coordinates,this.coordinateCache_={},this.renderedTransform_=xo(),this.hitDetectionInstructions=s.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=s.fillStates||{},this.strokeStates=s.strokeStates||{},this.textStates=s.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=n?new Ug:null}getZIndexContext(){return this.zIndexContext_}createLabel(t,e,i,s){const n=t+e+i+s;if(this.labels_[n])return this.labels_[n];const r=s?this.strokeStates[s]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],h=this.pixelRatio,l=[a.scale[0]*h,a.scale[1]*h],c=a.justify?mp[a.justify]:Fp(Array.isArray(t)?t[0]:t,a.textAlign||"center"),u=s&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Dp,[]),{width:g,height:f,widths:p,heights:_,lineWidths:m}=Pg(a,d),y=g+u,v=[],x=(y+2)*l[0],w=(f+u)*l[1],E={width:x<0?Math.floor(x):Math.ceil(x),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:v};1==l[0]&&1==l[1]||v.push("scale",l),s&&r&&(v.push("strokeStyle",r.strokeStyle),v.push("lineWidth",u),v.push("lineCap",r.lineCap),v.push("lineJoin",r.lineJoin),v.push("miterLimit",r.miterLimit),v.push("setLineDash",[r.lineDash]),v.push("lineDashOffset",r.lineDashOffset)),i&&o&&v.push("fillStyle",o.fillStyle),v.push("textBaseline","middle"),v.push("textAlign","center");const M=.5-c;let S=c*y+M*u;const C=[],b=[];let P,R=0,I=0,T=0,A=0;for(let L=0,O=d.length;L<O;L+=2){const t=d[L];if("\n"===t){I+=R,R=0,S=c*y+M*u,++A;continue}const e=d[L+1]||a.font;e!==P&&(s&&C.push("font",e),i&&b.push("font",e),P=e),R=Math.max(R,_[T]);const n=[t,S+M*p[T]+c*(p[T]-m[A]),.5*(u+R)+I];S+=p[T],s&&C.push("strokeText",n),i&&b.push("fillText",n),++T}return Array.prototype.push.apply(v,C),Array.prototype.push.apply(v,b),this.labels_[n]=E,E}replayTextBackground_(t,e,i,s,n,r,o){t.beginPath(),t.moveTo.apply(t,e),t.lineTo.apply(t,i),t.lineTo.apply(t,s),t.lineTo.apply(t,n),t.lineTo.apply(t,e),r&&(this.alignAndScaleFill_=r[2],t.fillStyle=r[1],this.fill_(t)),o&&(this.setStrokeStyle_(t,o),t.stroke())}calculateImageOrLabelDimensions_(t,e,i,s,n,r,o,a,h,l,c,u,d,g,f,p){o*=u[0],a*=u[1];let _=i-o,m=s-a;const y=n+h>t?t-h:n,v=r+l>e?e-l:r,x=g[3]+y*u[0]+g[1],w=g[0]+v*u[1]+g[2],E=_-g[3],M=m-g[0];let S;return(f||0!==c)&&(Lp[0]=E,kp[0]=E,Lp[1]=M,Op[1]=M,Op[0]=E+x,Gp[0]=Op[0],Gp[1]=M+w,kp[1]=Gp[1]),0!==c?(S=Mo(xo(),i,s,1,1,c,-i,-s),Eo(S,Lp),Eo(S,Op),Eo(S,Gp),Eo(S,kp),Xs(Math.min(Lp[0],Op[0],Gp[0],kp[0]),Math.min(Lp[1],Op[1],Gp[1],kp[1]),Math.max(Lp[0],Op[0],Gp[0],kp[0]),Math.max(Lp[1],Op[1],Gp[1],kp[1]),Ap)):Xs(Math.min(E,E+x),Math.min(M,M+w),Math.max(E,E+x),Math.max(M,M+w),Ap),d&&(_=Math.round(_),m=Math.round(m)),{drawImageX:_,drawImageY:m,drawImageW:y,drawImageH:v,originX:h,originY:l,declutterBox:{minX:Ap[0],minY:Ap[1],maxX:Ap[2],maxY:Ap[3],value:p},canvasTransform:S,scale:u}}replayImageOrLabelArgs_(t){return this.replayImageOrLabel_(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}replayImageOrLabel_(t,e,i,s,n,r,o){const a=!(!r&&!o),h=s.declutterBox,l=o?o[2]*s.scale[0]/2:0,c=h.minX-l<=e[0]&&h.maxX+l>=0&&h.minY-l<=e[1]&&h.maxY+l>=0;return c&&(a&&this.replayTextBackground_(t,Lp,Op,Gp,kp,r,o),Rg(t,s.canvasTransform,n,i,s.originX,s.originY,s.drawImageW,s.drawImageH,s.drawImageX,s.drawImageY,s.scale)),!0}fill_(t){const e=this.alignAndScaleFill_;if(e){const i=Eo(this.renderedTransform_,[0,0]),s=512*this.pixelRatio;t.save(),t.translate(i[0]%s,i[1]%s),1!==e&&t.scale(e,e)}t.fill(),e&&t.restore()}setStrokeStyle_(t,e){t.strokeStyle=e[1],e[1]&&(t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.lineDashOffset=e[7],t.setLineDash(e[6]))}drawLabelWithPointPlacement_(t,e,i,s){const n=this.textStates[e],r=this.createLabel(t,e,s,i),o=this.strokeStates[i],a=this.pixelRatio,h=Fp(Array.isArray(t)?t[0]:t,n.textAlign||"center"),l=mp[n.textBaseline||"middle"],c=o&&o.lineWidth?o.lineWidth:0,u=r.width/a-2*n.scale[0],d=h*u+2*(.5-h)*c,g=l*r.height/a+2*(.5-l)*c;return{label:r,anchorX:d,anchorY:g}}execute_(t,e,i,s,n,r,o,a){const h=this.zIndexContext_;let l;this.pixelCoordinates_&&vi(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=To(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),wo(this.renderedTransform_,i));let c=0;const u=s.length;let d,g=0;const f=[];let p,_,m,y,v,x,w,E,M,S,C,b,P,R=0,I=0;const T=this.coordinateCache_,A=this.viewRotation_,L=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,O={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:A},G=this.instructions!=s||this.overlaps?0:200;let k,N,F,D;while(c<u){const i=s[c],u=i[0];switch(u){case ip.BEGIN_GEOMETRY:k=i[1],D=i[3],k.getGeometry()?void 0===o||fn(o,D.getExtent())?++c:c=i[2]+1:c=i[2],h&&(h.zIndex=i[4]);break;case ip.BEGIN_PATH:R>G&&(this.fill_(t),R=0),I>G&&(t.stroke(),I=0),R||I||(t.beginPath(),v=NaN,x=NaN),++c;break;case ip.CIRCLE:g=i[1],m=i[2]??0;const s=l[g],u=l[g+1],j=l[g+2]-m,z=l[g+3]-m,U=j-s,B=z-u,W=Math.sqrt(U*U+B*B);t.moveTo(s+W,u),t.arc(s,u,W,0,2*Math.PI,!0),++c;break;case ip.CLOSE_PATH:t.closePath(),++c;break;case ip.CUSTOM:g=i[1],d=i[2];const X=i[3],V=i[4],q=i[5];O.geometry=X,O.feature=k,c in T||(T[c]=[]);const Y=T[c];q?q(l,g,d,2,Y):(Y[0]=l[g],Y[1]=l[g+1],Y.length=2),h&&(h.zIndex=i[6]),V(Y,O),++c;break;case ip.DRAW_IMAGE:g=i[1],d=i[2],M=i[3],p=i[4],_=i[5];let K=i[6];const H=i[7],$=i[8],Z=i[9],J=i[10];let Q=i[11];const tt=i[12];let et=i[13];y=i[14]||"declutter";const it=i[15];if(!M&&i.length>=20){S=i[19],C=i[20],b=i[21],P=i[22];const t=this.drawLabelWithPointPlacement_(S,C,b,P);M=t.label,i[3]=M;const e=i[23];p=(t.anchorX-e)*this.pixelRatio,i[4]=p;const s=i[24];_=(t.anchorY-s)*this.pixelRatio,i[5]=_,K=M.height,i[6]=K,et=M.width,i[13]=et}let st,nt,rt,ot;i.length>25&&(st=i[25]),i.length>17?(nt=i[16],rt=i[17],ot=i[18]):(nt=pg,rt=null,ot=null),J&&L?Q+=A:J||L||(Q-=A);let at=0;for(;g<d;g+=2){if(st&&st[at++]<et/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(M.width,M.height,l[g],l[g+1],et,K,p,_,$,Z,Q,tt,n,nt,!!rt||!!ot,k),s=[t,e,M,i,H,rt,ot];if(a){let t,e,n,r,o;if(it){const i=d-g;if(!it[i]){it[i]={args:s,declutterMode:y};continue}const r=it[i];t=r.args,e=r.declutterMode,delete it[i],n=Np(t)}if(!t||"declutter"===e&&a.collides(n)||(r=!0),"declutter"===y&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===y){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(n),this.replayImageOrLabelArgs_(t)),o&&("none"!==y&&a.insert(i.declutterBox),this.replayImageOrLabelArgs_(s))}else this.replayImageOrLabelArgs_(s)}++c;break;case ip.DRAW_CHARS:const ht=i[1],lt=i[2],ct=i[3],ut=i[4];P=i[5];const dt=i[6],gt=i[7],ft=i[8];b=i[9];const pt=i[10];S=i[11],Array.isArray(S)&&(S=S.reduce(jp,"")),C=i[12];const _t=[i[13],i[13]];y=i[14]||"declutter";const mt=i[15],yt=i[16],vt=this.textStates[C],xt=vt.font,wt=[vt.scale[0]*gt,vt.scale[1]*gt];let Et;xt in this.widths_?Et=this.widths_[xt]:(Et={},this.widths_[xt]=Et);const Mt=Mp(l,ht,lt,2),St=Math.abs(wt[0])*bg(xt,S,Et);if(ut||St<=Mt){const i=this.textStates[C].textAlign,s=(Mt-St)*Fp(S,i),n=Tp(l,ht,lt,2,S,s,dt,Math.abs(wt[0]),bg,xt,Et,L?0:this.viewRotation_,mt);t:if(n){const i=[];let s,r,o,h,l;if(b)for(s=0,r=n.length;s<r;++s){l=n[s],o=l[4],h=this.createLabel(o,C,"",b),p=l[2]+(wt[0]<0?-pt:pt)-yt,_=ct*h.height+2*(.5-ct)*pt*wt[1]/wt[0]-ft;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,p,_,0,0,l[3],_t,!1,pg,!1,k);if(a&&"declutter"===y&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}if(P)for(s=0,r=n.length;s<r;++s){l=n[s],o=l[4],h=this.createLabel(o,C,P,""),p=l[2]-yt,_=ct*h.height-ft;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,p,_,0,0,l[3],_t,!1,pg,!1,k);if(a&&"declutter"===y&&a.collides(r.declutterBox))break t;i.push([t,e,h,r,1,null,null])}a&&"none"!==y&&a.load(i.map(Np));for(let t=0,e=i.length;t<e;++t)this.replayImageOrLabelArgs_(i[t])}}++c;break;case ip.END_GEOMETRY:if(void 0!==r){k=i[1];const t=r(k,D,y);if(t)return t}++c;break;case ip.FILL:G?R++:this.fill_(t),++c;break;case ip.MOVE_TO_LINE_TO:let Ct,bt,Pt;if(g=i[1],d=i[2],m=i[3],m){const t=i[4]??!1,e=t||Math.abs(l[g]-l[d-2])<1e-6&&Math.abs(l[g+1]-l[d-1])<1e-6;Sp(l,g,d,2,m,e,f),bp(f,2,e),Ct=f,bt=0,Pt=Ct.length}else Ct=l,bt=g,Pt=d;N=Ct[bt],F=Ct[bt+1],t.moveTo(N,F),v=N+.5|0,x=F+.5|0;for(let e=bt+2;e<Pt;e+=2)N=Ct[e],F=Ct[e+1],w=N+.5|0,E=F+.5|0,e!=Pt-2&&w===v&&E===x||(t.lineTo(N,F),v=w,x=E);++c;break;case ip.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],R?(this.fill_(t),R=0,I&&(t.stroke(),I=0)):I&&i[1]&&(t.stroke(),I=0),t.fillStyle=i[1],++c;break;case ip.SET_STROKE_STYLE:R&&i[1]&&(this.fill_(t),R=0),I&&(t.stroke(),I=0),this.setStrokeStyle_(t,i),++c;break;case ip.STROKE:G?I++:t.stroke(),++c;break;default:++c;break}}R&&this.fill_(t),I&&t.stroke()}execute(t,e,i,s,n,r){this.viewRotation_=s,this.execute_(t,e,i,this.instructions,n,void 0,void 0,r)}executeHitDetection(t,e,i,s,n){return this.viewRotation_=i,this.execute_(t,[t.canvas.width,t.canvas.height],e,this.hitDetectionInstructions,!0,s,n)}}var Up=zp;const Bp=["Polygon","Circle","LineString","Image","Text","Default"],Wp=["Image","Text"],Xp=Bp.filter(t=>!Wp.includes(t));let Vp=!1,qp=!1;function Yp(){let t=0;const e=e=>{const i=ph(1,1,null,{willReadFrequently:e});let s=0;const n=performance.now();for(;performance.now()-n<50;++s)i.fillStyle=`rgba(255,0,${s%256},1)`,i.fillRect(0,0,1,1),i.getImageData(0,0,1,1);return t=s>t?s:t,s},i={[e(!0)]:!0,[e(!1)]:!1,[e(void 0)]:void 0};Vp=i[t],qp=!0}class Kp{constructor(t,e,i,s,n,r,o){this.maxExtent_=t,this.overlaps_=s,this.pixelRatio_=i,this.resolution_=e,this.renderBuffer_=r,this.executorsByZIndex_={},this.hitDetectionContext_=null,this.hitDetectionTransform_=xo(),this.renderedContext_=null,this.deferredZIndexContexts_={},this.createExecutors_(n,!!o)}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()}createExecutors_(t,e){for(const i in t){let s=this.executorsByZIndex_[i];void 0===s&&(s={},this.executorsByZIndex_[i]=s);const n=t[i];for(const t in n){const i=n[t];s[t]=new Up(this.resolution_,this.pixelRatio_,this.overlaps_,i,e)}}}hasExecutors(t){for(const e in this.executorsByZIndex_){const i=this.executorsByZIndex_[e];for(let e=0,s=t.length;e<s;++e)if(t[e]in i)return!0}return!1}forEachFeatureAtCoordinate(t,e,i,s,n,r){!1===qp&&Yp(),s=Math.round(s);const o=2*s+1,a=Mo(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=ph(o,o,null,{willReadFrequently:Vp}));const l=this.hitDetectionContext_;let c;l.canvas.width!==o||l.canvas.height!==o?(l.canvas.width=o,l.canvas.height=o):h||l.clearRect(0,0,o,o),void 0!==this.renderBuffer_&&(c=Ws(),$s(c,t),Ns(c,e*(this.renderBuffer_+s),c));const u=$p(s);let d;const g=l;function f(t,e,i){const a=g.getImageData(0,0,o,o).data;for(let h=0,l=u.length;h<l;h++)if(a[u[h]]>0){if(!r||"none"===i||"Image"!==d&&"Text"!==d||r.includes(t)){const i=(u[h]-3)/4,r=s-i%o,a=s-(i/o|0),l=n(t,e,r*r+a*a);if(l)return l}g.clearRect(0,0,o,o);break}}const p=Object.keys(this.executorsByZIndex_).map(Number);let _,m,y,v,x;for(p.sort(fi),_=p.length-1;_>=0;--_){const t=p[_].toString();for(y=this.executorsByZIndex_[t],m=Bp.length-1;m>=0;--m)if(d=Bp[m],v=y[d],void 0!==v&&(x=v.executeHitDetection(l,a,i,f,c),x))return x}}getClipCoords(t){const e=this.maxExtent_;if(!e)return null;const i=e[0],s=e[1],n=e[2],r=e[3],o=[i,s,i,r,n,r,n,s];return To(o,0,8,2,t,o),o}isEmpty(){return oi(this.executorsByZIndex_)}execute(t,e,i,s,n,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?pi:fi),r=r||Bp;const h=Bp.length;for(let l=0,c=a.length;l<c;++l){const c=a[l].toString(),u=this.executorsByZIndex_[c];for(let d=0,g=r.length;d<g;++d){const c=r[d],g=u[c];if(void 0!==g){const r=null===o?void 0:g.getZIndexContext(),u=r?r.getContext():t,d=this.maxExtent_&&"Image"!==c&&"Text"!==c;if(d&&(u.save(),this.clip(u,i)),r&&"Text"!==c&&"Image"!==c?r.pushFunction(t=>g.execute(t,e,i,s,n,o)):g.execute(u,e,i,s,n,o),d&&u.restore(),r){r.offset();const t=a[l]*h+Bp.indexOf(c);this.deferredZIndexContexts_[t]||(this.deferredZIndexContexts_[t]=[]),this.deferredZIndexContexts_[t].push(r)}}}}this.renderedContext_=t}getDeferredZIndexContexts(){return this.deferredZIndexContexts_}getRenderedContext(){return this.renderedContext_}renderDeferred(){const t=this.deferredZIndexContexts_,e=Object.keys(t).map(Number).sort(fi);for(let i=0,s=e.length;i<s;++i)t[e[i]].forEach(t=>{t.draw(this.renderedContext_),t.clear()}),t[e[i]].length=0}}const Hp={};function $p(t){if(void 0!==Hp[t])return Hp[t];const e=2*t+1,i=t*t,s=new Array(i+1);for(let r=0;r<=t;++r)for(let n=0;n<=t;++n){const o=r*r+n*n;if(o>i)break;let a=s[o];a||(a=[],s[o]=a),a.push(4*((t+r)*e+(t+n))+3),r>0&&a.push(4*((t-r)*e+(t+n))+3),n>0&&(a.push(4*((t+r)*e+(t-n))+3),r>0&&a.push(4*((t-r)*e+(t-n))+3))}const n=[];for(let r=0,o=s.length;r<o;++r)s[r]&&n.push(...s[r]);return Hp[t]=n,n}var Zp=Kp;class Jp extends $f{constructor(t,e,i,s,n,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Ps(Math.atan2(s[1],s[0]),10):0,this.viewRotation_=n,this.squaredTolerance_=r,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_="",this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=xo()}drawImages_(t,e,i,s){if(!this.image_)return;const n=To(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_,o=this.tmpLocalTransform_,a=r.globalAlpha;1!=this.imageOpacity_&&(r.globalAlpha=a*this.imageOpacity_);let h=this.imageRotation_;0===this.transformRotation_&&(h-=this.viewRotation_),this.imageRotateWithView_&&(h+=this.viewRotation_);for(let l=0,c=n.length;l<c;l+=2){const t=n[l]-this.imageAnchorX_,e=n[l+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const i=t+this.imageAnchorX_,s=e+this.imageAnchorY_;Mo(o,i,s,1,1,h,-i,-s),r.save(),r.transform.apply(r,o),r.translate(i,s),r.scale(this.imageScale_[0],this.imageScale_[1]),r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),r.restore()}else r.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,e,this.imageWidth_,this.imageHeight_)}1!=this.imageOpacity_&&(r.globalAlpha=a)}drawText_(t,e,i,s){if(!this.textState_||""===this.text_)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);const n=To(t,e,i,s,this.transform_,this.pixelCoordinates_),r=this.context_;let o=this.textRotation_;for(0===this.transformRotation_&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);e<i;e+=s){const t=n[e]+this.textOffsetX_,i=n[e+1]+this.textOffsetY_;0!==o||1!=this.textScale_[0]||1!=this.textScale_[1]?(r.save(),r.translate(t-this.textOffsetX_,i-this.textOffsetY_),r.rotate(o),r.translate(this.textOffsetX_,this.textOffsetY_),r.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&r.strokeText(this.text_,0,0),this.textFillState_&&r.fillText(this.text_,0,0),r.restore()):(this.textStrokeState_&&r.strokeText(this.text_,t,i),this.textFillState_&&r.fillText(this.text_,t,i))}}moveToLineTo_(t,e,i,s,n,r){const o=this.context_,a=r??0;let h=To(t,e,i,s,this.transform_,this.pixelCoordinates_);if(Math.abs(a)>0){const t=h.length,e=n||Math.abs(h[0]-h[t-2])<1e-6&&Math.abs(h[1]-h[t-1])<1e-6;h=Sp(h,0,t,2,a,e,h),bp(h,2,e)}o.moveTo(h[0],h[1]);let l=h.length;n&&(l-=2);for(let c=2;c<l;c+=2)o.lineTo(h[c],h[c+1]);return n&&o.closePath(),i}drawRings_(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=this.moveToLineTo_(t,e,i[r],s,!0,n);return e}drawCircle(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),fn(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=Uo(t,this.transform_,this.pixelCoordinates_);if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=Math.sqrt(i*i+s*s),r=this.context_;r.beginPath(),r.arc(e[0],e[1],n,0,2*Math.PI),this.fillState_&&r.fill(),this.strokeState_&&r.stroke()}""!==this.text_&&this.drawText_(t.getCenter(),0,2,2)}}setStyle(t){this.setFillStrokeStyle(t.getFill()??null,t.getStroke()??null),this.setImageStyle(t.getImage()??null),this.setTextStyle(t.getText()??null)}setTransform(t){this.transform_=t}drawGeometry(t){const e=t.getType();switch(e){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);break;default:}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let i=0,s=e.length;i<s;++i)this.drawGeometry(e[i])}drawPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawMultiPoint(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getFlatCoordinates(),i=t.getStride();this.image_&&this.drawImages_(e,0,e.length,i),""!==this.text_&&this.drawText_(e,0,e.length,i)}drawLineString(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),fn(this.extent_,t.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();e.beginPath(),this.moveToLineTo_(i,0,i.length,t.getStride(),!1,this.strokeState_.strokeOffset),e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoint();this.drawText_(e,0,2,2)}}}drawMultiLineString(t){this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_));const e=t.getExtent();if(fn(this.extent_,e)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getFlatCoordinates();let s=0;const n=t.getEnds(),r=t.getStride();e.beginPath();for(let t=0,o=n.length;t<o;++t)s=this.moveToLineTo_(i,s,n[t],r,!1,this.strokeState_.strokeOffset);e.stroke()}if(""!==this.text_){const e=t.getFlatMidpoints();this.drawText_(e,0,e.length,2)}}}drawPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),fn(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_;e.beginPath(),this.drawRings_(t.getOrientedFlatCoordinates(),0,t.getEnds(),t.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoint();this.drawText_(e,0,2,2)}}}drawMultiPolygon(t){if(this.squaredTolerance_&&(t=t.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),fn(this.extent_,t.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=this.context_,i=t.getOrientedFlatCoordinates();let s=0;const n=t.getEndss(),r=t.getStride();e.beginPath();for(let t=0,o=n.length;t<o;++t){const e=n[t];s=this.drawRings_(i,s,e,r,this.strokeState_?.strokeOffset)}this.fillState_&&e.fill(),this.strokeState_&&e.stroke()}if(""!==this.text_){const e=t.getFlatInteriorPoints();this.drawText_(e,0,e.length,2)}}}setContextFillState_(t){const e=this.context_,i=this.contextFillState_;i?i.fillStyle!=t.fillStyle&&(i.fillStyle=t.fillStyle,e.fillStyle=t.fillStyle):(e.fillStyle=t.fillStyle,this.contextFillState_={fillStyle:t.fillStyle})}setContextStrokeState_(t){const e=this.context_,i=this.contextStrokeState_;i?(i.lineCap!=t.lineCap&&(i.lineCap=t.lineCap,e.lineCap=t.lineCap),vi(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.contextStrokeState_={lineCap:t.lineCap,lineDash:t.lineDash,lineDashOffset:t.lineDashOffset,lineJoin:t.lineJoin,lineWidth:t.lineWidth,miterLimit:t.miterLimit,strokeStyle:t.strokeStyle})}setContextTextState_(t){const e=this.context_,i=this.contextTextState_,s=t.textAlign?t.textAlign:"center";i?(i.font!=t.font&&(i.font=t.font,e.font=t.font),i.textAlign!=s&&(i.textAlign=s,e.textAlign=s),i.textBaseline!=t.textBaseline&&(i.textBaseline=t.textBaseline,e.textBaseline=t.textBaseline)):(e.font=t.font,e.textAlign=s,e.textBaseline=t.textBaseline,this.contextTextState_={font:t.font,textAlign:s,textBaseline:t.textBaseline})}setFillStrokeStyle(t,e){if(t){const e=t.getColor();this.fillState_={fillStyle:ed(e||"#000")||"#000"}}else this.fillState_=null;if(e){const t=e.getColor(),i=e.getLineCap(),s=e.getLineDash(),n=e.getLineDashOffset(),r=e.getLineJoin(),o=e.getWidth(),a=e.getMiterLimit(),h=s||fg,l=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:"round",lineDash:1===this.pixelRatio_?h:h.map(t=>t*this.pixelRatio_),lineDashOffset:(n||0)*this.pixelRatio_,lineJoin:void 0!==r?r:"round",lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:ed(t||"#000")||"#000",strokeOffset:(l??0)*this.pixelRatio_}}else this.strokeState_=null}setImageStyle(t){let e;if(!t||!(e=t.getSize()))return void(this.image_=null);const i=t.getPixelRatio(this.pixelRatio_),s=t.getAnchor(),n=t.getOrigin();if(!s||!n)return void(this.image_=null);this.image_=t.getImage(this.pixelRatio_),this.imageAnchorX_=s[0]*i,this.imageAnchorY_=s[1]*i,this.imageHeight_=e[1]*i,this.imageOpacity_=t.getOpacity(),this.imageOriginX_=n[0],this.imageOriginY_=n[1],this.imageRotateWithView_=t.getRotateWithView(),this.imageRotation_=t.getRotation();const r=t.getScaleArray();this.imageScale_=[r[0]*this.pixelRatio_/i,r[1]*this.pixelRatio_/i],this.imageWidth_=e[0]*i}setTextStyle(t){if(t){const e=t.getFill();if(e){const t=e.getColor();this.textFillState_={fillStyle:ed(t||"#000")||"#000"}}else this.textFillState_=null;const i=t.getStroke();if(i){const t=i.getColor(),e=i.getLineCap(),s=i.getLineDash(),n=i.getLineDashOffset(),r=i.getLineJoin(),o=i.getWidth(),a=i.getMiterLimit();this.textStrokeState_={lineCap:void 0!==e?e:"round",lineDash:s||fg,lineDashOffset:n||0,lineJoin:void 0!==r?r:"round",lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:ed(t||"#000")||"#000"}}else this.textStrokeState_=null;const s=t.getFont(),n=t.getOffsetX(),r=t.getOffsetY(),o=t.getRotateWithView(),a=t.getRotation(),h=t.getScaleArray(),l=t.getText(),c=t.getTextAlign(),u=t.getTextBaseline();this.textState_={font:void 0!==s?s:gg,textAlign:void 0!==c?c:"center",textBaseline:void 0!==u?u:"middle"},this.text_=void 0!==l?Array.isArray(l)?l.reduce((t,e,i)=>t+(i%2?" ":e),""):l:"",this.textOffsetX_=void 0!==n?this.pixelRatio_*n:0,this.textOffsetY_=void 0!==r?this.pixelRatio_*r:0,this.textRotateWithView_=void 0!==o&&o,this.textRotation_=void 0!==a?a:0,this.textScale_=[this.pixelRatio_*h[0],this.pixelRatio_*h[1]]}else this.text_=""}}var Qp=Jp;const t_=.5;function e_(t,e,i,s,n,r,o,a,h){const l=h?fo(n,h):n,c=t[0]*t_,u=t[1]*t_,d=ph(c,u);d.imageSmoothingEnabled=!1;const g=d.canvas,f=new Qp(d,t_,n,[1,0,0,1,0,0],o,a??0,h?no(co(),h)??void 0:void 0),p=i.length,_=Math.floor(16777215/p),m={};for(let v=1;v<=p;++v){const t=i[v-1],e=t.getStyleFunction()||s;if(!e)continue;let n=e(t,r);if(!n)continue;Array.isArray(n)||(n=[n]);const o=v*_,a=o.toString(16).padStart(7,"#00000");for(let i=0,s=n.length;i<s;++i){const e=n[i],s=e.getGeometryFunction()(t);if(!s||!fn(l,s.getExtent()))continue;const r=e.clone(),o=r.getFill();o&&o.setColor(a);const h=r.getStroke();h&&(h.setColor(a),h.setLineDash(null)),r.setText(null);const c=e.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=ph(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 gd({img:i,anchor:c.getAnchor()??void 0,anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin()??void 0,opacity:1,size:c.getSize()??void 0,scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=r.getZIndex()||0;let d=m[u];d||(d={},m[u]=d,d["Polygon"]=[],d["Circle"]=[],d["LineString"]=[],d["Point"]=[]);const g=s.getType();if("GeometryCollection"===g){const t=s.getGeometriesArrayRecursive();for(let e=0,i=t.length;e<i;++e){const i=t[e];d[i.getType().replace("Multi","")].push(i,r)}}else d[g.replace("Multi","")].push(s,r)}}const y=Object.keys(m).map(Number).sort(fi);for(let v=0,x=y.length;v<x;++v){const t=m[y[v]];for(const i in t){const s=t[i];for(let t=0,i=s.length;t<i;t+=2){f.setStyle(s[t+1]);for(let i=0,n=e.length;i<n;++i)f.setTransform(e[i]),f.drawGeometry(s[t])}}}return d.getImageData(0,0,g.width,g.height)}function i_(t,e,i){const s=[];if(i){const n=Math.floor(Math.round(t[0])*t_),r=Math.floor(Math.round(t[1])*t_),o=4*(vs(n,0,i.width-1)+vs(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2],c=l+256*(h+256*a),u=Math.floor(16777215/e.length);c&&c%u===0&&s.push(e[c/u-1])}return s}const s_=.5,n_={Point:__,LineString:g_,Polygon:y_,MultiPoint:m_,MultiLineString:f_,MultiPolygon:p_,GeometryCollection:d_,Circle:h_};function r_(t,e){return parseInt(Mi(t),10)-parseInt(Mi(e),10)}function o_(t,e){const i=a_(t,e);return i*i}function a_(t,e){return s_*t/e}function h_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Circle");a.setFillStrokeStyle(r,o),a.drawCircle(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}function l_(t,e,i,s,n,r,o,a){const h=[],l=i.getImage();if(l){let t=!0;const e=l.getImageState();e==Uu.LOADED||e==Uu.ERROR?t=!1:e==Uu.IDLE&&l.load(),t&&h.push(l.ready())}const c=i.getFill();c&&c.loading()&&h.push(c.ready());const u=h.length>0;return u&&Promise.all(h).then(()=>n(null)),c_(t,e,i,s,r,o,a),u}function c_(t,e,i,s,n,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const h=a.simplifyTransformed(s,n),l=i.getRenderer();if(l)u_(t,h,i,e,o);else{const s=n_[h.getType()];s(t,h,i,e,o,r)}}function u_(t,e,i,s,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)u_(t,r[e],i,s,n);return}const r=t.getBuilder(i.getZIndex(),"Default");r.drawCustom(e,s,i.getRenderer(),i.getHitDetectionRenderer(),n)}function d_(t,e,i,s,n,r){const o=e.getGeometriesArray();let a,h;for(a=0,h=o.length;a<h;++a){const e=n_[o[a].getType()];e(t,o[a],i,s,n,r)}}function g_(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}}function f_(t,e,i,s,n){const r=i.getStroke();if(r){const o=t.getBuilder(i.getZIndex(),"LineString");o.setFillStrokeStyle(null,r),o.drawMultiLineString(e,s,n)}const o=i.getText();if(o&&o.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(o),r.drawText(e,s,n)}}function p_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(o||r){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawMultiPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}function __(t,e,i,s,n,r){const o=i.getImage(),a=i.getText(),h=a&&a.getText(),l=r&&o&&h?{}:void 0;if(o){if(o.getImageState()!=Uu.LOADED)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,l),r.drawPoint(e,s,n)}if(h){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a,l),r.drawText(e,s,n)}}function m_(t,e,i,s,n,r){const o=i.getImage(),a=o&&0!==o.getOpacity(),h=i.getText(),l=h&&h.getText(),c=r&&a&&l?{}:void 0;if(a){if(o.getImageState()!=Uu.LOADED)return;const r=t.getBuilder(i.getZIndex(),"Image");r.setImageStyle(o,c),r.drawMultiPoint(e,s,n)}if(l){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(h,c),r.drawText(e,s,n)}}function y_(t,e,i,s,n){const r=i.getFill(),o=i.getStroke();if(r||o){const a=t.getBuilder(i.getZIndex(),"Polygon");a.setFillStrokeStyle(r,o),a.drawPolygon(e,s,n)}const a=i.getText();if(a&&a.getText()){const r=t.getBuilder(i.getZIndex(),"Text");r.setTextStyle(a),r.drawText(e,s,n)}}class v_ extends Hg{constructor(t,e){super(t),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.animatingOrInteracting_,this.hitDetectionImageData_=null,this.clipExtent_=null,this.extendX_=!1,this.renderedFeatures_=null,this.renderedRevision_=-1,this.renderedResolution_=NaN,this.renderedExtent_=Ws(),this.wrappedRenderedExtent_=Ws(),this.renderedRotation_,this.renderedCenter_=null,this.renderedProjection_=null,this.renderedPixelRatio_=1,this.renderedRenderOrder_=null,this.renderedFrameDeclutter_,this.replayGroup_=null,this.replayGroupChanged=!0,this.clipping=!0,this.targetContext_=null,this.opacity_=1,void 0!==e?.wantRotation&&(this.wantRotation=e.wantRotation)}renderWorlds(t,e,i){const s=e.extent,n=e.viewState,r=n.center,o=n.resolution,a=n.projection,h=n.rotation,l=a.getExtent(),c=this.getLayer().getSource(),u=this.getLayer().getDeclutter(),d=e.pixelRatio,g=e.viewHints,f=!(g[ms.ANIMATING]||g[ms.INTERACTING]),p=this.context,_=p.canvas.width,m=p.canvas.height,y=c.getWrapX()&&a.canWrapX(),v=y?gn(l):null,x=s,w=y?Math.ceil((x[2]-l[2])/v)+(this.extendX_?2:1):1;let E=y?Math.floor((x[0]-l[0])/v)-(this.extendX_?1:0):0;do{let s=this.getRenderTransform(r,o,this.sourceRotates()?h:0,d,_,m,E*v);e.declutter&&(s=s.slice(0)),t.execute(p,[p.canvas.width,p.canvas.height],s,h,f,void 0===i?Bp:i?Wp:Xp,i?u&&e.declutter[u]:void 0)}while(++E<w)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=ph(this.context.canvas.width,this.context.canvas.height,Vg))}resetDrawContext_(){if(1!==this.opacity_&&this.targetContext_){const t=this.targetContext_.globalAlpha;this.targetContext_.globalAlpha=this.opacity_,this.targetContext_.drawImage(this.context.canvas,0,0),this.targetContext_.globalAlpha=t,yh(this.context),Vg.push(this.context.canvas),this.context=this.targetContext_,this.targetContext_=null}}renderDeclutter(t){this.replayGroup_&&this.getLayer().getDeclutter()&&this.renderWorlds(this.replayGroup_,t,!0)}renderDeferredInternal(t){this.replayGroup_&&(this.clipExtent_&&this.clipUnrotated(this.context,t,this.clipExtent_),this.replayGroup_.renderDeferred(),this.clipExtent_&&(this.context.restore(),this.clipExtent_=null),this.resetDrawContext_())}renderFrame(t,e){const i=t.layerStatesArray[t.layerIndex];this.opacity_=i.opacity;const s=t.viewState;this.prepareContainer(t,e);const n=this.context,r=this.replayGroup_;let o=r&&!r.isEmpty();if(!o){const t=this.getLayer().hasListener(Dl.PRERENDER)||this.getLayer().hasListener(Dl.POSTRENDER);if(!t)return this.container}this.setDrawContext_(),this.preRender(n,t);const a=s.projection;this.clipExtent_=null;let h=!1;if(o&&i.extent&&this.clipping){const e=po(i.extent,a);o=fn(e,t.extent);const s=o&&!zs(e,t.extent);s&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(n,t,e),h=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),h&&n.restore(),this.postRender(n,t),this.renderedRotation_!==s.rotation&&(this.renderedRotation_=s.rotation,this.hitDetectionImageData_=null),t.declutter||this.resetDrawContext_(),this.container}getFeatures(t){return new Promise(e=>{if(this.frameState&&!this.hitDetectionImageData_&&!this.animatingOrInteracting_){const t=this.frameState.size.slice(),e=this.renderedCenter_,i=this.renderedResolution_,s=this.renderedRotation_,n=this.renderedProjection_,r=this.wrappedRenderedExtent_,o=this.getLayer(),a=[],h=.5*t[0],l=.5*t[1];a.push(this.getRenderTransform(e,i,s,.5,h,l,0).slice());const c=o.getSource(),u=n.getExtent();if(c.getWrapX()&&n.canWrapX()&&!zs(u,r)){let t=r[0];const n=gn(u);let o,c=0;while(t<u[0])--c,o=n*c,a.push(this.getRenderTransform(e,i,s,.5,h,l,o).slice()),t+=n;c=0,t=r[2];while(t>u[2])++c,o=n*c,a.push(this.getRenderTransform(e,i,s,.5,h,l,o).slice()),t-=n}const d=co();this.hitDetectionImageData_=e_(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,s,o_(i,this.renderedPixelRatio_),d?n:null)}e(i_(t,this.renderedFeatures_,this.hitDetectionImageData_))})}forEachFeatureAtCoordinate(t,e,i,s,n){if(!this.replayGroup_)return;const r=e.viewState.resolution,o=e.viewState.rotation,a=this.getLayer(),h={},l=function(t,e,i){const r=Mi(t),o=h[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return h[r]=!0,n.splice(n.lastIndexOf(o),1),s(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return h[r]=!0,s(t,a,e);n.push(h[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:s})}},c=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,l,c?e.declutter?.[c]?.all().map(t=>t.value):null)}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&this.replayGroup_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}prepareFrame(t){const e=this.getLayer(),i=e.getSource();if(!i)return!1;const s=t.viewHints[ms.ANIMATING],n=t.viewHints[ms.INTERACTING],r=e.getUpdateWhileAnimating(),o=e.getUpdateWhileInteracting();if(this.ready&&!r&&s||!o&&n)return this.animatingOrInteracting_=!0,!0;this.animatingOrInteracting_=!1;const a=t.extent,h=t.viewState,l=h.projection,c=h.resolution,u=t.pixelRatio,d=e.getRevision(),g=e.getRenderBuffer();let f=e.getRenderOrder();void 0===f&&(f=r_);const p=h.center.slice(),_=Ns(a,g*c),m=_.slice(),y=[_.slice()],v=l.getExtent(),x=i.getWrapX()&&l.canWrapX();if(this.extendX_=!1,x){const t=i.getExtent();t&&!pn(t)&&(this.extendX_=t[0]<v[0]||t[2]>v[2])}if(x&&(!zs(v,t.extent)||this.extendX_)){const t=gn(v),e=Math.max(gn(_)/2,t);let i=v[0],s=v[2];this.extendX_&&(i-=t,s+=t),_[0]=i-e,_[2]=s+e,bn(p,l);const n=vn(y[0],l);n[0]<v[0]&&n[2]<v[2]?y.push([n[0]+t,n[1],n[2]+t,n[3]]):n[0]>v[0]&&n[2]>v[2]&&y.push([n[0]-t,n[1],n[2]-t,n[3]])}if(this.ready&&this.renderedResolution_==c&&this.renderedPixelRatio_===u&&this.renderedRevision_==d&&this.renderedRenderOrder_==f&&this.renderedFrameDeclutter_===!!t.declutter&&zs(this.wrappedRenderedExtent_,_))return vi(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=p,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Ep(a_(c,u),_,c,u),E=co();let M;if(E){for(let t=0,e=y.length;t<e;++t){const e=y[t],s=fo(e,l);i.loadFeatures(s,_o(c,l),E)}M=no(E,l)}else for(let A=0,L=y.length;A<L;++A)i.loadFeatures(y[A],c,l);const S=o_(c,u);let C=!0;const b=(t,i)=>{let s;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(s=n(t,c)),s){const e=this.renderFeature(t,S,s,w,M,this.getLayer().getDeclutter(),i);C=C&&!e}},P=fo(_,l),R=i.getFeaturesInExtent(P);f&&R.sort(f);for(let A=0,L=R.length;A<L;++A)b(R[A],A);this.renderedFeatures_=R,this.ready=C;const I=w.finish(),T=new Zp(_,c,u,i.getOverlaps(),I,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=f,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=_,this.renderedCenter_=p,this.renderedProjection_=l,this.renderedPixelRatio_=u,this.replayGroup_=T,this.hitDetectionImageData_=null,this.replayGroupChanged=!0,!0}renderFeature(t,e,i,s,n,r,o){if(!i)return!1;let a=!1;if(Array.isArray(i))for(let h=0,l=i.length;h<l;++h)a=l_(s,t,i[h],e,this.boundHandleStyleImageChange_,n,r,o)||a;else a=l_(s,t,i,e,this.boundHandleStyleImageChange_,n,r,o);return a}}var x_=v_;class w_ extends cg{constructor(t){super(t)}createRenderer(){return new x_(this)}}var E_=w_;function M_(t){return Array.isArray(t)?Math.min(...t):t}class S_ extends Yu{constructor(t,e,i,s,n,r,o){let a=t.getExtent();a&&t.canWrapX()&&(a=a.slice(),a[0]=-1/0,a[2]=1/0);let h=e.getExtent();h&&e.canWrapX()&&(h=h.slice(),h[0]=-1/0,h[2]=1/0);const l=h?ln(i,h):i,c=nn(l),u=Ef(t,e,c,s),d=.5,g=new Rf(t,e,l,a,u*d,s),f=g.calculateSourceExtent(),p=pn(f)?null:r(f,u,n),_=p?Uu.IDLE:Uu.EMPTY,m=p?p.getPixelRatio():1;super(i,s,m,_),this.targetProj_=e,this.maxSourceExtent_=a,this.triangulation_=g,this.targetResolution_=s,this.targetExtent_=i,this.sourceImage_=p,this.sourcePixelRatio_=m,this.interpolate_=o,this.canvas_=null,this.sourceListenerKey_=null}disposeInternal(){this.state==Uu.LOADING&&this.unlistenSource_(),super.disposeInternal()}getImage(){return this.canvas_}getProjection(){return this.targetProj_}reproject_(){const t=this.sourceImage_;if(!t)return;const e=t.getState();if(e==Uu.LOADED){const e=gn(this.targetExtent_)/this.targetResolution_,i=hn(this.targetExtent_)/this.targetResolution_,s=t.getImage();if(!s)return;this.canvas_=Sf(e,i,this.sourcePixelRatio_,M_(t.getResolution()),this.maxSourceExtent_,this.targetResolution_,this.targetExtent_,this.triangulation_,[{extent:t.getExtent(),image:s}],0,void 0,this.interpolate_,!0)}this.state=e,this.changed()}load(){if(this.state==Uu.IDLE){const t=this.sourceImage_;if(!t)return;this.state=Uu.LOADING,this.changed();const e=t.getState();e==Uu.LOADED||e==Uu.ERROR?this.reproject_():(this.sourceListenerKey_=ai(t,ci.CHANGE,()=>{const e=t.getState();e!=Uu.LOADED&&e!=Uu.ERROR||(this.unlistenSource_(),this.reproject_())}),t.load())}}unlistenSource_(){li(this.sourceListenerKey_),this.sourceListenerKey_=null}}var C_=S_;class b_ extends ji{constructor(t){super(),this.projection=Kr(t.projection),this.attributions_=P_(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!1,this.canRotate=!1,this.state_=void 0!==t.state?t.state:"ready",this.wrapX_=void 0!==t.wrapX&&t.wrapX,this.interpolate_=!!t.interpolate,this.viewResolver=null,this.viewRejector=null;const e=this;this.viewPromise_=new Promise(function(t,i){e.viewResolver=t,e.viewRejector=i})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(t){return null}getView(){return this.viewPromise_}ready(){const t=this.getState();return"ready"===t?Promise.resolve():"error"===t?Promise.reject(new Error("Source failed to load")):new Promise((t,e)=>{const i=()=>{const s=this.getState();"ready"===s?(this.un("change",i),t()):"error"===s&&(this.un("change",i),e(new Error("Source failed to load")))};this.on("change",i)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(t){this.attributions_=P_(t),this.changed()}setState(t){this.state_=t,this.changed()}}function P_(t){return t?"function"===typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}var R_=b_;const I_={IMAGELOADSTART:"imageloadstart",IMAGELOADEND:"imageloadend",IMAGELOADERROR:"imageloaderror"};class T_ extends Ai{constructor(t,e){super(t),this.image=e}}class A_ extends R_{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.loader=t.loader||null,this.resolutions_=void 0!==t.resolutions?t.resolutions:null,this.reprojectedImage_=null,this.reprojectedRevision_=0,this.image=null,this.wantedExtent_,this.wantedResolution_,this.static_=!!t.loader&&0===t.loader.length,this.wantedProjection_=null}getResolutions(){return this.resolutions_}setResolutions(t){this.resolutions_=t}findNearestResolution(t){const e=this.getResolutions();if(e){const i=_i(e,t,0);t=e[i]}return t}getImage(t,e,i,s){const n=this.getProjection();if(!n||!s||so(n,s))return n&&(s=n),this.getImageInternal(t,e,i,s);if(this.reprojectedImage_){if(this.reprojectedRevision_==this.getRevision()&&so(this.reprojectedImage_.getProjection(),s)&&this.reprojectedImage_.getResolution()==e&&Ks(this.reprojectedImage_.getExtent(),t))return this.reprojectedImage_;this.reprojectedImage_.dispose(),this.reprojectedImage_=null}return this.reprojectedImage_=new C_(n,s,t,e,i,(t,e,i)=>this.getImageInternal(t,e,i,n),this.getInterpolate()),this.reprojectedRevision_=this.getRevision(),this.reprojectedImage_}getImageInternal(t,e,i,s){if(this.loader){const n=O_(t,e,i,1),r=this.findNearestResolution(e);if(this.image&&(this.static_||this.wantedProjection_===s&&(this.wantedExtent_&&zs(this.wantedExtent_,n)||zs(this.image.getExtent(),n))&&(this.wantedResolution_&&M_(this.wantedResolution_)===r||M_(this.image.getResolution())===r)))return this.image;this.wantedProjection_=s,this.wantedExtent_=n,this.wantedResolution_=r,this.image=new Yu(n,r,i,this.loader),this.image.addEventListener(ci.CHANGE,this.handleImageChange.bind(this))}return this.image}handleImageChange(t){const e=t.target;let i;switch(e.getState()){case Uu.LOADING:this.loading=!0,i=I_.IMAGELOADSTART;break;case Uu.LOADED:this.loading=!1,i=I_.IMAGELOADEND;break;case Uu.ERROR:this.loading=!1,i=I_.IMAGELOADERROR;break;default:return}this.hasListener(i)&&this.dispatchEvent(new T_(i,e))}}function L_(t,e){t.getImage().src=e}function O_(t,e,i,s){const n=e/i,r=nn(t),o=Is(gn(t)/n,4),a=Is(hn(t)/n,4),h=Is((s-1)*o/2,4),l=o+2*h,c=Is((s-1)*a/2,4),u=a+2*c;return on(r,n,0,[l,u])}var G_=A_;function k_(t){const e=t.load||qu,i=t.imageExtent,s=t.crossOrigin??null;return()=>{const n=new Image;return n.crossOrigin=s,void 0!==t.referrerPolicy&&(n.referrerPolicy=t.referrerPolicy),e(n,t.url).then(t=>{const e=gn(i)/t.width,s=hn(i)/t.height,n=e!==s?[e,s]:s;return{image:t,extent:i,resolution:n,pixelRatio:1}})}}class N_ extends G_{constructor(t){const e=void 0!==t.crossOrigin?t.crossOrigin:null,i=void 0!==t.imageLoadFunction?t.imageLoadFunction:L_;super({attributions:t.attributions,interpolate:t.interpolate,projection:t.projection}),this.url_=t.url,this.imageExtent_=t.imageExtent,this.image=null,this.image=new Yu(this.imageExtent_,void 0,1,k_({url:t.url,imageExtent:t.imageExtent,crossOrigin:e,referrerPolicy:t.referrerPolicy,load:(t,e)=>{const s=this.image;return s.setImage(t),i(s,e),qu(t)}}));const s=this.image;s.addEventListener(ci.CHANGE,this.handleImageChange.bind(this))}getImageExtent(){return this.imageExtent_}getImageInternal(t,e,i,s){const n=this.image;return n&&fn(t,n.getExtent())?n:null}getUrl(){return this.url_}}var F_=N_;const D_=[0,0,0],j_=5;class z_{constructor(t){let e=t.minZoom;const i=t.resolutions;let s;if(void 0===e&&i&&(e=i.findIndex(t=>void 0!==t)),this.minZoom=void 0!==e?e:0,this.resolutions_=i,cs(xi(this.resolutions_,(t,e)=>e-t,!0),"`resolutions` must be sorted in descending order"),!t.origins)for(let r=0,o=this.resolutions_.length-1;r<o;++r)if(s){if(this.resolutions_[r]/this.resolutions_[r+1]!==s){s=void 0;break}}else s=this.resolutions_[r]/this.resolutions_[r+1];this.zoomFactor_=s,this.maxZoom=this.resolutions_.length-1,this.origin_=void 0!==t.origin?t.origin:null,this.origins_=null,void 0!==t.origins&&(this.origins_=t.origins,cs(this.origins_.length==this.resolutions_.length,"Number of `origins` and `resolutions` must be equal"));const n=t.extent;void 0===n||this.origin_||this.origins_||(this.origin_=un(n)),cs(!this.origin_&&this.origins_||this.origin_&&!this.origins_,"Either `origin` or `origins` must be configured, never both"),this.tileSizes_=null,void 0!==t.tileSizes&&(this.tileSizes_=t.tileSizes,cs(this.tileSizes_.length==this.resolutions_.length,"Number of `tileSizes` and `resolutions` must be equal")),this.tileSize_=void 0!==t.tileSize?t.tileSize:this.tileSizes_?null:256,cs(!this.tileSize_&&this.tileSizes_||this.tileSize_&&!this.tileSizes_,"Either `tileSize` or `tileSizes` must be configured, never both"),this.extent_=void 0!==n?n:null,this.fullTileRanges_=null,this.tmpSize_=[0,0],this.tmpExtent_=[0,0,0,0],void 0!==t.tileRanges?this.fullTileRanges_=t.tileRanges:void 0!==t.sizes?this.fullTileRanges_=t.sizes.map((t,e)=>{const i=new _f(Math.min(0,t[0]),Math.max(t[0]-1,-1),Math.min(0,t[1]),Math.max(t[1]-1,-1));if(n){const t=this.getTileRangeForExtentAndZ(n,e);i.minX=Math.max(t.minX,i.minX),i.maxX=Math.min(t.maxX,i.maxX),i.minY=Math.max(t.minY,i.minY),i.maxY=Math.min(t.maxY,i.maxY)}return i}):n&&this.calculateTileRanges_(n)}forEachTileCoord(t,e,i){const s=this.getTileRangeForExtentAndZ(t,e);for(let n=s.minX,r=s.maxX;n<=r;++n)for(let t=s.minY,o=s.maxY;t<=o;++t)i([e,n,t])}forEachTileCoordParentTileRange(t,e,i,s){let n,r,o,a=null,h=t[0]-1;2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,s);while(h>=this.minZoom){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),n=pf(r,r,o,o,i)):n=this.getTileRangeForExtentAndZ(a,h,i),e(h,n))return!0;--h}return!1}getExtent(){return this.extent_}getMaxZoom(){return this.maxZoom}getMinZoom(){return this.minZoom}getOrigin(t){return this.origin_?this.origin_:this.origins_?this.origins_[t]:[0,0]}getOrigins(){return this.origins_}getResolution(t){return this.resolutions_[t]}getResolutions(){return this.resolutions_}getTileCoordChildTileRange(t,e,i){if(t[0]<this.maxZoom){if(2===this.zoomFactor_){const i=2*t[1],s=2*t[2];return pf(i,i+1,s,s+1,e)}const s=this.getTileCoordExtent(t,i||this.tmpExtent_);return this.getTileRangeForExtentAndZ(s,t[0]+1,e)}return null}getTileRangeForTileCoordAndZ(t,e,i){if(e>this.maxZoom||e<this.minZoom)return null;const s=t[0],n=t[1],r=t[2];if(e===s)return pf(n,n,r,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-s),o=Math.floor(n*t),a=Math.floor(r*t);if(e<s)return pf(o,o,a,a,i);const h=Math.floor(t*(n+1))-1,l=Math.floor(t*(r+1))-1;return pf(o,h,a,l,i)}const o=this.getTileCoordExtent(t,this.tmpExtent_);return this.getTileRangeForExtentAndZ(o,e,i)}getTileRangeForExtentAndZ(t,e,i){this.getTileCoordForXYAndZ_(t[0],t[3],e,!1,D_);const s=D_[1],n=D_[2];this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,D_);const r=D_[1],o=D_[2];return pf(s,r,n,o,i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=Lc(this.getTileSize(t[0]),this.tmpSize_);return[e[0]+(t[1]+.5)*s[0]*i,e[1]-(t[2]+.5)*s[1]*i]}getTileCoordExtent(t,e){const i=this.getOrigin(t[0]),s=this.getResolution(t[0]),n=Lc(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*n[0]*s,o=i[1]-(t[2]+1)*n[1]*s,a=r+n[0]*s,h=o+n[1]*s;return Xs(r,o,a,h,e)}getTileCoordForCoordAndResolution(t,e,i){return this.getTileCoordForXYAndResolution_(t[0],t[1],e,!1,i)}getTileCoordForXYAndResolution_(t,e,i,s,n){const r=this.getZForResolution(i),o=i/this.getResolution(r),a=this.getOrigin(r),h=Lc(this.getTileSize(r),this.tmpSize_);let l=o*(t-a[0])/i/h[0],c=o*(a[1]-e)/i/h[1];return s?(l=Is(l,j_)-1,c=Is(c,j_)-1):(l=Rs(l,j_),c=Rs(c,j_)),Of(r,l,c,n)}getTileCoordForXYAndZ_(t,e,i,s,n){const r=this.getOrigin(i),o=this.getResolution(i),a=Lc(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return s?(h=Is(h,j_)-1,l=Is(l,j_)-1):(h=Rs(h,j_),l=Rs(l,j_)),Of(i,h,l,n)}getTileCoordForCoordAndZ(t,e,i){return this.getTileCoordForXYAndZ_(t[0],t[1],e,!1,i)}getTileCoordResolution(t){return this.resolutions_[t[0]]}getTileSize(t){return this.tileSize_?this.tileSize_:this.tileSizes_?this.tileSizes_[t]:256}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){const i=_i(this.resolutions_,t,e||0);return vs(i,this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return ga(e,0,e.length,2,this.getTileCoordExtent(t))}calculateTileRanges_(t){const e=this.resolutions_.length,i=new Array(e);for(let s=this.minZoom;s<e;++s)i[s]=this.getTileRangeForExtentAndZ(t,s);this.fullTileRanges_=i}}var U_=z_;function B_(t){let e=t.getDefaultTileGrid();return e||(e=Y_(t),t.setDefaultTileGrid(e)),e}function W_(t,e,i){const s=e[0],n=t.getTileCoordCenter(e),r=K_(i);if(!js(r,n)){const e=gn(r),i=Math.ceil((r[0]-n[0])/e);return n[0]+=e*i,t.getTileCoordForCoordAndZ(n,s)}return e}function X_(t,e,i,s){s=void 0!==s?s:"top-left";const n=q_(t,e,i);return new U_({extent:t,origin:rn(t,s),resolutions:n,tileSize:i})}function V_(t){const e=t||{},i=e.extent||Kr("EPSG:3857")?.getExtent();if(!i)throw new Error("Unable to determine extent for XYZ tile grid");const s={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:q_(i,e.maxZoom,e.tileSize,e.maxResolution)};return new U_(s)}function q_(t,e,i,s){e=void 0!==e?e:42,i=Lc(void 0!==i?i:256);const n=hn(t),r=gn(t);s=void 0!==s&&s>0?s:Math.max(r/i[0],n/i[1]);const o=e+1,a=new Array(o);for(let h=0;h<o;++h)a[h]=s/Math.pow(2,h);return a}function Y_(t,e,i,s){const n=K_(t);return X_(n,e,i,s)}function K_(t){const e=Kr(t);if(!e)throw new Error("Unable to determine extent from unknown projection");let i=e.getExtent();if(!i){const t=e.getMetersPerUnit();if(void 0===t)throw new Error("Unable to determine extent from projection without units");const s=180*Fn.degrees/t;i=Xs(-s,-s,s,s)}return i}const H_=/\{z\}/g,$_=/\{x\}/g,Z_=/\{y\}/g,J_=/\{-y\}/g;function Q_(t,e,i,s,n){return t.replace(H_,e.toString()).replace($_,i.toString()).replace(Z_,s.toString()).replace(J_,function(){if(void 0===n)throw new Error("If the URL template has a {-y} placeholder, the grid extent must be known");return(n-s).toString()})}function tm(t){const e=[];let i=/\{([a-z])-([a-z])\}/.exec(t);if(i){const s=i[1].charCodeAt(0),n=i[2].charCodeAt(0);let r;for(r=s;r<=n;++r)e.push(t.replace(i[0],String.fromCharCode(r)));return e}if(i=/\{(\d+)-(\d+)\}/.exec(t),i){const s=parseInt(i[2],10);for(let n=parseInt(i[1],10);n<=s;n++)e.push(t.replace(i[0],n.toString()));return e}return e.push(t),e}function em(t,e){return function(i,s,n){if(!i)return;let r;const o=i[0];if(e){const t=e.getFullTileRange(o);t&&(r=t.getHeight()-1)}return Q_(t,o,i[1],i[2],r)}}function im(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=em(t[n],e);return sm(s)}function sm(t){return 1===t.length?t[0]:function(e,i,s){if(!e)return;const n=Nf(e),r=Cs(n,t.length);return t[r](e,i,s)}}class nm extends R_{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.tilePixelRatio_=void 0!==t.tilePixelRatio?t.tilePixelRatio:1,this.tileGrid=void 0!==t.tileGrid?t.tileGrid:null;const e=[256,256];this.tileGrid&&Lc(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),e),this.tmpSize=[0,0],this.key_=t.key||Mi(this),this.tileOptions={transition:t.transition,interpolate:t.interpolate},this.zDirection=t.zDirection?t.zDirection:0}getGutterForProjection(t){return 0}getKey(){return this.key_}setKey(t){this.key_!==t&&(this.key_=t,this.changed())}getResolutions(t){const e=t?this.getTileGridForProjection(t):this.tileGrid;return e?e.getResolutions():null}getTile(t,e,i,s,n,r){return wi()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:B_(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),r=Lc(s.getTileSize(t),this.tmpSize);return 1==n?r:Ac(r,n,this.tmpSize)}getTileCoordForTileUrlFunction(t,e){const i=void 0!==e?e:this.getProjection(),s=void 0!==e?this.getTileGridForProjection(i):this.tileGrid||this.getTileGridForProjection(i);return this.getWrapX()&&i.isGlobal()&&(t=W_(s,t,i)),Df(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}}class rm extends Ai{constructor(t,e){super(t),this.tile=e}}var om=nm,am={TILELOADSTART:"tileloadstart",TILELOADEND:"tileloadend",TILELOADERROR:"tileloaderror"};class hm extends om{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tilePixelRatio:t.tilePixelRatio,wrapX:t.wrapX,transition:t.transition,interpolate:t.interpolate,key:t.key,attributionsCollapsible:t.attributionsCollapsible,zDirection:t.zDirection}),this.generateTileUrlFunction_=this.tileUrlFunction===hm.prototype.tileUrlFunction,this.tileLoadFunction=t.tileLoadFunction,t.tileUrlFunction&&(this.tileUrlFunction=t.tileUrlFunction),this.urls=null,t.urls?this.setUrls(t.urls):t.url&&this.setUrl(t.url),this.tileLoadingKeys_={}}getTileLoadFunction(){return this.tileLoadFunction}getTileUrlFunction(){return Object.getPrototypeOf(this).tileUrlFunction===this.tileUrlFunction?this.tileUrlFunction.bind(this):this.tileUrlFunction}getUrls(){return this.urls}handleTileChange(t){const e=t.target,i=Mi(e),s=e.getState();let n;s==ls.LOADING?(this.tileLoadingKeys_[i]=!0,n=am.TILELOADSTART):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],n=s==ls.ERROR?am.TILELOADERROR:s==ls.LOADED?am.TILELOADEND:void 0),void 0!=n&&this.dispatchEvent(new rm(n,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,"undefined"!==typeof e?this.setKey(e):this.changed()}setUrl(t){const e=tm(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(im(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}var lm=hm;class cm extends lm{constructor(t){super({attributions:t.attributions,cacheSize:t.cacheSize,projection:t.projection,state:t.state,tileGrid:t.tileGrid,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:um,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.referrerPolicy=t.referrerPolicy,this.tileClass=void 0!==t.tileClass?t.tileClass:gf,this.tileGridForProjection={},this.reprojectionErrorThreshold_=t.reprojectionErrorThreshold,this.renderReprojectionEdges_=!1}getGutterForProjection(t){const e=this.getProjection();return e&&t&&!so(e,t)?0:this.getGutter()}getGutter(){return 0}getKey(){let t=super.getKey();return this.getInterpolate()||(t+=":disable-interpolation"),t}getTileGridForProjection(t){const e=this.getProjection();if(this.tileGrid&&(!e||so(e,t)))return this.tileGrid;const i=Mi(t);return i in this.tileGridForProjection||(this.tileGridForProjection[i]=B_(t)),this.tileGridForProjection[i]}createTile_(t,e,i,s,n,r){const o=[t,e,i],a=this.getTileCoordForTileUrlFunction(o,n),h=a?this.tileUrlFunction(a,s,n):void 0,l=new this.tileClass(o,void 0!==h?ls.IDLE:ls.EMPTY,void 0!==h?h:"",{crossOrigin:this.crossOrigin,referrerPolicy:this.referrerPolicy},this.tileLoadFunction,this.tileOptions);return l.key=r,l.addEventListener(ci.CHANGE,this.handleTileChange.bind(this)),l}getTile(t,e,i,s,n,r){const o=this.getProjection();if(!o||!n||so(o,n))return this.getTileInternal(t,e,i,s,o||n);const a=[t,e,i],h=this.getKey(),l=this.getTileGridForProjection(o),c=this.getTileGridForProjection(n),u=this.getTileCoordForTileUrlFunction(a,n)||a,d=new Tf(o,l,n,c,a,u,this.getTilePixelRatio(s),this.getGutter(),(t,e,i,s)=>this.getTileInternal(t,e,i,s,o,r),this.reprojectionErrorThreshold_,this.renderReprojectionEdges_,this.tileOptions);return d.key=h,d}getTileInternal(t,e,i,s,n,r){const o=this.getKey(),a=kf(this,o,t,e,i);if(r&&r.containsKey(a)){const t=r.get(a);return t}const h=this.createTile_(t,e,i,s,n,o);return r?.set(a,h),h}setRenderReprojectionEdges(t){this.renderReprojectionEdges_!=t&&(this.renderReprojectionEdges_=t,this.changed())}setTileGridForProjection(t,e){const i=Kr(t);if(i){const t=Mi(i);t in this.tileGridForProjection||(this.tileGridForProjection[t]=e)}}}function um(t,e){if(ts){const i=t.getCrossOrigin();let s="same-origin",n="same-origin";"anonymous"===i||""===i?(s="cors",n="omit"):"use-credentials"===i&&(s="cors",n="include");const r={mode:s,credentials:n,referrerPolicy:t.getReferrerPolicy()};return void fetch(e,r).then(t=>{if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.blob()}).then(t=>createImageBitmap(t)).then(e=>{const i=t.getImage();if(!i)return;i.width=e.width,i.height=e.height;const s=i.getContext("2d");s&&(s.drawImage(e,0,0),e.close?.(),i.dispatchEvent(new Event("load")))}).catch(()=>{const e=t.getImage();e?.dispatchEvent(new Event("error"))})}t.getImage().src=e}var dm=cm;class gm extends dm{constructor(t){t=t||{};const e=void 0!==t.projection?t.projection:"EPSG:3857",i=void 0!==t.tileGrid?t.tileGrid:V_({extent:K_(e),maxResolution:t.maxResolution,maxZoom:t.maxZoom,minZoom:t.minZoom,tileSize:t.tileSize});super({attributions:t.attributions,cacheSize:t.cacheSize,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,interpolate:t.interpolate,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.gutter_=void 0!==t.gutter?t.gutter:0}getGutter(){return this.gutter_}}var fm=gm;let pm=!1;function _m(t,e,i,s,n,r,o){const a=new XMLHttpRequest;a.open("GET","function"===typeof t?t(i,s,n):t,!0),"arraybuffer"==e.getType()&&(a.responseType="arraybuffer"),a.withCredentials=pm,a.onload=function(t){if(!a.status||a.status>=200&&a.status<300){const t=e.getType();try{let s;"text"==t||"json"==t?s=a.responseText:"xml"==t?s=a.responseXML||a.responseText:"arraybuffer"==t&&(s=a.response),s?r(e.readFeatures(s,{extent:i,featureProjection:n}),e.readProjection(s)):o()}catch{o()}}else o()},a.onerror=o,a.send()}function mm(t,e){return function(i,s,n,r,o){_m(t,e,i,s,n,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}function ym(t,e){return[[-1/0,-1/0,1/0,1/0]]}function vm(t,e,i,s){const n=[];let r=Ws();for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Ys(t,e,a[0],s),n.push((r[0]+r[2])/2,(r[1]+r[3])/2),e=a[a.length-1]}return n}function xm(t,e,i,s,n,r,o){let a,h;const l=(i-e)/s;if(1===l)a=e;else if(2===l)a=e,h=n;else if(0!==l){let r=t[e],o=t[e+1],l=0;const c=[0];for(let n=e+s;n<i;n+=s){const e=t[n],i=t[n+1];l+=Math.sqrt((e-r)*(e-r)+(i-o)*(i-o)),c.push(l),r=e,o=i}const u=n*l,d=gi(c,u);d<0?(h=(u-c[-d-2])/(c[-d-1]-c[-d-2]),a=e+(-d-2)*s):a=e+d*s}o=void 0!==o&&o>1?o:2,r=r||new Array(o);for(let c=0;c<o;++c)r[c]=void 0===a?NaN:void 0===h?t[a+c]:bs(t[a+c],t[a+s+c],h);return r}function wm(t,e,i,s,n,r){if(i==e)return null;let o;if(n<t[e+s-1])return r?(o=t.slice(e,e+s),o[s-1]=n,o):null;if(t[i-1]<n)return r?(o=t.slice(i-s,i),o[s-1]=n,o):null;if(n==t[e+s-1])return t.slice(e,e+s);let a=e/s,h=i/s;while(a<h){const e=a+h>>1;n<t[(e+1)*s-1]?h=e:a=e+1}const l=t[a*s-1];if(n==l)return t.slice((a-1)*s,(a-1)*s+s);const c=t[(a+1)*s-1],u=(n-l)/(c-l);o=[];for(let d=0;d<s-1;++d)o.push(bs(t[(a-1)*s+d],t[a*s+d],u));return o.push(n),o}function Em(t,e,i,s,n,r,o){if(o)return wm(t,e,i[i.length-1],s,n,r);let a;if(n<t[s-1])return r?(a=t.slice(0,s),a[s-1]=n,a):null;if(t[t.length-1]<n)return r?(a=t.slice(t.length-s),a[s-1]=n,a):null;for(let h=0,l=i.length;h<l;++h){const r=i[h];if(e!=r){if(n<t[e+s-1])return null;if(n<=t[r-1])return wm(t,e,r,s,n,!1);e=r}}return null}const Mm=xo();class Sm{constructor(t,e,i,s,n,r){this.styleFunction,this.extent_,this.id_=r,this.type_=t,this.flatCoordinates_=e,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=i||null,this.properties_=n,this.squaredTolerance_,this.stride_=s,this.simplifiedGeometry_}get(t){return this.properties_[t]}getExtent(){return this.extent_||(this.extent_="Point"===this.type_?qs(this.flatCoordinates_):Ys(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=nn(this.getExtent());this.flatInteriorPoints_=ba(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=Ga(this.flatCoordinates_,this.ends_),e=vm(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=Pa(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=xm(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5)),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];const t=this.flatCoordinates_;let e=0;const i=this.ends_;for(let s=0,n=i.length;s<n;++s){const n=i[s],r=xm(t,e,n,this.stride_,.5);yi(this.flatMidpoints_,r),e=n}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(t){return this}simplifyTransformed(t,e){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(t){t=Kr(t);const e=t.getExtent(),i=t.getWorldExtent();if(e&&i){const t=hn(i)/hn(e);Mo(Mm,i[0],i[3],t,-t,0,0,0),To(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Mm,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Sm(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=Ri((t,e)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),e&&this.simplifiedGeometry_.applyTransform(e);const i=this.simplifiedGeometry_.getFlatCoordinates();let s;switch(this.type_){case"LineString":i.length=_a(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=ma(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=xa(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s);break;default:}return s&&(this.simplifiedGeometry_=new Sm(this.type_,i,s,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Sm.prototype.getFlatCoordinates=Sm.prototype.getOrientedFlatCoordinates;var Cm=Sm;class bm{constructor(t){this.rbush_=new Vl(t),this.items_={}}insert(t,e){const i={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3],value:e};this.rbush_.insert(i),this.items_[Mi(e)]=i}load(t,e){const i=new Array(e.length);for(let s=0,n=e.length;s<n;s++){const n=t[s],r=e[s],o={minX:n[0],minY:n[1],maxX:n[2],maxY:n[3],value:r};i[s]=o,this.items_[Mi(r)]=o}this.rbush_.load(i)}remove(t){const e=Mi(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[Mi(e)],s=[i.minX,i.minY,i.maxX,i.maxY];Ks(s,t)||(this.remove(e),this.insert(t,e))}getAll(){const t=this.rbush_.all();return t.map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]},i=this.rbush_.search(e);return i.map(function(t){return t.value})}forEach(t){return this.forEach_(this.getAll(),t)}forEachInExtent(t,e){return this.forEach_(this.getInExtent(t),e)}forEach_(t,e){let i;for(let s=0,n=t.length;s<n;s++)if(i=e(t[s]),i)return i;return i}isEmpty(){return oi(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Xs(e.minX,e.minY,e.maxX,e.maxY,t)}concat(t){this.rbush_.load(t.rbush_.all());for(const e in t.items_)this.items_[e]=t.items_[e]}}var Pm=bm,Rm={ADDFEATURE:"addfeature",CHANGEFEATURE:"changefeature",CLEAR:"clear",REMOVEFEATURE:"removefeature",FEATURESLOADSTART:"featuresloadstart",FEATURESLOADEND:"featuresloadend",FEATURESLOADERROR:"featuresloaderror"};class Im extends Ai{constructor(t,e,i){super(t),this.feature=e,this.features=i}}class Tm extends R_{constructor(t){t=t||{},super({attributions:t.attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.canRotate=!0,this.on,this.once,this.un,this.loader_=Pi,this.format_=t.format||null,this.overlaps_=void 0===t.overlaps||t.overlaps,this.url_=t.url,void 0!==t.loader?this.loader_=t.loader:void 0!==this.url_&&(cs(this.format_,"`format` must be set when `url` is set"),this.loader_=mm(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:ym;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,s;this.featuresRtree_=e?new Pm:null,this.loadedExtentsRtree_=new Pm,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null,Array.isArray(t.features)?s=t.features:t.features&&(i=t.features,s=i.getArray()),e||void 0!==i||(i=new Wi(s)),void 0!==s&&this.addFeaturesInternal(s),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Mi(t);if(!this.addToIndex_(e,t))return void(this.featuresCollection_&&this.featuresCollection_.remove(t));this.setupChangeEvents_(e,t);const i=t.getGeometry();if(i){const e=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(e,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new Im(Rm.ADDFEATURE,t))}setupChangeEvents_(t,e){e instanceof Cm||(this.featureChangeKeys_[t]=[ai(e,ci.CHANGE,this.handleFeatureChange_,this),ai(e,ni.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(t,e){let i=!0;if(void 0!==e.getId()){const t=String(e.getId());if(t in this.idIndex_)if(e instanceof Cm){const s=this.idIndex_[t];s instanceof Cm?Array.isArray(s)?s.push(e):this.idIndex_[t]=[s,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(cs(!(t in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[t]=e),i}addFeatures(t){this.addFeaturesInternal(t),this.changed()}addFeaturesInternal(t){const e=[],i=[],s=[];for(let n=0,r=t.length;n<r;n++){const e=t[n],s=Mi(e);this.addToIndex_(s,e)&&i.push(e)}for(let n=0,r=i.length;n<r;n++){const t=i[n],r=Mi(t);this.setupChangeEvents_(r,t);const o=t.getGeometry();if(o){const i=o.getExtent();e.push(i),s.push(t)}else this.nullGeometryFeatures_[r]=t}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Rm.ADDFEATURE))for(let n=0,r=i.length;n<r;n++)this.dispatchEvent(new Im(Rm.ADDFEATURE,i[n]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Rm.ADDFEATURE,function(i){!e&&i.feature&&(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Rm.REMOVEFEATURE,function(i){!e&&i.feature&&(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(si.ADD,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(si.REMOVE,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_){const e=this.featureChangeKeys_[t];e.forEach(li)}this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(t=>{this.removeFeatureInternal(t)});for(const t in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[t])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};const e=new Im(Rm.CLEAR);this.dispatchEvent(e),this.changed()}forEachFeature(t){if(this.featuresRtree_)return this.featuresRtree_.forEach(t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureAtCoordinateDirect(t,e){const i=[t[0],t[1],t[0],t[1]];return this.forEachFeatureInExtent(i,function(i){const s=i.getGeometry();if(s instanceof Cm||s&&s.intersectsCoordinate(t))return e(i)})}forEachFeatureInExtent(t,e){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(t,e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureIntersectingExtent(t,e){return this.forEachFeatureInExtent(t,function(i){const s=i.getGeometry();if(s instanceof Cm||s&&s.intersectsExtent(t)){const t=e(i);if(t)return t}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let t;return this.featuresCollection_?t=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(t=this.featuresRtree_.getAll(),oi(this.nullGeometryFeatures_)||yi(t,Object.values(this.nullGeometryFeatures_))),t||[]}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){const i=e&&e.canWrapX()&&this.getWrapX();if(!i)return this.featuresRtree_.getInExtent(t);const s=this.featuresRtree_,n=xn(t,e);return n.flatMap(t=>s.getInExtent(t))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let n=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];e=e||Ci;const h=this.featuresRtree_;return h?(h.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry();if(!e)return;const h=o;if(o=e instanceof Cm?0:e.closestPointXY(i,s,r,o),o<h){n=t;const e=Math.sqrt(o);a[0]=i-e,a[1]=s-e,a[2]=i+e,a[3]=s+e}}}),n):null}getExtent(t){return this.featuresRtree_?.getExtent(t)??null}getFeatureById(t){const e=this.idIndex_[t.toString()];return void 0!==e?e:null}getFeatureByUid(t){const e=this.uidIndex_[t];return void 0!==e?e:null}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(t){const e=t.target,i=Mi(e),s=e.getGeometry();if(s){const t=s.getExtent();i in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[i],this.featuresRtree_&&this.featuresRtree_.insert(t,e)):this.featuresRtree_&&this.featuresRtree_.update(t,e)}else i in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(e),this.nullGeometryFeatures_[i]=e);const n=e.getId();if(void 0!==n){const t=n.toString();this.idIndex_[t]!==e&&(this.removeFromIdIndex_(e),this.idIndex_[t]=e)}else this.removeFromIdIndex_(e),this.uidIndex_[i]=e;this.changed(),this.dispatchEvent(new Im(Rm.CHANGEFEATURE,e))}hasFeature(t){const e=t.getId();if(void 0!==e){const i=this.idIndex_[String(e)];return Array.isArray(i)?i.includes(t):i===t}return Mi(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&oi(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,n=this.strategy_(t,e,i);for(let r=0,o=n.length;r<o;++r){const t=n[r],o=s.forEachInExtent(t,function(e){return zs(e.extent,t)});if(!o){this.loading=Number(this.loading)+1,this.dispatchEvent(new Im(Rm.FEATURESLOADSTART));const n=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new Im(Rm.FEATURESLOADEND,void 0,t))},r=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new Im(Rm.FEATURESLOADERROR))};let o=!1;const a=this.loader_.call(this,t,e,i,t=>o||n(t),()=>o||r());Si(a)?(o=!0,a.then(t=>{const e=t;this.addFeatures(e),n(e)}).catch(r)):this.loader_.length<4&&(this.loading=!1),s.insert(t,{extent:t.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(t){const e=this.loadedExtentsRtree_,i=[];e.forEachInExtent(t,function(t){i.push(t)}),i.forEach(i=>{e.remove(i);const s=cn(i.extent,t);for(const t of s)e.insert(t,{extent:t})})}removeFeatures(t){let e=!1;for(let i=0,s=t.length;i<s;++i)e=this.removeFeatureInternal(t[i])||e;e&&this.changed()}removeFeature(t){if(!t)return;const e=this.removeFeatureInternal(t);e&&this.changed()}removeFeatureInternal(t){const e=Mi(t);if(!(e in this.uidIndex_))return!1;e in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[e]:this.featuresRtree_&&this.featuresRtree_.remove(t);const i=this.featureChangeKeys_[e];i?.forEach(li),delete this.featureChangeKeys_[e];const s=t.getId();if(void 0!==s){const e=s.toString(),i=this.idIndex_[e];i===t?delete this.idIndex_[e]:Array.isArray(i)&&(i.splice(i.indexOf(t),1),1===i.length&&(this.idIndex_[e]=i[0]))}return delete this.uidIndex_[e],this.hasListener(Rm.REMOVEFEATURE)&&this.dispatchEvent(new Im(Rm.REMOVEFEATURE,t)),!0}removeFromIdIndex_(t){for(const e in this.idIndex_)if(this.idIndex_[e]===t){delete this.idIndex_[e];break}}setLoader(t){this.loader_=t}setUrl(t){cs(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(mm(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}}var Am=Tm;class Lm extends ji{constructor(t){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_="geometry",this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),t)if("function"===typeof t.getSimplifiedGeometry){const e=t;this.setGeometry(e)}else{const e=t;this.setProperties(e)}}clone(){const t=new Lm,e=this.geometryName_;t.setGeometryName(e);const i=this.getPropertiesInternal();if(i){const s=this.getGeometry();for(const n in i)n===e&&s?t.set(n,s.clone()):t.set(n,i[n],!0)}const s=this.getStyle();return s&&t.setStyle(s),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&(li(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=ai(t,ci.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t??null,this.styleFunction_=t?Om(t):void 0,this.changed()}setId(t){this.id_=t,this.changed()}setGeometryName(t){t!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=t,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}}function Om(t){if("function"===typeof t)return t;let e;if(Array.isArray(t))e=t;else{cs("function"===typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`");const i=t;e=[i]}return function(){return e}}var Gm=Lm;class km extends Fo{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(li),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(ai(t[e],ci.CHANGE,this.changed,this))}clone(){const t=new km(Nm(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Ds(this.getExtent(),t,e))return s;const n=this.geometries_;for(let r=0,o=n.length;r<o;++r)s=n[r].closestPointXY(t,e,i,s);return s}containsXY(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)if(i[s].containsXY(t,e))return!0;return!1}computeExtent(t){Vs(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)Hs(t,e[i].getExtent());return t}getGeometries(){return Nm(this.geometries_)}getGeometriesArray(){return this.geometries_}getGeometriesArrayRecursive(){let t=[];const e=this.geometries_;for(let i=0,s=e.length;i<s;++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.geometries_;let s=!1;for(let n=0,r=i.length;n<r;++n){const r=i[n],o=r.getSimplifiedGeometry(t);e.push(o),o!==r&&(s=!0)}if(s){const t=new km(e);return t}return this.simplifiedGeometryMaxMinSquaredTolerance=t,this}getType(){return"GeometryCollection"}intersectsExtent(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)if(e[i].intersectsExtent(t))return!0;return!1}isEmpty(){return 0===this.geometries_.length}rotate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].rotate(t,e);this.changed()}scale(t,e,i){i||(i=nn(this.getExtent()));const s=this.geometries_;for(let n=0,r=s.length;n<r;++n)s[n].scale(t,e,i);this.changed()}setGeometries(t){this.setGeometriesArray(Nm(t))}setGeometriesArray(t){this.unlistenGeometriesChange_(),this.geometries_=t,this.listenGeometriesChange_(),this.changed()}applyTransform(t){const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)e[i].applyTransform(t);this.changed()}translate(t,e){const i=this.geometries_;for(let s=0,n=i.length;s<n;++s)i[s].translate(t,e);this.changed()}disposeInternal(){this.unlistenGeometriesChange_(),super.disposeInternal()}}function Nm(t){return t.map(t=>t.clone())}var Fm=km;class Dm extends Bo{constructor(t,e){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,void 0===e||Array.isArray(t[0])?this.setCoordinates(t,e):this.setFlatCoordinates(e,t)}appendCoordinate(t){yi(this.flatCoordinates,t),this.changed()}clone(){const t=new Dm(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Yo(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$o(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return ca(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,wm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return xm(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Mp(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){const e=[];return e.length=_a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Dm(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return ua(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,this.getExtent())}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var jm=Dm;class zm extends Bo{constructor(t,e,i){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(t[0]))this.setCoordinates(t,e);else if(void 0!==e&&i)this.setFlatCoordinates(e,t),this.ends_=i;else{const e=t,i=[],s=[];for(let t=0,r=e.length;t<r;++t){const n=e[t];yi(i,n.getFlatCoordinates()),s.push(i.length)}const n=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(n,i),this.ends_=s}}appendLineString(t){yi(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new zm(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ko(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Zo(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,t,e,i,s))}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,Em(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return na(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new jm(this.flatCoordinates.slice(0===t?0:this.ends_[t-1],this.ends_[t]),this.layout)}getLineStrings(){const t=this.flatCoordinates,e=this.ends_,i=this.layout,s=[];let n=0;for(let r=0,o=e.length;r<o;++r){const o=e[r],a=new jm(t.slice(n,o),i);s.push(a),n=o}return s}getLength(){const t=this.ends_;let e=0,i=0;for(let s=0,n=t.length;s<n;++s)i+=Mp(this.flatCoordinates,e,t[s],this.stride),e=t[s];return i}getFlatMidpoints(){const t=[],e=this.flatCoordinates;let i=0;const s=this.ends_,n=this.stride;for(let r=0,o=s.length;r<o;++r){const o=s[r],a=xm(e,i,o,n,.5);yi(t,a),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=ma(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new zm(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return da(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=ea(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}var Um=zm;class Bm extends Bo{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){yi(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Bm(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<Ds(this.getExtent(),t,e))return s;const n=this.flatCoordinates,r=this.stride;for(let o=0,a=n.length;o<a;o+=r){const a=ws(t,e,n[o],n[o+1]);if(a<s){s=a;for(let t=0;t<r;++t)i[t]=n[o+t];i.length=r}}return s}getCoordinates(){return sa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new Ca(this.flatCoordinates.slice(t*this.stride,(t+1)*this.stride),this.layout)}getPoints(){const t=this.flatCoordinates,e=this.layout,i=this.stride,s=[];for(let n=0,r=t.length;n<r;n+=i){const r=new Ca(t.slice(n,n+i),e);s.push(r)}return s}getType(){return"MultiPoint"}intersectsExtent(t){const e=this.flatCoordinates,i=this.stride;for(let s=0,n=e.length;s<n;s+=i){const i=e[s],n=e[s+1];if(Us(t,i,n))return!0}return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=ta(this.flatCoordinates,0,t,this.stride),this.changed()}}var Wm=Bm;class Xm extends Bo{constructor(t,e,i){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!i&&!Array.isArray(t[0])){const s=t,n=[],r=[];for(let t=0,e=s.length;t<e;++t){const e=s[t],i=n.length,o=e.getEnds();for(let t=0,s=o.length;t<s;++t)o[t]+=i;yi(n,e.getFlatCoordinates()),r.push(o)}e=0===s.length?this.getLayout():s[0].getLayout(),t=n,i=r}void 0!==e&&i?(this.setFlatCoordinates(e,t),this.endss_=i):this.setCoordinates(t,e)}appendPolygon(t){let e;if(this.flatCoordinates){const i=this.flatCoordinates.length;yi(this.flatCoordinates,t.getFlatCoordinates()),e=t.getEnds().slice();for(let t=0,s=e.length;t<s;++t)e[t]+=i}else this.flatCoordinates=t.getFlatCoordinates().slice(),e=t.getEnds().slice(),this.endss_.push();this.endss_.push(e),this.changed()}clone(){const t=this.endss_.length,e=new Array(t);for(let s=0;s<t;++s)e[s]=this.endss_[s].slice();const i=new Xm(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<Ds(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ho(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jo(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return la(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return Vo(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),Oa(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,ra(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=vm(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=Pa(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Wm(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;Aa(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=Oa(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=wa(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Xm(e,"XY",i)}getPolygon(t){if(t<0||this.endss_.length<=t)return null;let e;if(0===t)e=0;else{const i=this.endss_[t-1];e=i[i.length-1]}const i=this.endss_[t].slice(),s=i[i.length-1];if(0!==e)for(let n=0,r=i.length;n<r;++n)i[n]-=e;return new Na(this.flatCoordinates.slice(e,s),this.layout,i)}getPolygons(){const t=this.layout,e=this.flatCoordinates,i=this.endss_,s=[];let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r].slice(),a=o[o.length-1];if(0!==n)for(let t=0,e=o.length;t<e;++t)o[t]-=n;const h=new Na(e.slice(n,a),t,o);s.push(h),n=a}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return pa(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=ia(this.flatCoordinates,0,t,this.stride,this.endss_);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 Vm=Xm;class qm{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Gm,this.supportedMediaTypes=void 0}getReadOptions(t,e){if(e){let i=e.dataProjection?Kr(e.dataProjection):this.readProjection(t);if(e.extent&&i&&"tile-pixels"===i.getUnits()){const t=Kr(i);t&&(t.setWorldExtent(e.extent),i=t)}e={dataProjection:i??void 0,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return wi()}readFeature(t,e){return wi()}readFeatures(t,e){return wi()}readGeometry(t,e){return wi()}readProjection(t){return wi()}writeFeature(t,e){return wi()}writeFeatures(t,e){return wi()}writeGeometry(t,e){return wi()}}var Ym=qm;function Km(t,e,i){const s=i?Kr(i.featureProjection):null,n=i?Kr(i.dataProjection):null;let r=t;if(s&&n&&!so(s,n)){e&&(r=t.clone());const i=e?s:n,o=e?n:s;if("tile-pixels"===i.getUnits())r.transform(i,o);else{const t=oo(i,o);t&&r.applyTransform(t)}}if(e&&i&&void 0!==i.decimals){const e=Math.pow(10,i.decimals),s=function(t){for(let i=0,s=t.length;i<s;++i)t[i]=Math.round(t[i]*e)/e;return t};r===t&&(r=t.clone()),r.applyTransform(s)}return r}function Hm(t,e,i){if(Array.isArray(e[0])){const s=e;return Aa(t,0,s,i)||(t=t.slice(),Oa(t,0,s,i)),t}const s=e;return Ta(t,0,s,i)||(t=t.slice(),La(t,0,s,i)),t}function $m(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>$m({...t,geometry:e})).flat();const s="MultiPolygon"===i.type?"Polygon":i.type;if("GeometryCollection"===s||"Circle"===s)throw new Error("Unsupported geometry type: "+s);const n=(i.layout??"XY").length;return Km(new Cm(s,"Polygon"===s?Hm(i.flatCoordinates,i.ends,n):i.flatCoordinates,i.ends?.flat()??[],n,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Zm(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Zm(t,e));return new Fm(i)}const i=t.type,s=t.layout||"XY";let n;switch(i){case"Point":n=new Ca(t.flatCoordinates,s);break;case"LineString":n=new jm(t.flatCoordinates,s);break;case"Polygon":n=new Na(t.flatCoordinates,s,t.ends);break;case"MultiPoint":n=new Wm(t.flatCoordinates,s);break;case"MultiLineString":n=new Um(t.flatCoordinates,s,t.ends);break;case"MultiPolygon":n=new Vm(t.flatCoordinates,s,t.ends);break;default:throw new Error("Unsupported geometry type: "+i)}return Km(n,!1,e)}class Jm extends Ym{constructor(){super()}getType(){return"json"}readFeature(t,e){const i=Qm(t);return i?this.readFeatureFromObject(i,this.getReadOptions(t,e)):[]}readFeatures(t,e){const i=Qm(t);return i?this.readFeaturesFromObject(i,this.getReadOptions(t,e)):[]}readFeatureFromObject(t,e){return wi()}readFeaturesFromObject(t,e){return wi()}readGeometry(t,e){const i=Qm(t);if(!i)throw new Error("Expected a JSON object");return this.readGeometryFromObject(i,this.getReadOptions(t,e))}readGeometryFromObject(t,e){return wi()}readProjection(t){const e=Qm(t);if(!e)throw new Error("Expected a JSON object");return this.readProjectionFromObject(e)}readProjectionFromObject(t){return wi()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return wi()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return wi()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return wi()}}function Qm(t){if("string"===typeof t){const e=JSON.parse(t);return e||null}return null!==t?t:null}var ty=Jm;class ey extends ty{constructor(t){t=t||{},super(),this.dataProjection=Kr(t.dataProjection?t.dataProjection:"EPSG:4326")??void 0,t.featureProjection&&(this.defaultFeatureProjection=Kr(t.featureProjection)??void 0),t.featureClass&&(this.featureClass=t.featureClass),this.geometryName_=t.geometryName,this.extractGeometryName_=t.extractGeometryName,this.supportedMediaTypes=["application/geo+json","application/vnd.geo+json"]}readFeatureFromObject(t,e){const i=t;let s;s="Feature"===i["type"]?i:{type:"Feature",geometry:t,properties:null};const n=iy(s["geometry"],e);if(this.featureClass===Cm)return $m({geometry:n??void 0,id:s["id"],properties:s["properties"]??void 0},e);const r=this.featureClass,o=new r;return this.geometryName_?o.setGeometryName(this.geometryName_):this.extractGeometryName_&&"geometry_name"in s&&s["geometry_name"]&&o.setGeometryName(s["geometry_name"]),o.setGeometry(Zm(n,e)),"id"in s&&o.setId(s["id"]),s["properties"]&&o.setProperties(s["properties"],!0),o}readFeaturesFromObject(t,e){const i=t;let s=null;if("FeatureCollection"===i["type"]){const i=t;s=[];const n=i["features"];for(let t=0,r=n.length;t<r;++t){const i=this.readFeatureFromObject(n[t],e);i&&s.push(i)}}else s=[this.readFeatureFromObject(t,e)];return s.flat()}readGeometryFromObject(t,e){return sy(t,e)}readProjectionFromObject(t){const e=t,i=e["crs"];let s;if(i)if("name"==i["type"])s=Kr(i["properties"]["name"]);else{if("EPSG"!==i["type"])throw new Error("Unknown SRS type");s=Kr("EPSG:"+i["properties"]["code"])}else s=this.dataProjection;return s}writeFeatureObject(t,e){e=this.adaptOptions(e);const i={type:"Feature",geometry:null,properties:null},s=t.getId();if(void 0!==s&&(i.id=s),!t.hasProperties())return i;const n=t.getProperties(),r=t.getGeometry();return r&&(i.geometry=uy(r,e),delete n[t.getGeometryName()]),oi(n)||(i.properties=n),i}writeFeaturesObject(t,e){e=this.adaptOptions(e);const i=[];for(let s=0,n=t.length;s<n;++s)i.push(this.writeFeatureObject(t[s],e));return{type:"FeatureCollection",features:i}}writeGeometryObject(t,e){return uy(t,this.adaptOptions(e))}}function iy(t,e){if(!t||"GeometryCollection"!==t.type&&Array.isArray(t.coordinates)&&!t.coordinates.length)return null;let i;switch(t["type"]){case"Point":i=ry(t);break;case"LineString":i=oy(t);break;case"Polygon":i=cy(t);break;case"MultiPoint":i=hy(t);break;case"MultiLineString":i=ay(t);break;case"MultiPolygon":i=ly(t);break;case"GeometryCollection":i=ny(t);break;default:throw new Error("Unsupported GeoJSON type: "+t["type"])}return i}function sy(t,e){const i=iy(t,e);return i?Zm(i,e):null}function ny(t,e){const i=t["geometries"],s=[];for(const n of i){const t=iy(n,e);t&&s.push(t)}return s}function ry(t){const e=t["coordinates"];return{type:"Point",flatCoordinates:e,layout:jo(e.length)}}function oy(t){const e=t["coordinates"],i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:jo(e[0]?.length||2)}}function ay(t){const e=t["coordinates"],i=e[0]?.[0]?.length||2,s=[],n=ea(s,0,e,i);return{type:"MultiLineString",flatCoordinates:s,ends:n,layout:jo(i)}}function hy(t){const e=t["coordinates"];return{type:"MultiPoint",flatCoordinates:e.flat(),layout:jo(e[0]?.length||2)}}function ly(t){const e=t["coordinates"],i=[],s=e[0]?.[0]?.[0].length||2,n=ia(i,0,e,s);return{type:"MultiPolygon",flatCoordinates:i,ends:n,layout:jo(s)}}function cy(t){const e=t["coordinates"],i=[],s=e[0]?.[0]?.length,n=ea(i,0,e,s);return{type:"Polygon",flatCoordinates:i,ends:n,layout:jo(s)}}function uy(t,e){t=Km(t,!0,e);const i=t.getType();let s;switch(i){case"Point":s=my(t,e);break;case"LineString":s=gy(t,e);break;case"Polygon":s=yy(t,e);break;case"MultiPoint":s=py(t,e);break;case"MultiLineString":s=fy(t,e);break;case"MultiPolygon":s=_y(t,e);break;case"GeometryCollection":s=dy(t,e);break;case"Circle":s={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return s}function dy(t,e){e=Object.assign({},e),delete e.featureProjection;const i=t.getGeometriesArray().map(function(t){return uy(t,e)});return{type:"GeometryCollection",geometries:i}}function gy(t,e){return{type:"LineString",coordinates:t.getCoordinates()}}function fy(t,e){return{type:"MultiLineString",coordinates:t.getCoordinates()}}function py(t,e){return{type:"MultiPoint",coordinates:t.getCoordinates()}}function _y(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}function my(t,e){return{type:"Point",coordinates:t.getCoordinates()}}function yy(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}var vy=ey;const xy=["fullscreenchange","webkitfullscreenchange"],wy={ENTERFULLSCREEN:"enterfullscreen",LEAVEFULLSCREEN:"leavefullscreen"};class Ey extends Ch{constructor(t){t=t||{},super({element:document.createElement("div"),target:t.target}),this.on,this.once,this.un,this.keys_=void 0!==t.keys&&t.keys,this.source_=t.source,this.isInFullscreen_=!1,this.boundHandleMapTargetChange_=this.handleMapTargetChange_.bind(this),this.cssClassName_=void 0!==t.className?t.className:"ol-full-screen",this.documentListeners_=[],this.activeClassName_=void 0!==t.activeClassName?t.activeClassName.split(" "):[this.cssClassName_+"-true"],this.inactiveClassName_=void 0!==t.inactiveClassName?t.inactiveClassName.split(" "):[this.cssClassName_+"-false"];const e=void 0!==t.label?t.label:"⛶";this.labelNode_="string"===typeof e?document.createTextNode(e):e;const i=void 0!==t.labelActive?t.labelActive:"×";this.labelActiveNode_="string"===typeof i?document.createTextNode(i):i;const s=t.tipLabel?t.tipLabel:"Toggle full-screen";this.button_=document.createElement("button"),this.button_.title=s,this.button_.setAttribute("type","button"),this.button_.appendChild(this.labelNode_),this.button_.addEventListener(ci.CLICK,this.handleClick_.bind(this),!1),this.setClassName_(this.button_,this.isInFullscreen_);const n=this.element;n.className=`${this.cssClassName_} ${sh} ${rh}`,n.appendChild(this.button_)}handleClick_(t){t.preventDefault(),this.handleFullScreen_()}handleFullScreen_(){const t=this.getMap();if(!t)return;const e=t.getOwnerDocument();if(My(e))if(Sy(e))Py(e);else{let i;if(i=this.source_?"string"===typeof this.source_?e.getElementById(this.source_):this.source_:t.getTargetElement(),!i)return;this.keys_?by(i):Cy(i)}}handleFullScreenChange_(){const t=this.getMap();if(!t)return;const e=this.isInFullscreen_;this.isInFullscreen_=Sy(t.getOwnerDocument()),e!==this.isInFullscreen_&&(this.setClassName_(this.button_,this.isInFullscreen_),this.isInFullscreen_?(vh(this.labelActiveNode_,this.labelNode_),this.dispatchEvent(wy.ENTERFULLSCREEN)):(vh(this.labelNode_,this.labelActiveNode_),this.dispatchEvent(wy.LEAVEFULLSCREEN)),t.updateSize())}setClassName_(t,e){e?(t.classList.remove(...this.inactiveClassName_),t.classList.add(...this.activeClassName_)):(t.classList.remove(...this.activeClassName_),t.classList.add(...this.inactiveClassName_))}setMap(t){const e=this.getMap();e&&e.removeChangeListener(hs.TARGET,this.boundHandleMapTargetChange_),super.setMap(t),this.handleMapTargetChange_(),t&&t.addChangeListener(hs.TARGET,this.boundHandleMapTargetChange_)}handleMapTargetChange_(){const t=this.documentListeners_;for(let i=0,s=t.length;i<s;++i)li(t[i]);t.length=0;const e=this.getMap();if(e){const i=e.getOwnerDocument();My(i)?this.element.classList.remove(nh):this.element.classList.add(nh);for(let e=0,s=xy.length;e<s;++e)t.push(ai(i,xy[e],this.handleFullScreenChange_,this));this.handleFullScreenChange_()}}}function My(t){const e=t.body;return!!(e.webkitRequestFullscreen||"requestFullscreen"in e&&t.fullscreenEnabled)}function Sy(t){const e=t;return!(!e.webkitIsFullScreen&&!t.fullscreenElement)}function Cy(t){const e=t;t.requestFullscreen?t.requestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function by(t){const e=t;e.webkitRequestFullscreen?e.webkitRequestFullscreen():Cy(t)}function Py(t){const e=t;t.exitFullscreen?t.exitFullscreen():e.webkitExitFullscreen&&e.webkitExitFullscreen()}var Ry=Ey;const Iy="units",Ty=[1,2,5],Ay=25.4/.28;class Ly extends Ch{constructor(t){t=t||{};const e=document.createElement("div");e.style.pointerEvents="none",super({element:e,render:t.render,target:t.target}),this.on,this.once,this.un;const i=void 0!==t.className?t.className:t.bar?"ol-scale-bar":"ol-scale-line";this.innerElement_=document.createElement("div"),this.innerElement_.className=i+"-inner",this.element.className=i+" "+sh,this.element.appendChild(this.innerElement_),this.viewState_=null,this.minWidth_=void 0!==t.minWidth?t.minWidth:64,this.maxWidth_=t.maxWidth,this.renderedVisible_=!1,this.renderedWidth_=void 0,this.renderedHTML_="",this.addChangeListener(Iy,this.handleUnitsChanged_),this.setUnits(t.units||"metric"),this.scaleBar_=t.bar||!1,this.scaleBarSteps_=t.steps||4,this.scaleBarText_=t.text||!1,this.dpi_=t.dpi||void 0}getUnits(){return this.get(Iy)}handleUnitsChanged_(){this.updateElement_()}setUnits(t){this.set(Iy,t)}setDpi(t){this.dpi_=t}updateElement_(){const t=this.viewState_;if(!t){const t=this.element;return void(this.renderedVisible_&&t&&(t.style.display="none",this.renderedVisible_=!1))}const e=t.center,i=t.projection,s=this.getUnits(),n="degrees"==s?"degrees":"m";let r=Hr(i,t.resolution,e,n);const o=this.minWidth_*(this.dpi_||Ay)/Ay,a=void 0!==this.maxWidth_?this.maxWidth_*(this.dpi_||Ay)/Ay:void 0;let h=o*r,l="";if("degrees"==s){const t=Fn.degrees;h*=t,h<t/60?(l="″",r*=3600):h<t?(l="′",r*=60):l="°"}else if("imperial"==s)h<.9144?(l="in",r/=.0254):h<1609.344?(l="ft",r/=.3048):(l="mi",r/=1609.344);else if("nautical"==s)r/=1852,l="NM";else if("metric"==s)h<1e-6?(l="nm",r*=1e9):h<.001?(l="μm",r*=1e6):h<1?(l="mm",r*=1e3):h<1e3?l="m":(l="km",r/=1e3);else{if("us"!=s)throw new Error("Invalid units");h<.9144?(l="in",r*=39.37):h<1609.344?(l="ft",r/=.30480061):(l="mi",r/=1609.3472)}let c,u,d,g,f=3*Math.floor(Math.log(o*r)/Math.log(10)),p=0,_=0;while(1){p=Math.floor(f/3);const t=Math.pow(10,p);if(c=Ty[(f%3+3)%3]*t,u=Math.round(c/r),isNaN(u)){const t=this.element;return t&&(t.style.display="none"),void(this.renderedVisible_=!1)}if(void 0!==a&&u>=a){c=_,u=d,p=g;break}if(u>=o)break;_=c,d=u,g=p,++f}const m=this.scaleBar_?this.createScaleBar(u,c,l):c.toFixed(p<0?-p:0)+" "+l;if(this.renderedHTML_!=m&&(this.innerElement_.innerHTML=m,this.renderedHTML_=m),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),!this.renderedVisible_){const t=this.element;t&&(t.style.display=""),this.renderedVisible_=!0}}createScaleBar(t,e,i){const s=this.getScaleForResolution(),n=s<1?Math.round(1/s).toLocaleString()+" : 1":"1 : "+Math.round(s).toLocaleString(),r=this.scaleBarSteps_,o=t/r,a=[this.createMarker("absolute")];for(let l=0;l<r;++l){const s=l%2===0?"ol-scale-singlebar-odd":"ol-scale-singlebar-even";a.push(`<div><div class="ol-scale-singlebar ${s}" style="width: ${o}px;"></div>`+this.createMarker("relative")+(l%2===0||2===r?this.createStepText(l,t,!1,e,i):"")+"</div>")}a.push(this.createStepText(r,t,!0,e,i));const h=this.scaleBarText_?`<div class="ol-scale-text" style="width: ${t}px;">`+n+"</div>":"";return h+a.join("")}createMarker(t){const e="absolute"===t?3:-10;return`<div class="ol-scale-step-marker" style="position: ${t}; top: ${e}px;"></div>`}createStepText(t,e,i,s,n){const r=0===t?0:Math.round(s/this.scaleBarSteps_*t*100)/100,o=r+(0===t?"":" "+n),a=0===t?-3:e/this.scaleBarSteps_*-1,h=0===t?0:e/this.scaleBarSteps_*2;return`<div class="ol-scale-step-text" style="margin-left: ${a}px;text-align: ${0===t?"left":"center"};min-width: ${h}px;left: ${i?e+"px":"unset"};">`+o+"</div>"}getScaleForResolution(){const t=this.viewState_;if(!t)return 0;const e=Hr(t.projection,t.resolution,t.center,"m"),i=this.dpi_||Ay,s=1e3/25.4;return e*s*i}render(t){const e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()}}var Oy=Ly;const Gy="projection",ky="coordinateFormat";class Ny extends Ch{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(Gy,this.handleProjectionChanged_),t.coordinateFormat&&this.setCoordinateFormat(t.coordinateFormat),t.projection&&this.setProjection(t.projection),this.renderOnMouseOut_=void 0!==t.placeholder,this.placeholder_=this.renderOnMouseOut_?t.placeholder:" ",this.renderedHTML_=e.innerHTML,this.mapProjection_=null,this.transform_=null,this.wrapX_=!1!==t.wrapX}handleProjectionChanged_(){this.transform_=null}getCoordinateFormat(){return this.get(ky)}getProjection(){return this.get(Gy)}handleMouseMove(t){const e=this.getMap();e&&this.updateHTML_(e.getEventPixel(t))}handleMouseOut(t){this.updateHTML_(null)}setMap(t){if(super.setMap(t),t){const e=t.getViewport();if(!e)return;this.listenerKeys.push(ai(e,ns.POINTERMOVE,this.handleMouseMove,this)),this.renderOnMouseOut_&&this.listenerKeys.push(ai(e,ns.POINTEROUT,this.handleMouseOut,this)),this.updateHTML_(null)}}setCoordinateFormat(t){this.set(ky,t)}setProjection(t){this.set(Gy,Kr(t))}updateHTML_(t){let e=this.placeholder_;if(t&&this.mapProjection_){if(!this.transform_){const t=this.getProjection();this.transform_=t?no(this.mapProjection_,t):Vr}const i=this.getMap();if(!i)return;const s=i.getCoordinateFromPixelInternal(t);if(s){const t=co();t&&(this.transform_=no(this.mapProjection_,t));const i=this.transform_;if(i&&i(s,s),this.wrapX_){const e=t||this.getProjection()||this.mapProjection_;bn(s,e)}const n=this.getCoordinateFormat();e=n?n(s):s.toString()}}if(!this.renderedHTML_||e!==this.renderedHTML_){const t=this.element;t&&(t.innerHTML=e,this.renderedHTML_=e)}}render(t){const e=t.frameState;e?this.mapProjection_!=e.viewState.projection&&(this.mapProjection_=e.viewState.projection,this.transform_=null):this.mapProjection_=null}}var Fy=Ny;function Dy(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");for(var e=1;e<=60;++e)t("EPSG:"+(32600+e),"+proj=utm +zone="+e+" +datum=WGS84 +units=m"),t("EPSG:"+(32700+e),"+proj=utm +zone="+e+" +south +datum=WGS84 +units=m");t("EPSG:5041","+title=WGS 84 / UPS North (E,N) +proj=stere +lat_0=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t("EPSG:5042","+title=WGS 84 / UPS South (E,N) +proj=stere +lat_0=-90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m"),t.WGS84=t["EPSG:4326"],t["EPSG:3785"]=t["EPSG:3857"],t.GOOGLE=t["EPSG:3857"],t["EPSG:900913"]=t["EPSG:3857"],t["EPSG:102113"]=t["EPSG:3857"]}var jy=1,zy=2,Uy=3,By=4,Wy=5,Xy=6378137,Vy=6356752.314,qy=.0066943799901413165,Yy=484813681109536e-20,Ky=Math.PI/2,Hy=.16666666666666666,$y=.04722222222222222,Zy=.022156084656084655,Jy=1e-10,Qy=.017453292519943295,tv=57.29577951308232,ev=Math.PI/4,iv=2*Math.PI,sv=3.14159265359,nv={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667},rv=nv,ov={mm:{to_meter:.001},cm:{to_meter:.01},ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937},fath:{to_meter:1.8288},kmi:{to_meter:1852},"us-ch":{to_meter:20.1168402336805},"us-mi":{to_meter:1609.34721869444},km:{to_meter:1e3},"ind-ft":{to_meter:.30479841},"ind-yd":{to_meter:.91439523},mi:{to_meter:1609.344},yd:{to_meter:.9144},ch:{to_meter:20.1168},link:{to_meter:.201168},dm:{to_meter:.1},in:{to_meter:.0254},"ind-ch":{to_meter:20.11669506},"us-in":{to_meter:.025400050800101},"us-yd":{to_meter:.914401828803658}},av=/[\s_\-\/\(\)]/g;function hv(t,e){if(t[e])return t[e];var i,s,n=Object.keys(t),r=e.toLowerCase().replace(av,""),o=-1;while(++o<n.length)if(i=n[o],s=i.toLowerCase().replace(av,""),s===r)return t[i]}function lv(t){var e,i,s,n={},r=t.split("+").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t},{}),o={proj:function(t){n.projName=["lonlat","latlon","latlong"].includes(t)?"longlat":t},datum:"datumCode",rf:function(t){n.rf=parseFloat(t)},lat_0:function(t){n.lat0=t*Qy},lat_1:function(t){n.lat1=t*Qy},lat_2:function(t){n.lat2=t*Qy},lat_ts:function(t){n.lat_ts=t*Qy},lon_0:function(t){n.long0=t*Qy},lon_wrap:function(t){n.long_wrap=parseFloat(t)*Qy},lon_1:function(t){n.long1=t*Qy},lon_2:function(t){n.long2=t*Qy},alpha:function(t){n.alpha=parseFloat(t)*Qy},gamma:function(t){n.rectified_grid_angle=parseFloat(t)*Qy},lonc:function(t){n.longc=t*Qy},x_0:function(t){n.x0=parseFloat(t)},y_0:function(t){n.y0=parseFloat(t)},k_0:function(t){n.k0=parseFloat(t)},k:function(t){n.k0=parseFloat(t)},a:function(t){n.a=parseFloat(t)},b:function(t){n.b=parseFloat(t)},r:function(t){n.a=n.b=parseFloat(t)},r_a:function(){n.R_A=!0},zone:function(t){n.zone=parseInt(t,10)},south:function(){n.utmSouth=!0},towgs84:function(t){n.datum_params=t.split(",").map(function(t){return parseFloat(t)})},to_meter:function(t){n.to_meter=parseFloat(t)},units:function(t){n.units=t;var e=hv(ov,t);e&&(n.to_meter=e.to_meter)},from_greenwich:function(t){n.from_greenwich=t*Qy},pm:function(t){var e=hv(rv,t);n.from_greenwich=(e||parseFloat(t))*Qy},nadgrids:function(t){"@null"===t?n.datumCode="none":n.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(n.axis=t)},approx:function(){n.approx=!0},over:function(){n.over=!0}};for(e in r)i=r[e],e in o?(s=o[e],"function"===typeof s?s(i):n[s]=i):n[e]=i;return"string"===typeof n.datumCode&&"WGS84"!==n.datumCode&&(n.datumCode=n.datumCode.toLowerCase()),n["projStr"]=t,n}class cv{static getId(t){const e=t.find(t=>Array.isArray(t)&&"ID"===t[0]);return e&&e.length>=3?{authority:e[1],code:parseInt(e[2],10)}:null}static convertUnit(t,e="unit"){if(!t||t.length<3)return{type:e,name:"unknown",conversion_factor:null};const i=t[1],s=parseFloat(t[2])||null,n=t.find(t=>Array.isArray(t)&&"ID"===t[0]),r=n?{authority:n[1],code:parseInt(n[2],10)}:null;return{type:e,name:i,conversion_factor:s,id:r}}static convertAxis(t){const e=t[1]||"Unknown";let i;const s=e.match(/^\((.)\)$/);if(s){const e=s[1].toUpperCase();if("E"===e)i="east";else if("N"===e)i="north";else if("U"===e)i="up";else{if(!t[2])throw new Error(`Unknown axis abbreviation: ${e}`);i=t[2]}}else i=t[2]||"unknown";const n=t.find(t=>Array.isArray(t)&&"ORDER"===t[0]),r=n?parseInt(n[1],10):null,o=t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0])),a=this.convertUnit(o);return{name:e,direction:i,unit:a,order:r}}static extractAxes(t){return t.filter(t=>Array.isArray(t)&&"AXIS"===t[0]).map(t=>this.convertAxis(t)).sort((t,e)=>(t.order||0)-(e.order||0))}static convert(t,e={}){switch(t[0]){case"PROJCRS":e.type="ProjectedCRS",e.name=t[1],e.base_crs=t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"BASEGEOGCRS"===t[0])):null,e.conversion=t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"CONVERSION"===t[0])):null;const i=t.find(t=>Array.isArray(t)&&"CS"===t[0]);i&&(e.coordinate_system={subtype:i[1],axis:this.extractAxes(t)});const s=t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]);if(s){const t=this.convertUnit(s);e.coordinate_system.unit=t}e.id=this.getId(t);break;case"BASEGEOGCRS":case"GEOGCRS":case"GEODCRS":e.type="GEODCRS"===t[0]?"GeodeticCRS":"GeographicCRS",e.name=t[1];const n=t.find(t=>Array.isArray(t)&&("DATUM"===t[0]||"ENSEMBLE"===t[0]));if(n){const i=this.convert(n);"ENSEMBLE"===n[0]?e.datum_ensemble=i:e.datum=i;const s=t.find(t=>Array.isArray(t)&&"PRIMEM"===t[0]);s&&"Greenwich"!==s[1]&&(i.prime_meridian={name:s[1],longitude:parseFloat(s[2])})}const r=t.find(t=>Array.isArray(t)&&"CS"===t[0]);e.coordinate_system={subtype:r?r[1]:"ellipsoidal",axis:this.extractAxes(t)},e.id=this.getId(t);break;case"DATUM":e.type="GeodeticReferenceFrame",e.name=t[1],e.ellipsoid=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0])):null;break;case"ENSEMBLE":e.type="DatumEnsemble",e.name=t[1],e.members=t.filter(t=>Array.isArray(t)&&"MEMBER"===t[0]).map(t=>({type:"DatumEnsembleMember",name:t[1],id:this.getId(t)}));const o=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);o&&(e.accuracy=parseFloat(o[1]));const a=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);a&&(e.ellipsoid=this.convert(a)),e.id=this.getId(t);break;case"ELLIPSOID":e.type="Ellipsoid",e.name=t[1],e.semi_major_axis=parseFloat(t[2]),e.inverse_flattening=parseFloat(t[3]);t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0])&&this.convert(t.find(t=>Array.isArray(t)&&"LENGTHUNIT"===t[0]),e);break;case"CONVERSION":e.type="Conversion",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&"PARAMETER"===t[0]).map(t=>this.convert(t));break;case"METHOD":e.type="Method",e.name=t[1],e.id=this.getId(t);break;case"PARAMETER":e.type="Parameter",e.name=t[1],e.value=parseFloat(t[2]),e.unit=this.convertUnit(t.find(t=>Array.isArray(t)&&("LENGTHUNIT"===t[0]||"ANGLEUNIT"===t[0]||"SCALEUNIT"===t[0]))),e.id=this.getId(t);break;case"BOUNDCRS":e.type="BoundCRS";const h=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(h){const t=h.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(l){const t=l.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const c=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=c?this.convert(c):null;break;case"ABRIDGEDTRANSFORMATION":if(e.type="Transformation",e.name=t[1],e.method=t.find(t=>Array.isArray(t)&&"METHOD"===t[0])?this.convert(t.find(t=>Array.isArray(t)&&"METHOD"===t[0])):null,e.parameters=t.filter(t=>Array.isArray(t)&&("PARAMETER"===t[0]||"PARAMETERFILE"===t[0])).map(t=>"PARAMETER"===t[0]?this.convert(t):"PARAMETERFILE"===t[0]?{name:t[1],value:t[2],id:{authority:"EPSG",code:8656}}:void 0),7===e.parameters.length){const t=e.parameters[6];"Scale difference"===t.name&&(t.value=Math.round(1e12*(t.value-1))/1e6)}e.id=this.getId(t);break;case"AXIS":e.coordinate_system||(e.coordinate_system={type:"unspecified",axis:[]}),e.coordinate_system.axis.push(this.convertAxis(t));break;case"LENGTHUNIT":const u=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=u)}),u.conversion_factor&&1!==u.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:u});break;default:e.keyword=t[0];break}return e}}var uv=cv;function dv(t){return uv.convert(t)}function gv(t){const e=t.toUpperCase();return e.includes("PROJCRS")||e.includes("GEOGCRS")||e.includes("BOUNDCRS")||e.includes("VERTCRS")||e.includes("LENGTHUNIT")||e.includes("ANGLEUNIT")||e.includes("SCALEUNIT")?"WKT2":(e.includes("PROJCS")||e.includes("GEOGCS")||e.includes("LOCAL_CS")||e.includes("VERT_CS")||e.includes("UNIT"),"WKT1")}var fv=Pv,pv=1,_v=2,mv=3,yv=4,vv=5,xv=-1,wv=/\s/,Ev=/[A-Za-z]/,Mv=/[A-Za-z84_]/,Sv=/[,\]]/,Cv=/[\d\.E\-\+]/;function bv(t){if("string"!==typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=pv}function Pv(t){var e=new bv(t);return e.output()}function Rv(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,n=i.reduce(function(t,e){return Iv(e,t),t},s);e&&(t[e]=n)}function Iv(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void Iv(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return i in e||(e[i]=[]),void e[i].push(t);var s;switch(Array.isArray(i)||(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&Iv(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&Iv(t[3],e[i]));case"EDATUM":case"ENGINEERINGDATUM":case"LOCAL_DATUM":case"DATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":return t[0]=["name",t[0]],void Rv(e,i,t);case"COMPD_CS":case"COMPOUNDCRS":case"FITTED_CS":case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"ENGCRS":case"ENGINEERINGCRS":return t[0]=["name",t[0]],Rv(e,i,t),void(e[i].type=i);default:s=-1;while(++s<t.length)if(!Array.isArray(t[s]))return Iv(t,e[i]);return Rv(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}bv.prototype.readCharicter=function(){var t=this.text[this.place++];if(this.state!==yv)while(wv.test(t)){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case pv:return this.neutral(t);case _v:return this.keyword(t);case yv:return this.quoted(t);case vv:return this.afterquote(t);case mv:return this.number(t);case xv:return}},bv.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=yv);if(Sv.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},bv.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=pv)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=pv,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=xv))):void 0},bv.prototype.number=function(t){if(!Cv.test(t)){if(Sv.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},bv.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=vv},bv.prototype.keyword=function(t){if(Mv.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=pv)}if(!Sv.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},bv.prototype.neutral=function(t){if(Ev.test(t))return this.word=t,void(this.state=_v);if('"'===t)return this.word="",void(this.state=yv);if(Cv.test(t))return this.word=t,void(this.state=mv);if(!Sv.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},bv.prototype.output=function(){while(this.place<this.text.length)this.readCharicter();if(this.state===xv)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Tv=.017453292519943295;function Av(t){return t*Tv}function Lv(t){const e=(t.projName||"").toLowerCase().replace(/_/g," ");void 0===t.long0&&void 0!==t.longc&&(t.long0=t.longc),t.lat_ts||!t.lat1||"stereographic south pole"!==e&&"polar stereographic (variant b)"!==e?t.lat_ts||!t.lat0||"polar stereographic"!==e&&"polar stereographic (variant a)"!==e||(t.lat_ts=t.lat0,t.lat0=Av(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Av(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Ov(t){let e={units:null,to_meter:void 0};return"string"===typeof t?(e.units=t.toLowerCase(),"metre"===e.units&&(e.units="meter"),"meter"===e.units&&(e.to_meter=1)):t&&t.name&&(e.units=t.name.toLowerCase(),"metre"===e.units&&(e.units="meter"),e.to_meter=t.conversion_factor),e}function Gv(t){return"object"===typeof t?t.value*t.unit.conversion_factor:t}function kv(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=Gv(t.ellipsoid.semi_major_axis),void 0!==t.ellipsoid.inverse_flattening?e.rf=t.ellipsoid.inverse_flattening:void 0!==t.ellipsoid.semi_major_axis&&void 0!==t.ellipsoid.semi_minor_axis&&(e.rf=e.a/(e.a-Gv(t.ellipsoid.semi_minor_axis))))}function Nv(t,e={}){return t&&"object"===typeof t?"BoundCRS"===t.type?(Nv(t.source_crs,e),t.transformation&&(t.transformation.method&&"NTv2"===t.transformation.method.name?e.nadgrids=t.transformation.parameters[0].value:e.datum_params=t.transformation.parameters.map(t=>t.value)),e):(Object.keys(t).forEach(i=>{const s=t[i];if(null!==s)switch(i){case"name":if(e.srsCode)break;e.name=s,e.srsCode=s;break;case"type":"GeographicCRS"===s?e.projName="longlat":"GeodeticCRS"===s?t.coordinate_system&&"Cartesian"===t.coordinate_system.subtype?e.projName="geocent":e.projName="longlat":"ProjectedCRS"===s&&t.conversion&&t.conversion.method&&(e.projName=t.conversion.method.name);break;case"datum":case"datum_ensemble":s.ellipsoid&&(e.ellps=s.ellipsoid.name,kv(s,e)),s.prime_meridian&&(e.from_greenwich=s.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=s.name,kv(s,e);break;case"prime_meridian":e.long0=(s.longitude||0)*Math.PI/180;break;case"coordinate_system":if(s.axis){const t={east:"e",north:"n",west:"w",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"},i=s.axis.map(e=>t[e.direction.toLowerCase()]);if(i.every(Boolean)&&(e.axis=i.join(""),2===e.axis.length&&(e.axis+="u")),s.unit){const{units:t,to_meter:i}=Ov(s.unit);e.units=t,e.to_meter=i}else if(s.axis[0]&&s.axis[0].unit){const{units:t,to_meter:i}=Ov(s.axis[0].unit);e.units=t,e.to_meter=i}}break;case"id":s.authority&&s.code&&(e.title=s.authority+":"+s.code);break;case"conversion":s.method&&s.method.name&&(e.projName=s.method.name),s.parameters&&s.parameters.forEach(t=>{const i=t.name.toLowerCase().replace(/\s+/g,"_"),s=t.value;t.unit&&t.unit.conversion_factor?e[i]=s*t.unit.conversion_factor:"degree"===t.unit?e[i]=s*Math.PI/180:e[i]=s});break;case"unit":s.name&&(e.units=s.name.toLowerCase(),"metre"===e.units&&(e.units="meter")),s.conversion_factor&&(e.to_meter=s.conversion_factor);break;case"base_crs":Nv(s,e),e.datumCode=s.id?s.id.authority+"_"+s.id.code:s.name;break;default:break}}),e.datumCode||"GeographicCRS"!==t.type&&"GeodeticCRS"!==t.type||!t.id||(e.datumCode=t.id.authority+"_"+t.id.code),void 0!==e.latitude_of_false_origin&&(e.lat0=e.latitude_of_false_origin),void 0!==e.longitude_of_false_origin&&(e.long0=e.longitude_of_false_origin),void 0!==e.latitude_of_standard_parallel&&(e.lat0=e.latitude_of_standard_parallel,e.lat1=e.latitude_of_standard_parallel),void 0!==e.latitude_of_1st_standard_parallel&&(e.lat1=e.latitude_of_1st_standard_parallel),void 0!==e.latitude_of_2nd_standard_parallel&&(e.lat2=e.latitude_of_2nd_standard_parallel),void 0!==e.latitude_of_projection_centre&&(e.lat0=e.latitude_of_projection_centre),void 0!==e.longitude_of_projection_centre&&(e.longc=e.longitude_of_projection_centre),void 0!==e.easting_at_false_origin&&(e.x0=e.easting_at_false_origin),void 0!==e.northing_at_false_origin&&(e.y0=e.northing_at_false_origin),void 0!==e.latitude_of_natural_origin&&(e.lat0=e.latitude_of_natural_origin),void 0!==e.longitude_of_natural_origin&&(e.long0=e.longitude_of_natural_origin),void 0!==e.longitude_of_origin&&(e.long0=e.longitude_of_origin),void 0!==e.false_easting&&(e.x0=e.false_easting),e.easting_at_projection_centre&&(e.x0=e.easting_at_projection_centre),void 0!==e.false_northing&&(e.y0=e.false_northing),e.northing_at_projection_centre&&(e.y0=e.northing_at_projection_centre),void 0!==e.standard_parallel_1&&(e.lat1=e.standard_parallel_1),void 0!==e.standard_parallel_2&&(e.lat2=e.standard_parallel_2),void 0!==e.scale_factor_at_natural_origin&&(e.k0=e.scale_factor_at_natural_origin),void 0!==e.scale_factor_at_projection_centre&&(e.k0=e.scale_factor_at_projection_centre),void 0!==e.scale_factor_on_pseudo_standard_parallel&&(e.k0=e.scale_factor_on_pseudo_standard_parallel),void 0!==e.azimuth&&(e.alpha=e.azimuth),void 0!==e.azimuth_at_projection_centre&&(e.alpha=e.azimuth_at_projection_centre),e.angle_from_rectified_to_skew_grid&&(e.rectified_grid_angle=e.angle_from_rectified_to_skew_grid),Lv(e),e):t}var Fv=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Dv(t,e){var i=e[0],s=e[1];!(i in t)&&s in t&&(t[i]=t[s],3===e.length&&(t[i]=e[2](t[i])))}function jv(t){for(var e=Object.keys(t),i=0,s=e.length;i<s;++i){var n=e[i];-1!==Fv.indexOf(n)&&zv(t[n]),"object"===typeof t[n]&&jv(t[n])}}function zv(t){if(t.AUTHORITY){var e=Object.keys(t.AUTHORITY)[0];e&&e in t.AUTHORITY&&(t.title=e+":"+t.AUTHORITY[e])}if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"===typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var i="",s=0,n=t.AXIS.length;s<n;++s){var r=[t.AXIS[s][0].toLowerCase(),t.AXIS[s][1].toLowerCase()];-1!==r[0].indexOf("north")||("y"===r[0]||"lat"===r[0])&&"north"===r[1]?i+="n":-1!==r[0].indexOf("south")||("y"===r[0]||"lat"===r[0])&&"south"===r[1]?i+="s":-1!==r[0].indexOf("east")||("x"===r[0]||"lon"===r[0])&&"east"===r[1]?i+="e":-1===r[0].indexOf("west")&&("x"!==r[0]&&"lon"!==r[0]||"west"!==r[1])||(i+="w")}2===i.length&&(i+="u"),3===i.length&&(t.axis=i)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var o=t.GEOGCS;function a(e){var i=t.to_meter||1;return e*i}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Av(o.PRIMEM.convert)),o.DATUM?t.datumCode=o.DATUM.name.toLowerCase():t.datumCode=o.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),"new_zealand_1949"===t.datumCode&&(t.datumCode="nzgd49"),"wgs_1984"!==t.datumCode&&"world_geodetic_system_1984"!==t.datumCode||("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"belge_1972"===t.datumCode&&(t.datumCode="rnb72"),o.DATUM&&o.DATUM.SPHEROID&&(t.ellps=o.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=o.DATUM.SPHEROID.a,t.rf=parseFloat(o.DATUM.SPHEROID.rf)),o.DATUM&&o.DATUM.TOWGS84&&(t.datum_params=o.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),t.rectified_grid_angle&&(t.rectified_grid_angle=Av(t.rectified_grid_angle));var h=function(e){return Dv(t,e)},l=[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Av],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Av],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Av],["lat0","latitude_of_origin",Av],["lat0","standard_parallel_1",Av],["lat1","standard_parallel_1",Av],["lat2","standard_parallel_2",Av],["azimuth","Azimuth"],["alpha","azimuth",Av],["srsCode","name"]];l.forEach(h),Lv(t)}function Uv(t){if("object"===typeof t)return Nv(t);const e=gv(t);var i=fv(t);if("WKT2"===e){const t=dv(i);return Nv(t)}var s=i[0],n={};return Iv(i,n),jv(n),n[s]}function Bv(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"===typeof i?"+"===i.charAt(0)?Bv[t]=lv(arguments[1]):Bv[t]=Uv(arguments[1]):i&&"object"===typeof i&&!("projName"in i)?Bv[t]=Uv(arguments[1]):(Bv[t]=i,i||delete Bv[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?Bv.apply(e,t):Bv(t)});if("string"===typeof t){if(t in Bv)return Bv[t]}else"EPSG"in t?Bv["EPSG:"+t.EPSG]=t:"ESRI"in t?Bv["ESRI:"+t.ESRI]=t:"IAU2000"in t?Bv["IAU2000:"+t.IAU2000]=t:console.log(t);return}}Dy(Bv);var Wv=Bv;function Xv(t){return"string"===typeof t}function Vv(t){return t in Wv}function qv(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"===typeof t&&!("srsCode"in t)}var Yv=["3857","900913","3785","102113"];function Kv(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Yv.indexOf(t.title.substr(5))>-1;var e=hv(t,"authority");if(e){var i=hv(e,"epsg");return i&&Yv.indexOf(i)>-1}}function Hv(t){var e=hv(t,"extension");if(e)return hv(e,"proj4")}function $v(t){return"+"===t[0]}function Zv(t){let e;if(Xv(t))if(Vv(t))e=Wv[t];else if(qv(t)){e=Uv(t);var i=Hv(e);i&&(e=lv(i))}else $v(t)&&(e=lv(t));else e="projName"in t?t:Uv(t);return e&&Kv(e)?Wv["EPSG:3857"]:e}var Jv=Zv;function Qv(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)i=e[s],void 0!==i&&(t[s]=i);return t}function tx(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function ex(t){return t<0?-1:1}function ix(t,e){return e||Math.abs(t)<=sv?t:t-ex(t)*iv}function sx(t,e,i){var s=t*i,n=.5*t;return s=Math.pow((1-s)/(1+s),n),Math.tan(.5*(Ky-e))/s}function nx(t,e){for(var i,s,n=.5*t,r=Ky-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(r),s=Ky-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-r,r+=s,Math.abs(s)<=1e-10)return r;return-9999}function rx(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.long0=this.long0||0,this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)}function ox(t){var e,i,s=t.x,n=t.y;if(n*tv>90&&n*tv<-90&&s*tv>180&&s*tv<-180)return null;if(Math.abs(Math.abs(n)-Ky)<=Jy)return null;if(this.sphere)e=this.x0+this.a*this.k0*ix(s-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(ev+.5*n));else{var r=Math.sin(n),o=sx(this.e,n,r);e=this.x0+this.a*this.k0*ix(s-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t}function ax(t){var e,i,s=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=Ky-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var r=Math.exp(-n/(this.a*this.k0));if(i=nx(this.e,r),-9999===i)return null}return e=ix(this.long0+s/(this.a*this.k0),this.over),t.x=e,t.y=i,t}var hx=["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"],lx={init:rx,forward:ox,inverse:ax,names:hx};function cx(){}function ux(t){return t}var dx=["longlat","identity","lonlat","latlon","latlong"],gx={init:cx,forward:ux,inverse:ux,names:dx},fx=[lx,gx],px={},_x=[];function mx(t,e){var i=_x.length;return t.names?(_x[i]=t,t.names.forEach(function(t){px[t.toLowerCase()]=i}),this):(console.log(e),!0)}function yx(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}function vx(t){if(!t)return!1;var e=t.toLowerCase();return"undefined"!==typeof px[e]&&_x[px[e]]?_x[px[e]]:(e=yx(e),e in px&&_x[px[e]]?_x[px[e]]:void 0)}function xx(){fx.forEach(mx)}var wx={start:xx,add:mx,get:vx},Ex={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Mx=Ex;const Sx=Mx.WGS84;function Cx(t,e,i,s){var n=t*t,r=e*e,o=(n-r)/n,a=0;s?(t*=1-o*(Hy+o*($y+o*Zy)),n=t*t,o=0):a=Math.sqrt(o);var h=(n-r)/r;return{es:o,e:a,ep2:h}}function bx(t,e,i,s,n){if(!t){var r=hv(Mx,s);r||(r=Sx),t=r.a,e=r.b,i=r.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<Jy)&&(n=!0,e=t),{a:t,b:e,rf:i,sphere:n}}var Px={wgs84:{towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad83:{towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(var Rx in Px){var Ix=Px[Rx];Ix.datumName&&(Px[Ix.datumName]=Ix)}var Tx=Px;function Ax(t,e,i,s,n,r,o){var a={};return a.datum_type=Wy,e&&(a.datum_type=By,a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=jy),a.datum_params.length>3&&(0===a.datum_params[3]&&0===a.datum_params[4]&&0===a.datum_params[5]&&0===a.datum_params[6]||(a.datum_type=zy,a.datum_params[3]*=Yy,a.datum_params[4]*=Yy,a.datum_params[5]*=Yy,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=Uy,a.grids=o),a.a=i,a.b=s,a.es=n,a.ep2=r,a}var Lx=Ax,Ox={};function Gx(t,e,i){return e instanceof ArrayBuffer?kx(t,e,i):{ready:Nx(t,e)}}function kx(t,e,i){var s=!0;void 0!==i&&!1===i.includeErrorFields&&(s=!1);var n=new DataView(e),r=Ux(n),o=Bx(n,r),a=Xx(n,o,r,s),h={header:o,subgrids:a};return Ox[t]=h,h}async function Nx(t,e){for(var i=[],s=await e.getImageCount(),n=s-1;n>=0;n--){var r=await e.getImage(n),o=await r.readRasters(),a=o,h=[r.getWidth(),r.getHeight()],l=r.getBoundingBox().map(jx),c="function"===typeof r.fileDirectory.getValue?r.fileDirectory.getValue("ModelPixelScale"):r.fileDirectory.ModelPixelScale,u=[c[0],c[1]].map(jx),d=l[0]+(h[0]-1)*u[0],g=l[3]-(h[1]-1)*u[1],f=a[0],p=a[1],_=[];for(let t=h[1]-1;t>=0;t--)for(let e=h[0]-1;e>=0;e--){var m=t*h[0]+e;_.push([-zx(p[m]),zx(f[m])])}i.push({del:u,lim:h,ll:[-d,g],cvs:_})}var y={header:{nSubgrids:s},subgrids:i};return Ox[t]=y,y}function Fx(t){if(void 0===t)return null;var e=t.split(",");return e.map(Dx)}function Dx(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:Ox[t]||null,isNull:!1}}function jx(t){return t*Math.PI/180}function zx(t){return t/3600*Math.PI/180}function Ux(t){var e=t.getInt32(8,!1);return 11!==e&&(e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}function Bx(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:Wx(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}function Wx(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function Xx(t,e,i,s){for(var n=176,r=[],o=0;o<e.nSubgrids;o++){var a=qx(t,n,i),h=Yx(t,n,a,i,s),l=Math.round(1+(a.upperLongitude-a.lowerLongitude)/a.longitudeInterval),c=Math.round(1+(a.upperLatitude-a.lowerLatitude)/a.latitudeInterval);r.push({ll:[zx(a.lowerLongitude),zx(a.lowerLatitude)],del:[zx(a.longitudeInterval),zx(a.latitudeInterval)],lim:[l,c],count:a.gridNodeCount,cvs:Vx(h)});var u=16;!1===s&&(u=8),n+=176+a.gridNodeCount*u}return r}function Vx(t){return t.map(function(t){return[zx(t.longitudeShift),zx(t.latitudeShift)]})}function qx(t,e,i){return{name:Wx(t,e+8,e+16).trim(),parent:Wx(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function Yx(t,e,i,s,n){var r=e+176,o=16;!1===n&&(o=8);for(var a=[],h=0;h<i.gridNodeCount;h++){var l={latitudeShift:t.getFloat32(r+h*o,s),longitudeShift:t.getFloat32(r+h*o+4,s)};!1!==n&&(l.latitudeAccuracy=t.getFloat32(r+h*o+8,s),l.longitudeAccuracy=t.getFloat32(r+h*o+12,s)),a.push(l)}return a}function Kx(t,e){if(!(this instanceof Kx))return new Kx(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.axis,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=Jv(t);if("object"===typeof i){var s=Kx.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var n=hv(Tx,i.datumCode);n&&(i.datum_params=i.datum_params||(n.towgs84?n.towgs84.split(","):null),i.ellps=n.ellipse,i.datumName=n.datumName?n.datumName:i.datumCode)}i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r=bx(i.a,i.b,i.rf,i.ellps,i.sphere),o=Cx(r.a,r.b,r.rf,i.R_A),a=Fx(i.nadgrids),h=i.datum||Lx(i.datumCode,i.datum_params,r.a,r.b,o.es,o.ep2,a);Qv(this,i),Qv(this,s),this.a=r.a,this.b=r.b,this.rf=r.rf,this.sphere=r.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=h,"init"in this&&"function"===typeof this.init&&this.init(),this.k0||(this.k0=1),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}Kx.projections=wx,Kx.projections.start();var Hx=Kx;function $x(t,e){return t.datum_type===e.datum_type&&(!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(t.datum_type===jy?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:t.datum_type!==zy||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6]))}function Zx(t,e,i){var s,n,r,o,a=t.x,h=t.y,l=t.z?t.z:0;if(h<-Ky&&h>-1.001*Ky)h=-Ky;else if(h>Ky&&h<1.001*Ky)h=Ky;else{if(h<-Ky)return{x:-1/0,y:-1/0,z:t.z};if(h>Ky)return{x:1/0,y:1/0,z:t.z}}return a>Math.PI&&(a-=2*Math.PI),n=Math.sin(h),o=Math.cos(h),r=n*n,s=i/Math.sqrt(1-e*r),{x:(s+l)*o*Math.cos(a),y:(s+l)*o*Math.sin(a),z:(s*(1-e)+l)*n}}function Jx(t,e,i,s){var n,r,o,a,h,l,c,u,d,g,f,p,_,m,y,v,x=1e-12,w=x*x,E=30,M=t.x,S=t.y,C=t.z?t.z:0;if(n=Math.sqrt(M*M+S*S),r=Math.sqrt(M*M+S*S+C*C),n/i<x){if(m=0,r/i<x)return y=Ky,v=-s,{x:t.x,y:t.y,z:t.z}}else m=Math.atan2(S,M);o=C/r,a=n/r,h=1/Math.sqrt(1-e*(2-e)*a*a),u=a*(1-e)*h,d=o*h,_=0;do{_++,c=i/Math.sqrt(1-e*d*d),v=n*u+C*d-c*(1-e*d*d),l=e*c/(c+v),h=1/Math.sqrt(1-l*(2-l)*a*a),g=a*(1-l)*h,f=o*h,p=f*u-g*d,u=g,d=f}while(p*p>w&&_<E);return y=Math.atan(f/Math.abs(g)),{x:m,y:y,z:v}}function Qx(t,e,i){if(e===jy)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(e===zy){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6];return{x:l*(t.x-h*t.y+a*t.z)+s,y:l*(h*t.x+t.y-o*t.z)+n,z:l*(-a*t.x+o*t.y+t.z)+r}}}function tw(t,e,i){if(e===jy)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(e===zy){var s=i[0],n=i[1],r=i[2],o=i[3],a=i[4],h=i[5],l=i[6],c=(t.x-s)/l,u=(t.y-n)/l,d=(t.z-r)/l;return{x:c+h*u-a*d,y:-h*c+u+o*d,z:a*c-o*u+d}}}function ew(t){return t===jy||t===zy}function iw(t,e,i){if($x(t,e))return i;if(t.datum_type===Wy||e.datum_type===Wy)return i;var s=t.a,n=t.es;if(t.datum_type===Uy){var r=sw(t,!1,i);if(0!==r)return;s=Xy,n=qy}var o=e.a,a=e.b,h=e.es;if(e.datum_type===Uy&&(o=Xy,a=Vy,h=qy),n===h&&s===o&&!ew(t.datum_type)&&!ew(e.datum_type))return i;if(i=Zx(i,n,s),ew(t.datum_type)&&(i=Qx(i,t.datum_type,t.datum_params)),ew(e.datum_type)&&(i=tw(i,e.datum_type,e.datum_params)),i=Jx(i,h,o,a),e.datum_type===Uy){var l=sw(e,!0,i);if(0!==l)return}return i}function sw(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var s={x:-i.x,y:i.y},n={x:Number.NaN,y:Number.NaN},r=[];t:for(var o=0;o<t.grids.length;o++){var a=t.grids[o];if(r.push(a.name),a.isNull){n=s;break}if(null!==a.grid)for(var h=a.grid.subgrids,l=0,c=h.length;l<c;l++){var u=h[l],d=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,g=u.ll[0]-d,f=u.ll[1]-d,p=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,_=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(f>s.y||g>s.x||_<s.y||p<s.x)&&(n=nw(s,e,u),!isNaN(n.x)))break t}else if(a.mandatory)return console.log("Unable to find mandatory grid '"+a.name+"'"),-1}return isNaN(n.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*tv+" "+s.y*tv+" tried: '"+r+"'"),-1):(i.x=-n.x,i.y=n.y,0)}function nw(t,e,i){var s={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return s;var n={x:t.x,y:t.y};n.x-=i.ll[0],n.y-=i.ll[1],n.x=ix(n.x-Math.PI)+Math.PI;var r=rw(n,i);if(e){if(isNaN(r.x))return s;r.x=n.x-r.x,r.y=n.y-r.y;var o,a,h=9,l=1e-12;do{if(a=rw(r,i),isNaN(a.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge. Using first approximation.");break}o={x:n.x-(a.x+r.x),y:n.y-(a.y+r.y)},r.x+=o.x,r.y+=o.y}while(h--&&Math.abs(o.x)>l&&Math.abs(o.y)>l);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=ix(r.x+i.ll[0]),s.y=r.y+i.ll[1]}else isNaN(r.x)||(s.x=t.x+r.x,s.y=t.y+r.y);return s}function rw(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},n={x:Math.floor(s.x),y:Math.floor(s.y)},r={x:s.x-1*n.x,y:s.y-1*n.y},o={x:Number.NaN,y:Number.NaN};if(n.x<0||n.x>=e.lim[0])return o;if(n.y<0||n.y>=e.lim[1])return o;i=n.y*e.lim[0]+n.x;var a={x:e.cvs[i][0],y:e.cvs[i][1]};i++;var h={x:e.cvs[i][0],y:e.cvs[i][1]};i+=e.lim[0];var l={x:e.cvs[i][0],y:e.cvs[i][1]};i--;var c={x:e.cvs[i][0],y:e.cvs[i][1]},u=r.x*r.y,d=r.x*(1-r.y),g=(1-r.x)*(1-r.y),f=(1-r.x)*r.y;return o.x=g*a.x+d*h.x+f*c.x+u*l.x,o.y=g*a.y+d*h.y+f*c.y+u*l.y,o}var ow=["x","y","z"];function aw(t,e){const i={};for(let s=0,n=t.axis.length;s<n;s++){if(2===s&&void 0===e.z)continue;let n=e[ow[s]];switch(t.axis[s]){case"e":i.x=n;break;case"w":i.x=-n;break;case"n":i.y=n;break;case"s":i.y=-n;break;case"u":i.z=n;break;case"d":i.z=-n;break;default:return null}}return i}function hw(t,e){const i={};for(let s=0,n=t.axis.length;s<n;s++)if(2!==s||void 0!==e.z)switch(t.axis[s]){case"e":i[ow[s]]=e.x;break;case"w":i[ow[s]]=-e.x;break;case"n":i[ow[s]]=e.y;break;case"s":i[ow[s]]=-e.y;break;case"u":i[ow[s]]=e.z;break;case"d":i[ow[s]]=-e.z;break;default:return null}return i}function lw(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function cw(t){uw(t.x),uw(t.y)}function uw(t){if("function"===typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!==typeof t||t!==t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function dw(t,e){return(t.datum.datum_type===jy||t.datum.datum_type===zy||t.datum.datum_type===Uy)&&"WGS84"!==e.datumCode||(e.datum.datum_type===jy||e.datum.datum_type===zy||e.datum.datum_type===Uy)&&"WGS84"!==t.datumCode}function gw(t,e,i,s){var n,r=void 0!==i.z;if(cw(i),t.datum&&e.datum&&dw(t,e)&&(n=new Hx("WGS84"),i=gw(t,n,i,s),t=n),s&&"enu"!==t.axis&&(i=aw(t,i)),"longlat"===t.projName)i={x:i.x*Qy,y:i.y*Qy,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),i=t.inverse(i),!i)return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=iw(t.datum,e.datum,i),i)return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?(void 0!==e.long_wrap&&(i.x=e.long_wrap+ix(i.x-e.long_wrap)),i={x:i.x*tv,y:i.y*tv,z:i.z||0}):(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),s&&"enu"!==e.axis?hw(e,i):(i&&!r&&"geocent"!==e.projName&&delete i.z,i)}function fw(t,e,i,s){var n;return n=Array.isArray(i)?lw(i):{x:i.x,y:i.y,z:i.z,m:i.m},gw(t,e,n,s)}var pw=Hx("WGS84");function _w(t,e,i,s){var n,r,o;return Array.isArray(i)?(n=gw(t,e,lw(i),s)||{x:NaN,y:NaN},i.length>2?(r="undefined"!==typeof t.name&&"geocent"===t.name||"undefined"!==typeof e.name&&"geocent"===e.name,r?"number"===typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y,i[2]].concat(i.slice(3)):s&&"number"===typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y].concat(i.slice(2))):[n.x,n.y]):(n=gw(t,e,{x:i.x,y:i.y,z:i.z,m:i.m},s)||{x:NaN,y:NaN},o=Object.keys(i),2===o.length||(r="undefined"!==typeof t.name&&"geocent"===t.name||"undefined"!==typeof e.name&&"geocent"===e.name,o.forEach(function(t){"x"!==t&&"y"!==t&&("z"===t&&(r||s)||(n[t]=i[t]))})),n)}function mw(t){return t instanceof Hx?t:"object"===typeof t&&"oProj"in t?t.oProj:Hx(t)}function yw(t,e,i){var s,n,r,o=!1;return"undefined"===typeof e?(n=mw(t),s=pw,o=!0):("undefined"!==typeof e.x||Array.isArray(e))&&(i=e,n=mw(t),s=pw,o=!0),s||(s=mw(t)),n||(n=mw(e)),i?_w(s,n,i):(r={forward:function(t,e){return _w(s,n,t,e)},inverse:function(t,e){return _w(n,s,t,e)}},o&&(r.oProj=n),r)}var vw=yw,xw=6,ww="AJSAJS",Ew="AFAFAF",Mw=65,Sw=73,Cw=79,bw=86,Pw=90,Rw={forward:Iw,inverse:Tw,toPoint:Aw};function Iw(t,e){return e=e||5,Fw(Gw({lat:t[1],lon:t[0]}),e)}function Tw(t){var e=kw(Uw(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]}function Aw(t){var e=kw(Uw(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Lw(t){return t*(Math.PI/180)}function Ow(t){return t/Math.PI*180}function Gw(t){var e,i,s,n,r,o,a,h,l,c=t.lat,u=t.lon,d=6378137,g=.00669438,f=.9996,p=Lw(c),_=Lw(u);l=Math.floor((u+180)/6)+1,180===u&&(l=60),c>=56&&c<64&&u>=3&&u<12&&(l=32),c>=72&&c<84&&(u>=0&&u<9?l=31:u>=9&&u<21?l=33:u>=21&&u<33?l=35:u>=33&&u<42&&(l=37)),e=6*(l-1)-180+3,h=Lw(e),i=g/(1-g),s=d/Math.sqrt(1-g*Math.sin(p)*Math.sin(p)),n=Math.tan(p)*Math.tan(p),r=i*Math.cos(p)*Math.cos(p),o=Math.cos(p)*(_-h),a=d*((1-g/4-3*g*g/64-5*g*g*g/256)*p-(3*g/8+3*g*g/32+45*g*g*g/1024)*Math.sin(2*p)+(15*g*g/256+45*g*g*g/1024)*Math.sin(4*p)-35*g*g*g/3072*Math.sin(6*p));var m=f*s*(o+(1-n+r)*o*o*o/6+(5-18*n+n*n+72*r-58*i)*o*o*o*o*o/120)+5e5,y=f*(a+s*Math.tan(p)*(o*o/2+(5-n+9*r+4*r*r)*o*o*o*o/24+(61-58*n+n*n+600*r-330*i)*o*o*o*o*o*o/720));return c<0&&(y+=1e7),{northing:Math.round(y),easting:Math.round(m),zoneNumber:l,zoneLetter:Nw(c)}}function kw(t){var e=t.northing,i=t.easting,s=t.zoneLetter,n=t.zoneNumber;if(n<0||n>60)return null;var r,o,a,h,l,c,u,d,g,f,p=.9996,_=6378137,m=.00669438,y=(1-Math.sqrt(1-m))/(1+Math.sqrt(1-m)),v=i-5e5,x=e;s<"N"&&(x-=1e7),d=6*(n-1)-180+3,r=m/(1-m),u=x/p,g=u/(_*(1-m/4-3*m*m/64-5*m*m*m/256)),f=g+(3*y/2-27*y*y*y/32)*Math.sin(2*g)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*g)+151*y*y*y/96*Math.sin(6*g),o=_/Math.sqrt(1-m*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),h=r*Math.cos(f)*Math.cos(f),l=_*(1-m)/Math.pow(1-m*Math.sin(f)*Math.sin(f),1.5),c=v/(o*p);var w=f-o*Math.tan(f)/l*(c*c/2-(5+3*a+10*h-4*h*h-9*r)*c*c*c*c/24+(61+90*a+298*h+45*a*a-252*r-3*h*h)*c*c*c*c*c*c/720);w=Ow(w);var E,M=(c-(1+2*a+h)*c*c*c/6+(5-2*h+28*a-3*h*h+8*r+24*a*a)*c*c*c*c*c/120)/Math.cos(f);if(M=d+Ow(M),t.accuracy){var S=kw({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});E={top:S.lat,right:S.lon,bottom:w,left:M}}else E={lat:w,lon:M};return E}function Nw(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Fw(t,e){var i="00000"+t.easting,s="00000"+t.northing;return t.zoneNumber+t.zoneLetter+Dw(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+s.substr(s.length-5,e)}function Dw(t,e,i){var s=jw(i),n=Math.floor(t/1e5),r=Math.floor(e/1e5)%20;return zw(n,r,s)}function jw(t){var e=t%xw;return 0===e&&(e=xw),e}function zw(t,e,i){var s=i-1,n=ww.charCodeAt(s),r=Ew.charCodeAt(s),o=n+t-1,a=r+e,h=!1;o>Pw&&(o=o-Pw+Mw-1,h=!0),(o===Sw||n<Sw&&o>Sw||(o>Sw||n<Sw)&&h)&&o++,(o===Cw||n<Cw&&o>Cw||(o>Cw||n<Cw)&&h)&&(o++,o===Sw&&o++),o>Pw&&(o=o-Pw+Mw-1),a>bw?(a=a-bw+Mw-1,h=!0):h=!1,(a===Sw||r<Sw&&a>Sw||(a>Sw||r<Sw)&&h)&&a++,(a===Cw||r<Cw&&a>Cw||(a>Cw||r<Cw)&&h)&&(a++,a===Sw&&a++),a>bw&&(a=a-bw+Mw-1);var l=String.fromCharCode(o)+String.fromCharCode(a);return l}function Uw(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";var e,i=t.length,s=null,n="",r=0;while(!/[A-Z]/.test(e=t.charAt(r))){if(r>=2)throw"MGRSPoint bad conversion from: "+t;n+=e,r++}var o=parseInt(n,10);if(0===r||r+3>i)throw"MGRSPoint bad conversion from: "+t;var a=t.charAt(r++);if(a<="A"||"B"===a||"Y"===a||a>="Z"||"I"===a||"O"===a)throw"MGRSPoint zone letter "+a+" not handled: "+t;s=t.substring(r,r+=2);var h=jw(o),l=Bw(s.charAt(0),h),c=Ww(s.charAt(1),h);while(c<Xw(a))c+=2e6;var u=i-r;if(u%2!==0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,g,f,p,_,m=u/2,y=0,v=0;return m>0&&(d=1e5/Math.pow(10,m),g=t.substring(r,r+m),y=parseFloat(g)*d,f=t.substring(r+m),v=parseFloat(f)*d),p=y+l,_=v+c,{easting:p,northing:_,zoneLetter:a,zoneNumber:o,accuracy:d}}function Bw(t,e){var i=ww.charCodeAt(e-1),s=1e5,n=!1;while(i!==t.charCodeAt(0)){if(i++,i===Sw&&i++,i===Cw&&i++,i>Pw){if(n)throw"Bad character: "+t;i=Mw,n=!0}s+=1e5}return s}function Ww(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=Ew.charCodeAt(e-1),s=0,n=!1;while(i!==t.charCodeAt(0)){if(i++,i===Sw&&i++,i===Cw&&i++,i>bw){if(n)throw"Bad character: "+t;i=Mw,n=!0}s+=1e5}return s}function Xw(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Vw(t,e,i){if(!(this instanceof Vw))return new Vw(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"===typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"===typeof t&&"undefined"===typeof e){var s=t.split(",");this.x=parseFloat(s[0]),this.y=parseFloat(s[1]),this.z=parseFloat(s[2])||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Vw.fromMGRS=function(t){return new Vw(Aw(t))},Vw.prototype.toMGRS=function(t){return Iw([this.x,this.y],t)};var qw=Vw,Yw=1,Kw=.25,Hw=.046875,$w=.01953125,Zw=.01068115234375,Jw=.75,Qw=.46875,tE=.013020833333333334,eE=.007120768229166667,iE=.3645833333333333,sE=.005696614583333333,nE=.3076171875;function rE(t){var e=[];e[0]=Yw-t*(Kw+t*(Hw+t*($w+t*Zw))),e[1]=t*(Jw-t*(Hw+t*($w+t*Zw)));var i=t*t;return e[2]=i*(Qw-t*(tE+t*eE)),i*=t,e[3]=i*(iE-t*sE),e[4]=i*t*nE,e}function oE(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}var aE=20;function hE(t,e,i){for(var s=1/(1-e),n=t,r=aE;r;--r){var o=Math.sin(n),a=1-e*o*o;if(a=(oE(n,o,Math.cos(n),i)-t)*(a*Math.sqrt(a))*s,n-=a,Math.abs(a)<Jy)return n}return n}function lE(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=rE(this.es),this.ml0=oE(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))}function cE(t){var e,i,s,n=t.x,r=t.y,o=ix(n-this.long0,this.over),a=Math.sin(r),h=Math.cos(r);if(this.es){var l=h*o,c=Math.pow(l,2),u=this.ep2*Math.pow(h,2),d=Math.pow(u,2),g=Math.abs(h)>Jy?Math.tan(r):0,f=Math.pow(g,2),p=Math.pow(f,2);e=1-this.es*Math.pow(a,2),l/=Math.sqrt(e);var _=oE(r,a,h,this.en);i=this.a*(this.k0*l*(1+c/6*(1-f+u+c/20*(5-18*f+p+14*u-58*f*u+c/42*(61+179*p-p*f-479*f)))))+this.x0,s=this.a*(this.k0*(_-this.ml0+a*o*l/2*(1+c/12*(5-f+9*u+4*d+c/30*(61+p-58*f+270*u-330*f*u+c/56*(1385+543*p-p*f-3111*f))))))+this.y0}else{var m=h*Math.sin(o);if(Math.abs(Math.abs(m)-1)<Jy)return 93;if(i=.5*this.a*this.k0*Math.log((1+m)/(1-m))+this.x0,s=h*Math.cos(o)/Math.sqrt(1-Math.pow(m,2)),m=Math.abs(s),m>=1){if(m-1>Jy)return 93;s=0}else s=Math.acos(s);r<0&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return t.x=i,t.y=s,t}function uE(t){var e,i,s,n,r=(t.x-this.x0)*(1/this.a),o=(t.y-this.y0)*(1/this.a);if(this.es)if(e=this.ml0+o/this.k0,i=hE(e,this.es,this.en),Math.abs(i)<Ky){var a=Math.sin(i),h=Math.cos(i),l=Math.abs(h)>Jy?Math.tan(i):0,c=this.ep2*Math.pow(h,2),u=Math.pow(c,2),d=Math.pow(l,2),g=Math.pow(d,2);e=1-this.es*Math.pow(a,2);var f=r*Math.sqrt(e)/this.k0,p=Math.pow(f,2);e*=l,s=i-e*p/(1-this.es)*.5*(1-p/12*(5+3*d-9*c*d+c-4*u-p/30*(61+90*d-252*c*d+45*g+46*c-p/56*(1385+3633*d+4095*g+1574*g*d)))),n=ix(this.long0+f*(1-p/6*(1+2*d+c-p/20*(5+28*d+24*g+8*c*d+6*c-p/42*(61+662*d+1320*g+720*g*d))))/h,this.over)}else s=Ky*ex(o),n=0;else{var _=Math.exp(r/this.k0),m=.5*(_-1/_),y=this.lat0+o/this.k0,v=Math.cos(y);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(m,2))),s=Math.asin(e),o<0&&(s=-s),n=0===m&&0===v?0:ix(Math.atan2(m,v)+this.long0,this.over)}return t.x=n,t.y=s,t}var dE=["Fast_Transverse_Mercator","Fast Transverse Mercator"],gE={init:lE,forward:cE,inverse:uE,names:dE};function fE(t){var e=Math.exp(t);return e=(e-1/e)/2,e}function pE(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),s=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(s,2))}function _E(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}function mE(t){var e=Math.abs(t);return e=_E(e*(1+e/(pE(1,e)+1))),t<0?-e:e}function yE(t,e){var i,s=2*Math.cos(2*e),n=t.length-1,r=t[n],o=0;while(--n>=0)i=s*r-o+t[n],o=r,r=i;return e+i*Math.sin(2*e)}function vE(t,e){var i,s=2*Math.cos(e),n=t.length-1,r=t[n],o=0;while(--n>=0)i=s*r-o+t[n],o=r,r=i;return Math.sin(e)*i}function xE(t){var e=Math.exp(t);return e=(e+1/e)/2,e}function wE(t,e,i){var s,n,r=Math.sin(e),o=Math.cos(e),a=fE(i),h=xE(i),l=2*o*h,c=-2*r*a,u=t.length-1,d=t[u],g=0,f=0,p=0;while(--u>=0)s=f,n=g,f=d,g=p,d=l*f-s-c*g+t[u],p=c*f-n+l*g;return l=r*h,c=o*a,[l*d-c*p,l*p+c*d]}function EE(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(gE.init.apply(this),this.forward=gE.forward,this.inverse=gE.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.k0=void 0!==this.k0?this.k0:1,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=yE(this.cbg,this.lat0);this.Zb=-this.Qn*(s+vE(this.gtu,2*s))}function ME(t){var e=ix(t.x-this.long0,this.over),i=t.y;i=yE(this.cbg,i);var s=Math.sin(i),n=Math.cos(i),r=Math.sin(e),o=Math.cos(e);i=Math.atan2(s,o*n),e=Math.atan2(r*n,pE(s,n*o)),e=mE(Math.tan(e));var a,h,l=wE(this.gtu,2*i,2*e);return i+=l[0],e+=l[1],Math.abs(e)<=2.623395162778?(a=this.a*(this.Qn*e)+this.x0,h=this.a*(this.Qn*i+this.Zb)+this.y0):(a=1/0,h=1/0),t.x=a,t.y=h,t}function SE(t){var e,i,s=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(n=(n-this.Zb)/this.Qn,s/=this.Qn,Math.abs(s)<=2.623395162778){var r=wE(this.utg,2*n,2*s);n+=r[0],s+=r[1],s=Math.atan(fE(s));var o=Math.sin(n),a=Math.cos(n),h=Math.sin(s),l=Math.cos(s);n=Math.atan2(o*l,pE(h,l*a)),s=Math.atan2(h,l*a),e=ix(s+this.long0,this.over),i=yE(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t}var CE=["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"],bE={init:EE,forward:ME,inverse:SE,names:CE};function PE(t,e){if(void 0===t){if(t=Math.floor(30*(ix(e)+Math.PI)/Math.PI)+1,t<0)return 0;if(t>60)return 60}return t}var RE="etmerc";function IE(){var t=PE(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*Qy,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,bE.init.apply(this),this.forward=bE.forward,this.inverse=bE.inverse}var TE=["Universal Transverse Mercator System","utm"],AE={init:IE,names:TE,dependsOn:RE};function LE(t,e){return Math.pow((1-t)/(1+t),e)}var OE=20;function GE(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+ev)/(Math.pow(Math.tan(.5*this.lat0+ev),this.C)*LE(this.e*t,this.ratexp))}function kE(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+ev),this.C)*LE(this.e*Math.sin(i),this.ratexp))-Ky,t.x=this.C*e,t}function NE(t){for(var e=1e-14,i=t.x/this.C,s=t.y,n=Math.pow(Math.tan(.5*s+ev)/this.K,1/this.C),r=OE;r>0;--r){if(s=2*Math.atan(n*LE(this.e*Math.sin(t.y),-.5*this.e))-Ky,Math.abs(s-t.y)<e)break;t.y=s}return r?(t.x=i,t.y=s,t):null}var FE=["gauss"],DE={init:GE,forward:kE,inverse:NE,names:FE};function jE(){DE.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))}function zE(t){var e,i,s,n;return t.x=ix(t.x-this.long0,this.over),DE.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),s=Math.cos(t.x),n=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*s),t.x=n*i*Math.sin(t.x),t.y=n*(this.cosc0*e-this.sinc0*i*s),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function UE(t){var e,i,s,n,r;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,r=pE(t.x,t.y)){var o=2*Math.atan2(r,this.R2);e=Math.sin(o),i=Math.cos(o),n=Math.asin(i*this.sinc0+t.y*e*this.cosc0/r),s=Math.atan2(t.x*e,r*this.cosc0*i-t.y*this.sinc0*e)}else n=this.phic0,s=0;return t.x=s,t.y=n,DE.inverse.apply(this,[t]),t.x=ix(t.x+this.long0,this.over),t}var BE=["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"],WE={init:jE,forward:zE,inverse:UE,names:BE};function XE(t,e,i){return e*=i,Math.tan(.5*(Ky+t))*Math.pow((1-e)/(1+e),.5*i)}function VE(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Jy&&(this.k0=.5*(1+ex(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=Jy&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=Jy&&Math.abs(Math.cos(this.lat_ts))>Jy&&(this.k0=.5*this.cons*tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/sx(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=tx(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(XE(this.lat0,this.sinlat0,this.e))-Ky,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))}function qE(t){var e,i,s,n,r,o,a=t.x,h=t.y,l=Math.sin(h),c=Math.cos(h),u=ix(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=Jy&&Math.abs(h+this.lat0)<=Jy?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*l+this.coslat0*c*Math.cos(u)),t.x=this.a*e*c*Math.sin(u)+this.x0,t.y=this.a*e*(this.coslat0*l-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(XE(h,l,this.e))-Ky,n=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=Jy?(r=sx(this.e,h*this.con,this.con*l),o=2*this.a*this.k0*r/this.cons,t.x=this.x0+o*Math.sin(a-this.long0),t.y=this.y0-this.con*o*Math.cos(a-this.long0),t):(Math.abs(this.sinlat0)<Jy?(e=2*this.a*this.k0/(1+n*Math.cos(u)),t.y=e*s):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*n*Math.cos(u))),t.y=e*(this.cosX0*s-this.sinX0*n*Math.cos(u))+this.y0),t.x=e*n*Math.sin(u)+this.x0,t))}function YE(t){var e,i,s,n,r;t.x-=this.x0,t.y-=this.y0;var o=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var a=2*Math.atan(o/(2*this.a*this.k0));return e=this.long0,i=this.lat0,o<=Jy?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(a)*this.sinlat0+t.y*Math.sin(a)*this.coslat0/o),e=Math.abs(this.coslat0)<Jy?this.lat0>0?ix(this.long0+Math.atan2(t.x,-1*t.y),this.over):ix(this.long0+Math.atan2(t.x,t.y),this.over):ix(this.long0+Math.atan2(t.x*Math.sin(a),o*this.coslat0*Math.cos(a)-t.y*this.sinlat0*Math.sin(a)),this.over),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=Jy){if(o<=Jy)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,s=o*this.cons/(2*this.a*this.k0),i=this.con*nx(this.e,s),e=this.con*ix(this.con*this.long0+Math.atan2(t.x,-1*t.y),this.over)}else n=2*Math.atan(o*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,o<=Jy?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=ix(this.long0+Math.atan2(t.x*Math.sin(n),o*this.cosX0*Math.cos(n)-t.y*this.sinX0*Math.sin(n)),this.over)),i=-1*nx(this.e,Math.tan(.5*(Ky+r)));return t.x=e,t.y=i,t}var KE=["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],HE={init:VE,forward:qE,inverse:YE,names:KE,ssfn_:XE};function $E(){this.k0||(this.k0=1);var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=this.rf,n=1/s,r=2*n-Math.pow(n,2),o=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var a=Math.log(Math.tan(Math.PI/4+this.b0/2)),h=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+o*e)/(1-o*e));this.K=a-this.alpha*h+this.alpha*o/2*l}function ZE(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),s=-this.alpha*(e+i)+this.K,n=2*(Math.atan(Math.exp(s))-Math.PI/4),r=this.alpha*(t.x-this.lambda0),o=Math.atan(Math.sin(r)/(Math.sin(this.b0)*Math.tan(n)+Math.cos(this.b0)*Math.cos(r))),a=Math.asin(Math.cos(this.b0)*Math.sin(n)-Math.sin(this.b0)*Math.cos(n)*Math.cos(r));return t.y=this.R/2*Math.log((1+Math.sin(a))/(1-Math.sin(a)))+this.y0,t.x=this.R*o+this.x0,t}function JE(t){var e=t.x-this.x0,i=t.y-this.y0,s=e/this.R,n=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),r=Math.asin(Math.cos(this.b0)*Math.sin(n)+Math.sin(this.b0)*Math.cos(n)*Math.cos(s)),o=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(n))),a=this.lambda0+o/this.alpha,h=0,l=r,c=-1e3,u=0;while(Math.abs(l-c)>1e-7){if(++u>20)return;h=1/this.alpha*(Math.log(Math.tan(Math.PI/4+r/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(l))/2)),c=l,l=2*Math.atan(Math.exp(h))-Math.PI/2}return t.x=a,t.y=l,t}var QE=["somerc"],tM={init:$E,forward:ZE,inverse:JE,names:QE},eM=1e-7;function iM(t){var e=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],i="object"===typeof t.projName?Object.keys(t.projName)[0]:t.projName;return"no_uoff"in t||"no_off"in t||-1!==e.indexOf(i)||-1!==e.indexOf(yx(i))}function sM(){var t,e,i,s,n,r,o,a,h,l,c,u=0,d=0,g=0,f=0,p=0,_=0,m=0;this.k0||(this.k0=1),this.no_off=iM(this),this.no_rot="no_rot"in this;var y=!1;"alpha"in this&&(y=!0);var v=!1;if("rectified_grid_angle"in this&&(v=!0),y&&(m=this.alpha),v&&(u=this.rectified_grid_angle,y||(m=0,y=!0)),y||v)d=this.longc;else if(g=this.long1,p=this.lat1,f=this.long2,_=this.lat2,Math.abs(p-_)<=eM||(t=Math.abs(p))<=eM||Math.abs(t-Ky)<=eM||Math.abs(Math.abs(this.lat0)-Ky)<=eM||Math.abs(Math.abs(_)-Ky)<=eM)throw new Error;var x=1-this.es;e=Math.sqrt(x),Math.abs(this.lat0)>Jy?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/x),this.A=this.B*this.k0*e/t,s=this.B*e/(i*Math.sqrt(t)),n=s*s-1,n<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=s,this.E*=Math.pow(sx(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=n=1),y||v?(y?(c=Math.asin(Math.sin(m)/s),v||(u=m)):(c=u,m=Math.asin(s*Math.sin(c))),this.lam0=d-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B):(r=Math.pow(sx(this.e,p,Math.sin(p)),this.B),o=Math.pow(sx(this.e,_,Math.sin(_)),this.B),n=this.E/r,h=(o-r)/(o+r),l=this.E*this.E,l=(l-o*r)/(l+o*r),t=g-f,t<-Math.PI?f-=iv:t>Math.PI&&(f+=iv),this.lam0=ix(.5*(g+f)-Math.atan(l*Math.tan(.5*this.B*(g-f))/h)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*ix(g-this.lam0,this.over))/(n-1/n)),u=m=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(m))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(ev-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(ev+n))}function nM(t){var e,i,s,n,r,o,a,h,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-Ky)>Jy){if(r=this.E/Math.pow(sx(this.e,t.y,Math.sin(t.y)),this.B),o=1/r,e=.5*(r-o),i=.5*(r+o),n=Math.sin(this.B*t.x),s=(e*this.singam-n*this.cosgam)/i,Math.abs(Math.abs(s)-1)<Jy)throw new Error;h=.5*this.ArB*Math.log((1-s)/(1+s)),o=Math.cos(this.B*t.x),a=Math.abs(o)<eM?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+n*this.singam,o)}else h=t.y>0?this.v_pole_n:this.v_pole_s,a=this.ArB*t.y;return this.no_rot?(l.x=a,l.y=h):(a-=this.u_0,l.x=h*this.cosrot+a*this.sinrot,l.y=a*this.cosrot-h*this.sinrot),l.x=this.a*l.x+this.x0,l.y=this.a*l.y+this.y0,void 0!==t.z&&(l.z=t.z),void 0!==t.m&&(l.m=t.m),l}function rM(t){var e,i,s,n,r,o,a,h={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),s=Math.exp(-this.BrA*i),n=.5*(s-1/s),r=.5*(s+1/s),o=Math.sin(this.BrA*e),a=(o*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(a)-1)<Jy)h.x=0,h.y=a<0?-Ky:Ky;else{if(h.y=this.E/Math.sqrt((1+a)/(1-a)),h.y=nx(this.e,Math.pow(h.y,1/this.B)),h.y===1/0)throw new Error;h.x=-this.rB*Math.atan2(n*this.cosgam-o*this.singam,Math.cos(this.BrA*e))}return h.x+=this.lam0,void 0!==t.z&&(h.z=t.z),void 0!==t.m&&(h.m=t.m),h}var oM=["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"],aM={init:sM,forward:nM,inverse:rM,names:oM};function hM(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,!(Math.abs(this.lat1+this.lat2)<Jy)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),s=tx(this.e,e,i),n=sx(this.e,this.lat1,e),r=Math.sin(this.lat2),o=Math.cos(this.lat2),a=tx(this.e,r,o),h=sx(this.e,this.lat2,r),l=sx(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>Jy?this.ns=Math.log(s/a)/Math.log(n/h):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(n,this.ns)),this.rh=Math.abs(Math.abs(this.lat0)-Ky)<Jy?0:this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}}function lM(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=Jy&&(i=ex(i)*(Ky-2*Jy));var s,n,r=Math.abs(Math.abs(i)-Ky);if(r>Jy)s=sx(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(s,this.ns);else{if(r=i*this.ns,r<=0)return null;n=0}var o=this.ns*ix(e-this.long0,this.over);return t.x=this.k0*(n*Math.sin(o))+this.x0,t.y=this.k0*(this.rh-n*Math.cos(o))+this.y0,t}function cM(t){var e,i,s,n,r,o=(t.x-this.x0)/this.k0,a=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(o*o+a*a),i=1):(e=-Math.sqrt(o*o+a*a),i=-1);var h=0;if(0!==e&&(h=Math.atan2(i*o,i*a)),0!==e||this.ns>0){if(i=1/this.ns,s=Math.pow(e/(this.a*this.f0),i),n=nx(this.e,s),-9999===n)return null}else n=-Ky;return r=ix(h/this.ns+this.long0,this.over),t.x=r,t.y=n,t}var uM=["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],dM={init:hM,forward:lM,inverse:cM,names:uM};function gM(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq}function fM(t){var e,i,s,n,r,o,a,h=t.x,l=t.y,c=ix(h-this.long0,this.over);return e=Math.pow((1+this.e*Math.sin(l))/(1-this.e*Math.sin(l)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(l/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,n=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),r=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(n)),o=this.n*r,a=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(n/2+this.s45),this.n),t.y=a*Math.cos(o)/1,t.x=a*Math.sin(o)/1,this.czech||(t.y*=-1,t.x*=-1),t}function pM(t){var e,i,s,n,r,o,a,h,l=t.x;t.x=t.y,t.y=l,this.czech||(t.y*=-1,t.x*=-1),o=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x),n=r/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/o,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(n)),i=Math.asin(Math.cos(s)*Math.sin(n)/Math.cos(e)),t.x=this.long0-i/this.alfa,a=e,h=0;var c=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(a))/(1-this.e*Math.sin(a)),this.e/2))-this.s45),Math.abs(a-t.y)<1e-10&&(h=1),a=t.y,c+=1}while(0===h&&c<15);return c>=15?null:t}var _M=["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"],mM={init:gM,forward:fM,inverse:pM,names:_M};function yM(t,e,i,s,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)}function vM(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function xM(t){return.375*t*(1+.25*t*(1+.46875*t))}function wM(t){return.05859375*t*t*(1+.75*t)}function EM(t){return t*t*t*(35/3072)}function MM(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function SM(t){return Math.abs(t)<Ky?t:t-ex(t)*Math.PI}function CM(t,e,i,s,n){var r,o;r=t/e;for(var a=0;a<15;a++)if(o=(t-(e*r-i*Math.sin(2*r)+s*Math.sin(4*r)-n*Math.sin(6*r)))/(e-2*i*Math.cos(2*r)+4*s*Math.cos(4*r)-6*n*Math.cos(6*r)),r+=o,Math.abs(o)<=1e-10)return r;return NaN}function bM(){this.sphere||(this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.ml0=this.a*yM(this.e0,this.e1,this.e2,this.e3,this.lat0))}function PM(t){var e,i,s=t.x,n=t.y;if(s=ix(s-this.long0,this.over),this.sphere)e=this.a*Math.asin(Math.cos(n)*Math.sin(s)),i=this.a*(Math.atan2(Math.tan(n),Math.cos(s))-this.lat0);else{var r=Math.sin(n),o=Math.cos(n),a=MM(this.a,this.e,r),h=Math.tan(n)*Math.tan(n),l=s*Math.cos(n),c=l*l,u=this.es*o*o/(1-this.es),d=this.a*yM(this.e0,this.e1,this.e2,this.e3,n);e=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),i=d-this.ml0+a*r/o*c*(.5+(5-h+6*u)*c/24)}return t.x=e+this.x0,t.y=i+this.y0,t}function RM(t){t.x-=this.x0,t.y-=this.y0;var e,i,s=t.x/this.a,n=t.y/this.a;if(this.sphere){var r=n+this.lat0;e=Math.asin(Math.sin(r)*Math.cos(s)),i=Math.atan2(Math.tan(s),Math.cos(r))}else{var o=this.ml0/this.a+n,a=CM(o,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(a)-Ky)<=Jy)return t.x=this.long0,t.y=Ky,n<0&&(t.y*=-1),t;var h=MM(this.a,this.e,Math.sin(a)),l=h*h*h/this.a/this.a*(1-this.es),c=Math.pow(Math.tan(a),2),u=s*this.a/h,d=u*u;e=a-h*Math.tan(a)/l*u*u*(.5-(1+3*c)*u*u/24),i=u*(1-d*(c/3+(1+3*c)*c*d/15))/Math.cos(a)}return t.x=ix(i+this.long0,this.over),t.y=SM(e),t}var IM=["Cassini","Cassini_Soldner","cass"],TM={init:bM,forward:PM,inverse:RM,names:IM};function AM(t,e){var i;return t>1e-7?(i=t*e,(1-t*t)*(e/(1-i*i)-.5/t*Math.log((1-i)/(1+i)))):2*e}var LM=.3333333333333333,OM=.17222222222222222,GM=.10257936507936508,kM=.06388888888888888,NM=.0664021164021164,FM=.016415012942191543;function DM(t){var e,i=[];return i[0]=t*LM,e=t*t,i[0]+=e*OM,i[1]=e*kM,e*=t,i[0]+=e*GM,i[1]+=e*NM,i[2]=e*FM,i}function jM(t,e){var i=t+t;return t+e[0]*Math.sin(i)+e[1]*Math.sin(i+i)+e[2]*Math.sin(i+i+i)}var zM=1,UM=2,BM=3,WM=4;function XM(){var t,e=Math.abs(this.lat0);if(Math.abs(e-Ky)<Jy?this.mode=this.lat0<0?zM:UM:Math.abs(e)<Jy?this.mode=BM:this.mode=WM,this.es>0)switch(this.qp=AM(this.e,1),this.mmf=.5/(1-this.es),this.apa=DM(this.es),this.mode){case UM:this.dd=1;break;case zM:this.dd=1;break;case BM:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case WM:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=AM(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd;break}else this.mode===WM&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))}function VM(t){var e,i,s,n,r,o,a,h,l,c,u=t.x,d=t.y;if(u=ix(u-this.long0,this.over),this.sphere){if(r=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if(i=this.mode===this.EQUIT?1+c*s:1+this.sinph0*r+this.cosph0*c*s,i<=Jy)return null;i=Math.sqrt(2/i),e=i*c*Math.sin(u),i*=this.mode===this.EQUIT?r:this.cosph0*r-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<Jy)return null;i=ev-.5*d,i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)),e=i*Math.sin(u),i*=s}}else{switch(a=0,h=0,l=0,s=Math.cos(u),n=Math.sin(u),r=Math.sin(d),o=AM(this.e,r),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(a=o/this.qp,h=Math.sqrt(1-a*a)),this.mode){case this.OBLIQ:l=1+this.sinb1*a+this.cosb1*h*s;break;case this.EQUIT:l=1+h*s;break;case this.N_POLE:l=Ky+d,o=this.qp-o;break;case this.S_POLE:l=d-Ky,o=this.qp+o;break}if(Math.abs(l)<Jy)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:l=Math.sqrt(2/l),i=this.mode===this.OBLIQ?this.ymf*l*(this.cosb1*a-this.sinb1*h*s):(l=Math.sqrt(2/(1+h*s)))*a*this.ymf,e=this.xmf*l*h*n;break;case this.N_POLE:case this.S_POLE:o>=0?(e=(l=Math.sqrt(o))*n,i=s*(this.mode===this.S_POLE?l:-l)):e=i=0;break}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t}function qM(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,n,r,o,a,h=t.x/this.a,l=t.y/this.a;if(this.sphere){var c,u=0,d=0;if(c=Math.sqrt(h*h+l*l),i=.5*c,i>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(d=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(c)<=Jy?0:Math.asin(l*d/c),h*=d,l=u*c;break;case this.OBLIQ:i=Math.abs(c)<=Jy?this.lat0:Math.asin(u*this.sinph0+l*d*this.cosph0/c),h*=d*this.cosph0,l=(u-Math.sin(i)*this.sinph0)*c;break;case this.N_POLE:l=-l,i=Ky-i;break;case this.S_POLE:i-=Ky;break}e=0!==l||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(h,l):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(h/=this.dd,l*=this.dd,o=Math.sqrt(h*h+l*l),o<Jy)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),s=Math.cos(n),h*=n=Math.sin(n),this.mode===this.OBLIQ?(a=s*this.sinb1+l*n*this.cosb1/o,r=this.qp*a,l=o*this.cosb1*s-l*this.sinb1*n):(a=l*n/o,r=this.qp*a,l=o*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(l=-l),r=h*h+l*l,!r)return t.x=this.long0,t.y=this.lat0,t;a=1-r/this.qp,this.mode===this.S_POLE&&(a=-a)}e=Math.atan2(h,l),i=jM(Math.asin(a),this.apa)}return t.x=ix(this.long0+e,this.over),t.y=i,t}var YM=["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],KM={init:XM,forward:VM,inverse:qM,names:YM,S_POLE:zM,N_POLE:UM,EQUIT:BM,OBLIQ:WM};function HM(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}function $M(){Math.abs(this.lat1+this.lat2)<Jy||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=tx(this.e3,this.sin_po,this.cos_po),this.qs1=AM(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=tx(this.e3,this.sin_po,this.cos_po),this.qs2=AM(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=AM(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>Jy?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)}function ZM(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=AM(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,r=this.ns0*ix(e-this.long0,this.over),o=n*Math.sin(r)+this.x0,a=this.rh-n*Math.cos(r)+this.y0;return t.x=o,t.y=a,t}function JM(t){var e,i,s,n,r,o;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1),n=0,0!==e&&(n=Math.atan2(s*t.x,s*t.y)),s=e*this.ns0/this.a,this.sphere?o=Math.asin((this.c-s*s)/(2*this.ns0)):(i=(this.c-s*s)/this.ns0,o=this.phi1z(this.e3,i)),r=ix(n/this.ns0+this.long0,this.over),t.x=r,t.y=o,t}function QM(t,e){var i,s,n,r,o,a=HM(.5*e);if(t<Jy)return a;for(var h=t*t,l=1;l<=25;l++)if(i=Math.sin(a),s=Math.cos(a),n=t*i,r=1-n*n,o=.5*r*r/s*(e/(1-h)-i/r+.5/t*Math.log((1-n)/(1+n))),a+=o,Math.abs(o)<=1e-7)return a;return null}var tS=["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],eS={init:$M,forward:ZM,inverse:JM,names:tS,phi1z:QM};function iS(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1}function sS(t){var e,i,s,n,r,o,a,h,l=t.x,c=t.y;return s=ix(l-this.long0,this.over),e=Math.sin(c),i=Math.cos(c),n=Math.cos(s),o=this.sin_p14*e+this.cos_p14*i*n,r=1,o>0||Math.abs(o)<=Jy?(a=this.x0+this.a*r*i*Math.sin(s)/o,h=this.y0+this.a*r*(this.cos_p14*e-this.sin_p14*i*n)/o):(a=this.x0+this.infinity_dist*i*Math.sin(s),h=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=h,t}function nS(t){var e,i,s,n,r,o;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(n=Math.atan2(e,this.rc),i=Math.sin(n),s=Math.cos(n),o=HM(s*this.sin_p14+t.y*i*this.cos_p14/e),r=Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i),r=ix(this.long0+r,this.over)):(o=this.phic0,r=0),t.x=r,t.y=o,t}var rS=["gnom"],oS={init:iS,forward:sS,inverse:nS,names:rS};function aS(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*Ky:Ky;for(var s,n,r,o,a=Math.asin(.5*e),h=0;h<30;h++)if(n=Math.sin(a),r=Math.cos(a),o=t*n,s=Math.pow(1-o*o,2)/(2*r)*(e/(1-t*t)-n/(1-o*o)+.5/t*Math.log((1-o)/(1+o))),a+=s,Math.abs(s)<=1e-10)return a;return NaN}function hS(){this.sphere||(this.k0=tx(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))}function lS(t){var e,i,s=t.x,n=t.y,r=ix(s-this.long0,this.over);if(this.sphere)e=this.x0+this.a*r*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(n)/Math.cos(this.lat_ts);else{var o=AM(this.e,Math.sin(n));e=this.x0+this.a*this.k0*r,i=this.y0+this.a*o*.5/this.k0}return t.x=e,t.y=i,t}function cS(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=ix(this.long0+t.x/this.a/Math.cos(this.lat_ts),this.over),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=aS(this.e,2*t.y*this.k0/this.a),e=ix(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t}var uS=["cea"],dS={init:hS,forward:lS,inverse:cS,names:uS};function gS(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)}function fS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=SM(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*n,t}function pS(t){var e=t.x,i=t.y;return t.x=ix(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=SM(this.lat0+(i-this.y0)/this.a),t}var _S=["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"],mS={init:gS,forward:fS,inverse:pS,names:_S},yS=20;function vS(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.ml0=this.a*yM(this.e0,this.e1,this.e2,this.e3,this.lat0)}function xS(t){var e,i,s,n=t.x,r=t.y,o=ix(n-this.long0,this.over);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=Jy?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(r),i=this.a*(SM(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=Jy)e=this.a*o,i=-1*this.ml0;else{var a=MM(this.a,this.e,Math.sin(r))/Math.tan(r);e=a*Math.sin(s),i=this.a*yM(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+a*(1-Math.cos(s))}return t.x=e+this.x0,t.y=i+this.y0,t}function wS(t){var e,i,s,n,r,o,a,h,l;if(s=t.x-this.x0,n=t.y-this.y0,this.sphere)if(Math.abs(n+this.a*this.lat0)<=Jy)e=ix(s/this.a+this.long0,this.over),i=0;else{var c;for(o=this.lat0+n/this.a,a=s*s/this.a/this.a+o*o,h=o,r=yS;r;--r)if(c=Math.tan(h),l=-1*(o*(h*c+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),h+=l,Math.abs(l)<=Jy){i=h;break}e=ix(this.long0+Math.asin(s*Math.tan(h)/this.a)/Math.sin(i),this.over)}else if(Math.abs(n+this.ml0)<=Jy)i=0,e=ix(this.long0+s/this.a,this.over);else{var u,d,g,f,p;for(o=(this.ml0+n)/this.a,a=s*s/this.a/this.a+o*o,h=o,r=yS;r;--r)if(p=this.e*Math.sin(h),u=Math.sqrt(1-p*p)*Math.tan(h),d=this.a*yM(this.e0,this.e1,this.e2,this.e3,h),g=this.e0-2*this.e1*Math.cos(2*h)+4*this.e2*Math.cos(4*h)-6*this.e3*Math.cos(6*h),f=d/this.a,l=(o*(u*f+1)-f-.5*u*(f*f+a))/(this.es*Math.sin(2*h)*(f*f+a-2*o*f)/(4*u)+(o-f)*(u*g-2/Math.sin(2*h))-g),h-=l,Math.abs(l)<=Jy){i=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=ix(this.long0+Math.asin(s*u/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t}var ES=["Polyconic","American_Polyconic","poly"],MS={init:vS,forward:xS,inverse:wS,names:ES},SS=1;function CS(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013}function bS(t){var e,i=t.x,s=t.y,n=s-this.lat0,r=i-this.long0,o=n/Yy*1e-5,a=r,h=1,l=0;for(e=1;e<=10;e++)h*=o,l+=this.A[e]*h;var c,u,d=l,g=a,f=1,p=0,_=0,m=0;for(e=1;e<=6;e++)c=f*d-p*g,u=p*d+f*g,f=c,p=u,_=_+this.B_re[e]*f-this.B_im[e]*p,m=m+this.B_im[e]*f+this.B_re[e]*p;return t.x=m*this.a+this.x0,t.y=_*this.a+this.y0,t}function PS(t){var e,i,s,n=t.x,r=t.y,o=n-this.x0,a=r-this.y0,h=a/this.a,l=o/this.a,c=1,u=0,d=0,g=0;for(e=1;e<=6;e++)i=c*h-u*l,s=u*h+c*l,c=i,u=s,d=d+this.C_re[e]*c-this.C_im[e]*u,g=g+this.C_im[e]*c+this.C_re[e]*u;for(var f=0;f<this.iterations;f++){var p,_,m=d,y=g,v=h,x=l;for(e=2;e<=6;e++)p=m*d-y*g,_=y*d+m*g,m=p,y=_,v+=(e-1)*(this.B_re[e]*m-this.B_im[e]*y),x+=(e-1)*(this.B_im[e]*m+this.B_re[e]*y);m=1,y=0;var w=this.B_re[1],E=this.B_im[1];for(e=2;e<=6;e++)p=m*d-y*g,_=y*d+m*g,m=p,y=_,w+=e*(this.B_re[e]*m-this.B_im[e]*y),E+=e*(this.B_im[e]*m+this.B_re[e]*y);var M=w*w+E*E;d=(v*w+x*E)/M,g=(x*w-v*E)/M}var S=d,C=g,b=1,P=0;for(e=1;e<=9;e++)b*=S,P+=this.D[e]*b;var R=this.lat0+P*Yy*1e5,I=this.long0+C;return t.x=I,t.y=R,t}var RS=["New_Zealand_Map_Grid","nzmg"],IS={init:CS,forward:bS,inverse:PS,names:RS,iterations:SS};function TS(){}function AS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=this.x0+this.a*s,r=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=n,t.y=r,t}function LS(t){t.x-=this.x0,t.y-=this.y0;var e=ix(this.long0+t.x/this.a,this.over),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t}var OS=["Miller_Cylindrical","mill"],GS={init:TS,forward:AS,inverse:LS,names:OS},kS=20;function NS(){this.long0=this.long0||0,this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=rE(this.es)}function FS(t){var e,i,s=t.x,n=t.y;if(s=ix(s-this.long0,this.over),this.sphere){if(this.m)for(var r=this.n*Math.sin(n),o=kS;o;--o){var a=(this.m*n+Math.sin(n)-r)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<Jy)break}else n=1!==this.n?Math.asin(this.n*Math.sin(n)):n;e=this.a*this.C_x*s*(this.m+Math.cos(n)),i=this.a*this.C_y*n}else{var h=Math.sin(n),l=Math.cos(n);i=this.a*oE(n,h,l,this.en),e=this.a*s*l/Math.sqrt(1-this.es*h*h)}return t.x=e,t.y=i,t}function DS(t){var e,i,s,n;return t.x-=this.x0,s=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,s/=this.C_x*(this.m+Math.cos(e)),this.m?e=HM((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=HM(Math.sin(e)/this.n)),s=ix(s+this.long0,this.over),e=SM(e)):(e=hE(t.y/this.a,this.es,this.en),n=Math.abs(e),n<Ky?(n=Math.sin(e),i=this.long0+t.x*Math.sqrt(1-this.es*n*n)/(this.a*Math.cos(e)),s=ix(i,this.over)):n-Jy<Ky&&(s=this.long0)),t.x=s,t.y=e,t}var jS=["Sinusoidal","sinu"],zS={init:NS,forward:FS,inverse:DS,names:jS};function US(){this.sphere=!0,this.b=this.a,this.m=1,this.n=2.5707963267948966,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)}var BS=FS,WS=DS,XS=["Eckert_VI","eck6"],VS={init:US,forward:BS,inverse:WS,names:XS};function qS(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0}function YS(t){var e=t.x,i=t.y,s=ix(e-this.long0,this.over),n=i,r=Math.PI*Math.sin(i);while(1){var o=-(n+Math.sin(n)-r)/(1+Math.cos(n));if(n+=o,Math.abs(o)<Jy)break}n/=2,Math.PI/2-Math.abs(i)<Jy&&(s=0);var a=.900316316158*this.a*s*Math.cos(n)+this.x0,h=1.4142135623731*this.a*Math.sin(n)+this.y0;return t.x=a,t.y=h,t}function KS(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var s=ix(this.long0+t.x/(.900316316158*this.a*Math.cos(e)),this.over);s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var n=Math.asin(i);return t.x=s,t.y=n,t}var HS=["Mollweide","moll"],$S={init:qS,forward:YS,inverse:KS,names:HS};function ZS(){Math.abs(this.lat1+this.lat2)<Jy||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=vM(this.es),this.e1=xM(this.es),this.e2=wM(this.es),this.e3=EM(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=tx(this.e,this.sin_phi,this.cos_phi),this.ml1=yM(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<Jy?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=tx(this.e,this.sin_phi,this.cos_phi),this.ml2=yM(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=yM(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))}function JS(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var n=yM(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-n)}var r=this.ns*ix(i-this.long0,this.over),o=this.x0+e*Math.sin(r),a=this.y0+this.rh-e*Math.cos(r);return t.x=o,t.y=a,t}function QS(t){var e,i,s,n;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var r=0;if(0!==i&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere)return n=ix(this.long0+r/this.ns,this.over),s=SM(this.g-i/this.a),t.x=n,t.y=s,t;var o=this.g-i/this.a;return s=CM(o,this.e0,this.e1,this.e2,this.e3),n=ix(this.long0+r/this.ns,this.over),t.x=n,t.y=s,t}var tC=["Equidistant_Conic","eqdc"],eC={init:ZS,forward:JS,inverse:QS,names:tC};function iC(){this.R=this.a}function sC(t){var e,i,s=t.x,n=t.y,r=ix(s-this.long0,this.over);if(Math.abs(n)<=Jy)return e=this.x0+this.R*r,i=this.y0,t.x=e,t.y=i,t;var o=HM(2*Math.abs(n/Math.PI));if(Math.abs(r)<=Jy||Math.abs(Math.abs(n)-Ky)<=Jy)return e=this.x0,i=n>=0?this.y0+Math.PI*this.R*Math.tan(.5*o):this.y0+Math.PI*this.R*-Math.tan(.5*o),t.x=e,t.y=i,t;var a=.5*Math.abs(Math.PI/r-r/Math.PI),h=a*a,l=Math.sin(o),c=Math.cos(o),u=c/(l+c-1),d=u*u,g=u*(2/l-1),f=g*g,p=Math.PI*this.R*(a*(u-f)+Math.sqrt(h*(u-f)*(u-f)-(f+h)*(d-f)))/(f+h);r<0&&(p=-p),e=this.x0+p;var _=h+u;return p=Math.PI*this.R*(g*_-a*Math.sqrt((f+h)*(h+1)-_*_))/(f+h),i=n>=0?this.y0+p:this.y0-p,t.x=e,t.y=i,t}function nC(t){var e,i,s,n,r,o,a,h,l,c,u,d,g;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,s=t.x/u,n=t.y/u,r=s*s+n*n,o=-Math.abs(n)*(1+r),a=o-2*n*n+s*s,h=-2*o+1+2*n*n+r*r,g=n*n/h+(2*a*a*a/h/h/h-9*o*a/h/h)/27,l=(o-a*a/3/h)/h,c=2*Math.sqrt(-l/3),u=3*g/l/c,Math.abs(u)>1&&(u=u>=0?1:-1),d=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI:-(-c*Math.cos(d+Math.PI/3)-a/3/h)*Math.PI,e=Math.abs(s)<Jy?this.long0:ix(this.long0+Math.PI*(r-1+Math.sqrt(1+2*(s*s-n*n)+r*r))/2/s,this.over),t.x=e,t.y=i,t}var rC=["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"],oC={init:iC,forward:sC,inverse:nC,names:rC};function aC(t,e,i,s,n,r){const o=s-e,a=Math.atan((1-r)*Math.tan(t)),h=Math.atan((1-r)*Math.tan(i)),l=Math.sin(a),c=Math.cos(a),u=Math.sin(h),d=Math.cos(h);let g,f,p,_,m,y,v,x,w,E,M,S,C,b,P,R=o,I=100;do{if(f=Math.sin(R),p=Math.cos(R),_=Math.sqrt(d*f*(d*f)+(c*u-l*d*p)*(c*u-l*d*p)),0===_)return{azi1:0,s12:0};m=l*u+c*d*p,y=Math.atan2(_,m),v=c*d*f/_,x=1-v*v,w=0!==x?m-2*l*u/x:0,E=r/16*x*(4+r*(4-3*x)),g=R,R=o+(1-E)*r*v*(y+E*_*(w+E*m*(2*w*w-1)))}while(Math.abs(R-g)>1e-12&&--I>0);if(0===I)return{azi1:NaN,s12:NaN};M=x*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),S=1+M/16384*(4096+M*(M*(320-175*M)-768)),C=M/1024*(256+M*(M*(74-47*M)-128)),b=C*_*(w+C/4*(m*(2*w*w-1)-C/6*w*(4*_*_-3)*(4*w*w-3))),P=n*(1-r)*S*(y-b);const T=Math.atan2(d*f,c*u-l*d*p);return{azi1:T,s12:P}}function hC(t,e,i,s,n,r){const o=Math.atan((1-r)*Math.tan(t)),a=Math.sin(o),h=Math.cos(o),l=Math.sin(i),c=Math.cos(i),u=Math.atan2(a,h*c),d=h*l,g=1-d*d,f=g*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),p=1+f/16384*(4096+f*(f*(320-175*f)-768)),_=f/1024*(256+f*(f*(74-47*f)-128));let m,y,v,x,w,E=s/(n*(1-r)*p),M=100;do{y=Math.cos(2*u+E),v=Math.sin(E),x=Math.cos(E),w=_*v*(y+_/4*(x*(2*y*y-1)-_/6*y*(4*v*v-3)*(4*y*y-3))),m=E,E=s/(n*(1-r)*p)+w}while(Math.abs(E-m)>1e-12&&--M>0);if(0===M)return{lat2:NaN,lon2:NaN};const S=a*v-h*x*c,C=Math.atan2(a*x+h*v*c,(1-r)*Math.sqrt(d*d+S*S)),b=Math.atan2(v*l,h*x-a*v*c),P=r/16*g*(4+r*(4-3*g)),R=b-(1-P)*r*d*(E+P*v*(y+P*x*(2*y*y-1))),I=e+R;return{lat2:C,lon2:I}}function lC(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.f=this.es/(1+Math.sqrt(1-this.es))}function cC(t){var e,i,s,n,r,o,a,h,l,c,u,d=t.x,g=t.y,f=Math.sin(t.y),p=Math.cos(t.y),_=ix(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=Jy?(t.x=this.x0+this.a*(Ky-g)*Math.sin(_),t.y=this.y0-this.a*(Ky-g)*Math.cos(_),t):Math.abs(this.sin_p12+1)<=Jy?(t.x=this.x0+this.a*(Ky+g)*Math.sin(_),t.y=this.y0+this.a*(Ky+g)*Math.cos(_),t):(l=this.sin_p12*f+this.cos_p12*p*Math.cos(_),a=Math.acos(l),h=a?a/Math.sin(a):1,t.x=this.x0+this.a*h*p*Math.sin(_),t.y=this.y0+this.a*h*(this.cos_p12*f-this.sin_p12*p*Math.cos(_)),t):(e=vM(this.es),i=xM(this.es),s=wM(this.es),n=EM(this.es),Math.abs(this.sin_p12-1)<=Jy?(r=this.a*yM(e,i,s,n,Ky),o=this.a*yM(e,i,s,n,g),t.x=this.x0+(r-o)*Math.sin(_),t.y=this.y0-(r-o)*Math.cos(_),t):Math.abs(this.sin_p12+1)<=Jy?(r=this.a*yM(e,i,s,n,Ky),o=this.a*yM(e,i,s,n,g),t.x=this.x0+(r+o)*Math.sin(_),t.y=this.y0+(r+o)*Math.cos(_),t):Math.abs(d)<Jy&&Math.abs(g-this.lat0)<Jy?(t.x=this.x0,t.y=this.y0,t):(c=aC(this.lat0,this.long0,g,d,this.a,this.f),u=c.azi1,t.x=this.x0+c.s12*Math.sin(u),t.y=this.y0+c.s12*Math.cos(u),t))}function uC(t){var e,i,s,n,r,o,a,h,l,c,u,d,g,f,p,_;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if(e=Math.sqrt(t.x*t.x+t.y*t.y),e>2*Ky*this.a)return;return i=e/this.a,s=Math.sin(i),n=Math.cos(i),r=this.long0,Math.abs(e)<=Jy?o=this.lat0:(o=HM(n*this.sin_p12+t.y*s*this.cos_p12/e),a=Math.abs(this.lat0)-Ky,r=Math.abs(a)<=Jy?this.lat0>=0?ix(this.long0+Math.atan2(t.x,-t.y),this.over):ix(this.long0-Math.atan2(-t.x,t.y),this.over):ix(this.long0+Math.atan2(t.x*s,e*this.cos_p12*n-t.y*this.sin_p12*s),this.over)),t.x=r,t.y=o,t}return h=vM(this.es),l=xM(this.es),c=wM(this.es),u=EM(this.es),Math.abs(this.sin_p12-1)<=Jy?(d=this.a*yM(h,l,c,u,Ky),e=Math.sqrt(t.x*t.x+t.y*t.y),g=d-e,o=CM(g/this.a,h,l,c,u),r=ix(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=o,t):Math.abs(this.sin_p12+1)<=Jy?(d=this.a*yM(h,l,c,u,Ky),e=Math.sqrt(t.x*t.x+t.y*t.y),g=e-d,o=CM(g/this.a,h,l,c,u),r=ix(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=o,t):(f=Math.atan2(t.x,t.y),p=Math.sqrt(t.x*t.x+t.y*t.y),_=hC(this.lat0,this.long0,f,p,this.a,this.f),t.x=_.lon2,t.y=_.lat2,t)}var dC=["Azimuthal_Equidistant","aeqd"],gC={init:lC,forward:cC,inverse:uC,names:dC};function fC(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)}function pC(t){var e,i,s,n,r,o,a,h,l=t.x,c=t.y;return s=ix(l-(this.long0||0),this.over),e=Math.sin(c),i=Math.cos(c),n=Math.cos(s),o=this.sin_p14*e+this.cos_p14*i*n,r=1,(o>0||Math.abs(o)<=Jy)&&(a=(this.x0||0)+this.a*r*i*Math.sin(s),h=(this.y0||0)+this.a*r*(this.cos_p14*e-this.sin_p14*i*n)),t.x=a,t.y=h,t}function _C(t){var e,i,s,n,r,o,a,h,l;return t.x-=this.x0||0,t.y-=this.y0||0,e=Math.sqrt(t.x*t.x+t.y*t.y),i=HM(e/this.a),s=Math.sin(i),n=Math.cos(i),h=this.long0||0,l=this.lat0||0,o=h,Math.abs(e)<=Jy?(a=l,t.x=o,t.y=a,t):(a=HM(n*this.sin_p14+t.y*s*this.cos_p14/e),r=Math.abs(l)-Ky,Math.abs(r)<=Jy?(o=ix(l>=0?h+Math.atan2(t.x,-t.y):h-Math.atan2(-t.x,t.y),this.over),t.x=o,t.y=a,t):(o=ix(h+Math.atan2(t.x*s,e*this.cos_p14*n-t.y*this.sin_p14*s),this.over),t.x=o,t.y=a,t))}var mC=["ortho"],yC={init:fC,forward:pC,inverse:_C,names:mC},vC={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},xC={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function wC(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=Ky-ev/2?this.face=vC.TOP:this.lat0<=-(Ky-ev/2)?this.face=vC.BOTTOM:Math.abs(this.long0)<=ev?this.face=vC.FRONT:Math.abs(this.long0)<=Ky+ev?this.face=this.long0>0?vC.RIGHT:vC.LEFT:this.face=vC.BACK,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)}function EC(t){var e,i,s,n,r,o,a={x:0,y:0},h={value:0};if(t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===vC.TOP)n=Ky-e,i>=ev&&i<=Ky+ev?(h.value=xC.AREA_0,s=i-Ky):i>Ky+ev||i<=-(Ky+ev)?(h.value=xC.AREA_1,s=i>0?i-sv:i+sv):i>-(Ky+ev)&&i<=-ev?(h.value=xC.AREA_2,s=i+Ky):(h.value=xC.AREA_3,s=i);else if(this.face===vC.BOTTOM)n=Ky+e,i>=ev&&i<=Ky+ev?(h.value=xC.AREA_0,s=-i+Ky):i<ev&&i>=-ev?(h.value=xC.AREA_1,s=-i):i<-ev&&i>=-(Ky+ev)?(h.value=xC.AREA_2,s=-i-Ky):(h.value=xC.AREA_3,s=i>0?-i+sv:-i-sv);else{var l,c,u,d,g,f,p;this.face===vC.RIGHT?i=CC(i,+Ky):this.face===vC.BACK?i=CC(i,+sv):this.face===vC.LEFT&&(i=CC(i,-Ky)),d=Math.sin(e),g=Math.cos(e),f=Math.sin(i),p=Math.cos(i),l=g*p,c=g*f,u=d,this.face===vC.FRONT?(n=Math.acos(l),s=SC(n,u,c,h)):this.face===vC.RIGHT?(n=Math.acos(c),s=SC(n,u,-l,h)):this.face===vC.BACK?(n=Math.acos(-l),s=SC(n,u,-c,h)):this.face===vC.LEFT?(n=Math.acos(-c),s=SC(n,u,l,h)):(n=s=0,h.value=xC.AREA_0)}return o=Math.atan(12/sv*(s+Math.acos(Math.sin(s)*Math.cos(ev))-Ky)),r=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),h.value===xC.AREA_1?o+=Ky:h.value===xC.AREA_2?o+=sv:h.value===xC.AREA_3&&(o+=1.5*sv),a.x=r*Math.cos(o),a.y=r*Math.sin(o),a.x=a.x*this.a+this.x0,a.y=a.y*this.a+this.y0,t.x=a.x,t.y=a.y,t}function MC(t){var e,i,s,n,r,o,a,h,l,c,u,d,g={lam:0,phi:0},f={value:0};if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f.value=xC.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f.value=xC.AREA_1,e-=Ky):t.x<0&&-t.x>=Math.abs(t.y)?(f.value=xC.AREA_2,e=e<0?e+sv:e-sv):(f.value=xC.AREA_3,e+=Ky),l=sv/12*Math.tan(e),r=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(r),s=Math.cos(e),n=Math.tan(i),a=1-s*s*n*n*(1-Math.cos(Math.atan(1/Math.cos(o)))),a<-1?a=-1:a>1&&(a=1),this.face===vC.TOP)h=Math.acos(a),g.phi=Ky-h,f.value===xC.AREA_0?g.lam=o+Ky:f.value===xC.AREA_1?g.lam=o<0?o+sv:o-sv:f.value===xC.AREA_2?g.lam=o-Ky:g.lam=o;else if(this.face===vC.BOTTOM)h=Math.acos(a),g.phi=h-Ky,f.value===xC.AREA_0?g.lam=-o+Ky:f.value===xC.AREA_1?g.lam=-o:f.value===xC.AREA_2?g.lam=-o-Ky:g.lam=o<0?-o-sv:-o+sv;else{var p,_,m;p=a,l=p*p,m=l>=1?0:Math.sqrt(1-l)*Math.sin(o),l+=m*m,_=l>=1?0:Math.sqrt(1-l),f.value===xC.AREA_1?(l=_,_=-m,m=l):f.value===xC.AREA_2?(_=-_,m=-m):f.value===xC.AREA_3&&(l=_,_=m,m=-l),this.face===vC.RIGHT?(l=p,p=-_,_=l):this.face===vC.BACK?(p=-p,_=-_):this.face===vC.LEFT&&(l=p,p=_,_=-l),g.phi=Math.acos(-m)-Ky,g.lam=Math.atan2(_,p),this.face===vC.RIGHT?g.lam=CC(g.lam,-Ky):this.face===vC.BACK?g.lam=CC(g.lam,-sv):this.face===vC.LEFT&&(g.lam=CC(g.lam,+Ky))}0!==this.es&&(c=g.phi<0?1:0,u=Math.tan(g.phi),d=this.b/Math.sqrt(u*u+this.one_minus_f_squared),g.phi=Math.atan(Math.sqrt(this.a*this.a-d*d)/(this.one_minus_f*d)),c&&(g.phi=-g.phi));return g.lam+=this.long0,t.x=g.lam,t.y=g.phi,t}function SC(t,e,i,s){var n;return t<Jy?(s.value=xC.AREA_0,n=0):(n=Math.atan2(e,i),Math.abs(n)<=ev?s.value=xC.AREA_0:n>ev&&n<=Ky+ev?(s.value=xC.AREA_1,n-=Ky):n>Ky+ev||n<=-(Ky+ev)?(s.value=xC.AREA_2,n=n>=0?n-sv:n+sv):(s.value=xC.AREA_3,n+=Ky)),n}function CC(t,e){var i=t+e;return i<-sv?i+=iv:i>+sv&&(i-=iv),i}var bC=["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"],PC={init:wC,forward:EC,inverse:MC,names:bC},RC=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],IC=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],TC=.8487,AC=1.3523,LC=tv/5,OC=1/LC,GC=18,kC=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))},NC=function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])};function FC(t,e,i,s){for(var n=e;s;--s){var r=t(n);if(n-=r,Math.abs(r)<i)break}return n}function DC(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"}function jC(t){var e=ix(t.x-this.long0,this.over),i=Math.abs(t.y),s=Math.floor(i*LC);s<0?s=0:s>=GC&&(s=GC-1),i=tv*(i-OC*s);var n={x:kC(RC[s],i)*e,y:kC(IC[s],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*TC+this.x0,n.y=n.y*this.a*AC+this.y0,void 0!==t.z&&(n.z=t.z),void 0!==t.m&&(n.m=t.m),n}function zC(t){var e={x:(t.x-this.x0)/(this.a*TC),y:Math.abs(t.y-this.y0)/(this.a*AC)};if(e.y>=1)e.x/=RC[GC][0],e.y=t.y<0?-Ky:Ky;else{var i=Math.floor(e.y*GC);for(i<0?i=0:i>=GC&&(i=GC-1);;)if(IC[i][0]>e.y)--i;else{if(!(IC[i+1][0]<=e.y))break;++i}var s=IC[i],n=5*(e.y-s[0])/(IC[i+1][0]-s[0]);n=FC(function(t){return(kC(s,t)-e.y)/NC(s,t)},n,Jy,100),e.x/=kC(RC[i],n),e.y=(5*i+n)*Qy,t.y<0&&(e.y=-e.y)}return e.x=ix(e.x+this.long0,this.over),void 0!==t.z&&(e.z=t.z),void 0!==t.m&&(e.m=t.m),e}var UC=["Robinson","robin"],BC={init:DC,forward:jC,inverse:zC,names:UC};function WC(){this.name="geocent"}function XC(t){var e=Zx(t,this.es,this.a);return e}function VC(t){var e=Jx(t,this.es,this.a,this.b);return e}var qC=["Geocentric","geocentric","geocent","Geocent"],YC={init:WC,forward:XC,inverse:VC,names:qC},KC={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3},HC={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};function $C(){if(Object.keys(HC).forEach(function(t){if("undefined"===typeof this[t])this[t]=HC[t].def;else{if(HC[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);HC[t].num&&(this[t]=parseFloat(this[t]))}HC[t].degrees&&(this[t]=this[t]*Qy)}.bind(this)),Math.abs(Math.abs(this.lat0)-Ky)<Jy?this.mode=this.lat0<0?KC.S_POLE:KC.N_POLE:Math.abs(this.lat0)<Jy?this.mode=KC.EQUIT:(this.mode=KC.OBLIQ,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)}function ZC(t){t.x-=this.long0;var e,i,s,n,r=Math.sin(t.y),o=Math.cos(t.y),a=Math.cos(t.x);switch(this.mode){case KC.OBLIQ:i=this.sinph0*r+this.cosph0*o*a;break;case KC.EQUIT:i=o*a;break;case KC.S_POLE:i=-r;break;case KC.N_POLE:i=r;break}switch(i=this.pn1/(this.p-i),e=i*o*Math.sin(t.x),this.mode){case KC.OBLIQ:i*=this.cosph0*r-this.sinph0*o*a;break;case KC.EQUIT:i*=r;break;case KC.N_POLE:i*=-o*a;break;case KC.S_POLE:i*=o*a;break}return s=i*this.cg+e*this.sg,n=1/(s*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*n,i=s*n,t.x=e*this.a,t.y=i*this.a,t}function JC(t){t.x/=this.a,t.y/=this.a;var e,i,s,n={x:t.x,y:t.y};s=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*s,i=this.pn1*t.y*this.cw*s,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var r=pE(t.x,t.y);if(Math.abs(r)<Jy)n.x=0,n.y=t.y;else{var o,a;switch(a=1-r*r*this.pfact,a=(this.p-Math.sqrt(a))/(this.pn1/r+r/this.pn1),o=Math.sqrt(1-a*a),this.mode){case KC.OBLIQ:n.y=Math.asin(o*this.sinph0+t.y*a*this.cosph0/r),t.y=(o-this.sinph0*Math.sin(n.y))*r,t.x*=a*this.cosph0;break;case KC.EQUIT:n.y=Math.asin(t.y*a/r),t.y=o*r,t.x*=a;break;case KC.N_POLE:n.y=Math.asin(o),t.y=-t.y;break;case KC.S_POLE:n.y=-Math.asin(o);break}n.x=Math.atan2(t.x,t.y)}return t.x=n.x+this.long0,t.y=n.y,t}var QC=["Tilted_Perspective","tpers"],tb={init:$C,forward:ZC,inverse:JC,names:QC};function eb(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";this.title||(this.title="Geostationary Satellite View")}function ib(t){var e,i,s,n,r=t.x,o=t.y;if(r-=this.long0,"ellipse"===this.shape){o=Math.atan(this.radius_p2*Math.tan(o));var a=this.radius_p/pE(this.radius_p*Math.cos(o),Math.sin(o));if(i=a*Math.cos(r)*Math.cos(o),s=a*Math.sin(r)*Math.cos(o),n=a*Math.sin(o),(this.radius_g-i)*i-s*s-n*n*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/pE(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/pE(s,e)))}else"sphere"===this.shape&&(e=Math.cos(o),i=Math.cos(r)*e,s=Math.sin(r)*e,n=Math.sin(o),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/pE(n,e)),t.y=this.radius_g_1*Math.atan(n/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(n/pE(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t}function sb(t){var e,i,s,n,r=-1,o=0,a=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*pE(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*pE(1,o));var h=a/this.radius_p;if(e=o*o+h*h+r*r,i=2*this.radius_g*r,s=i*i-4*e*this.C,s<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(a=Math.tan(t.y/this.radius_g_1),o=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+a*a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+o*o)),e=o*o+a*a+r*r,i=2*this.radius_g*r,s=i*i-4*e*this.C,s<0)return t.x=Number.NaN,t.y=Number.NaN,t;n=(-i-Math.sqrt(s))/(2*e),r=this.radius_g+n*r,o*=n,a*=n,t.x=Math.atan2(o,r),t.y=Math.atan(a*Math.cos(t.x)/r)}return t.x=t.x+this.long0,t}var nb=["Geostationary Satellite View","Geostationary_Satellite","geos"],rb={init:eb,forward:ib,inverse:sb,names:nb},ob=1.340264,ab=-.081106,hb=893e-6,lb=.003796,cb=Math.sqrt(3)/2;function ub(){this.long0=void 0!==this.long0?this.long0:0,this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,0!==this.es&&(this.apa=DM(this.es),this.qp=AM(this.e,1),this.rqda=Math.sqrt(.5*this.qp))}function db(t){var e=ix(t.x-this.long0,this.over),i=t.y,s=Math.sin(i);0!==this.es&&(s=AM(this.e,s)/this.qp);var n=Math.asin(cb*s),r=n*n,o=r*r*r;return t.x=e*Math.cos(n)/(cb*(ob+3*ab*r+o*(7*hb+9*lb*r))),t.y=n*(ob+ab*r+o*(hb+lb*r)),0!==this.es&&(t.x*=this.rqda,t.y*=this.rqda),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t}function gb(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,0!==this.es&&(t.x/=this.rqda,t.y/=this.rqda);var e,i,s,n,r,o,a=1e-9,h=12,l=t.y;for(o=0;o<h;++o)if(e=l*l,i=e*e*e,s=l*(ob+ab*e+i*(hb+lb*e))-t.y,n=ob+3*ab*e+i*(7*hb+9*lb*e),l-=r=s/n,Math.abs(r)<a)break;return e=l*l,i=e*e*e,t.x=cb*t.x*(ob+3*ab*e+i*(7*hb+9*lb*e))/Math.cos(l),t.y=Math.asin(Math.sin(l)/cb),0!==this.es&&(t.y=jM(t.y,this.apa)),t.x=ix(t.x+this.long0,this.over),t}var fb=["eqearth","Equal Earth","Equal_Earth"],pb={init:ub,forward:db,inverse:gb,names:fb},_b=1e-10;function mb(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<_b)throw new Error;this.es?(this.en=rE(this.es),this.m1=oE(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=vb,this.forward=yb):(Math.abs(this.phi1)+_b>=Ky?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=wb,this.forward=xb)}function yb(t){var e,i,s,n=ix(t.x-(this.long0||0),this.over),r=t.y;return e=this.am1+this.m1-oE(r,i=Math.sin(r),s=Math.cos(r),this.en),i=s*n/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function vb(t){var e,i,s,n;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=pE(t.x,t.y=this.am1-t.y),n=hE(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(n))<Ky)e=Math.sin(n),s=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(n);else{if(!(Math.abs(e-Ky)<=_b))throw new Error;s=0}return t.x=ix(s+(this.long0||0),this.over),t.y=SM(n),t}function xb(t){var e,i,s=ix(t.x-(this.long0||0),this.over),n=t.y;return i=this.cphi1+this.phi1-n,Math.abs(i)>_b?(t.x=i*Math.sin(e=s*Math.cos(n)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function wb(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var s=pE(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>Ky)throw new Error;return e=Math.abs(Math.abs(i)-Ky)<=_b?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=ix(e+(this.long0||0),this.over),t.y=SM(i),t}var Eb=["bonne","Bonne (Werner lat_1=90)"],Mb={init:mb,names:Eb};const Sb={OBLIQUE:{forward:Tb,inverse:Lb},TRANSVERSE:{forward:Ab,inverse:Ob}},Cb={ROTATE:{o_alpha:"oAlpha",o_lon_c:"oLongC",o_lat_c:"oLatC"},NEW_POLE:{o_lat_p:"oLatP",o_lon_p:"oLongP"},NEW_EQUATOR:{o_lon_1:"oLong1",o_lat_1:"oLat1",o_lon_2:"oLong2",o_lat_2:"oLat2"}};function bb(){if(this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.title=this.title||"General Oblique Transformation",this.isIdentity=dx.includes(this.o_proj),!this.o_proj)throw new Error("Missing parameter: o_proj");if("ob_tran"===this.o_proj)throw new Error("Invalid value for o_proj: "+this.o_proj);const t=this.projStr.replace("+proj=ob_tran","").replace("+o_proj=","+proj=").trim(),e=Hx(t);if(!e)throw new Error("Invalid parameter: o_proj. Unknown projection "+this.o_proj);let i;e.long0=0,this.obliqueProjection=e;const s=Object.keys(Cb),n=t=>{if("undefined"===typeof this[t])return;const e=parseFloat(this[t])*Qy;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let a=0;a<s.length;a++){const t=s[a],e=Cb[t],r=Object.entries(e),o=r.some(([t])=>"undefined"!==typeof this[t]);if(o){i=e;for(let t=0;t<r.length;t++){const[e,i]=r[t],s=n(e);if("undefined"===typeof s)throw new Error("Missing parameter: "+e+".");this[i]=s}break}}if(!i)throw new Error("No valid parameters provided for ob_tran projection.");const{lamp:r,phip:o}=Ib(this,i);this.lamp=r,Math.abs(o)>Jy?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=Sb.OBLIQUE):this.projectionType=Sb.TRANSVERSE}function Pb(t){return this.projectionType.forward(this,t)}function Rb(t){return this.projectionType.inverse(this,t)}function Ib(t,e){let i,s;if(e===Cb.ROTATE){let e=t.oLongC,n=t.oLatC,r=t.oAlpha;if(Math.abs(Math.abs(n)-Ky)<=Jy)throw new Error("Invalid value for o_lat_c: "+t.o_lat_c+" should be < 90°");s=e+Math.atan2(-1*Math.cos(r),-1*Math.sin(r)*Math.sin(n)),i=Math.asin(Math.cos(n)*Math.sin(r))}else if(e===Cb.NEW_POLE)s=t.oLongP,i=t.oLatP;else{let e=t.oLong1,n=t.oLat1,r=t.oLong2,o=t.oLat2,a=Math.abs(n);if(Math.abs(n)>Ky-Jy)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>Ky-Jy)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(n-o)<Jy)throw new Error("Invalid value for o_lat_1 and o_lat_2: o_lat_1 should be different from o_lat_2");if(a<Jy)throw new Error("Invalid value for o_lat_1: o_lat_1 should be different from zero");s=Math.atan2(Math.cos(n)*Math.sin(o)*Math.cos(e)-Math.sin(n)*Math.cos(o)*Math.cos(r),Math.sin(n)*Math.cos(o)*Math.sin(r)-Math.cos(n)*Math.sin(o)*Math.sin(e)),i=Math.atan(-1*Math.cos(s-e)/Math.tan(n))}return{lamp:s,phip:i}}function Tb(t,e){let{x:i,y:s}=e;i=ix(i-t.long0,t.over);const n=Math.cos(i),r=Math.sin(s),o=Math.cos(s);e.x=ix(Math.atan2(o*Math.sin(i),t.sphip*o*n+t.cphip*r)+t.lamp),e.y=Math.asin(t.sphip*r-t.cphip*o*n);const a=t.obliqueProjection.forward(e);return t.isIdentity&&(a.x*=tv,a.y*=tv),a}function Ab(t,e){let{x:i,y:s}=e;i=ix(i-t.long0,t.over);const n=Math.cos(s),r=Math.cos(i);e.x=ix(Math.atan2(n*Math.sin(i),Math.sin(s))+t.lamp),e.y=Math.asin(-1*n*r);const o=t.obliqueProjection.forward(e);return t.isIdentity&&(o.x*=tv,o.y*=tv),o}function Lb(t,e){t.isIdentity&&(e.x*=Qy,e.y*=Qy);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){s-=t.lamp;const i=Math.cos(s),r=Math.sin(n),o=Math.cos(n);e.x=Math.atan2(o*Math.sin(s),t.sphip*o*i-t.cphip*r),e.y=Math.asin(t.sphip*r+t.cphip*o*i)}return e.x=ix(e.x+t.long0),e}function Ob(t,e){t.isIdentity&&(e.x*=Qy,e.y*=Qy);const i=t.obliqueProjection.inverse(e);let{x:s,y:n}=i;if(s<Number.MAX_VALUE){const i=Math.cos(n);s-=t.lamp,e.x=Math.atan2(i*Math.sin(s),-1*Math.sin(n)),e.y=Math.asin(i*Math.cos(s))}return e.x=ix(e.x+t.long0),e}var Gb=["General Oblique Transformation","General_Oblique_Transformation","ob_tran"],kb={init:bb,forward:Pb,inverse:Rb,names:Gb};function Nb(t){t.Proj.projections.add(gE),t.Proj.projections.add(bE),t.Proj.projections.add(AE),t.Proj.projections.add(WE),t.Proj.projections.add(HE),t.Proj.projections.add(tM),t.Proj.projections.add(aM),t.Proj.projections.add(dM),t.Proj.projections.add(mM),t.Proj.projections.add(TM),t.Proj.projections.add(KM),t.Proj.projections.add(eS),t.Proj.projections.add(oS),t.Proj.projections.add(dS),t.Proj.projections.add(mS),t.Proj.projections.add(MS),t.Proj.projections.add(IS),t.Proj.projections.add(GS),t.Proj.projections.add(zS),t.Proj.projections.add(VS),t.Proj.projections.add($S),t.Proj.projections.add(eC),t.Proj.projections.add(oC),t.Proj.projections.add(gC),t.Proj.projections.add(yC),t.Proj.projections.add(PC),t.Proj.projections.add(BC),t.Proj.projections.add(YC),t.Proj.projections.add(tb),t.Proj.projections.add(rb),t.Proj.projections.add(pb),t.Proj.projections.add(Mb),t.Proj.projections.add(kb)}const Fb=Object.assign(vw,{defaultDatum:"WGS84",Proj:Hx,WGS84:new Hx("WGS84"),Point:qw,toPoint:lw,defs:Wv,nadgrid:Gx,transform:fw,mgrs:Rw,version:"__VERSION__"});Nb(Fb);var Db=Fb;let jb=null;function zb(t){jb=t;const e=Object.keys(t.defs),i=e.length;let s,n;for(s=0;s<i;++s){const i=e[s];if(!er(i)){const e=t.defs(i);let s=e.units;s||"longlat"!==e.projName||(s="degrees"),qr(new jn({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:s}))}}for(s=0;s<i;++s){const r=e[s],o=er(r);for(n=0;n<i;++n){const i=e[n],s=er(i);if(o&&s&&!rr(r,i))if(t.defs(r)===t.defs(i))$r([o,s]);else{const e=t(r,i);to(o,s,mo(o,s,e.forward),mo(s,o,e.inverse))}}}}zb(Db);var Ub={name:"mapView",props:{theme:{type:String,default:"light"},dataCrs:{type:String,default:"EPSG:3857"},zoom:{type:Number,default:4.2},hidePanels:{type:Boolean,default:!1},width:{type:[String,Number],default:null},height:{type:[String,Number],default:null},mapBackground:{type:String,default:null},autoLoad:{type:Object,default:null}},data(){return{viewerReady:!1,sidebarWidth:342,loadingTasks:0,olLoading:!1,dropVisible:!1,sourceCategory:"raster",currentTab:"image",loadDialogVisible:!1,sidebarCollapsed:!1,panelRightCollapsed:!1,isLight:!1,themeIcon:"☀️",themeTitle:"切换到深色主题",statusInfo:"",toastText:"",toastType:"info",toastVisible:!1,mapInfo:{active:!1,name:"",kind:"",dataCrs:"",extent:"未知"},mapListItems:[],layerListVisible:!1,layerListHint:"",layerTotal:0,layerFeatureTotal:0,layerListItems:[],crsOptions:{dataCrs:[],viewCrs:[],urlExtentCrs:[]},customCrsOptions:[],mapExtent:{minx:"",miny:"",maxx:"",maxy:""},viewExtent:{minx:"",miny:"",maxx:"",maxy:""},form:{dataCrs:this.dataCrs,viewCrs:"EPSG:3857",urlExtentCrs:this.dataCrs,imgFileName:"未选择文件",worldFileName:"未选择文件",zoneHint:{message:"",options:[]},tilesDirName:"未选择目录",tilesInfo:"支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。",tilesTms:!1,geojsonDirName:"未选择目录",geojsonInfo:"支持按文件名配对的 .geojson 与 .sld。",geojsonCrsHint:"未选择 GeoJSON。",geojsonCrsOptions:[],urlTemplate:"",urlInfo:"",urlMinzoom:"",urlMaxzoom:"",customEpsg:""}}},computed:{viewerStyle(){const t=t=>null==t||""===t?null:"number"===typeof t?t+"px":String(t),e={},i=t(this.width),s=t(this.height);return i&&(e.width=i),s&&(e.height=s),e["--sidebar-width"]=this.sidebarWidth+"px",this.mapBackground&&(e["--map-bg"]=this.mapBackground),e},mapLoading(){return this.loadingTasks>0||this.olLoading}},mounted(){this.initViewer(),this.processAutoLoad().catch(t=>{console.error("[autoLoad] 自动加载失败:",t),this.toast("自动加载失败:"+t.message,"err")}),this.hidePanels&&(this.collapseSidebar(),this.collapsePanelRight())},beforeDestroy(){this.destroyViewer()},methods:{initViewer(){if(this.viewerReady)return;this.map=null,this.viewerAbortController=new AbortController,this.PIXEL=new jn({code:"PIXEL",units:"pixels"}),qr(this.PIXEL),this.CRS_GROUPS=[],this.addGroup("常用",[{code:"EPSG:3857",name:"EPSG:3857 · WGS84 伪墨卡托(网络地图)"},{code:"EPSG:4326",name:"EPSG:4326 · WGS84 经纬度"},{code:"EPSG:4490",name:"EPSG:4490 · CGCS2000 经纬度(2000国家大地坐标系)",def:"+proj=longlat +ellps=GRS80 +no_defs"},{code:"PIXEL",name:"像素坐标(未配准图片)",pixel:!0}]);const t=[],e=[],i=[],s=[];for(let o=25;o<=45;o++){const e=3*o;t.push({code:"EPSG:"+(4513+o-25),name:`EPSG:${4513+o-25} · CGCS2000 3度带 ${o}(CM ${e}°E)`,def:this.gkDef(e,5e5+1e6*o),geoBox:[e-1.5,16,e+1.5,56]})}for(let o=13;o<=23;o++){const t=6*o-3;i.push({code:"EPSG:"+(4491+o-13),name:`EPSG:${4491+o-13} · CGCS2000 6度带 ${o}(CM ${t}°E)`,def:this.gkDef(t,5e5+1e6*o),geoBox:[t-3,16,t+3,56]})}this.addGroup("CGCS2000 3度带(含带号)",t),this.addGroup("CGCS2000 3度带(中央经线)",e),this.addGroup("CGCS2000 6度带(含带号)",i),this.addGroup("CGCS2000 6度带(中央经线)",s);const n=[],r=[];for(let o=1;o<=60;o++){const t=6*o-183;n.push({code:`EPSG:${32600+o}`,name:`EPSG:${32600+o} · WGS84 / UTM ${o}N(CM ${t}°E)`,def:`+proj=utm +zone=${o} +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]}),r.push({code:`EPSG:${32700+o}`,name:`EPSG:${32700+o} · WGS84 / UTM ${o}S(CM ${t}°E)`,def:`+proj=utm +zone=${o} +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs`,geoBox:[t-3,-80,t+3,84]})}this.addGroup("UTM 北半球",n),this.addGroup("UTM 南半球",r),this.presetByCode=new Map;for(const o of this.CRS_GROUPS)for(const t of o.items)this.presetByCode.set(t.code,t);this.customPresets=[],this.map=new jg({target:"map",layers:[],view:new eh({projection:this.form.viewCrs,center:eo([108.5,36.5],this.form.viewCrs),zoom:this.zoom}),controls:[new Ah({zoomInTipLabel:"放大",zoomOutTipLabel:"缩小"}),new Ry({tipLabel:"全屏"}),new Oy({units:"metric",target:this.$refs.statusScale}),new Fy({coordinateFormat:t=>this.formatCoord(t),undefinedHTML:"—",target:this.$refs.statusCoords}),this.createFitAllControl()]}),this.attachViewListener(),this.map.on("moveend",()=>{this.updateStatus(),this.$emit("view-changed",this.getViewState())}),this.map.on("loadstart",()=>{this.olLoading=!0}),this.map.on("loadend",()=>{this.olLoading=!1}),this.toastTimer=null,this.mapEntries=[],this.activeEntry=null,this.entrySeq=0,this.KIND_LABELS={image:"图片",tiles:"本地切片XYZ",xyz:"在线切片XYZ",geojson:"GeoJSON / SLD"},this.TILE_PATH_RE=/(\d+)[\\/](\d+)[\\/](\d+)\.(png|jpe?g|webp)$/i,this.pickedImage=null,this.pickedWorldFile=null,this.pickedTiles=null,this.VECTOR_COLORS=["#3f8cff","#39c26d","#e8b339","#e8718d","#9b6fd8","#31b8b5","#f28f3b","#729b6f"],this.GEOJSON_FILE_RE=/\.(geojson|json)$/i,this.SLD_FILE_RE=/\.(sld|xml)$/i,this.pickedGeoJson=null,this.geoJsonCrsDetectionSeq=0,this.currentTab="image",this.$refs.imgFile.addEventListener("change",()=>{const t=this.$refs.imgFile.files&&this.$refs.imgFile.files[0];t&&this.onImageFileChosen(t)}),this.$refs.worldFile.addEventListener("change",async()=>{const t=this.$refs.worldFile.files&&this.$refs.worldFile.files[0];if(t)try{const e=await t.text();this.pickedWorldFile={text:e,name:t.name},this.form.worldFileName=t.name,this.applyWorldFileToExtent()}catch{this.toast("世界文件读取失败","err")}}),this.$refs.tilesDir.addEventListener("change",()=>this.onTilesDirChosen(this.$refs.tilesDir.files)),this.$refs.geojsonDir.addEventListener("change",()=>this.onGeoJsonDirChosen(this.$refs.geojsonDir.files)),this.applyTheme(this.theme),["dragenter","dragover"].forEach(t=>document.addEventListener(t,t=>{t.preventDefault(),t.dataTransfer&&[...t.dataTransfer.types].includes("Files")&&(this.dropVisible=!0)},{signal:this.viewerAbortController.signal})),document.addEventListener("dragleave",t=>{t.relatedTarget||(this.dropVisible=!1)},{signal:this.viewerAbortController.signal}),document.addEventListener("drop",async t=>{t.preventDefault(),this.dropVisible=!1;const e=await this.filesFromDataTransfer(t.dataTransfer);if(!e.length)return;if(e.some(t=>this.GEOJSON_FILE_RE.test(t.name)||this.SLD_FILE_RE.test(t.name)))return this.onGeoJsonDirChosen(e),this.setActiveTab("geojson"),void await this.loadGeoJsonLayers();const i=e.find(t=>/\.(png|jpe?g|webp)$/i.test(t.name));if(!i)return void this.toast("请拖放图片或 GeoJSON/SLD","warn");const s=e.find(t=>/\.(pgw|pwg|jgw|gfw|wld|pngw|jpgw)$/i.test(t.name));if(await this.onImageFileChosen(i),s)try{this.pickedWorldFile={text:await s.text(),name:s.name},this.form.worldFileName=s.name,this.applyWorldFileToExtent()}catch{}this.setActiveTab("image"),this.toast("图片已就绪,点击“加载到地图”","ok")},{signal:this.viewerAbortController.signal}),this.refillCrsSelects(),this.form.viewCrs="EPSG:3857",(async()=>{const t=new URLSearchParams(location.search),e=this.normalizeEpsg(t.get("epsg"));e&&this.ensureProjection(e)&&(this.form.dataCrs=e);const i=t.get("xyz"),s=t.get("img");if(i){this.form.urlTemplate=i,t.get("minzoom")&&(this.form.urlMinzoom=t.get("minzoom")),t.get("maxzoom")&&(this.form.urlMaxzoom=t.get("maxzoom"));const e=(t.get("extent")||"").split(",").map(t=>parseFloat(t.trim()));4===e.length&&e.every(Number.isFinite)&&(this.$refs.urlExtMinx.value=e[0],this.$refs.urlExtMiny.value=e[1],this.$refs.urlExtMaxx.value=e[2],this.$refs.urlExtMaxy.value=e[3]);const s=this.normalizeEpsg(t.get("extentepsg"));s&&(this.form.urlExtentCrs=s),this.setActiveTab("url"),this.loadUrlLayer()}else if(s){this.setActiveTab("image");let e=null;const i=t.get("worldfile");if(i)try{const t=await fetch(i);t.ok&&(e=await t.text())}catch{}let n=null;const r=t.get("extent");if(r){const t=r.split(",").map(Number);4===t.length&&t.every(isFinite)&&(n=t)}await this.addImageFromUrl({url:s,name:decodeURIComponent(s.split("/").pop()||"图片"),worldText:e,extent:n})}})(),this.updateStatus(),this.updateUrlTemplateHint(),this.viewerReady=!0},pushLoading(){this.loadingTasks+=1},popLoading(){this.loadingTasks=Math.max(0,this.loadingTasks-1)},startSidebarResize(t){t.preventDefault();const e=t.clientX,i=this.sidebarWidth,s=t=>{this.sidebarWidth=Math.min(620,Math.max(280,i+(t.clientX-e)))},n=()=>{window.removeEventListener("mousemove",s),window.removeEventListener("mouseup",n),document.body.style.cursor="",document.body.style.userSelect=""};document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",s),window.addEventListener("mouseup",n)},collapseSidebar(){this.$refs.mapViewer.classList.add("sidebar-collapsed")},expandSidebar(){this.$refs.mapViewer.classList.remove("sidebar-collapsed")},collapsePanelRight(){this.$refs.mapViewer.classList.add("panel-right-collapsed")},expandPanelRight(){this.$refs.mapViewer.classList.remove("panel-right-collapsed")},toggleTheme(){this.applyTheme(this.$refs.mapViewer.classList.contains("light-theme")?"dark":"light")},async loadToMap(){const t=this.mapEntries.length;"image"===this.currentTab?await this.loadImageLayer():"tiles"===this.currentTab?this.loadTilesLayer():"geojson"===this.currentTab?await this.loadGeoJsonForCurrentSource():await this.loadUrlLayer(),this.mapEntries.length>t&&this.closeLoadDialog()},destroyViewer(){this.viewerAbortController&&(this.viewerAbortController.abort(),this.viewerAbortController=null),this.map&&(this.map.setTarget(null),this.map=null),this.viewerReady=!1},createFitAllControl(){const t=document.createElement("button");t.innerHTML="⤢",t.title="复位视图";const e=document.createElement("div");return e.className="ol-fit-all ol-control",e.appendChild(t),t.addEventListener("click",()=>this.fitActiveMap()),new Ch({element:e})},gkDef(t,e){return`+proj=tmerc +lat_0=0 +lon_0=${t} +k=1 +x_0=${e} +y_0=0 +ellps=GRS80 +units=m +no_defs`},addGroup(t,e){this.CRS_GROUPS.push({label:t,items:e})},buildCrsOptionGroups(t){const e=this.CRS_GROUPS.map(e=>({label:e.label,items:e.items.filter(e=>t||!e.pixel)})).filter(t=>t.items.length),i=this.customPresets.map(t=>({code:t.code,name:`${t.code} · 自定义`}));return{groups:e,custom:i}},refillCrsSelects(){const t=this.buildCrsOptionGroups(!0),e=this.buildCrsOptionGroups(!1);this.crsOptions.dataCrs=t.groups,this.crsOptions.viewCrs=e.groups,this.crsOptions.urlExtentCrs=e.groups,this.customCrsOptions=t.custom,this.form.urlExtentCrs||(this.form.urlExtentCrs="EPSG:3857")},ensureProjection(t){if(!t)return null;if("PIXEL"===t)return this.PIXEL;let e=Kr(t);if(e)return e;const i=this.presetByCode.get(t)||this.customPresets.find(e=>e.code===t);if(!i||!i.def)return null;if(Db.defs(t,i.def),zb(Db),e=Kr(t),e&&i.geoBox&&!e.getExtent())try{const s=ho(i.geoBox,"EPSG:4326",t);s.every(isFinite)&&e.setExtent(s)}catch{}return e},formatCoord(t){const e=this.map.getView();if(!e||!t)return"";const i=e.getProjection(),s="degrees"===i.getUnits(),n=t.map(t=>s?t.toFixed(6):t.toFixed(2)).join(", ");if("PIXEL"===i.getCode())return`${n} px`;try{const e=io(t,i);return isFinite(e[0])&&isFinite(e[1])?`${n} | ${e[0].toFixed(6)}, ${e[1].toFixed(6)}°`:n}catch{return n}},attachViewListener(){this.map.getView().on("change:resolution",()=>this.updateStatus())},fmtRes(t){return isFinite(t)?t>=1e3?t.toFixed(0):t>=1?t.toPrecision(4):t.toExponential(1):"-"},updateStatus(){const t=this.map&&this.map.getView();if(!t)return;const e=t.getZoom(),i=t.getResolution(),s=t.getProjection(),n="degrees"===s.getUnits()?"°/px":"PIXEL"===s.getCode()?"px":"m/px";this.statusInfo=`${s.getCode()} · 级别 ${null==e?"-":e.toFixed(1)} · 分辨率 ${this.fmtRes(i)} ${n}`,this.updateViewExtent(),this.updateMapExtent()},updateMapExtent(){const t=this.map&&this.map.getView(),e=t?t.getProjection():null;if(!this.activeEntry||!this.activeEntry.extent||!e)return void(this.mapExtent={minx:"",miny:"",maxx:"",maxy:""});let i=this.activeEntry.extent;if(this.activeEntry.projection.getCode()!==e.getCode()){try{i=ho(i,this.activeEntry.projection,e)}catch{i=null}if(!i||!i.every(isFinite))return void(this.mapExtent={minx:"",miny:"",maxx:"",maxy:""})}this.mapExtent={minx:this.fmtExtentInput(i[0]),miny:this.fmtExtentInput(i[1]),maxx:this.fmtExtentInput(i[2]),maxy:this.fmtExtentInput(i[3])}},updateViewExtent(){const t=this.map&&this.map.getView(),e=this.map&&this.map.getSize();if(!t||!e||!this.activeEntry||null==t.getResolution())return void(this.viewExtent={minx:"",miny:"",maxx:"",maxy:""});const i=t.calculateExtent(e);i&&i.every(isFinite)?this.viewExtent={minx:this.fmtExtentInput(i[0]),miny:this.fmtExtentInput(i[1]),maxx:this.fmtExtentInput(i[2]),maxy:this.fmtExtentInput(i[3])}:this.viewExtent={minx:"",miny:"",maxx:"",maxy:""}},fmtExtentInput(t){return isFinite(t)?String(+(Math.abs(t)>=1e3?t.toFixed(2):t.toFixed(6))):""},toast(t,e="info"){this.toastText=t,this.toastType=e,this.toastVisible=!0,clearTimeout(this.toastTimer),this.toastTimer=setTimeout(()=>{this.toastVisible=!1},3200)},kindIcon(t){return{image:"🖼️",tiles:"🧩",xyz:"🌐",geojson:"🌍"}[t]||"🗺️"},selectAndFitMap(t){this.selectMapEntry(t),this.activeEntry===t&&this.fitToExtent(t.extent,t.projection)},renderMapList(){this.mapListItems=this.mapEntries.map(t=>({id:t.id,entry:t,active:t===this.activeEntry,icon:this.kindIcon(t.kind),name:t.name,meta:`${t.projection.getCode()} · ${t.viewProjectionCode}`}))},renderMapInfo(){if(this.renderLayerList(),!this.activeEntry)return void(this.mapInfo.active=!1);const t=this.activeEntry,e=t.projection.getCode();this.mapInfo={active:!0,name:t.name,kind:`${this.kindIcon(t.kind)} ${this.KIND_LABELS[t.kind]||"地图"}`,dataCrs:t.sourceCrs&&t.sourceCrs!==e?`${e}(源:${t.sourceCrs})`:e,extent:t.extent?`X ${this.fmtExtentNum(t.extent[0])} ~ ${this.fmtExtentNum(t.extent[2])};Y ${this.fmtExtentNum(t.extent[1])} ~ ${this.fmtExtentNum(t.extent[3])}`:"未知"}},inferGeoJsonGroup(t){for(const e of t){const t=e.get("layer"),i="string"===typeof t?t.trim():"";if(i)return i}return null},buildLayerGroups(t){const e=[];let i=0;while(i<t.length){const s=t[i];if(!s.group){e.push({type:"layer",sublayer:s}),i+=1;continue}const n=i,r=[];while(i<t.length&&t[i].group===s.group)r.push(t[i]),i+=1;e.push({type:"group",key:`${n}:${s.group}`,name:s.group,children:r})}return e},isLayerEffectivelyVisible(t){return t.visible&&!1!==t.groupVisible},renderLayerList(){if(this.activeEntry&&"image"===this.activeEntry.kind)return this.layerListHint="PNG 格式地图无可操作图层",this.layerListVisible=!0,this.layerListItems=[],this.layerTotal=0,void(this.layerFeatureTotal=0);this.layerListHint="";const t=this.activeEntry&&this.activeEntry.sublayers?this.activeEntry.sublayers:[];this.layerTotal=t.length,this.layerFeatureTotal=t.reduce((t,e)=>t+(Number.isFinite(e.featureCount)?e.featureCount:0),0);const e=Boolean(t.length);if(this.layerListVisible=e,!e)return void(this.layerListItems=[]);const i=this.buildLayerGroups(this.activeEntry.sublayers).reverse();this.layerListItems=i.map((t,e)=>{if("layer"===t.type){const i=t.sublayer,s=this.isLayerEffectivelyVisible(i);return{type:"layer",key:`layer-${e}`,name:i.name,meta:`${this.kindIcon(i.kind)} ${this.KIND_LABELS[i.kind]||"图层"}${Number.isFinite(i.featureCount)?` · ${i.featureCount} 要素`:""}`,visible:s,sublayer:i}}const i=t.children.map((t,i)=>({key:`child-${e}-${i}`,name:t.name,meta:`${this.kindIcon(t.kind)} ${this.KIND_LABELS[t.kind]||"图层"}${Number.isFinite(t.featureCount)?` · ${t.featureCount} 要素`:""}`,visible:this.isLayerEffectivelyVisible(t),sublayer:t}));return{type:"group",key:`group-${t.key}-${e}`,name:t.name,collapsed:!this.activeEntry.expandedLayerGroups.has(t.key),visible:i.every(t=>!1!==t.sublayer.groupVisible),group:t,children:i}})},toggleLayerVisible(t){const e=t.sublayer;t.visible?(e.visible=!1,e.layer.setVisible(!1)):(e.visible=!0,e.layer.setVisible(!0)),this.renderLayerList()},toggleLayerGroupExpanded(t){t.collapsed?this.activeEntry.expandedLayerGroups.add(t.group.key):this.activeEntry.expandedLayerGroups.delete(t.group.key),this.renderLayerList()},toggleLayerGroupVisible(t){const e=!t.visible;t.children.forEach(t=>{t.sublayer.groupVisible=e,t.sublayer.layer.setVisible(e&&t.sublayer.visible)}),this.renderLayerList()},toggleLayerChildVisible(t,e){const i=e.sublayer;e.visible?(i.visible=!1,i.layer.setVisible(!1)):(i.visible=!0,t.children.forEach(t=>{t.sublayer.groupVisible=!0,t.sublayer.layer.setVisible(t.sublayer.visible)})),this.renderLayerList()},getVectorSourceExtent(t){if(!t||"geojson"!==t.kind)return null;try{const e=t.source||t.layer.getSource(),i=e&&"function"===typeof e.getExtent?e.getExtent():null;if(Array.isArray(i)&&i.every(isFinite)&&i[2]>i[0]&&i[3]>i[1])return i.slice()}catch(e){}return null},zoomToLayer(t){const e=this.activeEntry,i=t&&t.sublayer;if(!e||!i)return;const s=this.getVectorSourceExtent(i);s?this.fitToExtent(s,this.map.getView().getProjection()):Array.isArray(e.extent)&&e.extent.every(isFinite)&&e.extent[2]>e.extent[0]&&e.extent[3]>e.extent[1]?this.fitToExtent(e.extent,e.projection):this.toast("该图层暂无有效范围","warn")},zoomToLayerGroup(t){const e=this.activeEntry;if(!e||!t||!Array.isArray(t.children)||!t.children.length)return;const i=Ws();let s=!1;t.children.forEach(t=>{const e=this.getVectorSourceExtent(t.sublayer);e&&(Hs(i,e),s=!0)}),s&&i.every(isFinite)&&i[2]>i[0]&&i[3]>i[1]?this.fitToExtent(i,this.map.getView().getProjection()):this.fitToExtent(e.extent,e.projection)},removeSublayerInternal(t){const e=this.activeEntry;if(!e||!t)return!1;const i=e.sublayers.indexOf(t);if(i<0)return!1;if(e.sublayers.splice(i,1),Array.isArray(e.sources)){const i=e.sources.indexOf(t.source);i>=0&&e.sources.splice(i,1)}if(e.layer&&"function"===typeof e.layer.getLayers){e.layer.getLayers().remove(t.layer);try{t.layer.dispose()}catch(s){}}return!0},afterLayersRemoved(t){const e=this.activeEntry;if(e&&!e.sublayers.length)return this.deleteMapEntry(e),void(t&&this.toast(t,"ok"));this.renderMapList(),this.renderMapInfo(),t&&this.toast(t,"ok")},removeLayerItem(t){const e=t&&t.sublayer;e&&this.removeSublayerInternal(e)&&(this.$emit("layer-removed",{isGroup:!1,name:e.name,layerCount:null,group:e.group}),console.log("row",t),this.afterLayersRemoved("已删除图层:"+e.name))},removeLayerGroup(t){if(!t||!Array.isArray(t.children)||!t.children.length)return;const e=t.children.length;t.children.forEach(t=>this.removeSublayerInternal(t.sublayer)),console.log("row",t),this.$emit("layer-removed",{isGroup:!0,name:t.name,layerCount:e,group:null}),this.afterLayersRemoved("已删除图层组("+e+" 个图层)")},normalizeSublayers(t){Array.isArray(t.sublayers)||(t.sublayers=[{name:t.name,kind:t.kind,layer:t.layer,visible:!0}]);for(const e of t.sublayers)e.name=e.name||t.name,e.kind=e.kind||t.kind,e.group=e.group||null,e.groupVisible=!e.group||!1!==e.groupVisible,e.visible=!1!==e.visible,e.layer.setVisible(this.isLayerEffectivelyVisible(e)),e.layer.set("title",e.name);return t.sublayers},saveActiveViewState(){if(!this.activeEntry)return;const t=this.map.getView();this.activeEntry.viewState={center:t.getCenter(),resolution:t.getResolution()},this.activeEntry.viewProjectionCode=t.getProjection().getCode()},selectMapEntry(t){if(!t||t===this.activeEntry)return;this.saveActiveViewState(),this.activeEntry&&this.map.removeLayer(this.activeEntry.layer),this.activeEntry=t,this.map.addLayer(t.layer);const e=this.ensureProjection(t.viewProjectionCode)||t.projection,i=t.viewState;i&&i.center&&i.center.every(isFinite)?this.setViewProjection(e,{center:i.center,resolution:i.resolution}):(this.setViewProjection(e),this.fitToExtent(t.extent,t.projection)),this.renderMapList(),this.updateStatus(),this.renderMapInfo(),this.$emit("active-map-changed",{id:t.id,name:t.name,kind:t.kind})},addMapEntry(t){t.id=++this.entrySeq,t.expandedLayerGroups=new Set,t.sublayers=this.normalizeSublayers(t),t.layer.set("title",t.name),t.viewProjectionCode=t.projection.getCode(),t.viewState=null,this.mapEntries.unshift(t),this.selectMapEntry(t)},deleteMapEntry(t){const e=this.mapEntries.indexOf(t);e>=0&&this.mapEntries.splice(e,1),this.activeEntry===t?(this.map.removeLayer(t.layer),this.activeEntry=null,this.mapEntries.length?this.selectMapEntry(this.mapEntries[0]):(this.renderMapList(),this.renderMapInfo(),this.updateStatus())):this.renderMapList();try{t.cleanup&&t.cleanup()}catch{}this.$emit("map-removed",{id:t.id,name:t.name,kind:t.kind})},fitActiveMap(){this.activeEntry?this.fitToExtent(this.activeEntry.extent,this.activeEntry.projection):this.toast("暂无地图","warn")},fitToExtent(t,e){const i=this.map.getView(),s=i.getProjection();let n=t;if(e&&e.getCode()!==s.getCode()){try{n=ho(t,e,s)}catch{n=null}if(!n||!n.every(isFinite))return void this.toast("无法将数据范围转换到当前视图坐标系","warn")}!n||n[2]<=n[0]||n[3]<=n[1]||i.fit(n,{padding:[60,60,60,60],maxZoom:28,duration:300})},syncViewCrsSelect(){this.form.viewCrs=this.map.getView().getProjection().getCode()},computeViewTransition(t){const e=this.map.getView(),i=e.getProjection(),s=e.getCenter(),n=e.getResolution();let r=null,o=null;try{r=ao(s,i,t);const e=Hr(i,1,s,"m"),a=Hr(t,1,r,"m");r.every(isFinite)&&[e,a].every(isFinite)&&a>0?o=n*e/a:r=null}catch{r=null}return{center:r,resolution:o}},setViewProjection(t,{center:e,resolution:i}={}){const s=new eh({projection:t});if(this.map.setView(s),e&&e.every(isFinite))s.setCenter(e);else{const e=t.getExtent();e?s.setCenter([(e[0]+e[2])/2,(e[1]+e[3])/2]):s.setCenter([0,0])}if(i&&isFinite(i)&&i>0)try{s.setResolution(i)}catch{}this.attachViewListener(),this.syncViewCrsSelect(),this.activeEntry&&Array.isArray(this.activeEntry.sources)&&this.activeEntry.sources.forEach(t=>t.refresh()),this.updateStatus()},worldSquareExtent(t){let e=t.getExtent();if(!e||!e.every(isFinite))try{e=ho([-180,-90,180,90],"EPSG:4326",t)}catch{e=[-1,-1,1,1]}const i=e[2]-e[0],s=e[3]-e[1],n=Math.max(i,s),r=(e[0]+e[2])/2,o=(e[1]+e[3])/2;return[r-n/2,o-n/2,r+n/2,o+n/2]},buildTileGrid(t,e,i=0,s=null){const n=this.worldSquareExtent(t),r=(n[2]-n[0])/256,o=[];for(let a=0;a<=e;a++)o.push(r/Math.pow(2,a));return new U_({extent:s||n,origin:[n[0],n[3]],resolutions:o,tileSize:[256,256],minZoom:i,maxZoom:e})},tilesExtent(t,e){const i=t.getResolution(e.minZ),[s,n]=t.getOrigin(e.minZ);return[s+256*e.x0*i,n-256*(e.y1+1)*i,s+256*(e.x1+1)*i,n-256*e.y0*i]},fmtExtentNum(t){return isFinite(t)?Math.abs(t)>=1e3?Math.round(t).toLocaleString("zh-CN"):String(+t.toFixed(6)):"-"},extentText(t){return`X ${this.fmtExtentNum(t[0])} ~ ${this.fmtExtentNum(t[2])};Y ${this.fmtExtentNum(t[1])} ~ ${this.fmtExtentNum(t[3])}`},extentFromTileMap(t,e){const i=this.ensureProjection(e);if(!i||"PIXEL"===i.getCode())return null;const s=this.tileStats(t);if(!s)return null;const n=this.buildTileGrid(i,s.maxZ,s.minZ);return this.tilesExtent(n,s)},scanTileFiles(t,e){const i=new Map;for(const s of t){const t=s.webkitRelativePath||s.name,n=t.match(this.TILE_PATH_RE);if(!n)continue;let r=+n[1],o=+n[2],a=+n[3];e&&(a=(1<<r)-1-a),i.set(`${r}/${o}/${a}`,s)}return i},tileStats(t){if(!t.size)return null;let e=1/0,i=-1/0;const s=new Map;for(const n of t.keys()){const[t,r,o]=n.split("/").map(Number);t<e&&(e=t),t>i&&(i=t);let a=s.get(t);a||(a={x0:1/0,x1:-1/0,y0:1/0,y1:-1/0},s.set(t,a)),a.x0=Math.min(a.x0,r),a.x1=Math.max(a.x1,r),a.y0=Math.min(a.y0,o),a.y1=Math.max(a.y1,o)}return{minZ:e,maxZ:i,...s.get(e),ranges:s}},clampInt(t,e,i,s){const n=parseInt(t,10);return Number.isFinite(n)?Math.min(i,Math.max(e,n)):s},getImageSize(t){return new Promise((e,i)=>{const s=new Image;s.onload=()=>e({width:s.naturalWidth,height:s.naturalHeight}),s.onerror=()=>i(new Error("图片加载失败")),s.src=t})},parseWorldFile(t){const e=t.trim().split(/\r?\n/).map(t=>parseFloat(t.trim()));if(e.length<6||e.slice(0,6).some(t=>!isFinite(t)))throw new Error("世界文件格式无法解析");return e.slice(0,6)},extentFromWorldFile(t,e,i){const[s,n,r,o,a,h]=i;if(n||r)throw new Error("不支持带旋转的世界文件");return[a-s/2,h+(e-.5)*o,a+(t-.5)*s,h-o/2]},guessCrsFromExtent(t){if(!t)return null;const e=t[2];if(e<=1e6||e>=7e7)return null;const i=Math.round(e/1e6),s=[];return i>=25&&i<=45&&s.push({code:"EPSG:"+(4513+i-25),label:`3度带 ${i},中央经线 ${3*i}°E(EPSG:${4513+i-25},含带号)`}),i>=13&&i<=23&&s.push({code:"EPSG:"+(4491+i-13),label:`6度带 ${i},中央经线 ${6*i-3}°E(EPSG:${4491+i-13},含带号)`}),s.length?(this.form.zoneHint={message:"检测到高斯带号坐标,可能是:",options:s},s[0].code):null},updateZoneHint(t){if(this.form.zoneHint={message:"",options:[]},!t)return;const e=this.guessCrsFromExtent(t);e&&(this.form.dataCrs=e)},applyWorldFileToExtent(){if(this.pickedImage&&this.pickedImage.width&&this.pickedWorldFile)try{const t=this.parseWorldFile(this.pickedWorldFile.text),e=this.extentFromWorldFile(this.pickedImage.width,this.pickedImage.height,t);this.$refs.extMinx.value=e[0],this.$refs.extMiny.value=e[1],this.$refs.extMaxx.value=e[2],this.$refs.extMaxy.value=e[3],this.updateZoneHint(e),this.toast("已根据世界文件计算显示范围","ok")}catch(t){this.toast(`世界文件解析失败:${t.message}`,"err")}},async onImageFileChosen(t){this.pickedImage&&this.pickedImage.objectUrl&&URL.revokeObjectURL(this.pickedImage.objectUrl);const e=URL.createObjectURL(t);this.pickedImage={file:t,objectUrl:e,name:t.name,width:null,height:null},this.form.imgFileName=t.name,this.$refs.extMinx.value=this.$refs.extMiny.value=this.$refs.extMaxx.value=this.$refs.extMaxy.value="",this.updateZoneHint(null);try{const t=await this.getImageSize(e);this.pickedImage.width=t.width,this.pickedImage.height=t.height,this.applyWorldFileToExtent()}catch{this.toast("图片无法读取","err")}},readExtentInputs(){const t=[this.$refs.extMinx,this.$refs.extMiny,this.$refs.extMaxx,this.$refs.extMaxy].map(t=>t.value.trim());if(t.some(t=>""===t))return this.toast("请填写完整的四至范围:X/Y 的最小值和最大值","warn"),{ok:!1,extent:null};const e=t.map(Number);return e.some(t=>!isFinite(t))?(this.toast("范围数值无效","warn"),{ok:!1,extent:null}):e[2]>e[0]&&e[3]>e[1]?{ok:!0,extent:e}:(this.toast("范围无效:需要 X最大 > X最小 且 Y最大 > Y最小","warn"),{ok:!1,extent:null})},async loadImageLayer(){this.pushLoading();try{if(!this.pickedImage)return void this.toast("请先选择图片文件","warn");const t=this.ensureProjection(this.form.dataCrs);if(!t)return void this.toast("请先选择或注册有效的坐标系","warn");let{width:e,height:i}=this.pickedImage;if(!e||!i)try{const t=await this.getImageSize(this.pickedImage.objectUrl);e=this.pickedImage.width=t.width,i=this.pickedImage.height=t.height}catch{return void this.toast("无法读取图片尺寸","err")}const s=this.readExtentInputs();if(!s.ok)return;const n=s.extent,r=URL.createObjectURL(this.pickedImage.file),o=new ef({source:new F_({url:r,imageExtent:n,projection:t})});this.addMapEntry({name:this.pickedImage.name,kind:"image",layer:o,extent:n,projection:t,cleanup(){URL.revokeObjectURL(r)}})}finally{this.popLoading()}},async addImageFromUrl({url:t,name:e,worldText:i,extent:s,crs:n=null}){this.pushLoading();try{let o;try{o=await this.getImageSize(t)}catch{return void this.toast(`无法加载图片:${t}`,"err")}if(i)try{const t=this.parseWorldFile(i);s=this.extentFromWorldFile(o.width,o.height,t)}catch(r){this.toast(`世界文件解析失败:${r.message}`,"err")}s=s||[0,-o.height,o.width,0],this.updateZoneHint(s);const a=n||this.guessCrsFromExtent(s)||"EPSG:3857";this.form.dataCrs=a;const h=this.ensureProjection(a)||this.PIXEL,l=new ef({source:new F_({url:t,imageExtent:s,projection:h})});this.$refs.extMinx.value=s[0],this.$refs.extMiny.value=s[1],this.$refs.extMaxx.value=s[2],this.$refs.extMaxy.value=s[3],this.addMapEntry({name:e,kind:"image",layer:l,extent:s,projection:h,cleanup(){}})}finally{this.popLoading()}},onTilesDirChosen(t){const e=Array.from(t||[]);if(!e.length)return;const i=(e[0].webkitRelativePath||"").split(/[\\/]/)[0]||"本地切片XYZ目录";this.pickedTiles={name:i,files:e},this.form.tilesDirName=`${i}(${e.length} 个文件)`,this.updateTilesInfo()},updateTilesInfo(){if(!this.pickedTiles)return;const t=this.scanTileFiles(this.pickedTiles.files,this.form.tilesTms),e=this.tileStats(t);if(!e)return void(this.form.tilesInfo="未识别到本地切片XYZ(需要 z/x/y.png 目录结构)");const i=this.extentFromTileMap(t,this.form.dataCrs);this.form.tilesInfo=i?`已识别 ${t.size} 张切片,层级 ${e.minZ}–${e.maxZ}。显示范围(${this.form.dataCrs}):${this.extentText(i)}`:`已识别 ${t.size} 张切片,层级 ${e.minZ}–${e.maxZ}。`},loadTilesLayer(){this.pushLoading();try{if(!this.pickedTiles||!this.pickedTiles.files.length)return void this.toast("请先选择本地切片XYZ目录","warn");const t=this.ensureProjection(this.form.dataCrs);if(!t)return void this.toast("请先选择或注册有效的坐标系","warn");const e=this.scanTileFiles(this.pickedTiles.files,this.form.tilesTms);if(!e.size)return void this.toast("所选目录中未找到 z/x/y 结构的切片文件","err");const i=this.tileStats(e),s=this.buildTileGrid(t,i.maxZ,i.minZ),n=this.tilesExtent(s,i),r=this.buildTileGrid(t,i.maxZ,i.minZ,n),o=new Map,a=new fm({projection:t,tileGrid:r,wrapX:!1,minZoom:i.minZ,maxZoom:i.maxZ,tileUrlFunction:([t,i,s])=>{const n=e.get(`${t}/${i}/${s}`);if(!n)return;let r=o.get(n);return r||(r=URL.createObjectURL(n),o.set(n,r)),r}});this.addMapEntry({name:this.pickedTiles.name,kind:"tiles",layer:new Kf({source:a}),extent:n,projection:t,cleanup(){o.forEach(t=>URL.revokeObjectURL(t))}})}finally{this.popLoading()}},updateUrlTemplateHint(){const t=String(this.form.urlTemplate||"").trim();this.form.urlInfo="",t&&(/^https?:\/\//i.test(t)?/\{z\}/.test(t)&&/\{x\}/.test(t)&&/(\{y\}|\{-y\})/.test(t)||(this.form.urlInfo="模板需包含 {z}、{x} 和 {y}(或 {-y})。"):this.form.urlInfo="URL 模板需以 http:// 或 https:// 开头。")},async createXyzEntry(t,e,i,s,n=null){if(!t||!/^https?:\/\//i.test(t))return{error:"URL 模板需以 http:// 或 https:// 开头"};if(!/\{z\}/.test(t)||!/\{x\}/.test(t)||!/(\{y\}|\{-y\})/.test(t))return{error:"模板需包含 {z}、{x} 和 {y}(或 {-y})"};const r=this.ensureProjection(e);if(!r)return{error:"请先选择或注册有效的坐标系"};let o=null;if(n){const t=this.ensureProjection(n.crs);if(!t)return{error:"范围坐标系无效"};const e=n.extent;if(!e||!e.every(Number.isFinite))return{error:"范围数值无效"};if(e[0]>=e[2]||e[1]>=e[3])return{error:"范围需满足:X最小 < X最大,Y最小 < Y最大"};try{o=ho(e,t,r)}catch{return{error:"范围坐标系换算失败"}}if(!o||!o.every(Number.isFinite))return{error:"范围坐标系换算失败"}}const a=null!=s?s:this.clampInt(this.form.urlMaxzoom,0,24,22),h=null!=i?i:this.clampInt(this.form.urlMinzoom,0,24,0),l=this.buildTileGrid(r,Math.max(a,h),h,o),c={projection:r,tileGrid:l,minZoom:h,maxZoom:a,url:t};o&&(c.wrapX=!1);const u=t.length>28?t.slice(0,28)+"…":t;return{entry:{name:`在线切片XYZ · ${u}`,kind:"xyz",layer:new Kf({source:new fm(c)}),extent:o,projection:r,cleanup(){}}}},async loadUrlLayer(){this.pushLoading();try{const t=String(this.form.urlTemplate||"").trim();if(!t)return void this.toast("请填写在线切片XYZ URL 模板","warn");if(""===String(this.form.urlMinzoom||"").trim())return void this.toast("请填写最小层级","warn");if(""===String(this.form.urlMaxzoom||"").trim())return void this.toast("请填写最大层级","warn");const e=[this.$refs.urlExtMinx.value,this.$refs.urlExtMiny.value,this.$refs.urlExtMaxx.value,this.$refs.urlExtMaxy.value];if(e.some(t=>""===t.trim()))return void this.toast("请填写完整的范围:X/Y 的最小值和最大值","warn");const i=e.map(Number);if(!i.every(Number.isFinite))return void this.toast("范围数值无效","warn");const s={extent:i,crs:this.form.urlExtentCrs},n=await this.createXyzEntry(t,this.form.dataCrs,null,null,s);if(!n.entry)return void this.toast(n.error||"加载失败","warn");this.form.urlInfo="使用指定范围加载,已自动定位。",this.addMapEntry(n.entry)}finally{this.popLoading()}},vectorColor(t){let e=0;const i=String(t||"vector");for(let s=0;s<i.length;s++)e=31*e+i.charCodeAt(s)>>>0;return this.VECTOR_COLORS[e%this.VECTOR_COLORS.length]},descendants(t,e){return Array.from(t.getElementsByTagName("*")).filter(t=>t.localName===e)},svgParameters(t){const e=new Map,i=[...this.descendants(t,"SvgParameter"),...this.descendants(t,"CssParameter")];for(const s of i){const t=s.getAttribute("name");t&&e.set(t.toLowerCase(),(s.textContent||"").trim())}return e},strokeFromParams(t,e="stroke"){const i=t.get(e);if(i)return new pd({color:i,width:Number(t.get(e+"-width"))||1,lineCap:"square"===t.get(e+"-linecap")?"square":void 0,lineJoin:"mitre"===t.get(e+"-linejoin")?"miter":void 0,lineDash:(t.get(e+"-dasharray")||"").split(/[\s,]+/).filter(Boolean).map(Number).filter(Number.isFinite)})},parseSldStyles(t){const e=(new DOMParser).parseFromString(t,"application/xml");if(e.getElementsByTagName("parsererror").length)return null;const i=[];let s=null;const n=this.descendants(e,"TextSymbolizer").length>0;for(const r of this.descendants(e,"PointSymbolizer")){if(n)continue;const t=this.svgParameters(r),e=t.has("fill")?new cd({color:t.get("fill")}):void 0,o=this.strokeFromParams(t),a=Number((this.descendants(r,"Size")[0]||{}).textContent)||8,h=((this.descendants(r,"WellKnownName")[0]||{}).textContent||"circle").toLowerCase(),l={radius:a/2,fill:e,stroke:o};let c;c="square"===h?new od({...l,points:4,angle:Math.PI/4}):"triangle"===h?new od({...l,points:3,angle:0}):"cross"===h?new od({...l,points:4,angle:0,radius2:a/6}):new hd(l);const u=new wd({image:c});i.push(u),s||(s=u)}for(const r of this.descendants(e,"LineSymbolizer")){const t=this.strokeFromParams(this.svgParameters(r));t&&i.push(new wd({stroke:t}))}for(const r of this.descendants(e,"PolygonSymbolizer")){const t=this.svgParameters(r),e=t.has("fill")?new cd({color:t.get("fill")}):void 0,s=this.strokeFromParams(t);(e||s)&&i.push(new wd({fill:e,stroke:s}))}for(const r of this.descendants(e,"TextSymbolizer")){const t=this.descendants(r,"PropertyName")[0],e=t?t.textContent.trim():"",n=this.svgParameters(this.descendants(r,"Font")[0]||r),o=Number(n.get("font-size"))||10,a=n.get("font-family")||"SimSun",h=n.get("font-weight")||"normal",l=n.get("font-style")||"normal",c=new Sd({font:l+" "+h+" "+o+'px "'+a+'", sans-serif',fill:new cd({color:this.svgParameters(r).get("fill")||"#000000"}),text:e?" ":""});s?s.setText(c):i.push(new wd({text:c}))}return i.length?i:null},sldLabelProperty(t){const e=(new DOMParser).parseFromString(t,"application/xml");for(const i of this.descendants(e,"TextSymbolizer")){const t=this.descendants(i,"PropertyName")[0];if(t)return t.textContent.trim()}return""},parseCadColor(t){if("string"!==typeof t)return null;const e=t.trim().split(",").map(t=>Number(t.trim()));if(e.length<3)return null;if(e.slice(0,3).some(t=>!Number.isFinite(t)||t<0||t>255))return null;const i=e.length>=4&&Number.isFinite(e[3])&&e[3]>=0&&e[3]<=255?e[3]/255:1;return[e[0],e[1],e[2],i]},parseCadColor24(t){const e=Number(t);return!Number.isFinite(e)||e<0||e>16777215?null:[e>>16&255,e>>8&255,255&e,1]},resolveGeoJsonCadColor(t){return this.parseCadColor(t.get("color"))||this.parseCadColor24(t.get("color24"))||null},setStyleColor(t,e,i){if(!e)return;const s=t.getStroke(),n=t.getFill(),r=t.getText();i.includes("Polygon")?(s&&t.setStroke(new pd({color:e,width:s.getWidth(),lineCap:s.getLineCap(),lineJoin:s.getLineJoin(),lineDash:s.getLineDash(),lineDashOffset:s.getLineDashOffset(),miterLimit:s.getMiterLimit()})),n&&t.setFill(new cd({color:e}))):i.includes("LineString")||i.includes("Curve")?s&&t.setStroke(new pd({color:e,width:s.getWidth(),lineCap:s.getLineCap(),lineJoin:s.getLineJoin(),lineDash:s.getLineDash(),lineDashOffset:s.getLineDashOffset(),miterLimit:s.getMiterLimit()})):i.includes("Point")&&(n&&t.setFill(new cd({color:e})),r&&r.setFill(new cd({color:e}))),r&&(i.includes("Point")||i.includes("Polygon"))&&r.setFill(new cd({color:e}))},makeSldStyleFunction(t,e){const i=new Map;return(s,n)=>{const r=s.getGeometry(),o=r?r.getType():"",a=e?s.get(e):null,h=this.resolveGeoJsonCadColor(s),l=h?h.join(","):"sld",c=r&&r.getFirstCoordinate?r.getFirstCoordinate():this.map.getView().getCenter(),u=Hr(this.map.getView().getProjection(),Number.isFinite(n)&&n>0?n:1,c,"m"),d=Number(s.get("height")),g=Number.isFinite(d)&&d>0?Math.max(3,Math.min(128,d/u)):null,f=Math.round(4*Math.log2(u)),p=Number(s.get("angle")),_=Number.isFinite(p)?p*Math.PI/180:null,m=o+"|"+l+"|"+f+"|"+String(null==a?"":a)+"|"+_;let y=i.get(m);return y||(y=t.map(t=>{const i=t.clone();this.setStyleColor(i,h,o);const s=i.getText();if(s&&e&&null!=a&&""!==a){if(s.setText(String(a)),null!=g){const t=s.getFont()||'normal normal 10px "SimSun", sans-serif';s.setFont(t.replace(/([0-9]+(?:\.[0-9]+)?)px/,g.toFixed(2)+"px"))}null!=_&&s.setRotation(_)}return i}),i.set(m,y)),y}},defaultVectorStyle(t,e){const i=t.get("_sldStyle");if(i)return"function"===typeof i?i(t,e):i;const s=t.getGeometry(),n=s?s.getType():"",r=t.get("_styleColor")||this.vectorColor(t.get("layer")||t.get("_layerName")),o=t.get("_labelProperty")?t.get(t.get("_labelProperty")):t.get("text"),a=null!=o&&""!==o?new Sd({font:'12px "Microsoft YaHei", sans-serif',fill:new cd({color:"#1c2833"}),text:String(o)}):void 0;return n.includes("Polygon")?new wd({fill:new cd({color:r+"26"}),stroke:new pd({color:r,width:1.5}),text:a}):n.includes("LineString")||n.includes("Curve")?new wd({stroke:new pd({color:r,width:1.4}),text:a}):new wd({image:new hd({radius:4.5,fill:new cd({color:r}),stroke:new pd({color:"#ffffff",width:1})}),text:a})},featuresExtent(t){let e=Ws();for(const i of t){const t=i.getGeometry();t&&Hs(e,t.getExtent())}return e},createReprojectingVectorSource(t,e){return new Am({loader(i,s,n){const r=t.map(t=>{const i=t.clone(),s=i.getGeometry();return s&&s.transform(e,n),i});return this.addFeatures(r),r}})},geoJsonCrsCode(t){const e=t&&t.crs&&t.crs.properties&&t.crs.properties.name;if(!e)return null;if(/CRS84$/i.test(e))return"EPSG:4326";const i=String(e).match(/EPSG[:\s]+(\d+)/i);return i?"EPSG:"+i[1]:null},geoJsonCrsChipLabel(t,e){const i="EPSG:4326"===t?"EPSG:4326(WGS84 / CRS84)":t;return e?i+"("+e+" 个文件)":i},updateGeoJsonCrsHint(t,e){return e?t&&t.size?(this.form.geojsonCrsHint=`检测到 ${t.size} 种 CRS:`,void(this.form.geojsonCrsOptions=[...t].map(([t,e])=>({code:t,label:this.geoJsonCrsChipLabel(t,e)})))):(this.form.geojsonCrsHint=`已检查 ${e} 个 GeoJSON,未发现 CRS 声明。`,void(this.form.geojsonCrsOptions=[])):(this.form.geojsonCrsHint="未识别到 GeoJSON,无法检测 CRS。",void(this.form.geojsonCrsOptions=[]))},async detectGeoJsonCrsHints(t,e){const i=new Map;let s=0;for(const n of t){if(e!==this.geoJsonCrsDetectionSeq)return;try{const t=JSON.parse(await n.file.text()),e=this.geoJsonCrsCode(t);e&&i.set(e,(i.get(e)||0)+1)}catch{}s+=1,this.updateGeoJsonCrsHint(i,s)}if(e===this.geoJsonCrsDetectionSeq&&(this.updateGeoJsonCrsHint(i,s),i.size)){const t=[...i.entries()].sort((t,e)=>e[1]-t[1]);this.form.dataCrs=t[0][0]}},isMetadataJson(t){return/^metadata\.json$/i.test(t.name)},matchGeoJsonPairs(t){const e=t.filter(t=>this.GEOJSON_FILE_RE.test(t.name)&&!this.isMetadataJson(t)),i=new Map;for(const s of t)this.SLD_FILE_RE.test(s.name)&&i.set(s.name.replace(/\.[^.]+$/,""),s);return e.map(t=>({file:t,sld:i.get(t.name.replace(/\.[^.]+$/,""))||null}))},async orderGeoJsonPairsByMetadata(t,e){if(!e)return{pairs:t,metadata:null};const i=JSON.parse(await e.text());if(!i||!Array.isArray(i.layers))throw new Error("metadata.json 缺少 layers 数组");const s=new Map(t.map(t=>[t.file.name,t])),n=[],r=new Set;for(const o of i.layers){const t=o&&o.geojson,e=s.get(t);e&&!r.has(t)&&(e.layerTitle=o.title||"",n.push(e),r.add(t))}for(const o of t)r.has(o.file.name)||n.push(o);return{pairs:n,metadata:i}},onGeoJsonDirChosen(t){const e=Array.from(t||[]),i=e.length?(e[0].webkitRelativePath||"").split(/[\\/]/)[0]:"GeoJSON 目录",s=this.matchGeoJsonPairs(e),n=e.find(this.isMetadataJson)||null;this.pickedGeoJson={name:i,files:e,pairs:s,metadataFile:n,metadataName:null},this.form.geojsonDirName=s.length?i+"("+s.length+" 个 GeoJSON,"+s.filter(t=>t.sld).length+" 个 SLD)":"未识别到 GeoJSON 文件",this.form.geojsonInfo=s.length?(n?"已识别 metadata.json,将按其中的图层顺序加载;":"")+"未配对的 .sld 使用默认矢量样式。":"请选择包含 .geojson(或 .json)和可选同名 .sld 的目录。",this.geoJsonCrsDetectionSeq+=1,s.length?(this.form.geojsonCrsHint="正在检测 GeoJSON CRS…",this.detectGeoJsonCrsHints(s,this.geoJsonCrsDetectionSeq)):this.form.geojsonCrsHint="未选择 GeoJSON。"},async loadGeoJsonLayers(){this.pushLoading();try{if(!this.pickedGeoJson||!this.pickedGeoJson.pairs.length)return void this.toast("请先选择包含 GeoJSON 文件的目录","warn");const e=new vy,i=[];let s=null,n=null,r=0,o=this.pickedGeoJson.pairs;const a=[];try{if(this.pickedGeoJson.metadataFile){const t=await this.orderGeoJsonPairsByMetadata(this.pickedGeoJson.pairs,this.pickedGeoJson.metadataFile);o=t.pairs,this.pickedGeoJson.metadataName=t.metadata&&t.metadata.name?t.metadata.name:null}for(const t of o){const o=await t.file.text(),h=JSON.parse(o),l=this.geoJsonCrsCode(h)||this.form.dataCrs,c=this.ensureProjection(l);if(!c)throw new Error("无效坐标系:"+l);let u=e.readFeatures(h,{dataProjection:l,featureProjection:l});if(s){if(c.getCode()!==n)for(const t of u){const e=t.getGeometry();e&&e.transform(c,s)}}else s=c,n=c.getCode();if(t.sld){const e=await t.sld.text(),i=this.parseSldStyles(e);if(i){const s=this.sldLabelProperty(e),n=this.makeSldStyleFunction(i,s);for(const e of u)e.set("_sldStyle",n,!0),t.layerTitle&&e.set("_layerName",t.layerTitle,!0);r++}}a.push({pair:t,features:u}),i.push(...u)}}catch(t){return void this.toast("GeoJSON 加载失败:"+t.message,"err")}if(!i.length)return void this.toast("所选文件中没有有效要素","warn");const h=a.map(({pair:t,features:e})=>{const i=this.createReprojectingVectorSource(e,s),n=new E_({source:i,style:(t,e)=>this.defaultVectorStyle(t,e)});return{name:t.layerTitle||t.file.name,kind:"geojson",layer:n,featureCount:e.length,visible:!0,group:this.inferGeoJsonGroup(e),groupVisible:!0,source:i}});if(h.some(t=>"0"===t.group))for(const t of h)t.group||(t.group="0");const l=new Fl({layers:h.map(t=>t.layer)});this.addMapEntry({name:this.pickedGeoJson.metadataName||this.pickedGeoJson.name,kind:"geojson",layer:l,sublayers:h.map(t=>{const e={...t};return delete e.source,e}),extent:this.featuresExtent(i),projection:s,sourceCrs:n,sources:h.map(t=>t.source),cleanup(){}}),this.form.geojsonInfo="已按 metadata.json 顺序加载 "+o.length+" 个图层、"+i.length+" 个要素,应用 "+r+" 个 SLD 样式,数据坐标系 "+n+"。"}finally{this.popLoading()}},switchViewProjection(){const t=this.form.viewCrs,e=this.map.getView(),i=e.getProjection();if(i.getCode()===t)return void this.toast("当前视图已使用该坐标系","info");if("PIXEL"===i.getCode()||"PIXEL"===t)return void this.toast("像素坐标无法与其他坐标系互转","warn");const s=this.ensureProjection(t);if(!s)return void this.toast("目标坐标系未注册","warn");const{center:n,resolution:r}=this.computeViewTransition(s);this.setViewProjection(s,{center:n,resolution:r}),n&&!r&&this.activeEntry&&this.fitActiveMap(),this.activeEntry&&(this.activeEntry.viewProjectionCode=s.getCode(),this.renderMapList())},registerCustom(t,e){try{if(Kr(t)||(Db.defs(t,e),zb(Db)),!Kr(t))throw new Error("注册失败")}catch(i){return this.toast(`坐标系注册失败:${i.message}`,"err"),!1}return this.customPresets.some(e=>e.code===t)||this.customPresets.push({code:t,name:`${t} · 自定义`,def:e}),this.refillCrsSelects(),this.form.dataCrs=t,!0},async fetchAndRegisterEpsg(){const t=String(parseInt(this.$refs.customEpsg.value.trim(),10));if(!t||"NaN"===t)return void this.toast("请输入有效的 EPSG 代码","warn");const e=`EPSG:${t}`;this.toast(`正在从 epsg.io 获取 ${e} …`);try{const i=await fetch(`https://epsg.io/${t}.proj4`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const s=(await i.text()).trim();if(!s.startsWith("+"))throw new Error("返回内容不是 proj4 定义");this.registerCustom(e,s)&&this.toast(`已注册并应用 ${e}`,"ok")}catch(i){this.toast(`获取失败(${i.message}),请检查网络后重试`,"err")}},setSourceCategory(t){this.sourceCategory=t},setActiveTab(t){this.currentTab=t,this.sourceCategory=["image","tiles","url"].includes(t)?"raster":"vector"},setSourceCategoryAndDefault(t){this.setSourceCategory(t),this.setActiveTab("raster"===t?"image":"geojson")},resetLoadDialog(){this.pickedImage&&this.pickedImage.objectUrl&&URL.revokeObjectURL(this.pickedImage.objectUrl),this.pickedImage=null,this.pickedWorldFile=null,this.pickedTiles=null,this.pickedGeoJson=null,this.$refs.imgFile.value="",this.$refs.worldFile.value="",this.$refs.tilesDir.value="",this.$refs.geojsonDir.value="",this.form.imgFileName="未选择文件",this.form.worldFileName="未选择文件",this.form.tilesDirName="未选择目录",this.form.tilesInfo="支持 QGIS / GDAL 等导出的 z/x/y.png 目录结构。",this.form.tilesTms=!1,this.form.geojsonDirName="未选择目录",this.form.geojsonInfo="支持按文件名配对的 .geojson 与 .sld。",this.geoJsonCrsDetectionSeq+=1,this.form.geojsonCrsHint="未选择 GeoJSON。",this.form.geojsonCrsOptions=[],this.$refs.extMinx.value=this.$refs.extMiny.value=this.$refs.extMaxx.value=this.$refs.extMaxy.value="",this.form.zoneHint={message:"",options:[]},this.form.urlTemplate="",this.form.urlMinzoom=this.form.urlMaxzoom="",this.$refs.urlExtMinx.value=this.$refs.urlExtMiny.value=this.$refs.urlExtMaxx.value=this.$refs.urlExtMaxy.value="",this.form.urlExtentCrs="EPSG:3857",this.form.urlInfo="",this.form.customEpsg="",this.form.dataCrs="EPSG:3857",this.setActiveTab("image")},openLoadDialog(){this.resetLoadDialog(),this.loadDialogVisible=!0},closeLoadDialog(){this.loadDialogVisible=!1},getViewState(){if(!this.map)return null;const t=this.map.getView();return{center:t.getCenter(),zoom:t.getZoom(),crs:t.getProjection().getCode()}},getActiveMapInfo(){const t=this.activeEntry;if(!t)return null;const e=this.map.getView();return{id:t.id,name:t.name,kind:t.kind,dataCrs:t.projection.getCode(),viewCrs:t.viewProjectionCode,extent:t.extent,sublayerCount:t.sublayers.length,center:e.getCenter(),zoom:e.getZoom()}},async addXyzLayer({url:t,crs:e="EPSG:3857",minZoom:i=0,maxZoom:s=22,extent:n=null,extentCrs:r=null}={}){this.viewerReady||await this.waitViewerReady();const o=n&&4===n.length?{extent:n,crs:r||e}:null,a=await this.createXyzEntry(t,e,i,s,o);return a.entry?(this.addMapEntry(a.entry),a.entry):(this.toast(a.error||"加载失败","warn"),null)},async loadImageFromUrl({url:t,name:e=null,crs:i=null,worldFileUrl:s=null,worldText:n=null,extent:r=null}={}){if(this.viewerReady||await this.waitViewerReady(),i&&(this.form.dataCrs=i),!n&&s)try{const t=await fetch(s);t.ok&&(n=await t.text())}catch{}return await this.addImageFromUrl({url:t,name:e||decodeURIComponent(String(t).split("/").pop()||"图片"),worldText:n,extent:r,crs:i}),this.activeEntry},async loadGeoJsonFromFiles(t){return this.viewerReady||await this.waitViewerReady(),this.onGeoJsonDirChosen(t),await this.loadGeoJsonLayers(),this.activeEntry},async loadGeoJsonFromManifest(t,e=""){this.viewerReady||await this.waitViewerReady();const i=this.manifestEntries(t);if(!i.length)return this.toast("清单中没有文件","warn"),null;const s=[],n=[];for(const o of i){const t=this.resolveManifestUrl(o.url,e);try{const e=await fetch(t);if(!e.ok)throw new Error("HTTP "+e.status);const i=await e.blob();s.push(new File([i],this.manifestUrlName(t),{type:i.type||"application/octet-stream"}))}catch(r){console.error("[manifest] 文件加载失败:",t,r),n.push(this.manifestUrlName(t)+":"+r.message)}}if(n.length&&this.toast("有 "+n.length+" 个文件加载失败:"+n.slice(0,3).join(";")+(n.length>3?" 等":""),"warn"),!s.length)throw new Error("矢量文件全部加载失败(共 "+n.length+" 个)");return this.loadGeoJsonFromFiles(s)},manifestEntries(t){const e=t=>{if("string"===typeof t)return{url:t};if(!t||"object"!==typeof t)return null;const e=t.url||t.geojson||t.image||t.png||null;return e?{url:e,type:t.type||null,name:t.name||t.title||null,crs:t.crs||null,worldFile:t.worldFile||t.worldfile||null,worldText:t.worldText||null,extent:Array.isArray(t.extent)&&4===t.extent.length?t.extent:null,sld:t.sld||null}:null},i=t=>{const i=[],s=e(t);return s&&i.push(s),t&&"object"===typeof t&&"string"===typeof t.sld&&t.sld&&(s&&s.url===t.sld||i.push({url:t.sld})),i};if(Array.isArray(t))return[].concat.apply([],t.map(i));if(!t)return[];if(Array.isArray(t.files))return[].concat.apply([],t.files.map(i));if(Array.isArray(t.layers)){const i=[];for(const s of t.layers)s&&s.geojson&&i.push(e(Object.assign({},s,{url:s.geojson,sld:null}))),s&&s.sld&&i.push({url:s.sld});return i.push({url:"metadata.json"}),i}return[]},resolveManifestUrl(t,e){const i=String(t);return/^https?:\/\//i.test(i)||!e?i:e.replace(/\/$/,"")+"/"+i.replace(/^\//,"")},manifestUrlName(t){return decodeURIComponent(String(t).split("/").pop().split("?")[0]||"未命名")},async loadGeoJsonFromData(t){if(this.viewerReady||await this.waitViewerReady(),!Array.isArray(t)||!t.length)return this.toast("没有可加载的图层数据","warn"),null;const e=[];for(const i of t){if(!i||!i.geojson)continue;const t="string"===typeof i.geojson?i.geojson:JSON.stringify(i.geojson);if(e.push(new File([t],i.name+".geojson",{type:"application/geo+json"})),i.sld){const t="string"===typeof i.sld?i.sld:JSON.stringify(i.sld);e.push(new File([t],i.name+".sld",{type:"application/xml"}))}}return e.length?this.loadGeoJsonFromFiles(e):(this.toast("没有可加载的图层数据","warn"),null)},async loadGeoJsonForCurrentSource(){await this.loadGeoJsonLayers()},waitViewerReady(){return this.viewerReady?Promise.resolve():new Promise(t=>{const e=setInterval(()=>{this.viewerReady&&(clearInterval(e),t())},50)})},async processAutoLoad(){this.pushLoading();try{const t=this.autoLoad;if(!t||!t.url)return;if("manifest"===t.type){const e=await fetch(t.url);if(!e.ok)throw new Error("获取失败:"+t.url+"("+e.status+")");const i=await e.json();await this.loadGeoJsonFromManifest(i,t.baseUrl||"")}else"image"===t.type&&await this.loadImageFromUrl({url:t.url,name:t.name||null,crs:t.crs||null,worldFileUrl:t.worldFile||null,worldText:t.worldText||null,extent:t.extent||null})}finally{this.popLoading()}},applyTheme(t){this.isLight="light"===t,this.themeIcon=this.isLight?"🌙":"☀️",this.themeTitle=this.isLight?"切换到深色主题":"切换到浅色主题",this.$emit("theme-changed",t)},async readDroppedEntry(t,e=""){if(!t)return[];if(t.isFile)return await new Promise(i=>{t.file(s=>{try{Object.defineProperty(s,"webkitRelativePath",{value:e+t.name})}catch{}i([s])},()=>i([]))});const i=t.createReader(),s=[];for(;;){const t=await new Promise(t=>i.readEntries(t,()=>t([])));if(!t.length)break;s.push(...t)}const n=[];for(const r of s)n.push(...await this.readDroppedEntry(r,e+t.name+"/"));return n},async filesFromDataTransfer(t){const e=Array.from(t&&t.files||[]);if(e.length)return e;const i=Array.from(t&&t.items||[]),s=i.map(t=>t.webkitGetAsEntry&&t.webkitGetAsEntry()).filter(Boolean);if(!s.length)return[];const n=await Promise.all(s.map(t=>this.readDroppedEntry(t)));return n.flat()},normalizeEpsg(t){return t=String(t||"").trim(),/^\d+$/.test(t)?`EPSG:${t}`:/^epsg:\d+$/i.test(t)?t.toUpperCase():null}}},Bb=Ub;function Wb(t,e,i,s,n,r,o,a){var h,l="function"===typeof t?t.options:t;if(e&&(l.render=e,l.staticRenderFns=i,l._compiled=!0),s&&(l.functional=!0),r&&(l._scopeId="data-v-"+r),o?(h=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&&n.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},l._ssrRegister=h):n&&(h=a?function(){n.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:n),h)if(l.functional){l._injectStyles=h;var c=l.render;l.render=function(t,e){return h.call(e),c(t,e)}}else{var u=l.beforeCreate;l.beforeCreate=u?[].concat(u,h):[h]}return{exports:t,options:l}}var Xb=Wb(Bb,ei,ii,!1,null,null,null),Vb=Xb.exports;const qb=[Vb],Yb=function(t){qb.forEach(e=>{t.component(e.name,e)})};var Kb={install:Yb},Hb=Kb}(),s}()});
|
|
2
2
|
//# sourceMappingURL=map_view_vue2.umd.min.js.map
|