@defra/interactive-map 0.0.50-alpha → 0.0.51-apha

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.
Files changed (76) hide show
  1. package/dist/esm/im-core.js +1 -1
  2. package/dist/umd/im-core.js +1 -1
  3. package/docs/api.md +19 -0
  4. package/docs/architecture.md +14 -0
  5. package/docs/getting-started.md +10 -0
  6. package/docs/plugins/datasets.md +9 -3
  7. package/jest.setup.js +8 -0
  8. package/package.json +8 -3
  9. package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
  10. package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -0
  11. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  12. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  13. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +2 -0
  14. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js.LICENSE.txt +1 -0
  15. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  16. package/plugins/datasets/dist/umd/index.js +1 -1
  17. package/plugins/datasets/src/adapters/loadLayerAdapter.js +7 -3
  18. package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +17 -0
  19. package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +74 -0
  20. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +14 -79
  21. package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +4 -0
  22. package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +3 -89
  23. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.js +111 -0
  24. package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +198 -0
  25. package/plugins/datasets/src/adapters/openlayers/layerBuilders.js +205 -0
  26. package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +233 -0
  27. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +276 -0
  28. package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +431 -0
  29. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +172 -0
  30. package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +262 -0
  31. package/plugins/datasets/src/fetch/createDynamicSource.js +12 -8
  32. package/plugins/datasets/src/fetch/createDynamicSource.test.js +61 -52
  33. package/plugins/datasets/src/initialise/DatasetsInit.jsx +13 -1
  34. package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +20 -0
  35. package/plugins/datasets/src/initialise/initialiseDatasets.js +1 -1
  36. package/plugins/datasets/src/initialise/initialiseDatasets.test.js +1 -1
  37. package/plugins/datasets/src/registry/mapboxStyleDataset.js +108 -0
  38. package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +240 -0
  39. package/plugins/datasets/src/utils/bbox.js +5 -7
  40. package/plugins/datasets/src/utils/bbox.test.js +3 -10
  41. package/plugins/draw/dist/css/index.css +1 -0
  42. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  43. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  44. package/plugins/draw/src/index.js +2 -0
  45. package/plugins/draw/src/index.test.js +1 -0
  46. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  47. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  48. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  49. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  50. package/providers/beta/openlayers/dist/umd/index.js +1 -1
  51. package/providers/beta/openlayers/src/index.js +16 -0
  52. package/providers/beta/openlayers/src/openlayersProvider.js +160 -7
  53. package/providers/beta/openlayers/src/openlayersProvider.test.js +13 -0
  54. package/providers/beta/openlayers/src/utils/bngProjection.js +9 -0
  55. package/providers/beta/openlayers/src/utils/filterEvaluator.js +32 -0
  56. package/providers/beta/openlayers/src/utils/filterEvaluator.test.js +36 -0
  57. package/providers/beta/openlayers/src/utils/highlightFeatures.js +38 -23
  58. package/providers/beta/openlayers/src/utils/highlightFeatures.test.js +153 -8
  59. package/providers/beta/openlayers/src/utils/hoverCursor.js +5 -1
  60. package/providers/beta/openlayers/src/utils/hoverCursor.test.js +40 -0
  61. package/providers/beta/openlayers/src/utils/queryFeatures.js +72 -54
  62. package/providers/beta/openlayers/src/utils/queryFeatures.test.js +143 -1
  63. package/providers/beta/openlayers/src/utils/symbolImages.js +79 -5
  64. package/providers/beta/openlayers/src/utils/symbolImages.test.js +111 -1
  65. package/providers/beta/openlayers/src/utils/vtTileFragments.js +20 -8
  66. package/providers/beta/openlayers/src/utils/vtTileFragments.test.js +162 -0
  67. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  68. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  69. package/providers/maplibre/dist/umd/index.js +1 -1
  70. package/providers/maplibre/src/utils/patternImages.js +4 -44
  71. package/rollup.esm.mjs +2 -0
  72. package/src/services/patternRegistry.js +38 -0
  73. package/src/services/patternRegistry.test.js +61 -0
  74. package/src/types.js +11 -0
  75. package/webpack.dev.mjs +1 -0
  76. /package/plugins/datasets/dist/esm/{esriLayerAdapter.js → im-datasets-esri-adapter.js} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see im-datasets-ol-adapter.js.LICENSE.txt */
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[2809],{91816(t,e,i){function s(t){return s="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},s(t)}function n(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,r(s.key),s)}}function r(t){var e=function(t){if("object"!=s(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=s(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==s(e)?e:e+""}i.d(e,{T:()=>o});var o=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},(e=[{key:"attachDynamicSources",value:function(t){this._dynamicSources=t}},{key:"dynamicSources",get:function(){return this._dynamicSources}}])&&n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},44202(t,e,i){i.d(e,{h:()=>_});var s=i(91816),n=i(83262);function r(t){return r="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},r(t)}function o(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var o=s&&s.prototype instanceof l?s:l,c=Object.create(o.prototype);return a(c,"_invoke",function(i,s,n){var r,o,a,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return r=e,o=0,a=t,d.n=i,h}};function f(i,s){for(o=i,a=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],f=d.p,g=r[2];i>3?(n=g===s)&&(a=r[(o=r[4])?5:(o=3,3)],r[4]=r[5]=t):r[0]<=f&&((n=i<2&&f<r[1])?(o=0,d.v=s,d.n=r[1]):f<g&&(n=i<3||r[0]>s||s>g)&&(r[4]=i,r[5]=s,d.n=g,o=0))}if(n||i>1)return h;throw u=!0,s}return function(n,c,g){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),o=c,a=g;(e=o<2?t:a)||!u;){r||(o?o<3?(o>1&&(d.n=-1),f(o,a)):d.n=a:d.v=a);try{if(l=2,r){if(o||(n="next"),e=r[n]){if(!(e=e.call(r,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,o<2&&(o=0)}else 1===o&&(e=r.return)&&e.call(r),o<2&&(a=TypeError("The iterator does not provide a '"+n+"' method"),o=1);r=t}else if((e=(u=d.n<0)?a:i.call(s,d))!==h)break}catch(e){r=t,o=1,a=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),c}var h={};function l(){}function c(){}function u(){}e=Object.getPrototypeOf;var d=[][s]?e(e([][s]())):(a(e={},s,function(){return this}),e),f=u.prototype=l.prototype=Object.create(d);function g(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,a(t,n,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=u,a(f,"constructor",u),a(u,"constructor",c),c.displayName="GeneratorFunction",a(u,n,"GeneratorFunction"),a(f),a(f,n,"Generator"),a(f,s,function(){return this}),a(f,"toString",function(){return"[object Generator]"}),(o=function(){return{w:r,m:g}})()}function a(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}a=function(t,e,i,s){function r(e,i){a(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},a(t,e,i,s)}function h(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function l(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,c(s.key),s)}}function c(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}function u(t,e,i){return e=f(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,d()?Reflect.construct(e,i||[],f(t).constructor):e.apply(t,i))}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function g(t,e){return g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},g(t,e)}var _=function(t){function e(t,i,s){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,e))._mapProvider=t,n._map=t.map,n._symbolRegistry=i,n._patternRegistry=s,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&g(t,e)}(e,t),i=e,s=[{key:"_pixelRatio",get:function(){return this._map.getPixelRatio()}},{key:"addDataset",value:(r=o().m(function t(e){var i;return o().w(function(t){for(;;)switch(t.n){case 0:if(i=n.Q.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._addLayers(i);case 3:return t.a(2)}},t,this)}),a=function(){var t=this,e=arguments;return new Promise(function(i,s){var n=r.apply(t,e);function o(t){h(n,i,s,o,a,"next",t)}function a(t){h(n,i,s,o,a,"throw",t)}o(void 0)})},function(t){return a.apply(this,arguments)})},{key:"applyDatasetOpacity",value:function(t){var e=n.Q.getDataset(t);e&&this._applyRegistryDatasetOpacity(e)}},{key:"_applyRegistryDatasetOpacity",value:function(t){var e=this;t.getLayersWithOpacity().forEach(function(t){var i=t.layerIds,s=t.opacity;i.forEach(function(t){return e._setLayerOpacity(t,s)})})}},{key:"applyGlobalOpacity",value:function(){var t=this;n.Q.forEachDataset(function(e){return t._applyRegistryDatasetOpacity(e)})}},{key:"applyDatasetVisibility",value:function(t){var e=n.Q.getDataset(t);e&&this._applyRegistryDatasetVisibility(e)}},{key:"_applyRegistryDatasetVisibility",value:function(t){var e=this;t.getLayersWithVisibility().forEach(function(t){var i=t.layerIds,s=t.visibility;i.forEach(function(t){return e._setLayerVisibility(t,s)})})}},{key:"applyGlobalVisibility",value:function(){var t=this;n.Q.forEachDataset(function(e){return t._applyRegistryDatasetVisibility(e)})}}],s&&l(i.prototype,s),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,s,r,a}(s.T)},59771(t,e,i){i.r(e),i.d(e,{default:()=>h_});var s=i(10417),n=i(83262),r=i(43247),o=i(93121),a={symbol:"pin",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},h={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},l={id:"pin",viewBox:"0 0 44 44",anchor:[.5,.9],graphic:h.dot,svg:'<path d="M22 40.999c-3.621 0-8.306-5.864-10.258-8.3C9.02 29.302 6 23.66 6 19.002a16.01 16.01 0 0 1 16-16 16.01 16.01 0 0 1 16 16c0 4.658-3.02 10.3-5.742 13.697-1.952 2.437-6.637 8.3-10.258 8.3z" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M22 7.001a12.01 12.01 0 0 1 12 12c0 7.623-10.377 17.998-12 17.998S10 26.624 10 19.001a12.01 12.01 0 0 1 12-12z" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 19) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},c={id:"circle",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<circle cx="22" cy="22" r="16" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <circle cx="22" cy="22" r="12" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},u={id:"square",viewBox:"0 0 44 44",anchor:[.5,.5],graphic:h.dot,svg:'<path d="M13 6h18c3.863 0 7 3.137 7 7v18c0 3.863-3.137 7-7 7H13c-3.863 0-7-3.137-7-7V13c0-3.863 3.137-7 7-7" fill="{{selectedColor}}" stroke="{{activeColor}}" stroke-width="6" paint-order="stroke fill"/>\n <path d="M13 34a3 3 0 0 1-3-3V13a3 3 0 0 1 3-3h18a3 3 0 0 1 3 3v18a3 3 0 0 1-3 3H13z" fill-rule="nonzero" fill="{{backgroundColor}}" stroke="{{haloColor}}" stroke-width="2" paint-order="stroke fill"/>\n <g transform="translate(22, 22) scale(0.8) translate(-8, -8)"><path d="{{graphic}}" fill="{{foregroundColor}}"/></g>'},d={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},f=function(t,e,i){return new Promise(function(s,n){var r="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),o=new Image(e,i);o.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=i;var n=t.getContext("2d");n.drawImage(o,0,0,e,i),s(n.getImageData(0,0,e,i))},o.onerror=function(){n(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},o.src=r})};function g(t){return g="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},g(t)}function _(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var h=s&&s.prototype instanceof a?s:a,l=Object.create(h.prototype);return p(l,"_invoke",function(i,s,n){var r,a,h,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return r=e,a=0,h=t,d.n=i,o}};function f(i,s){for(a=i,h=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],f=d.p,g=r[2];i>3?(n=g===s)&&(h=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=t):r[0]<=f&&((n=i<2&&f<r[1])?(a=0,d.v=s,d.n=r[1]):f<g&&(n=i<3||r[0]>s||s>g)&&(r[4]=i,r[5]=s,d.n=g,a=0))}if(n||i>1)return o;throw u=!0,s}return function(n,c,g){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,h=g;(e=a<2?t:h)||!u;){r||(a?a<3?(a>1&&(d.n=-1),f(a,h)):d.n=h:d.v=h);try{if(l=2,r){if(a||(n="next"),e=r[n]){if(!(e=e.call(r,h)))throw TypeError("iterator result is not an object");if(!e.done)return e;h=e.value,a<2&&(a=0)}else 1===a&&(e=r.return)&&e.call(r),a<2&&(h=TypeError("The iterator does not provide a '"+n+"' method"),a=1);r=t}else if((e=(u=d.n<0)?h:i.call(s,d))!==o)break}catch(e){r=t,a=1,h=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),l}var o={};function a(){}function h(){}function l(){}e=Object.getPrototypeOf;var c=[][s]?e(e([][s]())):(p(e={},s,function(){return this}),e),u=l.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,p(t,n,"GeneratorFunction")),t.prototype=Object.create(u),t}return h.prototype=l,p(u,"constructor",l),p(l,"constructor",h),h.displayName="GeneratorFunction",p(l,n,"GeneratorFunction"),p(u),p(u,n,"Generator"),p(u,s,function(){return this}),p(u,"toString",function(){return"[object Generator]"}),(_=function(){return{w:r,m:d}})()}function p(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}p=function(t,e,i,s){function r(e,i){p(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},p(t,e,i,s)}function m(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function y(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function x(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?y(Object(i),!0).forEach(function(e){v(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):y(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function v(t,e,i){return(e=function(t){var e=function(t){if("object"!=g(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=g(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var s,n,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(s=r.call(i)).done)&&(a.push(s.value),a.length!==e);h=!0);}catch(t){l=!0,n=t}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}(t,e)||S(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){if(t){if("string"==typeof t)return M(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?M(t,e):void 0}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}var b=new Map,E=new Map,C={},P=function(t){var e,i=0,s=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=S(t))){e&&(t=e);var i=0,s=function(){};return{s,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,r=!0,o=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return r=t.done,t},e:function(t){o=!0,n=t},f:function(){try{r||null==e.return||e.return()}finally{if(o)throw n}}}}(t);try{for(s.s();!(e=s.n()).done;){var n=e.value;i=Math.trunc((i<<5)-i+n.codePointAt(0))}}catch(t){s.e(t)}finally{s.f()}return Math.abs(i).toString(36)},I=new Set(["id","svg","viewBox","anchor","symbol","symbolSvgContent"]);function R(t,e,i){var s,n,o,l,c=null==i?void 0:i.id,u=Object.fromEntries(Object.entries(t||{}).filter(function(t){var e=w(t,1)[0];return!I.has(e)})),f=Object.fromEntries(Object.entries(C).filter(function(t){var e=w(t,1)[0];return!I.has(e)})),g=Object.fromEntries(Object.entries(e).filter(function(t){return null!=w(t,2)[1]})),_=x(x(x(x({},a),f),u),g),p=null!==(s=d[null==i?void 0:i.mapColorScheme])&&void 0!==s?s:d.light;return _.haloColor=null!==(n=null==i?void 0:i.haloColor)&&void 0!==n?n:p.haloColor,_.selectedColor=null!==(o=null==i?void 0:i.selectedColor)&&void 0!==o?o:p.selectedColor,_.activeColor=null!==(l=null==i?void 0:i.activeColor)&&void 0!==l?l:p.activeColor,"string"==typeof _.graphic&&h[_.graphic]&&(_.graphic=h[_.graphic]),Object.fromEntries(Object.entries(_).map(function(t){var e=w(t,2),i=e[0],s=e[1];return[i,(0,r.o)(s,c)||""]}))}function T(t,e){return Object.entries(e).reduce(function(t,e){var i=w(e,2),s=i[0],n=i[1];return t.replaceAll("{{".concat(s,"}}"),n)},t)}var G={setDefaults:function(t){C=t||{}},getDefaults:function(){return x(x({},a),C)},register:function(t){b.set(t.id,t)},get:function(t){return b.get(t)},list:function(){return function(t){if(Array.isArray(t))return M(t)}(t=b.values())||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||S(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();var t},clear:function(){b.clear()},initialise:function(){this.register(l),this.register(c),this.register(u)},resolve:function(t,e,i){var s=R(t,e||{},i);return t?(s.selectedColor="none",s.activeColor="none",T(t.svg,s)):""},resolveActive:function(t,e,i){var s=R(t,e||{},i);return t?T(t.svg,s):""},resolveSelected:function(t,e,i){var s=R(t,e||{},i);return t?(s.activeColor="none",T(t.svg,s)):""},getSymbolImageId:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,n=this.getSymbolDef(t);if(!n)return null;var r=(0,o.sR)(t),a=i?this.resolveActive(n,r,e):this.resolve(n,r,e);return"symbol-".concat(i?"act-":"").concat(P(a),"-").concat(s,"x")},getSymbolDef:function(t){return t.symbolSvgContent?{svg:t.symbolSvgContent}:t.symbol?this.get(t.symbol):void 0},rasteriseSymbolImage:function(t,e,i,s){var n,r=this;return(n=_().m(function n(){var a,h,l,c,u,d,g,p,m,y,x,v;return _().w(function(n){for(;;)switch(n.n){case 0:if(a=r.getSymbolDef(t)){n.n=1;break}return n.a(2,null);case 1:if(h=(0,o.sR)(t),"active"===i?(l=r.resolveActive(a,h,e),c="act-"):"selected"===i?(l=r.resolveSelected(a,h,e),c="sel-"):(l=r.resolve(a,h,e),c=""),u="symbol-".concat(c).concat(P(l),"-").concat(s,"x"),d=E.get(u)){n.n=3;break}return g=(0,o.n8)(t,a),p=g.split(" ").map(Number),m=w(p,4),y=m[2],x=m[3],v='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(y*s,'" height="').concat(x*s,'" viewBox="').concat(g,'">').concat(l,"</svg>"),n.n=2,f(v,y*s,x*s);case 2:d=n.v,E.set(u,d);case 3:return n.a(2,{imageId:u,imageData:d})}},n)}),function(){var t=this,e=arguments;return new Promise(function(i,s){var r=n.apply(t,e);function o(t){m(r,i,s,o,a,"next",t)}function a(t){m(r,i,s,o,a,"throw",t)}o(void 0)})})()}};function O(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var h=s&&s.prototype instanceof a?s:a,l=Object.create(h.prototype);return k(l,"_invoke",function(i,s,n){var r,a,h,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return r=e,a=0,h=t,d.n=i,o}};function f(i,s){for(a=i,h=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],f=d.p,g=r[2];i>3?(n=g===s)&&(h=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=t):r[0]<=f&&((n=i<2&&f<r[1])?(a=0,d.v=s,d.n=r[1]):f<g&&(n=i<3||r[0]>s||s>g)&&(r[4]=i,r[5]=s,d.n=g,a=0))}if(n||i>1)return o;throw u=!0,s}return function(n,c,g){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,h=g;(e=a<2?t:h)||!u;){r||(a?a<3?(a>1&&(d.n=-1),f(a,h)):d.n=h:d.v=h);try{if(l=2,r){if(a||(n="next"),e=r[n]){if(!(e=e.call(r,h)))throw TypeError("iterator result is not an object");if(!e.done)return e;h=e.value,a<2&&(a=0)}else 1===a&&(e=r.return)&&e.call(r),a<2&&(h=TypeError("The iterator does not provide a '"+n+"' method"),a=1);r=t}else if((e=(u=d.n<0)?h:i.call(s,d))!==o)break}catch(e){r=t,a=1,h=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),l}var o={};function a(){}function h(){}function l(){}e=Object.getPrototypeOf;var c=[][s]?e(e([][s]())):(k(e={},s,function(){return this}),e),u=l.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,k(t,n,"GeneratorFunction")),t.prototype=Object.create(u),t}return h.prototype=l,k(u,"constructor",l),k(l,"constructor",h),h.displayName="GeneratorFunction",k(l,n,"GeneratorFunction"),k(u),k(u,n,"Generator"),k(u,s,function(){return this}),k(u,"toString",function(){return"[object Generator]"}),(O=function(){return{w:r,m:d}})()}function k(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}k=function(t,e,i,s){function r(e,i){k(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},k(t,e,i,s)}function A(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function F(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var r=t.apply(e,i);function o(t){A(r,s,n,o,a,"next",t)}function a(t){A(r,s,n,o,a,"throw",t)}o(void 0)})}}G.initialise();var L=new Map,j=new Map,N=new Map,D=new Map,z=function(t,e){var i=L.get(t);if(i)return i;var s=document.createElement("canvas");return s.width=e.width,s.height=e.height,s.getContext("2d").putImageData(e,0,0),L.set(t,s),s},W=function(){var t=F(O().m(function t(e,i,s,n){var r,o;return O().w(function(t){for(;;)switch(t.n){case 0:if(r=s.getSymbolImageId(e,i,!1,n)){t.n=1;break}return t.a(2);case 1:return(o=s.getSymbolImageId(e,i,!0,n))&&N.set(r,o),t.n=2,Promise.all(["normal","active","selected"].map(function(){var t=F(O().m(function t(a){var h,l,c;return O().w(function(t){for(;;)switch(t.n){case 0:if(h="active"===a?o:r,"selected"===a||h&&!L.has(h)){t.n=1;break}return t.a(2);case 1:return t.n=2,s.rasteriseSymbolImage(e,i,a,n);case 2:if(l=t.v){t.n=3;break}return t.a(2);case 3:"selected"===a&&D.set(r,l.imageId),L.has(l.imageId)||(c=z(l.imageId,l.imageData),"normal"===a&&j.set(l.imageId,c.toDataURL()));case 4:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}()));case 2:return t.a(2)}},t)}));return function(e,i,s,n){return t.apply(this,arguments)}}(),B=function(){var t=F(O().m(function t(e,i,s,n){return O().w(function(t){for(;;)switch(t.n){case 0:if(e.length){t.n=1;break}return t.a(2);case 1:return t.n=2,Promise.all(e.map(function(t){return W(t,i,s,n)}));case 2:return t.a(2)}},t)}));return function(e,i,s,n){return t.apply(this,arguments)}}();function X(t){return X="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},X(t)}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}function U(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,Y(s.key),s)}}function Y(t){var e=function(t){if("object"!=X(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=X(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==X(e)?e:e+""}function Z(t,e,i){return e=H(e),function(t,e){if(e&&("object"==X(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,V()?Reflect.construct(e,i||[],H(t).constructor):e.apply(t,i))}function V(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(V=function(){return!!t})()}function K(){return K="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,i){var s=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=H(t)););return t}(t,e);if(s){var n=Object.getOwnPropertyDescriptor(s,e);return n.get?n.get.call(arguments.length<3?t:i):n.value}},K.apply(null,arguments)}function H(t){return H=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},H(t)}function $(t,e){return $=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},$(t,e)}var J=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Z(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&$(t,e)}(e,t),i=e,s=[{key:"leafLayerIds",get:function(){return this.hasSublayers?[]:this.hasFill||this.hasStroke||this.hasSymbol?[this.id]:[]}},{key:"source",get:function(){return this.hasDynamicGeoJSON?{type:"geojson",data:{type:"FeatureCollection",features:[]}}:this.tiles?{type:"vector",tiles:this.tiles,minzoom:this.minZoom||0,maxzoom:this.maxZoom||22}:this.geojson?{type:"geojson",data:this.geojson}:null}},{key:"idStrategy",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.idProperty||null:this.idProperty||null}},{key:"filter",get:function(){var t,i,s=(t=e,i=this,K(H(1&1?t.prototype:t),"filter",i));if(!this.sourceLayer)return s;var n=["==",["get","layer"],this.sourceLayer];return s?"all"===s[0]?[].concat(function(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return q(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?q(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(s),[n]):["all",s,n]:n}},{key:"_wrapWithFilter",value:function(t){return this.filter?[{filter:this.filter,style:t}]:t}},{key:"symbolMeta",get:function(){if(!this.hasSymbol)return null;var t=G.getSymbolImageId(this.style,n.Q.mapStyle,!1,3);return t?{imageId:t,anchor:(0,o.Op)(this.style,G.getSymbolDef(this.style))}:null}},{key:"_symbolStyle",value:function(){var t,e={},i=this.symbolMeta,s=i&&(t=i.imageId,j.get(t));return s&&(e["icon-src"]=s,e["icon-anchor"]=i.anchor,e["icon-scale"]=1/3),this._wrapWithFilter(e)}},{key:"flatStyle",get:function(){var t;if(this.hasSymbol)return this._symbolStyle();var e=null===(t=n.Q.mapStyle)||void 0===t?void 0:t.id,i={};return this.hasFill&&!this.hasPattern&&(i["fill-color"]=(0,r.o)(this.style.fill,e)),this.hasStroke&&(i["stroke-color"]=(0,r.o)(this.style.stroke,e),i["stroke-width"]=this.style.strokeWidth||1,this.style.strokeDashArray&&(i["stroke-line-dash"]=this.style.strokeDashArray)),this._wrapWithFilter(i)}}],s&&U(i.prototype,s),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,s}(s.f),Q=i(44202);const tt="add",et="remove",it="propertychange";function st(t){for(const e in t)delete t[e]}function nt(t){let e;for(e in t)return!1;return!e}function rt(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 ot(t,e,i,s){return rt(t,e,i,s,!0)}function at(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),st(t))}const ht="change",lt=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function ct(t,e){return t>e?1:t<e?-1:0}function ut(t,e){return t<e?1:t>e?-1:0}function dt(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 i=1;i<s;++i){if(t[i]==e)return i;if(t[i]<e)return t[i-1]-e<e-t[i]?i-1:i}return s-1}function ft(t,e,i){for(;e<i;){const s=t[e];t[e]=t[i],t[i]=s,++e,--i}}function gt(t,e){const i=Array.isArray(e)?e:[e],s=i.length;for(let e=0;e<s;e++)t[t.length]=i[e]}function _t(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 pt(){return!0}function mt(){}function yt(t){let e,i,s;return function(){const n=Array.prototype.slice.call(arguments);return i&&this===s&&_t(n,i)||(s=this,i=n,e=t.apply(this,arguments)),e}}const xt=class{constructor(t){this.propagationStopped,this.defaultPrevented,this.type=t,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},vt=class extends lt{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 xt(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 t=0,e=s.length;t<e;++t)if(a="handleEvent"in s[t]?s[t].handleEvent(n):s[t].call(this,n),!1===a||n.propagationStopped){a=!1;break}if(0===--r[i]){let t=o[i];for(delete o[i];t--;)this.removeEventListener(i,mt);delete r[i]}return a}disposeInternal(){this.listeners_&&st(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]=mt,++this.pendingRemovals_[t]):(i.splice(s,1),0===i.length&&delete this.listeners_[t]))}};class wt extends vt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(ht)}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]=rt(this,t[n],e);return s}return rt(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]=ot(this,t[n],e)}else i=ot(this,t,e);return e.ol_key=i,i}unInternal(t,e){const i=e.ol_key;if(i)!function(t){if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)at(t[e]);else at(t)}(i);else if(Array.isArray(t))for(let i=0,s=t.length;i<s;++i)this.removeEventListener(t[i],e);else this.removeEventListener(t,e)}}wt.prototype.on,wt.prototype.once,wt.prototype.un;const St=wt;function Mt(){throw new Error("Unimplemented abstract method.")}let bt=0;function Et(t){return t.ol_uid||(t.ol_uid=String(++bt))}class Ct extends xt{constructor(t,e,i){super(t),this.key=e,this.oldValue=i}}const Pt=class extends St{constructor(t){super(),this.on,this.once,this.un,Et(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 Ct(i,t,e)),i=it,this.hasListener(i)&&this.dispatchEvent(new Ct(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],nt(this.values_)&&(this.values_=null),e||this.notify(t,i)}}},It="length";class Rt extends xt{constructor(t,e,i){super(t),this.element=e,this.index=i}}const Tt=class extends Pt{constructor(t,e){if(super(),this.on,this.once,this.un,e=e||{},this.unique_=!!e.unique,this.array_=t??[],this.unique_)for(let t=1,e=this.array_.length;t<e;++t)this.assertUnique_(this.array_[t],t);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(t){for(let e=0,i=t.length;e<i;++e)this.push(t[e]);return this}forEach(t){const e=this.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(It)}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 Rt(tt,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 Rt(et,e,t)),e}setAt(t,e){if(t>=this.getLength())return void this.insertAt(t,e);if(t<0)throw new Error("Index out of bounds: "+t);this.unique_&&this.assertUnique_(e,t);const i=this.array_[t];this.array_[t]=e,this.dispatchEvent(new Rt(et,i,t)),this.dispatchEvent(new Rt(tt,e,t))}updateLength_(){this.set(It,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")}};function Gt(t,e){if(!t)throw new Error(e)}function Ot(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0,s=t.length;i<s;++i)Ut(e,t[i]);return e}function kt(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 At(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 Ft(t,e){return jt(t,e[0],e[1])}function Lt(t,e){return t[0]<=e[0]&&e[2]<=t[2]&&t[1]<=e[1]&&e[3]<=t[3]}function jt(t,e,i){return t[0]<=e&&e<=t[2]&&t[1]<=i&&i<=t[3]}function Nt(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=e[0],a=e[1];let h=0;return o<i?h|=16:o>n&&(h|=4),a<s?h|=8:a>r&&(h|=2),0===h&&(h=1),h}function Dt(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 zt(t){return Dt(1/0,1/0,-1/0,-1/0,t)}function Wt(t,e){const i=t[0],s=t[1];return Dt(i,s,i,s,e)}function Bt(t,e,i,s,n){return Yt(zt(n),t,e,i,s)}function Xt(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function qt(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 Ut(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 Yt(t,e,i,s,n){for(;i<s;i+=n)Zt(t,e[i],e[i+1]);return t}function Zt(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 Vt(t,e){let i;return i=e(Ht(t)),i||(i=e($t(t)),i||(i=e(re(t)),i||(i=e(ne(t)),i||!1)))}function Kt(t){let e=0;return he(t)||(e=oe(t)*ee(t)),e}function Ht(t){return[t[0],t[1]]}function $t(t){return[t[2],t[1]]}function Jt(t){return[(t[0]+t[2])/2,(t[1]+t[3])/2]}function Qt(t,e){let i;if("bottom-left"===e)i=Ht(t);else if("bottom-right"===e)i=$t(t);else if("top-left"===e)i=ne(t);else{if("top-right"!==e)throw new Error("Invalid corner");i=re(t)}return i}function te(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 ee(t){return t[3]-t[1]}function ie(t,e,i){const s=i||[1/0,1/0,-1/0,-1/0];return ae(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]):zt(s),s}function se(t,e){if(!ae(t,e))return[t.slice()];if(Lt(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 ne(t){return[t[0],t[3]]}function re(t){return[t[2],t[3]]}function oe(t){return t[2]-t[0]}function ae(t,e){return t[0]<=e[2]&&t[2]>=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function he(t){return t[2]<t[0]||t[3]<t[1]}function le(t,e){const i=e.getExtent(),s=Jt(t);if(e.canWrapX()&&(s[0]<i[0]||s[0]>=i[2])){const e=oe(i),n=Math.floor((s[0]-i[0])/e)*e;t[0]-=n,t[2]-=n}return t}function ce(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]]];le(t,e);const n=oe(s);if(oe(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 ue(t,e){let i=[t];for(let t=0,s=e.length;t<s&&i.length>0;++t){const s=[];for(let n=0,r=i.length;n<r;++n)s.push(...se(i[n],e[t]));i=s}return i}function de(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=false,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 fe(t,e){return function(i,s,n,r,o){de(t,e,i,s,n,(t,e)=>{this.addFeatures(t),void 0!==r&&r(t)},()=>{this.changed(),void 0!==o&&o()})}}const ge=2;let _e=1;function pe(t,e,i){return Math.min(Math.max(t,e),i)}function me(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 ye(t,e,i,s)}function ye(t,e,i,s){const n=i-t,r=s-e;return n*n+r*r}function xe(t){return 180*t/Math.PI}function ve(t){return t*Math.PI/180}function we(t,e){const i=t%e;return i*e<0?i+e:i}function Se(t,e,i){return t+i*(e-t)}function Me(t,e){const i=Math.pow(10,e);return Math.round(t*i)/i}function be(t,e){return Math.floor(Me(t,e))}function Ee(t,e){return Math.ceil(Me(t,e))}function Ce(t,e,i){if(t>=e&&t<i)return t;const s=i-e;return((t-e)%s+s)%s+e}function Pe(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 Ie(t,e){if(e.canWrapX()){const i=oe(e.getExtent()),s=Re(t,e,i);s&&(t[0]-=s*i)}return t}function Re(t,e,i){const s=e.getExtent();let n=0;return e.canWrapX()&&(t[0]<s[0]||t[0]>s[2])&&(i=i||oe(s),n=Math.floor((t[0]-s[0])/i)),n}const Te={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},Ge=class{constructor(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||Te[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_}},Oe=6378137,ke=Math.PI*Oe,Ae=[-ke,-ke,ke,ke],Fe=[-180,-85,180,85],Le=Oe*Math.log(Math.tan(Math.PI/2));class je extends Ge{constructor(t){super({code:t,units:"m",extent:Ae,global:!0,worldExtent:Fe,getPointResolution:function(t,e){return t/Math.cosh(e[1]/Oe)}})}}const Ne=[new je("EPSG:3857"),new je("EPSG:102100"),new je("EPSG:102113"),new je("EPSG:900913"),new je("http://www.opengis.net/def/crs/EPSG/0/3857"),new je("http://www.opengis.net/gml/srs/epsg.xml#3857")];const De=[-180,-90,180,90],ze=6378137*Math.PI/180;class We extends Ge{constructor(t,e){super({code:t,units:"degrees",extent:De,axisOrientation:e,global:!0,metersPerUnit:ze,worldExtent:De})}}const Be=[new We("CRS:84"),new We("EPSG:4326","neu"),new We("urn:ogc:def:crs:OGC:1.3:CRS84"),new We("urn:ogc:def:crs:OGC:2:84"),new We("http://www.opengis.net/def/crs/OGC/1.3/CRS84"),new We("http://www.opengis.net/gml/srs/epsg.xml#4326","neu"),new We("http://www.opengis.net/def/crs/EPSG/0/4326","neu")];let Xe={};function qe(t){return Xe[t]||Xe[t.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,"EPSG:$3")]||null}let Ue={};function Ye(t,e,i){const s=t.getCode(),n=e.getCode();s in Ue||(Ue[s]={}),Ue[s][n]=i}function Ze(t,e){return t in Ue&&e in Ue[t]?Ue[t][e]:null}const Ve=.9996,Ke=.00669438,He=Ke*Ke,$e=He*Ke,Je=Ke/(1-Ke),Qe=Math.sqrt(1-Ke),ti=(1-Qe)/(1+Qe),ei=ti*ti,ii=ei*ti,si=ii*ti,ni=si*ti,ri=.9983242984503243,oi=15*He/256+45*$e/1024,ai=35*$e/3072,hi=1.5*ti-27/32*ii+269/512*ni,li=21/16*ei-55/32*si,ci=151/96*ii-417/128*ni,ui=1097/512*si,di=6378137;function fi(t,e,i){const s=t-5e5,n=(i.north?e:e-1e7)/Ve/(di*ri),r=n+hi*Math.sin(2*n)+li*Math.sin(4*n)+ci*Math.sin(6*n)+ui*Math.sin(8*n),o=Math.sin(r),a=o*o,h=Math.cos(r),l=o/h,c=l*l,u=c*c,d=1-Ke*a,f=Math.sqrt(1-Ke*a),g=Je*h**2,_=g*g,p=s/(di/f*Ve),m=p*p,y=m*p,x=y*p,v=x*p,w=r-l/((1-Ke)/d)*(m/2-x/24*(5+3*c+10*g-4*_-9*Je))+v*p/720*(61+90*c+298*g+45*u-252*Je-3*_);let S=(p-y/6*(1+2*c+g)+v/120*(5-2*g+28*c-3*_+8*Je+24*u))/h;return S=Ce(S+ve(_i(i.number)),-Math.PI,Math.PI),[xe(S),xe(w)]}function gi(t,e,i){t=Ce(t,-180,180),e<-80?e=-80:e>84&&(e=84);const s=ve(e),n=Math.sin(s),r=Math.cos(s),o=n/r,a=o*o,h=a*a,l=ve(t),c=ve(_i(i.number)),u=di/Math.sqrt(1-Ke*n**2),d=Je*r**2,f=r*Ce(l-c,-Math.PI,Math.PI),g=f*f,_=g*f,p=_*f,m=p*f,y=m*f,x=di*(ri*s-.002514607064228144*Math.sin(2*s)+oi*Math.sin(4*s)-ai*Math.sin(6*s)),v=Ve*u*(f+_/6*(1-a+d)+m/120*(5-18*a+h+72*d-58*Je))+5e5;let w=Ve*(x+u*o*(g/2+p/24*(5-a+9*d+4*d**2)+y/720*(61-58*a+h+600*d-330*Je)));return i.north||(w+=1e7),[v,w]}function _i(t){return 6*(t-1)-180+3}const pi=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function mi(t){let e=0;for(const i of pi){const s=t.match(i);if(s){e=parseInt(s[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 yi(t,e){return function(i,s,n,r){const o=i.length;n=n>1?n:2,r=r??n,s||(s=n>2?i.slice():new Array(o));for(let n=0;n<o;n+=r){const r=i[n],o=i[n+1],a=t(r,o,e);s[n]=a[0],s[n+1]=a[1]}return s}}function xi(t,e,i){i=i||6371008.8;const s=ve(t[1]),n=ve(e[1]),r=(n-s)/2,o=ve(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 vi=[function(t){const e=mi(t.getCode());return e?{forward:yi(gi,e),inverse:yi(fi,e)}:null}],wi=[function(t){return mi(t)?new Ge({code:t,units:"m"}):null}];let Si=!0;function Mi(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 bi(t){!function(t,e){Xe[t]=e}(t.getCode(),t),Ye(t,t,Mi)}function Ei(t){if("string"!=typeof t)return t;const e=qe(t);if(e)return e;for(const e of wi){const i=e(t);if(i)return i}return null}function Ci(t,e,i,s){let n;const r=(t=Ei(t)).getPointResolutionFunc();if(r){if(n=r(e,i),s&&s!==t.getUnits()){const e=t.getMetersPerUnit();e&&(n=n*e/Te[s])}}else{const r=t.getUnits();if("degrees"==r&&!s||"degrees"==s)n=e;else{const o=Oi(t,Ei("EPSG:4326"));if(o||"degrees"===r){let t=[i[0]-e/2,i[1],i[0]+e/2,i[1],i[0],i[1]-e/2,i[0],i[1]+e/2];t=o(t,t,2),n=(xi(t.slice(0,2),t.slice(2,4))+xi(t.slice(4,6),t.slice(6,8)))/2}else n=e*t.getMetersPerUnit();const a=s?Te[s]:t.getMetersPerUnit();void 0!==a&&(n/=a)}}return n}function Pi(t){!function(t){t.forEach(bi)}(t),t.forEach(function(e){t.forEach(function(t){e!==t&&Ye(e,t,Mi)})})}function Ii(t,e){return t?"string"==typeof t?Ei(t):t:Ei(e)}function Ri(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 Ti(t,e,i,s){const n=Ei(t),r=Ei(e);Ye(n,r,Ri(i)),Ye(r,n,Ri(s))}function Gi(t,e){if(t===e)return!0;const i=t.getUnits()===e.getUnits();return(t.getCode()===e.getCode()||Oi(t,e)===Mi)&&i}function Oi(t,e){const i=t.getCode(),s=e.getCode();let n=Ze(i,s);if(n)return n;let r=null,o=null;for(const i of vi)r||(r=i(t)),o||(o=i(e));if(!r&&!o)return null;const a="EPSG:4326";if(o)if(r)n=ki(r.inverse,o.forward);else{const t=Ze(i,a);t&&(n=ki(t,o.forward))}else{const t=Ze(a,s);t&&(n=ki(r.inverse,t))}return n&&(bi(t),bi(e),Ye(t,e,n)),n}function ki(t,e){return function(i,s,n,r){return s=t(i,s,n,r),e(s,s,n,r)}}function Ai(t,e){return Oi(Ei(t),Ei(e))}function Fi(t,e,i){const s=Ai(e,i);if(!s){const t=Ei(e).getCode(),s=Ei(i).getCode();throw new Error(`No transform available between ${t} and ${s}`)}return s(t,void 0,t.length)}function Li(t,e,i,s){return function(t,e,i,s){if(he(t))return zt(i);let n=[];if(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 t=0,e=n.length;t<e;t+=2)r.push(n[t]),o.push(n[t+1]);return function(t,e,i){return Dt(Math.min.apply(null,t),Math.min.apply(null,e),Math.max.apply(null,t),Math.max.apply(null,e),i)}(r,o,i)}(t,Ai(e,i),void 0,s)}let ji=null;function Ni(){return ji}function Di(t,e){return t}function zi(t,e){return Si&&!Pe(t,[0,0])&&t[0]>=-180&&t[0]<=180&&t[1]>=-90&&t[1]<=90&&(Si=!1,function(...t){_e>ge||console.warn(...t)}("Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.")),t}function Wi(t,e){return t}function Bi(t,e){return t}function Xi(t,e){return t}function qi(t,e,i){return function(s){let n,r;if(t.canWrapX()){const e=t.getExtent(),o=oe(e);r=Re(s=s.slice(0),t,o),r&&(s[0]=s[0]-r*o),s[0]=pe(s[0],e[0],e[2]),s[1]=pe(s[1],e[1],e[3]),n=i(s)}else n=i(s);return r&&e.canWrapX()&&(n[0]+=r*oe(e.getExtent())),n}}var Ui,Yi,Zi;function Vi(t,e){return[[-1/0,-1/0,1/0,1/0]]}function Ki(t,e,i,s){const n=[];let r=[1/0,1/0,-1/0,-1/0];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Bt(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 Hi(t,e,i,s,n){return!Vt(n,function(n){return!$i(t,e,i,s,n[0],n[1])})}function $i(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 Ji(t,e,i,s,n,r){if(0===i.length)return!1;if(!$i(t,e,i[0],s,n,r))return!1;for(let e=1,o=i.length;e<o;++e)if($i(t,i[e-1],i[e],s,n,r))return!1;return!0}function Qi(t,e,i,s,n,r,o){let a,h,l,c,u,d,f;const g=n[r+1],_=[];for(let n=0,r=i.length;n<r;++n){const r=i[n];for(c=t[r-s],d=t[r-s+1],a=e;a<r;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,_.push(l)),c=u,d=f}let p=NaN,m=-1/0;for(_.sort(ct),c=_[0],a=1,h=_.length;a<h;++a){u=_[a];const n=Math.abs(u-c);n>m&&(l=(c+u)/2,Ji(t,e,i,s,l,g)&&(p=l,m=n)),c=u}return isNaN(p)&&(p=n[r]),o?(o.push(p,g,m),o):[p,g,m]}function ts(t,e,i,s,n){let r=[];for(let o=0,a=i.length;o<a;++o){const a=i[o];r=Qi(t,e,a,s,n,2*o,r),e=a[a.length-1]}return r}function es(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=function(t,e,i){let s,n;i=i||ct;let r=0,o=t.length,a=!1;for(;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}(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=o>1?o:2,r=r||new Array(o);for(let e=0;e<o;++e)r[e]=void 0===a?NaN:void 0===h?t[a+e]:Se(t[a+e],t[a+s+e],h);return r}function is(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;for(;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=(n-l)/(t[(a+1)*s-1]-l);o=[];for(let e=0;e<s-1;++e)o.push(Se(t[(a-1)*s+e],t[a*s+e],c));return o.push(n),o}function ss(t,e,i,s){for(;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 ns(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 rs(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=ns(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 os(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(!rs(t,e,o,s,n))return!1;o.length&&(e=o[o.length-1])}return!0}function as(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=ns(t,e,o,s);(0===r?n&&a||!n&&!a:n&&!a||!n&&a)&&ss(t,e,o,s),e=o}return e}function hs(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r)e=as(t,e,i[r],s,n);return e}function ls(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=ns(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}function cs(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;for(;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=me(t[e],t[e+1],a,u,d,f);i>o&&(c=e,o=i)}o>n&&(h[(c-e)/s]=1,r+s<c&&l.push(r,c),c+s<i&&l.push(c,i))}for(let i=0;i<a;++i)h[i]&&(r[o++]=t[e+i*s],r[o++]=t[e+i*s+1]);return o}function us(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=cs(t,e,l,s,n,r,o),a.push(o),e=l}return o}function ds(t,e){return e*Math.round(t/e)}function fs(t,e,i,s,n,r,o){if(e==i)return o;let a,h,l=ds(t[e],n),c=ds(t[e+1],n);e+=s,r[o++]=l,r[o++]=c;do{if(a=ds(t[e],n),h=ds(t[e+1],n),(e+=s)==i)return r[o++]=a,r[o++]=h,o}while(a==l&&h==c);for(;e<i;){const i=ds(t[e],n),u=ds(t[e+1],n);if(e+=s,i==a&&u==h)continue;const d=a-l,f=h-c,g=i-l,_=u-c;d*_==f*g&&(d<0&&g<d||d==g||d>0&&g>d)&&(f<0&&_<f||f==_||f>0&&_>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 gs(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h];o=fs(t,e,l,s,n,r,o),a.push(o),e=l}return o}function _s(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 e=2;e<o;e++)r[a++]=t[h+e]}return r&&r.length!=a&&(r.length=a),r}function ps(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 n=e;n<i;n+=s){const e=t[n]-l,i=t[n+1]-c;o[u++]=l+e*a-i*h,o[u++]=c+e*h+i*a;for(let e=n+2;e<n+s;++e)o[u++]=t[e]}return o&&o.length!=u&&(o.length=u),o}Pi(Ne),Pi(Be),Ui=Ne,Yi=function(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s){e[i]=ke*t[i]/180;let s=Oe*Math.log(Math.tan(Math.PI*(+t[i+1]+90)/360));s>Le?s=Le:s<-Le&&(s=-Le),e[i+1]=s}return e},Zi=function(t,e,i,s){const n=t.length;i=i>1?i:2,s=s??i,void 0===e&&(e=i>2?t.slice():new Array(n));for(let i=0;i<n;i+=s)e[i]=180*t[i]/ke,e[i+1]=360*Math.atan(Math.exp(t[i+1]/Oe))/Math.PI-90;return e},Be.forEach(function(t){Ui.forEach(function(e){Ye(t,e,Yi),Ye(e,t,Zi)})});const ms=[1,0,0,1,0,0],ys=new Array(6);function xs(){return ms.slice(0)}function vs(t){return Ss(t,1,0,0,1,0,0)}function ws(t,e){const i=t[0],s=t[1],n=t[2],r=t[3],o=t[4],a=t[5],h=e[0],l=e[1],c=e[2],u=e[3],d=e[4],f=e[5];return t[0]=i*h+n*l,t[1]=s*h+r*l,t[2]=i*c+n*u,t[3]=s*c+r*u,t[4]=i*d+n*f+o,t[5]=s*d+r*f+a,t}function Ss(t,e,i,s,n,r,o){return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t[4]=r,t[5]=o,t}function Ms(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 bs(t,e,i){return ws(t,Ss(ys,e,0,0,i,0,0))}function Es(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}const Cs=[1e5,1e5,1e5,1e5,2,2];function Ps(t){return t.substring(7,t.length-1).split(",").map(parseFloat)}const Is=xs();class Rs{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_?Wt(this.flatCoordinates_):Bt(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_)),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){const t=Jt(this.getExtent());this.flatInteriorPoints_=Qi(this.flatCoordinates_,0,this.ends_,this.stride_,t,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){const t=ls(this.flatCoordinates_,this.ends_),e=Ki(this.flatCoordinates_,0,t,this.stride_);this.flatInteriorPoints_=ts(this.flatCoordinates_,0,t,this.stride_,e)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||(this.flatMidpoints_=es(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=es(t,e,n,this.stride_,.5);gt(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){const e=(t=Ei(t)).getExtent(),i=t.getWorldExtent();if(e&&i){const t=ee(i)/ee(e);Es(Is,i[0],i[3],t,-t,0,0,0),_s(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,Is,this.flatCoordinates_)}}applyTransform(t){t(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new Rs(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=yt((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=cs(i,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,i,0),s=[i.length];break;case"MultiLineString":s=[],i.length=us(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,i,0,s);break;case"Polygon":s=[],i.length=gs(i,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),i,0,s)}return s&&(this.simplifiedGeometry_=new Rs(this.type_,i,s,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}}Rs.prototype.getFlatCoordinates=Rs.prototype.getOrientedFlatCoordinates;const Ts=Rs;function Gs(t,e,i=0,s=t.length-1,n=ks){for(;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);Gs(t,e,Math.max(i,Math.floor(e-o*h/r+l)),Math.min(s,Math.floor(e+(r-o)*h/r+l)),n)}const r=t[e];let o=i,a=s;for(Os(t,i,e),n(t[s],r)>0&&Os(t,i,s);o<a;){for(Os(t,o,a),o++,a--;n(t[o],r)<0;)o++;for(;n(t[a],r)>0;)a--}0===n(t[i],r)?Os(t,i,a):(a++,Os(t,a,s)),a<=e&&(i=a+1),e<=a&&(s=a-1)}}function Os(t,e,i){const s=t[e];t[e]=t[i],t[i]=s}function ks(t,e){return t<e?-1:t>e?1:0}class As{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(!Ys(t,e))return i;const s=this.toBBox,n=[];for(;e;){for(let r=0;r<e.children.length;r++){const o=e.children[r],a=e.leaf?s(o):o;Ys(t,a)&&(e.leaf?i.push(o):Us(t,a)?this._all(o,i):n.push(o))}e=n.pop()}return i}collides(t){let e=this.data;if(!Ys(t,e))return!1;const i=[];for(;e;){for(let s=0;s<e.children.length;s++){const n=e.children[s],r=e.leaf?this.toBBox(n):n;if(Ys(t,r)){if(e.leaf||Us(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=Zs([]),this}remove(t,e){if(!t)return this;let i=this.data;const s=this.toBBox(t),n=[],r=[];let o,a,h;for(;i||n.length;){if(i||(i=n.pop(),a=n[n.length-1],o=r.pop(),h=!0),i.leaf){const s=Fs(t,i.children,e);if(-1!==s)return i.children.splice(s,1),n.push(i),this._condense(n),this}h||i.leaf||!Us(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=[];for(;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=Zs(t.slice(e,i+1)),Ls(r,this.toBBox),r;s||(s=Math.ceil(Math.log(n)/Math.log(o)),o=Math.ceil(n/Math.pow(o,s-1))),r=Zs([]),r.leaf=!1,r.height=s;const a=Math.ceil(n/o),h=a*Math.ceil(Math.sqrt(o));Vs(t,e,i,h,this.compareMinX);for(let n=e;n<=i;n+=h){const e=Math.min(n+h-1,i);Vs(t,n,e,a,this.compareMinY);for(let i=n;i<=e;i+=a){const n=Math.min(i+a-1,e);r.children.push(this._build(t,i,n,s-1))}}return Ls(r,this.toBBox),r}_chooseSubtree(t,e,i,s){for(;s.push(e),!e.leaf&&s.length-1!==i;){let i,s=1/0,n=1/0;for(let r=0;r<e.children.length;r++){const o=e.children[r],a=Ws(o),h=Xs(t,o)-a;h<n?(n=h,s=a<s?a:s,i=o):h===n&&a<s&&(s=a,i=o)}e=i||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);for(r.children.push(t),Ns(r,s);e>=0&&n[e].children.length>this._maxEntries;)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=Zs(i.children.splice(r,i.children.length-r));o.height=i.height,o.leaf=i.leaf,Ls(i,this.toBBox),Ls(o,this.toBBox),e?t[e-1].children.push(o):this._splitRoot(i,o)}_splitRoot(t,e){this.data=Zs([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Ls(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=js(t,0,o,this.toBBox),a=js(t,o,i,this.toBBox),h=qs(e,a),l=Ws(e)+Ws(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:Ds,n=t.leaf?this.compareMinY:zs;this._allDistMargin(t,e,i,s)<this._allDistMargin(t,e,i,n)&&t.children.sort(s)}_allDistMargin(t,e,i,s){t.children.sort(s);const n=this.toBBox,r=js(t,0,e,n),o=js(t,i-e,i,n);let a=Bs(r)+Bs(o);for(let s=e;s<i-e;s++){const e=t.children[s];Ns(r,t.leaf?n(e):e),a+=Bs(r)}for(let s=i-e-1;s>=e;s--){const e=t.children[s];Ns(o,t.leaf?n(e):e),a+=Bs(o)}return a}_adjustParentBBoxes(t,e,i){for(let s=i;s>=0;s--)Ns(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():Ls(t[i],this.toBBox)}}function Fs(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 Ls(t,e){js(t,0,t.children.length,e,t)}function js(t,e,i,s,n){n||(n=Zs(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];Ns(n,t.leaf?s(e):e)}return n}function Ns(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 Ds(t,e){return t.minX-e.minX}function zs(t,e){return t.minY-e.minY}function Ws(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function Bs(t){return t.maxX-t.minX+(t.maxY-t.minY)}function Xs(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 qs(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 Us(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function Ys(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function Zs(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vs(t,e,i,s,n){const r=[e,i];for(;r.length;){if((i=r.pop())-(e=r.pop())<=s)continue;const o=e+Math.ceil((i-e)/s/2)*s;Gs(t,o,e,i,n),r.push(e,o,o,i)}}const Ks=class{constructor(t){this.rbush_=new As(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_[Et(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_[Et(r)]=o}this.rbush_.load(i)}remove(t){const e=Et(t),i=this.items_[e];return delete this.items_[e],null!==this.rbush_.remove(i)}update(t,e){const i=this.items_[Et(e)];Xt([i.minX,i.minY,i.maxX,i.maxY],t)||(this.remove(e),this.insert(t,e))}getAll(){return this.rbush_.all().map(function(t){return t.value})}getInExtent(t){const e={minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]};return this.rbush_.search(e).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 nt(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(t){const e=this.rbush_.toJSON();return Dt(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]}};function Hs(t){return t?"function"==typeof t?t:(Array.isArray(t)||(t=[t]),e=>t):null}const $s=class extends Pt{constructor(t){super(),this.projection=Ei(t.projection),this.attributions_=Hs(t.attributions),this.attributionsCollapsible_=t.attributionsCollapsible??!0,this.loading=!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_=Hs(t),this.changed()}setState(t){this.state_=t,this.changed()}},Js="addfeature",Qs="removefeature";class tn extends xt{constructor(t,e,i){super(t),this.feature=e,this.features=i}}const en=class extends $s{constructor(t){super({attributions:(t=t||{}).attributions,interpolate:!0,projection:void 0,state:"ready",wrapX:void 0===t.wrapX||t.wrapX}),this.on,this.once,this.un,this.loader_=mt,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_&&(Gt(this.format_,"`format` must be set when `url` is set"),this.loader_=fe(this.url_,this.format_)),this.strategy_=void 0!==t.strategy?t.strategy:Vi;const e=void 0===t.useSpatialIndex||t.useSpatialIndex;let i,s;this.featuresRtree_=e?new Ks:null,this.loadedExtentsRtree_=new Ks,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 Tt(s)),void 0!==s&&this.addFeaturesInternal(s),void 0!==i&&this.bindFeaturesCollection_(i)}addFeature(t){this.addFeatureInternal(t),this.changed()}addFeatureInternal(t){const e=Et(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 tn(Js,t))}setupChangeEvents_(t,e){e instanceof Ts||(this.featureChangeKeys_[t]=[rt(e,ht,this.handleFeatureChange_,this),rt(e,it,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 Ts){const s=this.idIndex_[t];s instanceof Ts?Array.isArray(s)?s.push(e):this.idIndex_[t]=[s,e]:i=!1}else i=!1;else this.idIndex_[t]=e}return i&&(Gt(!(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 e=0,s=t.length;e<s;e++){const s=t[e],n=Et(s);this.addToIndex_(n,s)&&i.push(s)}for(let t=0,n=i.length;t<n;t++){const n=i[t],r=Et(n);this.setupChangeEvents_(r,n);const o=n.getGeometry();if(o){const t=o.getExtent();e.push(t),s.push(n)}else this.nullGeometryFeatures_[r]=n}if(this.featuresRtree_&&this.featuresRtree_.load(e,s),this.hasListener(Js))for(let t=0,e=i.length;t<e;t++)this.dispatchEvent(new tn(Js,i[t]))}bindFeaturesCollection_(t){let e=!1;this.addEventListener(Js,function(i){e||(e=!0,t.push(i.feature),e=!1)}),this.addEventListener(Qs,function(i){e||(e=!0,t.remove(i.feature),e=!1)}),t.addEventListener(tt,t=>{e||(e=!0,this.addFeature(t.element),e=!1)}),t.addEventListener(et,t=>{e||(e=!0,this.removeFeature(t.element),e=!1)}),this.featuresCollection_=t}clear(t){if(t){for(const t in this.featureChangeKeys_)this.featureChangeKeys_[t].forEach(at);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 tn("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 Ts||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 Ts||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(),nt(this.nullGeometryFeatures_)||gt(t,Object.values(this.nullGeometryFeatures_))),t}getFeaturesAtCoordinate(t){const e=[];return this.forEachFeatureAtCoordinateDirect(t,function(t){e.push(t)}),e}getFeaturesInExtent(t,e){if(this.featuresRtree_){if(!(e&&e.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(t);const i=ce(t,e);return[].concat(...i.map(t=>this.featuresRtree_.getInExtent(t)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(t,e){const i=t[0],s=t[1];let n=null;const r=[NaN,NaN];let o=1/0;const a=[-1/0,-1/0,1/0,1/0];return e=e||pt,this.featuresRtree_.forEachInExtent(a,function(t){if(e(t)){const e=t.getGeometry(),h=o;if(o=e instanceof Ts?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}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=Et(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 tn("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 Et(t)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&nt(this.nullGeometryFeatures_):!this.featuresCollection_||0===this.featuresCollection_.getLength()}loadFeatures(t,e,i){const s=this.loadedExtentsRtree_,n=this.strategy_(t,e,i);for(let t=0,r=n.length;t<r;++t){const r=n[t];if(!s.forEachInExtent(r,function(t){return Lt(t.extent,r)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new tn("featuresloadstart"));const t=t=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new tn("featuresloadend",void 0,t))},n=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new tn("featuresloaderror"))};let o=!1;const a=this.loader_.call(this,r,e,i,e=>o||t(e),()=>o||n());a instanceof Promise?(o=!0,a.then(e=>{this.addFeatures(e),t(e)}).catch(n)):this.loader_.length<4&&(this.loading=!1),s.insert(r,{extent:r.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=se(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){t&&this.removeFeatureInternal(t)&&this.changed()}removeFeatureInternal(t){const e=Et(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(at),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(Qs)&&this.dispatchEvent(new tn(Qs,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){Gt(this.format_,"`format` must be set when `url` is set"),this.url_=t,this.setLoader(fe(t,this.format_))}setOverlaps(t){this.overlaps_=t,this.changed()}},sn="undefined"!=typeof navigator&&void 0!==navigator.userAgent?navigator.userAgent.toLowerCase():"",nn=(sn.includes("safari")&&!sn.includes("chrom")&&(sn.includes("version/15.4")||/cpu (os|iphone os) 15_4 like mac os x/.test(sn)),sn.includes("webkit")&&sn.includes("edge"),sn.includes("macintosh"),"undefined"!=typeof devicePixelRatio&&devicePixelRatio,"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof OffscreenCanvas&&self instanceof WorkerGlobalScope),rn="undefined"!=typeof Image&&Image.prototype.decode;function on(t,e,i,s){let n;return n=i&&i.length?i.shift():nn?new class extends OffscreenCanvas{style={}}(t??300,e??150):document.createElement("canvas"),t&&(n.width=t),e&&(n.height=e),n.getContext("2d",s)}let an;function hn(){return an||(an=on(1,1)),an}function ln(t){const e=t.canvas;e.width=1,e.height=1,t.clearRect(0,0,1,1)}function cn(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas}!function(){let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("_",null,e),window.removeEventListener("_",null,e)}catch{}}();const un="prerender",dn="postrender",fn=[NaN,NaN,NaN,0];let gn;const _n=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,pn=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,mn=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,yn=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function xn(t,e){return t.endsWith("%")?Number(t.substring(0,t.length-1))/e:Number(t)}function vn(t){throw new Error('failed to parse "'+t+'" as color')}function wn(t){if(t.toLowerCase().startsWith("rgb")){const e=t.match(pn)||t.match(_n)||t.match(mn);if(e){const t=e[4],i=100/255;return[pe(xn(e[1],i)+.5|0,0,255),pe(xn(e[2],i)+.5|0,0,255),pe(xn(e[3],i)+.5|0,0,255),void 0!==t?pe(xn(t,100),0,1):1]}vn(t)}if(t.startsWith("#")){if(yn.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}vn(t)}const e=(gn||(gn=on(1,1,void 0,{willReadFrequently:!0,desynchronized:!0})),gn);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&&vn(t));const s=e.fillStyle;if(s.startsWith("#")||s.startsWith("rgba"))return wn(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]=Me(n[3]/255,3),n}const Sn={};let Mn=0;function bn(t){if(4===t.length)return t;const e=t.slice();return e[3]=1,e}function En(t){return t>.0031308?269.025*Math.pow(t,1/2.4)-14.025:3294.6*t}function Cn(t){return t>.2068965?Math.pow(t,3):108/841*(t-4/29)}function Pn(t){return t>10.314724?Math.pow((t+14.025)/269.025,2.4):t/3294.6}function In(t){return t>.0088564?Math.pow(t,1/3):t/(108/841)+4/29}function Rn(t){const e=Pn(t[0]),i=Pn(t[1]),s=Pn(t[2]),n=In(.222488403*e+.716873169*i+.06060791*s),r=500*(In(.452247074*e+.399439023*i+.148375274*s)-n),o=200*(n-In(.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 Tn(t){if("none"===t)return fn;if(Sn.hasOwnProperty(t))return Sn[t];if(Mn>=1024){let t=0;for(const e in Sn)3&t++||(delete Sn[e],--Mn)}const e=wn(t);4!==e.length&&vn(t);for(const i of e)isNaN(i)&&vn(t);return Sn[t]=e,++Mn,e}function Gn(t){return Array.isArray(t)?t:Tn(t)}function On(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];return s!=(0|s)&&(s=s+.5|0),"rgba("+e+","+i+","+s+","+(void 0===t[3]?1:Math.round(1e3*t[3])/1e3)+")"}function kn(t,e){return t+":"+(e?Gn(e):"null")}const An=new class{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];3&t++||i.hasListener()||(delete this.cache_[e],delete this.patternCache_[e],--this.cacheSize_)}}}get(t,e){const i=kn(t,e);return i in this.cache_?this.cache_[i]:null}getPattern(t,e){const i=kn(t,e);return i in this.patternCache_?this.patternCache_[i]:null}set(t,e,i,s){const n=kn(t,e),r=n in this.cache_;this.cache_[n]=i,s&&(0===i.getImageState()&&i.load(),1===i.getImageState()?i.ready().then(()=>{this.patternCache_[n]=hn().createPattern(i.getImage(1),"repeat")}):this.patternCache_[n]=hn().createPattern(i.getImage(1),"repeat")),r||++this.cacheSize_}setSize(t){this.maxCacheSize_=t,this.expire()}};let Fn=null;class Ln extends vt{constructor(t,e,i,s,n){super(),this.hitDetectionImage_=null,this.image_=t,this.crossOrigin_=i?.crossOrigin,this.referrerPolicy_=i?.referrerPolicy,this.canvas_={},this.color_=n,this.imageState_=void 0===s?0: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_&&2===this.imageState_){Fn||(Fn=on(1,1,void 0,{willReadFrequently:!0})),Fn.drawImage(this.image_,0,0);try{Fn.getImageData(0,0,1,1),this.tainted_=!1}catch{Fn=null,this.tainted_=!0}}return!0===this.tainted_}dispatchChangeEvent_(){this.dispatchEvent(ht)}handleImageError_(){this.imageState_=3,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=2,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(t){return this.image_||this.initializeImage_(),this.replaceColor_(t),this.canvas_[t]?this.canvas_[t]:this.image_}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_[0],e=this.size_[1],i=on(t,e);i.fillRect(0,0,t,e),this.hitDetectionImage_=i.canvas}else this.hitDetectionImage_=this.image_;return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(0===this.imageState_){this.image_||this.initializeImage_(),this.imageState_=1;try{void 0!==this.src_&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&(t=this.image_,e=this.src_,e&&(t.src=e),t.src&&rn?new Promise((e,i)=>t.decode().then(()=>e(t)).catch(s=>t.complete&&t.width?e(t):i(s))):function(t){return new Promise((e,i)=>{function s(){r(),e(t)}function n(){r(),i(new Error("Image load error"))}function r(){t.removeEventListener("load",s),t.removeEventListener("error",n)}t.addEventListener("load",s),t.addEventListener("error",n)})}(t)).then(t=>{this.image_=t,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}var t,e}replaceColor_(t){if(!this.color_||this.canvas_[t]||2!==this.imageState_)return;const e=this.image_,i=on(Math.ceil(e.width*t),Math.ceil(e.height*t)),s=i.canvas;var n;i.scale(t,t),i.drawImage(e,0,0),i.globalCompositeOperation="multiply",i.fillStyle="string"==typeof(n=this.color_)?n:On(n),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(2===this.imageState_||3===this.imageState_)t();else{const e=()=>{2!==this.imageState_&&3!==this.imageState_||(this.removeEventListener(ht,e),t())};this.addEventListener(ht,e)}})),this.ready_}}function jn(t,e,i,s,n,r){let o=void 0===e?void 0:An.get(e,n);return o||(o=new Ln(t,t&&"src"in t?t.src||void 0:e,i,s,n),An.set(e,n,o,r)),r&&o&&!An.getPattern(e,n)&&An.set(e,n,o,r),o}const Nn=Ln;function Dn(t){return t?Array.isArray(t)?On(t):"object"==typeof t&&"src"in t?function(t){if(!t.offset||!t.size)return An.getPattern(t.src,t.color);const e=t.src+":"+t.offset,i=An.getPattern(e,t.color);if(i)return i;const s=An.get(t.src,null);if(2!==s.getImageState())return null;const n=on(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]),jn(n.canvas,e,void 0,2,t.color,!0),An.getPattern(e,t.color)}(t):t:null}function zn(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 Wn(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++]=zn(t,e,a,s,n[r]),e=a}return n.length=r,n}function Bn(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?[]:Wn(t,e,a,s,n[r]),e=a[a.length-1]}return n.length=r,n}const Xn=class{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){}},qn=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"),Un=["style","variant","weight","size","lineHeight","family"],Yn={normal:400,bold:700},Zn=function(t){const e=t.match(qn);if(!e)return null;const i={lineHeight:"normal",size:"1.2em",style:"normal",weight:"400",variant:"normal"};for(let t=0,s=Un.length;t<s;++t){const s=e[t+1];void 0!==s&&(i[Un[t]]="string"==typeof s?s.trim():s)}return isNaN(Number(i.weight))&&i.weight in Yn&&(i.weight=Yn[i.weight]),i.families=i.family.split(/,\s?/).map(t=>t.trim().replace(/^['"]|['"]$/g,"")),i},Vn="10px sans-serif",Kn="#000",Hn="round",$n=[],Jn="round",Qn="#000",tr="center",er="middle",ir=[0,0,0,0],sr=new Pt;let nr,rr=null;const or={},ar=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]);function hr(t,e,i){return`${t} ${e} 16px "${i}"`}const lr=function(){const t=100;let e,i;async function s(t){await i.ready;const e=Zn(t),s=e.families[0].toLowerCase(),n=e.weight,r=[];return i.forEach(t=>{const i=t.family.replace(/^['"]|['"]$/g,"").toLowerCase(),o=Yn[t.weight]||t.weight;i===s&&t.style===e.style&&o==n&&r.push(t)}),0!==r.length&&(await Promise.all(r.map(t=>t.load().then(()=>!0,()=>!1)))).some(t=>t)}async function n(){await i.ready;let r=!0;const o=sr.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)?(st(or),sr.set(i,t)):(n+=10,sr.set(i,n,!0),n<t&&(r=!1)))}e=void 0,r||(e=setTimeout(n,100))}return async function(t){i||(i=nn?self.fonts:document.fonts);const s=Zn(t);if(!s)return;const r=s.families;let o=!1;for(const t of r){if(ar.has(t))continue;const e=hr(s.style,s.weight,t);void 0===sr.get(e)&&(sr.set(e,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(n,100))}}(),cr=function(){let t;return function(e){let i=or[e];if(null==i){if(nn){const t=Zn(e),s=ur(e,"Žg");i=(isNaN(Number(t.lineHeight))?1.2:Number(t.lineHeight))*(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);or[e]=i}return i}}();function ur(t,e){return rr||(rr=on(1,1)),t!=nr&&(rr.font=t,nr=rr.font),rr.measureText(e)}function dr(t,e){return ur(t,e).width}function fr(t,e,i){if(e in i)return i[e];const s=e.split("\n").reduce((e,i)=>Math.max(e,dr(t,i)),0);return i[e]=s,s}const gr={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},_r=[gr.FILL],pr=[gr.STROKE],mr=[gr.BEGIN_PATH],yr=[gr.CLOSE_PATH],xr=gr,vr=class extends Xn{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],Ft(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,_=!0;for(d=e+s;d<i;d+=s)u[0]=t[d],u[1]=t[d+1],g=Nt(h,u),g!==f?(_&&(o[a++]=l,o[a++]=c,_=!1),o[a++]=u[0],o[a++]=u[1]):1===g?(o[a++]=u[0],o[a++]=u[1],_=!1):_=!0,l=u[0],c=u[1],f=g;return(n&&_||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(),u=[];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),u.push(i)}this.instructions.push([xr.CUSTOM,a,u,t,i,Bn,n]),this.hitDetectionInstructions.push([xr.CUSTOM,a,u,t,s||i,Bn,n]);break;case"Polygon":case"MultiLineString":c=[],h="Polygon"==r?t.getOrientedFlatCoordinates():t.getFlatCoordinates(),d=this.drawCustomCoordinates_(h,0,t.getEnds(),o,c),this.instructions.push([xr.CUSTOM,a,c,t,i,Wn,n]),this.hitDetectionInstructions.push([xr.CUSTOM,a,c,t,s||i,Wn,n]);break;case"LineString":case"Circle":h=t.getFlatCoordinates(),l=this.appendFlatLineCoordinates(h,0,h.length,o,!1,!1),this.instructions.push([xr.CUSTOM,a,l,t,i,zn,n]),this.hitDetectionInstructions.push([xr.CUSTOM,a,l,t,s||i,zn,n]);break;case"MultiPoint":h=t.getFlatCoordinates(),l=this.appendFlatPointCoordinates(h,o),l>a&&(this.instructions.push([xr.CUSTOM,a,l,t,i,zn,n]),this.hitDetectionInstructions.push([xr.CUSTOM,a,l,t,s||i,zn,n]));break;case"Point":h=t.getFlatCoordinates(),this.coordinates.push(h[0],h[1]),l=this.coordinates.length,this.instructions.push([xr.CUSTOM,a,l,t,i,void 0,n]),this.hitDetectionInstructions.push([xr.CUSTOM,a,l,t,s||i,void 0,n])}this.endGeometry(e)}beginGeometry(t,e,i){this.beginGeometryInstruction1_=[xr.BEGIN_GEOMETRY,e,0,t,i],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[xr.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==xr.END_GEOMETRY?r=e:n==xr.BEGIN_GEOMETRY&&(s[2]=e,ft(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=Dn(i||Kn)??void 0}else e.fillStyle=void 0;return e}strokeStyleToState(t,e={}){if(t){const i=t.getColor();e.strokeStyle=Dn(i||Qn);const s=t.getLineCap();e.lineCap=void 0!==s?s:Hn;const n=t.getLineDash();e.lineDash=n?n.slice():$n;const r=t.getLineDashOffset();e.lineDashOffset=r||0;const o=t.getLineJoin();e.lineJoin=void 0!==o?o:Jn;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=[xr.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(t.fillPatternScale),i}applyStroke(t){this.instructions.push(this.createStroke(t))}createStroke(t){return[xr.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&&!_t(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=[xr.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=this.maxExtent.slice(),this.maxLineWidth>0)){const t=this.resolution*(this.maxLineWidth+1)/2;kt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},wr=class extends vr{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinatess_(t,e,i,s,n){const r=this.state,o=void 0!==r.fillStyle,a=void 0!==r.strokeStyle,h=i.length;this.instructions.push(mr),this.hitDetectionInstructions.push(mr);for(let r=0;r<h;++r){const o=i[r],h=this.coordinates.length,l=this.appendFlatLineCoordinates(t,e,o,s,!0,!a);this.instructions.push([xr.MOVE_TO_LINE_TO,h,l,n*this.pixelRatio,!0]),this.hitDetectionInstructions.push([xr.MOVE_TO_LINE_TO,h,l,n,!0]),a&&(this.instructions.push(yr),this.hitDetectionInstructions.push(yr)),e=o}return o&&(this.instructions.push(_r),this.hitDetectionInstructions.push(_r)),a&&(this.instructions.push(pr),this.hitDetectionInstructions.push(pr)),e}drawCircle(t,e,i){const s=this.state,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),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([xr.SET_FILL_STYLE,Kn]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([xr.SET_STROKE_STYLE,Qn,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,$n,0]);const a=t.getFlatCoordinates(),h=t.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(a,0,a.length,h,!1,!1);const c=[xr.CIRCLE,l,o];this.instructions.push(mr,c),this.hitDetectionInstructions.push(mr,c),void 0!==s.fillStyle&&(this.instructions.push(_r),this.hitDetectionInstructions.push(_r)),void 0!==s.strokeStyle&&(this.instructions.push(pr),this.hitDetectionInstructions.push(pr)),this.endGeometry(e)}drawPolygon(t,e,i){const s=this.state,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),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([xr.SET_FILL_STYLE,Kn]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([xr.SET_STROKE_STYLE,Qn,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,$n,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,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),void 0!==s.fillStyle&&this.hitDetectionInstructions.push([xr.SET_FILL_STYLE,Kn]),void 0!==s.strokeStyle&&this.hitDetectionInstructions.push([xr.SET_STROKE_STYLE,Qn,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,$n,0]);const a=t.getEndss(),h=t.getOrientedFlatCoordinates(),l=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinatess_(h,c,a[t],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]=ds(e[i],t)}return super.finish()}setFillStrokeStyles_(){const t=this.state;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;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)}};let Sr=0,Mr=1;function br(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 Sr=c,Mr=u,!0}function Er(t,e,i,s,n){const r=[];let o=i,a=0,h=e.slice(i,2);for(;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=Se(i,l,e),f=Se(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=Se(i,l,t/u),d=Se(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 Cr(t,e,i,s,n){let r,o,a,h,l,c,u,d,f,g,_=i,p=i,m=0,y=0,x=i;for(o=i;o<s;o+=n){const i=e[o],s=e[o+1];void 0!==l&&(f=i-l,g=s-c,h=Math.sqrt(f*f+g*g),void 0!==u&&(y+=a,r=Math.acos((u*f+d*g)/(a*h)),r>t&&(y>m&&(m=y,_=x,p=o),y=0,x=o-n)),a=h,u=f,d=g),l=i,c=s}return y+=h,y>m?[x,o]:[_,p]}const Pr={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Ir={Circle:wr,Default:vr,Image:class extends vr{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&&!Ft(this.maxExtent,t.getFlatCoordinates()))return;this.beginGeometry(t,e,i);const s=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,o=this.appendFlatPointCoordinates(s,n);this.instructions.push([xr.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xr.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);const s=t.getFlatCoordinates(),n=[];for(let e=0,i=s.length;e<i;e+=t.getStride())this.maxExtent&&!Ft(this.maxExtent,s.slice(e,e+2))||n.push(s[e],s[e+1]);const r=this.coordinates.length,o=this.appendFlatPointCoordinates(n,2);this.instructions.push([xr.DRAW_IMAGE,r,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([xr.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();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}},LineString:class extends vr{constructor(t,e,i,s){super(t,e,i,s)}drawFlatCoordinates_(t,e,i,s,n){const r=this.coordinates.length,o=this.appendFlatLineCoordinates(t,e,i,s,!1,!1);return this.instructions.push([xr.MOVE_TO_LINE_TO,r,o,n*this.pixelRatio]),this.hitDetectionInstructions.push([xr.MOVE_TO_LINE_TO,r,o,n]),i}drawLineString(t,e,i){const s=this.state,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),this.hitDetectionInstructions.push([xr.SET_STROKE_STYLE,Qn,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,$n,0],mr);const a=t.getFlatCoordinates(),h=t.getStride();this.drawFlatCoordinates_(a,0,a.length,h,o),this.hitDetectionInstructions.push(pr),this.endGeometry(e)}drawMultiLineString(t,e,i){const s=this.state,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),this.hitDetectionInstructions.push([xr.SET_STROKE_STYLE,Qn,s.lineWidth,s.lineCap,s.lineJoin,s.miterLimit,$n,0],mr);const a=t.getEnds(),h=t.getFlatCoordinates(),l=t.getStride();let c=0;for(let t=0,e=a.length;t<e;++t)c=this.drawFlatCoordinates_(h,c,a[t],l,o);this.hitDetectionInstructions.push(pr),this.endGeometry(e)}finish(){const t=this.state;return null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&this.instructions.push(pr),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(t){null!=t.lastStroke&&t.lastStroke!=this.coordinates.length&&(this.instructions.push(pr),t.lastStroke=this.coordinates.length),t.lastStroke=0,super.applyStroke(t),this.instructions.push(mr)}},Polygon:wr,Text:class extends vr{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[Kn]={fillStyle:Kn},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.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.push(e[t+2]/this.resolution),l.push(e[t],e[t+1]);if(0===l.length)return;c=2}const n=this.appendFlatPointCoordinates(l,c);if(n===a)return;if(s&&(n-a)/2!==l.length/c){let t=a/2;s=s.filter((e,i)=>{const s=o[2*(t+i)]===l[i*c]&&o[2*(t+i)+1]===l[i*c+1];return s||--t,s})}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);let f=r.padding;if(f!=ir&&(r.scale[0]<0||r.scale[1]<0)){let t=r.padding[0],e=r.padding[1],i=r.padding[2],s=r.padding[3];r.scale[0]<0&&(e=-e,s=-s),r.scale[1]<0&&(t=-t,i=-i),f=[t,e,i,s]}const g=this.pixelRatio;this.instructions.push([xr.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,f==ir?ir:f.map(function(t){return t*g}),u,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]);const _=1/g,p=u?u.slice(0):null;p&&(p[1]=Kn),this.hitDetectionInstructions.push([xr.DRAW_IMAGE,a,n,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[_,_],NaN,this.declutterMode_,this.declutterImageWithText_,f,p,d,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Kn:this.fillKey_,this.textOffsetX_,this.textOffsetY_,s]),this.endGeometry(e)}else{const s=t.getExtent();if(!ae(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(("LineString"==h||"MultiLineString"==h)&&!Lt(this.getBufferedMaxExtent(),s)){const t=function(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 s=0,g=e.length;s<g;++s){const g=e[s];let _=t[f],p=t[f+1],m=!1;for(let e=f+i;e<g;e+=i){const i=t[e],s=t[e+1];if(br(n,r,o,a,_,p,i,s)){const t=i-_,e=s-p,n=_+Sr*t,r=p+Sr*e,o=_+Mr*t,a=p+Mr*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}_=i,p=s}f=g}return d&&l.push(h.length),{flatCoordinates:h,ends:l}}(l,n,c,this.getBufferedMaxExtent());if(l=t.flatCoordinates,n=t.ends,c=2,0===n.length)return}this.beginGeometry(t,e,i);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?Er(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(null==d){const t=Cr(r.maxAngle,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||tr,justify:e.justify,textBaseline:e.textBaseline||er,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=Pr[s.textBaseline],l=this.textOffsetX_*a,c=this.textOffsetY_*a,u=this.text_,d=i?i.lineWidth*Math.abs(s.scale[0])/2:0;this.instructions.push([xr.DRAW_CHARS,t,e,h,s.overflow,o,s.maxAngle,a,c,n,d*a,u,r,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([xr.DRAW_CHARS,t,e,h,s.overflow,o?Kn:o,s.maxAngle,a,c,n,d*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=Dn(e.getColor()||Kn)):(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()||Hn,n.lineDash=t?t.slice():$n,n.lineDashOffset=void 0===e?0:e,n.lineJoin=r.getLineJoin()||Jn,n.lineWidth=void 0===i?1:i,n.miterLimit=void 0===s?10:s,n.strokeStyle=Dn(r.getColor()||Qn)}else n=null,this.textStrokeState_=n;i=this.textState_;const o=t.getFont()||Vn;lr(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()||er,i.backgroundFill=t.getBackgroundFill(),i.backgroundStroke=t.getBackgroundStroke(),i.padding=t.getPadding()||ir,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:Et(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:"|"+Et(s.fillStyle):""}else this.text_="";this.declutterMode_=t.getDeclutterMode(),this.declutterImageWithText_=e}}},Rr=class{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];return void 0===n&&(n=new(0,Ir[e])(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),s[e]=n),n}};function Tr(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 Gr(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,x,v=0;for(let w=e;w<i;w+=s){g=d,_=f,p=void 0,m=void 0,w+s<i&&(p=t[w+s],m=t[w+s+1]),r&&w===e&&(g=c,_=u),r&&w===i-s&&(p=h,m=l),d=t[w],f=t[w+1],[y,x]=Or(d,f,g,_,p,m,n),o[v++]=y,o[v++]=x;for(let e=2;e<a;e++)o[v++]=t[w+e]}return o.length!=v&&(o.length=v),o}function Or(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=function(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(pe(a[0]*n[0]+a[1]*n[1],-1,1));return h=Math.max(h,1e-5),a[0]*r[0]+a[1]*r[1]>0?h:2*Math.PI-h}([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);return[t+1/g*(g*a+f*h)*o,e+1/g*(-f*a+g*h)*o]}function kr(t,e,i=!1){for(let s=0,n=t.length-2;s<n;s+=e)for(let n=i&&0===s?t.length-3*e:t.length-2*e;n>s+e;n-=e){const i=t[s],r=t[s+1],o=t[s+e],a=t[s+e+1],h=t[n],l=t[n+1],c=t[n+e],u=t[n+e+1],d=(u-l)*(o-i)-(c-h)*(a-r);if(0===d)continue;const f=((c-h)*(r-l)-(u-l)*(i-h))/d,g=((o-i)*(r-l)-(a-r)*(i-h))/d;if(f>0&&f<1&&g>0&&g<1){const h=i+f*(o-i),l=r+f*(a-r);t[s+e]=h,t[s+e+1]=l,t.splice(s+2*e,n-s-e);break}}return t}let Ar;function Fr(t,e,i,s,n,r,o,a,h,l,c,u,d=!0){let f=t[e],g=t[e+1],_=0,p=0,m=0,y=0;function x(){_=f,p=g,f=t[e+=s],g=t[e+1],y+=m,m=Math.sqrt((f-_)*(f-_)+(g-p)*(g-p))}do{x()}while(e<i-s&&y+m<r);let v=0===m?0:(r-y)/m;const w=Se(_,f,v),S=Se(p,g,v),M=e-s,b=y,E=r+a*h(l,n,c);for(;e<i-s&&y+m<E;)x();v=0===m?0:(E-y)/m;const C=Se(_,f,v),P=Se(p,g,v);let I=!1;if(d)if(u){const t=[w,S,C,P];ps(t,0,4,2,u,t,t),I=t[0]>t[2]}else I=w>C;const R=Math.PI,T=[],G=M+s===e;let O;if(m=0,y=b,f=t[e=M],g=t[e+1],G){x(),O=Math.atan2(g-p,f-_),I&&(O+=O>0?-R:R);const t=(C+w)/2,e=(P+S)/2;return T[0]=[t,e,(E-r)/2,O,n],T}n=n.replace(/\n/g," ");const k=Array.from((Ar||(Ar=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Ar).segment(n),t=>t.segment);for(let t=0,n=k.length;t<n;){x();let u=Math.atan2(g-p,f-_);if(I&&(u+=u>0?-R:R),void 0!==O){let t=u-O;if(t+=t>R?-2*R:t<-R?2*R:0,Math.abs(t)>o)return null}O=u;const d=t;let w=0;for(;t<n;++t){const o=a*h(l,k[I?n-t-1:t],c);if(e+s<i&&y+m<r+w+o/2)break;w+=o}if(t===d)continue;const S=(I?k.slice(n-t,n-d):k.slice(d,t)).join("");v=0===m?0:(r+w/2-y)/m;const M=Se(_,f,v),b=Se(p,g,v);T.push([M,b,w/2,u,S]),r+=w}return T}const Lr=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(hn(),{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)}pushMethodArgs_=(...t)=>{this.push_(this.pendingMethod_,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}},jr=[1/0,1/0,-1/0,-1/0],Nr=[],Dr=[],zr=[],Wr=[];function Br(t){return t[3].declutterBox}const Xr=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 qr(t,e){return"start"===e?e=Xr.test(t)?"right":"left":"end"===e&&(e=Xr.test(t)?"left":"right"),Pr[e]}function Ur(t,e,i){return i>0&&t.push("\n",""),t.push(e,""),t}function Yr(t,e,i){return i%2==0&&(t+=e),t}const Zr=class{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_=xs(),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 Lr: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?Pr[a.justify]:qr(Array.isArray(t)?t[0]:t,a.textAlign||tr),u=s&&r.lineWidth?r.lineWidth:0,d=Array.isArray(t)?t:String(t).split("\n").reduce(Ur,[]),{width:f,height:g,widths:_,heights:p,lineWidths:m}=function(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=dr(d,u);i.push(f),o+=f;const g=cr(d);s.push(g),h=Math.max(h,g)}return{width:r,height:a,widths:i,heights:s,lineWidths:n}}(a,d),y=f+u,x=[],v=(y+2)*l[0],w=(g+u)*l[1],S={width:v<0?Math.floor(v):Math.ceil(v),height:w<0?Math.floor(w):Math.ceil(w),contextInstructions:x};1==l[0]&&1==l[1]||x.push("scale",l),s&&(x.push("strokeStyle",r.strokeStyle),x.push("lineWidth",u),x.push("lineCap",r.lineCap),x.push("lineJoin",r.lineJoin),x.push("miterLimit",r.miterLimit),x.push("setLineDash",[r.lineDash]),x.push("lineDashOffset",r.lineDashOffset)),i&&x.push("fillStyle",o.fillStyle),x.push("textBaseline","middle"),x.push("textAlign","center");const M=.5-c;let b=c*y+M*u;const E=[],C=[];let P,I=0,R=0,T=0,G=0;for(let t=0,e=d.length;t<e;t+=2){const e=d[t];if("\n"===e){R+=I,I=0,b=c*y+M*u,++G;continue}const n=d[t+1]||a.font;n!==P&&(s&&E.push("font",n),i&&C.push("font",n),P=n),I=Math.max(I,p[T]);const r=[e,b+M*_[T]+c*(_[T]-m[G]),.5*(u+I)+R];b+=_[T],s&&E.push("strokeText",r),i&&C.push("fillText",r),++T}return Array.prototype.push.apply(x,E),Array.prototype.push.apply(x,C),this.labels_[n]=S,S}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,_){let p=i-(o*=u[0]),m=s-(a*=u[1]);const y=n+h>t?t-h:n,x=r+l>e?e-l:r,v=f[3]+y*u[0]+f[1],w=f[0]+x*u[1]+f[2],S=p-f[3],M=m-f[0];let b;return(g||0!==c)&&(Nr[0]=S,Wr[0]=S,Nr[1]=M,Dr[1]=M,Dr[0]=S+v,zr[0]=Dr[0],zr[1]=M+w,Wr[1]=zr[1]),0!==c?(b=Es(xs(),i,s,1,1,c,-i,-s),Ms(b,Nr),Ms(b,Dr),Ms(b,zr),Ms(b,Wr),Dt(Math.min(Nr[0],Dr[0],zr[0],Wr[0]),Math.min(Nr[1],Dr[1],zr[1],Wr[1]),Math.max(Nr[0],Dr[0],zr[0],Wr[0]),Math.max(Nr[1],Dr[1],zr[1],Wr[1]),jr)):Dt(Math.min(S,S+v),Math.min(M,M+w),Math.max(S,S+v),Math.max(M,M+w),jr),d&&(p=Math.round(p),m=Math.round(m)),{drawImageX:p,drawImageY:m,drawImageW:y,drawImageH:x,originX:h,originY:l,declutterBox:{minX:jr[0],minY:jr[1],maxX:jr[2],maxY:jr[3],value:_},canvasTransform:b,scale:u}}replayImageOrLabel_(t,e,i,s,n,r,o){const a=!(!r&&!o),h=s.declutterBox,l=o?o[2]*s.scale[0]/2:0;return h.minX-l<=e[0]&&h.maxX+l>=0&&h.minY-l<=e[1]&&h.maxY+l>=0&&(a&&this.replayTextBackground_(t,Nr,Dr,zr,Wr,r,o),function(t,e,i,s,n,r,o,a,h,l,c){t.save(),1!==i&&(void 0===t.globalAlpha?t.globalAlpha=t=>t.globalAlpha*=i:t.globalAlpha*=i),e&&t.transform.apply(t,e),s.contextInstructions?(t.translate(h,l),t.scale(c[0],c[1]),function(t,e){const i=t.contextInstructions;for(let t=0,s=i.length;t<s;t+=2)Array.isArray(i[t+1])?e[i[t]].apply(e,i[t+1]):e[i[t]]=i[t+1]}(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()}(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=Ms(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=qr(Array.isArray(t)?t[0]:t,n.textAlign||tr),l=Pr[n.textBaseline||er],c=o&&o.lineWidth?o.lineWidth:0;return{label:r,anchorX:h*(r.width/a-2*n.scale[0])+2*(.5-h)*c,anchorY:l*r.height/a+2*(.5-l)*c}}execute_(t,e,i,s,n,r,o,a){const h=this.zIndexContext_;let l;var c,u;this.pixelCoordinates_&&_t(i,this.renderedTransform_)?l=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),l=_s(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),u=i,(c=this.renderedTransform_)[0]=u[0],c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5]);let d=0;const f=s.length;let g,_=0;const p=[];let m,y,x,v,w,S,M,b,E,C,P,I,R,T=0,G=0;const O=this.coordinateCache_,k=this.viewRotation_,A=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,F={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:k},L=this.instructions!=s||this.overlaps?0:200;let j,N,D,z;for(;d<f;){const i=s[d];switch(i[0]){case xr.BEGIN_GEOMETRY:j=i[1],z=i[3],j.getGeometry()?void 0===o||ae(o,z.getExtent())?++d:d=i[2]+1:d=i[2],h&&(h.zIndex=i[4]);break;case xr.BEGIN_PATH:T>L&&(this.fill_(t),T=0),G>L&&(t.stroke(),G=0),T||G||(t.beginPath(),w=NaN,S=NaN),++d;break;case xr.CIRCLE:_=i[1],x=i[2]??0;const s=l[_],c=l[_+1],u=l[_+2]-x-s,f=l[_+3]-x-c,W=Math.sqrt(u*u+f*f);t.moveTo(s+W,c),t.arc(s,c,W,0,2*Math.PI,!0),++d;break;case xr.CLOSE_PATH:t.closePath(),++d;break;case xr.CUSTOM:_=i[1],g=i[2];const B=i[3],X=i[4],q=i[5];F.geometry=B,F.feature=j,d in O||(O[d]=[]);const U=O[d];q?q(l,_,g,2,U):(U[0]=l[_],U[1]=l[_+1],U.length=2),h&&(h.zIndex=i[6]),X(U,F),++d;break;case xr.DRAW_IMAGE:_=i[1],g=i[2],E=i[3],m=i[4],y=i[5];let Y=i[6];const Z=i[7],V=i[8],K=i[9],H=i[10];let $=i[11];const J=i[12];let Q=i[13];v=i[14]||"declutter";const tt=i[15];if(!E&&i.length>=20){C=i[19],P=i[20],I=i[21],R=i[22];const t=this.drawLabelWithPointPlacement_(C,P,I,R);E=t.label,i[3]=E;const e=i[23];m=(t.anchorX-e)*this.pixelRatio,i[4]=m;const s=i[24];y=(t.anchorY-s)*this.pixelRatio,i[5]=y,Y=E.height,i[6]=Y,Q=E.width,i[13]=Q}let et,it,st,nt;i.length>25&&(et=i[25]),i.length>17?(it=i[16],st=i[17],nt=i[18]):(it=ir,st=null,nt=null),H&&A?$+=k:H||A||($-=k);let rt=0;for(;_<g;_+=2){if(et&&et[rt++]<Q/this.pixelRatio)continue;const i=this.calculateImageOrLabelDimensions_(E.width,E.height,l[_],l[_+1],Q,Y,m,y,V,K,$,J,n,it,!!st||!!nt,j),s=[t,e,E,i,Z,st,nt];if(a){let t,e,n,r,o;if(tt){const i=g-_;if(!tt[i]){tt[i]={args:s,declutterMode:v};continue}const r=tt[i];t=r.args,e=r.declutterMode,delete tt[i],n=Br(t)}if(!t||"declutter"===e&&a.collides(n)||(r=!0),"declutter"===v&&a.collides(i.declutterBox)||(o=!0),"declutter"===e&&"declutter"===v){const t=r&&o;r=t,o=t}r&&("none"!==e&&a.insert(n),this.replayImageOrLabel_.apply(this,t)),o&&("none"!==v&&a.insert(i.declutterBox),this.replayImageOrLabel_.apply(this,s))}else this.replayImageOrLabel_.apply(this,s)}++d;break;case xr.DRAW_CHARS:const ot=i[1],at=i[2],ht=i[3],lt=i[4];R=i[5];const ct=i[6],ut=i[7],dt=i[8];I=i[9];const ft=i[10];C=i[11],Array.isArray(C)&&(C=C.reduce(Yr,"")),P=i[12];const gt=[i[13],i[13]];v=i[14]||"declutter";const _t=i[15],pt=i[16],mt=this.textStates[P],yt=mt.font,xt=[mt.scale[0]*ut,mt.scale[1]*ut];let vt;yt in this.widths_?vt=this.widths_[yt]:(vt={},this.widths_[yt]=vt);const wt=Tr(l,ot,at,2),St=Math.abs(xt[0])*fr(yt,C,vt);if(lt||St<=wt){const i=Fr(l,ot,at,2,C,(wt-St)*qr(C,this.textStates[P].textAlign),ct,Math.abs(xt[0]),fr,yt,vt,A?0:this.viewRotation_,_t);t:if(i){const s=[];let n,r,o,h,l;if(I)for(n=0,r=i.length;n<r;++n){l=i[n],o=l[4],h=this.createLabel(o,P,"",I),m=l[2]+(xt[0]<0?-ft:ft)-pt,y=ht*h.height+2*(.5-ht)*ft*xt[1]/xt[0]-dt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,m,y,0,0,l[3],gt,!1,ir,!1,j);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;s.push([t,e,h,r,1,null,null])}if(R)for(n=0,r=i.length;n<r;++n){l=i[n],o=l[4],h=this.createLabel(o,P,R,""),m=l[2]-pt,y=ht*h.height-dt;const r=this.calculateImageOrLabelDimensions_(h.width,h.height,l[0],l[1],h.width,h.height,m,y,0,0,l[3],gt,!1,ir,!1,j);if(a&&"declutter"===v&&a.collides(r.declutterBox))break t;s.push([t,e,h,r,1,null,null])}a&&"none"!==v&&a.load(s.map(Br));for(let t=0,e=s.length;t<e;++t)this.replayImageOrLabel_.apply(this,s[t])}}++d;break;case xr.END_GEOMETRY:if(void 0!==r){j=i[1];const t=r(j,z,v);if(t)return t}++d;break;case xr.FILL:L?T++:this.fill_(t),++d;break;case xr.MOVE_TO_LINE_TO:let Mt,bt,Et;if(_=i[1],g=i[2],x=i[3],x){const t=(i[4]??!1)||Math.abs(l[_]-l[g-2])<1e-6&&Math.abs(l[_+1]-l[g-1])<1e-6;Gr(l,_,g,2,x,t,p),kr(p,2,t),Mt=p,bt=0,Et=Mt.length}else Mt=l,bt=_,Et=g;N=Mt[bt],D=Mt[bt+1],t.moveTo(N,D),w=N+.5|0,S=D+.5|0;for(let e=bt+2;e<Et;e+=2)N=Mt[e],D=Mt[e+1],M=N+.5|0,b=D+.5|0,e!=Et-2&&M===w&&b===S||(t.lineTo(N,D),w=M,S=b);++d;break;case xr.SET_FILL_STYLE:this.alignAndScaleFill_=i[2],T?(this.fill_(t),T=0,G&&(t.stroke(),G=0)):G&&i[1]&&(t.stroke(),G=0),t.fillStyle=i[1],++d;break;case xr.SET_STROKE_STYLE:T&&i[1]&&(this.fill_(t),T=0),G&&(t.stroke(),G=0),this.setStrokeStyle_(t,i),++d;break;case xr.STROKE:L?G++:t.stroke(),++d;break;default:++d}}T&&this.fill_(t),G&&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)}},Vr=["Polygon","Circle","LineString","Image","Text","Default"],Kr=["Image","Text"],Hr=Vr.filter(t=>!Kr.includes(t));let $r=!1,Jr=!1;const Qr={},to=class{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_=xs(),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 Zr(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===Jr&&function(){let t=0;const e=e=>{const i=on(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};$r=i[t],Jr=!0}();const o=2*(s=Math.round(s))+1,a=Es(this.hitDetectionTransform_,s+.5,s+.5,1/e,-1/e,-i,-t[0],-t[1]),h=!this.hitDetectionContext_;h&&(this.hitDetectionContext_=on(o,o,null,{willReadFrequently:$r}));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=[1/0,1/0,-1/0,-1/0],Ut(c,t),kt(c,e*(this.renderBuffer_+s),c));const u=function(t){if(void 0!==Qr[t])return Qr[t];const e=2*t+1,i=t*t,s=new Array(i+1);for(let n=0;n<=t;++n)for(let r=0;r<=t;++r){const o=n*n+r*r;if(o>i)break;let a=s[o];a||(a=[],s[o]=a),a.push(4*((t+n)*e+(t+r))+3),n>0&&a.push(4*((t-n)*e+(t+r))+3),r>0&&(a.push(4*((t+n)*e+(t-r))+3),n>0&&a.push(4*((t-n)*e+(t-r))+3))}const n=[];for(let t=0,e=s.length;t<e;++t)s[t]&&n.push(...s[t]);return Qr[t]=n,n}(s);let d;function f(t,e,i){const a=l.getImageData(0,0,o,o).data;for(let h=0,c=u.length;h<c;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}l.clearRect(0,0,o,o);break}}const g=Object.keys(this.executorsByZIndex_).map(Number);let _,p,m,y,x;for(g.sort(ct),_=g.length-1;_>=0;--_){const t=g[_].toString();for(m=this.executorsByZIndex_[t],p=Vr.length-1;p>=0;--p)if(d=Vr[p],y=m[d],void 0!==y&&(x=y.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 _s(o,0,8,2,t,o),o}isEmpty(){return nt(this.executorsByZIndex_)}execute(t,e,i,s,n,r,o){const a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(o?ut:ct),r=r||Vr;const h=Vr.length;for(let l=0,c=a.length;l<c;++l){const c=a[l].toString(),u=this.executorsByZIndex_[c];for(let c=0,d=r.length;c<d;++c){const d=r[c],f=u[d];if(void 0!==f){const r=null===o?void 0:f.getZIndexContext(),c=r?r.getContext():t,u=this.maxExtent_&&"Image"!==d&&"Text"!==d;if(u&&(c.save(),this.clip(c,i)),r&&"Text"!==d&&"Image"!==d?r.pushFunction(t=>f.execute(t,e,i,s,n,o)):f.execute(c,e,i,s,n,o),u&&c.restore(),r){r.offset();const t=a[l]*h+Vr.indexOf(d);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(ct);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}};function eo(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}class io{constructor(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=eo(t.scale),this.displacement_=t.displacement,this.declutterMode_=t.declutterMode}clone(){const t=this.getScale();return new io({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 Mt()}getImage(t){return Mt()}getHitDetectionImage(){return Mt()}getPixelRatio(t){return 1}getImageState(){return Mt()}getImageSize(){return Mt()}getOrigin(){return Mt()}getSize(){return Mt()}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_=eo(t)}listenImageChange(t){Mt()}load(){Mt()}unlistenImageChange(t){Mt()}ready(){return Promise.resolve()}}const so=io;function no(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 ro extends so{constructor(t){const e=void 0!==(t=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(Gt(!(void 0!==a&&r),"`image` and `src` cannot be provided at the same time"),void 0!==a&&0!==a.length||!r||(a=r.src||Et(r)),Gt(void 0!==a&&a.length>0,"A defined and non-empty `src` or `image` must be provided"),Gt(!((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=0:void 0!==r&&(o="complete"in r?r.complete?r.src?2:0:1:2),this.color_=void 0!==t.color?Gn(t.color):null,this.iconImage_=jn(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();this.setScale(no(i[0],i[1],t.width,t.height))};return void this.listenImageChange(e)}}void 0!==e&&this.setScale(no(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 ro({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?Gn(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?0:this.iconImage_.getImageState();this.iconImage_=jn(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_=jn(null,t,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},0,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){const t=this.getScaleArray();return this.size_?this.size_[0]*t[0]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[0]*t[0]:void 0}getHeight(){const t=this.getScaleArray();return this.size_?this.size_[1]*t[1]:2==this.iconImage_.getImageState()?this.iconImage_.getSize()[1]*t[1]:void 0}setScale(t){delete this.initialOptions_,super.setScale(t)}listenImageChange(t){this.iconImage_.addEventListener(ht,t)}load(){this.iconImage_.load()}unlistenImageChange(t){this.iconImage_.removeEventListener(ht,t)}ready(){return this.iconImage_.ready()}}const oo=ro,ao=xs(),ho=[NaN,NaN],lo=class extends Pt{constructor(){super(),this.extent_=[1/0,1/0,-1/0,-1/0],this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=yt((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 Mt()}closestPointXY(t,e,i,s){return Mt()}containsXY(t,e){return 0===this.closestPointXY(t,e,ho,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 Mt()}getExtent(t){if(this.extentRevision_!=this.getRevision()){const t=this.computeExtent(this.extent_);(isNaN(t[0])||isNaN(t[1]))&&zt(t),this.extentRevision_=this.getRevision()}return function(t,e){return e?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e):t}(this.extent_,t)}rotate(t,e){Mt()}scale(t,e,i){Mt()}simplify(t){return this.getSimplifiedGeometry(t*t)}getSimplifiedGeometry(t){return Mt()}getType(){return Mt()}applyTransform(t){Mt()}intersectsExtent(t){return Mt()}translate(t,e){Mt()}transform(t,e){const i=Ei(t),s="tile-pixels"==i.getUnits()?function(t,s,n){const r=i.getExtent(),o=i.getWorldExtent(),a=ee(o)/ee(r);Es(ao,o[0],o[3],a,-a,0,0,0);const h=_s(t,0,t.length,n,ao,s),l=Ai(i,e);return l?l(h,h,n):h}:Ai(i,e);return this.applyTransform(s),this}};function co(t){let e;return 2==t?e="XY":3==t?e="XYZ":4==t&&(e="XYZM"),e}function uo(t){let e;return"XY"==t?e=2:"XYZ"==t||"XYM"==t?e=3:"XYZM"==t&&(e=4),e}const fo=class extends lo{constructor(){super(),this.layout="XY",this.stride=2,this.flatCoordinates}computeExtent(t){return Bt(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}getCoordinates(){return Mt()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(t){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),t<0||0!==this.simplifiedGeometryMaxMinSquaredTolerance&&t<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;const e=this.getSimplifiedGeometryInternal(t);return e.getFlatCoordinates().length<this.flatCoordinates.length?e:(this.simplifiedGeometryMaxMinSquaredTolerance=t,this)}getSimplifiedGeometryInternal(t){return this}getStride(){return this.stride}setFlatCoordinates(t,e){this.stride=uo(t),this.layout=t,this.flatCoordinates=e}setCoordinates(t,e){Mt()}setLayout(t,e,i){let s;if(t)s=uo(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=co(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();ps(i,0,i.length,s,t,e,i),this.changed()}}scale(t,e,i){void 0===e&&(e=t),i||(i=Jt(this.getExtent()));const s=this.getFlatCoordinates();if(s){const n=this.getStride();!function(t,e,i,s,n,r,o,a){a=a||[];const h=o[0],l=o[1];let c=0;for(let e=0;e<i;e+=s){const i=t[e]-h,o=t[e+1]-l;a[c++]=h+n*i,a[c++]=l+r*o;for(let i=e+2;i<e+s;++i)a[c++]=t[i]}a&&a.length!=c&&(a.length=c)}(s,0,s.length,n,t,e,i,s),this.changed()}}translate(t,e){const i=this.getFlatCoordinates();if(i){const s=this.getStride();!function(t,e,i,s,n,r,o){o=o||[];let a=0;for(let e=0;e<i;e+=s){o[a++]=t[e]+n,o[a++]=t[e+1]+r;for(let i=e+2;i<e+s;++i)o[a++]=t[i]}o&&o.length!=a&&(o.length=a)}(i,0,i.length,s,t,e,i),this.changed()}}},go=class extends Xn{constructor(t,e,i,s,n,r,o){super(),this.context_=t,this.pixelRatio_=e,this.extent_=i,this.transform_=s,this.transformRotation_=s?Me(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_=xs()}drawImages_(t,e,i,s){if(!this.image_)return;const n=_s(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 t=0,e=n.length;t<e;t+=2){const e=n[t]-this.imageAnchorX_,i=n[t+1]-this.imageAnchorY_;if(0!==h||1!=this.imageScale_[0]||1!=this.imageScale_[1]){const t=e+this.imageAnchorX_,s=i+this.imageAnchorY_;Es(o,t,s,1,1,h,-t,-s),r.save(),r.transform.apply(r,o),r.translate(t,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_,e,i,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=_s(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_;let a=_s(t,e,i,s,this.transform_,this.pixelCoordinates_);if(Math.abs(r)>0){const t=a.length,e=n||Math.abs(a[0]-a[t-2])<1e-6&&Math.abs(a[1]-a[t-1])<1e-6;a=Gr(a,0,t,2,r,e,a),kr(a,2,e)}o.moveTo(a[0],a[1]);let h=a.length;n&&(h-=2);for(let t=2;t<h;t+=2)o.lineTo(a[t],a[t+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_)),ae(this.extent_,t.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);const e=function(t,e,i){const s=t.getFlatCoordinates();if(!s)return null;const n=t.getStride();return _s(s,0,s.length,n,e,i)}(t,this.transform_,this.pixelCoordinates_),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(),t.getStroke()),this.setImageStyle(t.getImage()),this.setTextStyle(t.getText())}setTransform(t){this.transform_=t}drawGeometry(t){switch(t.getType()){case"Point":this.drawPoint(t);break;case"LineString":this.drawLineString(t);break;case"Polygon":this.drawPolygon(t);break;case"MultiPoint":this.drawMultiPoint(t);break;case"MultiLineString":this.drawMultiLineString(t);break;case"MultiPolygon":this.drawMultiPolygon(t);break;case"GeometryCollection":this.drawGeometryCollection(t);break;case"Circle":this.drawCircle(t)}}drawFeature(t,e){const i=e.getGeometryFunction()(t);i&&(this.setStyle(e),this.drawGeometry(i))}drawGeometryCollection(t){const e=t.getGeometriesArray();for(let t=0,i=e.length;t<i;++t)this.drawGeometry(e[t])}drawPoint(t){this.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_)),ae(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(ae(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,e=n.length;t<e;++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_)),ae(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_)),ae(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,e=n.length;t<e;++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),_t(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:tr;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:Dn(e||Kn)}}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||$n,l=e.getOffset();this.strokeState_={lineCap:void 0!==i?i:Hn,lineDash:1===this.pixelRatio_?h:h.map(t=>t*this.pixelRatio_),lineDashOffset:(n||0)*this.pixelRatio_,lineJoin:void 0!==r?r:Jn,lineWidth:(void 0!==o?o:1)*this.pixelRatio_,miterLimit:void 0!==a?a:10,strokeStyle:Dn(t||Qn),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();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:Dn(t||Kn)}}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:Hn,lineDash:s||$n,lineDashOffset:n||0,lineJoin:void 0!==r?r:Jn,lineWidth:void 0!==o?o:1,miterLimit:void 0!==a?a:10,strokeStyle:Dn(t||Qn)}}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:Vn,textAlign:void 0!==c?c:tr,textBaseline:void 0!==u?u:er},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_=""}},_o=.5;function po(t,e,i,s,n,r,o,a,h){const l=h?Wi(n):n,c=on(t[0]*_o,t[1]*_o);c.imageSmoothingEnabled=!1;const u=c.canvas,d=new go(c,_o,n,null,o,a,h?Oi(Ni(),h):null),f=i.length,g=Math.floor(16777215/f),_={};for(let t=1;t<=f;++t){const e=i[t-1],n=e.getStyleFunction()||s;if(!n)continue;let o=n(e,r);if(!o)continue;Array.isArray(o)||(o=[o]);const a=(t*g).toString(16).padStart(7,"#00000");for(let t=0,i=o.length;t<i;++t){const i=o[t],s=i.getGeometryFunction()(e);if(!s||!ae(l,s.getExtent()))continue;const n=i.clone(),r=n.getFill();r&&r.setColor(a);const h=n.getStroke();h&&(h.setColor(a),h.setLineDash(null)),n.setText(void 0);const c=i.getImage();if(c){const t=c.getImageSize();if(!t)continue;const e=on(t[0],t[1],void 0,{alpha:!1}),i=e.canvas;e.fillStyle=a,e.fillRect(0,0,i.width,i.height),n.setImage(new oo({img:i,anchor:c.getAnchor(),anchorXUnits:"pixels",anchorYUnits:"pixels",offset:c.getOrigin(),opacity:1,size:c.getSize(),scale:c.getScale(),rotation:c.getRotation(),rotateWithView:c.getRotateWithView()}))}const u=n.getZIndex()||0;let d=_[u];d||(d={},_[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,n)}}else d[f.replace("Multi","")].push(s,n)}}const p=Object.keys(_).map(Number).sort(ct);for(let t=0,i=p.length;t<i;++t){const i=_[p[t]];for(const t in i){const s=i[t];for(let t=0,i=s.length;t<i;t+=2){d.setStyle(s[t+1]);for(let i=0,n=e.length;i<n;++i)d.setTransform(e[i]),d.drawGeometry(s[t])}}}return c.getImageData(0,0,u.width,u.height)}function mo(t,e,i){const s=[];if(i){const n=Math.floor(Math.round(t[0])*_o),r=Math.floor(Math.round(t[1])*_o),o=4*(pe(n,0,i.width-1)+pe(r,0,i.height-1)*i.width),a=i.data[o],h=i.data[o+1],l=i.data[o+2]+256*(h+256*a),c=Math.floor(16777215/e.length);l&&l%c===0&&s.push(e[l/c-1])}return s}const yo={Point: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(2!=o.getImageState())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)}},LineString:function(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)}},Polygon:function(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)}},MultiPoint:function(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(2!=o.getImageState())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)}},MultiLineString:function(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)}},MultiPolygon:function(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)}},GeometryCollection:function(t,e,i,s,n,r){const o=e.getGeometriesArray();let a,h;for(a=0,h=o.length;a<h;++a)(0,yo[o[a].getType()])(t,o[a],i,s,n,r)},Circle:function(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 xo(t,e){return parseInt(Et(t),10)-parseInt(Et(e),10)}function vo(t,e){const i=wo(t,e);return i*i}function wo(t,e){return.5*t/e}function So(t,e,i,s,n,r,o,a){const h=[],l=i.getImage();if(l){let t=!0;const e=l.getImageState();2==e||3==e?t=!1:0==e&&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)),function(t,e,i,s,n,r,o){const a=i.getGeometryFunction()(e);if(!a)return;const h=a.simplifyTransformed(s,n);i.getRenderer()?Mo(t,h,i,e,o):(0,yo[h.getType()])(t,h,i,e,o,r)}(t,e,i,s,r,o,a),u}function Mo(t,e,i,s,n){if("GeometryCollection"==e.getType()){const r=e.getGeometries();for(let e=0,o=r.length;e<o;++e)Mo(t,r[e],i,s,n);return}t.getBuilder(i.getZIndex(),"Default").drawCustom(e,s,i.getRenderer(),i.getHitDetectionRenderer(),n)}const bo=class extends xt{constructor(t,e,i,s){super(t),this.inversePixelTransform=e,this.frameState=i,this.context=s}},Eo=class extends St{constructor(t){super(),this.ready=!0,this.boundHandleImageChange_=this.handleImageChange_.bind(this),this.layer_=t,this.staleKeys_=new Array,this.maxStaleKeys=5,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 Mt()}getData(t){return null}prepareFrame(t){return Mt()}renderFrame(t,e){return Mt()}forEachFeatureAtCoordinate(t,e,i,s,n){}getLayer(){return this.layer_}handleFontsChanged(){}handleImageChange_(t){const e=t.target;2!==e.getState()&&3!==e.getState()||this.renderIfReadyAndVisible()}loadImage(t){let e=t.getState();return 2!=e&&3!=e&&t.addEventListener(ht,this.boundHandleImageChange_),0==e&&(t.load(),e=t.getState()),2==e}renderIfReadyAndVisible(){const t=this.getLayer();t&&t.getVisible()&&"ready"===t.getSourceState()&&t.changed()}renderDeferred(t){}disposeInternal(){delete this.layer_,super.disposeInternal()}},Co=[];let Po=null;const Io=class extends Eo{constructor(t){super(t),this.container=null,this.renderedResolution,this.tempTransform=xs(),this.pixelTransform=xs(),this.inversePixelTransform=xs(),this.context=null,this.deferredContext_=null,this.containerReused=!1,this.frameState=null}getImageData(t,e,i){let s;Po||(Po=on(1,1,void 0,{willReadFrequently:!0})),Po.clearRect(0,0,1,1);try{Po.drawImage(t,e,i,1,1,0,0,1,1),s=Po.getImageData(0,0,1,1).data}catch{return Po=null,null}return s}getBackground(t){let e=this.getLayer().getBackground();return"function"==typeof e&&(e=e(t.viewState.resolution)),e||void 0}useContainer(t,e,i,s,n){if(cn(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&&_t(Gn(t.style.backgroundColor),Gn(i)))){const e=t.firstElementChild;cn(e)&&(a=e.getContext("2d"))}if(a&&function(t,e){const i=Ps(t),s=Ps(e);for(let t=0;t<6;++t)if(0!==Math.round((i[t]-s[t])*Cs[t]))return!1;return!0}(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=nn?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)=>"firstElementChild"===e?t.childNodes.length>0?t.childNodes[0]:null:Reflect.get(t,e,i)}):document.createElement("div"),o.className=r;let t=o.style;t.position="absolute",t.width="100%",t.height="100%",a=on();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=ne(i),n=re(i),r=$t(i),o=Ht(i);Ms(e.coordinateToPixelTransform,s),Ms(e.coordinateToPixelTransform,n),Ms(e.coordinateToPixelTransform,r),Ms(e.coordinateToPixelTransform,o);const a=this.inversePixelTransform;Ms(a,s),Ms(a,n),Ms(a,r),Ms(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=t.viewState.rotation,r=t.pixelRatio,o=Math.round(oe(i)/s*r),a=Math.round(ee(i)/s*r);Es(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/r,1/r,n,-o/2,-a/2),function(t,e){const i=(s=e)[0]*s[3]-s[1]*s[2];var s;Gt(0!==i,"Transformation matrix cannot be inverted");const n=e[0],r=e[1],o=e[2],a=e[3],h=e[4],l=e[5];t[0]=a/i,t[1]=-r/i,t[2]=-o/i,t[3]=n/i,t[4]=(o*l-a*h)/i,t[5]=-(n*l-r*h)/i}(this.inversePixelTransform,this.pixelTransform);const h="matrix("+this.pixelTransform.join(", ")+")",l=this.getBackground(t);if(this.useContainer(e,h,l,o,a),!this.containerReused){const t=this.context.canvas;t.width!=o||t.height!=a?(t.width=o,t.height=a):this.context.clearRect(0,0,o,a),h!==t.style.transform&&(t.style.transform=h)}}dispatchRenderEvent_(t,e,i){const s=this.getLayer();if(s.hasListener(t)){const n=new bo(t,this.inversePixelTransform,i,e);s.dispatchEvent(n)}}preRender(t,e){this.frameState=e,e.declutter||this.dispatchRenderEvent_(un,t,e)}postRender(t,e){e.declutter||this.dispatchRenderEvent_(dn,t,e)}renderDeferredInternal(t){}getRenderContext(t){return t.declutter&&!this.deferredContext_&&(this.deferredContext_=new Lr),t.declutter?this.deferredContext_.getContext():this.context}renderDeferred(t){t.declutter&&(this.dispatchRenderEvent_(un,this.context,t),t.declutter&&this.deferredContext_&&(this.deferredContext_.draw(this.context),this.deferredContext_.clear()),this.renderDeferredInternal(t),this.dispatchRenderEvent_(dn,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 Es(this.tempTransform,a,h,l,c,-i,u,d)}disposeInternal(){delete this.frameState,super.disposeInternal()}},Ro=class extends Io{constructor(t){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_=[1/0,1/0,-1/0,-1/0],this.wrappedRenderedExtent_=[1/0,1/0,-1/0,-1/0],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}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[0]||f[1]),_=this.context,p=Math.round(oe(s)/o*d),m=Math.round(ee(s)/o*d),y=c.getWrapX()&&a.canWrapX(),x=y?oe(l):null,v=y?Math.ceil((s[2]-l[2])/x)+(this.extendX_?2:1):1;let w=y?Math.floor((s[0]-l[0])/x)-(this.extendX_?1:0):0;do{let s=this.getRenderTransform(r,o,0,d,p,m,w*x);e.declutter&&(s=s.slice(0)),t.execute(_,[_.canvas.width,_.canvas.height],s,h,g,void 0===i?Vr:i?Kr:Hr,i?u&&e.declutter[u]:void 0)}while(++w<v)}setDrawContext_(){1!==this.opacity_&&(this.targetContext_=this.context,this.context=on(this.context.canvas.width,this.context.canvas.height,Co))}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,ln(this.context),Co.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&&!this.getLayer().hasListener(un)&&!this.getLayer().hasListener(dn))return this.container;this.setDrawContext_(),this.preRender(n,t);s.projection;this.clipExtent_=null;let a=!1;if(o&&i.extent&&this.clipping){const e=Bi(i.extent);o=ae(e,t.extent),o&&!Lt(e,t.extent)&&(t.declutter?this.clipExtent_=e:(this.clipUnrotated(n,t,e),a=!0))}return o&&this.renderWorlds(r,t,!this.getLayer().getDeclutter()&&void 0),a&&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=t[0]*_o,l=t[1]*_o;a.push(this.getRenderTransform(e,i,s,_o,h,l,0).slice());const c=o.getSource(),u=n.getExtent();if(c.getWrapX()&&n.canWrapX()&&!Lt(u,r)){let t=r[0];const n=oe(u);let o,c=0;for(;t<u[0];)--c,o=n*c,a.push(this.getRenderTransform(e,i,s,_o,h,l,o).slice()),t+=n;for(c=0,t=r[2];t>u[2];)++c,o=n*c,a.push(this.getRenderTransform(e,i,s,_o,h,l,o).slice()),t-=n}const d=Ni();this.hitDetectionImageData_=po(t,a,this.renderedFeatures_,o.getStyleFunction(),r,i,s,vo(i,this.renderedPixelRatio_),d?n:null)}e(mo(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=this.getLayer().getDeclutter();return this.replayGroup_.forEachFeatureAtCoordinate(t,r,o,i,function(t,e,i){const r=Et(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})}},l?e.declutter?.[l]?.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[0],n=t.viewHints[1],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=xo);const _=h.center.slice(),p=kt(a,f*c),m=p.slice(),y=[p.slice()],x=l.getExtent(),v=i.getWrapX()&&l.canWrapX();if(this.extendX_=!1,v){const t=i.getExtent();t&&!he(t)&&(this.extendX_=t[0]<x[0]||t[2]>x[2])}if(v&&(!Lt(x,t.extent)||this.extendX_)){const t=oe(x),e=Math.max(oe(p)/2,t);let i=x[0],s=x[2];this.extendX_&&(i-=t,s+=t),p[0]=i-e,p[2]=s+e,Ie(_,l);const n=le(y[0],l);n[0]<x[0]&&n[2]<x[2]?y.push([n[0]+t,n[1],n[2]+t,n[3]]):n[0]>x[0]&&n[2]>x[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&&Lt(this.wrappedRenderedExtent_,p))return _t(this.renderedExtent_,m)||(this.hitDetectionImageData_=null,this.renderedExtent_=m),this.renderedCenter_=_,this.replayGroupChanged=!1,!0;this.replayGroup_=null;const w=new Rr(wo(c,u),p,c,u),S=Ni();let M;if(S){for(let t=0,e=y.length;t<e;++t){const e=Wi(y[t]);i.loadFeatures(e,Xi(c),S)}M=Oi(S,l)}else for(let t=0,e=y.length;t<e;++t)i.loadFeatures(y[t],c,l);const b=vo(c,u);let E=!0;const C=(t,i)=>{let s;const n=t.getStyleFunction()||e.getStyleFunction();if(n&&(s=n(t,c)),s){const e=this.renderFeature(t,b,s,w,M,this.getLayer().getDeclutter(),i);E=E&&!e}},P=Wi(p),I=i.getFeaturesInExtent(P);g&&I.sort(g);for(let t=0,e=I.length;t<e;++t)C(I[t],t);this.renderedFeatures_=I,this.ready=E;const R=w.finish(),T=new to(p,c,u,i.getOverlaps(),R,e.getRenderBuffer(),!!t.declutter);return this.renderedResolution_=c,this.renderedRevision_=d,this.renderedRenderOrder_=g,this.renderedFrameDeclutter_=!!t.declutter,this.renderedExtent_=m,this.wrappedRenderedExtent_=p,this.renderedCenter_=_,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=So(s,t,i[h],e,this.boundHandleStyleImageChange_,n,r,o)||a;else a=So(s,t,i,e,this.boundHandleStyleImageChange_,n,r,o);return a}};let To=0;const Go=1<<To++,Oo=1<<To++,ko=1<<To++,Ao=1<<To++,Fo=1<<To++,Lo=1<<To++,jo=Math.pow(2,6)-1,No={[Go]:"boolean",[Oo]:"number",[ko]:"string",[Ao]:"color",[Fo]:"number[]",[Lo]:"size"},Do=Object.keys(No).map(Number).sort(ct);function zo(t){const e=[];for(const i of Do)Wo(t,i)&&e.push(No[i]);return 0===e.length?"untyped":e.length<3?e.join(" or "):e.slice(0,-1).join(", ")+", or "+e[e.length-1]}function Wo(t,e){return(t&e)===e}function Bo(t,e){return!!(t&e)}function Xo(t,e){return t===e}class qo{constructor(t,e){if(!function(t){return t in No}(t))throw new Error(`literal expressions must have a specific type, got ${zo(t)}`);this.type=t,this.value=e}}class Uo{constructor(t,e,...i){this.type=t,this.operator=e,this.args=i}}function Yo(t){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:t}}function Zo(t,e,i){switch(typeof t){case"boolean":if(Xo(e,ko))return new qo(ko,t?"true":"false");if(!Wo(e,Go))throw new Error(`got a boolean, but expected ${zo(e)}`);return new qo(Go,t);case"number":if(Xo(e,Lo))return new qo(Lo,eo(t));if(Xo(e,Go))return new qo(Go,!!t);if(Xo(e,ko))return new qo(ko,t.toString());if(!Wo(e,Oo))throw new Error(`got a number, but expected ${zo(e)}`);return new qo(Oo,t);case"string":if(Xo(e,Ao))return new qo(Ao,Tn(t));if(Xo(e,Go))return new qo(Go,!!t);if(!Wo(e,ko))throw new Error(`got a string, but expected ${zo(e)}`);return new qo(ko,t)}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 function(t,e,i){const s=t[0],n=Wa[s];if(!n)throw new Error(`unknown operator: ${s}`);return n(t,e,i)}(t,e,i);for(const e of t)if("number"!=typeof e)throw new Error("expected an array of numbers");if(Xo(e,Lo)){if(2!==t.length)throw new Error(`expected an array of two values for a size, got ${t.length}`);return new qo(Lo,t)}if(Xo(e,Ao)){if(3===t.length)return new qo(Ao,[...t,1]);if(4===t.length)return new qo(Ao,t);throw new Error(`expected an array of 3 or 4 values for a color, got ${t.length}`)}if(!Wo(e,Fo))throw new Error(`got an array of numbers, but expected ${zo(e)}`);return new qo(Fo,t)}const Vo="get",Ko="var",Ho="concat",$o="geometry-type",Jo="line-metric",Qo="any",ta="all",ea="!",ia="resolution",sa="zoom",na="time",ra="==",oa="!=",aa=">",ha=">=",la="<",ca="<=",ua="*",da="/",fa="+",ga="-",_a="clamp",pa="%",ma="^",ya="abs",xa="floor",va="ceil",wa="round",Sa="sin",Ma="cos",ba="atan",Ea="sqrt",Ca="match",Pa="between",Ia="interpolate",Ra="coalesce",Ta="case",Ga="in",Oa="number",ka="string",Aa="array",Fa="color",La="id",ja="band",Na="palette",Da="to-string",za="has",Wa={[Vo]:Ha(Ua(1,1/0),Ba),[Ko]: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=Zo(r,jo,i);if(!(t instanceof qo))throw new Error(`style variables should only be literal values (no expressions!), variable name: ${s}`);let o=t.type;if("string"==typeof r&&Bo(n,Ao)&&!Bo(n,ko)?o=Ao:Array.isArray(r)&&2===r.length&&Bo(n,Lo)&&!Bo(n,Fo)&&(o=Lo),n&=o,0===n)throw new Error(`the type expected from the var operator (${zo(e)}) did not have any overlap with the type of the corresponding style variables (${zo(o)}), variable name: ${s}`)}if(i.variables.has(s)){const t=i.variables.get(s);if(n&=t,0===n)throw new Error(`a new type expected from the var operator (${zo(e)}) did not have any overlap with the previous type expected for it (${zo(t)}), variable name: ${s}`)}return i.variables.set(s,n),new Uo(n,"var",new qo(ko,s))},[za]:Ha(Ua(1,1/0),Ba),[La]:Ha(function(t,e,i){i.featureId=!0},qa),[Ho]:Ha(Ua(2,1/0),Za(ko)),[$o]:Ha(function(t,e,i){i.geometryType=!0},qa),[Jo]:Ha(function(t,e,i){i.mCoordinate=!0},qa),[ia]:Ha(Xa,qa),[sa]:Ha(Xa,qa),[na]:Ha(Xa,qa),[Qo]:Ha(Ua(2,1/0),Za(Go)),[ta]:Ha(Ua(2,1/0),Za(Go)),[ea]:Ha(Ua(1,1),Za(Go)),[ra]:Ha(Ua(2,2),Va()),[oa]:Ha(Ua(2,2),Va()),[aa]:Ha(Ua(2,2),Za(Oo)),[ha]:Ha(Ua(2,2),Za(Oo)),[la]:Ha(Ua(2,2),Za(Oo)),[ca]:Ha(Ua(2,2),Za(Oo)),[ua]:Ha(Ua(2,1/0),Ya),[Ra]:Ha(Ua(2,1/0),Ya),[da]:Ha(Ua(2,2),Za(Oo)),[fa]:Ha(Ua(2,1/0),Za(Oo)),[ga]:Ha(Ua(2,2),Za(Oo)),[_a]:Ha(Ua(3,3),Za(Oo)),[pa]:Ha(Ua(2,2),Za(Oo)),[ma]:Ha(Ua(2,2),Za(Oo)),[ya]:Ha(Ua(1,1),Za(Oo)),[xa]:Ha(Ua(1,1),Za(Oo)),[va]:Ha(Ua(1,1),Za(Oo)),[wa]:Ha(Ua(1,1),Za(Oo)),[Sa]:Ha(Ua(1,1),Za(Oo)),[Ma]:Ha(Ua(1,1),Za(Oo)),[ba]:Ha(Ua(1,2),Za(Oo)),[Ea]:Ha(Ua(1,1),Za(Oo)),[Ca]:Ha(Ua(4,1/0),Ka,function(t,e,i){const s=t.length-1,n=Zo(t[t.length-1],e,i);let r=ko|Oo|Go;const o=new Array(s-2);for(let e=0;e<s-2;e+=2){try{r&=Zo(t[e+2],r,i).type}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}if(0===r)throw new Error("no common type was found among the arguments of match expression")}for(let e=0;e<s-2;e+=2){try{const s=Zo(t[e+2],r,i);o[e]=s}catch(t){throw new Error(`failed to parse argument ${e+1} of match expression: ${t.message}`)}try{const s=Zo(t[e+3],n.type,i);o[e+1]=s}catch(t){throw new Error(`failed to parse argument ${e+2} of match expression: ${t.message}`)}}return[Zo(t[1],r,i),...o,n]}),[Pa]:Ha(Ua(3,3),Za(Oo)),[Ia]:Ha(Ua(6,1/0),Ka,function(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 qo(Oo,n);let o;try{o=Zo(t[2],Oo,i)}catch(t){throw new Error(`failed to parse argument 1 in interpolate expression: ${t.message}`)}const a=new Array(t.length-3);for(let s=0;s<a.length;s+=2){try{const e=Zo(t[s+3],Oo,i);a[s]=e}catch(t){throw new Error(`failed to parse argument ${s+2} for interpolate expression: ${t.message}`)}try{const n=Zo(t[s+4],e,i);a[s+1]=n}catch(t){throw new Error(`failed to parse argument ${s+3} for interpolate expression: ${t.message}`)}}return[r,o,...a]}),[Ta]:Ha(Ua(3,1/0),function(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(t,e,i){const s=Zo(t[t.length-1],e,i),n=new Array(t.length-1);for(let e=0;e<n.length-1;e+=2){try{const s=Zo(t[e+1],Go,i);n[e]=s}catch(t){throw new Error(`failed to parse argument ${e} of case expression: ${t.message}`)}try{const r=Zo(t[e+2],s.type,i);n[e+1]=r}catch(t){throw new Error(`failed to parse argument ${e+1} of case expression: ${t.message}`)}}return n[n.length-1]=s,n}),[Ga]:Ha(Ua(2,2),function(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]?ko:Oo;const r=new Array(n.length);for(let t=0;t<r.length;t++)try{const e=Zo(n[t],s,i);r[t]=e}catch(e){throw new Error(`failed to parse haystack item ${t} for "in" expression: ${e.message}`)}return[Zo(t[1],s,i),...r]}),[Oa]:Ha(Ua(1,1/0),Za(jo)),[ka]:Ha(Ua(1,1/0),Za(jo)),[Aa]:Ha(Ua(1,1/0),Za(Oo)),[Fa]:Ha(Ua(1,4),Za(Oo)),[ja]:Ha(Ua(1,3),Za(Oo)),[Na]:Ha(Ua(2,2),function(t,e,i){let s;try{s=Zo(t[1],Oo,i)}catch(t){throw new Error(`failed to parse first argument in palette expression: ${t.message}`)}const n=t[2];if(!Array.isArray(n))throw new Error("the second argument of palette must be an array");const r=new Array(n.length);for(let t=0;t<r.length;t++){let e;try{e=Zo(n[t],Ao,i)}catch(e){throw new Error(`failed to parse color at index ${t} in palette expression: ${e.message}`)}if(!(e instanceof qo))throw new Error(`the palette color at index ${t} must be a literal value`);r[t]=e}return[s,...r]}),[Da]:Ha(Ua(1,1),Za(Go|Oo|ko|Ao))};function Ba(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 qo(Oo,s);break;case"string":n[r]=new qo(ko,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 Xa(t,e,i){i.mapState=!0}function qa(t,e,i){const s=t[0];if(1!==t.length)throw new Error(`expected no arguments for ${s} operation`);return[]}function Ua(t,e){return function(i,s,n){const r=i[0],o=i.length-1;if(t===e){if(o!==t)throw new Error(`expected ${t} argument${1===t?"":"s"} for ${r}, got ${o}`)}else if(o<t||o>e)throw new Error(`expected ${e===1/0?`${t} or more`:`${t} to ${e}`} arguments for ${r}, got ${o}`)}}function Ya(t,e,i){const s=t.length-1,n=new Array(s);for(let r=0;r<s;++r){const s=Zo(t[r+1],e,i);n[r]=s}return n}function Za(t){return function(e,i,s){const n=e.length-1,r=new Array(n);for(let i=0;i<n;++i){const n=Zo(e[i+1],t,s);r[i]=n}return r}}function Va(){return function(t,e,i){const s=t[0],n=t.length-1,r=new Array(n);let o=jo;for(let e=0;e<n;++e)o&=Zo(t[e+1],o,i).type;if(0===o)throw new Error(`no common type was found among the arguments of ${s}`);for(let e=0;e<n;++e){const s=Zo(t[e+1],o,i);r[e]=s}return r}}function Ka(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 Ha(...t){return function(e,i,s){const n=e[0];let r;for(let n=0;n<t.length;n++){const o=t[n](e,i,s);if(n==t.length-1){if(!o)throw new Error("expected last argument validator to return the parsed args");r=o}}return new Uo(i,n,...r)}}function $a(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 $a(t.getGeometries()[0]);default:return""}}function Ja(t,e,i){return Qa(Zo(t,e,i),i)}function Qa(t,e){if(t instanceof qo){if(t.type===Ao&&"string"==typeof t.value){const e=Tn(t.value);return function(){return e}}return function(){return t.value}}const i=t.operator;switch(i){case Oa:case ka:case Ra:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Qa(t.args[i],e);switch(i){case Ra:return t=>{for(let e=0;e<s;++e){const i=n[e](t);if(null!=i)return i}throw new Error("Expected one of the values to be non-null")};case Oa:case ka: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}`)}}(t,e);case Vo:case Ko:case za:return function(t){const e=t.args[0].value;switch(t.operator){case Vo:return i=>{const s=t.args;let n=i.properties[e];for(let t=1,e=s.length;t<e;++t)n=n[s[t].value];return n};case Ko:return t=>t.variables[e];case za:return i=>{const s=t.args;if(!(e in i.properties))return!1;let n=i.properties[e];for(let t=1,e=s.length;t<e;++t){const e=s[t].value;if(!n||!Object.hasOwn(n,e))return!1;n=n[e]}return!0};default:throw new Error(`Unsupported accessor operator ${t.operator}`)}}(t);case"id":return t=>t.featureId;case $o:return t=>t.geometryType;case Ho:{const i=t.args.map(t=>Qa(t,e));return t=>"".concat(...i.map(e=>e(t).toString()))}case ia:return t=>t.resolution;case Qo:case ta:case Pa:case Ga:case"!":return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Qa(t.args[i],e);switch(i){case Qo:return t=>{for(let e=0;e<s;++e)if(n[e](t))return!0;return!1};case ta:return t=>{for(let e=0;e<s;++e)if(!n[e](t))return!1;return!0};case Pa:return t=>{const e=n[0](t),i=n[1](t),s=n[2](t);return e>=i&&e<=s};case Ga:return t=>{const e=n[0](t);for(let i=1;i<s;++i)if(e===n[i](t))return!0;return!1};case"!":return t=>!n[0](t);default:throw new Error(`Unsupported logical operator ${i}`)}}(t,e);case ra:case oa:case"<":case ca:case">":case ha:return function(t,e){const i=t.operator,s=Qa(t.args[0],e),n=Qa(t.args[1],e);switch(i){case ra:return t=>s(t)===n(t);case oa:return t=>s(t)!==n(t);case"<":return t=>s(t)<n(t);case ca:return t=>s(t)<=n(t);case">":return t=>s(t)>n(t);case ha:return t=>s(t)>=n(t);default:throw new Error(`Unsupported comparison operator ${i}`)}}(t,e);case"*":case"/":case"+":case"-":case _a:case"%":case"^":case ya:case xa:case va:case wa:case Sa:case Ma:case ba:case Ea:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Qa(t.args[i],e);switch(i){case"*":return t=>{let e=1;for(let i=0;i<s;++i)e*=n[i](t);return e};case"/":return t=>n[0](t)/n[1](t);case"+":return t=>{let e=0;for(let i=0;i<s;++i)e+=n[i](t);return e};case"-":return t=>n[0](t)-n[1](t);case _a: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"%":return t=>n[0](t)%n[1](t);case"^":return t=>Math.pow(n[0](t),n[1](t));case ya:return t=>Math.abs(n[0](t));case xa:return t=>Math.floor(n[0](t));case va:return t=>Math.ceil(n[0](t));case wa:return t=>Math.round(n[0](t));case Sa:return t=>Math.sin(n[0](t));case Ma:return t=>Math.cos(n[0](t));case ba:return 2===s?t=>Math.atan2(n[0](t),n[1](t)):t=>Math.atan(n[0](t));case Ea:return t=>Math.sqrt(n[0](t));default:throw new Error(`Unsupported numeric operator ${i}`)}}(t,e);case Ta:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Qa(t.args[n],e);return t=>{for(let e=0;e<i-1;e+=2)if(s[e](t))return s[e+1](t);return s[i-1](t)}}(t,e);case Ca:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Qa(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)}}(t,e);case Ia:return function(t,e){const i=t.args.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=Qa(t.args[n],e);return t=>{const e=s[0](t),n=s[1](t);let r,o;for(let a=2;a<i;a+=2){const i=s[a](t);let h=s[a+1](t);const l=Array.isArray(h);if(l&&(h=bn(h)),i>=n)return 2===a?h:l?eh(e,n,r,o,i,h):th(e,n,r,o,i,h);r=i,o=h}return o}}(t,e);case Da:return function(t,e){const i=t.operator,s=t.args.length,n=new Array(s);for(let i=0;i<s;++i)n[i]=Qa(t.args[i],e);if(i===Da)return e=>{const i=n[0](e);return t.args[0].type===Ao?On(i):i.toString()};throw new Error(`Unsupported convert operator ${i}`)}(t,e);default:throw new Error(`Unsupported operator ${i}`)}}function th(t,e,i,s,n,r){const o=n-i;if(0===o)return s;const a=e-i;return s+(1===t?a/o:(Math.pow(t,a)-1)/(Math.pow(t,o)-1))*(r-s)}function eh(t,e,i,s,n,r){if(0===n-i)return s;const o=Rn(s),a=Rn(r);let h=a[2]-o[2];return h>180?h-=360:h<-180&&(h+=360),function(t){const e=(t[0]+16)/116,i=t[1],s=t[2]*Math.PI/180,n=Cn(e),r=Cn(e+i/500*Math.cos(s)),o=Cn(e-i/200*Math.sin(s)),a=En(3.021973625*r-1.617392459*n-.404875592*o),h=En(-.943766287*r+1.916279586*n+.027607165*o),l=En(.069407491*r-.22898585*n+1.159737864*o);return[pe(a+.5|0,0,255),pe(h+.5|0,0,255),pe(l+.5|0,0,255),t[3]]}([th(t,e,i,o[0],n,a[0]),th(t,e,i,o[1],n,a[1]),o[2]+th(t,e,i,0,n,h),th(t,e,i,s[3],n,r[3])])}class ih extends so{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()?1:2,1===this.imageState_&&this.ready().then(()=>this.imageState_=2),this.render()}clone(){const t=this.getScale(),e=new ih({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}getAnchor(){const t=this.size_,e=this.getDisplacement(),i=this.getScaleArray();return[t[0]/2-e[0]/i[0],t[1]/2+e[1]/i[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(t){this.fill_=t,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||(this.hitDetectionCanvas_=this.createHitDetectionCanvas_(this.renderOptions_)),this.hitDetectionCanvas_}getImage(t){const e=this.fill_?.getKey(),i=`${t},${this.angle_},${this.radius},${this.radius2_},${this.points_},${e}`+Object.values(this.renderOptions_).join(",");let s=An.get(i,null)?.getImage(1);if(!s){const e=this.renderOptions_,n=Math.ceil(e.size*t),r=on(n,n);this.draw_(e,r,t),s=r.canvas;const o=new Nn(s,void 0,null,2,null);An.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=s-Math.sqrt(n*n-a*a),l=Math.sqrt(a*a+h*h),c=l/a;if("miter"===t&&c<=i)return c*e;const u=e/2/c,d=e/2*(h/l),f=Math.sqrt((s+u)*(s+u)+d*d)-s;if(void 0===this.radius2_||"bevel"===t)return 2*f;const g=s*Math.sin(o),_=n-Math.sqrt(s*s-g*g),p=Math.sqrt(g*g+_*_)/g;if(p<=i){const t=p*e/2-n-s;return 2*Math.max(f,t)}return 2*f}createRenderOptions(){let t,e=Hn,i=Jn,s=0,n=null,r=0,o=0;this.stroke_&&(t=Dn(this.stroke_.getColor()??Qn),o=this.stroke_.getWidth()??1,n=this.stroke_.getLineDash(),r=this.stroke_.getLineDashOffset()??0,i=this.stroke_.getLineJoin()??Jn,e=this.stroke_.getLineCap()??Hn,s=this.stroke_.getMiterLimit()??10);const a=this.calculateLineJoinSize_(i,o,s),h=Math.max(this.radius,this.radius2_||0);return{strokeStyle:t,strokeWidth:o,size:Math.ceil(2*h+a),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=Kn),e.fillStyle=Dn(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=Gn(i)),null===i?s=1:Array.isArray(i)&&(s=4===i.length?i[3]:1),0===s&&(e=on(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=Kn,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()}}const sh=ih;class nh extends sh{constructor(t){super({points:1/0,fill:(t=t||{radius:5}).fill,radius:t.radius,stroke:t.stroke,scale:void 0!==t.scale?t.scale:1,rotation:void 0!==t.rotation?t.rotation:0,rotateWithView:void 0!==t.rotateWithView&&t.rotateWithView,displacement:void 0!==t.displacement?t.displacement:[0,0],declutterMode:t.declutterMode})}clone(){const t=this.getScale(),e=new nh({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return e.setOpacity(this.getOpacity()),e}}const rh=nh;class oh{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 oh({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=jn(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}),0===e.getImageState()&&e.load(),1===e.getImageState()&&(this.patternImage_=e)}this.color_=t}getKey(){const t=this.getColor();return t?t instanceof CanvasPattern||t instanceof CanvasGradient?Et(t):"object"==typeof t&&"src"in t?t.src+":"+t.offset:Gn(t).toString():""}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}}const ah=oh;class hh{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 hh({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),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}}const lh=hh;class ch{constructor(t){t=t||{},this.geometry_=null,this.geometryFunction_=fh,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 ch({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,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_=fh,this.geometry_=t}setZIndex(t){this.zIndex_=t}}let uh=null;function dh(t,e){if(!uh){const t=new ah({color:"rgba(255,255,255,0.4)"}),e=new lh({color:"#3399CC",width:1.25});uh=[new ch({image:new rh({fill:t,stroke:e,radius:5}),fill:t,stroke:e})]}return uh}function fh(t){return t.getGeometry()}const gh=ch;class _h{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_=eo(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 ah({color:"#333"}),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 _h({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 ah?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,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_=eo(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}}const ph=_h;function mh(t){return!0}function yh(t,e){e=e??Yo();const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=xh(t[n],e);const n={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""},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}e.geometryType&&(n.geometryType=$a(t.getGeometry()));let a=0;for(let t=0;t<i;++t){const e=s[t](n);e&&(r[a]=e,a+=1)}return r.length=a,r}}function xh(t,e){const i=vh(t,"",e),s=wh(t,"",e),n=function(t,e){const i="text-",s=bh(t,i+"value",e);if(!s)return null;const n=vh(t,i,e),r=vh(t,i+"background-",e),o=wh(t,i,e),a=wh(t,i+"background-",e),h=bh(t,i+"font",e),l=Mh(t,i+"max-angle",e),c=Mh(t,i+"offset-x",e),u=Mh(t,i+"offset-y",e),d=Eh(t,i+"overflow",e),f=bh(t,i+"placement",e),g=Mh(t,i+"repeat",e),_=Th(t,i+"scale",e),p=Eh(t,i+"rotate-with-view",e),m=Mh(t,i+"rotation",e),y=bh(t,i+"align",e),x=bh(t,i+"justify",e),v=bh(t,i+"baseline",e),w=Eh(t,i+"keep-upright",e),S=Ph(t,i+"padding",e),M=Ah(t,i+"declutter-mode"),b=new ph({declutterMode:M});return function(t){if(b.setText(s(t)),n&&b.setFill(n(t)),r&&b.setBackgroundFill(r(t)),o&&b.setStroke(o(t)),a&&b.setBackgroundStroke(a(t)),h&&b.setFont(h(t)),l&&b.setMaxAngle(l(t)),c&&b.setOffsetX(c(t)),u&&b.setOffsetY(u(t)),d&&b.setOverflow(d(t)),f){const e=f(t);if("point"!==e&&"line"!==e)throw new Error("Expected point or line for text-placement");b.setPlacement(e)}if(g&&b.setRepeat(g(t)),_&&b.setScale(_(t)),p&&b.setRotateWithView(p(t)),m&&b.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");b.setTextAlign(e)}if(x){const e=x(t);if("left"!==e&&"right"!==e&&"center"!==e)throw new Error("Expected left, right, or center for text-justify");b.setJustify(e)}if(v){const e=v(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");b.setTextBaseline(e)}return S&&b.setPadding(S(t)),w&&b.setKeepUpright(w(t)),b}}(t,e),r=function(t,e){return"icon-src"in t?function(t,e){const i="icon-",s=i+"src",n=Lh(t[s],s),r=Ih(t,i+"anchor",e),o=Th(t,i+"scale",e),a=Mh(t,i+"opacity",e),h=Ih(t,i+"displacement",e),l=Mh(t,i+"rotation",e),c=Eh(t,i+"rotate-with-view",e),u=Oh(t,i+"anchor-origin"),d=kh(t,i+"anchor-x-units"),f=kh(t,i+"anchor-y-units"),g=Sh(t,i+"color");let _,p=null;void 0!==g&&(Array.isArray(g)&&g.length>0&&"string"==typeof g[0]?p=Ch(t,i+"color",e):_=Nh(g,i+"color"));const m=function(t,e){const i=t[e];if(void 0!==i){if("string"!=typeof i)throw new Error(`Expected a string for ${e}`);return i}}(t,i+"cross-origin"),y=function(t,e){const i=t[e];if(void 0!==i)return Fh(i,e)}(t,i+"offset"),x=Oh(t,i+"offset-origin"),v=Gh(t,i+"width"),w=Gh(t,i+"height"),S=function(t,e){const i=t[e];if(void 0!==i){if("number"==typeof i)return eo(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}}(t,i+"size"),M={src:n,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:m,offset:y,offsetOrigin:x,height:w,width:v,size:S,declutterMode:Ah(t,i+"declutter-mode")};let b=null;return function(t){if(b)p&&b.setColor(p(t));else{const e=p?p(t):_;b=new oo(void 0!==e?Object.assign({},M,{color:e}):Object.assign({},M))}return a&&b.setOpacity(a(t)),h&&b.setDisplacement(h(t)),l&&b.setRotation(l(t)),c&&b.setRotateWithView(c(t)),o&&b.setScale(o(t)),r&&b.setAnchor(r(t)),b}}(t,e):"shape-points"in t?function(t,e){const i="shape-",s=i+"points",n=i+"radius",r=jh(t[s],s);if(!(n in t))throw new Error(`Expected a number for ${n}`);const o=Mh(t,n,e),a="number"==typeof t[n]?t[n]:5,h=i+"radius2",l=Mh(t,h,e),c="number"==typeof t[h]?t[h]:void 0,u=vh(t,i,e),d=wh(t,i,e),f=Th(t,i+"scale",e),g=Ih(t,i+"displacement",e),_=Mh(t,i+"rotation",e),p=Eh(t,i+"rotate-with-view",e),m=Gh(t,i+"angle"),y=Ah(t,i+"declutter-mode"),x=new sh({points:r,radius:a,radius2:c,angle:m,declutterMode:y});return function(t){return o&&x.setRadius(o(t)),l&&x.setRadius2(l(t)),u&&x.setFill(u(t)),d&&x.setStroke(d(t)),g&&x.setDisplacement(g(t)),_&&x.setRotation(_(t)),p&&x.setRotateWithView(p(t)),f&&x.setScale(f(t)),x}}(t,e):"circle-radius"in t?function(t,e){const i="circle-",s=vh(t,i,e),n=wh(t,i,e),r=Mh(t,i+"radius",e),o=Th(t,i+"scale",e),a=Ih(t,i+"displacement",e),h=Mh(t,i+"rotation",e),l=Eh(t,i+"rotate-with-view",e),c=Ah(t,i+"declutter-mode"),u=new rh({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}}(t,e):null}(t,e),o=Mh(t,"z-index",e);if(!(i||s||n||r||nt(t)))throw new Error("No fill, stroke, point, or text symbolizer properties in style: "+JSON.stringify(t));const a=new gh;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 vh(t,e,i){let s;if(e+"fill-pattern-src"in t)s=function(t,e,i){const s=bh(t,e+"pattern-src",i),n=Rh(t,e+"pattern-offset",i),r=Rh(t,e+"pattern-size",i),o=Ch(t,e+"color",i);return function(t){return{src:s(t),offset:n&&n(t),size:r&&r(t),color:o&&o(t)}}}(t,e+"fill-",i);else{if("none"===t[e+"fill-color"])return t=>null;s=Ch(t,e+"fill-color",i)}if(!s)return null;const n=new ah;return function(t){const e=s(t);return e===fn?null:(n.setColor(e),n)}}function wh(t,e,i){const s=Mh(t,e+"stroke-width",i),n=Ch(t,e+"stroke-color",i);if(!s&&!n)return null;const r=bh(t,e+"stroke-line-cap",i),o=bh(t,e+"stroke-line-join",i),a=Ph(t,e+"stroke-line-dash",i),h=Mh(t,e+"stroke-line-dash-offset",i),l=Mh(t,e+"stroke-miter-limit",i),c=Mh(t,e+"stroke-offset",i),u=new lh;return function(t){if(n){const e=n(t);if(e===fn)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 Sh(t,e){if(!(e in t))return;const i=t[e];return void 0===i?void 0:i}function Mh(t,e,i){const s=Sh(t,e);if(void 0===s)return;const n=Ja(s,Oo,i);return function(t){return jh(n(t),e)}}function bh(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,ko,i);return function(t){return Lh(n(t),e)}}function Eh(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,Go,i);return function(t){const i=n(t);if("boolean"!=typeof i)throw new Error(`Expected a boolean for ${e}`);return i}}function Ch(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,Ao,i);return function(t){return Nh(n(t),e)}}function Ph(t,e,i){const s=Sh(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=Ja(t,Oo,i);return function(t){return jh(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=Ja(s,Fo,i);return function(t){return Fh(n(t),e)}}function Ih(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,Fo,i);return function(t){const i=Fh(n(t),e);if(2!==i.length)throw new Error(`Expected two numbers for ${e}`);return i}}function Rh(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,Fo,i);return function(t){return Dh(n(t),e)}}function Th(t,e,i){const s=Sh(t,e);if(void 0===s)return null;const n=Ja(s,Fo|Oo,i);return function(t){return i=n(t),s=e,"number"==typeof i?i:Dh(i,s);var i,s}}function Gh(t,e){const i=t[e];if(void 0!==i){if("number"!=typeof i)throw new Error(`Expected a number for ${e}`);return i}}function Oh(t,e){const i=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 kh(t,e){const i=t[e];if(void 0!==i){if("pixels"!==i&&"fraction"!==i)throw new Error(`Expected pixels or fraction for ${e}`);return i}}function Ah(t,e){const i=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 Fh(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 Lh(t,e){if("string"!=typeof t)throw new Error(`Expected a string for ${e}`);return t}function jh(t,e){if("number"!=typeof t)throw new Error(`Expected a number for ${e}`);return t}function Nh(t,e){if("string"==typeof t)return t;const i=Fh(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 Dh(t,e){const i=Fh(t,e);if(2!==i.length)throw new Error(`Expected an array of two numbers for ${e}`);return i}const zh={CENTER:"center",RESOLUTION:"resolution",ROTATION:"rotation"};function Wh(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,l=e?0:r[1]*n,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,_=t[3]-l/2+u;d>f&&(d=(f+d)/2,f=d),g>_&&(g=(_+g)/2,_=g);let p=pe(s[0],d,f),m=pe(s[1],g,_);if(o&&i&&n){const t=30*n;p+=-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]-_)/t)}return[p,m]}}function Bh(t){return t}function Xh(t){return Math.pow(t,3)}function qh(t){return 1-Xh(1-t)}function Uh(t){return 3*t*t-2*t*t*t}function Yh(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 Zh(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Yh(t,e,o,s),e=o}return n}function Vh(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]=Se(t[e+n],t[i+n],d);return void(o.length=s)}u=e}}for(let e=0;e<s;++e)o[e]=t[u+e];o.length=s}function Kh(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=ye(r,o,i,s);a>n&&(n=a),r=i,o=s}return n}function Hh(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Kh(t,e,o,s,n),e=o}return n}function $h(t,e,i,s,n,r,o,a,h,l,c){if(e==i)return l;let u,d;if(0===n){if(d=ye(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;for(;f<i;)if(Vh(t,f-s,f,s,o,a,c),d=ye(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&&(Vh(t,i-s,e,s,o,a,c),d=ye(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 Jh(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=$h(t,e,d,s,n,r,o,a,h,l,c),e=d}return l}function Qh(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 tl(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=Qh(t,e,i[o],s);n[r++]=a,e=a}return n.length=r,n}function el(t,e,i,s,n){n=n||[];let r=0;for(let o=0,a=i.length;o<a;++o){const a=tl(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 il(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 sl(t,e,i,s,n,r){return r=r??Yt([1/0,1/0,-1/0,-1/0],t,e,i,s),!!ae(n,r)&&(r[0]>=n[0]&&r[2]<=n[2]||r[1]>=n[1]&&r[3]<=n[3]||il(t,e,i,s,function(t,e){return function(t,e,i){let s=!1;const n=Nt(t,e),r=Nt(t,i);if(1===n||1===r)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;2&r&&!(2&n)&&(_=d-(f-l)/g,s=_>=o&&_<=h),s||!(4&r)||4&n||(p=f-(d-h)*g,s=p>=a&&p<=l),s||!(8&r)||8&n||(_=d-(f-a)/g,s=_>=o&&_<=h),s||!(16&r)||16&n||(p=f-(d-o)*g,s=p>=a&&p<=l)}return s}(n,t,e)}))}function nl(t,e,i,s,n){return!!(sl(t,e,i,s,n)||$i(t,e,i,s,n[0],n[1])||$i(t,e,i,s,n[0],n[3])||$i(t,e,i,s,n[2],n[1])||$i(t,e,i,s,n[2],n[3]))}function rl(t,e,i,s,n){if(!nl(t,e,i[0],s,n))return!1;if(1===i.length)return!0;for(let e=1,r=i.length;e<r;++e)if(Hi(t,i[e-1],i[e],s,n)&&!sl(t,i[e-1],i[e],s,n))return!1;return!0}class ol extends fo{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 ol(this.flatCoordinates.slice(),this.layout)}closestPointXY(t,e,i,s){return s<At(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$h(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,t,e,i,s))}getArea(){return Yh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){const e=[];return e.length=cs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new ol(e,"XY")}getType(){return"LinearRing"}intersectsExtent(t){return sl(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qh(this.flatCoordinates,0,t,this.stride),this.changed()}}const al=ol;class hl extends fo{constructor(t,e){super(),this.setCoordinates(t,e)}clone(){const t=new hl(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){const n=this.flatCoordinates,r=ye(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 Wt(this.flatCoordinates,t)}getType(){return"Point"}intersectsExtent(t){return jt(t,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(t,e){this.setLayout(e,t,0),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=function(t,e,i){for(let s=0,n=i.length;s<n;++s)t[e++]=i[s];return e}(this.flatCoordinates,0,t,this.stride),this.changed()}}const ll=hl;class cl extends fo{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?gt(this.flatCoordinates,t.getFlatCoordinates()):this.flatCoordinates=t.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new cl(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<At(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hh(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jh(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,t,e,i,s))}containsXY(t,e){return Ji(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,e)}getArea(){return Zh(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),as(e,0,this.ends_,this.stride,t)):e=this.flatCoordinates,Wn(e,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){const t=Jt(this.getExtent());this.flatInteriorPoint_=Qi(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new ll(this.getFlatInteriorPoint(),"XYM")}getLinearRingCount(){return this.ends_.length}getLinearRing(t){return t<0||this.ends_.length<=t?null:new al(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 al(e.slice(n,o),t);s.push(a),n=o}return s}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;rs(t,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=as(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=gs(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),e,0,i),new cl(e,"XY",i)}getType(){return"Polygon"}intersectsExtent(t){return rl(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=tl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const ul=cl;function dl(t){if(he(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 cl(r,"XY",[r.length])}function fl(t,e,i,s){const n=oe(e)/i[0],r=ee(e)/i[1];return s?Math.min(t,Math.max(n,r)):Math.min(t,Math.min(n,r))}function gl(t,e,i){let s=Math.min(t,e);return s*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(s=Math.max(s,i),s/=Math.log(1+50*Math.max(0,i/t-1))/50+1),pe(s,i/2,2*e)}function _l(t,e,i,s,n){return i=void 0===i||i,function(r,o,a,h){if(void 0!==r){const o=s?fl(t,s,a,n):t;return i&&h?gl(r,o,e):pe(r,e,o)}}}function pl(t){if(void 0!==t)return 0}function ml(t){if(void 0!==t)return t}function yl(t,e){setTimeout(function(){t(e)},0)}function xl(t){return!(t.sourceCenter&&t.targetCenter&&!Pe(t.sourceCenter,t.targetCenter))&&t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation}function vl(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;return a+=(e[0]/2-i[0])*s,h+=(i[1]-e[1]/2)*s,o=-o,[a*r-h*o,h*r+a*o]}const wl=class extends Pt{constructor(t){super(),this.on,this.once,this.un,t=Object.assign({},t),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ii(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&&function(t){Si=!(void 0===t||t)}(),t.center&&(t.center=zi(t.center,this.projection_)),t.extent&&(t.extent=Bi(t.extent,this.projection_)),this.applyOptions_(t)}applyOptions_(t){const e=Object.assign({},t);for(const t in zh)delete e[t];this.setProperties(e,!0);const i=function(t){let e,i,s;let n=void 0!==t.minZoom?t.minZoom:0,r=void 0!==t.maxZoom?t.maxZoom:28;const o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,h=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,l=void 0!==t.showFullExtent&&t.showFullExtent,c=Ii(t.projection,"EPSG:3857"),u=c.getExtent();let d=t.constrainOnlyCenter,f=t.extent;if(a||f||!c.isGlobal()||(d=!1,f=u),void 0!==t.resolutions){const o=t.resolutions;i=o[n],s=void 0!==o[r]?o[r]:o[o.length-1],e=t.constrainResolution?function(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?fl(h,i,o,s):h;if(a)return e?gl(n,c,l):pe(n,l,c);const u=Math.min(c,n),d=Math.floor(dt(t,u,r));return t[d]>c&&d<t.length-1?t[d+1]:t[d]}}}(o,h,!d&&f,l):_l(i,s,h,!d&&f,l)}else{const a=(u?Math.max(oe(u),ee(u)):360*Te.degrees/c.getMetersPerUnit())/256/Math.pow(2,0),g=a/Math.pow(2,28);i=t.maxResolution,void 0!==i?n=0:i=a/Math.pow(o,n),s=t.minResolution,void 0===s&&(s=void 0!==t.maxZoom?void 0!==t.maxResolution?i/Math.pow(o,r):a/Math.pow(o,r):g),r=n+Math.floor(Math.log(i/s)/Math.log(o)),s=i/Math.pow(o,r-n),e=t.constrainResolution?function(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?fl(e,n,h,r):e;if(l)return s?gl(o,c,i):pe(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),_=Math.floor(Math.log(e/g)/Math.log(t)+f),p=Math.max(d,_);return pe(e/Math.pow(t,p),i,c)}}}(o,i,s,h,!d&&f,l):_l(i,s,h,!d&&f,l)}return{constraint:e,maxResolution:i,minResolution:s,minZoom:n,zoomFactor:o}}(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=function(t){if(void 0!==t.extent){const e=void 0===t.smoothExtentConstraint||t.smoothExtentConstraint;return Wh(t.extent,t.constrainOnlyCenter,e)}const e=Ii(t.projection,"EPSG:3857");if(!0!==t.multiWorld&&e.isGlobal()){const t=e.getExtent().slice();return t[0]=-1/0,t[2]=1/0,Wh(t,!1,!1)}return Bh}(t),n=i.constraint,r=function(t){if(void 0===t.enableRotation||t.enableRotation){const e=t.constrainRotation;return void 0===e||!0===e?function(){const t=ve(5);return function(e,i){return i||void 0===e?e:Math.abs(e)<=t?0:e}}():!1===e?ml:"number"==typeof e?function(t){const e=2*Math.PI/t;return function(t,i){return i?t:void 0!==t?t=Math.floor(t/e+.5)*e:void 0}}(e):ml}return pl}(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 t=0;t<e.length;++t){let i=arguments[t];i.center&&(i=Object.assign({},i),i.center=zi(i.center,this.getProjection())),i.anchor&&(i=Object.assign({},i),i.anchor=zi(i.anchor,this.getProjection())),e[t]=i}this.animateInternal.apply(this,e)}animateInternal(t){let e,i=arguments.length;i>1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i);let 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&&yl(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||Uh,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=we(t.rotation-a+Math.PI,2*Math.PI)-Math.PI;i.targetRotation=a+e,a=i.targetRotation}xl(i)?i.complete=!0:n+=i.duration,h.push(i)}this.animations_.push(h),this.setHint(0,1),this.updateAnimations_()}getAnimating(){return this.hints_[0]>0}getInteracting(){return this.hints_[1]>0}cancelAnimations(){let t;this.setHint(0,-this.hints_[0]);for(let e=0,i=this.animations_.length;e<i;++e){const i=this.animations_[e];if(i[0].callback&&yl(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?we(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(0,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;const t=s[0].callback;t&&yl(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();var n,r;return void 0!==s&&(i=[s[0]-e[0],s[1]-e[1]],function(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;t[0]=n,t[1]=r}(i,t-this.getRotation()),r=e,(n=i)[0]+=+r[0],n[1]+=+r[1]),i}calculateCenterZoom(t,e){let i;const s=this.getCenterInternal(),n=this.getResolution();return void 0!==s&&void 0!==n&&(i=[e[0]-t*(e[0]-s[0])/n,e[1]-t*(e[1]-s[1])/n]),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?Di(t,this.getProjection()):t}getCenterInternal(){return this.get(zh.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){return Wi(this.calculateExtentInternal(t),this.getProjection())}calculateExtentInternal(t){t=t||this.getViewportSizeMinusPadding_();const e=this.getCenterInternal();Gt(e,"The view center is not defined");const i=this.getResolution();Gt(void 0!==i,"The view resolution is not defined");const s=this.getRotation();return Gt(void 0!==s,"The view rotation is not defined"),function(t,e,i,s){const[n,r,o,a,h,l,c,u]=te(t,e,i,s);return Dt(Math.min(n,o,h,c),Math.min(r,a,l,u),Math.max(n,o,h,c),Math.max(r,a,l,u),void 0)}(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(zh.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(t,e){return this.getResolutionForExtentInternal(Bi(t,this.getProjection()),e)}getResolutionForExtentInternal(t,e){e=e||this.getViewportSizeMinusPadding_();const i=oe(t)/e[0],s=ee(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){return e/Math.pow(t,i*s)}}getRotation(){return this.get(zh.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){return Math.log(i/t)/e/n}}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=vl(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=dt(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=pe(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,pe(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)}fit(t,e){let i;if(Gt(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,"Invalid extent or geometry provided as `geometry`"),Array.isArray(t))Gt(!he(t),"Cannot fit empty extent provided as `geometry`"),i=dl(Bi(t,this.getProjection()));else if("Circle"===t.getType()){const e=Bi(t.getExtent(),this.getProjection());i=dl(e),i.rotate(this.getRotation(),Jt(e))}else{const e=Ni();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 t=0,e=n.length;t<e;t+=r){const e=n[t]*i-n[t+1]*s,r=n[t]*s+n[t+1]*i;o=Math.min(o,e),a=Math.min(a,r),h=Math.max(h,e),l=Math.max(l,r)}return[o,a,h,l]}fitInternal(t,e){let i=(e=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=Jt(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),_=e.callback?e.callback:mt;void 0!==e.duration?this.animateInternal({resolution:a,center:g,duration:e.duration,easing:e.easing},_):(this.targetResolution_=a,this.targetCenter_=g,this.applyTargetState_(!1,!0),yl(_,!0))}centerOn(t,e,i){this.centerOnInternal(zi(t,this.getProjection()),e,i)}centerOnInternal(t,e,i){this.setCenterInternal(vl(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=vl(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=Di(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&&zi(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_*=t,this.applyTargetState_()}adjustZoom(t,e){this.adjustResolution(Math.pow(this.zoomFactor_,-t),e)}adjustRotation(t,e){e&&(e=zi(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_+=t,this.applyTargetState_()}setCenter(t){this.setCenterInternal(t?zi(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(zh.ROTATION)!==s&&this.set(zh.ROTATION,s),this.get(zh.RESOLUTION)!==r&&(this.set(zh.RESOLUTION,r),this.set("zoom",this.getZoom(),!0)),o&&this.get(zh.CENTER)&&Pe(this.get(zh.CENTER),o)||this.set(zh.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()&&Pe(this.getCenterInternal(),a)||(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:n,center:a,resolution:o,duration:t,easing:qh,anchor:i}))}beginInteraction(){this.resolveConstraints(0),this.setHint(1,1)}endInteraction(t,e,i){i=i&&zi(i,this.getProjection()),this.endInteractionInternal(t,e,i)}endInteractionInternal(t,e,i){this.getInteracting()&&(this.setHint(1,-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)}},Sl="opacity",Ml="visible",bl="extent",El="zIndex",Cl="maxResolution",Pl="minResolution",Il="maxZoom",Rl="minZoom",Tl="source",Gl=class extends Pt{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[Sl]=void 0!==t.opacity?t.opacity:1,Gt("number"==typeof e[Sl],"Layer opacity must be a number"),e[Ml]=void 0===t.visible||t.visible,e[El]=t.zIndex,e[Cl]=void 0!==t.maxResolution?t.maxResolution:1/0,e[Pl]=void 0!==t.minResolution?t.minResolution:0,e[Rl]=void 0!==t.minZoom?t.minZoom:-1/0,e[Il]=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=pe(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 Mt()}getLayerStatesArray(t){return Mt()}getExtent(){return this.get(bl)}getMaxResolution(){return this.get(Cl)}getMinResolution(){return this.get(Pl)}getMinZoom(){return this.get(Rl)}getMaxZoom(){return this.get(Il)}getOpacity(){return this.get(Sl)}getSourceState(){return Mt()}getVisible(){return this.get(Ml)}getZIndex(){return this.get(El)}setBackground(t){this.background_=t,this.changed()}setExtent(t){this.set(bl,t)}setMaxResolution(t){this.set(Cl,t)}setMinResolution(t){this.set(Pl,t)}setMaxZoom(t){this.set(Il,t)}setMinZoom(t){this.set(Rl,t)}setOpacity(t){Gt("number"==typeof t,"Layer opacity must be a number"),this.set(Sl,t)}setVisible(t){this.set(Ml,t)}setZIndex(t){this.set(El,t)}disposeInternal(){this.state_&&(this.state_.layer=null,this.state_=null),super.disposeInternal()}},Ol=class 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,this.handleSourcePropertyChange_);const i=t.source?t.source:null;this.setSource(i)}getLayersArray(t){return(t=t||[]).push(this),t}getLayerStatesArray(t){return(t=t||[]).push(this.getLayerState()),t}getSource(){return this.get(Tl)||null}getRenderSource(){return this.getSource()}getSourceState(){const t=this.getSource();return t?t.getState():"undefined"}handleSourceChange_(){this.changed(),this.sourceReady_||"ready"!==this.getSource().getState()||(this.sourceReady_=!0,this.dispatchEvent("sourceready"))}handleSourcePropertyChange_(){this.sourceChangeKey_&&(at(this.sourceChangeKey_),this.sourceChangeKey_=null),this.sourceReady_=!1;const t=this.getSource();t&&(this.sourceChangeKey_=rt(t,ht,this.handleSourceChange_,this),"ready"===t.getState()&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent("sourceready")},0))),this.changed()}getFeatures(t){return this.renderer_?this.renderer_.getFeatures(t):Promise.resolve([])}getData(t){return this.renderer_&&this.rendered?this.renderer_.getData(t):null}isVisible(t){let e;const i=this.getMapInternal();let s;if(!t&&i&&(t=i.getView()),e=t instanceof wl?{viewState:t.getState(),extent:t.calculateExtent()}:t,!e.layerStatesArray&&i&&(e.layerStatesArray=i.getLayerGroup().getLayerStatesArray()),e.layerStatesArray){if(s=e.layerStatesArray.find(t=>t.layer===this),!s)return!1}else s=this.getLayerState();const n=this.getExtent();return function(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}(s,e.viewState)&&(!n||ae(n,e.extent))}getAttributions(t){if(!this.isVisible(t))return[];const e=this.getSource()?.getAttributions();if(!e)return[];let i=e(t instanceof wl?t.getViewStateAndExtent():t);return Array.isArray(i)||(i=[i]),i}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("map",t)}getMapInternal(){return this.get("map")}setMap(t){this.mapPrecomposeKey_&&(at(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(at(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=rt(t,"precompose",this.handlePrecompose_,this),this.mapRenderKey_=rt(this,ht,t.render,t),this.changed())}handlePrecompose_(t){const e=t.frameState.layerStatesArray,i=this.getLayerState(!1);Gt(!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,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()}},kl="renderOrder",Al=class extends Ol{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(kl)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(t,e){const i=this.getDeclutter();i in t.declutter==0&&(t.declutter[i]=new As(9)),this.getRenderer().renderDeclutter(t,e)}setRenderOrder(t){this.set(kl,t)}setStyle(t){this.style_=void 0===t?dh:t;const e=function(t){if(void 0===t)return dh;if(!t)return null;if("function"==typeof t)return t;if(t instanceof gh)return t;if(Array.isArray(t)&&0===t.length)return[];if(Array.isArray(t)&&t[0]instanceof gh){const e=t.length,i=new Array(e);for(let s=0;s<e;++s){const e=t[s];if(!(e instanceof gh))throw new Error("Expected a list of style instances");i[s]=e}return i}return function(t,e){if(e=e??Yo(),!Array.isArray(t))return yh([t],e);const i=t.length;if("style"in t[0]){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 function(t,e){const i=function(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?Ja(i.filter,Go,e):mh;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]=xh(i.style[s],e)}else o=[xh(i.style,e)];s[n]={filter:r,styles:o}}return function(e){const n=[];let r=!1;for(let o=0;o<i;++o)if((0,s[o].filter)(e)&&(!t[o].else||!r)){r=!0;for(const t of s[o].styles){const i=t(e);i&&n.push(i)}}return n}}(t,e=e??Yo()),s={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};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}return e.geometryType&&(s.geometryType=$a(t.getGeometry())),i(s)}}(s,e)}return yh(t,e)}(t)}(t);this.styleFunction_=null===t?void 0:function(t){let e;if("function"==typeof t)e=t;else{let i;Array.isArray(t)?i=t:(Gt("function"==typeof t.getZIndex,"Expected an `Style` or an array of `Style`"),i=[t]),e=function(){return i}}return e}(e),this.changed()}setDeclutter(t){this.declutter_=t?String(t):void 0,this.changed()}},Fl=class extends Al{constructor(t){super(t)}createRenderer(){return new Ro(this)}},Ll=class extends vt{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(ht)}release(){this.setState(4)}getKey(){return this.key+"/"+this.tileCoord}getTileCoord(){return this.tileCoord}getState(){return this.state}setState(t){if(4!==this.state){if(3!==this.state&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()}}load(){Mt()}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:Xh(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()}},jl=[],Nl=class extends Ll{constructor(t,e,i,s,n){super(t,e,{transition:0}),this.context_=null,this.executorGroups={},this.loadingSourceTiles=0,this.hitDetectionImageData={},this.replayState_={},this.sourceTiles=[],this.errorTileKeys={},this.wantedResolution,this.getSourceTiles=s.bind(void 0,this),this.removeSourceTiles_=n,this.wrappedTileCoord=i}getContext(){return this.context_||(this.context_=on(1,1,jl)),this.context_}hasContext(){return!!this.context_}getImage(){return this.hasContext()?this.getContext().canvas:null}getReplayState(t){const e=Et(t);return e in this.replayState_||(this.replayState_[e]={dirty:!1,renderedRenderOrder:null,renderedResolution:NaN,renderedPixelRatio:NaN,renderedRevision:-1,renderedTileResolution:NaN,renderedTileRevision:-1,renderedTileZ:-1}),this.replayState_[e]}load(){this.getSourceTiles()}release(){this.context_&&(ln(this.context_),jl.push(this.context_.canvas),this.context_=null),this.removeSourceTiles_(this),this.sourceTiles.length=0,super.release()}},Dl=class extends Ll{constructor(t,e,i,s,n,r){super(t,e,r),this.extent=null,this.format_=s,this.features_=null,this.loader_,this.projection=null,this.resolution,this.tileLoadFunction_=n,this.url_=i,this.key=i}getTileUrl(){return this.url_}getFormat(){return this.format_}getFeatures(){return this.features_}load(){0==this.state&&(this.setState(1),this.tileLoadFunction_(this,this.url_),this.loader_&&this.loader_(this.extent,this.resolution,this.projection))}onLoad(t,e){this.setFeatures(t)}onError(){this.setState(3)}setFeatures(t){this.features_=t,this.setState(2)}setLoader(t){this.loader_=t}};class zl{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 Wl(t,e,i,s,n){return void 0!==n?(n.minX=t,n.maxX=e,n.minY=i,n.maxY=s,n):new zl(t,e,i,s)}const Bl=zl;function Xl(t,e,i,s){return void 0!==s?(s[0]=t,s[1]=e,s[2]=i,s):[t,e,i]}function ql(t,e,i,s,n){return`${Et(t)},${e},${function(t,e,i){return t+"/"+e+"/"+i}(i,s,n)}`}const Ul=[0,0,0],Yl=class{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,Gt(function(t){const e=((t,e)=>e-t)||ct;return t.every(function(i,s){if(0===s)return!0;const n=e(t[s-1],i);return!(n>0||0===n)})}(this.resolutions_),"`resolutions` must be sorted in descending order"),!t.origins)for(let t=0,e=this.resolutions_.length-1;t<e;++t)if(s){if(this.resolutions_[t]/this.resolutions_[t+1]!==s){s=void 0;break}}else s=this.resolutions_[t]/this.resolutions_[t+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,Gt(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_=ne(n)),Gt(!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,Gt(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,Gt(!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 Bl(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 t=s.minX,n=s.maxX;t<=n;++t)for(let n=s.minY,r=s.maxY;n<=r;++n)i([e,t,n])}forEachTileCoordParentTileRange(t,e,i,s){let n,r,o,a=null,h=t[0]-1;for(2===this.zoomFactor_?(r=t[1],o=t[2]):a=this.getTileCoordExtent(t,s);h>=this.minZoom;){if(void 0!==r&&void 0!==o?(r=Math.floor(r/2),o=Math.floor(o/2),n=Wl(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_[t]}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 Wl(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 Wl(n,r,n,r,i);if(this.zoomFactor_){const t=Math.pow(this.zoomFactor_,e-s),o=Math.floor(n*t),a=Math.floor(r*t);return e<s?Wl(o,o,a,a,i):Wl(o,Math.floor(t*(n+1))-1,a,Math.floor(t*(r+1))-1,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,Ul);const s=Ul[1],n=Ul[2];return this.getTileCoordForXYAndZ_(t[2],t[1],e,!0,Ul),Wl(s,Ul[1],n,Ul[2],i)}getTileCoordCenter(t){const e=this.getOrigin(t[0]),i=this.getResolution(t[0]),s=eo(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=eo(this.getTileSize(t[0]),this.tmpSize_),r=i[0]+t[1]*n[0]*s,o=i[1]-(t[2]+1)*n[1]*s;return Dt(r,o,r+n[0]*s,o+n[1]*s,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=eo(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=Ee(l,5)-1,c=Ee(c,5)-1):(l=be(l,5),c=be(c,5)),Xl(r,l,c,n)}getTileCoordForXYAndZ_(t,e,i,s,n){const r=this.getOrigin(i),o=this.getResolution(i),a=eo(this.getTileSize(i),this.tmpSize_);let h=(t-r[0])/o/a[0],l=(r[1]-e)/o/a[1];return s?(h=Ee(h,5)-1,l=Ee(l,5)-1):(h=be(h,5),l=be(l,5)),Xl(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_[t]}getFullTileRange(t){return this.fullTileRanges_?this.fullTileRanges_[t]:this.extent_?this.getTileRangeForExtentAndZ(this.extent_,t):null}getZForResolution(t,e){return pe(dt(this.resolutions_,t,e||0),this.minZoom,this.maxZoom)}tileCoordIntersectsViewport(t,e){return nl(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}};function Zl(t){let e=t.getDefaultTileGrid();return e||(e=function(t){return function(t,e,i,s){s=void 0!==s?s:"top-left";const n=Vl(t,e,i);return new Yl({extent:t,origin:Qt(t,s),resolutions:n,tileSize:i})}(Kl(t),void 0,void 0,void 0)}(t),t.setDefaultTileGrid(e)),e}function Vl(t,e,i,s){e=void 0!==e?e:42,i=eo(void 0!==i?i:256);const n=ee(t),r=oe(t);s=s>0?s:Math.max(r/i[0],n/i[1]);const o=e+1,a=new Array(o);for(let t=0;t<o;++t)a[t]=s/Math.pow(2,t);return a}function Kl(t){let e=(t=Ei(t)).getExtent();if(!e){const i=180*Te.degrees/t.getMetersPerUnit();e=Dt(-i,-i,i,i)}return e}const Hl=/\{z\}/g,$l=/\{x\}/g,Jl=/\{y\}/g,Ql=/\{-y\}/g;function tc(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 function(t,e,i,s,n){return t.replace(Hl,e.toString()).replace($l,i.toString()).replace(Jl,s.toString()).replace(Ql,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()})}(t,o,i[1],i[2],r)}}class ec extends xt{constructor(t,e){super(t),this.tile=e}}const ic=class extends $s{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;this.tileGrid&&eo(this.tileGrid.getTileSize(this.tileGrid.getMinZoom()),[256,256]),this.tmpSize=[0,0],this.key_=t.key||Et(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 Mt()}getTileGrid(){return this.tileGrid}getTileGridForProjection(t){return this.tileGrid?this.tileGrid:Zl(t)}getTilePixelRatio(t){return this.tilePixelRatio_}getTilePixelSize(t,e,i){const s=this.getTileGridForProjection(i),n=this.getTilePixelRatio(e),r=eo(s.getTileSize(t),this.tmpSize);return 1==n?r:(o=r,a=n,void 0===(h=this.tmpSize)&&(h=[0,0]),h[0]=o[0]*a+.5|0,h[1]=o[1]*a+.5|0,h);var o,a,h}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=function(t,e,i){const s=e[0],n=t.getTileCoordCenter(e),r=Kl(i);if(!Ft(r,n)){const e=oe(r),i=Math.ceil((r[0]-n[0])/e);return n[0]+=e*i,t.getTileCoordForCoordAndZ(n,s)}return e}(s,t,i)),function(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)}(t,s)?t:null}clear(){}refresh(){this.clear(),super.refresh()}};class sc extends ic{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===sc.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=Et(e),s=e.getState();let n;1==s?(this.tileLoadingKeys_[i]=!0,n="tileloadstart"):i in this.tileLoadingKeys_&&(delete this.tileLoadingKeys_[i],n=3==s?"tileloaderror":2==s?"tileloadend":void 0),null!=n&&this.dispatchEvent(new ec(n,e))}setTileLoadFunction(t){this.tileLoadFunction=t,this.changed()}setTileUrlFunction(t,e){this.tileUrlFunction=t,void 0!==e?this.setKey(e):this.changed()}setUrl(t){const e=function(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}(t);this.urls=e,this.setUrls(e)}setUrls(t){this.urls=t;const e=t.join("\n");this.generateTileUrlFunction_?this.setTileUrlFunction(function(t,e){const i=t.length,s=new Array(i);for(let n=0;n<i;++n)s[n]=tc(t[n],e);return function(t){return 1===t.length?t[0]:function(e,i,s){if(!e)return;const n=function(t){return e=t[0],(t[1]<<e)+t[2];var e}(e),r=we(n,t.length);return t[r](e,i,s)}}(s)}(t,this.tileGrid),e):this.setKey(e)}tileUrlFunction(t,e,i){}}const nc=sc,rc=class extends nc{constructor(t){const e=t.projection||"EPSG:3857",i=t.extent||Kl(e),s=t.tileGrid||function(t){const e=t||{},i=e.extent||Ei("EPSG:3857").getExtent(),s={extent:i,minZoom:e.minZoom,tileSize:e.tileSize,resolutions:Vl(i,e.maxZoom,e.tileSize,e.maxResolution)};return new Yl(s)}({extent:i,maxResolution:t.maxResolution,maxZoom:void 0!==t.maxZoom?t.maxZoom:22,minZoom:t.minZoom,tileSize:t.tileSize||512});super({attributions:t.attributions,attributionsCollapsible:t.attributionsCollapsible,cacheSize:t.cacheSize,interpolate:!0,projection:e,state:t.state,tileGrid:s,tileLoadFunction:t.tileLoadFunction?t.tileLoadFunction:oc,tileUrlFunction:t.tileUrlFunction,url:t.url,urls:t.urls,wrapX:void 0===t.wrapX||t.wrapX,transition:t.transition,zDirection:void 0===t.zDirection?1:t.zDirection}),this.format_=t.format?t.format:null,this.tileKeysBySourceTileUrl_={},this.sourceTiles_={},this.overlaps_=null==t.overlaps||t.overlaps,this.tileClass=t.tileClass?t.tileClass:Dl,this.tileGrids_={}}getOverlaps(){return this.overlaps_}getSourceZ_(t,e,i){const s=this.projection,n=e&&s&&!Gi(e,s)?t/s.getMetersPerUnit()*e.getMetersPerUnit():t;return this.tileGrid.getZForResolution(n,i)}getSourceTiles(t,e,i,s){if(0===i.getState()){i.setState(1);const n=i.wrappedTileCoord,r=this.getTileGridForProjection(e);let o=r.getTileCoordExtent(n);const a=n[0],h=r.getResolution(a);kt(o,-h,o);const l=this.projection;e&&this.projection&&!Gi(e,l)&&(o=Li(o,e,l));const c=this.tileGrid,u=c.getExtent();u&&ie(o,u,o);const d=this.getSourceZ_(h,e,this.zDirection),f=s||this.tileUrlFunction;c.forEachTileCoord(o,d,s=>{const n=f(s,t,e);this.sourceTiles_[n]||(this.sourceTiles_[n]=new this.tileClass(s,n?0:4,n,this.format_,this.tileLoadFunction));const r=this.sourceTiles_[n];i.sourceTiles.push(r),this.tileKeysBySourceTileUrl_[n]||(this.tileKeysBySourceTileUrl_[n]=[]),this.tileKeysBySourceTileUrl_[n].push(i.getKey());const o=r.getState();if(o<2){const t=e=>{this.handleTileChange(e);const s=r.getState();if(2===s||3===s){const e=r.getKey();e in i.errorTileKeys?2===r.getState()&&delete i.errorTileKeys[e]:i.loadingSourceTiles--,3===s?i.errorTileKeys[e]=!0:r.removeEventListener(ht,t),0===i.loadingSourceTiles&&i.setState(nt(i.errorTileKeys)?2:3)}};r.addEventListener(ht,t),i.loadingSourceTiles++}0===o&&(r.extent=c.getTileCoordExtent(s),r.projection=this.projection,r.resolution=c.getResolution(s[0]),r.load())}),i.loadingSourceTiles||i.setState(i.sourceTiles.some(t=>3===t.getState())?3:2)}return i.sourceTiles}removeSourceTiles(t){const e=t.getKey(),i=t.sourceTiles;for(let t=0,s=i.length;t<s;++t){const s=i[t].getTileUrl();if(!this.tileKeysBySourceTileUrl_[s])return;const n=this.tileKeysBySourceTileUrl_[s].indexOf(e);-1!==n&&(this.tileKeysBySourceTileUrl_[s].splice(n,1),0===this.tileKeysBySourceTileUrl_[s].length&&(delete this.tileKeysBySourceTileUrl_[s],delete this.sourceTiles_[s]))}}getTile(t,e,i,s,n){const r=[t,e,i];let o=this.getTileCoordForTileUrlFunction(r,n);const a=this.getTileGrid().getExtent(),h=this.projection,l=this.getTileGridForProjection(n);if(o&&a){const e=l.getTileCoordExtent(o);kt(e,-l.getResolution(t),e),ae(a,n&&h&&!Gi(n,h)?Li(e,n,h):e)||(o=null)}let c=!0;if(null!==o){const e=this.tileGrid,i=l.getResolution(t),r=this.getSourceZ_(i,n,1),a=l.getTileCoordExtent(o);kt(a,-i,a),e.forEachTileCoord(n&&h&&!Gi(n,h)?Li(a,n,h):a,r,t=>{c=c&&!this.tileUrlFunction(t,s,h)})}const u=this.tileUrlFunction,d=new Nl(r,c?4:0,o,t=>this.getSourceTiles(s,n,t,u),this.removeSourceTiles.bind(this));return d.key=this.getKey(),d}getTileGridForProjection(t){const e=t.getCode();let i=this.tileGrids_[e];if(!i){const s=this.projection;if(null!==s&&!Gi(s,t))return Zl(t);const n=this.tileGrid,r=n.getResolutions().slice(),o=r.map(function(t,e){return n.getOrigin(e)}),a=r.map(function(t,e){return n.getTileSize(e)}),h=43;for(let t=r.length;t<h;++t)r.push(r[t-1]/2),o.push(o[t-1]),a.push(a[t-1]);i=new Yl({extent:n.getExtent(),origins:o,resolutions:r,tileSizes:a}),this.tileGrids_[e]=i}return i}getTilePixelRatio(t){return t}getTilePixelSize(t,e,i){const s=eo(this.getTileGridForProjection(i).getTileSize(t),this.tmpSize);return[Math.round(s[0]*e),Math.round(s[1]*e)]}setOverlaps(t){this.overlaps_=t,this.changed()}};function oc(t,e){t.setLoader(function(i,s,n){de(e,t.getFormat(),i,s,n,t.onLoad.bind(t),t.onError.bind(t))})}function ac(t){return t instanceof Image||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageBitmap?t:null}const hc=new Error("disposed"),lc=[256,256],cc=class extends Ll{constructor(t){super(t.tileCoord,0,{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=ac(this.data_);return t?[t.width,t.height]:lc}getData(){return this.data_}getError(){return this.error_}load(){if(0!==this.state&&3!==this.state)return;this.state=1,this.changed();const t=this;this.loader_().then(function(e){t.data_=e,t.state=2,t.changed()}).catch(function(e){t.error_=e,t.state=3,t.changed()})}disposeInternal(){this.controller_&&(this.controller_.abort(hc),this.controller_=null),super.disposeInternal()}},uc=class extends Ll{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_,nn?this.image_=new OffscreenCanvas(1,1):(this.image_=new Image,null!==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=2,this.unlistenImage_(),this.changed()}getCrossOrigin(){return this.crossOrigin_}getReferrerPolicy(){return this.referrerPolicy_}handleImageError_(){this.state=3,this.unlistenImage_(),this.image_=function(){const t=on(1,1);return t.fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas}(),this.changed()}handleImageLoad_(){if(nn)this.state=2;else{const t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=2:this.state=4}this.unlistenImage_(),this.changed()}load(){3==this.state&&(this.state=0,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_),void 0!==this.referrerPolicy_&&(this.image_.referrerPolicy=this.referrerPolicy_)),0==this.state&&(this.state=1,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=function(t,e,i){const s=t;let n=!0,r=!1,o=!1;const a=[ot(s,"load",function(){o=!0,r||e()})];return s.src&&rn?(r=!0,s.decode().then(function(){n&&e()}).catch(function(t){n&&(o?e():i())})):a.push(ot(s,"error",i)),function(){n=!1,a.forEach(at)}}(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))}unlistenImage_(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)}disposeInternal(){this.unlistenImage_(),this.image_=null,super.disposeInternal()}};let dc;const fc=[];function gc(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 _c(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function pc(t,e,i,s){const n=Fi(i,e,t);let r=Ci(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||Ft(h,n)){const e=Ci(t,r,n)/r;isFinite(e)&&e>0&&(r/=e)}return r}const mc=class{constructor(t,e,i,s,n,r,o){this.sourceProj_=t,this.targetProj_=e;let a={};const h=o?Ri(t=>Ms(o,Fi(t,this.targetProj_,this.sourceProj_))):Ai(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()&&oe(s)>=oe(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?oe(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?oe(this.targetProj_.getExtent()):null;const l=ne(i),c=re(i),u=$t(i),d=Ht(i),f=this.transformInv_(l),g=this.transformInv_(c),_=this.transformInv_(u),p=this.transformInv_(d),m=10+(r?Math.max(0,Math.ceil(Math.log2(Kt(i)/(r*r*256*256)))):0);if(this.addQuad_(l,c,u,d,f,g,_,p,m),this.wrapsXInSource_){let t=1/0;this.triangles_.forEach(function(e,i,s){t=Math.min(t,e.source[0][0],e.source[1][0],e.source[2][0])}),this.triangles_.forEach(e=>{if(Math.max(e.source[0][0],e.source[1][0],e.source[2][0])-t>this.sourceWorldWidth_/2){const i=[[e.source[0][0],e.source[0][1]],[e.source[1][0],e.source[1][1]],[e.source[2][0],e.source[2][1]]];i[0][0]-t>this.sourceWorldWidth_/2&&(i[0][0]-=this.sourceWorldWidth_),i[1][0]-t>this.sourceWorldWidth_/2&&(i[1][0]-=this.sourceWorldWidth_),i[2][0]-t>this.sourceWorldWidth_/2&&(i[2][0]-=this.sourceWorldWidth_);const s=Math.min(i[0][0],i[1][0],i[2][0]);Math.max(i[0][0],i[1][0],i[2][0])-s<this.sourceWorldWidth_/2&&(e.source=i)}})}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=Ot([n,r,o,a]),c=this.sourceWorldWidth_?oe(l)/this.sourceWorldWidth_:null,u=this.sourceWorldWidth_,d=this.sourceProj_.canWrapX()&&c>.5&&c<1;let f=!1;if(h>0&&(this.targetProj_.isGlobal()&&this.targetWorldWidth_&&(f=oe(Ot([t,e,i,s]))/this.targetWorldWidth_>.25||f),!d&&this.sourceProj_.isGlobal()&&c&&(f=c>.25||f)),!f&&this.maxSourceExtent_&&isFinite(l[0])&&isFinite(l[1])&&isFinite(l[2])&&isFinite(l[3])&&!ae(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;r=d?(we(n[0],u)+we(o[0],u))/2-we(s[0],u):(n[0]+o[0])/2-s[0];const a=(n[1]+o[1])/2-s[1];f=r*r+a*a>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}11&g||this.addTriangle_(t,i,s,n,o,a),14&g||this.addTriangle_(t,i,e,n,o,r),g&&(13&g||this.addTriangle_(e,s,t,r,a,n),7&g||this.addTriangle_(e,s,i,r,a,o))}calculateSourceExtent(){const t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach(function(e,i,s){const n=e.source;Ut(t,n[0]),Ut(t,n[1]),Ut(t,n[2])}),t}getTriangles(){return this.triangles_}},yc=class extends Ll{constructor(t,e,i,s,n,r,o,a,h,l,c,u){super(n,0,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 _=f?ie(d,f):d;if(0===Kt(_))return void(this.state=4);const p=t.getExtent();p&&(g=g?ie(g,p):p);const m=s.getResolution(this.wrappedTileCoord_[0]),y=function(t,e,i,s){const n=Jt(i);let r=pc(t,e,n,s);return(!isFinite(r)||r<=0)&&Vt(i,function(i){return r=pc(t,e,i,s),isFinite(r)&&r>0}),r}(t,i,_,m);if(!isFinite(y)||y<=0)return void(this.state=4);const x=void 0!==l?l:.5;if(this.triangulation_=new mc(t,i,_,g,y*x,m),0===this.triangulation_.getTriangles().length)return void(this.state=4);this.sourceZ_=e.getZForResolution(y);let v=this.triangulation_.calculateSourceExtent();if(g&&(t.canWrapX()?(v[1]=pe(v[1],g[1],g[3]),v[3]=pe(v[3],g[1],g[3])):v=ie(v,g)),Kt(v)){let i=0,s=0;t.canWrapX()&&(i=oe(p),s=Math.floor((v[0]-p[0])/i)),ce(v.slice(),t,!0).forEach(t=>{const n=e.getTileRangeForExtentAndZ(t,this.sourceZ_);for(let t=n.minX;t<=n.maxX;t++)for(let e=n.minY;e<=n.maxY;e++){const n=s*i;this.sourceTiles_.push({getTile:()=>h(this.sourceZ_,t,e,o),offset:n})}++s}),0===this.sourceTiles_.length&&(this.state=4)}else this.state=4}getImage(){return this.canvas_}reproject_(){const t=[];if(this.sourceTiles_.forEach(e=>{const i=e.tile;if(i&&2==i.getState()){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),t.push({extent:s,clipExtent:n,image:i.getImage()})}}),this.sourceTiles_.length=0,0===t.length)this.state=3;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_=function(t,e,i,s,n,r,o,a,h,l,c,u,d,f){const g=on(Math.round(i*t),Math.round(i*e),fc);if(u||(g.imageSmoothingEnabled=!1),0===h.length)return g.canvas;function _(t){return Math.round(t*i)/i}g.scale(i,i),g.globalCompositeOperation="lighter";const p=[1/0,1/0,-1/0,-1/0];let m;h.forEach(function(t,e,i){qt(p,t.extent)});const y=i/s,x=(u?1:1+Math.pow(2,-24))/y;if(!d||1!==h.length||0!==l){if(m=on(Math.round(oe(p)*y),Math.round(ee(p)*y),fc),u||(m.imageSmoothingEnabled=!1),n&&f){const t=(n[0]-p[0])*y,e=-(n[3]-p[3])*y,i=oe(n)*y,s=ee(n)*y;m.rect(t,e,i,s),m.clip()}h.forEach(function(t,e,i){if(t.image.width>0&&t.image.height>0){if(t.clipExtent){m.save();const e=(t.clipExtent[0]-p[0])*y,i=-(t.clipExtent[3]-p[3])*y,s=oe(t.clipExtent)*y,n=ee(t.clipExtent)*y;m.rect(u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),m.clip()}const e=(t.extent[0]-p[0])*y,i=-(t.extent[3]-p[3])*y,s=oe(t.extent)*y,n=ee(t.extent)*y;m.drawImage(t.image,l,l,t.image.width-2*l,t.image.height-2*l,u?e:Math.round(e),u?i:Math.round(i),u?s:Math.round(e+s)-Math.round(e),u?n:Math.round(i+n)-Math.round(i)),t.clipExtent&&m.restore()}})}const v=ne(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=_((n[0][0]-v[0])/r),w=_(-(n[0][1]-v[1])/r),S=_((n[1][0]-v[0])/r),M=_(-(n[1][1]-v[1])/r),b=_((n[2][0]-v[0])/r),E=_(-(n[2][1]-v[1])/r),C=o,P=a;o=0,a=0,l-=C,c-=P,d-=C,f-=P;const I=function(t){const e=t.length;for(let i=0;i<e;i++){let s=i,n=Math.abs(t[i][i]);for(let r=i+1;r<e;r++){const e=Math.abs(t[r][i]);e>n&&(n=e,s=r)}if(0===n)return null;const r=t[s];t[s]=t[i],t[i]=r;for(let s=i+1;s<e;s++){const n=-t[s][i]/t[i][i];for(let r=i;r<e+1;r++)i==r?t[s][r]=0:t[s][r]+=n*t[i][r]}}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}([[l,c,0,0,S-y],[d,f,0,0,b-y],[0,0,l,c,M-w],[0,0,d,f,E-w]]);if(!I)return;if(g.save(),g.beginPath(),function(){if(void 0===dc){const t=on(6,6,fc);t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",gc(t,4,5,4,0),gc(t,4,5,0,5);const e=t.getImageData(0,0,3,3).data;dc=_c(e,0)||_c(e,4)||_c(e,8),ln(t),fc.push(t.canvas)}return dc}()||!u){g.moveTo(S,M);const t=4,e=y-S,i=w-M;for(let s=0;s<t;s++)g.lineTo(S+_((s+1)*e/t),M+_(s*i/(t-1))),s!=t-1&&g.lineTo(S+_((s+1)*e/t),M+_((s+1)*i/(t-1)));g.lineTo(b,E)}else g.moveTo(S,M),g.lineTo(y,w),g.lineTo(b,E);let R;if(g.clip(),g.transform(I[0],I[2],I[1],I[3],y,w),g.translate(p[0]-C,p[3]-P),m)R=m.canvas,g.scale(x,-x);else{const t=h[0],e=t.extent;R=t.image,g.scale(oe(e)/R.width,-ee(e)/R.height)}g.drawImage(R,0,0),g.restore()}),m&&(ln(m),fc.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]-v[0])/r,o=-(s[0][1]-v[1])/r,a=(s[1][0]-v[0])/r,h=-(s[1][1]-v[1])/r,l=(s[2][0]-v[0])/r,c=-(s[2][1]-v[1])/r;g.beginPath(),g.moveTo(a,h),g.lineTo(n,o),g.lineTo(l,c),g.closePath(),g.stroke()}),g.restore()),g.canvas}(s,n,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),r,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.interpolate),this.state=2}this.changed()}load(){for(const t of this.sourceTiles_)t.tile=t.getTile();if(0==this.state){this.state=1,this.changed();let t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(({tile:e})=>{const i=e.getState();if(0==i||1==i){t++;const i=rt(e,ht,s=>{const n=e.getState();2!=n&&3!=n&&4!=n||(at(i),t--,0===t&&(this.unlistenSources_(),this.reproject_()))});this.sourcesListenerKeys_.push(i)}}),0===t?setTimeout(this.reproject_.bind(this),0):this.sourceTiles_.forEach(function({tile:t},e,i){0==t.getState()&&t.load()})}}unlistenSources_(){this.sourcesListenerKeys_.forEach(at),this.sourcesListenerKeys_=null}release(){this.canvas_&&(ln(this.canvas_.getContext("2d")),fc.push(this.canvas_),this.canvas_=null),this.sourceTiles_.length=0,super.release()}},xc=class{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 lt&&t.dispose()}canExpireCache(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark}expireCache(t){for(;this.canExpireCache();)this.deleteOldest()}clear(){for(;this.oldest_;)this.deleteOldest()}containsKey(t){return this.entries_.hasOwnProperty(t)}forEach(t){let e=this.oldest_;for(;e;)t(e.value_,e.key_,this),e=e.newer}get(t,e){const i=this.entries_[t];return Gt(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 Gt(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){Gt(!(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}};function vc(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 wc(t,e,i){const s=t[i];return!!s&&s.delete(e)}function Sc(t,e){const i=t.layerStatesArray[t.layerIndex];i.extent&&(e=ie(e,Bi(i.extent,t.viewState.projection)));const s=i.layer.getRenderSource();if(!s.getWrapX()){const i=s.getTileGridForProjection(t.viewState.projection).getExtent();i&&(e=ie(e,i))}return e}const Mc=class extends Io{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=[1/0,1/0,-1/0,-1/0],this.tempTileRange_=new Bl(0,0,0,0),this.tempTileCoord_=Xl(0,0,0);const i=void 0!==e.cacheSize?e.cacheSize:512;this.tileCache_=new xc(i),this.sourceTileCache_=null,this.layerExtent=null,this.maxStaleKeys=.5*i}getTileCache(){return this.tileCache_}getSourceTileCache(){return this.sourceTileCache_||(this.sourceTileCache_=new xc(512)),this.sourceTileCache_}getOrCreateTile(t,e,i,s){const n=this.tileCache_,r=this.getLayer().getSource(),o=ql(r,r.getKey(),t,e,i);let a;if(n.containsKey(o))a=n.get(o);else{const h=s.viewState.projection,l=r.getProjection();if(a=r.getTile(t,e,i,s.pixelRatio,h,!l||Gi(l,h)?void 0:this.getSourceTileCache()),!a)return null;n.set(o,a)}return a}getTile(t,e,i,s){return this.getOrCreateTile(t,e,i,s)||null}getData(t){const e=this.frameState;if(!e)return null;const i=this.getLayer(),s=Ms(e.pixelToCoordinateTransform,t.slice()),n=i.getExtent();if(n&&!Ft(n,s))return null;const r=e.viewState,o=i.getRenderSource(),a=o.getTileGridForProjection(r.projection),h=o.getTilePixelRatio(e.pixelRatio);for(let t=a.getZForResolution(r.resolution);t>=a.getMinZoom();--t){const i=a.getTileCoordForCoordAndZ(s,t),n=this.getTile(t,i[1],i[2],e);if(!n||2!==n.getState())continue;const l=a.getOrigin(t),c=eo(a.getTileSize(t)),u=a.getResolution(t);let d;if(n instanceof uc||n instanceof yc)d=n.getImage();else{if(!(n instanceof cc))continue;if(d=ac(n.getData()),!d)continue}const f=Math.floor(h*((s[0]-l[0])/u-i[1]*c[0])),g=Math.floor(h*((l[1]-s[1])/u-i[2]*c[1])),_=Math.round(h*o.getGutterForProjection(r.projection));return this.getImageData(d,f+_,g+_)}return null}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(),h=a.getTileGridForProjection(r.projection),l=Et(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?te(r.center,r.resolution,f,t.size):void 0;for(let n=i;n>=d;--n){const i=h.getTileRangeForExtentAndZ(e,n,this.tempTileRange_),r=h.getResolution(n);for(let e=i.minX;e<=i.maxX;++e)for(let o=i.minY;o<=i.maxY;++o){if(f&&!h.tileCoordIntersectsViewport([n,e,o],g))continue;const i=this.getTile(n,e,o,t);if(!i)continue;if(!vc(s,i,n))continue;const a=i.getKey();if(c[a]=!0,0===i.getState()&&!t.tileQueue.isKeyQueued(a)){const s=Xl(n,e,o,this.tempTileCoord_);t.tileQueue.enqueue([i,l,h.getTileCoordCenter(s),r])}}}}findStaleTile_(t,e){const i=this.tileCache_,s=t[0],n=t[1],r=t[2],o=this.getStaleKeys();for(let t=0;t<o.length;++t){const a=ql(this.getLayer().getSource(),o[t],s,n,r);if(i.containsKey(a)){const t=i.peek(a);if(2===t.getState())return t.endTransition(Et(this)),vc(e,t,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(),h=a.getKey();for(let t=n.minX;t<=n.maxX;++t)for(let e=n.minY;e<=n.maxY;++e){const n=ql(a,h,i,t,e);let l=!1;if(o.containsKey(n)){const t=o.peek(n);2===t.getState()&&(vc(s,t,i),l=!0)}l||(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(),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 _=this.context.canvas.width,p=this.context.canvas.height;this.layerExtent=i.extent?Bi(i.extent):null,this.layerExtent&&(f=ie(f,this.layerExtent));const m=d*_/2/g,y=d*p/2/g,x=[o[0]-m,o[1]-y,o[0]+m,o[1]+y],v={};this.renderedTiles.length=0;const w=h.getPreload();if(t.nextExtent&&this.enqueueTilesForNextExtent()){const e=c.getZForResolution(s.nextResolution,l.zDirection),i=Sc(t,t.nextExtent);this.enqueueTiles(t,i,e,v,w)}const S=Sc(t,f);if(this.enqueueTiles(t,S,u,v,0),w>0&&setTimeout(()=>{this.enqueueTiles(t,S,u-1,v,w-1)},0),!(u in v))return this.container;const M=Et(this),b=t.time;for(const e of v[u]){const i=e.getState();if(4===i)continue;const s=e.tileCoord;if(2===i&&1===e.getAlpha(M,b)){e.endTransition(M);continue}if(3!==i&&(this.renderComplete=!1),this.findStaleTile_(s,v)){wc(v,e,u),t.animate=!0;continue}if(this.findAltTiles_(c,s,u+1,v))continue;const n=c.getMinZoom();for(let t=u-1;t>=n&&!this.findAltTiles_(c,s,t,v);--t);}const E=d/r*a/g,C=this.getRenderContext(t);Es(this.tempTransform,_/2,p/2,E,E,0,-_/2,-p/2),this.layerExtent&&this.clipUnrotated(C,t,this.layerExtent),l.getInterpolate()||(C.imageSmoothingEnabled=!1),this.preRender(C,t);const P=Object.keys(v).map(Number);P.sort(ct);const I=[],R=[],T=[];for(let e=P.length-1;e>=0;--e){const i=P[e],s=l.getTilePixelSize(i,a,n),r=c.getResolution(i)/d,o=s[0]*r*E,h=s[1]*r*E,f=c.getTileCoordForCoordAndZ(ne(x),i),_=c.getTileCoordExtent(f),p=Ms(this.tempTransform,[g*(_[0]-x[0])/d,g*(x[3]-_[3])/d]),m=g*l.getGutterForProjection(n);for(const e of v[i]){if(2!==e.getState())continue;const s=e.tileCoord,n=f[1]-s[1],r=Math.round(p[0]-(n-1)*o),a=f[2]-s[2],c=Math.round(p[1]-(a-1)*h),d=Math.round(p[0]-n*o),g=Math.round(p[1]-a*h),_=r-d,y=c-g,x=i===u;if(x&&e.inTransition(M)){T.push({tile:e,x:d,y:g,w:_,h:y,gutter:m}),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e);continue}const v=[d,g,d+_,g+y],w=[];for(let t=0,e=I.length;t<e;++t)i<R[t]&&ae(v,I[t])&&w.push(I[t]);let S;w.length>0&&(S=ue(v,w)),I.push(v),R.push(i),this.drawTile(e,t,d,g,_,y,m,x,S),this.renderedTiles.unshift(e),this.updateUsedTiles(t.usedTiles,l,e)}}for(let e=0,i=T.length;e<i;++e){const{tile:i,x:s,y:n,w:r,h:o,gutter:a}=T[e];this.drawTile(i,t,s,n,r,o,a,!0,void 0)}if(this.renderedResolution=d,this.extentChanged=!this.renderedExtent_||!Xt(this.renderedExtent_,x),this.renderedExtent_=x,this.renderedPixelRatio=a,this.postRender(this.context,t),this.layerExtent&&C.restore(),C.imageSmoothingEnabled=!0,this.renderComplete){const e=(t,e)=>{const i=Et(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.container}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 cc){if(l=ac(t.getData()),!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=Et(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 _=l.width-2*o,p=l.height-2*o;if(h){const t=_/n,e=p/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.context;return t?t.canvas:null}getTileImage(t){return t.getImage()}updateUsedTiles(t,e,i){const s=Et(e);s in t||(t[s]={}),t[s][i.getKey()]=!0}},bc={image:["Polygon","Circle","LineString","Image","Text"],hybrid:["Polygon","LineString"],vector:[]},Ec={hybrid:["Image","Text","Default"],vector:["Polygon","Circle","LineString","Image","Text","Default"]},Cc=class extends Mc{constructor(t,e){super(t,e),this.boundHandleStyleImageChange_=this.handleStyleImageChange_.bind(this),this.renderedLayerRevision_,this.renderedPixelToCoordinateTransform_=null,this.renderedRotation_,this.renderedOpacity_=1,this.tmpTransform_=xs(),this.tileClipContexts_=null}enqueueTilesForNextExtent(){return"vector"!==this.getLayer().getRenderMode()}drawTile(t,e,i,s,n,r,o,a,h){this.updateExecutorGroup_(t,e.pixelRatio,e.viewState.projection),this.tileImageNeedsRender_(t)&&this.renderTileImage_(t,e),super.drawTile(t,e,i,s,n,r,o,a,h)}getTile(t,e,i,s){const n=this.getOrCreateTile(t,e,i,s);if(!n)return null;const r=s.viewState,o=r.resolution,a=s.viewHints,h=this.getLayer().getSource(),l=h.getTileGridForProjection(r.projection),c=!(a[0]||a[1]),u=l.getZForResolution(o,h.zDirection)===t;return c&&u?n.wantedResolution=o:n.wantedResolution||(n.wantedResolution=l.getResolution(t)),n}prepareFrame(t){const e=this.getLayer().getRevision();return this.renderedLayerRevision_!==e&&(this.renderedLayerRevision_=e,this.renderedTiles.length=0),super.prepareFrame(t)}updateExecutorGroup_(t,e,i){const s=this.getLayer(),n=s.getRevision(),r=s.getRenderOrder()||null,o=t.wantedResolution,a=t.getReplayState(s);if(!a.dirty&&a.renderedResolution===o&&a.renderedRevision==n&&a.renderedPixelRatio===e&&a.renderedRenderOrder==r)return;const h=s.getSource(),l=!!s.getDeclutter(),c=h.getTileGrid(),u=h.getTileGridForProjection(i).getTileCoordExtent(t.wrappedTileCoord),d=h.getSourceTiles(e,i,t),f=Et(s);delete t.hitDetectionImageData[f],t.executorGroups[f]=[],a.dirty=!1;for(let n=0,g=d.length;n<g;++n){const g=d[n];if(2!=g.getState())continue;const _=h.getProjection(),p=g.tileCoord;let m=c.getTileCoordExtent(p);i&&_&&!Gi(i,_)&&(m=Li(m,_,i,32));const y=ie(u,m),x=kt(y,s.getRenderBuffer()*o,this.tempExtent),v=Xt(m,y)?null:x,w=new Rr(0,y,o,e),S=vo(o,e),M=function(t,e){let i;const n=t.getStyleFunction()||s.getStyleFunction();if(n&&(i=n(t,o)),i){const s=this.renderFeature(t,S,i,w,l,e);a.dirty=a.dirty||s}},b=g.getFeatures();r&&r!==a.renderedRenderOrder&&b.sort(r);for(let t=0,e=b.length;t<e;++t){let e=b[t];i&&g.projection&&!Gi(i,g.projection)&&(e=e.clone(),e.getGeometry().applyTransform(Ai(g.projection,i))),v&&!ae(v,e.getGeometry().getExtent())||M.call(this,e,t)}const E=w.finish(),C="vector"!==s.getRenderMode()&&l&&1===d.length?null:y,P=new to(C,o,e,h.getOverlaps(),E,s.getRenderBuffer(),!0);t.executorGroups[f].push(P)}a.renderedRevision=n,a.renderedPixelRatio=e,a.renderedRenderOrder=r,a.renderedResolution=o}forEachFeatureAtCoordinate(t,e,i,s,n){const r=e.viewState.resolution,o=e.viewState.rotation;i=null==i?0:i;const a=this.getLayer(),h=a.getSource().getTileGridForProjection(e.viewState.projection),l=a.getRenderBuffer(),c=Ot([t]);kt(c,r*(l+i),c);const u={},d=function(t,e,i){let r=t.getId();void 0===r&&(r=Et(t));const o=u[r];if(o){if(!0!==o&&i<o.distanceSq){if(0===i)return u[r]=!0,n.splice(n.lastIndexOf(o),1),s(t,a,e);o.geometry=e,o.distanceSq=i}}else{if(0===i)return u[r]=!0,s(t,a,e);n.push(u[r]={feature:t,layer:a,geometry:e,distanceSq:i,callback:s})}},f=this.renderedTiles,g=Et(a),_=a.getDeclutter(),p=_?e.declutter?.[_]?.all().map(t=>t.value):null;let m;t:for(let e=f.length-1;e>=0;--e){const s=f[e];if(!ae(h.getTileCoordExtent(s.wrappedTileCoord),c))continue;const n=s.executorGroups[g];for(let e=0,s=n.length;e<s;++e)if(m=n[e].forEachFeatureAtCoordinate(t,r,o,i,d,p),m)break t}return m}getFeatures(t){return 0===this.renderedTiles.length?Promise.resolve([]):new Promise((e,i)=>{const s=this.getLayer(),n=s.getSource(),r=this.renderedProjection,o=r.getExtent(),a=this.renderedResolution,h=n.getTileGridForProjection(r),l=Ms(this.renderedPixelToCoordinateTransform_,t.slice()),c=h.getTileCoordForCoordAndResolution(l,a).toString(),u=this.renderedTiles.find(t=>t.tileCoord.toString()===c&&2===t.getState());if(!u||u.loadingSourceTiles>0)return void e([]);n.getWrapX()&&r.canWrapX()&&!Lt(o,h.getTileCoordExtent(u.tileCoord))&&Ie(l,r);const d=Et(s),f=ne(h.getTileCoordExtent(u.wrappedTileCoord)),g=[(l[0]-f[0])/a,(f[1]-l[1])/a],_=u.getSourceTiles().reduce((t,e)=>t.concat(e.getFeatures()),[]);let p=u.hitDetectionImageData[d];if(!p){const t=eo(h.getTileSize(h.getZForResolution(a,n.zDirection))),e=this.renderedRotation_;p=po(t,[this.getRenderTransform(h.getTileCoordCenter(u.wrappedTileCoord),a,0,_o,t[0]*_o,t[1]*_o,0)],_,s.getStyleFunction(),h.getTileCoordExtent(u.wrappedTileCoord),u.getReplayState(s).renderedResolution,e),u.hitDetectionImageData[d]=p}e(mo(g,_,p))})}getFeaturesInExtent(t){const e=[],i=this.getTileCache();if(0===i.getCount())return e;const s=this.getLayer().getSource().getTileGridForProjection(this.frameState.viewState.projection),n=s.getZForResolution(this.renderedResolution),r={};return i.forEach(i=>{if(i.tileCoord[0]!==n||2!==i.getState())return;const o=i.getSourceTiles();for(let i=0,n=o.length;i<n;++i){const n=o[i],a=n.getKey();if(a in r)continue;r[a]=!0;const h=n.tileCoord;if(ae(t,s.getTileCoordExtent(h))){const i=n.getFeatures();if(i)for(let s=0,n=i.length;s<n;++s){const n=i[s],r=n.getGeometry();ae(t,r.getExtent())&&e.push(n)}}}}),e}handleFontsChanged(){const t=this.getLayer();t.getVisible()&&void 0!==this.renderedLayerRevision_&&t.changed()}handleStyleImageChange_(t){this.renderIfReadyAndVisible()}renderDeclutter(t,e){const i=this.context,s=i.globalAlpha;i.globalAlpha=e.opacity;const n=t.viewHints,r=!(n[0]||n[1]),o=[this.context.canvas.width,this.context.canvas.height],a=this.getLayer().getDeclutter(),h=a?t.declutter?.[a]:void 0,l=Et(this.getLayer()),c=this.renderedTiles;for(let e=0,i=c.length;e<i;++e){const i=c[e],s=i.executorGroups[l];if(s)for(let e=s.length-1;e>=0;--e)s[e].execute(this.context,o,this.getTileRenderTransform(i,t),t.viewState.rotation,r,Kr,h)}i.globalAlpha=s}renderDeferredInternal(t){const e=this.renderedTiles,i=Et(this.getLayer()),s=e.reduce((t,e,s)=>(e.executorGroups[i].forEach(e=>t.push({executorGroup:e,index:s})),t),[]),n=s.map(({executorGroup:t})=>t.getDeferredZIndexContexts()),r={};for(let t=0,e=s.length;t<e;++t){const e=s[t].executorGroup.getDeferredZIndexContexts();for(const t in e)r[t]=!0}const o=Object.keys(r).map(Number).sort(ct);this.layerExtent&&this.clipUnrotated(this.context,t,this.layerExtent),o.forEach(t=>{n.forEach((e,i)=>{e[t]&&(e[t].forEach(t=>{const{executorGroup:e,index:n}=s[i],r=e.getRenderedContext(),o=r.globalAlpha;r.globalAlpha=this.renderedOpacity_;const a=this.tileClipContexts_[n];a&&a.draw(r),t.draw(r),a&&r.restore(),r.globalAlpha=o,t.clear()}),e[t].length=0)})}),this.layerExtent&&this.context.restore()}getTileRenderTransform(t,e){const i=e.pixelRatio,s=e.viewState,n=s.center,r=s.resolution,o=s.rotation,a=e.size,h=Math.round(a[0]*i),l=Math.round(a[1]*i),c=this.getLayer().getSource().getTileGridForProjection(e.viewState.projection),u=t.tileCoord,d=c.getTileCoordExtent(t.wrappedTileCoord),f=c.getTileCoordExtent(u,this.tempExtent)[0]-d[0];return ws(bs(this.inversePixelTransform.slice(),1/i,1/i),this.getRenderTransform(n,r,o,i,h,l,f))}clipTileContext_(t,e,i,s,n,r){const o=[];for(let t=0,r=i.length;t<r;++t)n<s[t]&&ae(e,i[t])&&o.push(i[t]);if(0===o.length)return!1;const a=ue(e,o);t.save(),t.beginPath();for(let e=0,i=a.length;e<i;++e){const i=a[e],s=Ms(r,[i[0],i[1]]),n=Ms(r,[i[0],i[3]]),o=Ms(r,[i[2],i[3]]),h=Ms(r,[i[2],i[1]]);t.moveTo(s[0],s[1]),t.lineTo(n[0],n[1]),t.lineTo(o[0],o[1]),t.lineTo(h[0],h[1]),t.closePath()}return t.clip(),!0}postRender(t,e){const i=e.viewHints,s=!(i[0]||i[1]);this.renderedPixelToCoordinateTransform_=e.pixelToCoordinateTransform.slice(),this.renderedRotation_=e.viewState.rotation,this.renderedOpacity_=e.layerStatesArray[e.layerIndex].opacity;const n=this.getLayer(),r=n.getRenderMode(),o=t.globalAlpha;t.globalAlpha=this.renderedOpacity_;const a=n.getDeclutter(),h=a?Ec[r].filter(t=>!Kr.includes(t)):Ec[r],l=e.viewState,c=l.rotation;this.layerExtent&&this.clipUnrotated(t,e,this.layerExtent);const u=n.getSource(),d=u.getTileGridForProjection(l.projection).getZForResolution(l.resolution,u.zDirection),f=this.renderedTiles,g=[],_=[],p=[],m=Et(n);let y=!0;for(let i=f.length-1;i>=0;--i){const r=f[i];y=y&&!r.getReplayState(n).dirty;const o=r.executorGroups[m].filter(t=>t.hasExecutors(h));if(0===o.length)continue;const l=this.getTileRenderTransform(r,e),u=r.tileCoord[0];let x=!1;const v=o[0].getClipCoords(ms);let w,S=t;if(v){const t=[v[0],v[1],v[4],v[5]];w=new Lr,S=w.getContext(),d!==u&&(x=this.clipTileContext_(S,t,g,_,u,l)),g.push(t),_.push(u)}for(let i=0,n=o.length;i<n;++i)o[i].execute(t,[t.canvas.width,t.canvas.height],l,c,s,h,e.declutter?.[a]);x&&(S===t?S.restore():p[i]=w)}this.layerExtent&&t.restore(),t.globalAlpha=o,this.ready=y,this.tileClipContexts_=p,e.declutter||this.renderDeferredInternal(e),super.postRender(t,e)}renderFeature(t,e,i,s,n,r){if(!i)return!1;let o=!1;if(Array.isArray(i))for(let a=0,h=i.length;a<h;++a)o=So(s,t,i[a],e,this.boundHandleStyleImageChange_,void 0,n,r)||o;else o=So(s,t,i,e,this.boundHandleStyleImageChange_,void 0,n,r);return o}tileImageNeedsRender_(t){const e=this.getLayer();if("vector"===e.getRenderMode())return!1;const i=t.getReplayState(e),s=e.getRevision(),n=t.wantedResolution;return i.renderedTileResolution!==n||i.renderedTileRevision!==s}renderTileImage_(t,e){const i=this.getLayer(),s=t.getReplayState(i),n=i.getRevision(),r=t.executorGroups[Et(i)];s.renderedTileRevision=n;const o=t.wrappedTileCoord,a=o[0],h=i.getSource();let l=e.pixelRatio;const c=e.viewState.projection,u=h.getTileGridForProjection(c),d=u.getResolution(t.tileCoord[0]),f=e.pixelRatio/t.wantedResolution*d,g=u.getResolution(a),_=t.getContext();l=Math.round(Math.max(l,f/l));const p=h.getTilePixelSize(a,l,c);_.canvas.width=p[0],_.canvas.height=p[1];const m=l/f;if(1!==m){const t=vs(this.tmpTransform_);bs(t,m,m),_.setTransform.apply(_,t)}const y=u.getTileCoordExtent(o,this.tempExtent),x=f/g,v=vs(this.tmpTransform_);bs(v,x,-x),function(t,e,i){ws(t,Ss(ys,1,0,0,1,e,i))}(v,-y[0],-y[3]);for(let t=0,e=r.length;t<e;++t)r[t].execute(_,[_.canvas.width*m,_.canvas.height*m],v,0,!0,bc[i.getRenderMode()],null);s.renderedTileResolution=t.wantedResolution}},Pc="preload",Ic="useInterimTilesOnError",Rc=class extends Al{constructor(t){t=t||{};const e=Object.assign({},t);delete e.preload;const i=void 0===t.cacheSize?0:t.cacheSize;delete t.cacheSize,delete e.useInterimTilesOnError,super(e),this.on,this.once,this.un,this.cacheSize_=i;const s=t.renderMode||"hybrid";Gt("hybrid"==s||"vector"==s,"`renderMode` must be `'hybrid'` or `'vector'`"),this.renderMode_=s,this.setPreload(t.preload?t.preload:0),this.setUseInterimTilesOnError(void 0===t.useInterimTilesOnError||t.useInterimTilesOnError),this.getBackground,this.setBackground}createRenderer(){return new Cc(this,{cacheSize:this.cacheSize_})}getFeatures(t){return super.getFeatures(t)}getFeaturesInExtent(t){return this.getRenderer().getFeaturesInExtent(t)}getRenderMode(){return this.renderMode_}getPreload(){return this.get(Pc)}getUseInterimTilesOnError(){return this.get(Ic)}setPreload(t){this.set(Pc,t)}setUseInterimTilesOnError(t){this.set(Ic,t)}};class Tc extends Pt{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 Tc,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_&&(at(this.geometryChangeKey_),this.geometryChangeKey_=null);const t=this.getGeometry();t&&(this.geometryChangeKey_=rt(t,ht,this.handleGeometryChange_,this)),this.changed()}setGeometry(t){this.set(this.geometryName_,t)}setStyle(t){this.style_=t,this.styleFunction_=t?function(t){if("function"==typeof t)return t;let e;return Array.isArray(t)?e=t:(Gt("function"==typeof t.getZIndex,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),e=[t]),function(){return e}}(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_())}}const Gc=Tc;class Oc extends lo{constructor(t){super(),this.geometries_=t,this.changeEventsKeys_=[],this.listenGeometriesChange_()}unlistenGeometriesChange_(){this.changeEventsKeys_.forEach(at),this.changeEventsKeys_.length=0}listenGeometriesChange_(){const t=this.geometries_;for(let e=0,i=t.length;e<i;++e)this.changeEventsKeys_.push(rt(t[e],ht,this.changed,this))}clone(){const t=new Oc(kc(this.geometries_));return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<At(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){zt(t);const e=this.geometries_;for(let i=0,s=e.length;i<s;++i)qt(t,e[i].getExtent());return t}getGeometries(){return kc(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)}return s?new Oc(e):(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=Jt(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(kc(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 kc(t){return t.map(t=>t.clone())}const Ac=Oc;class Fc extends fo{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){gt(this.flatCoordinates,t),this.changed()}clone(){const t=new Fc(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<At(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Kh(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),$h(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,t,e,i,s))}forEachSegment(t){return il(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,is(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e))}getCoordinates(){return zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(t,e){return es(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,this.stride)}getLength(){return Tr(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=cs(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,e,0),new Fc(e,"XY")}getType(){return"LineString"}intersectsExtent(t){return sl(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=Qh(this.flatCoordinates,0,t,this.stride),this.changed()}}const Lc=Fc;class jc extends fo{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,n=e.length;t<n;++t)gt(i,e[t].getFlatCoordinates()),s.push(i.length);const n=0===e.length?this.getLayout():e[0].getLayout();this.setFlatCoordinates(n,i),this.ends_=s}}appendLineString(t){gt(this.flatCoordinates,t.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){const t=new jc(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(t,e,i,s){return s<At(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Hh(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Jh(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,function(t,e,i,s,n,r,o){if(o)return is(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 r=0,o=i.length;r<o;++r){const o=i[r];if(e!=o){if(n<t[e+s-1])return null;if(n<=t[o-1])return is(t,e,o,s,n,!1);e=o}}return null}(this.flatCoordinates,0,this.ends_,this.stride,t,e,i))}getCoordinates(){return Wn(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(t){return t<0||this.ends_.length<=t?null:new Lc(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 Lc(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+=Tr(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];gt(t,es(e,i,o,n,.5)),i=o}return t}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=us(this.flatCoordinates,0,this.ends_,this.stride,t,e,0,i),new jc(e,"XY",i)}getType(){return"MultiLineString"}intersectsExtent(t){return function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){if(sl(t,e,i[r],s,n))return!0;e=i[r]}return!1}(this.flatCoordinates,0,this.ends_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,2),this.flatCoordinates||(this.flatCoordinates=[]);const i=tl(this.flatCoordinates,0,t,this.stride,this.ends_);this.flatCoordinates.length=0===i.length?0:i[i.length-1],this.changed()}}const Nc=jc;class Dc extends fo{constructor(t,e){super(),e&&!Array.isArray(t[0])?this.setFlatCoordinates(e,t):this.setCoordinates(t,e)}appendPoint(t){gt(this.flatCoordinates,t.getFlatCoordinates()),this.changed()}clone(){const t=new Dc(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(t,e,i,s){if(s<At(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=ye(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 zn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(t){const e=this.flatCoordinates.length/this.stride;return t<0||e<=t?null:new ll(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 ll(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)if(jt(t,e[s],e[s+1]))return!0;return!1}setCoordinates(t,e){this.setLayout(e,t,1),this.flatCoordinates||(this.flatCoordinates=[]),this.flatCoordinates.length=Qh(this.flatCoordinates,0,t,this.stride),this.changed()}}const zc=Dc;class Wc extends fo{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,e=o.length;t<e;++t)o[t]+=i;gt(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;gt(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 i=0;i<t;++i)e[i]=this.endss_[i].slice();const i=new Wc(this.flatCoordinates.slice(),this.layout,e);return i.applyProperties(this),i}closestPointXY(t,e,i,s){return s<At(this.getExtent(),t,e)?s:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];n=Hh(t,e,o,s,n),e=o[o.length-1]}return n}(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),function(t,e,i,s,n,r,o,a,h,l,c){c=c||[NaN,NaN];for(let r=0,u=i.length;r<u;++r){const u=i[r];l=Jh(t,e,u,s,n,true,o,a,h,l,c),e=u[u.length-1]}return l}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,0,t,e,i,s))}containsXY(t,e){return function(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(Ji(t,e,a,s,n,r))return!0;e=a[a.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t,e)}getArea(){return function(t,e,i,s){let n=0;for(let r=0,o=i.length;r<o;++r){const o=i[r];n+=Zh(t,e,o,s),e=o[o.length-1]}return n}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(t){let e;return void 0!==t?(e=this.getOrientedFlatCoordinates().slice(),hs(e,0,this.endss_,this.stride,t)):e=this.flatCoordinates,Bn(e,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){const t=Ki(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=ts(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new zc(this.getFlatInteriorPoints().slice(),"XYM")}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){const t=this.flatCoordinates;os(t,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=t:(this.orientedFlatCoordinates_=t.slice(),this.orientedFlatCoordinates_.length=hs(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){const e=[],i=[];return e.length=function(t,e,i,s,n,r,o,a){for(let h=0,l=i.length;h<l;++h){const l=i[h],c=[];o=gs(t,e,l,s,n,r,o,c),a.push(c),e=l[l.length-1]}return o}(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),e,0,i),new Wc(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 t=0,s=i.length;t<s;++t)i[t]-=e;return new ul(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 ul(e.slice(n,a),t,o);s.push(h),n=a}return s}getType(){return"MultiPolygon"}intersectsExtent(t){return function(t,e,i,s,n){for(let r=0,o=i.length;r<o;++r){const o=i[r];if(rl(t,e,o,s,n))return!0;e=o[o.length-1]}return!1}(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,t)}setCoordinates(t,e){this.setLayout(e,t,3),this.flatCoordinates||(this.flatCoordinates=[]);const i=el(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()}}const Bc=Wc,Xc=class{constructor(){this.dataProjection=void 0,this.defaultFeatureProjection=void 0,this.featureClass=Gc,this.supportedMediaTypes=null}getReadOptions(t,e){if(e){let i=e.dataProjection?Ei(e.dataProjection):this.readProjection(t);e.extent&&i&&"tile-pixels"===i.getUnits()&&(i=Ei(i),i.setWorldExtent(e.extent)),e={dataProjection:i,featureProjection:e.featureProjection}}return this.adaptOptions(e)}adaptOptions(t){return Object.assign({dataProjection:this.dataProjection,featureProjection:this.defaultFeatureProjection,featureClass:this.featureClass},t)}getType(){return Mt()}readFeature(t,e){return Mt()}readFeatures(t,e){return Mt()}readGeometry(t,e){return Mt()}readProjection(t){return Mt()}writeFeature(t,e){return Mt()}writeFeatures(t,e){return Mt()}writeGeometry(t,e){return Mt()}};function qc(t,e,i){const s=i?Ei(i.featureProjection):null,n=i?Ei(i.dataProjection):null;let r=t;if(s&&n&&!Gi(s,n)){e&&(r=t.clone());const i=e?s:n,o=e?n:s;"tile-pixels"===i.getUnits()?r.transform(i,o):r.applyTransform(Ai(i,o))}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}const Uc={Point:ll,LineString:Lc,Polygon:ul,MultiPoint:zc,MultiLineString:Nc,MultiPolygon:Bc};function Yc(t,e){const i=t.geometry;if(!i)return[];if(Array.isArray(i))return i.map(e=>Yc({...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.length;return qc(new Ts(s,"Polygon"===s?function(t,e,i){return Array.isArray(e[0])?(os(t,0,e,i)||hs(t=t.slice(),0,e,i),t):(rs(t,0,e,i)||as(t=t.slice(),0,e,i),t)}(i.flatCoordinates,i.ends,n):i.flatCoordinates,i.ends?.flat(),n,t.properties||{},t.id).enableSimplifyTransformed(),!1,e)}function Zc(t,e){if(!t)return null;if(Array.isArray(t)){const i=t.map(t=>Zc(t,e));return new Ac(i)}return qc(new(0,Uc[t.type])(t.flatCoordinates,t.layout||"XY",t.ends),!1,e)}function Vc(t){if("string"==typeof t){return JSON.parse(t)||null}return null!==t?t:null}const Kc=class extends Xc{constructor(){super()}getType(){return"json"}readFeature(t,e){return this.readFeatureFromObject(Vc(t),this.getReadOptions(t,e))}readFeatures(t,e){return this.readFeaturesFromObject(Vc(t),this.getReadOptions(t,e))}readFeatureFromObject(t,e){return Mt()}readFeaturesFromObject(t,e){return Mt()}readGeometry(t,e){return this.readGeometryFromObject(Vc(t),this.getReadOptions(t,e))}readGeometryFromObject(t,e){return Mt()}readProjection(t){return this.readProjectionFromObject(Vc(t))}readProjectionFromObject(t){return Mt()}writeFeature(t,e){return JSON.stringify(this.writeFeatureObject(t,e))}writeFeatureObject(t,e){return Mt()}writeFeatures(t,e){return JSON.stringify(this.writeFeaturesObject(t,e))}writeFeaturesObject(t,e){return Mt()}writeGeometry(t,e){return JSON.stringify(this.writeGeometryObject(t,e))}writeGeometryObject(t,e){return Mt()}};function Hc(t,e){if(!t)return null;let i;switch(t.type){case"Point":i=function(t){const e=t.coordinates;return{type:"Point",flatCoordinates:e,layout:co(e.length)}}(t);break;case"LineString":i=function(t){const e=t.coordinates,i=e.flat();return{type:"LineString",flatCoordinates:i,ends:[i.length],layout:co(e[0]?.length||2)}}(t);break;case"Polygon":i=function(t){const e=t.coordinates,i=[],s=e[0]?.[0]?.length;return{type:"Polygon",flatCoordinates:i,ends:tl(i,0,e,s),layout:co(s)}}(t);break;case"MultiPoint":i=function(t){const e=t.coordinates;return{type:"MultiPoint",flatCoordinates:e.flat(),layout:co(e[0]?.length||2)}}(t);break;case"MultiLineString":i=function(t){const e=t.coordinates,i=e[0]?.[0]?.length||2,s=[];return{type:"MultiLineString",flatCoordinates:s,ends:tl(s,0,e,i),layout:co(i)}}(t);break;case"MultiPolygon":i=function(t){const e=t.coordinates,i=[],s=e[0]?.[0]?.[0].length||2;return{type:"MultiPolygon",flatCoordinates:i,ends:el(i,0,e,s),layout:co(s)}}(t);break;case"GeometryCollection":i=function(t){const e=t.geometries.map(function(t){return Hc(t)});return e}(t);break;default:throw new Error("Unsupported GeoJSON type: "+t.type)}return i}function $c(t,e){const i=(t=qc(t,!0,e)).getType();let s;switch(i){case"Point":s=function(t){return{type:"Point",coordinates:t.getCoordinates()}}(t);break;case"LineString":s=function(t){return{type:"LineString",coordinates:t.getCoordinates()}}(t);break;case"Polygon":s=function(t,e){let i;return e&&(i=e.rightHanded),{type:"Polygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"MultiPoint":s=function(t){return{type:"MultiPoint",coordinates:t.getCoordinates()}}(t);break;case"MultiLineString":s=function(t){return{type:"MultiLineString",coordinates:t.getCoordinates()}}(t);break;case"MultiPolygon":s=function(t,e){let i;return e&&(i=e.rightHanded),{type:"MultiPolygon",coordinates:t.getCoordinates(i)}}(t,e);break;case"GeometryCollection":s=function(t,e){delete(e=Object.assign({},e)).featureProjection;return{type:"GeometryCollection",geometries:t.getGeometriesArray().map(function(t){return $c(t,e)})}}(t,e);break;case"Circle":s={type:"GeometryCollection",geometries:[]};break;default:throw new Error("Unsupported geometry type: "+i)}return s}const Jc=4294967296,Qc="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class tu{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,i=this.length){let s;for(;s=this.nextField(i);)t(s,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Jc;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Jc;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf,i=e[this.pos++];if(i<128)return i;let s,n=127&i;return s=e[this.pos++],n|=(127&s)<<7,s<128?n:(s=e[this.pos++],n|=(127&s)<<14,s<128?n:(s=e[this.pos++],n|=(127&s)<<21,s<128?n:(s=e[this.pos],n|=(15&s)<<28,function(t,e,i){const s=i.buf;let n,r;if(r=s[i.pos++],n=(112&r)>>4,r<128)return eu(t,n,e);if(r=s[i.pos++],n|=(127&r)<<3,r<128)return eu(t,n,e);if(r=s[i.pos++],n|=(127&r)<<10,r<128)return eu(t,n,e);if(r=s[i.pos++],n|=(127&r)<<17,r<128)return eu(t,n,e);if(r=s[i.pos++],n|=(127&r)<<24,r<128)return eu(t,n,e);if(r=s[i.pos++],n|=(1&r)<<31,r<128)return eu(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(n,t,this))))}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Qc?Qc.decode(this.buf.subarray(e,t)):function(t,e,i){let s="",n=e;for(;n<i;){const e=t[n];let r,o,a,h=null,l=e>239?4:e>223?3:e>191?2:1;if(n+l>i)break;1===l?e<128&&(h=e):2===l?(r=t[n+1],128==(192&r)&&(h=(31&e)<<6|63&r,h<=127&&(h=null))):3===l?(r=t[n+1],o=t[n+2],128==(192&r)&&128==(192&o)&&(h=(15&e)<<12|(63&r)<<6|63&o,(h<=2047||h>=55296&&h<=57343)&&(h=null))):4===l&&(r=t[n+1],o=t[n+2],a=t[n+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(h=(15&e)<<18|(63&r)<<12|(63&o)<<6|63&a,(h<=65535||h>=1114112)&&(h=null))),null===h?(h=65533,l=1):h>65535&&(h-=65536,s+=String.fromCharCode(h>>>10&1023|55296),h=56320|1023&h),s+=String.fromCharCode(h),n+=l}return s}(this.buf,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const i=this.readPackedEnd();for(;this.pos<i;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;const e=this.readVarint();return this.type=7&e,this._valueStart=this.pos,e>>>3}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}}function eu(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function iu(t,e,i){if(3===t){const t={keys:[],values:[],features:[]},s=i.readVarint()+i.pos;i.readFields(su,t,s),t.length=t.features.length,t.length&&(e[t.name]=t)}}function su(t,e,i){if(15===t)e.version=i.readVarint();else if(1===t)e.name=i.readString();else if(5===t)e.extent=i.readVarint();else if(2===t)e.features.push(i.pos);else if(3===t)e.keys.push(i.readString());else if(4===t){let s=null;const n=i.readVarint()+i.pos;for(;i.pos<n;)s=1==(t=i.readVarint()>>3)?i.readString():2===t?i.readFloat():3===t?i.readDouble():4===t?i.readVarint(!0):5===t?i.readVarint():6===t?i.readSVarint():7===t?i.readBoolean():null;e.values.push(s)}}function nu(t,e,i){if(1==t)e.id=i.readVarint();else if(2==t){const t=i.readVarint()+i.pos;for(;i.pos<t;){const t=e.layer.keys[i.readVarint()],s=e.layer.values[i.readVarint()];e.properties[t]=s}}else 3==t?e.type=i.readVarint():4==t&&(e.geometry=i.pos)}function ru(t,e,i){t.pos=e.features[i];const s=t.readVarint()+t.pos,n={layer:e,type:0,properties:{}};return t.readFields(nu,n,s),n}const ou=class extends Xc{constructor(t){super(),t=t||{},this.dataProjection=new Ge({code:"",units:"tile-pixels"}),this.featureClass=t.featureClass?t.featureClass:Ts,this.geometryName_=t.geometryName,this.layerName_=t.layerName?t.layerName:"layer",this.layers_=t.layers?t.layers:null,this.idProperty_=t.idProperty,this.supportedMediaTypes=["application/vnd.mapbox-vector-tile","application/x-protobuf"]}readRawGeometry_(t,e,i,s){t.pos=e.geometry;const n=t.readVarint()+t.pos;let r=1,o=0,a=0,h=0,l=0,c=0;for(;t.pos<n;){if(!o){const e=t.readVarint();r=7&e,o=e>>3}if(o--,1===r||2===r)a+=t.readSVarint(),h+=t.readSVarint(),1===r&&l>c&&(s.push(l),c=l),i.push(a,h),l+=2;else{if(7!==r)throw new Error("Invalid command found in the PBF");l>c&&(i.push(i[c],i[c+1]),l+=2)}}l>c&&(s.push(l),c=l)}createFeature_(t,e,i){const s=e.type;if(0===s)return null;let n;const r=e.properties;let o;this.idProperty_?(o=r[this.idProperty_],delete r[this.idProperty_]):o=e.id,r[this.layerName_]=e.layer.name;const a=[],h=[];this.readRawGeometry_(t,e,a,h);const l=function(t,e){let i;return 1===t?i=1===e?"Point":"MultiPoint":2===t?i=1===e?"LineString":"MultiLineString":3===t&&(i="Polygon"),i}(s,h.length);if(this.featureClass===Ts)n=new this.featureClass(l,a,h,2,r,o),n.transform(i.dataProjection);else{let t;if("Polygon"==l){const e=ls(a,h);t=e.length>1?new Bc(a,"XY",e):new ul(a,"XY",h)}else t="Point"===l?new ll(a,"XY"):"LineString"===l?new Lc(a,"XY"):"MultiPoint"===l?new zc(a,"XY"):"MultiLineString"===l?new Nc(a,"XY",h):null;n=new(0,this.featureClass),this.geometryName_&&n.setGeometryName(this.geometryName_);const e=qc(t,!1,i);n.setGeometry(e),void 0!==o&&n.setId(o),n.setProperties(r,!0)}return n}getType(){return"arraybuffer"}readFeatures(t,e){const i=this.layers_,s=Ei((e=this.adaptOptions(e)).dataProjection);s.setWorldExtent(e.extent),e.dataProjection=s;const n=new tu(t),r=n.readFields(iu,{}),o=[];for(const t in r){if(i&&!i.includes(t))continue;const a=r[t],h=a?[0,0,a.extent,a.extent]:null;s.setExtent(h);for(let t=0,i=a.length;t<i;++t){const i=ru(n,a,t),s=this.createFeature_(n,i,e);null!==s&&o.push(s)}}return o}readProjection(t){return this.dataProjection}setLayers(t){this.layers_=t}};var au=i(97619),hu=6378137,lu=.0066943799901413165,cu=484813681109536e-20,uu=Math.PI/2,du=1e-10,fu=.017453292519943295,gu=57.29577951308232,_u=Math.PI/4,pu=2*Math.PI,mu=3.14159265359;const yu={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},xu={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}};var vu=/[\s_\-\/\(\)]/g;function wu(t,e){if(t[e])return t[e];for(var i,s=Object.keys(t),n=e.toLowerCase().replace(vu,""),r=-1;++r<s.length;)if((i=s[r]).toLowerCase().replace(vu,"")===n)return t[i]}function Su(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:"projName",datum:"datumCode",rf:function(t){n.rf=parseFloat(t)},lat_0:function(t){n.lat0=t*fu},lat_1:function(t){n.lat1=t*fu},lat_2:function(t){n.lat2=t*fu},lat_ts:function(t){n.lat_ts=t*fu},lon_0:function(t){n.long0=t*fu},lon_1:function(t){n.long1=t*fu},lon_2:function(t){n.long2=t*fu},alpha:function(t){n.alpha=parseFloat(t)*fu},gamma:function(t){n.rectified_grid_angle=parseFloat(t)*fu},lonc:function(t){n.longc=t*fu},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=wu(xu,t);e&&(n.to_meter=e.to_meter)},from_greenwich:function(t){n.from_greenwich=t*fu},pm:function(t){var e=wu(yu,t);n.from_greenwich=(e||parseFloat(t))*fu},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?"function"==typeof(s=o[e])?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}const Mu=class{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]);return{type:e,name:i,conversion_factor:s,id:n?{authority:n[1],code:parseInt(n[2],10)}:null}}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]));return{name:e,direction:i,unit:this.convertUnit(o),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={type: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])})}e.coordinate_system={type:"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 r=t.find(t=>Array.isArray(t)&&"ENSEMBLEACCURACY"===t[0]);r&&(e.accuracy=parseFloat(r[1]));const o=t.find(t=>Array.isArray(t)&&"ELLIPSOID"===t[0]);o&&(e.ellipsoid=this.convert(o)),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 a=t.find(t=>Array.isArray(t)&&"SOURCECRS"===t[0]);if(a){const t=a.find(t=>Array.isArray(t));e.source_crs=t?this.convert(t):null}const h=t.find(t=>Array.isArray(t)&&"TARGETCRS"===t[0]);if(h){const t=h.find(t=>Array.isArray(t));e.target_crs=t?this.convert(t):null}const l=t.find(t=>Array.isArray(t)&&"ABRIDGEDTRANSFORMATION"===t[0]);e.transformation=l?this.convert(l):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 c=this.convertUnit(t,"LinearUnit");e.coordinate_system&&e.coordinate_system.axis&&e.coordinate_system.axis.forEach(t=>{t.unit||(t.unit=c)}),c.conversion_factor&&1!==c.conversion_factor&&e.semi_major_axis&&(e.semi_major_axis={value:e.semi_major_axis,unit:c});break;default:e.keyword=t[0]}return e}},bu=class extends Mu{static convert(t,e={}){return super.convert(t,e),e.coordinate_system&&"Cartesian"===e.coordinate_system.subtype&&delete e.coordinate_system,e.usage&&delete e.usage,e}},Eu=class extends Mu{static convert(t,e={}){super.convert(t,e);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)&&"USAGE"===t[0]);if(s){const t=s.find(t=>Array.isArray(t)&&"SCOPE"===t[0]),i=s.find(t=>Array.isArray(t)&&"AREA"===t[0]),n=s.find(t=>Array.isArray(t)&&"BBOX"===t[0]);e.usage={},t&&(e.usage.scope=t[1]),i&&(e.usage.area=i[1]),n&&(e.usage.bbox=n.slice(1))}return e}};var Cu=/\s/,Pu=/[A-Za-z]/,Iu=/[A-Za-z84_]/,Ru=/[,\]]/,Tu=/[\d\.E\-\+]/;function Gu(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=1}function Ou(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,n=i.reduce(function(t,e){return ku(e,t),t},s);e&&(t[e]=n)}function ku(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 ku(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&&ku(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&ku(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 Ou(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]],Ou(e,i,t),void(e[i].type=i);default:for(s=-1;++s<t.length;)if(!Array.isArray(t[s]))return ku(t,e[i]);return Ou(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}function Au(t){return.017453292519943295*t}function Fu(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=Au(t.lat0>0?90:-90),delete t.lat1):(t.lat0=Au(t.lat1>0?90:-90),t.lat_ts=t.lat1,delete t.lat1)}function Lu(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 ju(t){return"object"==typeof t?t.value*t.unit.conversion_factor:t}function Nu(t,e){t.ellipsoid.radius?(e.a=t.ellipsoid.radius,e.rf=0):(e.a=ju(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-ju(t.ellipsoid.semi_minor_axis))))}function Du(t,e={}){return t&&"object"==typeof t?"BoundCRS"===t.type?(Du(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,Nu(s,e)),s.prime_meridian&&(e.from_greenwich=s.prime_meridian.longitude*Math.PI/180);break;case"ellipsoid":e.ellps=s.name,Nu(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}=Lu(s.unit);e.units=t,e.to_meter=i}else if(s.axis[0]&&s.axis[0].unit){const{units:t,to_meter:i}=Lu(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":Du(s,e),e.datumCode=s.id?s.id.authority+"_"+s.id.code:s.name}}),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),Fu(e),e):t}Gu.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;Cu.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Gu.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Ru.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)},Gu.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(this.currentObject||(this.state=-1))):void 0},Gu.prototype.number=function(t){if(!Tu.test(t)){if(Ru.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},Gu.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Gu.prototype.keyword=function(t){if(Iu.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=1)}if(!Ru.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Gu.prototype.neutral=function(t){if(Pu.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Tu.test(t))return this.word=t,void(this.state=3);if(!Ru.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Gu.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var zu=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];function Wu(t){for(var e=Object.keys(t),i=0,s=e.length;i<s;++i){var n=e[i];-1!==zu.indexOf(n)&&Bu(t[n]),"object"==typeof t[n]&&Wu(t[n])}}function Bu(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){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(o=t),o&&(o.PRIMEM&&o.PRIMEM.convert&&(t.from_greenwich=Au(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=Au(t.rectified_grid_angle)),[["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",Au],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Au],["x0","false_easting",a],["y0","false_northing",a],["long0","central_meridian",Au],["lat0","latitude_of_origin",Au],["lat0","standard_parallel_1",Au],["lat1","standard_parallel_1",Au],["lat2","standard_parallel_2",Au],["azimuth","Azimuth"],["alpha","azimuth",Au],["srsCode","name"]].forEach(function(e){return function(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])))}(t,e)}),Fu(t)}function Xu(t){if("object"==typeof t)return Du(t);const e=function(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")}(t);var i=new Gu(t).output();if("WKT2"===e)return Du(function(t){const e=function(t){return t.find(t=>Array.isArray(t)&&"USAGE"===t[0])?"2019":(t.find(t=>Array.isArray(t)&&"CS"===t[0])||"BOUNDCRS"===t[0]||"PROJCRS"===t[0]||t[0],"2015")}(t);return("2019"===e?Eu:bu).convert(t)}(i));var s=i[0],n={};return ku(i,n),Wu(n),n[s]}function qu(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?qu[t]=Su(arguments[1]):qu[t]=Xu(arguments[1]):i&&"object"==typeof i&&!("projName"in i)?qu[t]=Xu(arguments[1]):(qu[t]=i,i||delete qu[t])}else if(1===arguments.length){if(Array.isArray(t))return t.map(function(t){return Array.isArray(t)?qu.apply(e,t):qu(t)});if("string"==typeof t){if(t in qu)return qu[t]}else"EPSG"in t?qu["EPSG:"+t.EPSG]=t:"ESRI"in t?qu["ESRI:"+t.ESRI]=t:"IAU2000"in t?qu["IAU2000:"+t.IAU2000]=t:console.log(t);return}}!function(t){t("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),t("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),t("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");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"]}(qu);const Uu=qu;var Yu=["3857","900913","3785","102113"];function Zu(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)void 0!==(i=e[s])&&(t[s]=i);return t}function Vu(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function Ku(t){return t<0?-1:1}function Hu(t,e){return e||Math.abs(t)<=mu?t:t-Ku(t)*pu}function $u(t,e,i){var s=t*i,n=.5*t;return s=Math.pow((1-s)/(1+s),n),Math.tan(.5*(uu-e))/s}function Ju(t,e){for(var i,s,n=.5*t,r=uu-2*Math.atan(e),o=0;o<=15;o++)if(i=t*Math.sin(r),r+=s=uu-2*Math.atan(e*Math.pow((1-i)/(1+i),n))-r,Math.abs(s)<=1e-10)return r;return-9999}function Qu(t){return t}var td=["longlat","identity"],ed=[{init:function(){var t=this.b/this.a;this.es=1-t*t,"x0"in this||(this.x0=0),"y0"in this||(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Vu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):this.k0||(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,s=t.x,n=t.y;if(n*gu>90&&n*gu<-90&&s*gu>180&&s*gu<-180)return null;if(Math.abs(Math.abs(n)-uu)<=du)return null;if(this.sphere)e=this.x0+this.a*this.k0*Hu(s-this.long0,this.over),i=this.y0+this.a*this.k0*Math.log(Math.tan(_u+.5*n));else{var r=Math.sin(n),o=$u(this.e,n,r);e=this.x0+this.a*this.k0*Hu(s-this.long0,this.over),i=this.y0-this.a*this.k0*Math.log(o)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s=t.x-this.x0,n=t.y-this.y0;if(this.sphere)i=uu-2*Math.atan(Math.exp(-n/(this.a*this.k0)));else{var r=Math.exp(-n/(this.a*this.k0));if(-9999===(i=Ju(this.e,r)))return null}return e=Hu(this.long0+s/(this.a*this.k0),this.over),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A","merc"]},{init:function(){},forward:Qu,inverse:Qu,names:td}],id={},sd=[];function nd(t,e){var i=sd.length;return t.names?(sd[i]=t,t.names.forEach(function(t){id[t.toLowerCase()]=i}),this):(console.log(e),!0)}function rd(t){return t.replace(/[-\(\)\s]+/g," ").trim().replace(/ /g,"_")}const od={start:function(){ed.forEach(nd)},add:nd,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==id[e]&&sd[id[e]]||(e=rd(e))in id&&sd[id[e]]?sd[id[e]]:void 0}},ad={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},hd=ad.WGS84;var ld={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:"clark80",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 cd in ld){var ud=ld[cd];ud.datumName&&(ld[ud.datumName]=ud)}const dd=ld;var fd={};async function gd(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=[r.getWidth(),r.getHeight()],h=r.getBoundingBox().map(pd),l=[r.fileDirectory.ModelPixelScale[0],r.fileDirectory.ModelPixelScale[1]].map(pd),c=h[0]+(a[0]-1)*l[0],u=h[3]-(a[1]-1)*l[1],d=o[0],f=o[1],g=[];for(let t=a[1]-1;t>=0;t--)for(let e=a[0]-1;e>=0;e--){var _=t*a[0]+e;g.push([-md(f[_]),md(d[_])])}i.push({del:l,lim:a,ll:[-c,u],cvs:g})}var p={header:{nSubgrids:s},subgrids:i};return fd[t]=p,p}function _d(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:fd[t]||null,isNull:!1}}function pd(t){return t*Math.PI/180}function md(t){return t/3600*Math.PI/180}function yd(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function xd(t){return t.map(function(t){return[md(t.longitudeShift),md(t.latitudeShift)]})}function vd(t,e,i){return{name:yd(t,e+8,e+16).trim(),parent:yd(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 wd(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 Sd(t,e){if(!(this instanceof Sd))return new Sd(t);this.forward=null,this.inverse=null,this.init=null,this.name,this.names=null,this.title,e=e||function(t){if(t)throw t};var i=function(t){let e;if(function(t){return"string"==typeof t}(t))if(function(t){return t in Uu}(t))e=Uu[t];else if(function(t){return 0!==t.indexOf("+")&&-1!==t.indexOf("[")||"object"==typeof t&&!("srsCode"in t)}(t)){e=Xu(t);var i=function(t){var e=wu(t,"extension");if(e)return wu(e,"proj4")}(e);i&&(e=Su(i))}else(function(t){return"+"===t[0]})(t)&&(e=Su(t));else e="projName"in t?t:Xu(t);return e&&function(t){if(t.title)return 0===t.title.toLowerCase().indexOf("epsg:")&&Yu.indexOf(t.title.substr(5))>-1;var e=wu(t,"authority");if(e){var i=wu(e,"epsg");return i&&Yu.indexOf(i)>-1}}(e)?Uu["EPSG:3857"]:e}(t);if("object"==typeof i){var s=Sd.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var n=wu(dd,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.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var r=function(t,e,i,s,n){if(!t){var r=wu(ad,s);r||(r=hd),t=r.a,e=r.b,i=r.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<du)&&(n=!0,e=t),{a:t,b:e,rf:i,sphere:n}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,s){var n=t*t,r=e*e,o=(n-r)/n,a=0;return s?(n=(t*=1-o*(.16666666666666666+o*(.04722222222222222+.022156084656084655*o)))*t,o=0):a=Math.sqrt(o),{es:o,e:a,ep2:(n-r)/r}}(r.a,r.b,r.rf,i.R_A),a=function(t){return void 0===t?null:t.split(",").map(_d)}(i.nadgrids),h=i.datum||function(t,e,i,s,n,r,o){var a={};return a.datum_type=void 0===t||"none"===t?5:4,e&&(a.datum_params=e.map(parseFloat),0===a.datum_params[0]&&0===a.datum_params[1]&&0===a.datum_params[2]||(a.datum_type=1),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=2,a.datum_params[3]*=cu,a.datum_params[4]*=cu,a.datum_params[5]*=cu,a.datum_params[6]=a.datum_params[6]/1e6+1))),o&&(a.datum_type=3,a.grids=o),a.a=i,a.b=s,a.es=n,a.ep2=r,a}(i.datumCode,i.datum_params,r.a,r.b,o.es,o.ep2,a);Zu(this,i),Zu(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(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}Sd.projections=od,Sd.projections.start();const Md=Sd;function bd(t,e,i){var s,n,r,o,a=t.x,h=t.y,l=t.z?t.z:0;if(h<-uu&&h>-1.001*uu)h=-uu;else if(h>uu&&h<1.001*uu)h=uu;else{if(h<-uu)return{x:-1/0,y:-1/0,z:t.z};if(h>uu)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,{x:((s=i/Math.sqrt(1-e*r))+l)*o*Math.cos(a),y:(s+l)*o*Math.sin(a),z:(s*(1-e)+l)*n}}function Ed(t,e,i,s){var n,r,o,a,h,l,c,u,d,f,g,_,p,m,y,x=t.x,v=t.y,w=t.z?t.z:0;if(n=Math.sqrt(x*x+v*v),r=Math.sqrt(x*x+v*v+w*w),n/i<1e-12){if(m=0,r/i<1e-12)return y=-s,{x:t.x,y:t.y,z:t.z}}else m=Math.atan2(v,x);o=w/r,u=(a=n/r)*(1-e)*(h=1/Math.sqrt(1-e*(2-e)*a*a)),d=o*h,p=0;do{p++,l=e*(c=i/Math.sqrt(1-e*d*d))/(c+(y=n*u+w*d-c*(1-e*d*d))),_=(g=o*(h=1/Math.sqrt(1-l*(2-l)*a*a)))*u-(f=a*(1-l)*h)*d,u=f,d=g}while(_*_>1e-24&&p<30);return{x:m,y:Math.atan(g/Math.abs(f)),z:y}}function Cd(t){return 1===t||2===t}function Pd(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,_=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,p=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(g>s.y||f>s.x||p<s.y||_<s.x||(n=Id(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*gu+" "+s.y*gu+" tried: '"+r+"'"),-1):(i.x=-n.x,i.y=n.y,0)}function Id(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=Hu(n.x-Math.PI)+Math.PI;var r=Rd(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;do{if(a=Rd(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)>1e-12&&Math.abs(o.y)>1e-12);if(h<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=Hu(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 Rd(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},n=Math.floor(s.x),r=Math.floor(s.y),o=s.x-1*n,a=s.y-1*r,h={x:Number.NaN,y:Number.NaN};if(n<0||n>=e.lim[0])return h;if(r<0||r>=e.lim[1])return h;i=r*e.lim[0]+n;var l=e.cvs[i][0],c=e.cvs[i][1];i++;var u=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var f=e.cvs[i][0],g=e.cvs[i][1];i--;var _=e.cvs[i][0],p=e.cvs[i][1],m=o*a,y=o*(1-a),x=(1-o)*(1-a),v=(1-o)*a;return h.x=x*l+y*u+v*_+m*f,h.y=x*c+y*d+v*p+m*g,h}function Td(t,e,i){var s,n,r,o=i.x,a=i.y,h=i.z||0,l={};for(r=0;r<3;r++)if(!e||2!==r||void 0!==i.z)switch(0===r?(s=o,n=-1!=="ew".indexOf(t.axis[r])?"x":"y"):1===r?(s=a,n=-1!=="ns".indexOf(t.axis[r])?"y":"x"):(s=h,n="z"),t.axis[r]){case"e":case"n":l[n]=s;break;case"w":case"s":l[n]=-s;break;case"u":void 0!==i[n]&&(l.z=s);break;case"d":void 0!==i[n]&&(l.z=-s);break;default:return null}return l}function Gd(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 Od(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 kd(t,e,i,s){var n,r=void 0!==(i=Array.isArray(i)?Gd(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(function(t){Od(t.x),Od(t.y)}(i),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=kd(t,n=new Md("WGS84"),i,s),t=n),s&&"enu"!==t.axis&&(i=Td(t,!1,i)),"longlat"===t.projName)i={x:i.x*fu,y:i.y*fu,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=function(t,e,i){if(function(t,e){return t.datum_type===e.datum_type&&!(t.a!==e.a||Math.abs(t.es-e.es)>5e-11)&&(1===t.datum_type?t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]:2!==t.datum_type||t.datum_params[0]===e.datum_params[0]&&t.datum_params[1]===e.datum_params[1]&&t.datum_params[2]===e.datum_params[2]&&t.datum_params[3]===e.datum_params[3]&&t.datum_params[4]===e.datum_params[4]&&t.datum_params[5]===e.datum_params[5]&&t.datum_params[6]===e.datum_params[6])}(t,e))return i;if(5===t.datum_type||5===e.datum_type)return i;var s=t.a,n=t.es;if(3===t.datum_type){if(0!==Pd(t,!1,i))return;s=hu,n=lu}var r=e.a,o=e.b,a=e.es;return 3===e.datum_type&&(r=hu,o=6356752.314,a=lu),n!==a||s!==r||Cd(t.datum_type)||Cd(e.datum_type)?(i=bd(i,n,s),Cd(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){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}}}(i,t.datum_type,t.datum_params)),Cd(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){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}}}(i,e.datum_type,e.datum_params)),i=Ed(i,a,r,o),3!==e.datum_type||0===Pd(e,!0,i)?i:void 0):i}(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*gu,y:i.y*gu,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?Td(e,!0,i):(i&&!r&&"geocent"!==e.projName&&delete i.z,i)}var Ad=Md("WGS84");function Fd(t,e,i,s){var n,r,o;return Array.isArray(i)?(n=kd(t,e,i,s)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof n.z?[n.x,n.y,n.z].concat(i.slice(3)):[n.x,n.y,i[2]].concat(i.slice(3)):[n.x,n.y].concat(i.slice(2)):[n.x,n.y]):(r=kd(t,e,i,s),2===(o=Object.keys(i)).length||o.forEach(function(s){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===s||"y"===s||"z"===s)return}else if("x"===s||"y"===s)return;r[s]=i[s]}),r)}function Ld(t){return t instanceof Md?t:"object"==typeof t&&"oProj"in t?t.oProj:Md(t)}var jd="AJSAJS",Nd="AFAFAF",Dd=65,zd=73,Wd=79;const Bd={forward:Xd,inverse:function(t){var e=Zd(Kd(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:qd};function Xd(t,e){return e=e||5,function(t,e){var i,s,n,r,o,a,h,l,c,u,d,f="00000"+t.easting,g="00000"+t.northing;return t.zoneNumber+t.zoneLetter+(c=t.easting,u=t.northing,d=Vd(t.zoneNumber),i=Math.floor(c/1e5),s=Math.floor(u/1e5)%20,r=jd.charCodeAt(n=d-1),o=Nd.charCodeAt(n),l=!1,(a=r+i-1)>90&&(a=a-90+Dd-1,l=!0),(a===zd||r<zd&&a>zd||(a>zd||r<zd)&&l)&&a++,(a===Wd||r<Wd&&a>Wd||(a>Wd||r<Wd)&&l)&&++a===zd&&a++,a>90&&(a=a-90+Dd-1),(h=o+s)>86?(h=h-86+Dd-1,l=!0):l=!1,(h===zd||o<zd&&h>zd||(h>zd||o<zd)&&l)&&h++,(h===Wd||o<Wd&&h>Wd||(h>Wd||o<Wd)&&l)&&++h===zd&&h++,h>86&&(h=h-86+Dd-1),String.fromCharCode(a)+String.fromCharCode(h))+f.substr(f.length-5,e)+g.substr(g.length-5,e)}(function(t){var e,i,s,n,r,o,a,h=t.lat,l=t.lon,c=6378137,u=.00669438,d=.9996,f=Ud(h),g=Ud(l);a=Math.floor((l+180)/6)+1,180===l&&(a=60),h>=56&&h<64&&l>=3&&l<12&&(a=32),h>=72&&h<84&&(l>=0&&l<9?a=31:l>=9&&l<21?a=33:l>=21&&l<33?a=35:l>=33&&l<42&&(a=37)),o=Ud(6*(a-1)-180+3),e=.006739496752268451,i=c/Math.sqrt(1-u*Math.sin(f)*Math.sin(f)),s=Math.tan(f)*Math.tan(f),n=e*Math.cos(f)*Math.cos(f);var _,p,m=d*i*((r=Math.cos(f)*(g-o))+(1-s+n)*r*r*r/6+(5-18*s+s*s+72*n-58*e)*r*r*r*r*r/120)+5e5,y=d*(c*(.9983242984503243*f-.002514607064228144*Math.sin(2*f)+2639046602129982e-21*Math.sin(4*f)-3.418046101696858e-9*Math.sin(6*f))+i*Math.tan(f)*(r*r/2+(5-s+9*n+4*n*n)*r*r*r*r/24+(61-58*s+s*s+600*n-2.2240339282485886)*r*r*r*r*r*r/720));return h<0&&(y+=1e7),{northing:Math.round(y),easting:Math.round(m),zoneNumber:a,zoneLetter:(_=h,p="Z",84>=_&&_>=72?p="X":72>_&&_>=64?p="W":64>_&&_>=56?p="V":56>_&&_>=48?p="U":48>_&&_>=40?p="T":40>_&&_>=32?p="S":32>_&&_>=24?p="R":24>_&&_>=16?p="Q":16>_&&_>=8?p="P":8>_&&_>=0?p="N":0>_&&_>=-8?p="M":-8>_&&_>=-16?p="L":-16>_&&_>=-24?p="K":-24>_&&_>=-32?p="J":-32>_&&_>=-40?p="H":-40>_&&_>=-48?p="G":-48>_&&_>=-56?p="F":-56>_&&_>=-64?p="E":-64>_&&_>=-72?p="D":-72>_&&_>=-80&&(p="C"),p)}}({lat:t[1],lon:t[0]}),e)}function qd(t){var e=Zd(Kd(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Ud(t){return t*(Math.PI/180)}function Yd(t){return t/Math.PI*180}function Zd(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=.9996,_=6378137,p=.00669438,m=(1-Math.sqrt(.99330562))/(1+Math.sqrt(.99330562)),y=i-5e5,x=e;s<"N"&&(x-=1e7),u=6*(n-1)-180+3,r=.006739496752268451,f=(d=x/g/6367449.145945056)+(3*m/2-27*m*m*m/32)*Math.sin(2*d)+(21*m*m/16-55*m*m*m*m/32)*Math.sin(4*d)+151*m*m*m/96*Math.sin(6*d),o=_/Math.sqrt(1-p*Math.sin(f)*Math.sin(f)),a=Math.tan(f)*Math.tan(f),h=r*Math.cos(f)*Math.cos(f),l=.99330562*_/Math.pow(1-p*Math.sin(f)*Math.sin(f),1.5),c=y/(o*g);var v=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-1.6983531815716497-3*h*h)*c*c*c*c*c*c/720);v=Yd(v);var w,S=(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(S=u+Yd(S),t.accuracy){var M=Zd({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});w={top:M.lat,right:M.lon,bottom:v,left:S}}else w={lat:v,lon:S};return w}function Vd(t){var e=t%6;return 0===e&&(e=6),e}function Kd(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,s=null,n="",r=0;!/[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);for(var h=Vd(o),l=function(t,e){for(var i=jd.charCodeAt(e-1),s=1e5,n=!1;i!==t.charCodeAt(0);){if(++i===zd&&i++,i===Wd&&i++,i>90){if(n)throw"Bad character: "+t;i=Dd,n=!0}s+=1e5}return s}(s.charAt(0),h),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;for(var i=Nd.charCodeAt(e-1),s=0,n=!1;i!==t.charCodeAt(0);){if(++i===zd&&i++,i===Wd&&i++,i>86){if(n)throw"Bad character: "+t;i=Dd,n=!0}s+=1e5}return s}(s.charAt(1),h);c<Hd(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,_=u/2,p=0,m=0;return _>0&&(d=1e5/Math.pow(10,_),f=t.substring(r,r+_),p=parseFloat(f)*d,g=t.substring(r+_),m=parseFloat(g)*d),{easting:p+l,northing:m+c,zoneLetter:a,zoneNumber:o,accuracy:d}}function Hd(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 $d(t,e,i){if(!(this instanceof $d))return new $d(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var 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")}$d.fromMGRS=function(t){return new $d(qd(t))},$d.prototype.toMGRS=function(t){return Xd([this.x,this.y],t)};const Jd=$d;var Qd=.046875,tf=.01953125,ef=.01068115234375;function sf(t){var e=[];e[0]=1-t*(.25+t*(Qd+t*(tf+t*ef))),e[1]=t*(.75-t*(Qd+t*(tf+t*ef)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function nf(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}function rf(t,e,i){for(var s=1/(1-e),n=t,r=20;r;--r){var o=Math.sin(n),a=1-e*o*o;if(n-=a=(nf(n,o,Math.cos(n),i)-t)*(a*Math.sqrt(a))*s,Math.abs(a)<du)return n}return n}const of={init:function(){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=sf(this.es),this.ml0=nf(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,s,n=t.x,r=t.y,o=Hu(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)>du?Math.tan(r):0,g=Math.pow(f,2),_=Math.pow(g,2);e=1-this.es*Math.pow(a,2),l/=Math.sqrt(e);var p=nf(r,a,h,this.en);i=this.a*(this.k0*l*(1+c/6*(1-g+u+c/20*(5-18*g+_+14*u-58*g*u+c/42*(61+179*_-_*g-479*g)))))+this.x0,s=this.a*(this.k0*(p-this.ml0+a*o*l/2*(1+c/12*(5-g+9*u+4*d+c/30*(61+_-58*g+270*u-330*g*u+c/56*(1385+543*_-_*g-3111*g))))))+this.y0}else{var m=h*Math.sin(o);if(Math.abs(Math.abs(m)-1)<du)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))>=1){if(m-1>du)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},inverse:function(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(i=rf(e=this.ml0+o/this.k0,this.es,this.en),Math.abs(i)<uu){var a=Math.sin(i),h=Math.cos(i),l=Math.abs(h)>du?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,_=Math.pow(g,2);s=i-(e*=l)*_/(1-this.es)*.5*(1-_/12*(5+3*d-9*c*d+c-4*u-_/30*(61+90*d-252*c*d+45*f+46*c-_/56*(1385+3633*d+4095*f+1574*f*d)))),n=Hu(this.long0+g*(1-_/6*(1+2*d+c-_/20*(5+28*d+24*f+8*c*d+6*c-_/42*(61+662*d+1320*f+720*f*d))))/h,this.over)}else s=uu*Ku(o),n=0;else{var p=Math.exp(r/this.k0),m=.5*(p-1/p),y=this.lat0+o/this.k0,x=Math.cos(y);e=Math.sqrt((1-Math.pow(x,2))/(1+Math.pow(m,2))),s=Math.asin(e),o<0&&(s=-s),n=0===m&&0===x?0:Hu(Math.atan2(m,x)+this.long0,this.over)}return t.x=n,t.y=s,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function af(t){var e=Math.exp(t);return(e-1/e)/2}function hf(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 lf(t,e){for(var i,s=2*Math.cos(2*e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return e+i*Math.sin(2*e)}function cf(t,e,i){for(var s,n,r=Math.sin(e),o=Math.cos(e),a=af(i),h=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),l=2*o*h,c=-2*r*a,u=t.length-1,d=t[u],f=0,g=0,_=0;--u>=0;)s=g,n=f,d=l*(g=d)-s-c*(f=_)+t[u],_=c*g-n+l*f;return[(l=r*h)*d-(c=o*a)*_,l*_+c*d]}const uf={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(of.init.apply(this),this.forward=of.forward,this.inverse=of.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=lf(this.cbg,this.lat0);this.Zb=-this.Qn*(s+function(t,e){for(var i,s=2*Math.cos(e),n=t.length-1,r=t[n],o=0;--n>=0;)i=s*r-o+t[n],o=r,r=i;return Math.sin(e)*i}(this.gtu,2*s))},forward:function(t){var e=Hu(t.x-this.long0,this.over),i=t.y;i=lf(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,hf(s,n*o)),e=function(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(hf(1,e)+1))),t<0?-e:e}(Math.tan(e));var a,h,l=cf(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},inverse:function(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=cf(this.utg,2*n,2*s);n+=r[0],s+=r[1],s=Math.atan(af(s));var o=Math.sin(n),a=Math.cos(n),h=Math.sin(s),l=Math.cos(s);n=Math.atan2(o*l,hf(h,l*a)),e=Hu((s=Math.atan2(h,l*a))+this.long0,this.over),i=lf(this.cgb,n)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]},df={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(Hu(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*fu,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,uf.init.apply(this),this.forward=uf.forward,this.inverse=uf.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function ff(t,e){return Math.pow((1-t)/(1+t),e)}const gf={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+_u)/(Math.pow(Math.tan(.5*this.lat0+_u),this.C)*ff(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+_u),this.C)*ff(this.e*Math.sin(i),this.ratexp))-uu,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+_u)/this.K,1/this.C),n=20;n>0&&(i=2*Math.atan(s*ff(this.e*Math.sin(t.y),-.5*this.e))-uu,!(Math.abs(i-t.y)<1e-14));--n)t.y=i;return n?(t.x=e,t.y=i,t):null},names:["gauss"]},_f={init:function(){gf.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,this.title||(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,s,n;return t.x=Hu(t.x-this.long0,this.over),gf.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},inverse:function(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=hf(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,gf.inverse.apply(this,[t]),t.x=Hu(t.x+this.long0,this.over),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};function pf(t,e,i){return e*=i,Math.tan(.5*(uu+t))*Math.pow((1-e)/(1+e),.5*i)}const mf={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=du&&(this.k0=.5*(1+Ku(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=du&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=du&&Math.abs(Math.cos(this.lat_ts))>du&&(this.k0=.5*this.cons*Vu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/$u(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Vu(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(pf(this.lat0,this.sinlat0,this.e))-uu,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,s,n,r,o,a=t.x,h=t.y,l=Math.sin(h),c=Math.cos(h),u=Hu(a-this.long0,this.over);return Math.abs(Math.abs(a-this.long0)-Math.PI)<=du&&Math.abs(h+this.lat0)<=du?(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(pf(h,l,this.e))-uu,n=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=du?(r=$u(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)<du?(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))},inverse:function(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<=du?(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)<du?this.lat0>0?Hu(this.long0+Math.atan2(t.x,-1*t.y),this.over):Hu(this.long0+Math.atan2(t.x,t.y),this.over):Hu(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)<=du){if(o<=du)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*Ju(this.e,s),e=this.con*Hu(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<=du?r=this.X0:(r=Math.asin(Math.cos(n)*this.sinX0+t.y*Math.sin(n)*this.cosX0/o),e=Hu(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*Ju(this.e,Math.tan(.5*(uu+r)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],ssfn_:pf},yf={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=1/this.rf,n=2*s-Math.pow(s,2),r=this.e=Math.sqrt(n);this.R=this.k0*i*Math.sqrt(1-n)/(1-n*Math.pow(e,2)),this.alpha=Math.sqrt(1+n/(1-n)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var o=Math.log(Math.tan(Math.PI/4+this.b0/2)),a=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+r*e)/(1-r*e));this.K=o-this.alpha*a+this.alpha*r/2*h},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),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},inverse:function(t){for(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;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},names:["somerc"]};var xf=1e-7;const vf={init:function(){var t,e,i,s,n,r,o,a,h,l,c,u,d,f,g=0,_=0,p=0,m=0,y=0,x=0,v=0;this.no_off=(d=["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"],f="object"==typeof(u=this).projName?Object.keys(u.projName)[0]:u.projName,"no_uoff"in u||"no_off"in u||-1!==d.indexOf(f)||-1!==d.indexOf(rd(f))),this.no_rot="no_rot"in this;var w=!1;"alpha"in this&&(w=!0);var S=!1;if("rectified_grid_angle"in this&&(S=!0),w&&(v=this.alpha),S&&(g=this.rectified_grid_angle),w||S)_=this.longc;else if(p=this.long1,y=this.lat1,m=this.long2,x=this.lat2,Math.abs(y-x)<=xf||(t=Math.abs(y))<=xf||Math.abs(t-uu)<=xf||Math.abs(Math.abs(this.lat0)-uu)<=xf||Math.abs(Math.abs(x)-uu)<=xf)throw new Error;var M=1-this.es;e=Math.sqrt(M),Math.abs(this.lat0)>du?(a=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*a*a,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/M),this.A=this.B*this.k0*e/t,(n=(s=this.B*e/(i*Math.sqrt(t)))*s-1)<=0?n=0:(n=Math.sqrt(n),this.lat0<0&&(n=-n)),this.E=n+=s,this.E*=Math.pow($u(this.e,this.lat0,a),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=n=1),w||S?(w?(c=Math.asin(Math.sin(v)/s),S||(g=v)):(c=g,v=Math.asin(s*Math.sin(c))),this.lam0=_-Math.asin(.5*(n-1/n)*Math.tan(c))/this.B):(r=Math.pow($u(this.e,y,Math.sin(y)),this.B),o=Math.pow($u(this.e,x,Math.sin(x)),this.B),n=this.E/r,h=(o-r)/(o+r),l=((l=this.E*this.E)-o*r)/(l+o*r),(t=p-m)<-Math.PI?m-=pu:t>Math.PI&&(m+=pu),this.lam0=Hu(.5*(p+m)-Math.atan(l*Math.tan(.5*this.B*(p-m))/h)/this.B,this.over),c=Math.atan(2*Math.sin(this.B*Hu(p-this.lam0,this.over))/(n-1/n)),g=v=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(g),this.cosrot=Math.cos(g),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(v))),this.lat0<0&&(this.u_0=-this.u_0)),n=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(_u-n)),this.v_pole_s=this.ArB*Math.log(Math.tan(_u+n))},forward:function(t){var e,i,s,n,r,o,a,h,l={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-uu)>du){if(e=.5*((r=this.E/Math.pow($u(this.e,t.y,Math.sin(t.y)),this.B))-(o=1/r)),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)<du)throw new Error;h=.5*this.ArB*Math.log((1-s)/(1+s)),o=Math.cos(this.B*t.x),a=Math.abs(o)<xf?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,l},inverse:function(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),n=.5*((s=Math.exp(-this.BrA*i))-1/s),r=.5*(s+1/s),a=((o=Math.sin(this.BrA*e))*this.cosgam+n*this.singam)/r,Math.abs(Math.abs(a)-1)<du)h.x=0,h.y=a<0?-uu:uu;else{if(h.y=this.E/Math.sqrt((1+a)/(1-a)),h.y=Ju(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,h},names:["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"]},wf={init:function(){if(this.lat2||(this.lat2=this.lat1),this.k0||(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<du)){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=Vu(this.e,e,i),n=$u(this.e,this.lat1,e),r=Math.sin(this.lat2),o=Math.cos(this.lat2),a=Vu(this.e,r,o),h=$u(this.e,this.lat2,r),l=Math.abs(Math.abs(this.lat0)-uu)<du?0:$u(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>du?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=this.a*this.f0*Math.pow(l,this.ns),this.title||(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=du&&(i=Ku(i)*(uu-2e-10));var s,n,r=Math.abs(Math.abs(i)-uu);if(r>du)s=$u(this.e,i,Math.sin(i)),n=this.a*this.f0*Math.pow(s,this.ns);else{if((r=i*this.ns)<=0)return null;n=0}var o=this.ns*Hu(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},inverse:function(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),-9999===(n=Ju(this.e,s)))return null}else n=-uu;return r=Hu(h/this.ns+this.long0,this.over),t.x=r,t.y=n,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]},Sf={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),this.lat0||(this.lat0=.863937979737193),this.long0||(this.long0=.4334234309119251),this.k0||(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y,c=Hu(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},inverse:function(t){var e,i,s,n,r,o,a,h=t.x;t.x=t.y,t.y=h,this.czech||(t.y*=-1,t.x*=-1),r=Math.sqrt(t.x*t.x+t.y*t.y),n=Math.atan2(t.y,t.x)/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/r,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,o=e,a=0;var l=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(o))/(1-this.e*Math.sin(o)),this.e/2))-this.s45),Math.abs(o-t.y)<1e-10&&(a=1),o=t.y,l+=1}while(0===a&&l<15);return l>=15?null:t},names:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)","krovak"]};function Mf(t,e,i,s,n){return t*n-e*Math.sin(2*n)+i*Math.sin(4*n)-s*Math.sin(6*n)}function bf(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function Ef(t){return.375*t*(1+.25*t*(1+.46875*t))}function Cf(t){return.05859375*t*t*(1+.75*t)}function Pf(t){return t*t*t*(35/3072)}function If(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function Rf(t){return Math.abs(t)<uu?t:t-Ku(t)*Math.PI}function Tf(t,e,i,s,n){var r,o;r=t/e;for(var a=0;a<15;a++)if(r+=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)),Math.abs(o)<=1e-10)return r;return NaN}const Gf={init:function(){this.sphere||(this.e0=bf(this.es),this.e1=Ef(this.es),this.e2=Cf(this.es),this.e3=Pf(this.es),this.ml0=this.a*Mf(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,s=t.x,n=t.y;if(s=Hu(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=If(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);e=a*l*(1-c*h*(1/6-(8-h+8*u)*c/120)),i=this.a*Mf(this.e0,this.e1,this.e2,this.e3,n)-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},inverse:function(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=Tf(this.ml0/this.a+n,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(o)-uu)<=du)return t.x=this.long0,t.y=uu,n<0&&(t.y*=-1),t;var a=If(this.a,this.e,Math.sin(o)),h=a*a*a/this.a/this.a*(1-this.es),l=Math.pow(Math.tan(o),2),c=s*this.a/a,u=c*c;e=o-a*Math.tan(o)/h*c*c*(.5-(1+3*l)*c*c/24),i=c*(1-u*(l/3+(1+3*l)*l*u/15))/Math.cos(o)}return t.x=Hu(i+this.long0,this.over),t.y=Rf(e),t},names:["Cassini","Cassini_Soldner","cass"]};function Of(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}const kf={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-uu)<du?this.mode=this.lat0<0?1:2:Math.abs(e)<du?this.mode=3:this.mode=4,this.es>0)switch(this.qp=Of(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=.3333333333333333*t,e=t*t,i[0]+=.17222222222222222*e,i[1]=.06388888888888888*e,e*=t,i[0]+=.10257936507936508*e,i[1]+=.0664021164021164*e,i[2]=.016415012942191543*e,i}(this.es),this.mode){case 2:case 1:this.dd=1;break;case 3:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case 4:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=Of(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else 4===this.mode&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u=t.x,d=t.y;if(u=Hu(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)<=du)return null;e=(i=Math.sqrt(2/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)<du)return null;i=_u-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(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=Of(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=uu+d,o=this.qp-o;break;case this.S_POLE:l=d-uu,o=this.qp+o}if(Math.abs(l)<du)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}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,n,r,o,a,h,l,c,u=t.x/this.a,d=t.y/this.a;if(this.sphere){var f,g=0,_=0;if((i=.5*(f=Math.sqrt(u*u+d*d)))>1)return null;switch(i=2*Math.asin(i),this.mode!==this.OBLIQ&&this.mode!==this.EQUIT||(_=Math.sin(i),g=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(f)<=du?0:Math.asin(d*_/f),u*=_,d=g*f;break;case this.OBLIQ:i=Math.abs(f)<=du?this.lat0:Math.asin(g*this.sinph0+d*_*this.cosph0/f),u*=_*this.cosph0,d=(g-Math.sin(i)*this.sinph0)*f;break;case this.N_POLE:d=-d,i=uu-i;break;case this.S_POLE:i-=uu}e=0!==d||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(u,d):0}else{if(a=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(u/=this.dd,d*=this.dd,(o=Math.sqrt(u*u+d*d))<du)return t.x=this.long0,t.y=this.lat0,t;n=2*Math.asin(.5*o/this.rq),s=Math.cos(n),u*=n=Math.sin(n),this.mode===this.OBLIQ?(a=s*this.sinb1+d*n*this.cosb1/o,r=this.qp*a,d=o*this.cosb1*s-d*this.sinb1*n):(a=d*n/o,r=this.qp*a,d=o*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(d=-d),!(r=u*u+d*d))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(u,d),c=(h=Math.asin(a))+h,i=h+(l=this.apa)[0]*Math.sin(c)+l[1]*Math.sin(c+c)+l[2]*Math.sin(c+c+c)}return t.x=Hu(this.long0+e,this.over),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Af(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Ff={init:function(){Math.abs(this.lat1+this.lat2)<du||(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=Vu(this.e3,this.sin_po,this.cos_po),this.qs1=Of(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=Vu(this.e3,this.sin_po,this.cos_po),this.qs2=Of(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=Of(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>du?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=Of(this.e3,this.sin_phi),n=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,r=this.ns0*Hu(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},inverse:function(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=Hu(n/this.ns0+this.long0,this.over),t.x=r,t.y=o,t},names:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,s,n,r,o=Af(.5*e);if(t<du)return o;for(var a=t*t,h=1;h<=25;h++)if(o+=r=.5*(n=1-(s=t*(i=Math.sin(o)))*s)*n/Math.cos(o)*(e/(1-a)-i/n+.5/t*Math.log((1-s)/(1+s))),Math.abs(r)<=1e-7)return o;return null}},Lf={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=Hu(h-this.long0,this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),(r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=du?(o=this.x0+1*this.a*i*Math.sin(s)/r,a=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)/r):(o=this.x0+this.infinity_dist*i*Math.sin(s),a=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(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),o=Af((s=Math.cos(n))*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=Hu(this.long0+r,this.over)):(o=this.phic0,r=0),t.x=r,t.y=o,t},names:["gnom"]},jf={init:function(){this.sphere||(this.k0=Vu(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,s=t.x,n=t.y,r=Hu(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=Of(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},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=Hu(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=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*uu:uu;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,a+=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))),Math.abs(s)<=1e-10)return a;return NaN}(this.e,2*t.y*this.k0/this.a),e=Hu(this.long0+t.x/(this.a*this.k0),this.over)),t.x=e,t.y=i,t},names:["cea"]},Nf={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,s=Hu(e-this.long0,this.over),n=Rf(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*n,t},inverse:function(t){var e=t.x,i=t.y;return t.x=Hu(this.long0+(e-this.x0)/(this.a*this.rc),this.over),t.y=Rf(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical","eqc"]},Df={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=bf(this.es),this.e1=Ef(this.es),this.e2=Cf(this.es),this.e3=Pf(this.es),this.ml0=this.a*Mf(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,s,n=t.x,r=t.y,o=Hu(n-this.long0,this.over);if(s=o*Math.sin(r),this.sphere)Math.abs(r)<=du?(e=this.a*o,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(r),i=this.a*(Rf(r-this.lat0)+(1-Math.cos(s))/Math.tan(r)));else if(Math.abs(r)<=du)e=this.a*o,i=-1*this.ml0;else{var a=If(this.a,this.e,Math.sin(r))/Math.tan(r);e=a*Math.sin(s),i=this.a*Mf(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},inverse:function(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)<=du)e=Hu(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=20;r;--r)if(h+=l=-1*(o*(h*(c=Math.tan(h))+1)-h-.5*(h*h+a)*c)/((h-o)/c-1),Math.abs(l)<=du){i=h;break}e=Hu(this.long0+Math.asin(s*Math.tan(h)/this.a)/Math.sin(i),this.over)}else if(Math.abs(n+this.ml0)<=du)i=0,e=Hu(this.long0+s/this.a,this.over);else{var u,d,f,g,_;for(o=(this.ml0+n)/this.a,a=s*s/this.a/this.a+o*o,h=o,r=20;r;--r)if(_=this.e*Math.sin(h),u=Math.sqrt(1-_*_)*Math.tan(h),d=this.a*Mf(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),h-=l=(o*(u*(g=d/this.a)+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),Math.abs(l)<=du){i=h;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=Hu(this.long0+Math.asin(s*u/this.a)/Math.sin(i),this.over)}return t.x=e,t.y=i,t},names:["Polyconic","American_Polyconic","poly"]},zf={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,s=t.y-this.lat0,n=i-this.long0,r=s/cu*1e-5,o=n,a=1,h=0;for(e=1;e<=10;e++)a*=r,h+=this.A[e]*a;var l,c=h,u=o,d=1,f=0,g=0,_=0;for(e=1;e<=6;e++)l=f*c+d*u,d=d*c-f*u,f=l,g=g+this.B_re[e]*d-this.B_im[e]*f,_=_+this.B_im[e]*d+this.B_re[e]*f;return t.x=_*this.a+this.x0,t.y=g*this.a+this.y0,t},inverse:function(t){var e,i,s=t.x,n=t.y,r=s-this.x0,o=(n-this.y0)/this.a,a=r/this.a,h=1,l=0,c=0,u=0;for(e=1;e<=6;e++)i=l*o+h*a,h=h*o-l*a,l=i,c=c+this.C_re[e]*h-this.C_im[e]*l,u=u+this.C_im[e]*h+this.C_re[e]*l;for(var d=0;d<this.iterations;d++){var f,g=c,_=u,p=o,m=a;for(e=2;e<=6;e++)f=_*c+g*u,g=g*c-_*u,_=f,p+=(e-1)*(this.B_re[e]*g-this.B_im[e]*_),m+=(e-1)*(this.B_im[e]*g+this.B_re[e]*_);g=1,_=0;var y=this.B_re[1],x=this.B_im[1];for(e=2;e<=6;e++)f=_*c+g*u,g=g*c-_*u,_=f,y+=e*(this.B_re[e]*g-this.B_im[e]*_),x+=e*(this.B_im[e]*g+this.B_re[e]*_);var v=y*y+x*x;c=(p*y+m*x)/v,u=(m*y-p*x)/v}var w=c,S=u,M=1,b=0;for(e=1;e<=9;e++)M*=w,b+=this.D[e]*M;var E=this.lat0+b*cu*1e5,C=this.long0+S;return t.x=C,t.y=E,t},names:["New_Zealand_Map_Grid","nzmg"]},Wf={init:function(){},forward:function(t){var e=t.x,i=t.y,s=Hu(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},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=Hu(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},names:["Miller_Cylindrical","mill"]},Bf={init:function(){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=sf(this.es)},forward:function(t){var e,i,s=t.x,n=t.y;if(s=Hu(s-this.long0,this.over),this.sphere){if(this.m)for(var r=this.n*Math.sin(n),o=20;o;--o){var a=(this.m*n+Math.sin(n)-r)/(this.m+Math.cos(n));if(n-=a,Math.abs(a)<du)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*nf(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},inverse:function(t){var e,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Af((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Af(Math.sin(e)/this.n)),i=Hu(i+this.long0,this.over),e=Rf(e)):(e=rf(t.y/this.a,this.es,this.en),(s=Math.abs(e))<uu?(s=Math.sin(e),i=Hu(this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)),this.over)):s-du<uu&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]},Xf={init:function(){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},forward:function(t){for(var e=t.x,i=t.y,s=Hu(e-this.long0,this.over),n=i,r=Math.PI*Math.sin(i);;){var o=-(n+Math.sin(n)-r)/(1+Math.cos(n));if(n+=o,Math.abs(o)<du)break}n/=2,Math.PI/2-Math.abs(i)<du&&(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},inverse:function(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=Hu(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},names:["Mollweide","moll"]},qf={init:function(){Math.abs(this.lat1+this.lat2)<du||(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=bf(this.es),this.e1=Ef(this.es),this.e2=Cf(this.es),this.e3=Pf(this.es),this.sin_phi=Math.sin(this.lat1),this.cos_phi=Math.cos(this.lat1),this.ms1=Vu(this.e,this.sin_phi,this.cos_phi),this.ml1=Mf(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<du?this.ns=this.sin_phi:(this.sin_phi=Math.sin(this.lat2),this.cos_phi=Math.cos(this.lat2),this.ms2=Vu(this.e,this.sin_phi,this.cos_phi),this.ml2=Mf(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=Mf(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var n=Mf(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-n)}var r=this.ns*Hu(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},inverse:function(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;return 0!==i&&(r=Math.atan2(e*t.x,e*t.y)),this.sphere?(n=Hu(this.long0+r/this.ns,this.over),s=Rf(this.g-i/this.a),t.x=n,t.y=s,t):(s=Tf(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),n=Hu(this.long0+r/this.ns,this.over),t.x=n,t.y=s,t)},names:["Equidistant_Conic","eqdc"]},Uf={init:function(){this.R=this.a},forward:function(t){var e,i,s=t.x,n=t.y,r=Hu(s-this.long0,this.over);Math.abs(n)<=du&&(e=this.x0+this.R*r,i=this.y0);var o=Af(2*Math.abs(n/Math.PI));(Math.abs(r)<=du||Math.abs(Math.abs(n)-uu)<=du)&&(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));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,_=Math.PI*this.R*(a*(u-g)+Math.sqrt(h*(u-g)*(u-g)-(g+h)*(d-g)))/(g+h);r<0&&(_=-_),e=this.x0+_;var p=h+u;return _=Math.PI*this.R*(f*p-a*Math.sqrt((g+h)*(h+1)-p*p))/(g+h),i=n>=0?this.y0+_:this.y0-_,t.x=e,t.y=i,t},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,r=(s=t.x/u)*s+(n=t.y/u)*n,u=3*(n*n/(h=-2*(o=-Math.abs(n)*(1+r))+1+2*n*n+r*r)+(2*(a=o-2*n*n+s*s)*a*a/h/h/h-9*o*a/h/h)/27)/(l=(o-a*a/3/h)/h)/(c=2*Math.sqrt(-l/3)),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)<du?this.long0:Hu(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},names:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten","vandg"]},Yf={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0),this.f=this.es/(1+Math.sqrt(1-this.es))},forward:function(t){var e,i,s,n,r,o,a,h,l,c,u,d=t.x,f=t.y,g=Math.sin(t.y),_=Math.cos(t.y),p=Hu(d-this.long0,this.over);return this.sphere?Math.abs(this.sin_p12-1)<=du?(t.x=this.x0+this.a*(uu-f)*Math.sin(p),t.y=this.y0-this.a*(uu-f)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=du?(t.x=this.x0+this.a*(uu+f)*Math.sin(p),t.y=this.y0+this.a*(uu+f)*Math.cos(p),t):(l=this.sin_p12*g+this.cos_p12*_*Math.cos(p),h=(a=Math.acos(l))?a/Math.sin(a):1,t.x=this.x0+this.a*h*_*Math.sin(p),t.y=this.y0+this.a*h*(this.cos_p12*g-this.sin_p12*_*Math.cos(p)),t):(e=bf(this.es),i=Ef(this.es),s=Cf(this.es),n=Pf(this.es),Math.abs(this.sin_p12-1)<=du?(r=this.a*Mf(e,i,s,n,uu),o=this.a*Mf(e,i,s,n,f),t.x=this.x0+(r-o)*Math.sin(p),t.y=this.y0-(r-o)*Math.cos(p),t):Math.abs(this.sin_p12+1)<=du?(r=this.a*Mf(e,i,s,n,uu),o=this.a*Mf(e,i,s,n,f),t.x=this.x0+(r+o)*Math.sin(p),t.y=this.y0+(r+o)*Math.cos(p),t):Math.abs(d)<du&&Math.abs(f-this.lat0)<du?(t.x=t.y=0,t):(c=function(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,x,v,w,S,M,b,E,C,P,I=o,R=100;do{if(g=Math.sin(I),_=Math.cos(I),p=Math.sqrt(d*g*(d*g)+(c*u-l*d*_)*(c*u-l*d*_)),0===p)return{azi1:0,s12:0};m=l*u+c*d*_,y=Math.atan2(p,m),x=c*d*g/p,v=1-x*x,w=0!==v?m-2*l*u/v:0,S=r/16*v*(4+r*(4-3*v)),f=I,I=o+(1-S)*r*x*(y+S*p*(w+S*m*(2*w*w-1)))}while(Math.abs(I-f)>1e-12&&--R>0);return 0===R?{azi1:NaN,s12:NaN}:(M=v*(n*n-n*(1-r)*(n*(1-r)))/(n*(1-r)*(n*(1-r))),b=1+M/16384*(4096+M*(M*(320-175*M)-768)),E=M/1024*(256+M*(M*(74-47*M)-128)),C=E*p*(w+E/4*(m*(2*w*w-1)-E/6*w*(4*p*p-3)*(4*w*w-3))),P=n*(1-r)*b*(y-C),{azi1:Math.atan2(d*g,c*u-l*d*_),s12:P})}(this.lat0,this.long0,f,d,this.a,this.f),u=c.azi1,t.x=c.s12*Math.sin(u),t.y=c.s12*Math.cos(u),t))},inverse:function(t){var e,i,s,n,r,o,a,h,l,c,u,d,f,g,_;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*uu*this.a)return;return i=e/this.a,s=Math.sin(i),n=Math.cos(i),r=this.long0,Math.abs(e)<=du?o=this.lat0:(o=Af(n*this.sin_p12+t.y*s*this.cos_p12/e),a=Math.abs(this.lat0)-uu,r=Math.abs(a)<=du?this.lat0>=0?Hu(this.long0+Math.atan2(t.x,-t.y),this.over):Hu(this.long0-Math.atan2(-t.x,t.y),this.over):Hu(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=bf(this.es),l=Ef(this.es),c=Cf(this.es),u=Pf(this.es),Math.abs(this.sin_p12-1)<=du?(o=Tf(((d=this.a*Mf(h,l,c,u,uu))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,h,l,c,u),r=Hu(this.long0+Math.atan2(t.x,-1*t.y),this.over),t.x=r,t.y=o,t):Math.abs(this.sin_p12+1)<=du?(d=this.a*Mf(h,l,c,u,uu),o=Tf(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,h,l,c,u),r=Hu(this.long0+Math.atan2(t.x,t.y),this.over),t.x=r,t.y=o,t):(f=Math.atan2(t.x,t.y),g=Math.sqrt(t.x*t.x+t.y*t.y),_=function(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))),_=1+g/16384*(4096+g*(g*(320-175*g)-768)),p=g/1024*(256+g*(g*(74-47*g)-128));let m,y,x,v,w,S=s/(n*(1-r)*_),M=100;do{y=Math.cos(2*u+S),x=Math.sin(S),v=Math.cos(S),w=p*x*(y+p/4*(v*(2*y*y-1)-p/6*y*(4*x*x-3)*(4*y*y-3))),m=S,S=s/(n*(1-r)*_)+w}while(Math.abs(S-m)>1e-12&&--M>0);if(0===M)return{lat2:NaN,lon2:NaN};const b=a*x-h*v*c,E=r/16*f*(4+r*(4-3*f));return{lat2:Math.atan2(a*v+h*x*c,(1-r)*Math.sqrt(d*d+b*b)),lon2:e+(Math.atan2(x*l,h*v-a*x*c)-(1-E)*r*d*(S+E*x*(y+E*v*(2*y*y-1))))}}(this.lat0,this.long0,f,g,this.a,this.f),t.x=_.lon2,t.y=_.lat2,t)},names:["Azimuthal_Equidistant","aeqd"]},Zf={init:function(){this.sin_p14=Math.sin(this.lat0||0),this.cos_p14=Math.cos(this.lat0||0)},forward:function(t){var e,i,s,n,r,o,a,h=t.x,l=t.y;return s=Hu(h-(this.long0||0),this.over),e=Math.sin(l),i=Math.cos(l),n=Math.cos(s),((r=this.sin_p14*e+this.cos_p14*i*n)>0||Math.abs(r)<=du)&&(o=1*this.a*i*Math.sin(s),a=(this.y0||0)+1*this.a*(this.cos_p14*e-this.sin_p14*i*n)),t.x=o,t.y=a,t},inverse:function(t){var e,i,s,n,r,o,a,h,l;return t.x-=this.x0||0,t.y-=this.y0||0,i=Af((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),s=Math.sin(i),n=Math.cos(i),h=this.long0||0,l=this.lat0||0,o=h,Math.abs(e)<=du?(a=l,t.x=o,t.y=a,t):(a=Af(n*this.sin_p14+t.y*s*this.cos_p14/e),r=Math.abs(l)-uu,Math.abs(r)<=du?(o=Hu(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=Hu(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))},names:["ortho"]};function Vf(t,e,i,s){var n;return t<du?(s.value=1,n=0):(n=Math.atan2(e,i),Math.abs(n)<=_u?s.value=1:n>_u&&n<=uu+_u?(s.value=2,n-=uu):n>uu+_u||n<=-(uu+_u)?(s.value=3,n=n>=0?n-mu:n+mu):(s.value=4,n+=uu)),n}function Kf(t,e){var i=t+e;return i<-mu?i+=pu:i>+mu&&(i-=pu),i}const Hf={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=uu-_u/2?this.face=5:this.lat0<=-(uu-_u/2)?this.face=6:Math.abs(this.long0)<=_u?this.face=1:Math.abs(this.long0)<=uu+_u?this.face=this.long0>0?2:4:this.face=3,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,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,5===this.face)n=uu-e,i>=_u&&i<=uu+_u?(h.value=1,s=i-uu):i>uu+_u||i<=-(uu+_u)?(h.value=2,s=i>0?i-mu:i+mu):i>-(uu+_u)&&i<=-_u?(h.value=3,s=i+uu):(h.value=4,s=i);else if(6===this.face)n=uu+e,i>=_u&&i<=uu+_u?(h.value=1,s=-i+uu):i<_u&&i>=-_u?(h.value=2,s=-i):i<-_u&&i>=-(uu+_u)?(h.value=3,s=-i-uu):(h.value=4,s=i>0?-i+mu:-i-mu);else{var l,c,u,d,f,g;2===this.face?i=Kf(i,+uu):3===this.face?i=Kf(i,+mu):4===this.face&&(i=Kf(i,-uu)),d=Math.sin(e),f=Math.cos(e),g=Math.sin(i),l=f*Math.cos(i),c=f*g,u=d,1===this.face?s=Vf(n=Math.acos(l),u,c,h):2===this.face?s=Vf(n=Math.acos(c),u,-l,h):3===this.face?s=Vf(n=Math.acos(-l),u,-c,h):4===this.face?s=Vf(n=Math.acos(-c),u,l,h):(n=s=0,h.value=1)}return o=Math.atan(12/mu*(s+Math.acos(Math.sin(s)*Math.cos(_u))-uu)),r=Math.sqrt((1-Math.cos(n))/(Math.cos(o)*Math.cos(o))/(1-Math.cos(Math.atan(1/Math.cos(s))))),2===h.value?o+=uu:3===h.value?o+=mu:4===h.value&&(o+=1.5*mu),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},inverse:function(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=1:t.y>=0&&t.y>=Math.abs(t.x)?(g.value=2,e-=uu):t.x<0&&-t.x>=Math.abs(t.y)?(g.value=3,e=e<0?e+mu:e-mu):(g.value=4,e+=uu),l=mu/12*Math.tan(e),r=Math.sin(l)/(Math.cos(l)-1/Math.sqrt(2)),o=Math.atan(r),(a=1-(s=Math.cos(e))*s*(n=Math.tan(i))*n*(1-Math.cos(Math.atan(1/Math.cos(o)))))<-1?a=-1:a>1&&(a=1),5===this.face)h=Math.acos(a),f.phi=uu-h,1===g.value?f.lam=o+uu:2===g.value?f.lam=o<0?o+mu:o-mu:3===g.value?f.lam=o-uu:f.lam=o;else if(6===this.face)h=Math.acos(a),f.phi=h-uu,1===g.value?f.lam=-o+uu:2===g.value?f.lam=-o:3===g.value?f.lam=-o-uu:f.lam=o<0?-o-mu:-o+mu;else{var _,p,m;l=(_=a)*_,p=(l+=(m=l>=1?0:Math.sqrt(1-l)*Math.sin(o))*m)>=1?0:Math.sqrt(1-l),2===g.value?(l=p,p=-m,m=l):3===g.value?(p=-p,m=-m):4===g.value&&(l=p,p=m,m=-l),2===this.face?(l=_,_=-p,p=l):3===this.face?(_=-_,p=-p):4===this.face&&(l=_,_=p,p=-l),f.phi=Math.acos(-m)-uu,f.lam=Math.atan2(p,_),2===this.face?f.lam=Kf(f.lam,-uu):3===this.face?f.lam=Kf(f.lam,-mu):4===this.face&&(f.lam=Kf(f.lam,+uu))}return 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)),f.lam+=this.long0,t.x=f.lam,t.y=f.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var $f=[[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]],Jf=[[-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]],Qf=.8487,tg=1.3523,eg=gu/5,ig=1/eg,sg=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const ng={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=Hu(t.x-this.long0,this.over),i=Math.abs(t.y),s=Math.floor(i*eg);s<0?s=0:s>=18&&(s=17);var n={x:sg($f[s],i=gu*(i-ig*s))*e,y:sg(Jf[s],i)};return t.y<0&&(n.y=-n.y),n.x=n.x*this.a*Qf+this.x0,n.y=n.y*this.a*tg+this.y0,n},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*Qf),y:Math.abs(t.y-this.y0)/(this.a*tg)};if(e.y>=1)e.x/=$f[18][0],e.y=t.y<0?-uu:uu;else{var i=Math.floor(18*e.y);for(i<0?i=0:i>=18&&(i=17);;)if(Jf[i][0]>e.y)--i;else{if(!(Jf[i+1][0]<=e.y))break;++i}var s=Jf[i],n=5*(e.y-s[0])/(Jf[i+1][0]-s[0]);n=function(t,e,i,s){for(var n=e;s;--s){var r=t(n);if(n-=r,Math.abs(r)<1e-10)break}return n}(function(t){return(sg(s,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(s,t)},n,0,100),e.x/=sg($f[i],n),e.y=(5*i+n)*fu,t.y<0&&(e.y=-e.y)}return e.x=Hu(e.x+this.long0,this.over),e},names:["Robinson","robin"]},rg={init:function(){this.name="geocent"},forward:function(t){return bd(t,this.es,this.a)},inverse:function(t){return Ed(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var og={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}};const ag={init:function(){if(Object.keys(og).forEach(function(t){if(void 0===this[t])this[t]=og[t].def;else{if(og[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);og[t].num&&(this[t]=parseFloat(this[t]))}og[t].degrees&&(this[t]=this[t]*fu)}.bind(this)),Math.abs(Math.abs(this.lat0)-uu)<du?this.mode=this.lat0<0?1:0:Math.abs(this.lat0)<du?this.mode=2:(this.mode=3,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)},forward:function(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 3:i=this.sinph0*r+this.cosph0*o*a;break;case 2:i=o*a;break;case 1:i=-r;break;case 0:i=r}switch(e=(i=this.pn1/(this.p-i))*o*Math.sin(t.x),this.mode){case 3:i*=this.cosph0*r-this.sinph0*o*a;break;case 2:i*=r;break;case 0:i*=-o*a;break;case 1:i*=o*a}return n=1/((s=i*this.cg+e*this.sg)*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},inverse:function(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=hf(t.x,t.y);if(Math.abs(r)<du)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 3: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 2:n.y=Math.asin(t.y*a/r),t.y=o*r,t.x*=a;break;case 0:n.y=Math.asin(o),t.y=-t.y;break;case 1:n.y=-Math.asin(o)}n.x=Math.atan2(t.x,t.y)}return t.x=n.x+this.long0,t.y=n.y,t},names:["Tilted_Perspective","tpers"]},hg={init:function(){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")},forward:function(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/hf(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/hf(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/hf(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/hf(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/hf(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(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)*hf(1,a)):(o=Math.tan(t.x/this.radius_g_1),a=Math.tan(t.y/this.radius_g_1)*hf(1,o));var h=a/this.radius_p;if(e=o*o+h*h+r*r,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<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,(s=(i=2*this.radius_g*r)*i-4*e*this.C)<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},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var lg=1.340264,cg=-.081106,ug=893e-6,dg=.003796,fg=Math.sqrt(3)/2;const gg={init:function(){this.es=0,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},forward:function(t){var e=Hu(t.x-this.long0,this.over),i=t.y,s=Math.asin(fg*Math.sin(i)),n=s*s,r=n*n*n;return t.x=e*Math.cos(s)/(fg*(lg+3*cg*n+r*(7*ug+9*dg*n))),t.y=s*(lg+cg*n+r*(ug+dg*n)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,s,n,r=t.y;for(n=0;n<12&&(r-=s=(r*(lg+cg*(e=r*r)+(i=e*e*e)*(ug+dg*e))-t.y)/(lg+3*cg*e+i*(7*ug+9*dg*e)),!(Math.abs(s)<1e-9));++n);return i=(e=r*r)*e*e,t.x=fg*t.x*(lg+3*cg*e+i*(7*ug+9*dg*e))/Math.cos(r),t.y=Math.asin(Math.sin(r)/fg),t.x=Hu(t.x+this.long0,this.over),t},names:["eqearth","Equal Earth","Equal_Earth"]};var _g=1e-10;function pg(t){var e,i,s,n=Hu(t.x-(this.long0||0),this.over),r=t.y;return e=this.am1+this.m1-nf(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 mg(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=hf(t.x,t.y=this.am1-t.y),n=rf(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(n))<uu)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-uu)<=_g))throw new Error;s=0}return t.x=Hu(s+(this.long0||0),this.over),t.y=Rf(n),t}function yg(t){var e,i,s=Hu(t.x-(this.long0||0),this.over),n=t.y;return i=this.cphi1+this.phi1-n,Math.abs(i)>_g?(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 xg(t){var e,i;t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var s=hf(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>uu)throw new Error;return e=Math.abs(Math.abs(i)-uu)<=_g?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=Hu(e+(this.long0||0),this.over),t.y=Rf(i),t}const vg={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<_g)throw new Error;this.es?(this.en=sf(this.es),this.m1=nf(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=mg,this.forward=pg):(Math.abs(this.phi1)+_g>=uu?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=xg,this.forward=yg)},names:["bonne","Bonne (Werner lat_1=90)"]},wg={OBLIQUE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(i),r=Math.sin(s),o=Math.cos(s);e.x=Hu(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*=gu,a.y*=gu),a},inverse:function(t,e){t.isIdentity&&(e.x*=fu,e.y*=fu);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=Hu(e.x+t.long0),e}},TRANSVERSE:{forward:function(t,e){let{x:i,y:s}=e;i+=t.long0;const n=Math.cos(s),r=Math.cos(i);e.x=Hu(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*=gu,o.y*=gu),o},inverse:function(t,e){t.isIdentity&&(e.x*=fu,e.y*=fu);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=Hu(e.x+t.long0),e}}},Sg={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"}},Mg={init:function(){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=td.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=Md(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(Sg),n=t=>{if(void 0===this[t])return;const e=parseFloat(this[t])*fu;if(isNaN(e))throw new Error("Invalid value for "+t+": "+this[t]);return e};for(let t=0;t<s.length;t++){const e=s[t],r=Sg[e],o=Object.entries(r);if(o.some(([t])=>void 0!==this[t])){i=r;for(let t=0;t<o.length;t++){const[e,i]=o[t],s=n(e);if(void 0===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}=function(t,e){let i,s;if(e===Sg.ROTATE){let e=t.oLongC,n=t.oLatC,r=t.oAlpha;if(Math.abs(Math.abs(n)-uu)<=du)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===Sg.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)>uu-du)throw new Error("Invalid value for o_lat_1: "+t.o_lat_1+" should be < 90°");if(Math.abs(o)>uu-du)throw new Error("Invalid value for o_lat_2: "+t.o_lat_2+" should be < 90°");if(Math.abs(n-o)<du)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<du)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}}(this,i);this.lamp=r,Math.abs(o)>du?(this.cphip=Math.cos(o),this.sphip=Math.sin(o),this.projectionType=wg.OBLIQUE):this.projectionType=wg.TRANSVERSE},forward:function(t){return this.projectionType.forward(this,t)},inverse:function(t){return this.projectionType.inverse(this,t)},names:["General Oblique Transformation","General_Oblique_Transformation","ob_tran"]},bg=Object.assign(function(t,e,i){var s,n,r,o=!1;return void 0===e?(n=Ld(t),s=Ad,o=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,n=Ld(t),s=Ad,o=!0),s||(s=Ld(t)),n||(n=Ld(e)),i?Fd(s,n,i):(r={forward:function(t,e){return Fd(s,n,t,e)},inverse:function(t,e){return Fd(n,s,t,e)}},o&&(r.oProj=n),r)},{defaultDatum:"WGS84",Proj:Md,WGS84:new Md("WGS84"),Point:Jd,toPoint:Gd,defs:Uu,nadgrid:function(t,e,i){return e instanceof ArrayBuffer?function(t,e,i){var s=!0;void 0!==i&&!1===i.includeErrorFields&&(s=!1);var n=new DataView(e),r=function(t){var e=t.getInt32(8,!1);return 11!==e&&(11!==(e=t.getInt32(8,!0))&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(n),o=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:yd(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(n,r),a=function(t,e,i,s){for(var n=176,r=[],o=0;o<e.nSubgrids;o++){var a=vd(t,n,i),h=wd(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:[md(a.lowerLongitude),md(a.lowerLatitude)],del:[md(a.longitudeInterval),md(a.latitudeInterval)],lim:[l,c],count:a.gridNodeCount,cvs:xd(h)});var u=16;!1===s&&(u=8),n+=176+a.gridNodeCount*u}return r}(n,o,r,s),h={header:o,subgrids:a};return fd[t]=h,h}(t,e,i):{ready:gd(t,e)}},transform:kd,mgrs:Bd,version:"__VERSION__"});var Eg;(Eg=bg).Proj.projections.add(of),Eg.Proj.projections.add(uf),Eg.Proj.projections.add(df),Eg.Proj.projections.add(_f),Eg.Proj.projections.add(mf),Eg.Proj.projections.add(yf),Eg.Proj.projections.add(vf),Eg.Proj.projections.add(wf),Eg.Proj.projections.add(Sf),Eg.Proj.projections.add(Gf),Eg.Proj.projections.add(kf),Eg.Proj.projections.add(Ff),Eg.Proj.projections.add(Lf),Eg.Proj.projections.add(jf),Eg.Proj.projections.add(Nf),Eg.Proj.projections.add(Df),Eg.Proj.projections.add(zf),Eg.Proj.projections.add(Wf),Eg.Proj.projections.add(Bf),Eg.Proj.projections.add(Xf),Eg.Proj.projections.add(qf),Eg.Proj.projections.add(Uf),Eg.Proj.projections.add(Yf),Eg.Proj.projections.add(Zf),Eg.Proj.projections.add(Hf),Eg.Proj.projections.add(ng),Eg.Proj.projections.add(rg),Eg.Proj.projections.add(ag),Eg.Proj.projections.add(hg),Eg.Proj.projections.add(gg),Eg.Proj.projections.add(vg),Eg.Proj.projections.add(Mg);const Cg=bg;let Pg=null;var Ig="EPSG:27700";function Rg(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var h=s&&s.prototype instanceof a?s:a,l=Object.create(h.prototype);return Tg(l,"_invoke",function(i,s,n){var r,a,h,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return r=e,a=0,h=t,d.n=i,o}};function f(i,s){for(a=i,h=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],f=d.p,g=r[2];i>3?(n=g===s)&&(h=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=t):r[0]<=f&&((n=i<2&&f<r[1])?(a=0,d.v=s,d.n=r[1]):f<g&&(n=i<3||r[0]>s||s>g)&&(r[4]=i,r[5]=s,d.n=g,a=0))}if(n||i>1)return o;throw u=!0,s}return function(n,c,g){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,h=g;(e=a<2?t:h)||!u;){r||(a?a<3?(a>1&&(d.n=-1),f(a,h)):d.n=h:d.v=h);try{if(l=2,r){if(a||(n="next"),e=r[n]){if(!(e=e.call(r,h)))throw TypeError("iterator result is not an object");if(!e.done)return e;h=e.value,a<2&&(a=0)}else 1===a&&(e=r.return)&&e.call(r),a<2&&(h=TypeError("The iterator does not provide a '"+n+"' method"),a=1);r=t}else if((e=(u=d.n<0)?h:i.call(s,d))!==o)break}catch(e){r=t,a=1,h=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),l}var o={};function a(){}function h(){}function l(){}e=Object.getPrototypeOf;var c=[][s]?e(e([][s]())):(Tg(e={},s,function(){return this}),e),u=l.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Tg(t,n,"GeneratorFunction")),t.prototype=Object.create(u),t}return h.prototype=l,Tg(u,"constructor",l),Tg(l,"constructor",h),h.displayName="GeneratorFunction",Tg(l,n,"GeneratorFunction"),Tg(u),Tg(u,n,"Generator"),Tg(u,s,function(){return this}),Tg(u,"toString",function(){return"[object Generator]"}),(Rg=function(){return{w:r,m:d}})()}function Tg(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}Tg=function(t,e,i,s){function r(e,i){Tg(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},Tg(t,e,i,s)}function Gg(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function Og(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var r=t.apply(e,i);function o(t){Gg(r,s,n,o,a,"next",t)}function a(t){Gg(r,s,n,o,a,"throw",t)}o(void 0)})}}Cg.defs(Ig,"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs"),function(t){Pg=t;const e=Object.keys(t.defs),i=e.length;let s,n;for(s=0;s<i;++s){const i=e[s];if(!qe(i)){const e=t.defs(i);let s=e.units;s||"longlat"!==e.projName||(s="degrees"),bi(new Ge({code:i,axisOrientation:e.axis,metersPerUnit:e.to_meter,units:s}))}}for(s=0;s<i;++s){const r=e[s],o=qe(r);for(n=0;n<i;++n){const i=e[n],s=qe(i);if(!Ze(r,i))if(t.defs[r]===t.defs[i])Pi([o,s]);else{const e=t(r,i);Ti(o,s,qi(o,s,e.forward),qi(s,o,e.inverse))}}}}(Cg);var kg=new Map,Ag=function(t){return t},Fg=function(t){var e=document.createElement("canvas");e.width=t.width,e.height=t.height,e.getContext("2d").putImageData(t,0,0);var i=document.createElement("canvas").getContext("2d").createPattern(e,"repeat");return new ah({color:i})},Lg=function(){var t=Og(Rg().m(function t(e,i,s,n){var r,o,a;return Rg().w(function(t){for(;;)switch(t.n){case 0:if((r=s.getPatternImageId(e,i,n))&&!kg.has(Ag(r))){t.n=1;break}return t.a(2);case 1:return t.n=2,s.rasterisePatternImage(e,i,n);case 2:if(o=t.v){t.n=3;break}return t.a(2);case 3:a=Ag(o.imageId),kg.has(a)||kg.set(a,Fg(o.imageData));case 4:return t.a(2)}},t)}));return function(e,i,s,n){return t.apply(this,arguments)}}(),jg=function(){var t=Og(Rg().m(function t(e,i,s,n){return Rg().w(function(t){for(;;)switch(t.n){case 0:if(e.length){t.n=1;break}return t.a(2);case 1:return t.n=2,Promise.all(e.map(function(t){return Lg(t,i,s,n)}));case 2:return t.a(2)}},t)}));return function(e,i,s,n){return t.apply(this,arguments)}}(),Ng=function(t,e){if(t.hasStroke)return new lh({color:(0,r.o)(t.style.stroke,e),width:t.style.strokeWidth||1,lineDash:t.style.strokeDashArray})};function Dg(t){return Dg="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},Dg(t)}function zg(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,s)}return i}function Wg(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?zg(Object(i),!0).forEach(function(e){Bg(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):zg(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function Bg(t,e,i){return(e=function(t){var e=function(t){if("object"!=Dg(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Dg(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Dg(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var Xg=Ig,qg=new class extends Kc{constructor(t){t=t||{},super(),this.dataProjection=Ei(t.dataProjection?t.dataProjection:"EPSG:4326"),t.featureProjection&&(this.defaultFeatureProjection=Ei(t.featureProjection)),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){let i=null;i="Feature"===t.type?t:{type:"Feature",geometry:t,properties:null};const s=Hc(i.geometry);if(this.featureClass===Ts)return Yc({geometry:s,id:i.id,properties:i.properties},e);const n=new(0,this.featureClass);return this.geometryName_?n.setGeometryName(this.geometryName_):this.extractGeometryName_&&i.geometry_name&&n.setGeometryName(i.geometry_name),n.setGeometry(Zc(s,e)),"id"in i&&n.setId(i.id),i.properties&&n.setProperties(i.properties,!0),n}readFeaturesFromObject(t,e){let i=null;if("FeatureCollection"===t.type){i=[];const s=t.features;for(let t=0,n=s.length;t<n;++t){const n=this.readFeatureFromObject(s[t],e);n&&i.push(n)}}else i=[this.readFeatureFromObject(t,e)];return i.flat()}readGeometryFromObject(t,e){return function(t,e){return Zc(Hc(t),e)}(t,e)}readProjectionFromObject(t){const e=t.crs;let i;if(e)if("name"==e.type)i=Ei(e.properties.name);else{if("EPSG"!==e.type)throw new Error("Unknown SRS type");i=Ei("EPSG:"+e.properties.code)}else i=this.dataProjection;return i}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=$c(r,e),delete n[t.getGeometryName()]),nt(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 $c(t,this.adaptOptions(e))}}({dataProjection:Xg,featureProjection:Xg}),Ug=1e-6,Yg=13e5,Zg=[0,0,Yg,Yg],Vg=new Yl({extent:Zg,origin:[Zg[0],Zg[3]],resolutions:Array.from({length:25},function(t,e){return(Zg[2]-Zg[0])/(256*Math.pow(2,e))}),tileSize:256}),Kg=function(t,e){if(!e)return qg.readFeatures(t);var i=Wg(Wg({},t),{},{features:t.features.map(function(t){var i,s;return Wg(Wg({},t),{},{id:null!==(i=null===(s=t.properties)||void 0===s?void 0:s[e])&&void 0!==i?i:t.id})})});return qg.readFeatures(i)},Hg=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.mapStyleId,s=e.pixelRatio,n=e.patternRegistry;return t.hasPattern?function(t,e,i,s){var n=s.getPatternImageId(t.style,e,i),r=n&&function(t){return kg.get(t)}(n),o=r?new gh({fill:r,stroke:Ng(t,e)}):void 0,a=function(t){if(!t)return null;var e=Ja(t,Go,Yo()),i={variables:{},properties:{},resolution:NaN,featureId:null,geometryType:""};return function(t){var s,n,r;return i.properties=t.getProperties(),i.featureId=null!==(s=t.getId())&&void 0!==s?s:null,i.geometryType=null!==(n=null===(r=t.getGeometry())||void 0===r?void 0:r.getType())&&void 0!==n?n:"",Boolean(e(i))}}(t.filter);return function(t){if(o&&(!a||a(t)))return o}}(t,i,s,n):t.flatStyle};function $g(t){return $g="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},$g(t)}function Jg(){var t,e,i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",n=i.toStringTag||"@@toStringTag";function r(i,s,n,r){var h=s&&s.prototype instanceof a?s:a,l=Object.create(h.prototype);return Qg(l,"_invoke",function(i,s,n){var r,a,h,l=0,c=n||[],u=!1,d={p:0,n:0,v:t,a:f,f:f.bind(t,4),d:function(e,i){return r=e,a=0,h=t,d.n=i,o}};function f(i,s){for(a=i,h=s,e=0;!u&&l&&!n&&e<c.length;e++){var n,r=c[e],f=d.p,g=r[2];i>3?(n=g===s)&&(h=r[(a=r[4])?5:(a=3,3)],r[4]=r[5]=t):r[0]<=f&&((n=i<2&&f<r[1])?(a=0,d.v=s,d.n=r[1]):f<g&&(n=i<3||r[0]>s||s>g)&&(r[4]=i,r[5]=s,d.n=g,a=0))}if(n||i>1)return o;throw u=!0,s}return function(n,c,g){if(l>1)throw TypeError("Generator is already running");for(u&&1===c&&f(c,g),a=c,h=g;(e=a<2?t:h)||!u;){r||(a?a<3?(a>1&&(d.n=-1),f(a,h)):d.n=h:d.v=h);try{if(l=2,r){if(a||(n="next"),e=r[n]){if(!(e=e.call(r,h)))throw TypeError("iterator result is not an object");if(!e.done)return e;h=e.value,a<2&&(a=0)}else 1===a&&(e=r.return)&&e.call(r),a<2&&(h=TypeError("The iterator does not provide a '"+n+"' method"),a=1);r=t}else if((e=(u=d.n<0)?h:i.call(s,d))!==o)break}catch(e){r=t,a=1,h=e}finally{l=1}}return{value:e,done:u}}}(i,n,r),!0),l}var o={};function a(){}function h(){}function l(){}e=Object.getPrototypeOf;var c=[][s]?e(e([][s]())):(Qg(e={},s,function(){return this}),e),u=l.prototype=a.prototype=Object.create(c);function d(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,Qg(t,n,"GeneratorFunction")),t.prototype=Object.create(u),t}return h.prototype=l,Qg(u,"constructor",l),Qg(l,"constructor",h),h.displayName="GeneratorFunction",Qg(l,n,"GeneratorFunction"),Qg(u),Qg(u,n,"Generator"),Qg(u,s,function(){return this}),Qg(u,"toString",function(){return"[object Generator]"}),(Jg=function(){return{w:r,m:d}})()}function Qg(t,e,i,s){var n=Object.defineProperty;try{n({},"",{})}catch(t){n=0}Qg=function(t,e,i,s){function r(e,i){Qg(t,e,function(t){return this._invoke(e,i,t)})}e?n?n(t,e,{value:i,enumerable:!s,configurable:!s,writable:!s}):t[e]=i:(r("next",0),r("throw",1),r("return",2))},Qg(t,e,i,s)}function t_(t,e,i,s,n,r,o){try{var a=t[r](o),h=a.value}catch(t){return void i(t)}a.done?e(h):Promise.resolve(h).then(s,n)}function e_(t){return function(){var e=this,i=arguments;return new Promise(function(s,n){var r=t.apply(e,i);function o(t){t_(r,s,n,o,a,"next",t)}function a(t){t_(r,s,n,o,a,"throw",t)}o(void 0)})}}function i_(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,s_(s.key),s)}}function s_(t){var e=function(t){if("object"!=$g(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=$g(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==$g(e)?e:e+""}function n_(t,e,i){return e=o_(e),function(t,e){if(e&&("object"==$g(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,r_()?Reflect.construct(e,i||[],o_(t).constructor):e.apply(t,i))}function r_(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(r_=function(){return!!t})()}function o_(t){return o_=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},o_(t)}function a_(t,e){return a_=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},a_(t,e)}var h_=function(t){function e(t,i,s){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=n_(this,e,[t,i,s]))._sourcesById=new Map,n._layersById=new Map,n.createDataset=n.createDataset.bind(n),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a_(t,e)}(e,t),i=e,s=[{key:"createDataset",value:function(t){return new J(t)}},{key:"_styleContext",get:function(){var t;return{mapStyleId:null===(t=n.Q.mapStyle)||void 0===t?void 0:t.id,pixelRatio:this._pixelRatio,patternRegistry:this._patternRegistry}}},{key:"init",value:(c=e_(Jg().m(function t(){var e=this;return Jg().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:n.Q.forEachDataset(function(t){return e._addLayers(t)});case 2:return t.a(2)}},t,this)})),function(){return c.apply(this,arguments)})},{key:"destroy",value:function(){var t=this;this._layersById.forEach(function(e){return t._map.removeLayer(e)}),this._layersById.clear(),this._sourcesById.clear()}},{key:"onMapStyleChange",value:(l=e_(Jg().m(function t(){var e=this;return Jg().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Promise.all([this._registerPatterns(),this._registerSymbols()]);case 1:n.Q.forEachDataset(function(t){return e._forEachLeafDataset(t,function(t){e._setLayerStyle(t)})});case 2:return t.a(2)}},t,this)})),function(){return l.apply(this,arguments)})},{key:"onMapSizeChange",value:(h=e_(Jg().m(function t(){var e=this;return Jg().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,this._registerPatterns();case 1:n.Q.forEachDataset(function(t){return e._forEachLeafDataset(t,function(t){t.hasPattern&&e._setLayerStyle(t)})});case 2:return t.a(2)}},t,this)})),function(){return h.apply(this,arguments)})},{key:"_registerPatternsAndSymbols",value:function(t){return Promise.all([this._registerPatterns([t]),this._registerSymbols([t])])}},{key:"removeDataset",value:function(t){var e=this,i=n.Q.getDataset(t);if(i){i.layerIds.forEach(function(t){var i=e._layersById.get(t);i&&(e._map.removeLayer(i),e._layersById.delete(t))});var s=i.sourceId;n.Q.topLevelDatasets().some(function(e){return e.id!==t&&e.sourceId===s})||this._sourcesById.delete(s)}}},{key:"applyStyle",value:(a=e_(Jg().m(function t(e){var i,s=this;return Jg().w(function(t){for(;;)switch(t.n){case 0:if(i=n.Q.getDataset(e)){t.n=1;break}return t.a(2);case 1:return t.n=2,this._registerPatternsAndSymbols(i);case 2:this._forEachLeafDataset(i,function(t){s._layersById.has(t.id)?s._setLayerStyle(t):s._addLayers(t)});case 3:return t.a(2)}},t,this)})),function(t){return a.apply(this,arguments)})},{key:"_setLayerOpacity",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setOpacity(e)}},{key:"_setLayerVisibility",value:function(t,e){var i;null===(i=this._layersById.get(t))||void 0===i||i.setVisible("visible"===e)}},{key:"applyFeatureFilter",value:function(t){var e=this,i=n.Q.getDataset(t);i&&this._forEachLeafDataset(i,function(t){e._setLayerStyle(t)})}},{key:"setData",value:function(t,e){var i,s=n.Q.getDataset(t),r=s&&this._sourcesById.get(s.sourceId);r&&(r.clear(),null!=e&&null!==(i=e.features)&&void 0!==i&&i.length&&r.addFeatures(Kg(e,s.idStrategy)))}},{key:"_registerPatterns",value:(o=e_(Jg().m(function t(){var e,i,s,r,o=this,a=arguments;return Jg().w(function(t){for(;;)switch(t.n){case 0:return i=a.length>0&&void 0!==a[0]?a[0]:n.Q.topLevelDatasets(),s=[],i.forEach(function(t){return o._forEachLeafDataset(t,function(t){t.hasPattern&&s.push(t.style)})}),r=null===(e=n.Q.mapStyle)||void 0===e?void 0:e.id,t.n=1,jg(s,r,this._patternRegistry,this._pixelRatio);case 1:return t.a(2)}},t,this)})),function(){return o.apply(this,arguments)})},{key:"_registerSymbols",value:(r=e_(Jg().m(function t(){var e,i,s=this,r=arguments;return Jg().w(function(t){for(;;)switch(t.n){case 0:return e=r.length>0&&void 0!==r[0]?r[0]:n.Q.topLevelDatasets(),i=[],e.forEach(function(t){return s._forEachLeafDataset(t,function(t){t.hasSymbol&&i.push(t.style)})}),t.n=1,B(i,n.Q.mapStyle,this._symbolRegistry,3);case 1:return t.a(2)}},t,this)})),function(){return r.apply(this,arguments)})},{key:"_setLayerStyle",value:function(t){var e=this._layersById.get(t.id);if(e)try{e.setStyle(Hg(t,this._styleContext)),t.hasSymbol&&e.set("symbolMeta",t.symbolMeta)}catch(e){au.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}}},{key:"_forEachLeafDataset",value:function(t,e){var i=this;t.hasSublayers?t.sublayers.forEach(function(t){return i._forEachLeafDataset(t,e)}):e(t)}},{key:"_getOrCreateSource",value:function(t){var e,i=t.sourceId;if(this._sourcesById.has(i))return this._sourcesById.get(i);try{e=function(t){var e=t.source,i=t.id,s=t.idStrategy;if(!e)return null;if("geojson"===e.type){var n,r=new en;return"string"==typeof e.data?function(t,e,i,s){fetch(e).then(function(t){if(!t.ok)throw new Error("".concat(t.status," ").concat(t.statusText));return t.json()}).then(function(e){return t.addFeatures(Kg(e,i))}).catch(function(t){return au.v.warn('OpenLayers datasets adapter: failed to fetch geojson for dataset "'.concat(s,'" — ').concat(t.message))})}(r,e.data,s,i):null!==(n=e.data)&&void 0!==n&&null!==(n=n.features)&&void 0!==n&&n.length&&r.addFeatures(Kg(e.data,s)),r}if("vector"===e.type){var o=Array.isArray(e.tiles)?e.tiles:[e.tiles];return new rc({format:new ou({featureClass:Gc,idProperty:s||void 0}),urls:o,projection:Xg,tileGrid:Vg})}return au.v.warn('OpenLayers datasets adapter: unsupported source type "'.concat(e.type,'" (dataset "').concat(i,'")')),null}(t)}catch(e){return au.v.warn('OpenLayers datasets adapter: failed to build a source for dataset "'.concat(t.id,'" — ').concat(e.message)),null}return e&&this._sourcesById.set(i,e),e}},{key:"_addLayers",value:function(t){var e=this;if(t.hasSublayers)return this._getOrCreateSource(t),void t.sublayers.forEach(function(t){return e._addLayers(t)});if(t.leafLayerIds.length){var i=this._getOrCreateSource(t);if(i){var s;try{s=function(t,e,i){var s,n,r=e instanceof rc,o=new(r?Rc:Fl)(Wg({source:e,style:Hg(t,i),opacity:t.opacity,visible:"visible"===t.visibility,minZoom:(n=t.minZoom,void 0===n?void 0:n-Ug),maxZoom:(s=t.maxZoom,void 0===s?void 0:s-Ug),zIndex:t.hasSymbol?1:0},r?{renderMode:"vector"}:{}));return o.set("layerType",r?"vectorTile":"vector"),o.set("layerId",t.id),t.filter&&o.set("filter",t.filter),t.hasSymbol&&o.set("symbolMeta",t.symbolMeta),o}(t,i,this._styleContext)}catch(e){return void au.v.warn('OpenLayers datasets adapter: failed to build a style for dataset "'.concat(t.id,'" — ').concat(e.message))}this._map.addLayer(s),this._layersById.set(t.id,s)}}}}],s&&i_(i.prototype,s),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,s,r,o,a,h,l,c}(Q.h)},10417(t,e,i){i.d(e,{f:()=>f});var s=i(91954),n=i(41449);function r(t){return r="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},r(t)}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,s=Array(e);i<e;i++)s[i]=t[i];return s}function a(t,e){for(var i=0;i<e.length;i++){var s=e[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(t,h(s.key),s)}}function h(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}function l(t,e,i){return e=u(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,c()?Reflect.construct(e,i||[],u(t).constructor):e.apply(t,i))}function c(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(c=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),l(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),i=e,s=[{key:"_hiddenFeaturesIdExpression",get:function(){return this.hasDynamicGeoJSON?this.dynamicGeoJSON.hiddenFeaturesIdExpression:this.idProperty?["to-string",["get",this.idProperty]]:["to-string",["id"]]}},{key:"_hiddenFeaturesFilter",get:function(){var t,e=null===(t=this.hiddenFeatures)||void 0===t?void 0:t.filter(function(t){return-1!==t});return null!=e&&e.length?["!",["in",this._hiddenFeaturesIdExpression,["literal",e.map(String)]]]:null}},{key:"filter",get:function(){var t,e=["all"];null!==(t=this.parent)&&void 0!==t&&t.filter&&e.push(this.parent.filter),this._datasetDefinition.filter&&e.push(this._datasetDefinition.filter);var i=this._hiddenFeaturesFilter;return i&&e.push(i),1===e.length?null:e.length>2?e:e[1]}},{key:"leafLayerIds",get:function(){return[]}},{key:"layerIds",get:function(){return this.hasSublayers?this.sublayers.flatMap(function(t){return t.layerIds}).filter(Boolean):this.leafLayerIds}},{key:"getLayersWithValue",value:function(t){var e,i,s,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=[];if(!1===n||this[n]){var a=this.leafLayerIds;if(a.length){var l=this[t];r.push((e={layerIds:a},s=l,(i=h(i=t))in e?Object.defineProperty(e,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[i]=s,e))}}return this.hasSublayers&&this.sublayers.forEach(function(e){if(!1===n||e[n]){var i=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var s,n,r,o,a=[],h=!0,l=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;h=!1}else for(;!(h=(s=r.call(i)).done)&&(a.push(s.value),a.length!==e);h=!0);}catch(t){l=!0,n=t}finally{try{if(!h&&null!=i.return&&(o=i.return(),Object(o)!==o))return}finally{if(l)throw n}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(e.getLayersWithValue(t),1)[0];i&&r.push(i)}}),r}},{key:"getLayersWithVisibility",value:function(){return this.getLayersWithValue("visibility")}},{key:"getLayersWithOpacity",value:function(){return this.getLayersWithValue("opacity")}},{key:"getLayersWithFilters",value:function(){return this.getLayersWithValue("filter","hasHiddenFeatures")}},{key:"sourceId",get:function(){if(this.isSublayer)return this.parent.sourceId;if(this.hasDynamicGeoJSON)return this.dynamicGeoJSON.sourceId;if(this.tiles){var t=Array.isArray(this.tiles)?this.tiles.join(","):this.tiles;return"tiles-".concat((0,n.YZ)(t))}return this.geojson?"string"==typeof this.geojson?"geojson-".concat((0,n.YZ)(this.geojson)):"geojson-".concat(this.id):"source-".concat(this.id)}}],s&&a(i.prototype,s),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,s}(s.j)},43247(t,e,i){function s(t){return s="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},s(t)}i.d(e,{o:()=>n});var n=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===s(t)){if(e&&t[e])return t[e];var i=Object.values(t)[0];return null!=i?i:null}return null}},93121(t,e,i){i.d(e,{Op:()=>o,n8:()=>r,sR:()=>n});var s=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),n=function(t){if(!function(t){return!(!t.symbol&&!t.symbolSvgContent)}(t))return{};var e={};return s.forEach(function(i){if(null!=t[i]){var s=i.charAt(6).toLowerCase()+i.slice(7);e[s]=t[i]}}),e},r=function(t,e){var i;return t.symbolViewBox?t.symbolViewBox:null!==(i=null==e?void 0:e.viewBox)&&void 0!==i?i:"0 0 38 38"},o=function(t,e){var i;return t.symbolAnchor?t.symbolAnchor:null!==(i=null==e?void 0:e.anchor)&&void 0!==i?i:[.5,.5]}}}]);