qy-vue-plugins 0.1.5 → 0.1.7

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 (203) hide show
  1. package/dist/buildTime.cjs +1 -0
  2. package/dist/buildTime.mjs +33 -0
  3. package/dist/checkBuildTime.cjs +1 -0
  4. package/dist/checkBuildTime.mjs +41 -0
  5. package/dist/chunks/EventKeys-BLmCVdTJ.js +1 -0
  6. package/dist/chunks/EventKeys-CXd5zco-.js +16 -0
  7. package/dist/chunks/MapTools.vue_vue_type_style_index_0_lang-D2_JNQwR.js +1 -0
  8. package/dist/chunks/MapTools.vue_vue_type_style_index_0_lang-DOHuVsav.js +2791 -0
  9. package/dist/chunks/ProvideKeys-B6IuZ5VV.js +10 -0
  10. package/dist/chunks/ProvideKeys-jy8dfV9u.js +1 -0
  11. package/dist/chunks/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
  12. package/dist/chunks/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  13. package/dist/chunks/constant-Bc8XErtI.js +1 -0
  14. package/dist/chunks/constant-sg1_DRTW.js +342 -0
  15. package/dist/chunks/map-CAu4wyVU.js +1 -0
  16. package/dist/chunks/map-CBmOzxBT.js +7 -0
  17. package/dist/chunks/mapStore-Dir9bFfQ.js +1 -0
  18. package/dist/chunks/mapStore-VSPeSupp.js +262 -0
  19. package/dist/chunks/utils-B0B6Cxc_.js +271 -0
  20. package/dist/chunks/utils-TueA7Ppl.js +1 -0
  21. package/dist/components/HelloWorld.cjs +1 -0
  22. package/dist/components/HelloWorld.mjs +45 -0
  23. package/dist/index.cjs +1 -0
  24. package/dist/mapbox/EventKeys.cjs +1 -0
  25. package/dist/mapbox/EventKeys.mjs +17 -0
  26. package/dist/mapbox/MapView.cjs +1 -0
  27. package/dist/mapbox/MapView.mjs +839 -0
  28. package/dist/mapbox/ProvideKeys.cjs +1 -0
  29. package/dist/mapbox/ProvideKeys.mjs +10 -0
  30. package/dist/mapbox/components/MapLegend.cjs +1 -0
  31. package/dist/mapbox/components/MapLegend.mjs +86 -0
  32. package/dist/mapbox/components/MapTools.cjs +1 -0
  33. package/dist/mapbox/components/MapTools.mjs +4 -0
  34. package/dist/mapbox/components/mapCompass.cjs +1 -0
  35. package/dist/mapbox/components/mapCompass.mjs +80 -0
  36. package/dist/mapbox/components/mapLayer.cjs +1 -0
  37. package/dist/mapbox/components/mapLayer.mjs +60 -0
  38. package/dist/mapbox/components/mapLevel.cjs +1 -0
  39. package/dist/mapbox/components/mapLevel.mjs +90 -0
  40. package/dist/mapbox/components/mapPitch.cjs +1 -0
  41. package/dist/mapbox/components/mapPitch.mjs +36 -0
  42. package/dist/mapbox/components/mapPos.cjs +1 -0
  43. package/dist/mapbox/components/mapPos.mjs +40 -0
  44. package/dist/mapbox/components/mapTopic.cjs +1 -0
  45. package/dist/mapbox/components/mapTopic.mjs +349 -0
  46. package/dist/mapbox/constant.cjs +1 -0
  47. package/{package/mapbox/constant.ts → dist/mapbox/constant.mjs} +123 -134
  48. package/dist/mapbox/utils.cjs +1 -0
  49. package/dist/mapbox/utils.mjs +272 -0
  50. package/dist/mapbox/widgets/CustomShapeDialog.cjs +1 -0
  51. package/dist/mapbox/widgets/CustomShapeDialog.mjs +171 -0
  52. package/dist/mapbox/widgets/IconPicker.cjs +1 -0
  53. package/dist/mapbox/widgets/IconPicker.mjs +131 -0
  54. package/dist/mapbox/widgets/LayerAttributeDialog.cjs +1 -0
  55. package/dist/mapbox/widgets/LayerAttributeDialog.mjs +251 -0
  56. package/dist/mapbox/widgets/LayerDialog.cjs +1 -0
  57. package/dist/mapbox/widgets/LayerDialog.mjs +223 -0
  58. package/dist/mapbox/widgets/LegendDialogLine.cjs +1 -0
  59. package/dist/mapbox/widgets/LegendDialogLine.mjs +226 -0
  60. package/dist/mapbox/widgets/LegendDialogPoint.cjs +1 -0
  61. package/dist/mapbox/widgets/LegendDialogPoint.mjs +194 -0
  62. package/dist/mapbox/widgets/LegendLine.cjs +1 -0
  63. package/dist/mapbox/widgets/LegendLine.mjs +40 -0
  64. package/dist/mapbox/widgets/LegendPoint.cjs +1 -0
  65. package/dist/mapbox/widgets/LegendPoint.mjs +37 -0
  66. package/dist/mapbox/widgets/LegendPopLine.cjs +1 -0
  67. package/dist/mapbox/widgets/LegendPopLine.mjs +185 -0
  68. package/dist/mapbox/widgets/LegendPopPoint.cjs +1 -0
  69. package/dist/mapbox/widgets/LegendPopPoint.mjs +163 -0
  70. package/dist/mapbox/widgets/LegendShape.cjs +1 -0
  71. package/dist/mapbox/widgets/LegendShape.mjs +26 -0
  72. package/dist/mapbox/widgets/LegendSymbol.cjs +1 -0
  73. package/dist/mapbox/widgets/LegendSymbol.mjs +32 -0
  74. package/dist/mapbox/widgets/Point.cjs +1 -0
  75. package/dist/mapbox/widgets/Point.mjs +22 -0
  76. package/dist/mapbox/widgets/ShapeDialog.cjs +1 -0
  77. package/dist/mapbox/widgets/ShapeDialog.mjs +798 -0
  78. package/dist/mapbox/widgets/TopicItemPop.cjs +1 -0
  79. package/dist/mapbox/widgets/TopicItemPop.mjs +139 -0
  80. package/dist/mapbox/widgets/TopicPop.cjs +1 -0
  81. package/dist/mapbox/widgets/TopicPop.mjs +171 -0
  82. package/dist/mapbox.cjs +1 -0
  83. package/dist/mapbox.mjs +22 -0
  84. package/dist/qy-vue-plugins.css +1 -0
  85. package/dist/store.cjs +1 -0
  86. package/dist/store.mjs +262 -0
  87. package/dist/{buildTime → types/buildTime}/index.d.ts +0 -1
  88. package/dist/types/buildTime.d.ts +4 -0
  89. package/dist/types/checkBuildTime.d.ts +2 -0
  90. package/dist/{index.d.ts → types/index.d.ts} +0 -1
  91. package/dist/types/map.cjs +1 -0
  92. package/dist/types/map.mjs +4 -0
  93. package/dist/{mapbox → types/mapbox}/EventKeys.d.ts +0 -1
  94. package/dist/types/mapbox/MapView.vue.d.ts +65 -0
  95. package/dist/{mapbox → types/mapbox}/ProvideKeys.d.ts +0 -1
  96. package/dist/types/mapbox/components/MapLegend.vue.d.ts +2 -0
  97. package/dist/types/mapbox/components/MapTools.vue.d.ts +2 -0
  98. package/dist/types/mapbox/components/index.d.ts +8 -0
  99. package/dist/types/mapbox/components/mapCompass.vue.d.ts +4 -0
  100. package/dist/types/mapbox/components/mapLayer.vue.d.ts +4 -0
  101. package/dist/types/mapbox/components/mapLevel.vue.d.ts +22 -0
  102. package/dist/types/mapbox/components/mapPitch.vue.d.ts +2 -0
  103. package/dist/types/mapbox/components/mapPos.vue.d.ts +17 -0
  104. package/dist/{mapbox → types/mapbox}/constant.d.ts +0 -1
  105. package/dist/{mapbox → types/mapbox}/index.d.ts +0 -1
  106. package/dist/{mapbox → types/mapbox}/utils.d.ts +0 -1
  107. package/dist/types/mapbox/widgets/CustomShapeDialog.vue.d.ts +1421 -0
  108. package/dist/types/mapbox/widgets/IconPicker.vue.d.ts +94 -0
  109. package/dist/types/mapbox/widgets/LayerAttributeDialog.vue.d.ts +5 -0
  110. package/dist/types/mapbox/widgets/LayerDialog.vue.d.ts +1415 -0
  111. package/dist/types/mapbox/widgets/LegendDialogLine.vue.d.ts +1415 -0
  112. package/dist/types/mapbox/widgets/LegendDialogPoint.vue.d.ts +1415 -0
  113. package/dist/types/mapbox/widgets/LegendLine.vue.d.ts +6 -0
  114. package/dist/types/mapbox/widgets/LegendPoint.vue.d.ts +7 -0
  115. package/dist/types/mapbox/widgets/LegendPopLine.vue.d.ts +5 -0
  116. package/dist/types/mapbox/widgets/LegendShape.vue.d.ts +7 -0
  117. package/dist/types/mapbox/widgets/LegendSymbol.vue.d.ts +6 -0
  118. package/dist/types/mapbox/widgets/Point.vue.d.ts +5 -0
  119. package/dist/types/mapbox/widgets/ShapeDialog.vue.d.ts +5 -0
  120. package/dist/types/mapbox/widgets/TopicItemPop.vue.d.ts +18 -0
  121. package/dist/types/mapbox/widgets/TopicPop.vue.d.ts +1416 -0
  122. package/dist/types/mapbox/widgets/index.d.ts +12 -0
  123. package/dist/types/mapbox-EventKeys.d.ts +2 -0
  124. package/dist/types/mapbox-MapView.d.ts +4 -0
  125. package/dist/types/mapbox-ProvideKeys.d.ts +2 -0
  126. package/dist/types/mapbox-components-MapLegend.d.ts +4 -0
  127. package/dist/types/mapbox-components-MapTools.d.ts +4 -0
  128. package/dist/types/mapbox-components-mapCompass.d.ts +4 -0
  129. package/dist/types/mapbox-components-mapLayer.d.ts +4 -0
  130. package/dist/types/mapbox-components-mapLevel.d.ts +4 -0
  131. package/dist/types/mapbox-components-mapPitch.d.ts +4 -0
  132. package/dist/types/mapbox-components-mapPos.d.ts +4 -0
  133. package/dist/types/mapbox-components-mapTopic.d.ts +1 -0
  134. package/dist/types/mapbox-constant.d.ts +2 -0
  135. package/dist/types/mapbox-utils.d.ts +2 -0
  136. package/dist/types/mapbox-widgets-CustomShapeDialog.d.ts +4 -0
  137. package/dist/types/mapbox-widgets-IconPicker.d.ts +4 -0
  138. package/dist/types/mapbox-widgets-LayerAttributeDialog.d.ts +4 -0
  139. package/dist/types/mapbox-widgets-LayerDialog.d.ts +4 -0
  140. package/dist/types/mapbox-widgets-LegendDialogLine.d.ts +4 -0
  141. package/dist/types/mapbox-widgets-LegendDialogPoint.d.ts +4 -0
  142. package/dist/types/mapbox-widgets-LegendLine.d.ts +4 -0
  143. package/dist/types/mapbox-widgets-LegendPoint.d.ts +4 -0
  144. package/dist/types/mapbox-widgets-LegendPopLine.d.ts +4 -0
  145. package/dist/types/mapbox-widgets-LegendPopPoint.d.ts +1 -0
  146. package/dist/types/mapbox-widgets-LegendShape.d.ts +4 -0
  147. package/dist/types/mapbox-widgets-LegendSymbol.d.ts +4 -0
  148. package/dist/types/mapbox-widgets-Point.d.ts +4 -0
  149. package/dist/types/mapbox-widgets-ShapeDialog.d.ts +4 -0
  150. package/dist/types/mapbox-widgets-TopicItemPop.d.ts +4 -0
  151. package/dist/types/mapbox-widgets-TopicPop.d.ts +4 -0
  152. package/dist/types/mapbox.d.ts +2 -0
  153. package/dist/types/src-components-HelloWorld.d.ts +1 -0
  154. package/dist/{store → types/store}/mapStore.d.ts +0 -1
  155. package/dist/types/store.d.ts +2 -0
  156. package/dist/types/{map.d.ts → types/map.d.ts} +0 -1
  157. package/dist/types/types-map.d.ts +2 -0
  158. package/package/mapbox/index.js +15 -0
  159. package/package/types/map.js +7 -0
  160. package/package.json +148 -29
  161. package/dist/vue-plugins.umd.js +0 -1
  162. package/package/assets/campass-outline.png +0 -0
  163. package/package/assets/campass-pointer.png +0 -0
  164. package/package/assets/color-block.png +0 -0
  165. package/package/assets/img_c.png +0 -0
  166. package/package/assets/ter_c.png +0 -0
  167. package/package/assets/vec_c.png +0 -0
  168. package/package/buildTime/index.ts +0 -39
  169. package/package/checkBuildTime/index.ts +0 -71
  170. package/package/css/common.scss +0 -33
  171. package/package/css/map.scss +0 -42
  172. package/package/index.ts +0 -11
  173. package/package/mapbox/EventKeys.ts +0 -55
  174. package/package/mapbox/MapView.vue +0 -1497
  175. package/package/mapbox/ProvideKeys.ts +0 -23
  176. package/package/mapbox/components/MapLegend.vue +0 -185
  177. package/package/mapbox/components/MapTools.vue +0 -653
  178. package/package/mapbox/components/mapCompass.vue +0 -239
  179. package/package/mapbox/components/mapLayer.vue +0 -135
  180. package/package/mapbox/components/mapLevel.vue +0 -140
  181. package/package/mapbox/components/mapPitch.vue +0 -50
  182. package/package/mapbox/components/mapPos.vue +0 -37
  183. package/package/mapbox/components/mapTopic.vue +0 -520
  184. package/package/mapbox/utils.ts +0 -591
  185. package/package/mapbox/widgets/CustomShapeDialog.vue +0 -145
  186. package/package/mapbox/widgets/IconPicker.vue +0 -275
  187. package/package/mapbox/widgets/LayerAttributeDialog.vue +0 -321
  188. package/package/mapbox/widgets/LayerDialog.vue +0 -229
  189. package/package/mapbox/widgets/LegendDialogLine.vue +0 -194
  190. package/package/mapbox/widgets/LegendDialogPoint.vue +0 -208
  191. package/package/mapbox/widgets/LegendLine.vue +0 -54
  192. package/package/mapbox/widgets/LegendPoint.vue +0 -63
  193. package/package/mapbox/widgets/LegendPopLine.vue +0 -415
  194. package/package/mapbox/widgets/LegendPopPoint.vue +0 -348
  195. package/package/mapbox/widgets/LegendShape.vue +0 -46
  196. package/package/mapbox/widgets/LegendSymbol.vue +0 -63
  197. package/package/mapbox/widgets/Point.vue +0 -39
  198. package/package/mapbox/widgets/ShapeDialog.vue +0 -628
  199. package/package/mapbox/widgets/TopicItemPop.vue +0 -164
  200. package/package/mapbox/widgets/TopicPop.vue +0 -186
  201. package/package/store/mapStore.ts +0 -304
  202. /package/dist/{vue-plugins.es.js → index.mjs} +0 -0
  203. /package/dist/{checkBuildTime → types/checkBuildTime}/index.d.ts +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function n(i="build-time.json"){let e=new Date;return{name:"vite-plugin-build-time",enforce:"post",config:()=>(console.log("vite-plugin-build-time: config"),{define:{"import.meta.env.BUILD_TIME":JSON.stringify(e.getTime())}}),generateBundle(){console.log("vite-plugin-build-time: generateBundle");const t=JSON.stringify({timestamp:e.getTime(),isoString:e.toISOString(),localeString:e.toLocaleString()},null,2);this.emitFile({type:"asset",fileName:i,source:t})}}}exports.default=n;
