@maptiler/geocoding-control 1.4.2-dev.3 → 2.0.0-rc.1

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 (72) hide show
  1. package/MapLibreBasedGeocodingControl.d.ts +2971 -35
  2. package/leaflet-controller.d.ts +1 -1
  3. package/leaflet-controller.js +580 -569
  4. package/leaflet-controller.js.map +1 -1
  5. package/leaflet-controller.umd.js +3 -3
  6. package/leaflet-controller.umd.js.map +1 -1
  7. package/leaflet.d.ts +74 -16
  8. package/leaflet.js +1375 -1344
  9. package/leaflet.js.map +1 -1
  10. package/leaflet.umd.js +3 -3
  11. package/leaflet.umd.js.map +1 -1
  12. package/maplibregl-controller.d.ts +7 -7
  13. package/maplibregl-controller.js +683 -661
  14. package/maplibregl-controller.js.map +1 -1
  15. package/maplibregl-controller.umd.js +3 -3
  16. package/maplibregl-controller.umd.js.map +1 -1
  17. package/maplibregl.js +1596 -1447
  18. package/maplibregl.js.map +1 -1
  19. package/maplibregl.umd.js +3 -3
  20. package/maplibregl.umd.js.map +1 -1
  21. package/maptilersdk.js +1604 -1452
  22. package/maptilersdk.js.map +1 -1
  23. package/maptilersdk.umd.js +3 -3
  24. package/maptilersdk.umd.js.map +1 -1
  25. package/openlayers-controller.d.ts +1 -1
  26. package/openlayers-controller.js +308 -306
  27. package/openlayers-controller.js.map +1 -1
  28. package/openlayers-controller.umd.js +3 -3
  29. package/openlayers-controller.umd.js.map +1 -1
  30. package/openlayers.d.ts +21 -0
  31. package/openlayers.js +1352 -1366
  32. package/openlayers.js.map +1 -1
  33. package/openlayers.umd.js +3 -3
  34. package/openlayers.umd.js.map +1 -1
  35. package/package.json +18 -18
  36. package/react.d.ts +4 -4
  37. package/react.js +805 -788
  38. package/react.js.map +1 -1
  39. package/react.umd.js +1 -1
  40. package/react.umd.js.map +1 -1
  41. package/style.css +1 -1
  42. package/svelte/FeatureItem.svelte.d.ts +1 -1
  43. package/svelte/GeocodingControl.svelte +61 -32
  44. package/svelte/GeocodingControl.svelte.d.ts +24 -9
  45. package/svelte/MapLibreBasedGeocodingControl.d.ts +2971 -35
  46. package/svelte/MapLibreBasedGeocodingControl.js +166 -58
  47. package/svelte/leaflet-controller.d.ts +1 -1
  48. package/svelte/leaflet-controller.js +50 -24
  49. package/svelte/leaflet.d.ts +74 -16
  50. package/svelte/leaflet.js +25 -15
  51. package/svelte/maplibregl-controller.d.ts +7 -7
  52. package/svelte/maplibregl-controller.js +96 -66
  53. package/svelte/maplibregl.js +10 -7
  54. package/svelte/maptilersdk.js +23 -18
  55. package/svelte/openlayers-controller.d.ts +1 -1
  56. package/svelte/openlayers-controller.js +4 -1
  57. package/svelte/openlayers.d.ts +21 -0
  58. package/svelte/openlayers.js +30 -45
  59. package/svelte/react.d.ts +4 -4
  60. package/svelte/types.d.ts +32 -12
  61. package/svelte/vanilla.d.ts +14 -1
  62. package/svelte/vanilla.js +31 -8
  63. package/types.d.ts +32 -12
  64. package/vanilla.d.ts +14 -1
  65. package/vanilla.js +849 -804
  66. package/vanilla.js.map +1 -1
  67. package/vanilla.umd.js +1 -1
  68. package/vanilla.umd.js.map +1 -1
  69. package/maplibregl.d.ts +0 -16
  70. package/maptilersdk.d.ts +0 -11
  71. package/svelte/maplibregl.d.ts +0 -16
  72. package/svelte/maptilersdk.d.ts +0 -11
