@maplat/tin 0.11.1 → 0.11.2

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.
package/dist/tin.js CHANGED
@@ -1,15 +1,15 @@
1
- var Ke = Object.defineProperty;
2
- var Qe = (o, t, e) => t in o ? Ke(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
- var rt = (o, t, e) => Qe(o, typeof t != "symbol" ? t + "" : t, e);
4
- import Ze from "@turf/boolean-point-in-polygon";
5
- import ts from "@turf/centroid";
1
+ var Qe = Object.defineProperty;
2
+ var Ze = (o, t, e) => t in o ? Qe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
3
+ var rt = (o, t, e) => Ze(o, typeof t != "symbol" ? t + "" : t, e);
4
+ import ts from "@turf/boolean-point-in-polygon";
5
+ import es from "@turf/centroid";
6
6
  import ke from "@turf/convex";
7
7
  import { featureCollection as Ot, polygon as me, point as Jt, lineString as xe } from "@turf/helpers";
8
- import es from "@turf/line-intersect";
9
- import ss from "delaunator";
10
- var ns = Object.defineProperty, is = (o, t, e) => t in o ? ns(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, nt = (o, t, e) => is(o, typeof t != "symbol" ? t + "" : t, e);
11
- const Tt = 11102230246251565e-32, lt = 134217729, rs = (3 + 8 * Tt) * Tt;
12
- function he(o, t, e, s, i) {
8
+ import ss from "@turf/line-intersect";
9
+ import ns from "delaunator";
10
+ var is = Object.defineProperty, rs = (o, t, e) => t in o ? is(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, nt = (o, t, e) => rs(o, typeof t != "symbol" ? t + "" : t, e);
11
+ const Tt = 11102230246251565e-32, lt = 134217729, os = (3 + 8 * Tt) * Tt;
12
+ function ae(o, t, e, s, i) {
13
13
  let n, r, a, f, c = t[0], u = s[0], h = 0, l = 0;
14
14
  u > c == u > -c ? (n = c, c = t[++h]) : (n = u, u = s[++l]);
15
15
  let p = 0;
@@ -22,7 +22,7 @@ function he(o, t, e, s, i) {
22
22
  r = n + u, f = r - n, a = n - (r - f) + (u - f), u = s[++l], n = r, a !== 0 && (i[p++] = a);
23
23
  return (n !== 0 || p === 0) && (i[p++] = n), p;
24
24
  }
25
- function os(o, t) {
25
+ function as(o, t) {
26
26
  let e = t[0];
27
27
  for (let s = 1; s < o; s++) e += t[s];
28
28
  return e;
@@ -30,26 +30,26 @@ function os(o, t) {
30
30
  function Ht(o) {
31
31
  return new Float64Array(o);
32
32
  }
33
- const as = (3 + 16 * Tt) * Tt, hs = (2 + 12 * Tt) * Tt, cs = (9 + 64 * Tt) * Tt * Tt, Vt = Ht(4), _e = Ht(8), Me = Ht(12), Se = Ht(16), gt = Ht(4);
34
- function fs(o, t, e, s, i, n, r) {
33
+ const hs = (3 + 16 * Tt) * Tt, cs = (2 + 12 * Tt) * Tt, fs = (9 + 64 * Tt) * Tt * Tt, Vt = Ht(4), _e = Ht(8), Me = Ht(12), Se = Ht(16), gt = Ht(4);
34
+ function us(o, t, e, s, i, n, r) {
35
35
  let a, f, c, u, h, l, p, y, g, b, w, S, _, v, T, I, N, V;
36
36
  const z = o - i, G = e - i, tt = t - n, X = s - n;
37
37
  v = z * X, l = lt * z, p = l - (l - z), y = z - p, l = lt * X, g = l - (l - X), b = X - g, T = y * b - (v - p * g - y * g - p * b), I = tt * G, l = lt * tt, p = l - (l - tt), y = tt - p, l = lt * G, g = l - (l - G), b = G - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, Vt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, Vt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, Vt[2] = S - (V - h) + (w - h), Vt[3] = V;
38
- let it = os(4, Vt), d = hs * r;
39
- if (it >= d || -it >= d || (h = o - z, a = o - (z + h) + (h - i), h = e - G, c = e - (G + h) + (h - i), h = t - tt, f = t - (tt + h) + (h - n), h = s - X, u = s - (X + h) + (h - n), a === 0 && f === 0 && c === 0 && u === 0) || (d = cs * r + rs * Math.abs(it), it += z * u + X * a - (tt * c + G * f), it >= d || -it >= d)) return it;
38
+ let it = as(4, Vt), d = cs * r;
39
+ if (it >= d || -it >= d || (h = o - z, a = o - (z + h) + (h - i), h = e - G, c = e - (G + h) + (h - i), h = t - tt, f = t - (tt + h) + (h - n), h = s - X, u = s - (X + h) + (h - n), a === 0 && f === 0 && c === 0 && u === 0) || (d = fs * r + os * Math.abs(it), it += z * u + X * a - (tt * c + G * f), it >= d || -it >= d)) return it;
40
40
  v = a * X, l = lt * a, p = l - (l - a), y = a - p, l = lt * X, g = l - (l - X), b = X - g, T = y * b - (v - p * g - y * g - p * b), I = f * G, l = lt * f, p = l - (l - f), y = f - p, l = lt * G, g = l - (l - G), b = G - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, gt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, gt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, gt[2] = S - (V - h) + (w - h), gt[3] = V;
41
- const m = he(4, Vt, 4, gt, _e);
41
+ const m = ae(4, Vt, 4, gt, _e);
42
42
  v = z * u, l = lt * z, p = l - (l - z), y = z - p, l = lt * u, g = l - (l - u), b = u - g, T = y * b - (v - p * g - y * g - p * b), I = tt * c, l = lt * tt, p = l - (l - tt), y = tt - p, l = lt * c, g = l - (l - c), b = c - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, gt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, gt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, gt[2] = S - (V - h) + (w - h), gt[3] = V;
43
- const x = he(m, _e, 4, gt, Me);
43
+ const x = ae(m, _e, 4, gt, Me);
44
44
  v = a * u, l = lt * a, p = l - (l - a), y = a - p, l = lt * u, g = l - (l - u), b = u - g, T = y * b - (v - p * g - y * g - p * b), I = f * c, l = lt * f, p = l - (l - f), y = f - p, l = lt * c, g = l - (l - c), b = c - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, gt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, gt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, gt[2] = S - (V - h) + (w - h), gt[3] = V;
45
- const A = he(x, Me, 4, gt, Se);
45
+ const A = ae(x, Me, 4, gt, Se);
46
46
  return Se[A - 1];
47
47
  }
48
- function us(o, t, e, s, i, n) {
48
+ function ls(o, t, e, s, i, n) {
49
49
  const r = (t - n) * (e - i), a = (o - i) * (s - n), f = r - a, c = Math.abs(r + a);
50
- return Math.abs(f) >= as * c ? f : -fs(o, t, e, s, i, n, c);
50
+ return Math.abs(f) >= hs * c ? f : -us(o, t, e, s, i, n, c);
51
51
  }
52
- function ls(o, t) {
52
+ function ds(o, t) {
53
53
  var e, s, i = 0, n, r, a, f, c, u, h, l = o[0], p = o[1], y = t.length;
54
54
  for (e = 0; e < y; e++) {
55
55
  s = 0;
@@ -61,7 +61,7 @@ function ls(o, t) {
61
61
  if (f <= 0 && r >= 0 || r <= 0 && f >= 0)
62
62
  return 0;
63
63
  } else if (c >= 0 && a <= 0 || c <= 0 && a >= 0) {
64
- if (n = us(r, f, a, c, 0, 0), n === 0)
64
+ if (n = ls(r, f, a, c, 0, 0), n === 0)
65
65
  return 0;
66
66
  (n > 0 && c > 0 && a <= 0 || n < 0 && c <= 0 && a > 0) && i++;
67
67
  }
@@ -70,7 +70,7 @@ function ls(o, t) {
70
70
  }
71
71
  return i % 2 !== 0;
72
72
  }
73
- function je(o, t, e = {}) {
73
+ function Le(o, t, e = {}) {
74
74
  const s = { type: "Feature" };
75
75
  return (e.id === 0 || e.id) && (s.id = e.id), e.bbox && (s.bbox = e.bbox), s.properties = t || {}, s.geometry = o, s;
76
76
  }
@@ -83,12 +83,12 @@ function Yt(o, t, e = {}) {
83
83
  throw new Error("coordinates must be at least 2 numbers long");
84
84
  if (!Ae(o[0]) || !Ae(o[1]))
85
85
  throw new Error("coordinates must contain numbers");
86
- return je({
86
+ return Le({
87
87
  type: "Point",
88
88
  coordinates: o
89
89
  }, t, e);
90
90
  }
91
- function Le(o, t, e = {}) {
91
+ function Ve(o, t, e = {}) {
92
92
  for (const s of o) {
93
93
  if (s.length < 4)
94
94
  throw new Error(
@@ -100,7 +100,7 @@ function Le(o, t, e = {}) {
100
100
  if (s[s.length - 1][i] !== s[0][i])
101
101
  throw new Error("First and last Position are not equivalent.");
102
102
  }
103
- return je({
103
+ return Le({
104
104
  type: "Polygon",
105
105
  coordinates: o
106
106
  }, t, e);
@@ -112,7 +112,7 @@ function Lt(o, t = {}) {
112
112
  function Ae(o) {
113
113
  return !isNaN(o) && o !== null && !Array.isArray(o);
114
114
  }
115
- function ds(o) {
115
+ function gs(o) {
116
116
  if (!o)
117
117
  throw new Error("coord is required");
118
118
  if (!Array.isArray(o)) {
@@ -137,31 +137,31 @@ function Ee(o) {
137
137
  "coords must be GeoJSON Feature, Geometry Object or an Array"
138
138
  );
139
139
  }
140
- function gs(o) {
140
+ function ps(o) {
141
141
  return o.type === "Feature" ? o.geometry : o;
142
142
  }
143
- function ps(o, t, e = {}) {
143
+ function ws(o, t, e = {}) {
144
144
  if (!o)
145
145
  throw new Error("point is required");
146
146
  if (!t)
147
147
  throw new Error("polygon is required");
148
- const s = ds(o), i = gs(t), n = i.type, r = t.bbox;
148
+ const s = gs(o), i = ps(t), n = i.type, r = t.bbox;
149
149
  let a = i.coordinates;
150
- if (r && ws(s, r) === !1)
150
+ if (r && ms(s, r) === !1)
151
151
  return !1;
152
152
  n === "Polygon" && (a = [a]);
153
153
  let f = !1;
154
154
  for (var c = 0; c < a.length; ++c) {
155
- const u = ls(s, a[c]);
155
+ const u = ds(s, a[c]);
156
156
  if (u === 0) return !e.ignoreBoundary;
157
157
  u && (f = !0);
158
158
  }
159
159
  return f;
160
160
  }
161
- function ws(o, t) {
161
+ function ms(o, t) {
162
162
  return t[0] <= o[0] && t[1] <= o[1] && t[2] >= o[0] && t[3] >= o[1];
163
163
  }
164
- var we = ps;
164
+ var pe = ws;
165
165
  function ve(o) {
166
166
  const t = o.features;
167
167
  for (let e = 0; e < t.length; e++) {
@@ -224,7 +224,7 @@ function ve(o) {
224
224
  }
225
225
  return o;
226
226
  }
227
- function ms(o) {
227
+ function bs(o) {
228
228
  const t = ["a", "b", "c", "a"].map(
229
229
  (n) => o.properties[n].geom
230
230
  ), e = o.geometry.coordinates[0], s = o.properties, i = {
@@ -232,20 +232,20 @@ function ms(o) {
232
232
  b: { geom: e[1], index: s.b.index },
233
233
  c: { geom: e[2], index: s.c.index }
234
234
  };
235
- return Le([t], i);
235
+ return Ve([t], i);
236
236
  }
237
- function bs(o) {
237
+ function ys(o) {
238
238
  const t = [0, 1, 2, 0].map((s) => o[s][0][0]), e = {
239
239
  a: { geom: o[0][0][1], index: o[0][1] },
240
240
  b: { geom: o[1][0][1], index: o[1][1] },
241
241
  c: { geom: o[2][0][1], index: o[2][1] }
242
242
  };
243
- return Le([t], e);
243
+ return Ve([t], e);
244
244
  }
245
245
  function Gt(o, t, e, s, i, n = !1, r) {
246
246
  const a = o.map(
247
247
  (f) => {
248
- (!r || r < 2.00703) && (f = Ve(f));
248
+ (!r || r < 2.00703) && (f = We(f));
249
249
  const c = isFinite(f) ? t[f] : f === "c" ? s : f === "b0" ? i[0] : f === "b1" ? i[1] : f === "b2" ? i[2] : f === "b3" ? i[3] : function() {
250
250
  const u = f.match(/e(\d+)/);
251
251
  if (u) {
@@ -257,12 +257,12 @@ function Gt(o, t, e, s, i, n = !1, r) {
257
257
  return n ? [[c[1], c[0]], f] : [[c[0], c[1]], f];
258
258
  }
259
259
  );
260
- return bs(a);
260
+ return ys(a);
261
261
  }
262
- function Ve(o) {
262
+ function We(o) {
263
263
  return typeof o == "number" ? o : o.replace(/^(c|e|b)(?:ent|dgeNode|box)(\d+)?$/, "$1$2");
264
264
  }
265
- function We(o, t) {
265
+ function ze(o, t) {
266
266
  return t && t >= 2.00703 || Array.isArray(o[0]) ? o : o.map((e) => [
267
267
  e.illstNodes,
268
268
  e.mercNodes,
@@ -271,10 +271,10 @@ function We(o, t) {
271
271
  }
272
272
  function Oe(o, t) {
273
273
  for (let e = 0; e < t.features.length; e++)
274
- if (we(o, t.features[e]))
274
+ if (pe(o, t.features[e]))
275
275
  return t.features[e];
276
276
  }
277
- function ze(o, t, e) {
277
+ function Xe(o, t, e) {
278
278
  const s = t.geometry.coordinates[0][0], i = t.geometry.coordinates[0][1], n = t.geometry.coordinates[0][2], r = o.geometry.coordinates, a = t.properties.a.geom, f = t.properties.b.geom, c = t.properties.c.geom, u = [i[0] - s[0], i[1] - s[1]], h = [n[0] - s[0], n[1] - s[1]], l = [r[0] - s[0], r[1] - s[1]], p = [f[0] - a[0], f[1] - a[1]], y = [c[0] - a[0], c[1] - a[1]];
279
279
  let g = (h[1] * l[0] - h[0] * l[1]) / (u[0] * h[1] - u[1] * h[0]), b = (u[0] * l[1] - u[1] * l[0]) / (u[0] * h[1] - u[1] * h[0]);
280
280
  if (e) {
@@ -292,12 +292,12 @@ function ze(o, t, e) {
292
292
  g * p[1] + b * y[1] + a[1]
293
293
  ];
294
294
  }
295
- function ys(o, t, e, s) {
296
- const i = o.geometry.coordinates, n = e.geometry.coordinates, r = Math.atan2(i[0] - n[0], i[1] - n[1]), a = ks(r, t[0]);
295
+ function ks(o, t, e, s) {
296
+ const i = o.geometry.coordinates, n = e.geometry.coordinates, r = Math.atan2(i[0] - n[0], i[1] - n[1]), a = xs(r, t[0]);
297
297
  if (a === void 0)
298
298
  throw new Error("Unable to determine vertex index");
299
299
  const f = t[1][a];
300
- return ze(o, f.features[0], s);
300
+ return Xe(o, f.features[0], s);
301
301
  }
302
302
  function re(o, t, e, s, i, n, r, a) {
303
303
  let f;
@@ -308,13 +308,13 @@ function re(o, t, e, s, i, n, r, a) {
308
308
  }
309
309
  f = Oe(o, t);
310
310
  }
311
- return a && a(f), f ? ze(o, f, n) : ys(o, s, i, n);
311
+ return a && a(f), f ? Xe(o, f, n) : ks(o, s, i, n);
312
312
  }
313
313
  function At(o, t, e, s) {
314
314
  let i = Math.floor((o - t) / e);
315
315
  return i >= s && (i = s - 1), i;
316
316
  }
317
- function ks(o, t) {
317
+ function xs(o, t) {
318
318
  let e = Te(o - t[0]), s = Math.PI * 2, i;
319
319
  for (let n = 0; n < t.length; n++) {
320
320
  const r = (n + 1) % t.length, a = Te(o - t[r]), f = Math.min(Math.abs(e), Math.abs(a));
@@ -332,7 +332,7 @@ function Te(o, t = !1) {
332
332
  o = o + 2 * Math.PI * (o > 0 ? -1 : 1);
333
333
  return o;
334
334
  }
335
- const oe = 2.00703, kt = class xt {
335
+ const we = 2.00703, kt = class xt {
336
336
  constructor() {
337
337
  nt(this, "points", []), nt(this, "pointsWeightBuffer"), nt(this, "strict_status"), nt(this, "vertices_params"), nt(this, "centroid"), nt(this, "edgeNodes"), nt(this, "edges"), nt(this, "tins"), nt(this, "kinks"), nt(this, "yaxisMode", xt.YAXIS_INVERT), nt(this, "strictMode", xt.MODE_AUTO), nt(this, "vertexMode", xt.VERTEX_PLAIN), nt(this, "bounds"), nt(this, "boundsPolygon"), nt(this, "wh"), nt(this, "xy"), nt(this, "indexedTins"), nt(this, "stateFull", !1), nt(this, "stateTriangle"), nt(this, "stateBackward");
338
338
  }
@@ -353,7 +353,7 @@ const oe = 2.00703, kt = class xt {
353
353
  this.points = t.points, this.pointsWeightBuffer = !t.version || t.version < 2.00703 ? ["forw", "bakw"].reduce((s, i) => {
354
354
  const n = t.weight_buffer[i];
355
355
  return n && (s[i] = Object.keys(n).reduce((r, a) => {
356
- const f = Ve(a);
356
+ const f = We(a);
357
357
  return r[f] = n[a], r;
358
358
  }, {})), s;
359
359
  }, {}) : t.weight_buffer, t.strict_status ? this.strict_status = t.strict_status : t.kinks_points ? this.strict_status = xt.STATUS_ERROR : t.tins_points.length == 2 ? this.strict_status = xt.STATUS_LOOSE : this.strict_status = xt.STATUS_STRICT, this.vertices_params = {
@@ -367,7 +367,7 @@ const oe = 2.00703, kt = class xt {
367
367
  t.centroid_point,
368
368
  t.vertices_points,
369
369
  !1,
370
- oe
370
+ we
371
371
  );
372
372
  return Lt([n]);
373
373
  }), this.vertices_params.bakw[1] = [0, 1, 2, 3].map((s) => {
@@ -378,7 +378,7 @@ const oe = 2.00703, kt = class xt {
378
378
  t.centroid_point,
379
379
  t.vertices_points,
380
380
  !0,
381
- oe
381
+ we
382
382
  );
383
383
  return Lt([n]);
384
384
  }), this.centroid = {
@@ -394,7 +394,7 @@ const oe = 2.00703, kt = class xt {
394
394
  index: "c"
395
395
  }
396
396
  })
397
- }, this.edges = We(t.edges || []), this.edgeNodes = t.edgeNodes || [];
397
+ }, this.edges = ze(t.edges || []), this.edgeNodes = t.edgeNodes || [];
398
398
  const e = t.tins_points.length == 1 ? 0 : 1;
399
399
  this.tins = {
400
400
  forw: Lt(
@@ -564,7 +564,7 @@ const oe = 2.00703, kt = class xt {
564
564
  throw 'Backward transform is not allowed if strict_status == "strict_error"';
565
565
  this.yaxisMode == xt.YAXIS_FOLLOW && e && (t = [t[0], -1 * t[1]]);
566
566
  const i = Yt(t);
567
- if (this.bounds && !e && !s && !we(i, this.boundsPolygon))
567
+ if (this.bounds && !e && !s && !pe(i, this.boundsPolygon))
568
568
  return !1;
569
569
  const n = e ? this.tins.bakw : this.tins.forw, r = e ? this.indexedTins.bakw : this.indexedTins.forw, a = e ? this.vertices_params.bakw : this.vertices_params.forw, f = e ? this.centroid.bakw : this.centroid.forw, c = e ? this.pointsWeightBuffer.bakw : this.pointsWeightBuffer.forw;
570
570
  let u, h;
@@ -583,14 +583,14 @@ const oe = 2.00703, kt = class xt {
583
583
  );
584
584
  if (this.bounds && e && !s) {
585
585
  const p = Yt(l);
586
- if (!we(p, this.boundsPolygon)) return !1;
586
+ if (!pe(p, this.boundsPolygon)) return !1;
587
587
  } else this.yaxisMode == xt.YAXIS_FOLLOW && !e && (l = [l[0], -1 * l[1]]);
588
588
  return l;
589
589
  }
590
590
  };
591
591
  nt(kt, "VERTEX_PLAIN", "plain"), nt(kt, "VERTEX_BIRDEYE", "birdeye"), nt(kt, "MODE_STRICT", "strict"), nt(kt, "MODE_AUTO", "auto"), nt(kt, "MODE_LOOSE", "loose"), nt(kt, "STATUS_STRICT", "strict"), nt(kt, "STATUS_ERROR", "strict_error"), nt(kt, "STATUS_LOOSE", "loose"), nt(kt, "YAXIS_FOLLOW", "follow"), nt(kt, "YAXIS_INVERT", "invert");
592
- let xs = kt;
593
- const dt = 11102230246251565e-32, $ = 134217729, Xe = (3 + 8 * dt) * dt;
592
+ let _s = kt;
593
+ const dt = 11102230246251565e-32, $ = 134217729, Ye = (3 + 8 * dt) * dt;
594
594
  function ct(o, t, e, s, i) {
595
595
  let n, r, a, f, c = t[0], u = s[0], h = 0, l = 0;
596
596
  u > c == u > -c ? (n = c, c = t[++h]) : (n = u, u = s[++l]);
@@ -618,7 +618,7 @@ function M(o, t, e, s) {
618
618
  g = t[w], a = g * e, u = $ * g, h = u - (u - g), l = g - h, f = l * y - (a - h * p - l * p - h * y), n = i + f, c = n - i, r = i - (n - c) + (f - c), r !== 0 && (s[b++] = r), i = a + n, r = n - (i - a), r !== 0 && (s[b++] = r);
619
619
  return (i !== 0 || b === 0) && (s[b++] = i), b;
620
620
  }
621
- function Ye(o, t) {
621
+ function Ce(o, t) {
622
622
  let e = t[0];
623
623
  for (let s = 1; s < o; s++) e += t[s];
624
624
  return e;
@@ -626,13 +626,13 @@ function Ye(o, t) {
626
626
  function H(o) {
627
627
  return new Float64Array(o);
628
628
  }
629
- const _s = (3 + 16 * dt) * dt, Ms = (2 + 12 * dt) * dt, Ss = (9 + 64 * dt) * dt * dt, Wt = H(4), Ie = H(8), Pe = H(12), $e = H(16), pt = H(4);
630
- function As(o, t, e, s, i, n, r) {
629
+ const Ms = (3 + 16 * dt) * dt, Ss = (2 + 12 * dt) * dt, As = (9 + 64 * dt) * dt * dt, Wt = H(4), Ie = H(8), Pe = H(12), $e = H(16), pt = H(4);
630
+ function Es(o, t, e, s, i, n, r) {
631
631
  let a, f, c, u, h, l, p, y, g, b, w, S, _, v, T, I, N, V;
632
632
  const z = o - i, G = e - i, tt = t - n, X = s - n;
633
633
  v = z * X, l = $ * z, p = l - (l - z), y = z - p, l = $ * X, g = l - (l - X), b = X - g, T = y * b - (v - p * g - y * g - p * b), I = tt * G, l = $ * tt, p = l - (l - tt), y = tt - p, l = $ * G, g = l - (l - G), b = G - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, Wt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, Wt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, Wt[2] = S - (V - h) + (w - h), Wt[3] = V;
634
- let it = Ye(4, Wt), d = Ms * r;
635
- if (it >= d || -it >= d || (h = o - z, a = o - (z + h) + (h - i), h = e - G, c = e - (G + h) + (h - i), h = t - tt, f = t - (tt + h) + (h - n), h = s - X, u = s - (X + h) + (h - n), a === 0 && f === 0 && c === 0 && u === 0) || (d = Ss * r + Xe * Math.abs(it), it += z * u + X * a - (tt * c + G * f), it >= d || -it >= d)) return it;
634
+ let it = Ce(4, Wt), d = Ss * r;
635
+ if (it >= d || -it >= d || (h = o - z, a = o - (z + h) + (h - i), h = e - G, c = e - (G + h) + (h - i), h = t - tt, f = t - (tt + h) + (h - n), h = s - X, u = s - (X + h) + (h - n), a === 0 && f === 0 && c === 0 && u === 0) || (d = As * r + Ye * Math.abs(it), it += z * u + X * a - (tt * c + G * f), it >= d || -it >= d)) return it;
636
636
  v = a * X, l = $ * a, p = l - (l - a), y = a - p, l = $ * X, g = l - (l - X), b = X - g, T = y * b - (v - p * g - y * g - p * b), I = f * G, l = $ * f, p = l - (l - f), y = f - p, l = $ * G, g = l - (l - G), b = G - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, pt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, pt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, pt[2] = S - (V - h) + (w - h), pt[3] = V;
637
637
  const m = ct(4, Wt, 4, pt, Ie);
638
638
  v = z * u, l = $ * z, p = l - (l - z), y = z - p, l = $ * u, g = l - (l - u), b = u - g, T = y * b - (v - p * g - y * g - p * b), I = tt * c, l = $ * tt, p = l - (l - tt), y = tt - p, l = $ * c, g = l - (l - c), b = c - g, N = y * b - (I - p * g - y * g - p * b), w = T - N, h = T - w, pt[0] = T - (w + h) + (h - N), S = v + w, h = S - v, _ = v - (S - h) + (w - h), w = _ - I, h = _ - w, pt[1] = _ - (w + h) + (h - I), V = S + w, h = V - S, pt[2] = S - (V - h) + (w - h), pt[3] = V;
@@ -643,16 +643,16 @@ function As(o, t, e, s, i, n, r) {
643
643
  }
644
644
  function Ct(o, t, e, s, i, n) {
645
645
  const r = (t - n) * (e - i), a = (o - i) * (s - n), f = r - a, c = Math.abs(r + a);
646
- return Math.abs(f) >= _s * c ? f : -As(o, t, e, s, i, n, c);
646
+ return Math.abs(f) >= Ms * c ? f : -Es(o, t, e, s, i, n, c);
647
647
  }
648
- const Es = (10 + 96 * dt) * dt, vs = (4 + 48 * dt) * dt, Os = (44 + 576 * dt) * dt * dt, It = H(4), Pt = H(4), $t = H(4), _t = H(4), Mt = H(4), St = H(4), wt = H(4), mt = H(4), ce = H(8), fe = H(8), ue = H(8), le = H(8), de = H(8), ge = H(8), Kt = H(8), Qt = H(8), Zt = H(8), Bt = H(4), Dt = H(4), Ft = H(4), U = H(8), L = H(16), et = H(16), st = H(16), Z = H(32), Rt = H(32), ot = H(48), bt = H(64);
649
- let zt = H(1152), pe = H(1152);
648
+ const vs = (10 + 96 * dt) * dt, Os = (4 + 48 * dt) * dt, Ts = (44 + 576 * dt) * dt * dt, It = H(4), Pt = H(4), $t = H(4), _t = H(4), Mt = H(4), St = H(4), wt = H(4), mt = H(4), he = H(8), ce = H(8), fe = H(8), ue = H(8), le = H(8), de = H(8), Kt = H(8), Qt = H(8), Zt = H(8), Bt = H(4), Dt = H(4), Ft = H(4), U = H(8), L = H(16), et = H(16), st = H(16), Z = H(32), Rt = H(32), ot = H(48), bt = H(64);
649
+ let zt = H(1152), ge = H(1152);
650
650
  function at(o, t, e) {
651
- o = ct(o, zt, t, e, pe);
651
+ o = ct(o, zt, t, e, ge);
652
652
  const s = zt;
653
- return zt = pe, pe = s, o;
653
+ return zt = ge, ge = s, o;
654
654
  }
655
- function Ts(o, t, e, s, i, n, r, a, f) {
655
+ function Is(o, t, e, s, i, n, r, a, f) {
656
656
  let c, u, h, l, p, y, g, b, w, S, _, v, T, I, N, V, z, G, tt, X, it, d, m, x, A, E, R, k, O, B, P, D, F, W, j;
657
657
  const Y = o - r, C = e - r, q = i - r, K = t - a, J = s - a, Q = n - a;
658
658
  P = C * Q, m = $ * C, x = m - (m - C), A = C - x, m = $ * Q, E = m - (m - Q), R = Q - E, D = A * R - (P - x * E - A * E - x * R), F = q * J, m = $ * q, x = m - (m - q), A = q - x, m = $ * J, E = m - (m - J), R = J - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, It[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, It[1] = B - (k + d) + (d - F), j = O + k, d = j - O, It[2] = O - (j - d) + (k - d), It[3] = j, P = q * K, m = $ * q, x = m - (m - q), A = q - x, m = $ * K, E = m - (m - K), R = K - E, D = A * R - (P - x * E - A * E - x * R), F = Y * Q, m = $ * Y, x = m - (m - Y), A = Y - x, m = $ * Q, E = m - (m - Q), R = Q - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, Pt[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, Pt[1] = B - (k + d) + (d - F), j = O + k, d = j - O, Pt[2] = O - (j - d) + (k - d), Pt[3] = j, P = Y * J, m = $ * Y, x = m - (m - Y), A = Y - x, m = $ * J, E = m - (m - J), R = J - E, D = A * R - (P - x * E - A * E - x * R), F = C * K, m = $ * C, x = m - (m - C), A = C - x, m = $ * K, E = m - (m - K), R = K - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, $t[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, $t[1] = B - (k + d) + (d - F), j = O + k, d = j - O, $t[2] = O - (j - d) + (k - d), $t[3] = j, c = ct(
@@ -686,11 +686,11 @@ function Ts(o, t, e, s, i, n, r, a, f) {
686
686
  Z,
687
687
  zt
688
688
  );
689
- let Ut = Ye(c, zt), Xt = vs * f;
690
- if (Ut >= Xt || -Ut >= Xt || (d = o - Y, u = o - (Y + d) + (d - r), d = t - K, p = t - (K + d) + (d - a), d = e - C, h = e - (C + d) + (d - r), d = s - J, y = s - (J + d) + (d - a), d = i - q, l = i - (q + d) + (d - r), d = n - Q, g = n - (Q + d) + (d - a), u === 0 && h === 0 && l === 0 && p === 0 && y === 0 && g === 0) || (Xt = Os * f + Xe * Math.abs(Ut), Ut += (Y * Y + K * K) * (C * g + Q * h - (J * l + q * y)) + 2 * (Y * u + K * p) * (C * Q - J * q) + ((C * C + J * J) * (q * p + K * l - (Q * u + Y * g)) + 2 * (C * h + J * y) * (q * K - Q * Y)) + ((q * q + Q * Q) * (Y * y + J * u - (K * h + C * p)) + 2 * (q * l + Q * g) * (Y * J - K * C)), Ut >= Xt || -Ut >= Xt))
689
+ let Ut = Ce(c, zt), Xt = Os * f;
690
+ if (Ut >= Xt || -Ut >= Xt || (d = o - Y, u = o - (Y + d) + (d - r), d = t - K, p = t - (K + d) + (d - a), d = e - C, h = e - (C + d) + (d - r), d = s - J, y = s - (J + d) + (d - a), d = i - q, l = i - (q + d) + (d - r), d = n - Q, g = n - (Q + d) + (d - a), u === 0 && h === 0 && l === 0 && p === 0 && y === 0 && g === 0) || (Xt = Ts * f + Ye * Math.abs(Ut), Ut += (Y * Y + K * K) * (C * g + Q * h - (J * l + q * y)) + 2 * (Y * u + K * p) * (C * Q - J * q) + ((C * C + J * J) * (q * p + K * l - (Q * u + Y * g)) + 2 * (C * h + J * y) * (q * K - Q * Y)) + ((q * q + Q * Q) * (Y * y + J * u - (K * h + C * p)) + 2 * (q * l + Q * g) * (Y * J - K * C)), Ut >= Xt || -Ut >= Xt))
691
691
  return Ut;
692
- if ((h !== 0 || y !== 0 || l !== 0 || g !== 0) && (P = Y * Y, m = $ * Y, x = m - (m - Y), A = Y - x, D = A * A - (P - x * x - (x + x) * A), F = K * K, m = $ * K, x = m - (m - K), A = K - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, _t[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, _t[1] = B - (k - d) + (F - d), j = O + k, d = j - O, _t[2] = O - (j - d) + (k - d), _t[3] = j), (l !== 0 || g !== 0 || u !== 0 || p !== 0) && (P = C * C, m = $ * C, x = m - (m - C), A = C - x, D = A * A - (P - x * x - (x + x) * A), F = J * J, m = $ * J, x = m - (m - J), A = J - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, Mt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, Mt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, Mt[2] = O - (j - d) + (k - d), Mt[3] = j), (u !== 0 || p !== 0 || h !== 0 || y !== 0) && (P = q * q, m = $ * q, x = m - (m - q), A = q - x, D = A * A - (P - x * x - (x + x) * A), F = Q * Q, m = $ * Q, x = m - (m - Q), A = Q - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, St[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, St[1] = B - (k - d) + (F - d), j = O + k, d = j - O, St[2] = O - (j - d) + (k - d), St[3] = j), u !== 0 && (b = M(4, It, u, ce), c = at(c, yt(
693
- M(b, ce, 2 * Y, L),
692
+ if ((h !== 0 || y !== 0 || l !== 0 || g !== 0) && (P = Y * Y, m = $ * Y, x = m - (m - Y), A = Y - x, D = A * A - (P - x * x - (x + x) * A), F = K * K, m = $ * K, x = m - (m - K), A = K - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, _t[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, _t[1] = B - (k - d) + (F - d), j = O + k, d = j - O, _t[2] = O - (j - d) + (k - d), _t[3] = j), (l !== 0 || g !== 0 || u !== 0 || p !== 0) && (P = C * C, m = $ * C, x = m - (m - C), A = C - x, D = A * A - (P - x * x - (x + x) * A), F = J * J, m = $ * J, x = m - (m - J), A = J - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, Mt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, Mt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, Mt[2] = O - (j - d) + (k - d), Mt[3] = j), (u !== 0 || p !== 0 || h !== 0 || y !== 0) && (P = q * q, m = $ * q, x = m - (m - q), A = q - x, D = A * A - (P - x * x - (x + x) * A), F = Q * Q, m = $ * Q, x = m - (m - Q), A = Q - x, W = A * A - (F - x * x - (x + x) * A), k = D + W, d = k - D, St[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, St[1] = B - (k - d) + (F - d), j = O + k, d = j - O, St[2] = O - (j - d) + (k - d), St[3] = j), u !== 0 && (b = M(4, It, u, he), c = at(c, yt(
693
+ M(b, he, 2 * Y, L),
694
694
  L,
695
695
  M(M(4, St, u, U), U, J, et),
696
696
  et,
@@ -698,8 +698,8 @@ function Ts(o, t, e, s, i, n, r, a, f) {
698
698
  st,
699
699
  Z,
700
700
  ot
701
- ), ot)), p !== 0 && (w = M(4, It, p, fe), c = at(c, yt(
702
- M(w, fe, 2 * K, L),
701
+ ), ot)), p !== 0 && (w = M(4, It, p, ce), c = at(c, yt(
702
+ M(w, ce, 2 * K, L),
703
703
  L,
704
704
  M(M(4, Mt, p, U), U, q, et),
705
705
  et,
@@ -707,8 +707,8 @@ function Ts(o, t, e, s, i, n, r, a, f) {
707
707
  st,
708
708
  Z,
709
709
  ot
710
- ), ot)), h !== 0 && (S = M(4, Pt, h, ue), c = at(c, yt(
711
- M(S, ue, 2 * C, L),
710
+ ), ot)), h !== 0 && (S = M(4, Pt, h, fe), c = at(c, yt(
711
+ M(S, fe, 2 * C, L),
712
712
  L,
713
713
  M(M(4, _t, h, U), U, Q, et),
714
714
  et,
@@ -716,8 +716,8 @@ function Ts(o, t, e, s, i, n, r, a, f) {
716
716
  st,
717
717
  Z,
718
718
  ot
719
- ), ot)), y !== 0 && (_ = M(4, Pt, y, le), c = at(c, yt(
720
- M(_, le, 2 * J, L),
719
+ ), ot)), y !== 0 && (_ = M(4, Pt, y, ue), c = at(c, yt(
720
+ M(_, ue, 2 * J, L),
721
721
  L,
722
722
  M(M(4, St, y, U), U, Y, et),
723
723
  et,
@@ -725,8 +725,8 @@ function Ts(o, t, e, s, i, n, r, a, f) {
725
725
  st,
726
726
  Z,
727
727
  ot
728
- ), ot)), l !== 0 && (v = M(4, $t, l, de), c = at(c, yt(
729
- M(v, de, 2 * q, L),
728
+ ), ot)), l !== 0 && (v = M(4, $t, l, le), c = at(c, yt(
729
+ M(v, le, 2 * q, L),
730
730
  L,
731
731
  M(M(4, Mt, l, U), U, K, et),
732
732
  et,
@@ -734,8 +734,8 @@ function Ts(o, t, e, s, i, n, r, a, f) {
734
734
  st,
735
735
  Z,
736
736
  ot
737
- ), ot)), g !== 0 && (T = M(4, $t, g, ge), c = at(c, yt(
738
- M(T, ge, 2 * Q, L),
737
+ ), ot)), g !== 0 && (T = M(4, $t, g, de), c = at(c, yt(
738
+ M(T, de, 2 * Q, L),
739
739
  L,
740
740
  M(M(4, _t, g, U), U, C, et),
741
741
  et,
@@ -747,7 +747,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
747
747
  if (h !== 0 || y !== 0 || l !== 0 || g !== 0 ? (P = h * Q, m = $ * h, x = m - (m - h), A = h - x, m = $ * Q, E = m - (m - Q), R = Q - E, D = A * R - (P - x * E - A * E - x * R), F = C * g, m = $ * C, x = m - (m - C), A = C - x, m = $ * g, E = m - (m - g), R = g - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, wt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, wt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, wt[2] = O - (j - d) + (k - d), wt[3] = j, P = l * -J, m = $ * l, x = m - (m - l), A = l - x, m = $ * -J, E = m - (m - -J), R = -J - E, D = A * R - (P - x * E - A * E - x * R), F = q * -y, m = $ * q, x = m - (m - q), A = q - x, m = $ * -y, E = m - (m - -y), R = -y - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, mt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, mt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, mt[2] = O - (j - d) + (k - d), mt[3] = j, N = ct(4, wt, 4, mt, Qt), P = h * g, m = $ * h, x = m - (m - h), A = h - x, m = $ * g, E = m - (m - g), R = g - E, D = A * R - (P - x * E - A * E - x * R), F = l * y, m = $ * l, x = m - (m - l), A = l - x, m = $ * y, E = m - (m - y), R = y - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, Dt[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, Dt[1] = B - (k + d) + (d - F), j = O + k, d = j - O, Dt[2] = O - (j - d) + (k - d), Dt[3] = j, G = 4) : (Qt[0] = 0, N = 1, Dt[0] = 0, G = 1), u !== 0) {
748
748
  const ft = M(N, Qt, u, st);
749
749
  c = at(c, ct(
750
- M(b, ce, u, L),
750
+ M(b, he, u, L),
751
751
  L,
752
752
  M(ft, st, 2 * Y, Z),
753
753
  Z,
@@ -768,7 +768,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
768
768
  if (p !== 0) {
769
769
  const ft = M(N, Qt, p, st);
770
770
  c = at(c, ct(
771
- M(w, fe, p, L),
771
+ M(w, ce, p, L),
772
772
  L,
773
773
  M(ft, st, 2 * K, Z),
774
774
  Z,
@@ -791,7 +791,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
791
791
  if (l !== 0 || g !== 0 || u !== 0 || p !== 0 ? (P = l * K, m = $ * l, x = m - (m - l), A = l - x, m = $ * K, E = m - (m - K), R = K - E, D = A * R - (P - x * E - A * E - x * R), F = q * p, m = $ * q, x = m - (m - q), A = q - x, m = $ * p, E = m - (m - p), R = p - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, wt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, wt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, wt[2] = O - (j - d) + (k - d), wt[3] = j, X = -Q, it = -g, P = u * X, m = $ * u, x = m - (m - u), A = u - x, m = $ * X, E = m - (m - X), R = X - E, D = A * R - (P - x * E - A * E - x * R), F = Y * it, m = $ * Y, x = m - (m - Y), A = Y - x, m = $ * it, E = m - (m - it), R = it - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, mt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, mt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, mt[2] = O - (j - d) + (k - d), mt[3] = j, V = ct(4, wt, 4, mt, Zt), P = l * p, m = $ * l, x = m - (m - l), A = l - x, m = $ * p, E = m - (m - p), R = p - E, D = A * R - (P - x * E - A * E - x * R), F = u * g, m = $ * u, x = m - (m - u), A = u - x, m = $ * g, E = m - (m - g), R = g - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, Ft[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, Ft[1] = B - (k + d) + (d - F), j = O + k, d = j - O, Ft[2] = O - (j - d) + (k - d), Ft[3] = j, tt = 4) : (Zt[0] = 0, V = 1, Ft[0] = 0, tt = 1), h !== 0) {
792
792
  const ft = M(V, Zt, h, st);
793
793
  c = at(c, ct(
794
- M(S, ue, h, L),
794
+ M(S, fe, h, L),
795
795
  L,
796
796
  M(ft, st, 2 * C, Z),
797
797
  Z,
@@ -812,7 +812,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
812
812
  if (y !== 0) {
813
813
  const ft = M(V, Zt, y, st);
814
814
  c = at(c, ct(
815
- M(_, le, y, L),
815
+ M(_, ue, y, L),
816
816
  L,
817
817
  M(ft, st, 2 * J, Z),
818
818
  Z,
@@ -835,7 +835,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
835
835
  if (u !== 0 || p !== 0 || h !== 0 || y !== 0 ? (P = u * J, m = $ * u, x = m - (m - u), A = u - x, m = $ * J, E = m - (m - J), R = J - E, D = A * R - (P - x * E - A * E - x * R), F = Y * y, m = $ * Y, x = m - (m - Y), A = Y - x, m = $ * y, E = m - (m - y), R = y - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, wt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, wt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, wt[2] = O - (j - d) + (k - d), wt[3] = j, X = -K, it = -p, P = h * X, m = $ * h, x = m - (m - h), A = h - x, m = $ * X, E = m - (m - X), R = X - E, D = A * R - (P - x * E - A * E - x * R), F = C * it, m = $ * C, x = m - (m - C), A = C - x, m = $ * it, E = m - (m - it), R = it - E, W = A * R - (F - x * E - A * E - x * R), k = D + W, d = k - D, mt[0] = D - (k - d) + (W - d), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B + F, d = k - B, mt[1] = B - (k - d) + (F - d), j = O + k, d = j - O, mt[2] = O - (j - d) + (k - d), mt[3] = j, I = ct(4, wt, 4, mt, Kt), P = u * y, m = $ * u, x = m - (m - u), A = u - x, m = $ * y, E = m - (m - y), R = y - E, D = A * R - (P - x * E - A * E - x * R), F = h * p, m = $ * h, x = m - (m - h), A = h - x, m = $ * p, E = m - (m - p), R = p - E, W = A * R - (F - x * E - A * E - x * R), k = D - W, d = D - k, Bt[0] = D - (k + d) + (d - W), O = P + k, d = O - P, B = P - (O - d) + (k - d), k = B - F, d = B - k, Bt[1] = B - (k + d) + (d - F), j = O + k, d = j - O, Bt[2] = O - (j - d) + (k - d), Bt[3] = j, z = 4) : (Kt[0] = 0, I = 1, Bt[0] = 0, z = 1), l !== 0) {
836
836
  const ft = M(I, Kt, l, st);
837
837
  c = at(c, ct(
838
- M(v, de, l, L),
838
+ M(v, le, l, L),
839
839
  L,
840
840
  M(ft, st, 2 * q, Z),
841
841
  Z,
@@ -856,7 +856,7 @@ function Ts(o, t, e, s, i, n, r, a, f) {
856
856
  if (g !== 0) {
857
857
  const ft = M(I, Kt, g, st);
858
858
  c = at(c, ct(
859
- M(T, ge, g, L),
859
+ M(T, de, g, L),
860
860
  L,
861
861
  M(ft, st, 2 * Q, Z),
862
862
  Z,
@@ -877,11 +877,11 @@ function Ts(o, t, e, s, i, n, r, a, f) {
877
877
  }
878
878
  return zt[c - 1];
879
879
  }
880
- function Is(o, t, e, s, i, n, r, a) {
881
- const f = o - r, c = e - r, u = i - r, h = t - a, l = s - a, p = n - a, y = c * p, g = u * l, b = f * f + h * h, w = u * h, S = f * p, _ = c * c + l * l, v = f * l, T = c * h, I = u * u + p * p, N = b * (y - g) + _ * (w - S) + I * (v - T), V = (Math.abs(y) + Math.abs(g)) * b + (Math.abs(w) + Math.abs(S)) * _ + (Math.abs(v) + Math.abs(T)) * I, z = Es * V;
882
- return N > z || -N > z ? N : Ts(o, t, e, s, i, n, r, a, V);
880
+ function Ps(o, t, e, s, i, n, r, a) {
881
+ const f = o - r, c = e - r, u = i - r, h = t - a, l = s - a, p = n - a, y = c * p, g = u * l, b = f * f + h * h, w = u * h, S = f * p, _ = c * c + l * l, v = f * l, T = c * h, I = u * u + p * p, N = b * (y - g) + _ * (w - S) + I * (v - T), V = (Math.abs(y) + Math.abs(g)) * b + (Math.abs(w) + Math.abs(S)) * _ + (Math.abs(v) + Math.abs(T)) * I, z = vs * V;
882
+ return N > z || -N > z ? N : Is(o, t, e, s, i, n, r, a, V);
883
883
  }
884
- class Ps {
884
+ class $s {
885
885
  constructor(t, e) {
886
886
  this.W = t, this.bs = e;
887
887
  }
@@ -946,7 +946,7 @@ class Ps {
946
946
  return this;
947
947
  }
948
948
  }
949
- class Re extends Ps {
949
+ class Re extends $s {
950
950
  /**
951
951
  * Create a bit set.
952
952
  *
@@ -964,19 +964,19 @@ function jt(o) {
964
964
  function Et(o) {
965
965
  return o % 3 === 0 ? o + 2 : o - 1;
966
966
  }
967
- function Ce(o, t, e, s, i, n, r, a) {
967
+ function qe(o, t, e, s, i, n, r, a) {
968
968
  const f = Ct(o, t, i, n, r, a), c = Ct(e, s, i, n, r, a);
969
969
  if (f > 0 && c > 0 || f < 0 && c < 0)
970
970
  return !1;
971
971
  const u = Ct(i, n, o, t, e, s), h = Ct(r, a, o, t, e, s);
972
972
  return u > 0 && h > 0 || u < 0 && h < 0 ? !1 : f === 0 && c === 0 && u === 0 && h === 0 ? !(Math.max(i, r) < Math.min(o, e) || Math.max(o, e) < Math.min(i, r) || Math.max(n, a) < Math.min(t, s) || Math.max(t, s) < Math.min(n, a)) : !0;
973
973
  }
974
- class $s {
974
+ class Rs {
975
975
  constructor(t) {
976
976
  this.del = t;
977
977
  }
978
978
  }
979
- const qe = class extends $s {
979
+ const Je = class extends Rs {
980
980
  /**
981
981
  * Make a Constrain.
982
982
  *
@@ -1146,7 +1146,7 @@ const qe = class extends $s {
1146
1146
  */
1147
1147
  inCircle(t, e, s, i) {
1148
1148
  const n = this.del.coords;
1149
- return Is(
1149
+ return Ps(
1150
1150
  n[t * 2],
1151
1151
  n[t * 2 + 1],
1152
1152
  n[e * 2],
@@ -1182,7 +1182,7 @@ const qe = class extends $s {
1182
1182
  */
1183
1183
  intersectSegments(t, e, s, i) {
1184
1184
  const n = this.del.coords;
1185
- return t === s || t === i || e === s || e === i ? !1 : Ce(
1185
+ return t === s || t === i || e === s || e === i ? !1 : qe(
1186
1186
  n[t * 2],
1187
1187
  n[t * 2 + 1],
1188
1188
  n[e * 2],
@@ -1194,18 +1194,18 @@ const qe = class extends $s {
1194
1194
  );
1195
1195
  }
1196
1196
  };
1197
- qe.intersectSegments = Ce;
1198
- let Rs = qe;
1197
+ Je.intersectSegments = qe;
1198
+ let Ns = Je;
1199
1199
  function te(o, t, e) {
1200
1200
  if (t || (t = []), typeof o != "object" || o.type !== "FeatureCollection")
1201
1201
  throw "Argument points must be FeatureCollection";
1202
1202
  if (!Array.isArray(t)) throw "Argument points must be Array of Array";
1203
1203
  const s = o.features.map(
1204
1204
  (f) => f.geometry.coordinates
1205
- ), i = ss.from(s);
1205
+ ), i = ns.from(s);
1206
1206
  let n;
1207
1207
  const r = [];
1208
- i.triangles.length !== 0 && t.length !== 0 && (n = new Rs(i), n.constrainAll(t));
1208
+ i.triangles.length !== 0 && t.length !== 0 && (n = new Ns(i), n.constrainAll(t));
1209
1209
  for (let f = 0; f < i.triangles.length; f += 3)
1210
1210
  r.push([i.triangles[f], i.triangles[f + 1], i.triangles[f + 2]]);
1211
1211
  const a = ["a", "b", "c"];
@@ -1219,14 +1219,14 @@ function te(o, t, e) {
1219
1219
  })
1220
1220
  );
1221
1221
  }
1222
- function Ns(o) {
1223
- const e = new Us(o).findSegmentIntersections();
1224
- return Ge(e).reduce(
1222
+ function Us(o) {
1223
+ const e = new Bs(o).findSegmentIntersections();
1224
+ return Ke(e).reduce(
1225
1225
  (s, i, n, r) => Array.isArray(s) || (s || (s = {}), s[`${i.x}:${i.y}`] = i, n != r.length - 1) ? s : Object.keys(s).map((a) => Jt([s[a].x, s[a].y])),
1226
1226
  {}
1227
1227
  );
1228
1228
  }
1229
- class Us {
1229
+ class Bs {
1230
1230
  /**
1231
1231
  * 線分群からArcCollectionを初期化
1232
1232
  * @param coords - 線分群の座標配列
@@ -1271,7 +1271,7 @@ class Us {
1271
1271
  let n = 0;
1272
1272
  for (let r = 0; r < i; r++)
1273
1273
  this._ii[r] = n, n += t[r];
1274
- (n != this._xx.length || this._xx.length != this._yy.length) && be("ArcCollection#initXYData() Counting error"), this.initBounds(), this._arcIter = new en(this._xx, this._yy);
1274
+ (n != this._xx.length || this._xx.length != this._yy.length) && be("ArcCollection#initXYData() Counting error"), this.initBounds(), this._arcIter = new sn(this._xx, this._yy);
1275
1275
  }
1276
1276
  initBounds() {
1277
1277
  const t = this.calcArcBounds_(this._xx, this._yy, this._nn);
@@ -1282,10 +1282,10 @@ class Us {
1282
1282
  * @returns バウンディングボックス情報
1283
1283
  */
1284
1284
  calcArcBounds_(t, e, s) {
1285
- const i = s.length, n = new Float64Array(i * 4), r = new ae();
1285
+ const i = s.length, n = new Float64Array(i * 4), r = new oe();
1286
1286
  let a = 0, f, c, u;
1287
1287
  for (let h = 0; h < i; h++)
1288
- f = s[h], f > 0 && (c = h * 4, u = sn(t, e, a, f), n[c++] = u[0], n[c++] = u[1], n[c++] = u[2], n[c] = u[3], a += f, r.mergeBounds(u));
1288
+ f = s[h], f > 0 && (c = h * 4, u = nn(t, e, a, f), n[c++] = u[0], n[c++] = u[1], n[c++] = u[2], n[c] = u[3], a += f, r.mergeBounds(u));
1289
1289
  return {
1290
1290
  bb: n,
1291
1291
  bounds: r
@@ -1352,7 +1352,7 @@ class Us {
1352
1352
  /**
1353
1353
  * 線分の交差を検出
1354
1354
  * ストライプ分割による効率的な判定を実装
1355
- *
1355
+ *
1356
1356
  * @returns 検出された交差点の配列
1357
1357
  */
1358
1358
  findSegmentIntersections() {
@@ -1366,13 +1366,13 @@ class Us {
1366
1366
  _ += v > _ ? 1 : -1;
1367
1367
  }
1368
1368
  );
1369
- const c = this.getUint32Array(Fs(n));
1369
+ const c = this.getUint32Array(js(n));
1370
1370
  let u = 0;
1371
1371
  const h = [];
1372
- js(n, (g) => {
1372
+ Ls(n, (g) => {
1373
1373
  const b = u;
1374
1374
  u += g, h.push(c.subarray(b, u));
1375
- }), Ls(n, 0), this.forEachSegment(
1375
+ }), Vs(n, 0), this.forEachSegment(
1376
1376
  (g, b, w, S) => {
1377
1377
  let _ = r(S[g]);
1378
1378
  const v = r(S[b]);
@@ -1384,9 +1384,9 @@ class Us {
1384
1384
  const l = this.getVertexData(), p = [];
1385
1385
  let y;
1386
1386
  for (a = 0; a < i; a++)
1387
- for (y = Vs(h[a], l.xx, l.yy), f = 0; f < y.length; f++)
1387
+ for (y = Ws(h[a], l.xx, l.yy), f = 0; f < y.length; f++)
1388
1388
  p.push(y[f]);
1389
- return Ge(p);
1389
+ return Ke(p);
1390
1390
  }
1391
1391
  }
1392
1392
  function be(...o) {
@@ -1394,41 +1394,41 @@ function be(...o) {
1394
1394
  throw new Error(t);
1395
1395
  }
1396
1396
  function ye(o) {
1397
- return o ? Ds(o) ? !0 : Bs(o) ? !1 : o.length === 0 ? !0 : o.length > 0 : !1;
1397
+ return o ? Fs(o) ? !0 : Ds(o) ? !1 : o.length === 0 ? !0 : o.length > 0 : !1;
1398
1398
  }
1399
- function Bs(o) {
1399
+ function Ds(o) {
1400
1400
  return o != null && o.toString === String.prototype.toString;
1401
1401
  }
1402
- function Ds(o) {
1402
+ function Fs(o) {
1403
1403
  return Array.isArray(o);
1404
1404
  }
1405
- function Fs(o, t) {
1405
+ function js(o, t) {
1406
1406
  ye(o) || be("utils.sum() expects an array, received:", o);
1407
1407
  let e = 0, s;
1408
1408
  for (let i = 0, n = o.length; i < n; i++)
1409
1409
  s = o[i], s && (e += s);
1410
1410
  return e;
1411
1411
  }
1412
- function js(o, t, e) {
1412
+ function Ls(o, t, e) {
1413
1413
  if (!ye(o))
1414
1414
  throw new Error(`#forEach() takes an array-like argument. ${o}`);
1415
1415
  for (let s = 0, i = o.length; s < i; s++)
1416
1416
  t.call(e, o[s], s);
1417
1417
  }
1418
- function Ls(o, t) {
1418
+ function Vs(o, t) {
1419
1419
  for (let e = 0, s = o.length; e < s; e++)
1420
1420
  o[e] = t;
1421
1421
  return o;
1422
1422
  }
1423
- function Vs(o, t, e) {
1423
+ function Ws(o, t, e) {
1424
1424
  const s = o.length - 2, i = [];
1425
1425
  let n, r, a, f, c, u, h, l, p, y, g, b, w, S, _, v, T;
1426
- for (Ks(t, o), v = 0; v < s; ) {
1426
+ for (Qs(t, o), v = 0; v < s; ) {
1427
1427
  for (n = o[v], r = o[v + 1], c = t[n], u = t[r], p = e[n], y = e[r], T = v; T < s && (T += 2, a = o[T], h = t[a], !(u < h)); ) {
1428
1428
  if (g = e[a], f = o[T + 1], l = t[f], b = e[f], p >= g) {
1429
1429
  if (p > b && y > g && y > b) continue;
1430
1430
  } else if (p < b && y < g && y < b) continue;
1431
- n == a || n == f || r == a || r == f || (w = Ws(
1431
+ n == a || n == f || r == a || r == f || (w = zs(
1432
1432
  c,
1433
1433
  p,
1434
1434
  u,
@@ -1445,32 +1445,32 @@ function Vs(o, t, e) {
1445
1445
  }
1446
1446
  return i;
1447
1447
  }
1448
- function Ws(o, t, e, s, i, n, r, a) {
1449
- const f = zs(o, t, e, s, i, n, r, a);
1448
+ function zs(o, t, e, s, i, n, r, a) {
1449
+ const f = Xs(o, t, e, s, i, n, r, a);
1450
1450
  let c = null;
1451
- return f && (c = Xs(o, t, e, s, i, n, r, a), c ? Gs(o, t, e, s, i, n, r, a) && (c = null) : c = Hs(o, t, e, s, i, n, r, a)), c;
1451
+ return f && (c = Ys(o, t, e, s, i, n, r, a), c ? Ks(o, t, e, s, i, n, r, a) && (c = null) : c = Gs(o, t, e, s, i, n, r, a)), c;
1452
1452
  }
1453
- function zs(o, t, e, s, i, n, r, a) {
1453
+ function Xs(o, t, e, s, i, n, r, a) {
1454
1454
  return qt(o, t, e, s, i, n) * qt(o, t, e, s, r, a) <= 0 && qt(i, n, r, a, o, t) * qt(i, n, r, a, e, s) <= 0;
1455
1455
  }
1456
1456
  function qt(o, t, e, s, i, n) {
1457
- return Je(o - i, t - n, e - i, s - n);
1457
+ return He(o - i, t - n, e - i, s - n);
1458
1458
  }
1459
- function Je(o, t, e, s) {
1459
+ function He(o, t, e, s) {
1460
1460
  return o * s - t * e;
1461
1461
  }
1462
- function Xs(o, t, e, s, i, n, r, a) {
1462
+ function Ys(o, t, e, s, i, n, r, a) {
1463
1463
  let f = ee(o, t, e, s, i, n, r, a), c;
1464
- return f && (c = Cs(f[0], f[1], o, t, e, s, i, n, r, a), c == 1 ? f = ee(e, s, o, t, i, n, r, a) : c == 2 ? f = ee(i, n, r, a, o, t, e, s) : c == 3 && (f = ee(r, a, i, n, o, t, e, s))), f && Js(f, o, t, e, s, i, n, r, a), f;
1464
+ return f && (c = qs(f[0], f[1], o, t, e, s, i, n, r, a), c == 1 ? f = ee(e, s, o, t, i, n, r, a) : c == 2 ? f = ee(i, n, r, a, o, t, e, s) : c == 3 && (f = ee(r, a, i, n, o, t, e, s))), f && Hs(f, o, t, e, s, i, n, r, a), f;
1465
1465
  }
1466
1466
  function ee(o, t, e, s, i, n, r, a) {
1467
- const f = Je(e - o, s - t, r - i, a - n), c = 1e-18;
1467
+ const f = He(e - o, s - t, r - i, a - n), c = 1e-18;
1468
1468
  let u;
1469
1469
  if (f === 0) return null;
1470
1470
  const h = qt(i, n, r, a, o, t) / f;
1471
- return f <= c && f >= -c ? u = Ys(o, t, e, s, i, n, r, a) : u = [o + h * (e - o), t + h * (s - t)], u;
1471
+ return f <= c && f >= -c ? u = Cs(o, t, e, s, i, n, r, a) : u = [o + h * (e - o), t + h * (s - t)], u;
1472
1472
  }
1473
- function Ys(o, t, e, s, i, n, r, a) {
1473
+ function Cs(o, t, e, s, i, n, r, a) {
1474
1474
  let f = null;
1475
1475
  return !vt(o, i, r) && !vt(t, n, a) ? f = [o, t] : !vt(e, i, r) && !vt(s, n, a) ? f = [e, s] : !vt(i, o, e) && !vt(n, t, s) ? f = [i, n] : !vt(r, o, e) && !vt(a, t, s) && (f = [r, a]), f;
1476
1476
  }
@@ -1478,17 +1478,17 @@ function vt(o, t, e) {
1478
1478
  let s;
1479
1479
  return t < e ? s = o < t || o > e : t > e ? s = o > t || o < e : s = o != t, s;
1480
1480
  }
1481
- function Cs(o, t, ...e) {
1481
+ function qs(o, t, ...e) {
1482
1482
  let s = -1, i = 1 / 0, n;
1483
1483
  for (let r = 0, a = 0, f = e.length; a < f; r++, a += 2)
1484
- n = qs(o, t, e[a], e[a + 1]), n < i && (i = n, s = r);
1484
+ n = Js(o, t, e[a], e[a + 1]), n < i && (i = n, s = r);
1485
1485
  return s;
1486
1486
  }
1487
- function qs(o, t, e, s) {
1487
+ function Js(o, t, e, s) {
1488
1488
  const i = o - e, n = t - s;
1489
1489
  return i * i + n * n;
1490
1490
  }
1491
- function Js(o, t, e, s, i, n, r, a, f) {
1491
+ function Hs(o, t, e, s, i, n, r, a, f) {
1492
1492
  let c = o[0], u = o[1];
1493
1493
  c = se(c, t, s), c = se(c, n, a), u = se(u, e, i), u = se(u, r, f), o[0] = c, o[1] = u;
1494
1494
  }
@@ -1496,29 +1496,29 @@ function se(o, t, e) {
1496
1496
  let s;
1497
1497
  return vt(o, t, e) && (s = Math.abs(o - t) < Math.abs(o - e) ? t : e, o = s), o;
1498
1498
  }
1499
- function Hs(o, t, e, s, i, n, r, a) {
1499
+ function Gs(o, t, e, s, i, n, r, a) {
1500
1500
  const f = Math.min(o, e, i, r), c = Math.max(o, e, i, r), u = Math.min(t, s, n, a), h = Math.max(t, s, n, a), l = h - u > c - f;
1501
1501
  let p = [];
1502
1502
  return (l ? Nt(t, u, h) : Nt(o, f, c)) && p.push(o, t), (l ? Nt(s, u, h) : Nt(e, f, c)) && p.push(e, s), (l ? Nt(n, u, h) : Nt(i, f, c)) && p.push(i, n), (l ? Nt(a, u, h) : Nt(r, f, c)) && p.push(r, a), (p.length != 2 && p.length != 4 || p.length == 4 && p[0] == p[2] && p[1] == p[3]) && (p = null), p;
1503
1503
  }
1504
- function Gs(o, t, e, s, i, n, r, a) {
1504
+ function Ks(o, t, e, s, i, n, r, a) {
1505
1505
  return o == i && t == n || o == r && t == a || e == i && s == n || e == r && s == a;
1506
1506
  }
1507
1507
  function Nt(o, t, e) {
1508
1508
  return o > t && o < e;
1509
1509
  }
1510
- function Ks(o, t) {
1511
- Qs(o, t), He(o, t, 0, t.length - 2);
1512
- }
1513
1510
  function Qs(o, t) {
1511
+ Zs(o, t), Ge(o, t, 0, t.length - 2);
1512
+ }
1513
+ function Zs(o, t) {
1514
1514
  for (let e = 0, s = t.length; e < s; e += 2)
1515
- o[t[e]] > o[t[e + 1]] && Zs(t, e, e + 1);
1515
+ o[t[e]] > o[t[e + 1]] && tn(t, e, e + 1);
1516
1516
  }
1517
- function Zs(o, t, e) {
1517
+ function tn(o, t, e) {
1518
1518
  const s = o[t];
1519
1519
  o[t] = o[e], o[e] = s;
1520
1520
  }
1521
- function He(o, t, e, s) {
1521
+ function Ge(o, t, e, s) {
1522
1522
  let i = e, n = s, r, a;
1523
1523
  for (; i < s; ) {
1524
1524
  for (r = o[t[e + s >> 2 << 1]]; i <= n; ) {
@@ -1526,7 +1526,7 @@ function He(o, t, e, s) {
1526
1526
  for (; o[t[n]] > r; ) n -= 2;
1527
1527
  i <= n && (a = t[i], t[i] = t[n], t[n] = a, a = t[i + 1], t[i + 1] = t[n + 1], t[n + 1] = a, i += 2, n -= 2);
1528
1528
  }
1529
- if (n - e < 40 ? Ne(o, t, e, n) : He(o, t, e, n), s - i < 40) {
1529
+ if (n - e < 40 ? Ne(o, t, e, n) : Ge(o, t, e, n), s - i < 40) {
1530
1530
  Ne(o, t, i, s);
1531
1531
  return;
1532
1532
  }
@@ -1553,17 +1553,17 @@ function Be(o, t, e, s, i, n) {
1553
1553
  let r = e < s ? e : s, a = r === e ? s : e;
1554
1554
  return i[r] == o && n[r] == t ? a = r : i[a] == o && n[a] == t && (r = a), [r, a];
1555
1555
  }
1556
- function Ge(o) {
1556
+ function Ke(o) {
1557
1557
  const t = {};
1558
1558
  return o.filter((e) => {
1559
- const s = tn(e);
1559
+ const s = en(e);
1560
1560
  return s in t ? !1 : (t[s] = !0, !0);
1561
1561
  });
1562
1562
  }
1563
- function tn(o) {
1563
+ function en(o) {
1564
1564
  return `${o.a.join(",")};${o.b.join(",")}`;
1565
1565
  }
1566
- class en {
1566
+ class sn {
1567
1567
  constructor(t, e) {
1568
1568
  rt(this, "_i", 0);
1569
1569
  rt(this, "_n", 0);
@@ -1576,7 +1576,7 @@ class en {
1576
1576
  this._xx = t, this._yy = e;
1577
1577
  }
1578
1578
  }
1579
- function sn(o, t, e, s) {
1579
+ function nn(o, t, e, s) {
1580
1580
  let i = e | 0;
1581
1581
  const n = isNaN(s) ? o.length - i : s + i;
1582
1582
  let r, a, f, c, u, h;
@@ -1587,7 +1587,7 @@ function sn(o, t, e, s) {
1587
1587
  r = o[i], a = t[i], r < f && (f = r), r > u && (u = r), a < c && (c = a), a > h && (h = a);
1588
1588
  return [f, c, u, h];
1589
1589
  }
1590
- class ae {
1590
+ class oe {
1591
1591
  constructor(...t) {
1592
1592
  rt(this, "xmin");
1593
1593
  rt(this, "ymin");
@@ -1600,7 +1600,7 @@ class ae {
1600
1600
  return this.clone();
1601
1601
  }
1602
1602
  clone() {
1603
- return new ae(this.xmin, this.ymin, this.xmax, this.ymax);
1603
+ return new oe(this.xmin, this.ymin, this.xmax, this.ymax);
1604
1604
  }
1605
1605
  width() {
1606
1606
  return this.xmax - this.xmin || 0;
@@ -1617,7 +1617,7 @@ class ae {
1617
1617
  }
1618
1618
  mergeBounds(t, ...e) {
1619
1619
  let s, i, n, r;
1620
- return t instanceof ae ? (s = t.xmin, i = t.ymin, n = t.xmax, r = t.ymax) : e.length == 3 ? (s = t, i = e[0], n = e[1], r = e[2]) : t.length == 4 ? (s = t[0], i = t[1], n = t[2], r = t[3]) : be("Bounds#mergeBounds() invalid argument:", t), this.xmin === void 0 ? this.setBounds(s, i, n, r) : (s < this.xmin && (this.xmin = s), i < this.ymin && (this.ymin = i), n > this.xmax && (this.xmax = n), r > this.ymax && (this.ymax = r)), this;
1620
+ return t instanceof oe ? (s = t.xmin, i = t.ymin, n = t.xmax, r = t.ymax) : e.length == 3 ? (s = t, i = e[0], n = e[1], r = e[2]) : t.length == 4 ? (s = t[0], i = t[1], n = t[2], r = t[3]) : be("Bounds#mergeBounds() invalid argument:", t), this.xmin === void 0 ? this.setBounds(s, i, n, r) : (s < this.xmin && (this.xmin = s), i < this.ymin && (this.ymin = i), n > this.xmax && (this.xmax = n), r > this.ymax && (this.ymax = r)), this;
1621
1621
  }
1622
1622
  }
1623
1623
  function De(o) {
@@ -1633,7 +1633,7 @@ function De(o) {
1633
1633
  (e) => e.map((s) => t[s]).sort().join("-")
1634
1634
  ).sort();
1635
1635
  }
1636
- function nn(o, t, e) {
1636
+ function rn(o, t, e) {
1637
1637
  const s = De(t.forw), i = De(t.bakw);
1638
1638
  if (JSON.stringify(s) != JSON.stringify(i))
1639
1639
  throw `${JSON.stringify(t, null, 2)}
@@ -1679,14 +1679,17 @@ function Fe(o, t) {
1679
1679
  geom: r.properties.target.geom,
1680
1680
  index: r.properties.target.index
1681
1681
  }
1682
- }, h = Ot([me([c], u)]);
1682
+ }, h = Ot([
1683
+ me([c], u)
1684
+ ]);
1683
1685
  return [f, h];
1684
1686
  }).reduce(
1685
1687
  (s, i) => (s[0].push(i[0]), s[1].push(i[1]), s),
1686
1688
  [[], []]
1687
1689
  );
1688
1690
  }
1689
- class ht extends xs {
1691
+ const je = we;
1692
+ class ht extends _s {
1690
1693
  /**
1691
1694
  * Tinクラスのインスタンスを生成します
1692
1695
  * @param options - 初期化オプション
@@ -1702,7 +1705,7 @@ class ht extends xs {
1702
1705
  * フォーマットバージョンを取得します
1703
1706
  */
1704
1707
  getFormatVersion() {
1705
- return oe;
1708
+ return je;
1706
1709
  }
1707
1710
  /**
1708
1711
  * 制御点(GCP: Ground Control Points)を設定します
@@ -1717,7 +1720,7 @@ class ht extends xs {
1717
1720
  * エッジ(制約線)を設定します
1718
1721
  */
1719
1722
  setEdges(e = []) {
1720
- this.edges = We(e), this.edgeNodes = void 0, this.tins = void 0, this.indexedTins = void 0;
1723
+ this.edges = ze(e), this.edgeNodes = void 0, this.tins = void 0, this.indexedTins = void 0;
1721
1724
  }
1722
1725
  /**
1723
1726
  * 境界ポリゴンを設定します
@@ -1738,7 +1741,7 @@ class ht extends xs {
1738
1741
  getCompiled() {
1739
1742
  var i;
1740
1743
  const e = {};
1741
- e.version = oe, e.points = this.points, e.weight_buffer = this.pointsWeightBuffer, e.centroid_point = [
1744
+ e.version = je, e.points = this.points, e.weight_buffer = this.pointsWeightBuffer, e.centroid_point = [
1742
1745
  this.centroid.forw.geometry.coordinates,
1743
1746
  this.centroid.forw.properties.target.geom
1744
1747
  ], e.vertices_params = [
@@ -1751,11 +1754,15 @@ class ht extends xs {
1751
1754
  e.vertices_points[n] = [a, f];
1752
1755
  }), e.strict_status = this.strict_status, e.tins_points = [[]], this.tins.forw.features.map((n) => {
1753
1756
  e.tins_points[0].push(
1754
- ["a", "b", "c"].map((r) => n.properties[r].index)
1757
+ ["a", "b", "c"].map(
1758
+ (r) => n.properties[r].index
1759
+ )
1755
1760
  );
1756
1761
  }), this.strict_status === ht.STATUS_LOOSE ? (e.tins_points[1] = [], this.tins.bakw.features.map((n) => {
1757
1762
  e.tins_points[1].push(
1758
- ["a", "b", "c"].map((r) => n.properties[r].index)
1763
+ ["a", "b", "c"].map(
1764
+ (r) => n.properties[r].index
1765
+ )
1759
1766
  );
1760
1767
  })) : this.strict_status === ht.STATUS_ERROR && ((i = this.kinks) != null && i.bakw) && (e.kinks_points = this.kinks.bakw.features.map(
1761
1768
  (n) => n.geometry.coordinates
@@ -1783,18 +1790,20 @@ class ht extends xs {
1783
1790
  * 厳密なTINを計算します
1784
1791
  */
1785
1792
  calcurateStrictTin() {
1786
- const e = this.tins.forw.features.map((n) => ms(n));
1793
+ const e = this.tins.forw.features.map(
1794
+ (n) => bs(n)
1795
+ );
1787
1796
  this.tins.bakw = Ot(e);
1788
1797
  const s = {};
1789
1798
  this.tins.forw.features.forEach((n, r) => {
1790
1799
  const a = this.tins.bakw.features[r];
1791
- nn(s, { forw: n, bakw: a });
1800
+ rn(s, { forw: n, bakw: a });
1792
1801
  });
1793
1802
  const i = ["forw", "bakw"].map((n) => {
1794
1803
  const r = this.tins[n].features.map(
1795
1804
  (a) => a.geometry.coordinates[0]
1796
1805
  );
1797
- return Ns(r);
1806
+ return Us(r);
1798
1807
  });
1799
1808
  i[0].length === 0 && i[1].length === 0 ? (this.strict_status = ht.STATUS_STRICT, delete this.kinks) : (this.strict_status = ht.STATUS_ERROR, this.kinks = {}, i[0].length > 0 && (this.kinks.forw = Ot(i[0])), i[1].length > 0 && (this.kinks.bakw = Ot(i[1])));
1800
1809
  }
@@ -1802,7 +1811,10 @@ class ht extends xs {
1802
1811
  * 点群セットを生成します
1803
1812
  */
1804
1813
  generatePointsSet() {
1805
- const e = { forw: [], bakw: [] };
1814
+ const e = {
1815
+ forw: [],
1816
+ bakw: []
1817
+ };
1806
1818
  for (let n = 0; n < this.points.length; n++) {
1807
1819
  const r = this.points[n][0], a = this.points[n][1], f = ne(r, a, n);
1808
1820
  e.forw.push(f), e.bakw.push(ie(f));
@@ -1833,14 +1845,17 @@ class ht extends xs {
1833
1845
  c.map((u, h) => {
1834
1846
  const l = c[h ? 0 : 1];
1835
1847
  return u.filter((p, y) => !(y === 0 || y === u.length - 1 || p[4] === "handled")).map((p) => {
1836
- const y = p[0], g = p[3], b = l.reduce((w, S, _, v) => {
1837
- if (w) return w;
1838
- const T = v[_ + 1];
1839
- if (S[3] === g)
1840
- return S[4] = "handled", [S];
1841
- if (S[3] < g && T && T[3] > g)
1842
- return [S, T];
1843
- }, void 0);
1848
+ const y = p[0], g = p[3], b = l.reduce(
1849
+ (w, S, _, v) => {
1850
+ if (w) return w;
1851
+ const T = v[_ + 1];
1852
+ if (S[3] === g)
1853
+ return S[4] = "handled", [S];
1854
+ if (S[3] < g && T && T[3] > g)
1855
+ return [S, T];
1856
+ },
1857
+ void 0
1858
+ );
1844
1859
  if (b && b.length === 1)
1845
1860
  return h === 0 ? [y, b[0][0], g] : [b[0][0], y, g];
1846
1861
  if (b && b.length === 2) {
@@ -1853,9 +1868,19 @@ class ht extends xs {
1853
1868
  return [];
1854
1869
  });
1855
1870
  }).reduce((u, h) => u.concat(h), []).sort((u, h) => u[2] < h[2] ? -1 : 1).map((u, h, l) => {
1856
- this.edgeNodes[i] = [u[0], u[1]];
1857
- const p = ne(u[0], u[1], `e${i}`);
1858
- i++, e.forw.push(p), e.bakw.push(ie(p)), h === 0 ? s.push([r[0], e.forw.length - 1]) : s.push([e.forw.length - 2, e.forw.length - 1]), h === l.length - 1 && s.push([e.forw.length - 1, r[1]]);
1871
+ this.edgeNodes[i] = [
1872
+ u[0],
1873
+ u[1]
1874
+ ];
1875
+ const p = ne(
1876
+ u[0],
1877
+ u[1],
1878
+ `e${i}`
1879
+ );
1880
+ i++, e.forw.push(p), e.bakw.push(ie(p)), h === 0 ? s.push([r[0], e.forw.length - 1]) : s.push([
1881
+ e.forw.length - 2,
1882
+ e.forw.length - 1
1883
+ ]), h === l.length - 1 && s.push([e.forw.length - 1, r[1]]);
1859
1884
  });
1860
1885
  }
1861
1886
  return {
@@ -1869,7 +1894,7 @@ class ht extends xs {
1869
1894
  */
1870
1895
  validateAndPrepareInputs() {
1871
1896
  const e = this.xy[0] - 0.05 * this.wh[0], s = this.xy[0] + 1.05 * this.wh[0], i = this.xy[1] - 0.05 * this.wh[1], n = this.xy[1] + 1.05 * this.wh[1];
1872
- if (!this.points.reduce((f, c) => f && (this.bounds ? Ze(c[0], this.boundsPolygon) : c[0][0] >= e && c[0][0] <= s && c[0][1] >= i && c[0][1] <= n), !0))
1897
+ if (!this.points.reduce((f, c) => f && (this.bounds ? ts(c[0], this.boundsPolygon) : c[0][0] >= e && c[0][0] <= s && c[0][1] >= i && c[0][1] <= n), !0))
1873
1898
  throw "SOME POINTS OUTSIDE";
1874
1899
  let a = [];
1875
1900
  return this.wh && (a = [[e, i], [s, i], [e, n], [s, n]]), {
@@ -1890,10 +1915,18 @@ class ht extends xs {
1890
1915
  const { pointsSet: s, bbox: i, minx: n, maxx: r, miny: a, maxy: f } = this.validateAndPrepareInputs(), c = {
1891
1916
  forw: Ot(s.forw),
1892
1917
  bakw: Ot(s.bakw)
1893
- }, u = te(c.forw, s.edges, "target"), h = te(c.bakw, s.edges, "target");
1918
+ }, u = te(
1919
+ c.forw,
1920
+ s.edges,
1921
+ "target"
1922
+ ), h = te(
1923
+ c.bakw,
1924
+ s.edges,
1925
+ "target"
1926
+ );
1894
1927
  if (u.features.length === 0 || h.features.length === 0)
1895
1928
  throw "TOO LINEAR1";
1896
- const l = ts(c.forw), p = ke(c.forw);
1929
+ const l = es(c.forw), p = ke(c.forw);
1897
1930
  if (!p) throw "TOO LINEAR2";
1898
1931
  const y = {}, g = p.geometry.coordinates[0];
1899
1932
  let b;
@@ -1928,7 +1961,26 @@ class ht extends xs {
1928
1961
  forw: v,
1929
1962
  bakw: ie(v)
1930
1963
  };
1931
- const T = this.vertexMode === ht.VERTEX_BIRDEYE ? this.calculateBirdeyeVertices(y, _, i, n, r, a, f) : this.calculatePlainVertices(y, _, i, n, r, a, f), I = { forw: [], bakw: [] };
1964
+ const T = this.vertexMode === ht.VERTEX_BIRDEYE ? this.calculateBirdeyeVertices(
1965
+ y,
1966
+ _,
1967
+ i,
1968
+ n,
1969
+ r,
1970
+ a,
1971
+ f
1972
+ ) : this.calculatePlainVertices(
1973
+ y,
1974
+ _,
1975
+ i,
1976
+ n,
1977
+ r,
1978
+ a,
1979
+ f
1980
+ ), I = {
1981
+ forw: [],
1982
+ bakw: []
1983
+ };
1932
1984
  for (let N = 0; N < T.length; N++) {
1933
1985
  const V = T[N].forw, z = T[N].bakw, G = ne(V, z, `b${N}`), tt = ie(G);
1934
1986
  s.forw.push(G), s.bakw.push(tt), I.forw.push(G), I.bakw.push(tt);
@@ -1938,9 +1990,19 @@ class ht extends xs {
1938
1990
  bakw: Ot(s.bakw),
1939
1991
  edges: []
1940
1992
  }, this.tins = {
1941
- forw: ve(te(this.pointsSet.forw, s.edges, "target"))
1993
+ forw: ve(
1994
+ te(
1995
+ this.pointsSet.forw,
1996
+ s.edges,
1997
+ "target"
1998
+ )
1999
+ )
1942
2000
  }, (e === ht.MODE_STRICT || e === ht.MODE_AUTO) && this.calcurateStrictTin(), (e === ht.MODE_LOOSE || e === ht.MODE_AUTO && this.strict_status === ht.STATUS_ERROR) && (this.tins.bakw = ve(
1943
- te(this.pointsSet.bakw, s.edges, "target")
2001
+ te(
2002
+ this.pointsSet.bakw,
2003
+ s.edges,
2004
+ "target"
2005
+ )
1944
2006
  ), delete this.kinks, this.strict_status = ht.STATUS_LOOSE), this.vertices_params = {
1945
2007
  forw: Fe(I.forw, this.centroid.forw),
1946
2008
  bakw: Fe(I.bakw, this.centroid.bakw)
@@ -1957,38 +2019,66 @@ class ht extends xs {
1957
2019
  }, v = _.forw[0] === 0 ? 1 / 0 : ((_.forw[0] < 0 ? n : r) - s.forw[0]) / _.forw[0], T = _.forw[1] === 0 ? 1 / 0 : ((_.forw[1] < 0 ? a : f) - s.forw[1]) / _.forw[1];
1958
2020
  if (Math.abs(v) / Math.abs(T) < 1.1) {
1959
2021
  const I = {
1960
- forw: [_.forw[0] * v + s.forw[0], _.forw[1] * v + s.forw[1]],
1961
- bakw: [_.bakw[0] * v + s.bakw[0], _.bakw[1] * v + s.bakw[1]]
2022
+ forw: [
2023
+ _.forw[0] * v + s.forw[0],
2024
+ _.forw[1] * v + s.forw[1]
2025
+ ],
2026
+ bakw: [
2027
+ _.bakw[0] * v + s.bakw[0],
2028
+ _.bakw[1] * v + s.bakw[1]
2029
+ ]
1962
2030
  };
1963
2031
  _.forw[0] < 0 ? y[3].push(I) : y[1].push(I);
1964
2032
  }
1965
2033
  if (Math.abs(T) / Math.abs(v) < 1.1) {
1966
2034
  const I = {
1967
- forw: [_.forw[0] * T + s.forw[0], _.forw[1] * T + s.forw[1]],
1968
- bakw: [_.bakw[0] * T + s.bakw[0], _.bakw[1] * T + s.bakw[1]]
2035
+ forw: [
2036
+ _.forw[0] * T + s.forw[0],
2037
+ _.forw[1] * T + s.forw[1]
2038
+ ],
2039
+ bakw: [
2040
+ _.bakw[0] * T + s.bakw[0],
2041
+ _.bakw[1] * T + s.bakw[1]
2042
+ ]
1969
2043
  };
1970
2044
  _.forw[1] < 0 ? y[0].push(I) : y[2].push(I);
1971
2045
  }
1972
2046
  return y;
1973
2047
  }, [[], [], [], []]);
1974
- let h = Object.keys(e).reduce((y, g, b, w) => {
1975
- const S = e[g], _ = S.forw, v = S.bakw, T = {
1976
- forw: [_[0] - s.forw[0], _[1] - s.forw[1]],
1977
- bakw: [v[0] - s.bakw[0], s.bakw[1] - v[1]]
1978
- };
1979
- if (T.forw[0] === 0 || T.forw[1] === 0) return y;
1980
- let I = 0;
1981
- return T.forw[0] > 0 && (I += 1), T.forw[1] > 0 && (I += 2), y[I].push([T.forw, T.bakw]), b === w.length - 1 ? y.map((N) => N.reduce((V, z, G, tt) => {
1982
- V || (V = [1 / 0, 0, 0]);
1983
- let X = Math.sqrt(Math.pow(z[0][0], 2) + Math.pow(z[0][1], 2)) / Math.sqrt(Math.pow(z[1][0], 2) + Math.pow(z[1][1], 2));
1984
- X = X < V[0] ? X : V[0];
1985
- const it = Math.atan2(z[0][0], z[0][1]) - Math.atan2(z[1][0], z[1][1]), d = V[1] + Math.cos(it), m = V[2] + Math.sin(it);
1986
- return G === tt.length - 1 ? [X, Math.atan2(m, d)] : [X, d, m];
1987
- }, null)) : y;
1988
- }, [[], [], [], []]);
1989
- h.length === 1 && (h = [h[0], h[0], h[0], h[0]]);
2048
+ let h = Object.keys(e).reduce(
2049
+ (y, g, b, w) => {
2050
+ const S = e[g], _ = S.forw, v = S.bakw, T = {
2051
+ forw: [_[0] - s.forw[0], _[1] - s.forw[1]],
2052
+ bakw: [v[0] - s.bakw[0], s.bakw[1] - v[1]]
2053
+ };
2054
+ if (T.forw[0] === 0 || T.forw[1] === 0) return y;
2055
+ let I = 0;
2056
+ return T.forw[0] > 0 && (I += 1), T.forw[1] > 0 && (I += 2), y[I].push([T.forw, T.bakw]), b === w.length - 1 ? y.map((N) => N.reduce(
2057
+ (V, z, G, tt) => {
2058
+ V || (V = [1 / 0, 0, 0]);
2059
+ let X = Math.sqrt(Math.pow(z[0][0], 2) + Math.pow(z[0][1], 2)) / Math.sqrt(Math.pow(z[1][0], 2) + Math.pow(z[1][1], 2));
2060
+ X = X < V[0] ? X : V[0];
2061
+ const it = Math.atan2(z[0][0], z[0][1]) - Math.atan2(z[1][0], z[1][1]), d = V[1] + Math.cos(it), m = V[2] + Math.sin(it);
2062
+ return G === tt.length - 1 ? [X, Math.atan2(m, d)] : [X, d, m];
2063
+ },
2064
+ null
2065
+ )) : y;
2066
+ },
2067
+ [[], [], [], []]
2068
+ );
2069
+ h.length === 1 && (h = [
2070
+ h[0],
2071
+ h[0],
2072
+ h[0],
2073
+ h[0]
2074
+ ]);
1990
2075
  const l = h.map((y, g) => {
1991
- const b = i[g], w = [b[0] - s.forw[0], b[1] - s.forw[1]], _ = Math.sqrt(Math.pow(w[0], 2) + Math.pow(w[1], 2)) / y[0], v = Math.atan2(w[0], w[1]) - y[1], T = [
2076
+ const b = i[g], w = [
2077
+ b[0] - s.forw[0],
2078
+ b[1] - s.forw[1]
2079
+ ], _ = Math.sqrt(
2080
+ Math.pow(w[0], 2) + Math.pow(w[1], 2)
2081
+ ) / y[0], v = Math.atan2(w[0], w[1]) - y[1], T = [
1992
2082
  s.bakw[0] + _ * Math.sin(v),
1993
2083
  s.bakw[1] - _ * Math.cos(v)
1994
2084
  ];
@@ -2000,7 +2090,15 @@ class ht extends xs {
2000
2090
  * 鳥瞰図モードの頂点を計算
2001
2091
  */
2002
2092
  calculateBirdeyeVertices(e, s, i, n, r, a, f) {
2003
- return this.calculatePlainVertices(e, s, i, n, r, a, f);
2093
+ return this.calculatePlainVertices(
2094
+ e,
2095
+ s,
2096
+ i,
2097
+ n,
2098
+ r,
2099
+ a,
2100
+ f
2101
+ );
2004
2102
  }
2005
2103
  /**
2006
2104
  * 頂点の位置を調整
@@ -2010,12 +2108,18 @@ class ht extends xs {
2010
2108
  for (let r = 0; r < 4; r++) {
2011
2109
  const a = (r + 1) % 4, f = xe([e[r].bakw, e[a].bakw]);
2012
2110
  s[r].map((c) => {
2013
- const u = xe([i.bakw, c.bakw]), h = es(f, u);
2111
+ const u = xe([i.bakw, c.bakw]), h = ss(f, u);
2014
2112
  if (h.features.length > 0 && h.features[0].geometry) {
2015
2113
  const l = h.features[0], p = Math.sqrt(
2016
2114
  Math.pow(c.bakw[0] - i.bakw[0], 2) + Math.pow(c.bakw[1] - i.bakw[1], 2)
2017
2115
  ), y = Math.sqrt(
2018
- Math.pow(l.geometry.coordinates[0] - i.bakw[0], 2) + Math.pow(l.geometry.coordinates[1] - i.bakw[1], 2)
2116
+ Math.pow(
2117
+ l.geometry.coordinates[0] - i.bakw[0],
2118
+ 2
2119
+ ) + Math.pow(
2120
+ l.geometry.coordinates[1] - i.bakw[1],
2121
+ 2
2122
+ )
2019
2123
  ), g = p / y;
2020
2124
  g > n[r] && (n[r] = g), g > n[a] && (n[a] = g);
2021
2125
  }
@@ -2083,8 +2187,8 @@ export {
2083
2187
  te as constrainedTin,
2084
2188
  ie as counterPoint,
2085
2189
  ne as createPoint,
2086
- Ns as findIntersections,
2087
- oe as format_version,
2088
- nn as insertSearchIndex,
2190
+ Us as findIntersections,
2191
+ we as format_version,
2192
+ rn as insertSearchIndex,
2089
2193
  Fe as vertexCalc
2090
2194
  };