build-dxf 0.0.41 → 0.0.43

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 Ot, Color as Ft, Matrix4 as bt, Vector3 as K, 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 Z, 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";
2
+ import { EventDispatcher as Ot, Color as Ft, Matrix4 as bt, Vector3 as Z, Quaternion as Ut, BufferAttribute as q, REVISION as Gt, CompressedTexture as st, Source as jt, NoColorSpace as zt, MathUtils as at, RGBAFormat as qt, ImageUtils as _t, DoubleSide as Yt, PropertyBinding as Q, InterpolateDiscrete as kt, Scene as ft, SRGBColorSpace as Xt, NearestFilter as Vt, 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
3
  import pt from "clipper-lib";
4
4
  import $ from "dxf-writer";
5
5
  import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
6
- function at() {
6
+ function K() {
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
12
  class It extends Ot {
13
- uuid = at();
13
+ uuid = K();
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 It extends Ot {
30
30
  e && (e.forEach((n) => n()), this.eventRecordStack.delete(t));
31
31
  }
32
32
  }
33
- class q extends It {
33
+ class _ extends It {
34
34
  parent;
35
35
  destroyed = !1;
36
36
  constructor(...t) {
@@ -71,7 +71,7 @@ class se extends It {
71
71
  * @param component
72
72
  */
73
73
  removeComponent(t) {
74
- if (t instanceof q) {
74
+ if (t instanceof _) {
75
75
  const e = this.components.indexOf(t);
76
76
  e > -1 && (this.components.splice(e, 1), this.dispatchEvent({
77
77
  type: "removeComponent",
@@ -203,8 +203,8 @@ class N {
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), m = (p.x - f.x) * (l.y - f.y) - (p.y - f.y) * (l.x - f.x), L = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
- if (y * x < 0 && m * L < 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) || L === 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), D = (p.x - f.x) * (h.y - f.y) - (p.y - f.y) * (h.x - f.x);
207
+ if (y * x < 0 && m * D < 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) || D === 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
  }
@@ -465,7 +465,7 @@ class X {
465
465
  return null;
466
466
  }
467
467
  }
468
- class et {
468
+ class nt {
469
469
  points;
470
470
  get p0() {
471
471
  return this.points[0];
@@ -616,7 +616,7 @@ class et {
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 et([
619
+ return new nt([
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),
@@ -737,7 +737,7 @@ class A {
737
737
  new M(n.x - a, n.y - c).add(o),
738
738
  new M(s.x - a, s.y - c).add(r)
739
739
  ];
740
- return new et([0, 1, 3, 2].map((h) => l[h]));
740
+ return new nt([0, 1, 3, 2].map((h) => l[h]));
741
741
  }
742
742
  /**
743
743
  * 计算线段的长度
@@ -778,7 +778,7 @@ class A {
778
778
  if (r.x === 0 && r.y === 0)
779
779
  throw new Error("投影目标线段的两个点不能重合");
780
780
  const o = (p) => {
781
- const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, L = (y.x * r.x + y.y * r.y) / x, w = s.x + L * r.x, g = s.y + L * r.y;
781
+ const y = new M(p.x - s.x, p.y - s.y), x = r.x * r.x + r.y * r.y, D = (y.x * r.x + y.y * r.y) / x, w = s.x + D * r.x, g = s.y + D * r.y;
782
782
  return new M(w, g);
783
783
  };
784
784
  let a = o(e), c = o(n);
@@ -1236,6 +1236,16 @@ class M {
1236
1236
  const o = s / (i * r), a = Math.max(-1, Math.min(1, o));
1237
1237
  return e === "radian" ? Math.acos(a) : e === "cos" ? a : n === "180" || this.cross(t) < 0 ? Math.acos(a) / (Math.PI / 180) : 360 - Math.acos(a) / (Math.PI / 180);
1238
1238
  }
1239
+ /**
1240
+ * @param point
1241
+ * @returns
1242
+ */
1243
+ angleBetween2(t) {
1244
+ const e = Math.hypot(this.x, this.y), n = Math.hypot(t.x, t.y);
1245
+ if (e === 0 || n === 0) return 0;
1246
+ const s = this.x * t.x + this.y * t.y, i = this.x * t.y - this.y * t.x;
1247
+ return Math.atan2(i, s);
1248
+ }
1239
1249
  /** 获取向量长度
1240
1250
  */
1241
1251
  length() {
@@ -1544,7 +1554,7 @@ function lt(d, t = 0.03) {
1544
1554
  return n;
1545
1555
  }).filter((n) => n.length() >= t);
1546
1556
  }
1547
- function Q(...d) {
1557
+ function tt(...d) {
1548
1558
  d.forEach((t) => {
1549
1559
  const e = t.direction();
1550
1560
  t.userData.drawWindow?.forEach((n) => {
@@ -1562,16 +1572,47 @@ function Q(...d) {
1562
1572
  });
1563
1573
  });
1564
1574
  }
1565
- function ie(d) {
1575
+ function ie(d, t = 0.1, e) {
1576
+ e || (e = new X(), d.forEach((i) => {
1577
+ i.userData.isDoor || i.points.forEach((r) => e?.insert(r, i));
1578
+ }));
1579
+ const n = [], s = /* @__PURE__ */ new Set();
1580
+ for (let i = 0; i < d.length; i++) {
1581
+ const r = d[i], o = /* @__PURE__ */ new Map();
1582
+ r.userData.isDoor || r.points.forEach((a) => {
1583
+ if (s.has(a)) return !1;
1584
+ if (e.queryPoint(a).length > 1) return;
1585
+ const c = e.queryCircle(a, t).filter((y) => {
1586
+ if (s.has(y.point)) return !1;
1587
+ const x = y.userData;
1588
+ if (x === r || !r.parallel(x, 25) || e.queryPoint(y.point).length > 1) return !1;
1589
+ const m = a.distance(y.point);
1590
+ if (m < 1e-3) return !1;
1591
+ const D = a.direction(r.getAnotherPoint(a)), w = y.point.direction(x.getAnotherPoint(y.point));
1592
+ if (180 - D.angleBetween(w, "angle") < 25)
1593
+ return o.set(y.point, m), !0;
1594
+ }).sort((y, x) => {
1595
+ const m = o.get(y.point), D = o.get(x.point);
1596
+ return m - D;
1597
+ });
1598
+ if (c.length === 0) return;
1599
+ s.add(a), s.add(c[0].point);
1600
+ const l = c[0].userData, h = r.projectLineSegment(l), u = l.projectLineSegment(r), f = h.length(), p = u.length();
1601
+ f === 0 && p === 0 ? n.push(new A(a.clone(), c[0].point.clone())) : n.push(new A(h.center, u.center));
1602
+ });
1603
+ }
1604
+ return [...d, ...n];
1605
+ }
1606
+ function re(d) {
1566
1607
  const t = new X(), e = new F(N.fromByLineSegment(...d)), n = [];
1567
1608
  return d.forEach((s) => {
1568
1609
  s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
1569
1610
  }), n.forEach((s) => {
1570
1611
  const i = t.queryPoint(s.start), r = t.queryPoint(s.end);
1571
1612
  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;
1572
- }), d;
1613
+ }), d = ie(d, 0.3, t), d;
1573
1614
  }
1574
- function re(d) {
1615
+ function oe(d) {
1575
1616
  const t = new F(N.fromByLineSegment(...d));
1576
1617
  d.forEach((n) => {
1577
1618
  n.userData.isDoor || t.insert({ line: n, userData: void 0 });
@@ -1591,9 +1632,10 @@ function re(d) {
1591
1632
  }
1592
1633
  return e;
1593
1634
  }
1594
- function oe(d, t, e, n = 15) {
1635
+ function ae(d, t, e, n = 15) {
1595
1636
  const s = [d], i = [], r = [], o = [];
1596
1637
  function a(u) {
1638
+ if (u.userData.isDoor) return r.push(u);
1597
1639
  const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x);
1598
1640
  let y = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x) - f;
1599
1641
  for (; y > Math.PI; ) y -= 2 * Math.PI;
@@ -1602,14 +1644,15 @@ function oe(d, t, e, n = 15) {
1602
1644
  return u.start.rotate(x, y), u.end.rotate(x, y), u.userData.isDoor ? r.push(u) : s.push(u), u;
1603
1645
  }
1604
1646
  function c(u) {
1647
+ if (u.userData.isDoor) return r.push(u);
1605
1648
  const f = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x), p = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x);
1606
1649
  let y = p + Math.PI / 2 - f, x = p - Math.PI / 2 - f;
1607
1650
  for (; y > Math.PI; ) y -= 2 * Math.PI;
1608
1651
  for (; y < -Math.PI; ) y += 2 * Math.PI;
1609
1652
  for (; x > Math.PI; ) x -= 2 * Math.PI;
1610
1653
  for (; x < -Math.PI; ) x += 2 * Math.PI;
1611
- const m = Math.abs(y) < Math.abs(x) ? y : x, L = u.center;
1612
- return u.start.rotate(L, m), u.end.rotate(L, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
1654
+ const m = Math.abs(y) < Math.abs(x) ? y : x, D = u.center;
1655
+ return u.start.rotate(D, m), u.end.rotate(D, m), u.userData.isDoor ? r.push(u) : i.push(u), u;
1613
1656
  }
1614
1657
  function l(u, f, p = !1) {
1615
1658
  if (p) return l(u === "parallel" ? "vertical" : "parallel", f);
@@ -1626,13 +1669,13 @@ function oe(d, t, e, n = 15) {
1626
1669
  y && y.size > 1 ? h.push(() => {
1627
1670
  const x = [...y.values()].map(
1628
1671
  (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], L = x[1];
1630
- if (m.length === 1 && L.length === 1) {
1631
- if (m[0] === L[0]) return l(m[0], f, !0);
1672
+ ).map((w) => [...new Set(w)]), m = x[0], D = x[1];
1673
+ if (m.length === 1 && D.length === 1) {
1674
+ if (m[0] === D[0]) return l(m[0], f, !0);
1632
1675
  if (m.length === 1) {
1633
- if (L.includes(m[0])) return l(m[0], f, !0);
1634
- if (L.length === 1 && m.includes(L[0]))
1635
- return l(L[0], f, !0);
1676
+ if (D.includes(m[0])) return l(m[0], f, !0);
1677
+ if (D.length === 1 && m.includes(D[0]))
1678
+ return l(D[0], f, !0);
1636
1679
  }
1637
1680
  }
1638
1681
  c(f);
@@ -1685,11 +1728,11 @@ function xt(d, t, e, n) {
1685
1728
  }), o.sort((u, f) => f.distance(e.start) - u.distance(e.start));
1686
1729
  const a = o.map((u) => {
1687
1730
  const f = u.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
1688
- for (let L = 0; L < o.length; L++) {
1689
- const w = o[L];
1731
+ for (let D = 0; D < o.length; D++) {
1732
+ const w = o[D];
1690
1733
  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(L);
1734
+ const g = w.userData, S = i.get(g), E = r.get(g);
1735
+ (x.isPointOnSegment(S) || x.isPointOnSegment(E)) && m.push(D);
1693
1736
  }
1694
1737
  }
1695
1738
  return m;
@@ -1715,16 +1758,16 @@ function xt(d, t, e, n) {
1715
1758
  y.sort((w, g) => g.distance(e.start) - w.distance(e.start));
1716
1759
  const x = y[0], m = y[y.length - 1];
1717
1760
  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), E = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
1719
- if (D.distance(E) || R / b > 0.5 && B / R < 0.5) {
1720
- const C = [g], U = [S];
1761
+ const w = [...p].sort((C, G) => G.length() - C.length()), g = w[0], S = w[1], E = s.get(g), L = s.get(S), b = g.length(), R = S.length(), P = g.projectLineSegment(S), B = P.length();
1762
+ if (E.distance(L) || R / b > 0.5 && B / R < 0.5) {
1763
+ const C = [g], G = [S];
1721
1764
  for (let O = 0; O < y.length; O++) {
1722
1765
  const v = y[O], V = v.userData;
1723
- if (v === D || v === E) continue;
1724
- const z = S.projectLineSegment(V), W = z.length();
1725
- E.distance(v) <= n && W / R > 0 ? U.push(V) : C.push(V);
1766
+ if (v === E || v === L) continue;
1767
+ const j = S.projectLineSegment(V), W = j.length();
1768
+ L.distance(v) <= n && W / R > 0 ? G.push(V) : C.push(V);
1726
1769
  }
1727
- h.push(C, U);
1770
+ h.push(C, G);
1728
1771
  } else {
1729
1772
  const C = Math.floor(p.length * 0.5);
1730
1773
  h.push(p.slice(0, C), p.slice(C));
@@ -1757,7 +1800,7 @@ function gt(d, t) {
1757
1800
  }
1758
1801
  return s;
1759
1802
  }
1760
- function ae(d, t, e, n, s, i) {
1803
+ function ce(d, t, e, n, s, i) {
1761
1804
  const {
1762
1805
  principalAxisThreshold: r = 0.3,
1763
1806
  crossAxistThreshold: o = 0.06,
@@ -1778,18 +1821,24 @@ function ae(d, t, e, n, s, i) {
1778
1821
  };
1779
1822
  return c[a] ? c[a]() : c.originalInterPoint();
1780
1823
  }
1781
- function ce(d, t) {
1824
+ function le(d, t) {
1782
1825
  const e = /* @__PURE__ */ new Set();
1783
1826
  return d.forEach((n) => {
1784
- for (let s = 1; s < n.length; s++) {
1785
- const i = n[s], r = n[s - 1];
1786
- [...t.get(i) ?? [], ...t.get(r) ?? []].forEach((a) => {
1787
- (a.line.sameEndpointAsStart(i) && a.line.sameEndpointAsEnd(r) || a.line.sameEndpointAsStart(r) && a.line.sameEndpointAsEnd(i)) && e.add(a);
1827
+ const s = /* @__PURE__ */ new Map();
1828
+ n.map((i) => {
1829
+ t.get(i)?.forEach((o) => {
1830
+ s.has(o.line) || s.set(o.line, []), s.get(o.line)?.push({ intersect: o, targetLine: i });
1831
+ });
1832
+ });
1833
+ for (let i = 1; i < n.length; i++) {
1834
+ const r = n[i], o = n[i - 1];
1835
+ [...t.get(r) ?? [], ...t.get(o) ?? []].forEach((c) => {
1836
+ (c.line.sameEndpointAsStart(r) && c.line.sameEndpointAsEnd(o) || c.line.sameEndpointAsStart(o) && c.line.sameEndpointAsEnd(r)) && e.add(c);
1788
1837
  });
1789
1838
  }
1790
1839
  }), d.map((n) => n.filter((s) => !e.has(s)));
1791
1840
  }
1792
- function le(d, t = 0.1, e) {
1841
+ function he(d, t = 0.1, e) {
1793
1842
  const { fittingMethod: n = "average" } = e ?? {};
1794
1843
  return d.map((s) => {
1795
1844
  if (s.length === 0) return;
@@ -1834,7 +1883,7 @@ function mt(d, t = 0.4) {
1834
1883
  if (o && a) {
1835
1884
  if (o.equal(a)) {
1836
1885
  const c = i.start.distance(o), l = i.end.distance(a);
1837
- c < l ? i.directionMove(i.start.direction(i.end), c) : i.directionMove(i.end.direction(i.start), l);
1886
+ c < l ? i.directionMove(i.end.direction(i.start), c) : i.directionMove(i.start.direction(i.end), l);
1838
1887
  } else
1839
1888
  i.start.copy(o), i.end.copy(a);
1840
1889
  i.userData.isAdsorbed = !0;
@@ -1843,44 +1892,46 @@ function mt(d, t = 0.4) {
1843
1892
  }
1844
1893
  return d.filter((s) => s.length() > 1e-3);
1845
1894
  }
1846
- function he(d, t) {
1847
- const e = new X();
1848
- d.forEach((i) => i.points.forEach((r) => e.insert(r, i)));
1849
- const n = /* @__PURE__ */ new Map();
1850
- function s(i, r) {
1851
- n.has(i) || n.set(i, []), n.get(i)?.push(r);
1852
- }
1853
- for (let i = 0; i < d.length; i++) {
1854
- const r = d[i];
1855
- r.points.forEach((o) => {
1856
- if (e.queryPoint(o).filter((h) => h.userData !== r).length !== 0) return;
1857
- const a = e.queryCircle(o, t).filter((h) => h.userData !== r && h.userData?.vertical(r));
1858
- if (!a.length) return;
1859
- const c = a.sort((h, u) => h.userData.length() - u.userData.length())[0], l = c.userData?.projectPoint(o, !1);
1860
- if (l) {
1861
- const h = c.userData;
1862
- s(r, new A(o.clone(), l.clone())), s(h, new A(c.point.clone(), l.clone()));
1895
+ function ue(d, t) {
1896
+ const e = new X(), n = new F(N.fromByLineSegment(...d));
1897
+ d.forEach((r) => {
1898
+ r.userData.isDoor || (n.insert(r), r.points.forEach((o) => e.insert(o, r)));
1899
+ });
1900
+ const s = /* @__PURE__ */ new Map();
1901
+ function i(r, o) {
1902
+ s.has(r) || s.set(r, []), s.get(r)?.push(o);
1903
+ }
1904
+ for (let r = 0; r < d.length; r++) {
1905
+ const o = d[r];
1906
+ o.points.forEach((a) => {
1907
+ if (e.queryPoint(a).filter((f) => f.userData !== o).length !== 0 || n.queryCircle(a, 1e-3).filter((f) => f.line !== o).length > 0) return;
1908
+ const l = e.queryCircle(a, t).filter((f) => f.userData !== o && f.userData?.vertical(o)).sort((f, p) => f.point.distance(a) - p.point.distance(a));
1909
+ if (!l.length) return;
1910
+ const h = l[0], u = h.userData?.projectPoint(a, !1);
1911
+ if (u) {
1912
+ const f = h.userData;
1913
+ i(o, new A(a.clone(), u.clone())), i(f, new A(h.point.clone(), u.clone()));
1863
1914
  }
1864
1915
  });
1865
1916
  }
1866
- return n.forEach((i, r) => {
1867
- const o = A.mergeLines(r, ...i);
1868
- r.set(o.start, o.end);
1917
+ return s.forEach((r, o) => {
1918
+ const a = A.mergeLines(o, ...r);
1919
+ o.set(a.start, a.end);
1869
1920
  }), d;
1870
1921
  }
1871
- function ue(d, t) {
1922
+ function de(d, t) {
1872
1923
  const { snapThreshold: e = 0.2 } = t ?? {};
1873
- return d = mt(d, e), d = mt(d, e), d = he(d, e), d;
1924
+ return d = mt(d, e), d = mt(d, e), d = ue(d, e), d;
1874
1925
  }
1875
- function de(d) {
1926
+ function fe(d) {
1876
1927
  const t = /* @__PURE__ */ new Set();
1877
1928
  for (let e = 0; e < d.length; e++) {
1878
1929
  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);
1930
+ s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : tt(n);
1880
1931
  }
1881
- t.forEach((e) => Q(e));
1932
+ t.forEach((e) => tt(e));
1882
1933
  }
1883
- function fe(d) {
1934
+ function pe(d) {
1884
1935
  for (let t = 0; t < d.length; t++) {
1885
1936
  const e = d[t];
1886
1937
  let { endIntersection: n, startIntersection: s } = e.userData;
@@ -1901,7 +1952,7 @@ function fe(d) {
1901
1952
  }
1902
1953
  return d;
1903
1954
  }
1904
- function pe(d, t = 0.01) {
1955
+ function ye(d, t = 0.01) {
1905
1956
  const e = new X();
1906
1957
  return d.forEach((n) => n.points.forEach((s) => e.insert(s, n))), d.filter((n) => {
1907
1958
  if (n.length() <= t) {
@@ -1919,34 +1970,34 @@ class Pt {
1919
1970
  * @returns
1920
1971
  */
1921
1972
  static correction(t, e, n) {
1922
- t = ie(t.map((x) => x.clone()));
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(
1973
+ t = re(t.map((x) => x.clone()));
1974
+ const s = oe(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = ae(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), u = new A(
1924
1975
  l.clone().add(c.clone().multiplyScalar(-1e3)),
1925
1976
  l.clone().add(c.clone().multiplyScalar(1e3))
1926
1977
  ), f = new A(
1927
1978
  l.clone().add(h.clone().multiplyScalar(-1e3)),
1928
1979
  l.clone().add(h.clone().multiplyScalar(1e3))
1929
1980
  );
1930
- let p = ae(i, r, u, f, s, n);
1931
- p = ce(p, s);
1932
- let y = le(p, 0.1, n);
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;
1981
+ let p = ce(i, r, u, f, s, n);
1982
+ p = le(p, s);
1983
+ let y = he(p, 0.1, n);
1984
+ return y = de(y, n), fe(a), pe(o), y = lt(y, 1e-9), y.push(...o), y = ye(y, 0.08), y = y, y;
1934
1985
  }
1935
1986
  }
1936
- const ye = new A(
1987
+ const xe = new A(
1937
1988
  new M(0, 0),
1938
1989
  new M(0, 1)
1939
1990
  );
1940
- function xe(d) {
1991
+ function ge(d) {
1941
1992
  const t = [...d].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
1942
- let r = parseInt(ye.includedAngle(i) + "");
1993
+ let r = parseInt(xe.includedAngle(i) + "");
1943
1994
  return r > 90 && (r = 180 - r), r;
1944
1995
  }), n = /* @__PURE__ */ new Map();
1945
1996
  return e.forEach((i, r) => {
1946
1997
  n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
1947
1998
  }), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
1948
1999
  }
1949
- function ge(d) {
2000
+ function me(d) {
1950
2001
  let t = [], e = -1;
1951
2002
  const n = [];
1952
2003
  return d.forEach(({ start: i, end: r, ...o }, a) => {
@@ -1962,7 +2013,7 @@ function ge(d) {
1962
2013
  verticalReferenceIndex: e
1963
2014
  };
1964
2015
  }
1965
- const me = {
2016
+ const we = {
1966
2017
  Unitless: 1,
1967
2018
  // 无单位,1米 = 1(无单位)
1968
2019
  Inches: 39.37007874015748,
@@ -2018,7 +2069,7 @@ function wt(d) {
2018
2069
  function Mt(d) {
2019
2070
  return d.flatMap((t, e) => (e === d.length - 1 && [...t.points, d[0].points[0]], [t.points[0]]));
2020
2071
  }
2021
- class k extends q {
2072
+ class k extends _ {
2022
2073
  static name = "Dxf";
2023
2074
  shortLine = 0.04;
2024
2075
  width = 0.04;
@@ -2063,9 +2114,9 @@ class k extends q {
2063
2114
  * @param data
2064
2115
  */
2065
2116
  preprocessing(t) {
2066
- let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = ge(t);
2117
+ let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = me(t);
2067
2118
  if (this.originalZAverage = s, n === -1) {
2068
- const r = xe(e);
2119
+ const r = ge(e);
2069
2120
  n = e.indexOf(r);
2070
2121
  }
2071
2122
  const i = e[n];
@@ -2098,7 +2149,7 @@ class k extends q {
2098
2149
  return this.set(a, e, n);
2099
2150
  } else
2100
2151
  throw new Error("非node环境不允许使用路径");
2101
- if (this.scale = n, this.width = e, t.length === 0)
2152
+ if (this.scale = n, this.width = e, this.doorLineSegment.length = 0, t.length === 0)
2102
2153
  this.lineSegments = [], this.originalData = t;
2103
2154
  else {
2104
2155
  const i = this.preprocessing(t);
@@ -2353,7 +2404,7 @@ class k extends q {
2353
2404
  * 转为绘制数据
2354
2405
  */
2355
2406
  toDrawDataJson(t = "Millimeters") {
2356
- const e = me[t], n = {
2407
+ const e = we[t], n = {
2357
2408
  unit: t,
2358
2409
  line: [],
2359
2410
  arc: [],
@@ -2411,15 +2462,15 @@ class k extends q {
2411
2462
  break;
2412
2463
  }
2413
2464
  u.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
2414
- const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [L, w] = this.getArcAngleRange(m, l.end, u.end);
2415
- r(m, x, Math.min(L, w), Math.max(L, w)), a.push(f);
2465
+ const p = l.length(), y = u.length(), x = (p ** 2 + y ** 2) / (2 * y), m = u.end.clone().add(u.direction().multiplyScalar(-x)), [D, w] = this.getArcAngleRange(m, l.end, u.end);
2466
+ r(m, x, Math.min(D, w), Math.max(D, w)), a.push(f);
2416
2467
  } else
2417
2468
  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));
2418
2469
  }), s = "yellow", this.lineSegments.forEach((c) => {
2419
2470
  if (!c.userData.isWindow) return !1;
2420
2471
  Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
2421
2472
  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);
2422
- i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, L) => i(m, L));
2473
+ i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, D) => i(m, D));
2423
2474
  });
2424
2475
  }), n;
2425
2476
  }
@@ -2556,8 +2607,8 @@ function ct(d) {
2556
2607
  Object.prototype.hasOwnProperty.call(d, e) && (t[e] = ct(d[e]));
2557
2608
  return t;
2558
2609
  }
2559
- const j = new A();
2560
- class we extends k {
2610
+ const z = new A();
2611
+ class Me extends k {
2561
2612
  static name = "AngleCorrectionDxf";
2562
2613
  angle = 0;
2563
2614
  onAddFromParent(t) {
@@ -2568,12 +2619,12 @@ class we extends k {
2568
2619
  let s = 0, i = null;
2569
2620
  for (let c = 0; c < e.originalData.length; c++) {
2570
2621
  const l = e.originalData[c];
2571
- if (j.start.copy(l.start), j.end.copy(l.end), l.isVerticalReferenceLine) {
2572
- const [h, u] = l.start.y < l.end.y ? [j.start, j.end] : [j.end, j.start];
2622
+ if (z.start.copy(l.start), z.end.copy(l.end), l.isVerticalReferenceLine) {
2623
+ const [h, u] = l.start.y < l.end.y ? [z.start, z.end] : [z.end, z.start];
2573
2624
  s = -new A(h, u).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
2574
2625
  break;
2575
2626
  }
2576
- (!i || j.length() > i.length()) && (i = j.clone(), i.userData.index = c);
2627
+ (!i || z.length() > i.length()) && (i = z.clone(), i.userData.index = c);
2577
2628
  }
2578
2629
  if (i) {
2579
2630
  e.originalData[i.userData.index].isVerticalReferenceLine = !0;
@@ -2602,7 +2653,7 @@ class we extends k {
2602
2653
  });
2603
2654
  }
2604
2655
  }
2605
- class Rt extends q {
2656
+ class Rt extends _ {
2606
2657
  static name = "Variable";
2607
2658
  originalLineVisible = !0;
2608
2659
  dxfVisible = !0;
@@ -2629,10 +2680,11 @@ class Rt extends q {
2629
2680
  if (t in this) return this[t];
2630
2681
  }
2631
2682
  }
2632
- class Me {
2683
+ class Se {
2633
2684
  // 所有可查找的点位
2634
2685
  possibleDoorPoints = [];
2635
2686
  doorPoint = [];
2687
+ calculatedDoorPoint = [];
2636
2688
  dxf;
2637
2689
  // 包含所有点的虚拟网格
2638
2690
  pointVirtualGrid = new X();
@@ -2648,18 +2700,28 @@ class Me {
2648
2700
  lineAnalysis;
2649
2701
  continueFind = !0;
2650
2702
  constructor(t) {
2651
- 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) => {
2652
- this.pointVirtualGrid.insert(n.start, n), this.pointVirtualGrid.insert(n.end, n);
2653
- }), this.doorPoint = this.getDoorPoint();
2654
- const e = this.searchDoubleLinePoint();
2655
- this.addPointsExcludeRule((n, s, i) => {
2656
- const r = this.lineSegments.indexOf(n), o = e.get(r);
2657
- return typeof o == "number" ? o === -1 || o === i : !1;
2658
- }), 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();
2703
+ 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((i) => {
2704
+ this.pointVirtualGrid.insert(i.start, i), this.pointVirtualGrid.insert(i.end, i);
2705
+ });
2706
+ const { doorPoints: e, calculatedDoorPoint: n } = this.getDoorPoint();
2707
+ this.doorPoint = e, this.calculatedDoorPoint = n;
2708
+ const s = this.searchDoubleLinePoint();
2709
+ this.addPointsExcludeRule((i, r, o) => {
2710
+ const a = this.lineSegments.indexOf(i), c = s.get(a);
2711
+ return typeof c == "number" ? c === -1 || c === o : !1;
2712
+ }), this.addPointsExcludeRule((i, r) => !!this.doorPoint.find((o) => o.point.equal(r))), this.addPointsExcludeRule((i, r) => !!this.calculatedDoorPoint.find((o) => o.point.equal(r))), this.possibleDoorPoints = this.getPossiblePoints(), this.possibleDoorPoints.forEach((i) => this.findPointVirtualGrid.insert(i.point, i.line)), this.handle();
2659
2713
  }
2660
2714
  handle() {
2661
- 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));
2715
+ this.dxf.doorLineSegment.push(...this.search(this.doorPoint, this.possibleDoorPoints, 0.5)), this.dxf.doors.length < 2 && this.dxf.doorLineSegment.push(...this.search(this.possibleDoorPoints, this.possibleDoorPoints, 0.6));
2662
2716
  }
2717
+ /** 查找
2718
+ * @param doorPoints
2719
+ * @param possibleDoorPoints
2720
+ * @param minDoorWidth
2721
+ * @param doorSearchDistance
2722
+ * @param doorSearchNearAngle
2723
+ * @returns
2724
+ */
2663
2725
  search(t, e = [], n = 0.6, s = this.doorSearchDistance, i = this.doorSearchNearAngle) {
2664
2726
  const r = this.dxf, o = this.searchNearby(t, e, s, i);
2665
2727
  o.push(
@@ -2706,7 +2768,7 @@ class Me {
2706
2768
  return this.lineSegments.forEach((e) => {
2707
2769
  e.points.forEach((n, s) => {
2708
2770
  for (let r = 0; r < this._pointsExcludeRule.length; r++) if (this._pointsExcludeRule[r](e, n, s)) return;
2709
- this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: at() });
2771
+ this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: K() });
2710
2772
  });
2711
2773
  }), t;
2712
2774
  }
@@ -2714,32 +2776,39 @@ class Me {
2714
2776
  * 查找已知为门的点位
2715
2777
  */
2716
2778
  getDoorPoint() {
2717
- const t = [], e = this.dxf, n = this.pointVirtualGrid;
2718
- return e.doors.forEach((s) => {
2719
- const i = e.lineSegments[s[4]], r = e.originalData[s[4]];
2720
- if (r.doorDirectConnection) {
2779
+ const t = [], e = [], n = this.dxf, s = this.pointVirtualGrid;
2780
+ return n.doors.forEach((i) => {
2781
+ const r = n.lineSegments[i[4]], o = n.originalData[i[4]];
2782
+ if (o.doorDirectConnection) {
2721
2783
  this.continueFind = !1;
2722
- const o = new A(M.from(r.start), M.from(r.end));
2723
- o.userData = {
2784
+ const a = new A(M.from(o.start), M.from(o.end));
2785
+ a.userData = {
2724
2786
  doorDirectConnection: !0,
2725
2787
  isDoor: !0
2726
- }, this.dxf.doorLineSegment.push(o);
2727
- } else if (r.drawDoorData) {
2728
- const o = M.from(r.drawDoorData.start), a = M.from(r.drawDoorData.n), c = n.queryPoint(o).filter((l) => {
2729
- if (l.userData === i) return !1;
2730
- const h = l.userData, u = h.direction();
2731
- h.start.equal(o) && u.multiplyScalar(-1);
2732
- const f = a.angleBetween(u, "angle");
2733
- return f > 80 || f < 10;
2788
+ }, this.dxf.doorLineSegment.push(a), a.points.forEach((c) => {
2789
+ const l = s.queryPoint(c);
2790
+ l.length && e.push({
2791
+ line: l[0].userData,
2792
+ point: l[0].point,
2793
+ uuid: K()
2794
+ });
2795
+ });
2796
+ } else if (o.drawDoorData) {
2797
+ const a = M.from(o.drawDoorData.start), c = M.from(o.drawDoorData.n), l = s.queryPoint(a).filter((h) => {
2798
+ if (h.userData === r) return !1;
2799
+ const u = h.userData, f = u.direction();
2800
+ u.start.equal(a) && f.multiplyScalar(-1);
2801
+ const p = c.angleBetween(f, "angle");
2802
+ return p > 170 || p < 10;
2734
2803
  });
2735
- c.length && t.push({
2736
- line: c[0].userData,
2737
- point: o,
2738
- uuid: at()
2804
+ l.length && t.push({
2805
+ line: l[0].userData,
2806
+ point: a,
2807
+ uuid: K()
2739
2808
  });
2740
2809
  } else
2741
- console.warn(`门的线段顺序${s[4]} 没有drawDoorData属性`);
2742
- }), t;
2810
+ console.warn(`门的线段顺序${i[4]} 没有drawDoorData属性`);
2811
+ }), { doorPoints: t, calculatedDoorPoint: e };
2743
2812
  }
2744
2813
  /**
2745
2814
  * 查找双线墙的点位
@@ -2762,56 +2831,58 @@ class Me {
2762
2831
  */
2763
2832
  searchNearby(t, e = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
2764
2833
  const i = this.findPointVirtualGrid, r = this.quadtree;
2765
- function o({ point: x, line: m }, L, w) {
2834
+ function o({ point: x, line: m }, D, w) {
2766
2835
  const g = m.direction();
2767
2836
  m.start === x && g.multiplyScalar(-1);
2768
- const S = i.queryCircle(x, n).filter((E) => E.userData !== m).sort((E, b) => E.point.distance(x) - b.point.distance(x)), D = [];
2769
- for (let E = 0; E < S.length; E++) {
2770
- const b = e.findIndex((O) => O.point === S[E].point), R = t[L].uuid, P = e[b].uuid;
2837
+ const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), E = [];
2838
+ for (let L = 0; L < S.length; L++) {
2839
+ const b = e.findIndex((O) => O.point === S[L].point);
2840
+ if (b === -1) continue;
2841
+ const R = t[D].uuid, P = e[b].uuid;
2771
2842
  if (w.has(`${R}.${P}`)) continue;
2772
2843
  w.add(`${R}.${P}`), w.add(`${P}.${R}`);
2773
- const B = S[E].point, C = new A(x.clone(), B.clone());
2844
+ const B = S[L].point, C = new A(x.clone(), B.clone());
2774
2845
  if (C.direction().angleBetween(g, "angle") < s) {
2775
- const O = t[L].line.direction(), v = S[E].userData;
2776
- v.start.equal(S[E].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({
2777
- findData: S[E],
2846
+ const O = t[D].line.direction(), v = S[L].userData;
2847
+ 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 || E.push({
2848
+ findData: S[L],
2778
2849
  findUuid: P,
2779
2850
  doorLine: C,
2780
2851
  doorUuid: R
2781
2852
  }));
2782
2853
  }
2783
2854
  }
2784
- return D;
2855
+ return E;
2785
2856
  }
2786
- function a(x, m, L, w, g) {
2857
+ function a(x, m, D, w, g) {
2787
2858
  w.add(x);
2788
2859
  const S = [];
2789
2860
  g && S.push(g);
2790
- for (let D = 0; D < L.length; D++) {
2791
- const E = L[D];
2792
- if (m.has(E.findUuid)) {
2793
- const b = m.get(E.findUuid);
2794
- a(E.findUuid, m, b, w, E) && S.push(E);
2795
- } else S.push(E);
2861
+ for (let E = 0; E < D.length; E++) {
2862
+ const L = D[E];
2863
+ if (m.has(L.findUuid)) {
2864
+ const b = m.get(L.findUuid);
2865
+ a(L.findUuid, m, b, w, L) && S.push(L);
2866
+ } else S.push(L);
2796
2867
  }
2797
- return S.sort((D, E) => D.doorLine.length() - E.doorLine.length()), g && S[0] === g ? (L.splice(0), !0) : (L.splice(1), !1);
2868
+ return S.sort((E, L) => E.doorLine.length() - L.doorLine.length()), g && S[0] === g ? (D.splice(0), !0) : (D.splice(1), !1);
2798
2869
  }
2799
2870
  const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
2800
2871
  t.map((x, m) => {
2801
- const L = o(x, m, c);
2802
- L.length && l.set(x.uuid, L);
2872
+ const D = o(x, m, c);
2873
+ D.length && l.set(x.uuid, D);
2803
2874
  }), c.clear();
2804
2875
  const h = /* @__PURE__ */ new Map();
2805
2876
  l.forEach((x, m) => {
2806
2877
  if (!c.has(m) && x.length && a(m, l, x, c), x.length) {
2807
- const L = x[0];
2808
- h.has(L.doorUuid) || h.set(L.doorUuid, []), h.get(L.doorUuid)?.push(L), h.has(L.findUuid) || h.set(L.findUuid, []), h.get(L.findUuid)?.push(L);
2878
+ const D = x[0];
2879
+ h.has(D.doorUuid) || h.set(D.doorUuid, []), h.get(D.doorUuid)?.push(D), h.has(D.findUuid) || h.set(D.findUuid, []), h.get(D.findUuid)?.push(D);
2809
2880
  }
2810
2881
  });
2811
2882
  const u = /* @__PURE__ */ new Set();
2812
2883
  h.forEach((x) => {
2813
2884
  if (x.length > 1) {
2814
- x.sort((m, L) => m.doorLine.length() - L.doorLine.length());
2885
+ x.sort((m, D) => m.doorLine.length() - D.doorLine.length());
2815
2886
  for (let m = 1; m < x.length; m++) u.add(x[m]);
2816
2887
  }
2817
2888
  });
@@ -2824,16 +2895,16 @@ class Me {
2824
2895
  });
2825
2896
  const y = [];
2826
2897
  return f.forEach((x) => {
2827
- const m = t.findIndex((b) => b.uuid === x.doorUuid), L = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[L].point.clone(), S = this.findLongLineSegment(t[m].line), D = this.findLongLineSegment(e[L].line), E = S.projectPoint(g);
2828
- if (E) {
2829
- w.copy(E);
2830
- const b = new A(w, g), R = D.includedAngle(b);
2898
+ const m = t.findIndex((b) => b.uuid === x.doorUuid), D = e.findIndex((b) => b.uuid === x.findUuid), w = t[m].point.clone(), g = e[D].point.clone(), S = this.findLongLineSegment(t[m].line), E = this.findLongLineSegment(e[D].line), L = S.projectPoint(g);
2899
+ if (L) {
2900
+ w.copy(L);
2901
+ const b = new A(w, g), R = E.includedAngle(b);
2831
2902
  (R < 10 || R > 170 || Math.abs(90 - R) < 10) && y.push({
2832
2903
  start: w,
2833
2904
  end: g
2834
2905
  });
2835
2906
  } else {
2836
- const b = D.projectPoint(w);
2907
+ const b = E.projectPoint(w);
2837
2908
  b && g.copy(b);
2838
2909
  const R = new A(w, g), P = S.includedAngle(R);
2839
2910
  (P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
@@ -2920,7 +2991,7 @@ class Me {
2920
2991
  return e;
2921
2992
  }
2922
2993
  }
2923
- class Se extends q {
2994
+ class De extends _ {
2924
2995
  static name = "LineAnalysis";
2925
2996
  Dxf = null;
2926
2997
  Variable = null;
@@ -2976,12 +3047,12 @@ class Se extends q {
2976
3047
  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]);
2977
3048
  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);
2978
3049
  p.multiplyScalar(e.width * 0.5);
2979
- const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), L = y.direction(x);
2980
- if (!(m.x > 0 && L.x < 0 || m.x < 0 && L.x > 0 || m.y > 0 && L.y < 0 || m.y < 0 && L.y > 0)) {
3050
+ const y = u.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = u.direction(f), D = y.direction(x);
3051
+ if (!(m.x > 0 && D.x < 0 || m.x < 0 && D.x > 0 || m.y > 0 && D.y < 0 || m.y < 0 && D.y > 0)) {
2981
3052
  u.set(y.x, y.y), f.set(x.x, x.y);
2982
3053
  for (let w = 1; w < o; w++) {
2983
- const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), D = u.clone().add(g), E = f.clone().add(S);
2984
- this.addData(D, E);
3054
+ const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), E = u.clone().add(g), L = f.clone().add(S);
3055
+ this.addData(E, L);
2985
3056
  }
2986
3057
  }
2987
3058
  }
@@ -3008,7 +3079,7 @@ class Se extends q {
3008
3079
  this.buildQuadtree();
3009
3080
  const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
3010
3081
  e.forEach((i, r) => {
3011
- const o = e[r], a = et.fromByLineSegment(o, this.width * 2, !1, -0.01);
3082
+ const o = e[r], a = nt.fromByLineSegment(o, this.width * 2, !1, -0.01);
3012
3083
  t.queryRect(a).map((l) => l.userData).filter((l) => l !== r).forEach((l) => {
3013
3084
  try {
3014
3085
  if (n.has(`${r}-${l}`) || n.has(`${l}-${r}`)) return;
@@ -3051,13 +3122,12 @@ class Se extends q {
3051
3122
  doorSearchDistance = 2;
3052
3123
  doors = [];
3053
3124
  DoorsAnalysis;
3125
+ skipFindDoor = !1;
3054
3126
  doorsAnalysis() {
3055
- this.DoorsAnalysis = new Me(this), this.dispatchEvent({
3056
- type: "analysisCompleted"
3057
- });
3127
+ this.skipFindDoor || (this.DoorsAnalysis = new Se(this), this.skipFindDoor = !1), this.dispatchEvent({ type: "analysisCompleted" });
3058
3128
  }
3059
3129
  }
3060
- class Le extends q {
3130
+ class Le extends _ {
3061
3131
  static name = "ThreeVJia";
3062
3132
  lineSegments = [];
3063
3133
  onAddFromParent() {
@@ -3192,7 +3262,7 @@ class ht extends se {
3192
3262
  * @param scale 原始数据缩放比例
3193
3263
  */
3194
3264
  constructor(t = 0.1, e = 1) {
3195
- 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 Rt(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(new Se()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Le()), ht.finalInstance = this;
3265
+ 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 De()), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new Le()), ht.finalInstance = this;
3196
3266
  }
3197
3267
  usePlugin(t) {
3198
3268
  return typeof t == "function" && t.call(this, this), this;
@@ -3233,15 +3303,15 @@ class ut {
3233
3303
  static boundExtbyTraj(t, e, n = 0.12) {
3234
3304
  function s(w, g) {
3235
3305
  return g.queryLineSegment(w).filter((S) => S.line !== w).map(({ line: S }) => {
3236
- const D = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
3237
- w.sameEndpoint(S) && (D.type = "endpoint"), w.parallel(S) && (D.direction = "parallel");
3238
- const E = w.getSameEndpoint(S);
3239
- if (E) D.point = E[1];
3306
+ const E = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
3307
+ w.sameEndpoint(S) && (E.type = "endpoint"), w.parallel(S) && (E.direction = "parallel");
3308
+ const L = w.getSameEndpoint(S);
3309
+ if (L) E.point = L[1];
3240
3310
  else {
3241
3311
  const b = S.getIntersection(w);
3242
- b && (D.point = S.start.equal(b) ? S.start : S.end);
3312
+ b && (E.point = S.start.equal(b) ? S.start : S.end);
3243
3313
  }
3244
- return D;
3314
+ return E;
3245
3315
  });
3246
3316
  }
3247
3317
  function i(w) {
@@ -3254,18 +3324,18 @@ class ut {
3254
3324
  w.directionMove(S, n * 0.5);
3255
3325
  }
3256
3326
  }
3257
- function r({ resultLine: w, type: g, direction: S, point: D }, E, b, R) {
3327
+ function r({ resultLine: w, type: g, direction: S, point: E }, L, b, R) {
3258
3328
  if (g === "intersect")
3259
- D && D.copy(E.projectPoint(D) ?? D);
3329
+ E && E.copy(L.projectPoint(E) ?? E);
3260
3330
  else if (S === "vertical") {
3261
- if (D) {
3262
- const P = E.projectPoint(D, !1);
3263
- D.copy(P), E.isPointOnSegment(P) || (E.start.distance(P) < E.end.distance(P) ? R.push(new A(P.clone(), E.start.clone())) : R.push(new A(P.clone(), E.end.clone())));
3331
+ if (E) {
3332
+ const P = L.projectPoint(E, !1);
3333
+ E.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())));
3264
3334
  }
3265
- } else if (!u.includes(w) && D) {
3266
- let P = E.projectPoint(D, !1), B;
3267
- if (E.start.distance(D) < E.end.distance(D) ? B = E.start : B = E.end, P) {
3268
- R.push(new A(D.clone(), P.clone()));
3335
+ } else if (!u.includes(w) && E) {
3336
+ let P = L.projectPoint(E, !1), B;
3337
+ if (L.start.distance(E) < L.end.distance(E) ? B = L.start : B = L.end, P) {
3338
+ R.push(new A(E.clone(), P.clone()));
3269
3339
  const C = new A(P.clone(), B.clone());
3270
3340
  C.length() && R.push(C);
3271
3341
  }
@@ -3274,8 +3344,8 @@ class ut {
3274
3344
  }
3275
3345
  const o = Object.keys(e).map((w) => M.from(e[w])), a = [];
3276
3346
  let c = t.map(({ start: w, end: g, ...S }) => {
3277
- const D = new A(M.from(w), M.from(g));
3278
- return D.userData = S, a.push(w.z ?? 0, g.z ?? 0), D;
3347
+ const E = new A(M.from(w), M.from(g));
3348
+ return E.userData = S, a.push(w.z ?? 0, g.z ?? 0), E;
3279
3349
  });
3280
3350
  const l = a.reduce((w, g) => w + g, 0) / a.length;
3281
3351
  let u = ut.findExtWallByTraj(c, o).filter((w) => w.userData.expandDirect);
@@ -3284,35 +3354,35 @@ class ut {
3284
3354
  o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(u, 0, { color: 65280 }).position.z = l + 1e-3;
3285
3355
  const y = A.groupBySamePointAndParallel(u), x = new F(N.fromByLineSegment(...c));
3286
3356
  c.forEach((w) => w.userData.isDoor || x.insert(w));
3287
- const m = y.map((w) => w.flatMap((g) => s(g, x))), L = [];
3288
- return y.flatMap((w, g) => (w.forEach((D) => (i(D), x.update(D))), m[g].filter((D) => {
3289
- if (!u.includes(D.resultLine)) {
3290
- let E;
3291
- return Object.defineProperty(D, "newLine", {
3357
+ const m = y.map((w) => w.flatMap((g) => s(g, x))), D = [];
3358
+ return y.flatMap((w, g) => (w.forEach((E) => (i(E), x.update(E))), m[g].filter((E) => {
3359
+ if (!u.includes(E.resultLine)) {
3360
+ let L;
3361
+ return Object.defineProperty(E, "newLine", {
3292
3362
  get() {
3293
- return E || (E = A.mergeLines(...w)), E;
3363
+ return L || (L = A.mergeLines(...w)), L;
3294
3364
  }
3295
3365
  }), !0;
3296
3366
  }
3297
- r(D, A.mergeLines(...w), x, L);
3367
+ r(E, A.mergeLines(...w), x, D);
3298
3368
  }))).reduce((w, g) => (w.has(g.resultLine) || w.set(g.resultLine, []), w.get(g.resultLine)?.push(g), w), /* @__PURE__ */ new Map()).forEach((w) => {
3299
3369
  w.reduce((g, S) => (g.has(S.point) || g.set(S.point, []), g.get(S.point)?.push(S), g), /* @__PURE__ */ new Map()).forEach((g) => {
3300
3370
  const S = /* @__PURE__ */ new Set();
3301
- for (let D = 0; D < g.length; D++) {
3302
- const E = g[D];
3303
- S.has(E.point) || (r(E, E.newLine, x, L), S.add(E.point));
3371
+ for (let E = 0; E < g.length; E++) {
3372
+ const L = g[E];
3373
+ S.has(L.point) || (r(L, L.newLine, x, D), S.add(L.point));
3304
3374
  }
3305
3375
  });
3306
- }), c.push(...A.deduplication(L)), c.forEach((w) => w.userData.isWindow && Q(w)), c = lt(c), c = A.deduplication(c), J(c, l);
3376
+ }), c.push(...A.deduplication(D)), c.forEach((w) => w.userData.isWindow && tt(w)), c = lt(c), c = A.deduplication(c), J(c, l);
3307
3377
  }
3308
3378
  }
3309
- const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3379
+ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3310
3380
  __proto__: null,
3311
3381
  AxisAlignCorr: Pt,
3312
3382
  BoundExt: ut,
3313
3383
  lineDataToOriginalData: J,
3314
3384
  lineSegmentClipping: lt,
3315
- recomputedWindow: Q
3385
+ recomputedWindow: tt
3316
3386
  }, Symbol.toStringTag, { value: "Module" })), St = {
3317
3387
  POSITION: [
3318
3388
  "byte",
@@ -3341,36 +3411,36 @@ const cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3341
3411
  "unsigned short"
3342
3412
  ]
3343
3413
  };
3344
- class tt {
3414
+ class et {
3345
3415
  constructor() {
3346
3416
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
3347
- return new Ce(t);
3348
- }), this.register(function(t) {
3349
3417
  return new Be(t);
3350
3418
  }), this.register(function(t) {
3351
- return new Ue(t);
3419
+ return new Oe(t);
3420
+ }), this.register(function(t) {
3421
+ return new je(t);
3352
3422
  }), this.register(function(t) {
3353
3423
  return new ze(t);
3354
3424
  }), this.register(function(t) {
3355
- return new je(t);
3425
+ return new qe(t);
3356
3426
  }), this.register(function(t) {
3357
3427
  return new _e(t);
3358
- }), this.register(function(t) {
3359
- return new Oe(t);
3360
3428
  }), this.register(function(t) {
3361
3429
  return new Fe(t);
3362
3430
  }), this.register(function(t) {
3363
- return new Ge(t);
3431
+ return new Ue(t);
3364
3432
  }), this.register(function(t) {
3365
- return new qe(t);
3433
+ return new Ge(t);
3366
3434
  }), this.register(function(t) {
3367
3435
  return new Ye(t);
3368
3436
  }), this.register(function(t) {
3369
3437
  return new ke(t);
3438
+ }), this.register(function(t) {
3439
+ return new Xe(t);
3370
3440
  }), this.register(function(t) {
3371
3441
  return new Ve(t);
3372
3442
  }), this.register(function(t) {
3373
- return new Xe(t);
3443
+ return new We(t);
3374
3444
  });
3375
3445
  }
3376
3446
  register(t) {
@@ -3383,7 +3453,7 @@ class tt {
3383
3453
  return this.textureUtils = t, this;
3384
3454
  }
3385
3455
  parse(t, e, n, s) {
3386
- const i = new Ne(), r = [];
3456
+ const i = new Ce(), r = [];
3387
3457
  for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
3388
3458
  r.push(this.pluginCallbacks[o](i));
3389
3459
  i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
@@ -3419,34 +3489,34 @@ const T = {
3419
3489
  CLAMP_TO_EDGE: 33071,
3420
3490
  MIRRORED_REPEAT: 33648,
3421
3491
  REPEAT: 10497
3422
- }, st = "KHR_mesh_quantization", G = {};
3423
- G[Xt] = T.NEAREST;
3424
- G[Wt] = T.NEAREST_MIPMAP_NEAREST;
3425
- G[Ht] = T.NEAREST_MIPMAP_LINEAR;
3426
- G[Jt] = T.LINEAR;
3427
- G[$t] = T.LINEAR_MIPMAP_NEAREST;
3428
- G[Kt] = T.LINEAR_MIPMAP_LINEAR;
3429
- G[Zt] = T.CLAMP_TO_EDGE;
3430
- G[Qt] = T.REPEAT;
3431
- G[te] = T.MIRRORED_REPEAT;
3432
- const Lt = {
3492
+ }, it = "KHR_mesh_quantization", U = {};
3493
+ U[Vt] = T.NEAREST;
3494
+ U[Wt] = T.NEAREST_MIPMAP_NEAREST;
3495
+ U[Ht] = T.NEAREST_MIPMAP_LINEAR;
3496
+ U[Jt] = T.LINEAR;
3497
+ U[$t] = T.LINEAR_MIPMAP_NEAREST;
3498
+ U[Kt] = T.LINEAR_MIPMAP_LINEAR;
3499
+ U[Zt] = T.CLAMP_TO_EDGE;
3500
+ U[Qt] = T.REPEAT;
3501
+ U[te] = T.MIRRORED_REPEAT;
3502
+ const Dt = {
3433
3503
  scale: "scale",
3434
3504
  position: "translation",
3435
3505
  quaternion: "rotation",
3436
3506
  morphTargetInfluences: "weights"
3437
- }, Ee = new Ft(), Et = 12, De = 1179937895, Ae = 2, Dt = 8, Te = 1313821514, be = 5130562;
3507
+ }, Ee = new Ft(), Lt = 12, Ae = 1179937895, Te = 2, Et = 8, be = 1313821514, Ie = 5130562;
3438
3508
  function H(d, t) {
3439
3509
  return d.length === t.length && d.every(function(e, n) {
3440
3510
  return e === t[n];
3441
3511
  });
3442
3512
  }
3443
- function Ie(d) {
3513
+ function Pe(d) {
3444
3514
  return new TextEncoder().encode(d).buffer;
3445
3515
  }
3446
- function Pe(d) {
3516
+ function Re(d) {
3447
3517
  return H(d.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3448
3518
  }
3449
- function Re(d, t, e) {
3519
+ function ve(d, t, e) {
3450
3520
  const n = {
3451
3521
  min: new Array(d.itemSize).fill(Number.POSITIVE_INFINITY),
3452
3522
  max: new Array(d.itemSize).fill(Number.NEGATIVE_INFINITY)
@@ -3454,14 +3524,14 @@ function Re(d, t, e) {
3454
3524
  for (let s = t; s < t + e; s++)
3455
3525
  for (let i = 0; i < d.itemSize; i++) {
3456
3526
  let r;
3457
- 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);
3527
+ 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 = at.normalize(r, d.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3458
3528
  }
3459
3529
  return n;
3460
3530
  }
3461
3531
  function vt(d) {
3462
3532
  return Math.ceil(d / 4) * 4;
3463
3533
  }
3464
- function it(d, t = 0) {
3534
+ function rt(d, t = 0) {
3465
3535
  const e = vt(d.byteLength);
3466
3536
  if (e !== d.byteLength) {
3467
3537
  const n = new Uint8Array(e);
@@ -3475,7 +3545,7 @@ function it(d, t = 0) {
3475
3545
  function At() {
3476
3546
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
3477
3547
  }
3478
- function ve(d, t) {
3548
+ function Ne(d, t) {
3479
3549
  if (typeof OffscreenCanvas < "u" && d instanceof OffscreenCanvas) {
3480
3550
  let e;
3481
3551
  return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), d.convertToBlob({
@@ -3485,12 +3555,12 @@ function ve(d, t) {
3485
3555
  } else
3486
3556
  return new Promise((e) => d.toBlob(e, t));
3487
3557
  }
3488
- class Ne {
3558
+ class Ce {
3489
3559
  constructor() {
3490
3560
  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 = {
3491
3561
  asset: {
3492
3562
  version: "2.0",
3493
- generator: "THREE.GLTFExporter r" + Ut
3563
+ generator: "THREE.GLTFExporter r" + Gt
3494
3564
  }
3495
3565
  }, this.cache = {
3496
3566
  meshes: /* @__PURE__ */ new Map(),
@@ -3527,15 +3597,15 @@ class Ne {
3527
3597
  const s = this, i = s.buffers, r = s.json;
3528
3598
  n = s.options;
3529
3599
  const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
3530
- 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) {
3531
- const f = it(u), p = new DataView(new ArrayBuffer(Dt));
3532
- p.setUint32(0, f.byteLength, !0), p.setUint32(4, be, !0);
3533
- const y = it(Ie(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Dt));
3534
- x.setUint32(0, y.byteLength, !0), x.setUint32(4, Te, !0);
3535
- const m = new ArrayBuffer(Et), L = new DataView(m);
3536
- L.setUint32(0, De, !0), L.setUint32(4, Ae, !0);
3537
- const w = Et + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3538
- L.setUint32(8, w, !0);
3600
+ 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 ? ot(c).then(function(u) {
3601
+ const f = rt(u), p = new DataView(new ArrayBuffer(Et));
3602
+ p.setUint32(0, f.byteLength, !0), p.setUint32(4, Ie, !0);
3603
+ const y = rt(Pe(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Et));
3604
+ x.setUint32(0, y.byteLength, !0), x.setUint32(4, be, !0);
3605
+ const m = new ArrayBuffer(Lt), D = new DataView(m);
3606
+ D.setUint32(0, Ae, !0), D.setUint32(4, Te, !0);
3607
+ const w = Lt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3608
+ D.setUint32(8, w, !0);
3539
3609
  const g = new Blob([
3540
3610
  m,
3541
3611
  x,
@@ -3543,10 +3613,10 @@ class Ne {
3543
3613
  p,
3544
3614
  f
3545
3615
  ], { type: "application/octet-stream" });
3546
- rt(g).then((S) => {
3616
+ ot(g).then((S) => {
3547
3617
  e(S);
3548
3618
  });
3549
- }) : r.buffers && r.buffers.length > 0 ? We(c).then((u) => {
3619
+ }) : r.buffers && r.buffers.length > 0 ? He(c).then((u) => {
3550
3620
  r.buffers[0].uri = u, e(r);
3551
3621
  }) : e(r);
3552
3622
  }
@@ -3594,7 +3664,7 @@ class Ne {
3594
3664
  */
3595
3665
  isNormalizedNormalAttribute(t) {
3596
3666
  if (this.cache.attributesNormalized.has(t)) return !1;
3597
- const n = new K();
3667
+ const n = new Z();
3598
3668
  for (let s = 0, i = t.count; s < i; s++)
3599
3669
  if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
3600
3670
  return !0;
@@ -3609,7 +3679,7 @@ class Ne {
3609
3679
  createNormalizedNormalAttribute(t) {
3610
3680
  const e = this.cache;
3611
3681
  if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
3612
- const n = t.clone(), s = new K();
3682
+ const n = t.clone(), s = new Z();
3613
3683
  for (let i = 0, r = n.count; i < r; i++)
3614
3684
  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);
3615
3685
  return e.attributesNormalized.set(t, n), n;
@@ -3629,13 +3699,13 @@ class Ne {
3629
3699
  async buildMetalRoughTextureAsync(t, e) {
3630
3700
  if (t === e) return t;
3631
3701
  function n(f) {
3632
- return f.colorSpace === Vt ? function(y) {
3702
+ return f.colorSpace === Xt ? function(y) {
3633
3703
  return y < 0.04045 ? y * 0.0773993808 : Math.pow(y * 0.9478672986 + 0.0521327014, 2.4);
3634
3704
  } : function(y) {
3635
3705
  return y;
3636
3706
  };
3637
3707
  }
3638
- t instanceof nt && (t = await this.decompressTextureAsync(t)), e instanceof nt && (e = await this.decompressTextureAsync(e));
3708
+ t instanceof st && (t = await this.decompressTextureAsync(t)), e instanceof st && (e = await this.decompressTextureAsync(e));
3639
3709
  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();
3640
3710
  a.width = r, a.height = o;
3641
3711
  const c = a.getContext("2d", {
@@ -3657,7 +3727,7 @@ class Ne {
3657
3727
  }
3658
3728
  c.putImageData(l, 0, 0);
3659
3729
  const u = (t || e).clone();
3660
- 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;
3730
+ return u.source = new jt(a), u.colorSpace = zt, 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;
3661
3731
  }
3662
3732
  async decompressTextureAsync(t, e = 1 / 0) {
3663
3733
  if (this.textureUtils === null)
@@ -3705,7 +3775,7 @@ class Ne {
3705
3775
  for (let p = n; p < n + s; p++) {
3706
3776
  for (let y = 0; y < t.itemSize; y++) {
3707
3777
  let x;
3708
- 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;
3778
+ 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 = at.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;
3709
3779
  }
3710
3780
  h % a !== 0 && (h += a - h % a);
3711
3781
  }
@@ -3727,8 +3797,8 @@ class Ne {
3727
3797
  processBufferViewImage(t) {
3728
3798
  const e = this, n = e.json;
3729
3799
  return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
3730
- rt(t).then((i) => {
3731
- const r = it(i), o = {
3800
+ ot(t).then((i) => {
3801
+ const r = rt(i), o = {
3732
3802
  buffer: e.processBuffer(r),
3733
3803
  byteOffset: e.byteOffset,
3734
3804
  byteLength: r.byteLength
@@ -3772,7 +3842,7 @@ class Ne {
3772
3842
  else
3773
3843
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
3774
3844
  if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
3775
- const a = Re(t, n, s);
3845
+ const a = ve(t, n, s);
3776
3846
  let c;
3777
3847
  e !== void 0 && (c = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
3778
3848
  const l = this.processBufferView(t, o, n, s, c), h = {
@@ -3807,7 +3877,7 @@ class Ne {
3807
3877
  willReadFrequently: !0
3808
3878
  });
3809
3879
  if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
3810
- 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);
3880
+ e !== qt && 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);
3811
3881
  const x = new Uint8ClampedArray(t.height * t.width * 4);
3812
3882
  for (let m = 0; m < x.length; m += 4)
3813
3883
  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];
@@ -3817,10 +3887,10 @@ class Ne {
3817
3887
  else
3818
3888
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
3819
3889
  a.binary === !0 ? c.push(
3820
- ve(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3890
+ Ne(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3821
3891
  u.bufferView = x;
3822
3892
  })
3823
- ) : u.uri = qt.getDataURL(f, s);
3893
+ ) : u.uri = _t.getDataURL(f, s);
3824
3894
  const y = o.images.push(u) - 1;
3825
3895
  return l[h] = y, y;
3826
3896
  } else
@@ -3835,10 +3905,10 @@ class Ne {
3835
3905
  const e = this.json;
3836
3906
  e.samplers || (e.samplers = []);
3837
3907
  const n = {
3838
- magFilter: G[t.magFilter],
3839
- minFilter: G[t.minFilter],
3840
- wrapS: G[t.wrapS],
3841
- wrapT: G[t.wrapT]
3908
+ magFilter: U[t.magFilter],
3909
+ minFilter: U[t.minFilter],
3910
+ wrapS: U[t.wrapS],
3911
+ wrapT: U[t.wrapT]
3842
3912
  };
3843
3913
  return e.samplers.push(n) - 1;
3844
3914
  }
@@ -3850,7 +3920,7 @@ class Ne {
3850
3920
  async processTextureAsync(t) {
3851
3921
  const n = this.options, s = this.cache, i = this.json;
3852
3922
  if (s.textures.has(t)) return s.textures.get(t);
3853
- i.textures || (i.textures = []), t instanceof nt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
3923
+ i.textures || (i.textures = []), t instanceof st && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
3854
3924
  let r = t.userData.mimeType;
3855
3925
  r === "image/webp" && (r = "image/png");
3856
3926
  const o = {
@@ -3957,18 +4027,18 @@ class Ne {
3957
4027
  continue;
3958
4028
  }
3959
4029
  p = null;
3960
- const E = S.array;
3961
- g === "JOINTS_0" && !(E instanceof Uint16Array) && !(E instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new _(new Uint16Array(E), S.itemSize, S.normalized)) : (E instanceof Uint32Array || E instanceof Int32Array) && !g.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${g}" converted to type FLOAT.`), p = tt.Utils.toFloat32BufferAttribute(S));
4030
+ const L = S.array;
4031
+ g === "JOINTS_0" && !(L instanceof Uint16Array) && !(L instanceof Uint8Array) ? (console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'), p = new q(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 = et.Utils.toFloat32BufferAttribute(S));
3962
4032
  const b = this.processAccessor(p || S, r);
3963
4033
  b !== null && (g.startsWith("_") || this.detectMeshQuantization(g, S), c[g] = b, e.attributes.set(this.getUID(S), b));
3964
4034
  }
3965
4035
  if (f !== void 0 && r.setAttribute("normal", f), Object.keys(c).length === 0) return null;
3966
4036
  if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
3967
- const g = [], S = [], D = {};
4037
+ const g = [], S = [], E = {};
3968
4038
  if (t.morphTargetDictionary !== void 0)
3969
- for (const E in t.morphTargetDictionary)
3970
- D[t.morphTargetDictionary[E]] = E;
3971
- for (let E = 0; E < t.morphTargetInfluences.length; ++E) {
4039
+ for (const L in t.morphTargetDictionary)
4040
+ E[t.morphTargetDictionary[L]] = L;
4041
+ for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
3972
4042
  const b = {};
3973
4043
  let R = !1;
3974
4044
  for (const P in r.morphAttributes) {
@@ -3976,7 +4046,7 @@ class Ne {
3976
4046
  R || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), R = !0);
3977
4047
  continue;
3978
4048
  }
3979
- const B = r.morphAttributes[P][E], C = P.toUpperCase(), U = r.attributes[P];
4049
+ const B = r.morphAttributes[P][L], C = P.toUpperCase(), G = r.attributes[P];
3980
4050
  if (e.attributes.has(this.getUID(B, !0))) {
3981
4051
  b[C] = e.attributes.get(this.getUID(B, !0));
3982
4052
  continue;
@@ -3984,11 +4054,11 @@ class Ne {
3984
4054
  const O = B.clone();
3985
4055
  if (!r.morphTargetsRelative)
3986
4056
  for (let v = 0, V = B.count; v < V; v++)
3987
- for (let z = 0; z < B.itemSize; z++)
3988
- 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));
3989
- b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(U, !0), b[C]);
4057
+ for (let j = 0; j < B.itemSize; j++)
4058
+ j === 0 && O.setX(v, B.getX(v) - G.getX(v)), j === 1 && O.setY(v, B.getY(v) - G.getY(v)), j === 2 && O.setZ(v, B.getZ(v) - G.getZ(v)), j === 3 && O.setW(v, B.getW(v) - G.getW(v));
4059
+ b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(G, !0), b[C]);
3990
4060
  }
3991
- h.push(b), g.push(t.morphTargetInfluences[E]), t.morphTargetDictionary !== void 0 && S.push(D[E]);
4061
+ h.push(b), g.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(E[L]);
3992
4062
  }
3993
4063
  a.weights = g, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
3994
4064
  }
@@ -3997,22 +4067,22 @@ class Ne {
3997
4067
  let x = !1;
3998
4068
  if (y && r.index === null) {
3999
4069
  const g = [];
4000
- for (let S = 0, D = r.attributes.position.count; S < D; S++)
4070
+ for (let S = 0, E = r.attributes.position.count; S < E; S++)
4001
4071
  g[S] = S;
4002
4072
  r.setIndex(g), x = !0;
4003
4073
  }
4004
- const m = y ? t.material : [t.material], L = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4005
- for (let g = 0, S = L.length; g < S; g++) {
4006
- const D = {
4074
+ const m = y ? t.material : [t.material], D = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4075
+ for (let g = 0, S = D.length; g < S; g++) {
4076
+ const E = {
4007
4077
  mode: o,
4008
4078
  attributes: c
4009
4079
  };
4010
- if (this.serializeUserData(r, D), h.length > 0 && (D.targets = h), r.index !== null) {
4080
+ if (this.serializeUserData(r, E), h.length > 0 && (E.targets = h), r.index !== null) {
4011
4081
  let b = this.getUID(r.index);
4012
- (L[g].start !== void 0 || L[g].count !== void 0) && (b += ":" + L[g].start + ":" + L[g].count), e.attributes.has(b) ? D.indices = e.attributes.get(b) : (D.indices = this.processAccessor(r.index, r, L[g].start, L[g].count), e.attributes.set(b, D.indices)), D.indices === null && delete D.indices;
4082
+ (D[g].start !== void 0 || D[g].count !== void 0) && (b += ":" + D[g].start + ":" + D[g].count), e.attributes.has(b) ? E.indices = e.attributes.get(b) : (E.indices = this.processAccessor(r.index, r, D[g].start, D[g].count), e.attributes.set(b, E.indices)), E.indices === null && delete E.indices;
4013
4083
  }
4014
- const E = await this.processMaterialAsync(m[L[g].materialIndex]);
4015
- E !== null && (D.material = E), l.push(D);
4084
+ const L = await this.processMaterialAsync(m[D[g].materialIndex]);
4085
+ L !== null && (E.material = L), l.push(E);
4016
4086
  }
4017
4087
  x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(g) {
4018
4088
  g.writeMesh && g.writeMesh(t, a);
@@ -4032,7 +4102,7 @@ class Ne {
4032
4102
  * @param {THREE.BufferAttribute} attribute
4033
4103
  */
4034
4104
  detectMeshQuantization(t, e) {
4035
- if (this.extensionsUsed[st]) return;
4105
+ if (this.extensionsUsed[it]) return;
4036
4106
  let n;
4037
4107
  switch (e.array.constructor) {
4038
4108
  case Int8Array:
@@ -4052,7 +4122,7 @@ class Ne {
4052
4122
  }
4053
4123
  e.normalized && (n += " normalized");
4054
4124
  const s = t.split("_", 1)[0];
4055
- St[s] && St[s].includes(n) && (this.extensionsUsed[st] = !0, this.extensionsRequired[st] = !0);
4125
+ St[s] && St[s].includes(n) && (this.extensionsUsed[it] = !0, this.extensionsRequired[it] = !0);
4056
4126
  }
4057
4127
  /**
4058
4128
  * Process camera
@@ -4072,7 +4142,7 @@ class Ne {
4072
4142
  znear: t.near < 0 ? 0 : t.near
4073
4143
  } : s.perspective = {
4074
4144
  aspectRatio: t.aspect,
4075
- yfov: ot.degToRad(t.fov),
4145
+ yfov: at.degToRad(t.fov),
4076
4146
  zfar: t.far <= 0 ? 1e-3 : t.far,
4077
4147
  znear: t.near < 0 ? 0 : t.near
4078
4148
  }, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
@@ -4089,23 +4159,23 @@ class Ne {
4089
4159
  */
4090
4160
  processAnimation(t, e) {
4091
4161
  const n = this.json, s = this.nodeMap;
4092
- n.animations || (n.animations = []), t = tt.Utils.mergeMorphTargetTracks(t.clone(), e);
4162
+ n.animations || (n.animations = []), t = et.Utils.mergeMorphTargetTracks(t.clone(), e);
4093
4163
  const i = t.tracks, r = [], o = [];
4094
4164
  for (let c = 0; c < i.length; ++c) {
4095
- const l = i[c], h = Z.parseTrackName(l.name);
4096
- let u = Z.findNode(e, h.nodeName);
4097
- const f = Lt[h.propertyName];
4165
+ const l = i[c], h = Q.parseTrackName(l.name);
4166
+ let u = Q.findNode(e, h.nodeName);
4167
+ const f = Dt[h.propertyName];
4098
4168
  if (h.objectName === "bones" && (u.isSkinnedMesh === !0 ? u = u.skeleton.getBoneByName(h.objectIndex) : u = void 0), !u || !f) {
4099
4169
  console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
4100
4170
  continue;
4101
4171
  }
4102
4172
  const p = 1;
4103
4173
  let y = l.values.length / l.times.length;
4104
- f === Lt.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4174
+ f === Dt.morphTargetInfluences && (y /= u.morphTargetInfluences.length);
4105
4175
  let x;
4106
4176
  l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
4107
- input: this.processAccessor(new _(l.times, p)),
4108
- output: this.processAccessor(new _(l.values, y)),
4177
+ input: this.processAccessor(new q(l.times, p)),
4178
+ output: this.processAccessor(new q(l.values, y)),
4109
4179
  interpolation: x
4110
4180
  }), r.push({
4111
4181
  sampler: o.length - 1,
@@ -4135,7 +4205,7 @@ class Ne {
4135
4205
  for (let h = 0; h < i.bones.length; ++h)
4136
4206
  o.push(n.get(i.bones[h])), c.copy(i.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
4137
4207
  return e.skins === void 0 && (e.skins = []), e.skins.push({
4138
- inverseBindMatrices: this.processAccessor(new _(a, 16)),
4208
+ inverseBindMatrices: this.processAccessor(new q(a, 16)),
4139
4209
  joints: o,
4140
4210
  skeleton: n.get(r)
4141
4211
  }), s.skin = e.skins.length - 1;
@@ -4153,7 +4223,7 @@ class Ne {
4153
4223
  const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
4154
4224
  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);
4155
4225
  } else
4156
- t.matrixAutoUpdate && t.updateMatrix(), Pe(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4226
+ t.matrixAutoUpdate && t.updateMatrix(), Re(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4157
4227
  if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
4158
4228
  const o = await this.processMeshAsync(t);
4159
4229
  o !== null && (i.mesh = o);
@@ -4230,7 +4300,7 @@ class Ne {
4230
4300
  await t(this.plugins[e]);
4231
4301
  }
4232
4302
  }
4233
- class Ce {
4303
+ class Be {
4234
4304
  constructor(t) {
4235
4305
  this.writer = t, this.name = "KHR_lights_punctual";
4236
4306
  }
@@ -4246,7 +4316,7 @@ class Ce {
4246
4316
  o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
4247
4317
  }
4248
4318
  }
4249
- class Be {
4319
+ class Oe {
4250
4320
  constructor(t) {
4251
4321
  this.writer = t, this.name = "KHR_materials_unlit";
4252
4322
  }
@@ -4256,7 +4326,7 @@ class Be {
4256
4326
  e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
4257
4327
  }
4258
4328
  }
4259
- class Oe {
4329
+ class Fe {
4260
4330
  constructor(t) {
4261
4331
  this.writer = t, this.name = "KHR_materials_clearcoat";
4262
4332
  }
@@ -4287,7 +4357,7 @@ class Oe {
4287
4357
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4288
4358
  }
4289
4359
  }
4290
- class Fe {
4360
+ class Ue {
4291
4361
  constructor(t) {
4292
4362
  this.writer = t, this.name = "KHR_materials_dispersion";
4293
4363
  }
@@ -4321,7 +4391,7 @@ class Ge {
4321
4391
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4322
4392
  }
4323
4393
  }
4324
- class Ue {
4394
+ class je {
4325
4395
  constructor(t) {
4326
4396
  this.writer = t, this.name = "KHR_materials_transmission";
4327
4397
  }
@@ -4355,7 +4425,7 @@ class ze {
4355
4425
  t.attenuationDistance !== 1 / 0 && (i.attenuationDistance = t.attenuationDistance), i.attenuationColor = t.attenuationColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4356
4426
  }
4357
4427
  }
4358
- class je {
4428
+ class qe {
4359
4429
  constructor(t) {
4360
4430
  this.writer = t, this.name = "KHR_materials_ior";
4361
4431
  }
@@ -4389,7 +4459,7 @@ class _e {
4389
4459
  i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4390
4460
  }
4391
4461
  }
4392
- class qe {
4462
+ class Ye {
4393
4463
  constructor(t) {
4394
4464
  this.writer = t, this.name = "KHR_materials_sheen";
4395
4465
  }
@@ -4413,7 +4483,7 @@ class qe {
4413
4483
  i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4414
4484
  }
4415
4485
  }
4416
- class Ye {
4486
+ class ke {
4417
4487
  constructor(t) {
4418
4488
  this.writer = t, this.name = "KHR_materials_anisotropy";
4419
4489
  }
@@ -4427,7 +4497,7 @@ class Ye {
4427
4497
  i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4428
4498
  }
4429
4499
  }
4430
- class ke {
4500
+ class Xe {
4431
4501
  constructor(t) {
4432
4502
  this.writer = t, this.name = "KHR_materials_emissive_strength";
4433
4503
  }
@@ -4454,24 +4524,24 @@ class Ve {
4454
4524
  i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4455
4525
  }
4456
4526
  }
4457
- class Xe {
4527
+ class We {
4458
4528
  constructor(t) {
4459
4529
  this.writer = t, this.name = "EXT_mesh_gpu_instancing";
4460
4530
  }
4461
4531
  writeNode(t, e) {
4462
4532
  if (!t.isInstancedMesh) return;
4463
- 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 K(), l = new Gt(), h = new K();
4533
+ 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 Z(), l = new Ut(), h = new Z();
4464
4534
  for (let f = 0; f < s.count; f++)
4465
4535
  s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
4466
4536
  const u = {
4467
- TRANSLATION: n.processAccessor(new _(i, 3)),
4468
- ROTATION: n.processAccessor(new _(r, 4)),
4469
- SCALE: n.processAccessor(new _(o, 3))
4537
+ TRANSLATION: n.processAccessor(new q(i, 3)),
4538
+ ROTATION: n.processAccessor(new q(r, 4)),
4539
+ SCALE: n.processAccessor(new q(o, 3))
4470
4540
  };
4471
4541
  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;
4472
4542
  }
4473
4543
  }
4474
- tt.Utils = {
4544
+ et.Utils = {
4475
4545
  insertKeyframe: function(d, t) {
4476
4546
  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));
4477
4547
  let o;
@@ -4501,7 +4571,7 @@ tt.Utils = {
4501
4571
  const e = [], n = {}, s = d.tracks;
4502
4572
  for (let i = 0; i < s.length; ++i) {
4503
4573
  let r = s[i];
4504
- const o = Z.parseTrackName(r.name), a = Z.findNode(t, o.nodeName);
4574
+ const o = Q.parseTrackName(r.name), a = Q.findNode(t, o.nodeName);
4505
4575
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
4506
4576
  e.push(r);
4507
4577
  continue;
@@ -4535,7 +4605,7 @@ tt.Utils = {
4535
4605
  return d.tracks = e, d;
4536
4606
  },
4537
4607
  toFloat32BufferAttribute: function(d) {
4538
- const t = new _(new Float32Array(d.count * d.itemSize), d.itemSize, !1);
4608
+ const t = new q(new Float32Array(d.count * d.itemSize), d.itemSize, !1);
4539
4609
  if (!d.normalized && !d.isInterleavedBufferAttribute)
4540
4610
  return t.array.set(d.array), t;
4541
4611
  for (let e = 0, n = d.count; e < n; e++)
@@ -4544,7 +4614,7 @@ tt.Utils = {
4544
4614
  return t;
4545
4615
  }
4546
4616
  };
4547
- async function We(d) {
4617
+ async function He(d) {
4548
4618
  if (typeof FileReader > "u") {
4549
4619
  const t = await d.arrayBuffer(), n = Buffer.from(t).toString("base64");
4550
4620
  return `data:${d.type};base64,${n}`;
@@ -4554,7 +4624,7 @@ async function We(d) {
4554
4624
  n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(d);
4555
4625
  });
4556
4626
  }
4557
- async function rt(d) {
4627
+ async function ot(d) {
4558
4628
  if (typeof d.arrayBuffer == "function")
4559
4629
  return await d.arrayBuffer();
4560
4630
  if (typeof FileReader < "u")
@@ -4567,8 +4637,8 @@ async function rt(d) {
4567
4637
  return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
4568
4638
  }
4569
4639
  }
4570
- const He = new ne(), Je = new tt();
4571
- function $e(d, t, e = 0.1) {
4640
+ const Je = new ne(), $e = new et();
4641
+ function Ke(d, t, e = 0.1) {
4572
4642
  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;
4573
4643
  return {
4574
4644
  points: [
@@ -4583,7 +4653,7 @@ function $e(d, t, e = 0.1) {
4583
4653
  rectIndices: [0, 1, 3, 2, 0]
4584
4654
  };
4585
4655
  }
4586
- class Nt extends q {
4656
+ class Nt extends _ {
4587
4657
  static name = "WhiteModel";
4588
4658
  Dxf = null;
4589
4659
  Variable = null;
@@ -4613,7 +4683,7 @@ class Nt extends q {
4613
4683
  new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
4614
4684
  );
4615
4685
  }), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
4616
- 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);
4686
+ 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 } = Ke(r, o, t.width);
4617
4687
  return {
4618
4688
  points: a,
4619
4689
  indices: c,
@@ -4646,7 +4716,7 @@ class Nt extends q {
4646
4716
  toOBJ() {
4647
4717
  return new Promise((t) => {
4648
4718
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
4649
- t(He.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4719
+ t(Je.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4650
4720
  }, 20);
4651
4721
  });
4652
4722
  }
@@ -4658,7 +4728,7 @@ class Nt extends q {
4658
4728
  toGltf(t = !0) {
4659
4729
  return new Promise((e) => {
4660
4730
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
4661
- Je.parse(this.whiteModelGroup.children, (n) => {
4731
+ $e.parse(this.whiteModelGroup.children, (n) => {
4662
4732
  e(n), this.material.opacity = 0.8, this.material.transparent = !0;
4663
4733
  }, () => {
4664
4734
  e(void 0);
@@ -4719,7 +4789,7 @@ class Nt extends q {
4719
4789
  }
4720
4790
  }
4721
4791
  }
4722
- class Ct extends q {
4792
+ class Ct extends _ {
4723
4793
  static name = "DetailsPoint";
4724
4794
  Dxf = null;
4725
4795
  WhiteModel = null;
@@ -4796,7 +4866,7 @@ class Ct extends q {
4796
4866
  }, 50);
4797
4867
  }
4798
4868
  }
4799
- class Bt extends q {
4869
+ class Bt extends _ {
4800
4870
  static name = "DxfLineModel";
4801
4871
  dxfLineModel = new I.LineSegments();
4802
4872
  dxfDoorsLineModel = new I.LineSegments();
@@ -4819,7 +4889,7 @@ class Bt extends q {
4819
4889
  });
4820
4890
  }
4821
4891
  }
4822
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4892
+ const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4823
4893
  __proto__: null,
4824
4894
  DetailsPoint: Ct,
4825
4895
  DxfLineModel: Bt,
@@ -4833,24 +4903,24 @@ function Tt(d, t = {}) {
4833
4903
  } = t;
4834
4904
  s && d.addComponent(new Bt()), n && d.addComponent(new Nt()), e && d.addComponent(new Ct());
4835
4905
  }
4836
- const Ze = Object.assign(Tt, {
4906
+ const Qe = Object.assign(Tt, {
4837
4907
  create(d = {}) {
4838
4908
  return (t) => Tt(t, d);
4839
4909
  }
4840
- }), Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4910
+ }), tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4841
4911
  __proto__: null,
4842
- ModelDataPlugin: Ze,
4843
- components: Ke
4912
+ ModelDataPlugin: Qe,
4913
+ components: Ze
4844
4914
  }, Symbol.toStringTag, { value: "Module" }));
4845
- function tn() {
4915
+ function en() {
4846
4916
  return import("./index2.js");
4847
4917
  }
4848
- function en() {
4918
+ function nn() {
4849
4919
  return import("./index3.js");
4850
4920
  }
4851
4921
  let dt = null;
4852
- async function ln(d, t, e = !1, n) {
4853
- const s = await Promise.resolve().then(() => Qe), i = await tn(), r = await en(), o = new ht().usePlugin(s.ModelDataPlugin.create({
4922
+ async function hn(d, t, e = !1, n) {
4923
+ const s = await Promise.resolve().then(() => tn), i = await en(), r = await nn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
4854
4924
  detailsPoint: !1,
4855
4925
  whiteModel: !0
4856
4926
  })).usePlugin(i.RenderPlugin.create({
@@ -4862,10 +4932,10 @@ async function ln(d, t, e = !1, n) {
4862
4932
  })).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
4863
4933
  return a && d.appendChild(a.domElement), dt = o, {
4864
4934
  dxfSystem: o,
4865
- getFileAll: () => nn(o)
4935
+ getFileAll: () => sn(o)
4866
4936
  };
4867
4937
  }
4868
- async function nn(d = dt) {
4938
+ async function sn(d = dt) {
4869
4939
  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" });
4870
4940
  return {
4871
4941
  dxf: n,
@@ -4877,17 +4947,17 @@ async function nn(d = dt) {
4877
4947
  correctionDxf: s
4878
4948
  };
4879
4949
  }
4880
- function hn() {
4950
+ function un() {
4881
4951
  return dt;
4882
4952
  }
4883
4953
  export {
4884
4954
  Pt as A,
4885
4955
  N as B,
4886
- q as C,
4956
+ _ as C,
4887
4957
  ht as D,
4888
4958
  It as E,
4889
4959
  A as L,
4890
- Ze as M,
4960
+ Qe as M,
4891
4961
  M as P,
4892
4962
  F as Q,
4893
4963
  Le as T,
@@ -4895,12 +4965,13 @@ export {
4895
4965
  Nt as W,
4896
4966
  Ct as a,
4897
4967
  X as b,
4898
- ln as c,
4968
+ De as c,
4899
4969
  hn as d,
4900
- k as e,
4901
- cn as f,
4902
- nn as g,
4903
- Ke as i,
4904
- Q as r,
4905
- at as u
4970
+ un as e,
4971
+ k as f,
4972
+ sn as g,
4973
+ ln as h,
4974
+ Ze as i,
4975
+ tt as r,
4976
+ K as u
4906
4977
  };