@maqiuyao/dxf-viewer 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,8 +2,8 @@ var sl = Object.defineProperty;
2
2
  var nl = (c, t, e) => t in c ? sl(c, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : c[t] = e;
3
3
  var g = (c, t, e) => nl(c, typeof t != "symbol" ? t + "" : t, e);
4
4
  import * as p from "three";
5
- import { Box3 as De, Matrix4 as at, BufferAttribute as wr, Vector3 as G, Line3 as Ot, Plane as po, Vector2 as jt, Triangle as Oi, BackSide as rl, DoubleSide as al, REVISION as mo, Ray as ol, FrontSide as Ar, Mesh as mn, LineSegments as go, LineLoop as yo, Line as xo, Points as bo, Sphere as ll, BatchedMesh as cl, Layers as hl, Object3D as dl } from "three";
6
- import { Mesh as J0 } from "three";
5
+ import { Box3 as De, Matrix4 as at, BufferAttribute as wr, Vector3 as G, Line3 as Ot, Plane as po, Vector2 as Ut, Triangle as Oi, BackSide as rl, DoubleSide as al, REVISION as mo, Ray as ol, FrontSide as Ar, Mesh as mn, LineSegments as go, LineLoop as yo, Line as xo, Points as bo, Sphere as ll, BatchedMesh as cl, Layers as hl, Object3D as dl } from "three";
6
+ import { Mesh as ef } from "three";
7
7
  import * as Ir from "loglevel";
8
8
  import { CSS2DObject as ul, CSS2DRenderer as fl } from "three/examples/jsm/renderers/CSS2DRenderer.js";
9
9
  import { DRACOExporter as pl } from "three/examples/jsm/exporters/DRACOExporter.js";
@@ -36,9 +36,9 @@ import { GLTFLoader as Rl } from "three/examples/jsm/loaders/GLTFLoader.js";
36
36
  import { MTLLoader as Fl } from "three/examples/jsm/loaders/MTLLoader.js";
37
37
  import { OBJLoader as zl } from "three/examples/jsm/loaders/OBJLoader.js";
38
38
  import { PLYLoader as Vl } from "three/examples/jsm/loaders/PLYLoader.js";
39
- import { STLLoader as Ul } from "three/examples/jsm/loaders/STLLoader.js";
39
+ import { STLLoader as jl } from "three/examples/jsm/loaders/STLLoader.js";
40
40
  import Gi from "polygon-clipping";
41
- import { EffectComposer as jl } from "three/examples/jsm/postprocessing/EffectComposer.js";
41
+ import { EffectComposer as Ul } from "three/examples/jsm/postprocessing/EffectComposer.js";
42
42
  import { RenderPass as Nl } from "three/examples/jsm/postprocessing/RenderPass.js";
43
43
  import { ShaderPass as Hl } from "three/examples/jsm/postprocessing/ShaderPass.js";
44
44
  import { SAOPass as Gl } from "three/examples/jsm/postprocessing/SAOPass.js";
@@ -104,7 +104,7 @@ function ws(c, t, e, i, s, n, r) {
104
104
  object: c
105
105
  }), !0);
106
106
  }
107
- const y0 = p.Line, wo = 0, ec = 1, tc = 2, Dr = 2, Sn = 1.25, Lr = 1, Oe = 32, xe = Oe / 4, vo = 65535, en = Math.pow(2, -24), Mr = /* @__PURE__ */ Symbol("SKIP_GENERATION"), Mo = {
107
+ const b0 = p.Line, wo = 0, ec = 1, tc = 2, Dr = 2, Sn = 1.25, Lr = 1, Oe = 32, xe = Oe / 4, vo = 65535, en = Math.pow(2, -24), Mr = /* @__PURE__ */ Symbol("SKIP_GENERATION"), Mo = {
108
108
  strategy: wo,
109
109
  maxDepth: 40,
110
110
  targetLeafSize: 10,
@@ -400,21 +400,21 @@ class hc {
400
400
  }
401
401
  }
402
402
  const ne = /* @__PURE__ */ new hc();
403
- let Ut, ki;
403
+ let jt, ki;
404
404
  const di = [], Ts = /* @__PURE__ */ new Cr(() => new De());
405
405
  function dc(c, t, e, i, s, n) {
406
- Ut = Ts.getPrimitive(), ki = Ts.getPrimitive(), di.push(Ut, ki), ne.setBuffer(c._roots[t]);
406
+ jt = Ts.getPrimitive(), ki = Ts.getPrimitive(), di.push(jt, ki), ne.setBuffer(c._roots[t]);
407
407
  const r = ur(0, c.geometry, e, i, s, n);
408
- ne.clearBuffer(), Ts.releasePrimitive(Ut), Ts.releasePrimitive(ki), di.pop(), di.pop();
408
+ ne.clearBuffer(), Ts.releasePrimitive(jt), Ts.releasePrimitive(ki), di.pop(), di.pop();
409
409
  const a = di.length;
410
- return a > 0 && (ki = di[a - 1], Ut = di[a - 2]), r;
410
+ return a > 0 && (ki = di[a - 1], jt = di[a - 2]), r;
411
411
  }
412
412
  function ur(c, t, e, i, s = null, n = 0, r = 0) {
413
413
  const { float32Array: a, uint16Array: o, uint32Array: l } = ne;
414
414
  let h = c * 2;
415
415
  if (he(h, o)) {
416
416
  const u = Te(c, l), f = _e(h, o);
417
- return le(c, a, Ut), i(u, f, !1, r, n + c / xe, Ut);
417
+ return le(c, a, jt), i(u, f, !1, r, n + c / xe, jt);
418
418
  } else {
419
419
  let _ = function(I) {
420
420
  const { uint16Array: B, uint32Array: k } = ne;
@@ -431,12 +431,12 @@ function ur(c, t, e, i, s = null, n = 0, r = 0) {
431
431
  };
432
432
  const u = be(c), f = we(c, l);
433
433
  let m = u, b = f, y, C, w, x;
434
- if (s && (w = Ut, x = ki, le(m, a, w), le(b, a, x), y = s(w), C = s(x), C < y)) {
434
+ if (s && (w = jt, x = ki, le(m, a, w), le(b, a, x), y = s(w), C = s(x), C < y)) {
435
435
  m = f, b = u;
436
436
  const I = y;
437
437
  y = C, C = I, w = x;
438
438
  }
439
- w || (w = Ut, le(m, a, w));
439
+ w || (w = jt, le(m, a, w));
440
440
  const E = he(m * 2, o), M = e(w, E, y, r + 1, n + m / xe);
441
441
  let O;
442
442
  if (M === Dr) {
@@ -1061,7 +1061,7 @@ const vc = /* @__PURE__ */ (function() {
1061
1061
  y !== 0 ? C = (d * u - m * f) / y : C = 0, w = (d + C * u) / f, r.x = C, r.y = w;
1062
1062
  };
1063
1063
  })(), Er = /* @__PURE__ */ (function() {
1064
- const c = /* @__PURE__ */ new jt(), t = /* @__PURE__ */ new G(), e = /* @__PURE__ */ new G();
1064
+ const c = /* @__PURE__ */ new Ut(), t = /* @__PURE__ */ new G(), e = /* @__PURE__ */ new G();
1065
1065
  return function(s, n, r, a) {
1066
1066
  vc(s, n, c);
1067
1067
  let o = c.x, l = c.y;
@@ -1101,7 +1101,7 @@ const vc = /* @__PURE__ */ (function() {
1101
1101
  }
1102
1102
  return !1;
1103
1103
  };
1104
- })(), Tc = ["x", "y", "z"], Mt = 1e-15, Ur = Mt * Mt;
1104
+ })(), Tc = ["x", "y", "z"], Mt = 1e-15, jr = Mt * Mt;
1105
1105
  function Ye(c) {
1106
1106
  return Math.abs(c) < Mt;
1107
1107
  }
@@ -1143,7 +1143,7 @@ ot.prototype.closestPointToSegment = /* @__PURE__ */ (function() {
1143
1143
  };
1144
1144
  })();
1145
1145
  ot.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
1146
- const c = /* @__PURE__ */ new ot(), t = /* @__PURE__ */ new _t(), e = /* @__PURE__ */ new _t(), i = /* @__PURE__ */ new G(), s = /* @__PURE__ */ new G(), n = /* @__PURE__ */ new G(), r = /* @__PURE__ */ new G(), a = /* @__PURE__ */ new Ot(), o = /* @__PURE__ */ new Ot(), l = /* @__PURE__ */ new G(), h = /* @__PURE__ */ new jt(), d = /* @__PURE__ */ new jt();
1146
+ const c = /* @__PURE__ */ new ot(), t = /* @__PURE__ */ new _t(), e = /* @__PURE__ */ new _t(), i = /* @__PURE__ */ new G(), s = /* @__PURE__ */ new G(), n = /* @__PURE__ */ new G(), r = /* @__PURE__ */ new G(), a = /* @__PURE__ */ new Ot(), o = /* @__PURE__ */ new Ot(), l = /* @__PURE__ */ new G(), h = /* @__PURE__ */ new Ut(), d = /* @__PURE__ */ new Ut();
1147
1147
  function u(x, E, M, O) {
1148
1148
  const S = i;
1149
1149
  !x.isDegenerateIntoPoint && !x.isDegenerateIntoSegment ? S.copy(x.plane.normal) : S.copy(E.plane.normal);
@@ -1188,7 +1188,7 @@ ot.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
1188
1188
  }
1189
1189
  function C(x, E, M) {
1190
1190
  const O = x.degenerateSegment, S = E.a;
1191
- return O.closestPointToPoint(S, !0, i), S.distanceToSquared(i) < Ur ? (M && (M.start.copy(S), M.end.copy(S)), !0) : !1;
1191
+ return O.closestPointToPoint(S, !0, i), S.distanceToSquared(i) < jr ? (M && (M.start.copy(S), M.end.copy(S)), !0) : !1;
1192
1192
  }
1193
1193
  function w(x, E, M, O) {
1194
1194
  if (x.isDegenerateIntoSegment)
@@ -1206,7 +1206,7 @@ ot.prototype.intersectsTriangle = /* @__PURE__ */ (function() {
1206
1206
  } else return E.isDegenerateIntoPoint ? C(x, E, M) : b(E, x, M, O);
1207
1207
  else {
1208
1208
  if (x.isDegenerateIntoPoint)
1209
- return E.isDegenerateIntoPoint ? E.a.distanceToSquared(x.a) < Ur ? (M && (M.start.copy(x.a), M.end.copy(x.a)), !0) : !1 : E.isDegenerateIntoSegment ? C(E, x, M) : y(E, x, M);
1209
+ return E.isDegenerateIntoPoint ? E.a.distanceToSquared(x.a) < jr ? (M && (M.start.copy(x.a), M.end.copy(x.a)), !0) : !1 : E.isDegenerateIntoSegment ? C(E, x, M) : y(E, x, M);
1210
1210
  if (E.isDegenerateIntoPoint)
1211
1211
  return y(x, E, M);
1212
1212
  if (E.isDegenerateIntoSegment)
@@ -1434,7 +1434,7 @@ function Sc(c, t, e = {}, i = 0, s = 1 / 0) {
1434
1434
  const l = Math.sqrt(a);
1435
1435
  return e.point ? e.point.copy(Bn) : e.point = Bn.clone(), e.distance = l, e.faceIndex = o, e;
1436
1436
  }
1437
- const Cs = parseInt(mo) >= 169, Ec = parseInt(mo) <= 161, Xt = /* @__PURE__ */ new G(), Zt = /* @__PURE__ */ new G(), Kt = /* @__PURE__ */ new G(), Ss = /* @__PURE__ */ new jt(), Es = /* @__PURE__ */ new jt(), Os = /* @__PURE__ */ new jt(), jr = /* @__PURE__ */ new G(), Nr = /* @__PURE__ */ new G(), Hr = /* @__PURE__ */ new G(), Yi = /* @__PURE__ */ new G();
1437
+ const Cs = parseInt(mo) >= 169, Ec = parseInt(mo) <= 161, Xt = /* @__PURE__ */ new G(), Zt = /* @__PURE__ */ new G(), Kt = /* @__PURE__ */ new G(), Ss = /* @__PURE__ */ new Ut(), Es = /* @__PURE__ */ new Ut(), Os = /* @__PURE__ */ new Ut(), Ur = /* @__PURE__ */ new G(), Nr = /* @__PURE__ */ new G(), Hr = /* @__PURE__ */ new G(), Yi = /* @__PURE__ */ new G();
1438
1438
  function Oc(c, t, e, i, s, n, r, a) {
1439
1439
  let o;
1440
1440
  if (n === rl ? o = c.intersectTriangle(i, e, t, !0, s) : o = c.intersectTriangle(t, e, i, n !== al, s), o === null) return null;
@@ -1449,18 +1449,18 @@ function Gr(c, t, e, i, s, n, r, a, o, l, h) {
1449
1449
  const d = Oc(c, Xt, Zt, Kt, Yi, o, l, h);
1450
1450
  if (d) {
1451
1451
  if (i) {
1452
- Ss.fromBufferAttribute(i, n), Es.fromBufferAttribute(i, r), Os.fromBufferAttribute(i, a), d.uv = new jt();
1452
+ Ss.fromBufferAttribute(i, n), Es.fromBufferAttribute(i, r), Os.fromBufferAttribute(i, a), d.uv = new Ut();
1453
1453
  const f = Oi.getInterpolation(Yi, Xt, Zt, Kt, Ss, Es, Os, d.uv);
1454
1454
  Cs || (d.uv = f);
1455
1455
  }
1456
1456
  if (s) {
1457
- Ss.fromBufferAttribute(s, n), Es.fromBufferAttribute(s, r), Os.fromBufferAttribute(s, a), d.uv1 = new jt();
1457
+ Ss.fromBufferAttribute(s, n), Es.fromBufferAttribute(s, r), Os.fromBufferAttribute(s, a), d.uv1 = new Ut();
1458
1458
  const f = Oi.getInterpolation(Yi, Xt, Zt, Kt, Ss, Es, Os, d.uv1);
1459
1459
  Cs || (d.uv1 = f), Ec && (d.uv2 = d.uv1);
1460
1460
  }
1461
1461
  if (e) {
1462
- jr.fromBufferAttribute(e, n), Nr.fromBufferAttribute(e, r), Hr.fromBufferAttribute(e, a), d.normal = new G();
1463
- const f = Oi.getInterpolation(Yi, Xt, Zt, Kt, jr, Nr, Hr, d.normal);
1462
+ Ur.fromBufferAttribute(e, n), Nr.fromBufferAttribute(e, r), Hr.fromBufferAttribute(e, a), d.normal = new G();
1463
+ const f = Oi.getInterpolation(Yi, Xt, Zt, Kt, Ur, Nr, Hr, d.normal);
1464
1464
  d.normal.dot(c.direction) > 0 && d.normal.multiplyScalar(-1), Cs || (d.normal = f);
1465
1465
  }
1466
1466
  const u = {
@@ -1691,12 +1691,12 @@ function mr(c, t, e, i, s = null) {
1691
1691
  return le(h, n, _s), !!(s.intersectsBox(_s) && mr(h, t, e, i, s) || (le(d, n, _s), s.intersectsBox(_s) && mr(d, t, e, i, s)));
1692
1692
  }
1693
1693
  }
1694
- const As = /* @__PURE__ */ new at(), kn = /* @__PURE__ */ new Re(), Zi = /* @__PURE__ */ new Re(), Vc = /* @__PURE__ */ new G(), Uc = /* @__PURE__ */ new G(), jc = /* @__PURE__ */ new G(), Nc = /* @__PURE__ */ new G();
1694
+ const As = /* @__PURE__ */ new at(), kn = /* @__PURE__ */ new Re(), Zi = /* @__PURE__ */ new Re(), Vc = /* @__PURE__ */ new G(), jc = /* @__PURE__ */ new G(), Uc = /* @__PURE__ */ new G(), Nc = /* @__PURE__ */ new G();
1695
1695
  function Hc(c, t, e, i = {}, s = {}, n = 0, r = 1 / 0) {
1696
1696
  t.boundingBox || t.computeBoundingBox(), kn.set(t.boundingBox.min, t.boundingBox.max, e), kn.needsUpdate = !0;
1697
1697
  const a = c.geometry, o = a.attributes.position, l = a.index, h = t.attributes.position, d = t.index, u = $e.getPrimitive(), f = $e.getPrimitive();
1698
- let m = Vc, b = Uc, y = null, C = null;
1699
- s && (y = jc, C = Nc);
1698
+ let m = Vc, b = jc, y = null, C = null;
1699
+ s && (y = Uc, C = Nc);
1700
1700
  let w = 1 / 0, x = null, E = null;
1701
1701
  return As.copy(e).invert(), Zi.matrix.copy(As), c.shapecast(
1702
1702
  {
@@ -2442,7 +2442,7 @@ function Jr(c, t, e, i, s, n) {
2442
2442
  });
2443
2443
  }
2444
2444
  }
2445
- const x0 = p.Points, ih = `
2445
+ const w0 = p.Points, ih = `
2446
2446
  // When an object is transparent, we'll change its alpha value,
2447
2447
  // but we should not assign a fixed value because it may already
2448
2448
  // has an alpha value that is lower than 1.
@@ -2991,8 +2991,8 @@ Fe.state_transparent_fragment = dh;
2991
2991
  Fe.state_highlight_fragment = uh;
2992
2992
  Fe.pick_ex_vertex = mh;
2993
2993
  Fe.pick_ex_fragment = gh;
2994
- const b0 = p.ShaderChunk;
2995
- class w0 {
2994
+ const v0 = p.ShaderChunk;
2995
+ class M0 {
2996
2996
  constructor(t) {
2997
2997
  g(this, "promise");
2998
2998
  g(this, "cancelReject");
@@ -3325,7 +3325,7 @@ const Ri = class Ri {
3325
3325
  };
3326
3326
  g(Ri, "twinklingObjectIds", {});
3327
3327
  let j = Ri;
3328
- const v0 = (c, t, e) => {
3328
+ const T0 = (c, t, e) => {
3329
3329
  const {
3330
3330
  default: i,
3331
3331
  active: s
@@ -3480,7 +3480,7 @@ class Pe {
3480
3480
  return r.x /= i.clientWidth, r.y /= i.clientHeight, r;
3481
3481
  }
3482
3482
  }
3483
- class M0 {
3483
+ class C0 {
3484
3484
  /**
3485
3485
  * Creates CSS2DObject with HTMLElement
3486
3486
  */
@@ -3519,7 +3519,7 @@ class M0 {
3519
3519
  }
3520
3520
  const bh = {
3521
3521
  "Precision from file": 99
3522
- }, T0 = (c, t) => c.toFixed(t === bh["Precision from file"] ? 2 : t), wh = "en", xt = !1, vh = 10, qe = 11, li = 12, So = 583902, C0 = [0.031, 0.906, 0.867, 0.5], Rn = [0.3, 0.3, 0.3, 0.8], Eo = 0.5, Fn = 0.1, zn = 5e3, Mh = 45, S0 = "x-viewer-iconfont", E0 = "x-viewer-iconfont2", Oo = 10, Qr = new p.Vector3(), ea = new p.Vector3(), ta = new p.Vector3(), cs = new p.Vector3(), Ct = new p.Vector3(), ia = new p.Triangle();
3522
+ }, S0 = (c, t) => c.toFixed(t === bh["Precision from file"] ? 2 : t), wh = "en", xt = !1, vh = 10, qe = 11, li = 12, So = 583902, E0 = [0.031, 0.906, 0.867, 0.5], Rn = [0.3, 0.3, 0.3, 0.8], Eo = 0.5, Fn = 0.1, zn = 5e3, Mh = 45, O0 = "x-viewer-iconfont", _0 = "x-viewer-iconfont2", Oo = 10, Qr = new p.Vector3(), ea = new p.Vector3(), ta = new p.Vector3(), cs = new p.Vector3(), Ct = new p.Vector3(), ia = new p.Triangle();
3523
3523
  function Th(c, t, e, i, s) {
3524
3524
  const n = [], r = {};
3525
3525
  let a, o, l, h;
@@ -3900,7 +3900,7 @@ const Z = class Z {
3900
3900
  };
3901
3901
  g(Z, "EXTENSION_GLTF", ".gltf"), g(Z, "EXTENSION_GLB", ".glb"), g(Z, "EXTENSION_OBJ", ".obj"), g(Z, "EXTENSION_DRACO", ".drc"), g(Z, "EXTENSION_JSON", ".json"), g(Z, "EXTENSION_STL", ".stl"), g(Z, "downloadLink");
3902
3902
  let sa = Z;
3903
- class O0 {
3903
+ class P0 {
3904
3904
  constructor() {
3905
3905
  g(this, "prevTime");
3906
3906
  g(this, "beginTime");
@@ -3920,7 +3920,7 @@ class O0 {
3920
3920
  this.beginTime = this.end();
3921
3921
  }
3922
3922
  }
3923
- const Un = 1e-15, na = new p.Matrix4().set(0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), ra = new p.Matrix4().set(0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
3923
+ const jn = 1e-15, na = new p.Matrix4().set(0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), ra = new p.Matrix4().set(0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
3924
3924
  class F {
3925
3925
  static roundNumber(t, e) {
3926
3926
  return Math.round(t * Math.pow(10, e)) / Math.pow(10, e);
@@ -3948,7 +3948,7 @@ class F {
3948
3948
  }
3949
3949
  static getArcAngleSpanInRadian(t, e) {
3950
3950
  const i = Math.PI * 2;
3951
- return F.areNumbersClose(t, e, Un) ? 0 : (t %= i, F.areNumbersClose(t, e % i, Un) ? i : (F.areNumbersClose(e, i, Un) && (e %= i), e < t && (e += i), e - t));
3951
+ return F.areNumbersClose(t, e, jn) ? 0 : (t %= i, F.areNumbersClose(t, e % i, jn) ? i : (F.areNumbersClose(e, i, jn) && (e %= i), e < t && (e += i), e - t));
3952
3952
  }
3953
3953
  static getIntegerPartLength(t) {
3954
3954
  return t = Math.abs(t), t < 1 ? 0 : Math.ceil(Math.log10(Math.abs(t) + 1));
@@ -4040,7 +4040,18 @@ class F {
4040
4040
  }
4041
4041
  }
4042
4042
  }
4043
- const jn = 1e7, aa = new p.Box2(), oa = new p.Box2(), la = new p.Vector3(), ca = new p.Vector3(), ha = new p.Vector3(), It = new p.Triangle();
4043
+ const Un = 1e7, aa = new p.Box2(), oa = new p.Box2(), la = new p.Vector3(), ca = new p.Vector3(), ha = new p.Vector3(), It = new p.Triangle(), Oh = /not find (pre|next) vertex|has repeat vertex|translateLine line eror|not find Intersection/;
4044
+ function _h(c) {
4045
+ const t = console.error;
4046
+ console.error = (...e) => {
4047
+ typeof e[0] == "string" && Oh.test(e[0]) || t.apply(console, e);
4048
+ };
4049
+ try {
4050
+ return c();
4051
+ } finally {
4052
+ console.error = t;
4053
+ }
4054
+ }
4044
4055
  class N {
4045
4056
  /**
4046
4057
  * Compares two materials
@@ -4187,7 +4198,7 @@ class N {
4187
4198
  * Checks if we should rebase a point in case its value is too large
4188
4199
  */
4189
4200
  static shouldRebasePositionOnRTC(t) {
4190
- return Math.abs(t.x) > jn || Math.abs(t.y) > jn || t instanceof p.Vector3 && Math.abs(t.z) > jn;
4201
+ return Math.abs(t.x) > Un || Math.abs(t.y) > Un || t instanceof p.Vector3 && Math.abs(t.z) > Un;
4191
4202
  }
4192
4203
  /**
4193
4204
  * Calculates surface area
@@ -4309,10 +4320,12 @@ class N {
4309
4320
  i.push([s.x, s.y]);
4310
4321
  });
4311
4322
  try {
4312
- const { indices: s, position: n } = xl([i], {
4313
- lineWidth: e,
4314
- depth: 1
4315
- }), r = new p.BufferGeometry();
4323
+ const { indices: s, position: n } = _h(
4324
+ () => xl([i], {
4325
+ lineWidth: e,
4326
+ depth: 1
4327
+ })
4328
+ ), r = new p.BufferGeometry();
4316
4329
  return r.setAttribute("position", new p.Float32BufferAttribute(n, 3)), r.setIndex(Array.from(s)), r;
4317
4330
  } catch {
4318
4331
  return;
@@ -4344,7 +4357,7 @@ class N {
4344
4357
  return i;
4345
4358
  }
4346
4359
  }
4347
- const _0 = {
4360
+ const A0 = {
4348
4361
  ProgressBar: {
4349
4362
  Loading: "Loading",
4350
4363
  Comparing: "Comparing"
@@ -4362,9 +4375,9 @@ const _0 = {
4362
4375
  boxSelect: "框选一个区域以确定截图范围",
4363
4376
  pickMarkup: "点击一个批注以确定截图范围"
4364
4377
  }
4365
- }, lt = bl.createInstance(), Oh = "cn";
4378
+ }, lt = bl.createInstance(), Ph = "cn";
4366
4379
  lt.init({
4367
- lng: Oh,
4380
+ lng: Ph,
4368
4381
  debug: !1,
4369
4382
  resources: {
4370
4383
  en: {
@@ -4477,7 +4490,7 @@ class Me {
4477
4490
  });
4478
4491
  }
4479
4492
  }
4480
- const _h = new p.Vector3(0, 1, 0), Ze = class Ze {
4493
+ const Ah = new p.Vector3(0, 1, 0), Ze = class Ze {
4481
4494
  /**
4482
4495
  * Clears any styles, including transparency, wireframe mode, filter by floor, etc.
4483
4496
  * @param object
@@ -5032,7 +5045,7 @@ const _h = new p.Vector3(0, 1, 0), Ze = class Ze {
5032
5045
  * To save memory, object3d shares some variables
5033
5046
  */
5034
5047
  static setSharedVariablesOfObject(t) {
5035
- t.uuid = "", t.up = _h;
5048
+ t.uuid = "", t.up = Ah;
5036
5049
  const e = t;
5037
5050
  e.material && (Array.isArray(e.material) ? e.material.forEach((i) => {
5038
5051
  i.uuid && (i.uuid = "");
@@ -5100,7 +5113,7 @@ g(Ze, "OUTLINE_MATERIAL", new p.LineBasicMaterial({
5100
5113
  side: p.FrontSide
5101
5114
  }));
5102
5115
  let Q = Ze;
5103
- const Vs = new p.Matrix4(), Ph = new p.Matrix4(), us = class us {
5116
+ const Vs = new p.Matrix4(), Ih = new p.Matrix4(), us = class us {
5104
5117
  static resetMergeInfo() {
5105
5118
  this.MergeInfo.removedObjects = 0, this.MergeInfo.mergedMeshes = 0, this.MergeInfo.mergedLines = 0, this.MergeInfo.mergedPoints = 0, this.MergeInfo.mergedUnknownTypeObjects = 0, this.MergeInfo.elapsedTime = 0;
5106
5119
  }
@@ -5298,7 +5311,7 @@ const Vs = new p.Matrix4(), Ph = new p.Matrix4(), us = class us {
5298
5311
  let s = e;
5299
5312
  for (Vs.identity(); s && s !== i && (Vs.premultiply(s.matrix), !!s.parent); )
5300
5313
  s = s.parent;
5301
- return Vs.equals(Ph) ? t : t.applyMatrix4(Vs);
5314
+ return Vs.equals(Ih) ? t : t.applyMatrix4(Vs);
5302
5315
  }
5303
5316
  /**
5304
5317
  * Merges geometries for lines
@@ -5515,8 +5528,8 @@ g(us, "MergeInfo", {
5515
5528
  elapsedTime: 0
5516
5529
  });
5517
5530
  let ye = us;
5518
- const Ah = 0.01;
5519
- class P0 {
5531
+ const Bh = 0.01;
5532
+ class I0 {
5520
5533
  static getFaces(t) {
5521
5534
  const e = t.map((n) => n.toArray()).reduce((n, r) => (n.push(...r), n), []), i = [];
5522
5535
  return wl.triangulate(e, [], 3).forEach((n) => i.push(n)), i;
@@ -5525,7 +5538,7 @@ class P0 {
5525
5538
  if (t.length < 4) return !0;
5526
5539
  const e = t[1].clone().sub(t[0]), s = t[2].clone().sub(t[0]).cross(e).normalize();
5527
5540
  for (let n = 3; n < t.length; n++)
5528
- if (t[n].clone().sub(t[0]).projectOnVector(s).length() > Ah) return !1;
5541
+ if (t[n].clone().sub(t[0]).projectOnVector(s).length() > Bh) return !1;
5529
5542
  return !0;
5530
5543
  }
5531
5544
  static isSelfIntersecting(t) {
@@ -5648,7 +5661,7 @@ class ai {
5648
5661
  return s;
5649
5662
  }
5650
5663
  }
5651
- class A0 {
5664
+ class B0 {
5652
5665
  /**
5653
5666
  * Gets simplified object.
5654
5667
  */
@@ -5666,9 +5679,9 @@ class A0 {
5666
5679
  return i < 20 ? 0 : s;
5667
5680
  }
5668
5681
  }
5669
- const I0 = 10;
5682
+ const k0 = 10;
5670
5683
  var Lt = /* @__PURE__ */ ((c) => (c.TripleCross = "TripleCross", c.Square = "Square", c.Triangle = "Triangle", c.CircleWithCross = "CircleWithCross", c.Cross = "Cross", c.Perpendicular = "Perpendicular", c))(Lt || {});
5671
- class B0 {
5684
+ class D0 {
5672
5685
  static createSVGObject(t) {
5673
5686
  return new Tl(t);
5674
5687
  }
@@ -13895,7 +13908,7 @@ g(cn, "HDR_CITY_STREET_64x32", Uint16Array.from([
13895
13908
  10637,
13896
13909
  15360
13897
13910
  ]));
13898
- function Ih() {
13911
+ function kh() {
13899
13912
  if (Le.isBrowser) {
13900
13913
  const c = document.createElement("div");
13901
13914
  return c.setAttribute("style", "height: 1in; visibility: hidden; position: absolute; margin: 0; padding: 0;"), document.body.appendChild(c), 0.0254 / c.clientHeight;
@@ -13909,8 +13922,8 @@ const ua = {
13909
13922
  cm: 0.01,
13910
13923
  ft: 0.3048,
13911
13924
  in: 0.0254,
13912
- pt: Ih()
13913
- }, Bh = {
13925
+ pt: kh()
13926
+ }, Dh = {
13914
13927
  file: "m",
13915
13928
  m: "m",
13916
13929
  mm: "mm",
@@ -13918,15 +13931,15 @@ const ua = {
13918
13931
  ft: "ft",
13919
13932
  in: "in",
13920
13933
  pt: "pt"
13921
- }, _o = (c) => c === 2 ? "²" : c === 3 ? "³" : "", fa = (c, t = 1) => Bh[c] + _o(t), k0 = (c, t, e, i = 1) => (e == null && (e = t), e === t ? {
13934
+ }, _o = (c) => c === 2 ? "²" : c === 3 ? "³" : "", fa = (c, t = 1) => Dh[c] + _o(t), L0 = (c, t, e, i = 1) => (e == null && (e = t), e === t ? {
13922
13935
  value: c,
13923
13936
  unit: fa(e)
13924
13937
  } : {
13925
13938
  value: c * Math.pow(ua[t] / ua[e], i),
13926
13939
  unit: fa(e) + _o(i)
13927
13940
  });
13928
- var kh = /* @__PURE__ */ ((c) => (c.Top = "Top", c.Bottom = "Bottom", c.Front = "Front", c.Back = "Back", c.Left = "Left", c.Right = "Right", c))(kh || {});
13929
- class D0 {
13941
+ var Lh = /* @__PURE__ */ ((c) => (c.Top = "Top", c.Bottom = "Bottom", c.Front = "Front", c.Back = "Back", c.Left = "Left", c.Right = "Right", c))(Lh || {});
13942
+ class R0 {
13930
13943
  /**
13931
13944
  * Gets camera's new position and target(lookAt) by given bbox and view
13932
13945
  */
@@ -14297,7 +14310,7 @@ class Et extends ci {
14297
14310
  }
14298
14311
  }
14299
14312
  xn._registerDrawableClass(Et);
14300
- const Dh = [
14313
+ const Rh = [
14301
14314
  0,
14302
14315
  16711680,
14303
14316
  16776960,
@@ -14554,9 +14567,9 @@ const Dh = [
14554
14567
  11382189,
14555
14568
  14079702,
14556
14569
  16777215
14557
- ], Lh = ["PROXY", "REGION", "INSERT", "HATCH"];
14570
+ ], Fh = ["PROXY", "REGION", "INSERT", "HATCH"];
14558
14571
  function zi(c) {
14559
- return Dh[c];
14572
+ return Rh[c];
14560
14573
  }
14561
14574
  function Xe(c) {
14562
14575
  const t = {};
@@ -14565,7 +14578,7 @@ function Xe(c) {
14565
14578
  throw new Error("Expected code for point value to be " + i + " but got " + e.code);
14566
14579
  return t.y = e.value, i += 10, e = c.next(), e.code !== i || (t.z = e.value, c.next()), t;
14567
14580
  }
14568
- const Rh = "OriginalHandle", Fh = "OriginalType", zh = "Outlines";
14581
+ const zh = "OriginalHandle", Vh = "OriginalType", jh = "Outlines";
14569
14582
  function ee(c, t) {
14570
14583
  switch (t.code) {
14571
14584
  // 0: 实体类型(通常在 parseEntity 开头已处理,此处可保留)
@@ -14626,11 +14639,11 @@ function ee(c, t) {
14626
14639
  // 1000-1071: 扩展数据(XData)
14627
14640
  case 1e3:
14628
14641
  if (t.value && typeof t.value == "string") {
14629
- if (t.value.includes(Rh)) {
14642
+ if (t.value.includes(zh)) {
14630
14643
  const e = t.value.split(":").map((i) => i.trim());
14631
14644
  c.extendedData || (c.extendedData = {}), c.extendedData.originalHandle = e[1];
14632
14645
  }
14633
- if (t.value.includes(zh) && (c.extendedData || (c.extendedData = {}), c.extendedData.outlines = []), t.value.includes(Fh)) {
14646
+ if (t.value.includes(jh) && (c.extendedData || (c.extendedData = {}), c.extendedData.outlines = []), t.value.includes(Vh)) {
14634
14647
  const e = t.value.split(":").map((i) => i.trim());
14635
14648
  c.extendedData || (c.extendedData = {}), c.extendedData.originalType = e[1];
14636
14649
  }
@@ -14650,7 +14663,7 @@ function ee(c, t) {
14650
14663
  }
14651
14664
  return !0;
14652
14665
  }
14653
- function ji(c, t) {
14666
+ function Ui(c, t) {
14654
14667
  switch (t.code) {
14655
14668
  case 0:
14656
14669
  c.type = t.value;
@@ -14673,7 +14686,7 @@ function ji(c, t) {
14673
14686
  const Po = "BYLAYER", hn = "BYBLOCK";
14674
14687
  var Be = /* @__PURE__ */ ((c) => (c[c.Mesh = -1] = "Mesh", c[c.MeshWithPattern = 0] = "MeshWithPattern", c[c.LineWithWidth = 1] = "LineWithWidth", c[c.Line = 2] = "Line", c[c.LineWithPattern = 3] = "LineWithPattern", c[c.Point = 4] = "Point", c[c.Text = 5] = "Text", c))(Be || {});
14675
14688
  const sn = ["INSERT", "DIMENSION"];
14676
- function Vh(c, t, e, i, s) {
14689
+ function Uh(c, t, e, i, s) {
14677
14690
  if (!t) return 0;
14678
14691
  const n = /[\u4e00-\u9fff\u3400-\u4dbf\uf900-\ufaff]/.test(c), r = s && s.toLowerCase().endsWith(".shx");
14679
14692
  let a = 0, o = 0;
@@ -14693,7 +14706,7 @@ function Vh(c, t, e, i, s) {
14693
14706
  }
14694
14707
  return a + o;
14695
14708
  }
14696
- function Uh(c) {
14709
+ function Nh(c) {
14697
14710
  const t = /(\\M\+(?:[0-5])[0-9A-Fa-f]{4,})/g, e = c.match(t);
14698
14711
  if (!e)
14699
14712
  return c;
@@ -14724,7 +14737,7 @@ function ma(c) {
14724
14737
  e = e.replace(n, ""), t.push(n);
14725
14738
  }), { formatCodes: t, plainText: e };
14726
14739
  }
14727
- function jh(c, t) {
14740
+ function Hh(c, t) {
14728
14741
  const e = ma(c.text).plainText, i = ma(t.text).plainText;
14729
14742
  return e === i;
14730
14743
  }
@@ -14890,7 +14903,7 @@ const vt = class vt {
14890
14903
  }
14891
14904
  }
14892
14905
  bIgnoreChildEntitiesOriginalType(t) {
14893
- return Lh.includes(t.extendedData?.originalType);
14906
+ return Fh.includes(t.extendedData?.originalType);
14894
14907
  }
14895
14908
  entitiesEqual(t, e, i, s, n) {
14896
14909
  if (!this.baseEntitiesEqual(t, e, i, s, n))
@@ -15078,7 +15091,7 @@ const vt = class vt {
15078
15091
  if (s) {
15079
15092
  if (t.text !== e.text)
15080
15093
  return !1;
15081
- } else if (!jh(t, e))
15094
+ } else if (!Hh(t, e))
15082
15095
  return !1;
15083
15096
  return !!this.numberEqual(t.rotation, e.rotation);
15084
15097
  }
@@ -15447,7 +15460,7 @@ class z {
15447
15460
  });
15448
15461
  }
15449
15462
  }
15450
- const Us = new p.Matrix4(), Nh = new p.Matrix4();
15463
+ const js = new p.Matrix4(), Gh = new p.Matrix4();
15451
15464
  class kt {
15452
15465
  static resetMergeInfo() {
15453
15466
  this.MergeInfo.removedObjects = 0, this.MergeInfo.mergedMeshes = 0, this.MergeInfo.mergedLines = 0, this.MergeInfo.mergedPoints = 0, this.MergeInfo.mergedUnknownTypeObjects = 0, this.MergeInfo.elapsedTime = 0;
@@ -15657,9 +15670,9 @@ class kt {
15657
15670
  */
15658
15671
  static applyMatrix(t, e, i) {
15659
15672
  let s = e;
15660
- for (Us.identity(); s && s !== i && (Us.premultiply(s.matrix), !!s.parent); )
15673
+ for (js.identity(); s && s !== i && (js.premultiply(s.matrix), !!s.parent); )
15661
15674
  s = s.parent;
15662
- return Us.equals(Nh) ? t : t.applyMatrix4(Us);
15675
+ return js.equals(Gh) ? t : t.applyMatrix4(js);
15663
15676
  }
15664
15677
  /**
15665
15678
  * Merges geometries for lines
@@ -15697,13 +15710,13 @@ g(kt, "MergeInfo", {
15697
15710
  mergedUnknownTypeObjects: 0,
15698
15711
  elapsedTime: 0
15699
15712
  });
15700
- const Hh = (c, t) => {
15713
+ const Wh = (c, t) => {
15701
15714
  if (typeof t > "u" || +t == 0) return Math.round(c);
15702
15715
  let e = +c;
15703
15716
  if (t = +t, isNaN(e) || !(typeof t == "number" && t % 1 === 0)) return NaN;
15704
15717
  let i = e.toString().split("e");
15705
15718
  return e = Math.round(+(i[0] + "e" + (i[1] ? +i[1] - t : -t))), i = e.toString().split("e"), +(i[0] + "e" + (i[1] ? +i[1] + t : t));
15706
- }, Gh = (c, t, e, i, s) => {
15719
+ }, qh = (c, t, e, i, s) => {
15707
15720
  const n = e.length, r = e[0].length;
15708
15721
  if (c < 0 || c > 1) throw new Error("t out of bounds [0,1]: " + c);
15709
15722
  if (t < 1) throw new Error("degree must be at least 1 (linear)");
@@ -15737,15 +15750,15 @@ const Hh = (c, t) => {
15737
15750
  }
15738
15751
  const f = [];
15739
15752
  for (let m = 0; m < r; m++)
15740
- f[m] = Hh(d[h][m] / d[h][r], -9);
15753
+ f[m] = Wh(d[h][m] / d[h][r], -9);
15741
15754
  return f;
15742
- }, Wh = {
15755
+ }, Yh = {
15743
15756
  d: "°",
15744
15757
  c: "⌀",
15745
15758
  p: "±"
15746
15759
  }, nn = (c, t) => {
15747
15760
  if (!c) return [];
15748
- c = c.replace(/%%(.)/g, (o, l) => Wh[l] || l).replace(/\^I/g, " ");
15761
+ c = c.replace(/%%(.)/g, (o, l) => Yh[l] || l).replace(/\^I/g, " ");
15749
15762
  const e = t?.encoding;
15750
15763
  let i = e instanceof TextDecoder ? e : void 0, s = "", n;
15751
15764
  const r = [], a = (o) => {
@@ -15875,29 +15888,29 @@ const Hh = (c, t) => {
15875
15888
  }
15876
15889
  }
15877
15890
  return s && r.push(s), r;
15878
- }, qh = {
15891
+ }, Xh = {
15879
15892
  d: "°",
15880
15893
  c: "⌀",
15881
15894
  p: "±"
15882
- }, Yh = (c, t) => (c = Xh(c), t ? Zh(c, t) : c), Xh = (c) => c.replace(/\\[uU]\+([0-9a-fA-F]{4})/g, (t, e) => String.fromCodePoint(parseInt(e, 16))), Zh = (c, t) => {
15895
+ }, Zh = (c, t) => (c = Kh(c), t ? $h(c, t) : c), Kh = (c) => c.replace(/\\[uU]\+([0-9a-fA-F]{4})/g, (t, e) => String.fromCodePoint(parseInt(e, 16))), $h = (c, t) => {
15883
15896
  let e = t instanceof TextDecoder ? t : new TextDecoder(t);
15884
15897
  return c.replace(/\\[mM]\+[0|1]([0-9a-fA-F]{2})([0-9a-fA-F]{2})/g, (i, s, n) => (e = e || new TextDecoder(t)).decode(new Uint8Array([parseInt(s, 16), parseInt(n, 16)])));
15885
15898
  }, Wn = (c, t) => {
15886
- c = Yh(c, t?.encoding);
15899
+ c = Zh(c, t?.encoding);
15887
15900
  let e = 0, i = {
15888
15901
  text: ""
15889
15902
  };
15890
15903
  const s = [i], n = c.matchAll(/%%(\d\d\d|.)/g);
15891
15904
  for (const r of n) {
15892
15905
  i.text += c.slice(e, r.index);
15893
- const a = r[1], o = a.toLowerCase(), l = qh[o];
15906
+ const a = r[1], o = a.toLowerCase(), l = Xh[o];
15894
15907
  l ? i.text += l : o.length === 3 ? i.text += String.fromCodePoint(+o) : o === "k" || o === "o" || o === "u" ? (i = Object.assign(Object.assign({}, i), {
15895
15908
  text: ""
15896
15909
  }), i[o] ? delete i[o] : i[o] = 1, s.push(i)) : i.text += o, e = r.index + r[0].length;
15897
15910
  }
15898
15911
  return i.text += c.slice(e), s.filter((r) => r.text);
15899
15912
  };
15900
- class Kh {
15913
+ class Jh {
15901
15914
  /**
15902
15915
  * Creates line shader by given pattern.
15903
15916
  * Note: remember to call line.computeLineDistances() in order to make it work!
@@ -15983,7 +15996,7 @@ class Kh {
15983
15996
  });
15984
15997
  }
15985
15998
  }
15986
- function $h(c, t, e, i, s = 0) {
15999
+ function Qh(c, t, e, i, s = 0) {
15987
16000
  const n = {
15988
16001
  u_cameraZoom: e,
15989
16002
  u_patternLines: {
@@ -16204,7 +16217,7 @@ function $h(c, t, e, i, s = 0) {
16204
16217
  });
16205
16218
  }
16206
16219
  var st = /* @__PURE__ */ ((c) => (c.Unitless = "Unitless", c.Inches = "Inches", c.Feet = "Feet", c.Millimeters = "Millimeters", c.Centimeters = "Centimeters", c.Meters = "Meters", c))(st || {});
16207
- const ga = (c) => c === "Unitless" ? 1 : c === "Inches" ? 0.0254 : c === "Feet" ? 0.3048 : c === "Millimeters" ? 1e-3 : c === "Centimeters" ? 0.01 : (c === "Meters" || console.warn("[Units] Unsupported unit '" + c + "', will return 1 for unit scale."), 1), L0 = (c, t) => ga(c) / ga(t);
16220
+ const ga = (c) => c === "Unitless" ? 1 : c === "Inches" ? 0.0254 : c === "Feet" ? 0.3048 : c === "Millimeters" ? 1e-3 : c === "Centimeters" ? 0.01 : (c === "Meters" || console.warn("[Units] Unsupported unit '" + c + "', will return 1 for unit scale."), 1), F0 = (c, t) => ga(c) / ga(t);
16208
16221
  class Ao {
16209
16222
  constructor() {
16210
16223
  g(this, "pointer");
@@ -16301,7 +16314,7 @@ class wn {
16301
16314
  }
16302
16315
  }
16303
16316
  const ya = 1e3;
16304
- class Jh extends Ao {
16317
+ class ed extends Ao {
16305
16318
  constructor(e) {
16306
16319
  super();
16307
16320
  g(this, "reader");
@@ -16411,7 +16424,7 @@ class ba extends Ao {
16411
16424
  const e = {
16412
16425
  code: parseInt(this.data[this.pointer])
16413
16426
  };
16414
- return this.pointer++, e.value = Qh(e.code, this.data[this.pointer].trim(), this.data[this.pointer]), this.pointer++, e.code === 0 && e.value === "EOF" && (this.eof = !0), this.lastReadGroup = e, e;
16427
+ return this.pointer++, e.value = td(e.code, this.data[this.pointer].trim(), this.data[this.pointer]), this.pointer++, e.code === 0 && e.value === "EOF" && (this.eof = !0), this.lastReadGroup = e, e;
16415
16428
  }
16416
16429
  /**
16417
16430
  * Returns true if there is another code/value pair (2 elements in the array).
@@ -16428,24 +16441,24 @@ class ba extends Ao {
16428
16441
  return this.eof;
16429
16442
  }
16430
16443
  }
16431
- function Qh(c, t, e) {
16432
- return c >= 0 && c <= 9 ? e : c >= 10 && c <= 59 ? parseFloat(t) : c >= 60 && c <= 99 ? parseInt(t) : c >= 100 && c <= 109 ? t : c >= 110 && c <= 149 ? parseFloat(t) : c >= 160 && c <= 179 ? parseInt(t) : c >= 210 && c <= 239 ? parseFloat(t) : c >= 270 && c <= 289 ? parseInt(t) : c >= 290 && c <= 299 ? ed(t) : c >= 300 && c <= 369 ? t : c >= 370 && c <= 389 ? parseInt(t) : c >= 390 && c <= 399 ? t : c >= 400 && c <= 409 ? parseInt(t) : c >= 410 && c <= 419 ? t : c >= 420 && c <= 429 ? parseInt(t) : c >= 430 && c <= 439 ? t : c >= 440 && c <= 449 ? parseInt(t) : c >= 450 && c <= 459 ? parseFloat(t) : c >= 460 && c <= 469 || c === 999 || c >= 1e3 && c <= 1009 ? t : c >= 1010 && c <= 1059 ? parseFloat(t) : c >= 1060 && c <= 1071 ? parseInt(t) : (console.info("WARNING: Group code does not have a defined type: %j", {
16444
+ function td(c, t, e) {
16445
+ return c >= 0 && c <= 9 ? e : c >= 10 && c <= 59 ? parseFloat(t) : c >= 60 && c <= 99 ? parseInt(t) : c >= 100 && c <= 109 ? t : c >= 110 && c <= 149 ? parseFloat(t) : c >= 160 && c <= 179 ? parseInt(t) : c >= 210 && c <= 239 ? parseFloat(t) : c >= 270 && c <= 289 ? parseInt(t) : c >= 290 && c <= 299 ? id(t) : c >= 300 && c <= 369 ? t : c >= 370 && c <= 389 ? parseInt(t) : c >= 390 && c <= 399 ? t : c >= 400 && c <= 409 ? parseInt(t) : c >= 410 && c <= 419 ? t : c >= 420 && c <= 429 ? parseInt(t) : c >= 430 && c <= 439 ? t : c >= 440 && c <= 449 ? parseInt(t) : c >= 450 && c <= 459 ? parseFloat(t) : c >= 460 && c <= 469 || c === 999 || c >= 1e3 && c <= 1009 ? t : c >= 1010 && c <= 1059 ? parseFloat(t) : c >= 1060 && c <= 1071 ? parseInt(t) : (console.info("WARNING: Group code does not have a defined type: %j", {
16433
16446
  code: c,
16434
16447
  value: t
16435
16448
  }), t);
16436
16449
  }
16437
- function ed(c) {
16450
+ function id(c) {
16438
16451
  if (c === "0") return !1;
16439
16452
  if (c === "1") return !0;
16440
16453
  throw TypeError("String '" + c + "' cannot be cast to Boolean type");
16441
16454
  }
16442
- function td(c) {
16455
+ function sd(c) {
16443
16456
  if (c == null) return !0;
16444
16457
  for (const t in c)
16445
16458
  if (Object.prototype.hasOwnProperty.call(c, t)) return !1;
16446
16459
  return !0;
16447
16460
  }
16448
- function id(c, t) {
16461
+ function nd(c, t) {
16449
16462
  const e = [];
16450
16463
  let i = !1, s = !1;
16451
16464
  const n = 4;
@@ -16480,11 +16493,11 @@ function id(c, t) {
16480
16493
  }
16481
16494
  t = c.next();
16482
16495
  }
16483
- td(a) || e.push(a), i = !1, s = !1;
16496
+ sd(a) || e.push(a), i = !1, s = !1;
16484
16497
  }
16485
16498
  return e;
16486
16499
  }
16487
- class sd {
16500
+ class rd {
16488
16501
  constructor() {
16489
16502
  g(this, "ForEntityName", "3DFACE");
16490
16503
  }
@@ -16503,7 +16516,7 @@ class sd {
16503
16516
  e = t.next();
16504
16517
  break;
16505
16518
  case 10:
16506
- i.vertices = id(t, e), e = t.lastReadGroup;
16519
+ i.vertices = nd(t, e), e = t.lastReadGroup;
16507
16520
  break;
16508
16521
  case 101:
16509
16522
  for (; e.code != 0; )
@@ -16516,7 +16529,7 @@ class sd {
16516
16529
  return i;
16517
16530
  }
16518
16531
  }
16519
- class nd {
16532
+ class ad {
16520
16533
  constructor() {
16521
16534
  g(this, "ForEntityName", "ARC");
16522
16535
  }
@@ -16527,7 +16540,7 @@ class nd {
16527
16540
  for (e = t.next(); !t.isEOF() && e.code !== 0; )
16528
16541
  switch (e.code) {
16529
16542
  case 10:
16530
- i.center = rd(t), e = t.lastReadGroup;
16543
+ i.center = od(t), e = t.lastReadGroup;
16531
16544
  break;
16532
16545
  case 40:
16533
16546
  i.radius = e.value, e = t.next();
@@ -16558,7 +16571,7 @@ class nd {
16558
16571
  return i;
16559
16572
  }
16560
16573
  }
16561
- function rd(c) {
16574
+ function od(c) {
16562
16575
  const t = {};
16563
16576
  let e = c.lastReadGroup || c.next();
16564
16577
  const i = e.code;
@@ -16572,7 +16585,7 @@ function rd(c) {
16572
16585
  }
16573
16586
  return t;
16574
16587
  }
16575
- class ad {
16588
+ class ld {
16576
16589
  constructor() {
16577
16590
  g(this, "ForEntityName", "ATTDEF");
16578
16591
  }
@@ -16669,7 +16682,7 @@ function wa(c) {
16669
16682
  }
16670
16683
  return t;
16671
16684
  }
16672
- class od {
16685
+ class cd {
16673
16686
  constructor() {
16674
16687
  g(this, "ForEntityName", "ATTRIB");
16675
16688
  }
@@ -16766,7 +16779,7 @@ function va(c) {
16766
16779
  }
16767
16780
  return t;
16768
16781
  }
16769
- class ld {
16782
+ class hd {
16770
16783
  constructor() {
16771
16784
  g(this, "ForEntityName", "CIRCLE");
16772
16785
  }
@@ -16777,7 +16790,7 @@ class ld {
16777
16790
  for (e = t.next(); !t.isEOF() && e.code !== 0; )
16778
16791
  switch (e.code) {
16779
16792
  case 10:
16780
- i.center = cd(t), e = t.lastReadGroup;
16793
+ i.center = dd(t), e = t.lastReadGroup;
16781
16794
  break;
16782
16795
  case 40:
16783
16796
  i.radius = e.value, e = t.next();
@@ -16800,7 +16813,7 @@ class ld {
16800
16813
  return i;
16801
16814
  }
16802
16815
  }
16803
- function cd(c) {
16816
+ function dd(c) {
16804
16817
  const t = {};
16805
16818
  let e = c.lastReadGroup || c.next();
16806
16819
  const i = e.code;
@@ -16814,7 +16827,7 @@ function cd(c) {
16814
16827
  }
16815
16828
  return t;
16816
16829
  }
16817
- class hd {
16830
+ class ud {
16818
16831
  constructor() {
16819
16832
  g(this, "ForEntityName", "DIMENSION");
16820
16833
  }
@@ -16891,7 +16904,7 @@ function $t(c) {
16891
16904
  }
16892
16905
  return t;
16893
16906
  }
16894
- class dd {
16907
+ class fd {
16895
16908
  constructor() {
16896
16909
  g(this, "ForEntityName", "MULTILEADER");
16897
16910
  }
@@ -17059,7 +17072,7 @@ class dd {
17059
17072
  i.contextData.blockContentColor = e.value, e = t.next();
17060
17073
  break;
17061
17074
  case 47:
17062
- i.contextData.blockTransformationMatrix = ud(t, 47), e = t.lastReadGroup;
17075
+ i.contextData.blockTransformationMatrix = pd(t, 47), e = t.lastReadGroup;
17063
17076
  break;
17064
17077
  case 110:
17065
17078
  i.contextData.planeOriginPoint = Ne(t), e = t.lastReadGroup;
@@ -17255,7 +17268,7 @@ function Ne(c) {
17255
17268
  }
17256
17269
  return t;
17257
17270
  }
17258
- function ud(c, t) {
17271
+ function pd(c, t) {
17259
17272
  const e = [];
17260
17273
  let i = c.lastReadGroup || c.next();
17261
17274
  for (; !c.isEOF() && (i.code >= t && i.code < t + 16); ) {
@@ -17264,7 +17277,7 @@ function ud(c, t) {
17264
17277
  }
17265
17278
  return e;
17266
17279
  }
17267
- class fd {
17280
+ class md {
17268
17281
  constructor() {
17269
17282
  g(this, "ForEntityName", "ELLIPSE");
17270
17283
  }
@@ -17329,7 +17342,7 @@ function Ai(c) {
17329
17342
  else return t;
17330
17343
  return e.code === i + 20 && (t.z = e.value, !c.isEOF() && c.hasNext() && (e = c.next())), t;
17331
17344
  }
17332
- function pd(c) {
17345
+ function gd(c) {
17333
17346
  const t = {
17334
17347
  type: 0,
17335
17348
  points: [],
@@ -17354,7 +17367,7 @@ function pd(c) {
17354
17367
  pathTypeFlag: -1
17355
17368
  };
17356
17369
  }
17357
- function md(c, t) {
17370
+ function yd(c, t) {
17358
17371
  const e = [];
17359
17372
  let i = t.next();
17360
17373
  for (; e.length < c; ) {
@@ -17440,7 +17453,7 @@ function md(c, t) {
17440
17453
  pathTypeFlag: -1
17441
17454
  };
17442
17455
  }
17443
- function gd(c, t) {
17456
+ function xd(c, t) {
17444
17457
  const e = [];
17445
17458
  let i = -1, s = t.next();
17446
17459
  for (; e.length < c; ) {
@@ -17448,7 +17461,7 @@ function gd(c, t) {
17448
17461
  switch (s.code) {
17449
17462
  case 92:
17450
17463
  if (i = s.value, i & 2) {
17451
- if (n = pd(t), n) n.pathTypeFlag = i, e.push(n);
17464
+ if (n = gd(t), n) n.pathTypeFlag = i, e.push(n);
17452
17465
  else
17453
17466
  throw new Error("[Hatch] Failed to parse hatch polyline boundary path !");
17454
17467
  s = t.lastReadGroup;
@@ -17457,7 +17470,7 @@ function gd(c, t) {
17457
17470
  break;
17458
17471
  case 93: {
17459
17472
  const r = s.value;
17460
- n = md(r, t), n.pathTypeFlag = i, e.push(n), s = t.lastReadGroup;
17473
+ n = yd(r, t), n.pathTypeFlag = i, e.push(n), s = t.lastReadGroup;
17461
17474
  break;
17462
17475
  }
17463
17476
  default:
@@ -17467,7 +17480,7 @@ function gd(c, t) {
17467
17480
  }
17468
17481
  return e;
17469
17482
  }
17470
- function yd(c, t) {
17483
+ function bd(c, t) {
17471
17484
  if (c <= 0) {
17472
17485
  t.next();
17473
17486
  return;
@@ -17512,7 +17525,7 @@ function yd(c, t) {
17512
17525
  }
17513
17526
  return e;
17514
17527
  }
17515
- function xd(c, t) {
17528
+ function wd(c, t) {
17516
17529
  const e = [];
17517
17530
  let i = t.next();
17518
17531
  for (; e.length < c && !t.isEOF() && i.code !== void 0 && i.code !== 0; )
@@ -17529,7 +17542,7 @@ function xd(c, t) {
17529
17542
  }
17530
17543
  return e;
17531
17544
  }
17532
- class bd {
17545
+ class vd {
17533
17546
  constructor() {
17534
17547
  g(this, "ForEntityName", "HATCH");
17535
17548
  }
@@ -17580,10 +17593,10 @@ class bd {
17580
17593
  i.patternType = e.value, e = t.next();
17581
17594
  break;
17582
17595
  case 78:
17583
- i.patternLines = yd(e.value, t), e = t.lastReadGroup;
17596
+ i.patternLines = bd(e.value, t), e = t.lastReadGroup;
17584
17597
  break;
17585
17598
  case 91:
17586
- i.boundaryPathsCount = e.value, i.boundaryPaths = gd(i.boundaryPathsCount, t), e = t.lastReadGroup;
17599
+ i.boundaryPathsCount = e.value, i.boundaryPaths = xd(i.boundaryPathsCount, t), e = t.lastReadGroup;
17587
17600
  break;
17588
17601
  case 98:
17589
17602
  i.seedPointsCount = e.value, e = t.next();
@@ -17607,7 +17620,7 @@ class bd {
17607
17620
  e = t.next();
17608
17621
  break;
17609
17622
  case 453:
17610
- i.gradientColorCount = e.value, i.gradientColors = xd(i.gradientColorCount, t), e = t.next();
17623
+ i.gradientColorCount = e.value, i.gradientColors = wd(i.gradientColorCount, t), e = t.next();
17611
17624
  break;
17612
17625
  case 460:
17613
17626
  e = t.next();
@@ -17636,7 +17649,7 @@ class bd {
17636
17649
  }
17637
17650
  }
17638
17651
  var rn = /* @__PURE__ */ ((c) => (c[c.ShowImage = 1] = "ShowImage", c[c.ShowImageWhenNotAlignedWithScreen = 2] = "ShowImageWhenNotAlignedWithScreen", c[c.UseClippingBoundary = 4] = "UseClippingBoundary", c[c.TransparencyIsOn = 8] = "TransparencyIsOn", c))(rn || {});
17639
- let wd = class {
17652
+ let Md = class {
17640
17653
  constructor() {
17641
17654
  g(this, "ForEntityName", "IMAGE");
17642
17655
  }
@@ -17735,7 +17748,7 @@ function Ji(c) {
17735
17748
  }
17736
17749
  return t;
17737
17750
  }
17738
- class vd {
17751
+ class Td {
17739
17752
  constructor() {
17740
17753
  g(this, "ForEntityName", "INSERT");
17741
17754
  }
@@ -17809,7 +17822,7 @@ function Ma(c) {
17809
17822
  }
17810
17823
  return t;
17811
17824
  }
17812
- function Md(c) {
17825
+ function Cd(c) {
17813
17826
  switch (c) {
17814
17827
  case 40:
17815
17828
  return "DIMSCALE";
@@ -17843,7 +17856,7 @@ function Md(c) {
17843
17856
  return null;
17844
17857
  }
17845
17858
  }
17846
- class Td {
17859
+ class Sd {
17847
17860
  constructor() {
17848
17861
  g(this, "ForEntityName", "LEADER");
17849
17862
  }
@@ -17858,7 +17871,7 @@ class Td {
17858
17871
  for (; !t.isEOF() && e.code !== 0; )
17859
17872
  switch (e.code) {
17860
17873
  case 10:
17861
- i.vertices.push(Cd(t)), e = t.lastReadGroup;
17874
+ i.vertices.push(Ed(t)), e = t.lastReadGroup;
17862
17875
  break;
17863
17876
  case 3:
17864
17877
  i.dimensionStyle = e.value, e = t.next();
@@ -17889,7 +17902,7 @@ class Td {
17889
17902
  break;
17890
17903
  case 1070:
17891
17904
  if (s) {
17892
- const n = Md(e.value);
17905
+ const n = Cd(e.value);
17893
17906
  n && (e = t.next(), (e.code == 1005 || e.code == 1040 || e.code == 1070) && (n === "DIMLDRBLK" ? i.arrowHeadBlockHandle = e.value : n === "DIMASZ" ? i.arrowHeight = e.value : n === "DIMSCALE" ? i.arrowHeadScale = e.value : n === "DIMCLRD" && e.value > 0 && (i.colorIndex = e.value, i.color = zi(Math.abs(e.value)))));
17894
17907
  }
17895
17908
  e = t.next();
@@ -17901,7 +17914,7 @@ class Td {
17901
17914
  return i;
17902
17915
  }
17903
17916
  }
17904
- function Cd(c) {
17917
+ function Ed(c) {
17905
17918
  const t = {};
17906
17919
  let e = c.lastReadGroup || c.next();
17907
17920
  const i = e.code;
@@ -17915,7 +17928,7 @@ function Cd(c) {
17915
17928
  }
17916
17929
  return t;
17917
17930
  }
17918
- class Sd {
17931
+ class Od {
17919
17932
  constructor() {
17920
17933
  g(this, "ForEntityName", "LINE");
17921
17934
  }
@@ -17963,7 +17976,7 @@ function Yn(c) {
17963
17976
  }
17964
17977
  return t;
17965
17978
  }
17966
- function Ed(c, t) {
17979
+ function _d(c, t) {
17967
17980
  if (!c || c <= 0) throw Error("n must be greater than 0 verticies");
17968
17981
  const e = [];
17969
17982
  let i = !1, s = !1, n = t.lastReadGroup;
@@ -17997,7 +18010,7 @@ function Ed(c, t) {
17997
18010
  }
17998
18011
  return e.push(r), i = !1, s = !1, e;
17999
18012
  }
18000
- class Od {
18013
+ class Pd {
18001
18014
  constructor() {
18002
18015
  g(this, "ForEntityName", "LWPOLYLINE");
18003
18016
  }
@@ -18022,7 +18035,7 @@ class Od {
18022
18035
  s = e.value, e = t.next();
18023
18036
  break;
18024
18037
  case 10:
18025
- i.vertices.push(...Ed(s, t)), e = t.lastReadGroup;
18038
+ i.vertices.push(..._d(s, t)), e = t.lastReadGroup;
18026
18039
  break;
18027
18040
  case 43:
18028
18041
  e.value !== 0 && (i.constantWidth = e.value), e = t.next();
@@ -18047,7 +18060,7 @@ class Od {
18047
18060
  return i;
18048
18061
  }
18049
18062
  }
18050
- class _d {
18063
+ class Ad {
18051
18064
  constructor() {
18052
18065
  g(this, "ForEntityName", "MTEXT");
18053
18066
  }
@@ -18118,7 +18131,7 @@ function Ta(c) {
18118
18131
  }
18119
18132
  return t;
18120
18133
  }
18121
- class Pd {
18134
+ class Id {
18122
18135
  constructor() {
18123
18136
  g(this, "ForEntityName", "OLE2FRAME");
18124
18137
  }
@@ -18170,7 +18183,7 @@ class Pd {
18170
18183
  return i;
18171
18184
  }
18172
18185
  }
18173
- class Ad {
18186
+ class Bd {
18174
18187
  constructor() {
18175
18188
  g(this, "ForEntityName", "POINT");
18176
18189
  }
@@ -18217,7 +18230,7 @@ function Ca(c) {
18217
18230
  }
18218
18231
  return t;
18219
18232
  }
18220
- class Id {
18233
+ class kd {
18221
18234
  constructor() {
18222
18235
  g(this, "ForEntityName", "VERTEX");
18223
18236
  }
@@ -18274,20 +18287,20 @@ class Id {
18274
18287
  return i;
18275
18288
  }
18276
18289
  }
18277
- function Bd(c, t) {
18278
- const e = new Id(), i = [];
18290
+ function Dd(c, t) {
18291
+ const e = new kd(), i = [];
18279
18292
  for (; !c.isEOF(); )
18280
18293
  if (t.code === 0) {
18281
18294
  if (t.value === "VERTEX")
18282
18295
  i.push(e.parseEntity(c, t)), t = c.lastReadGroup;
18283
18296
  else if (t.value === "SEQEND") {
18284
- kd(c, t);
18297
+ Ld(c, t);
18285
18298
  break;
18286
18299
  }
18287
18300
  }
18288
18301
  return i;
18289
18302
  }
18290
- function kd(c, t) {
18303
+ function Ld(c, t) {
18291
18304
  const e = {
18292
18305
  type: t.value
18293
18306
  };
@@ -18299,7 +18312,7 @@ function kd(c, t) {
18299
18312
  ee(e, t), t = c.next();
18300
18313
  return e;
18301
18314
  }
18302
- class Dd {
18315
+ class Rd {
18303
18316
  constructor() {
18304
18317
  g(this, "ForEntityName", "POLYLINE");
18305
18318
  }
@@ -18347,7 +18360,7 @@ class Dd {
18347
18360
  e = t.next();
18348
18361
  break;
18349
18362
  case 210:
18350
- i.extrusionDirection = Ld(t), e = t.lastReadGroup;
18363
+ i.extrusionDirection = Fd(t), e = t.lastReadGroup;
18351
18364
  break;
18352
18365
  case 101:
18353
18366
  for (; e.code != 0; )
@@ -18357,10 +18370,10 @@ class Dd {
18357
18370
  ee(i, e), e = t.next();
18358
18371
  break;
18359
18372
  }
18360
- return i.vertices = Bd(t, e), i;
18373
+ return i.vertices = Dd(t, e), i;
18361
18374
  }
18362
18375
  }
18363
- function Ld(c) {
18376
+ function Fd(c) {
18364
18377
  const t = {};
18365
18378
  let e = c.lastReadGroup || c.next();
18366
18379
  const i = e.code;
@@ -18374,7 +18387,7 @@ function Ld(c) {
18374
18387
  }
18375
18388
  return t;
18376
18389
  }
18377
- class Rd {
18390
+ class zd {
18378
18391
  constructor() {
18379
18392
  g(this, "ForEntityName", "REGION");
18380
18393
  }
@@ -18404,7 +18417,7 @@ class Rd {
18404
18417
  return i;
18405
18418
  }
18406
18419
  }
18407
- class Fd {
18420
+ class Vd {
18408
18421
  constructor() {
18409
18422
  g(this, "ForEntityName", "RAY");
18410
18423
  }
@@ -18449,7 +18462,7 @@ function Sa(c) {
18449
18462
  }
18450
18463
  return t;
18451
18464
  }
18452
- class zd {
18465
+ class jd {
18453
18466
  constructor() {
18454
18467
  g(this, "ForEntityName", "SEQEND");
18455
18468
  }
@@ -18462,7 +18475,7 @@ class zd {
18462
18475
  return i;
18463
18476
  }
18464
18477
  }
18465
- class Vd {
18478
+ class Ud {
18466
18479
  constructor() {
18467
18480
  g(this, "ForEntityName", "SOLID");
18468
18481
  }
@@ -18513,7 +18526,7 @@ function Qi(c) {
18513
18526
  }
18514
18527
  return t;
18515
18528
  }
18516
- class Ud {
18529
+ class Nd {
18517
18530
  constructor() {
18518
18531
  g(this, "ForEntityName", "SPLINE");
18519
18532
  }
@@ -18581,7 +18594,7 @@ function es(c) {
18581
18594
  }
18582
18595
  return t;
18583
18596
  }
18584
- function jd(c, t, e) {
18597
+ function Hd(c, t, e) {
18585
18598
  let i = c;
18586
18599
  for (; i.code !== 304; )
18587
18600
  switch (i.code) {
@@ -18620,7 +18633,7 @@ function Ea(c, t) {
18620
18633
  break;
18621
18634
  }
18622
18635
  if (i.code === 301) {
18623
- jd(i, e, t);
18636
+ Hd(i, e, t);
18624
18637
  continue;
18625
18638
  }
18626
18639
  switch (i.code) {
@@ -18682,7 +18695,7 @@ function Ea(c, t) {
18682
18695
  }
18683
18696
  return e;
18684
18697
  }
18685
- class Nd {
18698
+ class Gd {
18686
18699
  constructor() {
18687
18700
  g(this, "ForEntityName", "ACAD_TABLE");
18688
18701
  }
@@ -18758,7 +18771,7 @@ function Oa(c) {
18758
18771
  }
18759
18772
  return t;
18760
18773
  }
18761
- class Hd {
18774
+ class Wd {
18762
18775
  constructor() {
18763
18776
  g(this, "ForEntityName", "TEXT");
18764
18777
  }
@@ -18823,7 +18836,7 @@ function _a(c) {
18823
18836
  }
18824
18837
  return t;
18825
18838
  }
18826
- class Gd {
18839
+ class qd {
18827
18840
  constructor() {
18828
18841
  g(this, "ForEntityName", "VIEWPORT");
18829
18842
  }
@@ -19009,7 +19022,7 @@ function dt(c) {
19009
19022
  }
19010
19023
  return t;
19011
19024
  }
19012
- class Wd {
19025
+ class Yd {
19013
19026
  constructor() {
19014
19027
  g(this, "ForEntityName", "XLINE");
19015
19028
  }
@@ -19054,7 +19067,7 @@ function Pa(c) {
19054
19067
  }
19055
19068
  return t;
19056
19069
  }
19057
- class qd {
19070
+ class Xd {
19058
19071
  constructor() {
19059
19072
  g(this, "ForObjectName", "DICTIONARY");
19060
19073
  }
@@ -19086,7 +19099,7 @@ class qd {
19086
19099
  e = t.next();
19087
19100
  break;
19088
19101
  default:
19089
- ji(s, e), e = t.next();
19102
+ Ui(s, e), e = t.next();
19090
19103
  break;
19091
19104
  }
19092
19105
  if (n.length !== r.length)
@@ -19096,7 +19109,7 @@ class qd {
19096
19109
  }), s;
19097
19110
  }
19098
19111
  }
19099
- class Yd {
19112
+ class Zd {
19100
19113
  constructor() {
19101
19114
  g(this, "ForObjectName", "IMAGEDEF");
19102
19115
  }
@@ -19125,7 +19138,7 @@ class Yd {
19125
19138
  s.resolutionUnits = e.value, e = t.next();
19126
19139
  break;
19127
19140
  default:
19128
- ji(s, e), e = t.next();
19141
+ Ui(s, e), e = t.next();
19129
19142
  break;
19130
19143
  }
19131
19144
  return s;
@@ -19145,7 +19158,7 @@ function Aa(c) {
19145
19158
  }
19146
19159
  return t;
19147
19160
  }
19148
- class Xd {
19161
+ class Kd {
19149
19162
  constructor() {
19150
19163
  g(this, "ForObjectName", "LAYOUT");
19151
19164
  }
@@ -19201,7 +19214,7 @@ class Xd {
19201
19214
  s.viewportHandle = e.value, e = t.next();
19202
19215
  break;
19203
19216
  default:
19204
- ji(s, e), e = t.next();
19217
+ Ui(s, e), e = t.next();
19205
19218
  break;
19206
19219
  }
19207
19220
  return s.blockTableHandle = s.ownerHandle, s;
@@ -19221,7 +19234,7 @@ function Bt(c) {
19221
19234
  }
19222
19235
  return t;
19223
19236
  }
19224
- class Zd {
19237
+ class $d {
19225
19238
  constructor() {
19226
19239
  g(this, "ForObjectName", "SORTENTSTABLE");
19227
19240
  }
@@ -19250,13 +19263,13 @@ class Zd {
19250
19263
  r.push(e.value), e = t.next();
19251
19264
  break;
19252
19265
  default:
19253
- ji(s, e), e = t.next();
19266
+ Ui(s, e), e = t.next();
19254
19267
  break;
19255
19268
  }
19256
19269
  return s;
19257
19270
  }
19258
19271
  }
19259
- class Kd {
19272
+ class Jd {
19260
19273
  constructor() {
19261
19274
  g(this, "ForObjectName", "SPATIAL_FILTER");
19262
19275
  }
@@ -19278,7 +19291,7 @@ class Kd {
19278
19291
  r,
19279
19292
  { x: n.x, y: r.y },
19280
19293
  n
19281
- )) : s.numberOfPointsOnClipBoundary > 2 ? (s.vertices = $d(s.numberOfPointsOnClipBoundary, t), e = t.lastReadGroup) : e = t.next();
19294
+ )) : s.numberOfPointsOnClipBoundary > 2 ? (s.vertices = Qd(s.numberOfPointsOnClipBoundary, t), e = t.lastReadGroup) : e = t.next();
19282
19295
  break;
19283
19296
  case 71:
19284
19297
  s.clipBoundaryVisible = e.value === 1, e = t.next();
@@ -19308,13 +19321,13 @@ class Kd {
19308
19321
  s.invertBlockMatrix = Ia(t, 40), s.matrix = Ia(t, 40), e = t.lastReadGroup;
19309
19322
  break;
19310
19323
  default:
19311
- ji(s, e), e = t.next();
19324
+ Ui(s, e), e = t.next();
19312
19325
  break;
19313
19326
  }
19314
19327
  return s;
19315
19328
  }
19316
19329
  }
19317
- function $d(c, t) {
19330
+ function Qd(c, t) {
19318
19331
  t.next();
19319
19332
  const e = [];
19320
19333
  for (; e.length < c; )
@@ -19345,7 +19358,7 @@ function an(c) {
19345
19358
  }
19346
19359
  return t;
19347
19360
  }
19348
- class Jd {
19361
+ class e1 {
19349
19362
  constructor() {
19350
19363
  g(this, "ForObjectName", "XRECORD");
19351
19364
  }
@@ -19369,26 +19382,26 @@ class Jd {
19369
19382
  e = t.next();
19370
19383
  break;
19371
19384
  default:
19372
- ji(s, e), e = t.next();
19385
+ Ui(s, e), e = t.next();
19373
19386
  break;
19374
19387
  }
19375
19388
  return s;
19376
19389
  }
19377
19390
  }
19378
- function Qd(c) {
19379
- c.registerEntityHandler(sd), c.registerEntityHandler(nd), c.registerEntityHandler(ad), c.registerEntityHandler(od), c.registerEntityHandler(ld), c.registerEntityHandler(hd), c.registerEntityHandler(dd), c.registerEntityHandler(fd), c.registerEntityHandler(bd), c.registerEntityHandler(wd), c.registerEntityHandler(vd), c.registerEntityHandler(Td), c.registerEntityHandler(Sd), c.registerEntityHandler(Od), c.registerEntityHandler(_d), c.registerEntityHandler(Pd), c.registerEntityHandler(Ad), c.registerEntityHandler(Dd), c.registerEntityHandler(Rd), c.registerEntityHandler(Fd), c.registerEntityHandler(zd), c.registerEntityHandler(Vd), c.registerEntityHandler(Ud), c.registerEntityHandler(Nd), c.registerEntityHandler(Hd), c.registerEntityHandler(Gd), c.registerEntityHandler(Wd);
19391
+ function t1(c) {
19392
+ c.registerEntityHandler(rd), c.registerEntityHandler(ad), c.registerEntityHandler(ld), c.registerEntityHandler(cd), c.registerEntityHandler(hd), c.registerEntityHandler(ud), c.registerEntityHandler(fd), c.registerEntityHandler(md), c.registerEntityHandler(vd), c.registerEntityHandler(Md), c.registerEntityHandler(Td), c.registerEntityHandler(Sd), c.registerEntityHandler(Od), c.registerEntityHandler(Pd), c.registerEntityHandler(Ad), c.registerEntityHandler(Id), c.registerEntityHandler(Bd), c.registerEntityHandler(Rd), c.registerEntityHandler(zd), c.registerEntityHandler(Vd), c.registerEntityHandler(jd), c.registerEntityHandler(Ud), c.registerEntityHandler(Nd), c.registerEntityHandler(Gd), c.registerEntityHandler(Wd), c.registerEntityHandler(qd), c.registerEntityHandler(Yd);
19380
19393
  }
19381
- function e1(c) {
19382
- c.registerObjectHandler(qd), c.registerObjectHandler(Yd), c.registerObjectHandler(Xd), c.registerObjectHandler(Zd), c.registerObjectHandler(Kd), c.registerObjectHandler(Jd);
19394
+ function i1(c) {
19395
+ c.registerObjectHandler(Xd), c.registerObjectHandler(Zd), c.registerObjectHandler(Kd), c.registerObjectHandler($d), c.registerObjectHandler(Jd), c.registerObjectHandler(e1);
19383
19396
  }
19384
- function t1(c) {
19397
+ function s1(c) {
19385
19398
  const t = new Uint8Array(c, 0, 18);
19386
19399
  let e = "";
19387
19400
  for (let i = 0; i < 18; i++)
19388
19401
  e += String.fromCharCode(t[i]);
19389
19402
  return e === "AutoCAD Binary DXF";
19390
19403
  }
19391
- class i1 {
19404
+ class n1 {
19392
19405
  constructor(t) {
19393
19406
  g(this, "_entityHandlers", {});
19394
19407
  g(this, "_objectHandlers", {});
@@ -19398,7 +19411,7 @@ class i1 {
19398
19411
  g(this, "unhandledEntities", {});
19399
19412
  g(this, "unsupportedLineTypes", {});
19400
19413
  g(this, "encoding");
19401
- this.encoding = t, Qd(this), e1(this);
19414
+ this.encoding = t, t1(this), i1(this);
19402
19415
  }
19403
19416
  parse(t) {
19404
19417
  if (typeof t == "string") {
@@ -19406,8 +19419,8 @@ class i1 {
19406
19419
  return this._parse(i);
19407
19420
  } else {
19408
19421
  let e;
19409
- if (t1(t))
19410
- e = new Jh(t);
19422
+ if (s1(t))
19423
+ e = new ed(t);
19411
19424
  else {
19412
19425
  const i = new TextDecoder(this.encoding).decode(t), s = Date.now(), n = this.splitByLineSeparator(i);
19413
19426
  console.info("[DxfParser] string.split took " + (Date.now() - s) / 1e3 + "s, it is avoidable by using dxf in binary."), e = new ba(n);
@@ -20021,7 +20034,7 @@ class i1 {
20021
20034
  if (r === "\r" || r === `
20022
20035
  `) {
20023
20036
  let a = t.substring(i, s);
20024
- a && a.indexOf("M+") > -1 && (a = Uh(a)), a && (a = a), e.push(a), r === "\r" && t[s + 1] === `
20037
+ a && a.indexOf("M+") > -1 && (a = Nh(a)), a && (a = a), e.push(a), r === "\r" && t[s + 1] === `
20025
20038
  ` && s++, i = s + 1;
20026
20039
  }
20027
20040
  }
@@ -20037,9 +20050,9 @@ function bt(c) {
20037
20050
  function Bo(c) {
20038
20051
  return c.code + ":" + c.value;
20039
20052
  }
20040
- const ko = "0.4.0", Do = "VERSION", s1 = () => window.localStorage.getItem(Do), n1 = () => {
20053
+ const ko = "0.4.0", Do = "VERSION", r1 = () => window.localStorage.getItem(Do), a1 = () => {
20041
20054
  window.localStorage.setItem(Do, ko);
20042
- }, r1 = () => s1() !== ko ? (n1(), !0) : !1, ii = class ii {
20055
+ }, o1 = () => r1() !== ko ? (a1(), !0) : !1, ii = class ii {
20043
20056
  constructor() {
20044
20057
  g(this, "DATABASE_NAME", "x_viewer");
20045
20058
  /**
@@ -20082,7 +20095,7 @@ const ko = "0.4.0", Do = "VERSION", s1 = () => window.localStorage.getItem(Do),
20082
20095
  */
20083
20096
  async getDatabase() {
20084
20097
  let t = await this.getDB(this.DATABASE_NAME);
20085
- return this.db || (t.close(), r1() && await this.deleteDataBase(this.DATABASE_NAME), t = await this.getUpgradedDB(t)), t.onclose = () => {
20098
+ return this.db || (t.close(), o1() && await this.deleteDataBase(this.DATABASE_NAME), t = await this.getUpgradedDB(t)), t.onclose = () => {
20086
20099
  this.db = void 0, P.debug("[DB] Db " + t.name + " is closed.");
20087
20100
  }, t.onerror = (e) => {
20088
20101
  this.db = void 0, P.debug("[DB] Db " + t.name + " encountered error.", e);
@@ -20303,7 +20316,7 @@ const si = class si extends Lo {
20303
20316
  */
20304
20317
  g(si, "_instance");
20305
20318
  let dn = si;
20306
- const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vector3(0, 0, 1), Ba = new p.Vector3(0, 0, 0), Vt = 16777215, a1 = "CONTINUOUS", js = new p.PointsMaterial({
20319
+ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vector3(0, 0, 1), Ba = new p.Vector3(0, 0, 0), Vt = 16777215, l1 = "CONTINUOUS", Us = new p.PointsMaterial({
20307
20320
  color: Vt
20308
20321
  }), pe = new p.LineBasicMaterial({
20309
20322
  color: Vt
@@ -20319,7 +20332,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20319
20332
  }), Fa = new p.PointsMaterial({
20320
20333
  color: 65280,
20321
20334
  depthTest: !1
20322
- }), o1 = (c) => c.viewDirectionFromTarget !== void 0, l1 = (c) => {
20335
+ }), c1 = (c) => c.viewDirectionFromTarget !== void 0, h1 = (c) => {
20323
20336
  if (c) {
20324
20337
  const t = c.match(/data:([a-zA-Z0-9]+\/[a-zA-Z0-9-.+]+).*,.*/);
20325
20338
  if (t && t.length > 0) {
@@ -20337,7 +20350,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20337
20350
  }, Va = (c, t, e) => ({
20338
20351
  x: c.x + t * Math.cos(e),
20339
20352
  y: c.y + t * Math.sin(e)
20340
- }), c1 = (c, t, e, i) => {
20353
+ }), d1 = (c, t, e, i) => {
20341
20354
  const s = c ? new p.Vector2(c.x, c.y) : new p.Vector2(0, 0), n = t ? new p.Vector2(t.x, t.y) : new p.Vector2(1, 0);
20342
20355
  e = e || 1;
20343
20356
  const r = 4 * Math.atan(e), a = s.distanceTo(n) / 2 / Math.sin(r / 2), o = Va(c, a, za(s, n) + (Math.PI / 2 - r / 2));
@@ -20349,13 +20362,13 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20349
20362
  d.push(new p.Vector3(f.x, f.y, 0));
20350
20363
  }
20351
20364
  return d;
20352
- }, Ua = (c, t, e, i = c.length * 2, s) => {
20365
+ }, ja = (c, t, e, i = c.length * 2, s) => {
20353
20366
  const n = [];
20354
20367
  if (!c || c.length < t + 1 || t < 1) return n;
20355
20368
  const r = c.map((a) => [a.x, a.y]);
20356
20369
  try {
20357
20370
  for (let a = 0; a < 1; a += 1 / i) {
20358
- const o = Gh(a, t, r, e, s);
20371
+ const o = qh(a, t, r, e, s);
20359
20372
  n.push(new p.Vector3(o[0], o[1], 0));
20360
20373
  }
20361
20374
  } catch {
@@ -20367,18 +20380,18 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20367
20380
  for (let s = 0; s < i; s++) {
20368
20381
  const n = c[s];
20369
20382
  if (n.bulge && (s !== i - 1 || t)) {
20370
- const r = n.bulge, a = s + 1 < i ? c[s + 1] : e[0], o = c1(n, a, r);
20383
+ const r = n.bulge, a = s + 1 < i ? c[s + 1] : e[0], o = d1(n, a, r);
20371
20384
  e.push(...o);
20372
20385
  } else e.push(new p.Vector3(n.x, n.y, 0));
20373
20386
  }
20374
20387
  return e;
20375
- }, h1 = (c) => {
20388
+ }, u1 = (c) => {
20376
20389
  const t = [];
20377
20390
  return c.faceA && t.push(c.faceA), c.faceB && t.push(c.faceB), c.faceC && t.push(c.faceC), c.faceD && t.push(c.faceD), t;
20378
- }, d1 = (c) => {
20391
+ }, f1 = (c) => {
20379
20392
  const t = [], e = [];
20380
20393
  c.forEach((s) => {
20381
- s.polyfaceMeshVertex && (s.threeDPolylineMesh ? t.push(new p.Vector3(s.x, s.y, s.z)) : e.push(h1(s)));
20394
+ s.polyfaceMeshVertex && (s.threeDPolylineMesh ? t.push(new p.Vector3(s.x, s.y, s.z)) : e.push(u1(s)));
20382
20395
  });
20383
20396
  const i = [];
20384
20397
  for (let s = 0; s < e.length; s++) {
@@ -20517,7 +20530,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20517
20530
  const r = s;
20518
20531
  n[s.ownerHandle].push(r);
20519
20532
  }
20520
- }, i && (this.ignorePaperSpace = i.ignorePaperSpace === !0, this.enableLocalCache = i.enableLocalCache === !0, this.enableMerge = U.LOADLLDATA ? !1 : i.enableMerge !== !1, this.encoding = i.encoding || "UTF-8", i.overrideColor != null && (this.overrideColor = gs.rgb2Hex(i.overrideColor)), i.overrideHatchPatternLineThickness != null && (this.overrideHatchPatternLineThickness = i.overrideHatchPatternLineThickness)), this.pointsMaterials[Vt] = js, this.lineBasicMaterials[Vt] = pe, this.meshBasicMaterials[Vt] = wi;
20533
+ }, i && (this.ignorePaperSpace = i.ignorePaperSpace === !0, this.enableLocalCache = i.enableLocalCache === !0, this.enableMerge = U.LOADLLDATA ? !1 : i.enableMerge !== !1, this.encoding = i.encoding || "UTF-8", i.requestHeaders && (this.requestHeader = i.requestHeaders), i.overrideColor != null && (this.overrideColor = gs.rgb2Hex(i.overrideColor)), i.overrideHatchPatternLineThickness != null && (this.overrideHatchPatternLineThickness = i.overrideHatchPatternLineThickness)), this.pointsMaterials[Vt] = Us, this.lineBasicMaterials[Vt] = pe, this.meshBasicMaterials[Vt] = wi;
20521
20534
  }
20522
20535
  /**
20523
20536
  * 说明:该成员与 setRequestHeader 方法未收录在发布的 d.ts 中(类型滞后),按 bundle 实现保留。
@@ -20536,13 +20549,10 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20536
20549
  * Downloads dxf file content
20537
20550
  */
20538
20551
  async download(e, i) {
20539
- let s = l1(e);
20552
+ let s = h1(e);
20540
20553
  if (!s) {
20541
- const n = Date.now(), r = new p.FileLoader(this.manager), a = U.REQUWSTHEADER;
20542
- a && r.setRequestHeader(
20543
- a
20544
- /* 类型桥接:d.ts 中 REQUWSTHEADER 声明为 string,three 签名要求请求头对象 */
20545
- ), r.setResponseType("arraybuffer"), r.setPath(this.path), s = await r.loadAsync(e, i), P.info("[Dxf] " + e + " dxf file downloaded in " + (Date.now() - n) / 1e3 + "s");
20554
+ const n = Date.now(), r = new p.FileLoader(this.manager);
20555
+ this.requestHeader && Object.keys(this.requestHeader).length > 0 && r.setRequestHeader(this.requestHeader), r.setResponseType("arraybuffer"), r.setPath(this.path), s = await r.loadAsync(e, i), P.info("[Dxf] " + e + " dxf file downloaded in " + (Date.now() - n) / 1e3 + "s");
20546
20556
  }
20547
20557
  return s;
20548
20558
  }
@@ -20589,7 +20599,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
20589
20599
  if (!r) return Promise.reject("[Dxf] Failed to download " + e);
20590
20600
  if (this.aborted) return Promise.reject("[Dxf] Job aborted");
20591
20601
  this.timer = Date.now(), P.info("[Dxf] Start parsing...");
20592
- const a = new i1(this.encoding).parseSync(r);
20602
+ const a = new n1(this.encoding).parseSync(r);
20593
20603
  if (this.tryFixDxfData(a), s(80), P.info("[Dxf] Parsed in " + (Date.now() - this.timer) / 1e3 + "s, creating entities..."), this.aborted) return Promise.reject("[Dxf] Job aborted");
20594
20604
  if (a && Le.isBrowser && this.enableLocalCache && this.dxfDataId) {
20595
20605
  const o = Date.now();
@@ -21062,7 +21072,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21062
21072
  const E = new p.BufferGeometry().setFromPoints(y), M = new z(H.Line);
21063
21073
  M.geometry = E, M.material = pe;
21064
21074
  const O = new z(H.Point);
21065
- return O.geometry = ka, O.material = js, O.matrix.setPosition(e.center.x, e.center.y, e.center.z), O.userData.isSnapObject = !0, O.userData.type = "CircleCenter", O.layers.set(qe), M.add(O), x && (this.setRTCUserData(M), M.matrix.setPosition(w.x, w.y, 0)), M.layers.enableAll(), M;
21075
+ return O.geometry = ka, O.material = Us, O.matrix.setPosition(e.center.x, e.center.y, e.center.z), O.userData.isSnapObject = !0, O.userData.type = "CircleCenter", O.layers.set(qe), M.add(O), x && (this.setRTCUserData(M), M.matrix.setPosition(w.x, w.y, 0)), M.layers.enableAll(), M;
21066
21076
  }
21067
21077
  // 说明:以下为源码中注释掉的 loadMText 旧实现(保真保留)。
21068
21078
  // ['loadMText'](entity, data, parentEntity) {
@@ -21220,7 +21230,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21220
21230
  }), a = this.getMTextGroup(r, e, n, i, s), o = a && a.object;
21221
21231
  if (!o) return;
21222
21232
  o.matrix.decompose(K, me, et), e.position && (K.x += e.position.x, K.y += e.position.y, o.matrix.compose(K, me, et)), ut.makeEmpty();
21223
- const l = z.getBox(o, ut), h = l.getSize(V), d = e.width || h.x, u = e.height || h.y, f = e.lineSpaceFactor || 1.657, m = e.text;
21233
+ const l = z.getBox(o, ut), h = l.getSize(V), d = e.width || h.x, u = e.height || h.y, f = h.y > 0 ? h.y : u, m = e.text;
21224
21234
  let b = 0, y = 0;
21225
21235
  switch (document.createElement("canvas").getContext("2d"), e.attachmentPoint) {
21226
21236
  case 1:
@@ -21233,24 +21243,22 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21233
21243
  b -= d, y = 0;
21234
21244
  break;
21235
21245
  case 4:
21236
- b = 0, y += u / 2;
21246
+ b = 0, y += f / 2;
21237
21247
  break;
21238
21248
  case 5:
21239
- b -= d / 2, y += u / 2;
21249
+ b -= d / 2, y += f / 2;
21240
21250
  break;
21241
21251
  case 6:
21242
- b -= d, y += u / 2;
21252
+ b -= d, y += f / 2;
21243
21253
  break;
21244
21254
  case 7:
21245
- b = 0;
21246
- const B = m.split("\\P").length - 1;
21247
- B > 0 ? y += u * (B + 1) + u * f * 0.8 * B : y += u;
21255
+ b = 0, y += f;
21248
21256
  break;
21249
21257
  case 8:
21250
- b -= d / 2, y += u;
21258
+ b -= d / 2, y += f;
21251
21259
  break;
21252
21260
  case 9:
21253
- b -= d, y += u;
21261
+ b -= d, y += f;
21254
21262
  break;
21255
21263
  default:
21256
21264
  return;
@@ -21339,37 +21347,35 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21339
21347
  }), a = this.getMTextGroup(r, e, n, i, s), o = a && a.object;
21340
21348
  if (!o) return;
21341
21349
  o.matrix.decompose(K, me, et), e.position && (K.x += e.position.x, K.y += e.position.y, o.matrix.compose(K, me, et)), ut.makeEmpty();
21342
- const l = z.getBox(o, ut), h = l.getSize(V), d = e.width || h.x, u = e.height || h.y, f = e.lineSpaceFactor || 1.657, m = e.text;
21343
- let b = 0, y = 0;
21350
+ const l = z.getBox(o, ut), h = l.getSize(V), d = e.width || h.x, u = e.height || h.y, f = h.y > 0 ? h.y : u;
21351
+ let m = 0, b = 0;
21344
21352
  switch (e.attachmentPoint) {
21345
21353
  case 1:
21346
- b = 0, y = 0;
21354
+ m = 0, b = 0;
21347
21355
  break;
21348
21356
  case 2:
21349
- b -= d / 2, y = 0;
21357
+ m -= d / 2, b = 0;
21350
21358
  break;
21351
21359
  case 3:
21352
- b -= d, y = 0;
21360
+ m -= d, b = 0;
21353
21361
  break;
21354
21362
  case 4:
21355
- b = 0, y += u / 2;
21363
+ m = 0, b += f / 2;
21356
21364
  break;
21357
21365
  case 5:
21358
- b -= d / 2, y += u / 2;
21366
+ m -= d / 2, b += f / 2;
21359
21367
  break;
21360
21368
  case 6:
21361
- b -= d, y += u / 2;
21369
+ m -= d, b += f / 2;
21362
21370
  break;
21363
21371
  case 7:
21364
- b = 0;
21365
- const E = m.split("\\P").length - 1;
21366
- E > 0 ? y += u * (E + 1) + u * f * 0.8 * E : y += u;
21372
+ m = 0, b += f;
21367
21373
  break;
21368
21374
  case 8:
21369
- b -= d / 2, y += u;
21375
+ m -= d / 2, b += f;
21370
21376
  break;
21371
21377
  case 9:
21372
- b -= d, y += u;
21378
+ m -= d, b += f;
21373
21379
  break;
21374
21380
  default:
21375
21381
  return;
@@ -21380,7 +21386,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21380
21386
  case 2:
21381
21387
  break;
21382
21388
  case 3:
21383
- y += u;
21389
+ b += u;
21384
21390
  break;
21385
21391
  case 4:
21386
21392
  break;
@@ -21389,17 +21395,17 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21389
21395
  default:
21390
21396
  return;
21391
21397
  }
21392
- o.traverse((x) => {
21393
- x.geometry && x.geometry.translate(b, y, 0), x.layers.enableAll();
21398
+ o.traverse((w) => {
21399
+ w.geometry && w.geometry.translate(m, b, 0), w.layers.enableAll();
21394
21400
  });
21395
- let C = 0;
21396
- if (e.rotation && (C = e.rotation * Math.PI / 180), e.directionVector) {
21397
- const x = e.directionVector, E = new p.Vector3(x.x, x.y, x.z), M = E.clone().cross(Ge), O = Ge.angleTo(E);
21398
- C = M.z > 0 ? -O : O;
21401
+ let y = 0;
21402
+ if (e.rotation && (y = e.rotation * Math.PI / 180), e.directionVector) {
21403
+ const w = e.directionVector, x = new p.Vector3(w.x, w.y, w.z), E = x.clone().cross(Ge), M = Ge.angleTo(x);
21404
+ y = E.z > 0 ? -M : M;
21399
21405
  }
21400
21406
  N.shouldRebasePositionOnRTC(K) && this.setRTCUserData(o), o.matrix.compose(K, me, et);
21401
- const w = e.position ? K.clone().sub(e.position) : K;
21402
- return Qe.makeTranslation(-w.x, -w.y, 0), de.makeRotationZ(C), o.matrix.multiply(Qe), o.matrix.multiply(de), o.matrix.multiply(Qe.invert()), o;
21407
+ const C = e.position ? K.clone().sub(e.position) : K;
21408
+ return Qe.makeTranslation(-C.x, -C.y, 0), de.makeRotationZ(y), o.matrix.multiply(Qe), o.matrix.multiply(de), o.matrix.multiply(Qe.invert()), o;
21403
21409
  }
21404
21410
  getMTextGroup(e, i, s, n, r, a = 0, o = 0, l = []) {
21405
21411
  if (e.length === 0) return;
@@ -21450,7 +21456,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21450
21456
  continue;
21451
21457
  }
21452
21458
  a > (u || 1 / 0) && (l.length > 0 && v(l), a = 0, o -= E, l = []), T.translate(a, o, 0), T.scale(y, 1, 1), T.boundingBox || T.computeBoundingBox(), O.T && (C = O.T);
21453
- const B = Vh(
21459
+ const B = Uh(
21454
21460
  I,
21455
21461
  T,
21456
21462
  h,
@@ -21565,7 +21571,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21565
21571
  let o = 1;
21566
21572
  const l = i;
21567
21573
  l?.xScale && l?.yScale && (o = Math.max(Math.abs(l.xScale), Math.abs(l.yScale)));
21568
- const h = Math.max(r - s, a - n), d = this.getBSplineInterpolationsPerSplineSegment(e.controlPoints.length, h * o), u = Ua(e.controlPoints, e.degreeOfSplineCurve, e.knotValues, d), f = new p.Vector3();
21574
+ const h = Math.max(r - s, a - n), d = this.getBSplineInterpolationsPerSplineSegment(e.controlPoints.length, h * o), u = ja(e.controlPoints, e.degreeOfSplineCurve, e.knotValues, d), f = new p.Vector3();
21569
21575
  let m = !1;
21570
21576
  this.enableRTC && (m = N.checkAndRebasePositionsOnRTC(u, f));
21571
21577
  const b = N.getAdjacentNonRepeatPoints(u);
@@ -21660,7 +21666,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21660
21666
  }
21661
21667
  let s = [];
21662
21668
  if (e.isPolyfaceMesh)
21663
- s = d1(e.vertices);
21669
+ s = f1(e.vertices);
21664
21670
  else {
21665
21671
  const h = Zn(e.vertices, e.shape);
21666
21672
  e.shape && h.length > 0 && h.push(h[0]), h.length > 0 && (s = [h]);
@@ -21717,7 +21723,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21717
21723
  if (n.length > 0) {
21718
21724
  a && N.checkAndRebasePositionsOnRTC(n, r);
21719
21725
  const h = new p.BufferGeometry().setFromPoints(n), d = new z(H.Point);
21720
- d.geometry = h, d.material = js, l ? console.warn("Line has both segments and points – consider using a Group") : l = d;
21726
+ d.geometry = h, d.material = Us, l ? console.warn("Line has both segments and points – consider using a Group") : l = d;
21721
21727
  }
21722
21728
  if (l)
21723
21729
  return a && (this.setRTCUserData(l), l.matrix.setPosition(r.x, r.y, r.z)), l.layers.enableAll(), l;
@@ -21737,9 +21743,9 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21737
21743
  const n = [...e.vertices];
21738
21744
  if (e.extrusionDirectionX !== void 0 && e.extrusionDirectionY !== void 0 && e.extrusionDirectionZ !== void 0) {
21739
21745
  V.set(e.extrusionDirectionX, e.extrusionDirectionY, e.extrusionDirectionZ);
21740
- const m = U.getOcsMatrix(V).invert(), b = e.elevation !== void 0 ? e.elevation : 0;
21741
- n.forEach((y) => {
21742
- V.set(y.x, y.y, b).applyMatrix4(m), y.x = V.x, y.y = V.y;
21746
+ const b = U.getOcsMatrix(V).invert(), y = e.elevation !== void 0 ? e.elevation : 0;
21747
+ n.forEach((C) => {
21748
+ V.set(C.x, C.y, y).applyMatrix4(b), C.x = V.x, C.y = V.y;
21743
21749
  });
21744
21750
  }
21745
21751
  let r = Zn(n, e.shape);
@@ -21750,15 +21756,15 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21750
21756
  let a = new z();
21751
21757
  const o = e.extendedData;
21752
21758
  if (o?.outlines) {
21753
- const m = o.outlines, b = [];
21754
- m.forEach((w) => {
21755
- const x = new p.Shape();
21756
- w.forEach((E, M) => {
21757
- M === 0 ? x.moveTo(E[0], E[1]) : x.lineTo(E[0], E[1]);
21758
- }), x.closePath(), b.push(new p.ShapeGeometry(x));
21759
+ const b = o.outlines, y = [];
21760
+ b.forEach((x) => {
21761
+ const E = new p.Shape();
21762
+ x.forEach((M, O) => {
21763
+ O === 0 ? E.moveTo(M[0], M[1]) : E.lineTo(M[0], M[1]);
21764
+ }), E.closePath(), y.push(new p.ShapeGeometry(E));
21759
21765
  });
21760
- const y = Ee(b), C = new z(H.Mesh);
21761
- C.geometry = y, C.material = wi, C.layers.enableAll(), C.layers.disable(qe), a.add(C);
21766
+ const C = Ee(y), w = new z(H.Mesh);
21767
+ w.geometry = C, w.material = wi, w.layers.enableAll(), w.layers.disable(qe), a.add(w);
21762
21768
  }
21763
21769
  let l = !1;
21764
21770
  const h = new p.Vector3();
@@ -21768,25 +21774,25 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
21768
21774
  P.warn("[Dxf] Invalid LWPolyline entity (handle '%s'), ignored!", e.handle);
21769
21775
  return;
21770
21776
  }
21771
- const u = e.constantWidth;
21772
- if (this.enablePlineWidth) {
21773
- const m = n.some((b) => b.startWidth !== void 0 || b.endWidth !== void 0);
21774
- if (m || u !== void 0 && u > 0) {
21775
- let b;
21776
- const y = i.tables?.lineType?.lineTypes, C = this.getLineType(e, i, s), w = y?.[C];
21777
- if (!w || !w.pattern || w.pattern.length === 0)
21778
- if (this.statsInfo.unsupportedPolylineCount++, m ? b = this.createTaperedPolylineGeometry(n) : b = N.convertWidthLineToMeshGeometry(d, u), !b)
21777
+ const u = e.constantWidth, f = d.length > 2 && F.areVector3sEqual(d[0], d[d.length - 1]);
21778
+ if (this.enablePlineWidth && !f) {
21779
+ const b = n.some((y) => y.startWidth !== void 0 || y.endWidth !== void 0);
21780
+ if (b || u !== void 0 && u > 0) {
21781
+ let y;
21782
+ const C = i.tables?.lineType?.lineTypes, w = this.getLineType(e, i, s), x = C?.[w];
21783
+ if (!x || !x.pattern || x.pattern.length === 0)
21784
+ if (this.statsInfo.unsupportedPolylineCount++, b ? y = this.createTaperedPolylineGeometry(n) : y = N.convertWidthLineToMeshGeometry(d, u), !y)
21779
21785
  P.warn("[Dxf] Failed to convert line with width to mesh geometry: %s", e.handle);
21780
21786
  else {
21781
- const x = new z(H.Mesh);
21782
- x.geometry = b, x.material = wi, x.layers.enableAll(), x.layers.disable(qe), a.add(x);
21783
- const E = Q.createOutline(b, pe, x.matrix), M = new z(H.LineSegment);
21784
- M.geometry = E.geometry, M.material = E.material, M.matrix = E.matrix, M.layers.enableAll(), M.layers.disable(qe), a.add(M);
21787
+ const E = new z(H.Mesh);
21788
+ E.geometry = y, E.material = wi, E.layers.enableAll(), E.layers.disable(qe), a.add(E);
21789
+ const M = Q.createOutline(y, pe, E.matrix), O = new z(H.LineSegment);
21790
+ O.geometry = M.geometry, O.material = M.material, O.matrix = M.matrix, O.layers.enableAll(), O.layers.disable(qe), a.add(O);
21785
21791
  }
21786
21792
  }
21787
21793
  }
21788
- const f = new z(H.Line);
21789
- return f.geometry = new p.BufferGeometry().setFromPoints(d), f.material = pe, f.layers.enableAll(), a.children.length > 0 ? a.add(f) : a = f, l && (this.setRTCUserData(a), a.matrix.setPosition(h)), a;
21794
+ const m = new z(H.Line);
21795
+ return m.geometry = new p.BufferGeometry().setFromPoints(d), m.material = pe, m.layers.enableAll(), a.children.length > 0 ? a.add(m) : a = m, l && (this.setRTCUserData(a), a.matrix.setPosition(h)), a;
21790
21796
  }
21791
21797
  /**
21792
21798
  * 根据带 startWidth/endWidth 的顶点数组,生成变宽多段线的网格几何体
@@ -22261,7 +22267,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22261
22267
  const x = new p.Vector3(e.center?.x, e.center?.y, e.center?.z).applyMatrix4(r.invert());
22262
22268
  w.x = x.x, w.y = x.y;
22263
22269
  const E = w, M = new z(H.Point);
22264
- return M.geometry = ka, M.material = js, M.userData.handle = e.handle, M.userData.isSnapObject = !0, M.userData.type = "CircleCenter", M.layers.set(qe), C.add(M), b ? (this.setRTCUserData(C), E.x += m.x, E.y += m.y) : N.shouldRebasePositionOnRTC(E) && this.setRTCUserData(C), C.matrix.setPosition(E), C.layers.enableAll(), C;
22270
+ return M.geometry = ka, M.material = Us, M.userData.handle = e.handle, M.userData.isSnapObject = !0, M.userData.type = "CircleCenter", M.layers.set(qe), C.add(M), b ? (this.setRTCUserData(C), E.x += m.x, E.y += m.y) : N.shouldRebasePositionOnRTC(E) && this.setRTCUserData(C), C.matrix.setPosition(E), C.layers.enableAll(), C;
22265
22271
  }
22266
22272
  addTriangleFacingCamera(e, i, s, n) {
22267
22273
  const r = new p.Vector3(), a = new p.Vector3();
@@ -22743,7 +22749,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22743
22749
  break;
22744
22750
  }
22745
22751
  case Pi.Spline: {
22746
- const n = e, r = Ua(n.controlPoints, n.degreeOfSplineCurve, n.knotValues);
22752
+ const n = e, r = ja(n.controlPoints, n.degreeOfSplineCurve, n.knotValues);
22747
22753
  if (r.length === 0) break;
22748
22754
  e.startPoint = r[0], e.endPoint = r[r.length - 1], i.push(
22749
22755
  ...r
@@ -22982,7 +22988,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
22982
22988
  }
22983
22989
  static getDcs2WcsMatrix(e, i) {
22984
22990
  let s;
22985
- o1(e) ? s = e.viewDirectionFromTarget : s = e.viewDirection, s ?? (s = { x: 0, y: 0, z: 1 });
22991
+ c1(e) ? s = e.viewDirectionFromTarget : s = e.viewDirection, s ?? (s = { x: 0, y: 0, z: 1 });
22986
22992
  const n = e.viewTarget ?? { x: 0, y: 0, z: 0 }, r = new p.Vector3(F.roundNumber(s.x, 7), F.roundNumber(s.y, 7), s.z), a = new p.Vector3(n.x, n.y, n.z), o = e.viewTwistAngle || 0;
22987
22993
  let l, h, d;
22988
22994
  d = r.clone().normalize(), l = bi.clone().cross(r), l.length() > 0 ? (l.normalize(), h = d.clone().cross(l)) : d.z < 0 ? (l = Ge.clone().negate(), h = Xn, d = bi.clone().negate()) : (l = Ge, h = Xn, d = bi);
@@ -23080,7 +23086,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23080
23086
  if (e.lineType !== Po && e.lineType !== hn) return e.lineType;
23081
23087
  if (e.lineType === hn)
23082
23088
  return s ? this.getLineType(s, i) : e.lineType;
23083
- const n = i.tables?.layer?.layers, r = a1;
23089
+ const n = i.tables?.layer?.layers, r = l1;
23084
23090
  if (e.layer !== "0") {
23085
23091
  const a = n && n[e.layer];
23086
23092
  if (a) return a.lineType;
@@ -23190,7 +23196,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23190
23196
  const n = e.name + "_" + i + "_" + s;
23191
23197
  if (!this.lineShaderMaterials[n]) {
23192
23198
  const r = this.getLineTypeScales(), a = r.ltScale * r.celtScale * s;
23193
- this.lineShaderMaterials[n] = Kh.createLineShaderMaterial(e.pattern, i, a, U.ViewportScaleUniform, U.CameraZoomUniform);
23199
+ this.lineShaderMaterials[n] = Jh.createLineShaderMaterial(e.pattern, i, a, U.ViewportScaleUniform, U.CameraZoomUniform);
23194
23200
  }
23195
23201
  return this.lineShaderMaterials[n];
23196
23202
  }
@@ -23242,7 +23248,7 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23242
23248
  }
23243
23249
  h.push(S);
23244
23250
  }
23245
- const u = $h(h, e.patternAngle, U.CameraZoomUniform, new p.Color(i), this.overrideHatchPatternLineThickness);
23251
+ const u = Qh(h, e.patternAngle, U.CameraZoomUniform, new p.Color(i), this.overrideHatchPatternLineThickness);
23246
23252
  return u.defines = {
23247
23253
  MAX_PATTERN_SEGMENT_COUNT: o
23248
23254
  }, this.hatchShaderMaterials.push({
@@ -23874,10 +23880,6 @@ const Ge = new p.Vector3(1, 0, 0), Xn = new p.Vector3(0, 1, 0), bi = new p.Vecto
23874
23880
  }
23875
23881
  };
23876
23882
  g(U, "MODEL_LAYOUT_NAME", "Model"), g(U, "SNAP_GROUP_NAME", "InvisibleObjectGroupForOSnap"), g(U, "SHOW_SNAP_OBJECT", !1), /**
23877
- * 说明:该静态属性在 bundle 中只被读取、从未被赋值(原始拼写可能有误),
23878
- * 运行时恒为 undefined;此处按原样保留。
23879
- */
23880
- g(U, "REQUWSTHEADER"), /**
23881
23883
  * 说明:以下静态字段在 bundle 中于类定义之后统一赋值,此处以字段初始化器的形式等价还原。
23882
23884
  */
23883
23885
  g(U, "CameraZoomUniform", {
@@ -23900,7 +23902,7 @@ g(U, "LOADLLDATA", !1), /**
23900
23902
  */
23901
23903
  g(U, "MaxFragmentUniforms", 1024);
23902
23904
  let X = U;
23903
- class ja extends hi {
23905
+ class Ua extends hi {
23904
23906
  constructor(e) {
23905
23907
  super();
23906
23908
  g(this, "viewer");
@@ -24752,7 +24754,7 @@ class Na extends p.MeshStandardMaterial {
24752
24754
  this.stateTexture = e.stateTexture, super.setValues(e);
24753
24755
  }
24754
24756
  }
24755
- const u1 = `
24757
+ const p1 = `
24756
24758
  // When an object is transparent, we'll change its alpha value,
24757
24759
  // but we should not assign a fixed value because it may already
24758
24760
  // has an alpha value that is lower than 1.
@@ -24894,12 +24896,12 @@ const u1 = `
24894
24896
  }
24895
24897
 
24896
24898
  // TODO: isHighlighted isOverride isHovered
24897
- `, f1 = `
24899
+ `, m1 = `
24898
24900
  attribute int tileObjectId;
24899
24901
  flat varying int vTileObjectId;
24900
- `, p1 = `
24902
+ `, g1 = `
24901
24903
  vTileObjectId = tileObjectId;
24902
- `, m1 = `
24904
+ `, y1 = `
24903
24905
  #ifdef USE_BC_OUTLINE
24904
24906
  // Restore barycentric coordinates
24905
24907
  int barycentricX = int(barycentric) & 0x1;
@@ -24907,14 +24909,14 @@ const u1 = `
24907
24909
  int barycentricZ = int(barycentric) & 0x4;
24908
24910
  vBarycentric = vec3(float(barycentricX), float(barycentricY), float(barycentricZ));
24909
24911
  #endif
24910
- `, g1 = `
24912
+ `, x1 = `
24911
24913
  #ifdef USE_BC_OUTLINE
24912
24914
  vec3 finWireframeColor = outlineColor;
24913
24915
  vec3 tempColor = gl_FragColor.rgb;
24914
24916
 
24915
24917
  gl_FragColor.rgb = mix(finWireframeColor, tempColor, edgeFactor3());
24916
24918
  #endif
24917
- `, y1 = `
24919
+ `, b1 = `
24918
24920
  #ifdef USE_BC_OUTLINE
24919
24921
  varying vec3 vBarycentric;
24920
24922
  uniform vec3 outlineColor;
@@ -24928,12 +24930,12 @@ const u1 = `
24928
24930
  return min(min(a3.x, a3.y), a3.z);
24929
24931
  }
24930
24932
  #endif
24931
- `, x1 = `
24933
+ `, w1 = `
24932
24934
  #ifdef USE_BC_OUTLINE
24933
24935
  attribute float barycentric;
24934
24936
  varying vec3 vBarycentric;
24935
24937
  #endif
24936
- `, b1 = `
24938
+ `, v1 = `
24937
24939
  vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);
24938
24940
  // if (uHoverId == tileObjectId) {
24939
24941
  // gl_FragColor = uHoverColor;
@@ -24970,7 +24972,7 @@ const u1 = `
24970
24972
  // gl_FragColor = vec4(0.5, 0.5, 0.5, 0.8);
24971
24973
  // }
24972
24974
  // }
24973
- `, w1 = `
24975
+ `, M1 = `
24974
24976
  vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);
24975
24977
  // State priority (high to low):
24976
24978
  // - Hidden
@@ -24988,7 +24990,7 @@ const u1 = `
24988
24990
  gl_FragColor = HIGHLIGHT_COLOR;
24989
24991
  return;
24990
24992
  }
24991
- `, v1 = `
24993
+ `, T1 = `
24992
24994
  flat varying int vTileObjectId;
24993
24995
  uniform float uTextureWidth;
24994
24996
  uniform float uTextureHeight;
@@ -24997,7 +24999,7 @@ const u1 = `
24997
24999
  // uniform int uHoverId;
24998
25000
  // uniform bool uIsIsolating;
24999
25001
  // uniform bool uTransparentOthersForIsolation;
25000
- `, M1 = `
25002
+ `, C1 = `
25001
25003
  vec4 textureColor = getTextureColorByTileObjectId(uStateTexture, uTextureWidth, uTextureHeight, vTileObjectId);
25002
25004
  // State priority (high to low):
25003
25005
  // - Hidden
@@ -25059,7 +25061,7 @@ const u1 = `
25059
25061
 
25060
25062
  gl_FragColor = tileObjectId2Color(vTileObjectId);
25061
25063
  }
25062
- `, T1 = `
25064
+ `, S1 = `
25063
25065
  #define STANDARD
25064
25066
 
25065
25067
  varying vec3 vViewPosition;
@@ -25119,7 +25121,7 @@ void main() {
25119
25121
 
25120
25122
  #endif
25121
25123
  }
25122
- `, C1 = `
25124
+ `, E1 = `
25123
25125
  #define STANDARD
25124
25126
 
25125
25127
  #ifdef PHYSICAL
@@ -25286,22 +25288,22 @@ void main() {
25286
25288
  #include <outline_bc_fragment>
25287
25289
  }
25288
25290
  `;
25289
- p.ShaderChunk.outline_bc_vertex = m1;
25290
- p.ShaderChunk.outline_bc_fragment = g1;
25291
- p.ShaderChunk.outline_bc_pars_fragment = y1;
25292
- p.ShaderChunk.outline_bc_pars_vertex = x1;
25293
- p.ShaderChunk.standard_ex_vertex = T1;
25294
- p.ShaderChunk.standard_ex_fragment = C1;
25295
- p.ShaderChunk.common_ex = u1;
25296
- p.ShaderChunk.id_pars_vertex = f1;
25297
- p.ShaderChunk.id_vertex = p1;
25298
- p.ShaderChunk.state_pars_fragment = v1;
25299
- p.ShaderChunk.state_fragment = b1;
25300
- p.ShaderChunk.state_transparent_fragment = M1;
25301
- p.ShaderChunk.state_highlight_fragment = w1;
25291
+ p.ShaderChunk.outline_bc_vertex = y1;
25292
+ p.ShaderChunk.outline_bc_fragment = x1;
25293
+ p.ShaderChunk.outline_bc_pars_fragment = b1;
25294
+ p.ShaderChunk.outline_bc_pars_vertex = w1;
25295
+ p.ShaderChunk.standard_ex_vertex = S1;
25296
+ p.ShaderChunk.standard_ex_fragment = E1;
25297
+ p.ShaderChunk.common_ex = p1;
25298
+ p.ShaderChunk.id_pars_vertex = m1;
25299
+ p.ShaderChunk.id_vertex = g1;
25300
+ p.ShaderChunk.state_pars_fragment = T1;
25301
+ p.ShaderChunk.state_fragment = v1;
25302
+ p.ShaderChunk.state_transparent_fragment = C1;
25303
+ p.ShaderChunk.state_highlight_fragment = M1;
25302
25304
  p.ShaderChunk.pick_ex_vertex = Fo;
25303
25305
  p.ShaderChunk.pick_ex_fragment = zo;
25304
- class S1 extends p.ShaderMaterial {
25306
+ class O1 extends p.ShaderMaterial {
25305
25307
  constructor(e) {
25306
25308
  super(e);
25307
25309
  g(this, "isBimTilesPickMaterial");
@@ -25325,7 +25327,7 @@ class S1 extends p.ShaderMaterial {
25325
25327
  this.stateTexture = e.stateTexture, super.setValues(e);
25326
25328
  }
25327
25329
  }
25328
- class E1 extends p.MeshStandardMaterial {
25330
+ class _1 extends p.MeshStandardMaterial {
25329
25331
  constructor(e) {
25330
25332
  super(e);
25331
25333
  g(this, "isBimTilesHighlightMaterial");
@@ -25383,7 +25385,7 @@ class E1 extends p.MeshStandardMaterial {
25383
25385
  this.stateTexture = e.stateTexture, super.setValues(e);
25384
25386
  }
25385
25387
  }
25386
- class O1 extends p.MeshStandardMaterial {
25388
+ class P1 extends p.MeshStandardMaterial {
25387
25389
  constructor(e) {
25388
25390
  super(e);
25389
25391
  g(this, "isBimTilesTransparentMaterial");
@@ -25441,7 +25443,7 @@ class O1 extends p.MeshStandardMaterial {
25441
25443
  }
25442
25444
  }
25443
25445
  var ti = /* @__PURE__ */ ((c) => (c[c.Hidden = 0] = "Hidden", c[c.Transparent = 1] = "Transparent", c[c.Highlighted = 2] = "Highlighted", c[c.Hovered = 3] = "Hovered", c))(ti || {});
25444
- class _1 {
25446
+ class A1 {
25445
25447
  constructor(t, e) {
25446
25448
  g(this, "_pickMaterial");
25447
25449
  g(this, "_highlightMaterial");
@@ -25479,21 +25481,21 @@ class _1 {
25479
25481
  return this.instanceMaterialMap.get(s);
25480
25482
  }
25481
25483
  get highlightMaterial() {
25482
- return this._highlightMaterial || (this._highlightMaterial = new E1({
25484
+ return this._highlightMaterial || (this._highlightMaterial = new _1({
25483
25485
  transparent: !0,
25484
25486
  color: 0,
25485
25487
  stateTexture: this.stateTexture
25486
25488
  })), this._highlightMaterial;
25487
25489
  }
25488
25490
  get transparentMaterial() {
25489
- return this._transparentMaterial || (this._transparentMaterial = new O1({
25491
+ return this._transparentMaterial || (this._transparentMaterial = new P1({
25490
25492
  transparent: !0,
25491
25493
  color: 0,
25492
25494
  stateTexture: this.stateTexture
25493
25495
  })), this._transparentMaterial;
25494
25496
  }
25495
25497
  get pickMaterial() {
25496
- return this._pickMaterial || (this._pickMaterial = new S1({
25498
+ return this._pickMaterial || (this._pickMaterial = new O1({
25497
25499
  stateTexture: this.stateTexture
25498
25500
  })), this._pickMaterial;
25499
25501
  }
@@ -25844,10 +25846,10 @@ class _1 {
25844
25846
  return (t & 1 << i) !== 0;
25845
25847
  }
25846
25848
  }
25847
- const P1 = {
25849
+ const I1 = {
25848
25850
  9728: p.NearestFilter,
25849
25851
  9729: p.LinearFilter
25850
- }, A1 = {
25852
+ }, B1 = {
25851
25853
  9984: p.NearestMipmapNearestFilter,
25852
25854
  9985: p.LinearMipmapNearestFilter,
25853
25855
  9986: p.NearestMipmapLinearFilter,
@@ -25869,7 +25871,7 @@ const Vo = {
25869
25871
  double: Float64Array
25870
25872
  };
25871
25873
  var _r = /* @__PURE__ */ ((c) => (c[c.scalar = 1] = "scalar", c[c.vec2 = 2] = "vec2", c[c.vec3 = 3] = "vec3", c[c.vec4 = 4] = "vec4", c[c.mat2 = 4] = "mat2", c[c.mat3 = 9] = "mat3", c[c.mat4 = 16] = "mat4", c))(_r || {});
25872
- class I1 {
25874
+ class k1 {
25873
25875
  constructor(t, e) {
25874
25876
  g(this, "baseUrl");
25875
25877
  g(this, "textureLoaderCache", /* @__PURE__ */ new Map());
@@ -25919,7 +25921,7 @@ class I1 {
25919
25921
  this.baseUrl + s.uri,
25920
25922
  (h) => {
25921
25923
  const d = e.samplers || {}, u = d[h.sampler] || {};
25922
- h.magFilter = P1[u.magFilter] || p.LinearFilter, h.minFilter = A1[u.minFilter] || p.LinearMipmapLinearFilter, h.wrapS = Ha[u.wrapS] || p.RepeatWrapping, h.wrapT = Ha[u.wrapT] || p.RepeatWrapping, o(h);
25924
+ h.magFilter = I1[u.magFilter] || p.LinearFilter, h.minFilter = B1[u.minFilter] || p.LinearMipmapLinearFilter, h.wrapS = Ha[u.wrapS] || p.RepeatWrapping, h.wrapT = Ha[u.wrapT] || p.RepeatWrapping, o(h);
25923
25925
  },
25924
25926
  void 0,
25925
25927
  (h) => {
@@ -26074,19 +26076,19 @@ class I1 {
26074
26076
  this.textureLoaderCache.clear(), this.materialCache.clear(), this.textureCache.clear(), this.userDataCache.clear(), this.familyInstanceIdCache.clear(), this.familyInstanceAndUserIdsCache.clear(), this.userIdAndUserDataCache.clear(), this.userBoxCache.clear();
26075
26077
  }
26076
26078
  }
26077
- function Uo(c) {
26079
+ function jo(c) {
26078
26080
  return new TextDecoder().decode(c);
26079
26081
  }
26080
26082
  function Ga(c, t) {
26081
26083
  return ((c & 255) << 24) + (t & 16777215);
26082
26084
  }
26083
- function B1(c) {
26085
+ function D1(c) {
26084
26086
  return c[3];
26085
26087
  }
26086
- function k1(c) {
26088
+ function L1(c) {
26087
26089
  return (c[0] << 16) + (c[1] << 8) + c[2];
26088
26090
  }
26089
- function jo(c) {
26091
+ function Uo(c) {
26090
26092
  const t = c.BYTES_PER_ELEMENT, e = (1 << 8 * t - 1) - 1, i = 2, s = c.length / i, n = new p.Vector2(), r = new p.Vector3(), a = new Float32Array(s * 3);
26091
26093
  for (let o = 0; o < s; o++)
26092
26094
  n.fromArray(c, o * i), F.OctDecode(n, r, e), r.toArray(a, o * 3);
@@ -26104,7 +26106,7 @@ class Wa {
26104
26106
  parseMesh(t, e, i) {
26105
26107
  const s = e.primitive, n = e.buffers, r = this.parseTypedArray(t, n[s.position]), a = s.color ? this.parseTypedArray(t, n[s.color]) : new Float32Array(), o = s.indice ? this.parseTypedArray(t, n[s.indice]) : new Uint16Array();
26106
26108
  let l = s.normal ? this.parseTypedArray(t, n[s.normal]) : new Float32Array();
26107
- s.normal >= 0 && s.normalCompressed && (l = jo(l));
26109
+ s.normal >= 0 && s.normalCompressed && (l = Uo(l));
26108
26110
  const h = s.tangent ? this.parseTypedArray(t, n[s.tangent]) : new Float32Array(), d = s.uv_0 ? this.parseTypedArray(t, n[s.uv_0]) : new Float32Array(), u = s.barycentric ? this.parseTypedArray(t, n[s.barycentric]) : new Uint8Array(), f = new Array(r.length / 3);
26109
26111
  return i.forEach((m) => {
26110
26112
  f.fill(m.userId, m.positionStart, m.positionStart + m.positionCount);
@@ -26158,7 +26160,7 @@ const ni = class ni {
26158
26160
  version: e.readUint32(),
26159
26161
  byteLength: e.readUint64()
26160
26162
  };
26161
- const i = e.readUint32(), s = e.readUint32(), n = e.readUint32(), r = e.readUint64(), a = t.slice(i, i + s), o = Uo(new Uint8Array(a, 0, s)), l = JSON.parse(o), h = t.slice(n, n + r);
26163
+ const i = e.readUint32(), s = e.readUint32(), n = e.readUint32(), r = e.readUint64(), a = t.slice(i, i + s), o = jo(new Uint8Array(a, 0, s)), l = JSON.parse(o), h = t.slice(n, n + r);
26162
26164
  return this.parseMeshes(h, l.meshes);
26163
26165
  }
26164
26166
  parseInstanceProto(t, e) {
@@ -26176,7 +26178,7 @@ const ni = class ni {
26176
26178
  parseMesh(t, e) {
26177
26179
  const i = e.primitive, s = e.buffers, n = this.parseTypedArray(t, s[i.position]), r = i.color ? this.parseTypedArray(t, s[i.color]) : new Float32Array(), a = i.indice ? this.parseTypedArray(t, s[i.indice]) : new Uint16Array();
26178
26180
  let o = i.normal ? this.parseTypedArray(t, s[i.normal]) : new Float32Array();
26179
- i.normal >= 0 && i.normalCompressed && (o = jo(o));
26181
+ i.normal >= 0 && i.normalCompressed && (o = Uo(o));
26180
26182
  const l = i.tangent ? this.parseTypedArray(t, s[i.tangent]) : new Float32Array(), h = i.uv_0 ? this.parseTypedArray(t, s[i.uv_0]) : new Float32Array(), d = i.barycentric ? this.parseTypedArray(t, s[i.barycentric]) : new Uint8Array(), u = [], f = [];
26181
26183
  return {
26182
26184
  type: i.type,
@@ -26210,13 +26212,13 @@ const ni = class ni {
26210
26212
  };
26211
26213
  g(ni, "instanceDataMap", {});
26212
26214
  let un = ni;
26213
- class D1 {
26215
+ class R1 {
26214
26216
  async parse(t, e, i) {
26215
26217
  const s = new Uint8Array(t);
26216
26218
  return j.isGzip(s) ? this.parseProto(s, e, i) : this.parseBinary(t, e);
26217
26219
  }
26218
26220
  async parseBinary(t, e) {
26219
- const i = new wn(t), s = i.readUtf8String(4), n = i.readUint32(), r = i.readUint64(), a = i.readUint32(), o = i.readUint32(), l = i.readUint32(), h = i.readUint64(), d = t.slice(a, a + o), u = Uo(new Uint8Array(d, 0, o)), f = JSON.parse(u);
26221
+ const i = new wn(t), s = i.readUtf8String(4), n = i.readUint32(), r = i.readUint64(), a = i.readUint32(), o = i.readUint32(), l = i.readUint32(), h = i.readUint64(), d = t.slice(a, a + o), u = jo(new Uint8Array(d, 0, o)), f = JSON.parse(u);
26220
26222
  P.debug(
26221
26223
  "[BimTiles] Tile, magic(" + s + "), version(" + n + "), byteLength(" + r + "), tileJson:",
26222
26224
  f
@@ -26244,7 +26246,7 @@ class D1 {
26244
26246
  };
26245
26247
  }
26246
26248
  }
26247
- const L1 = `syntax = "proto3";\r
26249
+ const F1 = `syntax = "proto3";\r
26248
26250
  \r
26249
26251
  package BimTiles;\r
26250
26252
  \r
@@ -26411,13 +26413,13 @@ message PBTileContent {\r
26411
26413
  bytes binaries = 4;\r
26412
26414
  }\r
26413
26415
  `, No = /* @__PURE__ */ Symbol("INITIAL_FRUSTUM_CULLED");
26414
- function R1(c, t) {
26416
+ function z1(c, t) {
26415
26417
  c.traverse((e) => {
26416
26418
  e.frustumCulled = e[No] && t;
26417
26419
  });
26418
26420
  }
26419
26421
  const Hs = new p.Vector3(), Gs = new p.Vector3(), $n = new p.Box3();
26420
- class F1 extends Ol {
26422
+ class V1 extends Ol {
26421
26423
  constructor(e, i) {
26422
26424
  super(e);
26423
26425
  g(this, "highlighUsage");
@@ -26429,7 +26431,7 @@ class F1 extends Ol {
26429
26431
  g(this, "tilesetId");
26430
26432
  g(this, "onBeforeParseTile");
26431
26433
  g(this, "protoRoot");
26432
- this.downloadQueue.maxJobs = 6, this.parseQueue.maxJobs = 4, this.optimizeRaycast = !1, this.errorTarget = 8, this.loadSiblings = !1, this.tilesetId = i, this.baseUrl = e.replace(/\/[^\\/]*\/?$/, "/"), this.highlighUsage = new p.Group(), this.highlighUsage.name = "highlighUsage-" + this.tilesetId, this.group.add(this.highlighUsage), this.transparentUsage = new p.Group(), this.transparentUsage.name = "transparentUsage-" + this.tilesetId, this.group.add(this.transparentUsage), this.pickUsage = new p.Group(), this.protoRoot = _l.parse(L1).root, this.propertyParser = new I1(this.baseUrl, this.protoRoot);
26434
+ this.downloadQueue.maxJobs = 6, this.parseQueue.maxJobs = 4, this.optimizeRaycast = !1, this.errorTarget = 8, this.loadSiblings = !1, this.tilesetId = i, this.baseUrl = e.replace(/\/[^\\/]*\/?$/, "/"), this.highlighUsage = new p.Group(), this.highlighUsage.name = "highlighUsage-" + this.tilesetId, this.group.add(this.highlighUsage), this.transparentUsage = new p.Group(), this.transparentUsage.name = "transparentUsage-" + this.tilesetId, this.group.add(this.transparentUsage), this.pickUsage = new p.Group(), this.protoRoot = _l.parse(F1).root, this.propertyParser = new k1(this.baseUrl, this.protoRoot);
26433
26435
  }
26434
26436
  getVertexColorArray(e, i = new p.Color(16777215)) {
26435
26437
  const s = [], { r: n, g: r, b: a } = i;
@@ -26527,7 +26529,7 @@ class F1 extends Ol {
26527
26529
  parseTile(e, i, s) {
26528
26530
  this.onBeforeParseTile && this.onBeforeParseTile(i), i._loadIndex = i._loadIndex || 0, i._loadIndex++;
26529
26531
  const n = i.cached, r = n.transform;
26530
- return new D1().parse(e, this.baseUrl, this.protoRoot).then(({ batchedMeshes: o, instancedMeshes: l }) => {
26532
+ return new R1().parse(e, this.baseUrl, this.protoRoot).then(({ batchedMeshes: o, instancedMeshes: l }) => {
26531
26533
  P.debug("[BimTiles] batchedMeshes:", o), P.debug("[BimTiles] instancedMeshes:", l);
26532
26534
  const h = new p.Group();
26533
26535
  h.name = "TileGroup";
@@ -26544,7 +26546,7 @@ class F1 extends Ol {
26544
26546
  };
26545
26547
  u(h), h.traverse((f) => {
26546
26548
  f[No] = f.frustumCulled;
26547
- }), R1(h, !this.autoDisableRendererCulling), u(d), n.scene = h, n.pickScene = d, this.onLoadModel && this.onLoadModel(h, i);
26549
+ }), z1(h, !this.autoDisableRendererCulling), u(d), n.scene = h, n.pickScene = d, this.onLoadModel && this.onLoadModel(h, i);
26548
26550
  });
26549
26551
  }
26550
26552
  disposeTile(e) {
@@ -26618,7 +26620,7 @@ class F1 extends Ol {
26618
26620
  this.preprocessURL ? this.preprocessURL(e) : e,
26619
26621
  this.fetchOptions
26620
26622
  ).then((n) => {
26621
- i[e] = n, this.materialManager = new _1(this, {
26623
+ i[e] = n, this.materialManager = new A1(this, {
26622
26624
  maxId: n.properties.userId.maxUserIdIndex
26623
26625
  });
26624
26626
  });
@@ -26666,7 +26668,7 @@ class Ho extends Or {
26666
26668
  g(this, "statistics");
26667
26669
  this.modelId = e.modelId;
26668
26670
  const n = i + s.getMetadata().root;
26669
- this.tilesRenderer = new F1(n, Number(this.modelId)), this._bbox = e.bbox, this.metadata = s.getMetadata(), this.statistics = s.getStatistics();
26671
+ this.tilesRenderer = new V1(n, Number(this.modelId)), this._bbox = e.bbox, this.metadata = s.getMetadata(), this.statistics = s.getStatistics();
26670
26672
  }
26671
26673
  getTilesRenderer() {
26672
26674
  return this.tilesRenderer;
@@ -26794,7 +26796,7 @@ class Ho extends Or {
26794
26796
  this.materialManager.setClipPlanes(e);
26795
26797
  }
26796
26798
  }
26797
- function z1() {
26799
+ function j1() {
26798
26800
  let c = /* @__PURE__ */ new Map();
26799
26801
  return {
26800
26802
  on(t, e) {
@@ -26811,7 +26813,7 @@ function z1() {
26811
26813
  }
26812
26814
  };
26813
26815
  }
26814
- class V1 {
26816
+ class U1 {
26815
26817
  constructor(t) {
26816
26818
  g(this, "viewer");
26817
26819
  g(this, "element");
@@ -26837,7 +26839,7 @@ class V1 {
26837
26839
  }), this.element = t, this.content = e, this.element.appendChild(this.content), this.viewer.widgetContainer?.appendChild(this.element);
26838
26840
  }
26839
26841
  createItem(t, e) {
26840
- const i = new U1(this.viewer, t);
26842
+ const i = new N1(this.viewer, t);
26841
26843
  return e === 0 && i.setActive(!0), i;
26842
26844
  }
26843
26845
  destroy() {
@@ -26854,14 +26856,14 @@ class V1 {
26854
26856
  this.element && (this.element.style.display = "none");
26855
26857
  }
26856
26858
  }
26857
- class U1 {
26859
+ class N1 {
26858
26860
  constructor(t, e) {
26859
26861
  g(this, "viewer");
26860
26862
  g(this, "eventBus");
26861
26863
  g(this, "element");
26862
26864
  g(this, "resetActivate");
26863
26865
  g(this, "active");
26864
- this.viewer = t, this.eventBus = z1(), this.active = !1, this.element = this.createItem(e), this.eventBus.on("activechange", (i) => {
26866
+ this.viewer = t, this.eventBus = j1(), this.active = !1, this.element = this.createItem(e), this.eventBus.on("activechange", (i) => {
26865
26867
  this.resetActivate && this.resetActivate(), i ? (this.element.classList.add("activate"), this.viewer.activateLayout(e)) : this.element.classList.remove("activate");
26866
26868
  });
26867
26869
  }
@@ -26881,7 +26883,7 @@ class U1 {
26881
26883
  this.eventBus.off("activechange");
26882
26884
  }
26883
26885
  }
26884
- class j1 {
26886
+ class H1 {
26885
26887
  // 当前任务数量
26886
26888
  constructor(t) {
26887
26889
  g(this, "element");
@@ -27034,7 +27036,7 @@ class Wo {
27034
27036
  }
27035
27037
  }
27036
27038
  var rt = /* @__PURE__ */ ((c) => (c.BaseViewer = "BaseViewer", c.Viewer3d = "Viewer3d", c.Viewer2d = "Viewer2d", c.BimTilesViewer = "BimTilesViewer", c))(rt || {}), St = /* @__PURE__ */ ((c) => (c.Perspective = "Perspective", c.Orthographic = "Orthographic", c))(St || {});
27037
- const F0 = {
27039
+ const V0 = {
27038
27040
  enableSpinner: !0,
27039
27041
  containerId: "myCanvas"
27040
27042
  }, q = {
@@ -27063,10 +27065,10 @@ const F0 = {
27063
27065
  function nt(c) {
27064
27066
  return c.isPerspectiveCamera;
27065
27067
  }
27066
- function Ue(c) {
27068
+ function je(c) {
27067
27069
  return c.isOrthographicCamera;
27068
27070
  }
27069
- class N1 {
27071
+ class G1 {
27070
27072
  constructor() {
27071
27073
  g(this, "_listeners");
27072
27074
  this._listeners = {};
@@ -27138,7 +27140,7 @@ function Jn(c, t) {
27138
27140
  }), t.x /= c.length, t.y /= c.length;
27139
27141
  }
27140
27142
  function Qn(c, t) {
27141
- return Ue(c) ? (console.warn(t + " is not supported in OrthographicCamera"), !0) : !1;
27143
+ return je(c) ? (console.warn(t + " is not supported in OrthographicCamera"), !0) : !1;
27142
27144
  }
27143
27145
  const qo = 1e-5, is = Math.PI / 180;
27144
27146
  function Ii(c, t, e) {
@@ -27185,9 +27187,9 @@ function Xa(c, t, e, i, s = 1 / 0, n, r) {
27185
27187
  const T = y - c.x, _ = C - c.y, A = w - c.z, I = r.x - y, B = r.y - C, k = r.z - w;
27186
27188
  return T * I + _ * B + A * k > 0 && (r.x = y, r.y = C, r.z = w, e.x = (r.x - y) / n, e.y = (r.y - C) / n, e.z = (r.z - w) / n), r;
27187
27189
  }
27188
- const qs = 1 / 8, H1 = Le.isBrowser && /Mac/.test(navigator.platform), G1 = !(Le.isBrowser && "PointerEvent" in window);
27190
+ const qs = 1 / 8, W1 = Le.isBrowser && /Mac/.test(navigator.platform), q1 = !(Le.isBrowser && "PointerEvent" in window);
27189
27191
  let W, Za, Ys, er, Ve, Y, te, Ti, ft, pt, Jt, Ka, $a, tt, rs, Ci, Ja, tr, Qa, ir, sr, Xs;
27190
- class $ extends N1 {
27192
+ class $ extends G1 {
27191
27193
  /**
27192
27194
  * Creates a `CameraControls` instance.
27193
27195
  *
@@ -27446,7 +27448,7 @@ class $ extends N1 {
27446
27448
  if (nt(this._camera)) {
27447
27449
  const O = Y.copy(this._camera.position).sub(this._target), S = this._camera.getEffectiveFOV() * is, v = O.length() * Math.tan(S * 0.5), T = this.truckSpeed * x * v / this._elementRect.height, _ = this.truckSpeed * E * v / this._elementRect.height;
27448
27450
  this.verticalDragToForward ? (M ? this.setFocalOffset(this._focalOffsetEnd.x + T, this._focalOffsetEnd.y, this._focalOffsetEnd.z, !0) : this.truck(T, 0, !0), this.forward(-_, !0)) : M ? this.setFocalOffset(this._focalOffsetEnd.x + T, this._focalOffsetEnd.y + _, this._focalOffsetEnd.z, !0) : this.truck(T, _, !0);
27449
- } else if (Ue(this._camera)) {
27451
+ } else if (je(this._camera)) {
27450
27452
  const O = this._camera, S = this.truckSpeed * x * (O.right - O.left) / O.zoom / this._elementRect.width, v = this.truckSpeed * E * (O.top - O.bottom) / O.zoom / this._elementRect.height;
27451
27453
  M ? this.setFocalOffset(this._focalOffsetEnd.x + S, this._focalOffsetEnd.y + v, this._focalOffsetEnd.z, !0) : this.truck(S, v, !0);
27452
27454
  }
@@ -27463,10 +27465,10 @@ class $ extends N1 {
27463
27465
  left: L.ROTATE,
27464
27466
  middle: L.DOLLY,
27465
27467
  right: L.TRUCK,
27466
- wheel: nt(this._camera) ? L.DOLLY : Ue(this._camera) ? L.ZOOM : L.NONE
27468
+ wheel: nt(this._camera) ? L.DOLLY : je(this._camera) ? L.ZOOM : L.NONE
27467
27469
  }, this.touches = {
27468
27470
  one: L.TOUCH_ROTATE,
27469
- two: nt(this._camera) ? L.TOUCH_DOLLY_TRUCK : Ue(this._camera) ? L.TOUCH_ZOOM_TRUCK : L.NONE,
27471
+ two: nt(this._camera) ? L.TOUCH_DOLLY_TRUCK : je(this._camera) ? L.TOUCH_ZOOM_TRUCK : L.NONE,
27470
27472
  three: L.TOUCH_TRUCK
27471
27473
  };
27472
27474
  const s = new W.Vector2(), n = new W.Vector2(), r = new W.Vector2(), a = (x) => {
@@ -27554,7 +27556,7 @@ class $ extends N1 {
27554
27556
  const v = performance.now();
27555
27557
  f - v < 1e3 && this._getClientRect(this._elementRect), f = v;
27556
27558
  }
27557
- const E = H1 ? -1 : -3, M = x.deltaMode === 1 ? x.deltaY / E : x.deltaY / (E * 10), O = this.dollyToCursor ? (x.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (x.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27559
+ const E = W1 ? -1 : -3, M = x.deltaMode === 1 ? x.deltaY / E : x.deltaY / (E * 10), O = this.dollyToCursor ? (x.clientX - this._elementRect.x) / this._elementRect.width * 2 - 1 : 0, S = this.dollyToCursor ? (x.clientY - this._elementRect.y) / this._elementRect.height * -2 + 1 : 0;
27558
27560
  switch (this.mouseButtons.wheel) {
27559
27561
  case L.ROTATE: {
27560
27562
  this._rotateInternal(x.deltaX, x.deltaY), this._isUserControllingRotate = !0;
@@ -27626,7 +27628,7 @@ class $ extends N1 {
27626
27628
  Jn(this._activePointers, Ve), n.copy(Ve), this._activePointers.length === 0 && this._domElement && (this._domElement.removeEventListener("pointermove", l), this._domElement.removeEventListener("mousemove", h), this._domElement.removeEventListener("pointerup", d), this._domElement.removeEventListener("mouseup", u), this.dispatchEvent({ type: "controlend" }));
27627
27629
  };
27628
27630
  this._addAllEventListeners = (x) => {
27629
- this._domElement = x, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", a), G1 && this._domElement.addEventListener("mousedown", o), this._domElement.addEventListener("pointercancel", d), this._domElement.addEventListener("wheel", m, { passive: !1 }), this._domElement.addEventListener("contextmenu", b);
27631
+ this._domElement = x, this._domElement.style.touchAction = "none", this._domElement.style.userSelect = "none", this._domElement.style.webkitUserSelect = "none", this._domElement.addEventListener("pointerdown", a), q1 && this._domElement.addEventListener("mousedown", o), this._domElement.addEventListener("pointercancel", d), this._domElement.addEventListener("wheel", m, { passive: !1 }), this._domElement.addEventListener("contextmenu", b);
27630
27632
  }, this._removeAllEventListeners = () => {
27631
27633
  this._domElement && (this._domElement.style.touchAction = "", this._domElement.style.userSelect = "", this._domElement.style.webkitUserSelect = "", this._domElement.removeEventListener("pointerdown", a), this._domElement.removeEventListener("mousedown", o), this._domElement.removeEventListener("pointercancel", d), this._domElement.removeEventListener("wheel", m), this._domElement.removeEventListener("contextmenu", b), this._domElement.removeEventListener("pointermove", l), this._domElement.removeEventListener("mousemove", h), this._domElement.removeEventListener("pointerup", d), this._domElement.removeEventListener("mouseup", u));
27632
27634
  }, this.cancel = () => {
@@ -28028,7 +28030,7 @@ class $ extends N1 {
28028
28030
  if (nt(this._camera)) {
28029
28031
  const x = this.getDistanceToFitBox(C.x, C.y, C.z, s);
28030
28032
  l.push(this.moveTo(w.x, w.y, w.z, i)), l.push(this.dollyTo(x, i)), l.push(this.setFocalOffset(0, 0, 0, i));
28031
- } else if (Ue(this._camera)) {
28033
+ } else if (je(this._camera)) {
28032
28034
  const x = this._camera, E = x.right - x.left, M = x.top - x.bottom, O = s ? Math.max(E / C.x, M / C.y) : Math.min(E / C.x, M / C.y);
28033
28035
  l.push(this.moveTo(w.x, w.y, w.z, i)), l.push(this.zoomTo(O, i)), l.push(this.setFocalOffset(0, 0, 0, i));
28034
28036
  }
@@ -28045,7 +28047,7 @@ class $ extends N1 {
28045
28047
  if (s.push(this.moveTo(r.center.x, r.center.y, r.center.z, i)), nt(this._camera)) {
28046
28048
  const a = this.getDistanceToFitSphere(r.radius);
28047
28049
  s.push(this.dollyTo(a, i));
28048
- } else if (Ue(this._camera)) {
28050
+ } else if (je(this._camera)) {
28049
28051
  const a = this._camera, o = a.right - a.left, l = a.top - a.bottom, h = 2 * r.radius, d = Math.min(o / h, l / h);
28050
28052
  s.push(this.zoomTo(d, i));
28051
28053
  }
@@ -28309,7 +28311,7 @@ class $ extends N1 {
28309
28311
  m.lengthSq() === 0 && (m.x = 1);
28310
28312
  const b = Ti.crossVectors(m, f), y = this._sphericalEnd.radius * Math.tan(u.getEffectiveFOV() * is * 0.5), w = (this._sphericalEnd.radius - this._dollyControlAmount - this._sphericalEnd.radius) / this._sphericalEnd.radius, x = Y.copy(this._targetEnd).add(m.multiplyScalar(this._dollyControlCoord.x * y * u.aspect)).add(b.multiplyScalar(this._dollyControlCoord.y * y));
28311
28313
  this._targetEnd.lerp(x, w);
28312
- } else if (Ue(this._camera)) {
28314
+ } else if (je(this._camera)) {
28313
28315
  const u = this._camera, f = Y.set(
28314
28316
  this._dollyControlCoord.x,
28315
28317
  this._dollyControlCoord.y,
@@ -28427,7 +28429,7 @@ class $ extends N1 {
28427
28429
  if (nt(this._camera)) {
28428
28430
  const e = this._camera, i = e.near, s = e.getEffectiveFOV() * is, n = Math.tan(s * 0.5) * i, r = n * e.aspect;
28429
28431
  this._nearPlaneCorners[0].set(-r, -n, 0), this._nearPlaneCorners[1].set(r, -n, 0), this._nearPlaneCorners[2].set(r, n, 0), this._nearPlaneCorners[3].set(-r, n, 0);
28430
- } else if (Ue(this._camera)) {
28432
+ } else if (je(this._camera)) {
28431
28433
  const e = this._camera, i = 1 / e.zoom, s = e.left * i, n = e.right * i, r = e.top * i, a = e.bottom * i;
28432
28434
  this._nearPlaneCorners[0].set(s, r, 0), this._nearPlaneCorners[1].set(n, r, 0), this._nearPlaneCorners[2].set(n, a, 0), this._nearPlaneCorners[3].set(s, a, 0);
28433
28435
  }
@@ -28489,7 +28491,7 @@ class $ extends N1 {
28489
28491
  }
28490
28492
  }
28491
28493
  var yt = /* @__PURE__ */ ((c) => (c[c.Orbit = 0] = "Orbit", c[c.FirstPerson = 1] = "FirstPerson", c[c.Plan = 2] = "Plan", c))(yt || {});
28492
- class W1 {
28494
+ class Y1 {
28493
28495
  constructor(t) {
28494
28496
  g(this, "mode");
28495
28497
  g(this, "cameraManager");
@@ -28501,10 +28503,10 @@ class W1 {
28501
28503
  left: $.ACTION.ROTATE,
28502
28504
  middle: $.ACTION.DOLLY,
28503
28505
  right: $.ACTION.TRUCK,
28504
- wheel: nt(t) ? $.ACTION.DOLLY : Ue(t) ? $.ACTION.ZOOM : $.ACTION.NONE
28506
+ wheel: nt(t) ? $.ACTION.DOLLY : je(t) ? $.ACTION.ZOOM : $.ACTION.NONE
28505
28507
  }, e.touches = {
28506
28508
  one: $.ACTION.TOUCH_ROTATE,
28507
- two: nt(t) ? $.ACTION.TOUCH_DOLLY_TRUCK : Ue(t) ? $.ACTION.TOUCH_ZOOM_TRUCK : $.ACTION.NONE,
28509
+ two: nt(t) ? $.ACTION.TOUCH_DOLLY_TRUCK : je(t) ? $.ACTION.TOUCH_ZOOM_TRUCK : $.ACTION.NONE,
28508
28510
  three: $.ACTION.TOUCH_TRUCK
28509
28511
  }, e.dollyToCursor = !0, e.azimuthRotateSpeed = 1, e.polarRotateSpeed = 1, e.minDistance = 1, e.maxDistance = 300, e.minZoom = 3, this.cameraManager.cameraControls.truckSpeed = 2;
28510
28512
  }
@@ -28515,7 +28517,7 @@ class W1 {
28515
28517
  e.minDistance = 1, e.maxDistance = s * 10, e.minZoom = 3;
28516
28518
  }
28517
28519
  }
28518
- class q1 {
28520
+ class X1 {
28519
28521
  constructor(t) {
28520
28522
  g(this, "mode");
28521
28523
  g(this, "cameraManager");
@@ -28527,10 +28529,10 @@ class q1 {
28527
28529
  left: $.ACTION.TRUCK,
28528
28530
  middle: $.ACTION.TRUCK,
28529
28531
  right: $.ACTION.TRUCK,
28530
- wheel: nt(t) ? $.ACTION.DOLLY : Ue(t) ? $.ACTION.ZOOM : $.ACTION.NONE
28532
+ wheel: nt(t) ? $.ACTION.DOLLY : je(t) ? $.ACTION.ZOOM : $.ACTION.NONE
28531
28533
  }, e.touches = {
28532
28534
  one: $.ACTION.TOUCH_TRUCK,
28533
- two: nt(t) ? $.ACTION.TOUCH_DOLLY_TRUCK : Ue(t) ? $.ACTION.TOUCH_ZOOM_TRUCK : $.ACTION.NONE,
28535
+ two: nt(t) ? $.ACTION.TOUCH_DOLLY_TRUCK : je(t) ? $.ACTION.TOUCH_ZOOM_TRUCK : $.ACTION.NONE,
28534
28536
  three: $.ACTION.NONE
28535
28537
  }, e.dollyToCursor = !0, e.azimuthRotateSpeed = 0, e.polarRotateSpeed = 0, e.truckSpeed = 1, e.maxZoom = 1 / 0, e.minZoom = -1 / 0;
28536
28538
  }
@@ -28538,7 +28540,7 @@ class q1 {
28538
28540
  }
28539
28541
  }
28540
28542
  const Si = 50, nr = new p.Vector3();
28541
- class Y1 {
28543
+ class Z1 {
28542
28544
  constructor(t) {
28543
28545
  g(this, "viewer");
28544
28546
  g(this, "perspectiveCamera");
@@ -28583,13 +28585,13 @@ class Y1 {
28583
28585
  a ? n.rotate(0, -0.1, !0) : this.viewer.name === rt.Viewer2d && n.truck(0, -r, !0);
28584
28586
  break;
28585
28587
  case "KeyW":
28586
- a && (Ue(this.activeCamera) ? n.zoom(0.01, !0) : n.dolly(1, !0));
28588
+ a && (je(this.activeCamera) ? n.zoom(0.01, !0) : n.dolly(1, !0));
28587
28589
  break;
28588
28590
  case "KeyA":
28589
28591
  a && n.truck(-r, 0, !0);
28590
28592
  break;
28591
28593
  case "KeyS":
28592
- a && (Ue(this.activeCamera) ? n.zoom(-0.01, !0) : n.dolly(-1, !0));
28594
+ a && (je(this.activeCamera) ? n.zoom(-0.01, !0) : n.dolly(-1, !0));
28593
28595
  break;
28594
28596
  case "KeyD":
28595
28597
  a && n.truck(r, 0, !0);
@@ -28621,8 +28623,8 @@ class Y1 {
28621
28623
  this.perspectiveCamera,
28622
28624
  t.getInputManager()
28623
28625
  ), this.controlsMap = {
28624
- [yt.Orbit]: new W1(this),
28625
- [yt.Plan]: new q1(this)
28626
+ [yt.Orbit]: new Y1(this),
28627
+ [yt.Plan]: new X1(this)
28626
28628
  }, this.activeControls = this.controlsMap[yt.Orbit], this.setupControls(), this.setProjection(St.Perspective), this.anchor = this.createAnchor();
28627
28629
  }
28628
28630
  get viewerContainer() {
@@ -28886,8 +28888,8 @@ const ri = class ri extends Lo {
28886
28888
  * Singleton design pattern
28887
28889
  */
28888
28890
  g(ri, "_instance");
28889
- let Ui = ri;
28890
- var Yo = /* @__PURE__ */ ((c) => (c[c.Horizontal = 0] = "Horizontal", c[c.Vertical = 1] = "Vertical", c[c.All = 2] = "All", c))(Yo || {}), je = /* @__PURE__ */ ((c) => (c[c.Shapes = 0] = "Shapes", c[c.Bigfont = 1] = "Bigfont", c[c.Unifont = 2] = "Unifont", c))(je || {});
28891
+ let ji = ri;
28892
+ var Yo = /* @__PURE__ */ ((c) => (c[c.Horizontal = 0] = "Horizontal", c[c.Vertical = 1] = "Vertical", c[c.All = 2] = "All", c))(Yo || {}), Ue = /* @__PURE__ */ ((c) => (c[c.Shapes = 0] = "Shapes", c[c.Bigfont = 1] = "Bigfont", c[c.Unifont = 2] = "Unifont", c))(Ue || {});
28891
28893
  class Xo extends Bl {
28892
28894
  constructor(e, i) {
28893
28895
  super(i);
@@ -28931,13 +28933,13 @@ class Xo extends Bl {
28931
28933
  async setFontDataToIndexedDb() {
28932
28934
  const e = this.getFontFile();
28933
28935
  return new Promise((i, s) => {
28934
- Ui.instance().save(e, () => {
28936
+ ji.instance().save(e, () => {
28935
28937
  console.log("[FontFile] Saved '" + this.fileName + "' (" + this.fileHeader + ") to indexedDb"), i();
28936
28938
  }, (n) => s("[FontFile] Failed to save '" + this.fileName + "' (" + this.fileHeader + ") to indexedDb! " + n));
28937
28939
  });
28938
28940
  }
28939
28941
  async getFontDataByIndexedDb() {
28940
- return Ui.instance().query(this.fileName);
28942
+ return ji.instance().query(this.fileName);
28941
28943
  }
28942
28944
  releaseFontData() {
28943
28945
  this.data = {};
@@ -29177,7 +29179,7 @@ class J {
29177
29179
  }
29178
29180
  }
29179
29181
  let fn;
29180
- function X1() {
29182
+ function K1() {
29181
29183
  const c = [
29182
29184
  [161, 169, 161, 254],
29183
29185
  [176, 247, 161, 254],
@@ -29198,8 +29200,8 @@ function X1() {
29198
29200
  for (fn = new Uint16Array(65536), e = 0; e < i.length; e++)
29199
29201
  fn[i.charCodeAt(e)] = t[e];
29200
29202
  }
29201
- function Z1(c) {
29202
- !fn && X1();
29203
+ function $1(c) {
29204
+ !fn && K1();
29203
29205
  const t = new Uint8Array(c.length * 2);
29204
29206
  let e = 0;
29205
29207
  for (let i = 0; i < c.length; i++) {
@@ -29303,7 +29305,7 @@ const mt = class mt {
29303
29305
  * Gets code id of a char.
29304
29306
  */
29305
29307
  static getCode(t) {
29306
- const e = Z1(t);
29308
+ const e = $1(t);
29307
29309
  return e.length < 2 ? e[0] : e.length < 4 ? J.ToUInt16(e, 0) : J.ToUInt32(e, 0);
29308
29310
  }
29309
29311
  /**
@@ -29345,13 +29347,13 @@ const mt = class mt {
29345
29347
  let d = 0, u, f = i * t.baseUp;
29346
29348
  const m = s.clone();
29347
29349
  switch (r.length > 1 && (n.push(r.slice()), r = []), t.fontType) {
29348
- case je.Shapes:
29350
+ case Ue.Shapes:
29349
29351
  l++, d = e[l];
29350
29352
  break;
29351
- case je.Bigfont:
29353
+ case Ue.Bigfont:
29352
29354
  l++, d = e[l], d == 0 && (l++, d = J.ToUInt16(new Uint8Array([e[l++], e[l++]]), 0), m.x = e[l++] * i, m.y = e[l++] * i, f = e[l] * i);
29353
29355
  break;
29354
- case je.Unifont:
29356
+ case Ue.Unifont:
29355
29357
  l += 2, d = J.ToUInt16(new Uint8Array([e[l - 1], e[l]]), 0);
29356
29358
  break;
29357
29359
  }
@@ -29508,13 +29510,13 @@ const mt = class mt {
29508
29510
  break;
29509
29511
  case 7:
29510
29512
  switch (t.fontType) {
29511
- case je.Shapes:
29513
+ case Ue.Shapes:
29512
29514
  i++;
29513
29515
  break;
29514
- case je.Bigfont:
29516
+ case Ue.Bigfont:
29515
29517
  i++, e[i] == 0 && (i += 6);
29516
29518
  break;
29517
- case je.Unifont:
29519
+ case Ue.Unifont:
29518
29520
  i += 2;
29519
29521
  break;
29520
29522
  }
@@ -30271,17 +30273,17 @@ const rr = {
30271
30273
  g(this, "fontType");
30272
30274
  g(this, "textShapesCache");
30273
30275
  g(this, "graphicData");
30274
- if (this.isExtend = !1, this.isUniCode = !0, this.isEmbedded = !1, this.fontType = je.Unifont, this.textShapesCache = /* @__PURE__ */ new Map(), this.graphicData = /* @__PURE__ */ new Map(), i instanceof ArrayBuffer) {
30276
+ if (this.isExtend = !1, this.isUniCode = !0, this.isEmbedded = !1, this.fontType = Ue.Unifont, this.textShapesCache = /* @__PURE__ */ new Map(), this.graphicData = /* @__PURE__ */ new Map(), i instanceof ArrayBuffer) {
30275
30277
  const s = new wn(i), n = Rt.parserHeader(s, Rt.FILE_STOP_FLAG), r = n.split(" ");
30276
30278
  switch (r[1]) {
30277
30279
  case "shapes":
30278
- this.parseShapeFont(s), this.fontType = je.Shapes;
30280
+ this.parseShapeFont(s), this.fontType = Ue.Shapes;
30279
30281
  break;
30280
30282
  case "bigfont":
30281
- this.parseBigFont(s), this.fontType = je.Bigfont;
30283
+ this.parseBigFont(s), this.fontType = Ue.Bigfont;
30282
30284
  break;
30283
30285
  case "unifont":
30284
- this.parseUniFont(s), this.fontType = je.Unifont;
30286
+ this.parseUniFont(s), this.fontType = Ue.Unifont;
30285
30287
  break;
30286
30288
  }
30287
30289
  this.fileHeader = r[0], this.fileVersion = r[2];
@@ -30370,7 +30372,7 @@ const rr = {
30370
30372
  for (const l of n)
30371
30373
  e.setPosition(l.offset), r[l.code] = e.readBytes(l.length);
30372
30374
  const a = r[0];
30373
- this.info = K1(a);
30375
+ this.info = J1(a);
30374
30376
  let o = this.info.indexOf("\0") + 1;
30375
30377
  a.length - o === 4 ? (this.baseUp = a[o++], this.baseDown = a[o++], this.orientation = a[o++]) : (this.baseUp = a[o++], o++, this.orientation = a[o++], this.baseDown = a[o++], this.isExtend = !0), this.data = r;
30376
30378
  }
@@ -30409,7 +30411,7 @@ const rr = {
30409
30411
  */
30410
30412
  getNotFoundTextShape(e) {
30411
30413
  let i = 0;
30412
- return this.fontType === je.Bigfont && (i = Rt.getCode("?")), this.fontType === je.Unifont && (i = Rt.getCode("?")), this.getGraphicDataByCode(i, e);
30414
+ return this.fontType === Ue.Bigfont && (i = Rt.getCode("?")), this.fontType === Ue.Unifont && (i = Rt.getCode("?")), this.getGraphicDataByCode(i, e);
30413
30415
  }
30414
30416
  getFontFile() {
30415
30417
  return {
@@ -30426,7 +30428,7 @@ const rr = {
30426
30428
  };
30427
30429
  }
30428
30430
  setFontFile(e) {
30429
- this.fileName = e.fileName, this.fontType = e.fontType || je.Unifont, this.data = e.data, this.info = e.info, this.order = e.order, this.orientation = e.orientation, this.baseUp = e.baseUp, this.baseDown = e.baseDown, this.fileHeader = e.fileHeader, this.fileVersion = e.fileVersion;
30431
+ this.fileName = e.fileName, this.fontType = e.fontType || Ue.Unifont, this.data = e.data, this.info = e.info, this.order = e.order, this.orientation = e.orientation, this.baseUp = e.baseUp, this.baseDown = e.baseDown, this.fileHeader = e.fileHeader, this.fileVersion = e.fileVersion;
30430
30432
  }
30431
30433
  releaseFontData() {
30432
30434
  super.releaseFontData(), this.graphicData.clear(), this.textShapesCache.clear();
@@ -30434,7 +30436,7 @@ const rr = {
30434
30436
  };
30435
30437
  g(fs, "DEFAULT_SIZE", 12);
30436
30438
  let Ft = fs;
30437
- function K1(c) {
30439
+ function J1(c) {
30438
30440
  let t, e, i, s, n;
30439
30441
  t = "";
30440
30442
  const r = c.length;
@@ -30627,7 +30629,7 @@ class Tt {
30627
30629
  const s = t[i];
30628
30630
  let n = null;
30629
30631
  typeof s == "object" ? n = Object.keys(s)[0] : n = Tt.getFileName(s.toLowerCase());
30630
- const r = await Ui.instance().query(n);
30632
+ const r = await ji.instance().query(n);
30631
30633
  if (r) e = !0;
30632
30634
  else {
30633
30635
  e = !1;
@@ -30642,7 +30644,7 @@ class Tt {
30642
30644
  }
30643
30645
  async getFontFromIndexeddb() {
30644
30646
  if (this.fontMap.size !== 0) return;
30645
- const t = (await Ui.instance().queryAll()).sort((e, i) => e.order - i.order);
30647
+ const t = (await ji.instance().queryAll()).sort((e, i) => e.order - i.order);
30646
30648
  for (let e = 0; e < t.length; e++) {
30647
30649
  const i = t[e], {
30648
30650
  fileName: s,
@@ -30692,7 +30694,7 @@ class Tt {
30692
30694
  return t.substring(e + 1);
30693
30695
  }
30694
30696
  }
30695
- class z0 {
30697
+ class j0 {
30696
30698
  constructor(t) {
30697
30699
  g(this, "object");
30698
30700
  this.object = t;
@@ -30772,7 +30774,7 @@ class z0 {
30772
30774
  return N.geometriesEqual(t, e);
30773
30775
  }
30774
30776
  }
30775
- class $1 {
30777
+ class Q1 {
30776
30778
  constructor() {
30777
30779
  g(this, "TIMEOUT", "timeout");
30778
30780
  g(this, "INTERVAL", "interval");
@@ -30860,7 +30862,7 @@ class pn {
30860
30862
  }
30861
30863
  }
30862
30864
  var os = /* @__PURE__ */ ((c) => (c[c.NULL = 0] = "NULL", c[c.POINT = 1] = "POINT", c[c.POLYLINE = 3] = "POLYLINE", c[c.POLYGON = 5] = "POLYGON", c))(os || {});
30863
- class J1 {
30865
+ class eu {
30864
30866
  parse(t) {
30865
30867
  var e = {}, i = new DataView(t), s = 0;
30866
30868
  if (e.fileCode = i.getInt32(s, !1), e.fileCode != 9994) throw new Error("Unknown file code: " + e.fileCode);
@@ -30918,7 +30920,7 @@ class J1 {
30918
30920
  return r;
30919
30921
  }
30920
30922
  }
30921
- class Q1 {
30923
+ class tu {
30922
30924
  constructor() {
30923
30925
  g(this, "LINE_MATERIAL");
30924
30926
  g(this, "MESH_MATERIAL");
@@ -31089,13 +31091,13 @@ class Q1 {
31089
31091
  return n;
31090
31092
  }
31091
31093
  }
31092
- class eu {
31094
+ class iu {
31093
31095
  async load(t, e, i, s) {
31094
31096
  this.updateProgress(i, 0);
31095
31097
  const n = new XMLHttpRequest();
31096
31098
  n.responseType = "arraybuffer", n.onload = () => {
31097
31099
  this.updateProgress(i, 50);
31098
- const r = new J1(), a = r.parse(n.response), o = new Q1().createModel(a);
31100
+ const r = new eu(), a = r.parse(n.response), o = new tu().createModel(a);
31099
31101
  this.updateProgress(i, 100), e(o);
31100
31102
  }, n.onerror = s, n.open("GET", t), n.send(null);
31101
31103
  }
@@ -31175,7 +31177,7 @@ const ps = class ps {
31175
31177
  return Promise.resolve(a);
31176
31178
  }
31177
31179
  async loadStl(t, e) {
31178
- const i = new Ul(this.manager), s = await i.loadAsync(t, e), n = new p.MeshStandardMaterial({
31180
+ const i = new jl(this.manager), s = await i.loadAsync(t, e), n = new p.MeshStandardMaterial({
31179
31181
  color: 11184810,
31180
31182
  metalness: 0.1,
31181
31183
  roughness: 0.8
@@ -31183,7 +31185,7 @@ const ps = class ps {
31183
31185
  return Promise.resolve(r);
31184
31186
  }
31185
31187
  async loadShp(t, e) {
31186
- const i = new eu();
31188
+ const i = new iu();
31187
31189
  return new Promise((s, n) => {
31188
31190
  i.load(
31189
31191
  t,
@@ -31288,7 +31290,7 @@ g(ps, "DecoderPath", "libs/draco/gltf/"), g(ps, "Rhino3dmLibraryPath", "https://
31288
31290
  let oi = ps;
31289
31291
  const Zo = `(function(){"use strict";function Ks(f){for(let t=f.length-1;t>=0;--t)if(f[t]>=65535)return!0;return!1}function ms(f){return document.createElementNS("http://www.w3.org/1999/xhtml",f)}const ps={};function xs(f){const t=f[0];if(typeof t=="string"&&t.startsWith("TSL:")){const e=f[1];e&&e.isStackTrace?f[0]+=" "+e.getLocation():f[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return f}function yt(...f){f=xs(f);const t="THREE."+f.shift();{const e=f[0];e&&e.isStackTrace?console.warn(e.getError(t)):console.warn(t,...f)}}function Ut(...f){f=xs(f);const t="THREE."+f.shift();{const e=f[0];e&&e.isStackTrace?console.error(e.getError(t)):console.error(t,...f)}}function yi(...f){const t=f.join(" ");t in ps||(ps[t]=!0,yt(...f))}class Ve{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[t]===void 0&&(i[t]=[]),i[t].indexOf(e)===-1&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return i===void 0?!1:i[t]!==void 0&&i[t].indexOf(e)!==-1}removeEventListener(t,e){const i=this._listeners;if(i===void 0)return;const s=i[t];if(s!==void 0){const n=s.indexOf(e);n!==-1&&s.splice(n,1)}}dispatchEvent(t){const e=this._listeners;if(e===void 0)return;const i=e[t.type];if(i!==void 0){t.target=this;const s=i.slice(0);for(let n=0,r=s.length;n<r;n++)s[n].call(this,t);t.target=null}}}const $=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];function Re(){const f=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return($[f&255]+$[f>>8&255]+$[f>>16&255]+$[f>>24&255]+"-"+$[t&255]+$[t>>8&255]+"-"+$[t>>16&15|64]+$[t>>24&255]+"-"+$[e&63|128]+$[e>>8&255]+"-"+$[e>>16&255]+$[e>>24&255]+$[i&255]+$[i>>8&255]+$[i>>16&255]+$[i>>24&255]).toLowerCase()}function V(f,t,e){return Math.max(t,Math.min(e,f))}function me(f,t){switch(t.constructor){case Float32Array:return f;case Uint32Array:return f/4294967295;case Uint16Array:return f/65535;case Uint8Array:case Uint8ClampedArray:return f/255;case Int32Array:return Math.max(f/2147483647,-1);case Int16Array:return Math.max(f/32767,-1);case Int8Array:return Math.max(f/127,-1);default:throw new Error("THREE.MathUtils: Invalid component type.")}}function K(f,t){switch(t.constructor){case Float32Array:return f;case Uint32Array:return Math.round(f*4294967295);case Uint16Array:return Math.round(f*65535);case Uint8Array:case Uint8ClampedArray:return Math.round(f*255);case Int32Array:return Math.round(f*2147483647);case Int16Array:return Math.round(f*32767);case Int8Array:return Math.round(f*127);default:throw new Error("THREE.MathUtils: Invalid component type.")}}const hs=class hs{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("THREE.Vector2: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("THREE.Vector2: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6],this.y=s[1]*e+s[4]*i+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=V(this.x,t.x,e.x),this.y=V(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=V(this.x,t,e),this.y=V(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(V(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(V(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),s=Math.sin(e),n=this.x-t.x,r=this.y-t.y;return this.x=n*i-r*s+t.x,this.y=n*s+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}};hs.prototype.isVector2=!0;let Y=hs;class pe{constructor(t=0,e=0,i=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=s}static slerpFlat(t,e,i,s,n,r,a){let o=i[s+0],c=i[s+1],h=i[s+2],u=i[s+3],l=n[r+0],d=n[r+1],y=n[r+2],m=n[r+3];if(u!==m||o!==l||c!==d||h!==y){let z=o*l+c*d+h*y+u*m;z<0&&(l=-l,d=-d,y=-y,m=-m,z=-z);let b=1-a;if(z<.9995){const p=Math.acos(z),x=Math.sin(p);b=Math.sin(b*p)/x,a=Math.sin(a*p)/x,o=o*b+l*a,c=c*b+d*a,h=h*b+y*a,u=u*b+m*a}else{o=o*b+l*a,c=c*b+d*a,h=h*b+y*a,u=u*b+m*a;const p=1/Math.sqrt(o*o+c*c+h*h+u*u);o*=p,c*=p,h*=p,u*=p}}t[e]=o,t[e+1]=c,t[e+2]=h,t[e+3]=u}static multiplyQuaternionsFlat(t,e,i,s,n,r){const a=i[s],o=i[s+1],c=i[s+2],h=i[s+3],u=n[r],l=n[r+1],d=n[r+2],y=n[r+3];return t[e]=a*y+h*u+o*d-c*l,t[e+1]=o*y+h*l+c*u-a*d,t[e+2]=c*y+h*d+a*l-o*u,t[e+3]=h*y-a*u-o*l-c*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,s){return this._x=t,this._y=e,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,s=t._y,n=t._z,r=t._order,a=Math.cos,o=Math.sin,c=a(i/2),h=a(s/2),u=a(n/2),l=o(i/2),d=o(s/2),y=o(n/2);switch(r){case"XYZ":this._x=l*h*u+c*d*y,this._y=c*d*u-l*h*y,this._z=c*h*y+l*d*u,this._w=c*h*u-l*d*y;break;case"YXZ":this._x=l*h*u+c*d*y,this._y=c*d*u-l*h*y,this._z=c*h*y-l*d*u,this._w=c*h*u+l*d*y;break;case"ZXY":this._x=l*h*u-c*d*y,this._y=c*d*u+l*h*y,this._z=c*h*y+l*d*u,this._w=c*h*u-l*d*y;break;case"ZYX":this._x=l*h*u-c*d*y,this._y=c*d*u+l*h*y,this._z=c*h*y-l*d*u,this._w=c*h*u+l*d*y;break;case"YZX":this._x=l*h*u+c*d*y,this._y=c*d*u+l*h*y,this._z=c*h*y-l*d*u,this._w=c*h*u-l*d*y;break;case"XZY":this._x=l*h*u-c*d*y,this._y=c*d*u-l*h*y,this._z=c*h*y+l*d*u,this._w=c*h*u+l*d*y;break;default:yt("Quaternion: .setFromEuler() encountered an unknown order: "+r)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,s=Math.sin(i);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],s=e[4],n=e[8],r=e[1],a=e[5],o=e[9],c=e[2],h=e[6],u=e[10],l=i+a+u;if(l>0){const d=.5/Math.sqrt(l+1);this._w=.25/d,this._x=(h-o)*d,this._y=(n-c)*d,this._z=(r-s)*d}else if(i>a&&i>u){const d=2*Math.sqrt(1+i-a-u);this._w=(h-o)/d,this._x=.25*d,this._y=(s+r)/d,this._z=(n+c)/d}else if(a>u){const d=2*Math.sqrt(1+a-i-u);this._w=(n-c)/d,this._x=(s+r)/d,this._y=.25*d,this._z=(o+h)/d}else{const d=2*Math.sqrt(1+u-i-a);this._w=(r-s)/d,this._x=(n+c)/d,this._y=(o+h)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(V(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(i===0)return this;const s=Math.min(1,e/i);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,s=t._y,n=t._z,r=t._w,a=e._x,o=e._y,c=e._z,h=e._w;return this._x=i*h+r*a+s*c-n*o,this._y=s*h+r*o+n*a-i*c,this._z=n*h+r*c+i*o-s*a,this._w=r*h-i*a-s*o-n*c,this._onChangeCallback(),this}slerp(t,e){let i=t._x,s=t._y,n=t._z,r=t._w,a=this.dot(t);a<0&&(i=-i,s=-s,n=-n,r=-r,a=-a);let o=1-e;if(a<.9995){const c=Math.acos(a),h=Math.sin(c);o=Math.sin(o*c)/h,e=Math.sin(e*c)/h,this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+s*e,this._z=this._z*o+n*e,this._w=this._w*o+r*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),n=Math.sqrt(i);return this.set(s*Math.sin(t),s*Math.cos(t),n*Math.sin(e),n*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}const ls=class ls{constructor(t=0,e=0,i=0){this.x=t,this.y=e,this.z=i}set(t,e,i){return i===void 0&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("THREE.Vector3: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("THREE.Vector3: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(gs.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(gs.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6]*s,this.y=n[1]*e+n[4]*i+n[7]*s,this.z=n[2]*e+n[5]*i+n[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,n=t.elements,r=1/(n[3]*e+n[7]*i+n[11]*s+n[15]);return this.x=(n[0]*e+n[4]*i+n[8]*s+n[12])*r,this.y=(n[1]*e+n[5]*i+n[9]*s+n[13])*r,this.z=(n[2]*e+n[6]*i+n[10]*s+n[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,s=this.z,n=t.x,r=t.y,a=t.z,o=t.w,c=2*(r*s-a*i),h=2*(a*e-n*s),u=2*(n*i-r*e);return this.x=e+o*c+r*u-a*h,this.y=i+o*h+a*c-n*u,this.z=s+o*u+n*h-r*c,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,s=this.z,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*s,this.y=n[1]*e+n[5]*i+n[9]*s,this.z=n[2]*e+n[6]*i+n[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=V(this.x,t.x,e.x),this.y=V(this.y,t.y,e.y),this.z=V(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=V(this.x,t,e),this.y=V(this.y,t,e),this.z=V(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(V(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,s=t.y,n=t.z,r=e.x,a=e.y,o=e.z;return this.x=s*o-n*a,this.y=n*r-i*o,this.z=i*a-s*r,this}projectOnVector(t){const e=t.lengthSq();if(e===0)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return mi.copy(this).projectOnVector(t),this.sub(mi)}reflect(t){return this.sub(mi.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(V(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,s=this.z-t.z;return e*e+i*i+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const s=Math.sin(e)*t;return this.x=s*Math.sin(i),this.y=Math.cos(e)*t,this.z=s*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}};ls.prototype.isVector3=!0;let S=ls;const mi=new S,gs=new pe,us=class us{constructor(t,e,i,s,n,r,a,o,c){this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,a,o,c)}set(t,e,i,s,n,r,a,o,c){const h=this.elements;return h[0]=t,h[1]=s,h[2]=a,h[3]=e,h[4]=n,h[5]=o,h[6]=i,h[7]=r,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,n=this.elements,r=i[0],a=i[3],o=i[6],c=i[1],h=i[4],u=i[7],l=i[2],d=i[5],y=i[8],m=s[0],z=s[3],b=s[6],p=s[1],x=s[4],g=s[7],w=s[2],B=s[5],_=s[8];return n[0]=r*m+a*p+o*w,n[3]=r*z+a*x+o*B,n[6]=r*b+a*g+o*_,n[1]=c*m+h*p+u*w,n[4]=c*z+h*x+u*B,n[7]=c*b+h*g+u*_,n[2]=l*m+d*p+y*w,n[5]=l*z+d*x+y*B,n[8]=l*b+d*g+y*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],c=t[7],h=t[8];return e*r*h-e*a*c-i*n*h+i*a*o+s*n*c-s*r*o}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],c=t[7],h=t[8],u=h*r-a*c,l=a*o-h*n,d=c*n-r*o,y=e*u+i*l+s*d;if(y===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/y;return t[0]=u*m,t[1]=(s*c-h*i)*m,t[2]=(a*i-s*r)*m,t[3]=l*m,t[4]=(h*e-s*o)*m,t[5]=(s*n-a*e)*m,t[6]=d*m,t[7]=(i*o-c*e)*m,t[8]=(r*e-i*n)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,s,n,r,a){const o=Math.cos(n),c=Math.sin(n);return this.set(i*o,i*c,-i*(o*r+c*a)+r+t,-s*c,s*o,-s*(-c*r+o*a)+a+e,0,0,1),this}scale(t,e){return yi("Matrix3: .scale() is deprecated. Use .makeScale() instead."),this.premultiply(pi.makeScale(t,e)),this}rotate(t){return yi("Matrix3: .rotate() is deprecated. Use .makeRotation() instead."),this.premultiply(pi.makeRotation(-t)),this}translate(t,e){return yi("Matrix3: .translate() is deprecated. Use .makeTranslation() instead."),this.premultiply(pi.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<9;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return new this.constructor().fromArray(this.elements)}};us.prototype.isMatrix3=!0;let xt=us;const pi=new xt;function xi(f){return f<.04045?f*.0773993808:Math.pow(f*.9478672986+.0521327014,2.4)}let Zt;class tn{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement>"u")return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{Zt===void 0&&(Zt=ms("canvas")),Zt.width=t.width,Zt.height=t.height;const s=Zt.getContext("2d");t instanceof ImageData?s.putImageData(t,0,0):s.drawImage(t,0,0,t.width,t.height),i=Zt}return i.toDataURL(e)}static sRGBToLinear(t){if(typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap){const e=ms("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const s=i.getImageData(0,0,t.width,t.height),n=s.data;for(let r=0;r<n.length;r++)n[r]=xi(n[r]/255)*255;return i.putImageData(s,0,0),e}else if(t.data){const e=t.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(xi(e[i]/255)*255):e[i]=xi(e[i]);return{data:e,width:t.width,height:t.height}}else return yt("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let en=0;class sn{constructor(t=null){this.isTextureSource=!0,Object.defineProperty(this,"id",{value:en++}),this.uuid=Re(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):typeof VideoFrame<"u"&&e instanceof VideoFrame?t.set(e.displayWidth,e.displayHeight,0):e!==null?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){t===!0&&this.version++}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];const i={uuid:this.uuid,url:""},s=this.data;if(s!==null){let n;if(Array.isArray(s)){n=[];for(let r=0,a=s.length;r<a;r++)s[r].isDataTexture?n.push(gi(s[r].image)):n.push(gi(s[r]))}else n=gi(s);i.url=n}return e||(t.images[this.uuid]=i),i}}function gi(f){return typeof HTMLImageElement<"u"&&f instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&f instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&f instanceof ImageBitmap?tn.getDataURL(f):f.data?{data:Array.from(f.data),width:f.width,height:f.height,type:f.data.constructor.name}:(yt("Texture: Unable to serialize Texture."),{})}let nn=0;const wi=new S;class Nt extends Ve{constructor(t=Nt.DEFAULT_IMAGE,e=Nt.DEFAULT_MAPPING,i=1001,s=1001,n=1006,r=1008,a=1023,o=1009,c=Nt.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:nn++}),this.uuid=Re(),this.name="",this.source=new sn(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=s,this.magFilter=n,this.minFilter=r,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Y(0,0),this.repeat=new Y(1,1),this.center=new Y(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(t&&t.depth&&t.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(wi).x}get height(){return this.source.getSize(wi).y}get depth(){return this.source.getSize(wi).z}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.normalized=t.normalized,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(i===void 0){yt(\`Texture.setValues(): parameter '\${e}' has value of undefined.\`);continue}const s=this[e];if(s===void 0){yt(\`Texture.setValues(): property '\${e}' does not exist.\`);continue}s&&i&&s.isVector2&&i.isVector2||s&&i&&s.isVector3&&i.isVector3||s&&i&&s.isMatrix3&&i.isMatrix3?s.copy(i):this[e]=i}}toJSON(t){const e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==300)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){t===!0&&this.pmremVersion++}}Nt.DEFAULT_IMAGE=null,Nt.DEFAULT_MAPPING=300,Nt.DEFAULT_ANISOTROPY=1;const fs=class fs{constructor(t=0,e=0,i=0,s=1){this.x=t,this.y=e,this.z=i,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,s){return this.x=t,this.y=e,this.z=i,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("THREE.Vector4: index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("THREE.Vector4: index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,s=this.z,n=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*s+r[12]*n,this.y=r[1]*e+r[5]*i+r[9]*s+r[13]*n,this.z=r[2]*e+r[6]*i+r[10]*s+r[14]*n,this.w=r[3]*e+r[7]*i+r[11]*s+r[15]*n,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,s,n;const o=t.elements,c=o[0],h=o[4],u=o[8],l=o[1],d=o[5],y=o[9],m=o[2],z=o[6],b=o[10];if(Math.abs(h-l)<.01&&Math.abs(u-m)<.01&&Math.abs(y-z)<.01){if(Math.abs(h+l)<.1&&Math.abs(u+m)<.1&&Math.abs(y+z)<.1&&Math.abs(c+d+b-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const x=(c+1)/2,g=(d+1)/2,w=(b+1)/2,B=(h+l)/4,_=(u+m)/4,M=(y+z)/4;return x>g&&x>w?x<.01?(i=0,s=.707106781,n=.707106781):(i=Math.sqrt(x),s=B/i,n=_/i):g>w?g<.01?(i=.707106781,s=0,n=.707106781):(s=Math.sqrt(g),i=B/s,n=M/s):w<.01?(i=.707106781,s=.707106781,n=0):(n=Math.sqrt(w),i=_/n,s=M/n),this.set(i,s,n,e),this}let p=Math.sqrt((z-y)*(z-y)+(u-m)*(u-m)+(l-h)*(l-h));return Math.abs(p)<.001&&(p=1),this.x=(z-y)/p,this.y=(u-m)/p,this.z=(l-h)/p,this.w=Math.acos((c+d+b-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=V(this.x,t.x,e.x),this.y=V(this.y,t.y,e.y),this.z=V(this.z,t.z,e.z),this.w=V(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=V(this.x,t,e),this.y=V(this.y,t,e),this.z=V(this.z,t,e),this.w=V(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(V(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}};fs.prototype.isVector4=!0;let xe=fs;const ui=class ui{constructor(t,e,i,s,n,r,a,o,c,h,u,l,d,y,m,z){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,i,s,n,r,a,o,c,h,u,l,d,y,m,z)}set(t,e,i,s,n,r,a,o,c,h,u,l,d,y,m,z){const b=this.elements;return b[0]=t,b[4]=e,b[8]=i,b[12]=s,b[1]=n,b[5]=r,b[9]=a,b[13]=o,b[2]=c,b[6]=h,b[10]=u,b[14]=l,b[3]=d,b[7]=y,b[11]=m,b[15]=z,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ui().fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return this.determinantAffine()===0?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(t.determinantAffine()===0)return this.identity();const e=this.elements,i=t.elements,s=1/$t.setFromMatrixColumn(t,0).length(),n=1/$t.setFromMatrixColumn(t,1).length(),r=1/$t.setFromMatrixColumn(t,2).length();return e[0]=i[0]*s,e[1]=i[1]*s,e[2]=i[2]*s,e[3]=0,e[4]=i[4]*n,e[5]=i[5]*n,e[6]=i[6]*n,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,s=t.y,n=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(s),c=Math.sin(s),h=Math.cos(n),u=Math.sin(n);if(t.order==="XYZ"){const l=r*h,d=r*u,y=a*h,m=a*u;e[0]=o*h,e[4]=-o*u,e[8]=c,e[1]=d+y*c,e[5]=l-m*c,e[9]=-a*o,e[2]=m-l*c,e[6]=y+d*c,e[10]=r*o}else if(t.order==="YXZ"){const l=o*h,d=o*u,y=c*h,m=c*u;e[0]=l+m*a,e[4]=y*a-d,e[8]=r*c,e[1]=r*u,e[5]=r*h,e[9]=-a,e[2]=d*a-y,e[6]=m+l*a,e[10]=r*o}else if(t.order==="ZXY"){const l=o*h,d=o*u,y=c*h,m=c*u;e[0]=l-m*a,e[4]=-r*u,e[8]=y+d*a,e[1]=d+y*a,e[5]=r*h,e[9]=m-l*a,e[2]=-r*c,e[6]=a,e[10]=r*o}else if(t.order==="ZYX"){const l=r*h,d=r*u,y=a*h,m=a*u;e[0]=o*h,e[4]=y*c-d,e[8]=l*c+m,e[1]=o*u,e[5]=m*c+l,e[9]=d*c-y,e[2]=-c,e[6]=a*o,e[10]=r*o}else if(t.order==="YZX"){const l=r*o,d=r*c,y=a*o,m=a*c;e[0]=o*h,e[4]=m-l*u,e[8]=y*u+d,e[1]=u,e[5]=r*h,e[9]=-a*h,e[2]=-c*h,e[6]=d*u+y,e[10]=l-m*u}else if(t.order==="XZY"){const l=r*o,d=r*c,y=a*o,m=a*c;e[0]=o*h,e[4]=-u,e[8]=c*h,e[1]=l*u+m,e[5]=r*h,e[9]=d*u-y,e[2]=y*u-d,e[6]=a*h,e[10]=m*u+l}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(rn,t,on)}lookAt(t,e,i){const s=this.elements;return et.subVectors(t,e),et.lengthSq()===0&&(et.z=1),et.normalize(),Pt.crossVectors(i,et),Pt.lengthSq()===0&&(Math.abs(i.z)===1?et.x+=1e-4:et.z+=1e-4,et.normalize(),Pt.crossVectors(i,et)),Pt.normalize(),ke.crossVectors(et,Pt),s[0]=Pt.x,s[4]=ke.x,s[8]=et.x,s[1]=Pt.y,s[5]=ke.y,s[9]=et.y,s[2]=Pt.z,s[6]=ke.z,s[10]=et.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,s=e.elements,n=this.elements,r=i[0],a=i[4],o=i[8],c=i[12],h=i[1],u=i[5],l=i[9],d=i[13],y=i[2],m=i[6],z=i[10],b=i[14],p=i[3],x=i[7],g=i[11],w=i[15],B=s[0],_=s[4],M=s[8],P=s[12],A=s[1],C=s[5],T=s[9],E=s[13],I=s[2],F=s[6],R=s[10],Z=s[14],tt=s[3],dt=s[7],at=s[11],pt=s[15];return n[0]=r*B+a*A+o*I+c*tt,n[4]=r*_+a*C+o*F+c*dt,n[8]=r*M+a*T+o*R+c*at,n[12]=r*P+a*E+o*Z+c*pt,n[1]=h*B+u*A+l*I+d*tt,n[5]=h*_+u*C+l*F+d*dt,n[9]=h*M+u*T+l*R+d*at,n[13]=h*P+u*E+l*Z+d*pt,n[2]=y*B+m*A+z*I+b*tt,n[6]=y*_+m*C+z*F+b*dt,n[10]=y*M+m*T+z*R+b*at,n[14]=y*P+m*E+z*Z+b*pt,n[3]=p*B+x*A+g*I+w*tt,n[7]=p*_+x*C+g*F+w*dt,n[11]=p*M+x*T+g*R+w*at,n[15]=p*P+x*E+g*Z+w*pt,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],s=t[8],n=t[12],r=t[1],a=t[5],o=t[9],c=t[13],h=t[2],u=t[6],l=t[10],d=t[14],y=t[3],m=t[7],z=t[11],b=t[15],p=o*d-c*l,x=a*d-c*u,g=a*l-o*u,w=r*d-c*h,B=r*l-o*h,_=r*u-a*h;return e*(m*p-z*x+b*g)-i*(y*p-z*w+b*B)+s*(y*x-m*w+b*_)-n*(y*g-m*B+z*_)}determinantAffine(){const t=this.elements,e=t[0],i=t[4],s=t[8],n=t[1],r=t[5],a=t[9],o=t[2],c=t[6],h=t[10];return e*(r*h-a*c)-i*(n*h-a*o)+s*(n*c-r*o)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],c=t[7],h=t[8],u=t[9],l=t[10],d=t[11],y=t[12],m=t[13],z=t[14],b=t[15],p=e*a-i*r,x=e*o-s*r,g=e*c-n*r,w=i*o-s*a,B=i*c-n*a,_=s*c-n*o,M=h*m-u*y,P=h*z-l*y,A=h*b-d*y,C=u*z-l*m,T=u*b-d*m,E=l*b-d*z,I=p*E-x*T+g*C+w*A-B*P+_*M;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const F=1/I;return t[0]=(a*E-o*T+c*C)*F,t[1]=(s*T-i*E-n*C)*F,t[2]=(m*_-z*B+b*w)*F,t[3]=(l*B-u*_-d*w)*F,t[4]=(o*A-r*E-c*P)*F,t[5]=(e*E-s*A+n*P)*F,t[6]=(z*g-y*_-b*x)*F,t[7]=(h*_-l*g+d*x)*F,t[8]=(r*T-a*A+c*M)*F,t[9]=(i*A-e*T-n*M)*F,t[10]=(y*B-m*g+b*p)*F,t[11]=(u*g-h*B-d*p)*F,t[12]=(a*P-r*C-o*M)*F,t[13]=(e*C-i*P+s*M)*F,t[14]=(m*x-y*w-z*p)*F,t[15]=(h*w-u*x+l*p)*F,this}scale(t){const e=this.elements,i=t.x,s=t.y,n=t.z;return e[0]*=i,e[4]*=s,e[8]*=n,e[1]*=i,e[5]*=s,e[9]*=n,e[2]*=i,e[6]*=s,e[10]*=n,e[3]*=i,e[7]*=s,e[11]*=n,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,s))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),s=Math.sin(e),n=1-i,r=t.x,a=t.y,o=t.z,c=n*r,h=n*a;return this.set(c*r+i,c*a-s*o,c*o+s*a,0,c*a+s*o,h*a+i,h*o-s*r,0,c*o-s*a,h*o+s*r,n*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,s,n,r){return this.set(1,i,n,0,t,1,r,0,e,s,1,0,0,0,0,1),this}compose(t,e,i){const s=this.elements,n=e._x,r=e._y,a=e._z,o=e._w,c=n+n,h=r+r,u=a+a,l=n*c,d=n*h,y=n*u,m=r*h,z=r*u,b=a*u,p=o*c,x=o*h,g=o*u,w=i.x,B=i.y,_=i.z;return s[0]=(1-(m+b))*w,s[1]=(d+g)*w,s[2]=(y-x)*w,s[3]=0,s[4]=(d-g)*B,s[5]=(1-(l+b))*B,s[6]=(z+p)*B,s[7]=0,s[8]=(y+x)*_,s[9]=(z-p)*_,s[10]=(1-(l+m))*_,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,i){const s=this.elements;t.x=s[12],t.y=s[13],t.z=s[14];const n=this.determinantAffine();if(n===0)return i.set(1,1,1),e.identity(),this;let r=$t.set(s[0],s[1],s[2]).length();const a=$t.set(s[4],s[5],s[6]).length(),o=$t.set(s[8],s[9],s[10]).length();n<0&&(r=-r),ct.copy(this);const c=1/r,h=1/a,u=1/o;return ct.elements[0]*=c,ct.elements[1]*=c,ct.elements[2]*=c,ct.elements[4]*=h,ct.elements[5]*=h,ct.elements[6]*=h,ct.elements[8]*=u,ct.elements[9]*=u,ct.elements[10]*=u,e.setFromRotationMatrix(ct),i.x=r,i.y=a,i.z=o,this}makePerspective(t,e,i,s,n,r,a=2e3,o=!1){const c=this.elements,h=2*n/(e-t),u=2*n/(i-s),l=(e+t)/(e-t),d=(i+s)/(i-s);let y,m;if(o)y=n/(r-n),m=r*n/(r-n);else if(a===2e3)y=-(r+n)/(r-n),m=-2*r*n/(r-n);else if(a===2001)y=-r/(r-n),m=-r*n/(r-n);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=l,c[12]=0,c[1]=0,c[5]=u,c[9]=d,c[13]=0,c[2]=0,c[6]=0,c[10]=y,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(t,e,i,s,n,r,a=2e3,o=!1){const c=this.elements,h=2/(e-t),u=2/(i-s),l=-(e+t)/(e-t),d=-(i+s)/(i-s);let y,m;if(o)y=1/(r-n),m=r/(r-n);else if(a===2e3)y=-2/(r-n),m=-(r+n)/(r-n);else if(a===2001)y=-1/(r-n),m=-n/(r-n);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=h,c[4]=0,c[8]=0,c[12]=l,c[1]=0,c[5]=u,c[9]=0,c[13]=d,c[2]=0,c[6]=0,c[10]=y,c[14]=m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let s=0;s<16;s++)if(e[s]!==i[s])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}};ui.prototype.isMatrix4=!0;let H=ui;const $t=new S,ct=new H,rn=new S(0,0,0),on=new S(1,1,1),Pt=new S,ke=new S,et=new S,ws=new H,bs=new pe;class Ue{constructor(t=0,e=0,i=0,s=Ue.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,s=this._order){return this._x=t,this._y=e,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const s=t.elements,n=s[0],r=s[4],a=s[8],o=s[1],c=s[5],h=s[9],u=s[2],l=s[6],d=s[10];switch(e){case"XYZ":this._y=Math.asin(V(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-r,n)):(this._x=Math.atan2(l,c),this._z=0);break;case"YXZ":this._x=Math.asin(-V(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,c)):(this._y=Math.atan2(-u,n),this._z=0);break;case"ZXY":this._x=Math.asin(V(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-r,c)):(this._y=0,this._z=Math.atan2(o,n));break;case"ZYX":this._y=Math.asin(-V(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(l,d),this._z=Math.atan2(o,n)):(this._x=0,this._z=Math.atan2(-r,c));break;case"YZX":this._z=Math.asin(V(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-u,n)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-V(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(l,c),this._y=Math.atan2(a,n)):(this._x=Math.atan2(-h,d),this._y=0);break;default:yt("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ws.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ws,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return bs.setFromEuler(this),this.setFromQuaternion(bs,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ue.DEFAULT_ORDER="XYZ";class an{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}}let cn=0;const zs=new S,Jt=new pe,gt=new H,Ne=new S,ge=new S,hn=new S,ln=new pe,_s=new S(1,0,0),Ms=new S(0,1,0),As=new S(0,0,1),Ss={type:"added"},un={type:"removed"},Gt={type:"childadded",child:null},bi={type:"childremoved",child:null};class Ct extends Ve{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:cn++}),this.uuid=Re(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ct.DEFAULT_UP.clone();const t=new S,e=new Ue,i=new pe,s=new S(1,1,1);function n(){i.setFromEuler(e,!1)}function r(){e.setFromQuaternion(i,void 0,!1)}e._onChange(n),i._onChange(r),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new H},normalMatrix:{value:new xt}}),this.matrix=new H,this.matrixWorld=new H,this.matrixAutoUpdate=Ct.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new an,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Jt.setFromAxisAngle(t,e),this.quaternion.multiply(Jt),this}rotateOnWorldAxis(t,e){return Jt.setFromAxisAngle(t,e),this.quaternion.premultiply(Jt),this}rotateX(t){return this.rotateOnAxis(_s,t)}rotateY(t){return this.rotateOnAxis(Ms,t)}rotateZ(t){return this.rotateOnAxis(As,t)}translateOnAxis(t,e){return zs.copy(t).applyQuaternion(this.quaternion),this.position.add(zs.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(_s,t)}translateY(t){return this.translateOnAxis(Ms,t)}translateZ(t){return this.translateOnAxis(As,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(gt.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Ne.copy(t):Ne.set(t,e,i);const s=this.parent;this.updateWorldMatrix(!0,!1),ge.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?gt.lookAt(ge,Ne,this.up):gt.lookAt(Ne,ge,this.up),this.quaternion.setFromRotationMatrix(gt),s&&(gt.extractRotation(s.matrixWorld),Jt.setFromRotationMatrix(gt),this.quaternion.premultiply(Jt.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(Ut("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Ss),Gt.child=t,this.dispatchEvent(Gt),Gt.child=null):Ut("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(un),bi.child=t,this.dispatchEvent(bi),bi.child=null),this}removeFromParent(){const t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),gt.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),gt.multiply(t.parent.matrixWorld)),t.applyMatrix4(gt),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Ss),Gt.child=t,this.dispatchEvent(Gt),Gt.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,s=this.children.length;i<s;i++){const r=this.children[i].getObjectByProperty(t,e);if(r!==void 0)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const s=this.children;for(let n=0,r=s.length;n<r;n++)s[n].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ge,t,hn),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ge,ln,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}intersectsFrustum(){}traverse(t){t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const t=this.pivot;if(t!==null){const e=t.x,i=t.y,s=t.z,n=this.matrix.elements;n[12]+=e-n[0]*e-n[4]*i-n[8]*s,n[13]+=i-n[1]*e-n[5]*i-n[9]*s,n[14]+=s-n[2]*e-n[6]*i-n[10]*s}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,s=e.length;i<s;i++)e[i].updateMatrixWorld(t)}updateWorldMatrix(t,e,i=!1){const s=this.parent;if(t===!0&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||i)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,i=!0),e===!0){const n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].updateWorldMatrix(!1,!0,i)}}toJSON(t){const e=t===void 0||typeof t=="string",i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,s.name=this.name,s.castShadow=this.castShadow,s.receiveShadow=this.receiveShadow,s.visible=this.visible,s.frustumCulled=this.frustumCulled,s.renderOrder=this.renderOrder,s.static=this.static,s.matrixAutoUpdate=this.matrixAutoUpdate,Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.pivot!==null&&(s.pivot=this.pivot.toArray()),this.morphTargetDictionary!==void 0&&(s.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(s.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.geometryInfo=this._geometryInfo.map(a=>({...a,boundingBox:a.boundingBox?a.boundingBox.toJSON():void 0,boundingSphere:a.boundingSphere?a.boundingSphere.toJSON():void 0})),s.instanceInfo=this._instanceInfo.map(a=>({...a})),s.availableInstanceIds=this._availableInstanceIds.slice(),s.availableGeometryIds=this._availableGeometryIds.slice(),s.nextIndexStart=this._nextIndexStart,s.nextVertexStart=this._nextVertexStart,s.geometryCount=this._geometryCount,s.maxInstanceCount=this._maxInstanceCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.matricesTexture=this._matricesTexture.toJSON(t),s.indirectTexture=this._indirectTexture.toJSON(t),this._colorsTexture!==null&&(s.colorsTexture=this._colorsTexture.toJSON(t)),this.boundingSphere!==null&&(s.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(s.boundingBox=this.boundingBox.toJSON()));function n(a,o){return a[o.uuid]===void 0&&(a[o.uuid]=o.toJSON(t)),o.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=n(t.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const o=a.shapes;if(Array.isArray(o))for(let c=0,h=o.length;c<h;c++){const u=o[c];n(t.shapes,u)}else n(t.shapes,o)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(n(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let o=0,c=this.material.length;o<c;o++)a.push(n(t.materials,this.material[o]));s.material=a}else s.material=n(t.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const o=this.animations[a];s.animations.push(n(t.animations,o))}}if(e){const a=r(t.geometries),o=r(t.materials),c=r(t.textures),h=r(t.images),u=r(t.shapes),l=r(t.skeletons),d=r(t.animations),y=r(t.nodes);a.length>0&&(i.geometries=a),o.length>0&&(i.materials=o),c.length>0&&(i.textures=c),h.length>0&&(i.images=h),u.length>0&&(i.shapes=u),l.length>0&&(i.skeletons=l),d.length>0&&(i.animations=d),y.length>0&&(i.nodes=y)}return i.object=s,i;function r(a){const o=[];for(const c in a){const h=a[c];delete h.metadata,o.push(h)}return o}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.pivot=t.pivot!==null?t.pivot.clone():null,this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let i=0;i<t.children.length;i++){const s=t.children[i];this.add(s.clone())}return this}dispose(){this.dispatchEvent({type:"dispose"})}}Ct.DEFAULT_UP=new S(0,1,0),Ct.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ht=new S,wt=new S,zi=new S,bt=new S,Qt=new S,jt=new S,Bs=new S,_i=new S,Mi=new S,Ai=new S,Si=new xe,Bi=new xe,Ti=new xe;class st{constructor(t=new S,e=new S,i=new S){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,s){s.subVectors(i,e),ht.subVectors(t,e),s.cross(ht);const n=s.lengthSq();return n>0?s.multiplyScalar(1/Math.sqrt(n)):s.set(0,0,0)}static getBarycoord(t,e,i,s,n){ht.subVectors(s,e),wt.subVectors(i,e),zi.subVectors(t,e);const r=ht.dot(ht),a=ht.dot(wt),o=ht.dot(zi),c=wt.dot(wt),h=wt.dot(zi),u=r*c-a*a;if(u===0)return n.set(0,0,0),null;const l=1/u,d=(c*o-a*h)*l,y=(r*h-a*o)*l;return n.set(1-d-y,y,d)}static containsPoint(t,e,i,s){return this.getBarycoord(t,e,i,s,bt)===null?!1:bt.x>=0&&bt.y>=0&&bt.x+bt.y<=1}static getInterpolation(t,e,i,s,n,r,a,o){return this.getBarycoord(t,e,i,s,bt)===null?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(n,bt.x),o.addScaledVector(r,bt.y),o.addScaledVector(a,bt.z),o)}static getInterpolatedAttribute(t,e,i,s,n,r){return Si.setScalar(0),Bi.setScalar(0),Ti.setScalar(0),Si.fromBufferAttribute(t,e),Bi.fromBufferAttribute(t,i),Ti.fromBufferAttribute(t,s),r.setScalar(0),r.addScaledVector(Si,n.x),r.addScaledVector(Bi,n.y),r.addScaledVector(Ti,n.z),r}static isFrontFacing(t,e,i,s){return ht.subVectors(i,e),wt.subVectors(t,e),ht.cross(wt).dot(s)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,s){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,i,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ht.subVectors(this.c,this.b),wt.subVectors(this.a,this.b),ht.cross(wt).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return st.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return st.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,s,n){return st.getInterpolation(t,this.a,this.b,this.c,e,i,s,n)}containsPoint(t){return st.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return st.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,s=this.b,n=this.c;let r,a;Qt.subVectors(s,i),jt.subVectors(n,i),_i.subVectors(t,i);const o=Qt.dot(_i),c=jt.dot(_i);if(o<=0&&c<=0)return e.copy(i);Mi.subVectors(t,s);const h=Qt.dot(Mi),u=jt.dot(Mi);if(h>=0&&u<=h)return e.copy(s);const l=o*u-h*c;if(l<=0&&o>=0&&h<=0)return r=o/(o-h),e.copy(i).addScaledVector(Qt,r);Ai.subVectors(t,n);const d=Qt.dot(Ai),y=jt.dot(Ai);if(y>=0&&d<=y)return e.copy(n);const m=d*c-o*y;if(m<=0&&c>=0&&y<=0)return a=c/(c-y),e.copy(i).addScaledVector(jt,a);const z=h*y-d*u;if(z<=0&&u-h>=0&&d-y>=0)return Bs.subVectors(n,s),a=(u-h)/(u-h+(d-y)),e.copy(s).addScaledVector(Bs,a);const b=1/(z+m+l);return r=m*b,a=l*b,e.copy(i).addScaledVector(Qt,r).addScaledVector(jt,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class Q{constructor(t=new S(1/0,1/0,1/0),e=new S(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(lt.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(lt.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=lt.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(i!==void 0){const n=i.getAttribute("position");if(e===!0&&n!==void 0&&t.isInstancedMesh!==!0)for(let r=0,a=n.count;r<a;r++)t.isMesh===!0?t.getVertexPosition(r,lt):lt.fromBufferAttribute(n,r),lt.applyMatrix4(t.matrixWorld),this.expandByPoint(lt);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Le.copy(t.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Le.copy(i.boundingBox)),Le.applyMatrix4(t.matrixWorld),this.union(Le)}const s=t.children;for(let n=0,r=s.length;n<r;n++)this.expandByObject(s[n],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,lt),lt.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(we),De.subVectors(this.max,we),Kt.subVectors(t.a,we),te.subVectors(t.b,we),ee.subVectors(t.c,we),Et.subVectors(te,Kt),It.subVectors(ee,te),Lt.subVectors(Kt,ee);let e=[0,-Et.z,Et.y,0,-It.z,It.y,0,-Lt.z,Lt.y,Et.z,0,-Et.x,It.z,0,-It.x,Lt.z,0,-Lt.x,-Et.y,Et.x,0,-It.y,It.x,0,-Lt.y,Lt.x,0];return!Pi(e,Kt,te,ee,De)||(e=[1,0,0,0,1,0,0,0,1],!Pi(e,Kt,te,ee,De))?!1:(qe.crossVectors(Et,It),e=[qe.x,qe.y,qe.z],Pi(e,Kt,te,ee,De))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,lt).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(lt).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(zt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zt),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const zt=[new S,new S,new S,new S,new S,new S,new S,new S],lt=new S,Le=new Q,Kt=new S,te=new S,ee=new S,Et=new S,It=new S,Lt=new S,we=new S,De=new S,qe=new S,Dt=new S;function Pi(f,t,e,i,s){for(let n=0,r=f.length-3;n<=r;n+=3){Dt.fromArray(f,n);const a=s.x*Math.abs(Dt.x)+s.y*Math.abs(Dt.y)+s.z*Math.abs(Dt.z),o=t.dot(Dt),c=e.dot(Dt),h=i.dot(Dt);if(Math.max(-Math.max(o,c,h),Math.min(o,c,h))>a)return!1}return!0}const L=new S,ve=new Y;let fn=0;class mt extends Ve{constructor(t,e,i=!1){if(super(),Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:fn++}),this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=i,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let s=0,n=this.itemSize;s<n;s++)this.array[t+s]=e.array[i+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)ve.fromBufferAttribute(this,e),ve.applyMatrix3(t),this.setXY(e,ve.x,ve.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)L.fromBufferAttribute(this,e),L.applyMatrix3(t),this.setXYZ(e,L.x,L.y,L.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)L.fromBufferAttribute(this,e),L.applyMatrix4(t),this.setXYZ(e,L.x,L.y,L.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)L.fromBufferAttribute(this,e),L.applyNormalMatrix(t),this.setXYZ(e,L.x,L.y,L.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)L.fromBufferAttribute(this,e),L.transformDirection(t),this.setXYZ(e,L.x,L.y,L.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=me(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=K(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=me(e,this.array)),e}setX(t,e){return this.normalized&&(e=K(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=me(e,this.array)),e}setY(t,e){return this.normalized&&(e=K(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=me(e,this.array)),e}setZ(t,e){return this.normalized&&(e=K(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=me(e,this.array)),e}setW(t,e){return this.normalized&&(e=K(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=K(e,this.array),i=K(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,s){return t*=this.itemSize,this.normalized&&(e=K(e,this.array),i=K(i,this.array),s=K(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this}setXYZW(t,e,i,s,n){return t*=this.itemSize,this.normalized&&(e=K(e,this.array),i=K(i,this.array),s=K(s,this.array),n=K(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=s,this.array[t+3]=n,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return t.name=this.name,t.usage=this.usage,t.gpuType=this.gpuType,t}dispose(){this.dispatchEvent({type:"dispose"})}}class dn extends mt{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class yn extends mt{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class mn extends mt{constructor(t,e,i){super(new Float32Array(t),e,i)}}const pn=new Q,be=new S,Ci=new S;class xn{constructor(t=new S,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;e!==void 0?i.copy(e):pn.setFromPoints(t).getCenter(i);let s=0;for(let n=0,r=t.length;n<r;n++)s=Math.max(s,i.distanceToSquared(t[n]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;be.subVectors(t,this.center);const e=be.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),s=(i-this.radius)*.5;this.center.addScaledVector(be,s/i),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Ci.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(be.copy(t.center).add(Ci)),this.expandByPoint(be.copy(t.center).sub(Ci))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let gn=0;const nt=new H,Ei=new Ct,ie=new S,it=new Q,ze=new Q,W=new S;class Ii extends Ve{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:gn++}),this.uuid=Re(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={},this._transformed=!1}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(Ks(t)?yn:dn)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const n=new xt().getNormalMatrix(t);i.applyNormalMatrix(n),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this._transformed=!0,this}applyQuaternion(t){return nt.makeRotationFromQuaternion(t),this.applyMatrix4(nt),this}rotateX(t){return nt.makeRotationX(t),this.applyMatrix4(nt),this}rotateY(t){return nt.makeRotationY(t),this.applyMatrix4(nt),this}rotateZ(t){return nt.makeRotationZ(t),this.applyMatrix4(nt),this}translate(t,e,i){return nt.makeTranslation(t,e,i),this.applyMatrix4(nt),this}scale(t,e,i){return nt.makeScale(t,e,i),this.applyMatrix4(nt),this}lookAt(t){return Ei.lookAt(t),Ei.updateMatrix(),this.applyMatrix4(Ei.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ie).negate(),this.translate(ie.x,ie.y,ie.z),this}setFromPoints(t){const e=this.getAttribute("position");if(e===void 0){const i=[];for(let s=0,n=t.length;s<n;s++){const r=t[s];i.push(r.x,r.y,r.z||0)}this.setAttribute("position",new mn(i,3))}else{const i=Math.min(t.length,e.count);for(let s=0;s<i;s++){const n=t[s];e.setXYZ(s,n.x,n.y,n.z||0)}t.length>e.count&&yt("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Q);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ut("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new S(-1/0,-1/0,-1/0),new S(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let i=0,s=e.length;i<s;i++){const n=e[i];it.setFromBufferAttribute(n),this.morphTargetsRelative?(W.addVectors(this.boundingBox.min,it.min),this.boundingBox.expandByPoint(W),W.addVectors(this.boundingBox.max,it.max),this.boundingBox.expandByPoint(W)):(this.boundingBox.expandByPoint(it.min),this.boundingBox.expandByPoint(it.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ut('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new xn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){Ut("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new S,1/0);return}if(t){const i=this.boundingSphere.center;if(it.setFromBufferAttribute(t),e)for(let n=0,r=e.length;n<r;n++){const a=e[n];ze.setFromBufferAttribute(a),this.morphTargetsRelative?(W.addVectors(it.min,ze.min),it.expandByPoint(W),W.addVectors(it.max,ze.max),it.expandByPoint(W)):(it.expandByPoint(ze.min),it.expandByPoint(ze.max))}it.getCenter(i);let s=0;for(let n=0,r=t.count;n<r;n++)W.fromBufferAttribute(t,n),s=Math.max(s,i.distanceToSquared(W));if(e)for(let n=0,r=e.length;n<r;n++){const a=e[n],o=this.morphTargetsRelative;for(let c=0,h=a.count;c<h;c++)W.fromBufferAttribute(a,c),o&&(ie.fromBufferAttribute(t,c),W.add(ie)),s=Math.max(s,i.distanceToSquared(W))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&Ut('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){Ut("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.position,s=e.normal,n=e.uv;let r=this.getAttribute("tangent");(r===void 0||r.count!==i.count)&&(r=new mt(new Float32Array(4*i.count),4),this.setAttribute("tangent",r));const a=[],o=[];for(let M=0;M<i.count;M++)a[M]=new S,o[M]=new S;const c=new S,h=new S,u=new S,l=new Y,d=new Y,y=new Y,m=new S,z=new S;function b(M,P,A){c.fromBufferAttribute(i,M),h.fromBufferAttribute(i,P),u.fromBufferAttribute(i,A),l.fromBufferAttribute(n,M),d.fromBufferAttribute(n,P),y.fromBufferAttribute(n,A),h.sub(c),u.sub(c),d.sub(l),y.sub(l);const C=1/(d.x*y.y-y.x*d.y);isFinite(C)&&(m.copy(h).multiplyScalar(y.y).addScaledVector(u,-d.y).multiplyScalar(C),z.copy(u).multiplyScalar(d.x).addScaledVector(h,-y.x).multiplyScalar(C),a[M].add(m),a[P].add(m),a[A].add(m),o[M].add(z),o[P].add(z),o[A].add(z))}let p=this.groups;p.length===0&&(p=[{start:0,count:t.count}]);for(let M=0,P=p.length;M<P;++M){const A=p[M],C=A.start,T=A.count;for(let E=C,I=C+T;E<I;E+=3)b(t.getX(E+0),t.getX(E+1),t.getX(E+2))}const x=new S,g=new S,w=new S,B=new S;function _(M){w.fromBufferAttribute(s,M),B.copy(w);const P=a[M];x.copy(P),x.sub(w.multiplyScalar(w.dot(P))).normalize(),g.crossVectors(B,P);const C=g.dot(o[M])<0?-1:1;r.setXYZW(M,x.x,x.y,x.z,C)}for(let M=0,P=p.length;M<P;++M){const A=p[M],C=A.start,T=A.count;for(let E=C,I=C+T;E<I;E+=3)_(t.getX(E+0)),_(t.getX(E+1)),_(t.getX(E+2))}this._transformed=!0}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0||i.count!==e.count)i=new mt(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let l=0,d=i.count;l<d;l++)i.setXYZ(l,0,0,0);const s=new S,n=new S,r=new S,a=new S,o=new S,c=new S,h=new S,u=new S;if(t)for(let l=0,d=t.count;l<d;l+=3){const y=t.getX(l+0),m=t.getX(l+1),z=t.getX(l+2);s.fromBufferAttribute(e,y),n.fromBufferAttribute(e,m),r.fromBufferAttribute(e,z),h.subVectors(r,n),u.subVectors(s,n),h.cross(u),a.fromBufferAttribute(i,y),o.fromBufferAttribute(i,m),c.fromBufferAttribute(i,z),a.add(h),o.add(h),c.add(h),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(m,o.x,o.y,o.z),i.setXYZ(z,c.x,c.y,c.z)}else for(let l=0,d=e.count;l<d;l+=3)s.fromBufferAttribute(e,l+0),n.fromBufferAttribute(e,l+1),r.fromBufferAttribute(e,l+2),h.subVectors(r,n),u.subVectors(s,n),h.cross(u),i.setXYZ(l+0,h.x,h.y,h.z),i.setXYZ(l+1,h.x,h.y,h.z),i.setXYZ(l+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)W.fromBufferAttribute(t,e),W.normalize(),t.setXYZ(e,W.x,W.y,W.z)}toNonIndexed(){function t(a,o){const c=a.array,h=a.itemSize,u=a.normalized,l=new c.constructor(o.length*h);let d=0,y=0;for(let m=0,z=o.length;m<z;m++){a.isInterleavedBufferAttribute?d=o[m]*a.data.stride+a.offset:d=o[m]*h;for(let b=0;b<h;b++)l[y++]=c[d++]}return new mt(l,h,u)}if(this.index===null)return yt("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ii,i=this.index.array,s=this.attributes;for(const a in s){const o=s[a],c=t(o,i);e.setAttribute(a,c)}const n=this.morphAttributes;for(const a in n){const o=[],c=n[a];for(let h=0,u=c.length;h<u;h++){const l=c[h],d=t(l,i);o.push(d)}e.morphAttributes[a]=o}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let a=0,o=r.length;a<o;a++){const c=r[a];e.addGroup(c.start,c.count,c.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.parameters!==void 0&&this._transformed===!0?"BufferGeometry":this.type,t.name=this.name,Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0&&this._transformed!==!0){const o=this.parameters;for(const c in o)o[c]!==void 0&&(t[c]=o[c]);return t}t.data={attributes:{}};const e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const o in i){const c=i[o];t.data.attributes[o]=c.toJSON(t.data)}const s={};let n=!1;for(const o in this.morphAttributes){const c=this.morphAttributes[o],h=[];for(let u=0,l=c.length;u<l;u++){const d=c[u];h.push(d.toJSON(t.data))}h.length>0&&(s[o]=h,n=!0)}n&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return a!==null&&(t.data.boundingSphere=a.toJSON()),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;i!==null&&this.setIndex(i.clone());const s=t.attributes;for(const c in s){const h=s[c];this.setAttribute(c,h.clone(e))}const n=t.morphAttributes;for(const c in n){const h=[],u=n[c];for(let l=0,d=u.length;l<d;l++)h.push(u[l].clone(e));this.morphAttributes[c]=h}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let c=0,h=r.length;c<h;c++){const u=r[c];this.addGroup(u.start,u.count,u.materialIndex)}const a=t.boundingBox;a!==null&&(this.boundingBox=a.clone());const o=t.boundingSphere;return o!==null&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this._transformed=t._transformed,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Fi=new S,wn=new S,bn=new xt;class Ts{constructor(t=new S(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,s){return this.normal.set(t,e,i),this.constant=s,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const s=Fi.subVectors(i,e).cross(wn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(s,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e,i=!0){const s=t.delta(Fi),n=this.normal.dot(s);if(n===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return i===!0&&(r<0||r>1)?null:e.copy(t.start).addScaledVector(s,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||bn.getNormalMatrix(t),s=this.coplanarPoint(Fi).applyMatrix4(t),n=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(n),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}toJSON(){return{normal:this.normal.toArray(),constant:this.constant}}fromJSON(t){return this.normal.fromArray(t.normal),this.constant=t.constant,this}}const _t=new S,Vi=new S,Oe=new S,We=new S;class zn{constructor(t=new S,e=new S(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,_t)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=_t.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(_t.copy(this.origin).addScaledVector(this.direction,e),_t.distanceToSquared(t))}distanceSqToSegment(t,e,i,s){Vi.copy(t).add(e).multiplyScalar(.5),Oe.copy(e).sub(t).normalize(),We.copy(this.origin).sub(Vi);const n=t.distanceTo(e)*.5,r=-this.direction.dot(Oe),a=We.dot(this.direction),o=-We.dot(Oe),c=We.lengthSq(),h=Math.abs(1-r*r);let u,l,d,y;if(h>0)if(u=r*o-a,l=r*a-o,y=n*h,u>=0)if(l>=-y)if(l<=y){const m=1/h;u*=m,l*=m,d=u*(u+r*l+2*a)+l*(r*u+l+2*o)+c}else l=n,u=Math.max(0,-(r*l+a)),d=-u*u+l*(l+2*o)+c;else l=-n,u=Math.max(0,-(r*l+a)),d=-u*u+l*(l+2*o)+c;else l<=-y?(u=Math.max(0,-(-r*n+a)),l=u>0?-n:Math.min(Math.max(-n,-o),n),d=-u*u+l*(l+2*o)+c):l<=y?(u=0,l=Math.min(Math.max(-n,-o),n),d=l*(l+2*o)+c):(u=Math.max(0,-(r*n+a)),l=u>0?n:Math.min(Math.max(-n,-o),n),d=-u*u+l*(l+2*o)+c);else l=r>0?-n:n,u=Math.max(0,-(r*l+a)),d=-u*u+l*(l+2*o)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,u),s&&s.copy(Vi).addScaledVector(Oe,l),d}intersectSphere(t,e){if(t.radius<0)return null;_t.subVectors(t.center,this.origin);const i=_t.dot(this.direction),s=_t.dot(_t)-i*i,n=t.radius*t.radius;if(s>n)return null;const r=Math.sqrt(n-s),a=i-r,o=i+r;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return t.radius<0?!1:this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return i===null?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,s,n,r,a,o;const c=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,l=this.origin;return c>=0?(i=(t.min.x-l.x)*c,s=(t.max.x-l.x)*c):(i=(t.max.x-l.x)*c,s=(t.min.x-l.x)*c),h>=0?(n=(t.min.y-l.y)*h,r=(t.max.y-l.y)*h):(n=(t.max.y-l.y)*h,r=(t.min.y-l.y)*h),i>r||n>s||((n>i||isNaN(i))&&(i=n),(r<s||isNaN(s))&&(s=r),u>=0?(a=(t.min.z-l.z)*u,o=(t.max.z-l.z)*u):(a=(t.max.z-l.z)*u,o=(t.min.z-l.z)*u),i>o||a>s)||((a>i||i!==i)&&(i=a),(o<s||s!==s)&&(s=o),s<0)?null:this.at(i>=0?i:s,e)}intersectsBox(t){return this.intersectBox(t,_t)!==null}intersectTriangle(t,e,i,s,n){const r=this.origin,a=this.direction,o=a.x,c=a.y,h=a.z,u=t.x-r.x,l=t.y-r.y,d=t.z-r.z,y=e.x-r.x,m=e.y-r.y,z=e.z-r.z,b=i.x-r.x,p=i.y-r.y,x=i.z-r.z,g=Math.abs(o),w=Math.abs(c),B=Math.abs(h);let _,M,P,A,C,T,E,I,F,R,Z,tt;if(g>=w&&g>=B?(P=o,T=u,F=y,tt=b,o>=0?(_=c,M=h,A=l,C=d,E=m,I=z,R=p,Z=x):(_=h,M=c,A=d,C=l,E=z,I=m,R=x,Z=p)):w>=B?(P=c,T=l,F=m,tt=p,c>=0?(_=h,M=o,A=d,C=u,E=z,I=y,R=x,Z=b):(_=o,M=h,A=u,C=d,E=y,I=z,R=b,Z=x)):(P=h,T=d,F=z,tt=x,h>=0?(_=o,M=c,A=u,C=l,E=y,I=m,R=b,Z=p):(_=c,M=o,A=l,C=u,E=m,I=y,R=p,Z=b)),P===0)return null;const dt=_/P,at=M/P,pt=1/P,ye=A-dt*T,Ie=C-at*T,ys=E-dt*F,Tt=I-at*F,fi=R-dt*tt,di=Z-at*tt,Wt=fi*Tt-di*ys,Xt=ye*di-Ie*fi,Yt=ys*Ie-Tt*ye;if(s){if(Wt<0||Xt<0||Yt<0)return null}else if((Wt<0||Xt<0||Yt<0)&&(Wt>0||Xt>0||Yt>0))return null;const Fe=Wt+Xt+Yt;if(Fe===0)return null;const Ht=pt*(Wt*T+Xt*F+Yt*tt);return(Fe>0?Ht<0:Ht>0)?null:this.at(Ht/Fe,n)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}const ds=class ds{constructor(t,e,i,s){this.elements=[1,0,0,1],t!==void 0&&this.set(t,e,i,s)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let i=0;i<4;i++)this.elements[i]=t[i+e];return this}set(t,e,i,s){const n=this.elements;return n[0]=t,n[2]=e,n[1]=i,n[3]=s,this}};ds.prototype.isMatrix2=!0;let Ps=ds;const Cs=new S,Xe=new S,se=new S,ne=new S,Ri=new S,_n=new S,Mn=new S;class Mt{constructor(t=new S,e=new S){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Cs.subVectors(t,this.start),Xe.subVectors(this.end,this.start);const i=Xe.dot(Xe);if(i===0)return 0;let n=Xe.dot(Cs)/i;return e&&(n=V(n,0,1)),n}closestPointToPoint(t,e,i){const s=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(s).add(this.start)}distanceSqToLine3(t,e=_n,i=Mn){const s=10000000000000001e-32;let n,r;const a=this.start,o=t.start,c=this.end,h=t.end;se.subVectors(c,a),ne.subVectors(h,o),Ri.subVectors(a,o);const u=se.dot(se),l=ne.dot(ne),d=ne.dot(Ri);if(u<=s&&l<=s)return e.copy(a),i.copy(o),e.sub(i),e.dot(e);if(u<=s)n=0,r=d/l,r=V(r,0,1);else{const y=se.dot(Ri);if(l<=s)r=0,n=V(-y/u,0,1);else{const m=se.dot(ne),z=u*l-m*m;z!==0?n=V((m*d-y*l)/z,0,1):n=0,r=(m*n+d)/l,r<0?(r=0,n=V(-y/u,0,1)):r>1&&(r=1,n=V((m-y)/u,0,1))}}return e.copy(a).addScaledVector(se,n),i.copy(o).addScaledVector(ne,r),e.distanceToSquared(i)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"186"}})),typeof window<"u"&&(window.__THREE__?yt("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="186");new xt().set(-1,0,0,0,1,0,0,0,1),new xt().set(-1,0,0,0,1,0,0,0,1);const Es=0,An=1,Sn=2,Is=2,ki=1.25,Fs=1,J=32,q=J/4,Vs=65535,Ye=Math.pow(2,-24),Ui=Symbol("SKIP_GENERATION"),Rs={strategy:Es,maxDepth:40,targetLeafSize:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null,[Ui]:!1};function U(f,t,e){return e.min.x=t[f],e.min.y=t[f+1],e.min.z=t[f+2],e.max.x=t[f+3],e.max.y=t[f+4],e.max.z=t[f+5],e}function Ni(f){let t=-1,e=-1/0;for(let i=0;i<3;i++){const s=f[i+3]-f[i];s>e&&(e=s,t=i)}return t}function ks(f,t){t.set(f)}function Us(f,t,e){let i,s;for(let n=0;n<3;n++){const r=n+3;i=f[n],s=t[n],e[n]=i<s?i:s,i=f[r],s=t[r],e[r]=i>s?i:s}}function He(f,t,e){for(let i=0;i<3;i++){const s=t[f+2*i],n=t[f+2*i+1],r=s-n,a=s+n;r<e[i]&&(e[i]=r),a>e[i+3]&&(e[i+3]=a)}}function _e(f){const t=f[3]-f[0],e=f[4]-f[1],i=f[5]-f[2];return 2*(t*e+e*i+i*t)}function N(f,t){return t[f+15]===Vs}function X(f,t){return t[f+6]}function G(f,t){return t[f+14]}function v(f){return f+q}function O(f,t){const e=t[f+6];return f+e*q}function Li(f,t){return t[f+7]}function Wr(f){return f}function Di(f,t,e,i,s){let n=1/0,r=1/0,a=1/0,o=-1/0,c=-1/0,h=-1/0,u=1/0,l=1/0,d=1/0,y=-1/0,m=-1/0,z=-1/0;const b=f.offset||0;for(let p=(t-b)*6,x=(t+e-b)*6;p<x;p+=6){const g=f[p+0],w=f[p+1],B=g-w,_=g+w;B<n&&(n=B),_>o&&(o=_),g<u&&(u=g),g>y&&(y=g);const M=f[p+2],P=f[p+3],A=M-P,C=M+P;A<r&&(r=A),C>c&&(c=C),M<l&&(l=M),M>m&&(m=M);const T=f[p+4],E=f[p+5],I=T-E,F=T+E;I<a&&(a=I),F>h&&(h=F),T<d&&(d=T),T>z&&(z=T)}i[0]=n,i[1]=r,i[2]=a,i[3]=o,i[4]=c,i[5]=h,s[0]=u,s[1]=l,s[2]=d,s[3]=y,s[4]=m,s[5]=z}const At=32,Bn=(f,t)=>f.candidate-t.candidate,Ft=new Array(At).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),Ze=new Float32Array(6);function Tn(f,t,e,i,s,n){let r=-1,a=0;if(n===Es)r=Ni(t),r!==-1&&(a=(t[r]+t[r+3])/2);else if(n===An)r=Ni(f),r!==-1&&(a=Pn(e,i,s,r));else if(n===Sn){const o=_e(f);let c=ki*s;const h=e.offset||0,u=(i-h)*6,l=(i+s-h)*6;for(let d=0;d<3;d++){const y=t[d],b=(t[d+3]-y)/At;if(s<At/4){const p=[...Ft];p.length=s;let x=0;for(let w=u;w<l;w+=6,x++){const B=p[x];B.candidate=e[w+2*d],B.count=0;const{bounds:_,leftCacheBounds:M,rightCacheBounds:P}=B;for(let A=0;A<3;A++)P[A]=1/0,P[A+3]=-1/0,M[A]=1/0,M[A+3]=-1/0,_[A]=1/0,_[A+3]=-1/0;He(w,e,_)}p.sort(Bn);let g=s;for(let w=0;w<g;w++){const B=p[w];for(;w+1<g&&p[w+1].candidate===B.candidate;)p.splice(w+1,1),g--}for(let w=u;w<l;w+=6){const B=e[w+2*d];for(let _=0;_<g;_++){const M=p[_];B>=M.candidate?He(w,e,M.rightCacheBounds):(He(w,e,M.leftCacheBounds),M.count++)}}for(let w=0;w<g;w++){const B=p[w],_=B.count,M=s-B.count,P=B.leftCacheBounds,A=B.rightCacheBounds;let C=0;_!==0&&(C=_e(P)/o);let T=0;M!==0&&(T=_e(A)/o);const E=Fs+ki*(C*_+T*M);E<c&&(r=d,c=E,a=B.candidate)}}else{for(let g=0;g<At;g++){const w=Ft[g];w.count=0,w.candidate=y+b+g*b;const B=w.bounds;for(let _=0;_<3;_++)B[_]=1/0,B[_+3]=-1/0}for(let g=u;g<l;g+=6){let _=~~((e[g+2*d]-y)/b);_>=At&&(_=At-1);const M=Ft[_];M.count++,He(g,e,M.bounds)}const p=Ft[At-1];ks(p.bounds,p.rightCacheBounds);for(let g=At-2;g>=0;g--){const w=Ft[g],B=Ft[g+1];Us(w.bounds,B.rightCacheBounds,w.rightCacheBounds)}let x=0;for(let g=0;g<At-1;g++){const w=Ft[g],B=w.count,_=w.bounds,P=Ft[g+1].rightCacheBounds;B!==0&&(x===0?ks(_,Ze):Us(_,Ze,Ze)),x+=B;let A=0,C=0;x!==0&&(A=_e(Ze)/o);const T=s-x;T!==0&&(C=_e(P)/o);const E=Fs+ki*(A*x+C*T);E<c&&(r=d,c=E,a=w.candidate)}}}}else console.warn(\`BVH: Invalid build strategy value \${n} used.\`);return{axis:r,pos:a}}function Pn(f,t,e,i){let s=0;const n=f.offset;for(let r=t,a=t+e;r<a;r++)s+=f[(r-n)*6+i*2];return s/e}class qi{constructor(){this.boundingData=new Float32Array(6)}}function Cn(f,t,e,i,s,n){let r=i,a=i+s-1;const o=n.pos,c=n.axis*2,h=e.offset||0;for(;;){for(;r<=a&&e[(r-h)*6+c]<o;)r++;for(;r<=a&&e[(a-h)*6+c]>=o;)a--;if(r<a){for(let u=0;u<t;u++){let l=f[r*t+u];f[r*t+u]=f[a*t+u],f[a*t+u]=l}for(let u=0;u<6;u++){const l=r-h,d=a-h,y=e[l*6+u];e[l*6+u]=e[d*6+u],e[d*6+u]=y}r++,a--}else return r}}let Ns,$e,vi,Ls;const En=Math.pow(2,32);function Oi(f){return"count"in f?1:1+Oi(f.left)+Oi(f.right)}function In(f,t,e){return Ns=new Float32Array(e),$e=new Uint32Array(e),vi=new Uint16Array(e),Ls=new Uint8Array(e),Wi(f,t)}function Wi(f,t){const e=f/4,i=f/2,s="count"in t,n=t.boundingData;for(let r=0;r<6;r++)Ns[e+r]=n[r];if(s)return t.buffer?(Ls.set(new Uint8Array(t.buffer),f),f+t.buffer.byteLength):($e[e+6]=t.offset,vi[i+14]=t.count,vi[i+15]=Vs,f+J);{const{left:r,right:a,splitAxis:o}=t,c=f+J;let h=Wi(c,r);const u=f/J,d=h/J-u;if(d>En)throw new Error("MeshBVH: Cannot store relative child node offset greater than 32 bits.");return $e[e+6]=d,$e[e+7]=o,Wi(h,a)}}function Fn(f,t,e,i,s,n){const{maxDepth:r,verbose:a,targetLeafSize:o,_strictLeafSize:c=1/0,strategy:h,onProgress:u}=s,l=f.primitiveBuffer,d=f.primitiveBufferStride,y=new Float32Array(6);let m=!1;const z=new qi;return Di(t,e,i,z.boundingData,y),p(z,e,i,y),z;function b(x){u&&u((x-n.offset)/n.count)}function p(x,g,w,B=null,_=0){!m&&_>=r&&(m=!0,a&&console.warn(\`BVH: Max depth of \${r} reached when generating BVH. Consider increasing maxDepth.\`));const M=w>c;if(w<=o&&!M||_>=r)return b(g+w),x.offset=g,x.count=w,x;const P=Tn(x.boundingData,B,t,g,w,h);let A=P.axis===-1?-1:Cn(l,d,t,g,w,P);if(P.axis===-1||A===g||A===g+w){if(!M)return b(g+w),x.offset=g,x.count=w,x;P.axis=Math.max(0,Ni(x.boundingData)),A=g+Math.max(1,Math.floor(w/2))}x.splitAxis=P.axis;const C=new qi,T=g,E=A-g;x.left=C,Di(t,T,E,C.boundingData,y),p(C,T,E,y,_+1);const I=new qi,F=A,R=w-E;return x.right=I,Di(t,F,R,I.boundingData,y),p(I,F,R,y,_+1),x}}function Vn(f,t){const e=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=f.getRootRanges(t.range),s=i[0],n=i[i.length-1],r={offset:s.offset,count:n.offset+n.count-s.offset},a=new Float32Array(6*r.count);a.offset=r.offset,f.computePrimitiveBounds(r.offset,r.count,a),f._roots=i.map(o=>{const c=Fn(f,a,o.offset,o.count,t,r),h=Oi(c),u=new e(J*h);return In(0,c,u),u})}class Xi{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){const t=this._primitives;return t.length===0?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}}class Rn{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const t=[];let e=null;this.setBuffer=i=>{e&&t.push(e),e=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{e=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,t.length!==0&&this.setBuffer(t.pop())}}}const k=new Rn;let Vt,re;const oe=[],Je=new Xi(()=>new Q);function kn(f,t,e,i,s,n){Vt=Je.getPrimitive(),re=Je.getPrimitive(),oe.push(Vt,re),k.setBuffer(f._roots[t]);const r=Yi(0,f.geometry,e,i,s,n);k.clearBuffer(),Je.releasePrimitive(Vt),Je.releasePrimitive(re),oe.pop(),oe.pop();const a=oe.length;return a>0&&(re=oe[a-1],Vt=oe[a-2]),r}function Yi(f,t,e,i,s=null,n=0,r=0){const{float32Array:a,uint16Array:o,uint32Array:c}=k;let h=f*2;if(N(h,o)){const l=X(f,c),d=G(h,o);return U(f,a,Vt),i(l,d,!1,r,n+f/q,Vt)}else{let A=function(T){const{uint16Array:E,uint32Array:I}=k;let F=T*2;for(;!N(F,E);)T=v(T),F=T*2;return X(T,I)},C=function(T){const{uint16Array:E,uint32Array:I}=k;let F=T*2;for(;!N(F,E);)T=O(T,I),F=T*2;return X(T,I)+G(F,E)};const l=v(f),d=O(f,c);let y=l,m=d,z,b,p,x;if(s&&(p=Vt,x=re,U(y,a,p),U(m,a,x),z=s(p),b=s(x),b<z)){y=d,m=l;const T=z;z=b,b=T,p=x}p||(p=Vt,U(y,a,p));const g=N(y*2,o),w=e(p,g,z,r+1,n+y/q);let B;if(w===Is){const T=A(y),I=C(y)-T;B=i(T,I,!0,r+1,n+y/q,p)}else B=w&&Yi(y,t,e,i,s,n,r+1);if(B)return!0;x=re,U(m,a,x);const _=N(m*2,o),M=e(x,_,b,r+1,n+m/q);let P;if(M===Is){const T=A(m),I=C(m)-T;P=i(T,I,!0,r+1,n+m/q,x)}else P=M&&Yi(m,t,e,i,s,n,r+1);return!!P}}const Me=new k.constructor,Ge=new k.constructor,Rt=new Xi(()=>new Q),ae=new Q,ce=new Q,Hi=new Q,Zi=new Q;let $i=!1;function Un(f,t,e,i){if($i)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");$i=!0;const s=f._roots,n=t._roots;let r,a=0,o=0;const c=new H().copy(e).invert();for(let h=0,u=s.length;h<u;h++){Me.setBuffer(s[h]),o=0;const l=Rt.getPrimitive();U(0,Me.float32Array,l),l.applyMatrix4(c);for(let d=0,y=n.length;d<y&&(Ge.setBuffer(n[d]),r=ut(0,0,e,c,i,a,o,0,0,l),Ge.clearBuffer(),o+=n[d].byteLength/J,!r);d++);if(Rt.releasePrimitive(l),Me.clearBuffer(),a+=s[h].byteLength/J,r)break}return $i=!1,r}function ut(f,t,e,i,s,n=0,r=0,a=0,o=0,c=null,h=!1){let u,l;h?(u=Ge,l=Me):(u=Me,l=Ge);const d=u.float32Array,y=u.uint32Array,m=u.uint16Array,z=l.float32Array,b=l.uint32Array,p=l.uint16Array,x=f*2,g=t*2,w=N(x,m),B=N(g,p);let _=!1;if(B&&w)h?_=s(X(t,b),G(t*2,p),X(f,y),G(f*2,m),o,r+t/q,a,n+f/q):_=s(X(f,y),G(f*2,m),X(t,b),G(t*2,p),a,n+f/q,o,r+t/q);else if(B){const M=Rt.getPrimitive();U(t,z,M),M.applyMatrix4(e);const P=v(f),A=O(f,y);U(P,d,ae),U(A,d,ce);const C=M.intersectsBox(ae),T=M.intersectsBox(ce);_=C&&ut(t,P,i,e,s,r,n,o,a+1,M,!h)||T&&ut(t,A,i,e,s,r,n,o,a+1,M,!h),Rt.releasePrimitive(M)}else{const M=v(t),P=O(t,b);U(M,z,Hi),U(P,z,Zi);const A=c.intersectsBox(Hi),C=c.intersectsBox(Zi);if(A&&C)_=ut(f,M,e,i,s,n,r,a,o+1,c,h)||ut(f,P,e,i,s,n,r,a,o+1,c,h);else if(A)if(w)_=ut(f,M,e,i,s,n,r,a,o+1,c,h);else{const T=Rt.getPrimitive();T.copy(Hi).applyMatrix4(e);const E=v(f),I=O(f,y);U(E,d,ae),U(I,d,ce);const F=T.intersectsBox(ae),R=T.intersectsBox(ce);_=F&&ut(M,E,i,e,s,r,n,o,a+1,T,!h)||R&&ut(M,I,i,e,s,r,n,o,a+1,T,!h),Rt.releasePrimitive(T)}else if(C)if(w)_=ut(f,P,e,i,s,n,r,a,o+1,c,h);else{const T=Rt.getPrimitive();T.copy(Zi).applyMatrix4(e);const E=v(f),I=O(f,y);U(E,d,ae),U(I,d,ce);const F=T.intersectsBox(ae),R=T.intersectsBox(ce);_=F&&ut(P,E,i,e,s,r,n,o,a+1,T,!h)||R&&ut(P,I,i,e,s,r,n,o,a+1,T,!h),Rt.releasePrimitive(T)}}return _}const Ji=new class{constructor(){let f=null,t=null,e=null,i=!1;this.root=null,this.buffer=null,this.uint32Array=null,this.uint16Array=null,this.setBVH=(n,r)=>{if(i)throw new Error("BVHTraversalHelper: cannot call setBVH during an active traversal.");this.root=r,this.buffer=f=n._roots[r],this.uint16Array=e=new Uint16Array(f),this.uint32Array=t=new Uint32Array(f)},this.reset=()=>{this.root=null,this.buffer=f=null,this.uint16Array=e=null,this.uint32Array=t=null},this.getRangeStart=n=>{let r=n*2;for(;!N(r,e);)n=v(n),r=n*2;return X(n,t)},this.getRangeEnd=n=>{let r=n*2;for(;!N(r,e);)n=O(n,t),r=n*2;return X(n,t)+G(r,e)};const s=(n,r,a)=>{const o=r*2,c=N(o,e);if(!n(a,c,r)&&!c){const u=v(r),l=O(r,t);s(n,u,a+1),s(n,l,a+1)}};this.traverseBuffer=n=>{if(i)throw new Error("BVHTraversalHelper: cannot start a traversal during an active traversal.");i=!0;try{s(n,0,0)}finally{i=!1}},this.traverse=n=>{this.traverseBuffer((r,a,o)=>{if(a){const c=o*2,h=t[o+6],u=e[c+14];return n(r,a,new Float32Array(f,o*4,6),h,u)}else{const c=Li(o,t);return n(r,a,new Float32Array(f,o*4,6),c)}})}}},Ds=new Q,he=new Float32Array(6);class Nn{constructor(){this._roots=null,this.primitiveBuffer=null,this.primitiveBufferStride=null}init(t){t={...Rs,...t},"maxLeafSize"in t&&(console.warn('BVH: "maxLeafSize" option has been deprecated. Use "targetLeafSize", instead.'),t={...t,targetLeafSize:t.maxLeafSize}),Vn(this,t)}getRootRanges(){throw new Error("BVH: getRootRanges() not implemented")}writePrimitiveBounds(){throw new Error("BVH: writePrimitiveBounds() not implemented")}writePrimitiveRangeBounds(t,e,i,s){let n=1/0,r=1/0,a=1/0,o=-1/0,c=-1/0,h=-1/0;for(let u=t,l=t+e;u<l;u++){this.writePrimitiveBounds(u,he,0);const[d,y,m,z,b,p]=he;d<n&&(n=d),z>o&&(o=z),y<r&&(r=y),b>c&&(c=b),m<a&&(a=m),p>h&&(h=p)}return i[s+0]=n,i[s+1]=r,i[s+2]=a,i[s+3]=o,i[s+4]=c,i[s+5]=h,i}computePrimitiveBounds(t,e,i){const s=i.offset||0;for(let n=t,r=t+e;n<r;n++){this.writePrimitiveBounds(n,he,0);const[a,o,c,h,u,l]=he,d=(a+h)/2,y=(o+u)/2,m=(c+l)/2,z=(h-a)/2,b=(u-o)/2,p=(l-c)/2,x=(n-s)*6;i[x+0]=d,i[x+1]=z+(Math.abs(d)+z)*Ye,i[x+2]=y,i[x+3]=b+(Math.abs(y)+b)*Ye,i[x+4]=m,i[x+5]=p+(Math.abs(m)+p)*Ye}return i}shiftPrimitiveOffsets(t){const e=this._indirectBuffer;if(e)for(let i=0,s=e.length;i<s;i++)e[i]+=t;else{const i=this._roots;for(let s=0;s<i.length;s++){const n=i[s],r=new Uint32Array(n),a=new Uint16Array(n),o=n.byteLength/J;for(let c=0;c<o;c++){const h=q*c,u=2*h;N(u,a)&&(r[h+6]+=t)}}}}traverse(t,e=0){Ji.setBVH(this,e),Ji.traverse(t),Ji.reset()}refit(){const t=this._roots;for(let e=0,i=t.length;e<i;e++){const s=t[e],n=new Uint32Array(s),r=new Uint16Array(s),a=new Float32Array(s),o=s.byteLength/J;for(let c=o-1;c>=0;c--){const h=c*q,u=h*2;if(N(u,r)){const d=X(h,n),y=G(u,r);this.writePrimitiveRangeBounds(d,y,he,0),a.set(he,h)}else{const d=v(h),y=O(h,n);for(let m=0;m<3;m++){const z=a[d+m],b=a[d+m+3],p=a[y+m],x=a[y+m+3];a[h+m]=z<p?z:p,a[h+m+3]=b>x?b:x}}}}}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(i=>{U(0,new Float32Array(i),Ds),t.union(Ds)}),t}shapecast(t){let{boundsTraverseOrder:e,intersectsBounds:i,intersectsRange:s,intersectsPrimitive:n,scratchPrimitive:r,iterate:a}=t;if(s&&n){const u=s;s=(l,d,y,m,z)=>u(l,d,y,m,z)?!0:a(l,d,this,n,y,m,r)}else s||(n?s=(u,l,d,y)=>a(u,l,this,n,d,y,r):s=(u,l,d)=>d);let o=!1,c=0;const h=this._roots;for(let u=0,l=h.length;u<l;u++){const d=h[u];if(o=kn(this,u,i,s,e,c),o)break;c+=d.byteLength/J}return o}bvhcast(t,e,i){let{intersectsRanges:s}=i;return Un(this,t,e,s)}}function Ln(){return typeof SharedArrayBuffer<"u"}function Gi(f){return f.index?f.index.count:f.attributes.position.count}function Qe(f){return Gi(f)/3}function Dn(f,t=ArrayBuffer){return f>65535?new Uint32Array(new t(4*f)):new Uint16Array(new t(2*f))}function qn(f,t){if(!f.index){const e=f.attributes.position.count,i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,s=Dn(e,i);f.setIndex(new mt(s,1));for(let n=0;n<e;n++)s[n]=n}}function vn(f,t,e){const i=Gi(f)/e,s=t||f.drawRange,n=s.start/e,r=(s.start+s.count)/e,a=Math.max(0,n),o=Math.min(i,r)-a;return{offset:Math.floor(a),count:Math.floor(o)}}function On(f,t){return f.groups.map(e=>({offset:e.start/t,count:e.count/t}))}function qs(f,t,e){const i=vn(f,t,e),s=On(f,e);if(!s.length)return[i];const n=[],r=i.offset,a=i.offset+i.count,o=Gi(f)/e,c=[];for(const l of s){const{offset:d,count:y}=l,m=d,z=isFinite(y)?y:o-d,b=d+z;m<a&&b>r&&(c.push({pos:Math.max(r,m),isStart:!0}),c.push({pos:Math.min(a,b),isStart:!1}))}c.sort((l,d)=>l.pos!==d.pos?l.pos-d.pos:l.type==="end"?-1:1);let h=0,u=null;for(const l of c){const d=l.pos;h!==0&&d!==u&&n.push({offset:u,count:d-u}),h+=l.isStart?1:-1,u=d}return n}function Wn(f,t){const e=f[f.length-1],i=e.offset+e.count>2**16,s=f.reduce((c,h)=>c+h.count,0),n=i?4:2,r=t?new SharedArrayBuffer(s*n):new ArrayBuffer(s*n),a=i?new Uint32Array(r):new Uint16Array(r);let o=0;for(let c=0;c<f.length;c++){const{offset:h,count:u}=f[c];for(let l=0;l<u;l++)a[o+l]=h+l;o+=u}return a}class Xn extends Nn{get indirect(){return!!this._indirectBuffer}get primitiveStride(){return null}get primitiveBufferStride(){return this.indirect?1:this.primitiveStride}set primitiveBufferStride(t){}get primitiveBuffer(){return this.indirect?this._indirectBuffer:this.geometry.index.array}set primitiveBuffer(t){}constructor(t,e={}){if(t.isBufferGeometry){if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("BVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("BVH: Only BufferGeometries are supported.");if(e.useSharedArrayBuffer&&!Ln())throw new Error("BVH: SharedArrayBuffer is not available.");super(),this.geometry=t,this.resolvePrimitiveIndex=e.indirect?i=>this._indirectBuffer[i]:i=>i,this.primitiveBuffer=null,this.primitiveBufferStride=null,this._indirectBuffer=null,e={...Rs,...e},e[Ui]||this.init(e)}init(t){const{geometry:e,primitiveStride:i}=this;if(t.indirect){const s=qs(e,t.range,i),n=Wn(s,t.useSharedArrayBuffer);this._indirectBuffer=n}else qn(e,t);super.init(t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Q))}getRootRanges(t){return this.indirect?[{offset:0,count:this._indirectBuffer.length}]:qs(this.geometry,t,this.primitiveStride)}raycastObject3D(){throw new Error("BVH: raycastObject3D() not implemented")}}class St{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let i=1/0,s=-1/0;for(let n=0,r=t.length;n<r;n++){const o=t[n][e];i=o<i?o:i,s=o>s?o:s}this.min=i,this.max=s}setFromPoints(t,e){let i=1/0,s=-1/0;for(let n=0,r=e.length;n<r;n++){const a=e[n],o=t.dot(a);i=o<i?o:i,s=o>s?o:s}this.min=i,this.max=s}isSeparated(t){return this.min>t.max||t.min>this.max}}St.prototype.setFromBox=(function(){const f=new S;return function(e,i){const s=i.min,n=i.max;let r=1/0,a=-1/0;for(let o=0;o<=1;o++)for(let c=0;c<=1;c++)for(let h=0;h<=1;h++){f.x=s.x*o+n.x*(1-o),f.y=s.y*c+n.y*(1-c),f.z=s.z*h+n.z*(1-h);const u=e.dot(f);r=Math.min(u,r),a=Math.max(u,a)}this.min=r,this.max=a}})();const Yn=(function(){const f=new S,t=new S,e=new S;return function(s,n,r){const a=s.start,o=f,c=n.start,h=t;e.subVectors(a,c),f.subVectors(s.end,s.start),t.subVectors(n.end,n.start);const u=e.dot(h),l=h.dot(o),d=h.dot(h),y=e.dot(o),z=o.dot(o)*d-l*l;let b,p;z!==0?b=(u*l-y*d)/z:b=0,p=(u+b*l)/d,r.x=b,r.y=p}})(),Qi=(function(){const f=new Y,t=new S,e=new S;return function(s,n,r,a){Yn(s,n,f);let o=f.x,c=f.y;if(o>=0&&o<=1&&c>=0&&c<=1){s.at(o,r),n.at(c,a);return}else if(o>=0&&o<=1){c<0?n.at(0,a):n.at(1,a),s.closestPointToPoint(a,!0,r);return}else if(c>=0&&c<=1){o<0?s.at(0,r):s.at(1,r),n.closestPointToPoint(r,!0,a);return}else{let h;o<0?h=s.start:h=s.end;let u;c<0?u=n.start:u=n.end;const l=t,d=e;if(s.closestPointToPoint(u,!0,t),n.closestPointToPoint(h,!0,e),l.distanceToSquared(u)<=d.distanceToSquared(h)){r.copy(l),a.copy(u);return}else{r.copy(h),a.copy(d);return}}}})(),Hn=(function(){const f=new S,t=new S,e=new Ts,i=new Mt;return function(n,r){const{radius:a,center:o}=n,{a:c,b:h,c:u}=r;if(i.start=c,i.end=h,i.closestPointToPoint(o,!0,f).distanceTo(o)<=a||(i.start=c,i.end=u,i.closestPointToPoint(o,!0,f).distanceTo(o)<=a)||(i.start=h,i.end=u,i.closestPointToPoint(o,!0,f).distanceTo(o)<=a))return!0;const m=r.getPlane(e);if(Math.abs(m.distanceToPoint(o))<=a){const b=m.projectPoint(o,t);if(r.containsPoint(b))return!0}return!1}})(),Zn=["x","y","z"],Bt=1e-15,vs=Bt*Bt;function rt(f){return Math.abs(f)<Bt}class ft extends st{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new S),this.satBounds=new Array(4).fill().map(()=>new St),this.points=[this.a,this.b,this.c],this.plane=new Ts,this.isDegenerateIntoSegment=!1,this.isDegenerateIntoPoint=!1,this.degenerateSegment=new Mt,this.needsUpdate=!0}intersectsSphere(t){return Hn(t,this)}update(){const t=this.a,e=this.b,i=this.c,s=this.points,n=this.satAxes,r=this.satBounds,a=n[0],o=r[0];this.getNormal(a),o.setFromPoints(a,s);const c=n[1],h=r[1];c.subVectors(t,e),h.setFromPoints(c,s);const u=n[2],l=r[2];u.subVectors(e,i),l.setFromPoints(u,s);const d=n[3],y=r[3];d.subVectors(i,t),y.setFromPoints(d,s);const m=c.length(),z=u.length(),b=d.length();this.isDegenerateIntoPoint=!1,this.isDegenerateIntoSegment=!1,m<Bt?z<Bt||b<Bt?this.isDegenerateIntoPoint=!0:(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(t),this.degenerateSegment.end.copy(i)):z<Bt?b<Bt?this.isDegenerateIntoPoint=!0:(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(e),this.degenerateSegment.end.copy(t)):b<Bt&&(this.isDegenerateIntoSegment=!0,this.degenerateSegment.start.copy(i),this.degenerateSegment.end.copy(e)),this.plane.setFromNormalAndCoplanarPoint(a,t),this.needsUpdate=!1}}ft.prototype.closestPointToSegment=(function(){const f=new S,t=new S,e=new Mt;return function(s,n=null,r=null){const{start:a,end:o}=s,c=this.points;let h,u=1/0;for(let l=0;l<3;l++){const d=(l+1)%3;e.start.copy(c[l]),e.end.copy(c[d]),Qi(e,s,f,t),h=f.distanceToSquared(t),h<u&&(u=h,n&&n.copy(f),r&&r.copy(t))}return this.closestPointToPoint(a,f),h=a.distanceToSquared(f),h<u&&(u=h,n&&n.copy(f),r&&r.copy(a)),this.closestPointToPoint(o,f),h=o.distanceToSquared(f),h<u&&(u=h,n&&n.copy(f),r&&r.copy(o)),Math.sqrt(u)}})(),ft.prototype.intersectsTriangle=(function(){const f=new ft,t=new St,e=new St,i=new S,s=new S,n=new S,r=new S,a=new Mt,o=new Mt,c=new S,h=new Y,u=new Y;function l(x,g,w,B){const _=i;!x.isDegenerateIntoPoint&&!x.isDegenerateIntoSegment?_.copy(x.plane.normal):_.copy(g.plane.normal);const M=x.satBounds,P=x.satAxes;for(let T=1;T<4;T++){const E=M[T],I=P[T];if(t.setFromPoints(I,g.points),E.isSeparated(t)||(r.copy(_).cross(I),t.setFromPoints(r,x.points),e.setFromPoints(r,g.points),t.isSeparated(e)))return!1}const A=g.satBounds,C=g.satAxes;for(let T=1;T<4;T++){const E=A[T],I=C[T];if(t.setFromPoints(I,x.points),E.isSeparated(t)||(r.crossVectors(_,I),t.setFromPoints(r,x.points),e.setFromPoints(r,g.points),t.isSeparated(e)))return!1}return w&&(B||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),w.start.set(0,0,0),w.end.set(0,0,0)),!0}function d(x,g,w,B,_,M,P,A,C,T,E){let I=P/(P-A);T.x=B+(_-B)*I,E.start.subVectors(g,x).multiplyScalar(I).add(x),I=P/(P-C),T.y=B+(M-B)*I,E.end.subVectors(w,x).multiplyScalar(I).add(x)}function y(x,g,w,B,_,M,P,A,C,T,E){if(_>0)d(x.c,x.a,x.b,B,g,w,C,P,A,T,E);else if(M>0)d(x.b,x.a,x.c,w,g,B,A,P,C,T,E);else if(A*C>0||P!=0)d(x.a,x.b,x.c,g,w,B,P,A,C,T,E);else if(A!=0)d(x.b,x.a,x.c,w,g,B,A,P,C,T,E);else if(C!=0)d(x.c,x.a,x.b,B,g,w,C,P,A,T,E);else return!0;return!1}function m(x,g,w,B){const _=g.degenerateSegment,M=x.plane.distanceToPoint(_.start),P=x.plane.distanceToPoint(_.end);return rt(M)?rt(P)?l(x,g,w,B):(w&&(w.start.copy(_.start),w.end.copy(_.start)),x.containsPoint(_.start)):rt(P)?(w&&(w.start.copy(_.end),w.end.copy(_.end)),x.containsPoint(_.end)):x.plane.intersectLine(_,i)!=null?(w&&(w.start.copy(i),w.end.copy(i)),x.containsPoint(i)):!1}function z(x,g,w){const B=g.a;return rt(x.plane.distanceToPoint(B))&&x.containsPoint(B)?(w&&(w.start.copy(B),w.end.copy(B)),!0):!1}function b(x,g,w){const B=x.degenerateSegment,_=g.a;return B.closestPointToPoint(_,!0,i),_.distanceToSquared(i)<vs?(w&&(w.start.copy(_),w.end.copy(_)),!0):!1}function p(x,g,w,B){if(x.isDegenerateIntoSegment)if(g.isDegenerateIntoSegment){const _=x.degenerateSegment,M=g.degenerateSegment,P=s,A=n;_.delta(P),M.delta(A);const C=i.subVectors(M.start,_.start),T=P.x*A.y-P.y*A.x;if(rt(T))return!1;const E=(C.x*A.y-C.y*A.x)/T,I=-(P.x*C.y-P.y*C.x)/T;if(E<0||E>1||I<0||I>1)return!1;const F=_.start.z+P.z*E,R=M.start.z+A.z*I;return rt(F-R)?(w&&(w.start.copy(_.start).addScaledVector(P,E),w.end.copy(_.start).addScaledVector(P,E)),!0):!1}else return g.isDegenerateIntoPoint?b(x,g,w):m(g,x,w,B);else{if(x.isDegenerateIntoPoint)return g.isDegenerateIntoPoint?g.a.distanceToSquared(x.a)<vs?(w&&(w.start.copy(x.a),w.end.copy(x.a)),!0):!1:g.isDegenerateIntoSegment?b(g,x,w):z(g,x,w);if(g.isDegenerateIntoPoint)return z(x,g,w);if(g.isDegenerateIntoSegment)return m(x,g,w,B)}}return function(g,w=null,B=!1){this.needsUpdate&&this.update(),g.isExtendedTriangle?g.needsUpdate&&g.update():(f.copy(g),f.update(),g=f);const _=p(this,g,w,B);if(_!==void 0)return _;const M=this.plane,P=g.plane;let A=P.distanceToPoint(this.a),C=P.distanceToPoint(this.b),T=P.distanceToPoint(this.c);rt(A)&&(A=0),rt(C)&&(C=0),rt(T)&&(T=0);const E=A*C,I=A*T;if(E>0&&I>0)return!1;let F=M.distanceToPoint(g.a),R=M.distanceToPoint(g.b),Z=M.distanceToPoint(g.c);rt(F)&&(F=0),rt(R)&&(R=0),rt(Z)&&(Z=0);const tt=F*R,dt=F*Z;if(tt>0&&dt>0)return!1;s.copy(M.normal),n.copy(P.normal);const at=s.cross(n);let pt=0,ye=Math.abs(at.x);const Ie=Math.abs(at.y);Ie>ye&&(ye=Ie,pt=1),Math.abs(at.z)>ye&&(pt=2);const Tt=Zn[pt],fi=this.a[Tt],di=this.b[Tt],Wt=this.c[Tt],Xt=g.a[Tt],Yt=g.b[Tt],Fe=g.c[Tt];if(y(this,fi,di,Wt,E,I,A,C,T,h,a))return l(this,g,w,B);if(y(g,Xt,Yt,Fe,tt,dt,F,R,Z,u,o))return l(this,g,w,B);if(h.y<h.x){const Ht=h.y;h.y=h.x,h.x=Ht,c.copy(a.start),a.start.copy(a.end),a.end.copy(c)}if(u.y<u.x){const Ht=u.y;u.y=u.x,u.x=Ht,c.copy(o.start),o.start.copy(o.end),o.end.copy(c)}return h.y<u.x||u.y<h.x?!1:(w&&(u.x>h.x?w.start.copy(o.start):w.start.copy(a.start),u.y<h.y?w.end.copy(o.end):w.end.copy(a.end)),!0)}})(),ft.prototype.distanceToPoint=(function(){const f=new S;return function(e){return this.closestPointToPoint(e,f),e.distanceTo(f)}})(),ft.prototype.distanceToTriangle=(function(){const f=new S,t=new S,e=["a","b","c"],i=new Mt,s=new Mt;return function(r,a=null,o=null){const c=a||o?i:null;if(this.intersectsTriangle(r,c,!0))return(a||o)&&(a&&c.getCenter(a),o&&c.getCenter(o)),0;let h=1/0;for(let u=0;u<3;u++){let l;const d=e[u],y=r[d];this.closestPointToPoint(y,f),l=y.distanceToSquared(f),l<h&&(h=l,a&&a.copy(f),o&&o.copy(y));const m=this[d];r.closestPointToPoint(m,f),l=m.distanceToSquared(f),l<h&&(h=l,a&&a.copy(m),o&&o.copy(f))}for(let u=0;u<3;u++){const l=e[u],d=e[(u+1)%3];i.set(this[l],this[d]);for(let y=0;y<3;y++){const m=e[y],z=e[(y+1)%3];s.set(r[m],r[z]),Qi(i,s,f,t);const b=f.distanceToSquared(t);b<h&&(h=b,a&&a.copy(f),o&&o.copy(t))}}return Math.sqrt(h)}})();class j{constructor(t,e,i){this.isOrientedBox=!0,this.min=new S,this.max=new S,this.matrix=new H,this.invMatrix=new H,this.points=new Array(8).fill().map(()=>new S),this.satAxes=new Array(3).fill().map(()=>new S),this.satBounds=new Array(3).fill().map(()=>new St),this.alignedSatBounds=new Array(3).fill().map(()=>new St),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),i&&this.matrix.copy(i)}set(t,e,i){this.min.copy(t),this.max.copy(e),this.matrix.copy(i),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}}j.prototype.update=(function(){return function(){const t=this.matrix,e=this.min,i=this.max,s=this.points;for(let c=0;c<=1;c++)for(let h=0;h<=1;h++)for(let u=0;u<=1;u++){const l=1*c|2*h|4*u,d=s[l];d.x=c?i.x:e.x,d.y=h?i.y:e.y,d.z=u?i.z:e.z,d.applyMatrix4(t)}const n=this.satBounds,r=this.satAxes,a=s[0];for(let c=0;c<3;c++){const h=r[c],u=n[c],l=1<<c,d=s[l];h.subVectors(a,d),u.setFromPoints(h,s)}const o=this.alignedSatBounds;o[0].setFromPointsField(s,"x"),o[1].setFromPointsField(s,"y"),o[2].setFromPointsField(s,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}})(),j.prototype.intersectsBox=(function(){const f=new St;return function(e){this.needsUpdate&&this.update();const i=e.min,s=e.max,n=this.satBounds,r=this.satAxes,a=this.alignedSatBounds;if(f.min=i.x,f.max=s.x,a[0].isSeparated(f)||(f.min=i.y,f.max=s.y,a[1].isSeparated(f))||(f.min=i.z,f.max=s.z,a[2].isSeparated(f)))return!1;for(let o=0;o<3;o++){const c=r[o],h=n[o];if(f.setFromBox(c,e),h.isSeparated(f))return!1}return!0}})(),j.prototype.intersectsTriangle=(function(){const f=new ft,t=new Array(3),e=new St,i=new St,s=new S;return function(r){this.needsUpdate&&this.update(),r.isExtendedTriangle?r.needsUpdate&&r.update():(f.copy(r),f.update(),r=f);const a=this.satBounds,o=this.satAxes;t[0]=r.a,t[1]=r.b,t[2]=r.c;for(let l=0;l<3;l++){const d=a[l],y=o[l];if(e.setFromPoints(y,t),d.isSeparated(e))return!1}const c=r.satBounds,h=r.satAxes,u=this.points;for(let l=0;l<3;l++){const d=c[l],y=h[l];if(e.setFromPoints(y,u),d.isSeparated(e))return!1}for(let l=0;l<3;l++){const d=o[l];for(let y=0;y<4;y++){const m=h[y];if(s.crossVectors(d,m),e.setFromPoints(s,t),i.setFromPoints(s,u),e.isSeparated(i))return!1}}return!0}})(),j.prototype.closestPointToPoint=(function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e}})(),j.prototype.distanceToPoint=(function(){const f=new S;return function(e){return this.closestPointToPoint(e,f),e.distanceTo(f)}})(),j.prototype.distanceToBox=(function(){const f=["x","y","z"],t=new Array(12).fill().map(()=>new Mt),e=new Array(12).fill().map(()=>new Mt),i=new S,s=new S;return function(r,a=0,o=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(r))return(o||c)&&(r.getCenter(s),this.closestPointToPoint(s,i),r.closestPointToPoint(i,s),o&&o.copy(i),c&&c.copy(s)),0;const h=a*a,u=r.min,l=r.max,d=this.points;let y=1/0;for(let z=0;z<8;z++){const b=d[z];s.copy(b).clamp(u,l);const p=b.distanceToSquared(s);if(p<y&&(y=p,o&&o.copy(b),c&&c.copy(s),p<h))return Math.sqrt(p)}let m=0;for(let z=0;z<3;z++)for(let b=0;b<=1;b++)for(let p=0;p<=1;p++){const x=(z+1)%3,g=(z+2)%3,w=b<<x|p<<g,B=1<<z|b<<x|p<<g,_=d[w],M=d[B];t[m].set(_,M);const A=f[z],C=f[x],T=f[g],E=e[m],I=E.start,F=E.end;I[A]=u[A],I[C]=b?u[C]:l[C],I[T]=p?u[T]:l[C],F[A]=l[A],F[C]=b?u[C]:l[C],F[T]=p?u[T]:l[C],m++}for(let z=0;z<=1;z++)for(let b=0;b<=1;b++)for(let p=0;p<=1;p++){s.x=z?l.x:u.x,s.y=b?l.y:u.y,s.z=p?l.z:u.z,this.closestPointToPoint(s,i);const x=s.distanceToSquared(i);if(x<y&&(y=x,o&&o.copy(i),c&&c.copy(s),x<h))return Math.sqrt(x)}for(let z=0;z<12;z++){const b=t[z];for(let p=0;p<12;p++){const x=e[p];Qi(b,x,i,s);const g=i.distanceToSquared(s);if(g<y&&(y=g,o&&o.copy(i),c&&c.copy(s),g<h))return Math.sqrt(g)}}return Math.sqrt(y)}})();class $n extends Xi{constructor(){super(()=>new ft)}}const ot=new $n,Ae=new S,ji=new S;function Jn(f,t,e={},i=0,s=1/0){const n=i*i,r=s*s;let a=1/0,o=null;if(f.shapecast({boundsTraverseOrder:h=>(Ae.copy(t).clamp(h.min,h.max),Ae.distanceToSquared(t)),intersectsBounds:(h,u,l)=>l<a&&l<r,intersectsTriangle:(h,u)=>{h.closestPointToPoint(t,Ae);const l=t.distanceToSquared(Ae);return l<a&&(ji.copy(Ae),a=l,o=u),l<n}}),a===1/0)return null;const c=Math.sqrt(a);return e.point?e.point.copy(ji):e.point=ji.clone(),e.distance=c,e.faceIndex=o,e}const je=parseInt("186")>=169,Gn=parseInt("186")<=161,qt=new S,vt=new S,Ot=new S,Ke=new Y,ti=new Y,ei=new Y,Os=new S,Ws=new S,Xs=new S,Se=new S;function Qn(f,t,e,i,s,n,r,a){let o;if(n===1?o=f.intersectTriangle(i,e,t,!0,s):o=f.intersectTriangle(t,e,i,n!==2,s),o===null)return null;const c=f.origin.distanceTo(s);return c<r||c>a?null:{distance:c,point:s.clone()}}function Ys(f,t,e,i,s,n,r,a,o,c,h){qt.fromBufferAttribute(t,n),vt.fromBufferAttribute(t,r),Ot.fromBufferAttribute(t,a);const u=Qn(f,qt,vt,Ot,Se,o,c,h);if(u){if(i){Ke.fromBufferAttribute(i,n),ti.fromBufferAttribute(i,r),ei.fromBufferAttribute(i,a),u.uv=new Y;const d=st.getInterpolation(Se,qt,vt,Ot,Ke,ti,ei,u.uv);je||(u.uv=d)}if(s){Ke.fromBufferAttribute(s,n),ti.fromBufferAttribute(s,r),ei.fromBufferAttribute(s,a),u.uv1=new Y;const d=st.getInterpolation(Se,qt,vt,Ot,Ke,ti,ei,u.uv1);je||(u.uv1=d),Gn&&(u.uv2=u.uv1)}if(e){Os.fromBufferAttribute(e,n),Ws.fromBufferAttribute(e,r),Xs.fromBufferAttribute(e,a),u.normal=new S;const d=st.getInterpolation(Se,qt,vt,Ot,Os,Ws,Xs,u.normal);u.normal.dot(f.direction)>0&&u.normal.multiplyScalar(-1),je||(u.normal=d)}const l={a:n,b:r,c:a,normal:new S,materialIndex:0};if(st.getNormal(qt,vt,Ot,l.normal),u.face=l,u.faceIndex=n,je){const d=new S;st.getBarycoord(Se,qt,vt,Ot,d),u.barycoord=d}}return u}function Hs(f){return f&&f.isMaterial?f.side:f}function ii(f,t,e,i,s,n,r){const a=i*3;let o=a+0,c=a+1,h=a+2;const{index:u,groups:l}=f;f.index&&(o=u.getX(o),c=u.getX(c),h=u.getX(h));const{position:d,normal:y,uv:m,uv1:z}=f.attributes;if(Array.isArray(t)){const b=i*3;for(let p=0,x=l.length;p<x;p++){const{start:g,count:w,materialIndex:B}=l[p];if(b>=g&&b<g+w){const _=Hs(t[B]),M=Ys(e,d,y,m,z,o,c,h,_,n,r);if(M)if(M.faceIndex=i,M.face.materialIndex=B,s)s.push(M);else return M}}}else{const b=Hs(t),p=Ys(e,d,y,m,z,o,c,h,b,n,r);if(p)if(p.faceIndex=i,p.face.materialIndex=0,s)s.push(p);else return p}return null}function D(f,t,e,i){const s=f.a,n=f.b,r=f.c;let a=t,o=t+1,c=t+2;e&&(a=e.getX(a),o=e.getX(o),c=e.getX(c)),s.x=i.getX(a),s.y=i.getY(a),s.z=i.getZ(a),n.x=i.getX(o),n.y=i.getY(o),n.z=i.getZ(o),r.x=i.getX(c),r.y=i.getY(c),r.z=i.getZ(c)}function jn(f,t,e,i,s,n,r,a){const{geometry:o,_indirectBuffer:c}=f;for(let h=i,u=i+s;h<u;h++)ii(o,t,e,h,n,r,a)}function Kn(f,t,e,i,s,n,r){const{geometry:a,_indirectBuffer:o}=f;let c=1/0,h=null;for(let u=i,l=i+s;u<l;u++){let d;d=ii(a,t,e,u,null,n,r),d&&d.distance<c&&(h=d,c=d.distance)}return h}function tr(f,t,e,i,s,n,r){const{geometry:a}=e,{index:o}=a,c=a.attributes.position;for(let h=f,u=t+f;h<u;h++){let l;if(l=h,D(r,l*3,o,c),r.needsUpdate=!0,i(r,l,s,n))return!0}return!1}function er(f,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=f.geometry,i=e.index?e.index.array:null,s=e.attributes.position;let n,r,a,o,c=0;const h=f._roots;for(let l=0,d=h.length;l<d;l++)n=h[l],r=new Uint32Array(n),a=new Uint16Array(n),o=new Float32Array(n),u(0,c),c+=n.byteLength;function u(l,d,y=!1){const m=l*2;if(N(m,a)){const z=X(l,r),b=G(m,a);let p=1/0,x=1/0,g=1/0,w=-1/0,B=-1/0,_=-1/0;for(let M=3*z,P=3*(z+b);M<P;M++){let A=i[M];const C=s.getX(A),T=s.getY(A),E=s.getZ(A);C<p&&(p=C),C>w&&(w=C),T<x&&(x=T),T>B&&(B=T),E<g&&(g=E),E>_&&(_=E)}return o[l+0]!==p||o[l+1]!==x||o[l+2]!==g||o[l+3]!==w||o[l+4]!==B||o[l+5]!==_?(o[l+0]=p,o[l+1]=x,o[l+2]=g,o[l+3]=w,o[l+4]=B,o[l+5]=_,!0):!1}else{const z=v(l),b=O(l,r);let p=y,x=!1,g=!1;if(t){if(!p){const A=z/q+d/J,C=b/q+d/J;x=t.has(A),g=t.has(C),p=!x&&!g}}else x=!0,g=!0;const w=p||x,B=p||g;let _=!1;w&&(_=u(z,d,p));let M=!1;B&&(M=u(b,d,p));const P=_||M;if(P)for(let A=0;A<3;A++){const C=z+A,T=b+A,E=o[C],I=o[C+3],F=o[T],R=o[T+3];o[l+A]=E<F?E:F,o[l+A+3]=I>R?I:R}return P}}}function kt(f,t,e,i,s){let n,r,a,o,c,h;const u=1/e.direction.x,l=1/e.direction.y,d=1/e.direction.z,y=e.origin.x,m=e.origin.y,z=e.origin.z;let b=t[f],p=t[f+3],x=t[f+1],g=t[f+3+1],w=t[f+2],B=t[f+3+2];return u>=0?(n=(b-y)*u,r=(p-y)*u):(n=(p-y)*u,r=(b-y)*u),l>=0?(a=(x-m)*l,o=(g-m)*l):(a=(g-m)*l,o=(x-m)*l),n>o||a>r||((a>n||isNaN(n))&&(n=a),(o<r||isNaN(r))&&(r=o),d>=0?(c=(w-z)*d,h=(B-z)*d):(c=(B-z)*d,h=(w-z)*d),n>h||c>r)?!1:((c>n||n!==n)&&(n=c),(h<r||r!==r)&&(r=h),n<=s&&r>=i)}function ir(f,t,e,i,s,n,r,a){const{geometry:o,_indirectBuffer:c}=f;for(let h=i,u=i+s;h<u;h++){let l=c?c[h]:h;ii(o,t,e,l,n,r,a)}}function sr(f,t,e,i,s,n,r){const{geometry:a,_indirectBuffer:o}=f;let c=1/0,h=null;for(let u=i,l=i+s;u<l;u++){let d;d=ii(a,t,e,o?o[u]:u,null,n,r),d&&d.distance<c&&(h=d,c=d.distance)}return h}function nr(f,t,e,i,s,n,r){const{geometry:a}=e,{index:o}=a,c=a.attributes.position;for(let h=f,u=t+f;h<u;h++){let l;if(l=e.resolveTriangleIndex(h),D(r,l*3,o,c),r.needsUpdate=!0,i(r,l,s,n))return!0}return!1}function rr(f,t,e,i,s,n,r){k.setBuffer(f._roots[t]),Ki(0,f,e,i,s,n,r),k.clearBuffer()}function Ki(f,t,e,i,s,n,r){const{float32Array:a,uint16Array:o,uint32Array:c}=k,h=f*2;if(N(h,o)){const l=X(f,c),d=G(h,o);jn(t,e,i,l,d,s,n,r)}else{const l=v(f);kt(l,a,i,n,r)&&Ki(l,t,e,i,s,n,r);const d=O(f,c);kt(d,a,i,n,r)&&Ki(d,t,e,i,s,n,r)}}const or=["x","y","z"];function ar(f,t,e,i,s,n){k.setBuffer(f._roots[t]);const r=ts(0,f,e,i,s,n);return k.clearBuffer(),r}function ts(f,t,e,i,s,n){const{float32Array:r,uint16Array:a,uint32Array:o}=k;let c=f*2;if(N(c,a)){const u=X(f,o),l=G(c,a);return Kn(t,e,i,u,l,s,n)}else{const u=Li(f,o),l=or[u],y=i.direction[l]>=0;let m,z;y?(m=v(f),z=O(f,o)):(m=O(f,o),z=v(f));const p=kt(m,r,i,s,n)?ts(m,t,e,i,s,n):null;if(p){const w=p.point[l];if(y?w<=r[z+u]:w>=r[z+u+3])return p}const g=kt(z,r,i,s,n)?ts(z,t,e,i,s,n):null;return p&&g?p.distance<=g.distance?p:g:p||g||null}}const si=new Q,le=new ft,ue=new ft,Be=new H,Zs=new j,ni=new j;function cr(f,t,e,i){k.setBuffer(f._roots[t]);const s=es(0,f,e,i);return k.clearBuffer(),s}function es(f,t,e,i,s=null){const{float32Array:n,uint16Array:r,uint32Array:a}=k;let o=f*2;if(s===null&&(e.boundingBox||e.computeBoundingBox(),Zs.set(e.boundingBox.min,e.boundingBox.max,i),s=Zs),N(o,r)){const h=t.geometry,u=h.index,l=h.attributes.position,d=e.index,y=e.attributes.position,m=X(f,a),z=G(o,r);if(Be.copy(i).invert(),e.boundsTree)return U(f,n,ni),ni.matrix.copy(Be),ni.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:p=>ni.intersectsBox(p),intersectsTriangle:p=>{p.a.applyMatrix4(i),p.b.applyMatrix4(i),p.c.applyMatrix4(i),p.needsUpdate=!0;for(let x=m*3,g=(z+m)*3;x<g;x+=3)if(D(ue,x,u,l),ue.needsUpdate=!0,p.intersectsTriangle(ue))return!0;return!1}});{const b=Qe(e);for(let p=m*3,x=(z+m)*3;p<x;p+=3){D(le,p,u,l),le.a.applyMatrix4(Be),le.b.applyMatrix4(Be),le.c.applyMatrix4(Be),le.needsUpdate=!0;for(let g=0,w=b*3;g<w;g+=3)if(D(ue,g,d,y),ue.needsUpdate=!0,le.intersectsTriangle(ue))return!0}}}else{const h=v(f),u=O(f,a);return U(h,n,si),!!(s.intersectsBox(si)&&es(h,t,e,i,s)||(U(u,n,si),s.intersectsBox(si)&&es(u,t,e,i,s)))}}const ri=new H,is=new j,Te=new j,hr=new S,lr=new S,ur=new S,fr=new S;function dr(f,t,e,i={},s={},n=0,r=1/0){t.boundingBox||t.computeBoundingBox(),is.set(t.boundingBox.min,t.boundingBox.max,e),is.needsUpdate=!0;const a=f.geometry,o=a.attributes.position,c=a.index,h=t.attributes.position,u=t.index,l=ot.getPrimitive(),d=ot.getPrimitive();let y=hr,m=lr,z=null,b=null;s&&(z=ur,b=fr);let p=1/0,x=null,g=null;return ri.copy(e).invert(),Te.matrix.copy(ri),f.shapecast({boundsTraverseOrder:w=>is.distanceToBox(w),intersectsBounds:(w,B,_)=>_<p&&_<r?(B&&(Te.min.copy(w.min),Te.max.copy(w.max),Te.needsUpdate=!0),!0):!1,intersectsRange:(w,B)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:M=>Te.distanceToBox(M),intersectsBounds:(M,P,A)=>A<p&&A<r,intersectsRange:(M,P)=>{for(let A=M,C=M+P;A<C;A++){D(d,3*A,u,h),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let T=w,E=w+B;T<E;T++){D(l,3*T,c,o),l.needsUpdate=!0;const I=l.distanceToTriangle(d,y,z);if(I<p&&(m.copy(y),b&&b.copy(z),p=I,x=T,g=A),I<n)return!0}}}});{const _=Qe(t);for(let M=0,P=_;M<P;M++){D(d,3*M,u,h),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let A=w,C=w+B;A<C;A++){D(l,3*A,c,o),l.needsUpdate=!0;const T=l.distanceToTriangle(d,y,z);if(T<p&&(m.copy(y),b&&b.copy(z),p=T,x=A,g=M),T<n)return!0}}}}}),ot.releasePrimitive(l),ot.releasePrimitive(d),p===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=p,i.faceIndex=x,s&&(s.point?s.point.copy(b):s.point=b.clone(),s.point.applyMatrix4(ri),m.applyMatrix4(ri),s.distance=m.sub(s.point).length(),s.faceIndex=g),i)}function yr(f,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=f.geometry,i=e.index?e.index.array:null,s=e.attributes.position;let n,r,a,o,c=0;const h=f._roots;for(let l=0,d=h.length;l<d;l++)n=h[l],r=new Uint32Array(n),a=new Uint16Array(n),o=new Float32Array(n),u(0,c),c+=n.byteLength;function u(l,d,y=!1){const m=l*2;if(N(m,a)){const z=X(l,r),b=G(m,a);let p=1/0,x=1/0,g=1/0,w=-1/0,B=-1/0,_=-1/0;for(let M=z,P=z+b;M<P;M++){const A=3*f.resolveTriangleIndex(M);for(let C=0;C<3;C++){let T=A+C;T=i?i[T]:T;const E=s.getX(T),I=s.getY(T),F=s.getZ(T);E<p&&(p=E),E>w&&(w=E),I<x&&(x=I),I>B&&(B=I),F<g&&(g=F),F>_&&(_=F)}}return o[l+0]!==p||o[l+1]!==x||o[l+2]!==g||o[l+3]!==w||o[l+4]!==B||o[l+5]!==_?(o[l+0]=p,o[l+1]=x,o[l+2]=g,o[l+3]=w,o[l+4]=B,o[l+5]=_,!0):!1}else{const z=v(l),b=O(l,r);let p=y,x=!1,g=!1;if(t){if(!p){const A=z/q+d/J,C=b/q+d/J;x=t.has(A),g=t.has(C),p=!x&&!g}}else x=!0,g=!0;const w=p||x,B=p||g;let _=!1;w&&(_=u(z,d,p));let M=!1;B&&(M=u(b,d,p));const P=_||M;if(P)for(let A=0;A<3;A++){const C=z+A,T=b+A,E=o[C],I=o[C+3],F=o[T],R=o[T+3];o[l+A]=E<F?E:F,o[l+A+3]=I>R?I:R}return P}}}function mr(f,t,e,i,s,n,r){k.setBuffer(f._roots[t]),ss(0,f,e,i,s,n,r),k.clearBuffer()}function ss(f,t,e,i,s,n,r){const{float32Array:a,uint16Array:o,uint32Array:c}=k,h=f*2;if(N(h,o)){const l=X(f,c),d=G(h,o);ir(t,e,i,l,d,s,n,r)}else{const l=v(f);kt(l,a,i,n,r)&&ss(l,t,e,i,s,n,r);const d=O(f,c);kt(d,a,i,n,r)&&ss(d,t,e,i,s,n,r)}}const pr=["x","y","z"];function xr(f,t,e,i,s,n){k.setBuffer(f._roots[t]);const r=ns(0,f,e,i,s,n);return k.clearBuffer(),r}function ns(f,t,e,i,s,n){const{float32Array:r,uint16Array:a,uint32Array:o}=k;let c=f*2;if(N(c,a)){const u=X(f,o),l=G(c,a);return sr(t,e,i,u,l,s,n)}else{const u=Li(f,o),l=pr[u],y=i.direction[l]>=0;let m,z;y?(m=v(f),z=O(f,o)):(m=O(f,o),z=v(f));const p=kt(m,r,i,s,n)?ns(m,t,e,i,s,n):null;if(p){const w=p.point[l];if(y?w<=r[z+u]:w>=r[z+u+3])return p}const g=kt(z,r,i,s,n)?ns(z,t,e,i,s,n):null;return p&&g?p.distance<=g.distance?p:g:p||g||null}}const oi=new Q,fe=new ft,de=new ft,Pe=new H,$s=new j,ai=new j;function gr(f,t,e,i){k.setBuffer(f._roots[t]);const s=rs(0,f,e,i);return k.clearBuffer(),s}function rs(f,t,e,i,s=null){const{float32Array:n,uint16Array:r,uint32Array:a}=k;let o=f*2;if(s===null&&(e.boundingBox||e.computeBoundingBox(),$s.set(e.boundingBox.min,e.boundingBox.max,i),s=$s),N(o,r)){const h=t.geometry,u=h.index,l=h.attributes.position,d=e.index,y=e.attributes.position,m=X(f,a),z=G(o,r);if(Pe.copy(i).invert(),e.boundsTree)return U(f,n,ai),ai.matrix.copy(Pe),ai.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:p=>ai.intersectsBox(p),intersectsTriangle:p=>{p.a.applyMatrix4(i),p.b.applyMatrix4(i),p.c.applyMatrix4(i),p.needsUpdate=!0;for(let x=m,g=z+m;x<g;x++)if(D(de,3*t.resolveTriangleIndex(x),u,l),de.needsUpdate=!0,p.intersectsTriangle(de))return!0;return!1}});{const b=Qe(e);for(let p=m,x=z+m;p<x;p++){const g=t.resolveTriangleIndex(p);D(fe,3*g,u,l),fe.a.applyMatrix4(Pe),fe.b.applyMatrix4(Pe),fe.c.applyMatrix4(Pe),fe.needsUpdate=!0;for(let w=0,B=b*3;w<B;w+=3)if(D(de,w,d,y),de.needsUpdate=!0,fe.intersectsTriangle(de))return!0}}}else{const h=v(f),u=O(f,a);return U(h,n,oi),!!(s.intersectsBox(oi)&&rs(h,t,e,i,s)||(U(u,n,oi),s.intersectsBox(oi)&&rs(u,t,e,i,s)))}}const ci=new H,os=new j,Ce=new j,wr=new S,br=new S,zr=new S,_r=new S;function Mr(f,t,e,i={},s={},n=0,r=1/0){t.boundingBox||t.computeBoundingBox(),os.set(t.boundingBox.min,t.boundingBox.max,e),os.needsUpdate=!0;const a=f.geometry,o=a.attributes.position,c=a.index,h=t.attributes.position,u=t.index,l=ot.getPrimitive(),d=ot.getPrimitive();let y=wr,m=br,z=null,b=null;s&&(z=zr,b=_r);let p=1/0,x=null,g=null;return ci.copy(e).invert(),Ce.matrix.copy(ci),f.shapecast({boundsTraverseOrder:w=>os.distanceToBox(w),intersectsBounds:(w,B,_)=>_<p&&_<r?(B&&(Ce.min.copy(w.min),Ce.max.copy(w.max),Ce.needsUpdate=!0),!0):!1,intersectsRange:(w,B)=>{if(t.boundsTree){const _=t.boundsTree;return _.shapecast({boundsTraverseOrder:M=>Ce.distanceToBox(M),intersectsBounds:(M,P,A)=>A<p&&A<r,intersectsRange:(M,P)=>{for(let A=M,C=M+P;A<C;A++){const T=_.resolveTriangleIndex(A);D(d,3*T,u,h),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let E=w,I=w+B;E<I;E++){const F=f.resolveTriangleIndex(E);D(l,3*F,c,o),l.needsUpdate=!0;const R=l.distanceToTriangle(d,y,z);if(R<p&&(m.copy(y),b&&b.copy(z),p=R,x=E,g=A),R<n)return!0}}}})}else{const _=Qe(t);for(let M=0,P=_;M<P;M++){D(d,3*M,u,h),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let A=w,C=w+B;A<C;A++){const T=f.resolveTriangleIndex(A);D(l,3*T,c,o),l.needsUpdate=!0;const E=l.distanceToTriangle(d,y,z);if(E<p&&(m.copy(y),b&&b.copy(z),p=E,x=A,g=M),E<n)return!0}}}}}),ot.releasePrimitive(l),ot.releasePrimitive(d),p===1/0?null:(i.point?i.point.copy(m):i.point=m.clone(),i.distance=p,i.faceIndex=x,s&&(s.point?s.point.copy(b):s.point=b.clone(),s.point.applyMatrix4(ci),m.applyMatrix4(ci),s.distance=m.sub(s.point).length(),s.faceIndex=g),i)}function Js(f,t,e){return f===null?null:(f.point.applyMatrix4(t.matrixWorld),f.distance=f.point.distanceTo(e.ray.origin),f.object=t,f)}const hi=new j,li=new zn,Gs=new S,Qs=new H,js=new S,as=["getX","getY","getZ"];class Ee extends Xn{static serialize(t,e={}){e={cloneBuffers:!0,...e};const i=t.geometry,s=t._roots,n=t._indirectBuffer,r=i.getIndex(),a={version:1,roots:null,index:null,indirectBuffer:null};return e.cloneBuffers?(a.roots=s.map(o=>o.slice()),a.index=r?r.array.slice():null,a.indirectBuffer=n?n.slice():null):(a.roots=s,a.index=r?r.array:null,a.indirectBuffer=n),a}static deserialize(t,e,i={}){i={setIndex:!0,indirect:!!t.indirectBuffer,...i};const{index:s,roots:n,indirectBuffer:r}=t;t.version||(console.warn("MeshBVH.deserialize: Serialization format has been changed and will be fixed up. It is recommended to regenerate any stored serialized data."),o(n));const a=new Ee(e,{...i,[Ui]:!0});if(a._roots=n,a._indirectBuffer=r||null,i.setIndex){const c=e.getIndex();if(c===null){const h=new mt(t.index,1,!1);e.setIndex(h)}else c.array!==s&&(c.array.set(s),c.needsUpdate=!0)}return a;function o(c){for(let h=0;h<c.length;h++){const u=c[h],l=new Uint32Array(u),d=new Uint16Array(u);for(let y=0,m=u.byteLength/J;y<m;y++){const z=q*y,b=2*z;N(b,d)||(l[z+6]=l[z+6]/q-y)}}}}get primitiveStride(){return 3}get resolveTriangleIndex(){return this.resolvePrimitiveIndex}constructor(t,e={}){e.maxLeafTris&&(console.warn('MeshBVH: "maxLeafTris" option has been deprecated. Use "targetLeafSize", instead.'),e={...e,targetLeafSize:e.maxLeafTris}),super(t,e)}shiftTriangleOffsets(t){return super.shiftPrimitiveOffsets(t)}writePrimitiveBounds(t,e,i){const s=this.geometry,n=this._indirectBuffer,r=s.attributes.position,a=s.index?s.index.array:null,c=(n?n[t]:t)*3;let h=c+0,u=c+1,l=c+2;a&&(h=a[h],u=a[u],l=a[l]);for(let d=0;d<3;d++){const y=r[as[d]](h),m=r[as[d]](u),z=r[as[d]](l);let b=y;m<b&&(b=m),z<b&&(b=z);let p=y;m>p&&(p=m),z>p&&(p=z),e[i+d]=b,e[i+d+3]=p}return e}computePrimitiveBounds(t,e,i){const s=this.geometry,n=this._indirectBuffer,r=s.attributes.position,a=s.index?s.index.array:null,o=r.normalized;if(t<0||e+t-i.offset>i.length/6)throw new Error("MeshBVH: compute triangle bounds range is invalid.");const c=r.array,h=r.offset||0;let u=3;r.isInterleavedBufferAttribute&&(u=r.data.stride);const l=["getX","getY","getZ"],d=i.offset;for(let y=t,m=t+e;y<m;y++){const b=(n?n[y]:y)*3,p=(y-d)*6;let x=b+0,g=b+1,w=b+2;a&&(x=a[x],g=a[g],w=a[w]),o||(x=x*u+h,g=g*u+h,w=w*u+h);for(let B=0;B<3;B++){let _,M,P;o?(_=r[l[B]](x),M=r[l[B]](g),P=r[l[B]](w)):(_=c[x+B],M=c[g+B],P=c[w+B]);let A=_;M<A&&(A=M),P<A&&(A=P);let C=_;M>C&&(C=M),P>C&&(C=P);const T=(C-A)/2,E=B*2;i[p+E+0]=A+T,i[p+E+1]=T+(Math.abs(A)+T)*Ye}}return i}raycastObject3D(t,e,i=[]){const{material:s}=t;if(s===void 0)return;Qs.copy(t.matrixWorld).invert(),li.copy(e.ray).applyMatrix4(Qs),js.setFromMatrixScale(t.matrixWorld),Gs.copy(li.direction).multiply(js);const n=Gs.length(),r=e.near/n,a=e.far/n;if(e.firstHitOnly===!0){let o=this.raycastFirst(li,s,r,a);o=Js(o,t,e),o&&i.push(o)}else{const o=this.raycast(li,s,r,a);for(let c=0,h=o.length;c<h;c++){const u=Js(o[c],t,e);u&&i.push(u)}}return i}refit(t=null){return(this.indirect?yr:er)(this,t)}raycast(t,e=0,i=0,s=1/0){const n=this._roots,r=[],a=this.indirect?mr:rr;for(let o=0,c=n.length;o<c;o++)a(this,o,e,t,r,i,s);return r}raycastFirst(t,e=0,i=0,s=1/0){const n=this._roots;let r=null;const a=this.indirect?xr:ar;for(let o=0,c=n.length;o<c;o++){const h=a(this,o,e,t,i,s);h!=null&&(r==null||h.distance<r.distance)&&(r=h)}return r}intersectsGeometry(t,e){let i=!1;const s=this._roots,n=this.indirect?gr:cr;for(let r=0,a=s.length;r<a&&(i=n(this,r,t,e),!i);r++);return i}shapecast(t){const e=ot.getPrimitive(),i=super.shapecast({...t,intersectsPrimitive:t.intersectsTriangle,scratchPrimitive:e,iterate:this.indirect?nr:tr});return ot.releasePrimitive(e),i}bvhcast(t,e,i){let{intersectsRanges:s,intersectsTriangles:n}=i;const r=ot.getPrimitive(),a=this.geometry.index,o=this.geometry.attributes.position,c=this.indirect?y=>{const m=this.resolveTriangleIndex(y);D(r,m*3,a,o)}:y=>{D(r,y*3,a,o)},h=ot.getPrimitive(),u=t.geometry.index,l=t.geometry.attributes.position,d=t.indirect?y=>{const m=t.resolveTriangleIndex(y);D(h,m*3,u,l)}:y=>{D(h,y*3,u,l)};if(n){if(!(t instanceof Ee))throw new Error('MeshBVH: "intersectsTriangles" callback can only be used with another MeshBVH.');const y=(m,z,b,p,x,g,w,B)=>{for(let _=b,M=b+p;_<M;_++){d(_),h.a.applyMatrix4(e),h.b.applyMatrix4(e),h.c.applyMatrix4(e),h.needsUpdate=!0;for(let P=m,A=m+z;P<A;P++)if(c(P),r.needsUpdate=!0,n(r,h,P,_,x,g,w,B))return!0}return!1};if(s){const m=s;s=function(z,b,p,x,g,w,B,_){return m(z,b,p,x,g,w,B,_)?!0:y(z,b,p,x,g,w,B,_)}}else s=y}return super.bvhcast(t,e,{intersectsRanges:s})}intersectsBox(t,e){return hi.set(t.min,t.max,e),hi.needsUpdate=!0,this.shapecast({intersectsBounds:i=>hi.intersectsBox(i),intersectsTriangle:i=>hi.intersectsTriangle(i)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,i={},s={},n=0,r=1/0){return(this.indirect?Mr:dr)(this,t,e,i,s,n,r)}closestPointToPoint(t,e={},i=0,s=1/0){return Jn(this,t,e,i,s)}}const cs=self;cs.addEventListener("message",async({data:f})=>{let t=performance.now();function e(a){const o=performance.now();(o-t>=10||a===1)&&(postMessage({error:void 0,serialized:void 0,position:void 0,progress:a}),t=o)}const{id:i,index:s,position:n,options:r}=f;try{const a=new Ii;if(a.setAttribute("position",new mt(n,3,!1)),s&&a.setIndex(new mt(s,1,!1)),r.includedProgressCallback&&(r.onProgress=e),r.groups){const h=r.groups;for(const u in h){const l=h[u];a.addGroup(l.start,l.count,l.materialIndex)}}const o=new Ee(a,r),c=Ee.serialize(o,{cloneBuffers:!1});cs.postMessage({id:i,error:void 0,serialized:c,position:n,progress:1},[c.index.buffer,n.buffer,...c.roots])}catch(a){cs.postMessage({id:i,error:a,serialized:void 0,position:void 0,progress:1})}})})();
31290
31292
  `, io = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", Zo], { type: "text/javascript;charset=utf-8" });
31291
- function tu(c) {
31293
+ function su(c) {
31292
31294
  let t;
31293
31295
  try {
31294
31296
  if (t = io && (self.URL || self.webkitURL).createObjectURL(io), !t) throw "";
@@ -31307,11 +31309,11 @@ function tu(c) {
31307
31309
  );
31308
31310
  }
31309
31311
  }
31310
- class iu {
31312
+ class nu {
31311
31313
  constructor() {
31312
31314
  g(this, "running");
31313
31315
  g(this, "worker");
31314
- this.running = !1, this.worker = new tu(), this.worker.onerror = (t) => {
31316
+ this.running = !1, this.worker = new su(), this.worker.onerror = (t) => {
31315
31317
  throw t.message ? new Error(`[GenerateMeshBVHWorker] Could not create Web Worker with error "${t.message}"`) : new Error("[GenerateMeshBVHWorker] Could not create Web Worker.");
31316
31318
  };
31317
31319
  }
@@ -31392,7 +31394,7 @@ class Ko {
31392
31394
  let e = 1;
31393
31395
  t ? e = t : window.navigator && (e = Math.max(e, window.navigator.hardwareConcurrency - 1));
31394
31396
  for (let i = 0; i < e; i++)
31395
- this.workers[i] = new iu();
31397
+ this.workers[i] = new nu();
31396
31398
  }
31397
31399
  isRunning() {
31398
31400
  return this.running;
@@ -31453,7 +31455,7 @@ class Ko {
31453
31455
  });
31454
31456
  }
31455
31457
  }
31456
- class V0 {
31458
+ class U0 {
31457
31459
  constructor(t, e, i, s, n) {
31458
31460
  g(this, "object");
31459
31461
  g(this, "camera");
@@ -31466,16 +31468,16 @@ class V0 {
31466
31468
  adjustSize() {
31467
31469
  const t = new p.Box3();
31468
31470
  if (this.object.updateMatrix(), t.expandByObject(this.object), !t) return;
31469
- const e = t.max.x - t.min.x, i = this.camera.position.distanceTo(this.object.position), s = su(e, i, this.canvasHeight);
31471
+ const e = t.max.x - t.min.x, i = this.camera.position.distanceTo(this.object.position), s = ru(e, i, this.canvasHeight);
31470
31472
  if (Math.abs(s - this.targetPixelHeight) < 5) return;
31471
31473
  let r = this.object.scale.x;
31472
31474
  r *= this.targetPixelHeight / s, this.object.scale.set(r, r, r), this.object.updateMatrix();
31473
31475
  }
31474
31476
  }
31475
- const su = (c, t, e = 800, i = 45) => {
31477
+ const ru = (c, t, e = 800, i = 45) => {
31476
31478
  const s = i * (Math.PI / 180), n = 2 * Math.tan(s / 2) * t, r = c / n;
31477
31479
  return e * r;
31478
- }, Zs = new p.Vector2(), Ks = new p.Vector2(), $s = new p.Vector2(), so = new p.Vector2(), nu = new p.Vector2(), ru = new p.Vector2(), ge = class ge extends ci {
31480
+ }, Zs = new p.Vector2(), Ks = new p.Vector2(), $s = new p.Vector2(), so = new p.Vector2(), au = new p.Vector2(), ou = new p.Vector2(), ge = class ge extends ci {
31479
31481
  constructor(e) {
31480
31482
  super(j.guid());
31481
31483
  g(this, "needsFrustumCulled");
@@ -31553,7 +31555,7 @@ const su = (c, t, e = 800, i = 45) => {
31553
31555
  * P5 p3 P6
31554
31556
  */
31555
31557
  drawPerpendicular(e, i) {
31556
- const s = this.transToScreenCoord(this.osnapInfo.point, i), n = ge.iconSize / 2, r = Zs.set(s.x, s.y), a = Ks.set(s.x - n, s.y), o = $s.set(s.x, s.y + n), l = so.set(s.x - n, s.y - n), h = nu.set(s.x - n, s.y + n), d = ru.set(s.x + n, s.y + n);
31558
+ const s = this.transToScreenCoord(this.osnapInfo.point, i), n = ge.iconSize / 2, r = Zs.set(s.x, s.y), a = Ks.set(s.x - n, s.y), o = $s.set(s.x, s.y + n), l = so.set(s.x - n, s.y - n), h = au.set(s.x - n, s.y + n), d = ou.set(s.x + n, s.y + n);
31557
31559
  e.moveTo(a.x, a.y), e.lineTo(r.x, r.y), e.lineTo(o.x, o.y), e.moveTo(l.x, l.y), e.lineTo(h.x, h.y), e.lineTo(d.x, d.y), e.lineTo(l.x, l.y);
31558
31560
  }
31559
31561
  update(e) {
@@ -31566,9 +31568,9 @@ const su = (c, t, e = 800, i = 45) => {
31566
31568
  g(ge, "lineColor", "rgba(255, 119, 0, 1)"), g(ge, "FILL_COLOR_NONE", "rgba(0, 0, 0, 0)"), g(ge, "SNAP_LINE_COLOR", "rgba(255, 240, 0, 0.3)"), g(ge, "lineWidth", 2), g(ge, "iconSize", 14);
31567
31569
  let ke = ge;
31568
31570
  xn._registerDrawableClass(ke);
31569
- var au = /* @__PURE__ */ ((c) => (c[c.None = 0] = "None", c[c.Vertex = 1] = "Vertex", c[c.MiddlePoint = 2] = "MiddlePoint", c[c.Edge = 4] = "Edge", c[c.Face = 8] = "Face", c[c.FootOfPerpendicular = 16] = "FootOfPerpendicular", c[c.Intersection = 32] = "Intersection", c[c.CircleCenter = 64] = "CircleCenter", c))(au || {});
31570
- const ou = 1e-5, oe = new p.Vector3(), Se = new p.Vector3(), Vi = new p.Vector3(), hs = new p.Vector3(), ei = new p.Matrix4(), ds = new p.Line3();
31571
- function lu(c, t) {
31571
+ var lu = /* @__PURE__ */ ((c) => (c[c.None = 0] = "None", c[c.Vertex = 1] = "Vertex", c[c.MiddlePoint = 2] = "MiddlePoint", c[c.Edge = 4] = "Edge", c[c.Face = 8] = "Face", c[c.FootOfPerpendicular = 16] = "FootOfPerpendicular", c[c.Intersection = 32] = "Intersection", c[c.CircleCenter = 64] = "CircleCenter", c))(lu || {});
31572
+ const cu = 1e-5, oe = new p.Vector3(), Se = new p.Vector3(), Vi = new p.Vector3(), hs = new p.Vector3(), ei = new p.Matrix4(), ds = new p.Line3();
31573
+ function hu(c, t) {
31572
31574
  let e = Number.MAX_VALUE, i = 0;
31573
31575
  for (let s = 0; s < c.vertices.length; s++) {
31574
31576
  const n = t.distanceTo(c.vertices[s]);
@@ -31579,7 +31581,7 @@ function lu(c, t) {
31579
31581
  distance: e
31580
31582
  };
31581
31583
  }
31582
- function cu(c) {
31584
+ function du(c) {
31583
31585
  if (!(c.object instanceof p.Mesh) || !c.face) return;
31584
31586
  const t = c.object, e = t.geometry.attributes.position;
31585
31587
  let i = t.geometry.index;
@@ -31618,7 +31620,7 @@ function cu(c) {
31618
31620
  distance: l
31619
31621
  };
31620
31622
  }
31621
- class U0 {
31623
+ class N0 {
31622
31624
  constructor(t) {
31623
31625
  g(this, "drawableList", new bn("snap"));
31624
31626
  g(this, "overlayRender");
@@ -31811,7 +31813,7 @@ class U0 {
31811
31813
  const i = this.markers[t];
31812
31814
  i && e && (i.update(e), i.visible = !0), this.overlayRender?.render();
31813
31815
  }
31814
- getFootOfPerpendicular(t, e, i = ou) {
31816
+ getFootOfPerpendicular(t, e, i = cu) {
31815
31817
  const { start: s, end: n } = e, r = s.x - n.x, a = s.y - n.y, o = s.z - n.z;
31816
31818
  if (s.distanceTo(n) < i) return s.clone();
31817
31819
  let l = (t.x - s.x) * (s.x - n.x) + (t.y - s.y) * (s.y - n.y) + (t.z - s.z) * (s.z - n.z);
@@ -31843,14 +31845,14 @@ class U0 {
31843
31845
  1
31844
31846
  /* Vertex */
31845
31847
  ]) return;
31846
- const n = Date.now(), r = cu(e);
31848
+ const n = Date.now(), r = du(e);
31847
31849
  if (!r) {
31848
31850
  P.warn("[OSnap] Failed to get edge !");
31849
31851
  return;
31850
31852
  }
31851
31853
  const a = Date.now();
31852
31854
  P.debug("[OSnap] getEdgeSnappingInfo took " + (a - n) / 1e3 + "s "), P.debug("[OSnap] edge:", r);
31853
- const o = lu(r, t);
31855
+ const o = hu(r, t);
31854
31856
  if (P.debug("[OSnap] vertex:", o), o.distance <= i && this.isOSnapTypeEnabled(
31855
31857
  1
31856
31858
  /* Vertex */
@@ -32087,7 +32089,7 @@ class $o {
32087
32089
  this.childNode.append(t);
32088
32090
  }
32089
32091
  }
32090
- class j0 {
32092
+ class H0 {
32091
32093
  constructor(t) {
32092
32094
  g(this, "viewer");
32093
32095
  g(this, "active", !1);
@@ -32249,7 +32251,7 @@ const Fi = class Fi {
32249
32251
  };
32250
32252
  g(Fi, "BORDER_COLOR", "#fff000"), g(Fi, "BORDER_WIDTH", "2px");
32251
32253
  let br = Fi;
32252
- class hu {
32254
+ class uu {
32253
32255
  constructor(t) {
32254
32256
  g(this, "viewer");
32255
32257
  g(this, "boxSelectHelper");
@@ -32304,11 +32306,11 @@ class hu {
32304
32306
  function no(c) {
32305
32307
  return c ? c.replace(/%%[dD]/g, "°").replace(/%%[cC]/g, "⌀").replace(/%%[pP]/g, "±").replace(/%%(U|O)/gi, "").replace(/\\P/g, " ").replace(/\\[A-Za-z][^;\\]*;/g, "").replace(/[{}]/g, "").replace(/\\\\/g, "\\").replace(/\\[uU]\+([0-9a-fA-F]{4})/g, (t, e) => String.fromCodePoint(parseInt(e, 16))).trim() : "";
32306
32308
  }
32307
- const Js = new p.Box3(), du = new p.Vector3();
32308
- function uu(c, t) {
32309
+ const Js = new p.Box3(), fu = new p.Vector3();
32310
+ function pu(c, t) {
32309
32311
  return c.trim().toLowerCase() === t ? 2e6 : 0;
32310
32312
  }
32311
- function fu(c, t) {
32313
+ function mu(c, t) {
32312
32314
  const e = c.toLowerCase(), i = e.indexOf(t);
32313
32315
  if (i >= 0) return (e === t ? 2e6 : 1e6) + (1e3 - i) - Math.min(e.length, 500);
32314
32316
  let s = 0, n = -1, r = -1, a = 0;
@@ -32415,7 +32417,7 @@ class ro {
32415
32417
  const s = e?.mode ?? "fuzzy", n = e?.layer?.trim().toLowerCase(), r = e?.maxResults ?? 200, a = [];
32416
32418
  for (const o of this.index) {
32417
32419
  if (n && o.layer.toLowerCase() !== n) continue;
32418
- const l = s === "exact" ? uu(o.text, i) : fu(o.text, i);
32420
+ const l = s === "exact" ? pu(o.text, i) : mu(o.text, i);
32419
32421
  l > 0 && a.push({ item: o, score: l });
32420
32422
  }
32421
32423
  return a.sort((o, l) => l.score - o.score), a.slice(0, r).map((o) => o.item);
@@ -32427,7 +32429,7 @@ class ro {
32427
32429
  if (!t) return;
32428
32430
  this.viewer.activateLayout(t.layoutName), this.highlight(t);
32429
32431
  const e = t.box.clone();
32430
- this.viewer.zoomToBBox(e.expandByScalar(Math.max(e.getSize(du).length() * 0.5, 1)));
32432
+ this.viewer.zoomToBBox(e.expandByScalar(Math.max(e.getSize(fu).length() * 0.5, 1)));
32431
32433
  }
32432
32434
  /**
32433
32435
  * 在叠加层用云线框高亮指定结果(替换上一个高亮)。
@@ -32451,7 +32453,7 @@ class ro {
32451
32453
  this.clearHighlight(), this.overlayRender = void 0, this.drawableList = void 0, this.index = [], this.indexedModelObject = void 0;
32452
32454
  }
32453
32455
  }
32454
- class N0 extends ci {
32456
+ class G0 extends ci {
32455
32457
  constructor(e) {
32456
32458
  super("MobileHelper");
32457
32459
  g(this, "position");
@@ -32499,7 +32501,7 @@ class N0 extends ci {
32499
32501
  }
32500
32502
  }
32501
32503
  var Ke = /* @__PURE__ */ ((c) => (c[c.Left = 0] = "Left", c[c.Middle = 1] = "Middle", c[c.Right = 2] = "Right", c[c.Back = 3] = "Back", c[c.Forward = 4] = "Forward", c))(Ke || {});
32502
- class pu extends hi {
32504
+ class gu extends hi {
32503
32505
  constructor(e) {
32504
32506
  super();
32505
32507
  g(this, "element");
@@ -32650,7 +32652,7 @@ class pu extends hi {
32650
32652
  function Qs(c, t) {
32651
32653
  return c[t] !== void 0;
32652
32654
  }
32653
- class mu {
32655
+ class yu {
32654
32656
  constructor(t) {
32655
32657
  g(this, "CLEAR_COLOR");
32656
32658
  g(this, "CLEAR_COLOR_ALPHA");
@@ -32741,7 +32743,7 @@ class mu {
32741
32743
  * Picks an object by mouse position.
32742
32744
  */
32743
32745
  pick(t, e) {
32744
- const i = this.pickBuffer(t, e), s = [i[0], i[1], i[2], i[3]], n = B1(s), r = k1(s);
32746
+ const i = this.pickBuffer(t, e), s = [i[0], i[1], i[2], i[3]], n = D1(s), r = L1(s);
32745
32747
  if (n !== this.EMPTY_MODEL_ID)
32746
32748
  return P.info("[PickMgr] Picked: tilesetId(" + n + "), userId(" + r + ")"), {
32747
32749
  tilesetId: n,
@@ -32779,7 +32781,7 @@ class mu {
32779
32781
  }
32780
32782
  }
32781
32783
  const ao = new p.Vector3();
32782
- class gu {
32784
+ class xu {
32783
32785
  constructor(t) {
32784
32786
  g(this, "viewer");
32785
32787
  g(this, "scene");
@@ -32928,7 +32930,7 @@ class gu {
32928
32930
  }), this.lights = void 0, this.pmremGenerator?.dispose(), this.renderer.domElement.remove(), this.renderer.clear(), this.renderer.dispose(), this.renderer.forceContextLoss(), this.scene.clear();
32929
32931
  }
32930
32932
  }
32931
- class yu {
32933
+ class bu {
32932
32934
  constructor(t) {
32933
32935
  g(this, "history");
32934
32936
  g(this, "step");
@@ -33019,11 +33021,11 @@ class Pr extends hi {
33019
33021
  * @internal
33020
33022
  */
33021
33023
  g(this, "enableRender");
33022
- this.name = rt.BaseViewer, this.clock = new p.Clock(), this.targetMaxFps = 60, this.timeStamp = 0, this.renderEnabled = !0, this.plugins = [], this.loadedModels = [], this.raf = new $1(), this._enableSelection = !0, this.enableRender = (i = 1e3) => {
33024
+ this.name = rt.BaseViewer, this.clock = new p.Clock(), this.targetMaxFps = 60, this.timeStamp = 0, this.renderEnabled = !0, this.plugins = [], this.loadedModels = [], this.raf = new Q1(), this._enableSelection = !0, this.enableRender = (i = 1e3) => {
33023
33025
  this.renderEnabled = !0, this.raf && (this.timeoutSymbol && this.raf.clearTimeout(this.timeoutSymbol), this.timeoutSymbol = this.raf.setTimeout(() => {
33024
33026
  this.renderEnabled = !1;
33025
33027
  }, i));
33026
- }, this.viewerCfg = e, this.initLogLevel(), this.initLocalization(), this.container = new Go(e.containerId), e.enableProgressBar && (this.progressBar = new Wo(this.container)), this.spinner = new j1(this.container), this.sceneManager = new gu(this), this.pickManager = new mu(this), this.overlayRender = new xn(this), this.css2dRenderer = this.initCSS2DRenderer(), this.inputManager = new pu(this.viewerContainer), this.cameraManager = new Y1(this), this.loaderHelper = new oi(), this.undoManager = new yu(), this.resize(), this.clock.start(), this.animate();
33028
+ }, this.viewerCfg = e, this.initLogLevel(), this.initLocalization(), this.container = new Go(e.containerId), e.enableProgressBar && (this.progressBar = new Wo(this.container)), this.spinner = new H1(this.container), this.sceneManager = new xu(this), this.pickManager = new yu(this), this.overlayRender = new xn(this), this.css2dRenderer = this.initCSS2DRenderer(), this.inputManager = new gu(this.viewerContainer), this.cameraManager = new Z1(this), this.loaderHelper = new oi(), this.undoManager = new bu(), this.resize(), this.clock.start(), this.animate();
33027
33029
  }
33028
33030
  initLogLevel() {
33029
33031
  const e = this.viewerCfg.logLevel;
@@ -33158,7 +33160,7 @@ class Pr extends hi {
33158
33160
  * ```
33159
33161
  */
33160
33162
  zoomToRect() {
33161
- !this.zoomToRectHelper && (this.zoomToRectHelper = new hu(this)), this.zoomToRectHelper.activate();
33163
+ !this.zoomToRectHelper && (this.zoomToRectHelper = new uu(this)), this.zoomToRectHelper.activate();
33162
33164
  }
33163
33165
  /**
33164
33166
  * @internal
@@ -33386,7 +33388,7 @@ class Pr extends hi {
33386
33388
  return this.plugins.find((i) => i.id === e);
33387
33389
  }
33388
33390
  }
33389
- const xu = -1e3, Ei = new p.Vector3(), oo = new p.Matrix4(), lo = new p.Frustum(), ar = new p.Box3(), co = new p.Matrix4();
33391
+ const wu = -1e3, Ei = new p.Vector3(), oo = new p.Matrix4(), lo = new p.Frustum(), ar = new p.Box3(), co = new p.Matrix4();
33390
33392
  class Jo extends Pr {
33391
33393
  constructor(e) {
33392
33394
  super(e);
@@ -33415,9 +33417,11 @@ class Jo extends Pr {
33415
33417
  g(this, "clickHighlightList");
33416
33418
  /** 是否启用点击实体高亮,默认关闭 */
33417
33419
  g(this, "_enableClickHighlight", !1);
33420
+ /** 全局默认请求头(如认证 token),loadModel 未显式传 headers 时使用 */
33421
+ g(this, "requestHeaders");
33418
33422
  /** 打印截图进行中:临时强制显示所有图符/文字,避免低缩放时被"视觉过小"逻辑隐藏 */
33419
33423
  g(this, "_printCaptureMode", !1);
33420
- this.name = rt.Viewer2d, this.loadedModels = [], this.masterModelId = "", this.activeLayoutName = "", this.layoutInfos = {}, this.units = void 0, this.enableHideVisuallySmallObjects = e.enableHideVisuallySmallObjects !== !1, this.sortedHidableObjects = {}, this.lastCameraZoom = 1 / 0, this.loadingDxfCount = 0, e.enableLayoutBar && (this.dxfLayoutBar = new V1(this)), this.cameraManager.setProjection(St.Orthographic), this.cameraManager.setNavigationMode(yt.Plan);
33424
+ this.name = rt.Viewer2d, this.loadedModels = [], this.masterModelId = "", this.activeLayoutName = "", this.layoutInfos = {}, this.units = void 0, this.enableHideVisuallySmallObjects = e.enableHideVisuallySmallObjects !== !1, this.sortedHidableObjects = {}, this.lastCameraZoom = 1 / 0, this.loadingDxfCount = 0, e.enableLayoutBar && (this.dxfLayoutBar = new U1(this)), this.cameraManager.setProjection(St.Orthographic), this.cameraManager.setNavigationMode(yt.Plan);
33421
33425
  const i = new p.Vector3(0, 0, 100), s = new p.Vector3(0, 0, 0);
33422
33426
  this.cameraManager.setCameraConfig({
33423
33427
  eye: i,
@@ -33537,6 +33541,18 @@ class Jo extends Pr {
33537
33541
  clearClickHighlight() {
33538
33542
  this.clickHighlightList?.clear(), this.enableRender();
33539
33543
  }
33544
+ /**
33545
+ * 设置后续所有 loadModel 下载 src 时附带的默认 HTTP 请求头(如认证 token)。
33546
+ * 传入 undefined 可清除。按次在 modelCfg.headers 中指定的请求头优先级更高。
33547
+ * @example
33548
+ * ```typescript
33549
+ * viewer.setRequestHeaders({ Authorization: "Bearer " + token });
33550
+ * await viewer.loadModel({ modelId: "a", src: "https://host/a.dxf" });
33551
+ * ```
33552
+ */
33553
+ setRequestHeaders(e) {
33554
+ this.requestHeaders = e;
33555
+ }
33540
33556
  handleMouseClick(e) {
33541
33557
  if (!this.enableSelection) return;
33542
33558
  const i = new p.Vector2(e.x, e.y), s = this.getWorldPositionByMousePick(i);
@@ -33619,7 +33635,8 @@ class Jo extends Pr {
33619
33635
  /* 类型桥接:字段位于派生配置类型 */
33620
33636
  enableMerge: e.merge,
33621
33637
  encoding: e.encoding,
33622
- overrideColor: e.overrideColor
33638
+ overrideColor: e.overrideColor,
33639
+ requestHeaders: e.headers ?? this.requestHeaders
33623
33640
  }).finally(() => {
33624
33641
  this.loadingDxfCount--, this.loadingDxfCount === 0 && this.fontManager?.releaseFontData();
33625
33642
  }), f = u.threejsObject;
@@ -33710,7 +33727,7 @@ class Jo extends Pr {
33710
33727
  color: "#888",
33711
33728
  side: p.DoubleSide
33712
33729
  });
33713
- this.groundPlane = new p.Mesh(o, l), this.groundPlane.visible = !1, this.groundPlane.position.set(a.x, a.y, -r.z), this.groundPlane.scale.set(1e5, 1e5, 1), this.groundPlane.name = "groundPlane", this.groundPlane.renderOrder = xu, this.groundPlane.layers.enableAll(), Q.disableLayerChannels(this.groundPlane, [li]), this.scene.add(this.groundPlane);
33730
+ this.groundPlane = new p.Mesh(o, l), this.groundPlane.visible = !1, this.groundPlane.position.set(a.x, a.y, -r.z), this.groundPlane.scale.set(1e5, 1e5, 1), this.groundPlane.name = "groundPlane", this.groundPlane.renderOrder = wu, this.groundPlane.layers.enableAll(), Q.disableLayerChannels(this.groundPlane, [li]), this.scene.add(this.groundPlane);
33714
33731
  }
33715
33732
  this.groundPlane.updateMatrix(), this.groundPlane.updateMatrixWorld(!0);
33716
33733
  }
@@ -33826,13 +33843,14 @@ class Jo extends Pr {
33826
33843
  l.extent = this.getBBox();
33827
33844
  let d = this.getLayoutExtentEx(s);
33828
33845
  if (d) {
33829
- const m = d.max.x - d.min.x, b = d.max.y - d.min.y;
33830
- (m < 1e-16 || b < 1e-16 || m > 1e16 || b > 1e16) && (P.warn(
33846
+ const b = d.max.x - d.min.x, y = d.max.y - d.min.y;
33847
+ (b < 1e-16 || y < 1e-16 || b > 1e16 || y > 1e16) && (P.warn(
33831
33848
  "[Viewer] Got wired bbox, max: " + d.max.toArray() + ", min: " + d.min.toArray() + ", going to use the calculated one..."
33832
33849
  ), d = l.extent);
33833
33850
  } else
33834
33851
  P.warn("[Viewer] Failed to get layout extent, going to use the calculated one..."), d = l.extent;
33835
- l.homeViewExtent = d, this.zoomToBBox(d);
33852
+ const u = l.extent;
33853
+ d && !u.isEmpty() && (d.intersectsBox(u) ? d.union(u) : (P.warn("[Viewer] Layout extent from header is far from actual geometry, using computed bbox instead."), d = u.clone())), l.homeViewExtent = d, this.zoomToBBox(d);
33836
33854
  }
33837
33855
  const h = i.getLayoutLevelObject(e);
33838
33856
  h && this.setLayoutHidableObjectArray(h), this.enableRender();
@@ -34369,7 +34387,7 @@ class Jo extends Pr {
34369
34387
  X.CameraZoomUniform.value = e * this.container.height / 50;
34370
34388
  }
34371
34389
  }
34372
- class bu {
34390
+ class vu {
34373
34391
  constructor(t) {
34374
34392
  /**
34375
34393
  * Viewer2d of DxfCompareHelper.
@@ -34526,7 +34544,7 @@ class bu {
34526
34544
  this.setSpinnerVisibility(--this.jobCount > 0);
34527
34545
  }
34528
34546
  }
34529
- class H0 extends bu {
34547
+ class W0 extends vu {
34530
34548
  constructor(e, i) {
34531
34549
  super(e);
34532
34550
  /**
@@ -34637,7 +34655,7 @@ class H0 extends bu {
34637
34655
  * 延迟到下一帧执行,确保模型已加入场景、overlay 尺寸已就绪。
34638
34656
  */
34639
34657
  drawCompareBoxes() {
34640
- this.changes && (this.markupManager1 ?? (this.markupManager1 = new ja(this.viewer)), this.markupManager2 ?? (this.markupManager2 = new ja(this.viewer2)), requestAnimationFrame(() => {
34658
+ this.changes && (this.markupManager1 ?? (this.markupManager1 = new Ua(this.viewer)), this.markupManager2 ?? (this.markupManager2 = new Ua(this.viewer2)), requestAnimationFrame(() => {
34641
34659
  this.markupManager1?.drawCompareDrawable(this.changes), this.markupManager2?.drawCompareDrawable(this.changes), this.viewer.enableRender(), this.viewer2.enableRender();
34642
34660
  }));
34643
34661
  }
@@ -34720,7 +34738,7 @@ const as = Array.isArray, ho = (c, t) => c[0] === t[0] && c[1] === t[1], or = (c
34720
34738
  }
34721
34739
  return c;
34722
34740
  };
34723
- class G0 {
34741
+ class q0 {
34724
34742
  constructor(t, e = 5) {
34725
34743
  g(this, "vertices");
34726
34744
  g(this, "edges");
@@ -34865,7 +34883,7 @@ class el {
34865
34883
  g(this, "bloomPass");
34866
34884
  g(this, "unrealBloomPass");
34867
34885
  g(this, "vertexNormalsHelpers");
34868
- this.composerEnabled = !0, this.viewer = t, this.composer = new jl(this.viewer.renderer), this.viewer.addEventListener(ce.AfterRender, () => this.render());
34886
+ this.composerEnabled = !0, this.viewer = t, this.composer = new Ul(this.viewer.renderer), this.viewer.addEventListener(ce.AfterRender, () => this.render());
34869
34887
  }
34870
34888
  get enabled() {
34871
34889
  return this.composerEnabled;
@@ -35010,7 +35028,7 @@ class el {
35010
35028
  this.renderPass && (this.composer?.removePass(this.renderPass), this.renderPass.dispose(), this.renderPass = void 0), this.effectFxaaPass && (this.composer?.removePass(this.effectFxaaPass), this.effectFxaaPass.dispose(), this.effectFxaaPass = void 0), this.saoPass && (this.composer?.removePass(this.saoPass), this.saoPass.dispose(), this.saoPass = void 0), this.ssaoPass && (this.composer?.removePass(this.ssaoPass), this.ssaoPass.dispose(), this.ssaoPass = void 0), this.outlinePass && (this.composer?.removePass(this.outlinePass), this.outlinePass.dispose(), this.outlinePass = void 0), this.ssaaRenderPass && (this.composer?.removePass(this.ssaaRenderPass), this.ssaaRenderPass.dispose(), this.ssaaRenderPass = void 0), this.bloomPass && (this.composer?.removePass(this.bloomPass), this.bloomPass.dispose(), this.bloomPass = void 0), this.unrealBloomPass && (this.composer?.removePass(this.unrealBloomPass), this.unrealBloomPass.dispose(), this.unrealBloomPass = void 0), this.composer && (this.composer?.dispose(), this.composer = void 0);
35011
35029
  }
35012
35030
  }
35013
- class W0 extends Pr {
35031
+ class Y0 extends Pr {
35014
35032
  constructor(e, i) {
35015
35033
  super(e);
35016
35034
  g(this, "name");
@@ -35317,20 +35335,20 @@ function fo(c) {
35317
35335
  texturePixels: 0
35318
35336
  }), c);
35319
35337
  }
35320
- function wu(c) {
35338
+ function Mu(c) {
35321
35339
  const t = {
35322
35340
  transform: new p.Matrix4(),
35323
35341
  boundingVolume: new p.Box3()
35324
35342
  };
35325
35343
  return Object.assign(Object.assign({}, t), c);
35326
35344
  }
35327
- class vu {
35345
+ class Tu {
35328
35346
  constructor(t) {
35329
35347
  g(this, "url");
35330
35348
  g(this, "metadata");
35331
35349
  g(this, "statistics");
35332
35350
  g(this, "view");
35333
- this.url = t, this.metadata = uo(), this.statistics = fo(), this.view = wu();
35351
+ this.url = t, this.metadata = uo(), this.statistics = fo(), this.view = Mu();
35334
35352
  }
35335
35353
  async parse() {
35336
35354
  return await fetch(this.url).then((t) => t.ok ? t.json() : (P.error(
@@ -35347,8 +35365,8 @@ class vu {
35347
35365
  return this.view;
35348
35366
  }
35349
35367
  }
35350
- let Mu = 0;
35351
- class q0 extends Pr {
35368
+ let Cu = 0;
35369
+ class X0 extends Pr {
35352
35370
  constructor(e, i) {
35353
35371
  super(e);
35354
35372
  g(this, "name");
@@ -35528,7 +35546,7 @@ class q0 extends Pr {
35528
35546
  */
35529
35547
  async loadModel(e, i) {
35530
35548
  if (e.src.length === 0) return Promise.reject();
35531
- const s = new vu(e.src);
35549
+ const s = new Tu(e.src);
35532
35550
  if (!await s.parse()) return Promise.reject();
35533
35551
  let r = e.src.replace(/\/[^\\/]*\/?$/, "/");
35534
35552
  r = new URL(r, window.location.href).toString(), this.spinner.increaseJobCount();
@@ -35536,7 +35554,7 @@ class q0 extends Pr {
35536
35554
  a.applyMatrix4(s.getView().transform);
35537
35555
  const o = new Ho(
35538
35556
  {
35539
- modelId: "" + Mu++,
35557
+ modelId: "" + Cu++,
35540
35558
  bbox: a
35541
35559
  },
35542
35560
  r,
@@ -35664,7 +35682,7 @@ class q0 extends Pr {
35664
35682
  });
35665
35683
  }
35666
35684
  }
35667
- class Y0 extends hi {
35685
+ class Z0 extends hi {
35668
35686
  /**
35669
35687
  * Creates this Plugin and installs it into the given {@link Viewer}.
35670
35688
  *
@@ -35687,7 +35705,7 @@ class Y0 extends hi {
35687
35705
  }
35688
35706
  }
35689
35707
  $.install({ THREE: p });
35690
- class Tu extends $ {
35708
+ class Su extends $ {
35691
35709
  constructor(e, i) {
35692
35710
  super(e, i);
35693
35711
  g(this, "minZoom");
@@ -35763,8 +35781,8 @@ class Tu extends $ {
35763
35781
  super.dispose(), this.stopListenToKeyEvents();
35764
35782
  }
35765
35783
  }
35766
- var Cu = /* @__PURE__ */ ((c) => (c[c.Browser = 0] = "Browser", c[c.Browserless = 1] = "Browserless", c[c.Headless = 2] = "Headless", c))(Cu || {});
35767
- class X0 {
35784
+ var Eu = /* @__PURE__ */ ((c) => (c[c.Browser = 0] = "Browser", c[c.Browserless = 1] = "Browserless", c[c.Headless = 2] = "Headless", c))(Eu || {});
35785
+ class K0 {
35768
35786
  constructor(t, e, i) {
35769
35787
  g(this, "containerOrCanvas");
35770
35788
  g(this, "glContext");
@@ -35876,7 +35894,7 @@ class X0 {
35876
35894
  if (!this.renderer) return;
35877
35895
  const t = this.camera;
35878
35896
  if (!t) return;
35879
- const e = new Tu(t, this.renderer.domElement);
35897
+ const e = new Su(t, this.renderer.domElement);
35880
35898
  e.smoothTime = 0.05, e.enabled = !0, e.keyTruckSpeed = 10, e.keys = {
35881
35899
  left: "KeyD",
35882
35900
  up: "KeyE",
@@ -36163,22 +36181,22 @@ class X0 {
36163
36181
  this.camera && (this.camera.fov = t, this.camera.updateProjectionMatrix());
36164
36182
  }
36165
36183
  }
36166
- const tl = "1.0.0", il = "VERSION", Su = () => window.localStorage.getItem(il), Eu = () => {
36184
+ const tl = "1.0.0", il = "VERSION", Ou = () => window.localStorage.getItem(il), _u = () => {
36167
36185
  window.localStorage.setItem(il, tl);
36168
- }, Z0 = () => Su() !== tl ? (Eu(), !0) : !1;
36186
+ }, $0 = () => Ou() !== tl ? (_u(), !0) : !1;
36169
36187
  export {
36170
- bu as BaseDxfCompareHelper,
36188
+ vu as BaseDxfCompareHelper,
36171
36189
  Pr as BaseViewer,
36172
36190
  Ho as BimTilesModel,
36173
- F1 as BimTilesRenderer,
36174
- q0 as BimTilesViewer,
36191
+ V1 as BimTilesRenderer,
36192
+ X0 as BimTilesViewer,
36175
36193
  wn as BinaryReader,
36176
36194
  br as BoxSelectHelper,
36177
36195
  hn as ByBlock,
36178
36196
  Po as ByLayer,
36179
- M0 as CSS2DObjectUtils,
36197
+ C0 as CSS2DObjectUtils,
36180
36198
  St as CameraProjection,
36181
- w0 as CancelablePromise,
36199
+ M0 as CancelablePromise,
36182
36200
  xn as CanvasRender,
36183
36201
  gs as ColorUtils,
36184
36202
  j as CommonUtils,
@@ -36192,107 +36210,107 @@ export {
36192
36210
  Fn as DefaultCameraNear,
36193
36211
  wh as DefaultLanguage,
36194
36212
  Eo as DefaultOpacity,
36195
- F0 as DefaultViewer3dConfig,
36213
+ V0 as DefaultViewer3dConfig,
36196
36214
  Le as DeviceUtils,
36197
36215
  ci as Drawable,
36198
36216
  bn as DrawableList,
36199
36217
  We as DxfChangeType,
36200
36218
  gt as DxfCompare,
36201
- H0 as DxfCompareHelper,
36202
- ja as DxfCompareMarkupManager,
36219
+ W0 as DxfCompareHelper,
36220
+ Ua as DxfCompareMarkupManager,
36203
36221
  X as DxfLoader,
36204
- i1 as DxfParser,
36222
+ n1 as DxfParser,
36205
36223
  Be as DxfRenderOrder,
36206
36224
  kt as DxfUtils,
36207
36225
  Eh as EdgeUtils,
36208
36226
  hi as Event,
36209
36227
  sa as ExportUtils,
36210
36228
  Tt as FontManager,
36211
- O0 as FpsUtils,
36212
- iu as GenerateMeshBvhWorker,
36229
+ P0 as FpsUtils,
36230
+ nu as GenerateMeshBvhWorker,
36213
36231
  N as GeometryUtils,
36214
- xu as GroundPlaneRenderOrder,
36232
+ wu as GroundPlaneRenderOrder,
36215
36233
  So as HighlightColor,
36216
- C0 as HighlightColorRgba,
36217
- S0 as IconfontClass,
36218
- E0 as IconfontClass2,
36219
- pu as InputManager,
36220
- z0 as InstantiateHelper,
36234
+ E0 as HighlightColorRgba,
36235
+ O0 as IconfontClass,
36236
+ _0 as IconfontClass2,
36237
+ gu as InputManager,
36238
+ j0 as InstantiateHelper,
36221
36239
  vh as LayerForHitableObjects,
36222
36240
  li as LayerForSelectableObjects,
36223
36241
  qe as LayerForSnapableObjects,
36224
- y0 as Line,
36225
- Kh as LinePatternShaders,
36242
+ b0 as Line,
36243
+ Jh as LinePatternShaders,
36226
36244
  oi as LoadingHelper,
36227
36245
  Me as MaterialUtils,
36228
36246
  F as MathUtils,
36229
36247
  xt as MatrixAutoUpdate,
36230
36248
  ye as MergeUtils,
36231
- J0 as Mesh,
36249
+ ef as Mesh,
36232
36250
  Ko as MeshBvhHelper,
36233
- N0 as MobileTouchHelperDrawable,
36251
+ G0 as MobileTouchHelperDrawable,
36234
36252
  Or as Model,
36235
36253
  ys as Model2d,
36236
36254
  Ro as Model3d,
36237
36255
  sn as NestedCompareTypes,
36238
- U0 as OSnapHelper,
36239
- I0 as OSnapIconSize,
36256
+ N0 as OSnapHelper,
36257
+ k0 as OSnapIconSize,
36240
36258
  Lt as OSnapMarkerType,
36241
- au as OSnapType,
36242
- V0 as ObjectPixelSizeHelper,
36259
+ lu as OSnapType,
36260
+ U0 as ObjectPixelSizeHelper,
36243
36261
  Q as ObjectUtils,
36244
- G0 as Offset,
36245
- W1 as OrbitControls,
36262
+ q0 as Offset,
36263
+ Y1 as OrbitControls,
36246
36264
  Rn as OutlineColorRgba,
36247
- j0 as PickMarkupHelper,
36248
- q1 as PlanControls,
36249
- Y0 as Plugin,
36250
- x0 as Points,
36251
- P0 as PolygonUtils,
36265
+ H0 as PickMarkupHelper,
36266
+ X1 as PlanControls,
36267
+ Z0 as Plugin,
36268
+ w0 as Points,
36269
+ I0 as PolygonUtils,
36252
36270
  Wo as ProgressBar,
36253
- $1 as RafHelper,
36254
- B0 as SVGObjectUtils,
36271
+ Q1 as RafHelper,
36272
+ D0 as SVGObjectUtils,
36255
36273
  zt as SceneUtils,
36256
36274
  ai as SectionUtils,
36257
- b0 as ShaderChunk,
36258
- A0 as SimplifyUtils,
36275
+ v0 as ShaderChunk,
36276
+ B0 as SimplifyUtils,
36259
36277
  ke as SnapDrawable,
36260
- j1 as Spinner,
36278
+ H1 as Spinner,
36261
36279
  ro as TextSearchHelper,
36262
36280
  cn as TextureUtils,
36263
36281
  Oo as ThresholdAngleForEdge,
36264
36282
  ua as UnitConversionByMeter,
36265
- Bh as UnitLabels,
36266
- L0 as UnitScaleConversion,
36283
+ Dh as UnitLabels,
36284
+ F0 as UnitScaleConversion,
36267
36285
  ga as UnitScaleToMeter,
36268
36286
  st as Units,
36269
36287
  Jo as Viewer2d,
36270
- W0 as Viewer3d,
36271
- X0 as Viewer3dLite,
36272
- D0 as Viewer3dUtils,
36288
+ Y0 as Viewer3d,
36289
+ K0 as Viewer3dLite,
36290
+ R0 as Viewer3dUtils,
36273
36291
  ce as ViewerEvent,
36274
- Cu as ViewerMode,
36292
+ Eu as ViewerMode,
36275
36293
  rt as ViewerName,
36276
- kh as Views,
36277
- hu as ZoomToRectHelper,
36278
- Gh as bspline,
36279
- Z0 as checkIsNewVersion,
36294
+ Lh as Views,
36295
+ uu as ZoomToRectHelper,
36296
+ qh as bspline,
36297
+ $0 as checkIsNewVersion,
36280
36298
  da as cn,
36281
- $h as createHatchPatternShaderMaterial,
36282
- Yh as decodeDxfTextCharacterCodes,
36283
- Zh as decodeDxfTextMbcsCharacterCodes,
36284
- Xh as decodeDxfTextUnicodeCodePoints,
36285
- _0 as en,
36286
- k0 as getLengthValueByUnit,
36299
+ Qh as createHatchPatternShaderMaterial,
36300
+ Zh as decodeDxfTextCharacterCodes,
36301
+ $h as decodeDxfTextMbcsCharacterCodes,
36302
+ Kh as decodeDxfTextUnicodeCodePoints,
36303
+ A0 as en,
36304
+ L0 as getLengthValueByUnit,
36287
36305
  fa as getUnitStr,
36288
- Su as getVersionFromLocalStorage,
36306
+ Ou as getVersionFromLocalStorage,
36289
36307
  lt as i18n,
36290
36308
  P as log,
36291
36309
  nn as parseDxfMTextContent,
36292
36310
  Wn as parseDxfTextContent,
36293
- Hh as round10,
36294
- v0 as setIcon,
36311
+ Wh as round10,
36312
+ T0 as setIcon,
36295
36313
  xh as setLogLevel,
36296
- Eu as setVersionToLocalStorage,
36297
- T0 as showPrecisionValue
36314
+ _u as setVersionToLocalStorage,
36315
+ S0 as showPrecisionValue
36298
36316
  };