build-dxf 0.0.39 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/build.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import * as I from "three";
2
- import { EventDispatcher as Bt, Color as Ot, Matrix4 as Lt, Vector3 as J, Quaternion as Ft, BufferAttribute as _, REVISION as Ut, CompressedTexture as tt, Source as Gt, NoColorSpace as jt, MathUtils as it, RGBAFormat as zt, ImageUtils as _t, DoubleSide as qt, PropertyBinding as $, InterpolateDiscrete as Yt, Scene as ut, SRGBColorSpace as kt, NearestFilter as Xt, NearestMipmapNearestFilter as Vt, NearestMipmapLinearFilter as Wt, LinearFilter as Ht, LinearMipmapNearestFilter as Jt, LinearMipmapLinearFilter as $t, ClampToEdgeWrapping as Kt, RepeatWrapping as Zt, MirroredRepeatWrapping as Qt, InterpolateLinear as te } from "three";
3
- import dt from "clipper-lib";
4
- import H from "dxf-writer";
5
- import { OBJExporter as ee } from "three/examples/jsm/exporters/OBJExporter.js";
6
- function rt() {
2
+ import { EventDispatcher as Ot, Color as Ft, Matrix4 as bt, Vector3 as $, Quaternion as Gt, BufferAttribute as _, REVISION as Ut, CompressedTexture as nt, Source as zt, NoColorSpace as jt, MathUtils as ot, RGBAFormat as _t, ImageUtils as qt, DoubleSide as Yt, PropertyBinding as K, InterpolateDiscrete as kt, Scene as ft, SRGBColorSpace as Vt, NearestFilter as Xt, NearestMipmapNearestFilter as Wt, NearestMipmapLinearFilter as Ht, LinearFilter as Jt, LinearMipmapNearestFilter as $t, LinearMipmapLinearFilter as Kt, ClampToEdgeWrapping as Zt, RepeatWrapping as Qt, MirroredRepeatWrapping as te, InterpolateLinear as ee } from "three";
3
+ import pt from "clipper-lib";
4
+ import J from "dxf-writer";
5
+ import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
6
+ function at() {
7
7
  return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(d) {
8
8
  var t = Math.random() * 16 | 0, e = d == "x" ? t : t & 3 | 8;
9
9
  return e.toString(16);
10
10
  });
11
11
  }
