@performant-software/geospatial 3.1.0-beta.2 → 3.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/index.cjs14.js +1 -1
  2. package/dist/index.cjs188.js +1 -1
  3. package/dist/index.cjs189.js +1 -1
  4. package/dist/index.cjs190.js +1 -1
  5. package/dist/index.cjs191.js +1 -1
  6. package/dist/index.cjs193.js +1 -1
  7. package/dist/index.cjs194.js +1 -1
  8. package/dist/index.cjs195.js +1 -1
  9. package/dist/index.cjs196.js +1 -1
  10. package/dist/index.cjs198.js +1 -1
  11. package/dist/index.cjs199.js +1 -1
  12. package/dist/index.cjs201.js +1 -1
  13. package/dist/index.cjs213.js +1 -1
  14. package/dist/index.cjs214.js +1 -1
  15. package/dist/index.cjs215.js +1 -1
  16. package/dist/index.cjs233.js +1 -1
  17. package/dist/index.cjs238.js +1 -1
  18. package/dist/index.cjs238.js.map +1 -1
  19. package/dist/index.cjs239.js +1 -1
  20. package/dist/index.cjs239.js.map +1 -1
  21. package/dist/index.cjs240.js +1 -1
  22. package/dist/index.cjs240.js.map +1 -1
  23. package/dist/index.cjs241.js +1 -1
  24. package/dist/index.cjs241.js.map +1 -1
  25. package/dist/index.cjs242.js +1 -1
  26. package/dist/index.cjs242.js.map +1 -1
  27. package/dist/index.cjs243.js +1 -1
  28. package/dist/index.cjs243.js.map +1 -1
  29. package/dist/index.cjs244.js +1 -1
  30. package/dist/index.cjs244.js.map +1 -1
  31. package/dist/index.cjs245.js +1 -1
  32. package/dist/index.cjs245.js.map +1 -1
  33. package/dist/index.cjs246.js +1 -1
  34. package/dist/index.cjs246.js.map +1 -1
  35. package/dist/index.cjs247.js +1 -1
  36. package/dist/index.cjs247.js.map +1 -1
  37. package/dist/index.cjs248.js +1 -1
  38. package/dist/index.cjs248.js.map +1 -1
  39. package/dist/index.cjs249.js +1 -1
  40. package/dist/index.cjs249.js.map +1 -1
  41. package/dist/index.cjs250.js +1 -1
  42. package/dist/index.cjs250.js.map +1 -1
  43. package/dist/index.cjs251.js +1 -1
  44. package/dist/index.cjs251.js.map +1 -1
  45. package/dist/index.cjs252.js +1 -1
  46. package/dist/index.cjs252.js.map +1 -1
  47. package/dist/index.cjs253.js +1 -1
  48. package/dist/index.cjs253.js.map +1 -1
  49. package/dist/index.cjs254.js +1 -1
  50. package/dist/index.cjs254.js.map +1 -1
  51. package/dist/index.cjs255.js +1 -1
  52. package/dist/index.cjs255.js.map +1 -1
  53. package/dist/index.cjs256.js +1 -1
  54. package/dist/index.cjs256.js.map +1 -1
  55. package/dist/index.cjs257.js +1 -1
  56. package/dist/index.cjs257.js.map +1 -1
  57. package/dist/index.cjs259.js +1 -1
  58. package/dist/index.cjs259.js.map +1 -1
  59. package/dist/index.cjs260.js +1 -1
  60. package/dist/index.cjs260.js.map +1 -1
  61. package/dist/index.cjs262.js +1 -1
  62. package/dist/index.cjs263.js +1 -1
  63. package/dist/index.cjs27.js +1 -1
  64. package/dist/index.cjs31.js +1 -1
  65. package/dist/index.cjs7.js.map +1 -1
  66. package/dist/index.cjs71.js +743 -1
  67. package/dist/index.cjs71.js.map +1 -1
  68. package/dist/index.cjs72.js +1 -1
  69. package/dist/index.cjs73.js +1 -1
  70. package/dist/index.cjs73.js.map +1 -1
  71. package/dist/index.cjs74.js +1 -743
  72. package/dist/index.cjs74.js.map +1 -1
  73. package/dist/index.cjs75.js +9 -1
  74. package/dist/index.cjs75.js.map +1 -1
  75. package/dist/index.cjs76.js +17 -1
  76. package/dist/index.cjs76.js.map +1 -1
  77. package/dist/index.cjs77.js +1 -1
  78. package/dist/index.cjs77.js.map +1 -1
  79. package/dist/index.cjs78.js +1 -9
  80. package/dist/index.cjs78.js.map +1 -1
  81. package/dist/index.cjs79.js +1 -17
  82. package/dist/index.cjs79.js.map +1 -1
  83. package/dist/index.es14.js +2 -2
  84. package/dist/index.es188.js +1 -1
  85. package/dist/index.es189.js +1 -1
  86. package/dist/index.es190.js +1 -1
  87. package/dist/index.es191.js +2 -2
  88. package/dist/index.es193.js +3 -3
  89. package/dist/index.es194.js +1 -1
  90. package/dist/index.es195.js +1 -1
  91. package/dist/index.es196.js +1 -1
  92. package/dist/index.es198.js +2 -2
  93. package/dist/index.es199.js +3 -3
  94. package/dist/index.es201.js +2 -2
  95. package/dist/index.es213.js +1 -1
  96. package/dist/index.es214.js +1 -1
  97. package/dist/index.es215.js +1 -1
  98. package/dist/index.es233.js +1 -1
  99. package/dist/index.es238.js +22 -18
  100. package/dist/index.es238.js.map +1 -1
  101. package/dist/index.es239.js +16 -22
  102. package/dist/index.es239.js.map +1 -1
  103. package/dist/index.es240.js +28 -22
  104. package/dist/index.es240.js.map +1 -1
  105. package/dist/index.es241.js +20 -15
  106. package/dist/index.es241.js.map +1 -1
  107. package/dist/index.es242.js +74 -30
  108. package/dist/index.es242.js.map +1 -1
  109. package/dist/index.es243.js +20 -21
  110. package/dist/index.es243.js.map +1 -1
  111. package/dist/index.es244.js +37 -71
  112. package/dist/index.es244.js.map +1 -1
  113. package/dist/index.es245.js +48 -19
  114. package/dist/index.es245.js.map +1 -1
  115. package/dist/index.es246.js +7 -40
  116. package/dist/index.es246.js.map +1 -1
  117. package/dist/index.es247.js +19 -48
  118. package/dist/index.es247.js.map +1 -1
  119. package/dist/index.es248.js +65 -7
  120. package/dist/index.es248.js.map +1 -1
  121. package/dist/index.es249.js +40 -18
  122. package/dist/index.es249.js.map +1 -1
  123. package/dist/index.es250.js +58 -60
  124. package/dist/index.es250.js.map +1 -1
  125. package/dist/index.es251.js +8 -42
  126. package/dist/index.es251.js.map +1 -1
  127. package/dist/index.es252.js +3 -63
  128. package/dist/index.es252.js.map +1 -1
  129. package/dist/index.es253.js +12 -8
  130. package/dist/index.es253.js.map +1 -1
  131. package/dist/index.es254.js +59 -3
  132. package/dist/index.es254.js.map +1 -1
  133. package/dist/index.es255.js +48 -11
  134. package/dist/index.es255.js.map +1 -1
  135. package/dist/index.es256.js +18 -57
  136. package/dist/index.es256.js.map +1 -1
  137. package/dist/index.es257.js +22 -49
  138. package/dist/index.es257.js.map +1 -1
  139. package/dist/index.es259.js +6 -4
  140. package/dist/index.es259.js.map +1 -1
  141. package/dist/index.es260.js +4 -6
  142. package/dist/index.es260.js.map +1 -1
  143. package/dist/index.es262.js +4 -4
  144. package/dist/index.es263.js +1 -1
  145. package/dist/index.es27.js +1 -1
  146. package/dist/index.es31.js +2 -2
  147. package/dist/index.es7.js.map +1 -1
  148. package/dist/index.es71.js +21314 -1955
  149. package/dist/index.es71.js.map +1 -1
  150. package/dist/index.es72.js +2 -6
  151. package/dist/index.es72.js.map +1 -1
  152. package/dist/index.es73.js +8 -2
  153. package/dist/index.es73.js.map +1 -1
  154. package/dist/index.es74.js +2 -21352
  155. package/dist/index.es74.js.map +1 -1
  156. package/dist/index.es75.js +26 -2
  157. package/dist/index.es75.js.map +1 -1
  158. package/dist/index.es76.js +588 -7
  159. package/dist/index.es76.js.map +1 -1
  160. package/dist/index.es77.js +1993 -2
  161. package/dist/index.es77.js.map +1 -1
  162. package/dist/index.es78.js +5 -25
  163. package/dist/index.es78.js.map +1 -1
  164. package/dist/index.es79.js +2 -589
  165. package/dist/index.es79.js.map +1 -1
  166. package/package.json +1 -1
  167. package/src/components/MapControl.js +0 -1
  168. package/types/components/MapControl.js.flow +0 -1
