gl-draw 0.17.0-beta.36 → 0.17.0-beta.38

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.
@@ -1,56 +1,56 @@
1
- var Ve = Object.defineProperty, _e = Object.defineProperties;
2
- var Ne = Object.getOwnPropertyDescriptors;
3
- var N = Object.getOwnPropertySymbols;
4
- var re = Object.prototype.hasOwnProperty, oe = Object.prototype.propertyIsEnumerable;
5
- var ae = Math.pow, ne = (r, e, t) => e in r ? Ve(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k = (r, e) => {
1
+ var _e = Object.defineProperty, Ne = Object.defineProperties;
2
+ var Re = Object.getOwnPropertyDescriptors;
3
+ var _ = Object.getOwnPropertySymbols;
4
+ var oe = Object.prototype.hasOwnProperty, ae = Object.prototype.propertyIsEnumerable;
5
+ var ce = Math.pow, re = (r, e, t) => e in r ? _e(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, k = (r, e) => {
6
6
  for (var t in e || (e = {}))
7
- re.call(e, t) && ne(r, t, e[t]);
8
- if (N)
9
- for (var t of N(e))
10
- oe.call(e, t) && ne(r, t, e[t]);
7
+ oe.call(e, t) && re(r, t, e[t]);
8
+ if (_)
9
+ for (var t of _(e))
10
+ ae.call(e, t) && re(r, t, e[t]);
11
11
  return r;
12
- }, X = (r, e) => _e(r, Ne(e));
13
- var ce = (r, e) => {
12
+ }, X = (r, e) => Ne(r, Re(e));
13
+ var le = (r, e) => {
14
14
  var t = {};
15
15
  for (var i in r)
16
- re.call(r, i) && e.indexOf(i) < 0 && (t[i] = r[i]);
17
- if (r != null && N)
18
- for (var i of N(r))
19
- e.indexOf(i) < 0 && oe.call(r, i) && (t[i] = r[i]);
16
+ oe.call(r, i) && e.indexOf(i) < 0 && (t[i] = r[i]);
17
+ if (r != null && _)
18
+ for (var i of _(r))
19
+ e.indexOf(i) < 0 && ae.call(r, i) && (t[i] = r[i]);
20
20
  return t;
21
21
  };
22
- var le = (r, e, t) => new Promise((i, s) => {
22
+ var ue = (r, e, t) => new Promise((i, s) => {
23
23
  var o = (a) => {
24
24
  try {
25
25
  n(t.next(a));
26
- } catch (l) {
27
- s(l);
26
+ } catch (h) {
27
+ s(h);
28
28
  }
29
29
  }, c = (a) => {
30
30
  try {
31
31
  n(t.throw(a));
32
- } catch (l) {
33
- s(l);
32
+ } catch (h) {
33
+ s(h);
34
34
  }
35
35
  }, n = (a) => a.done ? i(a.value) : Promise.resolve(a.value).then(o, c);
36
36
  n((t = t.apply(r, e)).next());
37
37
  });
38
- import { merge as te, mean as We, extent as ue } from "d3-array";
39
- import Re, { flatten as Te } from "earcut";
40
- import { Material as he, Object3D as G, Texture as de, Vector3 as S, Matrix4 as Be, Ray as Ue, Sphere as Oe, BufferGeometry as ie, Float32BufferAttribute as $, PointsMaterial as Ge, Points as se, InstancedMesh as De, Quaternion as $e, Group as Fe, Mesh as Ee, Sprite as fe, Box3 as ze, ShaderMaterial as qe, Vector2 as K, Color as pe, Vector4 as V, Line3 as Xe, InstancedInterleavedBuffer as Ke, InterleavedBufferAttribute as me, MathUtils as Qe } from "three";
41
- import Ye from "@turf/boolean-clockwise";
42
- import { p as ve, a as Ze } from "./polar2Cartesian.module.js";
43
- import Je from "delaunator";
44
- import He from "@turf/boolean-point-in-polygon";
45
- import { geoBounds as Le, geoContains as et, geoDistance as tt, geoInterpolate as it } from "d3-geo";
46
- import { geoVoronoi as st } from "d3-geo-voronoi";
47
- import { scaleLinear as be } from "d3-scale";
48
- import { LineSegmentsGeometry as nt } from "three/examples/jsm/lines/LineSegmentsGeometry";
49
- import { CSS2DObject as rt } from "three/examples/jsm/renderers/CSS2DRenderer";
50
- import { CSS3DObject as ot, CSS3DSprite as at } from "three/examples/jsm/renderers/CSS3DRenderer";
38
+ import { merge as ie, mean as Ue, extent as he } from "d3-array";
39
+ import Ge, { flatten as Oe } from "earcut";
40
+ import { Material as de, Object3D as G, Texture as fe, Vector3 as S, Matrix4 as De, Ray as $e, Sphere as ze, BufferGeometry as se, Float32BufferAttribute as $, PointsMaterial as Fe, Points as ne, InstancedMesh as Ee, Quaternion as qe, Group as Xe, Mesh as Le, Sprite as pe, Box3 as ke, ShaderMaterial as Ke, Vector2 as K, Color as me, Vector4 as V, Line3 as Qe, InstancedInterleavedBuffer as Ye, InterleavedBufferAttribute as ve, MathUtils as Ze } from "three";
41
+ import Je from "@turf/boolean-clockwise";
42
+ import { p as be, W as Q, c as ye } from "./cartographicToCartesian.module.js";
43
+ import He from "delaunator";
44
+ import et from "@turf/boolean-point-in-polygon";
45
+ import { geoBounds as Ve, geoContains as tt, geoDistance as it, geoInterpolate as st } from "d3-geo";
46
+ import { geoVoronoi as nt } from "d3-geo-voronoi";
47
+ import { scaleLinear as ge } from "d3-scale";
48
+ import { LineSegmentsGeometry as rt } from "three/examples/jsm/lines/LineSegmentsGeometry";
49
+ import { CSS2DObject as ot } from "three/examples/jsm/renderers/CSS2DRenderer";
50
+ import { CSS3DObject as at, CSS3DSprite as ct } from "three/examples/jsm/renderers/CSS3DRenderer";
51
51
  import "d3-geo-projection";
52
- const ye = 0, ge = 1, Nt = !1;
53
- class ct {
52
+ const Me = 0, xe = 1, Nt = !1;
53
+ class lt {
54
54
  constructor() {
55
55
  this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
56
56
  }
@@ -59,24 +59,24 @@ class ct {
59
59
  return e;
60
60
  if (Array.isArray(e))
61
61
  return e.forEach((t) => this.track(t)), e;
62
- if (!this.disposeMaterial && e instanceof he)
62
+ if (!this.disposeMaterial && e instanceof de)
63
63
  return e;
64
- if (e instanceof H ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof G || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof H)
64
+ if (e instanceof ee ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof G || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof ee)
65
65
  e.children.forEach((t) => {
66
66
  t.disposeTrack = !1;
67
67
  }), this.track(e.children);
68
68
  else if (e instanceof G) {
69
69
  const t = e;
70
70
  this.track(t.geometry), this.track(t.material), this.track(t.children);
71
- } else if (e instanceof he) {
71
+ } else if (e instanceof de) {
72
72
  for (const i of Object.values(e))
73
- i instanceof de && this.track(i);
73
+ i instanceof fe && this.track(i);
74
74
  const t = e;
75
75
  if (t.uniforms) {
76
76
  for (const i of Object.values(t.uniforms))
77
77
  if (i) {
78
78
  const s = i.value;
79
- (s instanceof de || Array.isArray(s)) && this.track(s);
79
+ (s instanceof fe || Array.isArray(s)) && this.track(s);
80
80
  }
81
81
  }
82
82
  } else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
@@ -91,17 +91,17 @@ class ct {
91
91
  }), e.length = 0, this.resources.clear();
92
92
  }
93
93
  }
94
- const Me = /* @__PURE__ */ new Be(), ke = /* @__PURE__ */ new Ue(), Q = /* @__PURE__ */ new Oe(), W = /* @__PURE__ */ new S();
95
- function lt(r, e) {
94
+ const we = /* @__PURE__ */ new De(), We = /* @__PURE__ */ new $e(), Y = /* @__PURE__ */ new ze(), N = /* @__PURE__ */ new S();
95
+ function ut(r, e) {
96
96
  const t = this.geometry, i = this.matrixWorld, s = r.params.Points.threshold, o = t.drawRange;
97
- t.boundingSphere === null && t.computeBoundingSphere(), Q.copy(t.boundingSphere), Q.applyMatrix4(i), Q.radius += s, Me.copy(i).invert(), ke.copy(r.ray).applyMatrix4(Me);
98
- const c = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), n = t.index, l = t.attributes.position;
97
+ t.boundingSphere === null && t.computeBoundingSphere(), Y.copy(t.boundingSphere), Y.applyMatrix4(i), Y.radius += s, we.copy(i).invert(), We.copy(r.ray).applyMatrix4(we);
98
+ const c = s / ((this.scale.x + this.scale.y + this.scale.z) / 3), n = t.index, h = t.attributes.position;
99
99
  if (n !== null) {
100
- const f = Math.max(0, o.start), u = Math.min(n.count, o.start + o.count);
101
- for (let d = f, h = u; d < h; d++) {
102
- const p = n.getX(d);
103
- W.fromBufferAttribute(l, p), we(
104
- W,
100
+ const d = Math.max(0, o.start), u = Math.min(n.count, o.start + o.count);
101
+ for (let f = d, l = u; f < l; f++) {
102
+ const p = n.getX(f);
103
+ N.fromBufferAttribute(h, p), Se(
104
+ N,
105
105
  p,
106
106
  c,
107
107
  i,
@@ -111,14 +111,14 @@ function lt(r, e) {
111
111
  );
112
112
  }
113
113
  } else {
114
- const f = Math.max(0, o.start), u = Math.min(
115
- l.count,
114
+ const d = Math.max(0, o.start), u = Math.min(
115
+ h.count,
116
116
  o.start + o.count
117
117
  );
118
- for (let d = f, h = u; d < h; d++)
119
- W.fromBufferAttribute(l, d), we(
120
- W,
121
- d,
118
+ for (let f = d, l = u; f < l; f++)
119
+ N.fromBufferAttribute(h, f), Se(
120
+ N,
121
+ f,
122
122
  c,
123
123
  i,
124
124
  r,
@@ -127,19 +127,19 @@ function lt(r, e) {
127
127
  );
128
128
  }
129
129
  }
130
- function we(r, e, t, i, s, o, c) {
130
+ function Se(r, e, t, i, s, o, c) {
131
131
  const n = new S();
132
- ke.closestPointToPoint(r, n), n.applyMatrix4(i);
133
- const a = s.ray.origin.distanceTo(r), l = n.distanceTo(r), f = Math.asin(
134
- l / a
132
+ We.closestPointToPoint(r, n), n.applyMatrix4(i);
133
+ const a = s.ray.origin.distanceTo(r), h = n.distanceTo(r), d = Math.asin(
134
+ h / a
135
135
  );
136
- if (f < t) {
136
+ if (d < t) {
137
137
  if (a < s.near || a > s.far)
138
138
  return;
139
139
  o.push({
140
140
  distance: a,
141
- distanceToRay: l,
142
- angleToRay: f,
141
+ distanceToRay: h,
142
+ angleToRay: d,
143
143
  point: n,
144
144
  index: e,
145
145
  face: null,
@@ -147,8 +147,8 @@ function we(r, e, t, i, s, o, c) {
147
147
  });
148
148
  }
149
149
  }
150
- const ut = (r, e = 1) => {
151
- const t = new ie();
150
+ const ht = (r, e = 1) => {
151
+ const t = new se();
152
152
  t.setAttribute(
153
153
  "position",
154
154
  new $(new Array(e * 3).fill(0), 3)
@@ -156,7 +156,7 @@ const ut = (r, e = 1) => {
156
156
  "scaleAtt",
157
157
  new $(new Array(e).fill(1), 1)
158
158
  );
159
- const i = r.material, s = new Ge({
159
+ const i = r.material, s = new Fe({
160
160
  size: 10,
161
161
  map: i.map,
162
162
  alphaMap: i.alphaMap,
@@ -178,23 +178,23 @@ const ut = (r, e = 1) => {
178
178
  )}
179
179
  `;
180
180
  };
181
- const o = new se(t, s);
182
- return o.raycast = lt, o;
183
- }, ht = (r, e) => {
181
+ const o = new ne(t, s);
182
+ return o.raycast = ut, o;
183
+ }, dt = (r, e) => {
184
184
  const t = new G();
185
185
  e.forEach((i, s) => {
186
- const o = ve(i.position), c = ve(i.scale || [1, 1, 1]);
186
+ const o = be(i.position), c = be(i.scale || [1, 1, 1]);
187
187
  t.position.copy(o), t.scale.copy(c), t.updateMatrix();
188
188
  const n = t.matrix.clone();
189
- if (r instanceof De || r.isInstantiate)
189
+ if (r instanceof Ee || r.isInstantiate)
190
190
  r.setMatrixAt(s, n);
191
- else if (r instanceof se || r.type === "Points") {
192
- const l = r.geometry, f = l.attributes.position.array, u = l.attributes.scaleAtt.array, d = new S(), h = new S(), p = new $e(), m = s * 3, v = s * 1;
193
- n.decompose(d, p, h), f[m] = d.x, f[m + 1] = d.y, f[m + 2] = d.z, u[v] = Math.max(h.x, h.y, h.z), l.attributes.position.needsUpdate = !0, l.attributes.scaleAtt.needsUpdate = !0;
191
+ else if (r instanceof ne || r.type === "Points") {
192
+ const h = r.geometry, d = h.attributes.position.array, u = h.attributes.scaleAtt.array, f = new S(), l = new S(), p = new qe(), m = s * 3, b = s * 1;
193
+ n.decompose(f, p, l), d[m] = f.x, d[m + 1] = f.y, d[m + 2] = f.z, u[b] = Math.max(l.x, l.y, l.z), h.attributes.position.needsUpdate = !0, h.attributes.scaleAtt.needsUpdate = !0;
194
194
  }
195
195
  });
196
196
  };
197
- class dt {
197
+ class ft {
198
198
  constructor() {
199
199
  this.onPointerIndex = [];
200
200
  }
@@ -226,7 +226,7 @@ class dt {
226
226
  });
227
227
  }
228
228
  }
229
- class ft extends dt {
229
+ class pt extends ft {
230
230
  constructor() {
231
231
  super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
232
232
  }
@@ -284,7 +284,7 @@ class ft extends dt {
284
284
  );
285
285
  }
286
286
  }
287
- class H extends ft {
287
+ class ee extends pt {
288
288
  constructor() {
289
289
  super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0, this.isDispose = !1;
290
290
  }
@@ -352,7 +352,7 @@ class H extends ft {
352
352
  */
353
353
  _disableLayersRecursive() {
354
354
  var e;
355
- (e = this.object3d) == null || e.layers.disable(ye), this.children.forEach((t) => {
355
+ (e = this.object3d) == null || e.layers.disable(Me), this.children.forEach((t) => {
356
356
  t._disableLayersRecursive();
357
357
  });
358
358
  }
@@ -361,30 +361,30 @@ class H extends ft {
361
361
  */
362
362
  _enableLayersRecursive() {
363
363
  var e;
364
- this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(ye), this.children.forEach((t) => {
364
+ this.object3d.visible && ((e = this.object3d) == null || e.layers.enable(Me), this.children.forEach((t) => {
365
365
  t._enableLayersRecursive();
366
366
  }));
367
367
  }
368
368
  createGroup() {
369
- return this.object3d = new Fe(), this;
369
+ return this.object3d = new Xe(), this;
370
370
  }
371
371
  createMesh(...e) {
372
- return this.object3d = new Ee(...e), this;
372
+ return this.object3d = new Le(...e), this;
373
373
  }
374
374
  createPoints(...e) {
375
- return this.object3d = new se(...e), this;
375
+ return this.object3d = new ne(...e), this;
376
376
  }
377
377
  createCSS2DObject(e) {
378
- return this.object3d = new rt(e), this;
378
+ return this.object3d = new ot(e), this;
379
379
  }
380
380
  createCSS3DObject(e) {
381
- return this.object3d = new ot(e), this;
381
+ return this.object3d = new at(e), this;
382
382
  }
383
383
  createCSS3DSprite(e) {
384
- return this.object3d = new at(e), this;
384
+ return this.object3d = new ct(e), this;
385
385
  }
386
386
  createSprite(e) {
387
- return this.object3d = new fe(e), this;
387
+ return this.object3d = new pe(e), this;
388
388
  }
389
389
  attach(...e) {
390
390
  return [...e].forEach((t) => {
@@ -392,7 +392,7 @@ class H extends ft {
392
392
  }), this;
393
393
  }
394
394
  getSize() {
395
- const e = new ze().setFromObject(this.object3d);
395
+ const e = new ke().setFromObject(this.object3d);
396
396
  return {
397
397
  min: e.min,
398
398
  max: e.max,
@@ -409,28 +409,28 @@ class H extends ft {
409
409
  });
410
410
  }
411
411
  instantiate(e) {
412
- return le(this, null, function* () {
413
- var l, f;
414
- const t = (l = e == null ? void 0 : e.recursive) != null ? l : !0, i = (f = e == null ? void 0 : e.cloneMaterial) != null ? f : !1, { objectType: s, objectOptions: o } = this;
412
+ return ue(this, null, function* () {
413
+ var h, d;
414
+ const t = (h = e == null ? void 0 : e.recursive) != null ? h : !0, i = (d = e == null ? void 0 : e.cloneMaterial) != null ? d : !1, { objectType: s, objectOptions: o } = this;
415
415
  let c = e == null ? void 0 : e.create, n, a = (e == null ? void 0 : e.target) || this.parent;
416
416
  return a === this.lead.prefabGroup && (a = this.lead.group), this.objectType === "BaseObject" ? n = this.lead.createBaseObject(this.object3d.clone(!1), {
417
417
  target: a
418
418
  }) : (c === void 0 && (c = (u) => {
419
- var d;
419
+ var f;
420
420
  if (this.object3d) {
421
- if ((d = e == null ? void 0 : e.instancedAttr) != null && d.length) {
422
- const h = e.instancedAttr.length;
423
- if (this.object3d instanceof fe)
424
- u.object3d = ut(this.object3d, h);
421
+ if ((f = e == null ? void 0 : e.instancedAttr) != null && f.length) {
422
+ const l = e.instancedAttr.length;
423
+ if (this.object3d instanceof pe)
424
+ u.object3d = ht(this.object3d, l);
425
425
  else {
426
426
  const p = this.object3d, m = i ? this.cloneMaterial() : p.material;
427
- u.object3d = new De(
427
+ u.object3d = new Ee(
428
428
  p.geometry,
429
429
  m,
430
- h
430
+ l
431
431
  );
432
432
  }
433
- ht(u.object3d, e == null ? void 0 : e.instancedAttr);
433
+ dt(u.object3d, e == null ? void 0 : e.instancedAttr);
434
434
  } else
435
435
  u.object3d = this.object3d.clone(!1), i && u.object3d.material && (u.object3d.material = this.cloneMaterial());
436
436
  u.object3d.userData.prefab && delete u.object3d.userData.prefab;
@@ -471,7 +471,7 @@ class H extends ft {
471
471
  });
472
472
  return;
473
473
  }
474
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(ge)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
474
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.add(this), this.object3d.layers.enable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !0;
475
475
  }
476
476
  disableBloom(e = !0) {
477
477
  var t, i, s;
@@ -485,228 +485,235 @@ class H extends ft {
485
485
  });
486
486
  return;
487
487
  }
488
- this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(ge)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
488
+ this.object3d && ((i = this.pencil.composerController) == null || i.bloomSelection.delete(this), this.object3d.layers.disable(xe)), (s = this.pencil.composerController) == null || s.checkBloomComposerActive(), this.isBloom = !1;
489
489
  }
490
490
  dispose() {
491
491
  var e, t;
492
492
  if (!this.isDispose && (this.isDispose = !0, super.dispose(), this.isBloom && (this.disableBloom(!1), (e = this.pencil.composerController) == null || e.checkBloomComposerActive()), (t = this.lead) == null || t.disableCursor(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack)) {
493
- const i = new ct();
493
+ const i = new lt();
494
494
  i.disposeMaterial = !1, i.track(this), i.dispose();
495
495
  }
496
496
  }
497
497
  }
498
- function pt(r, e) {
498
+ function mt(r, e) {
499
499
  return r.map((t) => {
500
500
  const i = [];
501
501
  let s;
502
502
  return t.forEach((o) => {
503
503
  if (s) {
504
- const c = tt(o, s) * 180 / Math.PI;
504
+ const c = it(o, s) * 180 / Math.PI;
505
505
  if (c > e) {
506
- const n = it(s, o), a = 1 / Math.ceil(c / e);
507
- let l = a;
508
- for (; l < 1; )
509
- i.push(n(l)), l += a;
506
+ const n = st(s, o), a = 1 / Math.ceil(c / e);
507
+ let h = a;
508
+ for (; h < 1; )
509
+ i.push(n(h)), h += a;
510
510
  }
511
511
  }
512
512
  i.push(s = o);
513
513
  }), i;
514
514
  });
515
515
  }
516
- function mt(r, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
517
- const o = Math.round(ae(360 / r, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, n = (h) => h / c * 360 % 360 - 180, a = (h) => Math.acos(2 * h / o - 1) / Math.PI * 180 - 90, l = (h) => o * (Math.cos((h + 90) * Math.PI / 180) + 1) / 2, f = [
518
- s !== void 0 ? Math.ceil(l(s)) : 0,
519
- i !== void 0 ? Math.floor(l(i)) : o - 1
520
- ], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (h) => h <= t : t === void 0 ? (h) => h >= e : t >= e ? (h) => h >= e && h <= t : (h) => h >= e || h <= t, d = [];
521
- for (let h = f[0]; h <= f[1]; h++) {
522
- const p = n(h);
523
- u(p) && d.push([p, a(h)]);
524
- }
525
- return d;
516
+ function vt(r, { minLng: e, maxLng: t, minLat: i, maxLat: s } = {}) {
517
+ const o = Math.round(ce(360 / r, 2) / Math.PI), c = (1 + Math.sqrt(5)) / 2, n = (l) => l / c * 360 % 360 - 180, a = (l) => Math.acos(2 * l / o - 1) / Math.PI * 180 - 90, h = (l) => o * (Math.cos((l + 90) * Math.PI / 180) + 1) / 2, d = [
518
+ s !== void 0 ? Math.ceil(h(s)) : 0,
519
+ i !== void 0 ? Math.floor(h(i)) : o - 1
520
+ ], u = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (l) => l <= t : t === void 0 ? (l) => l >= e : t >= e ? (l) => l >= e && l <= t : (l) => l >= e || l <= t, f = [];
521
+ for (let l = d[0]; l <= d[1]; l++) {
522
+ const p = n(l);
523
+ u(p) && f.push([p, a(l)]);
524
+ }
525
+ return f;
526
526
  }
527
- function ee(r, e, t = !1) {
528
- return t ? et(e, r) : He(r, e);
527
+ function te(r, e, t = !1) {
528
+ return t ? tt(e, r) : et(r, e);
529
529
  }
530
- function vt(r, e) {
531
- const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] = Le(t);
530
+ function bt(r, e) {
531
+ const t = { type: "Polygon", coordinates: r }, [[i, s], [o, c]] = Ve(t);
532
532
  if (Math.min(Math.abs(o - i), Math.abs(c - s)) < e)
533
533
  return [];
534
534
  const n = i > o || c >= 89 || s <= -89;
535
- return mt(e, {
535
+ return vt(e, {
536
536
  minLng: i,
537
537
  maxLng: o,
538
538
  minLat: s,
539
539
  maxLat: c
540
540
  }).filter(
541
- (a) => ee(a, t, n)
541
+ (a) => te(a, t, n)
542
542
  );
543
543
  }
544
- function bt(r, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
545
- const s = pt(r, e), o = te(s), c = vt(r, e), n = [...o, ...c], a = { type: "Polygon", coordinates: r }, [[l, f], [u, d]] = Le(a), h = l > u || // crosses antimeridian
546
- d >= 89 || // crosses north pole
547
- f <= -89;
544
+ function yt(r, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
545
+ const s = mt(r, e), o = ie(s), c = bt(r, e), n = [...o, ...c], a = { type: "Polygon", coordinates: r }, [[h, d], [u, f]] = Ve(a), l = h > u || // crosses antimeridian
546
+ f >= 89 || // crosses north pole
547
+ d <= -89;
548
548
  let p = [];
549
- if (h) {
550
- const y = st(n).triangles(), x = new Map(
551
- n.map(([A, I], z) => [`${A}-${I}`, z])
549
+ if (l) {
550
+ const y = nt(n).triangles(), w = new Map(
551
+ n.map(([I, T], E) => [`${I}-${T}`, E])
552
552
  );
553
- y.features.forEach((A) => {
554
- const I = A.geometry.coordinates[0].slice(0, 3).reverse(), z = [];
555
- if (I.forEach(([T, q]) => {
556
- const _ = `${T}-${q}`;
557
- x.has(_) && z.push(x.get(_));
558
- }), z.length === 3) {
559
- if (z.some((T) => T < o.length)) {
560
- const T = A.properties.circumcenter;
561
- if (!ee(
562
- T,
553
+ y.features.forEach((I) => {
554
+ const T = I.geometry.coordinates[0].slice(0, 3).reverse(), E = [];
555
+ if (T.forEach(([A, q]) => {
556
+ const W = `${A}-${q}`;
557
+ w.has(W) && E.push(w.get(W));
558
+ }), E.length === 3) {
559
+ if (E.some((A) => A < o.length)) {
560
+ const A = I.properties.circumcenter;
561
+ if (!te(
562
+ A,
563
563
  a,
564
- h
564
+ l
565
565
  ))
566
566
  return;
567
567
  }
568
- p.push(...z);
568
+ p.push(...E);
569
569
  }
570
570
  });
571
571
  } else if (c.length) {
572
- const y = Je.from(n);
573
- for (let x = 0, A = y.triangles.length; x < A; x += 3) {
574
- const I = [2, 1, 0].map((T) => y.triangles[x + T]), z = I.map((T) => n[T]);
575
- if (I.some((T) => T < o.length)) {
576
- const T = [0, 1].map(
577
- (q) => We(z, (_) => _[q])
572
+ const y = He.from(n);
573
+ for (let w = 0, I = y.triangles.length; w < I; w += 3) {
574
+ const T = [2, 1, 0].map((A) => y.triangles[w + A]), E = T.map((A) => n[A]);
575
+ if (T.some((A) => A < o.length)) {
576
+ const A = [0, 1].map(
577
+ (q) => Ue(E, (W) => W[q])
578
578
  );
579
- if (!ee(
580
- T,
579
+ if (!te(
580
+ A,
581
581
  a,
582
- h
582
+ l
583
583
  ))
584
584
  continue;
585
585
  }
586
- p.push(...I);
586
+ p.push(...T);
587
587
  }
588
588
  } else {
589
- const { vertices: y, holes: x = [] } = Te(s);
590
- p = Re(y, x, 2);
589
+ const { vertices: y, holes: w = [] } = Oe(s);
590
+ p = Ge(y, w, 2);
591
591
  }
592
- let m = t ? [t[0], t[2]] : ue(n, (y) => y[0]), v = t ? [t[1], t[3]] : ue(n, (y) => y[1]);
592
+ let m = t ? [t[0], t[2]] : he(n, (y) => y[0]), b = t ? [t[1], t[3]] : he(n, (y) => y[1]);
593
593
  if (i) {
594
- const [y, x] = i([m[0], v[0]]), [A, I] = i([m[1], v[1]]);
595
- m = [y, A], v = [-x, -I];
594
+ const [y, w] = i([m[0], b[0]]), [I, T] = i([m[1], b[1]]);
595
+ m = [y, I], b = [-w, -T];
596
596
  }
597
- const j = be(m, [0, 1]), C = be(v, [0, 1]), B = n.map(([y, x]) => {
597
+ const j = ge(m, [0, 1]), z = ge(b, [0, 1]), C = n.map(([y, w]) => {
598
598
  if (i) {
599
- const [A, I] = i([y, x]);
600
- return [j(A), C(-I)];
599
+ const [I, T] = i([y, w]);
600
+ return [j(I), z(-T)];
601
601
  } else
602
- return [j(y), C(x)];
602
+ return [j(y), z(w)];
603
603
  });
604
- return { contour: s, triangles: { points: n, indices: p, uvs: B } };
604
+ return { contour: s, triangles: { points: n, indices: p, uvs: C } };
605
605
  }
606
- const xe = new ie().setAttribute ? "setAttribute" : "addAttribute";
607
- function F(r, e, t, i) {
608
- const s = r.map(
609
- (o) => o.map(([c, n]) => {
610
- if (i) {
611
- const [a, l] = i([c, n]);
612
- return [a, -l, e];
606
+ const je = new se().setAttribute ? "setAttribute" : "addAttribute";
607
+ function F(r, e, t) {
608
+ const i = r.map(
609
+ (s) => s.map(([o, c]) => {
610
+ if (t === "cesium") {
611
+ const n = 1 / Q.a, a = e / n, h = Math.max(0, a - Q.a), d = ye(o, c, h, n, !1);
612
+ return [d.x, d.y, d.z];
613
613
  }
614
- return t ? Ze(c, n, e) : [c, n, e];
614
+ if (t === "sphere") {
615
+ const n = ye(
616
+ o,
617
+ c,
618
+ e - Q.a,
619
+ 1,
620
+ !0
621
+ );
622
+ return [n.x, n.y, n.z];
623
+ }
624
+ if (typeof t == "function") {
625
+ const [n, a] = t([o, c]);
626
+ return [n, -a, e];
627
+ }
628
+ return [o, c, e];
615
629
  })
616
630
  );
617
- return Te(s);
631
+ return Oe(i);
618
632
  }
619
- function yt(r, e, t, i, s) {
620
- const { vertices: o, holes: c } = F(
633
+ function gt(r, e, t, i) {
634
+ const { vertices: s, holes: o } = F(
621
635
  r,
622
636
  e,
623
- i,
624
- s
625
- ), { vertices: n } = F(
637
+ i
638
+ ), { vertices: c } = F(
626
639
  r,
627
640
  t,
628
- i,
629
- s
630
- ), a = te([n, o]), l = Math.round(n.length / 3), f = new Set(c);
631
- let u = 0;
632
- const d = [];
633
- for (let p = 0; p < l; p++) {
634
- let m = p + 1;
635
- if (m === l)
636
- m = u;
637
- else if (f.has(m)) {
638
- const v = m;
639
- m = u, u = v;
641
+ i
642
+ ), n = ie([c, s]), a = Math.round(c.length / 3), h = new Set(o);
643
+ let d = 0;
644
+ const u = [];
645
+ for (let l = 0; l < a; l++) {
646
+ let p = l + 1;
647
+ if (p === a)
648
+ p = d;
649
+ else if (h.has(p)) {
650
+ const m = p;
651
+ p = d, d = m;
640
652
  }
641
- d.push(p, p + l, m + l), d.push(m + l, m, p);
653
+ u.push(l, l + a, p + a), u.push(p + a, p, l);
642
654
  }
643
- const h = [];
644
- for (let p = 1; p >= 0; p--)
645
- for (let m = 0; m < l; m += 1) h.push(m / (l - 1), p);
646
- return { indices: d, vertices: a, uvs: h, topVerts: n };
655
+ const f = [];
656
+ for (let l = 1; l >= 0; l--)
657
+ for (let p = 0; p < a; p += 1) f.push(p / (a - 1), l);
658
+ return { indices: u, vertices: n, uvs: f, topVerts: c };
647
659
  }
648
- function Se(r, e, t, i, s, o) {
660
+ function Ce(r, e, t, i, s) {
649
661
  return {
650
662
  indices: i ? r.indices : r.indices.slice().reverse(),
651
663
  vertices: F(
652
664
  [r.points],
653
665
  e,
654
- s,
655
- o
666
+ s
656
667
  ).vertices,
657
668
  uvs: t
658
669
  };
659
670
  }
660
- const gt = ({
671
+ const Mt = ({
661
672
  polygonGeoJson: r,
662
673
  startHeight: e,
663
674
  endHeight: t,
664
675
  curvatureResolution: i = 1,
665
- cartesian: s = !0,
666
- hasSide: o = !0,
667
- hasBottom: c = !1,
668
- hasTop: n = !1,
669
- projection: a,
670
- bbox: l
676
+ hasSide: s = !0,
677
+ hasBottom: o = !1,
678
+ hasTop: c = !1,
679
+ projection: n = "sphere",
680
+ bbox: a
671
681
  }) => {
672
682
  r.forEach((j) => {
673
- Ye(j) || j.reverse();
683
+ Je(j) || j.reverse();
674
684
  });
675
- const { contour: f, triangles: u } = bt(r, {
685
+ const h = typeof n == "function" ? n : void 0, { contour: d, triangles: u } = yt(r, {
676
686
  resolution: i,
677
- bbox: l,
678
- projection: a
687
+ bbox: a,
688
+ projection: h
679
689
  });
680
- let d = {}, h;
681
- o && (d = yt(
682
- f,
690
+ let f = {}, l;
691
+ s && (f = gt(
692
+ d,
683
693
  e != null ? e : t,
684
694
  t != null ? t : e,
685
- s,
686
- a
687
- ), h = d.topVerts);
695
+ n
696
+ ), l = f.topVerts);
688
697
  let p = [];
689
- (c || n) && (p = te(u.uvs));
698
+ (o || c) && (p = ie(u.uvs));
690
699
  let m = {};
691
- c && (m = Se(
700
+ o && (m = Ce(
692
701
  u,
693
702
  e,
694
703
  p,
695
704
  !1,
696
- s,
697
- a
705
+ n
698
706
  ));
699
- let v = {};
700
- return n && (v = Se(
707
+ let b = {};
708
+ return c && (b = Ce(
701
709
  u,
702
710
  t,
703
711
  p,
704
712
  !0,
705
- s,
706
- a
707
- )), { contour: f, triangles: u, sideTorso: d, bottomCap: m, topCap: v, topVerts: h };
713
+ n
714
+ )), { contour: d, triangles: u, sideTorso: f, bottomCap: m, topCap: b, topVerts: l };
708
715
  };
709
- class Wt extends ie {
716
+ class Rt extends se {
710
717
  constructor(e, t = {}) {
711
718
  super(), this.type = "PolygonBufferGeometry", this.parameters = k({
712
719
  polygonGeoJson: e,
@@ -717,7 +724,7 @@ class Wt extends ie {
717
724
  hasBottom: !0,
718
725
  hasSide: !0,
719
726
  curvatureResolution: 1,
720
- cartesian: !0,
727
+ projection: "sphere",
721
728
  userDataRsoOffset: 0
722
729
  }, t);
723
730
  const {
@@ -726,26 +733,24 @@ class Wt extends ie {
726
733
  topFirst: o,
727
734
  hasBottom: c,
728
735
  hasSide: n,
729
- cartesian: a,
730
- userDataRsoOffset: l,
731
- projection: f
732
- } = this.parameters, { contour: u, sideTorso: d, topVerts: h, bottomCap: p, topCap: m } = gt(k({}, this.parameters));
733
- let v = [], j = [], C = [], B = 0;
734
- const P = (y) => {
735
- const x = Math.round(v.length / 3), A = C.length;
736
- v = v.concat(y.vertices), j = j.concat(y.uvs), C = C.concat(
737
- x ? y.indices.map((I) => I + x) : y.indices
738
- ), this.addGroup(A, C.length - A, B++);
736
+ userDataRsoOffset: a,
737
+ projection: h
738
+ } = this.parameters, { contour: d, sideTorso: u, topVerts: f, bottomCap: l, topCap: p } = Mt(k({}, this.parameters));
739
+ let m = [], b = [], j = [], z = 0;
740
+ const C = (P) => {
741
+ const y = Math.round(m.length / 3), w = j.length;
742
+ m = m.concat(P.vertices), b = b.concat(P.uvs), j = j.concat(
743
+ y ? P.indices.map((I) => I + y) : P.indices
744
+ ), this.addGroup(w, j.length - w, z++);
739
745
  };
740
- s && o && P(m), n && (P(d), this.userData.topVerts = l ? F(
741
- u,
742
- i + l,
743
- a,
744
- f
745
- ).vertices : h), c && P(p), s && !o && P(m), this.setIndex(C), this[xe]("position", new $(v, 3)), this[xe]("uv", new $(j, 2)), this.computeVertexNormals();
746
+ s && o && C(p), n && (C(u), this.userData.topVerts = a ? F(
747
+ d,
748
+ i + a,
749
+ h
750
+ ).vertices : f), c && C(l), s && !o && C(p), this.setIndex(j), this[je]("position", new $(m, 3)), this[je]("uv", new $(b, 2)), this.computeVertexNormals();
746
751
  }
747
752
  }
748
- const Mt = `
753
+ const xt = `
749
754
  #include <fog_pars_fragment>
750
755
  #include <logdepthbuf_pars_fragment>
751
756
 
@@ -882,9 +887,9 @@ void main() {
882
887
  #include <fog_vertex>
883
888
  }
884
889
  `;
885
- class Rt extends qe {
890
+ class Ut extends Ke {
886
891
  constructor(e = {}) {
887
- const C = e, {
892
+ const z = e, {
888
893
  lineWidth: t = 1,
889
894
  color: i = "#ffffff",
890
895
  opacity: s = 1,
@@ -892,15 +897,15 @@ class Rt extends qe {
892
897
  dashOffset: c = 0,
893
898
  dashArray: n = 0,
894
899
  dashRatio: a = 0,
895
- sizeAttenuation: l = !0,
896
- offsetLoop: f = !0,
900
+ sizeAttenuation: h = !0,
901
+ offsetLoop: d = !0,
897
902
  offset: u = new K(0, 0),
898
- scaleDown: d = 0,
899
- alphaMap: h = void 0,
903
+ scaleDown: f = 0,
904
+ alphaMap: l = void 0,
900
905
  alphaTest: p = 0,
901
906
  repeat: m = new K(1, 1),
902
- resolution: v = new K(1, 1)
903
- } = C, j = ce(C, [
907
+ resolution: b = new K(1, 1)
908
+ } = z, j = le(z, [
904
909
  "lineWidth",
905
910
  "color",
906
911
  "opacity",
@@ -920,26 +925,26 @@ class Rt extends qe {
920
925
  super(X(k({}, j), {
921
926
  uniforms: {
922
927
  lineWidth: { value: t },
923
- color: { value: new pe(i) },
928
+ color: { value: new me(i) },
924
929
  opacity: { value: s },
925
930
  map: { value: o },
926
931
  useMap: { value: o ? 1 : 0 },
927
- resolution: { value: v },
928
- sizeAttenuation: { value: l ? 1 : 0 },
932
+ resolution: { value: b },
933
+ sizeAttenuation: { value: h ? 1 : 0 },
929
934
  offset: { value: u },
930
- offsetLoop: { value: f ? 1 : 0 },
935
+ offsetLoop: { value: d ? 1 : 0 },
931
936
  dashArray: { value: n },
932
937
  dashOffset: { value: c },
933
938
  dashRatio: { value: a },
934
939
  useDash: { value: n > 0 ? 1 : 0 },
935
- scaleDown: { value: d / 10 },
940
+ scaleDown: { value: f / 10 },
936
941
  alphaTest: { value: p },
937
- alphaMap: { value: h },
938
- useAlphaMap: { value: h ? 1 : 0 },
942
+ alphaMap: { value: l },
943
+ useAlphaMap: { value: l ? 1 : 0 },
939
944
  repeat: { value: m }
940
945
  },
941
946
  vertexShader: wt,
942
- fragmentShader: Mt
947
+ fragmentShader: xt
943
948
  })), this.type = "MeshLineMaterial";
944
949
  }
945
950
  // Getter and setter for color
@@ -947,7 +952,7 @@ class Rt extends qe {
947
952
  return this.uniforms.color.value;
948
953
  }
949
954
  set color(e) {
950
- this.uniforms.color.value = new pe(e);
955
+ this.uniforms.color.value = new me(e);
951
956
  }
952
957
  get opacity() {
953
958
  var e;
@@ -990,20 +995,20 @@ class Rt extends qe {
990
995
  this.uniforms.sizeAttenuation.value = e ? 1 : 0;
991
996
  }
992
997
  }
993
- const Y = new V(), je = new S(), Ce = new S(), g = new V(), M = new V(), O = new V(), Z = new S(), J = new Be(), w = new Xe(), Pe = new S(), R = new ze(), U = new Oe(), D = new V();
994
- let E, L;
995
- function Ae(r, e, t) {
996
- return D.set(0, 0, -e, 1).applyMatrix4(r.projectionMatrix), D.multiplyScalar(1 / D.w), D.x = L / t.width, D.y = L / t.height, D.applyMatrix4(r.projectionMatrixInverse), D.multiplyScalar(1 / D.w), Math.abs(Math.max(D.x, D.y));
998
+ const Z = new V(), Pe = new S(), Ae = new S(), g = new V(), M = new V(), B = new V(), J = new S(), H = new De(), x = new Qe(), Ie = new S(), R = new ke(), U = new ze(), O = new V();
999
+ let D, L;
1000
+ function Te(r, e, t) {
1001
+ return O.set(0, 0, -e, 1).applyMatrix4(r.projectionMatrix), O.multiplyScalar(1 / O.w), O.x = L / t.width, O.y = L / t.height, O.applyMatrix4(r.projectionMatrixInverse), O.multiplyScalar(1 / O.w), Math.abs(Math.max(O.x, O.y));
997
1002
  }
998
- function xt(r, e) {
1003
+ function St(r, e) {
999
1004
  const t = r.matrixWorld, i = r.geometry, s = i.attributes.instanceStart, o = i.attributes.instanceEnd, c = Math.min(i.instanceCount, s.count);
1000
1005
  for (let n = 0, a = c; n < a; n++) {
1001
- w.start.fromBufferAttribute(s, n), w.end.fromBufferAttribute(o, n), w.applyMatrix4(t);
1002
- const l = new S(), f = new S();
1003
- E.distanceSqToSegment(w.start, w.end, f, l), f.distanceTo(l) < L * 0.5 && e.push({
1004
- point: f,
1005
- pointOnLine: l,
1006
- distance: E.origin.distanceTo(f),
1006
+ x.start.fromBufferAttribute(s, n), x.end.fromBufferAttribute(o, n), x.applyMatrix4(t);
1007
+ const h = new S(), d = new S();
1008
+ D.distanceSqToSegment(x.start, x.end, d, h), d.distanceTo(h) < L * 0.5 && e.push({
1009
+ point: d,
1010
+ pointOnLine: h,
1011
+ distance: D.origin.distanceTo(d),
1007
1012
  object: r,
1008
1013
  face: null,
1009
1014
  faceIndex: n,
@@ -1012,59 +1017,59 @@ function xt(r, e) {
1012
1017
  });
1013
1018
  }
1014
1019
  }
1015
- function St(r, e, t) {
1016
- const i = e.projectionMatrix, o = r.material.resolution, c = r.matrixWorld, n = r.geometry, a = n.attributes.instanceStart, l = n.attributes.instanceEnd, f = Math.min(n.instanceCount, a.count), u = -e.near;
1017
- E.at(1, O), O.w = 1, O.applyMatrix4(e.matrixWorldInverse), O.applyMatrix4(i), O.multiplyScalar(1 / O.w), O.x *= o.x / 2, O.y *= o.y / 2, O.z = 0, Z.copy(O), J.multiplyMatrices(e.matrixWorldInverse, c);
1018
- for (let d = 0, h = f; d < h; d++) {
1019
- if (g.fromBufferAttribute(a, d), M.fromBufferAttribute(l, d), g.w = 1, M.w = 1, g.applyMatrix4(J), M.applyMatrix4(J), g.z > u && M.z > u)
1020
+ function jt(r, e, t) {
1021
+ const i = e.projectionMatrix, o = r.material.resolution, c = r.matrixWorld, n = r.geometry, a = n.attributes.instanceStart, h = n.attributes.instanceEnd, d = Math.min(n.instanceCount, a.count), u = -e.near;
1022
+ D.at(1, B), B.w = 1, B.applyMatrix4(e.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= o.x / 2, B.y *= o.y / 2, B.z = 0, J.copy(B), H.multiplyMatrices(e.matrixWorldInverse, c);
1023
+ for (let f = 0, l = d; f < l; f++) {
1024
+ if (g.fromBufferAttribute(a, f), M.fromBufferAttribute(h, f), g.w = 1, M.w = 1, g.applyMatrix4(H), M.applyMatrix4(H), g.z > u && M.z > u)
1020
1025
  continue;
1021
1026
  if (g.z > u) {
1022
- const B = g.z - M.z, P = (g.z - u) / B;
1027
+ const C = g.z - M.z, P = (g.z - u) / C;
1023
1028
  g.lerp(M, P);
1024
1029
  } else if (M.z > u) {
1025
- const B = M.z - g.z, P = (M.z - u) / B;
1030
+ const C = M.z - g.z, P = (M.z - u) / C;
1026
1031
  M.lerp(g, P);
1027
1032
  }
1028
- g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, w.start.copy(g), w.start.z = 0, w.end.copy(M), w.end.z = 0;
1029
- const m = w.closestPointToPointParameter(Z, !0);
1030
- w.at(m, Pe);
1031
- const v = Qe.lerp(g.z, M.z, m), j = v >= -1 && v <= 1, C = Z.distanceTo(Pe) < L * 0.5;
1032
- if (j && C) {
1033
- w.start.fromBufferAttribute(a, d), w.end.fromBufferAttribute(l, d), w.start.applyMatrix4(c), w.end.applyMatrix4(c);
1034
- const B = new S(), P = new S();
1035
- E.distanceSqToSegment(w.start, w.end, P, B), t.push({
1033
+ g.applyMatrix4(i), M.applyMatrix4(i), g.multiplyScalar(1 / g.w), M.multiplyScalar(1 / M.w), g.x *= o.x / 2, g.y *= o.y / 2, M.x *= o.x / 2, M.y *= o.y / 2, x.start.copy(g), x.start.z = 0, x.end.copy(M), x.end.z = 0;
1034
+ const m = x.closestPointToPointParameter(J, !0);
1035
+ x.at(m, Ie);
1036
+ const b = Ze.lerp(g.z, M.z, m), j = b >= -1 && b <= 1, z = J.distanceTo(Ie) < L * 0.5;
1037
+ if (j && z) {
1038
+ x.start.fromBufferAttribute(a, f), x.end.fromBufferAttribute(h, f), x.start.applyMatrix4(c), x.end.applyMatrix4(c);
1039
+ const C = new S(), P = new S();
1040
+ D.distanceSqToSegment(x.start, x.end, P, C), t.push({
1036
1041
  point: P,
1037
- pointOnLine: B,
1038
- distance: E.origin.distanceTo(P),
1042
+ pointOnLine: C,
1043
+ distance: D.origin.distanceTo(P),
1039
1044
  object: r,
1040
1045
  face: null,
1041
- faceIndex: d,
1046
+ faceIndex: f,
1042
1047
  uv: null,
1043
1048
  uv1: null
1044
1049
  });
1045
1050
  }
1046
1051
  }
1047
1052
  }
1048
- class Ut extends Ee {
1049
- constructor(e = new nt(), t) {
1053
+ class Gt extends Le {
1054
+ constructor(e = new rt(), t) {
1050
1055
  super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
1051
1056
  }
1052
1057
  // for backwards-compatibility, but could be a method of LineSegmentsGeometry...
1053
1058
  computeLineDistances() {
1054
1059
  const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, s = new Float32Array(2 * t.count);
1055
1060
  for (let c = 0, n = 0, a = t.count; c < a; c++, n += 2)
1056
- je.fromBufferAttribute(t, c), Ce.fromBufferAttribute(i, c), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + je.distanceTo(Ce);
1057
- const o = new Ke(
1061
+ Pe.fromBufferAttribute(t, c), Ae.fromBufferAttribute(i, c), s[n] = n === 0 ? 0 : s[n - 1], s[n + 1] = s[n] + Pe.distanceTo(Ae);
1062
+ const o = new Ye(
1058
1063
  s,
1059
1064
  2,
1060
1065
  1
1061
1066
  );
1062
1067
  return e.setAttribute(
1063
1068
  "instanceDistanceStart",
1064
- new me(o, 1, 0)
1069
+ new ve(o, 1, 0)
1065
1070
  ), e.setAttribute(
1066
1071
  "instanceDistanceEnd",
1067
- new me(o, 1, 1)
1072
+ new ve(o, 1, 1)
1068
1073
  ), this;
1069
1074
  }
1070
1075
  raycast(e, t) {
@@ -1073,48 +1078,48 @@ class Ut extends Ee {
1073
1078
  'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
1074
1079
  );
1075
1080
  const o = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
1076
- E = e.ray;
1081
+ D = e.ray;
1077
1082
  const c = this.matrixWorld, n = this.geometry, a = this.material;
1078
1083
  L = a.linewidth + o, n.boundingSphere === null && n.computeBoundingSphere(), U.copy(n.boundingSphere).applyMatrix4(c);
1079
- let l;
1084
+ let h;
1080
1085
  if (i)
1081
- l = L * 0.5;
1086
+ h = L * 0.5;
1082
1087
  else {
1083
1088
  const u = Math.max(
1084
1089
  s.near,
1085
- U.distanceToPoint(E.origin)
1090
+ U.distanceToPoint(D.origin)
1086
1091
  );
1087
- l = Ae(
1092
+ h = Te(
1088
1093
  s,
1089
1094
  u,
1090
1095
  a.resolution
1091
1096
  );
1092
1097
  }
1093
- if (U.radius += l, E.intersectsSphere(U) === !1)
1098
+ if (U.radius += h, D.intersectsSphere(U) === !1)
1094
1099
  return;
1095
1100
  n.boundingBox === null && n.computeBoundingBox(), R.copy(n.boundingBox).applyMatrix4(c);
1096
- let f;
1101
+ let d;
1097
1102
  if (i)
1098
- f = L * 0.5;
1103
+ d = L * 0.5;
1099
1104
  else {
1100
1105
  const u = Math.max(
1101
1106
  s.near,
1102
- R.distanceToPoint(E.origin)
1107
+ R.distanceToPoint(D.origin)
1103
1108
  );
1104
- f = Ae(
1109
+ d = Te(
1105
1110
  s,
1106
1111
  u,
1107
1112
  a.resolution
1108
1113
  );
1109
1114
  }
1110
- R.expandByScalar(f), E.intersectsBox(R) !== !1 && (i ? xt(this, t) : St(this, s, t));
1115
+ R.expandByScalar(d), D.intersectsBox(R) !== !1 && (i ? St(this, t) : jt(this, s, t));
1111
1116
  }
1112
1117
  onBeforeRender(e) {
1113
1118
  const t = this.material.uniforms;
1114
- t && t.resolution && (e.getViewport(Y), this.material.uniforms.resolution.value.set(Y.z, Y.w));
1119
+ t && t.resolution && (e.getViewport(Z), this.material.uniforms.resolution.value.set(Z.z, Z.w));
1115
1120
  }
1116
1121
  }
1117
- const b = class b extends H {
1122
+ const v = class v extends ee {
1118
1123
  constructor(e) {
1119
1124
  super(), this.objectType = "Node", this.onNodePointerIndex = [], this.options = k({
1120
1125
  type: "2d"
@@ -1142,12 +1147,12 @@ const b = class b extends H {
1142
1147
  }
1143
1148
  ensureVisible() {
1144
1149
  const e = this.options.children;
1145
- e && (e.style.transform && (e.style.transform = ""), !b.observerMap.has(e) && (b.sharedObserver || (b.sharedObserver = new IntersectionObserver((t) => {
1150
+ e && (e.style.transform && (e.style.transform = ""), !v.observerMap.has(e) && (v.sharedObserver || (v.sharedObserver = new IntersectionObserver((t) => {
1146
1151
  t.forEach((i) => {
1147
- const s = i.target, o = b.observerMap.get(s);
1148
- o && i.isIntersecting && (o.moveElementToViewport(), b.observerMap.delete(s), b.sharedObserver && (b.sharedObserver.unobserve(s), b.observerMap.size === 0 && (b.sharedObserver.disconnect(), b.sharedObserver = void 0)));
1152
+ const s = i.target, o = v.observerMap.get(s);
1153
+ o && i.isIntersecting && (o.moveElementToViewport(), v.observerMap.delete(s), v.sharedObserver && (v.sharedObserver.unobserve(s), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)));
1149
1154
  });
1150
- })), b.observerMap.set(e, this), b.sharedObserver.observe(e)));
1155
+ })), v.observerMap.set(e, this), v.sharedObserver.observe(e)));
1151
1156
  }
1152
1157
  onPointerEvent(e, t) {
1153
1158
  const i = this.lead.handlePickNode([this], e, t);
@@ -1155,21 +1160,21 @@ const b = class b extends H {
1155
1160
  }
1156
1161
  dispose() {
1157
1162
  const e = this.options.children;
1158
- e && b.sharedObserver && (b.observerMap.delete(e), b.sharedObserver.unobserve(e), b.observerMap.size === 0 && (b.sharedObserver.disconnect(), b.sharedObserver = void 0)), this.onNodePointerIndex.forEach((t) => {
1163
+ e && v.sharedObserver && (v.observerMap.delete(e), v.sharedObserver.unobserve(e), v.observerMap.size === 0 && (v.sharedObserver.disconnect(), v.sharedObserver = void 0)), this.onNodePointerIndex.forEach((t) => {
1159
1164
  this.lead.removePickNode(t);
1160
1165
  }), super.dispose();
1161
1166
  }
1162
1167
  };
1163
- b.observerMap = /* @__PURE__ */ new Map();
1164
- let Ie = b;
1168
+ v.observerMap = /* @__PURE__ */ new Map();
1169
+ let Be = v;
1165
1170
  export {
1166
- ge as B,
1171
+ xe as B,
1167
1172
  Nt as I,
1168
- Ut as L,
1169
- Rt as M,
1170
- Ie as N,
1171
- Wt as P,
1172
- ct as R,
1173
- H as a,
1174
- gt as g
1173
+ Gt as L,
1174
+ Ut as M,
1175
+ Be as N,
1176
+ Rt as P,
1177
+ lt as R,
1178
+ ee as a,
1179
+ Mt as g
1175
1180
  };