12
- class At extends Bt {
13
- uuid = rt();
12
+ class It extends Ot {
13
+ uuid = at();
14
14
  addEventListener(t, e, n) {
15
15
  const { once: s = !1 } = n ?? {}, i = (o) => {
16
16
  e(o), s && r();
@@ -30,7 +30,7 @@ class At extends Bt {
30
30
  e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
31
31
  }
32
32
  }
33
- class q extends At {
33
+ class q extends It {
34
34
  parent;
35
35
  destroyed = !1;
36
36
  constructor(...t) {
@@ -48,7 +48,7 @@ class q extends At {
48
48
  this.destroyed = !0;
49
49
  }
50
50
  }
51
- class ne extends At {
51
+ class se extends It {
52
52
  static EventType = {
53
53
  ADD_COMPONENT: "addComponent"
54
54
  };
@@ -116,7 +116,7 @@ class ne extends At {
116
116
  return e || null;
117
117
  }
118
118
  }
119
- class R {
119
+ class N {
120
120
  minX = 0;
121
121
  maxX = 0;
122
122
  minY = 0;
@@ -203,8 +203,8 @@ class R {
203
203
  for (let c = 0; c < 4; c++) {
204
204
  const l = o[c], h = o[(c + 1) % 4];
205
205
  for (let u = 0; u < 4; u++) {
206
- const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), g = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), w = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
- if (y * x < 0 && g * w < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || g === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || w === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
206
+ const f = e[u], p = e[(u + 1) % 4], y = (h.x - l.x) * (f.y - l.y) - (h.y - l.y) * (f.x - l.x), x = (h.x - l.x) * (p.y - l.y) - (h.y - l.y) * (p.x - l.x), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), E = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
+ if (y * x < 0 && m * E < 0 || y === 0 && Math.min(l.x, h.x) <= f.x && f.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= f.y && f.y <= Math.max(l.y, h.y) || x === 0 && Math.min(l.x, h.x) <= p.x && p.x <= Math.max(l.x, h.x) && Math.min(l.y, h.y) <= p.y && p.y <= Math.max(l.y, h.y) || m === 0 && Math.min(f.x, p.x) <= l.x && l.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= l.y && l.y <= Math.max(f.y, p.y) || E === 0 && Math.min(f.x, p.x) <= h.x && h.x <= Math.max(f.x, p.x) && Math.min(f.y, p.y) <= h.y && h.y <= Math.max(f.y, p.y))
208
208
  return !0;
209
209
  }
210
210
  }
@@ -299,7 +299,7 @@ class R {
299
299
  * @returns
300
300
  */
301
301
  clone() {
302
- return new R(this.minX, this.maxX, this.minY, this.maxY);
302
+ return new N(this.minX, this.maxX, this.minY, this.maxY);
303
303
  }
304
304
  /**
305
305
  *
@@ -310,7 +310,7 @@ class R {
310
310
  const e = [], n = [];
311
311
  return t.forEach((s) => {
312
312
  e.push(s.x), n.push(s.y);
313
- }), new R(
313
+ }), new N(
314
314
  Math.min(...e),
315
315
  Math.max(...e),
316
316
  Math.min(...n),
@@ -328,7 +328,7 @@ class R {
328
328
  s?.points?.forEach((i) => {
329
329
  e.push(i.x), n.push(i.y);
330
330
  });
331
- }), new R(
331
+ }), new N(
332
332
  Math.min(...e),
333
333
  Math.max(...e),
334
334
  Math.min(...n),
@@ -415,7 +415,7 @@ class X {
415
415
  * @returns 相交的节点数组
416
416
  */
417
417
  queryCircle(t, e) {
418
- const n = new R(t.x - e, t.x + e, t.y - e, t.y + e), s = Math.ceil(n.minX / this.gridSize), i = Math.ceil(n.maxX / this.gridSize), r = Math.ceil(n.minY / this.gridSize), o = Math.ceil(n.maxY / this.gridSize), a = [];
418
+ const n = new N(t.x - e, t.x + e, t.y - e, t.y + e), s = Math.ceil(n.minX / this.gridSize), i = Math.ceil(n.maxX / this.gridSize), r = Math.ceil(n.minY / this.gridSize), o = Math.ceil(n.maxY / this.gridSize), a = [];
419
419
  for (let c = s; c <= i; c++)
420
420
  for (let l = r; l <= o; l++) {
421
421
  const h = `${c}.${l}`;
@@ -465,7 +465,7 @@ class X {
465
465
  return null;
466
466
  }
467
467
  }
468
- class Q {
468
+ class et {
469
469
  points;
470
470
  get p0() {
471
471
  return this.points[0];
@@ -606,7 +606,7 @@ class Q {
606
606
  let t = 1 / 0, e = -1 / 0, n = 1 / 0, s = -1 / 0;
607
607
  return this.points.forEach((i) => {
608
608
  e = Math.max(i.x, e), t = Math.min(i.x, t), s = Math.max(i.x, s), n = Math.min(i.x, n);
609
- }), new R(t, e, n, s);
609
+ }), new N(t, e, n, s);
610
610
  }
611
611
  /**
612
612
  *
@@ -616,7 +616,7 @@ class Q {
616
616
  */
617
617
  static fromByLineSegment(t, e = 0.1, n = !1, s = 0.5) {
618
618
  const i = t.points[0], r = t.points[1], o = r.normal(i), a = n ? r.direction(i).mutiplyScalar(e * s) : M.zero(), c = n ? i.direction(r).mutiplyScalar(e * s) : M.zero(), l = o.x * e * 0.5, h = o.y * e * 0.5;
619
- return new Q([
619
+ return new et([
620
620
  new M(i.x + l, i.y + h).add(c),
621
621
  new M(r.x + l, r.y + h).add(a),
622
622
  new M(r.x - l, r.y - h).add(a),
@@ -624,7 +624,7 @@ class Q {
624
624
  ]);
625
625
  }
626
626
  }
627
- class D {
627
+ class A {
628
628
  points = [new M(), new M()];
629
629
  userData = {};
630
630
  // line: any
@@ -646,6 +646,9 @@ class D {
646
646
  set(t, e) {
647
647
  return this.start.copy(t), this.end.copy(e), this;
648
648
  }
649
+ getAnotherPoint(t) {
650
+ return t === this.start ? this.end : this.start;
651
+ }
649
652
  /**
650
653
  * 是否有相同端点
651
654
  * @param line
@@ -734,7 +737,7 @@ class D {
734
737
  new M(n.x - a, n.y - c).add(o),
735
738
  new M(s.x - a, s.y - c).add(r)
736
739
  ];
737
- return new Q([0, 1, 3, 2].map((h) => l[h]));
740
+ return new et([0, 1, 3, 2].map((h) => l[h]));
738
741
  }
739
742
  /**
740
743
  * 计算线段的长度
@@ -775,8 +778,8 @@ class D {
775
778
  if (r.x === 0 && r.y === 0)
776
779
  throw new Error("投影目标线段的两个点不能重合");
777
780
  const o = (p) => {
778
- const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, w = (y.x * r.x + y.y * r.y) / x, E = s.x + w * r.x, m = s.y + w * r.y;
779
- return new M(E, m);
781
+ const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, E = (y.x * r.x + y.y * r.y) / x, w = s.x + E * r.x, g = s.y + E * r.y;
782
+ return new M(w, g);
780
783
  };
781
784
  let a = o(e), c = o(n);
782
785
  const l = (p) => {
@@ -785,10 +788,10 @@ class D {
785
788
  };
786
789
  let h = l(a), u = l(c);
787
790
  const f = (p) => {
788
- const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, g = s.y + y * r.y;
789
- return new M(x, g);
791
+ const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, m = s.y + y * r.y;
792
+ return new M(x, m);
790
793
  };
791
- return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new D(a, a) : new D(a, c);
794
+ return (h < 0 || h > 1) && (a = f(h)), (u < 0 || u > 1) && (c = f(u)), a.x === c.x && a.y === c.y ? new A(a, a) : new A(a, c);
792
795
  }
793
796
  /**
794
797
  * 计算一条线段在另一条直线上的投影
@@ -869,7 +872,7 @@ class D {
869
872
  * @param line
870
873
  */
871
874
  parallel(t, e = 1) {
872
- return t instanceof D ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
875
+ return t instanceof A ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
873
876
  }
874
877
  /** 两条线段或角度是否 垂直
875
878
  * @param line
@@ -877,7 +880,7 @@ class D {
877
880
  * @returns
878
881
  */
879
882
  vertical(t, e = 0.1) {
880
- return t instanceof D ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
883
+ return t instanceof A ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
881
884
  }
882
885
  /**
883
886
  * 两条线段方向相反否一致
@@ -952,7 +955,7 @@ class D {
952
955
  * @returns
953
956
  */
954
957
  clone() {
955
- const t = new D(
958
+ const t = new A(
956
959
  this.points[0].clone(),
957
960
  this.points[1].clone()
958
961
  );
@@ -1007,7 +1010,7 @@ class D {
1007
1010
  const f = o(u);
1008
1011
  f < a && (a = f, i = n.projectPoint(u, !1)), f > c && (c = f, r = n.projectPoint(u, !1));
1009
1012
  }
1010
- const l = new D(i, r);
1013
+ const l = new A(i, r);
1011
1014
  return t.forEach((h) => h.userData.fittedLine = l), l;
1012
1015
  }
1013
1016
  /** 合并平行线段
@@ -1026,7 +1029,7 @@ class D {
1026
1029
  const y = p.x * s.x + p.y * s.y;
1027
1030
  i = Math.min(i, y), r = Math.max(r, y), o += p.x, a += p.y;
1028
1031
  });
1029
- const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y), u = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new D(h, u);
1032
+ const c = new M(o / n.length, a / n.length), l = c.x * s.x + c.y * s.y, h = new M(c.x + (i - l) * s.x, c.y + (i - l) * s.y), u = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new A(h, u);
1030
1033
  return t.forEach((p) => p.userData.fittedLine = f), f;
1031
1034
  }
1032
1035
  /** 合并满足平行的线段
@@ -1191,7 +1194,7 @@ class M {
1191
1194
  * @param length
1192
1195
  */
1193
1196
  expandAsLine(t, e, n) {
1194
- const s = new D(
1197
+ const s = new A(
1195
1198
  this.clone(),
1196
1199
  this.clone().add(t.clone().multiplyScalar(e))
1197
1200
  );
@@ -1313,7 +1316,7 @@ class F {
1313
1316
  * @param node 线段节点
1314
1317
  */
1315
1318
  insert(t) {
1316
- if (t instanceof D) {
1319
+ if (t instanceof A) {
1317
1320
  this.insert({ line: t, userData: {} });
1318
1321
  return;
1319
1322
  }
@@ -1338,7 +1341,7 @@ class F {
1338
1341
  * @param node
1339
1342
  */
1340
1343
  remove(t) {
1341
- if (t instanceof D) {
1344
+ if (t instanceof A) {
1342
1345
  t = this.targetMap.get(t), t && this.remove(t);
1343
1346
  return;
1344
1347
  }
@@ -1369,25 +1372,25 @@ class F {
1369
1372
  this.isLeaf = !1, this.children = [];
1370
1373
  const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
1371
1374
  this.children[0] = new F(
1372
- new R(this.bounds.minX, t, this.bounds.minY, e),
1375
+ new N(this.bounds.minX, t, this.bounds.minY, e),
1373
1376
  this.capacity,
1374
1377
  this.maxDepth,
1375
1378
  this.depth + 1,
1376
1379
  this.targetMap
1377
1380
  ), this.children[1] = new F(
1378
- new R(t, this.bounds.maxX, this.bounds.minY, e),
1381
+ new N(t, this.bounds.maxX, this.bounds.minY, e),
1379
1382
  this.capacity,
1380
1383
  this.maxDepth,
1381
1384
  this.depth + 1,
1382
1385
  this.targetMap
1383
1386
  ), this.children[2] = new F(
1384
- new R(this.bounds.minX, t, e, this.bounds.maxY),
1387
+ new N(this.bounds.minX, t, e, this.bounds.maxY),
1385
1388
  this.capacity,
1386
1389
  this.maxDepth,
1387
1390
  this.depth + 1,
1388
1391
  this.targetMap
1389
1392
  ), this.children[3] = new F(
1390
- new R(t, this.bounds.maxX, e, this.bounds.maxY),
1393
+ new N(t, this.bounds.maxX, e, this.bounds.maxY),
1391
1394
  this.capacity,
1392
1395
  this.maxDepth,
1393
1396
  this.depth + 1,
@@ -1417,7 +1420,7 @@ class F {
1417
1420
  * @returns 相交的节点数组
1418
1421
  */
1419
1422
  queryCircle(t, e) {
1420
- const n = [], s = new R(
1423
+ const n = [], s = new N(
1421
1424
  t.x - e,
1422
1425
  t.x + e,
1423
1426
  t.y - e,
@@ -1498,8 +1501,8 @@ class F {
1498
1501
  })), t;
1499
1502
  }
1500
1503
  }
1501
- function K(d, t = 0, e) {
1502
- return e || (e = new F(R.fromByLineSegment(...d)), d.forEach((n) => e?.insert({ line: n, userData: void 0 }))), d.map((n) => {
1504
+ function Z(d, t = 0, e) {
1505
+ return e || (e = new F(N.fromByLineSegment(...d)), d.forEach((n) => e?.insert({ line: n, userData: void 0 }))), d.map((n) => {
1503
1506
  const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: d.indexOf(o.line) }));
1504
1507
  return {
1505
1508
  start: n.start.toJson(t),
@@ -1520,8 +1523,8 @@ function K(d, t = 0, e) {
1520
1523
  };
1521
1524
  });
1522
1525
  }
1523
- function at(d, t = 0.03) {
1524
- const e = new F(R.fromByLineSegment(...d));
1526
+ function lt(d, t = 0.03) {
1527
+ const e = new F(N.fromByLineSegment(...d));
1525
1528
  return d.forEach((n) => e.insert({ line: n, userData: void 0 })), d.flatMap((n) => {
1526
1529
  const s = e.queryLineSegment(n, !0).map((i) => {
1527
1530
  if (i.line === n) return;
@@ -1541,45 +1544,35 @@ function at(d, t = 0.03) {
1541
1544
  return n;
1542
1545
  }).filter((n) => n.length() >= t);
1543
1546
  }
1544
- function se(d, t) {
1545
- t || (t = new X(), d.forEach((n) => {
1546
- n.userData.isDoor || n.points.forEach((s) => t?.insert(s, n));
1547
- }));
1548
- const e = [];
1549
- for (let n = 0; n < d.length; n++) {
1550
- const s = d[n], i = /* @__PURE__ */ new Map();
1551
- s.userData.isDoor || s.points.forEach((r) => {
1552
- if (t.queryPoint(r).length > 1) return;
1553
- const o = t.queryCircle(r, 0.4).filter((c) => {
1554
- const l = c.userData;
1555
- if (l === s || !s.parallel(l, 25)) return !1;
1556
- if (t.queryPoint(c.point).length > 1) return;
1557
- const h = new D(r, c.point), u = new D(s.start === r ? s.end : s.start, l.start === c.point ? l.end : l.start);
1558
- if (!h.intersectLineSegment(u)) return !1;
1559
- const f = r.distance(c.point);
1560
- return f < 1e-3 ? !1 : (i.set(c.point, f), !0);
1561
- }).sort((c, l) => {
1562
- const h = i.get(c.point), u = i.get(l.point);
1563
- return h - u;
1564
- });
1565
- if (o.length === 0) return;
1566
- const a = o[0].userData;
1567
- e.push(new D(s.projectLineSegment(a).center, a.projectLineSegment(s).center));
1547
+ function Q(...d) {
1548
+ d.forEach((t) => {
1549
+ const e = t.direction();
1550
+ t.userData.drawWindow?.forEach((n) => {
1551
+ try {
1552
+ const s = M.from(n.p), i = t.projectPoint(
1553
+ s.clone().add(e.clone().multiplyScalar(n.width * 0.5)),
1554
+ !1
1555
+ ), r = t.projectPoint(
1556
+ s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
1557
+ !1
1558
+ ), o = t.projectLineSegment(new A(i, r)), a = o.center;
1559
+ n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
1560
+ } catch {
1561
+ }
1568
1562
  });
1569
- }
1570
- return [...d, ...e];
1563
+ });
1571
1564
  }
1572
1565
  function ie(d) {
1573
- const t = new X(), e = new F(R.fromByLineSegment(...d)), n = [];
1566
+ const t = new X(), e = new F(N.fromByLineSegment(...d)), n = [];
1574
1567
  return d.forEach((s) => {
1575
1568
  s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
1576
1569
  }), n.forEach((s) => {
1577
1570
  const i = t.queryPoint(s.start), r = t.queryPoint(s.end);
1578
1571
  i.length ? s.userData.startIntersection = i[0].userData : s.userData.startIntersection = e.queryPoint(s.start)[0]?.line, r.length ? s.userData.endIntersection = r[0].userData : s.userData.endIntersection = e.queryPoint(s.end)[0]?.line;
1579
- }), d = se(d, t), d;
1572
+ }), d;
1580
1573
  }
1581
1574
  function re(d) {
1582
- const t = new F(R.fromByLineSegment(...d));
1575
+ const t = new F(N.fromByLineSegment(...d));
1583
1576
  d.forEach((n) => {
1584
1577
  n.userData.isDoor || t.insert({ line: n, userData: void 0 });
1585
1578
  });
@@ -1598,7 +1591,7 @@ function re(d) {
1598
1591
  }
1599
1592
  return e;
1600
1593
  }
1601
- function oe(d, t, e, n = 25) {
1594
+ function oe(d, t, e, n = 15) {
1602
1595
  const s = [d], i = [], r = [], o = [];
1603
1596
  function a(u) {
1604
1597
  const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x);
@@ -1615,8 +1608,8 @@ function oe(d, t, e, n = 25) {
1615
1608
  for (; y < -Math.PI; ) y += 2 * Math.PI;
1616
1609
  for (; x > Math.PI; ) x -= 2 * Math.PI;
1617
1610
  for (; x < -Math.PI; ) x += 2 * Math.PI;
1618
- const g = Math.abs(y) < Math.abs(x) ? y : x, w = u.center;
1619
- return u.start.rotate(w, g), u.end.rotate(w, g), u.userData.isDoor ? r.push(u) : i.push(u), u;
1611
+ const m = Math.abs(y) < Math.abs(x) ? y : x, E = u.center;
1612
+ return u.start.rotate(E, m), u.end.rotate(E, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
1620
1613
  }
1621
1614
  function l(u, f, p = !1) {
1622
1615
  if (p) return l(u === "parallel" ? "vertical" : "parallel", f);
@@ -1629,17 +1622,17 @@ function oe(d, t, e, n = 25) {
1629
1622
  if (f.userData.isWindow && o.push(f), f.parallel(d, n)) a(f);
1630
1623
  else if (f.vertical(d, n)) c(f);
1631
1624
  else {
1632
- const y = e.get(f)?.reduce((x, g) => (g.sourcePoint && (x.has(g.sourcePoint) || x.set(g.sourcePoint, []), x.get(g.sourcePoint)?.push(g)), x), /* @__PURE__ */ new Map());
1625
+ const y = e.get(f)?.reduce((x, m) => (m.sourcePoint && (x.has(m.sourcePoint) || x.set(m.sourcePoint, []), x.get(m.sourcePoint)?.push(m)), x), /* @__PURE__ */ new Map());
1633
1626
  y && y.size > 1 ? h.push(() => {
1634
1627
  const x = [...y.values()].map(
1635
- (E) => E.map((m) => s.includes(m.line) ? "parallel" : i.includes(m.line) ? "vertical" : null).filter((m) => !!m)
1636
- ).map((E) => [...new Set(E)]), g = x[0], w = x[1];
1637
- if (g.length === 1 && w.length === 1) {
1638
- if (g[0] === w[0]) return l(g[0], f, !0);
1639
- if (g.length === 1) {
1640
- if (w.includes(g[0])) return l(g[0], f, !0);
1641
- if (w.length === 1 && g.includes(w[0]))
1642
- return l(w[0], f, !0);
1628
+ (w) => w.map((g) => s.includes(g.line) ? "parallel" : i.includes(g.line) ? "vertical" : null).filter((g) => !!g)
1629
+ ).map((w) => [...new Set(w)]), m = x[0], E = x[1];
1630
+ if (m.length === 1 && E.length === 1) {
1631
+ if (m[0] === E[0]) return l(m[0], f, !0);
1632
+ if (m.length === 1) {
1633
+ if (E.includes(m[0])) return l(m[0], f, !0);
1634
+ if (E.length === 1 && m.includes(E[0]))
1635
+ return l(E[0], f, !0);
1643
1636
  }
1644
1637
  }
1645
1638
  c(f);
@@ -1648,7 +1641,7 @@ function oe(d, t, e, n = 25) {
1648
1641
  }
1649
1642
  return h.forEach((u) => u()), { parallelLines: s, verticalLines: i, doorLines: r, windowLines: o };
1650
1643
  }
1651
- function ft(d, t, e, n, s) {
1644
+ function yt(d, t, e, n, s) {
1652
1645
  const i = [], r = /* @__PURE__ */ new Map();
1653
1646
  d.forEach((c) => {
1654
1647
  const l = e.projectPoint(c.start, !1);
@@ -1667,8 +1660,8 @@ function ft(d, t, e, n, s) {
1667
1660
  const l = c.flatMap((p) => {
1668
1661
  const y = p.userData;
1669
1662
  return y.points.map((x) => {
1670
- const g = t.projectPoint(x, !1);
1671
- return g.userData = y, g;
1663
+ const m = t.projectPoint(x, !1);
1664
+ return m.userData = y, m;
1672
1665
  });
1673
1666
  });
1674
1667
  l.sort((p, y) => p.distance(t.start) - y.distance(t.start));
@@ -1681,7 +1674,7 @@ function ft(d, t, e, n, s) {
1681
1674
  }), f.push([...u]), f;
1682
1675
  });
1683
1676
  }
1684
- function pt(d, t, e, n) {
1677
+ function xt(d, t, e, n) {
1685
1678
  const s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), o = [];
1686
1679
  d.forEach((u) => {
1687
1680
  const f = e.projectPoint(u.start, !1);
@@ -1691,23 +1684,23 @@ function pt(d, t, e, n) {
1691
1684
  });
1692
1685
  }), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
1693
1686
  const a = o.map((u) => {
1694
- const f = u.userData, p = i.get(f), y = r.get(f), x = new D(p, y), g = [];
1695
- for (let w = 0; w < o.length; w++) {
1696
- const E = o[w];
1697
- if (u !== E && u.distance(E) < n) {
1698
- const m = E.userData, S = i.get(m), T = r.get(m);
1699
- (x.isPointOnSegment(S) || x.isPointOnSegment(T)) && g.push(w);
1687
+ const f = u.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
1688
+ for (let E = 0; E < o.length; E++) {
1689
+ const w = o[E];
1690
+ if (u !== w && u.distance(w) < n) {
1691
+ const g = w.userData, S = i.get(g), D = r.get(g);
1692
+ (x.isPointOnSegment(S) || x.isPointOnSegment(D)) && m.push(E);
1700
1693
  }
1701
1694
  }
1702
- return g;
1695
+ return m;
1703
1696
  });
1704
1697
  function c(u, f, p = /* @__PURE__ */ new Set()) {
1705
1698
  if (p.has(u)) return p;
1706
1699
  const y = f[u];
1707
1700
  p.add(u);
1708
1701
  for (let x = 0; x < y.length; x++) {
1709
- const g = y[x];
1710
- c(g, f, p);
1702
+ const m = y[x];
1703
+ c(m, f, p);
1711
1704
  }
1712
1705
  return p;
1713
1706
  }
@@ -1718,20 +1711,20 @@ function pt(d, t, e, n) {
1718
1711
  if (f.forEach((y) => {
1719
1712
  l.add(y), p.push(o[y].userData);
1720
1713
  }), p.length > 2) {
1721
- const y = p.map((E) => s.get(E));
1722
- y.sort((E, m) => m.distance(e.start) - E.distance(e.start));
1723
- const x = y[0], g = y[y.length - 1];
1724
- if (x.distance(g) > n) {
1725
- const E = [...p].sort((C, G) => G.length() - C.length()), m = E[0], S = E[1], T = s.get(m), L = s.get(S), A = m.length(), P = S.length(), N = m.projectLineSegment(S), O = N.length();
1726
- if (T.distance(L) || P / A > 0.5 && O / P < 0.5) {
1727
- const C = [m], G = [S];
1728
- for (let B = 0; B < y.length; B++) {
1729
- const v = y[B], V = v.userData;
1730
- if (v === T || v === L) continue;
1731
- const j = S.projectLineSegment(V), Ct = j.length();
1732
- L.distance(v) <= n && Ct / P > 0 ? G.push(V) : C.push(V);
1714
+ const y = p.map((w) => s.get(w));
1715
+ y.sort((w, g) => g.distance(e.start) - w.distance(e.start));
1716
+ const x = y[0], m = y[y.length - 1];
1717
+ if (x.distance(m) > n) {
1718
+ const w = [...p].sort((C, U) => U.length() - C.length()), g = w[0], S = w[1], D = s.get(g), L = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
1719
+ if (D.distance(L) || R / b > 0.5 && B / R < 0.5) {
1720
+ const C = [g], U = [S];
1721
+ for (let O = 0; O < y.length; O++) {
1722
+ const v = y[O], V = v.userData;
1723
+ if (v === D || v === L) continue;
1724
+ const z = S.projectLineSegment(V), W = z.length();
1725
+ L.distance(v) <= n && W / R > 0 ? U.push(V) : C.push(V);
1733
1726
  }
1734
- h.push(C, G);
1727
+ h.push(C, U);
1735
1728
  } else {
1736
1729
  const C = Math.floor(p.length * 0.5);
1737
1730
  h.push(p.slice(0, C), p.slice(C));
@@ -1743,7 +1736,7 @@ function pt(d, t, e, n) {
1743
1736
  }
1744
1737
  return h;
1745
1738
  }
1746
- function yt(d, t) {
1739
+ function gt(d, t) {
1747
1740
  function e(i, r = /* @__PURE__ */ new Set()) {
1748
1741
  if (r.has(i)) return r;
1749
1742
  r.add(i);
@@ -1771,16 +1764,16 @@ function ae(d, t, e, n, s, i) {
1771
1764
  groupMethod: a = "principalAndCross"
1772
1765
  } = i ?? {}, c = {
1773
1766
  cross: () => [
1774
- ...pt(d, n, e, o),
1775
- ...pt(t, e, n, o)
1767
+ ...xt(d, n, e, o),
1768
+ ...xt(t, e, n, o)
1776
1769
  ],
1777
1770
  principalAndCross: () => [
1778
- ...ft(d, n, e, r, o),
1779
- ...ft(t, e, n, r, o)
1771
+ ...yt(d, n, e, r, o),
1772
+ ...yt(t, e, n, r, o)
1780
1773
  ],
1781
1774
  originalInterPoint: () => [
1782
- ...yt(d, s),
1783
- ...yt(t, s)
1775
+ ...gt(d, s),
1776
+ ...gt(t, s)
1784
1777
  ]
1785
1778
  };
1786
1779
  return c[a] ? c[a]() : c.originalInterPoint();
@@ -1803,7 +1796,7 @@ function le(d, t = 0.1, e) {
1803
1796
  if (s.length === 1) return s[0];
1804
1797
  const i = [];
1805
1798
  s.forEach((h) => i.push(h.start.clone(), h.end.clone()));
1806
- const r = n === "average" ? D.mergeLines(...s) : D.mergeLinesByMaxlength(...s);
1799
+ const r = n === "average" ? A.mergeLines(...s) : A.mergeLinesByMaxlength(...s);
1807
1800
  r.userData.rooftopPz = Math.min(
1808
1801
  ...s.map((h) => {
1809
1802
  const { drawDoorData: u, drawWindow: f, rooftopPz: p, ...y } = h.userData;
@@ -1820,10 +1813,10 @@ function le(d, t = 0.1, e) {
1820
1813
  return l >= t && (r.userData.wallWidth = l), s.forEach((h) => h.userData.fittedLine = r), r;
1821
1814
  }).filter((s) => !!s);
1822
1815
  }
1823
- function he(d, t = 0.4) {
1824
- const e = new F(R.fromByLineSegment(...d));
1816
+ function mt(d, t = 0.4) {
1817
+ const e = new F(N.fromByLineSegment(...d));
1825
1818
  d.forEach((s) => e.insert(s));
1826
- const n = new D();
1819
+ const n = new A();
1827
1820
  for (let s = 0; s < d.length; s++) {
1828
1821
  const i = d[s];
1829
1822
  if (i.userData.isAdsorbed) continue;
@@ -1845,12 +1838,12 @@ function he(d, t = 0.4) {
1845
1838
  } else
1846
1839
  i.start.copy(o), i.end.copy(a);
1847
1840
  i.userData.isAdsorbed = !0;
1848
- } else o ? i.start.copy(o) : a && i.end.copy(a);
1841
+ } else o ? i.directionMove(o.direction(i.start), i.start.distance(o)) : a && i.directionMove(a.direction(i.end), i.end.distance(a));
1849
1842
  e.update(i);
1850
1843
  }
1851
1844
  return d.filter((s) => s.length() > 1e-3);
1852
1845
  }
1853
- function ue(d, t) {
1846
+ function he(d, t) {
1854
1847
  const e = new X();
1855
1848
  d.forEach((i) => i.points.forEach((r) => e.insert(r, i)));
1856
1849
  const n = /* @__PURE__ */ new Map();
@@ -1866,51 +1859,39 @@ function ue(d, t) {
1866
1859
  const c = a.sort((h, u) => h.userData.length() - u.userData.length())[0], l = c.userData?.projectPoint(o, !1);
1867
1860
  if (l) {
1868
1861
  const h = c.userData;
1869
- s(r, new D(o.clone(), l.clone())), s(h, new D(c.point.clone(), l.clone()));
1862
+ s(r, new A(o.clone(), l.clone())), s(h, new A(c.point.clone(), l.clone()));
1870
1863
  }
1871
1864
  });
1872
1865
  }
1873
1866
  return n.forEach((i, r) => {
1874
- const o = D.mergeLines(r, ...i);
1867
+ const o = A.mergeLines(r, ...i);
1875
1868
  r.set(o.start, o.end);
1876
1869
  }), d;
1877
1870
  }
1878
- function de(d, t) {
1871
+ function ue(d, t) {
1879
1872
  const { snapThreshold: e = 0.2 } = t ?? {};
1880
- return d = he(d, e), d = ue(d, e), d;
1873
+ return d = mt(d, e), d = mt(d, e), d = he(d, e), d;
1881
1874
  }
1882
- function fe(d) {
1883
- for (let t = 0; t < d.length; t++) {
1884
- const e = d[t], n = e.userData.fittedLine;
1885
- if (n) {
1886
- const s = e.direction();
1887
- n.userData.isWindow = !0, n.userData.drawWindow = n.userData.drawWindow ?? [], e.userData.drawWindow?.forEach((i) => {
1888
- const r = M.from(i.p), o = n.projectPoint(
1889
- r.clone().add(s.clone().multiplyScalar(i.width * 0.5))
1890
- ), a = n.projectPoint(
1891
- r.clone().add(s.clone().multiplyScalar(i.width * -0.5))
1892
- ), c = new D(o, a), l = c.center;
1893
- n.userData.drawWindow?.push({
1894
- p: new I.Vector3(l?.x ?? 0, l?.y ?? 0, i.p.z),
1895
- width: c.length(),
1896
- full: i.full
1897
- });
1898
- });
1899
- }
1875
+ function de(d) {
1876
+ const t = /* @__PURE__ */ new Set();
1877
+ for (let e = 0; e < d.length; e++) {
1878
+ const n = d[e], s = n.userData.fittedLine;
1879
+ s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : Q(n);
1900
1880
  }
1881
+ t.forEach((e) => Q(e));
1901
1882
  }
1902
- function pe(d) {
1883
+ function fe(d) {
1903
1884
  for (let t = 0; t < d.length; t++) {
1904
1885
  const e = d[t];
1905
1886
  let { endIntersection: n, startIntersection: s } = e.userData;
1906
1887
  if (!(!n || !s)) {
1907
- if (s.userData.fittedLine && (s = s.userData.fittedLine), n.userData.fittedLine && (n = n.userData.fittedLine), e.isParallel(s))
1888
+ if (s.userData.fittedLine && (s = s.userData.fittedLine), n.userData.fittedLine && (n = n.userData.fittedLine), e.parallel(s))
1908
1889
  e.start.distance(s.start) < e.start.distance(s.end) ? e.start.copy(s.start) : e.start.copy(s.end);
1909
1890
  else {
1910
1891
  const i = s.projectPoint(e.start);
1911
1892
  i && e.start.copy(i);
1912
1893
  }
1913
- if (e.isParallel(n))
1894
+ if (e.parallel(n))
1914
1895
  e.end.distance(n.start) < e.end.distance(n.end) ? e.end.copy(n.start) : e.end.copy(n.end);
1915
1896
  else {
1916
1897
  const i = n.projectPoint(e.end);
@@ -1920,7 +1901,7 @@ function pe(d) {
1920
1901
  }
1921
1902
  return d;
1922
1903
  }
1923
- function ye(d, t = 0.01) {
1904
+ function pe(d, t = 0.01) {
1924
1905
  const e = new X();
1925
1906
  return d.forEach((n) => n.points.forEach((s) => e.insert(s, n))), d.filter((n) => {
1926
1907
  if (n.length() <= t) {
@@ -1930,7 +1911,7 @@ function ye(d, t = 0.01) {
1930
1911
  return !0;
1931
1912
  });
1932
1913
  }
1933
- class Tt {
1914
+ class Pt {
1934
1915
  /**
1935
1916
  * 轴对齐垂直修正
1936
1917
  * @param lines 待调整线段组
@@ -1939,33 +1920,33 @@ class Tt {
1939
1920
  */
1940
1921
  static correction(t, e, n) {
1941
1922
  t = ie(t.map((x) => x.clone()));
1942
- const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new D(
1923
+ const s = re(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = oe(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new A(
1943
1924
  l.clone().add(c.clone().multiplyScalar(-1e3)),
1944
1925
  l.clone().add(c.clone().multiplyScalar(1e3))
1945
- ), f = new D(
1926
+ ), f = new A(
1946
1927
  l.clone().add(h.clone().multiplyScalar(-1e3)),
1947
1928
  l.clone().add(h.clone().multiplyScalar(1e3))
1948
1929
  );
1949
1930
  let p = ae(i, r, u, f, s, n);
1950
1931
  p = ce(p, s);
1951
1932
  let y = le(p, 0.1, n);
1952
- return y = de(y, n), fe(a), pe(o), y = at(y, 1e-9), y.push(...o), y = ye(y, 0.08), y;
1933
+ return y = ue(y, n), de(a), fe(o), y = lt(y, 1e-9), y.push(...o), y = pe(y, 0.08), y = y, y;
1953
1934
  }
1954
1935
  }
1955
- const xe = new D(
1936
+ const ye = new A(
1956
1937
  new M(0, 0),
1957
1938
  new M(0, 1)
1958
1939
  );
1959
- function ge(d) {
1940
+ function xe(d) {
1960
1941
  const t = [...d].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
1961
- let r = parseInt(xe.includedAngle(i) + "");
1942
+ let r = parseInt(ye.includedAngle(i) + "");
1962
1943
  return r > 90 && (r = 180 - r), r;
1963
1944
  }), n = /* @__PURE__ */ new Map();
1964
1945
  return e.forEach((i, r) => {
1965
1946
  n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
1966
1947
  }), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
1967
1948
  }
1968
- const me = {
1949
+ const ge = {
1969
1950
  Unitless: 1,
1970
1951
  // 无单位,1米 = 1(无单位)
1971
1952
  Inches: 39.37007874015748,
@@ -2009,16 +1990,16 @@ const me = {
2009
1990
  Parsecs: 3240779289666404e-32
2010
1991
  // 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
2011
1992
  };
2012
- function xt(d) {
1993
+ function wt(d) {
2013
1994
  const t = [];
2014
1995
  for (let e = 0; e < d.length; e++)
2015
- t.push(new D(
1996
+ t.push(new A(
2016
1997
  d[e].clone(),
2017
1998
  d[(e + 1) % d.length].clone()
2018
1999
  ));
2019
2000
  return t;
2020
2001
  }
2021
- function gt(d) {
2002
+ function Mt(d) {
2022
2003
  return d.flatMap((t, e) => (e === d.length - 1 && [...t.points, d[0].points[0]], [t.points[0]]));
2023
2004
  }
2024
2005
  class k extends q {
@@ -2028,8 +2009,8 @@ class k extends q {
2028
2009
  scale = 1;
2029
2010
  originalData = [];
2030
2011
  data = [];
2031
- originalBox = new R(0, 0, 0, 0);
2032
- box = new R(0, 0, 0, 0);
2012
+ originalBox = new N(0, 0, 0, 0);
2013
+ box = new N(0, 0, 0, 0);
2033
2014
  pointsGroups = [];
2034
2015
  wallsGroup = [];
2035
2016
  doors = [];
@@ -2069,22 +2050,22 @@ class k extends q {
2069
2050
  const r = [];
2070
2051
  if (t.forEach(({ start: a, end: c, ...l }, h) => {
2071
2052
  r.push(a.z ?? 0, c.z ?? 0);
2072
- const u = new D(
2053
+ const u = new A(
2073
2054
  M.from(a),
2074
2055
  M.from(c)
2075
2056
  );
2076
2057
  u.userData = l, s.push(u), l.isVerticalReferenceLine && (i = h);
2077
2058
  }), this.originalZAverage = r.reduce((a, c) => a + c, 0) / r.length, i === -1) {
2078
- const a = ge(s);
2059
+ const a = xe(s);
2079
2060
  i = s.indexOf(a);
2080
2061
  }
2081
2062
  const o = s[i];
2082
- return o.userData.isVerticalReferenceLine = !0, t[i].isVerticalReferenceLine = !0, e && (s = Tt.correction.call(this, s, o, n), t = K(s)), this.dispatchEvent({
2063
+ return o.userData.isVerticalReferenceLine = !0, t[i].isVerticalReferenceLine = !0, e && (s = Pt.correction.call(this, s, o, n), t = Z(s)), this.dispatchEvent({
2083
2064
  type: "preprocessing",
2084
2065
  data: t,
2085
2066
  setData(a) {
2086
2067
  s = a.map(({ start: c, end: l, ...h }) => {
2087
- const u = new D(M.from(c), M.from(l));
2068
+ const u = new A(M.from(c), M.from(l));
2088
2069
  return u.userData = h, u;
2089
2070
  }), t = a;
2090
2071
  }
@@ -2237,7 +2218,7 @@ class k extends q {
2237
2218
  break;
2238
2219
  }
2239
2220
  }
2240
- const e = this.mergeSameDirectionLine(xt(t)), n = [e[0]];
2221
+ const e = this.mergeSameDirectionLine(wt(t)), n = [e[0]];
2241
2222
  for (let s = 1; s < e.length; s++) {
2242
2223
  const i = e[s], r = e[(e.length + s - 1) % e.length];
2243
2224
  if (i.length() > this.width * 0.9) {
@@ -2252,7 +2233,7 @@ class k extends q {
2252
2233
  const a = e[s + 2];
2253
2234
  a && r.includedAngle(a) < 2 ? (s = s + 2, n.push(a)) : n.push(i);
2254
2235
  }
2255
- return n.length > 3 ? gt(this.mergeSameDirectionLine(n)) : [];
2236
+ return n.length > 3 ? Mt(this.mergeSameDirectionLine(n)) : [];
2256
2237
  }
2257
2238
  /**
2258
2239
  * 移除短线段
@@ -2260,7 +2241,7 @@ class k extends q {
2260
2241
  * @param path
2261
2242
  */
2262
2243
  removeShortLine(t, e = this.shortLine) {
2263
- const n = xt(t), s = [], i = Math.PI / 180;
2244
+ const n = wt(t), s = [], i = Math.PI / 180;
2264
2245
  for (let r = 0; r < n.length; r++) {
2265
2246
  const o = n[r], a = o.length(), c = r;
2266
2247
  if (a > e || s.length === 0) {
@@ -2288,14 +2269,14 @@ class k extends q {
2288
2269
  } else
2289
2270
  r = c;
2290
2271
  }
2291
- return s.length > 3 ? gt(s) : [];
2272
+ return s.length > 3 ? Mt(s) : [];
2292
2273
  }
2293
2274
  /** 线偏移
2294
2275
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
2295
2276
  */
2296
2277
  lineOffset(t = k.EndType.etOpenSquare, e = k.JoinType.jtMiter, n = 1e4) {
2297
- let s = new dt.Paths();
2298
- const i = new dt.ClipperOffset(20, 0.25);
2278
+ let s = new pt.Paths();
2279
+ const i = new pt.ClipperOffset(20, 0.25);
2299
2280
  return this.pointsGroups.forEach((r) => {
2300
2281
  const o = this.lineTopology(r).map((a) => a.map((c) => c.clone().mutiplyScalar(n)));
2301
2282
  i.AddPaths(o, e, t);
@@ -2336,13 +2317,13 @@ class k extends q {
2336
2317
  * 线段数据转为原始json数据
2337
2318
  */
2338
2319
  lineDataToOriginalData(t, e) {
2339
- return K(t, this.originalZAverage, e);
2320
+ return Z(t, this.originalZAverage, e);
2340
2321
  }
2341
2322
  /**
2342
2323
  * 转为绘制数据
2343
2324
  */
2344
2325
  toDrawDataJson(t = "Millimeters") {
2345
- const e = me[t], n = {
2326
+ const e = ge[t], n = {
2346
2327
  unit: t,
2347
2328
  line: [],
2348
2329
  arc: [],
@@ -2386,29 +2367,29 @@ class k extends q {
2386
2367
  if (s = "cyan", l.length() < 1.2) {
2387
2368
  l.expansion(-o * 0.5);
2388
2369
  const h = c.normal();
2389
- let u = new D(
2370
+ let u = new A(
2390
2371
  l.start.clone(),
2391
2372
  l.start.clone().add(h.clone().multiplyScalar(l.length()))
2392
2373
  );
2393
2374
  const f = u.clone().directionMove(u.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
2394
- for (let m = 0; m < a.length; m++)
2395
- if (a[m].intersectRectangle(f)) {
2396
- u = new D(
2375
+ for (let g = 0; g < a.length; g++)
2376
+ if (a[g].intersectRectangle(f)) {
2377
+ u = new A(
2397
2378
  l.start.clone(),
2398
2379
  l.start.clone().add(h.clone().multiplyScalar(-l.length()))
2399
2380
  );
2400
2381
  break;
2401
2382
  }
2402
- u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((m, S) => i(m, S));
2403
- const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), g = u.end.clone().add(u.direction().multiplyScalar(-x)), [w, E] = this.getArcAngleRange(g, l.end, u.end);
2404
- r(g, x, Math.min(w, E), Math.max(w, E)), a.push(f);
2383
+ u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
2384
+ const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [E, w] = this.getArcAngleRange(m, l.end, u.end);
2385
+ r(m, x, Math.min(E, w), Math.max(E, w)), a.push(f);
2405
2386
  } else
2406
2387
  l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), o * 0.5).directionMove(l.direction(), o * 0.5).expansion(-l.length() * 0.45, "end").forward(o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u)), l.clone().directionMove(l.normal(), -o * 0.5).directionMove(l.direction(), -o * 0.5).expansion(-l.length() * 0.45, "start").forward(-o * 0.5).expandToRectangle(o).path2D((h, u) => i(h, u));
2407
2388
  }), s = "yellow", this.lineSegments.forEach((c) => {
2408
2389
  if (!c.userData.isWindow) return !1;
2409
2390
  Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
2410
- const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new D(p, y);
2411
- i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((g, w) => i(g, w));
2391
+ const { p: h, width: u } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(u * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-u * 0.5)), x = new A(p, y);
2392
+ i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, E) => i(m, E));
2412
2393
  });
2413
2394
  }), n;
2414
2395
  }
@@ -2439,8 +2420,8 @@ class k extends q {
2439
2420
  a.strokeStyle = o[p], a.beginPath(), a.arc(c, l, h, u * (Math.PI / 180), f * (Math.PI / 180)), a.stroke();
2440
2421
  }), a.beginPath(), s.dimensionLine.forEach((c) => {
2441
2422
  let [l, h, u, f] = c;
2442
- const p = Math.min(h, f), y = Math.max(h, f), x = (i.width * 0.5 - 0.4 * s.scale) * (l < 0 ? -1 : 1), g = (y - p) * 0.45;
2443
- a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x, g + p), a.moveTo(x, y), a.lineTo(x, y - g), a.moveTo(x - 0.1 * s.scale, y), a.lineTo(x + 0.1 * s.scale, y);
2423
+ const p = Math.min(h, f), y = Math.max(h, f), x = (i.width * 0.5 - 0.4 * s.scale) * (l < 0 ? -1 : 1), m = (y - p) * 0.45;
2424
+ a.fillStyle = "#fff", a.font = `${0.15 * s.scale}px Arial`, a.textAlign = "center", a.textBaseline = "middle", a.save(), a.translate(x, p + (y - p) * 0.5), a.scale(1, -1), a.fillText((y - p).toFixed(2) + "cm", 0, 0), a.restore(), a.moveTo(x - 0.1 * s.scale, p), a.lineTo(x + 0.1 * s.scale, p), a.moveTo(x, p), a.lineTo(x, m + p), a.moveTo(x, y), a.lineTo(x, y - m), a.moveTo(x - 0.1 * s.scale, y), a.lineTo(x + 0.1 * s.scale, y);
2444
2425
  }), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in i ? new Promise((c) => {
2445
2426
  i.toBlob((l) => {
2446
2427
  c(l);
@@ -2451,8 +2432,8 @@ class k extends q {
2451
2432
  * 将点json结构转换为Dxf string
2452
2433
  */
2453
2434
  toDxfString(t = "Millimeters") {
2454
- const e = new H();
2455
- e.setUnits(t), e.addLayer("cyan", H.ACI.CYAN, "DOTTED"), e.addLayer("yellow", H.ACI.YELLOW, "DOTTED"), e.addLayer("white", H.ACI.WHITE, "DOTTED");
2435
+ const e = new J();
2436
+ e.setUnits(t), e.addLayer("cyan", J.ACI.CYAN, "DOTTED"), e.addLayer("yellow", J.ACI.YELLOW, "DOTTED"), e.addLayer("white", J.ACI.WHITE, "DOTTED");
2456
2437
  const n = this.toDrawDataJson();
2457
2438
  return n.line.forEach((s) => {
2458
2439
  let [i, r, o, a, c] = s;
@@ -2508,7 +2489,7 @@ class k extends q {
2508
2489
  * @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
2509
2490
  * @returns
2510
2491
  */
2511
- computedOriginalSize(t, e = new R(0, 0, 0, 0)) {
2492
+ computedOriginalSize(t, e = new N(0, 0, 0, 0)) {
2512
2493
  const n = t.flatMap((c) => [c.start.x, c.end.x]), s = t.flatMap((c) => [c.start.y, c.end.y]), i = Math.min(...n), r = Math.min(...s), o = Math.max(...n), a = Math.max(...s);
2513
2494
  return e.set(i, r, o, a), e;
2514
2495
  }
@@ -2536,17 +2517,17 @@ class k extends q {
2536
2517
  });
2537
2518
  }
2538
2519
  }
2539
- function ot(d) {
2520
+ function ct(d) {
2540
2521
  if (d === null || typeof d != "object") return d;
2541
2522
  if (d instanceof Date) return new Date(d.getTime());
2542
- if (Array.isArray(d)) return d.map(ot);
2523
+ if (Array.isArray(d)) return d.map(ct);
2543
2524
  const t = {};
2544
2525
  for (const e in d)
2545
- Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ot(d[e]));
2526
+ Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ct(d[e]));
2546
2527
  return t;
2547
2528
  }
2548
- const z = new D();
2549
- class we extends k {
2529
+ const j = new A();
2530
+ class me extends k {
2550
2531
  static name = "AngleCorrectionDxf";
2551
2532
  angle = 0;
2552
2533
  onAddFromParent(t) {
@@ -2557,20 +2538,20 @@ class we extends k {
2557
2538
  let s = 0, i = null;
2558
2539
  for (let c = 0; c < e.originalData.length; c++) {
2559
2540
  const l = e.originalData[c];
2560
- if (z.start.copy(l.start), z.end.copy(l.end), l.isVerticalReferenceLine) {
2561
- const [h, u] = l.start.y < l.end.y ? [z.start, z.end] : [z.end, z.start];
2562
- s = -new D(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
2541
+ if (j.start.copy(l.start), j.end.copy(l.end), l.isVerticalReferenceLine) {
2542
+ const [h, u] = l.start.y < l.end.y ? [j.start, j.end] : [j.end, j.start];
2543
+ s = -new A(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
2563
2544
  break;
2564
2545
  }
2565
- (!i || z.length() > i.length()) && (i = z.clone(), i.userData.index = c);
2546
+ (!i || j.length() > i.length()) && (i = j.clone(), i.userData.index = c);
2566
2547
  }
2567
2548
  if (i) {
2568
2549
  e.originalData[i.userData.index].isVerticalReferenceLine = !0;
2569
2550
  const [c, l] = i.start.y < i.end.y ? [i.start, i.end] : [i.end, i.start];
2570
- s = -new D(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
2551
+ s = -new A(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
2571
2552
  }
2572
2553
  const r = e.originalBox.center, o = M.zero(), a = e.originalData.map((c) => {
2573
- const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z), u = Object.assign(ot(c), { start: l, end: h });
2554
+ const l = o.copy(c.start).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.start.z), h = o.copy(c.end).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(c.end.z), u = Object.assign(ct(c), { start: l, end: h });
2574
2555
  return u.drawWindow && u.drawWindow.forEach((f) => {
2575
2556
  f.p = o.copy(f.p).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(f.p.z);
2576
2557
  }), u;
@@ -2591,7 +2572,7 @@ class we extends k {
2591
2572
  });
2592
2573
  }
2593
2574
  }
2594
- class bt extends q {
2575
+ class Rt extends q {
2595
2576
  static name = "Variable";
2596
2577
  originalLineVisible = !0;
2597
2578
  dxfVisible = !0;
@@ -2618,7 +2599,7 @@ class bt extends q {
2618
2599
  if (t in this) return this[t];
2619
2600
  }
2620
2601
  }
2621
- class Me {
2602
+ class we {
2622
2603
  // 所有可查找的点位
2623
2604
  possibleDoorPoints = [];
2624
2605
  doorPoint = [];
@@ -2637,9 +2618,9 @@ class Me {
2637
2618
  lineAnalysis;
2638
2619
  continueFind = !0;
2639
2620
  constructor(t) {
2640
- if (this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new X(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
2621
+ this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new X(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((n) => {
2641
2622
  this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
2642
- }), this.doorPoint = this.getDoorPoint(), !this.continueFind) return;
2623
+ }), this.doorPoint = this.getDoorPoint();
2643
2624
  const e = this.searchDoubleLinePoint();
2644
2625
  this.addPointsExcludeRule((n, s, i) => {
2645
2626
  const r = this.lineSegments.indexOf(n), o = e.get(r);
@@ -2647,7 +2628,7 @@ class Me {
2647
2628
  }), this.addPointsExcludeRule((n, s) => !!this.doorPoint.find((i) => i.point.equal(s))), this.possibleDoorPoints = this.getPossiblePoints(), this.possibleDoorPoints.forEach((n) => this.findPointVirtualGrid.insert(n.point, n.line)), this.handle();
2648
2629
  }
2649
2630
  handle() {
2650
- this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.doorPoint.length < 2 && this.dxf.doorLineSegment.push(...this.search(this.possibleDoorPoints, this.possibleDoorPoints, 0.6));
2631
+ this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.dxf.doorLineSegment.length < 2 && this.dxf.doorLineSegment.push(...this.search(this.possibleDoorPoints, this.possibleDoorPoints, 0.6));
2651
2632
  }
2652
2633
  search(t, e = [], n = 0.6, s = this.doorSearchDistance, i = this.doorSearchNearAngle) {
2653
2634
  const r = this.dxf, o = this.searchNearby(t, e, s, i);
@@ -2667,15 +2648,15 @@ class Me {
2667
2648
  );
2668
2649
  const a = [];
2669
2650
  return o.forEach((c) => {
2670
- const l = new D(c?.start, c?.end), h = l.length();
2651
+ const l = new A(c?.start, c?.end), h = l.length();
2671
2652
  if (h < n) return;
2672
2653
  const u = l.normal(), f = l.direction(), p = (h - r.width * 2) / 2;
2673
2654
  for (let y = 0; y < 3; y++) {
2674
- const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), g = new D(
2655
+ const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), m = new A(
2675
2656
  x,
2676
2657
  x.clone().add(u.clone().multiplyScalar(1))
2677
2658
  );
2678
- if (g.directionMove(u, -0.5), this.quadtree.queryLineSegment(g).length) return;
2659
+ if (m.directionMove(u, -0.5), this.quadtree.queryLineSegment(m).length) return;
2679
2660
  }
2680
2661
  a.push(l);
2681
2662
  }), a;
@@ -2695,7 +2676,7 @@ class Me {
2695
2676
  return this.lineSegments.forEach((e) => {
2696
2677
  e.points.forEach((n, s) => {
2697
2678
  for (let r = 0; r < this._pointsExcludeRule.length; r++) if (this._pointsExcludeRule[r](e, n, s)) return;
2698
- this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: rt() });
2679
+ this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: at() });
2699
2680
  });
2700
2681
  }), t;
2701
2682
  }
@@ -2706,7 +2687,14 @@ class Me {
2706
2687
  const t = [], e = this.dxf, n = this.pointVirtualGrid;
2707
2688
  return e.doors.forEach((s) => {
2708
2689
  const i = e.lineSegments[s[4]], r = e.originalData[s[4]];
2709
- if (r.drawDoorData) {
2690
+ if (r.doorDirectConnection) {
2691
+ this.continueFind = !1;
2692
+ const o = new A(M.from(r.start), M.from(r.end));
2693
+ o.userData = {
2694
+ doorDirectConnection: !0,
2695
+ isDoor: !0
2696
+ }, this.dxf.doorLineSegment.push(o);
2697
+ } else if (r.drawDoorData) {
2710
2698
  const o = M.from(r.drawDoorData.start), a = M.from(r.drawDoorData.n), c = n.queryPoint(o).filter((l) => {
2711
2699
  if (l.userData === i) return !1;
2712
2700
  const h = l.userData, u = h.direction();
@@ -2717,15 +2705,8 @@ class Me {
2717
2705
  c.length && t.push({
2718
2706
  line: c[0].userData,
2719
2707
  point: o,
2720
- uuid: rt()
2708
+ uuid: at()
2721
2709
  });
2722
- } else if (r.doorDirectConnection) {
2723
- this.continueFind = !1;
2724
- const o = new D(M.from(r.start), M.from(r.end));
2725
- o.userData = {
2726
- doorDirectConnection: !0,
2727
- isDoor: !0
2728
- }, this.dxf.doorLineSegment.push(o);
2729
2710
  } else
2730
2711
  console.warn(`门的线段顺序${s[4]} 没有drawDoorData属性`);
2731
2712
  }), t;
@@ -2751,83 +2732,83 @@ class Me {
2751
2732
  */
2752
2733
  searchNearby(t, e = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
2753
2734
  const i = this.findPointVirtualGrid, r = this.quadtree;
2754
- function o({ point: x, line: g }, w, E) {
2755
- const m = g.direction();
2756
- g.start === x && m.multiplyScalar(-1);
2757
- const S = i.queryCircle(x, n).filter((L) => L.userData !== g).sort((L, A) => L.point.distance(x) - A.point.distance(x)), T = [];
2735
+ function o({ point: x, line: m }, E, w) {
2736
+ const g = m.direction();
2737
+ m.start === x && g.multiplyScalar(-1);
2738
+ const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), D = [];
2758
2739
  for (let L = 0; L < S.length; L++) {
2759
- const A = e.findIndex((B) => B.point === S[L].point), P = t[w].uuid, N = e[A].uuid;
2760
- if (E.has(`${P}.${N}`)) continue;
2761
- E.add(`${P}.${N}`), E.add(`${N}.${P}`);
2762
- const O = S[L].point, C = new D(x.clone(), O.clone());
2763
- if (C.direction().angleBetween(m, "angle") < s) {
2764
- const B = t[A].line.direction();
2765
- S[L].userData.start.equal(S[L].point) && B.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(B, "angle") < s && (r.queryLineSegment(C).length || T.push({
2740
+ const b = e.findIndex((O) => O.point === S[L].point), R = t[E].uuid, P = e[b].uuid;
2741
+ if (w.has(`${R}.${P}`)) continue;
2742
+ w.add(`${R}.${P}`), w.add(`${P}.${R}`);
2743
+ const B = S[L].point, C = new A(x.clone(), B.clone());
2744
+ if (C.direction().angleBetween(g, "angle") < s) {
2745
+ const O = t[E].line.direction(), v = S[L].userData;
2746
+ v.start.equal(S[L].point) && O.multiplyScalar(-1), C.direction().multiplyScalar(-1).angleBetween(O, "angle") < s && (r.queryLineSegment(C).filter((W) => !(W.line.start.equal(x) || W.line.end.equal(x) || W.line === v)).length || D.push({
2766
2747
  findData: S[L],
2767
- findUuid: N,
2748
+ findUuid: P,
2768
2749
  doorLine: C,
2769
- doorUuid: P
2750
+ doorUuid: R
2770
2751
  }));
2771
2752
  }
2772
2753
  }
2773
- return T;
2754
+ return D;
2774
2755
  }
2775
- function a(x, g, w, E, m) {
2776
- E.add(x);
2756
+ function a(x, m, E, w, g) {
2757
+ w.add(x);
2777
2758
  const S = [];
2778
- m && S.push(m);
2779
- for (let T = 0; T < w.length; T++) {
2780
- const L = w[T];
2781
- if (g.has(L.findUuid)) {
2782
- const A = g.get(L.findUuid);
2783
- a(L.findUuid, g, A, E, L) && S.push(L);
2759
+ g && S.push(g);
2760
+ for (let D = 0; D < E.length; D++) {
2761
+ const L = E[D];
2762
+ if (m.has(L.findUuid)) {
2763
+ const b = m.get(L.findUuid);
2764
+ a(L.findUuid, m, b, w, L) && S.push(L);
2784
2765
  } else S.push(L);
2785
2766
  }
2786
- return S.sort((T, L) => T.doorLine.length() - L.doorLine.length()), m && S[0] === m ? (w.splice(0), !0) : (w.splice(1), !1);
2767
+ return S.sort((D, L) => D.doorLine.length() - L.doorLine.length()), g && S[0] === g ? (E.splice(0), !0) : (E.splice(1), !1);
2787
2768
  }
2788
2769
  const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
2789
- t.map((x, g) => {
2790
- const w = o(x, g, c);
2791
- w.length && l.set(x.uuid, w);
2770
+ t.map((x, m) => {
2771
+ const E = o(x, m, c);
2772
+ E.length && l.set(x.uuid, E);
2792
2773
  }), c.clear();
2793
2774
  const h = /* @__PURE__ */ new Map();
2794
- l.forEach((x, g) => {
2795
- if (!c.has(g) && x.length && a(g, l, x, c), x.length) {
2796
- const w = x[0];
2797
- h.has(w.doorUuid) || h.set(w.doorUuid, []), h.get(w.doorUuid)?.push(w), h.has(w.findUuid) || h.set(w.findUuid, []), h.get(w.findUuid)?.push(w);
2775
+ l.forEach((x, m) => {
2776
+ if (!c.has(m) && x.length && a(m, l, x, c), x.length) {
2777
+ const E = x[0];
2778
+ h.has(E.doorUuid) || h.set(E.doorUuid, []), h.get(E.doorUuid)?.push(E), h.has(E.findUuid) || h.set(E.findUuid, []), h.get(E.findUuid)?.push(E);
2798
2779
  }
2799
2780
  });
2800
2781
  const u = /* @__PURE__ */ new Set();
2801
2782
  h.forEach((x) => {
2802
2783
  if (x.length > 1) {
2803
- x.sort((g, w) => g.doorLine.length() - w.doorLine.length());
2804
- for (let g = 1; g < x.length; g++) u.add(x[g]);
2784
+ x.sort((m, E) => m.doorLine.length() - E.doorLine.length());
2785
+ for (let m = 1; m < x.length; m++) u.add(x[m]);
2805
2786
  }
2806
2787
  });
2807
2788
  const f = [], p = [];
2808
2789
  l.forEach((x) => {
2809
2790
  if (x.length) {
2810
- const g = x[0];
2811
- u.has(g) || (f.push(g), p.push(g.doorUuid, g.findUuid));
2791
+ const m = x[0];
2792
+ u.has(m) || (f.push(m), p.push(m.doorUuid, m.findUuid));
2812
2793
  }
2813
2794
  });
2814
2795
  const y = [];
2815
2796
  return f.forEach((x) => {
2816
- const g = t.findIndex((A) => A.uuid === x.doorUuid), w = e.findIndex((A) => A.uuid === x.findUuid), E = t[g].point.clone(), m = e[w].point.clone(), S = this.findLongLineSegment(t[g].line), T = this.findLongLineSegment(e[w].line), L = S.projectPoint(m);
2797
+ const m = t.findIndex((b) => b.uuid === x.doorUuid), E = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[E].point.clone(), S = this.findLongLineSegment(t[m].line), D = this.findLongLineSegment(e[E].line), L = S.projectPoint(g);
2817
2798
  if (L) {
2818
- E.copy(L);
2819
- const A = new D(E, m), P = T.includedAngle(A);
2820
- (P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
2821
- start: E,
2822
- end: m
2799
+ w.copy(L);
2800
+ const b = new A(w, g), R = D.includedAngle(b);
2801
+ (R < 10 || R > 170 || Math.abs(90 - R) < 10) && y.push({
2802
+ start: w,
2803
+ end: g
2823
2804
  });
2824
2805
  } else {
2825
- const A = T.projectPoint(E);
2826
- A && m.copy(A);
2827
- const P = new D(E, m), N = S.includedAngle(P);
2828
- (N < 10 || N > 170 || Math.abs(90 - N) < 10) && y.push({
2829
- start: E,
2830
- end: m
2806
+ const b = D.projectPoint(w);
2807
+ b && g.copy(b);
2808
+ const R = new A(w, g), P = S.includedAngle(R);
2809
+ (P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
2810
+ start: w,
2811
+ end: g
2831
2812
  });
2832
2813
  }
2833
2814
  }), e.splice(
@@ -2848,7 +2829,7 @@ class Me {
2848
2829
  searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2849
2830
  const s = this.quadtree, i = e.direction();
2850
2831
  e.start === t && i.multiplyScalar(-1);
2851
- const r = t.clone().add(i.clone().multiplyScalar(n)), o = new D(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
2832
+ const r = t.clone().add(i.clone().multiplyScalar(n)), o = new A(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
2852
2833
  point: c.line.getIntersection(o),
2853
2834
  line: c.line
2854
2835
  })).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
@@ -2875,7 +2856,7 @@ class Me {
2875
2856
  break;
2876
2857
  }
2877
2858
  }
2878
- const l = new D(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((u) => ({
2859
+ const l = new A(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((u) => ({
2879
2860
  point: u.line.getIntersection(l),
2880
2861
  line: u.line
2881
2862
  })).filter((u) => u.point).sort((u, f) => t.distance(u.point) - t.distance(f.point));
@@ -2909,7 +2890,7 @@ class Me {
2909
2890
  return e;
2910
2891
  }
2911
2892
  }
2912
- class Se extends q {
2893
+ class Me extends q {
2913
2894
  static name = "LineAnalysis";
2914
2895
  Dxf = null;
2915
2896
  Variable = null;
@@ -2923,7 +2904,7 @@ class Se extends q {
2923
2904
  * @param parent
2924
2905
  */
2925
2906
  onAddFromParent(t) {
2926
- this.Dxf = t.findComponentByType(k), this.Variable = this.parent?.findComponentByType(bt), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2907
+ this.Dxf = t.findComponentByType(k), this.Variable = this.parent?.findComponentByType(Rt), this.Dxf.addEventListener("setDta", this.lineAnalysis.bind(this)), this.Dxf.addEventListener("createGroup", this.doorsAnalysis.bind(this));
2927
2908
  }
2928
2909
  /**
2929
2910
  *
@@ -2955,7 +2936,7 @@ class Se extends q {
2955
2936
  */
2956
2937
  addData(t, e) {
2957
2938
  const n = this.Dxf;
2958
- n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new D(t.clone(), e.clone()));
2939
+ n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new A(t.clone(), e.clone()));
2959
2940
  }
2960
2941
  /** 结果分析创建矩形
2961
2942
  * @param result
@@ -2965,12 +2946,12 @@ class Se extends q {
2965
2946
  n.includedAngle(s) > 135 && (s.points = [s.points[1], s.points[0]]), this.addData(n.points[0], s.points[0]), this.addData(n.points[1], s.points[1]);
2966
2947
  const i = n.points[0].distance(s.points[0]), r = n.points[1].distance(s.points[1]), o = Math.ceil(Math.max(i, r) / e.width), a = i / o, c = r / o, l = s.points[0].direction(n.points[0]), h = s.points[1].direction(n.points[1]), u = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(u);
2967
2948
  p.multiplyScalar(e.width * 0.5);
2968
- const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), g = u.direction(f), w = y.direction(x);
2969
- if (!(g.x > 0 && w.x < 0 || g.x < 0 && w.x > 0 || g.y > 0 && w.y < 0 || g.y < 0 && w.y > 0)) {
2949
+ const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), E = y.direction(x);
2950
+ if (!(m.x > 0 && E.x < 0 || m.x < 0 && E.x > 0 || m.y > 0 && E.y < 0 || m.y < 0 && E.y > 0)) {
2970
2951
  u.set(y.x, y.y), f.set(x.x, x.y);
2971
- for (let E = 1; E < o; E++) {
2972
- const m = l.clone().multiplyScalar(a * E), S = h.clone().multiplyScalar(c * E), T = u.clone().add(m), L = f.clone().add(S);
2973
- this.addData(T, L);
2952
+ for (let w = 1; w < o; w++) {
2953
+ const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), D = u.clone().add(g), L = f.clone().add(S);
2954
+ this.addData(D, L);
2974
2955
  }
2975
2956
  }
2976
2957
  }
@@ -2997,7 +2978,7 @@ class Se extends q {
2997
2978
  this.buildQuadtree();
2998
2979
  const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
2999
2980
  e.forEach((i, r) => {
3000
- const o = e[r], a = Q.fromByLineSegment(o, this.width * 2, !1, -0.01);
2981
+ const o = e[r], a = et.fromByLineSegment(o, this.width * 2, !1, -0.01);
3001
2982
  t.queryRect(a).map((l) => l.userData).filter((l) => l !== r).forEach((l) => {
3002
2983
  try {
3003
2984
  if (n.has(`${r}-${l}`) || n.has(`${l}-${r}`)) return;
@@ -3041,12 +3022,12 @@ class Se extends q {
3041
3022
  doors = [];
3042
3023
  DoorsAnalysis;
3043
3024
  doorsAnalysis() {
3044
- this.DoorsAnalysis = new Me(this), this.dispatchEvent({
3025
+ this.DoorsAnalysis = new we(this), this.dispatchEvent({
3045
3026
  type: "analysisCompleted"
3046
3027
  });
3047
3028
  }
3048
3029
  }
3049
- class Ee extends q {
3030
+ class Se extends q {
3050
3031
  static name = "ThreeVJia";
3051
3032
  lineSegments = [];
3052
3033
  onAddFromParent() {
@@ -3058,8 +3039,8 @@ class Ee extends q {
3058
3039
  t.resultList.forEach((l) => {
3059
3040
  const h = s.get(l.target) ?? [], u = s.get(l.source) ?? [], f = l.project.clone(), p = l.project2.clone();
3060
3041
  f.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...f.points), u.push(...p.points), s.set(l.target, h), s.set(l.source, u);
3061
- const y = new D(f.start, p.start), x = new D(f.end, p.end), g = new D(y.center, x.center);
3062
- g.userData.wallWidth = Math.max(y.length(), x.length()), r.push(g);
3042
+ const y = new A(f.start, p.start), x = new A(f.end, p.end), m = new A(y.center, x.center);
3043
+ m.userData.wallWidth = Math.max(y.length(), x.length()), r.push(m);
3063
3044
  });
3064
3045
  const a = [];
3065
3046
  i = i.filter((l) => {
@@ -3075,7 +3056,7 @@ class Ee extends q {
3075
3056
  const f = [];
3076
3057
  for (let p = 0; p < h.length; p++) {
3077
3058
  const y = h[p];
3078
- y.userData.type === "start" ? (f.length === 0 && (a.push(new D(u.start.clone(), y.clone())), u.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && u.start.copy(y));
3059
+ y.userData.type === "start" ? (f.length === 0 && (a.push(new A(u.start.clone(), y.clone())), u.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && u.start.copy(y));
3079
3060
  }
3080
3061
  a.push(u);
3081
3062
  }
@@ -3169,7 +3150,7 @@ class Ee extends q {
3169
3150
  } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
3170
3151
  }
3171
3152
  }
3172
- class ct extends ne {
3153
+ class ht extends se {
3173
3154
  Dxf;
3174
3155
  AngleCorrectionDxf;
3175
3156
  Variable;
@@ -3181,7 +3162,7 @@ class ct extends ne {
3181
3162
  * @param scale 原始数据缩放比例
3182
3163
  */
3183
3164
  constructor(t = 0.1, e = 1) {
3184
- super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new we(), this.Variable = new bt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Se()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Ee()), ct.finalInstance = this;
3165
+ super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new k(this.wallWidth, e), this.AngleCorrectionDxf = new me(), this.Variable = new Rt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Me()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Se()), ht.finalInstance = this;
3185
3166
  }
3186
3167
  usePlugin(t) {
3187
3168
  return typeof t == "function" && t.call(this, this), this;
@@ -3194,37 +3175,19 @@ class ct extends ne {
3194
3175
  });
3195
3176
  }
3196
3177
  }
3197
- function It(...d) {
3198
- d.forEach((t) => {
3199
- const e = t.direction();
3200
- t.userData.drawWindow?.forEach((n) => {
3201
- try {
3202
- const s = M.from(n.p), i = t.projectPoint(
3203
- s.clone().add(e.clone().multiplyScalar(n.width * 0.5)),
3204
- !1
3205
- ), r = t.projectPoint(
3206
- s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
3207
- !1
3208
- ), o = t.projectLineSegment(new D(i, r)), a = o.center;
3209
- n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
3210
- } catch {
3211
- }
3212
- });
3213
- });
3214
- }
3215
- class lt {
3178
+ class ut {
3216
3179
  /** 通过轨迹点查找外墙
3217
3180
  * @param lines
3218
3181
  * @param trajectoryPoints
3219
3182
  * @returns
3220
3183
  */
3221
3184
  static findExtWallByTraj(t, e, n = 0.4) {
3222
- const s = new F(R.fromByLineSegment(...t));
3185
+ const s = new F(N.fromByLineSegment(...t));
3223
3186
  return t.forEach((i) => s.insert({ line: i, userData: void 0 })), t = t.filter((i) => {
3224
3187
  const r = i.center, o = /* @__PURE__ */ new Set();
3225
3188
  for (const a of e) {
3226
3189
  if (o.size === 2) break;
3227
- const c = new D(r, a);
3190
+ const c = new A(r, a);
3228
3191
  if (!s.queryLineSegment(c).filter((h) => !(h.line === i || h.line.parallel(i) && i.getMinLength(h.line) < n && h.line.projectLineSegment(i).length() / i.length() > 0.6)).length) {
3229
3192
  const h = i.pointPosition(a);
3230
3193
  h !== "on" && o.add(h);
@@ -3238,87 +3201,89 @@ class lt {
3238
3201
  * @param trajectoryPoints
3239
3202
  */
3240
3203
  static boundExtbyTraj(t, e, n = 0.12) {
3241
- function s(g, w) {
3242
- return w.queryLineSegment(g).filter((E) => E.line !== g).map(({ line: E }) => {
3243
- const m = { resultLine: E, type: "intersect", direction: "vertical", point: null, newLine: null };
3244
- g.sameEndpoint(E) && (m.type = "endpoint"), g.parallel(E) && (m.direction = "parallel");
3245
- const S = g.getSameEndpoint(E);
3246
- if (S) m.point = S[1];
3204
+ function s(w, g) {
3205
+ return g.queryLineSegment(w).filter((S) => S.line !== w).map(({ line: S }) => {
3206
+ const D = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
3207
+ w.sameEndpoint(S) && (D.type = "endpoint"), w.parallel(S) && (D.direction = "parallel");
3208
+ const L = w.getSameEndpoint(S);
3209
+ if (L) D.point = L[1];
3247
3210
  else {
3248
- const T = E.getIntersection(g);
3249
- T && (m.point = E.start.equal(T) ? E.start : E.end);
3211
+ const b = S.getIntersection(w);
3212
+ b && (D.point = S.start.equal(b) ? S.start : S.end);
3250
3213
  }
3251
- return m;
3214
+ return D;
3252
3215
  });
3253
3216
  }
3254
- function i(g) {
3255
- const w = g.userData.expandDirect;
3256
- if (w === "left") {
3257
- const E = g.getLeftDirection();
3258
- g.directionMove(E, n * 0.5);
3259
- } else if (w === "right") {
3260
- const E = g.getRightDirection();
3261
- g.directionMove(E, n * 0.5);
3217
+ function i(w) {
3218
+ const g = w.userData.expandDirect;
3219
+ if (g === "left") {
3220
+ const S = w.getLeftDirection();
3221
+ w.directionMove(S, n * 0.5);
3222
+ } else if (g === "right") {
3223
+ const S = w.getRightDirection();
3224
+ w.directionMove(S, n * 0.5);
3262
3225
  }
3263
3226
  }
3264
- function r({ resultLine: g, type: w, direction: E, point: m }, S, T, L) {
3265
- if (w === "intersect")
3266
- m && m.copy(S.projectPoint(m) ?? m);
3267
- else if (E === "vertical") {
3268
- if (m) {
3269
- const A = S.projectPoint(m, !1);
3270
- m.copy(A), S.isPointOnSegment(A) || (S.start.distance(A) < S.end.distance(A) ? L.push(new D(A.clone(), S.start.clone())) : L.push(new D(A.clone(), S.end.clone())));
3227
+ function r({ resultLine: w, type: g, direction: S, point: D }, L, b, R) {
3228
+ if (g === "intersect")
3229
+ D && D.copy(L.projectPoint(D) ?? D);
3230
+ else if (S === "vertical") {
3231
+ if (D) {
3232
+ const P = L.projectPoint(D, !1);
3233
+ D.copy(P), L.isPointOnSegment(P) || (L.start.distance(P) < L.end.distance(P) ? R.push(new A(P.clone(), L.start.clone())) : R.push(new A(P.clone(), L.end.clone())));
3271
3234
  }
3272
- } else if (!u.includes(g) && m) {
3273
- let A = S.projectPoint(m, !1), P;
3274
- if (S.start.distance(m) < S.end.distance(m) ? P = S.start : P = S.end, A) {
3275
- L.push(new D(m.clone(), A.clone()));
3276
- const N = new D(A.clone(), P.clone());
3277
- N.length() && L.push(N);
3235
+ } else if (!u.includes(w) && D) {
3236
+ let P = L.projectPoint(D, !1), B;
3237
+ if (L.start.distance(D) < L.end.distance(D) ? B = L.start : B = L.end, P) {
3238
+ R.push(new A(D.clone(), P.clone()));
3239
+ const C = new A(P.clone(), B.clone());
3240
+ C.length() && R.push(C);
3278
3241
  }
3279
3242
  }
3280
- T.update(g);
3243
+ b.update(w);
3281
3244
  }
3282
- const o = Object.keys(e).map((g) => M.from(e[g])), a = [];
3283
- let c = t.map(({ start: g, end: w, ...E }) => {
3284
- const m = new D(M.from(g), M.from(w));
3285
- return m.userData = E, a.push(g.z ?? 0, w.z ?? 0), m;
3245
+ const o = Object.keys(e).map((w) => M.from(e[w])), a = [];
3246
+ let c = t.map(({ start: w, end: g, ...S }) => {
3247
+ const D = new A(M.from(w), M.from(g));
3248
+ return D.userData = S, a.push(w.z ?? 0, g.z ?? 0), D;
3286
3249
  });
3287
- const l = a.reduce((g, w) => g + w, 0) / a.length;
3288
- let u = lt.findExtWallByTraj(c, o).filter((g) => g.userData.expandDirect);
3289
- c = c.filter((g) => !u.includes(g)), c.push(...u);
3290
- const f = D.groupBySamePointAndParallel(u), p = new F(R.fromByLineSegment(...c));
3291
- c.forEach((g) => g.userData.isDoor || p.insert(g));
3292
- const y = f.map((g) => g.flatMap((w) => s(w, p))), x = [];
3293
- return f.flatMap((g, w) => (g.forEach((m) => (i(m), p.update(m))), y[w].filter((m) => {
3294
- if (!u.includes(m.resultLine)) {
3295
- let S;
3296
- return Object.defineProperty(m, "newLine", {
3250
+ const l = a.reduce((w, g) => w + g, 0) / a.length;
3251
+ let u = ut.findExtWallByTraj(c, o).filter((w) => w.userData.expandDirect);
3252
+ c = c.filter((w) => !u.includes(w)), c.push(...u);
3253
+ const p = this.parent?.findComponentByName("Renderer");
3254
+ o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(u, 0, { color: 65280 }).position.z = l + 1e-3;
3255
+ const y = A.groupBySamePointAndParallel(u), x = new F(N.fromByLineSegment(...c));
3256
+ c.forEach((w) => w.userData.isDoor || x.insert(w));
3257
+ const m = y.map((w) => w.flatMap((g) => s(g, x))), E = [];
3258
+ return y.flatMap((w, g) => (w.forEach((D) => (i(D), x.update(D))), m[g].filter((D) => {
3259
+ if (!u.includes(D.resultLine)) {
3260
+ let L;
3261
+ return Object.defineProperty(D, "newLine", {
3297
3262
  get() {
3298
- return S || (S = D.mergeLines(...g)), S;
3263
+ return L || (L = A.mergeLines(...w)), L;
3299
3264
  }
3300
3265
  }), !0;
3301
3266
  }
3302
- r(m, D.mergeLines(...g), p, x);
3303
- }))).reduce((g, w) => (g.has(w.resultLine) || g.set(w.resultLine, []), g.get(w.resultLine)?.push(w), g), /* @__PURE__ */ new Map()).forEach((g) => {
3304
- g.reduce((w, E) => (w.has(E.point) || w.set(E.point, []), w.get(E.point)?.push(E), w), /* @__PURE__ */ new Map()).forEach((w) => {
3305
- const E = /* @__PURE__ */ new Set();
3306
- for (let m = 0; m < w.length; m++) {
3307
- const S = w[m];
3308
- E.has(S.point) || (r(S, S.newLine, p, x), E.add(S.point));
3267
+ r(D, A.mergeLines(...w), x, E);
3268
+ }))).reduce((w, g) => (w.has(g.resultLine) || w.set(g.resultLine, []), w.get(g.resultLine)?.push(g), w), /* @__PURE__ */ new Map()).forEach((w) => {
3269
+ w.reduce((g, S) => (g.has(S.point) || g.set(S.point, []), g.get(S.point)?.push(S), g), /* @__PURE__ */ new Map()).forEach((g) => {
3270
+ const S = /* @__PURE__ */ new Set();
3271
+ for (let D = 0; D < g.length; D++) {
3272
+ const L = g[D];
3273
+ S.has(L.point) || (r(L, L.newLine, x, E), S.add(L.point));
3309
3274
  }
3310
3275
  });
3311
- }), c.push(...D.deduplication(x)), c.forEach((g) => g.userData.isWindow && It(g)), c = at(c), c = D.deduplication(c), K(c, l);
3276
+ }), c.push(...A.deduplication(E)), c.forEach((w) => w.userData.isWindow && Q(w)), c = lt(c), c = A.deduplication(c), Z(c, l);
3312
3277
  }
3313
3278
  }
3314
- const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3279
+ const an = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3315
3280
  __proto__: null,
3316
- AxisAlignCorr: Tt,
3317
- BoundExt: lt,
3318
- lineDataToOriginalData: K,
3319
- lineSegmentClipping: at,
3320
- recomputedWindow: It
3321
- }, Symbol.toStringTag, { value: "Module" })), mt = {
3281
+ AxisAlignCorr: Pt,
3282
+ BoundExt: ut,
3283
+ lineDataToOriginalData: Z,
3284
+ lineSegmentClipping: lt,
3285
+ recomputedWindow: Q
3286
+ }, Symbol.toStringTag, { value: "Module" })), St = {
3322
3287
  POSITION: [
3323
3288
  "byte",
3324
3289
  "byte normalized",
@@ -3346,34 +3311,34 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3346
3311
  "unsigned short"
3347
3312
  ]
3348
3313
  };
3349
- class Z {
3314
+ class tt {
3350
3315
  constructor() {
3351
3316
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
3352
- return new Ce(t);
3317
+ return new Ne(t);
3353
3318
  }), this.register(function(t) {
3354
- return new Be(t);
3319
+ return new Ce(t);
3355
3320
  }), this.register(function(t) {
3356
3321
  return new Ge(t);
3357
3322
  }), this.register(function(t) {
3358
- return new je(t);
3323
+ return new Ue(t);
3359
3324
  }), this.register(function(t) {
3360
3325
  return new ze(t);
3361
3326
  }), this.register(function(t) {
3362
- return new _e(t);
3327
+ return new je(t);
3328
+ }), this.register(function(t) {
3329
+ return new Be(t);
3363
3330
  }), this.register(function(t) {
3364
3331
  return new Oe(t);
3365
3332
  }), this.register(function(t) {
3366
3333
  return new Fe(t);
3367
3334
  }), this.register(function(t) {
3368
- return new Ue(t);
3335
+ return new _e(t);
3369
3336
  }), this.register(function(t) {
3370
3337
  return new qe(t);
3371
3338
  }), this.register(function(t) {
3372
3339
  return new Ye(t);
3373
3340
  }), this.register(function(t) {
3374
3341
  return new ke(t);
3375
- }), this.register(function(t) {
3376
- return new Xe(t);
3377
3342
  }), this.register(function(t) {
3378
3343
  return new Ve(t);
3379
3344
  });
@@ -3388,7 +3353,7 @@ class Z {
3388
3353
  return this.textureUtils = t, this;
3389
3354
  }
3390
3355
  parse(t, e, n, s) {
3391
- const i = new Ne(), r = [];
3356
+ const i = new ve(), r = [];
3392
3357
  for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
3393
3358
  r.push(this.pluginCallbacks[o](i));
3394
3359
  i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
@@ -3400,7 +3365,7 @@ class Z {
3400
3365
  });
3401
3366
  }
3402
3367
  }
3403
- const b = {
3368
+ const T = {
3404
3369
  POINTS: 0,
3405
3370
  LINES: 1,
3406
3371
  LINE_LOOP: 2,
@@ -3424,34 +3389,34 @@ const b = {
3424
3389
  CLAMP_TO_EDGE: 33071,
3425
3390
  MIRRORED_REPEAT: 33648,
3426
3391
  REPEAT: 10497
3427
- }, et = "KHR_mesh_quantization", U = {};
3428
- U[Xt] = b.NEAREST;
3429
- U[Vt] = b.NEAREST_MIPMAP_NEAREST;
3430
- U[Wt] = b.NEAREST_MIPMAP_LINEAR;
3431
- U[Ht] = b.LINEAR;
3432
- U[Jt] = b.LINEAR_MIPMAP_NEAREST;
3433
- U[$t] = b.LINEAR_MIPMAP_LINEAR;
3434
- U[Kt] = b.CLAMP_TO_EDGE;
3435
- U[Zt] = b.REPEAT;
3436
- U[Qt] = b.MIRRORED_REPEAT;
3437
- const wt = {
3392
+ }, st = "KHR_mesh_quantization", G = {};
3393
+ G[Xt] = T.NEAREST;
3394
+ G[Wt] = T.NEAREST_MIPMAP_NEAREST;
3395
+ G[Ht] = T.NEAREST_MIPMAP_LINEAR;
3396
+ G[Jt] = T.LINEAR;
3397
+ G[$t] = T.LINEAR_MIPMAP_NEAREST;
3398
+ G[Kt] = T.LINEAR_MIPMAP_LINEAR;
3399
+ G[Zt] = T.CLAMP_TO_EDGE;
3400
+ G[Qt] = T.REPEAT;
3401
+ G[te] = T.MIRRORED_REPEAT;
3402
+ const Et = {
3438
3403
  scale: "scale",
3439
3404
  position: "translation",
3440
3405
  quaternion: "rotation",
3441
3406
  morphTargetInfluences: "weights"
3442
- }, De = new Ot(), Mt = 12, Le = 1179937895, Ae = 2, St = 8, Te = 1313821514, be = 5130562;
3443
- function W(d, t) {
3407
+ }, Ee = new Ft(), Lt = 12, Le = 1179937895, De = 2, Dt = 8, Ae = 1313821514, Te = 5130562;
3408
+ function H(d, t) {
3444
3409
  return d.length === t.length && d.every(function(e, n) {
3445
3410
  return e === t[n];
3446
3411
  });
3447
3412
  }
3448
- function Ie(d) {
3413
+ function be(d) {
3449
3414
  return new TextEncoder().encode(d).buffer;
3450
3415
  }
3451
- function Pe(d) {
3452
- return W(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3416
+ function Ie(d) {
3417
+ return H(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3453
3418
  }
3454
- function Re(d, t, e) {
3419
+ function Pe(d, t, e) {
3455
3420
  const n = {
3456
3421
  min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
3457
3422
  max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
@@ -3459,15 +3424,15 @@ function Re(d, t, e) {
3459
3424
  for (let s = t; s < t + e; s++)
3460
3425
  for (let i = 0; i < d.itemSize; i++) {
3461
3426
  let r;
3462
- d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r = it.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3427
+ d.itemSize > 4 ? r = d.array[s * d.itemSize + i] : (i === 0 ? r = d.getX(s) : i === 1 ? r = d.getY(s) : i === 2 ? r = d.getZ(s) : i === 3 && (r = d.getW(s)), d.normalized === !0 && (r = ot.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3463
3428
  }
3464
3429
  return n;
3465
3430
  }
3466
- function Pt(d) {
3431
+ function vt(d) {
3467
3432
  return Math.ceil(d / 4) * 4;
3468
3433
  }
3469
- function nt(d, t = 0) {
3470
- const e = Pt(d.byteLength);
3434
+ function it(d, t = 0) {
3435
+ const e = vt(d.byteLength);
3471
3436
  if (e !== d.byteLength) {
3472
3437
  const n = new Uint8Array(e);
3473
3438
  if (n.set(new Uint8Array(d)), t !== 0)
@@ -3477,10 +3442,10 @@ function nt(d, t = 0) {
3477
3442
  }
3478
3443
  return d;
3479
3444
  }
3480
- function Et() {
3445
+ function At() {
3481
3446
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
3482
3447
  }
3483
- function ve(d, t) {
3448
+ function Re(d, t) {
3484
3449
  if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
3485
3450
  let e;
3486
3451
  return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
@@ -3490,7 +3455,7 @@ function ve(d, t) {
3490
3455
  } else
3491
3456
  return new Promise((e) => d.toBlob(e, t));
3492
3457
  }
3493
- class Ne {
3458
+ class ve {
3494
3459
  constructor() {
3495
3460
  this.plugins = [], this.options = {}, this.pending = [], this.buffers = [], this.byteOffset = 0, this.buffers = [], this.nodeMap = /* @__PURE__ */ new Map(), this.skins = [], this.extensionsUsed = {}, this.extensionsRequired = {}, this.uids = /* @__PURE__ */ new Map(), this.uid = 0, this.json = {
3496
3461
  asset: {
@@ -3532,26 +3497,26 @@ class Ne {
3532
3497
  const s = this, i = s.buffers, r = s.json;
3533
3498
  n = s.options;
3534
3499
  const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
3535
- l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? st(c).then(function(u) {
3536
- const f = nt(u), p = new DataView(new ArrayBuffer(St));
3537
- p.setUint32(0, f.byteLength, !0), p.setUint32(4, be, !0);
3538
- const y = nt(Ie(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(St));
3539
- x.setUint32(0, y.byteLength, !0), x.setUint32(4, Te, !0);
3540
- const g = new ArrayBuffer(Mt), w = new DataView(g);
3541
- w.setUint32(0, Le, !0), w.setUint32(4, Ae, !0);
3542
- const E = Mt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3543
- w.setUint32(8, E, !0);
3544
- const m = new Blob([
3545
- g,
3500
+ l.length > 0 && (r.extensionsUsed = l), h.length > 0 && (r.extensionsRequired = h), r.buffers && r.buffers.length > 0 && (r.buffers[0].byteLength = c.size), n.binary === !0 ? rt(c).then(function(u) {
3501
+ const f = it(u), p = new DataView(new ArrayBuffer(Dt));
3502
+ p.setUint32(0, f.byteLength, !0), p.setUint32(4, Te, !0);
3503
+ const y = it(be(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Dt));
3504
+ x.setUint32(0, y.byteLength, !0), x.setUint32(4, Ae, !0);
3505
+ const m = new ArrayBuffer(Lt), E = new DataView(m);
3506
+ E.setUint32(0, Le, !0), E.setUint32(4, De, !0);
3507
+ const w = Lt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3508
+ E.setUint32(8, w, !0);
3509
+ const g = new Blob([
3510
+ m,
3546
3511
  x,
3547
3512
  y,
3548
3513
  p,
3549
3514
  f
3550
3515
  ], { type: "application/octet-stream" });
3551
- st(m).then((S) => {
3516
+ rt(g).then((S) => {
3552
3517
  e(S);
3553
3518
  });
3554
- }) : r.buffers && r.buffers.length > 0 ? We(c).then((u) => {
3519
+ }) : r.buffers && r.buffers.length > 0 ? Xe(c).then((u) => {
3555
3520
  r.buffers[0].uri = u, e(r);
3556
3521
  }) : e(r);
3557
3522
  }
@@ -3599,7 +3564,7 @@ class Ne {
3599
3564
  */
3600
3565
  isNormalizedNormalAttribute(t) {
3601
3566
  if (this.cache.attributesNormalized.has(t)) return !1;
3602
- const n = new J();
3567
+ const n = new $();
3603
3568
  for (let s = 0, i = t.count; s < i; s++)
3604
3569
  if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
3605
3570
  return !0;
@@ -3614,7 +3579,7 @@ class Ne {
3614
3579
  createNormalizedNormalAttribute(t) {
3615
3580
  const e = this.cache;
3616
3581
  if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
3617
- const n = t.clone(), s = new J();
3582
+ const n = t.clone(), s = new $();
3618
3583
  for (let i = 0, r = n.count; i < r; i++)
3619
3584
  s.fromBufferAttribute(n, i), s.x === 0 && s.y === 0 && s.z === 0 ? s.setX(1) : s.normalize(), n.setXYZ(i, s.x, s.y, s.z);
3620
3585
  return e.attributesNormalized.set(t, n), n;
@@ -3634,14 +3599,14 @@ class Ne {
3634
3599
  async buildMetalRoughTextureAsync(t, e) {
3635
3600
  if (t === e) return t;
3636
3601
  function n(f) {
3637
- return f.colorSpace === kt ? function(y) {
3602
+ return f.colorSpace === Vt ? function(y) {
3638
3603
  return y < 0.04045 ? y * 0.0773993808 : Math.pow(y * 0.9478672986 + 0.0521327014, 2.4);
3639
3604
  } : function(y) {
3640
3605
  return y;
3641
3606
  };
3642
3607
  }
3643
- t instanceof tt && (t = await this.decompressTextureAsync(t)), e instanceof tt && (e = await this.decompressTextureAsync(e));
3644
- const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = Et();
3608
+ t instanceof nt && (t = await this.decompressTextureAsync(t)), e instanceof nt && (e = await this.decompressTextureAsync(e));
3609
+ const s = t ? t.image : null, i = e ? e.image : null, r = Math.max(s ? s.width : 0, i ? i.width : 0), o = Math.max(s ? s.height : 0, i ? i.height : 0), a = At();
3645
3610
  a.width = r, a.height = o;
3646
3611
  const c = a.getContext("2d", {
3647
3612
  willReadFrequently: !0
@@ -3662,7 +3627,7 @@ class Ne {
3662
3627
  }
3663
3628
  c.putImageData(l, 0, 0);
3664
3629
  const u = (t || e).clone();
3665
- return u.source = new Gt(a), u.colorSpace = jt, u.channel = (t || e).channel, t && e && t.channel !== e.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), u;
3630
+ return u.source = new zt(a), u.colorSpace = jt, u.channel = (t || e).channel, t && e && t.channel !== e.channel && console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."), console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."), u;
3666
3631
  }
3667
3632
  async decompressTextureAsync(t, e = 1 / 0) {
3668
3633
  if (this.textureUtils === null)
@@ -3692,25 +3657,25 @@ class Ne {
3692
3657
  r.bufferViews || (r.bufferViews = []);
3693
3658
  let o;
3694
3659
  switch (e) {
3695
- case b.BYTE:
3696
- case b.UNSIGNED_BYTE:
3660
+ case T.BYTE:
3661
+ case T.UNSIGNED_BYTE:
3697
3662
  o = 1;
3698
3663
  break;
3699
- case b.SHORT:
3700
- case b.UNSIGNED_SHORT:
3664
+ case T.SHORT:
3665
+ case T.UNSIGNED_SHORT:
3701
3666
  o = 2;
3702
3667
  break;
3703
3668
  default:
3704
3669
  o = 4;
3705
3670
  }
3706
3671
  let a = t.itemSize * o;
3707
- i === b.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
3708
- const c = Pt(s * a), l = new DataView(new ArrayBuffer(c));
3672
+ i === T.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
3673
+ const c = vt(s * a), l = new DataView(new ArrayBuffer(c));
3709
3674
  let h = 0;
3710
3675
  for (let p = n; p < n + s; p++) {
3711
3676
  for (let y = 0; y < t.itemSize; y++) {
3712
3677
  let x;
3713
- t.itemSize > 4 ? x = t.array[p * t.itemSize + y] : (y === 0 ? x = t.getX(p) : y === 1 ? x = t.getY(p) : y === 2 ? x = t.getZ(p) : y === 3 && (x = t.getW(p)), t.normalized === !0 && (x = it.normalize(x, t.array))), e === b.FLOAT ? l.setFloat32(h, x, !0) : e === b.INT ? l.setInt32(h, x, !0) : e === b.UNSIGNED_INT ? l.setUint32(h, x, !0) : e === b.SHORT ? l.setInt16(h, x, !0) : e === b.UNSIGNED_SHORT ? l.setUint16(h, x, !0) : e === b.BYTE ? l.setInt8(h, x) : e === b.UNSIGNED_BYTE && l.setUint8(h, x), h += o;
3678
+ t.itemSize > 4 ? x = t.array[p * t.itemSize + y] : (y === 0 ? x = t.getX(p) : y === 1 ? x = t.getY(p) : y === 2 ? x = t.getZ(p) : y === 3 && (x = t.getW(p)), t.normalized === !0 && (x = ot.normalize(x, t.array))), e === T.FLOAT ? l.setFloat32(h, x, !0) : e === T.INT ? l.setInt32(h, x, !0) : e === T.UNSIGNED_INT ? l.setUint32(h, x, !0) : e === T.SHORT ? l.setInt16(h, x, !0) : e === T.UNSIGNED_SHORT ? l.setUint16(h, x, !0) : e === T.BYTE ? l.setInt8(h, x) : e === T.UNSIGNED_BYTE && l.setUint8(h, x), h += o;
3714
3679
  }
3715
3680
  h % a !== 0 && (h += a - h % a);
3716
3681
  }
@@ -3719,7 +3684,7 @@ class Ne {
3719
3684
  byteOffset: this.byteOffset,
3720
3685
  byteLength: c
3721
3686
  };
3722
- return i !== void 0 && (u.target = i), i === b.ARRAY_BUFFER && (u.byteStride = a), this.byteOffset += c, r.bufferViews.push(u), {
3687
+ return i !== void 0 && (u.target = i), i === T.ARRAY_BUFFER && (u.byteStride = a), this.byteOffset += c, r.bufferViews.push(u), {
3723
3688
  id: r.bufferViews.length - 1,
3724
3689
  byteLength: 0
3725
3690
  };
@@ -3732,8 +3697,8 @@ class Ne {
3732
3697
  processBufferViewImage(t) {
3733
3698
  const e = this, n = e.json;
3734
3699
  return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
3735
- st(t).then((i) => {
3736
- const r = nt(i), o = {
3700
+ rt(t).then((i) => {
3701
+ const r = it(i), o = {
3737
3702
  buffer: e.processBuffer(r),
3738
3703
  byteOffset: e.byteOffset,
3739
3704
  byteLength: r.byteLength
@@ -3761,25 +3726,25 @@ class Ne {
3761
3726
  };
3762
3727
  let o;
3763
3728
  if (t.array.constructor === Float32Array)
3764
- o = b.FLOAT;
3729
+ o = T.FLOAT;
3765
3730
  else if (t.array.constructor === Int32Array)
3766
- o = b.INT;
3731
+ o = T.INT;
3767
3732
  else if (t.array.constructor === Uint32Array)
3768
- o = b.UNSIGNED_INT;
3733
+ o = T.UNSIGNED_INT;
3769
3734
  else if (t.array.constructor === Int16Array)
3770
- o = b.SHORT;
3735
+ o = T.SHORT;
3771
3736
  else if (t.array.constructor === Uint16Array)
3772
- o = b.UNSIGNED_SHORT;
3737
+ o = T.UNSIGNED_SHORT;
3773
3738
  else if (t.array.constructor === Int8Array)
3774
- o = b.BYTE;
3739
+ o = T.BYTE;
3775
3740
  else if (t.array.constructor === Uint8Array)
3776
- o = b.UNSIGNED_BYTE;
3741
+ o = T.UNSIGNED_BYTE;
3777
3742
  else
3778
3743
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
3779
3744
  if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
3780
- const a = Re(t, n, s);
3745
+ const a = Pe(t, n, s);
3781
3746
  let c;
3782
- e !== void 0 && (c = t === e.index ? b.ELEMENT_ARRAY_BUFFER : b.ARRAY_BUFFER);
3747
+ e !== void 0 && (c = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
3783
3748
  const l = this.processBufferView(t, o, n, s, c), h = {
3784
3749
  bufferView: l.id,
3785
3750
  byteOffset: l.byteOffset,
@@ -3806,26 +3771,26 @@ class Ne {
3806
3771
  const l = r.images.get(t), h = s + ":flipY/" + n.toString();
3807
3772
  if (l[h] !== void 0) return l[h];
3808
3773
  o.images || (o.images = []);
3809
- const u = { mimeType: s }, f = Et();
3774
+ const u = { mimeType: s }, f = At();
3810
3775
  f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
3811
3776
  const p = f.getContext("2d", {
3812
3777
  willReadFrequently: !0
3813
3778
  });
3814
3779
  if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
3815
- e !== zt && console.error("GLTFExporter: Only RGBAFormat is supported.", e), (t.width > a.maxTextureSize || t.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", t);
3780
+ e !== _t && console.error("GLTFExporter: Only RGBAFormat is supported.", e), (t.width > a.maxTextureSize || t.height > a.maxTextureSize) && console.warn("GLTFExporter: Image size is bigger than maxTextureSize", t);
3816
3781
  const x = new Uint8ClampedArray(t.height * t.width * 4);
3817
- for (let g = 0; g < x.length; g += 4)
3818
- x[g + 0] = t.data[g + 0], x[g + 1] = t.data[g + 1], x[g + 2] = t.data[g + 2], x[g + 3] = t.data[g + 3];
3782
+ for (let m = 0; m < x.length; m += 4)
3783
+ x[m + 0] = t.data[m + 0], x[m + 1] = t.data[m + 1], x[m + 2] = t.data[m + 2], x[m + 3] = t.data[m + 3];
3819
3784
  p.putImageData(new ImageData(x, t.width, t.height), 0, 0);
3820
3785
  } else if (typeof HTMLImageElement < "u" && t instanceof HTMLImageElement || typeof HTMLCanvasElement < "u" && t instanceof HTMLCanvasElement || typeof ImageBitmap < "u" && t instanceof ImageBitmap || typeof OffscreenCanvas < "u" && t instanceof OffscreenCanvas)
3821
3786
  p.drawImage(t, 0, 0, f.width, f.height);
3822
3787
  else
3823
3788
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
3824
3789
  a.binary === !0 ? c.push(
3825
- ve(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3790
+ Re(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3826
3791
  u.bufferView = x;
3827
3792
  })
3828
- ) : u.uri = _t.getDataURL(f, s);
3793
+ ) : u.uri = qt.getDataURL(f, s);
3829
3794
  const y = o.images.push(u) - 1;
3830
3795
  return l[h] = y, y;
3831
3796
  } else
@@ -3840,10 +3805,10 @@ class Ne {
3840
3805
  const e = this.json;
3841
3806
  e.samplers || (e.samplers = []);
3842
3807
  const n = {
3843
- magFilter: U[t.magFilter],
3844
- minFilter: U[t.minFilter],
3845
- wrapS: U[t.wrapS],
3846
- wrapT: U[t.wrapT]
3808
+ magFilter: G[t.magFilter],
3809
+ minFilter: G[t.minFilter],
3810
+ wrapS: G[t.wrapS],
3811
+ wrapT: G[t.wrapT]
3847
3812
  };
3848
3813
  return e.samplers.push(n) - 1;
3849
3814
  }
@@ -3855,7 +3820,7 @@ class Ne {
3855
3820
  async processTextureAsync(t) {
3856
3821
  const n = this.options, s = this.cache, i = this.json;
3857
3822
  if (s.textures.has(t)) return s.textures.get(t);
3858
- i.textures || (i.textures = []), t instanceof tt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
3823
+ i.textures || (i.textures = []), t instanceof nt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
3859
3824
  let r = t.userData.mimeType;
3860
3825
  r === "image/webp" && (r = "image/png");
3861
3826
  const o = {
@@ -3882,7 +3847,7 @@ class Ne {
3882
3847
  const s = { pbrMetallicRoughness: {} };
3883
3848
  t.isMeshStandardMaterial !== !0 && t.isMeshBasicMaterial !== !0 && console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");
3884
3849
  const i = t.color.toArray().concat([t.opacity]);
3885
- if (W(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), t.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = t.metalness, s.pbrMetallicRoughness.roughnessFactor = t.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), t.metalnessMap || t.roughnessMap) {
3850
+ if (H(i, [1, 1, 1, 1]) || (s.pbrMetallicRoughness.baseColorFactor = i), t.isMeshStandardMaterial ? (s.pbrMetallicRoughness.metallicFactor = t.metalness, s.pbrMetallicRoughness.roughnessFactor = t.roughness) : (s.pbrMetallicRoughness.metallicFactor = 0, s.pbrMetallicRoughness.roughnessFactor = 1), t.metalnessMap || t.roughnessMap) {
3886
3851
  const o = await this.buildMetalRoughTextureAsync(t.metalnessMap, t.roughnessMap), a = {
3887
3852
  index: await this.processTextureAsync(o),
3888
3853
  texCoord: o.channel
@@ -3920,7 +3885,7 @@ class Ne {
3920
3885
  };
3921
3886
  t.aoMapIntensity !== 1 && (o.strength = t.aoMapIntensity), this.applyTextureTransform(o, t.aoMap), s.occlusionTexture = o;
3922
3887
  }
3923
- t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === qt && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
3888
+ t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === Yt && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
3924
3889
  o.writeMaterialAsync && await o.writeMaterialAsync(t, s);
3925
3890
  });
3926
3891
  const r = n.materials.push(s) - 1;
@@ -3934,15 +3899,15 @@ class Ne {
3934
3899
  async processMeshAsync(t) {
3935
3900
  const e = this.cache, n = this.json, s = [t.geometry.uuid];
3936
3901
  if (Array.isArray(t.material))
3937
- for (let m = 0, S = t.material.length; m < S; m++)
3938
- s.push(t.material[m].uuid);
3902
+ for (let g = 0, S = t.material.length; g < S; g++)
3903
+ s.push(t.material[g].uuid);
3939
3904
  else
3940
3905
  s.push(t.material.uuid);
3941
3906
  const i = s.join(":");
3942
3907
  if (e.meshes.has(i)) return e.meshes.get(i);
3943
3908
  const r = t.geometry;
3944
3909
  let o;
3945
- t.isLineSegments ? o = b.LINES : t.isLineLoop ? o = b.LINE_LOOP : t.isLine ? o = b.LINE_STRIP : t.isPoints ? o = b.POINTS : o = t.material.wireframe ? b.LINES : b.TRIANGLES;
3910
+ t.isLineSegments ? o = T.LINES : t.isLineLoop ? o = T.LINE_LOOP : t.isLine ? o = T.LINE_STRIP : t.isPoints ? o = T.POINTS : o = t.material.wireframe ? T.LINES : T.TRIANGLES;
3946
3911
  const a = {}, c = {}, l = [], h = [], u = {
3947
3912
  uv: "TEXCOORD_0",
3948
3913
  uv1: "TEXCOORD_1",
@@ -3954,76 +3919,76 @@ class Ne {
3954
3919
  }, f = r.getAttribute("normal");
3955
3920
  f !== void 0 && !this.isNormalizedNormalAttribute(f) && (console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."), r.setAttribute("normal", this.createNormalizedNormalAttribute(f)));
3956
3921
  let p = null;
3957
- for (let m in r.attributes) {
3958
- if (m.slice(0, 5) === "morph") continue;
3959
- const S = r.attributes[m];
3960
- if (m = u[m] || m.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(m) || (m = "_" + m), e.attributes.has(this.getUID(S))) {
3961
- c[m] = e.attributes.get(this.getUID(S));
3922
+ for (let g in r.attributes) {
3923
+ if (g.slice(0, 5) === "morph") continue;
3924
+ const S = r.attributes[g];
3925
+ if (g = u[g] || g.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g) || (g = "_" + g), e.attributes.has(this.getUID(S))) {
3926
+ c[g] = e.attributes.get(this.getUID(S));
3962
3927
  continue;
3963
3928
  }
3964
3929
  p = null;
3965
3930
  const L = S.array;
3966
- m === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(L), S.itemSize, S.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !m.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${m}" converted to type FLOAT.`), p = Z.Utils.toFloat32BufferAttribute(S));
3967
- const A = this.processAccessor(p || S, r);
3968
- A !== null && (m.startsWith("_") || this.detectMeshQuantization(m, S), c[m] = A, e.attributes.set(this.getUID(S), A));
3931
+ g === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(L), S.itemSize, S.normalized)) : (L instanceof Uint32Array || L instanceof Int32Array) && !g.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${g}" converted to type FLOAT.`), p = tt.Utils.toFloat32BufferAttribute(S));
3932
+ const b = this.processAccessor(p || S, r);
3933
+ b !== null && (g.startsWith("_") || this.detectMeshQuantization(g, S), c[g] = b, e.attributes.set(this.getUID(S), b));
3969
3934
  }
3970
3935
  if (f !== void 0 && r.setAttribute("normal", f), Object.keys(c).length === 0) return null;
3971
3936
  if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
3972
- const m = [], S = [], T = {};
3937
+ const g = [], S = [], D = {};
3973
3938
  if (t.morphTargetDictionary !== void 0)
3974
3939
  for (const L in t.morphTargetDictionary)
3975
- T[t.morphTargetDictionary[L]] = L;
3940
+ D[t.morphTargetDictionary[L]] = L;
3976
3941
  for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
3977
- const A = {};
3978
- let P = !1;
3979
- for (const N in r.morphAttributes) {
3980
- if (N !== "position" && N !== "normal") {
3981
- P || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), P = !0);
3942
+ const b = {};
3943
+ let R = !1;
3944
+ for (const P in r.morphAttributes) {
3945
+ if (P !== "position" && P !== "normal") {
3946
+ R || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), R = !0);
3982
3947
  continue;
3983
3948
  }
3984
- const O = r.morphAttributes[N][L], C = N.toUpperCase(), G = r.attributes[N];
3985
- if (e.attributes.has(this.getUID(O, !0))) {
3986
- A[C] = e.attributes.get(this.getUID(O, !0));
3949
+ const B = r.morphAttributes[P][L], C = P.toUpperCase(), U = r.attributes[P];
3950
+ if (e.attributes.has(this.getUID(B, !0))) {
3951
+ b[C] = e.attributes.get(this.getUID(B, !0));
3987
3952
  continue;
3988
3953
  }
3989
- const B = O.clone();
3954
+ const O = B.clone();
3990
3955
  if (!r.morphTargetsRelative)
3991
- for (let v = 0, V = O.count; v < V; v++)
3992
- for (let j = 0; j < O.itemSize; j++)
3993
- j === 0 && B.setX(v, O.getX(v) - G.getX(v)), j === 1 && B.setY(v, O.getY(v) - G.getY(v)), j === 2 && B.setZ(v, O.getZ(v) - G.getZ(v)), j === 3 && B.setW(v, O.getW(v) - G.getW(v));
3994
- A[C] = this.processAccessor(B, r), e.attributes.set(this.getUID(G, !0), A[C]);
3956
+ for (let v = 0, V = B.count; v < V; v++)
3957
+ for (let z = 0; z < B.itemSize; z++)
3958
+ z === 0 && O.setX(v, B.getX(v) - U.getX(v)), z === 1 && O.setY(v, B.getY(v) - U.getY(v)), z === 2 && O.setZ(v, B.getZ(v) - U.getZ(v)), z === 3 && O.setW(v, B.getW(v) - U.getW(v));
3959
+ b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(U, !0), b[C]);
3995
3960
  }
3996
- h.push(A), m.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(T[L]);
3961
+ h.push(b), g.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(D[L]);
3997
3962
  }
3998
- a.weights = m, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
3963
+ a.weights = g, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
3999
3964
  }
4000
3965
  const y = Array.isArray(t.material);
4001
3966
  if (y && r.groups.length === 0) return null;
4002
3967
  let x = !1;
4003
3968
  if (y && r.index === null) {
4004
- const m = [];
4005
- for (let S = 0, T = r.attributes.position.count; S < T; S++)
4006
- m[S] = S;
4007
- r.setIndex(m), x = !0;
3969
+ const g = [];
3970
+ for (let S = 0, D = r.attributes.position.count; S < D; S++)
3971
+ g[S] = S;
3972
+ r.setIndex(g), x = !0;
4008
3973
  }
4009
- const g = y ? t.material : [t.material], w = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4010
- for (let m = 0, S = w.length; m < S; m++) {
4011
- const T = {
3974
+ const m = y ? t.material : [t.material], E = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
3975
+ for (let g = 0, S = E.length; g < S; g++) {
3976
+ const D = {
4012
3977
  mode: o,
4013
3978
  attributes: c
4014
3979
  };
4015
- if (this.serializeUserData(r, T), h.length > 0 && (T.targets = h), r.index !== null) {
4016
- let A = this.getUID(r.index);
4017
- (w[m].start !== void 0 || w[m].count !== void 0) && (A += ":" + w[m].start + ":" + w[m].count), e.attributes.has(A) ? T.indices = e.attributes.get(A) : (T.indices = this.processAccessor(r.index, r, w[m].start, w[m].count), e.attributes.set(A, T.indices)), T.indices === null && delete T.indices;
3980
+ if (this.serializeUserData(r, D), h.length > 0 && (D.targets = h), r.index !== null) {
3981
+ let b = this.getUID(r.index);
3982
+ (E[g].start !== void 0 || E[g].count !== void 0) && (b += ":" + E[g].start + ":" + E[g].count), e.attributes.has(b) ? D.indices = e.attributes.get(b) : (D.indices = this.processAccessor(r.index, r, E[g].start, E[g].count), e.attributes.set(b, D.indices)), D.indices === null && delete D.indices;
4018
3983
  }
4019
- const L = await this.processMaterialAsync(g[w[m].materialIndex]);
4020
- L !== null && (T.material = L), l.push(T);
3984
+ const L = await this.processMaterialAsync(m[E[g].materialIndex]);
3985
+ L !== null && (D.material = L), l.push(D);
4021
3986
  }
4022
- x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(m) {
4023
- m.writeMesh && m.writeMesh(t, a);
3987
+ x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(g) {
3988
+ g.writeMesh && g.writeMesh(t, a);
4024
3989
  });
4025
- const E = n.meshes.push(a) - 1;
4026
- return e.meshes.set(i, E), E;
3990
+ const w = n.meshes.push(a) - 1;
3991
+ return e.meshes.set(i, w), w;
4027
3992
  }
4028
3993
  /**
4029
3994
  * If a vertex attribute with a
@@ -4037,7 +4002,7 @@ class Ne {
4037
4002
  * @param {THREE.BufferAttribute} attribute
4038
4003
  */
4039
4004
  detectMeshQuantization(t, e) {
4040
- if (this.extensionsUsed[et]) return;
4005
+ if (this.extensionsUsed[st]) return;
4041
4006
  let n;
4042
4007
  switch (e.array.constructor) {
4043
4008
  case Int8Array:
@@ -4057,7 +4022,7 @@ class Ne {
4057
4022
  }
4058
4023
  e.normalized && (n += " normalized");
4059
4024
  const s = t.split("_", 1)[0];
4060
- mt[s] && mt[s].includes(n) && (this.extensionsUsed[et] = !0, this.extensionsRequired[et] = !0);
4025
+ St[s] && St[s].includes(n) && (this.extensionsUsed[st] = !0, this.extensionsRequired[st] = !0);
4061
4026
  }
4062
4027
  /**
4063
4028
  * Process camera
@@ -4077,7 +4042,7 @@ class Ne {
4077
4042
  znear: t.near < 0 ? 0 : t.near
4078
4043
  } : s.perspective = {
4079
4044
  aspectRatio: t.aspect,
4080
- yfov: it.degToRad(t.fov),
4045
+ yfov: ot.degToRad(t.fov),
4081
4046
  zfar: t.far <= 0 ? 1e-3 : t.far,
4082
4047
  znear: t.near < 0 ? 0 : t.near
4083
4048
  }, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
@@ -4094,21 +4059,21 @@ class Ne {
4094
4059
  */
4095
4060
  processAnimation(t, e) {
4096
4061
  const n = this.json, s = this.nodeMap;
4097
- n.animations || (n.animations = []), t = Z.Utils.mergeMorphTargetTracks(t.clone(), e);
4062
+ n.animations || (n.animations = []), t = tt.Utils.mergeMorphTargetTracks(t.clone(), e);
4098
4063
  const i = t.tracks, r = [], o = [];
4099
4064
  for (let c = 0; c < i.length; ++c) {
4100
- const l = i[c], h = $.parseTrackName(l.name);
4101
- let u = $.findNode(e, h.nodeName);
4102
- const f = wt[h.propertyName];
4065
+ const l = i[c], h = K.parseTrackName(l.name);
4066
+ let u = K.findNode(e, h.nodeName);
4067
+ const f = Et[h.propertyName];
4103
4068
  if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !f) {
4104
4069
  console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
4105
4070
  continue;
4106
4071
  }
4107
4072
  const p = 1;
4108
4073
  let y = l.values.length / l.times.length;
4109
- f === wt.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4074
+ f === Et.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4110
4075
  let x;
4111
- l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === Yt ? x = "STEP" : x = "LINEAR", o.push({
4076
+ l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
4112
4077
  input: this.processAccessor(new _(l.times, p)),
4113
4078
  output: this.processAccessor(new _(l.values, y)),
4114
4079
  interpolation: x
@@ -4136,7 +4101,7 @@ class Ne {
4136
4101
  if (i === void 0) return null;
4137
4102
  const r = t.skeleton.bones[0];
4138
4103
  if (r === void 0) return null;
4139
- const o = [], a = new Float32Array(i.bones.length * 16), c = new Lt();
4104
+ const o = [], a = new Float32Array(i.bones.length * 16), c = new bt();
4140
4105
  for (let h = 0; h < i.bones.length; ++h)
4141
4106
  o.push(n.get(i.bones[h])), c.copy(i.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
4142
4107
  return e.skins === void 0 && (e.skins = []), e.skins.push({
@@ -4156,9 +4121,9 @@ class Ne {
4156
4121
  const i = {};
4157
4122
  if (n.trs) {
4158
4123
  const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
4159
- W(o, [0, 0, 0, 1]) || (i.rotation = o), W(a, [0, 0, 0]) || (i.translation = a), W(c, [1, 1, 1]) || (i.scale = c);
4124
+ H(o, [0, 0, 0, 1]) || (i.rotation = o), H(a, [0, 0, 0]) || (i.translation = a), H(c, [1, 1, 1]) || (i.scale = c);
4160
4125
  } else
4161
- t.matrixAutoUpdate && t.updateMatrix(), Pe(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4126
+ t.matrixAutoUpdate && t.updateMatrix(), Ie(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4162
4127
  if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
4163
4128
  const o = await this.processMeshAsync(t);
4164
4129
  o !== null && (i.mesh = o);
@@ -4204,7 +4169,7 @@ class Ne {
4204
4169
  * @param {Array<THREE.Object3D>} objects List of objects to process
4205
4170
  */
4206
4171
  async processObjectsAsync(t) {
4207
- const e = new ut();
4172
+ const e = new ft();
4208
4173
  e.name = "AuxScene";
4209
4174
  for (let n = 0; n < t.length; n++)
4210
4175
  e.children.push(t[n]);
@@ -4220,7 +4185,7 @@ class Ne {
4220
4185
  });
4221
4186
  const n = [];
4222
4187
  for (let s = 0; s < t.length; s++)
4223
- t[s] instanceof ut ? await this.processSceneAsync(t[s]) : n.push(t[s]);
4188
+ t[s] instanceof ft ? await this.processSceneAsync(t[s]) : n.push(t[s]);
4224
4189
  n.length > 0 && await this.processObjectsAsync(n);
4225
4190
  for (let s = 0; s < this.skins.length; ++s)
4226
4191
  this.processSkin(this.skins[s]);
@@ -4235,7 +4200,7 @@ class Ne {
4235
4200
  await t(this.plugins[e]);
4236
4201
  }
4237
4202
  }
4238
- class Ce {
4203
+ class Ne {
4239
4204
  constructor(t) {
4240
4205
  this.writer = t, this.name = "KHR_lights_punctual";
4241
4206
  }
@@ -4251,7 +4216,7 @@ class Ce {
4251
4216
  o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
4252
4217
  }
4253
4218
  }
4254
- class Be {
4219
+ class Ce {
4255
4220
  constructor(t) {
4256
4221
  this.writer = t, this.name = "KHR_materials_unlit";
4257
4222
  }
@@ -4261,7 +4226,7 @@ class Be {
4261
4226
  e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
4262
4227
  }
4263
4228
  }
4264
- class Oe {
4229
+ class Be {
4265
4230
  constructor(t) {
4266
4231
  this.writer = t, this.name = "KHR_materials_clearcoat";
4267
4232
  }
@@ -4292,7 +4257,7 @@ class Oe {
4292
4257
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4293
4258
  }
4294
4259
  }
4295
- class Fe {
4260
+ class Oe {
4296
4261
  constructor(t) {
4297
4262
  this.writer = t, this.name = "KHR_materials_dispersion";
4298
4263
  }
@@ -4302,7 +4267,7 @@ class Fe {
4302
4267
  i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4303
4268
  }
4304
4269
  }
4305
- class Ue {
4270
+ class Fe {
4306
4271
  constructor(t) {
4307
4272
  this.writer = t, this.name = "KHR_materials_iridescence";
4308
4273
  }
@@ -4343,7 +4308,7 @@ class Ge {
4343
4308
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4344
4309
  }
4345
4310
  }
4346
- class je {
4311
+ class Ue {
4347
4312
  constructor(t) {
4348
4313
  this.writer = t, this.name = "KHR_materials_volume";
4349
4314
  }
@@ -4370,12 +4335,12 @@ class ze {
4370
4335
  i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4371
4336
  }
4372
4337
  }
4373
- class _e {
4338
+ class je {
4374
4339
  constructor(t) {
4375
4340
  this.writer = t, this.name = "KHR_materials_specular";
4376
4341
  }
4377
4342
  async writeMaterialAsync(t, e) {
4378
- if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(De) && !t.specularIntensityMap && !t.specularColorMap) return;
4343
+ if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Ee) && !t.specularIntensityMap && !t.specularColorMap) return;
4379
4344
  const n = this.writer, s = n.extensionsUsed, i = {};
4380
4345
  if (t.specularIntensityMap) {
4381
4346
  const r = {
@@ -4394,7 +4359,7 @@ class _e {
4394
4359
  i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4395
4360
  }
4396
4361
  }
4397
- class qe {
4362
+ class _e {
4398
4363
  constructor(t) {
4399
4364
  this.writer = t, this.name = "KHR_materials_sheen";
4400
4365
  }
@@ -4418,7 +4383,7 @@ class qe {
4418
4383
  i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4419
4384
  }
4420
4385
  }
4421
- class Ye {
4386
+ class qe {
4422
4387
  constructor(t) {
4423
4388
  this.writer = t, this.name = "KHR_materials_anisotropy";
4424
4389
  }
@@ -4432,7 +4397,7 @@ class Ye {
4432
4397
  i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4433
4398
  }
4434
4399
  }
4435
- class ke {
4400
+ class Ye {
4436
4401
  constructor(t) {
4437
4402
  this.writer = t, this.name = "KHR_materials_emissive_strength";
4438
4403
  }
@@ -4442,7 +4407,7 @@ class ke {
4442
4407
  i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4443
4408
  }
4444
4409
  }
4445
- class Xe {
4410
+ class ke {
4446
4411
  constructor(t) {
4447
4412
  this.writer = t, this.name = "EXT_materials_bump";
4448
4413
  }
@@ -4465,7 +4430,7 @@ class Ve {
4465
4430
  }
4466
4431
  writeNode(t, e) {
4467
4432
  if (!t.isInstancedMesh) return;
4468
- const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new Lt(), c = new J(), l = new Ft(), h = new J();
4433
+ const n = this.writer, s = t, i = new Float32Array(s.count * 3), r = new Float32Array(s.count * 4), o = new Float32Array(s.count * 3), a = new bt(), c = new $(), l = new Gt(), h = new $();
4469
4434
  for (let f = 0; f < s.count; f++)
4470
4435
  s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
4471
4436
  const u = {
@@ -4476,7 +4441,7 @@ class Ve {
4476
4441
  s.instanceColor && (u._COLOR_0 = n.processAccessor(s.instanceColor)), e.extensions = e.extensions || {}, e.extensions[this.name] = { attributes: u }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
4477
4442
  }
4478
4443
  }
4479
- Z.Utils = {
4444
+ tt.Utils = {
4480
4445
  insertKeyframe: function(d, t) {
4481
4446
  const n = d.getValueSize(), s = new d.TimeBufferType(d.times.length + 1), i = new d.ValueBufferType(d.values.length + n), r = d.createInterpolant(new d.ValueBufferType(n));
4482
4447
  let o;
@@ -4506,7 +4471,7 @@ Z.Utils = {
4506
4471
  const e = [], n = {}, s = d.tracks;
4507
4472
  for (let i = 0; i < s.length; ++i) {
4508
4473
  let r = s[i];
4509
- const o = $.parseTrackName(r.name), a = $.findNode(t, o.nodeName);
4474
+ const o = K.parseTrackName(r.name), a = K.findNode(t, o.nodeName);
4510
4475
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
4511
4476
  e.push(r);
4512
4477
  continue;
@@ -4514,7 +4479,7 @@ Z.Utils = {
4514
4479
  if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
4515
4480
  if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
4516
4481
  throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
4517
- console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(te);
4482
+ console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(ee);
4518
4483
  }
4519
4484
  const c = a.morphTargetInfluences.length, l = a.morphTargetDictionary[o.propertyIndex];
4520
4485
  if (l === void 0)
@@ -4549,7 +4514,7 @@ Z.Utils = {
4549
4514
  return t;
4550
4515
  }
4551
4516
  };
4552
- async function We(d) {
4517
+ async function Xe(d) {
4553
4518
  if (typeof FileReader > "u") {
4554
4519
  const t = await d.arrayBuffer(), n = Buffer.from(t).toString("base64");
4555
4520
  return `data:${d.type};base64,${n}`;
@@ -4559,7 +4524,7 @@ async function We(d) {
4559
4524
  n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(d);
4560
4525
  });
4561
4526
  }
4562
- async function st(d) {
4527
+ async function rt(d) {
4563
4528
  if (typeof d.arrayBuffer == "function")
4564
4529
  return await d.arrayBuffer();
4565
4530
  if (typeof FileReader < "u")
@@ -4572,8 +4537,8 @@ async function st(d) {
4572
4537
  return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
4573
4538
  }
4574
4539
  }
4575
- const He = new ee(), Je = new Z();
4576
- function $e(d, t, e = 0.1) {
4540
+ const We = new ne(), He = new tt();
4541
+ function Je(d, t, e = 0.1) {
4577
4542
  const n = t.normal(d), s = t.direction(d).mutiplyScalar(e * 0.5), i = d.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
4578
4543
  return {
4579
4544
  points: [
@@ -4588,7 +4553,7 @@ function $e(d, t, e = 0.1) {
4588
4553
  rectIndices: [0, 1, 3, 2, 0]
4589
4554
  };
4590
4555
  }
4591
- class Rt extends q {
4556
+ class Nt extends q {
4592
4557
  static name = "WhiteModel";
4593
4558
  Dxf = null;
4594
4559
  Variable = null;
@@ -4618,7 +4583,7 @@ class Rt extends q {
4618
4583
  new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
4619
4584
  );
4620
4585
  }), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
4621
- const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = $e(r, o, t.width);
4586
+ const r = new M(n.x, n.y).mutiplyScalar(t.scale), o = new M(s.x, s.y).mutiplyScalar(t.scale), { points: a, indices: c, rectIndices: l } = Je(r, o, t.width);
4622
4587
  return {
4623
4588
  points: a,
4624
4589
  indices: c,
@@ -4651,7 +4616,7 @@ class Rt extends q {
4651
4616
  toOBJ() {
4652
4617
  return new Promise((t) => {
4653
4618
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
4654
- t(He.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4619
+ t(We.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4655
4620
  }, 20);
4656
4621
  });
4657
4622
  }
@@ -4663,7 +4628,7 @@ class Rt extends q {
4663
4628
  toGltf(t = !0) {
4664
4629
  return new Promise((e) => {
4665
4630
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
4666
- Je.parse(this.whiteModelGroup.children, (n) => {
4631
+ He.parse(this.whiteModelGroup.children, (n) => {
4667
4632
  e(n), this.material.opacity = 0.8, this.material.transparent = !0;
4668
4633
  }, () => {
4669
4634
  e(void 0);
@@ -4724,7 +4689,7 @@ class Rt extends q {
4724
4689
  }
4725
4690
  }
4726
4691
  }
4727
- class vt extends q {
4692
+ class Ct extends q {
4728
4693
  static name = "DetailsPoint";
4729
4694
  Dxf = null;
4730
4695
  WhiteModel = null;
@@ -4801,7 +4766,7 @@ class vt extends q {
4801
4766
  }, 50);
4802
4767
  }
4803
4768
  }
4804
- class Nt extends q {
4769
+ class Bt extends q {
4805
4770
  static name = "DxfLineModel";
4806
4771
  dxfLineModel = new I.LineSegments();
4807
4772
  dxfDoorsLineModel = new I.LineSegments();
@@ -4824,38 +4789,38 @@ class Nt extends q {
4824
4789
  });
4825
4790
  }
4826
4791
  }
4827
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4792
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4828
4793
  __proto__: null,
4829
- DetailsPoint: vt,
4830
- DxfLineModel: Nt,
4831
- WhiteModel: Rt
4794
+ DetailsPoint: Ct,
4795
+ DxfLineModel: Bt,
4796
+ WhiteModel: Nt
4832
4797
  }, Symbol.toStringTag, { value: "Module" }));
4833
- function Dt(d, t = {}) {
4798
+ function Tt(d, t = {}) {
4834
4799
  const {
4835
4800
  detailsPoint: e = !0,
4836
4801
  whiteModel: n = !0,
4837
4802
  dxfLineModel: s = !0
4838
4803
  } = t;
4839
- s && d.addComponent(new Nt()), n && d.addComponent(new Rt()), e && d.addComponent(new vt());
4804
+ s && d.addComponent(new Bt()), n && d.addComponent(new Nt()), e && d.addComponent(new Ct());
4840
4805
  }
4841
- const Ze = Object.assign(Dt, {
4806
+ const Ke = Object.assign(Tt, {
4842
4807
  create(d = {}) {
4843
- return (t) => Dt(t, d);
4808
+ return (t) => Tt(t, d);
4844
4809
  }
4845
- }), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4810
+ }), Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4846
4811
  __proto__: null,
4847
- ModelDataPlugin: Ze,
4848
- components: Ke
4812
+ ModelDataPlugin: Ke,
4813
+ components: $e
4849
4814
  }, Symbol.toStringTag, { value: "Module" }));
4850
- function tn() {
4815
+ function Qe() {
4851
4816
  return import("./index2.js");
4852
4817
  }
4853
- function en() {
4818
+ function tn() {
4854
4819
  return import("./index3.js");
4855
4820
  }
4856
- let ht = null;
4857
- async function ln(d, t, e = !1, n) {
4858
- const s = await Promise.resolve().then(() => Qe), i = await tn(), r = await en(), o = new ct().usePlugin(s.ModelDataPlugin.create({
4821
+ let dt = null;
4822
+ async function cn(d, t, e = !1, n) {
4823
+ const s = await Promise.resolve().then(() => Ze), i = await Qe(), r = await tn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
4859
4824
  detailsPoint: !1,
4860
4825
  whiteModel: !0
4861
4826
  })).usePlugin(i.RenderPlugin.create({
@@ -4865,12 +4830,12 @@ async function ln(d, t, e = !1, n) {
4865
4830
  orbitControls: e,
4866
4831
  camera: t
4867
4832
  })).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
4868
- return a && d.appendChild(a.domElement), ht = o, {
4833
+ return a && d.appendChild(a.domElement), dt = o, {
4869
4834
  dxfSystem: o,
4870
- getFileAll: () => nn(o)
4835
+ getFileAll: () => en(o)
4871
4836
  };
4872
4837
  }
4873
- async function nn(d = ht) {
4838
+ async function en(d = dt) {
4874
4839
  const t = d.findComponentByName("WhiteModel"), e = new File([await d.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([d.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([d.AngleCorrectionDxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), i = new File([await t.toOBJBlob()], "model.obj", { type: "application/octet-stream" }), r = new File([await t.toGltfBlob(!0)], "model.glb", { type: "application/octet-stream" }), o = new File([await t.toGltfBlob(!1)], "model.gltf", { type: "application/json" }), a = new File([JSON.stringify(d.Dxf.originalData)], "json.json", { type: "application/json" });
4875
4840
  return {
4876
4841
  dxf: n,
@@ -4882,30 +4847,30 @@ async function nn(d = ht) {
4882
4847
  correctionDxf: s
4883
4848
  };
4884
4849
  }
4885
- function hn() {
4886
- return ht;
4850
+ function ln() {
4851
+ return dt;
4887
4852
  }
4888
4853
  export {
4889
- Tt as A,
4890
- R as B,
4854
+ Pt as A,
4855
+ N as B,
4891
4856
  q as C,
4892
- ct as D,
4893
- At as E,
4894
- D as L,
4895
- Ze as M,
4857
+ ht as D,
4858
+ It as E,
4859
+ A as L,
4860
+ Ke as M,
4896
4861
  M as P,
4897
4862
  F as Q,
4898
- Ee as T,
4899
- bt as V,
4900
- Rt as W,
4901
- vt as a,
4863
+ Se as T,
4864
+ Rt as V,
4865
+ Nt as W,
4866
+ Ct as a,
4902
4867
  X as b,
4903
- ln as c,
4904
- hn as d,
4868
+ cn as c,
4869
+ ln as d,
4905
4870
  k as e,
4906
- cn as f,
4907
- nn as g,
4908
- Ke as i,
4909
- It as r,
4910
- rt as u
4871
+ an as f,
4872
+ en as g,
4873
+ $e as i,
4874
+ Q as r,
4875
+ at as u
4911
4876
  };