@@ -1,5 +1,1996 @@
1
- var e = { exports: {} };
1
+ import { commonjsGlobal as bt } from "./index.es78.js";
2
+ import { __module as Et } from "./index.es79.js";
3
+ var io = Et.exports, Wn;
4
+ function co() {
5
+ return Wn ? Et.exports : (Wn = 1, function(Kn, ao) {
6
+ (function(Je, de) {
7
+ Kn.exports = de();
8
+ })(io, function() {
9
+ var Je = function(e, t) {
10
+ var n = { drag: [], click: [], mousemove: [], mousedown: [], mouseup: [], mouseout: [], keydown: [], keyup: [], touchstart: [], touchmove: [], touchend: [], tap: [] }, r = { on: function(i, a, l) {
11
+ if (n[i] === void 0) throw new Error("Invalid event type: " + i);
12
+ n[i].push({ selector: a, fn: l });
13
+ }, render: function(i) {
14
+ t.store.featureChanged(i);
15
+ } }, o = function(i, a) {
16
+ for (var l = n[i], d = l.length; d--; ) {
17
+ var h = l[d];
18
+ if (h.selector(a)) {
19
+ h.fn.call(r, a) || t.store.render(), t.ui.updateMapClasses();
20
+ break;
21
+ }
22
+ }
23
+ };
24
+ return e.start.call(r), { render: e.render, stop: function() {
25
+ e.stop && e.stop();
26
+ }, trash: function() {
27
+ e.trash && (e.trash(), t.store.render());
28
+ }, combineFeatures: function() {
29
+ e.combineFeatures && e.combineFeatures();
30
+ }, uncombineFeatures: function() {
31
+ e.uncombineFeatures && e.uncombineFeatures();
32
+ }, drag: function(i) {
33
+ o("drag", i);
34
+ }, click: function(i) {
35
+ o("click", i);
36
+ }, mousemove: function(i) {
37
+ o("mousemove", i);
38
+ }, mousedown: function(i) {
39
+ o("mousedown", i);
40
+ }, mouseup: function(i) {
41
+ o("mouseup", i);
42
+ }, mouseout: function(i) {
43
+ o("mouseout", i);
44
+ }, keydown: function(i) {
45
+ o("keydown", i);
46
+ }, keyup: function(i) {
47
+ o("keyup", i);
48
+ }, touchstart: function(i) {
49
+ o("touchstart", i);
50
+ }, touchmove: function(i) {
51
+ o("touchmove", i);
52
+ }, touchend: function(i) {
53
+ o("touchend", i);
54
+ }, tap: function(i) {
55
+ o("tap", i);
56
+ } };
57
+ };
58
+ function de(e) {
59
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
60
+ }
61
+ function Qn(e) {
62
+ if (e.__esModule) return e;
63
+ var t = e.default;
64
+ if (typeof t == "function") {
65
+ var n = function r() {
66
+ if (this instanceof r) {
67
+ var o = [null];
68
+ o.push.apply(o, arguments);
69
+ var i = Function.bind.apply(t, o);
70
+ return new i();
71
+ }
72
+ return t.apply(this, arguments);
73
+ };
74
+ n.prototype = t.prototype;
75
+ } else n = {};
76
+ return Object.defineProperty(n, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
77
+ var o = Object.getOwnPropertyDescriptor(e, r);
78
+ Object.defineProperty(n, r, o.get ? o : { enumerable: !0, get: function() {
79
+ return e[r];
80
+ } });
81
+ }), n;
82
+ }
83
+ var Tt = {}, er = { RADIUS: 6378137 }, Zt = er;
84
+ function Wt(e) {
85
+ var t = 0;
86
+ if (e && e.length > 0) {
87
+ t += Math.abs(Ct(e[0]));
88
+ for (var n = 1; n < e.length; n++) t -= Math.abs(Ct(e[n]));
89
+ }
90
+ return t;
91
+ }
92
+ function Ct(e) {
93
+ var t, n, r, o, i, a, l = 0, d = e.length;
94
+ if (d > 2) {
95
+ for (a = 0; a < d; a++) a === d - 2 ? (r = d - 2, o = d - 1, i = 0) : a === d - 1 ? (r = d - 1, o = 0, i = 1) : (r = a, o = a + 1, i = a + 2), t = e[r], n = e[o], l += (Ot(e[i][0]) - Ot(t[0])) * Math.sin(Ot(n[1]));
96
+ l = l * Zt.RADIUS * Zt.RADIUS / 2;
97
+ }
98
+ return l;
99
+ }
100
+ function Ot(e) {
101
+ return e * Math.PI / 180;
102
+ }
103
+ Tt.geometry = function e(t) {
104
+ var n, r = 0;
105
+ switch (t.type) {
106
+ case "Polygon":
107
+ return Wt(t.coordinates);
108
+ case "MultiPolygon":
109
+ for (n = 0; n < t.coordinates.length; n++) r += Wt(t.coordinates[n]);
110
+ return r;
111
+ case "Point":
112
+ case "MultiPoint":
113
+ case "LineString":
114
+ case "MultiLineString":
115
+ return 0;
116
+ case "GeometryCollection":
117
+ for (n = 0; n < t.geometries.length; n++) r += e(t.geometries[n]);
118
+ return r;
119
+ }
120
+ }, Tt.ring = Ct;
121
+ var q = { 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" }, X = { HOT: "mapbox-gl-draw-hot", COLD: "mapbox-gl-draw-cold" }, N = { ADD: "add", MOVE: "move", DRAG: "drag", POINTER: "pointer", NONE: "none" }, Y = { POLYGON: "polygon", LINE: "line_string", POINT: "point" }, m = { 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" }, T = { DRAW_LINE_STRING: "draw_line_string", DRAW_POLYGON: "draw_polygon", DRAW_POINT: "draw_point", SIMPLE_SELECT: "simple_select", DIRECT_SELECT: "direct_select", STATIC: "static" }, H = { 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" }, St = { MOVE: "move", CHANGE_COORDINATES: "change_coordinates" }, B = { FEATURE: "feature", MIDPOINT: "midpoint", VERTEX: "vertex" }, j = { ACTIVE: "true", INACTIVE: "false" }, Kt = ["scrollZoom", "boxZoom", "dragRotate", "dragPan", "keyboard", "doubleClickZoom", "touchZoomRotate"], It = -85, tr = Object.freeze({ __proto__: null, classes: q, sources: X, cursors: N, types: Y, geojsonTypes: m, modes: T, events: H, updateActions: St, meta: B, activeStates: j, interactions: Kt, LAT_MIN: -90, LAT_RENDERED_MIN: It, LAT_MAX: 90, LAT_RENDERED_MAX: 85, LNG_MIN: -270, LNG_MAX: 270 }), Qt = { Point: 0, LineString: 1, MultiLineString: 1, Polygon: 2 };
122
+ function nr(e, t) {
123
+ var n = Qt[e.geometry.type] - Qt[t.geometry.type];
124
+ return n === 0 && e.geometry.type === m.POLYGON ? e.area - t.area : n;
125
+ }
126
+ function en(e) {
127
+ return e.map(function(t) {
128
+ return t.geometry.type === m.POLYGON && (t.area = Tt.geometry({ type: m.FEATURE, property: {}, geometry: t.geometry })), t;
129
+ }).sort(nr).map(function(t) {
130
+ return delete t.area, t;
131
+ });
132
+ }
133
+ function tn(e, t) {
134
+ return t === void 0 && (t = 0), [[e.point.x - t, e.point.y - t], [e.point.x + t, e.point.y + t]];
135
+ }
136
+ function Z(e) {
137
+ if (this._items = {}, this._nums = {}, this._length = e ? e.length : 0, e) for (var 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);
138
+ }
139
+ Z.prototype.add = function(e) {
140
+ return this.has(e) || (this._length++, typeof e == "string" ? this._items[e] = this._length : this._nums[e] = this._length), this;
141
+ }, Z.prototype.delete = function(e) {
142
+ return this.has(e) === !1 || (this._length--, delete this._items[e], delete this._nums[e]), this;
143
+ }, Z.prototype.has = function(e) {
144
+ return (typeof e == "string" || typeof e == "number") && (this._items[e] !== void 0 || this._nums[e] !== void 0);
145
+ }, Z.prototype.values = function() {
146
+ var e = this, t = [];
147
+ return Object.keys(this._items).forEach(function(n) {
148
+ t.push({ k: n, v: e._items[n] });
149
+ }), Object.keys(this._nums).forEach(function(n) {
150
+ t.push({ k: JSON.parse(n), v: e._nums[n] });
151
+ }), t.sort(function(n, r) {
152
+ return n.v - r.v;
153
+ }).map(function(n) {
154
+ return n.k;
155
+ });
156
+ }, Z.prototype.clear = function() {
157
+ return this._length = 0, this._items = {}, this._nums = {}, this;
158
+ };
159
+ var rr = [B.FEATURE, B.MIDPOINT, B.VERTEX], xe = { click: function(e, t, n) {
160
+ return nn(e, t, n, n.options.clickBuffer);
161
+ }, touch: function(e, t, n) {
162
+ return nn(e, t, n, n.options.touchBuffer);
163
+ } };
164
+ function nn(e, t, n, r) {
165
+ if (n.map === null) return [];
166
+ var o = e ? tn(e, r) : t, i = {};
167
+ n.options.styles && (i.layers = n.options.styles.map(function(h) {
168
+ return h.id;
169
+ }).filter(function(h) {
170
+ return n.map.getLayer(h) != null;
171
+ }));
172
+ var a = n.map.queryRenderedFeatures(o, i).filter(function(h) {
173
+ return rr.indexOf(h.properties.meta) !== -1;
174
+ }), l = new Z(), d = [];
175
+ return a.forEach(function(h) {
176
+ var g = h.properties.id;
177
+ l.has(g) || (l.add(g), d.push(h));
178
+ }), en(d);
179
+ }
180
+ function ze(e, t) {
181
+ var n = xe.click(e, null, t), r = { mouse: N.NONE };
182
+ return n[0] && (r.mouse = n[0].properties.active === j.ACTIVE ? N.MOVE : N.POINTER, r.feature = n[0].properties.meta), t.events.currentModeName().indexOf("draw") !== -1 && (r.mouse = N.ADD), t.ui.queueMapClasses(r), t.ui.updateMapClasses(), n[0];
183
+ }
184
+ function xt(e, t) {
185
+ var n = e.x - t.x, r = e.y - t.y;
186
+ return Math.sqrt(n * n + r * r);
187
+ }
188
+ function Mt(e, t, n) {
189
+ n === void 0 && (n = {});
190
+ var r = n.fineTolerance != null ? n.fineTolerance : 4, o = n.grossTolerance != null ? n.grossTolerance : 12, i = n.interval != null ? n.interval : 500;
191
+ e.point = e.point || t.point, e.time = e.time || t.time;
192
+ var a = xt(e.point, t.point);
193
+ return a < r || a < o && t.time - e.time < i;
194
+ }
195
+ function Lt(e, t, n) {
196
+ n === void 0 && (n = {});
197
+ var r = n.tolerance != null ? n.tolerance : 25, o = n.interval != null ? n.interval : 250;
198
+ return e.point = e.point || t.point, e.time = e.time || t.time, xt(e.point, t.point) < r && t.time - e.time < o;
199
+ }
200
+ var rn = { exports: {} }, Nt = rn.exports = function(e, t) {
201
+ if (t || (t = 16), e === void 0 && (e = 128), e <= 0) return "0";
202
+ for (var n = Math.log(Math.pow(2, e)) / Math.log(t), r = 2; n === 1 / 0; r *= 2) n = Math.log(Math.pow(2, e / r)) / Math.log(t) * r;
203
+ var o = n - Math.floor(n), i = "";
204
+ for (r = 0; r < Math.floor(n); r++)
205
+ i = Math.floor(Math.random() * t).toString(t) + i;
206
+ if (o) {
207
+ var a = Math.pow(t, o);
208
+ i = Math.floor(Math.random() * a).toString(t) + i;
209
+ }
210
+ var l = parseInt(i, t);
211
+ return l !== 1 / 0 && l >= Math.pow(2, e) ? Nt(e, t) : i;
212
+ };
213
+ Nt.rack = function(e, t, n) {
214
+ var r = function(i) {
215
+ var a = 0;
216
+ do {
217
+ if (a++ > 10) {
218
+ if (!n) throw new Error("too many ID collisions, use more bits");
219
+ e += n;
220
+ }
221
+ var l = Nt(e, t);
222
+ } while (Object.hasOwnProperty.call(o, l));
223
+ return o[l] = i, l;
224
+ }, o = r.hats = {};
225
+ return r.get = function(i) {
226
+ return r.hats[i];
227
+ }, r.set = function(i, a) {
228
+ return r.hats[i] = a, r;
229
+ }, r.bits = e || 128, r.base = t || 16, r;
230
+ };
231
+ var Pt = de(rn.exports), G = function(e, t) {
232
+ this.ctx = e, this.properties = t.properties || {}, this.coordinates = t.geometry.coordinates, this.id = t.id || Pt(), this.type = t.geometry.type;
233
+ };
234
+ G.prototype.changed = function() {
235
+ this.ctx.store.featureChanged(this.id);
236
+ }, G.prototype.incomingCoords = function(e) {
237
+ this.setCoordinates(e);
238
+ }, G.prototype.setCoordinates = function(e) {
239
+ this.coordinates = e, this.changed();
240
+ }, G.prototype.getCoordinates = function() {
241
+ return JSON.parse(JSON.stringify(this.coordinates));
242
+ }, G.prototype.setProperty = function(e, t) {
243
+ this.properties[e] = t;
244
+ }, G.prototype.toGeoJSON = function() {
245
+ return JSON.parse(JSON.stringify({ id: this.id, type: m.FEATURE, properties: this.properties, geometry: { coordinates: this.getCoordinates(), type: this.type } }));
246
+ }, G.prototype.internal = function(e) {
247
+ var t = { id: this.id, meta: B.FEATURE, "meta:type": this.type, active: j.INACTIVE, mode: e };
248
+ if (this.ctx.options.userProperties) for (var n in this.properties) t["user_" + n] = this.properties[n];
249
+ return { type: m.FEATURE, properties: t, geometry: { coordinates: this.getCoordinates(), type: this.type } };
250
+ };
251
+ var me = function(e, t) {
252
+ G.call(this, e, t);
253
+ };
254
+ (me.prototype = Object.create(G.prototype)).isValid = function() {
255
+ return typeof this.coordinates[0] == "number" && typeof this.coordinates[1] == "number";
256
+ }, me.prototype.updateCoordinate = function(e, t, n) {
257
+ this.coordinates = arguments.length === 3 ? [t, n] : [e, t], this.changed();
258
+ }, me.prototype.getCoordinate = function() {
259
+ return this.getCoordinates();
260
+ };
261
+ var ie = function(e, t) {
262
+ G.call(this, e, t);
263
+ };
264
+ (ie.prototype = Object.create(G.prototype)).isValid = function() {
265
+ return this.coordinates.length > 1;
266
+ }, ie.prototype.addCoordinate = function(e, t, n) {
267
+ this.changed();
268
+ var r = parseInt(e, 10);
269
+ this.coordinates.splice(r, 0, [t, n]);
270
+ }, ie.prototype.getCoordinate = function(e) {
271
+ var t = parseInt(e, 10);
272
+ return JSON.parse(JSON.stringify(this.coordinates[t]));
273
+ }, ie.prototype.removeCoordinate = function(e) {
274
+ this.changed(), this.coordinates.splice(parseInt(e, 10), 1);
275
+ }, ie.prototype.updateCoordinate = function(e, t, n) {
276
+ var r = parseInt(e, 10);
277
+ this.coordinates[r] = [t, n], this.changed();
278
+ };
279
+ var W = function(e, t) {
280
+ G.call(this, e, t), this.coordinates = this.coordinates.map(function(n) {
281
+ return n.slice(0, -1);
282
+ });
283
+ };
284
+ (W.prototype = Object.create(G.prototype)).isValid = function() {
285
+ return this.coordinates.length !== 0 && this.coordinates.every(function(e) {
286
+ return e.length > 2;
287
+ });
288
+ }, W.prototype.incomingCoords = function(e) {
289
+ this.coordinates = e.map(function(t) {
290
+ return t.slice(0, -1);
291
+ }), this.changed();
292
+ }, W.prototype.setCoordinates = function(e) {
293
+ this.coordinates = e, this.changed();
294
+ }, W.prototype.addCoordinate = function(e, t, n) {
295
+ this.changed();
296
+ var r = e.split(".").map(function(o) {
297
+ return parseInt(o, 10);
298
+ });
299
+ this.coordinates[r[0]].splice(r[1], 0, [t, n]);
300
+ }, W.prototype.removeCoordinate = function(e) {
301
+ this.changed();
302
+ var t = e.split(".").map(function(r) {
303
+ return parseInt(r, 10);
304
+ }), n = this.coordinates[t[0]];
305
+ n && (n.splice(t[1], 1), n.length < 3 && this.coordinates.splice(t[0], 1));
306
+ }, W.prototype.getCoordinate = function(e) {
307
+ var t = e.split(".").map(function(r) {
308
+ return parseInt(r, 10);
309
+ }), n = this.coordinates[t[0]];
310
+ return JSON.parse(JSON.stringify(n[t[1]]));
311
+ }, W.prototype.getCoordinates = function() {
312
+ return this.coordinates.map(function(e) {
313
+ return e.concat([e[0]]);
314
+ });
315
+ }, W.prototype.updateCoordinate = function(e, t, n) {
316
+ this.changed();
317
+ var r = e.split("."), o = parseInt(r[0], 10), i = parseInt(r[1], 10);
318
+ this.coordinates[o] === void 0 && (this.coordinates[o] = []), this.coordinates[o][i] = [t, n];
319
+ };
320
+ var or = { MultiPoint: me, MultiLineString: ie, MultiPolygon: W }, Ye = function(e, t, n, r, o) {
321
+ var i = n.split("."), a = parseInt(i[0], 10), l = i[1] ? i.slice(1).join(".") : null;
322
+ return e[a][t](l, r, o);
323
+ }, $ = function(e, t) {
324
+ if (G.call(this, e, t), delete this.coordinates, this.model = or[t.geometry.type], this.model === void 0) throw new TypeError(t.geometry.type + " is not a valid type");
325
+ this.features = this._coordinatesToFeatures(t.geometry.coordinates);
326
+ };
327
+ function E(e) {
328
+ this.map = e.map, this.drawConfig = JSON.parse(JSON.stringify(e.options || {})), this._ctx = e;
329
+ }
330
+ ($.prototype = Object.create(G.prototype))._coordinatesToFeatures = function(e) {
331
+ var t = this, n = this.model.bind(this);
332
+ return e.map(function(r) {
333
+ return new n(t.ctx, { id: Pt(), type: m.FEATURE, properties: {}, geometry: { coordinates: r, type: t.type.replace("Multi", "") } });
334
+ });
335
+ }, $.prototype.isValid = function() {
336
+ return this.features.every(function(e) {
337
+ return e.isValid();
338
+ });
339
+ }, $.prototype.setCoordinates = function(e) {
340
+ this.features = this._coordinatesToFeatures(e), this.changed();
341
+ }, $.prototype.getCoordinate = function(e) {
342
+ return Ye(this.features, "getCoordinate", e);
343
+ }, $.prototype.getCoordinates = function() {
344
+ return JSON.parse(JSON.stringify(this.features.map(function(e) {
345
+ return e.type === m.POLYGON ? e.getCoordinates() : e.coordinates;
346
+ })));
347
+ }, $.prototype.updateCoordinate = function(e, t, n) {
348
+ Ye(this.features, "updateCoordinate", e, t, n), this.changed();
349
+ }, $.prototype.addCoordinate = function(e, t, n) {
350
+ Ye(this.features, "addCoordinate", e, t, n), this.changed();
351
+ }, $.prototype.removeCoordinate = function(e) {
352
+ Ye(this.features, "removeCoordinate", e), this.changed();
353
+ }, $.prototype.getFeatures = function() {
354
+ return this.features;
355
+ }, E.prototype.setSelected = function(e) {
356
+ return this._ctx.store.setSelected(e);
357
+ }, E.prototype.setSelectedCoordinates = function(e) {
358
+ var t = this;
359
+ this._ctx.store.setSelectedCoordinates(e), e.reduce(function(n, r) {
360
+ return n[r.feature_id] === void 0 && (n[r.feature_id] = !0, t._ctx.store.get(r.feature_id).changed()), n;
361
+ }, {});
362
+ }, E.prototype.getSelected = function() {
363
+ return this._ctx.store.getSelected();
364
+ }, E.prototype.getSelectedIds = function() {
365
+ return this._ctx.store.getSelectedIds();
366
+ }, E.prototype.isSelected = function(e) {
367
+ return this._ctx.store.isSelected(e);
368
+ }, E.prototype.getFeature = function(e) {
369
+ return this._ctx.store.get(e);
370
+ }, E.prototype.select = function(e) {
371
+ return this._ctx.store.select(e);
372
+ }, E.prototype.deselect = function(e) {
373
+ return this._ctx.store.deselect(e);
374
+ }, E.prototype.deleteFeature = function(e, t) {
375
+ return t === void 0 && (t = {}), this._ctx.store.delete(e, t);
376
+ }, E.prototype.addFeature = function(e) {
377
+ return this._ctx.store.add(e);
378
+ }, E.prototype.clearSelectedFeatures = function() {
379
+ return this._ctx.store.clearSelected();
380
+ }, E.prototype.clearSelectedCoordinates = function() {
381
+ return this._ctx.store.clearSelectedCoordinates();
382
+ }, E.prototype.setActionableState = function(e) {
383
+ e === void 0 && (e = {});
384
+ var t = { trash: e.trash || !1, combineFeatures: e.combineFeatures || !1, uncombineFeatures: e.uncombineFeatures || !1 };
385
+ return this._ctx.events.actionable(t);
386
+ }, E.prototype.changeMode = function(e, t, n) {
387
+ return t === void 0 && (t = {}), n === void 0 && (n = {}), this._ctx.events.changeMode(e, t, n);
388
+ }, E.prototype.updateUIClasses = function(e) {
389
+ return this._ctx.ui.queueMapClasses(e);
390
+ }, E.prototype.activateUIButton = function(e) {
391
+ return this._ctx.ui.setActiveButton(e);
392
+ }, E.prototype.featuresAt = function(e, t, n) {
393
+ if (n === void 0 && (n = "click"), n !== "click" && n !== "touch") throw new Error("invalid buffer type");
394
+ return xe[n](e, t, this._ctx);
395
+ }, E.prototype.newFeature = function(e) {
396
+ var t = e.geometry.type;
397
+ return t === m.POINT ? new me(this._ctx, e) : t === m.LINE_STRING ? new ie(this._ctx, e) : t === m.POLYGON ? new W(this._ctx, e) : new $(this._ctx, e);
398
+ }, E.prototype.isInstanceOf = function(e, t) {
399
+ if (e === m.POINT) return t instanceof me;
400
+ if (e === m.LINE_STRING) return t instanceof ie;
401
+ if (e === m.POLYGON) return t instanceof W;
402
+ if (e === "MultiFeature") return t instanceof $;
403
+ throw new Error("Unknown feature class: " + e);
404
+ }, E.prototype.doRender = function(e) {
405
+ return this._ctx.store.featureChanged(e);
406
+ }, E.prototype.onSetup = function() {
407
+ }, E.prototype.onDrag = function() {
408
+ }, E.prototype.onClick = function() {
409
+ }, E.prototype.onMouseMove = function() {
410
+ }, E.prototype.onMouseDown = function() {
411
+ }, E.prototype.onMouseUp = function() {
412
+ }, E.prototype.onMouseOut = function() {
413
+ }, E.prototype.onKeyUp = function() {
414
+ }, E.prototype.onKeyDown = function() {
415
+ }, E.prototype.onTouchStart = function() {
416
+ }, E.prototype.onTouchMove = function() {
417
+ }, E.prototype.onTouchEnd = function() {
418
+ }, E.prototype.onTap = function() {
419
+ }, E.prototype.onStop = function() {
420
+ }, E.prototype.onTrash = function() {
421
+ }, E.prototype.onCombineFeature = function() {
422
+ }, E.prototype.onUncombineFeature = function() {
423
+ }, E.prototype.toDisplayFeatures = function() {
424
+ throw new Error("You must overwrite toDisplayFeatures");
425
+ };
426
+ var on = { drag: "onDrag", click: "onClick", mousemove: "onMouseMove", mousedown: "onMouseDown", mouseup: "onMouseUp", mouseout: "onMouseOut", keyup: "onKeyUp", keydown: "onKeyDown", touchstart: "onTouchStart", touchmove: "onTouchMove", touchend: "onTouchEnd", tap: "onTap" }, ir = Object.keys(on);
427
+ function ar(e) {
428
+ var t = Object.keys(e);
429
+ return function(n, r) {
430
+ r === void 0 && (r = {});
431
+ var o = {}, i = t.reduce(function(a, l) {
432
+ return a[l] = e[l], a;
433
+ }, new E(n));
434
+ return { start: function() {
435
+ var a = this;
436
+ o = i.onSetup(r), ir.forEach(function(l) {
437
+ var d, h = on[l], g = function() {
438
+ return !1;
439
+ };
440
+ e[h] && (g = function() {
441
+ return !0;
442
+ }), a.on(l, g, (d = h, function(p) {
443
+ return i[d](o, p);
444
+ }));
445
+ });
446
+ }, stop: function() {
447
+ i.onStop(o);
448
+ }, trash: function() {
449
+ i.onTrash(o);
450
+ }, combineFeatures: function() {
451
+ i.onCombineFeatures(o);
452
+ }, uncombineFeatures: function() {
453
+ i.onUncombineFeatures(o);
454
+ }, render: function(a, l) {
455
+ i.toDisplayFeatures(o, a, l);
456
+ } };
457
+ };
458
+ }
459
+ function Re(e) {
460
+ return [].concat(e).filter(function(t) {
461
+ return t !== void 0;
462
+ });
463
+ }
464
+ function sr() {
465
+ var e = this;
466
+ if (!(e.ctx.map && e.ctx.map.getSource(X.HOT) !== void 0)) return d();
467
+ var t = e.ctx.events.currentModeName();
468
+ e.ctx.ui.queueMapClasses({ mode: t });
469
+ var n = [], r = [];
470
+ e.isDirty ? r = e.getAllIds() : (n = e.getChangedIds().filter(function(h) {
471
+ return e.get(h) !== void 0;
472
+ }), r = e.sources.hot.filter(function(h) {
473
+ return h.properties.id && n.indexOf(h.properties.id) === -1 && e.get(h.properties.id) !== void 0;
474
+ }).map(function(h) {
475
+ return h.properties.id;
476
+ })), e.sources.hot = [];
477
+ var o = e.sources.cold.length;
478
+ e.sources.cold = e.isDirty ? [] : e.sources.cold.filter(function(h) {
479
+ var g = h.properties.id || h.properties.parent;
480
+ return n.indexOf(g) === -1;
481
+ });
482
+ var i = o !== e.sources.cold.length || r.length > 0;
483
+ function a(h, g) {
484
+ var p = e.get(h).internal(t);
485
+ e.ctx.events.currentModeRender(p, function(_) {
486
+ e.sources[g].push(_);
487
+ });
488
+ }
489
+ if (n.forEach(function(h) {
490
+ return a(h, "hot");
491
+ }), r.forEach(function(h) {
492
+ return a(h, "cold");
493
+ }), i && e.ctx.map.getSource(X.COLD).setData({ type: m.FEATURE_COLLECTION, features: e.sources.cold }), e.ctx.map.getSource(X.HOT).setData({ type: m.FEATURE_COLLECTION, features: e.sources.hot }), e._emitSelectionChange && (e.ctx.map.fire(H.SELECTION_CHANGE, { features: e.getSelected().map(function(h) {
494
+ return h.toGeoJSON();
495
+ }), points: e.getSelectedCoordinates().map(function(h) {
496
+ return { type: m.FEATURE, properties: {}, geometry: { type: m.POINT, coordinates: h.coordinates } };
497
+ }) }), e._emitSelectionChange = !1), e._deletedFeaturesToEmit.length) {
498
+ var l = e._deletedFeaturesToEmit.map(function(h) {
499
+ return h.toGeoJSON();
500
+ });
501
+ e._deletedFeaturesToEmit = [], e.ctx.map.fire(H.DELETE, { features: l });
502
+ }
503
+ function d() {
504
+ e.isDirty = !1, e.clearChangedIds();
505
+ }
506
+ d(), e.ctx.map.fire(H.RENDER, {});
507
+ }
508
+ function x(e) {
509
+ var t, n = this;
510
+ this._features = {}, this._featureIds = new Z(), this._selectedFeatureIds = new Z(), this._selectedCoordinates = [], this._changedFeatureIds = new Z(), this._deletedFeaturesToEmit = [], this._emitSelectionChange = !1, this._mapInitialConfig = {}, this.ctx = e, this.sources = { hot: [], cold: [] }, this.render = function() {
511
+ t || (t = requestAnimationFrame(function() {
512
+ t = null, sr.call(n);
513
+ }));
514
+ }, this.isDirty = !1;
515
+ }
516
+ function an(e, t) {
517
+ var n = e._selectedCoordinates.filter(function(r) {
518
+ return e._selectedFeatureIds.has(r.feature_id);
519
+ });
520
+ e._selectedCoordinates.length === n.length || t.silent || (e._emitSelectionChange = !0), e._selectedCoordinates = n;
521
+ }
522
+ x.prototype.createRenderBatch = function() {
523
+ var e = this, t = this.render, n = 0;
524
+ return this.render = function() {
525
+ n++;
526
+ }, function() {
527
+ e.render = t, n > 0 && e.render();
528
+ };
529
+ }, x.prototype.setDirty = function() {
530
+ return this.isDirty = !0, this;
531
+ }, x.prototype.featureChanged = function(e) {
532
+ return this._changedFeatureIds.add(e), this;
533
+ }, x.prototype.getChangedIds = function() {
534
+ return this._changedFeatureIds.values();
535
+ }, x.prototype.clearChangedIds = function() {
536
+ return this._changedFeatureIds.clear(), this;
537
+ }, x.prototype.getAllIds = function() {
538
+ return this._featureIds.values();
539
+ }, x.prototype.add = function(e) {
540
+ return this.featureChanged(e.id), this._features[e.id] = e, this._featureIds.add(e.id), this;
541
+ }, x.prototype.delete = function(e, t) {
542
+ var n = this;
543
+ return t === void 0 && (t = {}), Re(e).forEach(function(r) {
544
+ n._featureIds.has(r) && (n._featureIds.delete(r), n._selectedFeatureIds.delete(r), t.silent || n._deletedFeaturesToEmit.indexOf(n._features[r]) === -1 && n._deletedFeaturesToEmit.push(n._features[r]), delete n._features[r], n.isDirty = !0);
545
+ }), an(this, t), this;
546
+ }, x.prototype.get = function(e) {
547
+ return this._features[e];
548
+ }, x.prototype.getAll = function() {
549
+ var e = this;
550
+ return Object.keys(this._features).map(function(t) {
551
+ return e._features[t];
552
+ });
553
+ }, x.prototype.select = function(e, t) {
554
+ var n = this;
555
+ return t === void 0 && (t = {}), Re(e).forEach(function(r) {
556
+ n._selectedFeatureIds.has(r) || (n._selectedFeatureIds.add(r), n._changedFeatureIds.add(r), t.silent || (n._emitSelectionChange = !0));
557
+ }), this;
558
+ }, x.prototype.deselect = function(e, t) {
559
+ var n = this;
560
+ return t === void 0 && (t = {}), Re(e).forEach(function(r) {
561
+ n._selectedFeatureIds.has(r) && (n._selectedFeatureIds.delete(r), n._changedFeatureIds.add(r), t.silent || (n._emitSelectionChange = !0));
562
+ }), an(this, t), this;
563
+ }, x.prototype.clearSelected = function(e) {
564
+ return e === void 0 && (e = {}), this.deselect(this._selectedFeatureIds.values(), { silent: e.silent }), this;
565
+ }, x.prototype.setSelected = function(e, t) {
566
+ var n = this;
567
+ return t === void 0 && (t = {}), e = Re(e), this.deselect(this._selectedFeatureIds.values().filter(function(r) {
568
+ return e.indexOf(r) === -1;
569
+ }), { silent: t.silent }), this.select(e.filter(function(r) {
570
+ return !n._selectedFeatureIds.has(r);
571
+ }), { silent: t.silent }), this;
572
+ }, x.prototype.setSelectedCoordinates = function(e) {
573
+ return this._selectedCoordinates = e, this._emitSelectionChange = !0, this;
574
+ }, x.prototype.clearSelectedCoordinates = function() {
575
+ return this._selectedCoordinates = [], this._emitSelectionChange = !0, this;
576
+ }, x.prototype.getSelectedIds = function() {
577
+ return this._selectedFeatureIds.values();
578
+ }, x.prototype.getSelected = function() {
579
+ var e = this;
580
+ return this._selectedFeatureIds.values().map(function(t) {
581
+ return e.get(t);
582
+ });
583
+ }, x.prototype.getSelectedCoordinates = function() {
584
+ var e = this;
585
+ return this._selectedCoordinates.map(function(t) {
586
+ return { coordinates: e.get(t.feature_id).getCoordinate(t.coord_path) };
587
+ });
588
+ }, x.prototype.isSelected = function(e) {
589
+ return this._selectedFeatureIds.has(e);
590
+ }, x.prototype.setFeatureProperty = function(e, t, n) {
591
+ this.get(e).setProperty(t, n), this.featureChanged(e);
592
+ }, x.prototype.storeMapConfig = function() {
593
+ var e = this;
594
+ Kt.forEach(function(t) {
595
+ e.ctx.map[t] && (e._mapInitialConfig[t] = e.ctx.map[t].isEnabled());
596
+ });
597
+ }, x.prototype.restoreMapConfig = function() {
598
+ var e = this;
599
+ Object.keys(this._mapInitialConfig).forEach(function(t) {
600
+ e._mapInitialConfig[t] ? e.ctx.map[t].enable() : e.ctx.map[t].disable();
601
+ });
602
+ }, x.prototype.getInitialConfigValue = function(e) {
603
+ return this._mapInitialConfig[e] === void 0 || this._mapInitialConfig[e];
604
+ };
605
+ var ur = function() {
606
+ for (var e = arguments, t = {}, n = 0; n < arguments.length; n++) {
607
+ var r = e[n];
608
+ for (var o in r) cr.call(r, o) && (t[o] = r[o]);
609
+ }
610
+ return t;
611
+ }, cr = Object.prototype.hasOwnProperty, pe = de(ur), lr = ["mode", "feature", "mouse"];
612
+ function dr(e) {
613
+ var t = null, n = null, r = { onRemove: function() {
614
+ return e.map.off("load", r.connect), clearInterval(n), r.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;
615
+ }, connect: function() {
616
+ e.map.off("load", r.connect), clearInterval(n), r.addLayers(), e.store.storeMapConfig(), e.events.addEventListeners();
617
+ }, onAdd: function(o) {
618
+ var i = o.fire;
619
+ return o.fire = function(a, l) {
620
+ var d = arguments;
621
+ return i.length === 1 && arguments.length !== 1 && (d = [pe({}, { type: a }, l)]), i.apply(o, d);
622
+ }, e.map = o, e.events = function(a) {
623
+ var l = Object.keys(a.options.modes).reduce(function(c, y) {
624
+ return c[y] = ar(a.options.modes[y]), c;
625
+ }, {}), d = {}, h = {}, g = {}, p = null, _ = null;
626
+ g.drag = function(c, y) {
627
+ y({ point: c.point, time: (/* @__PURE__ */ new Date()).getTime() }) ? (a.ui.queueMapClasses({ mouse: N.DRAG }), _.drag(c)) : c.originalEvent.stopPropagation();
628
+ }, g.mousedrag = function(c) {
629
+ g.drag(c, function(y) {
630
+ return !Mt(d, y);
631
+ });
632
+ }, g.touchdrag = function(c) {
633
+ g.drag(c, function(y) {
634
+ return !Lt(h, y);
635
+ });
636
+ }, g.mousemove = function(c) {
637
+ if ((c.originalEvent.buttons !== void 0 ? c.originalEvent.buttons : c.originalEvent.which) === 1) return g.mousedrag(c);
638
+ var y = ze(c, a);
639
+ c.featureTarget = y, _.mousemove(c);
640
+ }, g.mousedown = function(c) {
641
+ d = { time: (/* @__PURE__ */ new Date()).getTime(), point: c.point };
642
+ var y = ze(c, a);
643
+ c.featureTarget = y, _.mousedown(c);
644
+ }, g.mouseup = function(c) {
645
+ var y = ze(c, a);
646
+ c.featureTarget = y, Mt(d, { point: c.point, time: (/* @__PURE__ */ new Date()).getTime() }) ? _.click(c) : _.mouseup(c);
647
+ }, g.mouseout = function(c) {
648
+ _.mouseout(c);
649
+ }, g.touchstart = function(c) {
650
+ if (a.options.touchEnabled) {
651
+ h = { time: (/* @__PURE__ */ new Date()).getTime(), point: c.point };
652
+ var y = xe.touch(c, null, a)[0];
653
+ c.featureTarget = y, _.touchstart(c);
654
+ }
655
+ }, g.touchmove = function(c) {
656
+ if (a.options.touchEnabled) return _.touchmove(c), g.touchdrag(c);
657
+ }, g.touchend = function(c) {
658
+ if (c.originalEvent.preventDefault(), a.options.touchEnabled) {
659
+ var y = xe.touch(c, null, a)[0];
660
+ c.featureTarget = y, Lt(h, { time: (/* @__PURE__ */ new Date()).getTime(), point: c.point }) ? _.tap(c) : _.touchend(c);
661
+ }
662
+ };
663
+ var P = function(c) {
664
+ return !(c === 8 || c === 46 || c >= 48 && c <= 57);
665
+ };
666
+ function b(c, y, O) {
667
+ O === void 0 && (O = {}), _.stop();
668
+ var V = l[c];
669
+ if (V === void 0) throw new Error(c + " is not valid");
670
+ p = c;
671
+ var F = V(a, y);
672
+ _ = Je(F, a), O.silent || a.map.fire(H.MODE_CHANGE, { mode: c }), a.store.setDirty(), a.store.render();
673
+ }
674
+ g.keydown = function(c) {
675
+ (c.srcElement || c.target).classList.contains("mapboxgl-canvas") && (c.keyCode !== 8 && c.keyCode !== 46 || !a.options.controls.trash ? P(c.keyCode) ? _.keydown(c) : c.keyCode === 49 && a.options.controls.point ? b(T.DRAW_POINT) : c.keyCode === 50 && a.options.controls.line_string ? b(T.DRAW_LINE_STRING) : c.keyCode === 51 && a.options.controls.polygon && b(T.DRAW_POLYGON) : (c.preventDefault(), _.trash()));
676
+ }, g.keyup = function(c) {
677
+ P(c.keyCode) && _.keyup(c);
678
+ }, g.zoomend = function() {
679
+ a.store.changeZoom();
680
+ }, g.data = function(c) {
681
+ if (c.dataType === "style") {
682
+ var y = a.setup, O = a.map, V = a.options, F = a.store;
683
+ V.styles.some(function(jt) {
684
+ return O.getLayer(jt.id);
685
+ }) || (y.addLayers(), F.setDirty(), F.render());
686
+ }
687
+ };
688
+ var w = { trash: !1, combineFeatures: !1, uncombineFeatures: !1 };
689
+ return { start: function() {
690
+ p = a.options.defaultMode, _ = Je(l[p](a), a);
691
+ }, changeMode: b, actionable: function(c) {
692
+ var y = !1;
693
+ Object.keys(c).forEach(function(O) {
694
+ if (w[O] === void 0) throw new Error("Invalid action type");
695
+ w[O] !== c[O] && (y = !0), w[O] = c[O];
696
+ }), y && a.map.fire(H.ACTIONABLE, { actions: w });
697
+ }, currentModeName: function() {
698
+ return p;
699
+ }, currentModeRender: function(c, y) {
700
+ return _.render(c, y);
701
+ }, fire: function(c, y) {
702
+ g[c] && g[c](y);
703
+ }, addEventListeners: function() {
704
+ a.map.on("mousemove", g.mousemove), a.map.on("mousedown", g.mousedown), a.map.on("mouseup", g.mouseup), a.map.on("data", g.data), a.map.on("touchmove", g.touchmove), a.map.on("touchstart", g.touchstart), a.map.on("touchend", g.touchend), a.container.addEventListener("mouseout", g.mouseout), a.options.keybindings && (a.container.addEventListener("keydown", g.keydown), a.container.addEventListener("keyup", g.keyup));
705
+ }, removeEventListeners: function() {
706
+ a.map.off("mousemove", g.mousemove), a.map.off("mousedown", g.mousedown), a.map.off("mouseup", g.mouseup), a.map.off("data", g.data), a.map.off("touchmove", g.touchmove), a.map.off("touchstart", g.touchstart), a.map.off("touchend", g.touchend), a.container.removeEventListener("mouseout", g.mouseout), a.options.keybindings && (a.container.removeEventListener("keydown", g.keydown), a.container.removeEventListener("keyup", g.keyup));
707
+ }, trash: function(c) {
708
+ _.trash(c);
709
+ }, combineFeatures: function() {
710
+ _.combineFeatures();
711
+ }, uncombineFeatures: function() {
712
+ _.uncombineFeatures();
713
+ }, getMode: function() {
714
+ return p;
715
+ } };
716
+ }(e), e.ui = /* @__PURE__ */ function(a) {
717
+ var l = {}, d = null, h = { mode: null, feature: null, mouse: null }, g = { mode: null, feature: null, mouse: null };
718
+ function p(c) {
719
+ g = pe(g, c);
720
+ }
721
+ function _() {
722
+ var c, y;
723
+ if (a.container) {
724
+ var O = [], V = [];
725
+ lr.forEach(function(F) {
726
+ g[F] !== h[F] && (O.push(F + "-" + h[F]), g[F] !== null && V.push(F + "-" + g[F]));
727
+ }), O.length > 0 && (c = a.container.classList).remove.apply(c, O), V.length > 0 && (y = a.container.classList).add.apply(y, V), h = pe(h, g);
728
+ }
729
+ }
730
+ function P(c, y) {
731
+ y === void 0 && (y = {});
732
+ var O = document.createElement("button");
733
+ return O.className = q.CONTROL_BUTTON + " " + y.className, O.setAttribute("title", y.title), y.container.appendChild(O), O.addEventListener("click", function(V) {
734
+ if (V.preventDefault(), V.stopPropagation(), V.target === d) return b(), void y.onDeactivate();
735
+ w(c), y.onActivate();
736
+ }, !0), O;
737
+ }
738
+ function b() {
739
+ d && (d.classList.remove(q.ACTIVE_BUTTON), d = null);
740
+ }
741
+ function w(c) {
742
+ b();
743
+ var y = l[c];
744
+ y && y && c !== "trash" && (y.classList.add(q.ACTIVE_BUTTON), d = y);
745
+ }
746
+ return { setActiveButton: w, queueMapClasses: p, updateMapClasses: _, clearMapClasses: function() {
747
+ p({ mode: null, feature: null, mouse: null }), _();
748
+ }, addButtons: function() {
749
+ var c = a.options.controls, y = document.createElement("div");
750
+ return y.className = q.CONTROL_GROUP + " " + q.CONTROL_BASE, c && (c[Y.LINE] && (l[Y.LINE] = P(Y.LINE, { container: y, className: q.CONTROL_BUTTON_LINE, title: "LineString tool " + (a.options.keybindings ? "(l)" : ""), onActivate: function() {
751
+ return a.events.changeMode(T.DRAW_LINE_STRING);
752
+ }, onDeactivate: function() {
753
+ return a.events.trash();
754
+ } })), c[Y.POLYGON] && (l[Y.POLYGON] = P(Y.POLYGON, { container: y, className: q.CONTROL_BUTTON_POLYGON, title: "Polygon tool " + (a.options.keybindings ? "(p)" : ""), onActivate: function() {
755
+ return a.events.changeMode(T.DRAW_POLYGON);
756
+ }, onDeactivate: function() {
757
+ return a.events.trash();
758
+ } })), c[Y.POINT] && (l[Y.POINT] = P(Y.POINT, { container: y, className: q.CONTROL_BUTTON_POINT, title: "Marker tool " + (a.options.keybindings ? "(m)" : ""), onActivate: function() {
759
+ return a.events.changeMode(T.DRAW_POINT);
760
+ }, onDeactivate: function() {
761
+ return a.events.trash();
762
+ } })), c.trash && (l.trash = P("trash", { container: y, className: q.CONTROL_BUTTON_TRASH, title: "Delete", onActivate: function() {
763
+ a.events.trash();
764
+ } })), c.combine_features && (l.combine_features = P("combineFeatures", { container: y, className: q.CONTROL_BUTTON_COMBINE_FEATURES, title: "Combine", onActivate: function() {
765
+ a.events.combineFeatures();
766
+ } })), c.uncombine_features && (l.uncombine_features = P("uncombineFeatures", { container: y, className: q.CONTROL_BUTTON_UNCOMBINE_FEATURES, title: "Uncombine", onActivate: function() {
767
+ a.events.uncombineFeatures();
768
+ } }))), y;
769
+ }, removeButtons: function() {
770
+ Object.keys(l).forEach(function(c) {
771
+ var y = l[c];
772
+ y.parentNode && y.parentNode.removeChild(y), delete l[c];
773
+ });
774
+ } };
775
+ }(e), e.container = o.getContainer(), e.store = new x(e), t = e.ui.addButtons(), e.options.boxSelect && (e.boxZoomInitial = o.boxZoom.isEnabled(), o.boxZoom.disable(), o.dragPan.disable(), o.dragPan.enable()), o.loaded() ? r.connect() : (o.on("load", r.connect), n = setInterval(function() {
776
+ o.loaded() && r.connect();
777
+ }, 16)), e.events.start(), t;
778
+ }, addLayers: function() {
779
+ e.map.addSource(X.COLD, { data: { type: m.FEATURE_COLLECTION, features: [] }, type: "geojson" }), e.map.addSource(X.HOT, { data: { type: m.FEATURE_COLLECTION, features: [] }, type: "geojson" }), e.options.styles.forEach(function(o) {
780
+ e.map.addLayer(o);
781
+ }), e.store.setDirty(!0), e.store.render();
782
+ }, removeLayers: function() {
783
+ e.options.styles.forEach(function(o) {
784
+ e.map.getLayer(o.id) && e.map.removeLayer(o.id);
785
+ }), e.map.getSource(X.COLD) && e.map.removeSource(X.COLD), e.map.getSource(X.HOT) && e.map.removeSource(X.HOT);
786
+ } };
787
+ return e.setup = r, r;
788
+ }
789
+ var sn = [{ id: "gl-draw-polygon-fill-inactive", type: "fill", filter: ["all", ["==", "active", "false"], ["==", "$type", "Polygon"], ["!=", "mode", "static"]], paint: { "fill-color": "#3bb2d0", "fill-outline-color": "#3bb2d0", "fill-opacity": 0.1 } }, { id: "gl-draw-polygon-fill-active", type: "fill", filter: ["all", ["==", "active", "true"], ["==", "$type", "Polygon"]], paint: { "fill-color": "#fbb03b", "fill-outline-color": "#fbb03b", "fill-opacity": 0.1 } }, { id: "gl-draw-polygon-midpoint", type: "circle", filter: ["all", ["==", "$type", "Point"], ["==", "meta", "midpoint"]], paint: { "circle-radius": 3, "circle-color": "#fbb03b" } }, { id: "gl-draw-polygon-stroke-inactive", type: "line", filter: ["all", ["==", "active", "false"], ["==", "$type", "Polygon"], ["!=", "mode", "static"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#3bb2d0", "line-width": 2 } }, { id: "gl-draw-polygon-stroke-active", type: "line", filter: ["all", ["==", "active", "true"], ["==", "$type", "Polygon"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#fbb03b", "line-dasharray": [0.2, 2], "line-width": 2 } }, { id: "gl-draw-line-inactive", type: "line", filter: ["all", ["==", "active", "false"], ["==", "$type", "LineString"], ["!=", "mode", "static"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#3bb2d0", "line-width": 2 } }, { id: "gl-draw-line-active", type: "line", filter: ["all", ["==", "$type", "LineString"], ["==", "active", "true"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#fbb03b", "line-dasharray": [0.2, 2], "line-width": 2 } }, { id: "gl-draw-polygon-and-line-vertex-stroke-inactive", type: "circle", filter: ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"], ["!=", "mode", "static"]], paint: { "circle-radius": 5, "circle-color": "#fff" } }, { id: "gl-draw-polygon-and-line-vertex-inactive", type: "circle", filter: ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"], ["!=", "mode", "static"]], paint: { "circle-radius": 3, "circle-color": "#fbb03b" } }, { id: "gl-draw-point-point-stroke-inactive", type: "circle", filter: ["all", ["==", "active", "false"], ["==", "$type", "Point"], ["==", "meta", "feature"], ["!=", "mode", "static"]], paint: { "circle-radius": 5, "circle-opacity": 1, "circle-color": "#fff" } }, { id: "gl-draw-point-inactive", type: "circle", filter: ["all", ["==", "active", "false"], ["==", "$type", "Point"], ["==", "meta", "feature"], ["!=", "mode", "static"]], paint: { "circle-radius": 3, "circle-color": "#3bb2d0" } }, { id: "gl-draw-point-stroke-active", type: "circle", filter: ["all", ["==", "$type", "Point"], ["==", "active", "true"], ["!=", "meta", "midpoint"]], paint: { "circle-radius": 7, "circle-color": "#fff" } }, { id: "gl-draw-point-active", type: "circle", filter: ["all", ["==", "$type", "Point"], ["!=", "meta", "midpoint"], ["==", "active", "true"]], paint: { "circle-radius": 5, "circle-color": "#fbb03b" } }, { id: "gl-draw-polygon-fill-static", type: "fill", filter: ["all", ["==", "mode", "static"], ["==", "$type", "Polygon"]], paint: { "fill-color": "#404040", "fill-outline-color": "#404040", "fill-opacity": 0.1 } }, { id: "gl-draw-polygon-stroke-static", type: "line", filter: ["all", ["==", "mode", "static"], ["==", "$type", "Polygon"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#404040", "line-width": 2 } }, { id: "gl-draw-line-static", type: "line", filter: ["all", ["==", "mode", "static"], ["==", "$type", "LineString"]], layout: { "line-cap": "round", "line-join": "round" }, paint: { "line-color": "#404040", "line-width": 2 } }, { id: "gl-draw-point-static", type: "circle", filter: ["all", ["==", "mode", "static"], ["==", "$type", "Point"]], paint: { "circle-radius": 5, "circle-color": "#404040" } }];
790
+ function $e(e) {
791
+ return function(t) {
792
+ var n = t.featureTarget;
793
+ return !!n && !!n.properties && n.properties.meta === e;
794
+ };
795
+ }
796
+ function un(e) {
797
+ return !!e.originalEvent && !!e.originalEvent.shiftKey && e.originalEvent.button === 0;
798
+ }
799
+ function _e(e) {
800
+ return !!e.featureTarget && !!e.featureTarget.properties && e.featureTarget.properties.active === j.ACTIVE && e.featureTarget.properties.meta === B.FEATURE;
801
+ }
802
+ function At(e) {
803
+ return !!e.featureTarget && !!e.featureTarget.properties && e.featureTarget.properties.active === j.INACTIVE && e.featureTarget.properties.meta === B.FEATURE;
804
+ }
805
+ function qe(e) {
806
+ return e.featureTarget === void 0;
807
+ }
808
+ function wt(e) {
809
+ return !!e.featureTarget && !!e.featureTarget.properties && e.featureTarget.properties.meta === B.FEATURE;
810
+ }
811
+ function De(e) {
812
+ var t = e.featureTarget;
813
+ return !!t && !!t.properties && t.properties.meta === B.VERTEX;
814
+ }
815
+ function He(e) {
816
+ return !!e.originalEvent && e.originalEvent.shiftKey === !0;
817
+ }
818
+ function Xe(e) {
819
+ return e.keyCode === 27;
820
+ }
821
+ function Ze(e) {
822
+ return e.keyCode === 13;
823
+ }
824
+ var pr = Object.freeze({ __proto__: null, isOfMetaType: $e, isShiftMousedown: un, isActiveFeature: _e, isInactiveFeature: At, noTarget: qe, isFeature: wt, isVertex: De, isShiftDown: He, isEscapeKey: Xe, isEnterKey: Ze, isTrue: function() {
825
+ return !0;
826
+ } }), fr = Me;
827
+ function Me(e, t) {
828
+ this.x = e, this.y = t;
829
+ }
830
+ Me.prototype = { clone: function() {
831
+ return new Me(this.x, this.y);
832
+ }, add: function(e) {
833
+ return this.clone()._add(e);
834
+ }, sub: function(e) {
835
+ return this.clone()._sub(e);
836
+ }, multByPoint: function(e) {
837
+ return this.clone()._multByPoint(e);
838
+ }, divByPoint: function(e) {
839
+ return this.clone()._divByPoint(e);
840
+ }, mult: function(e) {
841
+ return this.clone()._mult(e);
842
+ }, div: function(e) {
843
+ return this.clone()._div(e);
844
+ }, rotate: function(e) {
845
+ return this.clone()._rotate(e);
846
+ }, rotateAround: function(e, t) {
847
+ return this.clone()._rotateAround(e, t);
848
+ }, matMult: function(e) {
849
+ return this.clone()._matMult(e);
850
+ }, unit: function() {
851
+ return this.clone()._unit();
852
+ }, perp: function() {
853
+ return this.clone()._perp();
854
+ }, round: function() {
855
+ return this.clone()._round();
856
+ }, mag: function() {
857
+ return Math.sqrt(this.x * this.x + this.y * this.y);
858
+ }, equals: function(e) {
859
+ return this.x === e.x && this.y === e.y;
860
+ }, dist: function(e) {
861
+ return Math.sqrt(this.distSqr(e));
862
+ }, distSqr: function(e) {
863
+ var t = e.x - this.x, n = e.y - this.y;
864
+ return t * t + n * n;
865
+ }, angle: function() {
866
+ return Math.atan2(this.y, this.x);
867
+ }, angleTo: function(e) {
868
+ return Math.atan2(this.y - e.y, this.x - e.x);
869
+ }, angleWith: function(e) {
870
+ return this.angleWithSep(e.x, e.y);
871
+ }, angleWithSep: function(e, t) {
872
+ return Math.atan2(this.x * t - this.y * e, this.x * e + this.y * t);
873
+ }, _matMult: function(e) {
874
+ var t = e[0] * this.x + e[1] * this.y, n = e[2] * this.x + e[3] * this.y;
875
+ return this.x = t, this.y = n, this;
876
+ }, _add: function(e) {
877
+ return this.x += e.x, this.y += e.y, this;
878
+ }, _sub: function(e) {
879
+ return this.x -= e.x, this.y -= e.y, this;
880
+ }, _mult: function(e) {
881
+ return this.x *= e, this.y *= e, this;
882
+ }, _div: function(e) {
883
+ return this.x /= e, this.y /= e, this;
884
+ }, _multByPoint: function(e) {
885
+ return this.x *= e.x, this.y *= e.y, this;
886
+ }, _divByPoint: function(e) {
887
+ return this.x /= e.x, this.y /= e.y, this;
888
+ }, _unit: function() {
889
+ return this._div(this.mag()), this;
890
+ }, _perp: function() {
891
+ var e = this.y;
892
+ return this.y = this.x, this.x = -e, this;
893
+ }, _rotate: function(e) {
894
+ var t = Math.cos(e), n = Math.sin(e), r = t * this.x - n * this.y, o = n * this.x + t * this.y;
895
+ return this.x = r, this.y = o, this;
896
+ }, _rotateAround: function(e, t) {
897
+ var n = Math.cos(e), r = Math.sin(e), o = t.x + n * (this.x - t.x) - r * (this.y - t.y), i = t.y + r * (this.x - t.x) + n * (this.y - t.y);
898
+ return this.x = o, this.y = i, this;
899
+ }, _round: function() {
900
+ return this.x = Math.round(this.x), this.y = Math.round(this.y), this;
901
+ } }, Me.convert = function(e) {
902
+ return e instanceof Me ? e : Array.isArray(e) ? new Me(e[0], e[1]) : e;
903
+ };
904
+ var hr = de(fr);
905
+ function Ft(e, t) {
906
+ var n = t.getBoundingClientRect();
907
+ return new hr(e.clientX - n.left - (t.clientLeft || 0), e.clientY - n.top - (t.clientTop || 0));
908
+ }
909
+ function Le(e, t, n, r) {
910
+ return { type: m.FEATURE, properties: { meta: B.VERTEX, parent: e, coord_path: n, active: r ? j.ACTIVE : j.INACTIVE }, geometry: { type: m.POINT, coordinates: t } };
911
+ }
912
+ function cn(e, t, n) {
913
+ var r = t.geometry.coordinates, o = n.geometry.coordinates;
914
+ if (r[1] > 85 || r[1] < It || o[1] > 85 || o[1] < It) return null;
915
+ var i = { lng: (r[0] + o[0]) / 2, lat: (r[1] + o[1]) / 2 };
916
+ return { type: m.FEATURE, properties: { meta: B.MIDPOINT, parent: e, lng: i.lng, lat: i.lat, coord_path: n.properties.coord_path }, geometry: { type: m.POINT, coordinates: [i.lng, i.lat] } };
917
+ }
918
+ function We(e, t, n) {
919
+ t === void 0 && (t = {}), n === void 0 && (n = null);
920
+ var r, o = e.geometry, i = o.type, a = o.coordinates, l = e.properties && e.properties.id, d = [];
921
+ function h(p, _) {
922
+ var P = "", b = null;
923
+ p.forEach(function(w, c) {
924
+ var y = _ != null ? _ + "." + c : String(c), O = Le(l, w, y, g(y));
925
+ if (t.midpoints && b) {
926
+ var V = cn(l, b, O);
927
+ V && d.push(V);
928
+ }
929
+ b = O;
930
+ var F = JSON.stringify(w);
931
+ P !== F && d.push(O), c === 0 && (P = F);
932
+ });
933
+ }
934
+ function g(p) {
935
+ return !!t.selectedPaths && t.selectedPaths.indexOf(p) !== -1;
936
+ }
937
+ return i === m.POINT ? d.push(Le(l, a, n, g(n))) : i === m.POLYGON ? a.forEach(function(p, _) {
938
+ h(p, n !== null ? n + "." + _ : String(_));
939
+ }) : i === m.LINE_STRING ? h(a, n) : i.indexOf(m.MULTI_PREFIX) === 0 && (r = i.replace(m.MULTI_PREFIX, ""), a.forEach(function(p, _) {
940
+ var P = { type: m.FEATURE, properties: e.properties, geometry: { type: r, coordinates: p } };
941
+ d = d.concat(We(P, t, _));
942
+ })), d;
943
+ }
944
+ var ee = { enable: function(e) {
945
+ setTimeout(function() {
946
+ e.map && e.map.doubleClickZoom && e._ctx && e._ctx.store && e._ctx.store.getInitialConfigValue && e._ctx.store.getInitialConfigValue("doubleClickZoom") && e.map.doubleClickZoom.enable();
947
+ }, 0);
948
+ }, disable: function(e) {
949
+ setTimeout(function() {
950
+ e.map && e.map.doubleClickZoom && e.map.doubleClickZoom.disable();
951
+ }, 0);
952
+ } }, Ke = { exports: {} }, ln = function(e) {
953
+ if (!e || !e.type) return null;
954
+ var t = gr[e.type];
955
+ if (!t) return null;
956
+ if (t === "geometry") return { type: "FeatureCollection", features: [{ type: "Feature", properties: {}, geometry: e }] };
957
+ if (t === "feature") return { type: "FeatureCollection", features: [e] };
958
+ if (t === "featurecollection") return e;
959
+ }, gr = { Point: "geometry", MultiPoint: "geometry", LineString: "geometry", MultiLineString: "geometry", Polygon: "geometry", MultiPolygon: "geometry", GeometryCollection: "geometry", Feature: "feature", FeatureCollection: "featurecollection" }, yr = de(ln), vr = Object.freeze({ __proto__: null, default: function e(t) {
960
+ switch (t && t.type || null) {
961
+ case "FeatureCollection":
962
+ return t.features = t.features.reduce(function(n, r) {
963
+ return n.concat(e(r));
964
+ }, []), t;
965
+ case "Feature":
966
+ return t.geometry ? e(t.geometry).map(function(n) {
967
+ var r = { type: "Feature", properties: JSON.parse(JSON.stringify(t.properties)), geometry: n };
968
+ return t.id !== void 0 && (r.id = t.id), r;
969
+ }) : [t];
970
+ case "MultiPoint":
971
+ return t.coordinates.map(function(n) {
972
+ return { type: "Point", coordinates: n };
973
+ });
974
+ case "MultiPolygon":
975
+ return t.coordinates.map(function(n) {
976
+ return { type: "Polygon", coordinates: n };
977
+ });
978
+ case "MultiLineString":
979
+ return t.coordinates.map(function(n) {
980
+ return { type: "LineString", coordinates: n };
981
+ });
982
+ case "GeometryCollection":
983
+ return t.geometries.map(e).reduce(function(n, r) {
984
+ return n.concat(r);
985
+ }, []);
986
+ case "Point":
987
+ case "Polygon":
988
+ case "LineString":
989
+ return [t];
990
+ }
991
+ } }), mr = ln, Qe = Qn(vr), _r = function(e) {
992
+ return function t(n) {
993
+ return Array.isArray(n) && n.length && typeof n[0] == "number" ? [n] : n.reduce(function(r, o) {
994
+ return Array.isArray(o) && Array.isArray(o[0]) ? r.concat(t(o)) : (r.push(o), r);
995
+ }, []);
996
+ }(e);
997
+ };
998
+ Qe instanceof Function || (Qe = Qe.default);
999
+ var dn = { exports: {} }, br = dn.exports = function(e) {
1000
+ return new K(e);
1001
+ };
1002
+ function K(e) {
1003
+ this.value = e;
1004
+ }
1005
+ function pn(e, t, n) {
1006
+ var r = [], o = [], i = !0;
1007
+ return function a(l) {
1008
+ var d = n ? fn(l) : l, h = {}, g = !0, p = { node: d, node_: l, path: [].concat(r), parent: o[o.length - 1], parents: o, key: r.slice(-1)[0], isRoot: r.length === 0, level: r.length, circular: null, update: function(b, w) {
1009
+ p.isRoot || (p.parent.node[p.key] = b), p.node = b, w && (g = !1);
1010
+ }, delete: function(b) {
1011
+ delete p.parent.node[p.key], b && (g = !1);
1012
+ }, remove: function(b) {
1013
+ hn(p.parent.node) ? p.parent.node.splice(p.key, 1) : delete p.parent.node[p.key], b && (g = !1);
1014
+ }, keys: null, before: function(b) {
1015
+ h.before = b;
1016
+ }, after: function(b) {
1017
+ h.after = b;
1018
+ }, pre: function(b) {
1019
+ h.pre = b;
1020
+ }, post: function(b) {
1021
+ h.post = b;
1022
+ }, stop: function() {
1023
+ i = !1;
1024
+ }, block: function() {
1025
+ g = !1;
1026
+ } };
1027
+ if (!i) return p;
1028
+ function _() {
1029
+ if (typeof p.node == "object" && p.node !== null) {
1030
+ p.keys && p.node_ === p.node || (p.keys = et(p.node)), p.isLeaf = p.keys.length == 0;
1031
+ for (var b = 0; b < o.length; b++) if (o[b].node_ === l) {
1032
+ p.circular = o[b];
1033
+ break;
1034
+ }
1035
+ } else p.isLeaf = !0, p.keys = null;
1036
+ p.notLeaf = !p.isLeaf, p.notRoot = !p.isRoot;
1037
+ }
1038
+ _();
1039
+ var P = t.call(p, p.node);
1040
+ return P !== void 0 && p.update && p.update(P), h.before && h.before.call(p, p.node), g && (typeof p.node != "object" || p.node === null || p.circular || (o.push(p), _(), tt(p.keys, function(b, w) {
1041
+ r.push(b), h.pre && h.pre.call(p, p.node[b], b);
1042
+ var c = a(p.node[b]);
1043
+ n && nt.call(p.node, b) && (p.node[b] = c.node), c.isLast = w == p.keys.length - 1, c.isFirst = w == 0, h.post && h.post.call(p, c), r.pop();
1044
+ }), o.pop()), h.after && h.after.call(p, p.node)), p;
1045
+ }(e).node;
1046
+ }
1047
+ function fn(e) {
1048
+ if (typeof e == "object" && e !== null) {
1049
+ var t;
1050
+ if (hn(e)) t = [];
1051
+ else if (Ne(e) === "[object Date]") t = new Date(e.getTime ? e.getTime() : e);
1052
+ else if (function(o) {
1053
+ return Ne(o) === "[object RegExp]";
1054
+ }(e)) t = new RegExp(e);
1055
+ else if (function(o) {
1056
+ return Ne(o) === "[object Error]";
1057
+ }(e)) t = { message: e.message };
1058
+ else if (function(o) {
1059
+ return Ne(o) === "[object Boolean]";
1060
+ }(e)) t = new Boolean(e);
1061
+ else if (function(o) {
1062
+ return Ne(o) === "[object Number]";
1063
+ }(e)) t = new Number(e);
1064
+ else if (function(o) {
1065
+ return Ne(o) === "[object String]";
1066
+ }(e)) t = new String(e);
1067
+ else if (Object.create && Object.getPrototypeOf) t = Object.create(Object.getPrototypeOf(e));
1068
+ else if (e.constructor === Object) t = {};
1069
+ else {
1070
+ var n = e.constructor && e.constructor.prototype || e.__proto__ || {}, r = function() {
1071
+ };
1072
+ r.prototype = n, t = new r();
1073
+ }
1074
+ return tt(et(e), function(o) {
1075
+ t[o] = e[o];
1076
+ }), t;
1077
+ }
1078
+ return e;
1079
+ }
1080
+ K.prototype.get = function(e) {
1081
+ for (var t = this.value, n = 0; n < e.length; n++) {
1082
+ var r = e[n];
1083
+ if (!t || !nt.call(t, r)) {
1084
+ t = void 0;
1085
+ break;
1086
+ }
1087
+ t = t[r];
1088
+ }
1089
+ return t;
1090
+ }, K.prototype.has = function(e) {
1091
+ for (var t = this.value, n = 0; n < e.length; n++) {
1092
+ var r = e[n];
1093
+ if (!t || !nt.call(t, r)) return !1;
1094
+ t = t[r];
1095
+ }
1096
+ return !0;
1097
+ }, K.prototype.set = function(e, t) {
1098
+ for (var n = this.value, r = 0; r < e.length - 1; r++) {
1099
+ var o = e[r];
1100
+ nt.call(n, o) || (n[o] = {}), n = n[o];
1101
+ }
1102
+ return n[e[r]] = t, t;
1103
+ }, K.prototype.map = function(e) {
1104
+ return pn(this.value, e, !0);
1105
+ }, K.prototype.forEach = function(e) {
1106
+ return this.value = pn(this.value, e, !1), this.value;
1107
+ }, K.prototype.reduce = function(e, t) {
1108
+ var n = arguments.length === 1, r = n ? this.value : t;
1109
+ return this.forEach(function(o) {
1110
+ this.isRoot && n || (r = e.call(this, r, o));
1111
+ }), r;
1112
+ }, K.prototype.paths = function() {
1113
+ var e = [];
1114
+ return this.forEach(function(t) {
1115
+ e.push(this.path);
1116
+ }), e;
1117
+ }, K.prototype.nodes = function() {
1118
+ var e = [];
1119
+ return this.forEach(function(t) {
1120
+ e.push(this.node);
1121
+ }), e;
1122
+ }, K.prototype.clone = function() {
1123
+ var e = [], t = [];
1124
+ return function n(r) {
1125
+ for (var o = 0; o < e.length; o++) if (e[o] === r) return t[o];
1126
+ if (typeof r == "object" && r !== null) {
1127
+ var i = fn(r);
1128
+ return e.push(r), t.push(i), tt(et(r), function(a) {
1129
+ i[a] = n(r[a]);
1130
+ }), e.pop(), t.pop(), i;
1131
+ }
1132
+ return r;
1133
+ }(this.value);
1134
+ };
1135
+ var et = Object.keys || function(e) {
1136
+ var t = [];
1137
+ for (var n in e) t.push(n);
1138
+ return t;
1139
+ };
1140
+ function Ne(e) {
1141
+ return Object.prototype.toString.call(e);
1142
+ }
1143
+ var hn = Array.isArray || function(e) {
1144
+ return Object.prototype.toString.call(e) === "[object Array]";
1145
+ }, tt = function(e, t) {
1146
+ if (e.forEach) return e.forEach(t);
1147
+ for (var n = 0; n < e.length; n++) t(e[n], n, e);
1148
+ };
1149
+ tt(et(K.prototype), function(e) {
1150
+ br[e] = function(t) {
1151
+ var n = [].slice.call(arguments, 1), r = new K(t);
1152
+ return r[e].apply(r, n);
1153
+ };
1154
+ });
1155
+ var nt = Object.hasOwnProperty || function(e, t) {
1156
+ return t in e;
1157
+ }, Er = dn.exports, Tr = J;
1158
+ function J(e) {
1159
+ if (!(this instanceof J)) return new J(e);
1160
+ this._bbox = e || [1 / 0, 1 / 0, -1 / 0, -1 / 0], this._valid = !!e;
1161
+ }
1162
+ J.prototype.include = function(e) {
1163
+ return this._valid = !0, this._bbox[0] = Math.min(this._bbox[0], e[0]), this._bbox[1] = Math.min(this._bbox[1], e[1]), this._bbox[2] = Math.max(this._bbox[2], e[0]), this._bbox[3] = Math.max(this._bbox[3], e[1]), this;
1164
+ }, J.prototype.equals = function(e) {
1165
+ var t;
1166
+ return t = e instanceof J ? e.bbox() : e, this._bbox[0] == t[0] && this._bbox[1] == t[1] && this._bbox[2] == t[2] && this._bbox[3] == t[3];
1167
+ }, J.prototype.center = function(e) {
1168
+ return this._valid ? [(this._bbox[0] + this._bbox[2]) / 2, (this._bbox[1] + this._bbox[3]) / 2] : null;
1169
+ }, J.prototype.union = function(e) {
1170
+ var t;
1171
+ return this._valid = !0, t = e instanceof J ? e.bbox() : e, this._bbox[0] = Math.min(this._bbox[0], t[0]), this._bbox[1] = Math.min(this._bbox[1], t[1]), this._bbox[2] = Math.max(this._bbox[2], t[2]), this._bbox[3] = Math.max(this._bbox[3], t[3]), this;
1172
+ }, J.prototype.bbox = function() {
1173
+ return this._valid ? this._bbox : null;
1174
+ }, J.prototype.contains = function(e) {
1175
+ if (!e) return this._fastContains();
1176
+ if (!this._valid) return null;
1177
+ var t = e[0], n = e[1];
1178
+ return this._bbox[0] <= t && this._bbox[1] <= n && this._bbox[2] >= t && this._bbox[3] >= n;
1179
+ }, J.prototype.intersect = function(e) {
1180
+ return this._valid ? (t = e instanceof J ? e.bbox() : e, !(this._bbox[0] > t[2] || this._bbox[2] < t[0] || this._bbox[3] < t[1] || this._bbox[1] > t[3])) : null;
1181
+ var t;
1182
+ }, J.prototype._fastContains = function() {
1183
+ if (!this._valid) return new Function("return null;");
1184
+ var e = "return " + this._bbox[0] + "<= ll[0] &&" + this._bbox[1] + "<= ll[1] &&" + this._bbox[2] + ">= ll[0] &&" + this._bbox[3] + ">= ll[1]";
1185
+ return new Function("ll", e);
1186
+ }, J.prototype.polygon = function() {
1187
+ return this._valid ? { type: "Polygon", coordinates: [[[this._bbox[0], this._bbox[1]], [this._bbox[2], this._bbox[1]], [this._bbox[2], this._bbox[3]], [this._bbox[0], this._bbox[3]], [this._bbox[0], this._bbox[1]]]] } : null;
1188
+ };
1189
+ var Cr = function(e) {
1190
+ if (!e) return [];
1191
+ var t = Qe(mr(e)), n = [];
1192
+ return t.features.forEach(function(r) {
1193
+ r.geometry && (n = n.concat(_r(r.geometry.coordinates)));
1194
+ }), n;
1195
+ }, Or = Er, Sr = Tr, gn = { features: ["FeatureCollection"], coordinates: ["Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon"], geometry: ["Feature"], geometries: ["GeometryCollection"] }, Ir = Object.keys(gn);
1196
+ function Rt(e) {
1197
+ for (var t = Sr(), n = Cr(e), r = 0; r < n.length; r++) t.include(n[r]);
1198
+ return t;
1199
+ }
1200
+ Ke.exports = function(e) {
1201
+ return Rt(e).bbox();
1202
+ }, Ke.exports.polygon = function(e) {
1203
+ return Rt(e).polygon();
1204
+ }, Ke.exports.bboxify = function(e) {
1205
+ return Or(e).map(function(t) {
1206
+ t && Ir.some(function(n) {
1207
+ return !!t[n] && gn[n].indexOf(t.type) !== -1;
1208
+ }) && (t.bbox = Rt(t).bbox(), this.update(t));
1209
+ });
1210
+ };
1211
+ var xr = de(Ke.exports), rt = -90;
1212
+ function Dt(e, t) {
1213
+ var n = rt, r = 90, o = rt, i = 90, a = 270, l = -270;
1214
+ e.forEach(function(h) {
1215
+ var g = xr(h), p = g[1], _ = g[3], P = g[0], b = g[2];
1216
+ p > n && (n = p), _ < r && (r = _), _ > o && (o = _), p < i && (i = p), P < a && (a = P), b > l && (l = b);
1217
+ });
1218
+ var d = t;
1219
+ return n + d.lat > 85 && (d.lat = 85 - n), o + d.lat > 90 && (d.lat = 90 - o), r + d.lat < -85 && (d.lat = -85 - r), i + d.lat < rt && (d.lat = rt - i), a + d.lng <= -270 && (d.lng += 360 * Math.ceil(Math.abs(d.lng) / 360)), l + d.lng >= 270 && (d.lng -= 360 * Math.ceil(Math.abs(d.lng) / 360)), d;
1220
+ }
1221
+ function kt(e, t) {
1222
+ var n = Dt(e.map(function(r) {
1223
+ return r.toGeoJSON();
1224
+ }), t);
1225
+ e.forEach(function(r) {
1226
+ var o, i = r.getCoordinates(), a = function(d) {
1227
+ var h = { lng: d[0] + n.lng, lat: d[1] + n.lat };
1228
+ return [h.lng, h.lat];
1229
+ }, l = function(d) {
1230
+ return d.map(function(h) {
1231
+ return a(h);
1232
+ });
1233
+ };
1234
+ r.type === m.POINT ? o = a(i) : r.type === m.LINE_STRING || r.type === m.MULTI_POINT ? o = i.map(a) : r.type === m.POLYGON || r.type === m.MULTI_LINE_STRING ? o = i.map(l) : r.type === m.MULTI_POLYGON && (o = i.map(function(d) {
1235
+ return d.map(function(h) {
1236
+ return l(h);
1237
+ });
1238
+ })), r.incomingCoords(o);
1239
+ });
1240
+ }
1241
+ var D = { onSetup: function(e) {
1242
+ var t = this, n = { dragMoveLocation: null, boxSelectStartLocation: null, boxSelectElement: void 0, boxSelecting: !1, canBoxSelect: !1, dragMoving: !1, canDragMove: !1, initiallySelectedFeatureIds: e.featureIds || [] };
1243
+ return this.setSelected(n.initiallySelectedFeatureIds.filter(function(r) {
1244
+ return t.getFeature(r) !== void 0;
1245
+ })), this.fireActionable(), this.setActionableState({ combineFeatures: !0, uncombineFeatures: !0, trash: !0 }), n;
1246
+ }, fireUpdate: function() {
1247
+ this.map.fire(H.UPDATE, { action: St.MOVE, features: this.getSelected().map(function(e) {
1248
+ return e.toGeoJSON();
1249
+ }) });
1250
+ }, fireActionable: function() {
1251
+ var e = this, t = this.getSelected(), n = t.filter(function(l) {
1252
+ return e.isInstanceOf("MultiFeature", l);
1253
+ }), r = !1;
1254
+ if (t.length > 1) {
1255
+ r = !0;
1256
+ var o = t[0].type.replace("Multi", "");
1257
+ t.forEach(function(l) {
1258
+ l.type.replace("Multi", "") !== o && (r = !1);
1259
+ });
1260
+ }
1261
+ var i = n.length > 0, a = t.length > 0;
1262
+ this.setActionableState({ combineFeatures: r, uncombineFeatures: i, trash: a });
1263
+ }, getUniqueIds: function(e) {
1264
+ return e.length ? e.map(function(t) {
1265
+ return t.properties.id;
1266
+ }).filter(function(t) {
1267
+ return t !== void 0;
1268
+ }).reduce(function(t, n) {
1269
+ return t.add(n), t;
1270
+ }, new Z()).values() : [];
1271
+ }, stopExtendedInteractions: function(e) {
1272
+ e.boxSelectElement && (e.boxSelectElement.parentNode && e.boxSelectElement.parentNode.removeChild(e.boxSelectElement), e.boxSelectElement = null), this.map.dragPan.enable(), e.boxSelecting = !1, e.canBoxSelect = !1, e.dragMoving = !1, e.canDragMove = !1;
1273
+ }, onStop: function() {
1274
+ ee.enable(this);
1275
+ }, onMouseMove: function(e, t) {
1276
+ return wt(t) && e.dragMoving && this.fireUpdate(), this.stopExtendedInteractions(e), !0;
1277
+ }, onMouseOut: function(e) {
1278
+ return !e.dragMoving || this.fireUpdate();
1279
+ } };
1280
+ D.onTap = D.onClick = function(e, t) {
1281
+ return qe(t) ? this.clickAnywhere(e, t) : $e(B.VERTEX)(t) ? this.clickOnVertex(e, t) : wt(t) ? this.clickOnFeature(e, t) : void 0;
1282
+ }, D.clickAnywhere = function(e) {
1283
+ var t = this, n = this.getSelectedIds();
1284
+ n.length && (this.clearSelectedFeatures(), n.forEach(function(r) {
1285
+ return t.doRender(r);
1286
+ })), ee.enable(this), this.stopExtendedInteractions(e);
1287
+ }, D.clickOnVertex = function(e, t) {
1288
+ this.changeMode(T.DIRECT_SELECT, { featureId: t.featureTarget.properties.parent, coordPath: t.featureTarget.properties.coord_path, startPos: t.lngLat }), this.updateUIClasses({ mouse: N.MOVE });
1289
+ }, D.startOnActiveFeature = function(e, t) {
1290
+ this.stopExtendedInteractions(e), this.map.dragPan.disable(), this.doRender(t.featureTarget.properties.id), e.canDragMove = !0, e.dragMoveLocation = t.lngLat;
1291
+ }, D.clickOnFeature = function(e, t) {
1292
+ var n = this;
1293
+ ee.disable(this), this.stopExtendedInteractions(e);
1294
+ var r = He(t), o = this.getSelectedIds(), i = t.featureTarget.properties.id, a = this.isSelected(i);
1295
+ if (!r && a && this.getFeature(i).type !== m.POINT) return this.changeMode(T.DIRECT_SELECT, { featureId: i });
1296
+ a && r ? (this.deselect(i), this.updateUIClasses({ mouse: N.POINTER }), o.length === 1 && ee.enable(this)) : !a && r ? (this.select(i), this.updateUIClasses({ mouse: N.MOVE })) : a || r || (o.forEach(function(l) {
1297
+ return n.doRender(l);
1298
+ }), this.setSelected(i), this.updateUIClasses({ mouse: N.MOVE })), this.doRender(i);
1299
+ }, D.onMouseDown = function(e, t) {
1300
+ return _e(t) ? this.startOnActiveFeature(e, t) : this.drawConfig.boxSelect && un(t) ? this.startBoxSelect(e, t) : void 0;
1301
+ }, D.startBoxSelect = function(e, t) {
1302
+ this.stopExtendedInteractions(e), this.map.dragPan.disable(), e.boxSelectStartLocation = Ft(t.originalEvent, this.map.getContainer()), e.canBoxSelect = !0;
1303
+ }, D.onTouchStart = function(e, t) {
1304
+ if (_e(t)) return this.startOnActiveFeature(e, t);
1305
+ }, D.onDrag = function(e, t) {
1306
+ return e.canDragMove ? this.dragMove(e, t) : this.drawConfig.boxSelect && e.canBoxSelect ? this.whileBoxSelect(e, t) : void 0;
1307
+ }, D.whileBoxSelect = function(e, t) {
1308
+ e.boxSelecting = !0, this.updateUIClasses({ mouse: N.ADD }), e.boxSelectElement || (e.boxSelectElement = document.createElement("div"), e.boxSelectElement.classList.add(q.BOX_SELECT), this.map.getContainer().appendChild(e.boxSelectElement));
1309
+ var n = Ft(t.originalEvent, this.map.getContainer()), r = Math.min(e.boxSelectStartLocation.x, n.x), o = 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(" + r + "px, " + i + "px)";
1310
+ e.boxSelectElement.style.transform = l, e.boxSelectElement.style.WebkitTransform = l, e.boxSelectElement.style.width = o - r + "px", e.boxSelectElement.style.height = a - i + "px";
1311
+ }, D.dragMove = function(e, t) {
1312
+ e.dragMoving = !0, t.originalEvent.stopPropagation();
1313
+ var n = { lng: t.lngLat.lng - e.dragMoveLocation.lng, lat: t.lngLat.lat - e.dragMoveLocation.lat };
1314
+ kt(this.getSelected(), n), e.dragMoveLocation = t.lngLat;
1315
+ }, D.onTouchEnd = D.onMouseUp = function(e, t) {
1316
+ var n = this;
1317
+ if (e.dragMoving) this.fireUpdate();
1318
+ else if (e.boxSelecting) {
1319
+ var r = [e.boxSelectStartLocation, Ft(t.originalEvent, this.map.getContainer())], o = this.featuresAt(null, r, "click"), i = this.getUniqueIds(o).filter(function(a) {
1320
+ return !n.isSelected(a);
1321
+ });
1322
+ i.length && (this.select(i), i.forEach(function(a) {
1323
+ return n.doRender(a);
1324
+ }), this.updateUIClasses({ mouse: N.MOVE }));
1325
+ }
1326
+ this.stopExtendedInteractions(e);
1327
+ }, D.toDisplayFeatures = function(e, t, n) {
1328
+ t.properties.active = this.isSelected(t.properties.id) ? j.ACTIVE : j.INACTIVE, n(t), this.fireActionable(), t.properties.active === j.ACTIVE && t.geometry.type !== m.POINT && We(t).forEach(n);
1329
+ }, D.onTrash = function() {
1330
+ this.deleteFeature(this.getSelectedIds()), this.fireActionable();
1331
+ }, D.onCombineFeatures = function() {
1332
+ var e = this.getSelected();
1333
+ if (!(e.length === 0 || e.length < 2)) {
1334
+ for (var t = [], n = [], r = e[0].type.replace("Multi", ""), o = 0; o < e.length; o++) {
1335
+ var i = e[o];
1336
+ if (i.type.replace("Multi", "") !== r) return;
1337
+ i.type.includes("Multi") ? i.getCoordinates().forEach(function(l) {
1338
+ t.push(l);
1339
+ }) : t.push(i.getCoordinates()), n.push(i.toGeoJSON());
1340
+ }
1341
+ if (n.length > 1) {
1342
+ var a = this.newFeature({ type: m.FEATURE, properties: n[0].properties, geometry: { type: "Multi" + r, coordinates: t } });
1343
+ this.addFeature(a), this.deleteFeature(this.getSelectedIds(), { silent: !0 }), this.setSelected([a.id]), this.map.fire(H.COMBINE_FEATURES, { createdFeatures: [a.toGeoJSON()], deletedFeatures: n });
1344
+ }
1345
+ this.fireActionable();
1346
+ }
1347
+ }, D.onUncombineFeatures = function() {
1348
+ var e = this, t = this.getSelected();
1349
+ if (t.length !== 0) {
1350
+ for (var n = [], r = [], o = function(a) {
1351
+ var l = t[a];
1352
+ e.isInstanceOf("MultiFeature", l) && (l.getFeatures().forEach(function(d) {
1353
+ e.addFeature(d), d.properties = l.properties, n.push(d.toGeoJSON()), e.select([d.id]);
1354
+ }), e.deleteFeature(l.id, { silent: !0 }), r.push(l.toGeoJSON()));
1355
+ }, i = 0; i < t.length; i++) o(i);
1356
+ n.length > 1 && this.map.fire(H.UNCOMBINE_FEATURES, { createdFeatures: n, deletedFeatures: r }), this.fireActionable();
1357
+ }
1358
+ };
1359
+ var yn = $e(B.VERTEX), vn = $e(B.MIDPOINT), fe = { fireUpdate: function() {
1360
+ this.map.fire(H.UPDATE, { action: St.CHANGE_COORDINATES, features: this.getSelected().map(function(e) {
1361
+ return e.toGeoJSON();
1362
+ }) });
1363
+ }, fireActionable: function(e) {
1364
+ this.setActionableState({ combineFeatures: !1, uncombineFeatures: !1, trash: e.selectedCoordPaths.length > 0 });
1365
+ }, startDragging: function(e, t) {
1366
+ this.map.dragPan.disable(), e.canDragMove = !0, e.dragMoveLocation = t.lngLat;
1367
+ }, stopDragging: function(e) {
1368
+ this.map.dragPan.enable(), e.dragMoving = !1, e.canDragMove = !1, e.dragMoveLocation = null;
1369
+ }, onVertex: function(e, t) {
1370
+ this.startDragging(e, t);
1371
+ var n = t.featureTarget.properties, r = e.selectedCoordPaths.indexOf(n.coord_path);
1372
+ He(t) || r !== -1 ? He(t) && r === -1 && e.selectedCoordPaths.push(n.coord_path) : e.selectedCoordPaths = [n.coord_path];
1373
+ var o = this.pathsToCoordinates(e.featureId, e.selectedCoordPaths);
1374
+ this.setSelectedCoordinates(o);
1375
+ }, onMidpoint: function(e, t) {
1376
+ this.startDragging(e, t);
1377
+ var n = t.featureTarget.properties;
1378
+ e.feature.addCoordinate(n.coord_path, n.lng, n.lat), this.fireUpdate(), e.selectedCoordPaths = [n.coord_path];
1379
+ }, pathsToCoordinates: function(e, t) {
1380
+ return t.map(function(n) {
1381
+ return { feature_id: e, coord_path: n };
1382
+ });
1383
+ }, onFeature: function(e, t) {
1384
+ e.selectedCoordPaths.length === 0 ? this.startDragging(e, t) : this.stopDragging(e);
1385
+ }, dragFeature: function(e, t, n) {
1386
+ kt(this.getSelected(), n), e.dragMoveLocation = t.lngLat;
1387
+ }, dragVertex: function(e, t, n) {
1388
+ for (var r = e.selectedCoordPaths.map(function(l) {
1389
+ return e.feature.getCoordinate(l);
1390
+ }), o = Dt(r.map(function(l) {
1391
+ return { type: m.FEATURE, properties: {}, geometry: { type: m.POINT, coordinates: l } };
1392
+ }), n), i = 0; i < r.length; i++) {
1393
+ var a = r[i];
1394
+ e.feature.updateCoordinate(e.selectedCoordPaths[i], a[0] + o.lng, a[1] + o.lat);
1395
+ }
1396
+ }, clickNoTarget: function() {
1397
+ this.changeMode(T.SIMPLE_SELECT);
1398
+ }, clickInactive: function() {
1399
+ this.changeMode(T.SIMPLE_SELECT);
1400
+ }, clickActiveFeature: function(e) {
1401
+ e.selectedCoordPaths = [], this.clearSelectedCoordinates(), e.feature.changed();
1402
+ }, onSetup: function(e) {
1403
+ var t = e.featureId, n = this.getFeature(t);
1404
+ if (!n) throw new Error("You must provide a featureId to enter direct_select mode");
1405
+ if (n.type === m.POINT) throw new TypeError("direct_select mode doesn't handle point features");
1406
+ var r = { featureId: t, feature: n, dragMoveLocation: e.startPos || null, dragMoving: !1, canDragMove: !1, selectedCoordPaths: e.coordPath ? [e.coordPath] : [] };
1407
+ return this.setSelectedCoordinates(this.pathsToCoordinates(t, r.selectedCoordPaths)), this.setSelected(t), ee.disable(this), this.setActionableState({ trash: !0 }), r;
1408
+ }, onStop: function() {
1409
+ ee.enable(this), this.clearSelectedCoordinates();
1410
+ }, toDisplayFeatures: function(e, t, n) {
1411
+ e.featureId === t.properties.id ? (t.properties.active = j.ACTIVE, n(t), We(t, { map: this.map, midpoints: !0, selectedPaths: e.selectedCoordPaths }).forEach(n)) : (t.properties.active = j.INACTIVE, n(t)), this.fireActionable(e);
1412
+ }, onTrash: function(e) {
1413
+ e.selectedCoordPaths.sort(function(t, n) {
1414
+ return n.localeCompare(t, "en", { numeric: !0 });
1415
+ }).forEach(function(t) {
1416
+ return e.feature.removeCoordinate(t);
1417
+ }), this.fireUpdate(), e.selectedCoordPaths = [], this.clearSelectedCoordinates(), this.fireActionable(e), e.feature.isValid() === !1 && (this.deleteFeature([e.featureId]), this.changeMode(T.SIMPLE_SELECT, {}));
1418
+ }, onMouseMove: function(e, t) {
1419
+ var n = _e(t), r = yn(t), o = vn(t), i = e.selectedCoordPaths.length === 0;
1420
+ return n && i || r && !i ? this.updateUIClasses({ mouse: N.MOVE }) : this.updateUIClasses({ mouse: N.NONE }), (r || n || o) && e.dragMoving && this.fireUpdate(), this.stopDragging(e), !0;
1421
+ }, onMouseOut: function(e) {
1422
+ return e.dragMoving && this.fireUpdate(), !0;
1423
+ } };
1424
+ fe.onTouchStart = fe.onMouseDown = function(e, t) {
1425
+ return yn(t) ? this.onVertex(e, t) : _e(t) ? this.onFeature(e, t) : vn(t) ? this.onMidpoint(e, t) : void 0;
1426
+ }, fe.onDrag = function(e, t) {
1427
+ if (e.canDragMove === !0) {
1428
+ e.dragMoving = !0, t.originalEvent.stopPropagation();
1429
+ var n = { lng: t.lngLat.lng - e.dragMoveLocation.lng, lat: t.lngLat.lat - e.dragMoveLocation.lat };
1430
+ e.selectedCoordPaths.length > 0 ? this.dragVertex(e, t, n) : this.dragFeature(e, t, n), e.dragMoveLocation = t.lngLat;
1431
+ }
1432
+ }, fe.onClick = function(e, t) {
1433
+ return qe(t) ? this.clickNoTarget(e, t) : _e(t) ? this.clickActiveFeature(e, t) : At(t) ? this.clickInactive(e, t) : void this.stopDragging(e);
1434
+ }, fe.onTap = function(e, t) {
1435
+ return qe(t) ? this.clickNoTarget(e, t) : _e(t) ? this.clickActiveFeature(e, t) : At(t) ? this.clickInactive(e, t) : void 0;
1436
+ }, fe.onTouchEnd = fe.onMouseUp = function(e) {
1437
+ e.dragMoving && this.fireUpdate(), this.stopDragging(e);
1438
+ };
1439
+ var ne = {};
1440
+ function ot(e, t) {
1441
+ return !!e.lngLat && e.lngLat.lng === t[0] && e.lngLat.lat === t[1];
1442
+ }
1443
+ ne.onSetup = function() {
1444
+ var e = this.newFeature({ type: m.FEATURE, properties: {}, geometry: { type: m.POINT, coordinates: [] } });
1445
+ return this.addFeature(e), this.clearSelectedFeatures(), this.updateUIClasses({ mouse: N.ADD }), this.activateUIButton(Y.POINT), this.setActionableState({ trash: !0 }), { point: e };
1446
+ }, ne.stopDrawingAndRemove = function(e) {
1447
+ this.deleteFeature([e.point.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT);
1448
+ }, ne.onTap = ne.onClick = function(e, t) {
1449
+ this.updateUIClasses({ mouse: N.MOVE }), e.point.updateCoordinate("", t.lngLat.lng, t.lngLat.lat), this.map.fire(H.CREATE, { features: [e.point.toGeoJSON()] }), this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.point.id] });
1450
+ }, ne.onStop = function(e) {
1451
+ this.activateUIButton(), e.point.getCoordinate().length || this.deleteFeature([e.point.id], { silent: !0 });
1452
+ }, ne.toDisplayFeatures = function(e, t, n) {
1453
+ var r = t.properties.id === e.point.id;
1454
+ if (t.properties.active = r ? j.ACTIVE : j.INACTIVE, !r) return n(t);
1455
+ }, ne.onTrash = ne.stopDrawingAndRemove, ne.onKeyUp = function(e, t) {
1456
+ if (Xe(t) || Ze(t)) return this.stopDrawingAndRemove(e, t);
1457
+ };
1458
+ var be = { onSetup: function() {
1459
+ var e = this.newFeature({ type: m.FEATURE, properties: {}, geometry: { type: m.POLYGON, coordinates: [[]] } });
1460
+ return this.addFeature(e), this.clearSelectedFeatures(), ee.disable(this), this.updateUIClasses({ mouse: N.ADD }), this.activateUIButton(Y.POLYGON), this.setActionableState({ trash: !0 }), { polygon: e, currentVertexPosition: 0 };
1461
+ }, clickAnywhere: function(e, t) {
1462
+ if (e.currentVertexPosition > 0 && ot(t, e.polygon.coordinates[0][e.currentVertexPosition - 1])) return this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.polygon.id] });
1463
+ this.updateUIClasses({ mouse: N.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);
1464
+ }, clickOnVertex: function(e) {
1465
+ return this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.polygon.id] });
1466
+ }, onMouseMove: function(e, t) {
1467
+ e.polygon.updateCoordinate("0." + e.currentVertexPosition, t.lngLat.lng, t.lngLat.lat), De(t) && this.updateUIClasses({ mouse: N.POINTER });
1468
+ } };
1469
+ be.onTap = be.onClick = function(e, t) {
1470
+ return De(t) ? this.clickOnVertex(e, t) : this.clickAnywhere(e, t);
1471
+ }, be.onKeyUp = function(e, t) {
1472
+ Xe(t) ? (this.deleteFeature([e.polygon.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT)) : Ze(t) && this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.polygon.id] });
1473
+ }, be.onStop = function(e) {
1474
+ this.updateUIClasses({ mouse: N.NONE }), ee.enable(this), this.activateUIButton(), this.getFeature(e.polygon.id) !== void 0 && (e.polygon.removeCoordinate("0." + e.currentVertexPosition), e.polygon.isValid() ? this.map.fire(H.CREATE, { features: [e.polygon.toGeoJSON()] }) : (this.deleteFeature([e.polygon.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT, {}, { silent: !0 })));
1475
+ }, be.toDisplayFeatures = function(e, t, n) {
1476
+ var r = t.properties.id === e.polygon.id;
1477
+ if (t.properties.active = r ? j.ACTIVE : j.INACTIVE, !r) return n(t);
1478
+ if (t.geometry.coordinates.length !== 0) {
1479
+ var o = t.geometry.coordinates[0].length;
1480
+ if (!(o < 3)) {
1481
+ if (t.properties.meta = B.FEATURE, n(Le(e.polygon.id, t.geometry.coordinates[0][0], "0.0", !1)), o > 3) {
1482
+ var i = t.geometry.coordinates[0].length - 3;
1483
+ n(Le(e.polygon.id, t.geometry.coordinates[0][i], "0." + i, !1));
1484
+ }
1485
+ if (o <= 4) {
1486
+ var a = [[t.geometry.coordinates[0][0][0], t.geometry.coordinates[0][0][1]], [t.geometry.coordinates[0][1][0], t.geometry.coordinates[0][1][1]]];
1487
+ if (n({ type: m.FEATURE, properties: t.properties, geometry: { coordinates: a, type: m.LINE_STRING } }), o === 3) return;
1488
+ }
1489
+ return n(t);
1490
+ }
1491
+ }
1492
+ }, be.onTrash = function(e) {
1493
+ this.deleteFeature([e.polygon.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT);
1494
+ };
1495
+ var Ee = { onSetup: function(e) {
1496
+ var t, n, r = (e = e || {}).featureId, o = "forward";
1497
+ if (r) {
1498
+ if (!(t = this.getFeature(r))) throw new Error("Could not find a feature with the provided featureId");
1499
+ var i = e.from;
1500
+ 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");
1501
+ var a = t.coordinates.length - 1;
1502
+ if (t.coordinates[a][0] === i[0] && t.coordinates[a][1] === i[1]) n = a + 1, t.addCoordinate.apply(t, [n].concat(t.coordinates[a]));
1503
+ else {
1504
+ if (t.coordinates[0][0] !== i[0] || t.coordinates[0][1] !== i[1]) throw new Error("`from` should match the point at either the start or the end of the provided LineString");
1505
+ o = "backwards", n = 0, t.addCoordinate.apply(t, [n].concat(t.coordinates[0]));
1506
+ }
1507
+ } else t = this.newFeature({ type: m.FEATURE, properties: {}, geometry: { type: m.LINE_STRING, coordinates: [] } }), n = 0, this.addFeature(t);
1508
+ return this.clearSelectedFeatures(), ee.disable(this), this.updateUIClasses({ mouse: N.ADD }), this.activateUIButton(Y.LINE), this.setActionableState({ trash: !0 }), { line: t, currentVertexPosition: n, direction: o };
1509
+ }, clickAnywhere: function(e, t) {
1510
+ if (e.currentVertexPosition > 0 && ot(t, e.line.coordinates[e.currentVertexPosition - 1]) || e.direction === "backwards" && ot(t, e.line.coordinates[e.currentVertexPosition + 1])) return this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.line.id] });
1511
+ this.updateUIClasses({ mouse: N.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);
1512
+ }, clickOnVertex: function(e) {
1513
+ return this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.line.id] });
1514
+ }, onMouseMove: function(e, t) {
1515
+ e.line.updateCoordinate(e.currentVertexPosition, t.lngLat.lng, t.lngLat.lat), De(t) && this.updateUIClasses({ mouse: N.POINTER });
1516
+ } };
1517
+ Ee.onTap = Ee.onClick = function(e, t) {
1518
+ if (De(t)) return this.clickOnVertex(e, t);
1519
+ this.clickAnywhere(e, t);
1520
+ }, Ee.onKeyUp = function(e, t) {
1521
+ Ze(t) ? this.changeMode(T.SIMPLE_SELECT, { featureIds: [e.line.id] }) : Xe(t) && (this.deleteFeature([e.line.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT));
1522
+ }, Ee.onStop = function(e) {
1523
+ ee.enable(this), this.activateUIButton(), this.getFeature(e.line.id) !== void 0 && (e.line.removeCoordinate("" + e.currentVertexPosition), e.line.isValid() ? this.map.fire(H.CREATE, { features: [e.line.toGeoJSON()] }) : (this.deleteFeature([e.line.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT, {}, { silent: !0 })));
1524
+ }, Ee.onTrash = function(e) {
1525
+ this.deleteFeature([e.line.id], { silent: !0 }), this.changeMode(T.SIMPLE_SELECT);
1526
+ }, Ee.toDisplayFeatures = function(e, t, n) {
1527
+ var r = t.properties.id === e.line.id;
1528
+ if (t.properties.active = r ? j.ACTIVE : j.INACTIVE, !r) return n(t);
1529
+ t.geometry.coordinates.length < 2 || (t.properties.meta = B.FEATURE, n(Le(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));
1530
+ };
1531
+ var mn = { simple_select: D, direct_select: fe, draw_point: ne, draw_polygon: be, draw_line_string: Ee }, Mr = { defaultMode: T.SIMPLE_SELECT, keybindings: !0, touchEnabled: !0, clickBuffer: 2, touchBuffer: 25, boxSelect: !0, displayControlsDefault: !0, styles: sn, modes: mn, controls: {}, userProperties: !1 }, Lr = { point: !0, line_string: !0, polygon: !0, trash: !0, combine_features: !0, uncombine_features: !0 }, Nr = { point: !1, line_string: !1, polygon: !1, trash: !1, combine_features: !1, uncombine_features: !1 };
1532
+ function _n(e, t) {
1533
+ return e.map(function(n) {
1534
+ return n.source ? n : pe(n, { id: n.id + "." + t, source: t === "hot" ? X.HOT : X.COLD });
1535
+ });
1536
+ }
1537
+ var Ut = { exports: {} };
1538
+ (function(e, t) {
1539
+ var n = "__lodash_hash_undefined__", r = 9007199254740991, o = "[object Arguments]", i = "[object Array]", a = "[object Boolean]", l = "[object Date]", d = "[object Error]", h = "[object Function]", g = "[object Map]", p = "[object Number]", _ = "[object Object]", P = "[object Promise]", b = "[object RegExp]", w = "[object Set]", c = "[object String]", y = "[object Symbol]", O = "[object WeakMap]", V = "[object ArrayBuffer]", F = "[object DataView]", jt = /^\[object .+?Constructor\]$/, Fr = /^(?:0|[1-9]\d*)$/, M = {};
1540
+ M["[object Float32Array]"] = M["[object Float64Array]"] = M["[object Int8Array]"] = M["[object Int16Array]"] = M["[object Int32Array]"] = M["[object Uint8Array]"] = M["[object Uint8ClampedArray]"] = M["[object Uint16Array]"] = M["[object Uint32Array]"] = !0, M[o] = M[i] = M[V] = M[a] = M[F] = M[l] = M[d] = M[h] = M[g] = M[p] = M[_] = M[b] = M[w] = M[c] = M[O] = !1;
1541
+ var Tn = typeof bt == "object" && bt && bt.Object === Object && bt, Rr = typeof self == "object" && self && self.Object === Object && self, ae = Tn || Rr || Function("return this")(), Cn = t && !t.nodeType && t, On = Cn && e && !e.nodeType && e, Sn = On && On.exports === Cn, Vt = Sn && Tn.process, In = function() {
1542
+ try {
1543
+ return Vt && Vt.binding && Vt.binding("util");
1544
+ } catch {
1545
+ }
1546
+ }(), xn = In && In.isTypedArray;
1547
+ function Dr(s, u) {
1548
+ for (var f = -1, v = s == null ? 0 : s.length; ++f < v; ) if (u(s[f], f, s)) return !0;
1549
+ return !1;
1550
+ }
1551
+ function kr(s) {
1552
+ var u = -1, f = Array(s.size);
1553
+ return s.forEach(function(v, L) {
1554
+ f[++u] = [L, v];
1555
+ }), f;
1556
+ }
1557
+ function Ur(s) {
1558
+ var u = -1, f = Array(s.size);
1559
+ return s.forEach(function(v) {
1560
+ f[++u] = v;
1561
+ }), f;
1562
+ }
1563
+ var Mn, Ln, Nn, jr = Array.prototype, Vr = Function.prototype, at = Object.prototype, Bt = ae["__core-js_shared__"], Pn = Vr.toString, re = at.hasOwnProperty, An = (Mn = /[^.]+$/.exec(Bt && Bt.keys && Bt.keys.IE_PROTO || "")) ? "Symbol(src)_1." + Mn : "", wn = at.toString, Br = RegExp("^" + Pn.call(re).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), Fn = Sn ? ae.Buffer : void 0, st = ae.Symbol, Rn = ae.Uint8Array, Dn = at.propertyIsEnumerable, Gr = jr.splice, Te = st ? st.toStringTag : void 0, kn = Object.getOwnPropertySymbols, Jr = Fn ? Fn.isBuffer : void 0, zr = (Ln = Object.keys, Nn = Object, function(s) {
1564
+ return Ln(Nn(s));
1565
+ }), Gt = Pe(ae, "DataView"), ke = Pe(ae, "Map"), Jt = Pe(ae, "Promise"), zt = Pe(ae, "Set"), Yt = Pe(ae, "WeakMap"), Ue = Pe(Object, "create"), Yr = Se(Gt), $r = Se(ke), qr = Se(Jt), Hr = Se(zt), Xr = Se(Yt), Un = st ? st.prototype : void 0, $t = Un ? Un.valueOf : void 0;
1566
+ function Ce(s) {
1567
+ var u = -1, f = s == null ? 0 : s.length;
1568
+ for (this.clear(); ++u < f; ) {
1569
+ var v = s[u];
1570
+ this.set(v[0], v[1]);
1571
+ }
1572
+ }
1573
+ function se(s) {
1574
+ var u = -1, f = s == null ? 0 : s.length;
1575
+ for (this.clear(); ++u < f; ) {
1576
+ var v = s[u];
1577
+ this.set(v[0], v[1]);
1578
+ }
1579
+ }
1580
+ function Oe(s) {
1581
+ var u = -1, f = s == null ? 0 : s.length;
1582
+ for (this.clear(); ++u < f; ) {
1583
+ var v = s[u];
1584
+ this.set(v[0], v[1]);
1585
+ }
1586
+ }
1587
+ function ut(s) {
1588
+ var u = -1, f = s == null ? 0 : s.length;
1589
+ for (this.__data__ = new Oe(); ++u < f; ) this.add(s[u]);
1590
+ }
1591
+ function he(s) {
1592
+ var u = this.__data__ = new se(s);
1593
+ this.size = u.size;
1594
+ }
1595
+ function Zr(s, u) {
1596
+ var f = dt(s), v = !f && to(s), L = !f && !v && qt(s), C = !f && !v && !L && qn(s), A = f || v || L || C, R = A ? function(U, oe) {
1597
+ for (var ue = -1, z = Array(U); ++ue < U; ) z[ue] = oe(ue);
1598
+ return z;
1599
+ }(s.length, String) : [], te = R.length;
1600
+ for (var k in s) !re.call(s, k) || A && (k == "length" || L && (k == "offset" || k == "parent") || C && (k == "buffer" || k == "byteLength" || k == "byteOffset") || eo(k, te)) || R.push(k);
1601
+ return R;
1602
+ }
1603
+ function ct(s, u) {
1604
+ for (var f = s.length; f--; ) if (Jn(s[f][0], u)) return f;
1605
+ return -1;
1606
+ }
1607
+ function je(s) {
1608
+ return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Te && Te in Object(s) ? function(u) {
1609
+ var f = re.call(u, Te), v = u[Te];
1610
+ try {
1611
+ u[Te] = void 0;
1612
+ var L = !0;
1613
+ } catch {
1614
+ }
1615
+ var C = wn.call(u);
1616
+ return L && (f ? u[Te] = v : delete u[Te]), C;
1617
+ }(s) : function(u) {
1618
+ return wn.call(u);
1619
+ }(s);
1620
+ }
1621
+ function jn(s) {
1622
+ return Ve(s) && je(s) == o;
1623
+ }
1624
+ function Vn(s, u, f, v, L) {
1625
+ return s === u || (s == null || u == null || !Ve(s) && !Ve(u) ? s != s && u != u : function(C, A, R, te, k, U) {
1626
+ var oe = dt(C), ue = dt(A), z = oe ? i : ge(C), ce = ue ? i : ge(A), Ae = (z = z == o ? _ : z) == _, pt = (ce = ce == o ? _ : ce) == _, we = z == ce;
1627
+ if (we && qt(C)) {
1628
+ if (!qt(A)) return !1;
1629
+ oe = !0, Ae = !1;
1630
+ }
1631
+ if (we && !Ae) return U || (U = new he()), oe || qn(C) ? Bn(C, A, R, te, k, U) : function(I, S, ft, ye, Ht, Q, le) {
1632
+ switch (ft) {
1633
+ case F:
1634
+ if (I.byteLength != S.byteLength || I.byteOffset != S.byteOffset) return !1;
1635
+ I = I.buffer, S = S.buffer;
1636
+ case V:
1637
+ return !(I.byteLength != S.byteLength || !Q(new Rn(I), new Rn(S)));
1638
+ case a:
1639
+ case l:
1640
+ case p:
1641
+ return Jn(+I, +S);
1642
+ case d:
1643
+ return I.name == S.name && I.message == S.message;
1644
+ case b:
1645
+ case c:
1646
+ return I == S + "";
1647
+ case g:
1648
+ var ve = kr;
1649
+ case w:
1650
+ var Ge = 1 & ye;
1651
+ if (ve || (ve = Ur), I.size != S.size && !Ge) return !1;
1652
+ var ht = le.get(I);
1653
+ if (ht) return ht == S;
1654
+ ye |= 2, le.set(I, S);
1655
+ var Fe = Bn(ve(I), ve(S), ye, Ht, Q, le);
1656
+ return le.delete(I), Fe;
1657
+ case y:
1658
+ if ($t) return $t.call(I) == $t.call(S);
1659
+ }
1660
+ return !1;
1661
+ }(C, A, z, R, te, k, U);
1662
+ if (!(1 & R)) {
1663
+ var Be = Ae && re.call(C, "__wrapped__"), Hn = pt && re.call(A, "__wrapped__");
1664
+ if (Be || Hn) {
1665
+ var ro = Be ? C.value() : C, oo = Hn ? A.value() : A;
1666
+ return U || (U = new he()), k(ro, oo, R, te, U);
1667
+ }
1668
+ }
1669
+ return we ? (U || (U = new he()), function(I, S, ft, ye, Ht, Q) {
1670
+ var le = 1 & ft, ve = Gn(I), Ge = ve.length, ht = Gn(S).length;
1671
+ if (Ge != ht && !le) return !1;
1672
+ for (var Fe = Ge; Fe--; ) {
1673
+ var Ie = ve[Fe];
1674
+ if (!(le ? Ie in S : re.call(S, Ie))) return !1;
1675
+ }
1676
+ var Xn = Q.get(I);
1677
+ if (Xn && Q.get(S)) return Xn == S;
1678
+ var gt = !0;
1679
+ Q.set(I, S), Q.set(S, I);
1680
+ for (var Xt = le; ++Fe < Ge; ) {
1681
+ var yt = I[Ie = ve[Fe]], vt = S[Ie];
1682
+ if (ye) var Zn = le ? ye(vt, yt, Ie, S, I, Q) : ye(yt, vt, Ie, I, S, Q);
1683
+ if (!(Zn === void 0 ? yt === vt || Ht(yt, vt, ft, ye, Q) : Zn)) {
1684
+ gt = !1;
1685
+ break;
1686
+ }
1687
+ Xt || (Xt = Ie == "constructor");
1688
+ }
1689
+ if (gt && !Xt) {
1690
+ var mt = I.constructor, _t = S.constructor;
1691
+ mt == _t || !("constructor" in I) || !("constructor" in S) || typeof mt == "function" && mt instanceof mt && typeof _t == "function" && _t instanceof _t || (gt = !1);
1692
+ }
1693
+ return Q.delete(I), Q.delete(S), gt;
1694
+ }(C, A, R, te, k, U)) : !1;
1695
+ }(s, u, f, v, Vn, L));
1696
+ }
1697
+ function Wr(s) {
1698
+ return !(!$n(s) || function(u) {
1699
+ return !!An && An in u;
1700
+ }(s)) && (zn(s) ? Br : jt).test(Se(s));
1701
+ }
1702
+ function Kr(s) {
1703
+ if (f = (u = s) && u.constructor, v = typeof f == "function" && f.prototype || at, u !== v) return zr(s);
1704
+ var u, f, v, L = [];
1705
+ for (var C in Object(s)) re.call(s, C) && C != "constructor" && L.push(C);
1706
+ return L;
1707
+ }
1708
+ function Bn(s, u, f, v, L, C) {
1709
+ var A = 1 & f, R = s.length, te = u.length;
1710
+ if (R != te && !(A && te > R)) return !1;
1711
+ var k = C.get(s);
1712
+ if (k && C.get(u)) return k == u;
1713
+ var U = -1, oe = !0, ue = 2 & f ? new ut() : void 0;
1714
+ for (C.set(s, u), C.set(u, s); ++U < R; ) {
1715
+ var z = s[U], ce = u[U];
1716
+ if (v) var Ae = A ? v(ce, z, U, u, s, C) : v(z, ce, U, s, u, C);
1717
+ if (Ae !== void 0) {
1718
+ if (Ae) continue;
1719
+ oe = !1;
1720
+ break;
1721
+ }
1722
+ if (ue) {
1723
+ if (!Dr(u, function(pt, we) {
1724
+ if (Be = we, !ue.has(Be) && (z === pt || L(z, pt, f, v, C))) return ue.push(we);
1725
+ var Be;
1726
+ })) {
1727
+ oe = !1;
1728
+ break;
1729
+ }
1730
+ } else if (z !== ce && !L(z, ce, f, v, C)) {
1731
+ oe = !1;
1732
+ break;
1733
+ }
1734
+ }
1735
+ return C.delete(s), C.delete(u), oe;
1736
+ }
1737
+ function Gn(s) {
1738
+ return function(u, f, v) {
1739
+ var L = f(u);
1740
+ return dt(u) ? L : function(C, A) {
1741
+ for (var R = -1, te = A.length, k = C.length; ++R < te; ) C[k + R] = A[R];
1742
+ return C;
1743
+ }(L, v(u));
1744
+ }(s, no, Qr);
1745
+ }
1746
+ function lt(s, u) {
1747
+ var f, v, L = s.__data__;
1748
+ return ((v = typeof (f = u)) == "string" || v == "number" || v == "symbol" || v == "boolean" ? f !== "__proto__" : f === null) ? L[typeof u == "string" ? "string" : "hash"] : L.map;
1749
+ }
1750
+ function Pe(s, u) {
1751
+ var f = function(v, L) {
1752
+ return v?.[L];
1753
+ }(s, u);
1754
+ return Wr(f) ? f : void 0;
1755
+ }
1756
+ Ce.prototype.clear = function() {
1757
+ this.__data__ = Ue ? Ue(null) : {}, this.size = 0;
1758
+ }, Ce.prototype.delete = function(s) {
1759
+ var u = this.has(s) && delete this.__data__[s];
1760
+ return this.size -= u ? 1 : 0, u;
1761
+ }, Ce.prototype.get = function(s) {
1762
+ var u = this.__data__;
1763
+ if (Ue) {
1764
+ var f = u[s];
1765
+ return f === n ? void 0 : f;
1766
+ }
1767
+ return re.call(u, s) ? u[s] : void 0;
1768
+ }, Ce.prototype.has = function(s) {
1769
+ var u = this.__data__;
1770
+ return Ue ? u[s] !== void 0 : re.call(u, s);
1771
+ }, Ce.prototype.set = function(s, u) {
1772
+ var f = this.__data__;
1773
+ return this.size += this.has(s) ? 0 : 1, f[s] = Ue && u === void 0 ? n : u, this;
1774
+ }, se.prototype.clear = function() {
1775
+ this.__data__ = [], this.size = 0;
1776
+ }, se.prototype.delete = function(s) {
1777
+ var u = this.__data__, f = ct(u, s);
1778
+ return !(f < 0) && (f == u.length - 1 ? u.pop() : Gr.call(u, f, 1), --this.size, !0);
1779
+ }, se.prototype.get = function(s) {
1780
+ var u = this.__data__, f = ct(u, s);
1781
+ return f < 0 ? void 0 : u[f][1];
1782
+ }, se.prototype.has = function(s) {
1783
+ return ct(this.__data__, s) > -1;
1784
+ }, se.prototype.set = function(s, u) {
1785
+ var f = this.__data__, v = ct(f, s);
1786
+ return v < 0 ? (++this.size, f.push([s, u])) : f[v][1] = u, this;
1787
+ }, Oe.prototype.clear = function() {
1788
+ this.size = 0, this.__data__ = { hash: new Ce(), map: new (ke || se)(), string: new Ce() };
1789
+ }, Oe.prototype.delete = function(s) {
1790
+ var u = lt(this, s).delete(s);
1791
+ return this.size -= u ? 1 : 0, u;
1792
+ }, Oe.prototype.get = function(s) {
1793
+ return lt(this, s).get(s);
1794
+ }, Oe.prototype.has = function(s) {
1795
+ return lt(this, s).has(s);
1796
+ }, Oe.prototype.set = function(s, u) {
1797
+ var f = lt(this, s), v = f.size;
1798
+ return f.set(s, u), this.size += f.size == v ? 0 : 1, this;
1799
+ }, ut.prototype.add = ut.prototype.push = function(s) {
1800
+ return this.__data__.set(s, n), this;
1801
+ }, ut.prototype.has = function(s) {
1802
+ return this.__data__.has(s);
1803
+ }, he.prototype.clear = function() {
1804
+ this.__data__ = new se(), this.size = 0;
1805
+ }, he.prototype.delete = function(s) {
1806
+ var u = this.__data__, f = u.delete(s);
1807
+ return this.size = u.size, f;
1808
+ }, he.prototype.get = function(s) {
1809
+ return this.__data__.get(s);
1810
+ }, he.prototype.has = function(s) {
1811
+ return this.__data__.has(s);
1812
+ }, he.prototype.set = function(s, u) {
1813
+ var f = this.__data__;
1814
+ if (f instanceof se) {
1815
+ var v = f.__data__;
1816
+ if (!ke || v.length < 199) return v.push([s, u]), this.size = ++f.size, this;
1817
+ f = this.__data__ = new Oe(v);
1818
+ }
1819
+ return f.set(s, u), this.size = f.size, this;
1820
+ };
1821
+ var Qr = kn ? function(s) {
1822
+ return s == null ? [] : (s = Object(s), function(u, f) {
1823
+ for (var v = -1, L = u == null ? 0 : u.length, C = 0, A = []; ++v < L; ) {
1824
+ var R = u[v];
1825
+ f(R, v, u) && (A[C++] = R);
1826
+ }
1827
+ return A;
1828
+ }(kn(s), function(u) {
1829
+ return Dn.call(s, u);
1830
+ }));
1831
+ } : function() {
1832
+ return [];
1833
+ }, ge = je;
1834
+ function eo(s, u) {
1835
+ return !!(u = u ?? r) && (typeof s == "number" || Fr.test(s)) && s > -1 && s % 1 == 0 && s < u;
1836
+ }
1837
+ function Se(s) {
1838
+ if (s != null) {
1839
+ try {
1840
+ return Pn.call(s);
1841
+ } catch {
1842
+ }
1843
+ try {
1844
+ return s + "";
1845
+ } catch {
1846
+ }
1847
+ }
1848
+ return "";
1849
+ }
1850
+ function Jn(s, u) {
1851
+ return s === u || s != s && u != u;
1852
+ }
1853
+ (Gt && ge(new Gt(new ArrayBuffer(1))) != F || ke && ge(new ke()) != g || Jt && ge(Jt.resolve()) != P || zt && ge(new zt()) != w || Yt && ge(new Yt()) != O) && (ge = function(s) {
1854
+ var u = je(s), f = u == _ ? s.constructor : void 0, v = f ? Se(f) : "";
1855
+ if (v) switch (v) {
1856
+ case Yr:
1857
+ return F;
1858
+ case $r:
1859
+ return g;
1860
+ case qr:
1861
+ return P;
1862
+ case Hr:
1863
+ return w;
1864
+ case Xr:
1865
+ return O;
1866
+ }
1867
+ return u;
1868
+ });
1869
+ var to = jn(/* @__PURE__ */ function() {
1870
+ return arguments;
1871
+ }()) ? jn : function(s) {
1872
+ return Ve(s) && re.call(s, "callee") && !Dn.call(s, "callee");
1873
+ }, dt = Array.isArray, qt = Jr || function() {
1874
+ return !1;
1875
+ };
1876
+ function zn(s) {
1877
+ if (!$n(s)) return !1;
1878
+ var u = je(s);
1879
+ return u == h || u == "[object GeneratorFunction]" || u == "[object AsyncFunction]" || u == "[object Proxy]";
1880
+ }
1881
+ function Yn(s) {
1882
+ return typeof s == "number" && s > -1 && s % 1 == 0 && s <= r;
1883
+ }
1884
+ function $n(s) {
1885
+ var u = typeof s;
1886
+ return s != null && (u == "object" || u == "function");
1887
+ }
1888
+ function Ve(s) {
1889
+ return s != null && typeof s == "object";
1890
+ }
1891
+ var qn = xn ? /* @__PURE__ */ function(s) {
1892
+ return function(u) {
1893
+ return s(u);
1894
+ };
1895
+ }(xn) : function(s) {
1896
+ return Ve(s) && Yn(s.length) && !!M[je(s)];
1897
+ };
1898
+ function no(s) {
1899
+ return (u = s) != null && Yn(u.length) && !zn(u) ? Zr(s) : Kr(s);
1900
+ var u;
1901
+ }
1902
+ e.exports = function(s, u) {
1903
+ return Vn(s, u);
1904
+ };
1905
+ })(Ut, Ut.exports);
1906
+ var bn = de(Ut.exports);
1907
+ function En(e, t) {
1908
+ return e.length === t.length && JSON.stringify(e.map(function(n) {
1909
+ return n;
1910
+ }).sort()) === JSON.stringify(t.map(function(n) {
1911
+ return n;
1912
+ }).sort());
1913
+ }
1914
+ var Pr = { Polygon: W, LineString: ie, Point: me, MultiPolygon: $, MultiLineString: $, MultiPoint: $ }, Ar = Object.freeze({ __proto__: null, CommonSelectors: pr, constrainFeatureMovement: Dt, createMidPoint: cn, createSupplementaryPoints: We, createVertex: Le, doubleClickZoom: ee, euclideanDistance: xt, featuresAt: xe, getFeatureAtAndSetCursors: ze, isClick: Mt, isEventAtCoordinates: ot, isTap: Lt, mapEventToBoundingBox: tn, ModeHandler: Je, moveFeatures: kt, sortFeatures: en, stringSetsAreEqual: En, StringSet: Z, theme: sn, toDenseArray: Re }), wr = function(e, t) {
1915
+ var n = { options: e = function(o) {
1916
+ o === void 0 && (o = {});
1917
+ var i = pe(o);
1918
+ return o.controls || (i.controls = {}), o.displayControlsDefault === !1 ? i.controls = pe(Nr, o.controls) : i.controls = pe(Lr, o.controls), (i = pe(Mr, i)).styles = _n(i.styles, "cold").concat(_n(i.styles, "hot")), i;
1919
+ }(e) };
1920
+ t = function(o, i) {
1921
+ return i.modes = T, i.getFeatureIdsAt = function(a) {
1922
+ return xe.click({ point: a }, null, o).map(function(l) {
1923
+ return l.properties.id;
1924
+ });
1925
+ }, i.getSelectedIds = function() {
1926
+ return o.store.getSelectedIds();
1927
+ }, i.getSelected = function() {
1928
+ return { type: m.FEATURE_COLLECTION, features: o.store.getSelectedIds().map(function(a) {
1929
+ return o.store.get(a);
1930
+ }).map(function(a) {
1931
+ return a.toGeoJSON();
1932
+ }) };
1933
+ }, i.getSelectedPoints = function() {
1934
+ return { type: m.FEATURE_COLLECTION, features: o.store.getSelectedCoordinates().map(function(a) {
1935
+ return { type: m.FEATURE, properties: {}, geometry: { type: m.POINT, coordinates: a.coordinates } };
1936
+ }) };
1937
+ }, i.set = function(a) {
1938
+ if (a.type === void 0 || a.type !== m.FEATURE_COLLECTION || !Array.isArray(a.features)) throw new Error("Invalid FeatureCollection");
1939
+ var l = o.store.createRenderBatch(), d = o.store.getAllIds().slice(), h = i.add(a), g = new Z(h);
1940
+ return (d = d.filter(function(p) {
1941
+ return !g.has(p);
1942
+ })).length && i.delete(d), l(), h;
1943
+ }, i.add = function(a) {
1944
+ var l = JSON.parse(JSON.stringify(yr(a))).features.map(function(d) {
1945
+ if (d.id = d.id || Pt(), d.geometry === null) throw new Error("Invalid geometry: null");
1946
+ if (o.store.get(d.id) === void 0 || o.store.get(d.id).type !== d.geometry.type) {
1947
+ var h = Pr[d.geometry.type];
1948
+ if (h === void 0) throw new Error("Invalid geometry type: " + d.geometry.type + ".");
1949
+ var g = new h(o, d);
1950
+ o.store.add(g);
1951
+ } else {
1952
+ var p = o.store.get(d.id);
1953
+ p.properties = d.properties, bn(p.properties, d.properties) || o.store.featureChanged(p.id), bn(p.getCoordinates(), d.geometry.coordinates) || p.incomingCoords(d.geometry.coordinates);
1954
+ }
1955
+ return d.id;
1956
+ });
1957
+ return o.store.render(), l;
1958
+ }, i.get = function(a) {
1959
+ var l = o.store.get(a);
1960
+ if (l) return l.toGeoJSON();
1961
+ }, i.getAll = function() {
1962
+ return { type: m.FEATURE_COLLECTION, features: o.store.getAll().map(function(a) {
1963
+ return a.toGeoJSON();
1964
+ }) };
1965
+ }, i.delete = function(a) {
1966
+ return o.store.delete(a, { silent: !0 }), i.getMode() !== T.DIRECT_SELECT || o.store.getSelectedIds().length ? o.store.render() : o.events.changeMode(T.SIMPLE_SELECT, void 0, { silent: !0 }), i;
1967
+ }, i.deleteAll = function() {
1968
+ return o.store.delete(o.store.getAllIds(), { silent: !0 }), i.getMode() === T.DIRECT_SELECT ? o.events.changeMode(T.SIMPLE_SELECT, void 0, { silent: !0 }) : o.store.render(), i;
1969
+ }, i.changeMode = function(a, l) {
1970
+ return l === void 0 && (l = {}), a === T.SIMPLE_SELECT && i.getMode() === T.SIMPLE_SELECT ? (En(l.featureIds || [], o.store.getSelectedIds()) || (o.store.setSelected(l.featureIds, { silent: !0 }), o.store.render()), i) : (a === T.DIRECT_SELECT && i.getMode() === T.DIRECT_SELECT && l.featureId === o.store.getSelectedIds()[0] || o.events.changeMode(a, l, { silent: !0 }), i);
1971
+ }, i.getMode = function() {
1972
+ return o.events.getMode();
1973
+ }, i.trash = function() {
1974
+ return o.events.trash({ silent: !0 }), i;
1975
+ }, i.combineFeatures = function() {
1976
+ return o.events.combineFeatures({ silent: !0 }), i;
1977
+ }, i.uncombineFeatures = function() {
1978
+ return o.events.uncombineFeatures({ silent: !0 }), i;
1979
+ }, i.setFeatureProperty = function(a, l, d) {
1980
+ return o.store.setFeatureProperty(a, l, d), i;
1981
+ }, i;
1982
+ }(n, t), n.api = t;
1983
+ var r = dr(n);
1984
+ return t.onAdd = r.onAdd, t.onRemove = r.onRemove, t.types = Y, t.options = e, t;
1985
+ };
1986
+ function it(e) {
1987
+ wr(e, this);
1988
+ }
1989
+ return it.modes = mn, it.constants = tr, it.lib = Ar, it;
1990
+ });
1991
+ }(Et), Et.exports);
1992
+ }
2
1993
  export {
3
- e as __module
1994
+ co as __require
4
1995
  };
5
1996
  //# sourceMappingURL=index.es77.js.map