@@ -0,0 +1,33 @@
1
+ function n(i = "build-time.json") {
2
+ let e = /* @__PURE__ */ new Date();
3
+ return {
4
+ name: "vite-plugin-build-time",
5
+ enforce: "post",
6
+ config: () => (console.log("vite-plugin-build-time: config"), {
7
+ define: {
8
+ // 将时间注入到环境变量中
9
+ "import.meta.env.BUILD_TIME": JSON.stringify(e.getTime())
10
+ }
11
+ }),
12
+ generateBundle() {
13
+ console.log("vite-plugin-build-time: generateBundle");
14
+ const t = JSON.stringify(
15
+ {
16
+ timestamp: e.getTime(),
17
+ isoString: e.toISOString(),
18
+ localeString: e.toLocaleString()
19
+ },
20
+ null,
21
+ 2
22
+ );
23
+ this.emitFile({
24
+ type: "asset",
25
+ fileName: i,
26
+ source: t
27
+ });
28
+ }
29
+ };
30
+ }
31
+ export {
32
+ n as default
33
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),t=i.ref(!1),c=i.ref(""),w=async(e,l=1e3,u)=>{if(t.value)return{stop:()=>{}};t.value=!0;const n=new AbortController,f=n.signal;try{const r=async()=>{if(f.aborted)return;let d=`//${window.location.host}${c.value}/version.json?t=${new Date().getTime()}`;try{const s=await fetch(d,{method:"GET"});if(s.status===200){const o=await s.json();let a=o.timestamp||o.version||0;if(!e)return;e<a&&u(a)}}catch{}};await r();const v=setInterval(r,l);return{stop:()=>{clearInterval(v),n.abort(),t.value=!1}}}catch{return t.value=!1,{stop:()=>{}}}},h=e=>{e&&(e.endsWith("/")&&(e=e.slice(0,-1)),c.value=e)};exports.isNewVersion=w;exports.setBaseUrl=h;
@@ -0,0 +1,41 @@
1
+ import { ref as i } from "vue";
2
+ const e = i(!1), c = i(""), d = async (t, l = 1e3, f) => {
3
+ if (e.value) return { stop: () => {
4
+ } };
5
+ e.value = !0;
6
+ const n = new AbortController(), u = n.signal;
7
+ try {
8
+ const r = async () => {
9
+ if (u.aborted)
10
+ return;
11
+ let h = `//${window.location.host}${c.value}/version.json?t=${(/* @__PURE__ */ new Date()).getTime()}`;
12
+ try {
13
+ const s = await fetch(h, { method: "GET" });
14
+ if (s.status === 200) {
15
+ const o = await s.json();
16
+ let a = o.timestamp || o.version || 0;
17
+ if (!t)
18
+ return;
19
+ t < a && f(a);
20
+ }
21
+ } catch {
22
+ }
23
+ };
24
+ await r();
25
+ const v = setInterval(r, l);
26
+ return {
27
+ stop: () => {
28
+ clearInterval(v), n.abort(), e.value = !1;
29
+ }
30
+ };
31
+ } catch {
32
+ return e.value = !1, { stop: () => {
33
+ } };
34
+ }
35
+ }, p = (t) => {
36
+ t && (t.endsWith("/") && (t = t.slice(0, -1)), c.value = t);
37
+ };
38
+ export {
39
+ d as isNewVersion,
40
+ p as setBaseUrl
41
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("@vueuse/core"),o=Symbol("delete-topic"),t=e.useEventBus(o),s=Symbol("create-topic"),a=e.useEventBus(s),c=Symbol("update-topic");e.useEventBus(c);const y=Symbol("topic-panel-click"),n=e.useEventBus(y),u=Symbol("render-geographic-data"),l=e.useEventBus(u),r=Symbol("toggle-geographic-layer"),i=e.useEventBus(r),p=Symbol("show-layer-edit"),B=e.useEventBus(p),d=Symbol("locate-to-layer-center"),g=e.useEventBus(d),K=Symbol("show-layer-dialog"),h=e.useEventBus(K),m=Symbol("map-loaded"),L=e.useEventBus(m),E=Symbol("map-style-changed"),S=e.useEventBus(E);exports.createTopicBus=a;exports.deleteTopicBus=t;exports.locateToLayerCenterKeyBus=g;exports.mapLoadedBus=L;exports.mapStyleChangedBus=S;exports.renderGeographicDataKeyBus=l;exports.showLayerDialogKeyBus=h;exports.showLayerEditKeyBus=B;exports.toggleGeographicLayerKeyBus=i;exports.topicPanelClickBus=n;
@@ -0,0 +1,16 @@
1
+ import { useEventBus as e } from "@vueuse/core";
2
+ const o = Symbol("delete-topic"), g = e(o), a = Symbol("create-topic"), m = e(a), t = Symbol("update-topic");
3
+ e(t);
4
+ const c = Symbol("topic-panel-click"), K = e(c), s = Symbol("render-geographic-data"), h = e(s), y = Symbol("toggle-geographic-layer"), u = e(y), l = Symbol("show-layer-edit"), S = e(l), n = Symbol("locate-to-layer-center"), b = e(n), r = Symbol("show-layer-dialog"), B = e(r), p = Symbol("map-loaded"), L = e(p), i = Symbol("map-style-changed"), T = e(i);
5
+ export {
6
+ B as a,
7
+ K as b,
8
+ m as c,
9
+ g as d,
10
+ L as e,
11
+ b as l,
12
+ T as m,
13
+ h as r,
14
+ S as s,
15
+ u as t
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";const g=require("vue"),mt=require("./ProvideKeys-jy8dfV9u.js"),ke=require("./EventKeys-BLmCVdTJ.js"),yt=require("./constant-Bc8XErtI.js"),Et=require("@turf/turf"),vt=require("@element-plus/icons-vue"),Ct=require("element-plus");function Tt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const j=Tt(Et),Me=function(e,t){const n={drag:[],click:[],mousemove:[],mousedown:[],mouseup:[],mouseout:[],keydown:[],keyup:[],touchstart:[],touchmove:[],touchend:[],tap:[]},o={on(i,a,l){if(n[i]===void 0)throw new Error(`Invalid event type: ${i}`);n[i].push({selector:a,fn:l})},render(i){t.store.featureChanged(i)}},r=function(i,a){const l=n[i];let c=l.length;for(;c--;){const s=l[c];if(s.selector(a)){s.fn.call(o,a)||t.store.render(),t.ui.updateMapClasses();break}}};return e.start.call(o),{render:e.render,stop(){e.stop&&e.stop()},trash(){e.trash&&(e.trash(),t.store.render())},combineFeatures(){e.combineFeatures&&e.combineFeatures()},uncombineFeatures(){e.uncombineFeatures&&e.uncombineFeatures()},drag(i){r("drag",i)},click(i){r("click",i)},mousemove(i){r("mousemove",i)},mousedown(i){r("mousedown",i)},mouseup(i){r("mouseup",i)},mouseout(i){r("mouseout",i)},keydown(i){r("keydown",i)},keyup(i){r("keyup",i)},touchstart(i){r("touchstart",i)},touchmove(i){r("touchmove",i)},touchend(i){r("touchend",i)},tap(i){r("tap",i)}}};function re(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ue={},te={},Ve;function St(){return Ve||(Ve=1,te.RADIUS=6378137,te.FLATTENING=1/298.257223563,te.POLAR_RADIUS=63567523142e-4),te}var xe;function _t(){if(xe)return ue;xe=1;var e=St();ue.geometry=t,ue.ring=o;function t(i){var a=0,l;switch(i.type){case"Polygon":return n(i.coordinates);case"MultiPolygon":for(l=0;l<i.coordinates.length;l++)a+=n(i.coordinates[l]);return a;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0;case"GeometryCollection":for(l=0;l<i.geometries.length;l++)a+=t(i.geometries[l]);return a}}function n(i){var a=0;if(i&&i.length>0){a+=Math.abs(o(i[0]));for(var l=1;l<i.length;l++)a-=Math.abs(o(i[l]))}return a}function o(i){var a,l,c,s,m,S,u,d=0,f=i.length;if(f>2){for(u=0;u<f;u++)u===f-2?(s=f-2,m=f-1,S=0):u===f-1?(s=f-1,m=0,S=1):(s=u,m=u+1,S=u+2),a=i[s],l=i[m],c=i[S],d+=(r(c[0])-r(a[0]))*Math.sin(r(l[1]));d=d*e.RADIUS*e.RADIUS/2}return d}function r(i){return i*Math.PI/180}return ue}var It=_t();const Mt=re(It),D={CANVAS:"mapboxgl-canvas",CONTROL_BASE:"mapboxgl-ctrl",CONTROL_PREFIX:"mapboxgl-ctrl-",CONTROL_BUTTON:"mapbox-gl-draw_ctrl-draw-btn",CONTROL_BUTTON_LINE:"mapbox-gl-draw_line",CONTROL_BUTTON_POLYGON:"mapbox-gl-draw_polygon",CONTROL_BUTTON_POINT:"mapbox-gl-draw_point",CONTROL_BUTTON_TRASH:"mapbox-gl-draw_trash",CONTROL_BUTTON_COMBINE_FEATURES:"mapbox-gl-draw_combine",CONTROL_BUTTON_UNCOMBINE_FEATURES:"mapbox-gl-draw_uncombine",CONTROL_GROUP:"mapboxgl-ctrl-group",ATTRIBUTION:"mapboxgl-ctrl-attrib",ACTIVE_BUTTON:"active",BOX_SELECT:"mapbox-gl-draw_boxselect"},k={HOT:"mapbox-gl-draw-hot",COLD:"mapbox-gl-draw-cold"},I={ADD:"add",MOVE:"move",DRAG:"drag",POINTER:"pointer",NONE:"none"},w={POLYGON:"polygon",LINE:"line_string",POINT:"point"},p={FEATURE:"Feature",POLYGON:"Polygon",LINE_STRING:"LineString",POINT:"Point",FEATURE_COLLECTION:"FeatureCollection",MULTI_PREFIX:"Multi",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon"},E={DRAW_LINE_STRING:"draw_line_string",DRAW_POLYGON:"draw_polygon",DRAW_POINT:"draw_point",SIMPLE_SELECT:"simple_select",DIRECT_SELECT:"direct_select"},A={CREATE:"draw.create",DELETE:"draw.delete",UPDATE:"draw.update",SELECTION_CHANGE:"draw.selectionchange",MODE_CHANGE:"draw.modechange",ACTIONABLE:"draw.actionable",RENDER:"draw.render",COMBINE_FEATURES:"draw.combine",UNCOMBINE_FEATURES:"draw.uncombine"},ie={MOVE:"move",CHANGE_PROPERTIES:"change_properties",CHANGE_COORDINATES:"change_coordinates"},N={FEATURE:"feature",MIDPOINT:"midpoint",VERTEX:"vertex"},L={ACTIVE:"true",INACTIVE:"false"},je=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate"],Ot=-90,Oe=-85,Lt=90,Le=85,Nt=-270,bt=270,Qe=Object.freeze(Object.defineProperty({__proto__:null,LAT_MAX:Lt,LAT_MIN:Ot,LAT_RENDERED_MAX:Le,LAT_RENDERED_MIN:Oe,LNG_MAX:bt,LNG_MIN:Nt,activeStates:L,classes:D,cursors:I,events:A,geojsonTypes:p,interactions:je,meta:N,modes:E,sources:k,types:w,updateActions:ie},Symbol.toStringTag,{value:"Module"})),Ge={Point:0,LineString:1,MultiLineString:1,Polygon:2};function Pt(e,t){const n=Ge[e.geometry.type]-Ge[t.geometry.type];return n===0&&e.geometry.type===p.POLYGON?e.area-t.area:n}function et(e){return e.map(t=>(t.geometry.type===p.POLYGON&&(t.area=Mt.geometry({type:p.FEATURE,property:{},geometry:t.geometry})),t)).sort(Pt).map(t=>(delete t.area,t))}function tt(e,t=0){return[[e.point.x-t,e.point.y-t],[e.point.x+t,e.point.y+t]]}function V(e){if(this._items={},this._nums={},this._length=e?e.length:0,!!e)for(let t=0,n=e.length;t<n;t++)this.add(e[t]),e[t]!==void 0&&(typeof e[t]=="string"?this._items[e[t]]=t:this._nums[e[t]]=t)}V.prototype.add=function(e){return this.has(e)?this:(this._length++,typeof e=="string"?this._items[e]=this._length:this._nums[e]=this._length,this)};V.prototype.delete=function(e){return this.has(e)===!1?this:(this._length--,delete this._items[e],delete this._nums[e],this)};V.prototype.has=function(e){return typeof e!="string"&&typeof e!="number"?!1:this._items[e]!==void 0||this._nums[e]!==void 0};V.prototype.values=function(){const e=[];return Object.keys(this._items).forEach(t=>{e.push({k:t,v:this._items[t]})}),Object.keys(this._nums).forEach(t=>{e.push({k:JSON.parse(t),v:this._nums[t]})}),e.sort((t,n)=>t.v-n.v).map(t=>t.k)};V.prototype.clear=function(){return this._length=0,this._items={},this._nums={},this};const At=[N.FEATURE,N.MIDPOINT,N.VERTEX],Q={click:Ft,touch:Dt};function Ft(e,t,n){return nt(e,t,n,n.options.clickBuffer)}function Dt(e,t,n){return nt(e,t,n,n.options.touchBuffer)}function nt(e,t,n,o){if(n.map===null)return[];const r=e?tt(e,o):t,i={};n.options.styles&&(i.layers=n.options.styles.map(s=>s.id).filter(s=>n.map.getLayer(s)!=null));const a=n.map.queryRenderedFeatures(r,i).filter(s=>At.indexOf(s.properties.meta)!==-1),l=new V,c=[];return a.forEach(s=>{const m=s.properties.id;l.has(m)||(l.add(m),c.push(s))}),et(c)}function fe(e,t){const n=Q.click(e,null,t),o={mouse:I.NONE};return n[0]&&(o.mouse=n[0].properties.active===L.ACTIVE?I.MOVE:I.POINTER,o.feature=n[0].properties.meta),t.events.currentModeName().indexOf("draw")!==-1&&(o.mouse=I.ADD),t.ui.queueMapClasses(o),t.ui.updateMapClasses(),n[0]}function Pe(e,t){const n=e.x-t.x,o=e.y-t.y;return Math.sqrt(n*n+o*o)}const wt=4,Rt=12,Ut=500;function Ne(e,t,n={}){const o=n.fineTolerance!=null?n.fineTolerance:wt,r=n.grossTolerance!=null?n.grossTolerance:Rt,i=n.interval!=null?n.interval:Ut;e.point=e.point||t.point,e.time=e.time||t.time;const a=Pe(e.point,t.point);return a<o||a<r&&t.time-e.time<i}const kt=25,Vt=250;function be(e,t,n={}){const o=n.tolerance!=null?n.tolerance:kt,r=n.interval!=null?n.interval:Vt;return e.point=e.point||t.point,e.time=e.time||t.time,Pe(e.point,t.point)<o&&t.time-e.time<r}let xt=(e,t=21)=>(n=t)=>{let o="",r=n|0;for(;r--;)o+=e[Math.random()*e.length|0];return o};const Gt=xt("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",32);function Ae(){return Gt()}const F=function(e,t){this.ctx=e,this.properties=t.properties||{},this.coordinates=t.geometry.coordinates,this.id=t.id||Ae(),this.type=t.geometry.type};F.prototype.changed=function(){this.ctx.store.featureChanged(this.id)};F.prototype.incomingCoords=function(e){this.setCoordinates(e)};F.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};F.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.coordinates))};F.prototype.setProperty=function(e,t){this.properties[e]=t};F.prototype.toGeoJSON=function(){return JSON.parse(JSON.stringify({id:this.id,type:p.FEATURE,properties:this.properties,geometry:{coordinates:this.getCoordinates(),type:this.type}}))};F.prototype.internal=function(e){const t={id:this.id,meta:N.FEATURE,"meta:type":this.type,active:L.INACTIVE,mode:e};if(this.ctx.options.userProperties)for(const n in this.properties)t[`user_${n}`]=this.properties[n];return{type:p.FEATURE,properties:t,geometry:{coordinates:this.getCoordinates(),type:this.type}}};const Z=function(e,t){F.call(this,e,t)};Z.prototype=Object.create(F.prototype);Z.prototype.isValid=function(){return typeof this.coordinates[0]=="number"&&typeof this.coordinates[1]=="number"};Z.prototype.updateCoordinate=function(e,t,n){arguments.length===3?this.coordinates=[t,n]:this.coordinates=[e,t],this.changed()};Z.prototype.getCoordinate=function(){return this.getCoordinates()};const q=function(e,t){F.call(this,e,t)};q.prototype=Object.create(F.prototype);q.prototype.isValid=function(){return this.coordinates.length>1};q.prototype.addCoordinate=function(e,t,n){this.changed();const o=parseInt(e,10);this.coordinates.splice(o,0,[t,n])};q.prototype.getCoordinate=function(e){const t=parseInt(e,10);return JSON.parse(JSON.stringify(this.coordinates[t]))};q.prototype.removeCoordinate=function(e){this.changed(),this.coordinates.splice(parseInt(e,10),1)};q.prototype.updateCoordinate=function(e,t,n){const o=parseInt(e,10);this.coordinates[o]=[t,n],this.changed()};const U=function(e,t){F.call(this,e,t),this.coordinates=this.coordinates.map(n=>n.slice(0,-1))};U.prototype=Object.create(F.prototype);U.prototype.isValid=function(){return this.coordinates.length===0?!1:this.coordinates.every(e=>e.length>2)};U.prototype.incomingCoords=function(e){this.coordinates=e.map(t=>t.slice(0,-1)),this.changed()};U.prototype.setCoordinates=function(e){this.coordinates=e,this.changed()};U.prototype.addCoordinate=function(e,t,n){this.changed();const o=e.split(".").map(i=>parseInt(i,10));this.coordinates[o[0]].splice(o[1],0,[t,n])};U.prototype.removeCoordinate=function(e){this.changed();const t=e.split(".").map(o=>parseInt(o,10)),n=this.coordinates[t[0]];n&&(n.splice(t[1],1),n.length<3&&this.coordinates.splice(t[0],1))};U.prototype.getCoordinate=function(e){const t=e.split(".").map(o=>parseInt(o,10)),n=this.coordinates[t[0]];return JSON.parse(JSON.stringify(n[t[1]]))};U.prototype.getCoordinates=function(){return this.coordinates.map(e=>e.concat([e[0]]))};U.prototype.updateCoordinate=function(e,t,n){this.changed();const o=e.split("."),r=parseInt(o[0],10),i=parseInt(o[1],10);this.coordinates[r]===void 0&&(this.coordinates[r]=[]),this.coordinates[r][i]=[t,n]};const Bt={MultiPoint:Z,MultiLineString:q,MultiPolygon:U},ge=(e,t,n,o,r)=>{const i=n.split("."),a=parseInt(i[0],10),l=i[1]?i.slice(1).join("."):null;return e[a][t](l,o,r)},P=function(e,t){if(F.call(this,e,t),delete this.coordinates,this.model=Bt[t.geometry.type],this.model===void 0)throw new TypeError(`${t.geometry.type} is not a valid type`);this.features=this._coordinatesToFeatures(t.geometry.coordinates)};P.prototype=Object.create(F.prototype);P.prototype._coordinatesToFeatures=function(e){const t=this.model.bind(this);return e.map(n=>new t(this.ctx,{id:Ae(),type:p.FEATURE,properties:{},geometry:{coordinates:n,type:this.type.replace("Multi","")}}))};P.prototype.isValid=function(){return this.features.every(e=>e.isValid())};P.prototype.setCoordinates=function(e){this.features=this._coordinatesToFeatures(e),this.changed()};P.prototype.getCoordinate=function(e){return ge(this.features,"getCoordinate",e)};P.prototype.getCoordinates=function(){return JSON.parse(JSON.stringify(this.features.map(e=>e.type===p.POLYGON?e.getCoordinates():e.coordinates)))};P.prototype.updateCoordinate=function(e,t,n){ge(this.features,"updateCoordinate",e,t,n),this.changed()};P.prototype.addCoordinate=function(e,t,n){ge(this.features,"addCoordinate",e,t,n),this.changed()};P.prototype.removeCoordinate=function(e){ge(this.features,"removeCoordinate",e),this.changed()};P.prototype.getFeatures=function(){return this.features};function y(e){this.map=e.map,this.drawConfig=JSON.parse(JSON.stringify(e.options||{})),this._ctx=e}y.prototype.setSelected=function(e){return this._ctx.store.setSelected(e)};y.prototype.setSelectedCoordinates=function(e){this._ctx.store.setSelectedCoordinates(e),e.reduce((t,n)=>(t[n.feature_id]===void 0&&(t[n.feature_id]=!0,this._ctx.store.get(n.feature_id).changed()),t),{})};y.prototype.getSelected=function(){return this._ctx.store.getSelected()};y.prototype.getSelectedIds=function(){return this._ctx.store.getSelectedIds()};y.prototype.isSelected=function(e){return this._ctx.store.isSelected(e)};y.prototype.getFeature=function(e){return this._ctx.store.get(e)};y.prototype.select=function(e){return this._ctx.store.select(e)};y.prototype.deselect=function(e){return this._ctx.store.deselect(e)};y.prototype.deleteFeature=function(e,t={}){return this._ctx.store.delete(e,t)};y.prototype.addFeature=function(e,t={}){return this._ctx.store.add(e,t)};y.prototype.clearSelectedFeatures=function(){return this._ctx.store.clearSelected()};y.prototype.clearSelectedCoordinates=function(){return this._ctx.store.clearSelectedCoordinates()};y.prototype.setActionableState=function(e={}){const t={trash:e.trash||!1,combineFeatures:e.combineFeatures||!1,uncombineFeatures:e.uncombineFeatures||!1};return this._ctx.events.actionable(t)};y.prototype.changeMode=function(e,t={},n={}){return this._ctx.events.changeMode(e,t,n)};y.prototype.fire=function(e,t){return this._ctx.events.fire(e,t)};y.prototype.updateUIClasses=function(e){return this._ctx.ui.queueMapClasses(e)};y.prototype.activateUIButton=function(e){return this._ctx.ui.setActiveButton(e)};y.prototype.featuresAt=function(e,t,n="click"){if(n!=="click"&&n!=="touch")throw new Error("invalid buffer type");return Q[n](e,t,this._ctx)};y.prototype.newFeature=function(e){const t=e.geometry.type;return t===p.POINT?new Z(this._ctx,e):t===p.LINE_STRING?new q(this._ctx,e):t===p.POLYGON?new U(this._ctx,e):new P(this._ctx,e)};y.prototype.isInstanceOf=function(e,t){if(e===p.POINT)return t instanceof Z;if(e===p.LINE_STRING)return t instanceof q;if(e===p.POLYGON)return t instanceof U;if(e==="MultiFeature")return t instanceof P;throw new Error(`Unknown feature class: ${e}`)};y.prototype.doRender=function(e){return this._ctx.store.featureChanged(e)};y.prototype.onSetup=function(){};y.prototype.onDrag=function(){};y.prototype.onClick=function(){};y.prototype.onMouseMove=function(){};y.prototype.onMouseDown=function(){};y.prototype.onMouseUp=function(){};y.prototype.onMouseOut=function(){};y.prototype.onKeyUp=function(){};y.prototype.onKeyDown=function(){};y.prototype.onTouchStart=function(){};y.prototype.onTouchMove=function(){};y.prototype.onTouchEnd=function(){};y.prototype.onTap=function(){};y.prototype.onStop=function(){};y.prototype.onTrash=function(){};y.prototype.onCombineFeature=function(){};y.prototype.onUncombineFeature=function(){};y.prototype.toDisplayFeatures=function(){throw new Error("You must overwrite toDisplayFeatures")};const ot={drag:"onDrag",click:"onClick",mousemove:"onMouseMove",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseout:"onMouseOut",keyup:"onKeyUp",keydown:"onKeyDown",touchstart:"onTouchStart",touchmove:"onTouchMove",touchend:"onTouchEnd",tap:"onTap"},$t=Object.keys(ot);function qt(e){const t=Object.keys(e);return function(n,o={}){let r={};const i=t.reduce((l,c)=>(l[c]=e[c],l),new y(n));function a(l){return c=>i[l](r,c)}return{start(){r=i.onSetup(o),$t.forEach(l=>{const c=ot[l];let s=()=>!1;e[c]&&(s=()=>!0),this.on(l,s,a(c))})},stop(){i.onStop(r)},trash(){i.onTrash(r)},combineFeatures(){i.onCombineFeatures(r)},uncombineFeatures(){i.onUncombineFeatures(r)},render(l,c){i.toDisplayFeatures(r,l,c)}}}}function Jt(e){const t=Object.keys(e.options.modes).reduce((u,d)=>(u[d]=qt(e.options.modes[d]),u),{});let n={},o={};const r={};let i=null,a=null;r.drag=function(u,d){d({point:u.point,time:new Date().getTime()})?(e.ui.queueMapClasses({mouse:I.DRAG}),a.drag(u)):u.originalEvent.stopPropagation()},r.mousedrag=function(u){r.drag(u,d=>!Ne(n,d))},r.touchdrag=function(u){r.drag(u,d=>!be(o,d))},r.mousemove=function(u){if((u.originalEvent.buttons!==void 0?u.originalEvent.buttons:u.originalEvent.which)===1)return r.mousedrag(u);const f=fe(u,e);u.featureTarget=f,a.mousemove(u)},r.mousedown=function(u){n={time:new Date().getTime(),point:u.point};const d=fe(u,e);u.featureTarget=d,a.mousedown(u)},r.mouseup=function(u){const d=fe(u,e);u.featureTarget=d,Ne(n,{point:u.point,time:new Date().getTime()})?a.click(u):a.mouseup(u)},r.mouseout=function(u){a.mouseout(u)},r.touchstart=function(u){if(!e.options.touchEnabled)return;o={time:new Date().getTime(),point:u.point};const d=Q.touch(u,null,e)[0];u.featureTarget=d,a.touchstart(u)},r.touchmove=function(u){if(e.options.touchEnabled)return a.touchmove(u),r.touchdrag(u)},r.touchend=function(u){if(u.originalEvent.preventDefault(),!e.options.touchEnabled)return;const d=Q.touch(u,null,e)[0];u.featureTarget=d,be(o,{time:new Date().getTime(),point:u.point})?a.tap(u):a.touchend(u)};const l=u=>!(u===8||u===46||u>=48&&u<=57);r.keydown=function(u){(u.srcElement||u.target).classList.contains(D.CANVAS)&&((u.keyCode===8||u.keyCode===46)&&e.options.controls.trash?(u.preventDefault(),a.trash()):l(u.keyCode)?a.keydown(u):u.keyCode===49&&e.options.controls.point?c(E.DRAW_POINT):u.keyCode===50&&e.options.controls.line_string?c(E.DRAW_LINE_STRING):u.keyCode===51&&e.options.controls.polygon&&c(E.DRAW_POLYGON))},r.keyup=function(u){l(u.keyCode)&&a.keyup(u)},r.zoomend=function(){e.store.changeZoom()},r.data=function(u){if(u.dataType==="style"){const{setup:d,map:f,options:v,store:b}=e;v.styles.some(X=>f.getLayer(X.id))||(d.addLayers(),b.setDirty(),b.render())}};function c(u,d,f={}){a.stop();const v=t[u];if(v===void 0)throw new Error(`${u} is not valid`);i=u;const b=v(e,d);a=Me(b,e),f.silent||e.map.fire(A.MODE_CHANGE,{mode:u}),e.store.setDirty(),e.store.render()}const s={trash:!1,combineFeatures:!1,uncombineFeatures:!1};function m(u){let d=!1;Object.keys(u).forEach(f=>{if(s[f]===void 0)throw new Error("Invalid action type");s[f]!==u[f]&&(d=!0),s[f]=u[f]}),d&&e.map.fire(A.ACTIONABLE,{actions:s})}return{start(){i=e.options.defaultMode,a=Me(t[i](e),e)},changeMode:c,actionable:m,currentModeName(){return i},currentModeRender(u,d){return a.render(u,d)},fire(u,d){e.map&&e.map.fire(u,d)},addEventListeners(){e.map.on("mousemove",r.mousemove),e.map.on("mousedown",r.mousedown),e.map.on("mouseup",r.mouseup),e.map.on("data",r.data),e.map.on("touchmove",r.touchmove),e.map.on("touchstart",r.touchstart),e.map.on("touchend",r.touchend),e.container.addEventListener("mouseout",r.mouseout),e.options.keybindings&&(e.container.addEventListener("keydown",r.keydown),e.container.addEventListener("keyup",r.keyup))},removeEventListeners(){e.map.off("mousemove",r.mousemove),e.map.off("mousedown",r.mousedown),e.map.off("mouseup",r.mouseup),e.map.off("data",r.data),e.map.off("touchmove",r.touchmove),e.map.off("touchstart",r.touchstart),e.map.off("touchend",r.touchend),e.container.removeEventListener("mouseout",r.mouseout),e.options.keybindings&&(e.container.removeEventListener("keydown",r.keydown),e.container.removeEventListener("keyup",r.keyup))},trash(u){a.trash(u)},combineFeatures(){a.combineFeatures()},uncombineFeatures(){a.uncombineFeatures()},getMode(){return i}}}function se(e){return[].concat(e).filter(t=>t!==void 0)}function Yt(){const e=this;if(!(e.ctx.map&&e.ctx.map.getSource(k.HOT)!==void 0))return c();const n=e.ctx.events.currentModeName();e.ctx.ui.queueMapClasses({mode:n});let o=[],r=[];e.isDirty?r=e.getAllIds():(o=e.getChangedIds().filter(s=>e.get(s)!==void 0),r=e.sources.hot.filter(s=>s.properties.id&&o.indexOf(s.properties.id)===-1&&e.get(s.properties.id)!==void 0).map(s=>s.properties.id)),e.sources.hot=[];const i=e.sources.cold.length;e.sources.cold=e.isDirty?[]:e.sources.cold.filter(s=>{const m=s.properties.id||s.properties.parent;return o.indexOf(m)===-1});const a=i!==e.sources.cold.length||r.length>0;o.forEach(s=>l(s,"hot")),r.forEach(s=>l(s,"cold"));function l(s,m){const u=e.get(s).internal(n);e.ctx.events.currentModeRender(u,d=>{d.properties.mode=n,e.sources[m].push(d)})}a&&e.ctx.map.getSource(k.COLD).setData({type:p.FEATURE_COLLECTION,features:e.sources.cold}),e.ctx.map.getSource(k.HOT).setData({type:p.FEATURE_COLLECTION,features:e.sources.hot}),c();function c(){e.isDirty=!1,e.clearChangedIds()}}function _(e){this._features={},this._featureIds=new V,this._selectedFeatureIds=new V,this._selectedCoordinates=[],this._changedFeatureIds=new V,this._emitSelectionChange=!1,this._mapInitialConfig={},this.ctx=e,this.sources={hot:[],cold:[]};let t;this.render=()=>{t||(t=requestAnimationFrame(()=>{t=null,Yt.call(this),this._emitSelectionChange&&(this.ctx.events.fire(A.SELECTION_CHANGE,{features:this.getSelected().map(n=>n.toGeoJSON()),points:this.getSelectedCoordinates().map(n=>({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:n.coordinates}}))}),this._emitSelectionChange=!1),this.ctx.events.fire(A.RENDER,{})}))},this.isDirty=!1}_.prototype.createRenderBatch=function(){const e=this.render;let t=0;return this.render=function(){t++},()=>{this.render=e,t>0&&this.render()}};_.prototype.setDirty=function(){return this.isDirty=!0,this};_.prototype.featureCreated=function(e,t={}){if(this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0){const o=this.get(e);this.ctx.events.fire(A.CREATE,{features:[o.toGeoJSON()]})}return this};_.prototype.featureChanged=function(e,t={}){return this._changedFeatureIds.add(e),(t.silent!=null?t.silent:this.ctx.options.suppressAPIEvents)!==!0&&this.ctx.events.fire(A.UPDATE,{action:t.action?t.action:ie.CHANGE_COORDINATES,features:[this.get(e).toGeoJSON()]}),this};_.prototype.getChangedIds=function(){return this._changedFeatureIds.values()};_.prototype.clearChangedIds=function(){return this._changedFeatureIds.clear(),this};_.prototype.getAllIds=function(){return this._featureIds.values()};_.prototype.add=function(e,t={}){return this._features[e.id]=e,this._featureIds.add(e.id),this.featureCreated(e.id,{silent:t.silent}),this};_.prototype.delete=function(e,t={}){const n=[];return se(e).forEach(o=>{this._featureIds.has(o)&&(this._featureIds.delete(o),this._selectedFeatureIds.delete(o),t.silent||n.indexOf(this._features[o])===-1&&n.push(this._features[o].toGeoJSON()),delete this._features[o],this.isDirty=!0)}),n.length&&this.ctx.events.fire(A.DELETE,{features:n}),rt(this,t),this};_.prototype.get=function(e){return this._features[e]};_.prototype.getAll=function(){return Object.keys(this._features).map(e=>this._features[e])};_.prototype.select=function(e,t={}){return se(e).forEach(n=>{this._selectedFeatureIds.has(n)||(this._selectedFeatureIds.add(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),this};_.prototype.deselect=function(e,t={}){return se(e).forEach(n=>{this._selectedFeatureIds.has(n)&&(this._selectedFeatureIds.delete(n),this._changedFeatureIds.add(n),t.silent||(this._emitSelectionChange=!0))}),rt(this,t),this};_.prototype.clearSelected=function(e={}){return this.deselect(this._selectedFeatureIds.values(),{silent:e.silent}),this};_.prototype.setSelected=function(e,t={}){return e=se(e),this.deselect(this._selectedFeatureIds.values().filter(n=>e.indexOf(n)===-1),{silent:t.silent}),this.select(e.filter(n=>!this._selectedFeatureIds.has(n)),{silent:t.silent}),this};_.prototype.setSelectedCoordinates=function(e){return this._selectedCoordinates=e,this._emitSelectionChange=!0,this};_.prototype.clearSelectedCoordinates=function(){return this._selectedCoordinates=[],this._emitSelectionChange=!0,this};_.prototype.getSelectedIds=function(){return this._selectedFeatureIds.values()};_.prototype.getSelected=function(){return this.getSelectedIds().map(e=>this.get(e))};_.prototype.getSelectedCoordinates=function(){return this._selectedCoordinates.map(t=>({coordinates:this.get(t.feature_id).getCoordinate(t.coord_path)}))};_.prototype.isSelected=function(e){return this._selectedFeatureIds.has(e)};_.prototype.setFeatureProperty=function(e,t,n,o={}){this.get(e).setProperty(t,n),this.featureChanged(e,{silent:o.silent,action:ie.CHANGE_PROPERTIES})};function rt(e,t={}){const n=e._selectedCoordinates.filter(o=>e._selectedFeatureIds.has(o.feature_id));e._selectedCoordinates.length!==n.length&&!t.silent&&(e._emitSelectionChange=!0),e._selectedCoordinates=n}_.prototype.storeMapConfig=function(){je.forEach(e=>{this.ctx.map[e]&&(this._mapInitialConfig[e]=this.ctx.map[e].isEnabled())})};_.prototype.restoreMapConfig=function(){Object.keys(this._mapInitialConfig).forEach(e=>{this._mapInitialConfig[e]?this.ctx.map[e].enable():this.ctx.map[e].disable()})};_.prototype.getInitialConfigValue=function(e){return this._mapInitialConfig[e]!==void 0?this._mapInitialConfig[e]:!0};const Xt=["mode","feature","mouse"];function Ht(e){const t={};let n=null,o={mode:null,feature:null,mouse:null},r={mode:null,feature:null,mouse:null};function i(){a({mode:null,feature:null,mouse:null}),l()}function a(d){r=Object.assign(r,d)}function l(){if(!e.container)return;const d=[],f=[];Xt.forEach(v=>{r[v]!==o[v]&&(d.push(`${v}-${o[v]}`),r[v]!==null&&f.push(`${v}-${r[v]}`))}),d.length>0&&e.container.classList.remove(...d),f.length>0&&e.container.classList.add(...f),o=Object.assign(o,r)}function c(d,f={}){const v=document.createElement("button");return v.className=`${D.CONTROL_BUTTON} ${f.className}`,v.setAttribute("title",f.title),f.container.appendChild(v),v.addEventListener("click",b=>{if(b.preventDefault(),b.stopPropagation(),b.target===n){s(),f.onDeactivate();return}m(d),f.onActivate()},!0),v}function s(){n&&(n.classList.remove(D.ACTIVE_BUTTON),n=null)}function m(d){s();const f=t[d];f&&f&&d!=="trash"&&(f.classList.add(D.ACTIVE_BUTTON),n=f)}function S(){const d=e.options.controls,f=document.createElement("div");return f.className=`${D.CONTROL_GROUP} ${D.CONTROL_BASE}`,d&&(d[w.LINE]&&(t[w.LINE]=c(w.LINE,{container:f,className:D.CONTROL_BUTTON_LINE,title:`LineString tool ${e.options.keybindings?"(l)":""}`,onActivate:()=>e.events.changeMode(E.DRAW_LINE_STRING),onDeactivate:()=>e.events.trash()})),d[w.POLYGON]&&(t[w.POLYGON]=c(w.POLYGON,{container:f,className:D.CONTROL_BUTTON_POLYGON,title:`Polygon tool ${e.options.keybindings?"(p)":""}`,onActivate:()=>e.events.changeMode(E.DRAW_POLYGON),onDeactivate:()=>e.events.trash()})),d[w.POINT]&&(t[w.POINT]=c(w.POINT,{container:f,className:D.CONTROL_BUTTON_POINT,title:`Marker tool ${e.options.keybindings?"(m)":""}`,onActivate:()=>e.events.changeMode(E.DRAW_POINT),onDeactivate:()=>e.events.trash()})),d.trash&&(t.trash=c("trash",{container:f,className:D.CONTROL_BUTTON_TRASH,title:"Delete",onActivate:()=>{e.events.trash()}})),d.combine_features&&(t.combine_features=c("combineFeatures",{container:f,className:D.CONTROL_BUTTON_COMBINE_FEATURES,title:"Combine",onActivate:()=>{e.events.combineFeatures()}})),d.uncombine_features&&(t.uncombine_features=c("uncombineFeatures",{container:f,className:D.CONTROL_BUTTON_UNCOMBINE_FEATURES,title:"Uncombine",onActivate:()=>{e.events.uncombineFeatures()}}))),f}function u(){Object.keys(t).forEach(d=>{const f=t[d];f.parentNode&&f.parentNode.removeChild(f),delete t[d]})}return{setActiveButton:m,queueMapClasses:a,updateMapClasses:l,clearMapClasses:i,addButtons:S,removeButtons:u}}function Zt(e){let t=null,n=null;const o={onRemove(){return e.map.off("load",o.connect),clearInterval(n),o.removeLayers(),e.store.restoreMapConfig(),e.ui.removeButtons(),e.events.removeEventListeners(),e.ui.clearMapClasses(),e.boxZoomInitial&&e.map.boxZoom.enable(),e.map=null,e.container=null,e.store=null,t&&t.parentNode&&t.parentNode.removeChild(t),t=null,this},connect(){e.map.off("load",o.connect),clearInterval(n),o.addLayers(),e.store.storeMapConfig(),e.events.addEventListeners()},onAdd(r){if(e.map=r,e.events=Jt(e),e.ui=Ht(e),e.container=r.getContainer(),e.store=new _(e),t=e.ui.addButtons(),e.options.boxSelect){e.boxZoomInitial=r.boxZoom.isEnabled(),r.boxZoom.disable();const i=r.dragPan.isEnabled();r.dragPan.disable(),r.dragPan.enable(),i||r.dragPan.disable()}return r.loaded()?o.connect():(r.on("load",o.connect),n=setInterval(()=>{r.loaded()&&o.connect()},16)),e.events.start(),t},addLayers(){e.map.addSource(k.COLD,{data:{type:p.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.map.addSource(k.HOT,{data:{type:p.FEATURE_COLLECTION,features:[]},type:"geojson"}),e.options.styles.forEach(r=>{e.map.addLayer(r)}),e.store.setDirty(!0),e.store.render()},removeLayers(){e.options.styles.forEach(r=>{e.map.getLayer(r.id)&&e.map.removeLayer(r.id)}),e.map.getSource(k.COLD)&&e.map.removeSource(k.COLD),e.map.getSource(k.HOT)&&e.map.removeSource(k.HOT)}};return e.setup=o,o}const Te="#3bb2d0",ne="#fbb03b",Be="#fff",it=[{id:"gl-draw-polygon-fill",type:"fill",filter:["all",["==","$type","Polygon"]],paint:{"fill-color":["case",["==",["get","active"],"true"],ne,Te],"fill-opacity":.1}},{id:"gl-draw-lines",type:"line",filter:["any",["==","$type","LineString"],["==","$type","Polygon"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","active"],"true"],ne,Te],"line-dasharray":["case",["==",["get","active"],"true"],[.2,2],[2,0]],"line-width":2}},{id:"gl-draw-point-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Be}},{id:"gl-draw-point-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","feature"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":["case",["==",["get","active"],"true"],ne,Te]}},{id:"gl-draw-vertex-outer",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],7,5],"circle-color":Be}},{id:"gl-draw-vertex-inner",type:"circle",filter:["all",["==","$type","Point"],["==","meta","vertex"],["!=","mode","simple_select"]],paint:{"circle-radius":["case",["==",["get","active"],"true"],5,3],"circle-color":ne}},{id:"gl-draw-midpoint",type:"circle",filter:["all",["==","meta","midpoint"]],paint:{"circle-radius":3,"circle-color":ne}}];function me(e){return function(t){const n=t.featureTarget;return!n||!n.properties?!1:n.properties.meta===e}}function st(e){return!e.originalEvent||!e.originalEvent.shiftKey?!1:e.originalEvent.button===0}function W(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===L.ACTIVE&&e.featureTarget.properties.meta===N.FEATURE}function Fe(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.active===L.INACTIVE&&e.featureTarget.properties.meta===N.FEATURE}function ye(e){return e.featureTarget===void 0}function De(e){return!e.featureTarget||!e.featureTarget.properties?!1:e.featureTarget.properties.meta===N.FEATURE}function ae(e){const t=e.featureTarget;return!t||!t.properties?!1:t.properties.meta===N.VERTEX}function pe(e){return e.originalEvent?e.originalEvent.shiftKey===!0:!1}function Ee(e){return e.keyCode===27}function ve(e){return e.keyCode===13}function Kt(){return!0}const Wt=Object.freeze(Object.defineProperty({__proto__:null,isActiveFeature:W,isEnterKey:ve,isEscapeKey:Ee,isFeature:De,isInactiveFeature:Fe,isOfMetaType:me,isShiftDown:pe,isShiftMousedown:st,isTrue:Kt,isVertex:ae,noTarget:ye},Symbol.toStringTag,{value:"Module"}));function H(e,t){this.x=e,this.y=t}H.prototype={clone(){return new H(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,n=e.y-this.y;return t*t+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[0]*this.x+e[1]*this.y,n=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=n,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),n=Math.sin(e),o=t*this.x-n*this.y,r=n*this.x+t*this.y;return this.x=o,this.y=r,this},_rotateAround(e,t){const n=Math.cos(e),o=Math.sin(e),r=t.x+n*(this.x-t.x)-o*(this.y-t.y),i=t.y+o*(this.x-t.x)+n*(this.y-t.y);return this.x=r,this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:H};H.convert=function(e){if(e instanceof H)return e;if(Array.isArray(e))return new H(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new H(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};function we(e,t){const n=t.getBoundingClientRect();return new H(e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0))}function ee(e,t,n,o){return{type:p.FEATURE,properties:{meta:N.VERTEX,parent:e,coord_path:n,active:o?L.ACTIVE:L.INACTIVE},geometry:{type:p.POINT,coordinates:t}}}function at(e,t,n){const o=t.geometry.coordinates,r=n.geometry.coordinates;if(o[1]>Le||o[1]<Oe||r[1]>Le||r[1]<Oe)return null;const i={lng:(o[0]+r[0])/2,lat:(o[1]+r[1])/2};return{type:p.FEATURE,properties:{meta:N.MIDPOINT,parent:e,lng:i.lng,lat:i.lat,coord_path:n.properties.coord_path},geometry:{type:p.POINT,coordinates:[i.lng,i.lat]}}}function Ce(e,t={},n=null){const{type:o,coordinates:r}=e.geometry,i=e.properties&&e.properties.id;let a=[];o===p.POINT?a.push(ee(i,r,n,c(n))):o===p.POLYGON?r.forEach((m,S)=>{l(m,n!==null?`${n}.${S}`:String(S))}):o===p.LINE_STRING?l(r,n):o.indexOf(p.MULTI_PREFIX)===0&&s();function l(m,S){let u="",d=null;m.forEach((f,v)=>{const b=S!=null?`${S}.${v}`:String(v),J=ee(i,f,b,c(b));if(t.midpoints&&d){const Y=at(i,d,J);Y&&a.push(Y)}d=J;const X=JSON.stringify(f);u!==X&&a.push(J),v===0&&(u=X)})}function c(m){return t.selectedPaths?t.selectedPaths.indexOf(m)!==-1:!1}function s(){const m=o.replace(p.MULTI_PREFIX,"");r.forEach((S,u)=>{const d={type:p.FEATURE,properties:e.properties,geometry:{type:m,coordinates:S}};a=a.concat(Ce(d,t,u))})}return a}const x={enable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||!e._ctx||!e._ctx.store||!e._ctx.store.getInitialConfigValue||e._ctx.store.getInitialConfigValue("doubleClickZoom")&&e.map.doubleClickZoom.enable()},0)},disable(e){setTimeout(()=>{!e.map||!e.map.doubleClickZoom||e.map.doubleClickZoom.disable()},0)}},{LAT_MIN:le,LAT_MAX:ce,LAT_RENDERED_MIN:$e,LAT_RENDERED_MAX:qe,LNG_MIN:Je,LNG_MAX:Ye}=Qe;function zt(e){const t={Point:0,LineString:1,Polygon:2,MultiPoint:1,MultiLineString:2,MultiPolygon:3}[e.geometry.type],n=[e.geometry.coordinates].flat(t),o=n.map(l=>l[0]),r=n.map(l=>l[1]),i=l=>Math.min.apply(null,l),a=l=>Math.max.apply(null,l);return[i(o),i(r),a(o),a(r)]}function Re(e,t){let n=le,o=ce,r=le,i=ce,a=Ye,l=Je;e.forEach(s=>{const m=zt(s),S=m[1],u=m[3],d=m[0],f=m[2];S>n&&(n=S),u<o&&(o=u),u>r&&(r=u),S<i&&(i=S),d<a&&(a=d),f>l&&(l=f)});const c=t;return n+c.lat>qe&&(c.lat=qe-n),r+c.lat>ce&&(c.lat=ce-r),o+c.lat<$e&&(c.lat=$e-o),i+c.lat<le&&(c.lat=le-i),a+c.lng<=Je&&(c.lng+=Math.ceil(Math.abs(c.lng)/360)*360),l+c.lng>=Ye&&(c.lng-=Math.ceil(Math.abs(c.lng)/360)*360),c}function Ue(e,t){const n=Re(e.map(o=>o.toGeoJSON()),t);e.forEach(o=>{const r=o.getCoordinates(),i=s=>{const m={lng:s[0]+n.lng,lat:s[1]+n.lat};return[m.lng,m.lat]},a=s=>s.map(m=>i(m)),l=s=>s.map(m=>a(m));let c;o.type===p.POINT?c=i(r):o.type===p.LINE_STRING||o.type===p.MULTI_POINT?c=r.map(i):o.type===p.POLYGON||o.type===p.MULTI_LINE_STRING?c=r.map(a):o.type===p.MULTI_POLYGON&&(c=r.map(l)),o.incomingCoords(c)})}const C={};C.onSetup=function(e){const t={dragMoveLocation:null,boxSelectStartLocation:null,boxSelectElement:void 0,boxSelecting:!1,canBoxSelect:!1,dragMoving:!1,canDragMove:!1,initialDragPanState:this.map.dragPan.isEnabled(),initiallySelectedFeatureIds:e.featureIds||[]};return this.setSelected(t.initiallySelectedFeatureIds.filter(n=>this.getFeature(n)!==void 0)),this.fireActionable(),this.setActionableState({combineFeatures:!0,uncombineFeatures:!0,trash:!0}),t};C.fireUpdate=function(){this.fire(A.UPDATE,{action:ie.MOVE,features:this.getSelected().map(e=>e.toGeoJSON())})};C.fireActionable=function(){const e=this.getSelected(),t=e.filter(i=>this.isInstanceOf("MultiFeature",i));let n=!1;if(e.length>1){n=!0;const i=e[0].type.replace("Multi","");e.forEach(a=>{a.type.replace("Multi","")!==i&&(n=!1)})}const o=t.length>0,r=e.length>0;this.setActionableState({combineFeatures:n,uncombineFeatures:o,trash:r})};C.getUniqueIds=function(e){return e.length?e.map(n=>n.properties.id).filter(n=>n!==void 0).reduce((n,o)=>(n.add(o),n),new V).values():[]};C.stopExtendedInteractions=function(e){e.boxSelectElement&&(e.boxSelectElement.parentNode&&e.boxSelectElement.parentNode.removeChild(e.boxSelectElement),e.boxSelectElement=null),(e.canDragMove||e.canBoxSelect)&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.boxSelecting=!1,e.canBoxSelect=!1,e.dragMoving=!1,e.canDragMove=!1};C.onStop=function(){x.enable(this)};C.onMouseMove=function(e,t){return De(t)&&e.dragMoving&&this.fireUpdate(),this.stopExtendedInteractions(e),!0};C.onMouseOut=function(e){return e.dragMoving?this.fireUpdate():!0};C.onTap=C.onClick=function(e,t){if(ye(t))return this.clickAnywhere(e,t);if(me(N.VERTEX)(t))return this.clickOnVertex(e,t);if(De(t))return this.clickOnFeature(e,t)};C.clickAnywhere=function(e){const t=this.getSelectedIds();t.length&&(this.clearSelectedFeatures(),t.forEach(n=>this.doRender(n))),x.enable(this),this.stopExtendedInteractions(e)};C.clickOnVertex=function(e,t){this.changeMode(E.DIRECT_SELECT,{featureId:t.featureTarget.properties.parent,coordPath:t.featureTarget.properties.coord_path,startPos:t.lngLat}),this.updateUIClasses({mouse:I.MOVE})};C.startOnActiveFeature=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),this.doRender(t.featureTarget.properties.id),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};C.clickOnFeature=function(e,t){x.disable(this),this.stopExtendedInteractions(e);const n=pe(t),o=this.getSelectedIds(),r=t.featureTarget.properties.id,i=this.isSelected(r);if(!n&&i&&this.getFeature(r).type!==p.POINT)return this.changeMode(E.DIRECT_SELECT,{featureId:r});i&&n?(this.deselect(r),this.updateUIClasses({mouse:I.POINTER}),o.length===1&&x.enable(this)):!i&&n?(this.select(r),this.updateUIClasses({mouse:I.MOVE})):!i&&!n&&(o.forEach(a=>this.doRender(a)),this.setSelected(r),this.updateUIClasses({mouse:I.MOVE})),this.doRender(r)};C.onMouseDown=function(e,t){if(e.initialDragPanState=this.map.dragPan.isEnabled(),W(t))return this.startOnActiveFeature(e,t);if(this.drawConfig.boxSelect&&st(t))return this.startBoxSelect(e,t)};C.startBoxSelect=function(e,t){this.stopExtendedInteractions(e),this.map.dragPan.disable(),e.boxSelectStartLocation=we(t.originalEvent,this.map.getContainer()),e.canBoxSelect=!0};C.onTouchStart=function(e,t){if(W(t))return this.startOnActiveFeature(e,t)};C.onDrag=function(e,t){if(e.canDragMove)return this.dragMove(e,t);if(this.drawConfig.boxSelect&&e.canBoxSelect)return this.whileBoxSelect(e,t)};C.whileBoxSelect=function(e,t){e.boxSelecting=!0,this.updateUIClasses({mouse:I.ADD}),e.boxSelectElement||(e.boxSelectElement=document.createElement("div"),e.boxSelectElement.classList.add(D.BOX_SELECT),this.map.getContainer().appendChild(e.boxSelectElement));const n=we(t.originalEvent,this.map.getContainer()),o=Math.min(e.boxSelectStartLocation.x,n.x),r=Math.max(e.boxSelectStartLocation.x,n.x),i=Math.min(e.boxSelectStartLocation.y,n.y),a=Math.max(e.boxSelectStartLocation.y,n.y),l=`translate(${o}px, ${i}px)`;e.boxSelectElement.style.transform=l,e.boxSelectElement.style.WebkitTransform=l,e.boxSelectElement.style.width=`${r-o}px`,e.boxSelectElement.style.height=`${a-i}px`};C.dragMove=function(e,t){e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};Ue(this.getSelected(),n),e.dragMoveLocation=t.lngLat};C.onTouchEnd=C.onMouseUp=function(e,t){if(e.dragMoving)this.fireUpdate();else if(e.boxSelecting){const n=[e.boxSelectStartLocation,we(t.originalEvent,this.map.getContainer())],o=this.featuresAt(null,n,"click"),r=this.getUniqueIds(o).filter(i=>!this.isSelected(i));r.length&&(this.select(r),r.forEach(i=>this.doRender(i)),this.updateUIClasses({mouse:I.MOVE}))}this.stopExtendedInteractions(e)};C.toDisplayFeatures=function(e,t,n){t.properties.active=this.isSelected(t.properties.id)?L.ACTIVE:L.INACTIVE,n(t),this.fireActionable(),!(t.properties.active!==L.ACTIVE||t.geometry.type===p.POINT)&&Ce(t).forEach(n)};C.onTrash=function(){this.deleteFeature(this.getSelectedIds()),this.fireActionable()};C.onCombineFeatures=function(){const e=this.getSelected();if(e.length===0||e.length<2)return;const t=[],n=[],o=e[0].type.replace("Multi","");for(let r=0;r<e.length;r++){const i=e[r];if(i.type.replace("Multi","")!==o)return;i.type.includes("Multi")?i.getCoordinates().forEach(a=>{t.push(a)}):t.push(i.getCoordinates()),n.push(i.toGeoJSON())}if(n.length>1){const r=this.newFeature({type:p.FEATURE,properties:n[0].properties,geometry:{type:`Multi${o}`,coordinates:t}});this.addFeature(r),this.deleteFeature(this.getSelectedIds(),{silent:!0}),this.setSelected([r.id]),this.fire(A.COMBINE_FEATURES,{createdFeatures:[r.toGeoJSON()],deletedFeatures:n})}this.fireActionable()};C.onUncombineFeatures=function(){const e=this.getSelected();if(e.length===0)return;const t=[],n=[];for(let o=0;o<e.length;o++){const r=e[o];this.isInstanceOf("MultiFeature",r)&&(r.getFeatures().forEach(i=>{this.addFeature(i),i.properties=r.properties,t.push(i.toGeoJSON()),this.select([i.id])}),this.deleteFeature(r.id,{silent:!0}),n.push(r.toGeoJSON()))}t.length>1&&this.fire(A.UNCOMBINE_FEATURES,{createdFeatures:t,deletedFeatures:n}),this.fireActionable()};const ut=me(N.VERTEX),lt=me(N.MIDPOINT),T={};T.fireUpdate=function(){this.fire(A.UPDATE,{action:ie.CHANGE_COORDINATES,features:this.getSelected().map(e=>e.toGeoJSON())})};T.fireActionable=function(e){this.setActionableState({combineFeatures:!1,uncombineFeatures:!1,trash:e.selectedCoordPaths.length>0})};T.startDragging=function(e,t){e.initialDragPanState=this.map.dragPan.isEnabled(),this.map.dragPan.disable(),e.canDragMove=!0,e.dragMoveLocation=t.lngLat};T.stopDragging=function(e){e.canDragMove&&e.initialDragPanState===!0&&this.map.dragPan.enable(),e.dragMoving=!1,e.canDragMove=!1,e.dragMoveLocation=null};T.onVertex=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties,o=e.selectedCoordPaths.indexOf(n.coord_path);!pe(t)&&o===-1?e.selectedCoordPaths=[n.coord_path]:pe(t)&&o===-1&&e.selectedCoordPaths.push(n.coord_path);const r=this.pathsToCoordinates(e.featureId,e.selectedCoordPaths);this.setSelectedCoordinates(r)};T.onMidpoint=function(e,t){this.startDragging(e,t);const n=t.featureTarget.properties;e.feature.addCoordinate(n.coord_path,n.lng,n.lat),this.fireUpdate(),e.selectedCoordPaths=[n.coord_path]};T.pathsToCoordinates=function(e,t){return t.map(n=>({feature_id:e,coord_path:n}))};T.onFeature=function(e,t){e.selectedCoordPaths.length===0?this.startDragging(e,t):this.stopDragging(e)};T.dragFeature=function(e,t,n){Ue(this.getSelected(),n),e.dragMoveLocation=t.lngLat};T.dragVertex=function(e,t,n){const o=e.selectedCoordPaths.map(a=>e.feature.getCoordinate(a)),r=o.map(a=>({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:a}})),i=Re(r,n);for(let a=0;a<o.length;a++){const l=o[a];e.feature.updateCoordinate(e.selectedCoordPaths[a],l[0]+i.lng,l[1]+i.lat)}};T.clickNoTarget=function(){this.changeMode(E.SIMPLE_SELECT)};T.clickInactive=function(){this.changeMode(E.SIMPLE_SELECT)};T.clickActiveFeature=function(e){e.selectedCoordPaths=[],this.clearSelectedCoordinates(),e.feature.changed()};T.onSetup=function(e){const t=e.featureId,n=this.getFeature(t);if(!n)throw new Error("You must provide a featureId to enter direct_select mode");if(n.type===p.POINT)throw new TypeError("direct_select mode doesn't handle point features");const o={featureId:t,feature:n,dragMoveLocation:e.startPos||null,dragMoving:!1,canDragMove:!1,selectedCoordPaths:e.coordPath?[e.coordPath]:[]};return this.setSelectedCoordinates(this.pathsToCoordinates(t,o.selectedCoordPaths)),this.setSelected(t),x.disable(this),this.setActionableState({trash:!0}),o};T.onStop=function(){x.enable(this),this.clearSelectedCoordinates()};T.toDisplayFeatures=function(e,t,n){e.featureId===t.properties.id?(t.properties.active=L.ACTIVE,n(t),Ce(t,{map:this.map,midpoints:!0,selectedPaths:e.selectedCoordPaths}).forEach(n)):(t.properties.active=L.INACTIVE,n(t)),this.fireActionable(e)};T.onTrash=function(e){e.selectedCoordPaths.sort((t,n)=>n.localeCompare(t,"en",{numeric:!0})).forEach(t=>e.feature.removeCoordinate(t)),this.fireUpdate(),e.selectedCoordPaths=[],this.clearSelectedCoordinates(),this.fireActionable(e),e.feature.isValid()===!1&&(this.deleteFeature([e.featureId]),this.changeMode(E.SIMPLE_SELECT,{}))};T.onMouseMove=function(e,t){const n=W(t),o=ut(t),r=lt(t),i=e.selectedCoordPaths.length===0;return n&&i?this.updateUIClasses({mouse:I.MOVE}):o&&!i?this.updateUIClasses({mouse:I.MOVE}):this.updateUIClasses({mouse:I.NONE}),(o||n||r)&&e.dragMoving&&this.fireUpdate(),this.stopDragging(e),!0};T.onMouseOut=function(e){return e.dragMoving&&this.fireUpdate(),!0};T.onTouchStart=T.onMouseDown=function(e,t){if(ut(t))return this.onVertex(e,t);if(W(t))return this.onFeature(e,t);if(lt(t))return this.onMidpoint(e,t)};T.onDrag=function(e,t){if(e.canDragMove!==!0)return;e.dragMoving=!0,t.originalEvent.stopPropagation();const n={lng:t.lngLat.lng-e.dragMoveLocation.lng,lat:t.lngLat.lat-e.dragMoveLocation.lat};e.selectedCoordPaths.length>0?this.dragVertex(e,t,n):this.dragFeature(e,t,n),e.dragMoveLocation=t.lngLat};T.onClick=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(W(t))return this.clickActiveFeature(e,t);if(Fe(t))return this.clickInactive(e,t);this.stopDragging(e)};T.onTap=function(e,t){if(ye(t))return this.clickNoTarget(e,t);if(W(t))return this.clickActiveFeature(e,t);if(Fe(t))return this.clickInactive(e,t)};T.onTouchEnd=T.onMouseUp=function(e){e.dragMoving&&this.fireUpdate(),this.stopDragging(e)};const $={};$.onSetup=function(){const e=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:[]}});return this.addFeature(e),this.clearSelectedFeatures(),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(w.POINT),this.setActionableState({trash:!0}),{point:e}};$.stopDrawingAndRemove=function(e){this.deleteFeature([e.point.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT)};$.onTap=$.onClick=function(e,t){this.updateUIClasses({mouse:I.MOVE}),e.point.updateCoordinate("",t.lngLat.lng,t.lngLat.lat),this.fire(A.CREATE,{features:[e.point.toGeoJSON()]}),this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.point.id]})};$.onStop=function(e){this.activateUIButton(),e.point.getCoordinate().length||this.deleteFeature([e.point.id],{silent:!0})};$.toDisplayFeatures=function(e,t,n){const o=t.properties.id===e.point.id;if(t.properties.active=o?L.ACTIVE:L.INACTIVE,!o)return n(t)};$.onTrash=$.stopDrawingAndRemove;$.onKeyUp=function(e,t){if(Ee(t)||ve(t))return this.stopDrawingAndRemove(e,t)};function he(e,t){return e.lngLat?e.lngLat.lng===t[0]&&e.lngLat.lat===t[1]:!1}const G={};G.onSetup=function(){const e=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.POLYGON,coordinates:[[]]}});return this.addFeature(e),this.clearSelectedFeatures(),x.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(w.POLYGON),this.setActionableState({trash:!0}),{polygon:e,currentVertexPosition:0}};G.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&he(t,e.polygon.coordinates[0][e.currentVertexPosition-1]))return this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.polygon.id]});this.updateUIClasses({mouse:I.ADD}),e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),e.currentVertexPosition++,e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat)};G.clickOnVertex=function(e){return this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};G.onMouseMove=function(e,t){e.polygon.updateCoordinate(`0.${e.currentVertexPosition}`,t.lngLat.lng,t.lngLat.lat),ae(t)&&this.updateUIClasses({mouse:I.POINTER})};G.onTap=G.onClick=function(e,t){return ae(t)?this.clickOnVertex(e,t):this.clickAnywhere(e,t)};G.onKeyUp=function(e,t){Ee(t)?(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT)):ve(t)&&this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.polygon.id]})};G.onStop=function(e){this.updateUIClasses({mouse:I.NONE}),x.enable(this),this.activateUIButton(),this.getFeature(e.polygon.id)!==void 0&&(e.polygon.removeCoordinate(`0.${e.currentVertexPosition}`),e.polygon.isValid()?this.fire(A.CREATE,{features:[e.polygon.toGeoJSON()]}):(this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT,{},{silent:!0})))};G.toDisplayFeatures=function(e,t,n){const o=t.properties.id===e.polygon.id;if(t.properties.active=o?L.ACTIVE:L.INACTIVE,!o)return n(t);if(t.geometry.coordinates.length===0)return;const r=t.geometry.coordinates[0].length;if(!(r<3)){if(t.properties.meta=N.FEATURE,n(ee(e.polygon.id,t.geometry.coordinates[0][0],"0.0",!1)),r>3){const i=t.geometry.coordinates[0].length-3;n(ee(e.polygon.id,t.geometry.coordinates[0][i],`0.${i}`,!1))}if(r<=4){const i=[[t.geometry.coordinates[0][0][0],t.geometry.coordinates[0][0][1]],[t.geometry.coordinates[0][1][0],t.geometry.coordinates[0][1][1]]];if(n({type:p.FEATURE,properties:t.properties,geometry:{coordinates:i,type:p.LINE_STRING}}),r===3)return}return n(t)}};G.onTrash=function(e){this.deleteFeature([e.polygon.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT)};const B={};B.onSetup=function(e){e=e||{};const t=e.featureId;let n,o,r="forward";if(t){if(n=this.getFeature(t),!n)throw new Error("Could not find a feature with the provided featureId");let i=e.from;if(i&&i.type==="Feature"&&i.geometry&&i.geometry.type==="Point"&&(i=i.geometry),i&&i.type==="Point"&&i.coordinates&&i.coordinates.length===2&&(i=i.coordinates),!i||!Array.isArray(i))throw new Error("Please use the `from` property to indicate which point to continue the line from");const a=n.coordinates.length-1;if(n.coordinates[a][0]===i[0]&&n.coordinates[a][1]===i[1])o=a+1,n.addCoordinate(o,...n.coordinates[a]);else if(n.coordinates[0][0]===i[0]&&n.coordinates[0][1]===i[1])r="backwards",o=0,n.addCoordinate(o,...n.coordinates[0]);else throw new Error("`from` should match the point at either the start or the end of the provided LineString")}else n=this.newFeature({type:p.FEATURE,properties:{},geometry:{type:p.LINE_STRING,coordinates:[]}}),o=0,this.addFeature(n);return this.clearSelectedFeatures(),x.disable(this),this.updateUIClasses({mouse:I.ADD}),this.activateUIButton(w.LINE),this.setActionableState({trash:!0}),{line:n,currentVertexPosition:o,direction:r}};B.clickAnywhere=function(e,t){if(e.currentVertexPosition>0&&he(t,e.line.coordinates[e.currentVertexPosition-1])||e.direction==="backwards"&&he(t,e.line.coordinates[e.currentVertexPosition+1]))return this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.line.id]});this.updateUIClasses({mouse:I.ADD}),e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),e.direction==="forward"?(e.currentVertexPosition++,e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat)):e.line.addCoordinate(0,t.lngLat.lng,t.lngLat.lat)};B.clickOnVertex=function(e){return this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.line.id]})};B.onMouseMove=function(e,t){e.line.updateCoordinate(e.currentVertexPosition,t.lngLat.lng,t.lngLat.lat),ae(t)&&this.updateUIClasses({mouse:I.POINTER})};B.onTap=B.onClick=function(e,t){if(ae(t))return this.clickOnVertex(e,t);this.clickAnywhere(e,t)};B.onKeyUp=function(e,t){ve(t)?this.changeMode(E.SIMPLE_SELECT,{featureIds:[e.line.id]}):Ee(t)&&(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT))};B.onStop=function(e){x.enable(this),this.activateUIButton(),this.getFeature(e.line.id)!==void 0&&(e.line.removeCoordinate(`${e.currentVertexPosition}`),e.line.isValid()?this.fire(A.CREATE,{features:[e.line.toGeoJSON()]}):(this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT,{},{silent:!0})))};B.onTrash=function(e){this.deleteFeature([e.line.id],{silent:!0}),this.changeMode(E.SIMPLE_SELECT)};B.toDisplayFeatures=function(e,t,n){const o=t.properties.id===e.line.id;if(t.properties.active=o?L.ACTIVE:L.INACTIVE,!o)return n(t);t.geometry.coordinates.length<2||(t.properties.meta=N.FEATURE,n(ee(e.line.id,t.geometry.coordinates[e.direction==="forward"?t.geometry.coordinates.length-2:1],`${e.direction==="forward"?t.geometry.coordinates.length-2:1}`,!1)),n(t))};const ct={simple_select:C,direct_select:T,draw_point:$,draw_polygon:G,draw_line_string:B},jt={defaultMode:E.SIMPLE_SELECT,keybindings:!0,touchEnabled:!0,clickBuffer:2,touchBuffer:25,boxSelect:!0,displayControlsDefault:!0,styles:it,modes:ct,controls:{},userProperties:!1,suppressAPIEvents:!0},Qt={point:!0,line_string:!0,polygon:!0,trash:!0,combine_features:!0,uncombine_features:!0},en={point:!1,line_string:!1,polygon:!1,trash:!1,combine_features:!1,uncombine_features:!1};function Xe(e,t){return e.map(n=>n.source?n:Object.assign({},n,{id:`${n.id}.${t}`,source:t==="hot"?k.HOT:k.COLD}))}function tn(e={}){let t=Object.assign({},e);return e.controls||(t.controls={}),e.displayControlsDefault===!1?t.controls=Object.assign({},en,e.controls):t.controls=Object.assign({},Qt,e.controls),t=Object.assign({},jt,t),t.styles=Xe(t.styles,"cold").concat(Xe(t.styles,"hot")),t}var Se,He;function nn(){return He||(He=1,Se=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var o,r,i;if(Array.isArray(t)){if(o=t.length,o!=n.length)return!1;for(r=o;r--!==0;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(n).length)return!1;for(r=o;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=o;r--!==0;){var a=i[r];if(!e(t[a],n[a]))return!1}return!0}return t!==t&&n!==n}),Se}var on=nn();const Ze=re(on);var _e,Ke;function rn(){if(Ke)return _e;Ke=1,_e=t;var e={Point:"geometry",MultiPoint:"geometry",LineString:"geometry",MultiLineString:"geometry",Polygon:"geometry",MultiPolygon:"geometry",GeometryCollection:"geometry",Feature:"feature",FeatureCollection:"featurecollection"};function t(n){if(!n||!n.type)return null;var o=e[n.type];if(!o)return null;if(o==="geometry")return{type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:n}]};if(o==="feature")return{type:"FeatureCollection",features:[n]};if(o==="featurecollection")return n}return _e}var sn=rn();const an=re(sn);function dt(e,t){return e.length!==t.length?!1:JSON.stringify(e.map(n=>n).sort())===JSON.stringify(t.map(n=>n).sort())}const un={Polygon:U,LineString:q,Point:Z,MultiPolygon:P,MultiLineString:P,MultiPoint:P};function ln(e,t){t.modes=E;const n=e.options.suppressAPIEvents!==void 0?!!e.options.suppressAPIEvents:!0;return t.getFeatureIdsAt=function(o){return Q.click({point:o},null,e).map(i=>i.properties.id)},t.getSelectedIds=function(){return e.store.getSelectedIds()},t.getSelected=function(){return{type:p.FEATURE_COLLECTION,features:e.store.getSelectedIds().map(o=>e.store.get(o)).map(o=>o.toGeoJSON())}},t.getSelectedPoints=function(){return{type:p.FEATURE_COLLECTION,features:e.store.getSelectedCoordinates().map(o=>({type:p.FEATURE,properties:{},geometry:{type:p.POINT,coordinates:o.coordinates}}))}},t.set=function(o){if(o.type===void 0||o.type!==p.FEATURE_COLLECTION||!Array.isArray(o.features))throw new Error("Invalid FeatureCollection");const r=e.store.createRenderBatch();let i=e.store.getAllIds().slice();const a=t.add(o),l=new V(a);return i=i.filter(c=>!l.has(c)),i.length&&t.delete(i),r(),a},t.add=function(o){const i=JSON.parse(JSON.stringify(an(o))).features.map(a=>{if(a.id=a.id||Ae(),a.geometry===null)throw new Error("Invalid geometry: null");if(e.store.get(a.id)===void 0||e.store.get(a.id).type!==a.geometry.type){const l=un[a.geometry.type];if(l===void 0)throw new Error(`Invalid geometry type: ${a.geometry.type}.`);const c=new l(e,a);e.store.add(c,{silent:n})}else{const l=e.store.get(a.id),c=l.properties;l.properties=a.properties,Ze(c,a.properties)||e.store.featureChanged(l.id,{silent:n}),Ze(l.getCoordinates(),a.geometry.coordinates)||l.incomingCoords(a.geometry.coordinates)}return a.id});return e.store.render(),i},t.get=function(o){const r=e.store.get(o);if(r)return r.toGeoJSON()},t.getAll=function(){return{type:p.FEATURE_COLLECTION,features:e.store.getAll().map(o=>o.toGeoJSON())}},t.delete=function(o){return e.store.delete(o,{silent:n}),t.getMode()===E.DIRECT_SELECT&&!e.store.getSelectedIds().length?e.events.changeMode(E.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.deleteAll=function(){return e.store.delete(e.store.getAllIds(),{silent:n}),t.getMode()===E.DIRECT_SELECT?e.events.changeMode(E.SIMPLE_SELECT,void 0,{silent:n}):e.store.render(),t},t.changeMode=function(o,r={}){return o===E.SIMPLE_SELECT&&t.getMode()===E.SIMPLE_SELECT?(dt(r.featureIds||[],e.store.getSelectedIds())||(e.store.setSelected(r.featureIds,{silent:n}),e.store.render()),t):(o===E.DIRECT_SELECT&&t.getMode()===E.DIRECT_SELECT&&r.featureId===e.store.getSelectedIds()[0]||e.events.changeMode(o,r,{silent:n}),t)},t.getMode=function(){return e.events.getMode()},t.trash=function(){return e.events.trash({silent:n}),t},t.combineFeatures=function(){return e.events.combineFeatures({silent:n}),t},t.uncombineFeatures=function(){return e.events.uncombineFeatures({silent:n}),t},t.setFeatureProperty=function(o,r,i){return e.store.setFeatureProperty(o,r,i,{silent:n}),t},t}const cn=Object.freeze(Object.defineProperty({__proto__:null,CommonSelectors:Wt,ModeHandler:Me,StringSet:V,constrainFeatureMovement:Re,createMidPoint:at,createSupplementaryPoints:Ce,createVertex:ee,doubleClickZoom:x,euclideanDistance:Pe,featuresAt:Q,getFeatureAtAndSetCursors:fe,isClick:Ne,isEventAtCoordinates:he,isTap:be,mapEventToBoundingBox:tt,moveFeatures:Ue,sortFeatures:et,stringSetsAreEqual:dt,theme:it,toDenseArray:se},Symbol.toStringTag,{value:"Module"})),dn=function(e,t){e=tn(e);const n={options:e};t=ln(n,t),n.api=t;const o=Zt(n);return t.onAdd=o.onAdd,t.onRemove=o.onRemove,t.types=w,t.options=e,t};function oe(e){dn(e,this)}oe.modes=ct;oe.constants=Qe;oe.lib=cn;var Ie={exports:{}},We;function fn(){if(We)return Ie.exports;We=1;var e=Ie.exports={};return e.onSetup=function(){return this.setActionableState(),{}},e.toDisplayFeatures=function(t,n,o){o(n)},Ie.exports}var pn=fn();const hn=re(pn);var de={},ze;function gn(){if(ze)return de;ze=1,Object.defineProperty(de,"__esModule",{value:!0});var e={enable:function(o){setTimeout(function(){!o.map||!o.map.doubleClickZoom||!o._ctx||!o._ctx.store||!o._ctx.store.getInitialConfigValue||o._ctx.store.getInitialConfigValue("doubleClickZoom")&&o.map.doubleClickZoom.enable()},0)},disable:function(o){setTimeout(function(){!o.map||!o.map.doubleClickZoom||o.map.doubleClickZoom.disable()},0)}},t={onSetup:function(o){var r=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[]]}});return this.addFeature(r),this.clearSelectedFeatures(),e.disable(this),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:r}},onTap:function(o,r){o.startPoint&&this.onMouseMove(o,r),this.onClick(o,r)},onClick:function(o,r){o.startPoint&&o.startPoint[0]!==r.lngLat.lng&&o.startPoint[1]!==r.lngLat.lat&&(this.updateUIClasses({mouse:"pointer"}),o.endPoint=[r.lngLat.lng,r.lngLat.lat],this.changeMode("simple_select",{featuresId:o.rectangle.id}));var i=[r.lngLat.lng,r.lngLat.lat];o.startPoint=i},onMouseMove:function(o,r){o.startPoint&&(o.rectangle.updateCoordinate("0.0",o.startPoint[0],o.startPoint[1]),o.rectangle.updateCoordinate("0.1",r.lngLat.lng,o.startPoint[1]),o.rectangle.updateCoordinate("0.2",r.lngLat.lng,r.lngLat.lat),o.rectangle.updateCoordinate("0.3",o.startPoint[0],r.lngLat.lat),o.rectangle.updateCoordinate("0.4",o.startPoint[0],o.startPoint[1]))},onKeyUp:function(o,r){if(r.keyCode===27)return this.changeMode("simple_select")},onStop:function(o){e.enable(this),this.updateUIClasses({mouse:"none"}),this.activateUIButton(),this.getFeature(o.rectangle.id)!==void 0&&(o.rectangle.removeCoordinate("0.4"),o.rectangle.isValid()?this.map.fire("draw.create",{features:[o.rectangle.toGeoJSON()]}):(this.deleteFeature([o.rectangle.id],{silent:!0}),this.changeMode("simple_select",{},{silent:!0})))},toDisplayFeatures:function(o,r,i){var a=r.properties.id===o.rectangle.id;if(r.properties.active=a?"true":"false",!a)return i(r);if(o.startPoint)return i(r)},onTrash:function(o){this.deleteFeature([o.rectangle.id],{silent:!0}),this.changeMode("simple_select")}};return de.default=t,de}var mn=gn();const yn=re(mn),En={key:0,class:"measure-info-panel"},vn={class:"measure-info-content"},Cn={class:"measure-label"},Tn={class:"measure-value"},Sn={class:"qy-flex-row hiper-map-tools-bar"},_n=g.defineComponent({__name:"MapTools",setup(e){const t=g.inject("mapRootId"),n=g.ref(),o=g.ref([]),r=g.ref(null),i=g.ref(null),a=g.ref(!1),l=g.ref("distance"),c=M=>{switch(a.value&&M!=="measure_distance"&&M!=="clear_all"&&X(),n.value=M,M){case"point":m.changeMode("draw_point");break;case"line":m.changeMode("draw_line_string");break;case"polygon":m.changeMode("draw_polygon");break;case"measure_distance":m.changeMode("simple_select"),l.value="distance",d();break;case"measure_area":m.changeMode("simple_select"),l.value="area",d();break;case"clear_all":m.deleteAll(),X();break}},s=g.inject(mt.mapInstanceKey),m=new oe({userProperties:!0,displayControlsDefault:!1,modes:{...oe.modes,draw_rectangle:yn,static:hn}});let S=null;S=ke.mapLoadedBus.on(({mapRootId:M})=>{t!==M||!(s!=null&&s.value)||(console.log("hiper-map-tools-bar mounted",s),s.value.addControl(m,"top-left"),s.value.on("draw.create",u))});function u(M){const h=m.getAll();if(!h.features.length)return;h.features=[h.features[0]];const O={point:{layerType:"symbol",config:{textColor:"rgba(0,0,0,1)",iconName:yt.DefaultIcon}},line:{layerType:"line",config:{lineWidth:1,lineColor:"rgba(255, 0, 0, 1)",lineStyle:"solid"}},polygon:{layerType:"shape",config:{fillColor:"rgba(241, 131, 127, 1)",lineWidth:1}}}[n.value];O&&ke.showLayerEditKeyBus.emit({mapRootId:t,e:new MouseEvent("click"),layer:{layerType:O.layerType,customLayerConfig:JSON.stringify(O.config),geoJSON:JSON.stringify(h),...n.value==="polygon"?{pid:null}:{}}}),m.deleteAll()}function d(){s!=null&&s.value&&(a.value=!0,o.value=[],s.value.getCanvas().style.cursor="crosshair",s.value.on("click",v),s.value.on("dblclick",f))}function f(M){var h,R;if(a.value){if(M.preventDefault(),l.value==="distance")o.value.length>=2&&b();else if(o.value.length>=3){const O=o.value[0],K=o.value[o.value.length-1];(O[0]!==K[0]||O[1]!==K[1])&&o.value.push(O),b()}(h=s==null?void 0:s.value)==null||h.off("click",v),(R=s==null?void 0:s.value)==null||R.off("dblclick",f),s!=null&&s.value&&(s.value.getCanvas().style.cursor=""),a.value=!1}}function v(M){if(!a.value||!(s!=null&&s.value))return;M.originalEvent.stopPropagation();const h=[M.lngLat.lng,M.lngLat.lat];o.value.push(h),o.value.length===1?(l.value==="distance"?Y.value=0:z.value=0,s.value.getSource("measure-point-source")?s.value.getSource("measure-point-source").setData({type:"Feature",properties:{},geometry:{type:"Point",coordinates:h}}):(s.value.addSource("measure-point-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"Point",coordinates:h}}}),s.value.addLayer({id:"measure-point-layer",type:"circle",source:"measure-point-source",paint:{"circle-radius":5,"circle-color":"#16aaff"}}))):(s.value.getSource("measure-point-source")&&s.value.getSource("measure-point-source").setData({type:"FeatureCollection",features:o.value.map(R=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:R}}))}),b(),l.value==="area"&&o.value.length>=3&&(s.value.getCanvas().style.cursor="pointer"))}function b(){if(!(s!=null&&s.value)||o.value.length<2)return;const M=j.lineString(o.value);if(l.value==="distance"){const h=j.length(M,{units:"kilometers"});Y.value=h,h<1?`${(h*1e3).toFixed(2)}`:`${h.toFixed(3)}`;const R=Math.floor(o.value.length/2)-1;R<0?o.value[0]:o.value[R],J(M)}else if(o.value.length>=3){const h=[...o.value];h[0]!==h[h.length-1]&&h.push(h[0]);const R=j.polygon([h]),O=j.area(R)/1e6;z.value=O,O<1?`${(O*1e6).toFixed(2)}`:`${O.toFixed(3)}`;const K=j.centroid(R);J(M,K.geometry.coordinates)}else J(M,M.geometry.coordinates[0])}function J(M,h,R){if(s!=null&&s.value){if(s.value.getSource("measure-line-source")?s.value.getSource("measure-line-source").setData(M):(s.value.addSource("measure-line-source",{type:"geojson",data:M}),s.value.addLayer({id:"measure-line-layer",type:"line",source:"measure-line-source",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#16aaff","line-width":2,"line-dasharray":[2,1]}}),r.value="measure-line-layer"),l.value==="area"&&o.value.length>=3){const O=[...o.value];O[0]!==O[O.length-1]&&O.push(O[0]);const K=j.polygon([O]);s.value.getSource("measure-fill-source")?s.value.getSource("measure-fill-source").setData(K):(s.value.addSource("measure-fill-source",{type:"geojson",data:K}),s.value.addLayer({id:"measure-fill-layer",type:"fill",source:"measure-fill-source",paint:{"fill-color":"#16aaff","fill-opacity":.2,"fill-outline-color":"#16aaff"}},"measure-line-layer"))}s.value.getSource("measure-label-source")&&s.value.getLayer("measure-label-layer")&&(s.value.removeLayer("measure-label-layer"),s.value.removeSource("measure-label-source"),i.value=null)}}function X(){s!=null&&s.value&&(s.value.off("click",v),s.value.off("dblclick",f),s.value.getCanvas().style.cursor="",s.value.getLayer("measure-point-layer")&&(s.value.removeLayer("measure-point-layer"),s.value.removeSource("measure-point-source")),s.value.getLayer("measure-line-layer")&&(s.value.removeLayer("measure-line-layer"),s.value.removeSource("measure-line-source")),s.value.getLayer("measure-fill-layer")&&(s.value.removeLayer("measure-fill-layer"),s.value.removeSource("measure-fill-source")),s.value.getLayer("measure-label-layer")&&(s.value.removeLayer("measure-label-layer"),s.value.removeSource("measure-label-source")),o.value=[],r.value=null,i.value=null,a.value=!1,Y.value=0,z.value=0,s.value.getLayer("measure-label-layer")&&s.value.removeLayer("measure-label-layer"),s.value.getSource("measure-label-source")&&s.value.removeSource("measure-label-source"))}g.onUnmounted(()=>{X(),S&&S(),s!=null&&s.value&&(s.value.removeControl(m),s.value.off("draw.create",u),s.value.off("click",v),s.value.off("dblclick",f))});const Y=g.ref(0),ft=g.computed(()=>Y.value<1?`${(Y.value*1e3).toFixed(2)} 米`:`${Y.value.toFixed(3)} 公里`),z=g.ref(0),pt=g.computed(()=>z.value<1?`${(z.value*1e6).toFixed(2)} 平方米`:`${z.value.toFixed(3)} 平方公里`),ht=g.computed(()=>l.value==="distance"?ft.value:pt.value),gt=g.computed(()=>l.value==="distance"?"总长度: ":"总面积: ");return(M,h)=>(g.openBlock(),g.createElementBlock(g.Fragment,null,[a.value||o.value.length>0&&(n.value=="measure_distance"||n.value=="measure_area")?(g.openBlock(),g.createElementBlock("div",En,[g.createElementVNode("div",vn,[g.createElementVNode("span",Cn,g.toDisplayString(gt.value),1),g.createElementVNode("span",Tn,g.toDisplayString(ht.value),1),g.createVNode(g.unref(Ct.ElIcon),{style:{display:"block","margin-left":"10px",cursor:"pointer"},onClick:h[0]||(h[0]=R=>c("clear_all")),size:"20px"},{default:g.withCtx(()=>[g.createVNode(g.unref(vt.Close))]),_:1})])])):g.createCommentVNode("",!0),g.createElementVNode("div",Sn,[g.createElementVNode("div",{title:"兴趣点",class:g.normalizeClass(["hiper-map-tools-btn",n.value=="point"?"active":null]),onClick:h[1]||(h[1]=()=>c("point"))},h[7]||(h[7]=[g.createElementVNode("span",{class:"qyuan icon-local-two"},null,-1)]),2),g.createElementVNode("div",{title:"折线",class:g.normalizeClass(["hiper-map-tools-btn",n.value=="line"?"active":null]),onClick:h[2]||(h[2]=()=>c("line"))},h[8]||(h[8]=[g.createElementVNode("span",{class:"qyuan icon-whole-site-accelerator"},null,-1)]),2),g.createElementVNode("div",{title:"多边形",class:g.normalizeClass(["hiper-map-tools-btn",n.value=="polygon"?"active":null]),onClick:h[3]||(h[3]=()=>c("polygon"))},h[9]||(h[9]=[g.createElementVNode("span",{class:"qyuan icon-anchor"},null,-1)]),2),g.createElementVNode("div",{title:"测距",class:g.normalizeClass(["hiper-map-tools-btn",n.value=="measure_distance"?"active":null]),onClick:h[4]||(h[4]=()=>c("measure_distance"))},h[10]||(h[10]=[g.createElementVNode("span",{class:"qyuan icon-ruler"},null,-1)]),2),g.createElementVNode("div",{title:"测面",class:g.normalizeClass(["hiper-map-tools-btn",n.value=="measure_area"?"active":null]),onClick:h[5]||(h[5]=()=>c("measure_area"))},h[11]||(h[11]=[g.createElementVNode("span",{class:"qyuan icon-multi-triangular"},null,-1)]),2),g.createElementVNode("div",{title:"清除所有临时绘制图形",class:"hiper-map-tools-btn",style:{border:"none"},onClick:h[6]||(h[6]=()=>c("clear_all"))},h[12]||(h[12]=[g.createElementVNode("span",{class:"qyuan icon-clear"},null,-1)]))])],64))}});exports._sfc_main=_n;