@defra/interactive-map 0.0.59-alpha → 0.0.61-alpha

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 (125) hide show
  1. package/assets/templates/add-polygons.njk +2 -2
  2. package/assets/templates/add-symbols.njk +2 -2
  3. package/dist/css/index.css +1 -1
  4. package/dist/esm/im-core.js +1 -1
  5. package/dist/esm/im-shell.js +1 -1
  6. package/dist/umd/im-core.js +1 -1
  7. package/dist/umd/index.js +1 -1
  8. package/docs/api/button-definition.md +11 -0
  9. package/docs/api/context.md +2 -0
  10. package/docs/api/panel-definition.md +30 -0
  11. package/docs/api/symbol-config.md +12 -0
  12. package/docs/api.md +21 -2
  13. package/docs/assets/images/slot-map.svg +3 -3
  14. package/docs/plugins/datasets.md +11 -1
  15. package/docs/plugins/draw.md +26 -0
  16. package/package.json +1 -1
  17. package/plugins/datasets/dist/esm/index.js +1 -1
  18. package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
  19. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  20. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  21. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  22. package/plugins/datasets/dist/umd/index.js +1 -1
  23. package/plugins/datasets/src/index.js +0 -1
  24. package/plugins/datasets/src/index.test.js +2 -8
  25. package/plugins/datasets/src/registry/dataset.test.js +9 -0
  26. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  27. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  28. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  29. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  30. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  31. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  32. package/plugins/draw/dist/umd/index.js +1 -1
  33. package/plugins/draw/src/DrawInit.jsx +3 -0
  34. package/plugins/draw/src/DrawInit.test.jsx +16 -0
  35. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +19 -3
  36. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -0
  37. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +10 -2
  38. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +14 -0
  39. package/plugins/draw/src/defaults.js +4 -0
  40. package/plugins/draw/src/hooks/useSnapMinZoom.js +29 -0
  41. package/plugins/draw/src/hooks/useSnapMinZoom.test.js +82 -0
  42. package/plugins/draw/src/manifest.js +4 -1
  43. package/plugins/draw/src/manifest.test.js +15 -2
  44. package/plugins/draw/src/utils/snapMinZoom.js +8 -0
  45. package/plugins/draw/src/utils/snapMinZoom.test.js +22 -0
  46. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  47. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  48. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  49. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  50. package/plugins/map-key/src/manifest.js +1 -1
  51. package/plugins/search/dist/css/index.css +1 -1
  52. package/plugins/search/src/components/Form/Form.module.scss +1 -0
  53. package/providers/esri/dist/esm/im-esri-provider.js +1 -1
  54. package/providers/esri/src/esriProvider.js +10 -21
  55. package/providers/esri/src/utils/coords.js +37 -7
  56. package/providers/esri/src/utils/coords.test.js +22 -1
  57. package/providers/esri/src/utils/spatial.js +1 -47
  58. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  59. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  60. package/providers/maplibre/src/maplibreProvider.js +5 -14
  61. package/providers/maplibre/src/maplibreProvider.test.js +143 -146
  62. package/providers/maplibre/src/utils/spatial.js +0 -40
  63. package/providers/maplibre/src/utils/spatial.test.js +0 -35
  64. package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  65. package/providers/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  66. package/providers/openlayers/src/openlayersProvider.js +5 -14
  67. package/providers/openlayers/src/openlayersProvider.test.js +12 -10
  68. package/providers/openlayers/src/utils/spatial.js +0 -39
  69. package/providers/openlayers/src/utils/spatial.test.js +1 -26
  70. package/src/App/components/Hints/Hints.jsx +9 -21
  71. package/src/App/components/Hints/Hints.test.jsx +20 -33
  72. package/src/App/components/MapButton/MapButton.jsx +20 -2
  73. package/src/App/components/MapButton/MapButton.module.scss +15 -1
  74. package/src/App/components/MapButton/MapButton.test.jsx +21 -3
  75. package/src/App/components/Panel/Panel.jsx +16 -1
  76. package/src/App/components/Panel/Panel.test.jsx +44 -0
  77. package/src/App/components/Tooltip/Tooltip.jsx +29 -11
  78. package/src/App/components/Tooltip/Tooltip.test.jsx +45 -3
  79. package/src/App/components/Viewport/MapController.jsx +2 -0
  80. package/src/App/components/Viewport/MapController.test.jsx +3 -0
  81. package/src/App/hooks/useCrossHairAPI.js +27 -28
  82. package/src/App/hooks/useCrossHairAPI.test.js +64 -7
  83. package/src/App/hooks/useLayoutMeasurements.js +175 -131
  84. package/src/App/hooks/useLayoutMeasurements.test.js +227 -122
  85. package/src/App/hooks/useMapProviderOverrides.js +114 -35
  86. package/src/App/hooks/useMapProviderOverrides.test.js +188 -5
  87. package/src/App/hooks/useModalPanelBehaviour.js +18 -32
  88. package/src/App/hooks/useModalPanelBehaviour.test.js +45 -33
  89. package/src/App/hooks/useUserMoveTracking.js +65 -0
  90. package/src/App/hooks/useUserMoveTracking.test.js +99 -0
  91. package/src/App/hooks/useVisibleGeometry.js +35 -45
  92. package/src/App/hooks/useVisibleGeometry.test.js +149 -121
  93. package/src/App/layout/Layout.jsx +4 -4
  94. package/src/App/layout/layout.module.scss +124 -61
  95. package/src/App/renderer/mapButtons.js +1 -0
  96. package/src/App/renderer/mapButtons.test.js +8 -0
  97. package/src/App/store/AppProvider.jsx +3 -0
  98. package/src/App/store/appDispatchMiddleware.js +18 -10
  99. package/src/App/store/appDispatchMiddleware.test.js +42 -4
  100. package/src/App/store/mapActionsMap.js +2 -1
  101. package/src/App/store/mapActionsMap.test.js +6 -0
  102. package/src/App/store/mapReducer.js +2 -0
  103. package/src/App/store/mapReducer.test.js +1 -0
  104. package/src/InteractiveMap/InteractiveMap.js +3 -2
  105. package/src/InteractiveMap/InteractiveMap.test.js +2 -2
  106. package/src/config/events.js +1 -1
  107. package/src/config/mapPanelSlots.js +8 -0
  108. package/src/config/symbolConfig.js +1 -1
  109. package/src/scss/settings/_colors.scss +4 -0
  110. package/src/services/symbolRegistry.js +1 -1
  111. package/src/services/symbolRegistry.test.js +19 -0
  112. package/src/types.js +33 -8
  113. package/src/utils/getFitMove.js +73 -0
  114. package/src/utils/getFitMove.test.js +114 -0
  115. package/src/utils/getSafeZoneInset.js +122 -77
  116. package/src/utils/getSafeZoneInset.test.js +241 -54
  117. package/src/utils/getValueForStyle.js +10 -5
  118. package/src/utils/getValueForStyle.test.js +13 -2
  119. package/src/utils/renderedBoxes.js +25 -0
  120. package/src/utils/renderedBoxes.test.js +61 -0
  121. package/src/utils/screenBox.js +70 -0
  122. package/src/utils/screenBox.test.js +69 -0
  123. package/src/utils/symbolUtils.js +9 -9
  124. package/src/utils/symbolUtils.test.js +21 -0
  125. package/providers/esri/src/utils/spatial.test.js +0 -58
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-draw-plugin.js.LICENSE.txt */
2
- "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[568],{278:function(e,t,n){n.d(t,{Et:function(){return d},Gf:function(){return c},Lr:function(){return s},n1:function(){return u},nv:function(){return f},tR:function(){return p},wi:function(){return l},zX:function(){return r},zx:function(){return a}});var r=6371008.8,i={centimeters:100*r,centimetres:100*r,degrees:360/(2*Math.PI),feet:3.28084*r,inches:39.37*r,kilometers:r/1e3,kilometres:r/1e3,meters:r,metres:r,miles:r/1609.344,millimeters:1e3*r,millimetres:1e3*r,nauticalmiles:r/1852,radians:1,yards:1.0936*r};function o(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function a(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(e[0])||!d(e[1]))throw new Error("coordinates must contain numbers");return o({type:"Point",coordinates:e},t,n)}function u(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return o({type:"Polygon",coordinates:e},t,n)}function l(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return o({type:"LineString",coordinates:e},t,n)}function s(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function c(e,t="kilometers"){const n=i[t];if(!n)throw new Error(t+" units is invalid");return e/n}function f(e){return e%(2*Math.PI)*180/Math.PI}function p(e){return e%360*Math.PI/180}function d(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}},850:function(e,t,n){function r(e,t,n){if(null!==e)for(var i,o,a,u,l,s,c,f,p=0,d=0,h=e.type,y="FeatureCollection"===h,g="Feature"===h,v=y?e.features.length:1,m=0;m<v;m++){l=(f=!!(c=y?e.features[m].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<l;b++){var S=0,w=0;if(null!==(u=f?c.geometries[b]:c)){s=u.coordinates;var E=u.type;switch(p=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===t(s,d,m,S,w))return!1;d++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(!1===t(s[i],d,m,S,w))return!1;d++,"MultiPoint"===E&&S++}"LineString"===E&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(o=0;o<s[i].length-p;o++){if(!1===t(s[i][o],d,m,S,w))return!1;d++}"MultiLineString"===E&&S++,"Polygon"===E&&w++}"Polygon"===E&&S++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(w=0,o=0;o<s[i].length;o++){for(a=0;a<s[i][o].length-p;a++){if(!1===t(s[i][o][a],d,m,S,w))return!1;d++}w++}S++}break;case"GeometryCollection":for(i=0;i<u.geometries.length;i++)if(!1===r(u.geometries[i],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function i(e,t,n){var r=n;return function(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,function(e,i,o,a,u){r=0===i&&void 0===n?e:t(r,e,i,o,a,u)}),r}n.d(t,{Fh:function(){return r},jE:function(){return i}})},360:function(e,t,n){n.d(t,{P:function(){return r},k:function(){return i}});var r="change",i={CREATE:"create",EDIT_FINISH:"editfinish",CANCEL:"cancel",VERTEX_SELECTION:"vertexselection",VERTEX_CHANGE:"vertexchange",UNDO_CHANGE:"undochange",UPDATE:"update",GEOMETRY_CHANGE:"geometrychange",INTERFACE_TYPE_CHANGE:"interfacetypechange",PLACEMENT_BLOCKED:"placementblocked",VALIDITY_CHANGE:"validitychange",CAN_PLACE_CHANGE:"canplacechange"}},682:function(e,t,n){n.d(t,{F0:function(){return l},V3:function(){return f},WQ:function(){return c},lm:function(){return u},vf:function(){return s}});var r="rgba(29,112,184,1)",i="#ffffff",o="rgba(11,12,12,1)",a="rgba(212,53,28,0.5)",u={editStroke:{light:r,dark:i},editFill:{light:"rgba(29,112,184,0.1)",dark:"rgba(255,255,255,0.1)"},editVertex:{light:r,dark:i},editMidpoint:{light:r,dark:i},editHalo:{light:i,dark:o},editActive:{light:o,dark:i},splitInvalid:{light:r,dark:i},splitValid:{light:r,dark:i},invalidStroke:{light:r,dark:i},shapeStroke:"rgba(212,53,28,1)",shapeFill:a,snapVertex:a,snapMidpoint:"rgba(40,161,151,1)",snapEdge:"rgba(29,112,184,0.5)"},l={strokeWidth:2,vertexRadius:6,midpointRadius:4,vertexHaloRadius:8,midpointHaloRadius:6,touchTargetSize:48,touchIndicatorRadius:30},s={snapRadius:12},c={nudgeAmount:1,stepAmount:5},f="draw"},806:function(e,t,n){n.r(t),n.d(t,{manifest:function(){return xt}});var r=new Set(["draw_polygon","draw_line"]),i=new Set(["draw_polygon","draw_line","draw_point"]),o=new Set(["edit_vertex","edit_point"]),a=new Set(["draw_polygon","draw_line","edit_vertex","edit_point"]),u=new Set(["draw_polygon","draw_line","draw_point","edit_vertex","edit_point"]),l=function(e){return r.has(e)},s=function(e){return i.has(e)},c=function(e){return o.has(e)},f=function(e){return a.has(e)};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g={SET_MODE:function(e,t){return h(h({},e),{},{mode:t,numVertices:l(t)?0:e.numVertices,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0})},SET_ACTION:function(e,t){return h(h({},e),{},{action:t.name,actionValid:t.isValid})},SET_FEATURE:function(e,t){return h(h({},e),{},{feature:void 0===t.feature?e.feature:t.feature,tempFeature:void 0===t.tempFeature?e.tempFeature:t.tempFeature})},SET_SELECTED_VERTEX_INDEX:function(e,t){return h(h({},e),{},{selectedVertexIndex:t.index,numVertices:t.numVertices})},TOGGLE_SNAP:function(e){return h(h({},e),{},{snap:!e.snap})},SET_HAS_SNAP_LAYERS:function(e,t){return h(h({},e),{},{hasSnapLayers:!!t})},SET_UNDO_STACK_LENGTH:function(e,t){return h(h({},e),{},{undoStackLength:t})},SET_VALIDATION_STATUS:function(e,t){return h(h({},e),{},{validationStatus:t,checkSlow:!1})},SET_CAN_FINISH:function(e,t){return h(h({},e),{},{canFinish:!!t})},SET_CHECK_SLOW:function(e){return h(h({},e),{},{checkSlow:!0})},SET_HOLDING:function(e,t){return h(h({},e),{},{holding:!!t})},SET_PREVIEW_VALID:function(e,t){return h(h({},e),{},{previewValid:!!t})},SET_CAN_ADD_POINT:function(e,t){return h(h({},e),{},{canAddPoint:!!t})}},v=n(738),m={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return S(s,"_invoke",function(n,r,i){var o,u,l,s=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(l=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){o=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,i,o),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,S(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,S(f,"constructor",s),S(s,"constructor",l),l.displayName="GeneratorFunction",S(s,i,"GeneratorFunction"),S(f),S(f,i,"Generator"),S(f,r,function(){return this}),S(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:o,m:p}})()}function S(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}S=function(e,t,n,r){function o(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},S(e,t,n,r)}function w(e,t,n,r,i,o,a){try{var u=e[o](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,i)}var E=function(){var e,t=(e=b().m(function e(t,r){var i,o,a,u,l;return b().w(function(e){for(;;)switch(e.n){case 0:l=t.name,e.n="MapLibreProvider"===l?1:"OpenLayersProvider"===l?3:5;break;case 1:return e.n=2,n.e(356).then(n.bind(n,960));case 2:return i=e.v,o=i.MaplibreDrawAdapter,e.a(2,new o(t,r));case 3:return e.n=4,n.e(722).then(n.bind(n,356));case 4:return a=e.v,u=a.OLDrawAdapter,e.a(2,new u(t,r));case 5:throw new Error('No draw adapter available for map provider "'.concat(t.name,'"'));case 6:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){w(o,r,i,a,u,"next",e)}function u(e){w(o,r,i,a,u,"throw",e)}a(void 0)})});return function(e,n){return t.apply(this,arguments)}}(),P=n(360),O=n(520),x=n(9),_=n(619),A=n(59);function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return(t=function(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||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 M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e){return"sortKey"===e||e.startsWith("symbol")&&!A.I.has(e)},R=function(e){if(null==e||!e.properties)return e;for(var t={},n=0,r=Object.entries(e.properties);n<r.length;n++){var i=I(r[n],2),o=i[0],a=i[1];L(o)||(t[o]=a)}return C(C({},e),{},{properties:t})};function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F(e,t,n){return(t=function(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={revision:0,status:"idle",result:null,feature:null,context:null,slow:!1,afterPending:!1,lastResultStatus:null},B=function(e){return e.valid?"valid":"invalid"},U=new Set(["invalid","error"]),H=new WeakMap,q=function(e){var t,n,r,i,o,a,u,l,s,c=H.get(e);return c||(t=0,n=null,r=null,i=null,o=V,a=null,u=null,l=function(){var e;null===(e=i)||void 0===e||e.abort(),i=null,clearTimeout(r)},s=function(e,u){var l,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).fromCallback;if(e===t){var c=void 0!==s&&s?u.status:o.lastResultStatus;"pending"!==u.status&&(i=null,clearTimeout(r));var f=!!u.slow,p="pending"!==u.status&&n===e;n=f?e:null,o=G(G({},u),{},{revision:e,slow:f,afterPending:p,lastResultStatus:c}),null===(l=a)||void 0===l||l(o)}},c={get state(){return o},setOnSettle:function(e){a=e},get heldId(){var e;return(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0},hold:function(e){u={id:e,revision:t}},release:function(){u=null},run:function(e){var n=e.feature,o=e.context,a=e.consumerCheck,u=e.rules,c=void 0===u?x.k7:u;l();var f=++t,p={feature:n,context:o},d=(0,O.$U)(n,o,{rules:c});if(d.valid&&"function"==typeof a){i=new AbortController;var h,y=function(e){f===t&&(_.v.warn("[draw] geometry check failed (".concat(null==o?void 0:o.phase,")"),e),s(f,G(G({},p),{},{status:"error",result:{valid:!1,reason:null,source:"callback"},error:e}),{fromCallback:!0}))};try{h=a(G({feature:n},o),{signal:i.signal,revision:f})}catch(e){return void y(e)}var g,v=function(e){var t=(0,O.g5)((0,O.Av)(e),"callback");s(f,G(G({},p),{},{status:B(t),result:t}),{fromCallback:!0})};"function"==typeof(null==(g=h)?void 0:g.then)?(s(f,G(G({},p),{},{status:"pending",result:null})),r=setTimeout(function(){return s(f,G(G({},p),{},{status:"pending",result:null,slow:!0}))},300),h.then(v,y)):v(h)}else s(f,G(G({},p),{},{status:B(d),result:d}))},reset:function(){var e,n=(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0;return l(),t++,o=V,u=null,n}},H.set(e,c)),c},z=function(e){var t=e[0],n=e[e.length-1];return e.length>1&&t[0]===n[0]&&t[1]===n[1]?e.slice(0,-1):e},W=function(e){return"Polygon"===e.type?e.coordinates.map(z):e.coordinates},Y=function(e,t){var n=null==e?void 0:e.geometry,r=null==t?void 0:t.geometry;return!(!n||!r||n.type!==r.type)&&JSON.stringify(W(n))===JSON.stringify(W(r))},$=function(e){var t,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e._previewValidator=null!==(t=i.onGeometryPreview)&&void 0!==t?t:o.onGeometryPreview,e._commitValidator=null!==(n=i.onGeometryChange)&&void 0!==n?n:o.onGeometryChange,e._finishValidator=null!==(r=i.onGeometryFinish)&&void 0!==r?r:o.onGeometryFinish;var u=q(e).reset();if(void 0!==u){var l=e.get(u);e.delete(u),null==a||a.emit("draw:cancelled",R(l))}},X=n(652),K=n(491);function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e,t)||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 J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Q=function(e,t,n,r){var i=r.caller,o=r.styleIds,a=void 0===o?[]:o;if(null==n)return{};if(!(0,K.Q)(n))return _.v.warn("".concat(i,": ignoring properties that aren't a plain object"),n),{};for(var u={},l=[],s=0,c=Object.entries((0,X.Uv)(n));s<c.length;s++){var f=Z(c[s],2),p=f[0],d=f[1];L(p)||(0,X.TI)(p,a)?l.push(p):u[p]=d}return l.length&&_.v.warn("".concat(i,": ignoring internal and style properties — use setStyle for style"),l),Object.keys(u).length&&e.setProperties(t,u),u};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}var te=["announcement"];function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach(function(t){ie(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ie(e,t,n){return(t=function(e){var t=function(e){if("object"!=ee(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ee(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oe="draw:created",ae=new WeakMap,ue=new WeakMap,le=new Set(["create","edit-finish"]),se=function(e,t){var n=t.result,r=t.context;return!(le.has(null==r?void 0:r.phase)||"function"!=typeof e._finishValidator&&(null==n||!n.recheckOnFinish))},ce=function(e){var t;return null!==(t=e._finishValidator)&&void 0!==t?t:e._commitValidator},fe=function(e,t,n){var r=t.status,i=t.result,o=t.context,a=t.feature;return"function"==typeof e._finishValidator&&le.has(null==o?void 0:o.phase)&&"valid"===r&&Y(a,n)?i:null},pe=function(e,t,n){var r,i=null===(r=fe(e,q(e).state,t))||void 0===r?void 0:r.properties;return i?(Q(e,t.id,i,{caller:"onGeometryFinish",styleIds:(0,X._8)(n)}),e.get(t.id)):t},de=function(e,t,n){var r,i,o,a,u,l=(o=(i=n).status,a=i.lastResultStatus,u=i.context,"valid"===o||"pending"===o&&"edit-start"!==(null==u?void 0:u.phase)&&!U.has(a));null===(r=e.setCanFinish)||void 0===r||r.call(e,l),t({type:"SET_CAN_FINISH",payload:l})},he={pending:"Checking shape",valid:"Shape check passed",invalid:"Shape check failed",error:"Shape could not be checked"};function ye(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.eventBus,u=e.emitGeometryInvalid,l=e.announce,s=e.resetState,p=o.draw,d=i.feature,h=i.tempFeature,y=i.dispatch,g=q(p);return re(re(re(re({},function(e){var t=e.draw,n=e.dispatch,r=q(t),i=function(e){ue.set(t,e),n({type:"SET_HOLDING",payload:!0})},o=function(e){if("pending"!==e.status||t._finishValidator)if(se(t,e)){r.run({feature:e.feature,context:{phase:"edit-finish",mode:t.getMode()},consumerCheck:ce(t)});var o=r.state;"pending"===o.status?i(o.revision):"valid"===o.status?t.done():n({type:"SET_HOLDING",payload:!1})}else t.done();else i(e.revision)};return{handleDone:function(){c(t.getMode())?o(r.state):t.done()},onEditCheckSettled:function(e){if(ue.has(t)){var r=ue.get(t)===e.revision;r&&"pending"===e.status||(ue.delete(t),r&&"valid"===e.status?o(e):n({type:"SET_HOLDING",payload:!1}))}}}}({draw:p,dispatch:y})),{},{handleCancel:function(){var e,t=p.getMode(),n=c(t)&&!(null==h||!h.id),r=n&&ae.get(p)===h.id,i=null!==(e=g.heldId)&&void 0!==e?e:r?h.id:void 0;n&&!r&&p.add(d),ae.delete(p),g.release(),p.cancel(),void 0!==i&&p.delete(i),s(),a.emit("draw:cancelled",R(d))},handleUndo:function(){return p.undo()},handleDeleteVertex:function(){return p.deleteVertex()},handleSnap:function(){i.dispatch({type:"TOGGLE_SNAP"}),p.setSnapEnabled(!i.snap)},onCancel:function(){g.reset()}},function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.draw,o=e.dispatch,a=e.eventBus,u=e.resetState,l=q(i),s=function(e,u){ae.set(i,e),setTimeout(function(){return function(e,t,n){var r,i,o,a=e.draw,u=e.appState,l=e.appConfig,s=e.mapState,c=e.dispatch,f=e.eventBus,p="Point"===n?"edit_point":"edit_vertex";a.changeMode(p,{container:null==u||null===(r=u.layoutRefs)||void 0===r||null===(r=r.viewportRef)||void 0===r?void 0:r.current,deleteVertexButtonId:"".concat(null==l?void 0:l.id,"-draw-delete-point"),undoButtonId:"".concat(null==l?void 0:l.id,"-draw-undo"),isPanEnabled:"keyboard"!==(null==u?void 0:u.interfaceType),interfaceType:null==u?void 0:u.interfaceType,scale:null==s?void 0:s.mapSizeScale,featureId:t,getSnapEnabled:function(){return a.isSnapEnabled()}});var d=a.get(t),h=q(a).state,y=h.status,g=h.result;c({type:"SET_FEATURE",payload:{feature:d,tempFeature:d}}),c({type:"SET_MODE",payload:p}),c({type:"SET_VALIDATION_STATUS",payload:y}),de(a,c,h),null===(i=a.setInvalid)||void 0===i||i.call(a,"invalid"===y),f.emit("draw:reopened",{feature:R(d),status:y,reason:null!==(o=null==g?void 0:g.reason)&&void 0!==o?o:null})}({draw:i,appState:t,appConfig:n,mapState:r,dispatch:o,eventBus:a},e,u)},0)},c=function(e,t){var n,o,l;"create"===(null===(n=t.context)||void 0===n?void 0:n.phase)&&null!==(o=fe(i,t,e))&&void 0!==o&&o.reopen?s(e.id,null===(l=e.geometry)||void 0===l?void 0:l.type):function(e){var t=pe(i,e,r);u(),setTimeout(function(){return i.changeMode("disabled")},0),a.emit(oe,R(t))}(e)},f=function(e){var t,n=function(e){var t=l.state,n=t.status,r=t.feature;return("valid"===n||"pending"===n)&&Y(r,e)&&!se(i,l.state)||l.run({feature:e,context:{phase:"create",mode:i.getMode()},consumerCheck:ce(i)}),l.state}(e);if("valid"===n.status)c(e,n);else if("pending"===n.status)t=e.id,l.hold(t),o({type:"SET_HOLDING",payload:!0}),setTimeout(function(){return i.changeMode("disabled")},0);else{var r;s(e.id,null===(r=e.geometry)||void 0===r?void 0:r.type)}};return{onCreate:f,onCheckSettled:function(e){var t=l.heldId;if(void 0!==t&&"pending"!==e.status){l.release();var n=i.get(t);if(se(i,e))f(n);else if("valid"===e.status)c(n,e);else{var r;s(t,null==n||null===(r=n.geometry)||void 0===r?void 0:r.type)}}},onEditFinish:function(e){var t=pe(i,e,r);u(),setTimeout(function(){return i.changeMode("disabled")},0),ae.get(i)===e.id?(ae.delete(i),a.emit(oe,R(t))):a.emit("draw:edited",R(t))}}}({appState:t,appConfig:n,mapState:r,draw:p,dispatch:y,eventBus:a,resetState:s})),function(e){var t=e.draw,n=e.pluginState,r=e.mapProvider,i=e.eventBus;return{onVertexSelection:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:e}),r.activeMoveTarget=e.index>=0?function(e){return{move:function(t,n,r){return e.nudgeSelectedVertex(t,n,r)},label:"vertex"}}(t):null,i.emit("draw:vertexselection",e)},onVertexChange:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:{index:-1,numVertices:e.numVertices}}),r.activeMoveTarget=null}}}({draw:p,pluginState:i,mapProvider:o,eventBus:a})),{},{onUndoChange:function(e){i.dispatch({type:"SET_UNDO_STACK_LENGTH",payload:e})},onUpdate:function(e){a.emit("draw:updated",R(e))},onGeometryChange:function(e){if(null!=e&&e.phase){var t=p.getMode();f(t)&&g.run({feature:e.feature,context:{phase:e.phase,vertexIndex:e.vertexIndex,mode:t},consumerCheck:p._commitValidator})}},onPlacementBlocked:function(e){e.announcement&&(null==l||l(e.announcement,"action")),u(re(re({},e),{},{feature:R(e.feature)}))},onValidityChange:function(e){i.dispatch({type:"SET_PREVIEW_VALID",payload:e.valid})},onCanPlaceChange:function(e){i.dispatch({type:"SET_CAN_ADD_POINT",payload:e.canPlace})},onInterfaceTypeChange:function(e){a.emit("draw:interfacetypechange",{interfaceType:e.interfaceType})}})}function ge(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginState,o=e.mapProvider,a=e.buttonConfig,u=e.eventBus,l=e.hints,s=e.announce,f=o.draw,p=function(e,t){return function(n){var r,i=n.announcement,o=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(n,te);e.emit("draw:geometryinvalid",o),i||!o.reason||(r=o.reason,Object.values(x.PH).includes(r))||t.show(o.reason)}}(u,l),d=ye({appState:t,appConfig:n,mapState:r,pluginState:i,mapProvider:o,eventBus:u,emitGeometryInvalid:p,announce:s,resetState:function(){i.dispatch({type:"SET_MODE",payload:null}),i.dispatch({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),o.activeMoveTarget=null,q(f).reset(),ue.delete(f)}}),h=q(f),y=function(e){var t=e.draw,n=e.dispatch,r=e.emitGeometryInvalid,i=e.announce;return function(e){var o,a=e.status,u=e.result,l=e.context,s=e.feature,f="valid"===a;if(n(e.slow?{type:"SET_CHECK_SLOW"}:{type:"SET_VALIDATION_STATUS",payload:a}),function(e,t){var n=t.status,r=t.result,i=t.slow,o=t.afterPending;null!=r&&r.announcement?null==e||e(r.announcement,"action"):"pending"===n?i&&(null==e||e(he.pending,"action")):o&&(null==e||e("invalid"===n&&r.reason||he[n],"action"))}(i,e),de(t,n,e),"pending"!==a&&"error"!==a&&(c(t.getMode())&&(null===(o=t.setInvalid)||void 0===o||o.call(t,!f)),!f&&"edit-start"!==(null==l?void 0:l.phase))){var p=u.reason,d=u.source,h=u.announcement;r(re(re({reason:p,source:d,announcement:h},l),{},{feature:R(s)}))}}}({draw:f,dispatch:i.dispatch,emitGeometryInvalid:p,announce:s});return h.setOnSettle(function(e){y(e),d.onCheckSettled(e),d.onEditCheckSettled(e)}),function(e,t){var n=e.drawDone,r=e.drawCancel,i=e.drawUndo,o=e.drawDeletePoint,a=e.drawSnap;n.onClick=t.handleDone,r.onClick=t.handleCancel,i.onClick=t.handleUndo,o&&(o.onClick=t.handleDeleteVertex),a&&(a.onClick=t.handleSnap)}(a,d),function(e,t){e.on(P.k.CREATE,t.onCreate),e.on(P.k.EDIT_FINISH,t.onEditFinish),e.on(P.k.CANCEL,t.onCancel),e.on(P.k.VERTEX_SELECTION,t.onVertexSelection),e.on(P.k.VERTEX_CHANGE,t.onVertexChange),e.on(P.k.UNDO_CHANGE,t.onUndoChange),e.on(P.k.UPDATE,t.onUpdate),e.on(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.on(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.on(P.k.VALIDITY_CHANGE,t.onValidityChange),e.on(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.on(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d),function(){h.setOnSettle(null),function(e){var t=e.drawDone,n=e.drawCancel,r=e.drawUndo,i=e.drawDeletePoint,o=e.drawSnap;t.onClick=null,n.onClick=null,r.onClick=null,i&&(i.onClick=null),o&&(o.onClick=null)}(a),function(e,t){e.off(P.k.CREATE,t.onCreate),e.off(P.k.EDIT_FINISH,t.onEditFinish),e.off(P.k.CANCEL,t.onCancel),e.off(P.k.VERTEX_SELECTION,t.onVertexSelection),e.off(P.k.VERTEX_CHANGE,t.onVertexChange),e.off(P.k.UNDO_CHANGE,t.onUndoChange),e.off(P.k.UPDATE,t.onUpdate),e.off(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.off(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.off(P.k.VALIDITY_CHANGE,t.onValidityChange),e.off(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.off(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d)}}function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach(function(t){Se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Se(e,t,n){return(t=function(e){var t=function(e){if("object"!=ve(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ve(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var we="edit_vertex",Ee="draw",Pe=function(e,t,n){var r=e.mapToScreen(n);return{x:r.x*t,y:r.y*t}};function Oe(e){var t=e.mapState,n=e.pluginState,r=e.services,i=e.mapProvider,o=e.spatialListRegistry,a=e.viewportRef,u=t.mapSizeScale,l=r.eventBus,s=r.announce,c=(0,v.useRef)([]),f=(0,v.useRef)(null);!function(e){var t=e.pluginState,n=e.mapProvider,r=e.mapSizeScale,i=e.spatialListRegistry,o=e.itemsRef,a=e.eventBus;(0,v.useEffect)(function(){var e=function(){o.current=t.mode===we?function(e,t){var n,r,i,o=null!==(n=null===(r=e.draw)||void 0===r||null===(i=r.getVertexItems)||void 0===i?void 0:i.call(r))&&void 0!==n?n:{vertices:[],midpoints:[]},a=o.vertices,u=o.midpoints,l=[];return a.forEach(function(n,r){l.push(function(n,r){return be({id:String(r),label:"Point ".concat(r+1),isMidpoint:!1},Pe(e,t,n))}(n,r)),r<u.length&&l.push(function(n,r){return be({id:String(a.length+r),label:"Insert ".concat(r+1,"-").concat((r+1)%a.length+1),isMidpoint:!0},Pe(e,t,n))}(u[r],r))}),l}(n,r):[],i.notifyItemsChanged(Ee)};e(),a.on(m.MAP_MOVE_END,e);var u=n.draw;return u?(u.on(P.k.UPDATE,e),function(){a.off(m.MAP_MOVE_END,e),u.off(P.k.UPDATE,e)}):function(){return a.off(m.MAP_MOVE_END,e)}},[t.mode,n,r,i,o,a]),(0,v.useEffect)(function(){return i.registerItemProvider(Ee,{getItems:function(){return{items:o.current,multiselectable:!1,label:"Shape points",focusable:!1}},exclusive:!0}),function(){i.unregisterItemProvider(Ee)}},[i,o]),(0,v.useEffect)(function(){if(t.mode===we)return i.claimExclusive(Ee),function(){return i.releaseExclusive(Ee)}},[t.mode,i])}({pluginState:n,mapProvider:i,mapSizeScale:u,spatialListRegistry:o,itemsRef:c,eventBus:l}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef;(0,v.useEffect)(function(){var e=function(e){var t,o,a=e.id;i.current=a,null!==a&&r.mode===we&&(null===(t=n.draw)||void 0===t||null===(o=t.selectVertex)||void 0===o||o.call(t,Number(a)))};return t.on(m.MAP_SET_ACTIVE_ITEM,e),function(){t.off(m.MAP_SET_ACTIVE_ITEM,e)}},[t,n,r.mode,i])}({eventBus:l,mapProvider:i,pluginState:n,activeIdRef:f}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,i=e.activeIdRef,o=e.itemsRef,a=e.viewportRef,u=e.announce;(0,v.useEffect)(function(){var e=function(){var e;if(r.mode===we&&null!==i.current){var t,l,s=o.current.find(function(e){return e.id===i.current});s&&(s.isMidpoint?(null===(t=n.draw)||void 0===t||null===(l=t.insertVertexAtMidpoint)||void 0===l||l.call(t,Number(i.current)),u("New point inserted","action")):u("".concat(s.label," selected"),"action"),null===(e=a.current)||void 0===e||e.focus())}};return t.on(m.MAP_SELECT_ITEM,e),function(){t.off(m.MAP_SELECT_ITEM,e)}},[t,n,r.mode,i,o,a,u])}({eventBus:l,mapProvider:i,pluginState:n,activeIdRef:f,itemsRef:c,viewportRef:a,announce:s})}var xe=n(682),_e=function(e){var t,n=e.appState,r=e.pluginState;return s(r.mode)&&("touch"===n.interfaceType||!(null===(t=n.expandedButtons)||void 0===t||!t.has("mapControls")))};function Ae(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return Te(s,"_invoke",function(n,r,i){var o,u,l,s=0,c=i||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return o=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!i&&t<c.length;t++){var i,o=c[t],d=p.p,h=o[2];n>3?(i=h===r)&&(l=o[(u=o[4])?5:(u=3,3)],o[4]=o[5]=e):o[0]<=d&&((i=n<2&&d<o[1])?(u=0,p.v=r,p.n=o[1]):d<h&&(i=n<3||o[0]>r||r>h)&&(o[4]=n,o[5]=r,p.n=h,u=0))}if(i||n>1)return a;throw f=!0,r}return function(i,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){o||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,o){if(u||(i="next"),t=o[i]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=o.return)&&t.call(o),u<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),u=1);o=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){o=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,i,o),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(Te(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Te(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,Te(f,"constructor",s),Te(s,"constructor",l),l.displayName="GeneratorFunction",Te(s,i,"GeneratorFunction"),Te(f),Te(f,i,"Generator"),Te(f,r,function(){return this}),Te(f,"toString",function(){return"[object Generator]"}),(Ae=function(){return{w:o,m:p}})()}function Te(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}Te=function(e,t,n,r){function o(t,n){Te(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},Te(e,t,n,r)}function je(e,t,n,r,i,o,a){try{var u=e[o](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,i)}var Ce=function(){return new Promise(function(e){return setTimeout(e,0)})};function ke(e){return ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ke(e)}var Ie=["stroke","fill","strokeWidth","properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Le(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Me(Object(n),!0).forEach(function(t){Re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Re(e,t,n){return(t=function(e){var t=function(e){if("object"!=ke(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ke(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ne=function(e){return function(t,n){var r,i=t.appState,o=t.appConfig,a=t.pluginConfig,u=t.pluginState,l=t.mapState,s=t.mapProvider,c=t.services,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=u.dispatch,d=s.draw,h=c.eventBus;if(d){var y=f.stroke,g=f.fill,v=f.strokeWidth,m=f.properties,b=f.onGeometryChange,S=f.onGeometryPreview,w=f.onGeometryFinish,E=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(f,Ie);$(d,{onGeometryChange:b,onGeometryPreview:S,onGeometryFinish:w},a,h),h.emit("draw:started",{mode:e,featureId:n});var P=void 0===f.snapLayers?null!==(r=a.snapLayers)&&void 0!==r?r:null:f.snapLayers;d.setSnapLayers(P),p({type:"SET_HAS_SNAP_LAYERS",payload:(null==P?void 0:P.length)>0});var O=Le(Le({},m),(0,X.h1)({stroke:y,fill:g,strokeWidth:v}));d.changeMode(e,Le(Le({container:i.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(o.id,"-draw-add-point"),interfaceType:i.interfaceType,crossHair:l.crossHair,getSnapEnabled:function(){return d.isSnapEnabled()},featureId:n},E),{},{properties:O})),p({type:"SET_MODE",payload:e})}}},De=Ne("draw_polygon"),Ge=Ne("draw_line");function Fe(e){return Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fe(e)}var Ve=["properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach(function(t){He(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function He(e,t,n){return(t=function(e){var t=function(e){if("object"!=Fe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qe(e){return qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qe(e)}var ze=["stroke","fill","strokeWidth","properties"];function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ye(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?We(Object(n),!0).forEach(function(t){$e(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function $e(e,t,n){return(t=function(e){var t=function(e){if("object"!=qe(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=qe(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==qe(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xe=new Set(["Point","LineString","Polygon"]);function Ke(e){return Ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ke(e)}function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Je(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach(function(t){Qe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qe(e,t,n){return(t=function(e){var t=function(e){if("object"!=Ke(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Ke(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Ke(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function et(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return tt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tt(e,t):void 0}}(e,t)||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 tt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var nt=new Set(["stroke","fill","strokeWidth"]),rt=function(e){return Object.fromEntries(Object.entries(e).map(function(e){var t=et(e,2),n=t[0],r=t[1];return[n,void 0===r?null:r]}))};function it(e){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},it(e)}function ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=it(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=it(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==it(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var lt=n(704);function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct="_splitter",ft=function(e){var t,n,r,i,o=e.draw,a=(t=e.polygonFeature,n=e.feature,!(!(i=null===(r=n.geometry)||void 0===r?void 0:r.coordinates)||i.length<2||!(0,lt.ns)(t,{id:ct,geometry:n.geometry})));return o.setDrawingPreviewProperty("splitter",a?"valid":"invalid"),a};function pt(e){return pt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},pt(e)}function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ht(e,t,n){return(t=function(e){var t=function(e){if("object"!=pt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=pt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==pt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var yt=function(){var e;return"undefined"!=typeof navigator&&/mac/i.test((null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||navigator.platform||"")};function gt(e){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gt(e)}function vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vt(Object(n),!0).forEach(function(t){bt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bt(e,t,n){return(t=function(e){var t=function(e){if("object"!=gt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=gt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==gt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var St=yt()?"<kbd>Command</kbd> + <kbd>Z</kbd>":"<kbd>Ctrl</kbd> + <kbd>Z</kbd>",wt=yt()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",Et="top-middle",Pt=function(e){var t=e.checkSlow,n=e.holding;return!(!t||!n)},Ot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"actions";return{mobile:{slot:t,showLabel:e},tablet:{slot:t,showLabel:e},desktop:{slot:t,showLabel:e}}},xt={reducer:{initialState:{mode:null,action:null,actionValid:!1,feature:null,tempFeature:null,selectedVertexIndex:-1,numVertices:null,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0,snap:!1,hasSnapLayers:!1,undoStackLength:0},actions:g},InitComponent:function(e){var t=e.appState,n=e.appConfig,r=e.mapState,i=e.pluginConfig,o=e.pluginState,a=e.services,l=e.mapProvider,c=e.buttonConfig,f=e.setApplicationMode,p=e.clearApplicationMode,d=a.eventBus,h=a.hints,y=a.symbolRegistry,g=r.crossHair;Oe({mapState:r,pluginState:o,services:a,mapProvider:l,spatialListRegistry:t.spatialListRegistry,viewportRef:t.layoutRefs.viewportRef});var b=(0,v.useRef)(!1);b.current=!o.holding&&(_e({appState:t,pluginState:o})||s(o.mode)&&"keyboard"===t.interfaceType),function(e){var t=e.mapState,n=e.pluginConfig,r=e.pluginState,i=e.mapProvider,o=e.eventBus,a=e.symbolRegistry,u=(0,v.useRef)(!0),l=(0,v.useRef)(!1);(0,v.useEffect)(function(){if(t.isMapReady&&!l.current){l.current=!0;var e=function(){var e,l=(e=Ae().m(function e(){var l,s;return Ae().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ce();case 1:if(u.current){e.n=2;break}return e.a(2);case 2:return e.n=3,E(i,{mapStyle:t.mapStyle,snapLayers:n.snapLayers,pluginConfig:n,events:m,eventBus:o,symbolRegistry:a});case 3:if(s=e.v,u.current){e.n=4;break}return s.remove(),e.a(2);case 4:i.draw=s,r.dispatch({type:"SET_HAS_SNAP_LAYERS",payload:(null===(l=n.snapLayers)||void 0===l?void 0:l.length)>0}),o.emit("draw:ready");case 5:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){je(o,r,i,a,u,"next",e)}function u(e){je(o,r,i,a,u,"throw",e)}a(void 0)})});return function(){return l.apply(this,arguments)}}();e().catch(function(e){return _.v.error("[draw] failed to load the draw adapter",e)})}},[t.isMapReady]),(0,v.useEffect)(function(){return function(){var e;u.current=!1,null===(e=i.draw)||void 0===e||e.remove(),i.draw=null,i.activeMoveTarget=null}},[])}({mapState:r,pluginConfig:i,pluginState:o,mapProvider:l,eventBus:d,symbolRegistry:y}),(0,v.useLayoutEffect)(function(){if(o.mode)return f(xe.V3),function(){return p(xe.V3)};p(xe.V3)},[o.mode]),(0,v.useEffect)(function(){var e=null!==o.mode&&"edit_vertex"!==o.mode;return d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:e}),function(){d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:!1})}},[o.mode,d]),(0,v.useEffect)(function(){if(b.current){var e=g.isVisible;return g.fixAtCenter(),function(){e||b.current||g.hide()}}},[o.mode,o.holding,t.interfaceType,t.expandedButtons]),(0,v.useEffect)(function(){var e;e=o.mode,u.has(e)&&l.draw&&l.draw.setInterfaceType(t.interfaceType)},[t.interfaceType,o.mode]),(0,v.useEffect)(function(){if(l.draw)return ge({appState:t,appConfig:n,mapState:r,mapProvider:l,buttonConfig:c,pluginState:o,events:m,eventBus:d,hints:h,announce:a.announce})},[l,t,o])},applicationModes:bt({},xe.V3,{include:["mapStyles","mapControls","scaleBar"]}),buttons:[mt({id:"drawCancel",label:"Cancel",variant:"tertiary",exclusiveSlot:!0,hiddenWhen:function(e){return!e.pluginState.mode}},Ot(!0)),mt({id:"drawAddPoint",label:"Add point",variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.appState,n=e.pluginState;return!_e({appState:t,pluginState:n})},enableWhen:function(e){var t=e.pluginState;return t.canAddPoint&&!t.holding}},Ot(!0)),mt({id:"drawDone",label:function(e){var t=e.pluginState;return Pt(t)?"Checking…":"Done"},busyWhen:function(e){var t=e.pluginState;return Pt(t)},variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)&&!t.holding},enableWhen:function(e){var t=e.pluginState,n=t.mode,r=t.canFinish,i=t.previewValid,o=t.holding;return f(n)&&r&&i&&!o}},Ot(!0)),mt({id:"drawUndo",label:"Undo",iconId:"undo",hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)},enableWhen:function(e){var t=e.pluginState;return!t.holding&&(l(t.mode)?t.numVertices>0:t.undoStackLength>0)}},Ot(!1,Et)),mt({id:"drawSnap",label:"Snap",iconId:"magnet",hiddenWhen:function(e){var t=e.pluginState;return!t.mode||!t.hasSnapLayers},enableWhen:function(e){return!e.pluginState.holding},pressedWhen:function(e){return!!e.pluginState.snap}},Ot(!0,Et)),mt({id:"drawDeletePoint",label:"Delete point",iconId:"trash",enableWhen:function(e){var t,n=e.pluginState;return!(n.holding||n.selectedVertexIndex<0)&&("Polygon"===(null===(t=n.feature)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type)?n.numVertices>3:n.numVertices>2)},hiddenWhen:function(e){return"edit_vertex"!==e.pluginState.mode}},Ot(!1,Et))],keyboardShortcuts:[{id:"drawAddPoint",group:"Drawing",title:"Add point (draw)",command:"<kbd>Enter</kbd>"},{id:"drawSelectPoint",group:"Drawing",title:"Select nearest point (edit)",command:"<kbd>Spacebar</kbd>"},{id:"drawSelectAdjacentPoint",group:"Drawing",title:"Select adjacent point (edit)",command:"".concat(wt," + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>")},{id:"drawMovePoint",group:"Drawing",title:"Move point (edit)",command:"<kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawNudgePoint",group:"Drawing",title:"Nudge point (edit)",command:"<kbd>Shift</kbd> + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawDeletePoint",group:"Drawing",title:"Delete point (edit)",command:"<kbd>Delete</kbd>"},{id:"drawUndo",group:"Drawing",title:"Undo",command:St}],icons:[{id:"undo",svgContent:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>'},{id:"magnet",svgContent:'<path d="m12 15 4 4"/><path d="M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z"/><path d="m5 8 4 4"/>'},{id:"trash",svgContent:'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>'}],api:{newPolygon:De,newLine:Ge,newPoint:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginConfig,a=e.pluginState,u=e.mapState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=a.dispatch,p=l.draw,d=s.eventBus;if(p){var h=c.properties,y=c.onGeometryChange,g=c.onGeometryPreview,v=c.onGeometryFinish,m=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(c,Ve);$(p,{onGeometryChange:y,onGeometryPreview:g,onGeometryFinish:v},o,d),d.emit("draw:started",{mode:"draw_point",featureId:t});var b=void 0===c.snapLayers?null!==(n=o.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(b),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==b?void 0:b.length)>0});var S={};A.I.forEach(function(e){void 0!==m[e]&&(S[e]=m[e],delete m[e])}),p.changeMode("draw_point",Ue(Ue({container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:u.crossHair,getSnapEnabled:function(){return p.isSnapEnabled()},featureId:t},m),{},{properties:Ue(Ue({},h),S)})),f({type:"SET_MODE",payload:"draw_point"})}},editFeature:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.mapState,a=e.pluginConfig,u=e.pluginState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=u.dispatch,p=l.draw,d=s.eventBus;if(!p)return!1;var h=p.get(t);if(!h)return!1;$(p,c,a,d);var y="Point"===h.geometry.type?"edit_point":"edit_vertex";d.emit("draw:editstart",{mode:{LineString:"edit_line",Polygon:"edit_polygon",Point:"edit_point"}[h.geometry.type],featureId:t});var g=void 0===c.snapLayers?null!==(n=a.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(g),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==g?void 0:g.length)>0}),p.changeMode(y,{container:r.layoutRefs.viewportRef.current,deleteVertexButtonId:"".concat(i.id,"-draw-delete-point"),undoButtonId:"".concat(i.id,"-draw-undo"),isPanEnabled:"keyboard"!==r.interfaceType,interfaceType:r.interfaceType,scale:o.mapSizeScale,featureId:t,getSnapEnabled:function(){return p.isSnapEnabled()}});var v=p.get(t);return f({type:"SET_FEATURE",payload:{feature:v,tempFeature:v}}),f({type:"SET_MODE",payload:y}),q(p).run({feature:v,context:{phase:"edit-start",mode:y},consumerCheck:p._commitValidator}),!0},addFeature:function(e,t){var n=e.mapState,r=e.mapProvider,i=e.services,o=r.draw,a=i.eventBus;if(o){var u=t.stroke,l=t.fill,s=t.strokeWidth,c=t.properties,f=function(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,ze),p=(0,X.h1)(c),d=Ye(Ye({type:"Feature"},f),{},{properties:(0,X.Uv)(Ye(Ye({},p),(0,X.A)(p,{stroke:u,fill:l,strokeWidth:s},(0,X._8)(n))))});!function(e){var t,n;return Xe.has(null===(t=e.geometry)||void 0===t?void 0:t.type)&&void 0!==(null===(n=e.geometry)||void 0===n?void 0:n.coordinates)}(d)?_.v.warn("addFeature: ignoring invalid GeoJSON feature",d):(o.add(d),a.emit("draw:add",R(d)))}},setStyle:function(e,t){var n=e.mapState,r=e.mapProvider,i=e.services,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.draw,u=i.eventBus;if(!a)return!1;var l=a.get(t);if(!l)return _.v.warn("setStyle: no feature found for id",t),!1;for(var s={},c={},f=0,p=Object.entries(o);f<p.length;f++){var d=et(p[f],2),h=d[0],y=d[1];(nt.has(h)?s:c)[h]=y}var g=Je(Je({},(0,X.A)(l.properties,s,(0,X._8)(n))),(0,X.Uv)(c));return a.setStyle(t,g),u.emit("draw:stylechange",{featureId:t,properties:rt(g)}),!0},setProperties:function(e,t){var n=e.pluginState,r=e.mapState,i=e.mapProvider,o=e.services,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=i.draw,l=o.eventBus;if(!u)return!1;if(!u.get(t))return _.v.warn("setProperties: no feature found for id",t),!1;var s=Q(u,t,a,{caller:"setProperties",styleIds:(0,X._8)(r)}),f=n.feature,p=n.dispatch;return c(u.getMode())&&(null==f?void 0:f.id)===t&&p({type:"SET_FEATURE",payload:{feature:at(at({},f),{},{properties:at(at({},f.properties),s)})}}),l.emit("draw:propertieschange",{featureId:t,properties:s}),!0},deleteFeature:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;i&&(i.delete(t),o.emit("draw:delete",{featureId:t}))},split:function(e,t){var n,r=e.appState,i=e.appConfig,o=e.pluginState,a=e.mapState,u=e.mapProvider,l=e.services,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=o.dispatch,f=u.draw,p=l.eventBus;if(f){var d=f.get(t),h=f._previewValidator,y=f._commitValidator,g=f._finishValidator;f._previewValidator=function(e){var t=e.draw,n=e.polygonFeature;return function(e){var r=e.feature;return"preview"===e.phase&&ft({draw:t,polygonFeature:n,feature:r}),{valid:!0}}}({draw:f,polygonFeature:d}),f._commitValidator=function(e){var t=e.draw,n=e.dispatch,r=e.polygonFeature;return function(e){var i,o=e.feature;return e.phase===P.P?(i=function(e){var t=e.dispatch,n=ft({draw:e.draw,polygonFeature:e.polygonFeature,feature:e.feature});return t({type:"SET_ACTION",payload:{name:"split",isValid:n}}),n}({draw:t,dispatch:n,polygonFeature:r,feature:o}),i?{valid:!0}:{valid:!1,reason:"Line does not split the shape into two parts"}):{valid:!0}}}({draw:f,dispatch:c,polygonFeature:d}),f._finishValidator=null,q(f).reset();var v=["stroke-inactive.cold"].concat(function(e){if(Array.isArray(e))return st(e)}(n=s.snapLayers||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}(n)||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.")}());f.setSnapLayers(v),c({type:"SET_HAS_SNAP_LAYERS",payload:!0}),f.changeMode("draw_line",{container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:null==a?void 0:a.crossHair,getSnapEnabled:function(){return f.isSnapEnabled()},featureId:ct,properties:{splitter:"invalid"}});var m=function(){f._previewValidator=h,f._commitValidator=y,f._finishValidator=g,f.off(P.k.CREATE,b),f.off(P.k.CANCEL,S)},b=function(e){m(),f.delete(ct);var n=(0,lt.ns)(d,e);c({type:"SET_ACTION",payload:{name:"split",isValid:!!n}}),n&&p.emit("draw:split",{originalFeatureId:t,featureCollection:n})},S=function(){m()};f.on(P.k.CREATE,b),f.on(P.k.CANCEL,S),c({type:"SET_MODE",payload:"draw_line"}),c({type:"SET_ACTION",payload:{name:"split"}})}},merge:function(e,t){var n=e.mapProvider,r=e.services,i=n.draw,o=r.eventBus;if(!i)return null;var a=t.map(function(e){return i.get(e)}),u=(0,lt.OI)(a);return u&&o.emit("draw:merge",{originalFeatureIds:t,feature:u}),u},setGeometry:function(e,t){var n,r,i=e.mapProvider,o=e.pluginState,a=i.draw;if(!a||!c(a.getMode()))return!1;var u,l=a.get(null===(n=o.feature)||void 0===n?void 0:n.id);return!(!l||(null===(r=l.geometry)||void 0===r?void 0:r.type)!==(null==t?void 0:t.type)||(a.setGeometry({type:t.type,coordinates:(u=t.coordinates,JSON.parse(JSON.stringify(u)))}),0))},recheckGeometry:function(e,t){var n=e.mapProvider.draw;if(!n)return!1;var r=n.getMode(),i=q(n),o=i.state.feature;if(!f(r)||!o)return!1;var a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(n),!0).forEach(function(t){ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({phase:"recheck",mode:r},void 0!==t&&{detail:t});return i.run({feature:o,context:a,consumerCheck:n._commitValidator}),!0}}}},652:function(e,t,n){n.d(t,{A:function(){return b},TI:function(){return m},Uv:function(){return g},_8:function(){return v},h1:function(){return y}});var r=n(59),i=n(491);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 o,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw o}}}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||f(e,t)||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 f(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=new Set(["stroke","fill","strokeWidth"]),h=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},y=function(e){if(!e)return{};for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var o=c(r[n],2),a=o[0],u=o[1];if(d.has(a)&&(0,i.Q)(u)){var l=Object.entries(u);l.length>0&&(t[a]=l[0][1]);for(var s=0,f=l;s<f.length;s++){var p=c(f[s],2),y=p[0],g=p[1];t["".concat(a).concat(h(y))]=g}}else t[a]=u}return t},g=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=0,r=Object.entries(e);n<r.length;n++){var i=c(r[n],2),o=i[0],a=i[1];void 0!==a&&(t[o]=a)}return t},v=function(e){var t,n;return null!==(t=null==e||null===(n=e.mapStyles)||void 0===n?void 0:n.map(function(e){return e.id}))&&void 0!==t?t:[]},m=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return d.has(e)||r.I.has(e)||(t=d,function(e){if(Array.isArray(e))return p(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||f(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.")}()).some(function(t){return n.some(function(n){return e==="".concat(t).concat(h(n))})})},b=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=g(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r={},i=0,o=Object.keys(n);i<o.length;i++){var a=o[i];if(d.has(a)){var l,c=s(t);try{for(c.s();!(l=c.n()).done;){var f=l.value,p="".concat(a).concat(h(f));p in e&&(r[p]=void 0)}}catch(e){c.e(e)}finally{c.f()}}}return u(u({},r),y(n))}},491:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Q:function(){return i}});var i=function(e){if(null===e||"object"!==r(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},704:function(e,t,n){function r(e){var t={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=i(e.properties),t.geometry=o(e.geometry),t}function i(e){var t={};return e?(Object.keys(e).forEach(function(n){var r=e[n];"object"==typeof r?null===r?t[n]=null:Array.isArray(r)?t[n]=r.map(function(e){return e}):t[n]=i(r):t[n]=r}),t):t}function o(e){var t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(function(e){return o(e)}),t):(t.coordinates=a(e.coordinates),t)}function a(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map(function(e){return a(e)})}n.d(t,{jK:function(){return ht},DF:function(){return dt},OI:function(){return ft},ns:function(){return ct}});function u(e){for(var t,n,r=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),i=0,o=1;o<r.length;)t=n||r[0],i+=((n=r[o])[0]-t[0])*(n[1]+t[1]),o++;return i>0}function l(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var n=0;n<e.features.length&&!1!==t(e.features[n],n);n++);}function s(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}function c(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function f(e,t){switch("Feature"===e.type?e.geometry.type:e.type){case"GeometryCollection":return s(e,function(e){f(e,t)}),e;case"LineString":return p(c(e),t),e;case"Polygon":return d(c(e),t),e;case"MultiLineString":return c(e).forEach(function(e){p(e,t)}),e;case"MultiPolygon":return c(e).forEach(function(e){d(e,t)}),e;case"Point":case"MultiPoint":return e}}function p(e,t){u(e)===t&&e.reverse()}function d(e,t){u(e[0])!==t&&e[0].reverse();for(var n=1;n<e.length;n++)u(e[n])===t&&e[n].reverse()}var h=function(e,t){if(!(n=t=t||{})||n.constructor!==Object)throw new Error("options is invalid");var n,i=t.reverse||!1,a=t.mutate||!1;if(!e)throw new Error("<geojson> is required");if("boolean"!=typeof i)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof a)throw new Error("<mutate> must be a boolean");!1===a&&(e=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(function(e){return r(e)}),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return o(e);default:throw new Error("unknown GeoJSON type")}}(e));var u=[];switch(e.type){case"GeometryCollection":return s(e,function(e){f(e,i)}),e;case"FeatureCollection":return l(e,function(e){l(f(e,i),function(e){u.push(e)})}),function(e,t){void 0===t&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}(u)}return f(e,i)};const y=11102230246251565e-32,g=134217729,v=(3+8*y)*y;function m(e,t,n,r,i){let o,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(o=s,s=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+o,u=o-(a-s),s=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>s==c>-s?(a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f]):(a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function b(e){return new Float64Array(e)}const S=b(4),w=b(8),E=b(12),P=b(16),O=b(4);function x(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),l=a-u,s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,i,o,a){let u,l,s,c,f,p,d,h,y,b,x,_,A,T,j,C,k,I;const M=e-i,L=n-i,R=t-o,N=r-o;T=M*N,p=g*M,d=p-(p-M),h=M-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=R*L,p=g*R,d=p-(p-R),h=R-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,S[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,S[1]=A-(x+f)+(f-C),I=_+x,f=I-_,S[2]=_-(I-f)+(x-f),S[3]=I;let D=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,S),G=22204460492503146e-32*a;if(D>=G||-D>=G)return D;if(f=e-M,u=e-(M+f)+(f-i),f=n-L,s=n-(L+f)+(f-i),f=t-R,l=t-(R+f)+(f-o),f=r-N,c=r-(N+f)+(f-o),0===u&&0===l&&0===s&&0===c)return D;if(G=11093356479670487e-47*a+v*Math.abs(D),D+=M*c+N*u-(R*s+L*l),D>=G||-D>=G)return D;T=u*N,p=g*u,d=p-(p-u),h=u-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=l*L,p=g*l,d=p-(p-l),h=l-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const F=m(4,S,4,O,w);T=M*c,p=g*M,d=p-(p-M),h=M-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=R*s,p=g*R,d=p-(p-R),h=R-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const V=m(F,w,4,O,E);T=u*c,p=g*u,d=p-(p-u),h=u-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=l*s,p=g*l,d=p-(p-l),h=l-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const B=m(V,E,4,O,P);return P[B-1]}(e,t,n,r,i,o,s)}function _(e,t){var n,r,i,o,a,u,l,s,c,f=0,p=e[0],d=e[1],h=t.length;for(n=0;n<h;n++){r=0;var y=t[n],g=y.length-1;if((s=y[0])[0]!==y[g][0]&&s[1]!==y[g][1])throw new Error("First and last coordinates in a ring must be the same");for(o=s[0]-p,a=s[1]-d;r<g;r++){if(u=(c=y[r+1])[0]-p,l=c[1]-d,0===a&&0===l){if(u<=0&&o>=0||o<=0&&u>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(i=x(o,u,a,l,0,0)))return 0;(i>0&&l>0&&a<=0||i<0&&l<=0&&a>0)&&f++}s=c,a=l,o=u}}return f%2!=0}b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(4),b(8),b(8),b(8),b(12),b(192),b(192),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(4),b(4),b(4),b(8),b(16),b(16),b(16),b(32),b(32),b(48),b(64),b(1152),b(1152),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(1152),b(1152),b(1152),b(1152),b(1152),b(2304),b(2304),b(3456),b(5760),b(8),b(8),b(8),b(16),b(24),b(48),b(48),b(96),b(192),b(384),b(384),b(384),b(768),b(96),b(96),b(96),b(1152);const A=134217729;function T(e,t,n,r,i){let o,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(o=s,s=t[++f]):(o=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+o,u=o-(a-s),s=t[++f]):(a=c+o,u=o-(a-c),c=r[++p]),o=a,0!==u&&(i[d++]=u);f<e&&p<n;)c>s==c>-s?(a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f]):(a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p]),o=a,0!==u&&(i[d++]=u);for(;f<e;)a=o+s,l=a-o,u=o-(a-l)+(s-l),s=t[++f],o=a,0!==u&&(i[d++]=u);for(;p<n;)a=o+c,l=a-o,u=o-(a-l)+(c-l),c=r[++p],o=a,0!==u&&(i[d++]=u);return 0===o&&0!==d||(i[d++]=o),d}function j(e){return new Float64Array(e)}const C=j(4),k=j(8),I=j(12),M=j(16),L=j(4);function R(e,t,n,r,i,o){const a=(t-o)*(n-i),u=(e-i)*(r-o),l=a-u;if(0===a||0===u||a>0!=u>0)return l;const s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,i,o,a){let u,l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O;const x=e-i,_=n-i,j=t-o,R=r-o;S=x*R,p=A*x,d=p-(p-x),h=x-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=j*_,p=A*j,d=p-(p-j),h=j-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,C[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,C[1]=b-(v+f)+(f-E),O=m+v,f=O-m,C[2]=m-(O-f)+(v-f),C[3]=O;let N=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,C),D=22204460492503146e-32*a;if(N>=D||-N>=D)return N;if(f=e-x,u=e-(x+f)+(f-i),f=n-_,s=n-(_+f)+(f-i),f=t-j,l=t-(j+f)+(f-o),f=r-R,c=r-(R+f)+(f-o),0===u&&0===l&&0===s&&0===c)return N;if(D=11093356479670487e-47*a+33306690738754706e-32*Math.abs(N),N+=x*c+R*u-(j*s+_*l),N>=D||-N>=D)return N;S=u*R,p=A*u,d=p-(p-u),h=u-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=l*_,p=A*l,d=p-(p-l),h=l-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const G=T(4,C,4,L,k);S=x*c,p=A*x,d=p-(p-x),h=x-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=j*s,p=A*j,d=p-(p-j),h=j-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const F=T(G,k,4,L,I);S=u*c,p=A*u,d=p-(p-u),h=u-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=l*s,p=A*l,d=p-(p-l),h=l-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const V=T(F,I,4,L,M);return M[V-1]}(e,t,n,r,i,o,s)}j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(4),j(8),j(8),j(8),j(12),j(192),j(192),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(4),j(4),j(4),j(8),j(16),j(16),j(16),j(32),j(32),j(48),j(64),j(1152),j(1152),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(1152),j(1152),j(1152),j(1152),j(1152),j(2304),j(2304),j(3456),j(5760),j(8),j(8),j(8),j(16),j(24),j(48),j(48),j(96),j(192),j(384),j(384),j(384),j(768),j(96),j(96),j(96),j(1152);var N=function(e,t,n,r,i){this.p1=e,this.p2=t,this.edgeType=n,this.originalIndex=r,this.polygonContourId=i,this.interiorRing=!1,this.minX=Math.min(e.p[0],t.p[0]),this.minY=Math.min(e.p[1],t.p[1]),this.maxX=Math.max(e.p[0],t.p[0]),this.maxY=Math.max(e.p[1],t.p[1]),this.intersectionPoints=[],this.nextEdge=null},D=function(e){this.p=e},G=function(e,t){this.id=e,this.rawCoords=t};function F(e,t){return!(e.maxX<t[0]||e.minX>t[2]||e.maxY<t[1]||e.minY>t[3])}var V=function(e,t,n,r){this.p=e,this.polylineEdge=t,this.polygonEdge=n,this.isHeadingIn=r,this.distanceFromPolylineEdgeStart=B(this.polylineEdge.p1.p,this.p),this.distanceFromPolygonEdgeStart=B(this.polygonEdge.p1.p,this.p),this.polygonEdge.intersectionPoints.push(this),this.polylineEdge.intersectionPoints.push(this),this.visitCount=0};function B(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*=n,r*=r,Math.sqrt(n+r)}V.prototype.incrementVisitCount=function(){this.visitCount=this.visitCount+1};function U(e,t){return e[0]*t[1]-e[1]*t[0]}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function q(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1]]}function z(e,t,n){var r=[e.p2.p[0]-e.p1.p[0],e.p2.p[1]-e.p1.p[1]],i=[t.p2.p[0]-t.p1.p[0],t.p2.p[1]-t.p1.p[1]],o=[t.p1.p[0]-e.p1.p[0],t.p1.p[1]-e.p1.p[1]],a=U(r,i),u=a*a,l=H(r,r);if(u>0){var s=U(o,i)/a;if(s<0||s>1)return null;var c=U(o,r)/a;return c<0||c>1?null:0===s||1===s?n?null:[q(e.p1.p,s,r)]:0===c||1===c?n?null:[q(t.p1.p,c,i)]:[q(e.p1.p,s,r)]}var f=H(o,o);if((u=(a=U(o,r))*a)>1e-9*l*f)return null;var p=H(r,o)/l,d=p+H(r,i)/l,h=Math.min(p,d),y=Math.max(p,d);return h<=1&&y>=0?1===h?n?null:[q(e.p1.p,h>0?h:0,r)]:0===y?n?null:[q(e.p1.p,y<1?y:1,r)]:n&&0===h&&1===y?null:[q(e.p1.p,h>0?h:0,r),q(e.p1.p,y<1?y:1,r)]:null}function W(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.polygonContourId===t)return r}}function Y(e,t){return t.find(function(t){return t.id===e.polygonContourId}).rawCoords}function $(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(_(e[0],[r[0]]))return void r.push(e)}t.push([e])}function X(e,t){var n=e.polygonEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}return n.intersectionPoints[0].incrementVisitCount(),t.push(n.intersectionPoints[0].p),n.intersectionPoints[0]}function K(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return null}function Z(e,t){var n=e.polylineEdge;if(2===n.intersectionPoints.length){var r=n.intersectionPoints[n.intersectionPoints.length-1];if(r===e){var i=n.intersectionPoints[0];return t.push(i.p),i.incrementVisitCount(),i}return t.push(r.p),r.incrementVisitCount(),r}if(n.intersectionPoints.length>2&&n.intersectionPoints[0]!==e){var o=K(e,n.intersectionPoints),a=n.intersectionPoints[o-1];return t.push(a.p),a.incrementVisitCount(),a}for(var u=!0;u;){if(t.push(n.p1.p),void 0===(n=n.prevEdge).originalIndex)return e;n.intersectionPoints.length>0&&(u=!1)}if(void 0===n.originalIndex)return e;var l=n.intersectionPoints[n.intersectionPoints.length-1];return l.incrementVisitCount(),t.push(l.p),l}function J(e,t){var n=e.polylineEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),i=n.intersectionPoints[r+1];return t.push(i.p),i.incrementVisitCount(),i}for(var o=!0;o;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(o=!1)}if(void 0===n)return e;var a=n.intersectionPoints[0];return a.incrementVisitCount(),t.push(a.p),a}var Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ee=Math.ceil,te=Math.floor,ne="[BigNumber Error] ",re=ne+"Number primitive has more than 15 significant digits: ",ie=1e14,oe=14,ae=9007199254740991,ue=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],le=1e7,se=1e9;function ce(e){var t=0|e;return e>0||e===t?t:t-1}function fe(e){for(var t,n,r=1,i=e.length,o=e[0]+"";r<i;){for(t=e[r++]+"",n=oe-t.length;n--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function pe(e,t){var n,r,i=e.c,o=t.c,a=e.s,u=t.s,l=e.e,s=t.e;if(!a||!u)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-u:a;if(a!=u)return a;if(n=a<0,r=l==s,!i||!o)return r?0:!i^n?1:-1;if(!r)return l>s^n?1:-1;for(u=(l=i.length)<(s=o.length)?l:s,a=0;a<u;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return l==s?0:l>s^n?1:-1}function de(e,t,n,r){if(e<t||e>n||e!==te(e))throw Error(ne+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function he(e){var t=e.c.length-1;return ce(e.e/oe)==t&&e.c[t]%2!=0}function ye(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ge(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ve=function e(t){var n,r,i,o,a,u,l,s,c,f,p=_.prototype={constructor:_,toString:null,valueOf:null},d=new _(1),h=20,y=4,g=-7,v=21,m=-1e7,b=1e7,S=!1,w=1,E=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function _(e,t){var n,o,a,u,l,s,c,f,p=this;if(!(p instanceof _))return new _(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>b?p.c=p.e=null:e.e<m?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,l=e;l>=10;l/=10,u++);return void(u>b?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!Q.test(f=String(e)))return i(p,f,s);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(l=f.search(/e/i))>0?(u<0&&(u=l),u+=+f.slice(l+1),f=f.substring(0,l)):u<0&&(u=f.length)}else{if(de(t,2,O.length,"Base"),10==t&&x)return C(p=new _(e),h+p.e+1,y);if(f=String(e),s="number"==typeof e){if(0*e!=0)return i(p,f,s,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,_.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(re+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=O.slice(0,t),u=l=0,c=f.length;l<c;l++)if(n.indexOf(o=f.charAt(l))<0){if("."==o){if(l>u){u=c;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,l=-1,u=0;continue}return i(p,String(e),s,t)}s=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(l=0;48===f.charCodeAt(l);l++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(l,++c)){if(c-=l,s&&_.DEBUG&&c>15&&(e>ae||e!==te(e)))throw Error(re+p.s*e);if((u=u-l-1)>b)p.c=p.e=null;else if(u<m)p.c=[p.e=0];else{if(p.e=u,p.c=[],l=(u+1)%oe,u<0&&(l+=oe),l<c){for(l&&p.c.push(+f.slice(0,l)),c-=oe;l<c;)p.c.push(+f.slice(l,l+=oe));l=oe-(f=f.slice(l)).length}else l-=c;for(;l--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function A(e,t,n,r){var i,o,a,u,l;if(null==n?n=y:de(n,0,8),!e.c)return e.toString();if(i=e.c[0],a=e.e,null==t)l=fe(e.c),l=1==r||2==r&&(a<=g||a>=v)?ye(l,a):ge(l,a,"0");else if(o=(e=C(new _(e),t,n)).e,u=(l=fe(e.c)).length,1==r||2==r&&(t<=o||o<=g)){for(;u<t;l+="0",u++);l=ye(l,o)}else if(t-=a+(2===r&&o>a),l=ge(l,o,"0"),o+1>u){if(--t>0)for(l+=".";t--;l+="0");}else if((t+=o-u)>0)for(o+1==u&&(l+=".");t--;l+="0");return e.s<0&&i?"-"+l:l}function T(e,t){for(var n,r,i=1,o=new _(e[0]);i<e.length;i++)(!(r=new _(e[i])).s||(n=pe(o,r))===t||0===n&&o.s===t)&&(o=r);return o}function j(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*oe-1)>b?e.c=e.e=null:n<m?e.c=[e.e=0]:(e.e=n,e.c=t),e}function C(e,t,n,r){var i,o,a,u,l,s,c,f=e.c,p=ue;if(f){e:{for(i=1,u=f[0];u>=10;u/=10,i++);if((o=t-i)<0)o+=oe,a=t,l=f[s=0],c=te(l/p[i-a-1]%10);else if((s=ee((o+1)/oe))>=f.length){if(!r)break e;for(;f.length<=s;f.push(0));l=c=0,i=1,a=(o%=oe)-oe+1}else{for(l=u=f[s],i=1;u>=10;u/=10,i++);c=(a=(o%=oe)-oe+i)<0?0:te(l/p[i-a-1]%10)}if(r=r||t<0||null!=f[s+1]||(a<0?l:l%p[i-a-1]),r=n<4?(c||r)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||r||6==n&&(o>0?a>0?l/p[i-a]:0:f[s-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,r?(t-=e.e+1,f[0]=p[(oe-t%oe)%oe],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=s,u=1,s--):(f.length=s+1,u=p[oe-o],f[s]=a>0?te(l/p[i-a]%p[a])*u:0),r)for(;;){if(0==s){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);o!=u&&(e.e++,f[0]==ie&&(f[0]=1));break}if(f[s]+=u,f[s]!=ie)break;f[s--]=0,u=1}for(o=f.length;0===f[--o];f.pop());}e.e>b?e.c=e.e=null:e.e<m&&(e.c=[e.e=0])}return e}function k(e){var t,n=e.e;return null===n?e.toString():(t=fe(e.c),t=n<=g||n>=v?ye(t,n):ge(t,n,"0"),e.s<0?"-"+t:t)}return _.clone=e,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(ne+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(de(n=e[t],0,se,t),h=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(de(n=e[t],0,8,t),y=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(de(n[0],-se,0,t),de(n[1],0,se,t),g=n[0],v=n[1]):(de(n,-se,se,t),g=-(v=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)de(n[0],-se,-1,t),de(n[1],1,se,t),m=n[0],b=n[1];else{if(de(n,-se,se,t),!n)throw Error(ne+t+" cannot be zero: "+n);m=-(b=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(ne+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw S=!n,Error(ne+"crypto unavailable");S=n}else S=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(de(n=e[t],0,9,t),w=n),e.hasOwnProperty(t="POW_PRECISION")&&(de(n=e[t],0,se,t),E=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(ne+t+" not an object: "+n);P=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(ne+t+" invalid: "+n);x="0123456789"==n.slice(0,10),O=n}}return{DECIMAL_PLACES:h,ROUNDING_MODE:y,EXPONENTIAL_AT:[g,v],RANGE:[m,b],CRYPTO:S,MODULO_MODE:w,POW_PRECISION:E,FORMAT:P,ALPHABET:O}},_.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!_.DEBUG)return!0;var t,n,r=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===o||-1===o)&&i>=-se&&i<=se&&i===te(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%oe)<1&&(t+=oe),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=ie||n!==te(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(ne+"Invalid BigNumber: "+e)},_.maximum=_.max=function(){return T(arguments,-1)},_.minimum=_.min=function(){return T(arguments,1)},_.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return te(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,u=0,l=[],s=new _(d);if(null==e?e=h:de(e,0,se),i=ee(e/oe),S)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));u<i;)(o=131072*t[u]+(t[u+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(l.push(o%1e14),u+=2);u=i/2}else{if(!crypto.randomBytes)throw S=!1,Error(ne+"crypto unavailable");for(t=crypto.randomBytes(i*=7);u<i;)(o=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(l.push(o%1e14),u+=7);u=i/7}if(!S)for(;u<i;)(o=a())<9e15&&(l[u++]=o%1e14);for(i=l[--u],e%=oe,i&&e&&(o=ue[oe-e],l[u]=te(i/o)*o);0===l[u];l.pop(),u--);if(u<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=oe);for(u=1,o=l[0];o>=10;o/=10,u++);u<oe&&(r-=oe-u)}return s.e=r,s.c=l,s}),_.sum=function(){for(var e=1,t=arguments,n=new _(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var i,o,a=[0],u=0,l=e.length;u<l;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(u++)),i=0;i<a.length;i++)a[i]>n-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,o,a,u){var l,s,c,f,p,d,g,v,m=r.indexOf("."),b=h,S=y;for(m>=0&&(f=E,E=0,r=r.replace(".",""),d=(v=new _(i)).pow(r.length-m),E=f,v.c=t(ge(fe(d.c),d.e,"0"),10,o,e),v.e=v.c.length),c=f=(g=t(r,i,o,u?(l=O,e):(l=e,O))).length;0==g[--f];g.pop());if(!g[0])return l.charAt(0);if(m<0?--c:(d.c=g,d.e=c,d.s=a,g=(d=n(d,v,b,S,o)).c,p=d.r,c=d.e),m=g[s=c+b+1],f=o/2,p=p||s<0||null!=g[s+1],p=S<4?(null!=m||p)&&(0==S||S==(d.s<0?3:2)):m>f||m==f&&(4==S||p||6==S&&1&g[s-1]||S==(d.s<0?8:7)),s<1||!g[0])r=p?ge(l.charAt(1),-b,l.charAt(0)):l.charAt(0);else{if(g.length=s,p)for(--o;++g[--s]>o;)g[s]=0,s||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(m=0,r="";m<=f;r+=l.charAt(g[m++]));r=ge(r,c,l.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,i,o,a,u=0,l=e.length,s=t%le,c=t/le|0;for(e=e.slice();l--;)u=((i=s*(o=e[l]%le)+(r=c*o+(a=e[l]/le|0)*s)%le*le+u)/n|0)+(r/le|0)+c*a,e[l]=i%n;return u&&(e=[u].concat(e)),e}function t(e,t,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;i<n;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,o,a,u){var l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O,x=r.s==i.s?1:-1,A=r.c,T=i.c;if(!(A&&A[0]&&T&&T[0]))return new _(r.s&&i.s&&(A?!T||A[0]!=T[0]:T)?A&&0==A[0]||!T?0*x:x/0:NaN);for(g=(y=new _(x)).c=[],x=o+(s=r.e-i.e)+1,u||(u=ie,s=ce(r.e/oe)-ce(i.e/oe),x=x/oe|0),c=0;T[c]==(A[c]||0);c++);if(T[c]>(A[c]||0)&&s--,x<0)g.push(1),f=!0;else{for(w=A.length,P=T.length,c=0,x+=2,(p=te(u/(T[0]+1)))>1&&(T=e(T,p,u),A=e(A,p,u),P=T.length,w=A.length),S=P,m=(v=A.slice(0,P)).length;m<P;v[m++]=0);O=T.slice(),O=[0].concat(O),E=T[0],T[1]>=u/2&&E++;do{if(p=0,(l=t(T,v,P,m))<0){if(b=v[0],P!=m&&(b=b*u+(v[1]||0)),(p=te(b/E))>1)for(p>=u&&(p=u-1),h=(d=e(T,p,u)).length,m=v.length;1==t(d,v,h,m);)p--,n(d,P<h?O:T,h,u),h=d.length,l=1;else 0==p&&(l=p=1),h=(d=T.slice()).length;if(h<m&&(d=[0].concat(d)),n(v,d,m,u),m=v.length,-1==l)for(;t(T,v,P,m)<1;)p++,n(v,P<m?O:T,m,u),m=v.length}else 0===l&&(p++,v=[0]);g[c++]=p,v[0]?v[m++]=A[S]||0:(v=[A[S]],m=1)}while((S++<w||null!=v[0])&&x--);f=null!=v[0],g[0]||g.splice(0,1)}if(u==ie){for(c=1,x=g[0];x>=10;x/=10,c++);C(y,o+(y.e=c+s*oe-1)+1,a,f)}else y.e=s,y.r=+f;return y}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,o=n?t:t.replace(f,"");if(c.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!n&&(o=o.replace(u,function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t}),r&&(i=r,o=o.replace(l,"$1").replace(s,"0.$1")),t!=o))return new _(o,i);if(_.DEBUG)throw Error(ne+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},p.absoluteValue=p.abs=function(){var e=new _(this);return e.s<0&&(e.s=1),e},p.comparedTo=function(e,t){return pe(this,new _(e,t))},p.decimalPlaces=p.dp=function(e,t){var n,r,i,o=this;if(null!=e)return de(e,0,se),null==t?t=y:de(t,0,8),C(new _(o),e+o.e+1,t);if(!(n=o.c))return null;if(r=((i=n.length-1)-ce(this.e/oe))*oe,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},p.dividedBy=p.div=function(e,t){return n(this,new _(e,t),h,y)},p.dividedToIntegerBy=p.idiv=function(e,t){return n(this,new _(e,t),0,1)},p.exponentiatedBy=p.pow=function(e,t){var n,r,i,o,a,u,l,s,c=this;if((e=new _(e)).c&&!e.isInteger())throw Error(ne+"Exponent not an integer: "+k(e));if(null!=t&&(t=new _(t)),a=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return s=new _(Math.pow(+k(c),a?e.s*(2-he(e)):+k(e))),t?s.mod(t):s;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new _(NaN);(r=!u&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||a&&c.c[1]>=24e7:c.c[0]<8e13||a&&c.c[0]<=9999975e7)))return o=c.s<0&&he(e)?-0:0,c.e>-1&&(o=1/o),new _(u?1/o:o);E&&(o=ee(E/oe+2))}for(a?(n=new _(.5),u&&(e.s=1),l=he(e)):l=(i=Math.abs(+k(e)))%2,s=new _(d);;){if(l){if(!(s=s.times(c)).c)break;o?s.c.length>o&&(s.c.length=o):r&&(s=s.mod(t))}if(i){if(0===(i=te(i/2)))break;l=i%2}else if(C(e=e.times(n),e.e+1,1),e.e>14)l=he(e);else{if(0===(i=+k(e)))break;l=i%2}c=c.times(c),o?c.c&&c.c.length>o&&(c.c.length=o):r&&(c=c.mod(t))}return r?s:(u&&(s=d.div(s)),t?s.mod(t):o?C(s,E,y,void 0):s)},p.integerValue=function(e){var t=new _(this);return null==e?e=y:de(e,0,8),C(t,t.e+1,e)},p.isEqualTo=p.eq=function(e,t){return 0===pe(this,new _(e,t))},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(e,t){return pe(this,new _(e,t))>0},p.isGreaterThanOrEqualTo=p.gte=function(e,t){return 1===(t=pe(this,new _(e,t)))||0===t},p.isInteger=function(){return!!this.c&&ce(this.e/oe)>this.c.length-2},p.isLessThan=p.lt=function(e,t){return pe(this,new _(e,t))<0},p.isLessThanOrEqualTo=p.lte=function(e,t){return-1===(t=pe(this,new _(e,t)))||0===t},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&0==this.c[0]},p.minus=function(e,t){var n,r,i,o,a=this,u=a.s;if(t=(e=new _(e,t)).s,!u||!t)return new _(NaN);if(u!=t)return e.s=-t,a.plus(e);var l=a.e/oe,s=e.e/oe,c=a.c,f=e.c;if(!l||!s){if(!c||!f)return c?(e.s=-t,e):new _(f?a:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new _(c[0]?a:3==y?-0:0)}if(l=ce(l),s=ce(s),c=c.slice(),u=l-s){for((o=u<0)?(u=-u,i=c):(s=l,i=f),i.reverse(),t=u;t--;i.push(0));i.reverse()}else for(r=(o=(u=c.length)<(t=f.length))?u:t,u=t=0;t<r;t++)if(c[t]!=f[t]){o=c[t]<f[t];break}if(o&&(i=c,c=f,f=i,e.s=-e.s),(t=(r=f.length)-(n=c.length))>0)for(;t--;c[n++]=0);for(t=ie-1;r>u;){if(c[--r]<f[r]){for(n=r;n&&!c[--n];c[n]=t);--c[n],c[r]+=ie}c[r]-=f[r]}for(;0==c[0];c.splice(0,1),--s);return c[0]?j(e,c,s):(e.s=3==y?-1:1,e.c=[e.e=0],e)},p.modulo=p.mod=function(e,t){var r,i,o=this;return e=new _(e,t),!o.c||!e.s||e.c&&!e.c[0]?new _(NaN):!e.c||o.c&&!o.c[0]?new _(o):(9==w?(i=e.s,e.s=1,r=n(o,e,0,3),e.s=i,r.s*=i):r=n(o,e,0,w),(e=o.minus(r.times(e))).c[0]||1!=w||(e.s=o.s),e)},p.multipliedBy=p.times=function(e,t){var n,r,i,o,a,u,l,s,c,f,p,d,h,y,g,v=this,m=v.c,b=(e=new _(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!v.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=v.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=ce(v.e/oe)+ce(e.e/oe),e.s*=v.s,(l=m.length)<(f=b.length)&&(h=m,m=b,b=h,i=l,l=f,f=i),i=l+f,h=[];i--;h.push(0));for(y=ie,g=le,i=f;--i>=0;){for(n=0,p=b[i]%g,d=b[i]/g|0,o=i+(a=l);o>i;)n=((s=p*(s=m[--a]%g)+(u=d*s+(c=m[a]/g|0)*p)%g*g+h[o]+n)/y|0)+(u/g|0)+d*c,h[o--]=s%y;h[o]=n}return n?++r:h.splice(0,1),j(e,h,r)},p.negated=function(){var e=new _(this);return e.s=-e.s||null,e},p.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new _(e,t)).s,!i||!t)return new _(NaN);if(i!=t)return e.s=-t,r.minus(e);var o=r.e/oe,a=e.e/oe,u=r.c,l=e.c;if(!o||!a){if(!u||!l)return new _(i/0);if(!u[0]||!l[0])return l[0]?e:new _(u[0]?r:0*i)}if(o=ce(o),a=ce(a),u=u.slice(),i=o-a){for(i>0?(a=o,n=l):(i=-i,n=u),n.reverse();i--;n.push(0));n.reverse()}for((i=u.length)-(t=l.length)<0&&(n=l,l=u,u=n,t=i),i=0;t;)i=(u[--t]=u[t]+l[t]+i)/ie|0,u[t]=ie===u[t]?0:u[t]%ie;return i&&(u=[i].concat(u),++a),j(e,u,a)},p.precision=p.sd=function(e,t){var n,r,i,o=this;if(null!=e&&e!==!!e)return de(e,1,se),null==t?t=y:de(t,0,8),C(new _(o),e,t);if(!(n=o.c))return null;if(r=(i=n.length-1)*oe+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&o.e+1>r&&(r=o.e+1),r},p.shiftedBy=function(e){return de(e,-9007199254740991,ae),this.times("1e"+e)},p.squareRoot=p.sqrt=function(){var e,t,r,i,o,a=this,u=a.c,l=a.s,s=a.e,c=h+4,f=new _("0.5");if(1!==l||!u||!u[0])return new _(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(l=Math.sqrt(+k(a)))||l==1/0?(((t=fe(u)).length+s)%2==0&&(t+="0"),l=Math.sqrt(+t),s=ce((s+1)/2)-(s<0||s%2),r=new _(t=l==1/0?"5e"+s:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+s)):r=new _(l+""),r.c[0])for((l=(s=r.e)+c)<3&&(l=0);;)if(o=r,r=f.times(o.plus(n(a,o,c,1))),fe(o.c).slice(0,l)===(t=fe(r.c)).slice(0,l)){if(r.e<s&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(C(r,r.e+h+2,1),e=!r.times(r).eq(a));break}if(!i&&(C(o,o.e+h+2,0),o.times(o).eq(a))){r=o;break}c+=4,l+=4,i=1}return C(r,r.e+h+1,y,e)},p.toExponential=function(e,t){return null!=e&&(de(e,0,se),e++),A(this,e,t,1)},p.toFixed=function(e,t){return null!=e&&(de(e,0,se),e=e+this.e+1),A(this,e,t)},p.toFormat=function(e,t,n){var r,i=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=P;else if("object"!=typeof n)throw Error(ne+"Argument not an object: "+n);if(r=i.toFixed(e,t),i.c){var o,a=r.split("."),u=+n.groupSize,l=+n.secondaryGroupSize,s=n.groupSeparator||"",c=a[0],f=a[1],p=i.s<0,d=p?c.slice(1):c,h=d.length;if(l&&(o=u,u=l,l=o,h-=o),u>0&&h>0){for(o=h%u||u,c=d.substr(0,o);o<h;o+=u)c+=s+d.substr(o,u);l>0&&(c+=s+d.slice(o)),p&&(c="-"+c)}r=f?c+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):c}return(n.prefix||"")+r+(n.suffix||"")},p.toFraction=function(e){var t,r,i,o,a,u,l,s,c,f,p,h,g=this,v=g.c;if(null!=e&&(!(l=new _(e)).isInteger()&&(l.c||1!==l.s)||l.lt(d)))throw Error(ne+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+k(l));if(!v)return new _(g);for(t=new _(d),c=r=new _(d),i=s=new _(d),h=fe(v),a=t.e=h.length-g.e-1,t.c[0]=ue[(u=a%oe)<0?oe+u:u],e=!e||l.comparedTo(t)>0?a>0?t:c:l,u=b,b=1/0,l=new _(h),s.c[0]=0;f=n(l,t,0,1),1!=(o=r.plus(f.times(i))).comparedTo(e);)r=i,i=o,c=s.plus(f.times(o=c)),s=o,t=l.minus(f.times(o=t)),l=o;return o=n(e.minus(r),i,0,1),s=s.plus(o.times(c)),r=r.plus(o.times(i)),s.s=c.s=g.s,p=n(c,i,a*=2,y).minus(g).abs().comparedTo(n(s,r,a,y).minus(g).abs())<1?[c,i]:[s,r],b=u,p},p.toNumber=function(){return+k(this)},p.toPrecision=function(e,t){return null!=e&&de(e,1,se),A(this,e,t,2)},p.toString=function(e){var t,n=this,i=n.s,o=n.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=g||o>=v?ye(fe(n.c),o):ge(fe(n.c),o,"0"):10===e&&x?t=ge(fe((n=C(new _(n),h+o+1,y)).c),n.e,"0"):(de(e,2,O.length,"Base"),t=r(ge(fe(n.c),o,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},p.valueOf=p.toJSON=function(){return k(this)},p._isBigNumber=!0,p[Symbol.toStringTag]="BigNumber",p[Symbol.for("nodejs.util.inspect.custom")]=p.valueOf,null!=t&&_.set(t),_}(),me=ve,be=class{key;left=null;right=null;constructor(e){this.key=e}},Se=class extends be{constructor(e){super(e)}},we=class{size=0;modificationCount=0;splayCount=0;splay(e){const t=this.root;if(null==t)return this.compare(e,e),-1;let n=null,r=null,i=null,o=null,a=t;const u=this.compare;let l;for(;;)if(l=u(a.key,e),l>0){let t=a.left;if(null==t)break;if(l=u(t.key,e),l>0&&(a.left=t.right,t.right=a,a=t,t=a.left,null==t))break;null==n?r=a:n.left=a,n=a,a=t}else{if(!(l<0))break;{let t=a.right;if(null==t)break;if(l=u(t.key,e),l<0&&(a.right=t.left,t.left=a,a=t,t=a.right,null==t))break;null==i?o=a:i.right=a,i=a,a=t}}return null!=i&&(i.right=a.left,a.left=o),null!=n&&(n.left=a.right,a.right=r),this.root!==a&&(this.root=a,this.splayCount++),l}splayMin(e){let t=e,n=t.left;for(;null!=n;){const e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;null!=n;){const e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(null==this.root)return null;if(0!=this.splay(e))return null;let t=this.root;const n=t,r=t.left;if(this.size--,null==r)this.root=t.right;else{const e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;const n=this.root;null!=n?(t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e):this.root=e}_first(){const e=this.root;return null==e?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return null==e?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&0==this.splay(e)}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},Ee=(Symbol.iterator,Symbol.toStringTag,class e extends we{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>null!=e&&null!=e)}delete(e){return!!this.validKey(e)&&null!=this._delete(e)}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this}addAndReturn(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return null==this.root}isNotEmpty(){return null!=this.root}single(){if(0==this.size)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(0==this.size)throw"Bad state: No element";return this._first().key}last(){if(0==this.size)throw"Bad state: No element";return this._last().key}lastBefore(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(null==t)return null;let n=t.right;for(;null!=n;)t=n,n=t.right;return t.key}firstAfter(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(null==t)return null;let n=t.left;for(;null!=n;)t=n,n=t.left;return t.key}retainAll(t){const n=new e(this.compare,this.validKey),r=this.modificationCount;for(const e of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(e)&&0==this.splay(e)&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return this.validKey(e)?0!=this.splay(e)?null:this.root.key:null}intersection(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)&&n.add(e);return n}difference(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)||n.add(e);return n}union(e){const t=this.clone();return t.addAll(e),t}clone(){const t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(null==e)return null;const t=new Se(e.key);return function e(t,n){let r,i;do{if(r=t.left,i=t.right,null!=r){const t=new Se(r.key);n.left=t,e(r,t)}if(null!=i){const e=new Se(i.key);n.right=e,t=i,n=e}}while(null!=i)}(e,t),t}toSet(){return this.clone()}entries(){return new xe(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Oe(this.wrap())}[Symbol.toStringTag]="[object Set]"}),Pe=class{tree;path=new Array;modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;null!=e;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(null==this.modificationCount){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;null!=e;)this.path.push(e),e=e.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(null!=t){for(;null!=t;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Oe=class extends Pe{getValue(e){return e.key}},xe=class extends Pe{getValue(e){return[e.key,e.key]}},_e=e=>()=>e,Ae=e=>{const t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):_e(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function Te(e){const t=e?(t,n,r,i,o)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(o.minus(r).exponentiatedBy(2)).times(e)):_e(!1);return(e,n,r)=>{const i=e.x,o=e.y,a=r.x,u=r.y,l=o.minus(u).times(n.x.minus(a)).minus(i.minus(a).times(n.y.minus(u)));return t(l,i,o,a,u)?0:l.comparedTo(0)}}var je=e=>e,Ce=e=>{if(e){const t=new Ee(Ae(e)),n=new Ee(Ae(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new me(0),y:new me(0)}),i}return je},ke=e=>({set:e=>{Ie=ke(e)},reset:()=>ke(e),compare:Ae(e),snap:Ce(e),orient:Te(e)}),Ie=ke(),Me=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Le=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x;return{ll:{x:n,y:e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y},ur:{x:r,y:e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y}}},Re=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Ne=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),De=e=>Ne(e,e).sqrt(),Ge=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Re(i,r).div(De(i)).div(De(r))},Fe=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Ne(i,r).div(De(i)).div(De(r))},Ve=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Be=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ue=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){const r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:Ke.compare(t.segment,n.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(void 0===n.segment.consumedBy)for(let r=t+1;r<e;r++){const e=this.point.events[r];void 0===e.consumedBy&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){const t=new Map,n=n=>{const r=n.otherSE;t.set(n,{sine:Ge(this.point,e.point,r.point),cosine:Fe(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);const{sine:i,cosine:o}=t.get(e),{sine:a,cosine:u}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&a.isGreaterThanOrEqualTo(0)?o.isLessThan(u)?1:o.isGreaterThan(u)?-1:0:i.isLessThan(0)&&a.isLessThan(0)?o.isLessThan(u)?-1:o.isGreaterThan(u)?1:0:a.isLessThan(i)?-1:a.isGreaterThan(i)?1:0}}},He=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){const n=[];for(let r=0,i=t.length;r<i;r++){const i=t[r];if(!i.isInResult()||i.ringOut)continue;let o=null,a=i.leftSE,u=i.rightSE;const l=[a],s=a.point,c=[];for(;o=a,a=u,l.push(a),a.point!==s;)for(;;){const t=a.getAvailableLinkedEvents();if(0===t.length){const e=l[0].point,t=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(1===t.length){u=t[0].otherSE;break}let r=null;for(let e=0,t=c.length;e<t;e++)if(c[e].point===a.point){r=e;break}if(null!==r){const t=c.splice(r)[0],i=l.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}c.push({index:l.length,point:a.point});const i=a.getLeftmostComparator(o);u=t.sort(i)[0].otherSE;break}n.push(new e(l))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==Ie.orient(r,e,i)&&(t.push(r),e=r)}if(1===t.length)return null;const n=t[0],r=t[1];0===Ie.orient(n,e,r)&&t.shift(),t.push(t[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:t.length-1,a=this.isExteriorRing()?t.length:-1,u=[];for(let e=o;e!=a;e+=i)u.push([t[e].x.toNumber(),t[e].y.toNumber()]);return u}isExteriorRing(){if(void 0===this._isExteriorRing){const e=this.enclosingRing();this._isExteriorRing=!e||!e.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){const n=this.events[t];Ue.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},qe=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(null===e)return null;const t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}},ze=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getGeom();null!==n&&e.push(n)}return e}_composePolys(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new qe(r));else{const e=r.enclosingRing();e?.poly||t.push(new qe(e)),e?.poly?.addInterior(r)}}return t}},We=class{queue;tree;segments;constructor(e,t=Ke.compare){this.queue=e,this.tree=new Ee(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do{r=this.tree.lastBefore(r)}while(null!=r&&null!=r.consumedBy);do{i=this.tree.firstAfter(i)}while(null!=i&&null!=i.consumedBy);if(e.isLeft){let o=null;if(r){const e=r.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(o=e),!r.isAnEndpoint(e))){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let a=null;if(i){const e=i.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(a=e),!i.isAnEndpoint(e))){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(null!==o||null!==a){let e=null;e=null===o?a:null===a||Ue.comparePoints(o,a)<=0?o:a,this.queue.delete(t.rightSE),n.push(t.rightSE);const r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){const e=r.getIntersection(i);if(null!==e){if(!r.isAnEndpoint(e)){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){const t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);const n=e.rightSE;this.queue.delete(n);const r=e.split(t);return r.push(n),void 0===e.consumedBy&&this.tree.add(e),r}},Ye=new class{type;numMultiPolys;run(e,t,n){Ye.type=e;const r=[new Qe(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Qe(n[e],!1));if(Ye.numMultiPolys=r.length,"difference"===Ye.type){const e=r[0];let t=1;for(;t<r.length;)null!==Le(r[t].bbox,e.bbox)?t++:r.splice(t,1)}if("intersection"===Ye.type)for(let e=0,t=r.length;e<t;e++){const t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(null===Le(t.bbox,r[n].bbox))return[]}const i=new Ee(Ue.compare);for(let e=0,t=r.length;e<t;e++){const t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}const o=new We(i);let a=null;for(0!=i.size&&(a=i.first(),i.delete(a));a;){const e=o.process(a);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.add(n)}0!=i.size?(a=i.first(),i.delete(a)):a=null}Ie.reset();const u=He.factory(o.segments);return new ze(u).getGeom()}},$e=Ye,Xe=0,Ke=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,o=t.rightSE.point.x;if(o.isLessThan(n))return 1;if(i.isLessThan(r))return-1;const a=e.leftSE.point.y,u=t.leftSE.point.y,l=e.rightSE.point.y,s=t.rightSE.point.y;if(n.isLessThan(r)){if(u.isLessThan(a)&&u.isLessThan(l))return 1;if(u.isGreaterThan(a)&&u.isGreaterThan(l))return-1;const n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=t.comparePoint(e.rightSE.point);return 0!==r?r:-1}if(n.isGreaterThan(r)){if(a.isLessThan(u)&&a.isLessThan(s))return-1;if(a.isGreaterThan(u)&&a.isGreaterThan(s))return 1;const n=t.comparePoint(e.leftSE.point);if(0!==n)return n;const r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(a.isLessThan(u))return-1;if(a.isGreaterThan(u))return 1;if(i.isLessThan(o)){const n=t.comparePoint(e.rightSE.point);if(0!==n)return n}if(i.isGreaterThan(o)){const n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(o)){const e=l.minus(a),t=i.minus(n),c=s.minus(u),f=o.minus(r);if(e.isGreaterThan(t)&&c.isLessThan(f))return 1;if(e.isLessThan(t)&&c.isGreaterThan(f))return-1}return i.isGreaterThan(o)?1:i.isLessThan(o)||l.isLessThan(s)?-1:l.isGreaterThan(s)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Xe,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,o,a;const u=Ue.comparePoints(t,n);if(u<0)i=t,o=n,a=1;else{if(!(u>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);i=n,o=t,a=-1}const l=new Ue(i,!0),s=new Ue(o,!1);return new e(l,s,[r],[a])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Ie.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=Le(t,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,a=e.leftSE.point,u=e.rightSE.point,l=Me(t,a)&&0===this.comparePoint(a),s=Me(n,i)&&0===e.comparePoint(i),c=Me(t,u)&&0===this.comparePoint(u),f=Me(n,o)&&0===e.comparePoint(o);if(s&&l)return f&&!c?o:!f&&c?u:null;if(s)return c&&i.x.eq(u.x)&&i.y.eq(u.y)?null:i;if(l)return f&&o.x.eq(a.x)&&o.y.eq(a.y)?null:a;if(f&&c)return null;if(f)return o;if(c)return u;const p=((e,t,n,r)=>{if(t.x.isZero())return Be(n,r,e.x);if(r.x.isZero())return Be(e,t,n.x);if(t.y.isZero())return Ve(n,r,e.y);if(r.y.isZero())return Ve(e,t,n.y);const i=Re(t,r);if(i.isZero())return null;const o={x:n.x.minus(e.x),y:n.y.minus(e.y)},a=Re(o,t).div(i),u=Re(o,r).div(i),l=e.x.plus(u.times(t.x)),s=n.x.plus(a.times(r.x)),c=e.y.plus(u.times(t.y)),f=n.y.plus(a.times(r.y));return{x:l.plus(s).div(2),y:c.plus(f).div(2)}})(i,this.vector(),a,e.vector());return null===p?null:Me(r,p)?Ie.snap(p):null}split(t){const n=[],r=void 0!==t.events,i=new Ue(t,!0),o=new Ue(t,!1),a=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);const u=new e(i,a,this.rings.slice(),this.windings.slice());return Ue.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),Ue.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const i=e.compare(n,r);if(0!==i){if(i>0){const e=n;n=r,r=e}if(n.prev===r){const e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){const t=r.rings[e],i=r.windings[e],o=n.rings.indexOf(t);-1===o?(n.rings.push(t),n.windings.push(i)):n.windings[o]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){const r=this.rings[e],i=this.windings[e],o=t.indexOf(r);-1===o?(t.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let e=0,r=t.length;e<r;e++){if(0===n[e])continue;const r=t[e],a=r.poly;if(-1===o.indexOf(a))if(r.isExterior)i.push(a);else{-1===o.indexOf(a)&&o.push(a);const e=i.indexOf(r.poly);-1!==e&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){const t=i[e].multiPoly;-1===r.indexOf(t)&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($e.type){case"union":{const n=0===e.length,r=0===t.length;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===$e.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2==1;break}case"difference":{const n=e=>1===e.length&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Ze=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=Ie.snap({x:new me(e[0][0]),y:new me(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if("number"!=typeof e[t][0]||"number"!=typeof e[t][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const n=Ie.snap({x:new me(e[t][0]),y:new me(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(Ke.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}r.x.eq(i.x)&&r.y.eq(i.y)||this.segments.push(Ke.fromRing(i,r,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;t<n;t++){const n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Je=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ze(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){const n=new Ze(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){const n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Qe=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(e){}this.polys=[],this.bbox={ll:{x:new me(Number.POSITIVE_INFINITY),y:new me(Number.POSITIVE_INFINITY)},ur:{x:new me(Number.NEGATIVE_INFINITY),y:new me(Number.NEGATIVE_INFINITY)}};for(let t=0,n=e.length;t<n;t++){const n=new Je(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}};Ie.set;function et(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Math.PI;var tt=function(e,t={}){const n=[];if(function(e,t){var n,r,i,o,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,i=0;i<a;i++)if(null!==(o=l?u.geometries[i]:u))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(o,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===t(o.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,e=>{n.push(e.coordinates)}),n.length<2)throw new Error("Must have at least 2 geometries");const r=((e,...t)=>$e.run("union",e,t))(n[0],...n.slice(1));return 0===r.length?null:1===r.length?function(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:e},t,n)}(r[0],t.properties):function(e,t,n={}){return et({type:"MultiPolygon",coordinates:e},t,n)}(r,t.properties)},nt=n(278);function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,u=[],l=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=o.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,i=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw i}}return u}}(e,t)||lt(e,t)||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 ot(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ot(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=function(e,t){var n,r,i,o,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e.geometry.coordinates.map(function(e){return function(e){if(Array.isArray(e))return st(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||lt(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}),r=n.length-1,i=function(e,n){return[e[0]+(e[0]-n[0])*t,e[1]+(e[1]-n[1])*t]},o=i(n[0],n[1]),a=i(n[r],n[r-1]);return n[0]=o,n[r]=a,(0,nt.wi)(n)}(t);try{o=function(e,t){var n=[],r=[],i=[],o=function(e,t,n,r,i){for(var o=0,a=[],u="Feature"===t.type?t.geometry:t,l="LineString"===u.type?[u.coordinates]:u.coordinates,s=0,c=0;c<l.length;c++){for(var f=l[c].length-1,p=new D(l[c][0]),d=null,h={nextEdge:null},y=0;y<f;y++){d=new D(l[c][y+1]),p.nextPoint=d,d.prevPoint=p;var g=new N(p,d,"polyline",s,null);r.push(g),h.nextEdge=g,g.prevEdge=h,i[0]=Math.min(i[0],p.p[0]),i[1]=Math.min(i[1],p.p[1]),i[2]=Math.max(i[2],p.p[0]),i[3]=Math.max(i[3],p.p[1]),p=d,s+=1,h=g}i[0]=Math.min(i[0],l[c][f][0]),i[1]=Math.min(i[1],l[c][f][1]),i[2]=Math.max(i[2],l[c][f][0]),i[3]=Math.max(i[3],l[c][f][1])}for(var v="Feature"===e.type?e.geometry:e,m="Polygon"===v.type?[v.coordinates]:v.coordinates,b=m.length,S=0;S<b;S++)for(var w=m[S].length,E=0;E<w;E++){o+=1;var P=m[S][E],O=P.length;a.push(new G(o,P));for(var x=new D(P[0]),_=x,A=void 0,T=null,j={nextEdge:null,prevEdge:null},C=null,k=1;k<O;k++)A=new D(P[k]),_.nextPoint=A,A.prevPoint=_,T=new N(_,A,"polygon",s,o),j.nextEdge=T,T.prevEdge=j,1===k&&(C=T),E>0&&(T.interiorRing=!0),T.intersectPolylineBbox=F(T,i),n.push(T),_=A,s+=1,j=T;T.nextEdge=C,C.prevEdge=T,A.nextPoint=x.nextPoint,x.prevPoint=A.prevPoint}return a}(h(e),t,r,i,[1/0,1/0,1/0,1/0]);if(function(e,t,n){var r,i,o,a=t.length,u=e.length;for(r=0;r<a;r++){var l=t[r];for(i=0;i<u;i++){var s=e[i];if(s.intersectPolylineBbox&&!(s.maxX<l.minX||s.minX>l.maxX||s.maxY<l.minY||s.minY>l.maxY)){var c=z(l,s);if(null!==c)for(o=0;o<c.length;o++){var f=R(s.p1.p[0],s.p1.p[1],s.p2.p[0],s.p2.p[1],l.p1.p[0],l.p1.p[1]),p=new V(c[o],l,s,f>0);n.push(p)}}}}t.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolylineEdgeStart-t.distanceFromPolylineEdgeStart})}),e.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolygonEdgeStart-t.distanceFromPolygonEdgeStart})})}(r,i,n),0===n.length)return e;var a={};o.forEach(function(e){return a[e.id]=0}),n.forEach(function(e){var t=e.polygonEdge.polygonContourId;a[t]=a[t]+1});for(var u=0,l=[],s=null,c=0;c<i.length;c++){var f=i[c];if(f.intersectionPoints.length>0){s=f.intersectionPoints[0];break}}for(var p=s,d={visitCount:1};s!==d&&!(u>2*n.length);){if(u=u++,d.visitCount>=2){for(var y=!1,g=0;g<n.length;g++){var v=n[g];if(v.visitCount<2){p=v,y=!0;break}}if(!y)break}p.visitCount=p.visitCount+1;var m=[];l.push(m),m.push(p.p),p.visitCount=p.visitCount+1;var b=X(p,m),S=!1;if(b===(d=b)&&2===n.length)for(var w=0;w<n.length;w++)n[w].visitCount<2&&(S=!0);for(;b!==p||S;)(b=(b.isHeadingIn?J:Z)(b,m))!==p&&(b=X(b,m)),S=!1;if(d.visitCount>=2){for(var E=!1,P=0;P<n.length;P++){var O=n[P];if(O.visitCount<2){p=O,E=!0;break}}E&&(d=p)}p=d}for(var x=l.map(function(e){return[e]}),_=Object.keys(a),A=0;A<_.length;A++){var T=_[A];0===a[T]&&$(Y(W(r,parseInt(T)),o),x)}return{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:x}}}(e,a)}catch(e){return null}var u=[];if("MultiPolygon"!==o.geometry.type)return null;if(2!==o.geometry.coordinates.length)return null;u=o.geometry.coordinates.map(function(t){return(0,nt.n1)(t,e.properties)});var l=null!==(n=null!==(r=e.id)&&void 0!==r?r:null===(i=e.properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly",s=u.map(function(t,n){return(0,nt.n1)(t.geometry.coordinates,at(at({},e.properties),{},{id:l}),{id:"".concat(l,"-").concat(n+1)})});return(0,nt.Lr)(s)},ft=function(e){var t,n,r,i,o;try{o=tt((0,nt.Lr)(e))}catch(e){return null}if("Polygon"!==(null===(t=o)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type))return null;var a=null!==(n=null!==(r=e[0].id)&&void 0!==r?r:null===(i=e[0].properties)||void 0===i?void 0:i.id)&&void 0!==n?n:"poly";return(0,nt.n1)(o.geometry.coordinates,at(at({},e[0].properties),{},{id:a}),{id:a})},pt=function(e,t){var n=it(e,2),r=n[0],i=n[1],o=it(t,2),a=o[0],u=o[1],l=function(e){return e*Math.PI/180},s=l(u-i),c=l(a-r),f=Math.pow(Math.sin(s/2),2)+Math.cos(l(i))*Math.cos(l(u))*Math.pow(Math.sin(c/2),2);return 12742e3*Math.atan2(Math.sqrt(f),Math.sqrt(1-f))},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01;if(e.length<=1)return!0;var n=e[e.length-1],r=e[e.length-2];return pt(n,r)>=t},ht=function(e){return e[0].length<=1||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e[0];return n.length<=1||!(n.length<=3&&function(e,t){for(var n=0;n<e.length;n++)for(var r=n+1;r<e.length;r++)if(pt(e[n],e[r])<t)return!0;return!1}(n,t))}(e)}},59:function(e,t,n){n.d(t,{I:function(){return r}});var r=new Set(["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"])},9:function(e,t,n){n.d(t,{k7:function(){return P},n8:function(){return c},PH:function(){return E},Uv:function(){return x},J$:function(){return O}});var r=n(278),i=n(850);function o(e){let t=0;if(e&&e.length>0){t+=Math.abs(l(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(l(e[n]))}return t}var a=r.zX*r.zX/2,u=Math.PI/180;function l(e){const t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){const i=e[r],o=e[r+1===t?0:r+1],a=e[r+2>=t?(r+2)%t:r+2],l=i[0]*u,s=o[1]*u;n+=(a[0]*u-l)*Math.sin(s),r++}return n*a}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c={Polygon:3,LineString:2},f=function(e){var t;return null!==(t=null==e?void 0:e.geometry)&&void 0!==t?t:e},p=function(e){var t=f(e);return"Polygon"===(null==t?void 0:t.type)?t:null},d=function(e){for(var t,n,r=null!==(t=null===(n=e.coordinates)||void 0===n?void 0:n[0])&&void 0!==t?t:[],i=r.filter(function(e,t){return 0===t||e[0]!==r[t-1][0]||e[1]!==r[t-1][1]});i.length>1&&i[0][0]===i[i.length-1][0]&&i[0][1]===i[i.length-1][1];)i.pop();return i},h=function(e){return[].concat(function(e){if(Array.isArray(e))return s(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):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.")}(),[e[0]]);var t},y=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])},g=function(e,t){return e>0&&t<0||e<0&&t>0},v=function(e,t,n,r){return 0===e&&function(e,t,n){return Math.min(e[0],n[0])<=t[0]&&t[0]<=Math.max(e[0],n[0])&&Math.min(e[1],n[1])<=t[1]&&t[1]<=Math.max(e[1],n[1])}(t,n,r)},m=function(e,t,n,r){var i=y(n,r,e),o=y(n,r,t),a=y(e,t,n),u=y(e,t,r);return!(!g(i,o)||!g(a,u))||v(i,n,e,r)||v(o,n,t,r)||v(a,e,n,t)||v(u,e,r,t)},b=function(e,t){for(var n=e.length,r=t?n:n-1,i=0;i<r;i++)for(var o=i+1;o<r;o++)if(!(o===i+1||t&&0===i&&o===r-1)&&m(e[i],e[(i+1)%n],e[o],e[(o+1)%n]))return!0;return!1},S=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);return n.length<4?{valid:!0}:b(n,!0)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}},w=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);if(n.length<c.Polygon)return{valid:!0};var r,a=0;try{r={type:"Feature",geometry:{type:"Polygon",coordinates:[h(n)]},properties:{}},a=(0,i.jE)(r,(e,t)=>e+function(e){let t,n=0;switch(e.type){case"Polygon":return o(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)n+=o(e.coordinates[t]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}catch(e){return{valid:!0}}return a>0?{valid:!0}:{valid:!1,reason:"Shape must enclose an area"}},E={Polygon:"Shape needs at least 3 points",LineString:"Line needs at least 2 points"},P=[S,w,function(e){var t,n,r=f(e);return"Polygon"===(null==r?void 0:r.type)?d(r).length>=c.Polygon?{valid:!0}:{valid:!1,reason:E.Polygon}:"LineString"===(null==r?void 0:r.type)?(null!==(t=null===(n=r.coordinates)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>=c.LineString?{valid:!0}:{valid:!1,reason:E.LineString}:{valid:!0}}],O=[S,w],x=[function(e){return function(e){var t=p(e);if(!t)return!1;var n=d(t);return!(n.length<4)&&b(n,!1)}(e)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}}]},520:function(e,t,n){n.d(t,{$U:function(){return p},$b:function(){return g},Av:function(){return c},RQ:function(){return y},Uk:function(){return v},dV:function(){return h},g5:function(){return f},oK:function(){return d}});var r=n(9);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(e){if(void 0===e||!0===e)return{valid:!0};if(!1===e)return{valid:!1,reason:null};var t=e.valid,n=e.reason,r=e.announcement,i=e.recheckOnFinish,o=e.reopen,a=e.properties,u=!1!==t;return l(l(l(l({valid:u,reason:n},r&&{announcement:r}),i&&{recheckOnFinish:!0}),u&&o&&{reopen:!0}),u&&null!=a&&{properties:a})},f=function(e,t){return e.valid?e:l(l({},e),{},{source:t})},p=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=i.rules,u=void 0===a?r.k7:a,s=i.onGeometryPreview,p=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=o(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 i,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw i}}}}(u);try{for(p.s();!(t=p.n()).done;){var d=t.value,h=c(d(e,n));if(!h.valid)return f(h,"rules")}}catch(e){p.e(e)}finally{p.f()}return"function"==typeof s?f(c(s(l({feature:e},n))),"callback"):{valid:!0}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.rules,o=void 0===i?r.Uv:i,a=n.onGeometryPreview;return p(e,l(l({},t),{},{phase:"place"}),{rules:o,onGeometryPreview:a})},h={Polygon:"draw_polygon",LineString:"draw_line"},y=function(e,t,n){var r=t.reason,i=t.source,o=t.announcement,a=n.mode,u=n.vertexIndex;return l(l({feature:e,reason:null!=r?r:null,source:i},o&&{announcement:o}),{},{phase:"place",mode:a,vertexIndex:u})},g=function(e){var t,n=e.placed,r=e.point,i=e.geometryType,u=e.onGeometryPreview,l=[].concat(function(e){if(Array.isArray(e))return a(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||o(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.")}(),[r]),s={type:"Feature",geometry:"Polygon"===i?{type:"Polygon",coordinates:[l]}:{type:"LineString",coordinates:l},properties:{}},c=h[i],f=n.length,p=d(s,{mode:c,vertexIndex:f},{onGeometryPreview:u});return p.valid?{valid:!0}:{valid:!1,blocked:y(s,p,{mode:c,vertexIndex:f})}},v=function(e){var t,n,i,o,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=s.rules,f=void 0===c?r.J$:c,d=s.onGeometryPreview,h=null!==(t=null==e||null===(n=e.geometry)||void 0===n?void 0:n.type)&&void 0!==t?t:null==e?void 0:e.type,y=null!==(i=r.n8[h])&&void 0!==i?i:0,g=(null!==(o=u.numVertices)&&void 0!==o?o:0)<y?[]:f;return p(e,l(l({},u),{},{phase:null!==(a=u.phase)&&void 0!==a?a:"preview"}),{rules:g,onGeometryPreview:d})}},619:function(e,t,n){n.d(t,{v:function(){return i}});var r="[interactive-map]",i={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[r].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[r].concat(n))}}}}]);
2
+ "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[568],{278:function(e,t,n){n.d(t,{Et:function(){return d},Gf:function(){return c},Lr:function(){return s},n1:function(){return u},nv:function(){return f},tR:function(){return p},wi:function(){return l},zX:function(){return r},zx:function(){return a}});var r=6371008.8,o={centimeters:100*r,centimetres:100*r,degrees:360/(2*Math.PI),feet:3.28084*r,inches:39.37*r,kilometers:r/1e3,kilometres:r/1e3,meters:r,metres:r,miles:r/1609.344,millimeters:1e3*r,millimetres:1e3*r,nauticalmiles:r/1852,radians:1,yards:1.0936*r};function i(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function a(e,t,n={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(e[0])||!d(e[1]))throw new Error("coordinates must contain numbers");return i({type:"Point",coordinates:e},t,n)}function u(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return i({type:"Polygon",coordinates:e},t,n)}function l(e,t,n={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return i({type:"LineString",coordinates:e},t,n)}function s(e,t={}){const n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function c(e,t="kilometers"){const n=o[t];if(!n)throw new Error(t+" units is invalid");return e/n}function f(e){return e%(2*Math.PI)*180/Math.PI}function p(e){return e%360*Math.PI/180}function d(e){return!isNaN(e)&&null!==e&&!Array.isArray(e)}},850:function(e,t,n){function r(e,t,n){if(null!==e)for(var o,i,a,u,l,s,c,f,p=0,d=0,h=e.type,y="FeatureCollection"===h,g="Feature"===h,v=y?e.features.length:1,m=0;m<v;m++){l=(f=!!(c=y?e.features[m].geometry:g?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var b=0;b<l;b++){var S=0,w=0;if(null!==(u=f?c.geometries[b]:c)){s=u.coordinates;var E=u.type;switch(p=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===t(s,d,m,S,w))return!1;d++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<s.length;o++){if(!1===t(s[o],d,m,S,w))return!1;d++,"MultiPoint"===E&&S++}"LineString"===E&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<s.length;o++){for(i=0;i<s[o].length-p;i++){if(!1===t(s[o][i],d,m,S,w))return!1;d++}"MultiLineString"===E&&S++,"Polygon"===E&&w++}"Polygon"===E&&S++;break;case"MultiPolygon":for(o=0;o<s.length;o++){for(w=0,i=0;i<s[o].length;i++){for(a=0;a<s[o][i].length-p;a++){if(!1===t(s[o][i][a],d,m,S,w))return!1;d++}w++}S++}break;case"GeometryCollection":for(o=0;o<u.geometries.length;o++)if(!1===r(u.geometries[o],t,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function o(e,t,n){var r=n;return function(e,t){var n,r,o,i,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,o=0;o<a;o++)if(null!==(i=l?u.geometries[o]:u))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(i,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<i.geometries.length;r++)if(!1===t(i.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,function(e,o,i,a,u){r=0===o&&void 0===n?e:t(r,e,o,i,a,u)}),r}n.d(t,{Fh:function(){return r},jE:function(){return o}})},360:function(e,t,n){n.d(t,{P:function(){return r},k:function(){return o}});var r="change",o={CREATE:"create",EDIT_FINISH:"editfinish",CANCEL:"cancel",VERTEX_SELECTION:"vertexselection",VERTEX_CHANGE:"vertexchange",UNDO_CHANGE:"undochange",UPDATE:"update",GEOMETRY_CHANGE:"geometrychange",INTERFACE_TYPE_CHANGE:"interfacetypechange",PLACEMENT_BLOCKED:"placementblocked",VALIDITY_CHANGE:"validitychange",CAN_PLACE_CHANGE:"canplacechange"}},682:function(e,t,n){n.d(t,{F0:function(){return l},V3:function(){return p},WQ:function(){return f},jg:function(){return c},lm:function(){return u},vf:function(){return s}});var r="rgba(29,112,184,1)",o="#ffffff",i="rgba(11,12,12,1)",a="rgba(212,53,28,0.5)",u={editStroke:{light:r,dark:o},editFill:{light:"rgba(29,112,184,0.1)",dark:"rgba(255,255,255,0.1)"},editVertex:{light:r,dark:o},editMidpoint:{light:r,dark:o},editHalo:{light:o,dark:i},editActive:{light:i,dark:o},splitInvalid:{light:r,dark:o},splitValid:{light:r,dark:o},invalidStroke:{light:r,dark:o},shapeStroke:"rgba(212,53,28,1)",shapeFill:a,snapVertex:a,snapMidpoint:"rgba(40,161,151,1)",snapEdge:"rgba(29,112,184,0.5)"},l={strokeWidth:2,vertexRadius:6,midpointRadius:4,vertexHaloRadius:8,midpointHaloRadius:6,touchTargetSize:48,touchIndicatorRadius:30},s={snapRadius:12},c="Zoom in to use snap",f={nudgeAmount:1,stepAmount:5},p="draw"},579:function(e,t,n){n.r(t),n.d(t,{manifest:function(){return At}});var r=new Set(["draw_polygon","draw_line"]),o=new Set(["draw_polygon","draw_line","draw_point"]),i=new Set(["edit_vertex","edit_point"]),a=new Set(["draw_polygon","draw_line","edit_vertex","edit_point"]),u=new Set(["draw_polygon","draw_line","draw_point","edit_vertex","edit_point"]),l=function(e){return r.has(e)},s=function(e){return o.has(e)},c=function(e){return i.has(e)},f=function(e){return a.has(e)};function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(e,t,n){return(t=function(e){var t=function(e){if("object"!=p(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==p(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var g={SET_MODE:function(e,t){return h(h({},e),{},{mode:t,numVertices:l(t)?0:e.numVertices,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0})},SET_ACTION:function(e,t){return h(h({},e),{},{action:t.name,actionValid:t.isValid})},SET_FEATURE:function(e,t){return h(h({},e),{},{feature:void 0===t.feature?e.feature:t.feature,tempFeature:void 0===t.tempFeature?e.tempFeature:t.tempFeature})},SET_SELECTED_VERTEX_INDEX:function(e,t){return h(h({},e),{},{selectedVertexIndex:t.index,numVertices:t.numVertices})},TOGGLE_SNAP:function(e){return h(h({},e),{},{snap:!e.snap})},SET_HAS_SNAP_LAYERS:function(e,t){return h(h({},e),{},{hasSnapLayers:!!t})},SET_UNDO_STACK_LENGTH:function(e,t){return h(h({},e),{},{undoStackLength:t})},SET_VALIDATION_STATUS:function(e,t){return h(h({},e),{},{validationStatus:t,checkSlow:!1})},SET_CAN_FINISH:function(e,t){return h(h({},e),{},{canFinish:!!t})},SET_CHECK_SLOW:function(e){return h(h({},e),{},{checkSlow:!0})},SET_HOLDING:function(e,t){return h(h({},e),{},{holding:!!t})},SET_PREVIEW_VALID:function(e,t){return h(h({},e),{},{previewValid:!!t})},SET_CAN_ADD_POINT:function(e,t){return h(h({},e),{},{canAddPoint:!!t})}},v=n(738),m={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function b(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return S(s,"_invoke",function(n,r,o){var i,u,l,s=0,c=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!o&&t<c.length;t++){var o,i=c[t],d=p.p,h=i[2];n>3?(o=h===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,p.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){i||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(S(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,S(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,S(f,"constructor",s),S(s,"constructor",l),l.displayName="GeneratorFunction",S(s,o,"GeneratorFunction"),S(f),S(f,o,"Generator"),S(f,r,function(){return this}),S(f,"toString",function(){return"[object Generator]"}),(b=function(){return{w:i,m:p}})()}function S(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}S=function(e,t,n,r){function i(t,n){S(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},S(e,t,n,r)}function w(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}var E=function(){var e,t=(e=b().m(function e(t,r){var o,i,a,u,l;return b().w(function(e){for(;;)switch(e.n){case 0:l=t.name,e.n="MapLibreProvider"===l?1:"OpenLayersProvider"===l?3:5;break;case 1:return e.n=2,n.e(356).then(n.bind(n,960));case 2:return o=e.v,i=o.MaplibreDrawAdapter,e.a(2,new i(t,r));case 3:return e.n=4,n.e(722).then(n.bind(n,356));case 4:return a=e.v,u=a.OLDrawAdapter,e.a(2,new u(t,r));case 5:throw new Error('No draw adapter available for map provider "'.concat(t.name,'"'));case 6:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){w(i,r,o,a,u,"next",e)}function u(e){w(i,r,o,a,u,"throw",e)}a(void 0)})});return function(e,n){return t.apply(this,arguments)}}(),P=n(360),O=n(520),x=n(9),_=n(619),A=n(59);function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return(t=function(e){var t=function(e){if("object"!=T(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=T(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==T(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||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 M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e){return"sortKey"===e||e.startsWith("symbol")&&!A.I.has(e)},R=function(e){if(null==e||!e.properties)return e;for(var t={},n=0,r=Object.entries(e.properties);n<r.length;n++){var o=I(r[n],2),i=o[0],a=o[1];L(i)||(t[i]=a)}return C(C({},e),{},{properties:t})};function N(e){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},N(e)}function D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?D(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F(e,t,n){return(t=function(e){var t=function(e){if("object"!=N(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=N(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==N(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var V={revision:0,status:"idle",result:null,feature:null,context:null,slow:!1,afterPending:!1,lastResultStatus:null},B=function(e){return e.valid?"valid":"invalid"},U=new Set(["invalid","error"]),H=new WeakMap,q=function(e){var t,n,r,o,i,a,u,l,s,c=H.get(e);return c||(t=0,n=null,r=null,o=null,i=V,a=null,u=null,l=function(){var e;null===(e=o)||void 0===e||e.abort(),o=null,clearTimeout(r)},s=function(e,u){var l,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).fromCallback;if(e===t){var c=void 0!==s&&s?u.status:i.lastResultStatus;"pending"!==u.status&&(o=null,clearTimeout(r));var f=!!u.slow,p="pending"!==u.status&&n===e;n=f?e:null,i=G(G({},u),{},{revision:e,slow:f,afterPending:p,lastResultStatus:c}),null===(l=a)||void 0===l||l(i)}},c={get state(){return i},setOnSettle:function(e){a=e},get heldId(){var e;return(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0},hold:function(e){u={id:e,revision:t}},release:function(){u=null},run:function(e){var n=e.feature,i=e.context,a=e.consumerCheck,u=e.rules,c=void 0===u?x.k7:u;l();var f=++t,p={feature:n,context:i},d=(0,O.$U)(n,i,{rules:c});if(d.valid&&"function"==typeof a){o=new AbortController;var h,y=function(e){f===t&&(_.v.warn("[draw] geometry check failed (".concat(null==i?void 0:i.phase,")"),e),s(f,G(G({},p),{},{status:"error",result:{valid:!1,reason:null,source:"callback"},error:e}),{fromCallback:!0}))};try{h=a(G({feature:n},i),{signal:o.signal,revision:f})}catch(e){return void y(e)}var g,v=function(e){var t=(0,O.g5)((0,O.Av)(e),"callback");s(f,G(G({},p),{},{status:B(t),result:t}),{fromCallback:!0})};"function"==typeof(null==(g=h)?void 0:g.then)?(s(f,G(G({},p),{},{status:"pending",result:null})),r=setTimeout(function(){return s(f,G(G({},p),{},{status:"pending",result:null,slow:!0}))},300),h.then(v,y)):v(h)}else s(f,G(G({},p),{},{status:B(d),result:d}))},reset:function(){var e,n=(null===(e=u)||void 0===e?void 0:e.revision)===t?u.id:void 0;return l(),t++,i=V,u=null,n}},H.set(e,c)),c},z=function(e){var t=e[0],n=e[e.length-1];return e.length>1&&t[0]===n[0]&&t[1]===n[1]?e.slice(0,-1):e},W=function(e){return"Polygon"===e.type?e.coordinates.map(z):e.coordinates},Y=function(e,t){var n=null==e?void 0:e.geometry,r=null==t?void 0:t.geometry;return!(!n||!r||n.type!==r.type)&&JSON.stringify(W(n))===JSON.stringify(W(r))},$=function(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e._previewValidator=null!==(t=o.onGeometryPreview)&&void 0!==t?t:i.onGeometryPreview,e._commitValidator=null!==(n=o.onGeometryChange)&&void 0!==n?n:i.onGeometryChange,e._finishValidator=null!==(r=o.onGeometryFinish)&&void 0!==r?r:i.onGeometryFinish;var u=q(e).reset();if(void 0!==u){var l=e.get(u);e.delete(u),null==a||a.emit("draw:cancelled",R(l))}},X=n(652),K=n(491);function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return J(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?J(e,t):void 0}}(e,t)||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 J(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Q=function(e,t,n,r){var o=r.caller,i=r.styleIds,a=void 0===i?[]:i;if(null==n)return{};if(!(0,K.Q)(n))return _.v.warn("".concat(o,": ignoring properties that aren't a plain object"),n),{};for(var u={},l=[],s=0,c=Object.entries((0,X.Uv)(n));s<c.length;s++){var f=Z(c[s],2),p=f[0],d=f[1];L(p)||(0,X.TI)(p,a)?l.push(p):u[p]=d}return l.length&&_.v.warn("".concat(o,": ignoring internal and style properties — use setStyle for style"),l),Object.keys(u).length&&e.setProperties(t,u),u};function ee(e){return ee="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ee(e)}var te=["announcement"];function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach(function(t){oe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function oe(e,t,n){return(t=function(e){var t=function(e){if("object"!=ee(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ee(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ee(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ie="draw:created",ae=new WeakMap,ue=new WeakMap,le=new Set(["create","edit-finish"]),se=function(e,t){var n=t.result,r=t.context;return!(le.has(null==r?void 0:r.phase)||"function"!=typeof e._finishValidator&&(null==n||!n.recheckOnFinish))},ce=function(e){var t;return null!==(t=e._finishValidator)&&void 0!==t?t:e._commitValidator},fe=function(e,t,n){var r=t.status,o=t.result,i=t.context,a=t.feature;return"function"==typeof e._finishValidator&&le.has(null==i?void 0:i.phase)&&"valid"===r&&Y(a,n)?o:null},pe=function(e,t,n){var r,o=null===(r=fe(e,q(e).state,t))||void 0===r?void 0:r.properties;return o?(Q(e,t.id,o,{caller:"onGeometryFinish",styleIds:(0,X._8)(n)}),e.get(t.id)):t},de=function(e,t,n){var r,o,i,a,u,l=(i=(o=n).status,a=o.lastResultStatus,u=o.context,"valid"===i||"pending"===i&&"edit-start"!==(null==u?void 0:u.phase)&&!U.has(a));null===(r=e.setCanFinish)||void 0===r||r.call(e,l),t({type:"SET_CAN_FINISH",payload:l})},he={pending:"Checking shape",valid:"Shape check passed",invalid:"Shape check failed",error:"Shape could not be checked"};function ye(e){var t=e.appState,n=e.appConfig,r=e.mapState,o=e.pluginState,i=e.mapProvider,a=e.eventBus,u=e.emitGeometryInvalid,l=e.announce,s=e.resetState,p=i.draw,d=o.feature,h=o.tempFeature,y=o.dispatch,g=q(p);return re(re(re(re({},function(e){var t=e.draw,n=e.dispatch,r=q(t),o=function(e){ue.set(t,e),n({type:"SET_HOLDING",payload:!0})},i=function(e){if("pending"!==e.status||t._finishValidator)if(se(t,e)){r.run({feature:e.feature,context:{phase:"edit-finish",mode:t.getMode()},consumerCheck:ce(t)});var i=r.state;"pending"===i.status?o(i.revision):"valid"===i.status?t.done():n({type:"SET_HOLDING",payload:!1})}else t.done();else o(e.revision)};return{handleDone:function(){c(t.getMode())?i(r.state):t.done()},onEditCheckSettled:function(e){if(ue.has(t)){var r=ue.get(t)===e.revision;r&&"pending"===e.status||(ue.delete(t),r&&"valid"===e.status?i(e):n({type:"SET_HOLDING",payload:!1}))}}}}({draw:p,dispatch:y})),{},{handleCancel:function(){var e,t=p.getMode(),n=c(t)&&!(null==h||!h.id),r=n&&ae.get(p)===h.id,o=null!==(e=g.heldId)&&void 0!==e?e:r?h.id:void 0;n&&!r&&p.add(d),ae.delete(p),g.release(),p.cancel(),void 0!==o&&p.delete(o),s(),a.emit("draw:cancelled",R(d))},handleUndo:function(){return p.undo()},handleDeleteVertex:function(){return p.deleteVertex()},handleSnap:function(){o.dispatch({type:"TOGGLE_SNAP"}),p.setSnapEnabled(!o.snap)},onCancel:function(){g.reset()}},function(e){var t=e.appState,n=e.appConfig,r=e.mapState,o=e.draw,i=e.dispatch,a=e.eventBus,u=e.resetState,l=q(o),s=function(e,u){ae.set(o,e),setTimeout(function(){return function(e,t,n){var r,o,i,a=e.draw,u=e.appState,l=e.appConfig,s=e.mapState,c=e.dispatch,f=e.eventBus,p="Point"===n?"edit_point":"edit_vertex";a.changeMode(p,{container:null==u||null===(r=u.layoutRefs)||void 0===r||null===(r=r.viewportRef)||void 0===r?void 0:r.current,deleteVertexButtonId:"".concat(null==l?void 0:l.id,"-draw-delete-point"),undoButtonId:"".concat(null==l?void 0:l.id,"-draw-undo"),isPanEnabled:"keyboard"!==(null==u?void 0:u.interfaceType),interfaceType:null==u?void 0:u.interfaceType,scale:null==s?void 0:s.mapSizeScale,featureId:t,getSnapEnabled:function(){return a.isSnapEnabled()}});var d=a.get(t),h=q(a).state,y=h.status,g=h.result;c({type:"SET_FEATURE",payload:{feature:d,tempFeature:d}}),c({type:"SET_MODE",payload:p}),c({type:"SET_VALIDATION_STATUS",payload:y}),de(a,c,h),null===(o=a.setInvalid)||void 0===o||o.call(a,"invalid"===y),f.emit("draw:reopened",{feature:R(d),status:y,reason:null!==(i=null==g?void 0:g.reason)&&void 0!==i?i:null})}({draw:o,appState:t,appConfig:n,mapState:r,dispatch:i,eventBus:a},e,u)},0)},c=function(e,t){var n,i,l;"create"===(null===(n=t.context)||void 0===n?void 0:n.phase)&&null!==(i=fe(o,t,e))&&void 0!==i&&i.reopen?s(e.id,null===(l=e.geometry)||void 0===l?void 0:l.type):function(e){var t=pe(o,e,r);u(),setTimeout(function(){return o.changeMode("disabled")},0),a.emit(ie,R(t))}(e)},f=function(e){var t,n=function(e){var t=l.state,n=t.status,r=t.feature;return("valid"===n||"pending"===n)&&Y(r,e)&&!se(o,l.state)||l.run({feature:e,context:{phase:"create",mode:o.getMode()},consumerCheck:ce(o)}),l.state}(e);if("valid"===n.status)c(e,n);else if("pending"===n.status)t=e.id,l.hold(t),i({type:"SET_HOLDING",payload:!0}),setTimeout(function(){return o.changeMode("disabled")},0);else{var r;s(e.id,null===(r=e.geometry)||void 0===r?void 0:r.type)}};return{onCreate:f,onCheckSettled:function(e){var t=l.heldId;if(void 0!==t&&"pending"!==e.status){l.release();var n=o.get(t);if(se(o,e))f(n);else if("valid"===e.status)c(n,e);else{var r;s(t,null==n||null===(r=n.geometry)||void 0===r?void 0:r.type)}}},onEditFinish:function(e){var t=pe(o,e,r);u(),setTimeout(function(){return o.changeMode("disabled")},0),ae.get(o)===e.id?(ae.delete(o),a.emit(ie,R(t))):a.emit("draw:edited",R(t))}}}({appState:t,appConfig:n,mapState:r,draw:p,dispatch:y,eventBus:a,resetState:s})),function(e){var t=e.draw,n=e.pluginState,r=e.mapProvider,o=e.eventBus;return{onVertexSelection:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:e}),r.activeMoveTarget=e.index>=0?function(e){return{move:function(t,n,r){return e.nudgeSelectedVertex(t,n,r)},label:"vertex"}}(t):null,o.emit("draw:vertexselection",e)},onVertexChange:function(e){n.dispatch({type:"SET_SELECTED_VERTEX_INDEX",payload:{index:-1,numVertices:e.numVertices}}),r.activeMoveTarget=null}}}({draw:p,pluginState:o,mapProvider:i,eventBus:a})),{},{onUndoChange:function(e){o.dispatch({type:"SET_UNDO_STACK_LENGTH",payload:e})},onUpdate:function(e){a.emit("draw:updated",R(e))},onGeometryChange:function(e){if(null!=e&&e.phase){var t=p.getMode();f(t)&&g.run({feature:e.feature,context:{phase:e.phase,vertexIndex:e.vertexIndex,mode:t},consumerCheck:p._commitValidator})}},onPlacementBlocked:function(e){e.announcement&&(null==l||l(e.announcement,"action")),u(re(re({},e),{},{feature:R(e.feature)}))},onValidityChange:function(e){o.dispatch({type:"SET_PREVIEW_VALID",payload:e.valid})},onCanPlaceChange:function(e){o.dispatch({type:"SET_CAN_ADD_POINT",payload:e.canPlace})},onInterfaceTypeChange:function(e){a.emit("draw:interfacetypechange",{interfaceType:e.interfaceType})}})}function ge(e){var t=e.appState,n=e.appConfig,r=e.mapState,o=e.pluginState,i=e.mapProvider,a=e.buttonConfig,u=e.eventBus,l=e.hints,s=e.announce,f=i.draw,p=function(e,t){return function(n){var r,o=n.announcement,i=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,te);e.emit("draw:geometryinvalid",i),o||!i.reason||(r=i.reason,Object.values(x.PH).includes(r))||t.show(i.reason)}}(u,l),d=ye({appState:t,appConfig:n,mapState:r,pluginState:o,mapProvider:i,eventBus:u,emitGeometryInvalid:p,announce:s,resetState:function(){o.dispatch({type:"SET_MODE",payload:null}),o.dispatch({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),i.activeMoveTarget=null,q(f).reset(),ue.delete(f)}}),h=q(f),y=function(e){var t=e.draw,n=e.dispatch,r=e.emitGeometryInvalid,o=e.announce;return function(e){var i,a=e.status,u=e.result,l=e.context,s=e.feature,f="valid"===a;if(n(e.slow?{type:"SET_CHECK_SLOW"}:{type:"SET_VALIDATION_STATUS",payload:a}),function(e,t){var n=t.status,r=t.result,o=t.slow,i=t.afterPending;null!=r&&r.announcement?null==e||e(r.announcement,"action"):"pending"===n?o&&(null==e||e(he.pending,"action")):i&&(null==e||e("invalid"===n&&r.reason||he[n],"action"))}(o,e),de(t,n,e),"pending"!==a&&"error"!==a&&(c(t.getMode())&&(null===(i=t.setInvalid)||void 0===i||i.call(t,!f)),!f&&"edit-start"!==(null==l?void 0:l.phase))){var p=u.reason,d=u.source,h=u.announcement;r(re(re({reason:p,source:d,announcement:h},l),{},{feature:R(s)}))}}}({draw:f,dispatch:o.dispatch,emitGeometryInvalid:p,announce:s});return h.setOnSettle(function(e){y(e),d.onCheckSettled(e),d.onEditCheckSettled(e)}),function(e,t){var n=e.drawDone,r=e.drawCancel,o=e.drawUndo,i=e.drawDeletePoint,a=e.drawSnap;n.onClick=t.handleDone,r.onClick=t.handleCancel,o.onClick=t.handleUndo,i&&(i.onClick=t.handleDeleteVertex),a&&(a.onClick=t.handleSnap)}(a,d),function(e,t){e.on(P.k.CREATE,t.onCreate),e.on(P.k.EDIT_FINISH,t.onEditFinish),e.on(P.k.CANCEL,t.onCancel),e.on(P.k.VERTEX_SELECTION,t.onVertexSelection),e.on(P.k.VERTEX_CHANGE,t.onVertexChange),e.on(P.k.UNDO_CHANGE,t.onUndoChange),e.on(P.k.UPDATE,t.onUpdate),e.on(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.on(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.on(P.k.VALIDITY_CHANGE,t.onValidityChange),e.on(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.on(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d),function(){h.setOnSettle(null),function(e){var t=e.drawDone,n=e.drawCancel,r=e.drawUndo,o=e.drawDeletePoint,i=e.drawSnap;t.onClick=null,n.onClick=null,r.onClick=null,o&&(o.onClick=null),i&&(i.onClick=null)}(a),function(e,t){e.off(P.k.CREATE,t.onCreate),e.off(P.k.EDIT_FINISH,t.onEditFinish),e.off(P.k.CANCEL,t.onCancel),e.off(P.k.VERTEX_SELECTION,t.onVertexSelection),e.off(P.k.VERTEX_CHANGE,t.onVertexChange),e.off(P.k.UNDO_CHANGE,t.onUndoChange),e.off(P.k.UPDATE,t.onUpdate),e.off(P.k.GEOMETRY_CHANGE,t.onGeometryChange),e.off(P.k.PLACEMENT_BLOCKED,t.onPlacementBlocked),e.off(P.k.VALIDITY_CHANGE,t.onValidityChange),e.off(P.k.CAN_PLACE_CHANGE,t.onCanPlaceChange),e.off(P.k.INTERFACE_TYPE_CHANGE,t.onInterfaceTypeChange)}(f,d)}}function ve(e){return ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve(e)}function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?me(Object(n),!0).forEach(function(t){Se(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Se(e,t,n){return(t=function(e){var t=function(e){if("object"!=ve(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ve(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ve(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var we="edit_vertex",Ee="draw",Pe=function(e,t,n){var r=e.mapToScreen(n);return{x:r.x*t,y:r.y*t}};function Oe(e){var t=e.mapState,n=e.pluginState,r=e.services,o=e.mapProvider,i=e.spatialListRegistry,a=e.viewportRef,u=t.mapSizeScale,l=r.eventBus,s=r.announce,c=(0,v.useRef)([]),f=(0,v.useRef)(null);!function(e){var t=e.pluginState,n=e.mapProvider,r=e.mapSizeScale,o=e.spatialListRegistry,i=e.itemsRef,a=e.eventBus;(0,v.useEffect)(function(){var e=function(){i.current=t.mode===we?function(e,t){var n,r,o,i=null!==(n=null===(r=e.draw)||void 0===r||null===(o=r.getVertexItems)||void 0===o?void 0:o.call(r))&&void 0!==n?n:{vertices:[],midpoints:[]},a=i.vertices,u=i.midpoints,l=[];return a.forEach(function(n,r){l.push(function(n,r){return be({id:String(r),label:"Point ".concat(r+1),isMidpoint:!1},Pe(e,t,n))}(n,r)),r<u.length&&l.push(function(n,r){return be({id:String(a.length+r),label:"Insert ".concat(r+1,"-").concat((r+1)%a.length+1),isMidpoint:!0},Pe(e,t,n))}(u[r],r))}),l}(n,r):[],o.notifyItemsChanged(Ee)};e(),a.on(m.MAP_MOVE_END,e);var u=n.draw;return u?(u.on(P.k.UPDATE,e),function(){a.off(m.MAP_MOVE_END,e),u.off(P.k.UPDATE,e)}):function(){return a.off(m.MAP_MOVE_END,e)}},[t.mode,n,r,o,i,a]),(0,v.useEffect)(function(){return o.registerItemProvider(Ee,{getItems:function(){return{items:i.current,multiselectable:!1,label:"Shape points",focusable:!1}},exclusive:!0}),function(){o.unregisterItemProvider(Ee)}},[o,i]),(0,v.useEffect)(function(){if(t.mode===we)return o.claimExclusive(Ee),function(){return o.releaseExclusive(Ee)}},[t.mode,o])}({pluginState:n,mapProvider:o,mapSizeScale:u,spatialListRegistry:i,itemsRef:c,eventBus:l}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,o=e.activeIdRef;(0,v.useEffect)(function(){var e=function(e){var t,i,a=e.id;o.current=a,null!==a&&r.mode===we&&(null===(t=n.draw)||void 0===t||null===(i=t.selectVertex)||void 0===i||i.call(t,Number(a)))};return t.on(m.MAP_SET_ACTIVE_ITEM,e),function(){t.off(m.MAP_SET_ACTIVE_ITEM,e)}},[t,n,r.mode,o])}({eventBus:l,mapProvider:o,pluginState:n,activeIdRef:f}),function(e){var t=e.eventBus,n=e.mapProvider,r=e.pluginState,o=e.activeIdRef,i=e.itemsRef,a=e.viewportRef,u=e.announce;(0,v.useEffect)(function(){var e=function(){var e;if(r.mode===we&&null!==o.current){var t,l,s=i.current.find(function(e){return e.id===o.current});s&&(s.isMidpoint?(null===(t=n.draw)||void 0===t||null===(l=t.insertVertexAtMidpoint)||void 0===l||l.call(t,Number(o.current)),u("New point inserted","action")):u("".concat(s.label," selected"),"action"),null===(e=a.current)||void 0===e||e.focus())}};return t.on(m.MAP_SELECT_ITEM,e),function(){t.off(m.MAP_SELECT_ITEM,e)}},[t,n,r.mode,o,i,a,u])}({eventBus:l,mapProvider:o,pluginState:n,activeIdRef:f,itemsRef:c,viewportRef:a,announce:s})}var xe=n(682),_e=function(e,t){return"number"==typeof(null==e?void 0:e.snapMinZoom)&&"number"==typeof t&&t<e.snapMinZoom},Ae=function(e){var t;return null!==(t=null==e?void 0:e.snapZoomInHintText)&&void 0!==t?t:xe.jg},Te=function(e){var t,n=e.appState,r=e.pluginState;return s(r.mode)&&("touch"===n.interfaceType||!(null===(t=n.expandedButtons)||void 0===t||!t.has("mapControls")))};function je(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var l=r&&r.prototype instanceof u?r:u,s=Object.create(l.prototype);return Ce(s,"_invoke",function(n,r,o){var i,u,l,s=0,c=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,u=0,l=e,p.n=n,a}};function d(n,r){for(u=n,l=r,t=0;!f&&s&&!o&&t<c.length;t++){var o,i=c[t],d=p.p,h=i[2];n>3?(o=h===r)&&(l=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<h&&(o=n<3||i[0]>r||r>h)&&(i[4]=n,i[5]=r,p.n=h,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,c,h){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&d(c,h),u=c,l=h;(t=u<2?e:l)||!f;){i||(u?u<3?(u>1&&(p.n=-1),d(u,l)):p.n=l:p.v=l);try{if(s=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(l=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=p.n<0)?l:n.call(r,p))!==a)break}catch(t){i=e,u=1,l=t}finally{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function l(){}function s(){}t=Object.getPrototypeOf;var c=[][r]?t(t([][r]())):(Ce(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(c);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,Ce(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=s,Ce(f,"constructor",s),Ce(s,"constructor",l),l.displayName="GeneratorFunction",Ce(s,o,"GeneratorFunction"),Ce(f),Ce(f,o,"Generator"),Ce(f,r,function(){return this}),Ce(f,"toString",function(){return"[object Generator]"}),(je=function(){return{w:i,m:p}})()}function Ce(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ce=function(e,t,n,r){function i(t,n){Ce(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},Ce(e,t,n,r)}function ke(e,t,n,r,o,i,a){try{var u=e[i](a),l=u.value}catch(e){return void n(e)}u.done?t(l):Promise.resolve(l).then(r,o)}var Ie=function(){return new Promise(function(e){return setTimeout(e,0)})};function Me(e){return Me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Me(e)}var Le=["stroke","fill","strokeWidth","properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function Re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(n),!0).forEach(function(t){De(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function De(e,t,n){return(t=function(e){var t=function(e){if("object"!=Me(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Me(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Me(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ge=function(e){return function(t,n){var r,o=t.appState,i=t.appConfig,a=t.pluginConfig,u=t.pluginState,l=t.mapState,s=t.mapProvider,c=t.services,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},p=u.dispatch,d=s.draw,h=c.eventBus;if(d){var y=f.stroke,g=f.fill,v=f.strokeWidth,m=f.properties,b=f.onGeometryChange,S=f.onGeometryPreview,w=f.onGeometryFinish,E=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(f,Le);$(d,{onGeometryChange:b,onGeometryPreview:S,onGeometryFinish:w},a,h),h.emit("draw:started",{mode:e,featureId:n});var P=void 0===f.snapLayers?null!==(r=a.snapLayers)&&void 0!==r?r:null:f.snapLayers;d.setSnapLayers(P),p({type:"SET_HAS_SNAP_LAYERS",payload:(null==P?void 0:P.length)>0});var O=Ne(Ne({},m),(0,X.h1)({stroke:y,fill:g,strokeWidth:v}));d.changeMode(e,Ne(Ne({container:o.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(i.id,"-draw-add-point"),interfaceType:o.interfaceType,crossHair:l.crossHair,getSnapEnabled:function(){return d.isSnapEnabled()},featureId:n},E),{},{properties:O})),p({type:"SET_MODE",payload:e})}}},Fe=Ge("draw_polygon"),Ve=Ge("draw_line");function Be(e){return Be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Be(e)}var Ue=["properties","onGeometryChange","onGeometryPreview","onGeometryFinish"];function He(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?He(Object(n),!0).forEach(function(t){ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):He(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ze(e,t,n){return(t=function(e){var t=function(e){if("object"!=Be(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Be(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Be(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function We(e){return We="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(e)}var Ye=["stroke","fill","strokeWidth","properties"];function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$e(Object(n),!0).forEach(function(t){Ke(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$e(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ke(e,t,n){return(t=function(e){var t=function(e){if("object"!=We(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=We(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==We(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ze=new Set(["Point","LineString","Polygon"]);function Je(e){return Je="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Je(e)}function Qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach(function(t){tt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function tt(e,t,n){return(t=function(e){var t=function(e){if("object"!=Je(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Je(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Je(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rt(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rt(e,t):void 0}}(e,t)||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 rt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ot=new Set(["stroke","fill","strokeWidth"]),it=function(e){return Object.fromEntries(Object.entries(e).map(function(e){var t=nt(e,2),n=t[0],r=t[1];return[n,void 0===r?null:r]}))};function at(e){return at="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},at(e)}function ut(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function lt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(n),!0).forEach(function(t){st(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ut(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function st(e,t,n){return(t=function(e){var t=function(e){if("object"!=at(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=at(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==at(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ct=n(704);function ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var pt="_splitter",dt=function(e){var t,n,r,o,i=e.draw,a=(t=e.polygonFeature,n=e.feature,!(!(o=null===(r=n.geometry)||void 0===r?void 0:r.coordinates)||o.length<2||!(0,ct.ns)(t,{id:pt,geometry:n.geometry})));return i.setDrawingPreviewProperty("splitter",a?"valid":"invalid"),a};function ht(e){return ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ht(e)}function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gt(e,t,n){return(t=function(e){var t=function(e){if("object"!=ht(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ht(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ht(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var vt=function(){var e;return"undefined"!=typeof navigator&&/mac/i.test((null===(e=navigator.userAgentData)||void 0===e?void 0:e.platform)||navigator.platform||"")};function mt(e){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mt(e)}function bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bt(Object(n),!0).forEach(function(t){wt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wt(e,t,n){return(t=function(e){var t=function(e){if("object"!=mt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=mt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==mt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Et=vt()?"<kbd>Command</kbd> + <kbd>Z</kbd>":"<kbd>Ctrl</kbd> + <kbd>Z</kbd>",Pt=vt()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",Ot="top-middle",xt=function(e){var t=e.checkSlow,n=e.holding;return!(!t||!n)},_t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"actions";return{mobile:{slot:t,showLabel:e},tablet:{slot:t,showLabel:e},desktop:{slot:t,showLabel:e}}},At={reducer:{initialState:{mode:null,action:null,actionValid:!1,feature:null,tempFeature:null,selectedVertexIndex:-1,numVertices:null,validationStatus:"idle",canFinish:!1,checkSlow:!1,holding:!1,previewValid:!0,canAddPoint:!0,snap:!1,hasSnapLayers:!1,undoStackLength:0},actions:g},InitComponent:function(e){var t=e.appState,n=e.appConfig,r=e.mapState,o=e.pluginConfig,i=e.pluginState,a=e.services,l=e.mapProvider,c=e.buttonConfig,f=e.setApplicationMode,p=e.clearApplicationMode,d=a.eventBus,h=a.hints,y=a.symbolRegistry,g=r.crossHair;Oe({mapState:r,pluginState:i,services:a,mapProvider:l,spatialListRegistry:t.spatialListRegistry,viewportRef:t.layoutRefs.viewportRef});var b=(0,v.useRef)(!1);b.current=!i.holding&&(Te({appState:t,pluginState:i})||s(i.mode)&&"keyboard"===t.interfaceType),function(e){var t=e.mapState,n=e.pluginConfig,r=e.pluginState,o=e.mapProvider,i=e.eventBus,a=e.symbolRegistry,u=(0,v.useRef)(!0),l=(0,v.useRef)(!1);(0,v.useEffect)(function(){if(t.isMapReady&&!l.current){l.current=!0;var e=function(){var e,l=(e=je().m(function e(){var l,s;return je().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ie();case 1:if(u.current){e.n=2;break}return e.a(2);case 2:return e.n=3,E(o,{mapStyle:t.mapStyle,snapLayers:n.snapLayers,pluginConfig:n,events:m,eventBus:i,symbolRegistry:a});case 3:if(s=e.v,u.current){e.n=4;break}return s.remove(),e.a(2);case 4:o.draw=s,r.dispatch({type:"SET_HAS_SNAP_LAYERS",payload:(null===(l=n.snapLayers)||void 0===l?void 0:l.length)>0}),i.emit("draw:ready");case 5:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){ke(i,r,o,a,u,"next",e)}function u(e){ke(i,r,o,a,u,"throw",e)}a(void 0)})});return function(){return l.apply(this,arguments)}}();e().catch(function(e){return _.v.error("[draw] failed to load the draw adapter",e)})}},[t.isMapReady]),(0,v.useEffect)(function(){return function(){var e;u.current=!1,null===(e=o.draw)||void 0===e||e.remove(),o.draw=null,o.activeMoveTarget=null}},[])}({mapState:r,pluginConfig:o,pluginState:i,mapProvider:l,eventBus:d,symbolRegistry:y}),function(e){var t=e.mapState,n=e.pluginConfig,r=e.pluginState,o=e.mapProvider,i=e.hints,a=t.zoom,u=t.isUserMove,l=r.mode,s=r.hasSnapLayers,c=r.snap,f=o.draw,p=_e(n,a),d=(0,v.useRef)({mode:null,isBelow:!1});(0,v.useEffect)(function(){if(f){var e=d.current;d.current={mode:l,isBelow:p},f.setSnapAvailable(!p);var t=!!l&&e.mode===l&&s;p&&!e.isBelow&&t&&c&&u&&i.show(Ae(n))}},[f,l,p])}({mapState:r,pluginConfig:o,pluginState:i,mapProvider:l,hints:h}),(0,v.useLayoutEffect)(function(){if(i.mode)return f(xe.V3),function(){return p(xe.V3)};p(xe.V3)},[i.mode]),(0,v.useEffect)(function(){var e=null!==i.mode&&"edit_vertex"!==i.mode;return d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:e}),function(){d.emit(m.MAP_SET_SPATIAL_LIST_SUPPRESSED,{suppressed:!1})}},[i.mode,d]),(0,v.useEffect)(function(){if(b.current){var e=g.isVisible;return g.fixAtCenter(),function(){e||b.current||g.hide()}}},[i.mode,i.holding,t.interfaceType,t.expandedButtons]),(0,v.useEffect)(function(){var e;e=i.mode,u.has(e)&&l.draw&&l.draw.setInterfaceType(t.interfaceType)},[t.interfaceType,i.mode]),(0,v.useEffect)(function(){if(l.draw)return ge({appState:t,appConfig:n,mapState:r,mapProvider:l,buttonConfig:c,pluginState:i,events:m,eventBus:d,hints:h,announce:a.announce})},[l,t,i])},applicationModes:wt({},xe.V3,{include:["mapStyles","mapControls","scaleBar"]}),buttons:[St({id:"drawCancel",label:"Cancel",variant:"tertiary",exclusiveSlot:!0,hiddenWhen:function(e){return!e.pluginState.mode}},_t(!0)),St({id:"drawAddPoint",label:"Add point",variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.appState,n=e.pluginState;return!Te({appState:t,pluginState:n})},enableWhen:function(e){var t=e.pluginState;return t.canAddPoint&&!t.holding}},_t(!0)),St({id:"drawDone",label:function(e){var t=e.pluginState;return xt(t)?"Checking…":"Done"},busyWhen:function(e){var t=e.pluginState;return xt(t)},variant:"primary",exclusiveSlot:!0,hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)&&!t.holding},enableWhen:function(e){var t=e.pluginState,n=t.mode,r=t.canFinish,o=t.previewValid,i=t.holding;return f(n)&&r&&o&&!i}},_t(!0)),St({id:"drawUndo",label:"Undo",iconId:"undo",hiddenWhen:function(e){var t=e.pluginState;return!f(t.mode)},enableWhen:function(e){var t=e.pluginState;return!t.holding&&(l(t.mode)?t.numVertices>0:t.undoStackLength>0)}},_t(!1,Ot)),St({id:"drawSnap",label:"Snap",iconId:"magnet",hiddenWhen:function(e){var t=e.pluginState;return!t.mode||!t.hasSnapLayers},enableWhen:function(e){var t=e.pluginConfig,n=e.pluginState,r=e.mapState;return!n.holding&&!_e(t,r.zoom)},pressedWhen:function(e){return!!e.pluginState.snap},description:function(e){var t=e.pluginConfig,n=e.mapState;return _e(t,n.zoom)?Ae(t):void 0}},_t(!0,Ot)),St({id:"drawDeletePoint",label:"Delete point",iconId:"trash",enableWhen:function(e){var t,n=e.pluginState;return!(n.holding||n.selectedVertexIndex<0)&&("Polygon"===(null===(t=n.feature)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type)?n.numVertices>3:n.numVertices>2)},hiddenWhen:function(e){return"edit_vertex"!==e.pluginState.mode}},_t(!1,Ot))],keyboardShortcuts:[{id:"drawAddPoint",group:"Drawing",title:"Add point (draw)",command:"<kbd>Enter</kbd>"},{id:"drawSelectPoint",group:"Drawing",title:"Select nearest point (edit)",command:"<kbd>Spacebar</kbd>"},{id:"drawSelectAdjacentPoint",group:"Drawing",title:"Select adjacent point (edit)",command:"".concat(Pt," + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>")},{id:"drawMovePoint",group:"Drawing",title:"Move point (edit)",command:"<kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawNudgePoint",group:"Drawing",title:"Nudge point (edit)",command:"<kbd>Shift</kbd> + <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> or <kbd>→</kbd>"},{id:"drawDeletePoint",group:"Drawing",title:"Delete point (edit)",command:"<kbd>Delete</kbd>"},{id:"drawUndo",group:"Drawing",title:"Undo",command:Et}],icons:[{id:"undo",svgContent:'<path d="M9 14 4 9l5-5"/><path d="M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11"/>'},{id:"magnet",svgContent:'<path d="m12 15 4 4"/><path d="M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z"/><path d="m5 8 4 4"/>'},{id:"trash",svgContent:'<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>'}],api:{newPolygon:Fe,newLine:Ve,newPoint:function(e,t){var n,r=e.appState,o=e.appConfig,i=e.pluginConfig,a=e.pluginState,u=e.mapState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=a.dispatch,p=l.draw,d=s.eventBus;if(p){var h=c.properties,y=c.onGeometryChange,g=c.onGeometryPreview,v=c.onGeometryFinish,m=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(c,Ue);$(p,{onGeometryChange:y,onGeometryPreview:g,onGeometryFinish:v},i,d),d.emit("draw:started",{mode:"draw_point",featureId:t});var b=void 0===c.snapLayers?null!==(n=i.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(b),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==b?void 0:b.length)>0});var S={};A.I.forEach(function(e){void 0!==m[e]&&(S[e]=m[e],delete m[e])}),p.changeMode("draw_point",qe(qe({container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(o.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:u.crossHair,getSnapEnabled:function(){return p.isSnapEnabled()},featureId:t},m),{},{properties:qe(qe({},h),S)})),f({type:"SET_MODE",payload:"draw_point"})}},editFeature:function(e,t){var n,r=e.appState,o=e.appConfig,i=e.mapState,a=e.pluginConfig,u=e.pluginState,l=e.mapProvider,s=e.services,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=u.dispatch,p=l.draw,d=s.eventBus;if(!p)return!1;var h=p.get(t);if(!h)return!1;$(p,c,a,d);var y="Point"===h.geometry.type?"edit_point":"edit_vertex";d.emit("draw:editstart",{mode:{LineString:"edit_line",Polygon:"edit_polygon",Point:"edit_point"}[h.geometry.type],featureId:t});var g=void 0===c.snapLayers?null!==(n=a.snapLayers)&&void 0!==n?n:null:c.snapLayers;p.setSnapLayers(g),f({type:"SET_HAS_SNAP_LAYERS",payload:(null==g?void 0:g.length)>0}),p.changeMode(y,{container:r.layoutRefs.viewportRef.current,deleteVertexButtonId:"".concat(o.id,"-draw-delete-point"),undoButtonId:"".concat(o.id,"-draw-undo"),isPanEnabled:"keyboard"!==r.interfaceType,interfaceType:r.interfaceType,scale:i.mapSizeScale,featureId:t,getSnapEnabled:function(){return p.isSnapEnabled()}});var v=p.get(t);return f({type:"SET_FEATURE",payload:{feature:v,tempFeature:v}}),f({type:"SET_MODE",payload:y}),q(p).run({feature:v,context:{phase:"edit-start",mode:y},consumerCheck:p._commitValidator}),!0},addFeature:function(e,t){var n=e.mapState,r=e.mapProvider,o=e.services,i=r.draw,a=o.eventBus;if(i){var u=t.stroke,l=t.fill,s=t.strokeWidth,c=t.properties,f=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(t,Ye),p=(0,X.h1)(c),d=Xe(Xe({type:"Feature"},f),{},{properties:(0,X.Uv)(Xe(Xe({},p),(0,X.A)(p,{stroke:u,fill:l,strokeWidth:s},(0,X._8)(n))))});!function(e){var t,n;return Ze.has(null===(t=e.geometry)||void 0===t?void 0:t.type)&&void 0!==(null===(n=e.geometry)||void 0===n?void 0:n.coordinates)}(d)?_.v.warn("addFeature: ignoring invalid GeoJSON feature",d):(i.add(d),a.emit("draw:add",R(d)))}},setStyle:function(e,t){var n=e.mapState,r=e.mapProvider,o=e.services,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=r.draw,u=o.eventBus;if(!a)return!1;var l=a.get(t);if(!l)return _.v.warn("setStyle: no feature found for id",t),!1;for(var s={},c={},f=0,p=Object.entries(i);f<p.length;f++){var d=nt(p[f],2),h=d[0],y=d[1];(ot.has(h)?s:c)[h]=y}var g=et(et({},(0,X.A)(l.properties,s,(0,X._8)(n))),(0,X.Uv)(c));return a.setStyle(t,g),u.emit("draw:stylechange",{featureId:t,properties:it(g)}),!0},setProperties:function(e,t){var n=e.pluginState,r=e.mapState,o=e.mapProvider,i=e.services,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=o.draw,l=i.eventBus;if(!u)return!1;if(!u.get(t))return _.v.warn("setProperties: no feature found for id",t),!1;var s=Q(u,t,a,{caller:"setProperties",styleIds:(0,X._8)(r)}),f=n.feature,p=n.dispatch;return c(u.getMode())&&(null==f?void 0:f.id)===t&&p({type:"SET_FEATURE",payload:{feature:lt(lt({},f),{},{properties:lt(lt({},f.properties),s)})}}),l.emit("draw:propertieschange",{featureId:t,properties:s}),!0},deleteFeature:function(e,t){var n=e.mapProvider,r=e.services,o=n.draw,i=r.eventBus;o&&(o.delete(t),i.emit("draw:delete",{featureId:t}))},split:function(e,t){var n,r=e.appState,o=e.appConfig,i=e.pluginState,a=e.mapState,u=e.mapProvider,l=e.services,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=i.dispatch,f=u.draw,p=l.eventBus;if(f){var d=f.get(t),h=f._previewValidator,y=f._commitValidator,g=f._finishValidator;f._previewValidator=function(e){var t=e.draw,n=e.polygonFeature;return function(e){var r=e.feature;return"preview"===e.phase&&dt({draw:t,polygonFeature:n,feature:r}),{valid:!0}}}({draw:f,polygonFeature:d}),f._commitValidator=function(e){var t=e.draw,n=e.dispatch,r=e.polygonFeature;return function(e){var o,i=e.feature;return e.phase===P.P?(o=function(e){var t=e.dispatch,n=dt({draw:e.draw,polygonFeature:e.polygonFeature,feature:e.feature});return t({type:"SET_ACTION",payload:{name:"split",isValid:n}}),n}({draw:t,dispatch:n,polygonFeature:r,feature:i}),o?{valid:!0}:{valid:!1,reason:"Line does not split the shape into two parts"}):{valid:!0}}}({draw:f,dispatch:c,polygonFeature:d}),f._finishValidator=null,q(f).reset();var v=["stroke-inactive.cold"].concat(function(e){if(Array.isArray(e))return ft(e)}(n=s.snapLayers||[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return ft(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ft(e,t):void 0}}(n)||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.")}());f.setSnapLayers(v),c({type:"SET_HAS_SNAP_LAYERS",payload:!0}),f.changeMode("draw_line",{container:r.layoutRefs.viewportRef.current,addVertexButtonId:"".concat(o.id,"-draw-add-point"),interfaceType:r.interfaceType,crossHair:null==a?void 0:a.crossHair,getSnapEnabled:function(){return f.isSnapEnabled()},featureId:pt,properties:{splitter:"invalid"}});var m=function(){f._previewValidator=h,f._commitValidator=y,f._finishValidator=g,f.off(P.k.CREATE,b),f.off(P.k.CANCEL,S)},b=function(e){m(),f.delete(pt);var n=(0,ct.ns)(d,e);c({type:"SET_ACTION",payload:{name:"split",isValid:!!n}}),n&&p.emit("draw:split",{originalFeatureId:t,featureCollection:n})},S=function(){m()};f.on(P.k.CREATE,b),f.on(P.k.CANCEL,S),c({type:"SET_MODE",payload:"draw_line"}),c({type:"SET_ACTION",payload:{name:"split"}})}},merge:function(e,t){var n=e.mapProvider,r=e.services,o=n.draw,i=r.eventBus;if(!o)return null;var a=t.map(function(e){return o.get(e)}),u=(0,ct.OI)(a);return u&&i.emit("draw:merge",{originalFeatureIds:t,feature:u}),u},setGeometry:function(e,t){var n,r,o=e.mapProvider,i=e.pluginState,a=o.draw;if(!a||!c(a.getMode()))return!1;var u,l=a.get(null===(n=i.feature)||void 0===n?void 0:n.id);return!(!l||(null===(r=l.geometry)||void 0===r?void 0:r.type)!==(null==t?void 0:t.type)||(a.setGeometry({type:t.type,coordinates:(u=t.coordinates,JSON.parse(JSON.stringify(u)))}),0))},recheckGeometry:function(e,t){var n=e.mapProvider.draw;if(!n)return!1;var r=n.getMode(),o=q(n),i=o.state.feature;if(!f(r)||!i)return!1;var a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({phase:"recheck",mode:r},void 0!==t&&{detail:t});return o.run({feature:i,context:a,consumerCheck:n._commitValidator}),!0}}}},652:function(e,t,n){n.d(t,{A:function(){return b},TI:function(){return m},Uv:function(){return g},_8:function(){return v},h1:function(){return y}});var r=n(59),o=n(491);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return(t=function(e){var t=function(e){if("object"!=i(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==i(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=f(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||f(e,t)||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 f(e,t){if(e){if("string"==typeof e)return p(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?p(e,t):void 0}}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var d=new Set(["stroke","fill","strokeWidth"]),h=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},y=function(e){if(!e)return{};for(var t={},n=0,r=Object.entries(e);n<r.length;n++){var i=c(r[n],2),a=i[0],u=i[1];if(d.has(a)&&(0,o.Q)(u)){var l=Object.entries(u);l.length>0&&(t[a]=l[0][1]);for(var s=0,f=l;s<f.length;s++){var p=c(f[s],2),y=p[0],g=p[1];t["".concat(a).concat(h(y))]=g}}else t[a]=u}return t},g=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={},n=0,r=Object.entries(e);n<r.length;n++){var o=c(r[n],2),i=o[0],a=o[1];void 0!==a&&(t[i]=a)}return t},v=function(e){var t,n;return null!==(t=null==e||null===(n=e.mapStyles)||void 0===n?void 0:n.map(function(e){return e.id}))&&void 0!==t?t:[]},m=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return d.has(e)||r.I.has(e)||(t=d,function(e){if(Array.isArray(e))return p(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||f(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.")}()).some(function(t){return n.some(function(n){return e==="".concat(t).concat(h(n))})})},b=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=g(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),r={},o=0,i=Object.keys(n);o<i.length;o++){var a=i[o];if(d.has(a)){var l,c=s(t);try{for(c.s();!(l=c.n()).done;){var f=l.value,p="".concat(a).concat(h(f));p in e&&(r[p]=void 0)}}catch(e){c.e(e)}finally{c.f()}}}return u(u({},r),y(n))}},491:function(e,t,n){function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}n.d(t,{Q:function(){return o}});var o=function(e){if(null===e||"object"!==r(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},704:function(e,t,n){function r(e){var t={type:"Feature"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:t[n]=e[n]}}),t.properties=o(e.properties),t.geometry=i(e.geometry),t}function o(e){var t={};return e?(Object.keys(e).forEach(function(n){var r=e[n];"object"==typeof r?null===r?t[n]=null:Array.isArray(r)?t[n]=r.map(function(e){return e}):t[n]=o(r):t[n]=r}),t):t}function i(e){var t={type:e.type};return e.bbox&&(t.bbox=e.bbox),"GeometryCollection"===e.type?(t.geometries=e.geometries.map(function(e){return i(e)}),t):(t.coordinates=a(e.coordinates),t)}function a(e){var t=e;return"object"!=typeof t[0]?t.slice():t.map(function(e){return a(e)})}n.d(t,{jK:function(){return ht},DF:function(){return dt},OI:function(){return ft},ns:function(){return ct}});function u(e){for(var t,n,r=function(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}(e),o=0,i=1;i<r.length;)t=n||r[0],o+=((n=r[i])[0]-t[0])*(n[1]+t[1]),i++;return o>0}function l(e,t){if("Feature"===e.type)t(e,0);else if("FeatureCollection"===e.type)for(var n=0;n<e.features.length&&!1!==t(e.features[n],n);n++);}function s(e,t){var n,r,o,i,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,o=0;o<a;o++)if(null!==(i=l?u.geometries[o]:u))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(i,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<i.geometries.length;r++)if(!1===t(i.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}function c(e){if(Array.isArray(e))return e;if("Feature"===e.type){if(null!==e.geometry)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function f(e,t){switch("Feature"===e.type?e.geometry.type:e.type){case"GeometryCollection":return s(e,function(e){f(e,t)}),e;case"LineString":return p(c(e),t),e;case"Polygon":return d(c(e),t),e;case"MultiLineString":return c(e).forEach(function(e){p(e,t)}),e;case"MultiPolygon":return c(e).forEach(function(e){d(e,t)}),e;case"Point":case"MultiPoint":return e}}function p(e,t){u(e)===t&&e.reverse()}function d(e,t){u(e[0])!==t&&e[0].reverse();for(var n=1;n<e.length;n++)u(e[n])===t&&e[n].reverse()}var h=function(e,t){if(!(n=t=t||{})||n.constructor!==Object)throw new Error("options is invalid");var n,o=t.reverse||!1,a=t.mutate||!1;if(!e)throw new Error("<geojson> is required");if("boolean"!=typeof o)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof a)throw new Error("<mutate> must be a boolean");!1===a&&(e=function(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return r(e);case"FeatureCollection":return function(e){var t={type:"FeatureCollection"};return Object.keys(e).forEach(function(n){switch(n){case"type":case"features":return;default:t[n]=e[n]}}),t.features=e.features.map(function(e){return r(e)}),t}(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return i(e);default:throw new Error("unknown GeoJSON type")}}(e));var u=[];switch(e.type){case"GeometryCollection":return s(e,function(e){f(e,o)}),e;case"FeatureCollection":return l(e,function(e){l(f(e,o),function(e){u.push(e)})}),function(e,t){void 0===t&&(t={});var n={type:"FeatureCollection"};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}(u)}return f(e,o)};const y=11102230246251565e-32,g=134217729,v=(3+8*y)*y;function m(e,t,n,r,o){let i,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(i=s,s=t[++f]):(i=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+i,u=i-(a-s),s=t[++f]):(a=c+i,u=i-(a-c),c=r[++p]),i=a,0!==u&&(o[d++]=u);f<e&&p<n;)c>s==c>-s?(a=i+s,l=a-i,u=i-(a-l)+(s-l),s=t[++f]):(a=i+c,l=a-i,u=i-(a-l)+(c-l),c=r[++p]),i=a,0!==u&&(o[d++]=u);for(;f<e;)a=i+s,l=a-i,u=i-(a-l)+(s-l),s=t[++f],i=a,0!==u&&(o[d++]=u);for(;p<n;)a=i+c,l=a-i,u=i-(a-l)+(c-l),c=r[++p],i=a,0!==u&&(o[d++]=u);return 0===i&&0!==d||(o[d++]=i),d}function b(e){return new Float64Array(e)}const S=b(4),w=b(8),E=b(12),P=b(16),O=b(4);function x(e,t,n,r,o,i){const a=(t-i)*(n-o),u=(e-o)*(r-i),l=a-u,s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,o,i,a){let u,l,s,c,f,p,d,h,y,b,x,_,A,T,j,C,k,I;const M=e-o,L=n-o,R=t-i,N=r-i;T=M*N,p=g*M,d=p-(p-M),h=M-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=R*L,p=g*R,d=p-(p-R),h=R-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,S[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,S[1]=A-(x+f)+(f-C),I=_+x,f=I-_,S[2]=_-(I-f)+(x-f),S[3]=I;let D=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,S),G=22204460492503146e-32*a;if(D>=G||-D>=G)return D;if(f=e-M,u=e-(M+f)+(f-o),f=n-L,s=n-(L+f)+(f-o),f=t-R,l=t-(R+f)+(f-i),f=r-N,c=r-(N+f)+(f-i),0===u&&0===l&&0===s&&0===c)return D;if(G=11093356479670487e-47*a+v*Math.abs(D),D+=M*c+N*u-(R*s+L*l),D>=G||-D>=G)return D;T=u*N,p=g*u,d=p-(p-u),h=u-d,p=g*N,y=p-(p-N),b=N-y,j=h*b-(T-d*y-h*y-d*b),C=l*L,p=g*l,d=p-(p-l),h=l-d,p=g*L,y=p-(p-L),b=L-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const F=m(4,S,4,O,w);T=M*c,p=g*M,d=p-(p-M),h=M-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=R*s,p=g*R,d=p-(p-R),h=R-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const V=m(F,w,4,O,E);T=u*c,p=g*u,d=p-(p-u),h=u-d,p=g*c,y=p-(p-c),b=c-y,j=h*b-(T-d*y-h*y-d*b),C=l*s,p=g*l,d=p-(p-l),h=l-d,p=g*s,y=p-(p-s),b=s-y,k=h*b-(C-d*y-h*y-d*b),x=j-k,f=j-x,O[0]=j-(x+f)+(f-k),_=T+x,f=_-T,A=T-(_-f)+(x-f),x=A-C,f=A-x,O[1]=A-(x+f)+(f-C),I=_+x,f=I-_,O[2]=_-(I-f)+(x-f),O[3]=I;const B=m(V,E,4,O,P);return P[B-1]}(e,t,n,r,o,i,s)}function _(e,t){var n,r,o,i,a,u,l,s,c,f=0,p=e[0],d=e[1],h=t.length;for(n=0;n<h;n++){r=0;var y=t[n],g=y.length-1;if((s=y[0])[0]!==y[g][0]&&s[1]!==y[g][1])throw new Error("First and last coordinates in a ring must be the same");for(i=s[0]-p,a=s[1]-d;r<g;r++){if(u=(c=y[r+1])[0]-p,l=c[1]-d,0===a&&0===l){if(u<=0&&i>=0||i<=0&&u>=0)return 0}else if(l>=0&&a<=0||l<=0&&a>=0){if(0===(o=x(i,u,a,l,0,0)))return 0;(o>0&&l>0&&a<=0||o<0&&l<=0&&a>0)&&f++}s=c,a=l,i=u}}return f%2!=0}b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(4),b(8),b(8),b(8),b(12),b(192),b(192),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(8),b(4),b(4),b(4),b(8),b(16),b(16),b(16),b(32),b(32),b(48),b(64),b(1152),b(1152),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(4),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(24),b(1152),b(1152),b(1152),b(1152),b(1152),b(2304),b(2304),b(3456),b(5760),b(8),b(8),b(8),b(16),b(24),b(48),b(48),b(96),b(192),b(384),b(384),b(384),b(768),b(96),b(96),b(96),b(1152);const A=134217729;function T(e,t,n,r,o){let i,a,u,l,s=t[0],c=r[0],f=0,p=0;c>s==c>-s?(i=s,s=t[++f]):(i=c,c=r[++p]);let d=0;if(f<e&&p<n)for(c>s==c>-s?(a=s+i,u=i-(a-s),s=t[++f]):(a=c+i,u=i-(a-c),c=r[++p]),i=a,0!==u&&(o[d++]=u);f<e&&p<n;)c>s==c>-s?(a=i+s,l=a-i,u=i-(a-l)+(s-l),s=t[++f]):(a=i+c,l=a-i,u=i-(a-l)+(c-l),c=r[++p]),i=a,0!==u&&(o[d++]=u);for(;f<e;)a=i+s,l=a-i,u=i-(a-l)+(s-l),s=t[++f],i=a,0!==u&&(o[d++]=u);for(;p<n;)a=i+c,l=a-i,u=i-(a-l)+(c-l),c=r[++p],i=a,0!==u&&(o[d++]=u);return 0===i&&0!==d||(o[d++]=i),d}function j(e){return new Float64Array(e)}const C=j(4),k=j(8),I=j(12),M=j(16),L=j(4);function R(e,t,n,r,o,i){const a=(t-i)*(n-o),u=(e-o)*(r-i),l=a-u;if(0===a||0===u||a>0!=u>0)return l;const s=Math.abs(a+u);return Math.abs(l)>=33306690738754716e-32*s?l:-function(e,t,n,r,o,i,a){let u,l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O;const x=e-o,_=n-o,j=t-i,R=r-i;S=x*R,p=A*x,d=p-(p-x),h=x-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=j*_,p=A*j,d=p-(p-j),h=j-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,C[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,C[1]=b-(v+f)+(f-E),O=m+v,f=O-m,C[2]=m-(O-f)+(v-f),C[3]=O;let N=function(e,t){let n=t[0];for(let e=1;e<4;e++)n+=t[e];return n}(0,C),D=22204460492503146e-32*a;if(N>=D||-N>=D)return N;if(f=e-x,u=e-(x+f)+(f-o),f=n-_,s=n-(_+f)+(f-o),f=t-j,l=t-(j+f)+(f-i),f=r-R,c=r-(R+f)+(f-i),0===u&&0===l&&0===s&&0===c)return N;if(D=11093356479670487e-47*a+33306690738754706e-32*Math.abs(N),N+=x*c+R*u-(j*s+_*l),N>=D||-N>=D)return N;S=u*R,p=A*u,d=p-(p-u),h=u-d,p=A*R,y=p-(p-R),g=R-y,w=h*g-(S-d*y-h*y-d*g),E=l*_,p=A*l,d=p-(p-l),h=l-d,p=A*_,y=p-(p-_),g=_-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const G=T(4,C,4,L,k);S=x*c,p=A*x,d=p-(p-x),h=x-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=j*s,p=A*j,d=p-(p-j),h=j-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const F=T(G,k,4,L,I);S=u*c,p=A*u,d=p-(p-u),h=u-d,p=A*c,y=p-(p-c),g=c-y,w=h*g-(S-d*y-h*y-d*g),E=l*s,p=A*l,d=p-(p-l),h=l-d,p=A*s,y=p-(p-s),g=s-y,P=h*g-(E-d*y-h*y-d*g),v=w-P,f=w-v,L[0]=w-(v+f)+(f-P),m=S+v,f=m-S,b=S-(m-f)+(v-f),v=b-E,f=b-v,L[1]=b-(v+f)+(f-E),O=m+v,f=O-m,L[2]=m-(O-f)+(v-f),L[3]=O;const V=T(F,I,4,L,M);return M[V-1]}(e,t,n,r,o,i,s)}j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(4),j(8),j(8),j(8),j(12),j(192),j(192),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(8),j(4),j(4),j(4),j(8),j(16),j(16),j(16),j(32),j(32),j(48),j(64),j(1152),j(1152),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(4),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(24),j(1152),j(1152),j(1152),j(1152),j(1152),j(2304),j(2304),j(3456),j(5760),j(8),j(8),j(8),j(16),j(24),j(48),j(48),j(96),j(192),j(384),j(384),j(384),j(768),j(96),j(96),j(96),j(1152);var N=function(e,t,n,r,o){this.p1=e,this.p2=t,this.edgeType=n,this.originalIndex=r,this.polygonContourId=o,this.interiorRing=!1,this.minX=Math.min(e.p[0],t.p[0]),this.minY=Math.min(e.p[1],t.p[1]),this.maxX=Math.max(e.p[0],t.p[0]),this.maxY=Math.max(e.p[1],t.p[1]),this.intersectionPoints=[],this.nextEdge=null},D=function(e){this.p=e},G=function(e,t){this.id=e,this.rawCoords=t};function F(e,t){return!(e.maxX<t[0]||e.minX>t[2]||e.maxY<t[1]||e.minY>t[3])}var V=function(e,t,n,r){this.p=e,this.polylineEdge=t,this.polygonEdge=n,this.isHeadingIn=r,this.distanceFromPolylineEdgeStart=B(this.polylineEdge.p1.p,this.p),this.distanceFromPolygonEdgeStart=B(this.polygonEdge.p1.p,this.p),this.polygonEdge.intersectionPoints.push(this),this.polylineEdge.intersectionPoints.push(this),this.visitCount=0};function B(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*=n,r*=r,Math.sqrt(n+r)}V.prototype.incrementVisitCount=function(){this.visitCount=this.visitCount+1};function U(e,t){return e[0]*t[1]-e[1]*t[0]}function H(e,t){return e[0]*t[0]+e[1]*t[1]}function q(e,t,n){return[e[0]+t*n[0],e[1]+t*n[1]]}function z(e,t,n){var r=[e.p2.p[0]-e.p1.p[0],e.p2.p[1]-e.p1.p[1]],o=[t.p2.p[0]-t.p1.p[0],t.p2.p[1]-t.p1.p[1]],i=[t.p1.p[0]-e.p1.p[0],t.p1.p[1]-e.p1.p[1]],a=U(r,o),u=a*a,l=H(r,r);if(u>0){var s=U(i,o)/a;if(s<0||s>1)return null;var c=U(i,r)/a;return c<0||c>1?null:0===s||1===s?n?null:[q(e.p1.p,s,r)]:0===c||1===c?n?null:[q(t.p1.p,c,o)]:[q(e.p1.p,s,r)]}var f=H(i,i);if((u=(a=U(i,r))*a)>1e-9*l*f)return null;var p=H(r,i)/l,d=p+H(r,o)/l,h=Math.min(p,d),y=Math.max(p,d);return h<=1&&y>=0?1===h?n?null:[q(e.p1.p,h>0?h:0,r)]:0===y?n?null:[q(e.p1.p,y<1?y:1,r)]:n&&0===h&&1===y?null:[q(e.p1.p,h>0?h:0,r),q(e.p1.p,y<1?y:1,r)]:null}function W(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.polygonContourId===t)return r}}function Y(e,t){return t.find(function(t){return t.id===e.polygonContourId}).rawCoords}function $(e,t){for(var n=0;n<t.length;n++){var r=t[n];if(_(e[0],[r[0]]))return void r.push(e)}t.push([e])}function X(e,t){var n=e.polygonEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),o=n.intersectionPoints[r+1];return t.push(o.p),o.incrementVisitCount(),o}for(var i=!0;i;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(i=!1)}return n.intersectionPoints[0].incrementVisitCount(),t.push(n.intersectionPoints[0].p),n.intersectionPoints[0]}function K(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return null}function Z(e,t){var n=e.polylineEdge;if(2===n.intersectionPoints.length){var r=n.intersectionPoints[n.intersectionPoints.length-1];if(r===e){var o=n.intersectionPoints[0];return t.push(o.p),o.incrementVisitCount(),o}return t.push(r.p),r.incrementVisitCount(),r}if(n.intersectionPoints.length>2&&n.intersectionPoints[0]!==e){var i=K(e,n.intersectionPoints),a=n.intersectionPoints[i-1];return t.push(a.p),a.incrementVisitCount(),a}for(var u=!0;u;){if(t.push(n.p1.p),void 0===(n=n.prevEdge).originalIndex)return e;n.intersectionPoints.length>0&&(u=!1)}if(void 0===n.originalIndex)return e;var l=n.intersectionPoints[n.intersectionPoints.length-1];return l.incrementVisitCount(),t.push(l.p),l}function J(e,t){var n=e.polylineEdge;if(n.intersectionPoints.length>1&&n.intersectionPoints[n.intersectionPoints.length-1]!==e){var r=K(e,n.intersectionPoints),o=n.intersectionPoints[r+1];return t.push(o.p),o.incrementVisitCount(),o}for(var i=!0;i;){if(t.push(n.p2.p),null===(n=n.nextEdge))return e;n.intersectionPoints.length>0&&(i=!1)}if(void 0===n)return e;var a=n.intersectionPoints[0];return a.incrementVisitCount(),t.push(a.p),a}var Q=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,ee=Math.ceil,te=Math.floor,ne="[BigNumber Error] ",re=ne+"Number primitive has more than 15 significant digits: ",oe=1e14,ie=14,ae=9007199254740991,ue=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],le=1e7,se=1e9;function ce(e){var t=0|e;return e>0||e===t?t:t-1}function fe(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=ie-t.length;n--;t="0"+t);i+=t}for(o=i.length;48===i.charCodeAt(--o););return i.slice(0,o+1||1)}function pe(e,t){var n,r,o=e.c,i=t.c,a=e.s,u=t.s,l=e.e,s=t.e;if(!a||!u)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-u:a;if(a!=u)return a;if(n=a<0,r=l==s,!o||!i)return r?0:!o^n?1:-1;if(!r)return l>s^n?1:-1;for(u=(l=o.length)<(s=i.length)?l:s,a=0;a<u;a++)if(o[a]!=i[a])return o[a]>i[a]^n?1:-1;return l==s?0:l>s^n?1:-1}function de(e,t,n,r){if(e<t||e>n||e!==te(e))throw Error(ne+(r||"Argument")+("number"==typeof e?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function he(e){var t=e.c.length-1;return ce(e.e/ie)==t&&e.c[t]%2!=0}function ye(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function ge(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(++t>(r=e.length)){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var ve=function e(t){var n,r,o,i,a,u,l,s,c,f,p=_.prototype={constructor:_,toString:null,valueOf:null},d=new _(1),h=20,y=4,g=-7,v=21,m=-1e7,b=1e7,S=!1,w=1,E=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function _(e,t){var n,i,a,u,l,s,c,f,p=this;if(!(p instanceof _))return new _(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>b?p.c=p.e=null:e.e<m?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((s="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,l=e;l>=10;l/=10,u++);return void(u>b?p.c=p.e=null:(p.e=u,p.c=[e]))}f=String(e)}else{if(!Q.test(f=String(e)))return o(p,f,s);p.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(u=f.indexOf("."))>-1&&(f=f.replace(".","")),(l=f.search(/e/i))>0?(u<0&&(u=l),u+=+f.slice(l+1),f=f.substring(0,l)):u<0&&(u=f.length)}else{if(de(t,2,O.length,"Base"),10==t&&x)return C(p=new _(e),h+p.e+1,y);if(f=String(e),s="number"==typeof e){if(0*e!=0)return o(p,f,s,t);if(p.s=1/e<0?(f=f.slice(1),-1):1,_.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(re+e)}else p.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=O.slice(0,t),u=l=0,c=f.length;l<c;l++)if(n.indexOf(i=f.charAt(l))<0){if("."==i){if(l>u){u=c;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,l=-1,u=0;continue}return o(p,String(e),s,t)}s=!1,(u=(f=r(f,t,10,p.s)).indexOf("."))>-1?f=f.replace(".",""):u=f.length}for(l=0;48===f.charCodeAt(l);l++);for(c=f.length;48===f.charCodeAt(--c););if(f=f.slice(l,++c)){if(c-=l,s&&_.DEBUG&&c>15&&(e>ae||e!==te(e)))throw Error(re+p.s*e);if((u=u-l-1)>b)p.c=p.e=null;else if(u<m)p.c=[p.e=0];else{if(p.e=u,p.c=[],l=(u+1)%ie,u<0&&(l+=ie),l<c){for(l&&p.c.push(+f.slice(0,l)),c-=ie;l<c;)p.c.push(+f.slice(l,l+=ie));l=ie-(f=f.slice(l)).length}else l-=c;for(;l--;f+="0");p.c.push(+f)}}else p.c=[p.e=0]}function A(e,t,n,r){var o,i,a,u,l;if(null==n?n=y:de(n,0,8),!e.c)return e.toString();if(o=e.c[0],a=e.e,null==t)l=fe(e.c),l=1==r||2==r&&(a<=g||a>=v)?ye(l,a):ge(l,a,"0");else if(i=(e=C(new _(e),t,n)).e,u=(l=fe(e.c)).length,1==r||2==r&&(t<=i||i<=g)){for(;u<t;l+="0",u++);l=ye(l,i)}else if(t-=a+(2===r&&i>a),l=ge(l,i,"0"),i+1>u){if(--t>0)for(l+=".";t--;l+="0");}else if((t+=i-u)>0)for(i+1==u&&(l+=".");t--;l+="0");return e.s<0&&o?"-"+l:l}function T(e,t){for(var n,r,o=1,i=new _(e[0]);o<e.length;o++)(!(r=new _(e[o])).s||(n=pe(i,r))===t||0===n&&i.s===t)&&(i=r);return i}function j(e,t,n){for(var r=1,o=t.length;!t[--o];t.pop());for(o=t[0];o>=10;o/=10,r++);return(n=r+n*ie-1)>b?e.c=e.e=null:n<m?e.c=[e.e=0]:(e.e=n,e.c=t),e}function C(e,t,n,r){var o,i,a,u,l,s,c,f=e.c,p=ue;if(f){e:{for(o=1,u=f[0];u>=10;u/=10,o++);if((i=t-o)<0)i+=ie,a=t,l=f[s=0],c=te(l/p[o-a-1]%10);else if((s=ee((i+1)/ie))>=f.length){if(!r)break e;for(;f.length<=s;f.push(0));l=c=0,o=1,a=(i%=ie)-ie+1}else{for(l=u=f[s],o=1;u>=10;u/=10,o++);c=(a=(i%=ie)-ie+o)<0?0:te(l/p[o-a-1]%10)}if(r=r||t<0||null!=f[s+1]||(a<0?l:l%p[o-a-1]),r=n<4?(c||r)&&(0==n||n==(e.s<0?3:2)):c>5||5==c&&(4==n||r||6==n&&(i>0?a>0?l/p[o-a]:0:f[s-1])%10&1||n==(e.s<0?8:7)),t<1||!f[0])return f.length=0,r?(t-=e.e+1,f[0]=p[(ie-t%ie)%ie],e.e=-t||0):f[0]=e.e=0,e;if(0==i?(f.length=s,u=1,s--):(f.length=s+1,u=p[ie-i],f[s]=a>0?te(l/p[o-a]%p[a])*u:0),r)for(;;){if(0==s){for(i=1,a=f[0];a>=10;a/=10,i++);for(a=f[0]+=u,u=1;a>=10;a/=10,u++);i!=u&&(e.e++,f[0]==oe&&(f[0]=1));break}if(f[s]+=u,f[s]!=oe)break;f[s--]=0,u=1}for(i=f.length;0===f[--i];f.pop());}e.e>b?e.c=e.e=null:e.e<m&&(e.c=[e.e=0])}return e}function k(e){var t,n=e.e;return null===n?e.toString():(t=fe(e.c),t=n<=g||n>=v?ye(t,n):ge(t,n,"0"),e.s<0?"-"+t:t)}return _.clone=e,_.ROUND_UP=0,_.ROUND_DOWN=1,_.ROUND_CEIL=2,_.ROUND_FLOOR=3,_.ROUND_HALF_UP=4,_.ROUND_HALF_DOWN=5,_.ROUND_HALF_EVEN=6,_.ROUND_HALF_CEIL=7,_.ROUND_HALF_FLOOR=8,_.EUCLID=9,_.config=_.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(ne+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(de(n=e[t],0,se,t),h=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(de(n=e[t],0,8,t),y=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(de(n[0],-se,0,t),de(n[1],0,se,t),g=n[0],v=n[1]):(de(n,-se,se,t),g=-(v=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)de(n[0],-se,-1,t),de(n[1],1,se,t),m=n[0],b=n[1];else{if(de(n,-se,se,t),!n)throw Error(ne+t+" cannot be zero: "+n);m=-(b=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(ne+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw S=!n,Error(ne+"crypto unavailable");S=n}else S=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(de(n=e[t],0,9,t),w=n),e.hasOwnProperty(t="POW_PRECISION")&&(de(n=e[t],0,se,t),E=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(ne+t+" not an object: "+n);P=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(n))throw Error(ne+t+" invalid: "+n);x="0123456789"==n.slice(0,10),O=n}}return{DECIMAL_PLACES:h,ROUNDING_MODE:y,EXPONENTIAL_AT:[g,v],RANGE:[m,b],CRYPTO:S,MODULO_MODE:w,POW_PRECISION:E,FORMAT:P,ALPHABET:O}},_.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!_.DEBUG)return!0;var t,n,r=e.c,o=e.e,i=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===i||-1===i)&&o>=-se&&o<=se&&o===te(o)){if(0===r[0]){if(0===o&&1===r.length)return!0;break e}if((t=(o+1)%ie)<1&&(t+=ie),String(r[0]).length==t){for(t=0;t<r.length;t++)if((n=r[t])<0||n>=oe||n!==te(n))break e;if(0!==n)return!0}}}else if(null===r&&null===o&&(null===i||1===i||-1===i))return!0;throw Error(ne+"Invalid BigNumber: "+e)},_.maximum=_.max=function(){return T(arguments,-1)},_.minimum=_.min=function(){return T(arguments,1)},_.random=(i=9007199254740992,a=Math.random()*i&2097151?function(){return te(Math.random()*i)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,o,i,u=0,l=[],s=new _(d);if(null==e?e=h:de(e,0,se),o=ee(e/ie),S)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(o*=2));u<o;)(i=131072*t[u]+(t[u+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[u]=n[0],t[u+1]=n[1]):(l.push(i%1e14),u+=2);u=o/2}else{if(!crypto.randomBytes)throw S=!1,Error(ne+"crypto unavailable");for(t=crypto.randomBytes(o*=7);u<o;)(i=281474976710656*(31&t[u])+1099511627776*t[u+1]+4294967296*t[u+2]+16777216*t[u+3]+(t[u+4]<<16)+(t[u+5]<<8)+t[u+6])>=9e15?crypto.randomBytes(7).copy(t,u):(l.push(i%1e14),u+=7);u=o/7}if(!S)for(;u<o;)(i=a())<9e15&&(l[u++]=i%1e14);for(o=l[--u],e%=ie,o&&e&&(i=ue[ie-e],l[u]=te(o/i)*i);0===l[u];l.pop(),u--);if(u<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=ie);for(u=1,i=l[0];i>=10;i/=10,u++);u<ie&&(r-=ie-u)}return s.e=r,s.c=l,s}),_.sum=function(){for(var e=1,t=arguments,n=new _(t[0]);e<t.length;)n=n.plus(t[e++]);return n},r=function(){var e="0123456789";function t(e,t,n,r){for(var o,i,a=[0],u=0,l=e.length;u<l;){for(i=a.length;i--;a[i]*=t);for(a[0]+=r.indexOf(e.charAt(u++)),o=0;o<a.length;o++)a[o]>n-1&&(null==a[o+1]&&(a[o+1]=0),a[o+1]+=a[o]/n|0,a[o]%=n)}return a.reverse()}return function(r,o,i,a,u){var l,s,c,f,p,d,g,v,m=r.indexOf("."),b=h,S=y;for(m>=0&&(f=E,E=0,r=r.replace(".",""),d=(v=new _(o)).pow(r.length-m),E=f,v.c=t(ge(fe(d.c),d.e,"0"),10,i,e),v.e=v.c.length),c=f=(g=t(r,o,i,u?(l=O,e):(l=e,O))).length;0==g[--f];g.pop());if(!g[0])return l.charAt(0);if(m<0?--c:(d.c=g,d.e=c,d.s=a,g=(d=n(d,v,b,S,i)).c,p=d.r,c=d.e),m=g[s=c+b+1],f=i/2,p=p||s<0||null!=g[s+1],p=S<4?(null!=m||p)&&(0==S||S==(d.s<0?3:2)):m>f||m==f&&(4==S||p||6==S&&1&g[s-1]||S==(d.s<0?8:7)),s<1||!g[0])r=p?ge(l.charAt(1),-b,l.charAt(0)):l.charAt(0);else{if(g.length=s,p)for(--i;++g[--s]>i;)g[s]=0,s||(++c,g=[1].concat(g));for(f=g.length;!g[--f];);for(m=0,r="";m<=f;r+=l.charAt(g[m++]));r=ge(r,c,l.charAt(0))}return r}}(),n=function(){function e(e,t,n){var r,o,i,a,u=0,l=e.length,s=t%le,c=t/le|0;for(e=e.slice();l--;)u=((o=s*(i=e[l]%le)+(r=c*i+(a=e[l]/le|0)*s)%le*le+u)/n|0)+(r/le|0)+c*a,e[l]=o%n;return u&&(e=[u].concat(e)),e}function t(e,t,n,r){var o,i;if(n!=r)i=n>r?1:-1;else for(o=i=0;o<n;o++)if(e[o]!=t[o]){i=e[o]>t[o]?1:-1;break}return i}function n(e,t,n,r){for(var o=0;n--;)e[n]-=o,o=e[n]<t[n]?1:0,e[n]=o*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,o,i,a,u){var l,s,c,f,p,d,h,y,g,v,m,b,S,w,E,P,O,x=r.s==o.s?1:-1,A=r.c,T=o.c;if(!(A&&A[0]&&T&&T[0]))return new _(r.s&&o.s&&(A?!T||A[0]!=T[0]:T)?A&&0==A[0]||!T?0*x:x/0:NaN);for(g=(y=new _(x)).c=[],x=i+(s=r.e-o.e)+1,u||(u=oe,s=ce(r.e/ie)-ce(o.e/ie),x=x/ie|0),c=0;T[c]==(A[c]||0);c++);if(T[c]>(A[c]||0)&&s--,x<0)g.push(1),f=!0;else{for(w=A.length,P=T.length,c=0,x+=2,(p=te(u/(T[0]+1)))>1&&(T=e(T,p,u),A=e(A,p,u),P=T.length,w=A.length),S=P,m=(v=A.slice(0,P)).length;m<P;v[m++]=0);O=T.slice(),O=[0].concat(O),E=T[0],T[1]>=u/2&&E++;do{if(p=0,(l=t(T,v,P,m))<0){if(b=v[0],P!=m&&(b=b*u+(v[1]||0)),(p=te(b/E))>1)for(p>=u&&(p=u-1),h=(d=e(T,p,u)).length,m=v.length;1==t(d,v,h,m);)p--,n(d,P<h?O:T,h,u),h=d.length,l=1;else 0==p&&(l=p=1),h=(d=T.slice()).length;if(h<m&&(d=[0].concat(d)),n(v,d,m,u),m=v.length,-1==l)for(;t(T,v,P,m)<1;)p++,n(v,P<m?O:T,m,u),m=v.length}else 0===l&&(p++,v=[0]);g[c++]=p,v[0]?v[m++]=A[S]||0:(v=[A[S]],m=1)}while((S++<w||null!=v[0])&&x--);f=null!=v[0],g[0]||g.splice(0,1)}if(u==oe){for(c=1,x=g[0];x>=10;x/=10,c++);C(y,i+(y.e=c+s*ie-1)+1,a,f)}else y.e=s,y.r=+f;return y}}(),u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,s=/^\.([^.]+)$/,c=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,o=function(e,t,n,r){var o,i=n?t:t.replace(f,"");if(c.test(i))e.s=isNaN(i)?null:i<0?-1:1;else{if(!n&&(i=i.replace(u,function(e,t,n){return o="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=o?e:t}),r&&(o=r,i=i.replace(l,"$1").replace(s,"0.$1")),t!=i))return new _(i,o);if(_.DEBUG)throw Error(ne+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},p.absoluteValue=p.abs=function(){var e=new _(this);return e.s<0&&(e.s=1),e},p.comparedTo=function(e,t){return pe(this,new _(e,t))},p.decimalPlaces=p.dp=function(e,t){var n,r,o,i=this;if(null!=e)return de(e,0,se),null==t?t=y:de(t,0,8),C(new _(i),e+i.e+1,t);if(!(n=i.c))return null;if(r=((o=n.length-1)-ce(this.e/ie))*ie,o=n[o])for(;o%10==0;o/=10,r--);return r<0&&(r=0),r},p.dividedBy=p.div=function(e,t){return n(this,new _(e,t),h,y)},p.dividedToIntegerBy=p.idiv=function(e,t){return n(this,new _(e,t),0,1)},p.exponentiatedBy=p.pow=function(e,t){var n,r,o,i,a,u,l,s,c=this;if((e=new _(e)).c&&!e.isInteger())throw Error(ne+"Exponent not an integer: "+k(e));if(null!=t&&(t=new _(t)),a=e.e>14,!c.c||!c.c[0]||1==c.c[0]&&!c.e&&1==c.c.length||!e.c||!e.c[0])return s=new _(Math.pow(+k(c),a?e.s*(2-he(e)):+k(e))),t?s.mod(t):s;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new _(NaN);(r=!u&&c.isInteger()&&t.isInteger())&&(c=c.mod(t))}else{if(e.e>9&&(c.e>0||c.e<-1||(0==c.e?c.c[0]>1||a&&c.c[1]>=24e7:c.c[0]<8e13||a&&c.c[0]<=9999975e7)))return i=c.s<0&&he(e)?-0:0,c.e>-1&&(i=1/i),new _(u?1/i:i);E&&(i=ee(E/ie+2))}for(a?(n=new _(.5),u&&(e.s=1),l=he(e)):l=(o=Math.abs(+k(e)))%2,s=new _(d);;){if(l){if(!(s=s.times(c)).c)break;i?s.c.length>i&&(s.c.length=i):r&&(s=s.mod(t))}if(o){if(0===(o=te(o/2)))break;l=o%2}else if(C(e=e.times(n),e.e+1,1),e.e>14)l=he(e);else{if(0===(o=+k(e)))break;l=o%2}c=c.times(c),i?c.c&&c.c.length>i&&(c.c.length=i):r&&(c=c.mod(t))}return r?s:(u&&(s=d.div(s)),t?s.mod(t):i?C(s,E,y,void 0):s)},p.integerValue=function(e){var t=new _(this);return null==e?e=y:de(e,0,8),C(t,t.e+1,e)},p.isEqualTo=p.eq=function(e,t){return 0===pe(this,new _(e,t))},p.isFinite=function(){return!!this.c},p.isGreaterThan=p.gt=function(e,t){return pe(this,new _(e,t))>0},p.isGreaterThanOrEqualTo=p.gte=function(e,t){return 1===(t=pe(this,new _(e,t)))||0===t},p.isInteger=function(){return!!this.c&&ce(this.e/ie)>this.c.length-2},p.isLessThan=p.lt=function(e,t){return pe(this,new _(e,t))<0},p.isLessThanOrEqualTo=p.lte=function(e,t){return-1===(t=pe(this,new _(e,t)))||0===t},p.isNaN=function(){return!this.s},p.isNegative=function(){return this.s<0},p.isPositive=function(){return this.s>0},p.isZero=function(){return!!this.c&&0==this.c[0]},p.minus=function(e,t){var n,r,o,i,a=this,u=a.s;if(t=(e=new _(e,t)).s,!u||!t)return new _(NaN);if(u!=t)return e.s=-t,a.plus(e);var l=a.e/ie,s=e.e/ie,c=a.c,f=e.c;if(!l||!s){if(!c||!f)return c?(e.s=-t,e):new _(f?a:NaN);if(!c[0]||!f[0])return f[0]?(e.s=-t,e):new _(c[0]?a:3==y?-0:0)}if(l=ce(l),s=ce(s),c=c.slice(),u=l-s){for((i=u<0)?(u=-u,o=c):(s=l,o=f),o.reverse(),t=u;t--;o.push(0));o.reverse()}else for(r=(i=(u=c.length)<(t=f.length))?u:t,u=t=0;t<r;t++)if(c[t]!=f[t]){i=c[t]<f[t];break}if(i&&(o=c,c=f,f=o,e.s=-e.s),(t=(r=f.length)-(n=c.length))>0)for(;t--;c[n++]=0);for(t=oe-1;r>u;){if(c[--r]<f[r]){for(n=r;n&&!c[--n];c[n]=t);--c[n],c[r]+=oe}c[r]-=f[r]}for(;0==c[0];c.splice(0,1),--s);return c[0]?j(e,c,s):(e.s=3==y?-1:1,e.c=[e.e=0],e)},p.modulo=p.mod=function(e,t){var r,o,i=this;return e=new _(e,t),!i.c||!e.s||e.c&&!e.c[0]?new _(NaN):!e.c||i.c&&!i.c[0]?new _(i):(9==w?(o=e.s,e.s=1,r=n(i,e,0,3),e.s=o,r.s*=o):r=n(i,e,0,w),(e=i.minus(r.times(e))).c[0]||1!=w||(e.s=i.s),e)},p.multipliedBy=p.times=function(e,t){var n,r,o,i,a,u,l,s,c,f,p,d,h,y,g,v=this,m=v.c,b=(e=new _(e,t)).c;if(!(m&&b&&m[0]&&b[0]))return!v.s||!e.s||m&&!m[0]&&!b||b&&!b[0]&&!m?e.c=e.e=e.s=null:(e.s*=v.s,m&&b?(e.c=[0],e.e=0):e.c=e.e=null),e;for(r=ce(v.e/ie)+ce(e.e/ie),e.s*=v.s,(l=m.length)<(f=b.length)&&(h=m,m=b,b=h,o=l,l=f,f=o),o=l+f,h=[];o--;h.push(0));for(y=oe,g=le,o=f;--o>=0;){for(n=0,p=b[o]%g,d=b[o]/g|0,i=o+(a=l);i>o;)n=((s=p*(s=m[--a]%g)+(u=d*s+(c=m[a]/g|0)*p)%g*g+h[i]+n)/y|0)+(u/g|0)+d*c,h[i--]=s%y;h[i]=n}return n?++r:h.splice(0,1),j(e,h,r)},p.negated=function(){var e=new _(this);return e.s=-e.s||null,e},p.plus=function(e,t){var n,r=this,o=r.s;if(t=(e=new _(e,t)).s,!o||!t)return new _(NaN);if(o!=t)return e.s=-t,r.minus(e);var i=r.e/ie,a=e.e/ie,u=r.c,l=e.c;if(!i||!a){if(!u||!l)return new _(o/0);if(!u[0]||!l[0])return l[0]?e:new _(u[0]?r:0*o)}if(i=ce(i),a=ce(a),u=u.slice(),o=i-a){for(o>0?(a=i,n=l):(o=-o,n=u),n.reverse();o--;n.push(0));n.reverse()}for((o=u.length)-(t=l.length)<0&&(n=l,l=u,u=n,t=o),o=0;t;)o=(u[--t]=u[t]+l[t]+o)/oe|0,u[t]=oe===u[t]?0:u[t]%oe;return o&&(u=[o].concat(u),++a),j(e,u,a)},p.precision=p.sd=function(e,t){var n,r,o,i=this;if(null!=e&&e!==!!e)return de(e,1,se),null==t?t=y:de(t,0,8),C(new _(i),e,t);if(!(n=i.c))return null;if(r=(o=n.length-1)*ie+1,o=n[o]){for(;o%10==0;o/=10,r--);for(o=n[0];o>=10;o/=10,r++);}return e&&i.e+1>r&&(r=i.e+1),r},p.shiftedBy=function(e){return de(e,-9007199254740991,ae),this.times("1e"+e)},p.squareRoot=p.sqrt=function(){var e,t,r,o,i,a=this,u=a.c,l=a.s,s=a.e,c=h+4,f=new _("0.5");if(1!==l||!u||!u[0])return new _(!l||l<0&&(!u||u[0])?NaN:u?a:1/0);if(0==(l=Math.sqrt(+k(a)))||l==1/0?(((t=fe(u)).length+s)%2==0&&(t+="0"),l=Math.sqrt(+t),s=ce((s+1)/2)-(s<0||s%2),r=new _(t=l==1/0?"5e"+s:(t=l.toExponential()).slice(0,t.indexOf("e")+1)+s)):r=new _(l+""),r.c[0])for((l=(s=r.e)+c)<3&&(l=0);;)if(i=r,r=f.times(i.plus(n(a,i,c,1))),fe(i.c).slice(0,l)===(t=fe(r.c)).slice(0,l)){if(r.e<s&&--l,"9999"!=(t=t.slice(l-3,l+1))&&(o||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(C(r,r.e+h+2,1),e=!r.times(r).eq(a));break}if(!o&&(C(i,i.e+h+2,0),i.times(i).eq(a))){r=i;break}c+=4,l+=4,o=1}return C(r,r.e+h+1,y,e)},p.toExponential=function(e,t){return null!=e&&(de(e,0,se),e++),A(this,e,t,1)},p.toFixed=function(e,t){return null!=e&&(de(e,0,se),e=e+this.e+1),A(this,e,t)},p.toFormat=function(e,t,n){var r,o=this;if(null==n)null!=e&&t&&"object"==typeof t?(n=t,t=null):e&&"object"==typeof e?(n=e,e=t=null):n=P;else if("object"!=typeof n)throw Error(ne+"Argument not an object: "+n);if(r=o.toFixed(e,t),o.c){var i,a=r.split("."),u=+n.groupSize,l=+n.secondaryGroupSize,s=n.groupSeparator||"",c=a[0],f=a[1],p=o.s<0,d=p?c.slice(1):c,h=d.length;if(l&&(i=u,u=l,l=i,h-=i),u>0&&h>0){for(i=h%u||u,c=d.substr(0,i);i<h;i+=u)c+=s+d.substr(i,u);l>0&&(c+=s+d.slice(i)),p&&(c="-"+c)}r=f?c+(n.decimalSeparator||"")+((l=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):c}return(n.prefix||"")+r+(n.suffix||"")},p.toFraction=function(e){var t,r,o,i,a,u,l,s,c,f,p,h,g=this,v=g.c;if(null!=e&&(!(l=new _(e)).isInteger()&&(l.c||1!==l.s)||l.lt(d)))throw Error(ne+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+k(l));if(!v)return new _(g);for(t=new _(d),c=r=new _(d),o=s=new _(d),h=fe(v),a=t.e=h.length-g.e-1,t.c[0]=ue[(u=a%ie)<0?ie+u:u],e=!e||l.comparedTo(t)>0?a>0?t:c:l,u=b,b=1/0,l=new _(h),s.c[0]=0;f=n(l,t,0,1),1!=(i=r.plus(f.times(o))).comparedTo(e);)r=o,o=i,c=s.plus(f.times(i=c)),s=i,t=l.minus(f.times(i=t)),l=i;return i=n(e.minus(r),o,0,1),s=s.plus(i.times(c)),r=r.plus(i.times(o)),s.s=c.s=g.s,p=n(c,o,a*=2,y).minus(g).abs().comparedTo(n(s,r,a,y).minus(g).abs())<1?[c,o]:[s,r],b=u,p},p.toNumber=function(){return+k(this)},p.toPrecision=function(e,t){return null!=e&&de(e,1,se),A(this,e,t,2)},p.toString=function(e){var t,n=this,o=n.s,i=n.e;return null===i?o?(t="Infinity",o<0&&(t="-"+t)):t="NaN":(null==e?t=i<=g||i>=v?ye(fe(n.c),i):ge(fe(n.c),i,"0"):10===e&&x?t=ge(fe((n=C(new _(n),h+i+1,y)).c),n.e,"0"):(de(e,2,O.length,"Base"),t=r(ge(fe(n.c),i,"0"),10,e,o,!0)),o<0&&n.c[0]&&(t="-"+t)),t},p.valueOf=p.toJSON=function(){return k(this)},p._isBigNumber=!0,p[Symbol.toStringTag]="BigNumber",p[Symbol.for("nodejs.util.inspect.custom")]=p.valueOf,null!=t&&_.set(t),_}(),me=ve,be=class{key;left=null;right=null;constructor(e){this.key=e}},Se=class extends be{constructor(e){super(e)}},we=class{size=0;modificationCount=0;splayCount=0;splay(e){const t=this.root;if(null==t)return this.compare(e,e),-1;let n=null,r=null,o=null,i=null,a=t;const u=this.compare;let l;for(;;)if(l=u(a.key,e),l>0){let t=a.left;if(null==t)break;if(l=u(t.key,e),l>0&&(a.left=t.right,t.right=a,a=t,t=a.left,null==t))break;null==n?r=a:n.left=a,n=a,a=t}else{if(!(l<0))break;{let t=a.right;if(null==t)break;if(l=u(t.key,e),l<0&&(a.right=t.left,t.left=a,a=t,t=a.right,null==t))break;null==o?i=a:o.right=a,o=a,a=t}}return null!=o&&(o.right=a.left,a.left=i),null!=n&&(n.left=a.right,a.right=r),this.root!==a&&(this.root=a,this.splayCount++),l}splayMin(e){let t=e,n=t.left;for(;null!=n;){const e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;null!=n;){const e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(null==this.root)return null;if(0!=this.splay(e))return null;let t=this.root;const n=t,r=t.left;if(this.size--,null==r)this.root=t.right;else{const e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;const n=this.root;null!=n?(t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e):this.root=e}_first(){const e=this.root;return null==e?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return null==e?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&0==this.splay(e)}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},Ee=(Symbol.iterator,Symbol.toStringTag,class e extends we{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>null!=e&&null!=e)}delete(e){return!!this.validKey(e)&&null!=this._delete(e)}deleteAll(e){for(const t of e)this.delete(t)}forEach(e){const t=this[Symbol.iterator]();let n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this}addAndReturn(e){const t=this.splay(e);return 0!=t&&this.addNewRoot(new Se(e),t),this.root.key}addAll(e){for(const t of e)this.add(t)}isEmpty(){return null==this.root}isNotEmpty(){return null!=this.root}single(){if(0==this.size)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(0==this.size)throw"Bad state: No element";return this._first().key}last(){if(0==this.size)throw"Bad state: No element";return this._last().key}lastBefore(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(null==t)return null;let n=t.right;for(;null!=n;)t=n,n=t.right;return t.key}firstAfter(e){if(null==e)throw"Invalid arguments(s)";if(null==this.root)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(null==t)return null;let n=t.left;for(;null!=n;)t=n,n=t.left;return t.key}retainAll(t){const n=new e(this.compare,this.validKey),r=this.modificationCount;for(const e of t){if(r!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(e)&&0==this.splay(e)&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return this.validKey(e)?0!=this.splay(e)?null:this.root.key:null}intersection(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)&&n.add(e);return n}difference(t){const n=new e(this.compare,this.validKey);for(const e of this)t.has(e)||n.add(e);return n}union(e){const t=this.clone();return t.addAll(e),t}clone(){const t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(null==e)return null;const t=new Se(e.key);return function e(t,n){let r,o;do{if(r=t.left,o=t.right,null!=r){const t=new Se(r.key);n.left=t,e(r,t)}if(null!=o){const e=new Se(o.key);n.right=e,t=o,n=e}}while(null!=o)}(e,t),t}toSet(){return this.clone()}entries(){return new xe(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Oe(this.wrap())}[Symbol.toStringTag]="[object Set]"}),Pe=class{tree;path=new Array;modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;null!=e;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(null==this.modificationCount){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;null!=e;)this.path.push(e),e=e.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(null!=t){for(;null!=t;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Oe=class extends Pe{getValue(e){return e.key}},xe=class extends Pe{getValue(e){return[e.key,e.key]}},_e=e=>()=>e,Ae=e=>{const t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):_e(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function Te(e){const t=e?(t,n,r,o,i)=>t.exponentiatedBy(2).isLessThanOrEqualTo(o.minus(n).exponentiatedBy(2).plus(i.minus(r).exponentiatedBy(2)).times(e)):_e(!1);return(e,n,r)=>{const o=e.x,i=e.y,a=r.x,u=r.y,l=i.minus(u).times(n.x.minus(a)).minus(o.minus(a).times(n.y.minus(u)));return t(l,o,i,a,u)?0:l.comparedTo(0)}}var je=e=>e,Ce=e=>{if(e){const t=new Ee(Ae(e)),n=new Ee(Ae(e)),r=(e,t)=>t.addAndReturn(e),o=e=>({x:r(e.x,t),y:r(e.y,n)});return o({x:new me(0),y:new me(0)}),o}return je},ke=e=>({set:e=>{Ie=ke(e)},reset:()=>ke(e),compare:Ae(e),snap:Ce(e),orient:Te(e)}),Ie=ke(),Me=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Le=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x;return{ll:{x:n,y:e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y},ur:{x:r,y:e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y}}},Re=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),Ne=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),De=e=>Ne(e,e).sqrt(),Ge=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},o={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Re(o,r).div(De(o)).div(De(r))},Fe=(e,t,n)=>{const r={x:t.x.minus(e.x),y:t.y.minus(e.y)},o={x:n.x.minus(e.x),y:n.y.minus(e.y)};return Ne(o,r).div(De(o)).div(De(r))},Ve=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},Be=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},Ue=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){const r=e.comparePoints(t.point,n.point);return 0!==r?r:(t.point!==n.point&&t.link(n),t.isLeft!==n.isLeft?t.isLeft?1:-1:Ke.compare(t.segment,n.segment))}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw new Error("Tried to link already linked events");const t=e.point.events;for(let e=0,n=t.length;e<n;e++){const n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const e=this.point.events.length;for(let t=0;t<e;t++){const n=this.point.events[t];if(void 0===n.segment.consumedBy)for(let r=t+1;r<e;r++){const e=this.point.events[r];void 0===e.consumedBy&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){const e=[];for(let t=0,n=this.point.events.length;t<n;t++){const n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){const t=new Map,n=n=>{const r=n.otherSE;t.set(n,{sine:Ge(this.point,e.point,r.point),cosine:Fe(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);const{sine:o,cosine:i}=t.get(e),{sine:a,cosine:u}=t.get(r);return o.isGreaterThanOrEqualTo(0)&&a.isGreaterThanOrEqualTo(0)?i.isLessThan(u)?1:i.isGreaterThan(u)?-1:0:o.isLessThan(0)&&a.isLessThan(0)?i.isLessThan(u)?-1:i.isGreaterThan(u)?1:0:a.isLessThan(o)?-1:a.isGreaterThan(o)?1:0}}},He=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];if(!o.isInResult()||o.ringOut)continue;let i=null,a=o.leftSE,u=o.rightSE;const l=[a],s=a.point,c=[];for(;i=a,a=u,l.push(a),a.point!==s;)for(;;){const t=a.getAvailableLinkedEvents();if(0===t.length){const e=l[0].point,t=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(1===t.length){u=t[0].otherSE;break}let r=null;for(let e=0,t=c.length;e<t;e++)if(c[e].point===a.point){r=e;break}if(null!==r){const t=c.splice(r)[0],o=l.splice(t.index);o.unshift(o[0].otherSE),n.push(new e(o.reverse()));continue}c.push({index:l.length,point:a.point});const o=a.getLeftmostComparator(i);u=t.sort(o)[0].otherSE;break}n.push(new e(l))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point;const t=[e];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,o=this.events[n+1].point;0!==Ie.orient(r,e,o)&&(t.push(r),e=r)}if(1===t.length)return null;const n=t[0],r=t[1];0===Ie.orient(n,e,r)&&t.shift(),t.push(t[0]);const o=this.isExteriorRing()?1:-1,i=this.isExteriorRing()?0:t.length-1,a=this.isExteriorRing()?t.length:-1,u=[];for(let e=i;e!=a;e+=o)u.push([t[e].x.toNumber(),t[e].y.toNumber()]);return u}isExteriorRing(){if(void 0===this._isExteriorRing){const e=this.enclosingRing();this._isExteriorRing=!e||!e.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){const n=this.events[t];Ue.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()!==t.ringOut?t.ringOut:t.ringOut?.enclosingRing();t=n.prevInResult(),n=t?t.prevInResult():null}}},qe=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(null===e)return null;const t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}},ze=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getGeom();null!==n&&e.push(n)}return e}_composePolys(e){const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new qe(r));else{const e=r.enclosingRing();e?.poly||t.push(new qe(e)),e?.poly?.addInterior(r)}}return t}},We=class{queue;tree;segments;constructor(e,t=Ke.compare){this.queue=e,this.tree=new Ee(t),this.segments=[]}process(e){const t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,o=t;do{r=this.tree.lastBefore(r)}while(null!=r&&null!=r.consumedBy);do{o=this.tree.firstAfter(o)}while(null!=o&&null!=o.consumedBy);if(e.isLeft){let i=null;if(r){const e=r.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(i=e),!r.isAnEndpoint(e))){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let a=null;if(o){const e=o.getIntersection(t);if(null!==e&&(t.isAnEndpoint(e)||(a=e),!o.isAnEndpoint(e))){const t=this._splitSafely(o,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(null!==i||null!==a){let e=null;e=null===i?a:null===a||Ue.comparePoints(i,a)<=0?i:a,this.queue.delete(t.rightSE),n.push(t.rightSE);const r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&o){const e=r.getIntersection(o);if(null!==e){if(!r.isAnEndpoint(e)){const t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!o.isAnEndpoint(e)){const t=this._splitSafely(o,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);const n=e.rightSE;this.queue.delete(n);const r=e.split(t);return r.push(n),void 0===e.consumedBy&&this.tree.add(e),r}},Ye=new class{type;numMultiPolys;run(e,t,n){Ye.type=e;const r=[new Qe(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Qe(n[e],!1));if(Ye.numMultiPolys=r.length,"difference"===Ye.type){const e=r[0];let t=1;for(;t<r.length;)null!==Le(r[t].bbox,e.bbox)?t++:r.splice(t,1)}if("intersection"===Ye.type)for(let e=0,t=r.length;e<t;e++){const t=r[e];for(let n=e+1,o=r.length;n<o;n++)if(null===Le(t.bbox,r[n].bbox))return[]}const o=new Ee(Ue.compare);for(let e=0,t=r.length;e<t;e++){const t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)o.add(t[e])}const i=new We(o);let a=null;for(0!=o.size&&(a=o.first(),o.delete(a));a;){const e=i.process(a);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&o.add(n)}0!=o.size?(a=o.first(),o.delete(a)):a=null}Ie.reset();const u=He.factory(i.segments);return new ze(u).getGeom()}},$e=Ye,Xe=0,Ke=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){const n=e.leftSE.point.x,r=t.leftSE.point.x,o=e.rightSE.point.x,i=t.rightSE.point.x;if(i.isLessThan(n))return 1;if(o.isLessThan(r))return-1;const a=e.leftSE.point.y,u=t.leftSE.point.y,l=e.rightSE.point.y,s=t.rightSE.point.y;if(n.isLessThan(r)){if(u.isLessThan(a)&&u.isLessThan(l))return 1;if(u.isGreaterThan(a)&&u.isGreaterThan(l))return-1;const n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=t.comparePoint(e.rightSE.point);return 0!==r?r:-1}if(n.isGreaterThan(r)){if(a.isLessThan(u)&&a.isLessThan(s))return-1;if(a.isGreaterThan(u)&&a.isGreaterThan(s))return 1;const n=t.comparePoint(e.leftSE.point);if(0!==n)return n;const r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(a.isLessThan(u))return-1;if(a.isGreaterThan(u))return 1;if(o.isLessThan(i)){const n=t.comparePoint(e.rightSE.point);if(0!==n)return n}if(o.isGreaterThan(i)){const n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!o.eq(i)){const e=l.minus(a),t=o.minus(n),c=s.minus(u),f=i.minus(r);if(e.isGreaterThan(t)&&c.isLessThan(f))return 1;if(e.isLessThan(t)&&c.isGreaterThan(f))return-1}return o.isGreaterThan(i)?1:o.isLessThan(i)||l.isLessThan(s)?-1:l.isGreaterThan(s)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++Xe,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let o,i,a;const u=Ue.comparePoints(t,n);if(u<0)o=t,i=n,a=1;else{if(!(u>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);o=n,i=t,a=-1}const l=new Ue(o,!0),s=new Ue(i,!1);return new e(l,s,[r],[a])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return Ie.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){const t=this.bbox(),n=e.bbox(),r=Le(t,n);if(null===r)return null;const o=this.leftSE.point,i=this.rightSE.point,a=e.leftSE.point,u=e.rightSE.point,l=Me(t,a)&&0===this.comparePoint(a),s=Me(n,o)&&0===e.comparePoint(o),c=Me(t,u)&&0===this.comparePoint(u),f=Me(n,i)&&0===e.comparePoint(i);if(s&&l)return f&&!c?i:!f&&c?u:null;if(s)return c&&o.x.eq(u.x)&&o.y.eq(u.y)?null:o;if(l)return f&&i.x.eq(a.x)&&i.y.eq(a.y)?null:a;if(f&&c)return null;if(f)return i;if(c)return u;const p=((e,t,n,r)=>{if(t.x.isZero())return Be(n,r,e.x);if(r.x.isZero())return Be(e,t,n.x);if(t.y.isZero())return Ve(n,r,e.y);if(r.y.isZero())return Ve(e,t,n.y);const o=Re(t,r);if(o.isZero())return null;const i={x:n.x.minus(e.x),y:n.y.minus(e.y)},a=Re(i,t).div(o),u=Re(i,r).div(o),l=e.x.plus(u.times(t.x)),s=n.x.plus(a.times(r.x)),c=e.y.plus(u.times(t.y)),f=n.y.plus(a.times(r.y));return{x:l.plus(s).div(2),y:c.plus(f).div(2)}})(o,this.vector(),a,e.vector());return null===p?null:Me(r,p)?Ie.snap(p):null}split(t){const n=[],r=void 0!==t.events,o=new Ue(t,!0),i=new Ue(t,!1),a=this.rightSE;this.replaceRightSE(i),n.push(i),n.push(o);const u=new e(o,a,this.rings.slice(),this.windings.slice());return Ue.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),Ue.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(o.checkForConsuming(),i.checkForConsuming()),n}swapEvents(){const e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;const o=e.compare(n,r);if(0!==o){if(o>0){const e=n;n=r,r=e}if(n.prev===r){const e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){const t=r.rings[e],o=r.windings[e],i=n.rings.indexOf(t);-1===i?(n.rings.push(t),n.windings.push(o)):n.windings[i]+=o}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){const e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};const t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){const r=this.rings[e],o=this.windings[e],i=t.indexOf(r);-1===i?(t.push(r),n.push(o)):n[i]+=o}const o=[],i=[];for(let e=0,r=t.length;e<r;e++){if(0===n[e])continue;const r=t[e],a=r.poly;if(-1===i.indexOf(a))if(r.isExterior)o.push(a);else{-1===i.indexOf(a)&&i.push(a);const e=o.indexOf(r.poly);-1!==e&&o.splice(e,1)}}for(let e=0,t=o.length;e<t;e++){const t=o[e].multiPoly;-1===r.indexOf(t)&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch($e.type){case"union":{const n=0===e.length,r=0===t.length;this._isInResult=n!==r;break}case"intersection":{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===$e.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(e.length-t.length);this._isInResult=n%2==1;break}case"difference":{const n=e=>1===e.length&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Ze=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=n,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=Ie.snap({x:new me(e[0][0]),y:new me(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let o=r;for(let t=1,n=e.length;t<n;t++){if("number"!=typeof e[t][0]||"number"!=typeof e[t][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const n=Ie.snap({x:new me(e[t][0]),y:new me(e[t][1])});n.x.eq(o.x)&&n.y.eq(o.y)||(this.segments.push(Ke.fromRing(o,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),o=n)}r.x.eq(o.x)&&r.y.eq(o.y)||this.segments.push(Ke.fromRing(o,r,this))}getSweepEvents(){const e=[];for(let t=0,n=this.segments.length;t<n;t++){const n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Je=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ze(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){const n=new Ze(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){const n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Qe=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}catch(e){}this.polys=[],this.bbox={ll:{x:new me(Number.POSITIVE_INFINITY),y:new me(Number.POSITIVE_INFINITY)},ur:{x:new me(Number.NEGATIVE_INFINITY),y:new me(Number.NEGATIVE_INFINITY)}};for(let t=0,n=e.length;t<n;t++){const n=new Je(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,n=this.polys.length;t<n;t++){const n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}};Ie.set;function et(e,t,n={}){const r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}Math.PI;var tt=function(e,t={}){const n=[];if(function(e,t){var n,r,o,i,a,u,l,s,c,f,p=0,d="FeatureCollection"===e.type,h="Feature"===e.type,y=d?e.features.length:1;for(n=0;n<y;n++){for(u=d?e.features[n].geometry:h?e.geometry:e,s=d?e.features[n].properties:h?e.properties:{},c=d?e.features[n].bbox:h?e.bbox:void 0,f=d?e.features[n].id:h?e.id:void 0,a=(l=!!u&&"GeometryCollection"===u.type)?u.geometries.length:1,o=0;o<a;o++)if(null!==(i=l?u.geometries[o]:u))switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===t(i,p,s,c,f))return!1;break;case"GeometryCollection":for(r=0;r<i.geometries.length;r++)if(!1===t(i.geometries[r],p,s,c,f))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===t(null,p,s,c,f))return!1;p++}}(e,e=>{n.push(e.coordinates)}),n.length<2)throw new Error("Must have at least 2 geometries");const r=((e,...t)=>$e.run("union",e,t))(n[0],...n.slice(1));return 0===r.length?null:1===r.length?function(e,t,n={}){for(const t of e){if(t.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(t[t.length-1].length!==t[0].length)throw new Error("First and last Position are not equivalent.");for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw new Error("First and last Position are not equivalent.")}return et({type:"Polygon",coordinates:e},t,n)}(r[0],t.properties):function(e,t,n={}){return et({type:"MultiPolygon",coordinates:e},t,n)}(r,t.properties)},nt=n(278);function rt(e){return rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},rt(e)}function ot(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],l=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){s=!0,o=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,t)||lt(e,t)||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 it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function at(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?it(Object(n),!0).forEach(function(t){ut(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):it(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ut(e,t,n){return(t=function(e){var t=function(e){if("object"!=rt(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=rt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==rt(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lt(e,t){if(e){if("string"==typeof e)return st(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?st(e,t):void 0}}function st(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var ct=function(e,t){var n,r,o,i,a=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e.geometry.coordinates.map(function(e){return function(e){if(Array.isArray(e))return st(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||lt(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}),r=n.length-1,o=function(e,n){return[e[0]+(e[0]-n[0])*t,e[1]+(e[1]-n[1])*t]},i=o(n[0],n[1]),a=o(n[r],n[r-1]);return n[0]=i,n[r]=a,(0,nt.wi)(n)}(t);try{i=function(e,t){var n=[],r=[],o=[],i=function(e,t,n,r,o){for(var i=0,a=[],u="Feature"===t.type?t.geometry:t,l="LineString"===u.type?[u.coordinates]:u.coordinates,s=0,c=0;c<l.length;c++){for(var f=l[c].length-1,p=new D(l[c][0]),d=null,h={nextEdge:null},y=0;y<f;y++){d=new D(l[c][y+1]),p.nextPoint=d,d.prevPoint=p;var g=new N(p,d,"polyline",s,null);r.push(g),h.nextEdge=g,g.prevEdge=h,o[0]=Math.min(o[0],p.p[0]),o[1]=Math.min(o[1],p.p[1]),o[2]=Math.max(o[2],p.p[0]),o[3]=Math.max(o[3],p.p[1]),p=d,s+=1,h=g}o[0]=Math.min(o[0],l[c][f][0]),o[1]=Math.min(o[1],l[c][f][1]),o[2]=Math.max(o[2],l[c][f][0]),o[3]=Math.max(o[3],l[c][f][1])}for(var v="Feature"===e.type?e.geometry:e,m="Polygon"===v.type?[v.coordinates]:v.coordinates,b=m.length,S=0;S<b;S++)for(var w=m[S].length,E=0;E<w;E++){i+=1;var P=m[S][E],O=P.length;a.push(new G(i,P));for(var x=new D(P[0]),_=x,A=void 0,T=null,j={nextEdge:null,prevEdge:null},C=null,k=1;k<O;k++)A=new D(P[k]),_.nextPoint=A,A.prevPoint=_,T=new N(_,A,"polygon",s,i),j.nextEdge=T,T.prevEdge=j,1===k&&(C=T),E>0&&(T.interiorRing=!0),T.intersectPolylineBbox=F(T,o),n.push(T),_=A,s+=1,j=T;T.nextEdge=C,C.prevEdge=T,A.nextPoint=x.nextPoint,x.prevPoint=A.prevPoint}return a}(h(e),t,r,o,[1/0,1/0,1/0,1/0]);if(function(e,t,n){var r,o,i,a=t.length,u=e.length;for(r=0;r<a;r++){var l=t[r];for(o=0;o<u;o++){var s=e[o];if(s.intersectPolylineBbox&&!(s.maxX<l.minX||s.minX>l.maxX||s.maxY<l.minY||s.minY>l.maxY)){var c=z(l,s);if(null!==c)for(i=0;i<c.length;i++){var f=R(s.p1.p[0],s.p1.p[1],s.p2.p[0],s.p2.p[1],l.p1.p[0],l.p1.p[1]),p=new V(c[i],l,s,f>0);n.push(p)}}}}t.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolylineEdgeStart-t.distanceFromPolylineEdgeStart})}),e.forEach(function(e){e.intersectionPoints.sort(function(e,t){return e.distanceFromPolygonEdgeStart-t.distanceFromPolygonEdgeStart})})}(r,o,n),0===n.length)return e;var a={};i.forEach(function(e){return a[e.id]=0}),n.forEach(function(e){var t=e.polygonEdge.polygonContourId;a[t]=a[t]+1});for(var u=0,l=[],s=null,c=0;c<o.length;c++){var f=o[c];if(f.intersectionPoints.length>0){s=f.intersectionPoints[0];break}}for(var p=s,d={visitCount:1};s!==d&&!(u>2*n.length);){if(u=u++,d.visitCount>=2){for(var y=!1,g=0;g<n.length;g++){var v=n[g];if(v.visitCount<2){p=v,y=!0;break}}if(!y)break}p.visitCount=p.visitCount+1;var m=[];l.push(m),m.push(p.p),p.visitCount=p.visitCount+1;var b=X(p,m),S=!1;if(b===(d=b)&&2===n.length)for(var w=0;w<n.length;w++)n[w].visitCount<2&&(S=!0);for(;b!==p||S;)(b=(b.isHeadingIn?J:Z)(b,m))!==p&&(b=X(b,m)),S=!1;if(d.visitCount>=2){for(var E=!1,P=0;P<n.length;P++){var O=n[P];if(O.visitCount<2){p=O,E=!0;break}}E&&(d=p)}p=d}for(var x=l.map(function(e){return[e]}),_=Object.keys(a),A=0;A<_.length;A++){var T=_[A];0===a[T]&&$(Y(W(r,parseInt(T)),i),x)}return{type:"Feature",properties:{},geometry:{type:"MultiPolygon",coordinates:x}}}(e,a)}catch(e){return null}var u=[];if("MultiPolygon"!==i.geometry.type)return null;if(2!==i.geometry.coordinates.length)return null;u=i.geometry.coordinates.map(function(t){return(0,nt.n1)(t,e.properties)});var l=null!==(n=null!==(r=e.id)&&void 0!==r?r:null===(o=e.properties)||void 0===o?void 0:o.id)&&void 0!==n?n:"poly",s=u.map(function(t,n){return(0,nt.n1)(t.geometry.coordinates,at(at({},e.properties),{},{id:l}),{id:"".concat(l,"-").concat(n+1)})});return(0,nt.Lr)(s)},ft=function(e){var t,n,r,o,i;try{i=tt((0,nt.Lr)(e))}catch(e){return null}if("Polygon"!==(null===(t=i)||void 0===t||null===(t=t.geometry)||void 0===t?void 0:t.type))return null;var a=null!==(n=null!==(r=e[0].id)&&void 0!==r?r:null===(o=e[0].properties)||void 0===o?void 0:o.id)&&void 0!==n?n:"poly";return(0,nt.n1)(i.geometry.coordinates,at(at({},e[0].properties),{},{id:a}),{id:a})},pt=function(e,t){var n=ot(e,2),r=n[0],o=n[1],i=ot(t,2),a=i[0],u=i[1],l=function(e){return e*Math.PI/180},s=l(u-o),c=l(a-r),f=Math.pow(Math.sin(s/2),2)+Math.cos(l(o))*Math.cos(l(u))*Math.pow(Math.sin(c/2),2);return 12742e3*Math.atan2(Math.sqrt(f),Math.sqrt(1-f))},dt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01;if(e.length<=1)return!0;var n=e[e.length-1],r=e[e.length-2];return pt(n,r)>=t},ht=function(e){return e[0].length<=1||function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.01,n=e[0];return n.length<=1||!(n.length<=3&&function(e,t){for(var n=0;n<e.length;n++)for(var r=n+1;r<e.length;r++)if(pt(e[n],e[r])<t)return!0;return!1}(n,t))}(e)}},59:function(e,t,n){n.d(t,{I:function(){return r}});var r=new Set(["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"])},9:function(e,t,n){n.d(t,{k7:function(){return P},n8:function(){return c},PH:function(){return E},Uv:function(){return x},J$:function(){return O}});var r=n(278),o=n(850);function i(e){let t=0;if(e&&e.length>0){t+=Math.abs(l(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(l(e[n]))}return t}var a=r.zX*r.zX/2,u=Math.PI/180;function l(e){const t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){const o=e[r],i=e[r+1===t?0:r+1],a=e[r+2>=t?(r+2)%t:r+2],l=o[0]*u,s=i[1]*u;n+=(a[0]*u-l)*Math.sin(s),r++}return n*a}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c={Polygon:3,LineString:2},f=function(e){var t;return null!==(t=null==e?void 0:e.geometry)&&void 0!==t?t:e},p=function(e){var t=f(e);return"Polygon"===(null==t?void 0:t.type)?t:null},d=function(e){for(var t,n,r=null!==(t=null===(n=e.coordinates)||void 0===n?void 0:n[0])&&void 0!==t?t:[],o=r.filter(function(e,t){return 0===t||e[0]!==r[t-1][0]||e[1]!==r[t-1][1]});o.length>1&&o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1];)o.pop();return o},h=function(e){return[].concat(function(e){if(Array.isArray(e))return s(e)}(t=e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):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.")}(),[e[0]]);var t},y=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])},g=function(e,t){return e>0&&t<0||e<0&&t>0},v=function(e,t,n,r){return 0===e&&function(e,t,n){return Math.min(e[0],n[0])<=t[0]&&t[0]<=Math.max(e[0],n[0])&&Math.min(e[1],n[1])<=t[1]&&t[1]<=Math.max(e[1],n[1])}(t,n,r)},m=function(e,t,n,r){var o=y(n,r,e),i=y(n,r,t),a=y(e,t,n),u=y(e,t,r);return!(!g(o,i)||!g(a,u))||v(o,n,e,r)||v(i,n,t,r)||v(a,e,n,t)||v(u,e,r,t)},b=function(e,t){for(var n=e.length,r=t?n:n-1,o=0;o<r;o++)for(var i=o+1;i<r;i++)if(!(i===o+1||t&&0===o&&i===r-1)&&m(e[o],e[(o+1)%n],e[i],e[(i+1)%n]))return!0;return!1},S=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);return n.length<4?{valid:!0}:b(n,!0)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}},w=function(e){var t=p(e);if(!t)return{valid:!0};var n=d(t);if(n.length<c.Polygon)return{valid:!0};var r,a=0;try{r={type:"Feature",geometry:{type:"Polygon",coordinates:[h(n)]},properties:{}},a=(0,o.jE)(r,(e,t)=>e+function(e){let t,n=0;switch(e.type){case"Polygon":return i(e.coordinates);case"MultiPolygon":for(t=0;t<e.coordinates.length;t++)n+=i(e.coordinates[t]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(t),0)}catch(e){return{valid:!0}}return a>0?{valid:!0}:{valid:!1,reason:"Shape must enclose an area"}},E={Polygon:"Shape needs at least 3 points",LineString:"Line needs at least 2 points"},P=[S,w,function(e){var t,n,r=f(e);return"Polygon"===(null==r?void 0:r.type)?d(r).length>=c.Polygon?{valid:!0}:{valid:!1,reason:E.Polygon}:"LineString"===(null==r?void 0:r.type)?(null!==(t=null===(n=r.coordinates)||void 0===n?void 0:n.length)&&void 0!==t?t:0)>=c.LineString?{valid:!0}:{valid:!1,reason:E.LineString}:{valid:!0}}],O=[S,w],x=[function(e){return function(e){var t=p(e);if(!t)return!1;var n=d(t);return!(n.length<4)&&b(n,!1)}(e)?{valid:!1,reason:"Shape must not intersect itself"}:{valid:!0}}]},520:function(e,t,n){n.d(t,{$U:function(){return p},$b:function(){return g},Av:function(){return c},RQ:function(){return y},Uk:function(){return v},dV:function(){return h},g5:function(){return f},oK:function(){return d}});var r=n(9);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function i(e,t){if(e){if("string"==typeof e)return a(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){s(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,t,n){return(t=function(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=o(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=function(e){if(void 0===e||!0===e)return{valid:!0};if(!1===e)return{valid:!1,reason:null};var t=e.valid,n=e.reason,r=e.announcement,o=e.recheckOnFinish,i=e.reopen,a=e.properties,u=!1!==t;return l(l(l(l({valid:u,reason:n},r&&{announcement:r}),o&&{recheckOnFinish:!0}),u&&i&&{reopen:!0}),u&&null!=a&&{properties:a})},f=function(e,t){return e.valid?e:l(l({},e),{},{source:t})},p=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.rules,u=void 0===a?r.k7:a,s=o.onGeometryPreview,p=function(e){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=i(e))){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}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 o,a=!0,u=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==t.return||t.return()}finally{if(u)throw o}}}}(u);try{for(p.s();!(t=p.n()).done;){var d=t.value,h=c(d(e,n));if(!h.valid)return f(h,"rules")}}catch(e){p.e(e)}finally{p.f()}return"function"==typeof s?f(c(s(l({feature:e},n))),"callback"):{valid:!0}},d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.rules,i=void 0===o?r.Uv:o,a=n.onGeometryPreview;return p(e,l(l({},t),{},{phase:"place"}),{rules:i,onGeometryPreview:a})},h={Polygon:"draw_polygon",LineString:"draw_line"},y=function(e,t,n){var r=t.reason,o=t.source,i=t.announcement,a=n.mode,u=n.vertexIndex;return l(l({feature:e,reason:null!=r?r:null,source:o},i&&{announcement:i}),{},{phase:"place",mode:a,vertexIndex:u})},g=function(e){var t,n=e.placed,r=e.point,o=e.geometryType,u=e.onGeometryPreview,l=[].concat(function(e){if(Array.isArray(e))return a(e)}(t=n)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||i(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.")}(),[r]),s={type:"Feature",geometry:"Polygon"===o?{type:"Polygon",coordinates:[l]}:{type:"LineString",coordinates:l},properties:{}},c=h[o],f=n.length,p=d(s,{mode:c,vertexIndex:f},{onGeometryPreview:u});return p.valid?{valid:!0}:{valid:!1,blocked:y(s,p,{mode:c,vertexIndex:f})}},v=function(e){var t,n,o,i,a,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c=s.rules,f=void 0===c?r.J$:c,d=s.onGeometryPreview,h=null!==(t=null==e||null===(n=e.geometry)||void 0===n?void 0:n.type)&&void 0!==t?t:null==e?void 0:e.type,y=null!==(o=r.n8[h])&&void 0!==o?o:0,g=(null!==(i=u.numVertices)&&void 0!==i?i:0)<y?[]:f;return p(e,l(l({},u),{},{phase:null!==(a=u.phase)&&void 0!==a?a:"preview"}),{rules:g,onGeometryPreview:d})}},619:function(e,t,n){n.d(t,{v:function(){return o}});var r="[interactive-map]",o={warn:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return(e=console).warn.apply(e,[r].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return(e=console).error.apply(e,[r].concat(n))}}}}]);