@@ -1,11 +1,11 @@
1
- var Jt = Object.defineProperty;
2
- var Kt = (i, t, e) => t in i ? Jt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var it = (i, t, e) => Kt(i, typeof t != "symbol" ? t + "" : t, e);
4
- function V(i, t, e = {}) {
1
+ var te = Object.defineProperty;
2
+ var ee = (i, t, e) => t in i ? te(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var rt = (i, t, e) => ee(i, typeof t != "symbol" ? t + "" : t, e);
4
+ function X(i, t, e = {}) {
5
5
  const n = { type: "Feature" };
6
6
  return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = i, n;
7
7
  }
8
- function pt(i, t, e = {}) {
8
+ function yt(i, t, e = {}) {
9
9
  for (const r of i) {
10
10
  if (r.length < 4)
11
11
  throw new Error(
@@ -17,17 +17,17 @@ function pt(i, t, e = {}) {
17
17
  if (r[r.length - 1][o] !== r[0][o])
18
18
  throw new Error("First and last Position are not equivalent.");
19
19
  }
20
- return V({
20
+ return X({
21
21
  type: "Polygon",
22
22
  coordinates: i
23
23
  }, t, e);
24
24
  }
25
- function Z(i, t = {}) {
25
+ function V(i, t = {}) {
26
26
  const e = { type: "FeatureCollection" };
27
27
  return t.id && (e.id = t.id), t.bbox && (e.bbox = t.bbox), e.features = i, e;
28
28
  }
29
- function Ft(i, t, e = {}) {
30
- return V({
29
+ function jt(i, t, e = {}) {
30
+ return X({
31
31
  type: "MultiPolygon",
32
32
  coordinates: i
33
33
  }, t, e);
@@ -54,67 +54,67 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
54
54
  See the Apache Version 2.0 License for specific language governing permissions
55
55
  and limitations under the License.
56
56
  ***************************************************************************** */
57
- function Ht(i, t) {
57
+ function ne(i, t) {
58
58
  var e = { label: 0, sent: function() {
59
59
  if (o[0] & 1) throw o[1];
60
60
  return o[1];
61
- }, trys: [], ops: [] }, n, r, o, u;
62
- return u = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
61
+ }, trys: [], ops: [] }, n, r, o, f;
62
+ return f = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (f[Symbol.iterator] = function() {
63
63
  return this;
64
- }), u;
65
- function s(f) {
66
- return function(g) {
67
- return c([f, g]);
64
+ }), f;
65
+ function l(u) {
66
+ return function(p) {
67
+ return c([u, p]);
68
68
  };
69
69
  }
70
- function c(f) {
70
+ function c(u) {
71
71
  if (n) throw new TypeError("Generator is already executing.");
72
72
  for (; e; ) try {
73
- if (n = 1, r && (o = f[0] & 2 ? r.return : f[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, f[1])).done) return o;
74
- switch (r = 0, o && (f = [f[0] & 2, o.value]), f[0]) {
73
+ if (n = 1, r && (o = u[0] & 2 ? r.return : u[0] ? r.throw || ((o = r.return) && o.call(r), 0) : r.next) && !(o = o.call(r, u[1])).done) return o;
74
+ switch (r = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
75
75
  case 0:
76
76
  case 1:
77
- o = f;
77
+ o = u;
78
78
  break;
79
79
  case 4:
80
- return e.label++, { value: f[1], done: !1 };
80
+ return e.label++, { value: u[1], done: !1 };
81
81
  case 5:
82
- e.label++, r = f[1], f = [0];
82
+ e.label++, r = u[1], u = [0];
83
83
  continue;
84
84
  case 7:
85
- f = e.ops.pop(), e.trys.pop();
85
+ u = e.ops.pop(), e.trys.pop();
86
86
  continue;
87
87
  default:
88
- if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (f[0] === 6 || f[0] === 2)) {
88
+ if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (u[0] === 6 || u[0] === 2)) {
89
89
  e = 0;
90
90
  continue;
91
91
  }
92
- if (f[0] === 3 && (!o || f[1] > o[0] && f[1] < o[3])) {
93
- e.label = f[1];
92
+ if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
93
+ e.label = u[1];
94
94
  break;
95
95
  }
96
- if (f[0] === 6 && e.label < o[1]) {
97
- e.label = o[1], o = f;
96
+ if (u[0] === 6 && e.label < o[1]) {
97
+ e.label = o[1], o = u;
98
98
  break;
99
99
  }
100
100
  if (o && e.label < o[2]) {
101
- e.label = o[2], e.ops.push(f);
101
+ e.label = o[2], e.ops.push(u);
102
102
  break;
103
103
  }
104
104
  o[2] && e.ops.pop(), e.trys.pop();
105
105
  continue;
106
106
  }
107
- f = t.call(i, e);
108
- } catch (g) {
109
- f = [6, g], r = 0;
107
+ u = t.call(i, e);
108
+ } catch (p) {
109
+ u = [6, p], r = 0;
110
110
  } finally {
111
111
  n = o = 0;
112
112
  }
113
- if (f[0] & 5) throw f[1];
114
- return { value: f[0] ? f[1] : void 0, done: !0 };
113
+ if (u[0] & 5) throw u[1];
114
+ return { value: u[0] ? u[1] : void 0, done: !0 };
115
115
  }
116
116
  }
117
- var F = (
117
+ var G = (
118
118
  /** @class */
119
119
  /* @__PURE__ */ function() {
120
120
  function i(t, e) {
@@ -123,27 +123,27 @@ var F = (
123
123
  return i;
124
124
  }()
125
125
  );
126
- function te(i, t) {
126
+ function ie(i, t) {
127
127
  return i > t ? 1 : i < t ? -1 : 0;
128
128
  }
129
129
  function B(i, t, e) {
130
- for (var n = new F(null, null), r = n, o = n; ; ) {
131
- var u = e(i, t.key);
132
- if (u < 0) {
130
+ for (var n = new G(null, null), r = n, o = n; ; ) {
131
+ var f = e(i, t.key);
132
+ if (f < 0) {
133
133
  if (t.left === null)
134
134
  break;
135
135
  if (e(i, t.left.key) < 0) {
136
- var s = t.left;
137
- if (t.left = s.right, s.right = t, t = s, t.left === null)
136
+ var l = t.left;
137
+ if (t.left = l.right, l.right = t, t = l, t.left === null)
138
138
  break;
139
139
  }
140
140
  o.left = t, o = t, t = t.left;
141
- } else if (u > 0) {
141
+ } else if (f > 0) {
142
142
  if (t.right === null)
143
143
  break;
144
144
  if (e(i, t.right.key) > 0) {
145
- var s = t.right;
146
- if (t.right = s.left, s.left = t, t = s, t.right === null)
145
+ var l = t.right;
146
+ if (t.right = l.left, l.left = t, t = l, t.right === null)
147
147
  break;
148
148
  }
149
149
  r.right = t, r = t, t = t.right;
@@ -152,15 +152,15 @@ function B(i, t, e) {
152
152
  }
153
153
  return r.right = t.left, o.left = t.right, t.left = n.right, t.right = n.left, t;
154
154
  }
155
- function rt(i, t, e, n) {
156
- var r = new F(i, t);
155
+ function ot(i, t, e, n) {
156
+ var r = new G(i, t);
157
157
  if (e === null)
158
158
  return r.left = r.right = null, r;
159
159
  e = B(i, e, n);
160
160
  var o = n(i, e.key);
161
161
  return o < 0 ? (r.left = e.left, r.right = e, e.left = null) : o >= 0 && (r.right = e.right, r.left = e, e.right = null), r;
162
162
  }
163
- function vt(i, t, e) {
163
+ function Et(i, t, e) {
164
164
  var n = null, r = null;
165
165
  if (t) {
166
166
  t = B(i, t, e);
@@ -169,30 +169,30 @@ function vt(i, t, e) {
169
169
  }
170
170
  return { left: n, right: r };
171
171
  }
172
- function ee(i, t, e) {
172
+ function re(i, t, e) {
173
173
  return t === null ? i : (i === null || (t = B(i.key, t, e), t.left = i), t);
174
174
  }
175
- function lt(i, t, e, n, r) {
175
+ function ut(i, t, e, n, r) {
176
176
  if (i) {
177
177
  n("" + t + (e ? "└── " : "├── ") + r(i) + `
178
178
  `);
179
179
  var o = t + (e ? " " : "│ ");
180
- i.left && lt(i.left, o, !1, n, r), i.right && lt(i.right, o, !0, n, r);
180
+ i.left && ut(i.left, o, !1, n, r), i.right && ut(i.right, o, !0, n, r);
181
181
  }
182
182
  }
183
- var yt = (
183
+ var dt = (
184
184
  /** @class */
185
185
  function() {
186
186
  function i(t) {
187
- t === void 0 && (t = te), this._root = null, this._size = 0, this._comparator = t;
187
+ t === void 0 && (t = ie), this._root = null, this._size = 0, this._comparator = t;
188
188
  }
189
189
  return i.prototype.insert = function(t, e) {
190
- return this._size++, this._root = rt(t, e, this._root, this._comparator);
190
+ return this._size++, this._root = ot(t, e, this._root, this._comparator);
191
191
  }, i.prototype.add = function(t, e) {
192
- var n = new F(t, e);
192
+ var n = new G(t, e);
193
193
  this._root === null && (n.left = n.right = null, this._size++, this._root = n);
194
- var r = this._comparator, o = B(t, this._root, r), u = r(t, o.key);
195
- return u === 0 ? this._root = o : (u < 0 ? (n.left = o.left, n.right = o, o.left = null) : u > 0 && (n.right = o.right, n.left = o, o.right = null), this._size++, this._root = n), this._root;
194
+ var r = this._comparator, o = B(t, this._root, r), f = r(t, o.key);
195
+ return f === 0 ? this._root = o : (f < 0 ? (n.left = o.left, n.right = o, o.left = null) : f > 0 && (n.right = o.right, n.left = o, o.right = null), this._size++, this._root = n), this._root;
196
196
  }, i.prototype.remove = function(t) {
197
197
  this._root = this._remove(t, this._root, this._comparator);
198
198
  }, i.prototype._remove = function(t, e, n) {
@@ -233,15 +233,15 @@ var yt = (
233
233
  n !== null ? (r.push(n), n = n.left) : r.length !== 0 ? (n = r.pop(), t.call(e, n), n = n.right) : o = !0;
234
234
  return this;
235
235
  }, i.prototype.range = function(t, e, n, r) {
236
- for (var o = [], u = this._comparator, s = this._root, c; o.length !== 0 || s; )
237
- if (s)
238
- o.push(s), s = s.left;
236
+ for (var o = [], f = this._comparator, l = this._root, c; o.length !== 0 || l; )
237
+ if (l)
238
+ o.push(l), l = l.left;
239
239
  else {
240
- if (s = o.pop(), c = u(s.key, e), c > 0)
240
+ if (l = o.pop(), c = f(l.key, e), c > 0)
241
241
  break;
242
- if (u(s.key, t) >= 0 && n.call(r, s))
242
+ if (f(l.key, t) >= 0 && n.call(r, l))
243
243
  return this;
244
- s = s.right;
244
+ l = l.right;
245
245
  }
246
246
  return this;
247
247
  }, i.prototype.keys = function() {
@@ -312,15 +312,15 @@ var yt = (
312
312
  }, i.prototype.clear = function() {
313
313
  return this._root = null, this._size = 0, this;
314
314
  }, i.prototype.toList = function() {
315
- return ie(this._root);
315
+ return se(this._root);
316
316
  }, i.prototype.load = function(t, e, n) {
317
317
  e === void 0 && (e = []), n === void 0 && (n = !1);
318
318
  var r = t.length, o = this._comparator;
319
- if (n && ct(t, e, 0, r - 1, o), this._root === null)
320
- this._root = ut(t, e, 0, r), this._size = r;
319
+ if (n && ht(t, e, 0, r - 1, o), this._root === null)
320
+ this._root = ft(t, e, 0, r), this._size = r;
321
321
  else {
322
- var u = re(this.toList(), ne(t, e), o);
323
- r = this._size + r, this._root = ft({ head: u }, 0, r);
322
+ var f = le(this.toList(), oe(t, e), o);
323
+ r = this._size + r, this._root = ct({ head: f }, 0, r);
324
324
  }
325
325
  return this;
326
326
  }, i.prototype.isEmpty = function() {
@@ -342,17 +342,17 @@ var yt = (
342
342
  return String(n.key);
343
343
  });
344
344
  var e = [];
345
- return lt(this._root, "", !0, function(n) {
345
+ return ut(this._root, "", !0, function(n) {
346
346
  return e.push(n);
347
347
  }, t), e.join("");
348
348
  }, i.prototype.update = function(t, e, n) {
349
- var r = this._comparator, o = vt(t, this._root, r), u = o.left, s = o.right;
350
- r(t, e) < 0 ? s = rt(e, n, s, r) : u = rt(e, n, u, r), this._root = ee(u, s, r);
349
+ var r = this._comparator, o = Et(t, this._root, r), f = o.left, l = o.right;
350
+ r(t, e) < 0 ? l = ot(e, n, l, r) : f = ot(e, n, f, r), this._root = re(f, l, r);
351
351
  }, i.prototype.split = function(t) {
352
- return vt(t, this._root, this._comparator);
352
+ return Et(t, this._root, this._comparator);
353
353
  }, i.prototype[Symbol.iterator] = function() {
354
354
  var t, e, n;
355
- return Ht(this, function(r) {
355
+ return ne(this, function(r) {
356
356
  switch (r.label) {
357
357
  case 0:
358
358
  t = this._root, e = [], n = !1, r.label = 1;
@@ -376,69 +376,69 @@ var yt = (
376
376
  }, i;
377
377
  }()
378
378
  );
379
- function ut(i, t, e, n) {
379
+ function ft(i, t, e, n) {
380
380
  var r = n - e;
381
381
  if (r > 0) {
382
- var o = e + Math.floor(r / 2), u = i[o], s = t[o], c = new F(u, s);
383
- return c.left = ut(i, t, e, o), c.right = ut(i, t, o + 1, n), c;
382
+ var o = e + Math.floor(r / 2), f = i[o], l = t[o], c = new G(f, l);
383
+ return c.left = ft(i, t, e, o), c.right = ft(i, t, o + 1, n), c;
384
384
  }
385
385
  return null;
386
386
  }
387
- function ne(i, t) {
388
- for (var e = new F(null, null), n = e, r = 0; r < i.length; r++)
389
- n = n.next = new F(i[r], t[r]);
387
+ function oe(i, t) {
388
+ for (var e = new G(null, null), n = e, r = 0; r < i.length; r++)
389
+ n = n.next = new G(i[r], t[r]);
390
390
  return n.next = null, e.next;
391
391
  }
392
- function ie(i) {
393
- for (var t = i, e = [], n = !1, r = new F(null, null), o = r; !n; )
392
+ function se(i) {
393
+ for (var t = i, e = [], n = !1, r = new G(null, null), o = r; !n; )
394
394
  t ? (e.push(t), t = t.left) : e.length > 0 ? (t = o = o.next = e.pop(), t = t.right) : n = !0;
395
395
  return o.next = null, r.next;
396
396
  }
397
- function ft(i, t, e) {
397
+ function ct(i, t, e) {
398
398
  var n = e - t;
399
399
  if (n > 0) {
400
- var r = t + Math.floor(n / 2), o = ft(i, t, r), u = i.head;
401
- return u.left = o, i.head = i.head.next, u.right = ft(i, r + 1, e), u;
400
+ var r = t + Math.floor(n / 2), o = ct(i, t, r), f = i.head;
401
+ return f.left = o, i.head = i.head.next, f.right = ct(i, r + 1, e), f;
402
402
  }
403
403
  return null;
404
404
  }
405
- function re(i, t, e) {
406
- for (var n = new F(null, null), r = n, o = i, u = t; o !== null && u !== null; )
407
- e(o.key, u.key) < 0 ? (r.next = o, o = o.next) : (r.next = u, u = u.next), r = r.next;
408
- return o !== null ? r.next = o : u !== null && (r.next = u), n.next;
405
+ function le(i, t, e) {
406
+ for (var n = new G(null, null), r = n, o = i, f = t; o !== null && f !== null; )
407
+ e(o.key, f.key) < 0 ? (r.next = o, o = o.next) : (r.next = f, f = f.next), r = r.next;
408
+ return o !== null ? r.next = o : f !== null && (r.next = f), n.next;
409
409
  }
410
- function ct(i, t, e, n, r) {
410
+ function ht(i, t, e, n, r) {
411
411
  if (!(e >= n)) {
412
- for (var o = i[e + n >> 1], u = e - 1, s = n + 1; ; ) {
412
+ for (var o = i[e + n >> 1], f = e - 1, l = n + 1; ; ) {
413
413
  do
414
- u++;
415
- while (r(i[u], o) < 0);
414
+ f++;
415
+ while (r(i[f], o) < 0);
416
416
  do
417
- s--;
418
- while (r(i[s], o) > 0);
419
- if (u >= s)
417
+ l--;
418
+ while (r(i[l], o) > 0);
419
+ if (f >= l)
420
420
  break;
421
- var c = i[u];
422
- i[u] = i[s], i[s] = c, c = t[u], t[u] = t[s], t[s] = c;
421
+ var c = i[f];
422
+ i[f] = i[l], i[l] = c, c = t[f], t[f] = t[l], t[l] = c;
423
423
  }
424
- ct(i, t, e, s, r), ct(i, t, s + 1, n, r);
425
- }
426
- }
427
- const O = 11102230246251565e-32, S = 134217729, oe = (3 + 8 * O) * O;
428
- function ot(i, t, e, n, r) {
429
- let o, u, s, c, f = t[0], g = n[0], l = 0, h = 0;
430
- g > f == g > -f ? (o = f, f = t[++l]) : (o = g, g = n[++h]);
431
- let a = 0;
432
- if (l < i && h < e)
433
- for (g > f == g > -f ? (u = f + o, s = o - (u - f), f = t[++l]) : (u = g + o, s = o - (u - g), g = n[++h]), o = u, s !== 0 && (r[a++] = s); l < i && h < e; )
434
- g > f == g > -f ? (u = o + f, c = u - o, s = o - (u - c) + (f - c), f = t[++l]) : (u = o + g, c = u - o, s = o - (u - c) + (g - c), g = n[++h]), o = u, s !== 0 && (r[a++] = s);
435
- for (; l < i; )
436
- u = o + f, c = u - o, s = o - (u - c) + (f - c), f = t[++l], o = u, s !== 0 && (r[a++] = s);
424
+ ht(i, t, e, l, r), ht(i, t, l + 1, n, r);
425
+ }
426
+ }
427
+ const O = 11102230246251565e-32, S = 134217729, ue = (3 + 8 * O) * O;
428
+ function st(i, t, e, n, r) {
429
+ let o, f, l, c, u = t[0], p = n[0], s = 0, h = 0;
430
+ p > u == p > -u ? (o = u, u = t[++s]) : (o = p, p = n[++h]);
431
+ let g = 0;
432
+ if (s < i && h < e)
433
+ for (p > u == p > -u ? (f = u + o, l = o - (f - u), u = t[++s]) : (f = p + o, l = o - (f - p), p = n[++h]), o = f, l !== 0 && (r[g++] = l); s < i && h < e; )
434
+ p > u == p > -u ? (f = o + u, c = f - o, l = o - (f - c) + (u - c), u = t[++s]) : (f = o + p, c = f - o, l = o - (f - c) + (p - c), p = n[++h]), o = f, l !== 0 && (r[g++] = l);
435
+ for (; s < i; )
436
+ f = o + u, c = f - o, l = o - (f - c) + (u - c), u = t[++s], o = f, l !== 0 && (r[g++] = l);
437
437
  for (; h < e; )
438
- u = o + g, c = u - o, s = o - (u - c) + (g - c), g = n[++h], o = u, s !== 0 && (r[a++] = s);
439
- return (o !== 0 || a === 0) && (r[a++] = o), a;
438
+ f = o + p, c = f - o, l = o - (f - c) + (p - c), p = n[++h], o = f, l !== 0 && (r[g++] = l);
439
+ return (o !== 0 || g === 0) && (r[g++] = o), g;
440
440
  }
441
- function se(i, t) {
441
+ function fe(i, t) {
442
442
  let e = t[0];
443
443
  for (let n = 1; n < i; n++) e += t[n];
444
444
  return e;
@@ -446,26 +446,26 @@ function se(i, t) {
446
446
  function J(i) {
447
447
  return new Float64Array(i);
448
448
  }
449
- const le = (3 + 16 * O) * O, ue = (2 + 12 * O) * O, fe = (9 + 64 * O) * O * O, j = J(4), wt = J(8), Et = J(12), mt = J(16), P = J(4);
450
- function ce(i, t, e, n, r, o, u) {
451
- let s, c, f, g, l, h, a, d, x, y, p, v, E, w, m, b, M, _;
452
- const R = i - r, k = e - r, C = t - o, I = n - o;
453
- w = R * I, h = S * R, a = h - (h - R), d = R - a, h = S * I, x = h - (h - I), y = I - x, m = d * y - (w - a * x - d * x - a * y), b = C * k, h = S * C, a = h - (h - C), d = C - a, h = S * k, x = h - (h - k), y = k - x, M = d * y - (b - a * x - d * x - a * y), p = m - M, l = m - p, j[0] = m - (p + l) + (l - M), v = w + p, l = v - w, E = w - (v - l) + (p - l), p = E - b, l = E - p, j[1] = E - (p + l) + (l - b), _ = v + p, l = _ - v, j[2] = v - (_ - l) + (p - l), j[3] = _;
454
- let A = se(4, j), Y = ue * u;
455
- if (A >= Y || -A >= Y || (l = i - R, s = i - (R + l) + (l - r), l = e - k, f = e - (k + l) + (l - r), l = t - C, c = t - (C + l) + (l - o), l = n - I, g = n - (I + l) + (l - o), s === 0 && c === 0 && f === 0 && g === 0) || (Y = fe * u + oe * Math.abs(A), A += R * g + I * s - (C * f + k * c), A >= Y || -A >= Y)) return A;
456
- w = s * I, h = S * s, a = h - (h - s), d = s - a, h = S * I, x = h - (h - I), y = I - x, m = d * y - (w - a * x - d * x - a * y), b = c * k, h = S * c, a = h - (h - c), d = c - a, h = S * k, x = h - (h - k), y = k - x, M = d * y - (b - a * x - d * x - a * y), p = m - M, l = m - p, P[0] = m - (p + l) + (l - M), v = w + p, l = v - w, E = w - (v - l) + (p - l), p = E - b, l = E - p, P[1] = E - (p + l) + (l - b), _ = v + p, l = _ - v, P[2] = v - (_ - l) + (p - l), P[3] = _;
457
- const Zt = ot(4, j, 4, P, wt);
458
- w = R * g, h = S * R, a = h - (h - R), d = R - a, h = S * g, x = h - (h - g), y = g - x, m = d * y - (w - a * x - d * x - a * y), b = C * f, h = S * C, a = h - (h - C), d = C - a, h = S * f, x = h - (h - f), y = f - x, M = d * y - (b - a * x - d * x - a * y), p = m - M, l = m - p, P[0] = m - (p + l) + (l - M), v = w + p, l = v - w, E = w - (v - l) + (p - l), p = E - b, l = E - p, P[1] = E - (p + l) + (l - b), _ = v + p, l = _ - v, P[2] = v - (_ - l) + (p - l), P[3] = _;
459
- const Gt = ot(Zt, wt, 4, P, Et);
460
- w = s * g, h = S * s, a = h - (h - s), d = s - a, h = S * g, x = h - (h - g), y = g - x, m = d * y - (w - a * x - d * x - a * y), b = c * f, h = S * c, a = h - (h - c), d = c - a, h = S * f, x = h - (h - f), y = f - x, M = d * y - (b - a * x - d * x - a * y), p = m - M, l = m - p, P[0] = m - (p + l) + (l - M), v = w + p, l = v - w, E = w - (v - l) + (p - l), p = E - b, l = E - p, P[1] = E - (p + l) + (l - b), _ = v + p, l = _ - v, P[2] = v - (_ - l) + (p - l), P[3] = _;
461
- const Wt = ot(Gt, Et, 4, P, mt);
462
- return mt[Wt - 1];
463
- }
464
- function he(i, t, e, n, r, o) {
465
- const u = (t - o) * (e - r), s = (i - r) * (n - o), c = u - s, f = Math.abs(u + s);
466
- return Math.abs(c) >= le * f ? c : -ce(i, t, e, n, r, o, f);
467
- }
468
- const D = (i, t) => i.ll.x <= t.x && t.x <= i.ur.x && i.ll.y <= t.y && t.y <= i.ur.y, ht = (i, t) => {
449
+ const ce = (3 + 16 * O) * O, he = (2 + 12 * O) * O, ae = (9 + 64 * O) * O * O, U = J(4), mt = J(8), wt = J(12), bt = J(16), P = J(4);
450
+ function ge(i, t, e, n, r, o, f) {
451
+ let l, c, u, p, s, h, g, y, x, m, a, d, v, E, w, b, M, _;
452
+ const R = i - r, I = e - r, C = t - o, k = n - o;
453
+ E = R * k, h = S * R, g = h - (h - R), y = R - g, h = S * k, x = h - (h - k), m = k - x, w = y * m - (E - g * x - y * x - g * m), b = C * I, h = S * C, g = h - (h - C), y = C - g, h = S * I, x = h - (h - I), m = I - x, M = y * m - (b - g * x - y * x - g * m), a = w - M, s = w - a, U[0] = w - (a + s) + (s - M), d = E + a, s = d - E, v = E - (d - s) + (a - s), a = v - b, s = v - a, U[1] = v - (a + s) + (s - b), _ = d + a, s = _ - d, U[2] = d - (_ - s) + (a - s), U[3] = _;
454
+ let A = fe(4, U), Q = he * f;
455
+ if (A >= Q || -A >= Q || (s = i - R, l = i - (R + s) + (s - r), s = e - I, u = e - (I + s) + (s - r), s = t - C, c = t - (C + s) + (s - o), s = n - k, p = n - (k + s) + (s - o), l === 0 && c === 0 && u === 0 && p === 0) || (Q = ae * f + ue * Math.abs(A), A += R * p + k * l - (C * u + I * c), A >= Q || -A >= Q)) return A;
456
+ E = l * k, h = S * l, g = h - (h - l), y = l - g, h = S * k, x = h - (h - k), m = k - x, w = y * m - (E - g * x - y * x - g * m), b = c * I, h = S * c, g = h - (h - c), y = c - g, h = S * I, x = h - (h - I), m = I - x, M = y * m - (b - g * x - y * x - g * m), a = w - M, s = w - a, P[0] = w - (a + s) + (s - M), d = E + a, s = d - E, v = E - (d - s) + (a - s), a = v - b, s = v - a, P[1] = v - (a + s) + (s - b), _ = d + a, s = _ - d, P[2] = d - (_ - s) + (a - s), P[3] = _;
457
+ const Jt = st(4, U, 4, P, mt);
458
+ E = R * p, h = S * R, g = h - (h - R), y = R - g, h = S * p, x = h - (h - p), m = p - x, w = y * m - (E - g * x - y * x - g * m), b = C * u, h = S * C, g = h - (h - C), y = C - g, h = S * u, x = h - (h - u), m = u - x, M = y * m - (b - g * x - y * x - g * m), a = w - M, s = w - a, P[0] = w - (a + s) + (s - M), d = E + a, s = d - E, v = E - (d - s) + (a - s), a = v - b, s = v - a, P[1] = v - (a + s) + (s - b), _ = d + a, s = _ - d, P[2] = d - (_ - s) + (a - s), P[3] = _;
459
+ const Kt = st(Jt, mt, 4, P, wt);
460
+ E = l * p, h = S * l, g = h - (h - l), y = l - g, h = S * p, x = h - (h - p), m = p - x, w = y * m - (E - g * x - y * x - g * m), b = c * u, h = S * c, g = h - (h - c), y = c - g, h = S * u, x = h - (h - u), m = u - x, M = y * m - (b - g * x - y * x - g * m), a = w - M, s = w - a, P[0] = w - (a + s) + (s - M), d = E + a, s = d - E, v = E - (d - s) + (a - s), a = v - b, s = v - a, P[1] = v - (a + s) + (s - b), _ = d + a, s = _ - d, P[2] = d - (_ - s) + (a - s), P[3] = _;
461
+ const Ht = st(Kt, wt, 4, P, bt);
462
+ return bt[Ht - 1];
463
+ }
464
+ function pe(i, t, e, n, r, o) {
465
+ const f = (t - o) * (e - r), l = (i - r) * (n - o), c = f - l, u = Math.abs(f + l);
466
+ return Math.abs(c) >= ce * u ? c : -ge(i, t, e, n, r, o, u);
467
+ }
468
+ const F = (i, t) => i.ll.x <= t.x && t.x <= i.ur.x && i.ll.y <= t.y && t.y <= i.ur.y, at = (i, t) => {
469
469
  if (t.ur.x < i.ll.x || i.ur.x < t.ll.x || t.ur.y < i.ll.y || i.ur.y < t.ll.y) return null;
470
470
  const e = i.ll.x < t.ll.x ? t.ll.x : i.ll.x, n = i.ur.x < t.ur.x ? i.ur.x : t.ur.x, r = i.ll.y < t.ll.y ? t.ll.y : i.ll.y, o = i.ur.y < t.ur.y ? i.ur.y : t.ur.y;
471
471
  return {
@@ -479,20 +479,20 @@ const D = (i, t) => i.ll.x <= t.x && t.x <= i.ur.x && i.ll.y <= t.y && t.y <= i.
479
479
  }
480
480
  };
481
481
  };
482
- let z = Number.EPSILON;
483
- z === void 0 && (z = Math.pow(2, -52));
484
- const ae = z * z, bt = (i, t) => {
485
- if (-z < i && i < z && -z < t && t < z)
482
+ let T = Number.EPSILON;
483
+ T === void 0 && (T = Math.pow(2, -52));
484
+ const ye = T * T, _t = (i, t) => {
485
+ if (-T < i && i < T && -T < t && t < T)
486
486
  return 0;
487
487
  const e = i - t;
488
- return e * e < ae * i * t ? 0 : i < t ? -1 : 1;
488
+ return e * e < ye * i * t ? 0 : i < t ? -1 : 1;
489
489
  };
490
- class ge {
490
+ class de {
491
491
  constructor() {
492
492
  this.reset();
493
493
  }
494
494
  reset() {
495
- this.xRounder = new _t(), this.yRounder = new _t();
495
+ this.xRounder = new St(), this.yRounder = new St();
496
496
  }
497
497
  round(t, e) {
498
498
  return {
@@ -501,9 +501,9 @@ class ge {
501
501
  };
502
502
  }
503
503
  }
504
- class _t {
504
+ class St {
505
505
  constructor() {
506
- this.tree = new yt(), this.round(0);
506
+ this.tree = new dt(), this.round(0);
507
507
  }
508
508
  // Note: this can rounds input values backwards or forwards.
509
509
  // You might ask, why not restrict this to just rounding
@@ -514,16 +514,16 @@ class _t {
514
514
  // angle for t-intersections).
515
515
  round(t) {
516
516
  const e = this.tree.add(t), n = this.tree.prev(e);
517
- if (n !== null && bt(e.key, n.key) === 0)
517
+ if (n !== null && _t(e.key, n.key) === 0)
518
518
  return this.tree.remove(t), n.key;
519
519
  const r = this.tree.next(e);
520
- return r !== null && bt(e.key, r.key) === 0 ? (this.tree.remove(t), r.key) : t;
520
+ return r !== null && _t(e.key, r.key) === 0 ? (this.tree.remove(t), r.key) : t;
521
521
  }
522
522
  }
523
- const G = new ge(), H = (i, t) => i.x * t.y - i.y * t.x, jt = (i, t) => i.x * t.x + i.y * t.y, St = (i, t, e) => {
524
- const n = he(i.x, i.y, t.x, t.y, e.x, e.y);
523
+ const Z = new de(), tt = (i, t) => i.x * t.y - i.y * t.x, Yt = (i, t) => i.x * t.x + i.y * t.y, Pt = (i, t, e) => {
524
+ const n = pe(i.x, i.y, t.x, t.y, e.x, e.y);
525
525
  return n > 0 ? -1 : n < 0 ? 1 : 0;
526
- }, tt = (i) => Math.sqrt(jt(i, i)), pe = (i, t, e) => {
526
+ }, et = (i) => Math.sqrt(Yt(i, i)), xe = (i, t, e) => {
527
527
  const n = {
528
528
  x: t.x - i.x,
529
529
  y: t.y - i.y
@@ -531,8 +531,8 @@ const G = new ge(), H = (i, t) => i.x * t.y - i.y * t.x, jt = (i, t) => i.x * t.
531
531
  x: e.x - i.x,
532
532
  y: e.y - i.y
533
533
  };
534
- return H(r, n) / tt(r) / tt(n);
535
- }, ye = (i, t, e) => {
534
+ return tt(r, n) / et(r) / et(n);
535
+ }, ve = (i, t, e) => {
536
536
  const n = {
537
537
  x: t.x - i.x,
538
538
  y: t.y - i.y
@@ -540,34 +540,34 @@ const G = new ge(), H = (i, t) => i.x * t.y - i.y * t.x, jt = (i, t) => i.x * t.
540
540
  x: e.x - i.x,
541
541
  y: e.y - i.y
542
542
  };
543
- return jt(r, n) / tt(r) / tt(n);
544
- }, Pt = (i, t, e) => t.y === 0 ? null : {
543
+ return Yt(r, n) / et(r) / et(n);
544
+ }, Mt = (i, t, e) => t.y === 0 ? null : {
545
545
  x: i.x + t.x / t.y * (e - i.y),
546
546
  y: e
547
- }, Mt = (i, t, e) => t.x === 0 ? null : {
547
+ }, Lt = (i, t, e) => t.x === 0 ? null : {
548
548
  x: e,
549
549
  y: i.y + t.y / t.x * (e - i.x)
550
- }, de = (i, t, e, n) => {
551
- if (t.x === 0) return Mt(e, n, i.x);
552
- if (n.x === 0) return Mt(i, t, e.x);
553
- if (t.y === 0) return Pt(e, n, i.y);
554
- if (n.y === 0) return Pt(i, t, e.y);
555
- const r = H(t, n);
550
+ }, Ee = (i, t, e, n) => {
551
+ if (t.x === 0) return Lt(e, n, i.x);
552
+ if (n.x === 0) return Lt(i, t, e.x);
553
+ if (t.y === 0) return Mt(e, n, i.y);
554
+ if (n.y === 0) return Mt(i, t, e.y);
555
+ const r = tt(t, n);
556
556
  if (r == 0) return null;
557
557
  const o = {
558
558
  x: e.x - i.x,
559
559
  y: e.y - i.y
560
- }, u = H(o, t) / r, s = H(o, n) / r, c = i.x + s * t.x, f = e.x + u * n.x, g = i.y + s * t.y, l = e.y + u * n.y, h = (c + f) / 2, a = (g + l) / 2;
560
+ }, f = tt(o, t) / r, l = tt(o, n) / r, c = i.x + l * t.x, u = e.x + f * n.x, p = i.y + l * t.y, s = e.y + f * n.y, h = (c + u) / 2, g = (p + s) / 2;
561
561
  return {
562
562
  x: h,
563
- y: a
563
+ y: g
564
564
  };
565
565
  };
566
566
  class L {
567
567
  // for ordering sweep events in the sweep event queue
568
568
  static compare(t, e) {
569
569
  const n = L.comparePoints(t.point, e.point);
570
- return n !== 0 ? n : (t.point !== e.point && t.link(e), t.isLeft !== e.isLeft ? t.isLeft ? 1 : -1 : T.compare(t.segment, e.segment));
570
+ return n !== 0 ? n : (t.point !== e.point && t.link(e), t.isLeft !== e.isLeft ? t.isLeft ? 1 : -1 : z.compare(t.segment, e.segment));
571
571
  }
572
572
  // for ordering points in sweep line order
573
573
  static comparePoints(t, e) {
@@ -622,25 +622,25 @@ class L {
622
622
  const e = /* @__PURE__ */ new Map(), n = (r) => {
623
623
  const o = r.otherSE;
624
624
  e.set(r, {
625
- sine: pe(this.point, t.point, o.point),
626
- cosine: ye(this.point, t.point, o.point)
625
+ sine: xe(this.point, t.point, o.point),
626
+ cosine: ve(this.point, t.point, o.point)
627
627
  });
628
628
  };
629
629
  return (r, o) => {
630
630
  e.has(r) || n(r), e.has(o) || n(o);
631
631
  const {
632
- sine: u,
633
- cosine: s
632
+ sine: f,
633
+ cosine: l
634
634
  } = e.get(r), {
635
635
  sine: c,
636
- cosine: f
636
+ cosine: u
637
637
  } = e.get(o);
638
- return u >= 0 && c >= 0 ? s < f ? 1 : s > f ? -1 : 0 : u < 0 && c < 0 ? s < f ? -1 : s > f ? 1 : 0 : c < u ? -1 : c > u ? 1 : 0;
638
+ return f >= 0 && c >= 0 ? l < u ? 1 : l > u ? -1 : 0 : f < 0 && c < 0 ? l < u ? -1 : l > u ? 1 : 0 : c < f ? -1 : c > f ? 1 : 0;
639
639
  };
640
640
  }
641
641
  }
642
- let xe = 0;
643
- class T {
642
+ let me = 0;
643
+ class z {
644
644
  /* This compare() function is for ordering segments in the sweep
645
645
  * line tree, and does so according to the following criteria:
646
646
  *
@@ -655,60 +655,60 @@ class T {
655
655
  * is directly on the right-more of the two left inputs.
656
656
  */
657
657
  static compare(t, e) {
658
- const n = t.leftSE.point.x, r = e.leftSE.point.x, o = t.rightSE.point.x, u = e.rightSE.point.x;
659
- if (u < n) return 1;
658
+ const n = t.leftSE.point.x, r = e.leftSE.point.x, o = t.rightSE.point.x, f = e.rightSE.point.x;
659
+ if (f < n) return 1;
660
660
  if (o < r) return -1;
661
- const s = t.leftSE.point.y, c = e.leftSE.point.y, f = t.rightSE.point.y, g = e.rightSE.point.y;
661
+ const l = t.leftSE.point.y, c = e.leftSE.point.y, u = t.rightSE.point.y, p = e.rightSE.point.y;
662
662
  if (n < r) {
663
- if (c < s && c < f) return 1;
664
- if (c > s && c > f) return -1;
665
- const l = t.comparePoint(e.leftSE.point);
666
- if (l < 0) return 1;
667
- if (l > 0) return -1;
663
+ if (c < l && c < u) return 1;
664
+ if (c > l && c > u) return -1;
665
+ const s = t.comparePoint(e.leftSE.point);
666
+ if (s < 0) return 1;
667
+ if (s > 0) return -1;
668
668
  const h = e.comparePoint(t.rightSE.point);
669
669
  return h !== 0 ? h : -1;
670
670
  }
671
671
  if (n > r) {
672
- if (s < c && s < g) return -1;
673
- if (s > c && s > g) return 1;
674
- const l = e.comparePoint(t.leftSE.point);
675
- if (l !== 0) return l;
672
+ if (l < c && l < p) return -1;
673
+ if (l > c && l > p) return 1;
674
+ const s = e.comparePoint(t.leftSE.point);
675
+ if (s !== 0) return s;
676
676
  const h = t.comparePoint(e.rightSE.point);
677
677
  return h < 0 ? 1 : h > 0 ? -1 : 1;
678
678
  }
679
- if (s < c) return -1;
680
- if (s > c) return 1;
681
- if (o < u) {
682
- const l = e.comparePoint(t.rightSE.point);
683
- if (l !== 0) return l;
679
+ if (l < c) return -1;
680
+ if (l > c) return 1;
681
+ if (o < f) {
682
+ const s = e.comparePoint(t.rightSE.point);
683
+ if (s !== 0) return s;
684
684
  }
685
- if (o > u) {
686
- const l = t.comparePoint(e.rightSE.point);
687
- if (l < 0) return 1;
688
- if (l > 0) return -1;
685
+ if (o > f) {
686
+ const s = t.comparePoint(e.rightSE.point);
687
+ if (s < 0) return 1;
688
+ if (s > 0) return -1;
689
689
  }
690
- if (o !== u) {
691
- const l = f - s, h = o - n, a = g - c, d = u - r;
692
- if (l > h && a < d) return 1;
693
- if (l < h && a > d) return -1;
690
+ if (o !== f) {
691
+ const s = u - l, h = o - n, g = p - c, y = f - r;
692
+ if (s > h && g < y) return 1;
693
+ if (s < h && g > y) return -1;
694
694
  }
695
- return o > u ? 1 : o < u || f < g ? -1 : f > g ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
695
+ return o > f ? 1 : o < f || u < p ? -1 : u > p ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
696
696
  }
697
697
  /* Warning: a reference to ringWindings input will be stored,
698
698
  * and possibly will be later modified */
699
699
  constructor(t, e, n, r) {
700
- this.id = ++xe, this.leftSE = t, t.segment = this, t.otherSE = e, this.rightSE = e, e.segment = this, e.otherSE = t, this.rings = n, this.windings = r;
700
+ this.id = ++me, this.leftSE = t, t.segment = this, t.otherSE = e, this.rightSE = e, e.segment = this, e.otherSE = t, this.rings = n, this.windings = r;
701
701
  }
702
702
  static fromRing(t, e, n) {
703
- let r, o, u;
704
- const s = L.comparePoints(t, e);
705
- if (s < 0)
706
- r = t, o = e, u = 1;
707
- else if (s > 0)
708
- r = e, o = t, u = -1;
703
+ let r, o, f;
704
+ const l = L.comparePoints(t, e);
705
+ if (l < 0)
706
+ r = t, o = e, f = 1;
707
+ else if (l > 0)
708
+ r = e, o = t, f = -1;
709
709
  else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);
710
- const c = new L(r, !0), f = new L(o, !1);
711
- return new T(c, f, [n], [u]);
710
+ const c = new L(r, !0), u = new L(o, !1);
711
+ return new z(c, u, [n], [f]);
712
712
  }
713
713
  /* When a segment is split, the rightSE is replaced with a new sweep event */
714
714
  replaceRightSE(t) {
@@ -755,9 +755,9 @@ class T {
755
755
  const e = this.leftSE.point, n = this.rightSE.point, r = this.vector();
756
756
  if (e.x === n.x)
757
757
  return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
758
- const o = (t.y - e.y) / r.y, u = e.x + o * r.x;
759
- if (t.x === u) return 0;
760
- const s = (t.x - e.x) / r.x, c = e.y + s * r.y;
758
+ const o = (t.y - e.y) / r.y, f = e.x + o * r.x;
759
+ if (t.x === f) return 0;
760
+ const l = (t.x - e.x) / r.x, c = e.y + l * r.y;
761
761
  return t.y === c ? 0 : t.y < c ? -1 : 1;
762
762
  }
763
763
  /**
@@ -776,20 +776,20 @@ class T {
776
776
  * Else, return null.
777
777
  */
778
778
  getIntersection(t) {
779
- const e = this.bbox(), n = t.bbox(), r = ht(e, n);
779
+ const e = this.bbox(), n = t.bbox(), r = at(e, n);
780
780
  if (r === null) return null;
781
- const o = this.leftSE.point, u = this.rightSE.point, s = t.leftSE.point, c = t.rightSE.point, f = D(e, s) && this.comparePoint(s) === 0, g = D(n, o) && t.comparePoint(o) === 0, l = D(e, c) && this.comparePoint(c) === 0, h = D(n, u) && t.comparePoint(u) === 0;
782
- if (g && f)
783
- return h && !l ? u : !h && l ? c : null;
784
- if (g)
785
- return l && o.x === c.x && o.y === c.y ? null : o;
786
- if (f)
787
- return h && u.x === s.x && u.y === s.y ? null : s;
788
- if (h && l) return null;
789
- if (h) return u;
790
- if (l) return c;
791
- const a = de(o, this.vector(), s, t.vector());
792
- return a === null || !D(r, a) ? null : G.round(a.x, a.y);
781
+ const o = this.leftSE.point, f = this.rightSE.point, l = t.leftSE.point, c = t.rightSE.point, u = F(e, l) && this.comparePoint(l) === 0, p = F(n, o) && t.comparePoint(o) === 0, s = F(e, c) && this.comparePoint(c) === 0, h = F(n, f) && t.comparePoint(f) === 0;
782
+ if (p && u)
783
+ return h && !s ? f : !h && s ? c : null;
784
+ if (p)
785
+ return s && o.x === c.x && o.y === c.y ? null : o;
786
+ if (u)
787
+ return h && f.x === l.x && f.y === l.y ? null : l;
788
+ if (h && s) return null;
789
+ if (h) return f;
790
+ if (s) return c;
791
+ const g = Ee(o, this.vector(), l, t.vector());
792
+ return g === null || !F(r, g) ? null : Z.round(g.x, g.y);
793
793
  }
794
794
  /**
795
795
  * Split the given segment into multiple segments on the given points.
@@ -804,10 +804,10 @@ class T {
804
804
  * Warning: input array of points is modified
805
805
  */
806
806
  split(t) {
807
- const e = [], n = t.events !== void 0, r = new L(t, !0), o = new L(t, !1), u = this.rightSE;
807
+ const e = [], n = t.events !== void 0, r = new L(t, !0), o = new L(t, !1), f = this.rightSE;
808
808
  this.replaceRightSE(o), e.push(o), e.push(r);
809
- const s = new T(r, u, this.rings.slice(), this.windings.slice());
810
- return L.comparePoints(s.leftSE.point, s.rightSE.point) > 0 && s.swapEvents(), L.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), n && (r.checkForConsuming(), o.checkForConsuming()), e;
809
+ const l = new z(r, f, this.rings.slice(), this.windings.slice());
810
+ return L.comparePoints(l.leftSE.point, l.rightSE.point) > 0 && l.swapEvents(), L.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), n && (r.checkForConsuming(), o.checkForConsuming()), e;
811
811
  }
812
812
  /* Swap which event is left and right */
813
813
  swapEvents() {
@@ -822,7 +822,7 @@ class T {
822
822
  let e = this, n = t;
823
823
  for (; e.consumedBy; ) e = e.consumedBy;
824
824
  for (; n.consumedBy; ) n = n.consumedBy;
825
- const r = T.compare(e, n);
825
+ const r = z.compare(e, n);
826
826
  if (r !== 0) {
827
827
  if (r > 0) {
828
828
  const o = e;
@@ -832,9 +832,9 @@ class T {
832
832
  const o = e;
833
833
  e = n, n = o;
834
834
  }
835
- for (let o = 0, u = n.rings.length; o < u; o++) {
836
- const s = n.rings[o], c = n.windings[o], f = e.rings.indexOf(s);
837
- f === -1 ? (e.rings.push(s), e.windings.push(c)) : e.windings[f] += c;
835
+ for (let o = 0, f = n.rings.length; o < f; o++) {
836
+ const l = n.rings[o], c = n.windings[o], u = e.rings.indexOf(l);
837
+ u === -1 ? (e.rings.push(l), e.windings.push(c)) : e.windings[u] += c;
838
838
  }
839
839
  n.rings = null, n.windings = null, n.consumedBy = e, n.leftSE.consumedBy = e.leftSE, n.rightSE.consumedBy = e.rightSE;
840
840
  }
@@ -865,25 +865,25 @@ class T {
865
865
  multiPolys: []
866
866
  };
867
867
  const e = this._afterState.rings, n = this._afterState.windings, r = this._afterState.multiPolys;
868
- for (let s = 0, c = this.rings.length; s < c; s++) {
869
- const f = this.rings[s], g = this.windings[s], l = e.indexOf(f);
870
- l === -1 ? (e.push(f), n.push(g)) : n[l] += g;
868
+ for (let l = 0, c = this.rings.length; l < c; l++) {
869
+ const u = this.rings[l], p = this.windings[l], s = e.indexOf(u);
870
+ s === -1 ? (e.push(u), n.push(p)) : n[s] += p;
871
871
  }
872
- const o = [], u = [];
873
- for (let s = 0, c = e.length; s < c; s++) {
874
- if (n[s] === 0) continue;
875
- const f = e[s], g = f.poly;
876
- if (u.indexOf(g) === -1)
877
- if (f.isExterior) o.push(g);
872
+ const o = [], f = [];
873
+ for (let l = 0, c = e.length; l < c; l++) {
874
+ if (n[l] === 0) continue;
875
+ const u = e[l], p = u.poly;
876
+ if (f.indexOf(p) === -1)
877
+ if (u.isExterior) o.push(p);
878
878
  else {
879
- u.indexOf(g) === -1 && u.push(g);
880
- const l = o.indexOf(f.poly);
881
- l !== -1 && o.splice(l, 1);
879
+ f.indexOf(p) === -1 && f.push(p);
880
+ const s = o.indexOf(u.poly);
881
+ s !== -1 && o.splice(s, 1);
882
882
  }
883
883
  }
884
- for (let s = 0, c = o.length; s < c; s++) {
885
- const f = o[s].multiPoly;
886
- r.indexOf(f) === -1 && r.push(f);
884
+ for (let l = 0, c = o.length; l < c; l++) {
885
+ const u = o[l].multiPoly;
886
+ r.indexOf(u) === -1 && r.push(u);
887
887
  }
888
888
  return this._afterState;
889
889
  }
@@ -919,13 +919,13 @@ class T {
919
919
  return this._isInResult;
920
920
  }
921
921
  }
922
- class Lt {
922
+ class Rt {
923
923
  constructor(t, e, n) {
924
924
  if (!Array.isArray(t) || t.length === 0)
925
925
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
926
926
  if (this.poly = e, this.isExterior = n, this.segments = [], typeof t[0][0] != "number" || typeof t[0][1] != "number")
927
927
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
928
- const r = G.round(t[0][0], t[0][1]);
928
+ const r = Z.round(t[0][0], t[0][1]);
929
929
  this.bbox = {
930
930
  ll: {
931
931
  x: r.x,
@@ -937,13 +937,13 @@ class Lt {
937
937
  }
938
938
  };
939
939
  let o = r;
940
- for (let u = 1, s = t.length; u < s; u++) {
941
- if (typeof t[u][0] != "number" || typeof t[u][1] != "number")
940
+ for (let f = 1, l = t.length; f < l; f++) {
941
+ if (typeof t[f][0] != "number" || typeof t[f][1] != "number")
942
942
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
943
- let c = G.round(t[u][0], t[u][1]);
944
- c.x === o.x && c.y === o.y || (this.segments.push(T.fromRing(o, c, this)), c.x < this.bbox.ll.x && (this.bbox.ll.x = c.x), c.y < this.bbox.ll.y && (this.bbox.ll.y = c.y), c.x > this.bbox.ur.x && (this.bbox.ur.x = c.x), c.y > this.bbox.ur.y && (this.bbox.ur.y = c.y), o = c);
943
+ let c = Z.round(t[f][0], t[f][1]);
944
+ c.x === o.x && c.y === o.y || (this.segments.push(z.fromRing(o, c, this)), c.x < this.bbox.ll.x && (this.bbox.ll.x = c.x), c.y < this.bbox.ll.y && (this.bbox.ll.y = c.y), c.x > this.bbox.ur.x && (this.bbox.ur.x = c.x), c.y > this.bbox.ur.y && (this.bbox.ur.y = c.y), o = c);
945
945
  }
946
- (r.x !== o.x || r.y !== o.y) && this.segments.push(T.fromRing(o, r, this));
946
+ (r.x !== o.x || r.y !== o.y) && this.segments.push(z.fromRing(o, r, this));
947
947
  }
948
948
  getSweepEvents() {
949
949
  const t = [];
@@ -954,11 +954,11 @@ class Lt {
954
954
  return t;
955
955
  }
956
956
  }
957
- class ve {
957
+ class we {
958
958
  constructor(t, e) {
959
959
  if (!Array.isArray(t))
960
960
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
961
- this.exteriorRing = new Lt(t[0], this, !0), this.bbox = {
961
+ this.exteriorRing = new Rt(t[0], this, !0), this.bbox = {
962
962
  ll: {
963
963
  x: this.exteriorRing.bbox.ll.x,
964
964
  y: this.exteriorRing.bbox.ll.y
@@ -969,7 +969,7 @@ class ve {
969
969
  }
970
970
  }, this.interiorRings = [];
971
971
  for (let n = 1, r = t.length; n < r; n++) {
972
- const o = new Lt(t[n], this, !1);
972
+ const o = new Rt(t[n], this, !1);
973
973
  o.bbox.ll.x < this.bbox.ll.x && (this.bbox.ll.x = o.bbox.ll.x), o.bbox.ll.y < this.bbox.ll.y && (this.bbox.ll.y = o.bbox.ll.y), o.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = o.bbox.ur.x), o.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = o.bbox.ur.y), this.interiorRings.push(o);
974
974
  }
975
975
  this.multiPoly = e;
@@ -978,13 +978,13 @@ class ve {
978
978
  const t = this.exteriorRing.getSweepEvents();
979
979
  for (let e = 0, n = this.interiorRings.length; e < n; e++) {
980
980
  const r = this.interiorRings[e].getSweepEvents();
981
- for (let o = 0, u = r.length; o < u; o++)
981
+ for (let o = 0, f = r.length; o < f; o++)
982
982
  t.push(r[o]);
983
983
  }
984
984
  return t;
985
985
  }
986
986
  }
987
- class Rt {
987
+ class It {
988
988
  constructor(t, e) {
989
989
  if (!Array.isArray(t))
990
990
  throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
@@ -1003,7 +1003,7 @@ class Rt {
1003
1003
  }
1004
1004
  };
1005
1005
  for (let n = 0, r = t.length; n < r; n++) {
1006
- const o = new ve(t[n], this);
1006
+ const o = new we(t[n], this);
1007
1007
  o.bbox.ll.x < this.bbox.ll.x && (this.bbox.ll.x = o.bbox.ll.x), o.bbox.ll.y < this.bbox.ll.y && (this.bbox.ll.y = o.bbox.ll.y), o.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = o.bbox.ur.x), o.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = o.bbox.ur.y), this.polys.push(o);
1008
1008
  }
1009
1009
  this.isSubject = e;
@@ -1012,13 +1012,13 @@ class Rt {
1012
1012
  const t = [];
1013
1013
  for (let e = 0, n = this.polys.length; e < n; e++) {
1014
1014
  const r = this.polys[e].getSweepEvents();
1015
- for (let o = 0, u = r.length; o < u; o++)
1015
+ for (let o = 0, f = r.length; o < f; o++)
1016
1016
  t.push(r[o]);
1017
1017
  }
1018
1018
  return t;
1019
1019
  }
1020
1020
  }
1021
- class et {
1021
+ class nt {
1022
1022
  /* Given the segments from the sweep line pass, compute & return a series
1023
1023
  * of closed rings from all the segments marked to be part of the result */
1024
1024
  static factory(t) {
@@ -1026,39 +1026,39 @@ class et {
1026
1026
  for (let n = 0, r = t.length; n < r; n++) {
1027
1027
  const o = t[n];
1028
1028
  if (!o.isInResult() || o.ringOut) continue;
1029
- let u = null, s = o.leftSE, c = o.rightSE;
1030
- const f = [s], g = s.point, l = [];
1031
- for (; u = s, s = c, f.push(s), s.point !== g; )
1029
+ let f = null, l = o.leftSE, c = o.rightSE;
1030
+ const u = [l], p = l.point, s = [];
1031
+ for (; f = l, l = c, u.push(l), l.point !== p; )
1032
1032
  for (; ; ) {
1033
- const h = s.getAvailableLinkedEvents();
1033
+ const h = l.getAvailableLinkedEvents();
1034
1034
  if (h.length === 0) {
1035
- const x = f[0].point, y = f[f.length - 1].point;
1036
- throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${y.x}, ${y.y}].`);
1035
+ const x = u[0].point, m = u[u.length - 1].point;
1036
+ throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${m.x}, ${m.y}].`);
1037
1037
  }
1038
1038
  if (h.length === 1) {
1039
1039
  c = h[0].otherSE;
1040
1040
  break;
1041
1041
  }
1042
- let a = null;
1043
- for (let x = 0, y = l.length; x < y; x++)
1044
- if (l[x].point === s.point) {
1045
- a = x;
1042
+ let g = null;
1043
+ for (let x = 0, m = s.length; x < m; x++)
1044
+ if (s[x].point === l.point) {
1045
+ g = x;
1046
1046
  break;
1047
1047
  }
1048
- if (a !== null) {
1049
- const x = l.splice(a)[0], y = f.splice(x.index);
1050
- y.unshift(y[0].otherSE), e.push(new et(y.reverse()));
1048
+ if (g !== null) {
1049
+ const x = s.splice(g)[0], m = u.splice(x.index);
1050
+ m.unshift(m[0].otherSE), e.push(new nt(m.reverse()));
1051
1051
  continue;
1052
1052
  }
1053
- l.push({
1054
- index: f.length,
1055
- point: s.point
1053
+ s.push({
1054
+ index: u.length,
1055
+ point: l.point
1056
1056
  });
1057
- const d = s.getLeftmostComparator(u);
1058
- c = h.sort(d)[0].otherSE;
1057
+ const y = l.getLeftmostComparator(f);
1058
+ c = h.sort(y)[0].otherSE;
1059
1059
  break;
1060
1060
  }
1061
- e.push(new et(f));
1061
+ e.push(new nt(u));
1062
1062
  }
1063
1063
  return e;
1064
1064
  }
@@ -1071,15 +1071,15 @@ class et {
1071
1071
  getGeom() {
1072
1072
  let t = this.events[0].point;
1073
1073
  const e = [t];
1074
- for (let f = 1, g = this.events.length - 1; f < g; f++) {
1075
- const l = this.events[f].point, h = this.events[f + 1].point;
1076
- St(l, t, h) !== 0 && (e.push(l), t = l);
1074
+ for (let u = 1, p = this.events.length - 1; u < p; u++) {
1075
+ const s = this.events[u].point, h = this.events[u + 1].point;
1076
+ Pt(s, t, h) !== 0 && (e.push(s), t = s);
1077
1077
  }
1078
1078
  if (e.length === 1) return null;
1079
1079
  const n = e[0], r = e[1];
1080
- St(n, t, r) === 0 && e.shift(), e.push(e[0]);
1081
- const o = this.isExteriorRing() ? 1 : -1, u = this.isExteriorRing() ? 0 : e.length - 1, s = this.isExteriorRing() ? e.length : -1, c = [];
1082
- for (let f = u; f != s; f += o) c.push([e[f].x, e[f].y]);
1080
+ Pt(n, t, r) === 0 && e.shift(), e.push(e[0]);
1081
+ const o = this.isExteriorRing() ? 1 : -1, f = this.isExteriorRing() ? 0 : e.length - 1, l = this.isExteriorRing() ? e.length : -1, c = [];
1082
+ for (let u = f; u != l; u += o) c.push([e[u].x, e[u].y]);
1083
1083
  return c;
1084
1084
  }
1085
1085
  isExteriorRing() {
@@ -1096,8 +1096,8 @@ class et {
1096
1096
  _calcEnclosingRing() {
1097
1097
  let t = this.events[0];
1098
1098
  for (let r = 1, o = this.events.length; r < o; r++) {
1099
- const u = this.events[r];
1100
- L.compare(t, u) > 0 && (t = u);
1099
+ const f = this.events[r];
1100
+ L.compare(t, f) > 0 && (t = f);
1101
1101
  }
1102
1102
  let e = t.segment.prevInResult(), n = e ? e.prevInResult() : null;
1103
1103
  for (; ; ) {
@@ -1109,7 +1109,7 @@ class et {
1109
1109
  }
1110
1110
  }
1111
1111
  }
1112
- class kt {
1112
+ class Ct {
1113
1113
  constructor(t) {
1114
1114
  this.exteriorRing = t, t.poly = this, this.interiorRings = [];
1115
1115
  }
@@ -1126,7 +1126,7 @@ class kt {
1126
1126
  return t;
1127
1127
  }
1128
1128
  }
1129
- class we {
1129
+ class be {
1130
1130
  constructor(t) {
1131
1131
  this.rings = t, this.polys = this._composePolys(t);
1132
1132
  }
@@ -1143,19 +1143,19 @@ class we {
1143
1143
  for (let n = 0, r = t.length; n < r; n++) {
1144
1144
  const o = t[n];
1145
1145
  if (!o.poly)
1146
- if (o.isExteriorRing()) e.push(new kt(o));
1146
+ if (o.isExteriorRing()) e.push(new Ct(o));
1147
1147
  else {
1148
- const u = o.enclosingRing();
1149
- u.poly || e.push(new kt(u)), u.poly.addInterior(o);
1148
+ const f = o.enclosingRing();
1149
+ f.poly || e.push(new Ct(f)), f.poly.addInterior(o);
1150
1150
  }
1151
1151
  }
1152
1152
  return e;
1153
1153
  }
1154
1154
  }
1155
- class Ee {
1155
+ class _e {
1156
1156
  constructor(t) {
1157
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : T.compare;
1158
- this.queue = t, this.tree = new yt(e), this.segments = [];
1157
+ let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z.compare;
1158
+ this.queue = t, this.tree = new dt(e), this.segments = [];
1159
1159
  }
1160
1160
  process(t) {
1161
1161
  const e = t.segment, n = [];
@@ -1163,51 +1163,51 @@ class Ee {
1163
1163
  return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
1164
1164
  const r = t.isLeft ? this.tree.add(e) : this.tree.find(e);
1165
1165
  if (!r) throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);
1166
- let o = r, u = r, s, c;
1167
- for (; s === void 0; )
1168
- o = this.tree.prev(o), o === null ? s = null : o.key.consumedBy === void 0 && (s = o.key);
1166
+ let o = r, f = r, l, c;
1167
+ for (; l === void 0; )
1168
+ o = this.tree.prev(o), o === null ? l = null : o.key.consumedBy === void 0 && (l = o.key);
1169
1169
  for (; c === void 0; )
1170
- u = this.tree.next(u), u === null ? c = null : u.key.consumedBy === void 0 && (c = u.key);
1170
+ f = this.tree.next(f), f === null ? c = null : f.key.consumedBy === void 0 && (c = f.key);
1171
1171
  if (t.isLeft) {
1172
- let f = null;
1173
- if (s) {
1174
- const l = s.getIntersection(e);
1175
- if (l !== null && (e.isAnEndpoint(l) || (f = l), !s.isAnEndpoint(l))) {
1176
- const h = this._splitSafely(s, l);
1177
- for (let a = 0, d = h.length; a < d; a++)
1178
- n.push(h[a]);
1172
+ let u = null;
1173
+ if (l) {
1174
+ const s = l.getIntersection(e);
1175
+ if (s !== null && (e.isAnEndpoint(s) || (u = s), !l.isAnEndpoint(s))) {
1176
+ const h = this._splitSafely(l, s);
1177
+ for (let g = 0, y = h.length; g < y; g++)
1178
+ n.push(h[g]);
1179
1179
  }
1180
1180
  }
1181
- let g = null;
1181
+ let p = null;
1182
1182
  if (c) {
1183
- const l = c.getIntersection(e);
1184
- if (l !== null && (e.isAnEndpoint(l) || (g = l), !c.isAnEndpoint(l))) {
1185
- const h = this._splitSafely(c, l);
1186
- for (let a = 0, d = h.length; a < d; a++)
1187
- n.push(h[a]);
1183
+ const s = c.getIntersection(e);
1184
+ if (s !== null && (e.isAnEndpoint(s) || (p = s), !c.isAnEndpoint(s))) {
1185
+ const h = this._splitSafely(c, s);
1186
+ for (let g = 0, y = h.length; g < y; g++)
1187
+ n.push(h[g]);
1188
1188
  }
1189
1189
  }
1190
- if (f !== null || g !== null) {
1191
- let l = null;
1192
- f === null ? l = g : g === null ? l = f : l = L.comparePoints(f, g) <= 0 ? f : g, this.queue.remove(e.rightSE), n.push(e.rightSE);
1193
- const h = e.split(l);
1194
- for (let a = 0, d = h.length; a < d; a++)
1195
- n.push(h[a]);
1190
+ if (u !== null || p !== null) {
1191
+ let s = null;
1192
+ u === null ? s = p : p === null ? s = u : s = L.comparePoints(u, p) <= 0 ? u : p, this.queue.remove(e.rightSE), n.push(e.rightSE);
1193
+ const h = e.split(s);
1194
+ for (let g = 0, y = h.length; g < y; g++)
1195
+ n.push(h[g]);
1196
1196
  }
1197
- n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = s);
1197
+ n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = l);
1198
1198
  } else {
1199
- if (s && c) {
1200
- const f = s.getIntersection(c);
1201
- if (f !== null) {
1202
- if (!s.isAnEndpoint(f)) {
1203
- const g = this._splitSafely(s, f);
1204
- for (let l = 0, h = g.length; l < h; l++)
1205
- n.push(g[l]);
1199
+ if (l && c) {
1200
+ const u = l.getIntersection(c);
1201
+ if (u !== null) {
1202
+ if (!l.isAnEndpoint(u)) {
1203
+ const p = this._splitSafely(l, u);
1204
+ for (let s = 0, h = p.length; s < h; s++)
1205
+ n.push(p[s]);
1206
1206
  }
1207
- if (!c.isAnEndpoint(f)) {
1208
- const g = this._splitSafely(c, f);
1209
- for (let l = 0, h = g.length; l < h; l++)
1210
- n.push(g[l]);
1207
+ if (!c.isAnEndpoint(u)) {
1208
+ const p = this._splitSafely(c, u);
1209
+ for (let s = 0, h = p.length; s < h; s++)
1210
+ n.push(p[s]);
1211
1211
  }
1212
1212
  }
1213
1213
  }
@@ -1225,157 +1225,157 @@ class Ee {
1225
1225
  return r.push(n), t.consumedBy === void 0 && this.tree.add(t), r;
1226
1226
  }
1227
1227
  }
1228
- const Ct = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6, me = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
1229
- class be {
1228
+ const kt = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6, Se = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
1229
+ class Pe {
1230
1230
  run(t, e, n) {
1231
- $.type = t, G.reset();
1232
- const r = [new Rt(e, !0)];
1233
- for (let l = 0, h = n.length; l < h; l++)
1234
- r.push(new Rt(n[l], !1));
1231
+ $.type = t, Z.reset();
1232
+ const r = [new It(e, !0)];
1233
+ for (let s = 0, h = n.length; s < h; s++)
1234
+ r.push(new It(n[s], !1));
1235
1235
  if ($.numMultiPolys = r.length, $.type === "difference") {
1236
- const l = r[0];
1236
+ const s = r[0];
1237
1237
  let h = 1;
1238
1238
  for (; h < r.length; )
1239
- ht(r[h].bbox, l.bbox) !== null ? h++ : r.splice(h, 1);
1239
+ at(r[h].bbox, s.bbox) !== null ? h++ : r.splice(h, 1);
1240
1240
  }
1241
1241
  if ($.type === "intersection")
1242
- for (let l = 0, h = r.length; l < h; l++) {
1243
- const a = r[l];
1244
- for (let d = l + 1, x = r.length; d < x; d++)
1245
- if (ht(a.bbox, r[d].bbox) === null) return [];
1242
+ for (let s = 0, h = r.length; s < h; s++) {
1243
+ const g = r[s];
1244
+ for (let y = s + 1, x = r.length; y < x; y++)
1245
+ if (at(g.bbox, r[y].bbox) === null) return [];
1246
1246
  }
1247
- const o = new yt(L.compare);
1248
- for (let l = 0, h = r.length; l < h; l++) {
1249
- const a = r[l].getSweepEvents();
1250
- for (let d = 0, x = a.length; d < x; d++)
1251
- if (o.insert(a[d]), o.size > Ct)
1247
+ const o = new dt(L.compare);
1248
+ for (let s = 0, h = r.length; s < h; s++) {
1249
+ const g = r[s].getSweepEvents();
1250
+ for (let y = 0, x = g.length; y < x; y++)
1251
+ if (o.insert(g[y]), o.size > kt)
1252
1252
  throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
1253
1253
  }
1254
- const u = new Ee(o);
1255
- let s = o.size, c = o.pop();
1254
+ const f = new _e(o);
1255
+ let l = o.size, c = o.pop();
1256
1256
  for (; c; ) {
1257
- const l = c.key;
1258
- if (o.size === s) {
1259
- const a = l.segment;
1260
- throw new Error(`Unable to pop() ${l.isLeft ? "left" : "right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`);
1257
+ const s = c.key;
1258
+ if (o.size === l) {
1259
+ const g = s.segment;
1260
+ throw new Error(`Unable to pop() ${s.isLeft ? "left" : "right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${g.id} [${g.leftSE.point.x}, ${g.leftSE.point.y}] -> [${g.rightSE.point.x}, ${g.rightSE.point.y}] from queue.`);
1261
1261
  }
1262
- if (o.size > Ct)
1262
+ if (o.size > kt)
1263
1263
  throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
1264
- if (u.segments.length > me)
1264
+ if (f.segments.length > Se)
1265
1265
  throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
1266
- const h = u.process(l);
1267
- for (let a = 0, d = h.length; a < d; a++) {
1268
- const x = h[a];
1266
+ const h = f.process(s);
1267
+ for (let g = 0, y = h.length; g < y; g++) {
1268
+ const x = h[g];
1269
1269
  x.consumedBy === void 0 && o.insert(x);
1270
1270
  }
1271
- s = o.size, c = o.pop();
1271
+ l = o.size, c = o.pop();
1272
1272
  }
1273
- G.reset();
1274
- const f = et.factory(u.segments);
1275
- return new we(f).getGeom();
1273
+ Z.reset();
1274
+ const u = nt.factory(f.segments);
1275
+ return new be(u).getGeom();
1276
1276
  }
1277
1277
  }
1278
- const $ = new be(), _e = function(i) {
1278
+ const $ = new Pe(), Me = function(i) {
1279
1279
  for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
1280
1280
  e[n - 1] = arguments[n];
1281
1281
  return $.run("union", i, e);
1282
- }, Se = function(i) {
1282
+ }, Le = function(i) {
1283
1283
  for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
1284
1284
  e[n - 1] = arguments[n];
1285
1285
  return $.run("intersection", i, e);
1286
- }, Pe = function(i) {
1286
+ }, Re = function(i) {
1287
1287
  for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
1288
1288
  e[n - 1] = arguments[n];
1289
1289
  return $.run("xor", i, e);
1290
- }, Me = function(i) {
1290
+ }, Ie = function(i) {
1291
1291
  for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
1292
1292
  e[n - 1] = arguments[n];
1293
1293
  return $.run("difference", i, e);
1294
1294
  };
1295
- var qt = {
1296
- union: _e,
1297
- intersection: Se,
1298
- xor: Pe,
1299
- difference: Me
1295
+ var Qt = {
1296
+ union: Me,
1297
+ intersection: Le,
1298
+ xor: Re,
1299
+ difference: Ie
1300
1300
  };
1301
- function Qt(i, t, e) {
1301
+ function Ft(i, t, e) {
1302
1302
  if (i !== null)
1303
- for (var n, r, o, u, s, c, f, g = 0, l = 0, h, a = i.type, d = a === "FeatureCollection", x = a === "Feature", y = d ? i.features.length : 1, p = 0; p < y; p++) {
1304
- f = d ? i.features[p].geometry : x ? i.geometry : i, h = f ? f.type === "GeometryCollection" : !1, s = h ? f.geometries.length : 1;
1305
- for (var v = 0; v < s; v++) {
1306
- var E = 0, w = 0;
1307
- if (u = h ? f.geometries[v] : f, u !== null) {
1308
- c = u.coordinates;
1309
- var m = u.type;
1310
- switch (g = 0, m) {
1303
+ for (var n, r, o, f, l, c, u, p = 0, s = 0, h, g = i.type, y = g === "FeatureCollection", x = g === "Feature", m = y ? i.features.length : 1, a = 0; a < m; a++) {
1304
+ u = y ? i.features[a].geometry : x ? i.geometry : i, h = u ? u.type === "GeometryCollection" : !1, l = h ? u.geometries.length : 1;
1305
+ for (var d = 0; d < l; d++) {
1306
+ var v = 0, E = 0;
1307
+ if (f = h ? u.geometries[d] : u, f !== null) {
1308
+ c = f.coordinates;
1309
+ var w = f.type;
1310
+ switch (p = 0, w) {
1311
1311
  case null:
1312
1312
  break;
1313
1313
  case "Point":
1314
1314
  if (t(
1315
1315
  c,
1316
- l,
1317
- p,
1318
- E,
1319
- w
1316
+ s,
1317
+ a,
1318
+ v,
1319
+ E
1320
1320
  ) === !1)
1321
1321
  return !1;
1322
- l++, E++;
1322
+ s++, v++;
1323
1323
  break;
1324
1324
  case "LineString":
1325
1325
  case "MultiPoint":
1326
1326
  for (n = 0; n < c.length; n++) {
1327
1327
  if (t(
1328
1328
  c[n],
1329
- l,
1330
- p,
1331
- E,
1332
- w
1329
+ s,
1330
+ a,
1331
+ v,
1332
+ E
1333
1333
  ) === !1)
1334
1334
  return !1;
1335
- l++, m === "MultiPoint" && E++;
1335
+ s++, w === "MultiPoint" && v++;
1336
1336
  }
1337
- m === "LineString" && E++;
1337
+ w === "LineString" && v++;
1338
1338
  break;
1339
1339
  case "Polygon":
1340
1340
  case "MultiLineString":
1341
1341
  for (n = 0; n < c.length; n++) {
1342
- for (r = 0; r < c[n].length - g; r++) {
1342
+ for (r = 0; r < c[n].length - p; r++) {
1343
1343
  if (t(
1344
1344
  c[n][r],
1345
- l,
1346
- p,
1347
- E,
1348
- w
1345
+ s,
1346
+ a,
1347
+ v,
1348
+ E
1349
1349
  ) === !1)
1350
1350
  return !1;
1351
- l++;
1351
+ s++;
1352
1352
  }
1353
- m === "MultiLineString" && E++, m === "Polygon" && w++;
1353
+ w === "MultiLineString" && v++, w === "Polygon" && E++;
1354
1354
  }
1355
- m === "Polygon" && E++;
1355
+ w === "Polygon" && v++;
1356
1356
  break;
1357
1357
  case "MultiPolygon":
1358
1358
  for (n = 0; n < c.length; n++) {
1359
- for (w = 0, r = 0; r < c[n].length; r++) {
1360
- for (o = 0; o < c[n][r].length - g; o++) {
1359
+ for (E = 0, r = 0; r < c[n].length; r++) {
1360
+ for (o = 0; o < c[n][r].length - p; o++) {
1361
1361
  if (t(
1362
1362
  c[n][r][o],
1363
- l,
1364
- p,
1365
- E,
1366
- w
1363
+ s,
1364
+ a,
1365
+ v,
1366
+ E
1367
1367
  ) === !1)
1368
1368
  return !1;
1369
- l++;
1369
+ s++;
1370
1370
  }
1371
- w++;
1371
+ E++;
1372
1372
  }
1373
- E++;
1373
+ v++;
1374
1374
  }
1375
1375
  break;
1376
1376
  case "GeometryCollection":
1377
- for (n = 0; n < u.geometries.length; n++)
1378
- if (Qt(u.geometries[n], t) === !1)
1377
+ for (n = 0; n < f.geometries.length; n++)
1378
+ if (Ft(f.geometries[n], t) === !1)
1379
1379
  return !1;
1380
1380
  break;
1381
1381
  default:
@@ -1385,17 +1385,17 @@ function Qt(i, t, e) {
1385
1385
  }
1386
1386
  }
1387
1387
  }
1388
- function dt(i, t) {
1389
- var e, n, r, o, u, s, c, f, g, l, h = 0, a = i.type === "FeatureCollection", d = i.type === "Feature", x = a ? i.features.length : 1;
1388
+ function xt(i, t) {
1389
+ var e, n, r, o, f, l, c, u, p, s, h = 0, g = i.type === "FeatureCollection", y = i.type === "Feature", x = g ? i.features.length : 1;
1390
1390
  for (e = 0; e < x; e++) {
1391
- for (s = a ? i.features[e].geometry : d ? i.geometry : i, f = a ? i.features[e].properties : d ? i.properties : {}, g = a ? i.features[e].bbox : d ? i.bbox : void 0, l = a ? i.features[e].id : d ? i.id : void 0, c = s ? s.type === "GeometryCollection" : !1, u = c ? s.geometries.length : 1, r = 0; r < u; r++) {
1392
- if (o = c ? s.geometries[r] : s, o === null) {
1391
+ for (l = g ? i.features[e].geometry : y ? i.geometry : i, u = g ? i.features[e].properties : y ? i.properties : {}, p = g ? i.features[e].bbox : y ? i.bbox : void 0, s = g ? i.features[e].id : y ? i.id : void 0, c = l ? l.type === "GeometryCollection" : !1, f = c ? l.geometries.length : 1, r = 0; r < f; r++) {
1392
+ if (o = c ? l.geometries[r] : l, o === null) {
1393
1393
  if (t(
1394
1394
  null,
1395
1395
  h,
1396
- f,
1397
- g,
1398
- l
1396
+ u,
1397
+ p,
1398
+ s
1399
1399
  ) === !1)
1400
1400
  return !1;
1401
1401
  continue;
@@ -1410,9 +1410,9 @@ function dt(i, t) {
1410
1410
  if (t(
1411
1411
  o,
1412
1412
  h,
1413
- f,
1414
- g,
1415
- l
1413
+ u,
1414
+ p,
1415
+ s
1416
1416
  ) === !1)
1417
1417
  return !1;
1418
1418
  break;
@@ -1422,9 +1422,9 @@ function dt(i, t) {
1422
1422
  if (t(
1423
1423
  o.geometries[n],
1424
1424
  h,
1425
- f,
1426
- g,
1427
- l
1425
+ u,
1426
+ p,
1427
+ s
1428
1428
  ) === !1)
1429
1429
  return !1;
1430
1430
  break;
@@ -1436,22 +1436,22 @@ function dt(i, t) {
1436
1436
  h++;
1437
1437
  }
1438
1438
  }
1439
- function Le(i, t) {
1440
- dt(i, function(e, n, r, o, u) {
1441
- var s = e === null ? null : e.type;
1442
- switch (s) {
1439
+ function Ce(i, t) {
1440
+ xt(i, function(e, n, r, o, f) {
1441
+ var l = e === null ? null : e.type;
1442
+ switch (l) {
1443
1443
  case null:
1444
1444
  case "Point":
1445
1445
  case "LineString":
1446
1446
  case "Polygon":
1447
1447
  return t(
1448
- V(e, r, { bbox: o, id: u }),
1448
+ X(e, r, { bbox: o, id: f }),
1449
1449
  n,
1450
1450
  0
1451
1451
  ) === !1 ? !1 : void 0;
1452
1452
  }
1453
1453
  var c;
1454
- switch (s) {
1454
+ switch (l) {
1455
1455
  case "MultiPoint":
1456
1456
  c = "Point";
1457
1457
  break;
@@ -1462,147 +1462,147 @@ function Le(i, t) {
1462
1462
  c = "Polygon";
1463
1463
  break;
1464
1464
  }
1465
- for (var f = 0; f < e.coordinates.length; f++) {
1466
- var g = e.coordinates[f], l = {
1465
+ for (var u = 0; u < e.coordinates.length; u++) {
1466
+ var p = e.coordinates[u], s = {
1467
1467
  type: c,
1468
- coordinates: g
1468
+ coordinates: p
1469
1469
  };
1470
- if (t(V(l, r), n, f) === !1)
1470
+ if (t(X(s, r), n, u) === !1)
1471
1471
  return !1;
1472
1472
  }
1473
1473
  });
1474
1474
  }
1475
- function Re(i, t = {}) {
1475
+ function ke(i, t = {}) {
1476
1476
  const e = [];
1477
- if (dt(i, (r) => {
1477
+ if (xt(i, (r) => {
1478
1478
  e.push(r.coordinates);
1479
1479
  }), e.length < 2)
1480
1480
  throw new Error("Must have at least 2 geometries");
1481
- const n = qt.union(e[0], ...e.slice(1));
1482
- return n.length === 0 ? null : n.length === 1 ? pt(n[0], t.properties) : Ft(n, t.properties);
1481
+ const n = Qt.union(e[0], ...e.slice(1));
1482
+ return n.length === 0 ? null : n.length === 1 ? yt(n[0], t.properties) : jt(n, t.properties);
1483
1483
  }
1484
- var Ut = Re;
1484
+ var Dt = ke;
1485
1485
  function W() {
1486
1486
  }
1487
- function Yt(i) {
1487
+ function Xt(i) {
1488
1488
  return i();
1489
1489
  }
1490
- function It() {
1490
+ function $t() {
1491
1491
  return /* @__PURE__ */ Object.create(null);
1492
1492
  }
1493
- function nt(i) {
1494
- i.forEach(Yt);
1493
+ function it(i) {
1494
+ i.forEach(Xt);
1495
1495
  }
1496
- function Dt(i) {
1496
+ function Vt(i) {
1497
1497
  return typeof i == "function";
1498
1498
  }
1499
- function ke(i, t) {
1499
+ function $e(i, t) {
1500
1500
  return i != i ? t == t : i !== t || i && typeof i == "object" || typeof i == "function";
1501
1501
  }
1502
- function Ce(i) {
1502
+ function Ae(i) {
1503
1503
  return Object.keys(i).length === 0;
1504
1504
  }
1505
- function Ie(i, t) {
1505
+ function Oe(i, t) {
1506
1506
  i.appendChild(t);
1507
1507
  }
1508
- function $e(i, t, e) {
1508
+ function Ne(i, t, e) {
1509
1509
  i.insertBefore(t, e || null);
1510
1510
  }
1511
- function Xt(i) {
1511
+ function Zt(i) {
1512
1512
  i.parentNode && i.parentNode.removeChild(i);
1513
1513
  }
1514
- function $t(i) {
1514
+ function At(i) {
1515
1515
  return document.createElementNS("http://www.w3.org/2000/svg", i);
1516
1516
  }
1517
1517
  function N(i, t, e) {
1518
1518
  e == null ? i.removeAttribute(t) : i.getAttribute(t) !== e && i.setAttribute(t, e);
1519
1519
  }
1520
- function Ae(i) {
1520
+ function Be(i) {
1521
1521
  return Array.from(i.childNodes);
1522
1522
  }
1523
1523
  function K(i, t, e) {
1524
1524
  i.classList.toggle(t, !!e);
1525
1525
  }
1526
- let xt;
1527
- function X(i) {
1528
- xt = i;
1526
+ let vt;
1527
+ function D(i) {
1528
+ vt = i;
1529
1529
  }
1530
- const Q = [], At = [];
1531
- let U = [];
1532
- const Ot = [], Oe = /* @__PURE__ */ Promise.resolve();
1533
- let at = !1;
1534
- function Ne() {
1535
- at || (at = !0, Oe.then(Vt));
1530
+ const j = [], Ot = [];
1531
+ let Y = [];
1532
+ const Nt = [], Te = /* @__PURE__ */ Promise.resolve();
1533
+ let gt = !1;
1534
+ function ze() {
1535
+ gt || (gt = !0, Te.then(Wt));
1536
1536
  }
1537
- function gt(i) {
1538
- U.push(i);
1537
+ function pt(i) {
1538
+ Y.push(i);
1539
1539
  }
1540
- const st = /* @__PURE__ */ new Set();
1540
+ const lt = /* @__PURE__ */ new Set();
1541
1541
  let q = 0;
1542
- function Vt() {
1542
+ function Wt() {
1543
1543
  if (q !== 0)
1544
1544
  return;
1545
- const i = xt;
1545
+ const i = vt;
1546
1546
  do {
1547
1547
  try {
1548
- for (; q < Q.length; ) {
1549
- const t = Q[q];
1550
- q++, X(t), Be(t.$$);
1548
+ for (; q < j.length; ) {
1549
+ const t = j[q];
1550
+ q++, D(t), Ge(t.$$);
1551
1551
  }
1552
1552
  } catch (t) {
1553
- throw Q.length = 0, q = 0, t;
1553
+ throw j.length = 0, q = 0, t;
1554
1554
  }
1555
- for (X(null), Q.length = 0, q = 0; At.length; ) At.pop()();
1556
- for (let t = 0; t < U.length; t += 1) {
1557
- const e = U[t];
1558
- st.has(e) || (st.add(e), e());
1555
+ for (D(null), j.length = 0, q = 0; Ot.length; ) Ot.pop()();
1556
+ for (let t = 0; t < Y.length; t += 1) {
1557
+ const e = Y[t];
1558
+ lt.has(e) || (lt.add(e), e());
1559
1559
  }
1560
- U.length = 0;
1561
- } while (Q.length);
1562
- for (; Ot.length; )
1563
- Ot.pop()();
1564
- at = !1, st.clear(), X(i);
1560
+ Y.length = 0;
1561
+ } while (j.length);
1562
+ for (; Nt.length; )
1563
+ Nt.pop()();
1564
+ gt = !1, lt.clear(), D(i);
1565
1565
  }
1566
- function Be(i) {
1566
+ function Ge(i) {
1567
1567
  if (i.fragment !== null) {
1568
- i.update(), nt(i.before_update);
1568
+ i.update(), it(i.before_update);
1569
1569
  const t = i.dirty;
1570
- i.dirty = [-1], i.fragment && i.fragment.p(i.ctx, t), i.after_update.forEach(gt);
1570
+ i.dirty = [-1], i.fragment && i.fragment.p(i.ctx, t), i.after_update.forEach(pt);
1571
1571
  }
1572
1572
  }
1573
- function ze(i) {
1573
+ function Ue(i) {
1574
1574
  const t = [], e = [];
1575
- U.forEach((n) => i.indexOf(n) === -1 ? t.push(n) : e.push(n)), e.forEach((n) => n()), U = t;
1575
+ Y.forEach((n) => i.indexOf(n) === -1 ? t.push(n) : e.push(n)), e.forEach((n) => n()), Y = t;
1576
1576
  }
1577
- const Te = /* @__PURE__ */ new Set();
1578
- function Fe(i, t) {
1579
- i && i.i && (Te.delete(i), i.i(t));
1577
+ const qe = /* @__PURE__ */ new Set();
1578
+ function je(i, t) {
1579
+ i && i.i && (qe.delete(i), i.i(t));
1580
1580
  }
1581
- function je(i, t, e) {
1581
+ function Ye(i, t, e) {
1582
1582
  const { fragment: n, after_update: r } = i.$$;
1583
- n && n.m(t, e), gt(() => {
1584
- const o = i.$$.on_mount.map(Yt).filter(Dt);
1585
- i.$$.on_destroy ? i.$$.on_destroy.push(...o) : nt(o), i.$$.on_mount = [];
1586
- }), r.forEach(gt);
1583
+ n && n.m(t, e), pt(() => {
1584
+ const o = i.$$.on_mount.map(Xt).filter(Vt);
1585
+ i.$$.on_destroy ? i.$$.on_destroy.push(...o) : it(o), i.$$.on_mount = [];
1586
+ }), r.forEach(pt);
1587
1587
  }
1588
- function qe(i, t) {
1588
+ function Qe(i, t) {
1589
1589
  const e = i.$$;
1590
- e.fragment !== null && (ze(e.after_update), nt(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
1590
+ e.fragment !== null && (Ue(e.after_update), it(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
1591
1591
  }
1592
- function Qe(i, t) {
1593
- i.$$.dirty[0] === -1 && (Q.push(i), Ne(), i.$$.dirty.fill(0)), i.$$.dirty[t / 31 | 0] |= 1 << t % 31;
1592
+ function Fe(i, t) {
1593
+ i.$$.dirty[0] === -1 && (j.push(i), ze(), i.$$.dirty.fill(0)), i.$$.dirty[t / 31 | 0] |= 1 << t % 31;
1594
1594
  }
1595
- function Ue(i, t, e, n, r, o, u = null, s = [-1]) {
1596
- const c = xt;
1597
- X(i);
1598
- const f = i.$$ = {
1595
+ function De(i, t, e, n, r, o, f = null, l = [-1]) {
1596
+ const c = vt;
1597
+ D(i);
1598
+ const u = i.$$ = {
1599
1599
  fragment: null,
1600
1600
  ctx: [],
1601
1601
  // state
1602
1602
  props: o,
1603
1603
  update: W,
1604
1604
  not_equal: r,
1605
- bound: It(),
1605
+ bound: $t(),
1606
1606
  // lifecycle
1607
1607
  on_mount: [],
1608
1608
  on_destroy: [],
@@ -1611,27 +1611,27 @@ function Ue(i, t, e, n, r, o, u = null, s = [-1]) {
1611
1611
  after_update: [],
1612
1612
  context: new Map(t.context || (c ? c.$$.context : [])),
1613
1613
  // everything else
1614
- callbacks: It(),
1615
- dirty: s,
1614
+ callbacks: $t(),
1615
+ dirty: l,
1616
1616
  skip_bound: !1,
1617
1617
  root: t.target || c.$$.root
1618
1618
  };
1619
- u && u(f.root);
1620
- let g = !1;
1621
- if (f.ctx = e ? e(i, t.props || {}, (l, h, ...a) => {
1622
- const d = a.length ? a[0] : h;
1623
- return f.ctx && r(f.ctx[l], f.ctx[l] = d) && (!f.skip_bound && f.bound[l] && f.bound[l](d), g && Qe(i, l)), h;
1624
- }) : [], f.update(), g = !0, nt(f.before_update), f.fragment = n ? n(f.ctx) : !1, t.target) {
1619
+ f && f(u.root);
1620
+ let p = !1;
1621
+ if (u.ctx = e ? e(i, t.props || {}, (s, h, ...g) => {
1622
+ const y = g.length ? g[0] : h;
1623
+ return u.ctx && r(u.ctx[s], u.ctx[s] = y) && (!u.skip_bound && u.bound[s] && u.bound[s](y), p && Fe(i, s)), h;
1624
+ }) : [], u.update(), p = !0, it(u.before_update), u.fragment = n ? n(u.ctx) : !1, t.target) {
1625
1625
  if (t.hydrate) {
1626
- const l = Ae(t.target);
1627
- f.fragment && f.fragment.l(l), l.forEach(Xt);
1626
+ const s = Be(t.target);
1627
+ u.fragment && u.fragment.l(s), s.forEach(Zt);
1628
1628
  } else
1629
- f.fragment && f.fragment.c();
1630
- t.intro && Fe(i.$$.fragment), je(i, t.target, t.anchor), Vt();
1629
+ u.fragment && u.fragment.c();
1630
+ t.intro && je(i.$$.fragment), Ye(i, t.target, t.anchor), Wt();
1631
1631
  }
1632
- X(c);
1632
+ D(c);
1633
1633
  }
1634
- class Ye {
1634
+ class Xe {
1635
1635
  constructor() {
1636
1636
  /**
1637
1637
  * ### PRIVATE API
@@ -1640,7 +1640,7 @@ class Ye {
1640
1640
  *
1641
1641
  * @type {any}
1642
1642
  */
1643
- it(this, "$$");
1643
+ rt(this, "$$");
1644
1644
  /**
1645
1645
  * ### PRIVATE API
1646
1646
  *
@@ -1648,11 +1648,11 @@ class Ye {
1648
1648
  *
1649
1649
  * @type {any}
1650
1650
  */
1651
- it(this, "$$set");
1651
+ rt(this, "$$set");
1652
1652
  }
1653
1653
  /** @returns {void} */
1654
1654
  $destroy() {
1655
- qe(this, 1), this.$destroy = W;
1655
+ Qe(this, 1), this.$destroy = W;
1656
1656
  }
1657
1657
  /**
1658
1658
  * @template {Extract<keyof Events, string>} K
@@ -1661,7 +1661,7 @@ class Ye {
1661
1661
  * @returns {() => void}
1662
1662
  */
1663
1663
  $on(t, e) {
1664
- if (!Dt(e))
1664
+ if (!Vt(e))
1665
1665
  return W;
1666
1666
  const n = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
1667
1667
  return n.push(e), () => {
@@ -1674,16 +1674,16 @@ class Ye {
1674
1674
  * @returns {void}
1675
1675
  */
1676
1676
  $set(t) {
1677
- this.$$set && !Ce(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
1677
+ this.$$set && !Ae(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
1678
1678
  }
1679
1679
  }
1680
- const De = "4";
1681
- typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(De);
1682
- function Xe(i) {
1680
+ const Ve = "4";
1681
+ typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Ve);
1682
+ function Ze(i) {
1683
1683
  let t, e, n;
1684
1684
  return {
1685
1685
  c() {
1686
- t = $t("svg"), e = $t("path"), N(e, "stroke-width", "4"), N(e, "d", "M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"), N(e, "class", "svelte-gzo3ar"), N(t, "width", n = /*displayIn*/
1686
+ t = At("svg"), e = At("path"), N(e, "stroke-width", "4"), N(e, "d", "M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"), N(e, "class", "svelte-gzo3ar"), N(t, "width", n = /*displayIn*/
1687
1687
  i[0] === "list" ? 20 : void 0), N(t, "viewBox", "0 0 70 85"), N(t, "fill", "none"), N(t, "class", "svelte-gzo3ar"), K(
1688
1688
  t,
1689
1689
  "in-map",
@@ -1697,7 +1697,7 @@ function Xe(i) {
1697
1697
  );
1698
1698
  },
1699
1699
  m(r, o) {
1700
- $e(r, t, o), Ie(t, e);
1700
+ Ne(r, t, o), Oe(t, e);
1701
1701
  },
1702
1702
  p(r, [o]) {
1703
1703
  o & /*displayIn*/
@@ -1719,57 +1719,57 @@ function Xe(i) {
1719
1719
  i: W,
1720
1720
  o: W,
1721
1721
  d(r) {
1722
- r && Xt(t);
1722
+ r && Zt(t);
1723
1723
  }
1724
1724
  };
1725
1725
  }
1726
- function Ve(i, t, e) {
1726
+ function We(i, t, e) {
1727
1727
  let { displayIn: n } = t;
1728
1728
  return i.$$set = (r) => {
1729
1729
  "displayIn" in r && e(0, n = r.displayIn);
1730
1730
  }, [n];
1731
1731
  }
1732
- class Ze extends Ye {
1732
+ class Je extends Xe {
1733
1733
  constructor(t) {
1734
- super(), Ue(this, t, Ve, Xe, ke, { displayIn: 0 });
1734
+ super(), De(this, t, We, Ze, $e, { displayIn: 0 });
1735
1735
  }
1736
1736
  }
1737
- function Ge(i, t = {}) {
1737
+ function Ke(i, t = {}) {
1738
1738
  if (i.bbox != null && t.recompute !== !0)
1739
1739
  return i.bbox;
1740
1740
  const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
1741
- return Qt(i, (n) => {
1741
+ return Ft(i, (n) => {
1742
1742
  e[0] > n[0] && (e[0] = n[0]), e[1] > n[1] && (e[1] = n[1]), e[2] < n[0] && (e[2] = n[0]), e[3] < n[1] && (e[3] = n[1]);
1743
1743
  }), e;
1744
1744
  }
1745
- var Nt = Ge;
1746
- function We(i) {
1745
+ var Bt = Ke;
1746
+ function He(i) {
1747
1747
  const t = [];
1748
- if (dt(i, (r) => {
1748
+ if (xt(i, (r) => {
1749
1749
  t.push(r.coordinates);
1750
1750
  }), t.length < 2)
1751
1751
  throw new Error("Must have at least two features");
1752
- const e = i.features[0].properties || {}, n = qt.difference(t[0], ...t.slice(1));
1753
- return n.length === 0 ? null : n.length === 1 ? pt(n[0], e) : Ft(n, e);
1752
+ const e = i.features[0].properties || {}, n = Qt.difference(t[0], ...t.slice(1));
1753
+ return n.length === 0 ? null : n.length === 1 ? yt(n[0], e) : jt(n, e);
1754
1754
  }
1755
- var Je = We;
1756
- function Ke(i) {
1755
+ var tn = He;
1756
+ function en(i) {
1757
1757
  if (!i)
1758
1758
  throw new Error("geojson is required");
1759
1759
  var t = [];
1760
- return Le(i, function(e) {
1760
+ return Ce(i, function(e) {
1761
1761
  t.push(e);
1762
- }), Z(t);
1762
+ }), V(t);
1763
1763
  }
1764
- var He = Ke;
1765
- function Bt(i) {
1764
+ var nn = en;
1765
+ function Tt(i) {
1766
1766
  const t = [...i];
1767
1767
  return t[2] < t[0] && (Math.abs((t[0] + t[2] + 360) / 2) > Math.abs((t[0] - 360 + t[2]) / 2) ? t[0] -= 360 : t[2] += 360), t;
1768
1768
  }
1769
1769
  function zt(i, t) {
1770
- const e = Je(
1771
- Z([
1772
- pt([
1770
+ const e = tn(
1771
+ V([
1772
+ yt([
1773
1773
  [
1774
1774
  [180, 90],
1775
1775
  [-180, 90],
@@ -1784,28 +1784,27 @@ function zt(i, t) {
1784
1784
  if (!e)
1785
1785
  return;
1786
1786
  e.properties = { isMask: !0 };
1787
- const n = Bt(Nt(i)), r = (n[2] - n[0]) / 360 / 1e3, o = n[0] < -180, u = n[2] > 180, s = He(i);
1788
- if (s.features.length > 1 && (o || u))
1789
- for (const c of s.features) {
1790
- const f = Bt(Nt(c));
1791
- if (u && f[0] < -180 + r)
1792
- for (const g of c.geometry.coordinates)
1793
- for (const l of g)
1794
- l[0] += 360 - r;
1795
- if (o && f[2] > 180 - r)
1796
- for (const g of c.geometry.coordinates)
1797
- for (const l of g)
1798
- l[0] -= 360 - r;
1787
+ const n = Tt(Bt(i)), r = (n[2] - n[0]) / 360 / 1e3, o = n[0] < -180, f = n[2] > 180, l = nn(i);
1788
+ if (l.features.length > 1 && (o || f))
1789
+ for (const c of l.features) {
1790
+ const u = Tt(Bt(c));
1791
+ if (f && u[0] < -180 + r)
1792
+ for (const p of c.geometry.coordinates)
1793
+ for (const s of p)
1794
+ s[0] += 360 - r;
1795
+ if (o && u[2] > 180 - r)
1796
+ for (const p of c.geometry.coordinates)
1797
+ for (const s of p)
1798
+ s[0] -= 360 - r;
1799
1799
  }
1800
1800
  t(
1801
- Z([
1802
- s.features.length < 2 ? i : Ut(s) ?? i,
1801
+ V([
1802
+ l.features.length < 2 ? i : Dt(l) ?? i,
1803
1803
  e
1804
1804
  ])
1805
1805
  );
1806
1806
  }
1807
- const Tt = Z([]);
1808
- function en(i, t, e = !0, n = !0, r = {}, o = {}, u = {
1807
+ const Gt = {
1809
1808
  fill: {
1810
1809
  paint: {
1811
1810
  "fill-color": "#000",
@@ -1824,123 +1823,146 @@ function en(i, t, e = !0, n = !0, r = {}, o = {}, u = {
1824
1823
  },
1825
1824
  filter: ["!", ["has", "isMask"]]
1826
1825
  }
1827
- }) {
1828
- let s;
1829
- const c = [];
1830
- let f, g, l;
1831
- function h() {
1832
- !i.getSource("full-geom") && (u != null && u.fill || u != null && u.line) && i.addSource("full-geom", {
1833
- type: "geojson",
1834
- data: Tt
1835
- }), !i.getLayer("full-geom-fill") && (u != null && u.fill) && i.addLayer({
1836
- ...u == null ? void 0 : u.fill,
1837
- id: "full-geom-fill",
1826
+ }, H = "mtlr-gc-full-geom", Ut = "mtlr-gc-full-geom-fill", qt = "mtlr-gc-full-geom-line";
1827
+ function on(i, t, e = !0, n = !0, r = {}, o = {}, f = Gt, l = !1) {
1828
+ let c;
1829
+ const u = [];
1830
+ let p, s, h;
1831
+ function g() {
1832
+ if (!i.loaded) {
1833
+ i.once("load", g);
1834
+ return;
1835
+ }
1836
+ const a = f ? f === !0 ? Gt : f : void 0;
1837
+ if (!(a != null && a.fill) && !(a != null && a.line))
1838
+ return;
1839
+ const d = i.getSource(H);
1840
+ if (d)
1841
+ d.setData(h ?? V([]));
1842
+ else if (h)
1843
+ i.addSource(H, {
1844
+ type: "geojson",
1845
+ data: h
1846
+ });
1847
+ else
1848
+ return;
1849
+ !i.getLayer(Ut) && (a != null && a.fill) && i.addLayer({
1850
+ ...a == null ? void 0 : a.fill,
1851
+ id: Ut,
1838
1852
  type: "fill",
1839
- source: "full-geom"
1840
- }), !i.getLayer("full-geom-line") && (u != null && u.line) && i.addLayer({
1841
- ...u == null ? void 0 : u.line,
1842
- id: "full-geom-line",
1853
+ source: H
1854
+ }), !i.getLayer(qt) && (a != null && a.line) && i.addLayer({
1855
+ ...a == null ? void 0 : a.line,
1856
+ id: qt,
1843
1857
  type: "line",
1844
- source: "full-geom"
1845
- }), l && x(l);
1858
+ source: H
1859
+ });
1846
1860
  }
1847
- i.loaded() ? h() : i.once("load", () => {
1848
- h();
1849
- }), i.on("styledata", () => {
1850
- h();
1861
+ function y(a) {
1862
+ h = a, g();
1863
+ }
1864
+ i.on("styledata", () => {
1865
+ setTimeout(() => {
1866
+ h && g();
1867
+ });
1851
1868
  });
1852
- const a = (y) => {
1853
- s == null || s({
1869
+ const x = (a) => {
1870
+ c == null || c({
1854
1871
  type: "mapClick",
1855
- coordinates: [y.lngLat.lng, y.lngLat.lat]
1872
+ coordinates: [a.lngLat.lng, a.lngLat.lat]
1856
1873
  });
1857
1874
  };
1858
- function d(y = !1) {
1875
+ function m(a = !1) {
1859
1876
  if (!t)
1860
1877
  throw new Error();
1861
- const p = document.createElement("div");
1862
- return y && p.classList.add("marker-interactive"), new Ze({
1878
+ const d = document.createElement("div");
1879
+ return a && d.classList.add("marker-interactive"), new Je({
1863
1880
  props: { displayIn: "maplibre" },
1864
- target: p
1865
- }), new t.Marker({ element: p, offset: [1, -13] });
1866
- }
1867
- function x(y) {
1868
- var p;
1869
- l = y, y && ((p = i.getSource("full-geom")) == null || p.setData(y));
1881
+ target: d
1882
+ }), new t.Marker({ element: d, offset: [1, -13] });
1870
1883
  }
1871
1884
  return {
1872
- setEventHandler(y) {
1873
- y ? (s = y, i.on("click", a)) : (s = void 0, i.off("click", a));
1885
+ setEventHandler(a) {
1886
+ a ? (c = a, i.on("click", x)) : (c = void 0, i.off("click", x));
1874
1887
  },
1875
- flyTo(y, p) {
1876
- i.flyTo({ center: y, ...p ? { zoom: p } : {}, ...r });
1888
+ flyTo(a, d) {
1889
+ i.flyTo({ center: a, ...d ? { zoom: d } : {}, ...r });
1877
1890
  },
1878
- fitBounds(y, p, v) {
1891
+ fitBounds(a, d, v) {
1879
1892
  i.fitBounds(
1880
1893
  [
1881
- [y[0], y[1]],
1882
- [y[2], y[3]]
1894
+ [a[0], a[1]],
1895
+ [a[2], a[3]]
1883
1896
  ],
1884
- { padding: p, ...v ? { maxZoom: v } : {}, ...o }
1897
+ { padding: d, ...v ? { maxZoom: v } : {}, ...o }
1885
1898
  );
1886
1899
  },
1887
- indicateReverse(y) {
1888
- i.getCanvasContainer().style.cursor = y ? "crosshair" : "";
1900
+ indicateReverse(a) {
1901
+ i.getCanvasContainer().style.cursor = a ? "crosshair" : "";
1889
1902
  },
1890
- setReverseMarker(y) {
1891
- !t || !e || (g ? y ? g.setLngLat(y) : (g.remove(), g = void 0) : y && (g = (typeof e == "object" ? new t.Marker(e) : d()).setLngLat(y).addTo(i), g.getElement().classList.add("marker-reverse")));
1903
+ setReverseMarker(a) {
1904
+ !t || !e || (s ? a ? s.setLngLat(a) : (s.remove(), s = void 0) : a && (e instanceof Function ? s = e(i) ?? void 0 : (s = (typeof e == "object" ? new t.Marker(e) : m()).setLngLat(a).addTo(i), s.getElement().classList.add("marker-reverse"))));
1892
1905
  },
1893
- setMarkers(y, p) {
1894
- if (e) {
1895
- for (const v of c)
1896
- v.remove();
1897
- if (c.length = 0, x(Tt), !!t) {
1898
- if (p) {
1899
- let v = !1;
1900
- if (p.geometry.type === "GeometryCollection") {
1901
- const E = p.geometry.geometries.filter(
1902
- (w) => w.type === "Polygon" || w.type === "MultiPolygon"
1906
+ setMarkers(a, d) {
1907
+ for (const v of u)
1908
+ v.remove();
1909
+ if (u.length = 0, y(void 0), !!t) {
1910
+ if (d) {
1911
+ let v = !1;
1912
+ if (d.geometry.type === "GeometryCollection") {
1913
+ const E = d.geometry.geometries.filter(
1914
+ (w) => w.type === "Polygon" || w.type === "MultiPolygon"
1915
+ );
1916
+ t: if (E.length > 0) {
1917
+ const w = Dt(
1918
+ V(E.map((b) => X(b)))
1903
1919
  );
1904
- t: if (E.length > 0) {
1905
- const w = Ut(
1906
- Z(E.map((m) => V(m)))
1907
- );
1908
- if (!w)
1909
- break t;
1910
- zt(
1911
- {
1912
- ...p,
1913
- geometry: w.geometry
1914
- },
1915
- x
1916
- ), v = !0;
1917
- } else {
1918
- const w = p.geometry.geometries.filter(
1919
- (m) => m.type === "LineString" || m.type === "MultiLineString"
1920
- );
1921
- w.length > 0 && (x({
1922
- ...p,
1923
- geometry: { type: "GeometryCollection", geometries: w }
1924
- }), v = !0);
1925
- }
1920
+ if (!w)
1921
+ break t;
1922
+ zt(
1923
+ {
1924
+ ...d,
1925
+ geometry: w.geometry
1926
+ },
1927
+ y
1928
+ ), v = !0;
1929
+ } else {
1930
+ const w = d.geometry.geometries.filter(
1931
+ (b) => b.type === "LineString" || b.type === "MultiLineString"
1932
+ );
1933
+ w.length > 0 && (y({
1934
+ ...d,
1935
+ geometry: { type: "GeometryCollection", geometries: w }
1936
+ }), v = !0);
1926
1937
  }
1927
- if (!v) {
1928
- if (p.geometry.type === "Polygon" || p.geometry.type === "MultiPolygon")
1929
- zt(p, x);
1930
- else if (p.geometry.type === "LineString" || p.geometry.type === "MultiLineString") {
1931
- x(p);
1932
- return;
1933
- }
1938
+ }
1939
+ if (!v) {
1940
+ if (d.geometry.type === "Polygon" || d.geometry.type === "MultiPolygon")
1941
+ zt(d, y);
1942
+ else if (d.geometry.type === "LineString" || d.geometry.type === "MultiLineString") {
1943
+ y(d);
1944
+ return;
1934
1945
  }
1935
- e && c.push(
1936
- (typeof e == "object" ? new t.Marker(e) : d()).setLngLat(p.center).addTo(i)
1937
- );
1938
1946
  }
1939
- if (n)
1940
- for (const v of y ?? []) {
1941
- if (v === p)
1947
+ if (!l && d.geometry.type !== "Point")
1948
+ return;
1949
+ if (e instanceof Function) {
1950
+ const E = e(i, d);
1951
+ E && u.push(E);
1952
+ } else e && u.push(
1953
+ typeof e == "object" ? new t.Marker(e) : m().setLngLat(d.center).addTo(i)
1954
+ );
1955
+ }
1956
+ if (n)
1957
+ for (const v of a ?? []) {
1958
+ if (v === d)
1959
+ continue;
1960
+ let E;
1961
+ if (n instanceof Function) {
1962
+ if (E = n(i, v), !E)
1942
1963
  continue;
1943
- const E = (typeof n == "object" ? new t.Marker(n) : d(!0)).setLngLat(v.center).setPopup(
1964
+ } else
1965
+ E = (typeof n == "object" ? new t.Marker(n) : m(!0)).setLngLat(v.center).setPopup(
1944
1966
  new t.Popup({
1945
1967
  offset: [1, -27],
1946
1968
  closeButton: !1,
@@ -1949,28 +1971,28 @@ function en(i, t, e = !0, n = !0, r = {}, o = {}, u = {
1949
1971
  }).setText(
1950
1972
  v.place_type[0] === "reverse" ? v.place_name : v.place_name.replace(/,.*/, "")
1951
1973
  )
1952
- ).addTo(i), w = E.getElement();
1953
- w.addEventListener("click", (m) => {
1954
- m.stopPropagation(), s == null || s({ type: "markerClick", id: v.id });
1955
- }), w.addEventListener("mouseenter", () => {
1956
- s == null || s({ type: "markerMouseEnter", id: v.id }), E.togglePopup();
1957
- }), w.addEventListener("mouseleave", () => {
1958
- s == null || s({ type: "markerMouseLeave", id: v.id }), E.togglePopup();
1959
- }), c.push(E);
1960
- }
1961
- }
1974
+ ).addTo(i);
1975
+ const w = E.getElement();
1976
+ w.addEventListener("click", (b) => {
1977
+ b.stopPropagation(), c == null || c({ type: "markerClick", id: v.id });
1978
+ }), w.addEventListener("mouseenter", () => {
1979
+ c == null || c({ type: "markerMouseEnter", id: v.id }), E.togglePopup();
1980
+ }), w.addEventListener("mouseleave", () => {
1981
+ c == null || c({ type: "markerMouseLeave", id: v.id }), E.togglePopup();
1982
+ }), u.push(E);
1983
+ }
1962
1984
  }
1963
1985
  },
1964
- setSelectedMarker(y) {
1965
- f && f.getElement().classList.toggle("marker-selected", !1), f = y > -1 ? c[y] : void 0, f == null || f.getElement().classList.toggle("marker-selected", !0);
1986
+ setSelectedMarker(a) {
1987
+ p && p.getElement().classList.toggle("marker-selected", !1), p = a > -1 ? u[a] : void 0, p == null || p.getElement().classList.toggle("marker-selected", !0);
1966
1988
  },
1967
1989
  getCenterAndZoom() {
1968
- const y = i.getCenter();
1969
- return [i.getZoom(), y.lng, y.lat];
1990
+ const a = i.getCenter();
1991
+ return [i.getZoom(), a.lng, a.lat];
1970
1992
  }
1971
1993
  };
1972
1994
  }
1973
1995
  export {
1974
- en as createMapLibreGlMapController
1996
+ on as createMapLibreGlMapController
1975
1997
  };
1976
1998
  //# sourceMappingURL=maplibregl-controller.js.map