build-dxf 0.0.42 → 0.0.44

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 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";
2
+ import { EventDispatcher as Ft, Color as Ut, Matrix4 as Tt, Vector3 as Q, Quaternion as jt, BufferAttribute as _, REVISION as Gt, CompressedTexture as rt, Source as zt, NoColorSpace as qt, MathUtils as lt, RGBAFormat as _t, ImageUtils as Yt, DoubleSide as kt, PropertyBinding as tt, InterpolateDiscrete as Xt, Scene as ft, SRGBColorSpace as Vt, NearestFilter as Wt, NearestMipmapNearestFilter as Ht, NearestMipmapLinearFilter as Jt, LinearFilter as $t, LinearMipmapNearestFilter as Kt, LinearMipmapLinearFilter as Zt, ClampToEdgeWrapping as Qt, RepeatWrapping as te, MirroredRepeatWrapping as ee, InterpolateLinear as ne } from "three";
3
3
  import pt from "clipper-lib";
4
- import $ from "dxf-writer";
5
- import { OBJExporter as ne } from "three/examples/jsm/exporters/OBJExporter.js";
6
- function K() {
4
+ import K from "dxf-writer";
5
+ import { OBJExporter as se } from "three/examples/jsm/exporters/OBJExporter.js";
6
+ function Z() {
7
7
  return "xxxx-xxxx-4xxx-yxxx-xxxx".replace(/[xy]/g, function(u) {
8
8
  var t = Math.random() * 16 | 0, e = u == "x" ? t : t & 3 | 8;
9
9
  return e.toString(16);
10
10
  });
11
11
  }
12
- class It extends Ot {
13
- uuid = K();
12
+ class bt extends Ft {
13
+ uuid = Z();
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 _ extends It {
33
+ class z extends bt {
34
34
  parent;
35
35
  destroyed = !1;
36
36
  constructor(...t) {
@@ -48,7 +48,7 @@ class _ extends It {
48
48
  this.destroyed = !0;
49
49
  }
50
50
  }
51
- class se extends It {
51
+ class ie extends bt {
52
52
  static EventType = {
53
53
  ADD_COMPONENT: "addComponent"
54
54
  };
@@ -71,7 +71,7 @@ class se extends It {
71
71
  * @param component
72
72
  */
73
73
  removeComponent(t) {
74
- if (t instanceof _) {
74
+ if (t instanceof z) {
75
75
  const e = this.components.indexOf(t);
76
76
  e > -1 && (this.components.splice(e, 1), this.dispatchEvent({
77
77
  type: "removeComponent",
@@ -116,7 +116,7 @@ class se extends It {
116
116
  return e || null;
117
117
  }
118
118
  }
119
- class N {
119
+ class P {
120
120
  minX = 0;
121
121
  maxX = 0;
122
122
  minY = 0;
@@ -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 d = 0; d < 4; d++) {
206
- const f = e[d], p = e[(d + 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))
206
+ const f = e[d], p = e[(d + 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))
208
208
  return !0;
209
209
  }
210
210
  }
@@ -299,7 +299,7 @@ class N {
299
299
  * @returns
300
300
  */
301
301
  clone() {
302
- return new N(this.minX, this.maxX, this.minY, this.maxY);
302
+ return new P(this.minX, this.maxX, this.minY, this.maxY);
303
303
  }
304
304
  /**
305
305
  *
@@ -310,7 +310,7 @@ class N {
310
310
  const e = [], n = [];
311
311
  return t.forEach((s) => {
312
312
  e.push(s.x), n.push(s.y);
313
- }), new N(
313
+ }), new P(
314
314
  Math.min(...e),
315
315
  Math.max(...e),
316
316
  Math.min(...n),
@@ -328,7 +328,7 @@ class N {
328
328
  s?.points?.forEach((i) => {
329
329
  e.push(i.x), n.push(i.y);
330
330
  });
331
- }), new N(
331
+ }), new P(
332
332
  Math.min(...e),
333
333
  Math.max(...e),
334
334
  Math.min(...n),
@@ -336,7 +336,7 @@ class N {
336
336
  );
337
337
  }
338
338
  }
339
- class X {
339
+ class k {
340
340
  map = /* @__PURE__ */ new Map();
341
341
  targetMap = /* @__PURE__ */ new Map();
342
342
  gridSize;
@@ -374,6 +374,9 @@ class X {
374
374
  n && (n.delete(e), delete t?.userData?.pointVirtualGridMap, this.targetMap.delete(t));
375
375
  }
376
376
  }
377
+ update(t) {
378
+ this.remove(t), this.insert(t);
379
+ }
377
380
  /**
378
381
  * 获取通过坐标,获取唯一网格索引
379
382
  * @param point
@@ -415,7 +418,7 @@ class X {
415
418
  * @returns 相交的节点数组
416
419
  */
417
420
  queryCircle(t, e) {
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 = [];
421
+ const n = new P(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
422
  for (let c = s; c <= i; c++)
420
423
  for (let l = r; l <= o; l++) {
421
424
  const h = `${c}.${l}`;
@@ -447,11 +450,14 @@ class X {
447
450
  * 查找相同点
448
451
  * @param point
449
452
  */
450
- queryPoint(t) {
451
- const e = this.getGridId(t), n = [];
452
- return this.map.has(e) && this.map.get(e)?.forEach((i) => {
453
- t.equal(i.point) && n.push(i);
454
- }), n;
453
+ queryPoint(t, e = !1) {
454
+ const n = this.getGridId(t), s = [];
455
+ return this.map.has(n) && this.map.get(n)?.forEach((r) => {
456
+ if (t.equal(r.point)) {
457
+ if (e && t === r.point) return;
458
+ s.push(r);
459
+ }
460
+ }), s;
455
461
  }
456
462
  /**
457
463
  * 查找点自己
@@ -465,7 +471,7 @@ class X {
465
471
  return null;
466
472
  }
467
473
  }
468
- class nt {
474
+ class it {
469
475
  points;
470
476
  get p0() {
471
477
  return this.points[0];
@@ -606,7 +612,7 @@ class nt {
606
612
  let t = 1 / 0, e = -1 / 0, n = 1 / 0, s = -1 / 0;
607
613
  return this.points.forEach((i) => {
608
614
  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 N(t, e, n, s);
615
+ }), new P(t, e, n, s);
610
616
  }
611
617
  /**
612
618
  *
@@ -616,7 +622,7 @@ class nt {
616
622
  */
617
623
  static fromByLineSegment(t, e = 0.1, n = !1, s = 0.5) {
618
624
  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 nt([
625
+ return new it([
620
626
  new M(i.x + l, i.y + h).add(c),
621
627
  new M(r.x + l, r.y + h).add(a),
622
628
  new M(r.x - l, r.y - h).add(a),
@@ -624,7 +630,7 @@ class nt {
624
630
  ]);
625
631
  }
626
632
  }
627
- class A {
633
+ class L {
628
634
  points = [new M(), new M()];
629
635
  userData = {};
630
636
  // line: any
@@ -737,7 +743,7 @@ class A {
737
743
  new M(n.x - a, n.y - c).add(o),
738
744
  new M(s.x - a, s.y - c).add(r)
739
745
  ];
740
- return new nt([0, 1, 3, 2].map((h) => l[h]));
746
+ return new it([0, 1, 3, 2].map((h) => l[h]));
741
747
  }
742
748
  /**
743
749
  * 计算线段的长度
@@ -778,8 +784,8 @@ class A {
778
784
  if (r.x === 0 && r.y === 0)
779
785
  throw new Error("投影目标线段的两个点不能重合");
780
786
  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, D = (y.x * r.x + y.y * r.y) / x, w = s.x + D * r.x, g = s.y + D * r.y;
782
- return new M(w, g);
787
+ 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, D = s.x + w * r.x, m = s.y + w * r.y;
788
+ return new M(D, m);
783
789
  };
784
790
  let a = o(e), c = o(n);
785
791
  const l = (p) => {
@@ -788,10 +794,10 @@ class A {
788
794
  };
789
795
  let h = l(a), d = l(c);
790
796
  const f = (p) => {
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);
797
+ const y = Math.max(0, Math.min(1, p)), x = s.x + y * r.x, g = s.y + y * r.y;
798
+ return new M(x, g);
793
799
  };
794
- return (h < 0 || h > 1) && (a = f(h)), (d < 0 || d > 1) && (c = f(d)), a.x === c.x && a.y === c.y ? new A(a, a) : new A(a, c);
800
+ return (h < 0 || h > 1) && (a = f(h)), (d < 0 || d > 1) && (c = f(d)), a.x === c.x && a.y === c.y ? new L(a, a) : new L(a, c);
795
801
  }
796
802
  /**
797
803
  * 计算一条线段在另一条直线上的投影
@@ -872,7 +878,7 @@ class A {
872
878
  * @param line
873
879
  */
874
880
  parallel(t, e = 1) {
875
- return t instanceof A ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
881
+ return t instanceof L ? this.parallel(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), t < e || t > 180 - e);
876
882
  }
877
883
  /** 两条线段或角度是否 垂直
878
884
  * @param line
@@ -880,7 +886,7 @@ class A {
880
886
  * @returns
881
887
  */
882
888
  vertical(t, e = 0.1) {
883
- return t instanceof A ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
889
+ return t instanceof L ? this.vertical(this.includedAngle(t), e) : (typeof t != "number" && (t = Number(t)), Math.abs(t - 90) < e);
884
890
  }
885
891
  /**
886
892
  * 两条线段方向相反否一致
@@ -955,7 +961,7 @@ class A {
955
961
  * @returns
956
962
  */
957
963
  clone() {
958
- const t = new A(
964
+ const t = new L(
959
965
  this.points[0].clone(),
960
966
  this.points[1].clone()
961
967
  );
@@ -978,7 +984,7 @@ class A {
978
984
  * @param selectLines
979
985
  */
980
986
  static groupBySamePointAndParallel(t) {
981
- const e = new X();
987
+ const e = new k();
982
988
  t.forEach((r) => r.points.forEach((o) => e.insert(o, r)));
983
989
  const n = /* @__PURE__ */ new Set();
984
990
  function s(r, o, a) {
@@ -1010,7 +1016,7 @@ class A {
1010
1016
  const f = o(d);
1011
1017
  f < a && (a = f, i = n.projectPoint(d, !1)), f > c && (c = f, r = n.projectPoint(d, !1));
1012
1018
  }
1013
- const l = new A(i, r);
1019
+ const l = new L(i, r);
1014
1020
  return t.forEach((h) => h.userData.fittedLine = l), l;
1015
1021
  }
1016
1022
  /** 合并平行线段
@@ -1029,7 +1035,7 @@ class A {
1029
1035
  const y = p.x * s.x + p.y * s.y;
1030
1036
  i = Math.min(i, y), r = Math.max(r, y), o += p.x, a += p.y;
1031
1037
  });
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), d = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new A(h, d);
1038
+ 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), d = new M(c.x + (r - l) * s.x, c.y + (r - l) * s.y), f = new L(h, d);
1033
1039
  return t.forEach((p) => p.userData.fittedLine = f), f;
1034
1040
  }
1035
1041
  /** 合并满足平行的线段
@@ -1135,6 +1141,15 @@ class M {
1135
1141
  division(t) {
1136
1142
  return this.x -= t.x, this.y -= t.y, this;
1137
1143
  }
1144
+ /**
1145
+ * 减法
1146
+ * @description 将当前点的坐标减去指定点的坐标
1147
+ * @param point
1148
+ * @returns
1149
+ */
1150
+ subtract(t) {
1151
+ return this.x -= t.x, this.y -= t.y, this;
1152
+ }
1138
1153
  /**
1139
1154
  * 加法
1140
1155
  * @description 将当前点的坐标加上指定点的坐标
@@ -1194,7 +1209,7 @@ class M {
1194
1209
  * @param length
1195
1210
  */
1196
1211
  expandAsLine(t, e, n) {
1197
- const s = new A(
1212
+ const s = new L(
1198
1213
  this.clone(),
1199
1214
  this.clone().add(t.clone().multiplyScalar(e))
1200
1215
  );
@@ -1289,7 +1304,7 @@ class M {
1289
1304
  return new M(0, 0);
1290
1305
  }
1291
1306
  }
1292
- async function Y(u, t = !0) {
1307
+ async function X(u, t = !0) {
1293
1308
  if (typeof global < "u" && typeof require < "u")
1294
1309
  return require(u);
1295
1310
  {
@@ -1300,7 +1315,7 @@ async function Y(u, t = !0) {
1300
1315
  return t && (e = e.default), e;
1301
1316
  }
1302
1317
  }
1303
- class F {
1318
+ class B {
1304
1319
  bounds;
1305
1320
  // 包围盒
1306
1321
  capacity;
@@ -1326,7 +1341,7 @@ class F {
1326
1341
  * @param node 线段节点
1327
1342
  */
1328
1343
  insert(t) {
1329
- if (t instanceof A) {
1344
+ if (t instanceof L) {
1330
1345
  this.insert({ line: t, userData: {} });
1331
1346
  return;
1332
1347
  }
@@ -1351,7 +1366,7 @@ class F {
1351
1366
  * @param node
1352
1367
  */
1353
1368
  remove(t) {
1354
- if (t instanceof A) {
1369
+ if (t instanceof L) {
1355
1370
  t = this.targetMap.get(t), t && this.remove(t);
1356
1371
  return;
1357
1372
  }
@@ -1381,26 +1396,26 @@ class F {
1381
1396
  if (!this.isLeaf) return;
1382
1397
  this.isLeaf = !1, this.children = [];
1383
1398
  const t = (this.bounds.minX + this.bounds.maxX) / 2, e = (this.bounds.minY + this.bounds.maxY) / 2;
1384
- this.children[0] = new F(
1385
- new N(this.bounds.minX, t, this.bounds.minY, e),
1399
+ this.children[0] = new B(
1400
+ new P(this.bounds.minX, t, this.bounds.minY, e),
1386
1401
  this.capacity,
1387
1402
  this.maxDepth,
1388
1403
  this.depth + 1,
1389
1404
  this.targetMap
1390
- ), this.children[1] = new F(
1391
- new N(t, this.bounds.maxX, this.bounds.minY, e),
1405
+ ), this.children[1] = new B(
1406
+ new P(t, this.bounds.maxX, this.bounds.minY, e),
1392
1407
  this.capacity,
1393
1408
  this.maxDepth,
1394
1409
  this.depth + 1,
1395
1410
  this.targetMap
1396
- ), this.children[2] = new F(
1397
- new N(this.bounds.minX, t, e, this.bounds.maxY),
1411
+ ), this.children[2] = new B(
1412
+ new P(this.bounds.minX, t, e, this.bounds.maxY),
1398
1413
  this.capacity,
1399
1414
  this.maxDepth,
1400
1415
  this.depth + 1,
1401
1416
  this.targetMap
1402
- ), this.children[3] = new F(
1403
- new N(t, this.bounds.maxX, e, this.bounds.maxY),
1417
+ ), this.children[3] = new B(
1418
+ new P(t, this.bounds.maxX, e, this.bounds.maxY),
1404
1419
  this.capacity,
1405
1420
  this.maxDepth,
1406
1421
  this.depth + 1,
@@ -1430,7 +1445,7 @@ class F {
1430
1445
  * @returns 相交的节点数组
1431
1446
  */
1432
1447
  queryCircle(t, e) {
1433
- const n = [], s = new N(
1448
+ const n = [], s = new P(
1434
1449
  t.x - e,
1435
1450
  t.x + e,
1436
1451
  t.y - e,
@@ -1512,7 +1527,7 @@ class F {
1512
1527
  }
1513
1528
  }
1514
1529
  function J(u, t = 0, e) {
1515
- return e || (e = new F(N.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 }))), u.map((n) => {
1530
+ return e || (e = new B(P.fromByLineSegment(...u)), u.forEach((n) => e?.insert({ line: n, userData: void 0 }))), u.map((n) => {
1516
1531
  const s = n.userData, i = s.drawWindow, r = e.queryLineSegment(n).filter((o) => o.line !== n && !o.userData?.isDoor).map((o) => ({ index: u.indexOf(o.line) }));
1517
1532
  return {
1518
1533
  start: n.start.toJson(t),
@@ -1528,13 +1543,14 @@ function J(u, t = 0, e) {
1528
1543
  drawWindow: i && i.map((o) => ({
1529
1544
  p: { x: o.p.x, y: o.p.y, z: o.p.z },
1530
1545
  width: o.width,
1531
- full: o.full
1546
+ full: o.full,
1547
+ rooftopPz: o.rooftopPz
1532
1548
  }))
1533
1549
  };
1534
1550
  });
1535
1551
  }
1536
- function lt(u, t = 0.03) {
1537
- const e = new F(N.fromByLineSegment(...u));
1552
+ function et(u, t = 0.03) {
1553
+ const e = new B(P.fromByLineSegment(...u));
1538
1554
  return u.forEach((n) => e.insert({ line: n, userData: void 0 })), u.flatMap((n) => {
1539
1555
  const s = e.queryLineSegment(n, !0).map((i) => {
1540
1556
  if (i.line === n) return;
@@ -1554,7 +1570,7 @@ function lt(u, t = 0.03) {
1554
1570
  return n;
1555
1571
  }).filter((n) => n.length() >= t);
1556
1572
  }
1557
- function tt(...u) {
1573
+ function nt(...u) {
1558
1574
  u.forEach((t) => {
1559
1575
  const e = t.direction();
1560
1576
  t.userData.drawWindow?.forEach((n) => {
@@ -1565,15 +1581,15 @@ function tt(...u) {
1565
1581
  ), r = t.projectPoint(
1566
1582
  s.clone().add(e.clone().multiplyScalar(n.width * -0.5)),
1567
1583
  !1
1568
- ), o = t.projectLineSegment(new A(i, r)), a = o.center;
1584
+ ), o = t.projectLineSegment(new L(i, r)), a = o.center;
1569
1585
  n.p = new I.Vector3(a?.x ?? 0, a?.y ?? 0, n.p.z);
1570
1586
  } catch {
1571
1587
  }
1572
1588
  });
1573
1589
  });
1574
1590
  }
1575
- function ie(u, t = 0.1, e) {
1576
- e || (e = new X(), u.forEach((i) => {
1591
+ function re(u, t = 0.1, e) {
1592
+ e || (e = new k(), u.forEach((i) => {
1577
1593
  i.userData.isDoor || i.points.forEach((r) => e?.insert(r, i));
1578
1594
  }));
1579
1595
  const n = [], s = /* @__PURE__ */ new Set();
@@ -1586,34 +1602,34 @@ function ie(u, t = 0.1, e) {
1586
1602
  if (s.has(y.point)) return !1;
1587
1603
  const x = y.userData;
1588
1604
  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;
1605
+ const g = a.distance(y.point);
1606
+ if (g < 1e-3) return !1;
1607
+ const w = a.direction(r.getAnotherPoint(a)), D = y.point.direction(x.getAnotherPoint(y.point));
1608
+ if (180 - w.angleBetween(D, "angle") < 25)
1609
+ return o.set(y.point, g), !0;
1594
1610
  }).sort((y, x) => {
1595
- const m = o.get(y.point), D = o.get(x.point);
1596
- return m - D;
1611
+ const g = o.get(y.point), w = o.get(x.point);
1612
+ return g - w;
1597
1613
  });
1598
1614
  if (c.length === 0) return;
1599
1615
  s.add(a), s.add(c[0].point);
1600
1616
  const l = c[0].userData, h = r.projectLineSegment(l), d = l.projectLineSegment(r), f = h.length(), p = d.length();
1601
- f === 0 && p === 0 ? n.push(new A(a.clone(), c[0].point.clone())) : n.push(new A(h.center, d.center));
1617
+ f === 0 && p === 0 ? n.push(new L(a.clone(), c[0].point.clone())) : n.push(new L(h.center, d.center));
1602
1618
  });
1603
1619
  }
1604
1620
  return [...u, ...n];
1605
1621
  }
1606
- function re(u) {
1607
- const t = new X(), e = new F(N.fromByLineSegment(...u)), n = [];
1622
+ function oe(u) {
1623
+ const t = new k(), e = new B(P.fromByLineSegment(...u)), n = [];
1608
1624
  return u.forEach((s) => {
1609
1625
  s.userData.isDoor ? n.push(s) : (s.points.forEach((i) => t.insert(i, s)), e.insert({ line: s, userData: void 0 }));
1610
1626
  }), n.forEach((s) => {
1611
1627
  const i = t.queryPoint(s.start), r = t.queryPoint(s.end);
1612
1628
  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;
1613
- }), u = ie(u, 0.3, t), u;
1629
+ }), u = re(u, 0.4, t), u;
1614
1630
  }
1615
- function oe(u) {
1616
- const t = new F(N.fromByLineSegment(...u));
1631
+ function ae(u) {
1632
+ const t = new B(P.fromByLineSegment(...u));
1617
1633
  u.forEach((n) => {
1618
1634
  n.userData.isDoor || t.insert({ line: n, userData: void 0 });
1619
1635
  });
@@ -1632,9 +1648,10 @@ function oe(u) {
1632
1648
  }
1633
1649
  return e;
1634
1650
  }
1635
- function ae(u, t, e, n = 15) {
1651
+ function ce(u, t, e, n = 15) {
1636
1652
  const s = [u], i = [], r = [], o = [];
1637
1653
  function a(d) {
1654
+ if (d.userData.isDoor) return r.push(d);
1638
1655
  const f = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x);
1639
1656
  let y = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x) - f;
1640
1657
  for (; y > Math.PI; ) y -= 2 * Math.PI;
@@ -1643,14 +1660,15 @@ function ae(u, t, e, n = 15) {
1643
1660
  return d.start.rotate(x, y), d.end.rotate(x, y), d.userData.isDoor ? r.push(d) : s.push(d), d;
1644
1661
  }
1645
1662
  function c(d) {
1663
+ if (d.userData.isDoor) return r.push(d);
1646
1664
  const f = Math.atan2(d.end.y - d.start.y, d.end.x - d.start.x), p = Math.atan2(u.end.y - u.start.y, u.end.x - u.start.x);
1647
1665
  let y = p + Math.PI / 2 - f, x = p - Math.PI / 2 - f;
1648
1666
  for (; y > Math.PI; ) y -= 2 * Math.PI;
1649
1667
  for (; y < -Math.PI; ) y += 2 * Math.PI;
1650
1668
  for (; x > Math.PI; ) x -= 2 * Math.PI;
1651
1669
  for (; x < -Math.PI; ) x += 2 * Math.PI;
1652
- const m = Math.abs(y) < Math.abs(x) ? y : x, D = d.center;
1653
- return d.start.rotate(D, m), d.end.rotate(D, m), d.userData.isDoor ? r.push(d) : i.push(d), d;
1670
+ const g = Math.abs(y) < Math.abs(x) ? y : x, w = d.center;
1671
+ return d.start.rotate(w, g), d.end.rotate(w, g), d.userData.isDoor ? r.push(d) : i.push(d), d;
1654
1672
  }
1655
1673
  function l(d, f, p = !1) {
1656
1674
  if (p) return l(d === "parallel" ? "vertical" : "parallel", f);
@@ -1663,17 +1681,17 @@ function ae(u, t, e, n = 15) {
1663
1681
  if (f.userData.isWindow && o.push(f), f.parallel(u, n)) a(f);
1664
1682
  else if (f.vertical(u, n)) c(f);
1665
1683
  else {
1666
- 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());
1684
+ 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());
1667
1685
  y && y.size > 1 ? h.push(() => {
1668
1686
  const x = [...y.values()].map(
1669
- (w) => w.map((g) => s.includes(g.line) ? "parallel" : i.includes(g.line) ? "vertical" : null).filter((g) => !!g)
1670
- ).map((w) => [...new Set(w)]), m = x[0], D = x[1];
1671
- if (m.length === 1 && D.length === 1) {
1672
- if (m[0] === D[0]) return l(m[0], f, !0);
1673
- if (m.length === 1) {
1674
- if (D.includes(m[0])) return l(m[0], f, !0);
1675
- if (D.length === 1 && m.includes(D[0]))
1676
- return l(D[0], f, !0);
1687
+ (D) => D.map((m) => s.includes(m.line) ? "parallel" : i.includes(m.line) ? "vertical" : null).filter((m) => !!m)
1688
+ ).map((D) => [...new Set(D)]), g = x[0], w = x[1];
1689
+ if (g.length === 1 && w.length === 1) {
1690
+ if (g[0] === w[0]) return l(g[0], f, !0);
1691
+ if (g.length === 1) {
1692
+ if (w.includes(g[0])) return l(g[0], f, !0);
1693
+ if (w.length === 1 && g.includes(w[0]))
1694
+ return l(w[0], f, !0);
1677
1695
  }
1678
1696
  }
1679
1697
  c(f);
@@ -1701,8 +1719,8 @@ function yt(u, t, e, n, s) {
1701
1719
  const l = c.flatMap((p) => {
1702
1720
  const y = p.userData;
1703
1721
  return y.points.map((x) => {
1704
- const m = t.projectPoint(x, !1);
1705
- return m.userData = y, m;
1722
+ const g = t.projectPoint(x, !1);
1723
+ return g.userData = y, g;
1706
1724
  });
1707
1725
  });
1708
1726
  l.sort((p, y) => p.distance(t.start) - y.distance(t.start));
@@ -1725,23 +1743,23 @@ function xt(u, t, e, n) {
1725
1743
  });
1726
1744
  }), o.sort((d, f) => f.distance(e.start) - d.distance(e.start));
1727
1745
  const a = o.map((d) => {
1728
- const f = d.userData, p = i.get(f), y = r.get(f), x = new A(p, y), m = [];
1729
- for (let D = 0; D < o.length; D++) {
1730
- const w = o[D];
1731
- if (d !== w && d.distance(w) < n) {
1732
- const g = w.userData, S = i.get(g), E = r.get(g);
1733
- (x.isPointOnSegment(S) || x.isPointOnSegment(E)) && m.push(D);
1746
+ const f = d.userData, p = i.get(f), y = r.get(f), x = new L(p, y), g = [];
1747
+ for (let w = 0; w < o.length; w++) {
1748
+ const D = o[w];
1749
+ if (d !== D && d.distance(D) < n) {
1750
+ const m = D.userData, S = i.get(m), T = r.get(m);
1751
+ (x.isPointOnSegment(S) || x.isPointOnSegment(T)) && g.push(w);
1734
1752
  }
1735
1753
  }
1736
- return m;
1754
+ return g;
1737
1755
  });
1738
1756
  function c(d, f, p = /* @__PURE__ */ new Set()) {
1739
1757
  if (p.has(d)) return p;
1740
1758
  const y = f[d];
1741
1759
  p.add(d);
1742
1760
  for (let x = 0; x < y.length; x++) {
1743
- const m = y[x];
1744
- c(m, f, p);
1761
+ const g = y[x];
1762
+ c(g, f, p);
1745
1763
  }
1746
1764
  return p;
1747
1765
  }
@@ -1752,23 +1770,23 @@ function xt(u, t, e, n) {
1752
1770
  if (f.forEach((y) => {
1753
1771
  l.add(y), p.push(o[y].userData);
1754
1772
  }), p.length > 2) {
1755
- const y = p.map((w) => s.get(w));
1756
- y.sort((w, g) => g.distance(e.start) - w.distance(e.start));
1757
- const x = y[0], m = y[y.length - 1];
1758
- if (x.distance(m) > n) {
1759
- 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();
1760
- if (E.distance(L) || R / b > 0.5 && B / R < 0.5) {
1761
- const C = [g], G = [S];
1773
+ const y = p.map((D) => s.get(D));
1774
+ y.sort((D, m) => m.distance(e.start) - D.distance(e.start));
1775
+ const x = y[0], g = y[y.length - 1];
1776
+ if (x.distance(g) > n) {
1777
+ const D = [...p].sort((N, j) => j.length() - N.length()), m = D[0], S = D[1], T = s.get(m), E = s.get(S), A = m.length(), v = S.length(), C = m.projectLineSegment(S), F = C.length();
1778
+ if (T.distance(E) || v / A > 0.5 && F / v < 0.5) {
1779
+ const N = [m], j = [S];
1762
1780
  for (let O = 0; O < y.length; O++) {
1763
- const v = y[O], V = v.userData;
1764
- if (v === E || v === L) continue;
1765
- const j = S.projectLineSegment(V), W = j.length();
1766
- L.distance(v) <= n && W / R > 0 ? G.push(V) : C.push(V);
1781
+ const R = y[O], V = R.userData;
1782
+ if (R === T || R === E) continue;
1783
+ const G = S.projectLineSegment(V), W = G.length();
1784
+ E.distance(R) <= n && W / v > 0 ? j.push(V) : N.push(V);
1767
1785
  }
1768
- h.push(C, G);
1786
+ h.push(N, j);
1769
1787
  } else {
1770
- const C = Math.floor(p.length * 0.5);
1771
- h.push(p.slice(0, C), p.slice(C));
1788
+ const N = Math.floor(p.length * 0.5);
1789
+ h.push(p.slice(0, N), p.slice(N));
1772
1790
  }
1773
1791
  continue;
1774
1792
  }
@@ -1798,7 +1816,7 @@ function gt(u, t) {
1798
1816
  }
1799
1817
  return s;
1800
1818
  }
1801
- function ce(u, t, e, n, s, i) {
1819
+ function le(u, t, e, n, s, i) {
1802
1820
  const {
1803
1821
  principalAxisThreshold: r = 0.3,
1804
1822
  crossAxistThreshold: o = 0.06,
@@ -1819,25 +1837,30 @@ function ce(u, t, e, n, s, i) {
1819
1837
  };
1820
1838
  return c[a] ? c[a]() : c.originalInterPoint();
1821
1839
  }
1822
- function le(u, t) {
1840
+ function he(u, t) {
1823
1841
  const e = /* @__PURE__ */ new Set();
1824
1842
  return u.forEach((n) => {
1825
- for (let s = 1; s < n.length; s++) {
1826
- const i = n[s], r = n[s - 1];
1827
- [...t.get(i) ?? [], ...t.get(r) ?? []].forEach((a) => {
1828
- (a.line.sameEndpointAsStart(i) && a.line.sameEndpointAsEnd(r) || a.line.sameEndpointAsStart(r) && a.line.sameEndpointAsEnd(i)) && e.add(a);
1843
+ const s = /* @__PURE__ */ new Map();
1844
+ n.map((i) => {
1845
+ t.get(i)?.forEach((o) => {
1846
+ s.has(o.line) || s.set(o.line, []), s.get(o.line)?.push({ intersect: o, targetLine: i });
1829
1847
  });
1830
- }
1848
+ });
1849
+ for (const [i, r] of s)
1850
+ if (r.length === 2) {
1851
+ const o = r[0].targetLine, a = r[1].targetLine;
1852
+ (i.sameEndpointAsStart(o) && i.sameEndpointAsEnd(a) || i.sameEndpointAsStart(a) && i.sameEndpointAsEnd(o)) && e.add(i);
1853
+ }
1831
1854
  }), u.map((n) => n.filter((s) => !e.has(s)));
1832
1855
  }
1833
- function he(u, t = 0.1, e) {
1856
+ function ue(u, t = 0.1, e) {
1834
1857
  const { fittingMethod: n = "average" } = e ?? {};
1835
1858
  return u.map((s) => {
1836
1859
  if (s.length === 0) return;
1837
1860
  if (s.length === 1) return s[0];
1838
1861
  const i = [];
1839
1862
  s.forEach((h) => i.push(h.start.clone(), h.end.clone()));
1840
- const r = n === "average" ? A.mergeLines(...s) : A.mergeLinesByMaxlength(...s);
1863
+ const r = n === "average" ? L.mergeLines(...s) : L.mergeLinesByMaxlength(...s);
1841
1864
  r.userData.rooftopPz = Math.min(
1842
1865
  ...s.map((h) => {
1843
1866
  const { drawDoorData: d, drawWindow: f, rooftopPz: p, ...y } = h.userData;
@@ -1854,14 +1877,42 @@ function he(u, t = 0.1, e) {
1854
1877
  return l >= t && (r.userData.wallWidth = l), s.forEach((h) => h.userData.fittedLine = r), r;
1855
1878
  }).filter((s) => !!s);
1856
1879
  }
1857
- function mt(u, t = 0.4) {
1858
- const e = new F(N.fromByLineSegment(...u));
1859
- u.forEach((s) => e.insert(s));
1860
- const n = new A();
1880
+ function de(u, t) {
1881
+ const e = new k(), n = new B(P.fromByLineSegment(...u));
1882
+ u.forEach((i) => {
1883
+ i.userData.isDoor || (n.insert(i), i.points.forEach((r) => e.insert(r, i)));
1884
+ }), u.forEach((i) => {
1885
+ i.userData.isDoor || (n.insert(i), i.points.forEach((r) => e.insert(r, i)));
1886
+ });
1887
+ function s(i, r, o) {
1888
+ if (o.length) {
1889
+ const a = o.map(({ line: c }) => {
1890
+ if (c.userData.fittedLine && (c = c.userData.fittedLine), c.vertical(i))
1891
+ return c.projectPoint(r, !0);
1892
+ }).filter((c) => !!c).sort((c, l) => c.distance(r) - l.distance(r));
1893
+ a.length && (r.copy(a[0]), e.update(r), n.update(i));
1894
+ }
1895
+ }
1896
+ for (let i = 0; i < u.length; i++) {
1897
+ const r = u[i], a = (t.get(r) ?? []).reduce((c, l) => (l.sourcePoint === r.start ? c[0].push(l) : c[1].push(l), c), [[], []]);
1898
+ for (let c = 0; c < r.points.length; c++) {
1899
+ const l = r.points[c];
1900
+ e.queryPoint(l, !0).length || s(r, l, a[c]);
1901
+ }
1902
+ }
1903
+ return u;
1904
+ }
1905
+ function fe(u, t = 0.4) {
1906
+ const e = new B(P.fromByLineSegment(...u));
1907
+ u.forEach((s) => {
1908
+ s.userData.isDoor || e.insert(s);
1909
+ });
1910
+ const n = new L();
1861
1911
  for (let s = 0; s < u.length; s++) {
1862
1912
  const i = u[s];
1863
1913
  if (i.userData.isAdsorbed) continue;
1864
1914
  const r = i.direction().multiplyScalar(t), [o, a] = i.points.map((c) => {
1915
+ if (e.queryPoint(c).length > 1) return;
1865
1916
  n.set(c, c), n.start.add(r), n.end.add(r.multiplyScalar(-1));
1866
1917
  const l = /* @__PURE__ */ new Map(), h = e.queryLineSegment(n).filter((d) => d.line !== i).map((d) => {
1867
1918
  const f = d.line.getIntersection(n);
@@ -1872,56 +1923,60 @@ function mt(u, t = 0.4) {
1872
1923
  });
1873
1924
  return h.length ? l.get(h[0]) : void 0;
1874
1925
  });
1875
- if (o && a) {
1876
- if (o.equal(a)) {
1877
- const c = i.start.distance(o), l = i.end.distance(a);
1878
- c < l ? i.directionMove(i.start.direction(i.end), c) : i.directionMove(i.end.direction(i.start), l);
1879
- } else
1880
- i.start.copy(o), i.end.copy(a);
1881
- i.userData.isAdsorbed = !0;
1882
- } else o ? i.directionMove(o.direction(i.start), i.start.distance(o)) : a && i.directionMove(a.direction(i.end), i.end.distance(a));
1883
- e.update(i);
1926
+ if (o || o) {
1927
+ if (o && a) {
1928
+ if (o.equal(a)) {
1929
+ const c = i.start.distance(o), l = i.end.distance(a);
1930
+ c < l ? i.directionMove(i.end.direction(i.start), c) : i.directionMove(i.start.direction(i.end), l);
1931
+ } else
1932
+ i.start.copy(o), i.end.copy(a);
1933
+ i.userData.isAdsorbed = !0;
1934
+ } else o ? i.start.copy(o) : a && i.end.copy(a);
1935
+ e.update(i);
1936
+ }
1884
1937
  }
1885
- return u.filter((s) => s.length() > 1e-3);
1938
+ return u;
1886
1939
  }
1887
- function ue(u, t) {
1888
- const e = new X();
1889
- u.forEach((i) => i.points.forEach((r) => e.insert(r, i)));
1890
- const n = /* @__PURE__ */ new Map();
1891
- function s(i, r) {
1892
- n.has(i) || n.set(i, []), n.get(i)?.push(r);
1893
- }
1894
- for (let i = 0; i < u.length; i++) {
1895
- const r = u[i];
1896
- r.points.forEach((o) => {
1897
- if (e.queryPoint(o).filter((h) => h.userData !== r).length !== 0) return;
1898
- const a = e.queryCircle(o, t).filter((h) => h.userData !== r && h.userData?.vertical(r));
1899
- if (!a.length) return;
1900
- const c = a.sort((h, d) => h.userData.length() - d.userData.length())[0], l = c.userData?.projectPoint(o, !1);
1901
- if (l) {
1902
- const h = c.userData;
1903
- s(r, new A(o.clone(), l.clone())), s(h, new A(c.point.clone(), l.clone()));
1940
+ function pe(u, t) {
1941
+ const e = new k(), n = new B(P.fromByLineSegment(...u));
1942
+ u.forEach((r) => {
1943
+ r.userData.isDoor || (n.insert(r), r.points.forEach((o) => e.insert(o, r)));
1944
+ });
1945
+ const s = /* @__PURE__ */ new Map();
1946
+ function i(r, o) {
1947
+ s.has(r) || s.set(r, []), s.get(r)?.push(o);
1948
+ }
1949
+ for (let r = 0; r < u.length; r++) {
1950
+ const o = u[r];
1951
+ o.points.forEach((a) => {
1952
+ if (e.queryPoint(a).filter((f) => f.userData !== o).length !== 0 || n.queryCircle(a, 1e-3).filter((f) => f.line !== o).length > 0) return;
1953
+ 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));
1954
+ if (!l.length) return;
1955
+ const h = l[0], d = h.userData?.projectPoint(a, !1);
1956
+ if (d) {
1957
+ const f = h.userData;
1958
+ i(o, new L(a.clone(), d.clone())), i(f, new L(h.point.clone(), d.clone()));
1904
1959
  }
1905
1960
  });
1906
1961
  }
1907
- return n.forEach((i, r) => {
1908
- const o = A.mergeLines(r, ...i);
1909
- r.set(o.start, o.end);
1962
+ return s.forEach((r, o) => {
1963
+ const a = L.mergeLines(o, ...r);
1964
+ o.set(a.start, a.end);
1910
1965
  }), u;
1911
1966
  }
1912
- function de(u, t) {
1913
- const { snapThreshold: e = 0.2 } = t ?? {};
1914
- return u = mt(u, e), u = mt(u, e), u = ue(u, e), u;
1967
+ function ye(u, t, e) {
1968
+ const { snapThreshold: n = 0.2 } = e ?? {};
1969
+ return u = de(u, t), u = fe(u, n), u = pe(u, n), u;
1915
1970
  }
1916
- function fe(u) {
1971
+ function xe(u) {
1917
1972
  const t = /* @__PURE__ */ new Set();
1918
1973
  for (let e = 0; e < u.length; e++) {
1919
1974
  const n = u[e], s = n.userData.fittedLine;
1920
- s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : tt(n);
1975
+ s ? (t.add(s), s.userData.isWindow = !0, s.userData.drawWindow || (s.userData.drawWindow = []), s.userData.drawWindow.push(...n.userData.drawWindow ?? [])) : nt(n);
1921
1976
  }
1922
- t.forEach((e) => tt(e));
1977
+ t.forEach((e) => nt(e));
1923
1978
  }
1924
- function pe(u) {
1979
+ function ge(u) {
1925
1980
  for (let t = 0; t < u.length; t++) {
1926
1981
  const e = u[t];
1927
1982
  let { endIntersection: n, startIntersection: s } = e.userData;
@@ -1942,8 +1997,8 @@ function pe(u) {
1942
1997
  }
1943
1998
  return u;
1944
1999
  }
1945
- function ye(u, t = 0.01) {
1946
- const e = new X();
2000
+ function me(u, t = 0.01) {
2001
+ const e = new k();
1947
2002
  return u.forEach((n) => n.points.forEach((s) => e.insert(s, n))), u.filter((n) => {
1948
2003
  if (n.length() <= t) {
1949
2004
  const s = e.queryPoint(n.start).filter((r) => r.userData !== n).length === 0, i = e.queryPoint(n.end).filter((r) => r.userData !== n).length === 0;
@@ -1952,7 +2007,7 @@ function ye(u, t = 0.01) {
1952
2007
  return !0;
1953
2008
  });
1954
2009
  }
1955
- class Pt {
2010
+ class It {
1956
2011
  /**
1957
2012
  * 轴对齐垂直修正
1958
2013
  * @param lines 待调整线段组
@@ -1960,39 +2015,39 @@ class Pt {
1960
2015
  * @returns
1961
2016
  */
1962
2017
  static correction(t, e, n) {
1963
- t = re(t.map((x) => x.clone()));
1964
- 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(), d = new A(
2018
+ t = oe(t.map((x) => x.clone()));
2019
+ const s = ae(t), { parallelLines: i, verticalLines: r, doorLines: o, windowLines: a } = ce(e, t, s, 25), c = e.normal(), l = e.center, h = e.direction(), d = new L(
1965
2020
  l.clone().add(c.clone().multiplyScalar(-1e3)),
1966
2021
  l.clone().add(c.clone().multiplyScalar(1e3))
1967
- ), f = new A(
2022
+ ), f = new L(
1968
2023
  l.clone().add(h.clone().multiplyScalar(-1e3)),
1969
2024
  l.clone().add(h.clone().multiplyScalar(1e3))
1970
2025
  );
1971
- let p = ce(i, r, d, f, s, n);
1972
- p = le(p, s);
1973
- let y = he(p, 0.1, n);
1974
- 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;
2026
+ let p = le(i, r, d, f, s, n);
2027
+ p = he(p, s);
2028
+ let y = ue(p, 0.1, n);
2029
+ return y = ye(y, s, n), xe(a), ge(o), y = et(y, 1e-9), y.push(...o), y = me(y, 0.15), y = y, y = L.autoMergeLines(y).lines, y = et(y, 1e-9), y;
1975
2030
  }
1976
2031
  }
1977
- const xe = new A(
2032
+ const we = new L(
1978
2033
  new M(0, 0),
1979
2034
  new M(0, 1)
1980
2035
  );
1981
- function ge(u) {
2036
+ function Me(u) {
1982
2037
  const t = [...u].sort((i, r) => r.length() - i.length()).slice(0, 20), e = t.map((i) => {
1983
- let r = parseInt(xe.includedAngle(i) + "");
2038
+ let r = parseInt(we.includedAngle(i) + "");
1984
2039
  return r > 90 && (r = 180 - r), r;
1985
2040
  }), n = /* @__PURE__ */ new Map();
1986
2041
  return e.forEach((i, r) => {
1987
2042
  n.has(i) || n.set(i, []), n.get(i)?.push(t[r]);
1988
2043
  }), [...n.values()].sort((i, r) => r.length - i.length)[0].sort((i, r) => r.length() - i.length())[0];
1989
2044
  }
1990
- function me(u) {
2045
+ function Se(u) {
1991
2046
  let t = [], e = -1;
1992
2047
  const n = [];
1993
2048
  return u.forEach(({ start: i, end: r, ...o }, a) => {
1994
2049
  n.push(i.z ?? 0, r.z ?? 0);
1995
- const c = new A(
2050
+ const c = new L(
1996
2051
  M.from(i),
1997
2052
  M.from(r)
1998
2053
  );
@@ -2003,7 +2058,7 @@ function me(u) {
2003
2058
  verticalReferenceIndex: e
2004
2059
  };
2005
2060
  }
2006
- const we = {
2061
+ const De = {
2007
2062
  Unitless: 1,
2008
2063
  // 无单位,1米 = 1(无单位)
2009
2064
  Inches: 39.37007874015748,
@@ -2047,27 +2102,27 @@ const we = {
2047
2102
  Parsecs: 3240779289666404e-32
2048
2103
  // 秒差距,1米 ≈ 0.00000000000000003240779289666404秒差距
2049
2104
  };
2050
- function wt(u) {
2105
+ function mt(u) {
2051
2106
  const t = [];
2052
2107
  for (let e = 0; e < u.length; e++)
2053
- t.push(new A(
2108
+ t.push(new L(
2054
2109
  u[e].clone(),
2055
2110
  u[(e + 1) % u.length].clone()
2056
2111
  ));
2057
2112
  return t;
2058
2113
  }
2059
- function Mt(u) {
2114
+ function wt(u) {
2060
2115
  return u.flatMap((t, e) => (e === u.length - 1 && [...t.points, u[0].points[0]], [t.points[0]]));
2061
2116
  }
2062
- class k extends _ {
2117
+ class Y extends z {
2063
2118
  static name = "Dxf";
2064
2119
  shortLine = 0.04;
2065
2120
  width = 0.04;
2066
2121
  scale = 1;
2067
2122
  originalData = [];
2068
2123
  data = [];
2069
- originalBox = new N(0, 0, 0, 0);
2070
- box = new N(0, 0, 0, 0);
2124
+ originalBox = new P(0, 0, 0, 0);
2125
+ box = new P(0, 0, 0, 0);
2071
2126
  pointsGroups = [];
2072
2127
  wallsGroup = [];
2073
2128
  doors = [];
@@ -2104,9 +2159,9 @@ class k extends _ {
2104
2159
  * @param data
2105
2160
  */
2106
2161
  preprocessing(t) {
2107
- let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = me(t);
2162
+ let { lineSegments: e, verticalReferenceIndex: n, originalZAverage: s } = Se(t);
2108
2163
  if (this.originalZAverage = s, n === -1) {
2109
- const r = ge(e);
2164
+ const r = Me(e);
2110
2165
  n = e.indexOf(r);
2111
2166
  }
2112
2167
  const i = e[n];
@@ -2115,7 +2170,7 @@ class k extends _ {
2115
2170
  data: t,
2116
2171
  setData(r) {
2117
2172
  e = r.map(({ start: o, end: a, ...c }) => {
2118
- const l = new A(M.from(o), M.from(a));
2173
+ const l = new L(M.from(o), M.from(a));
2119
2174
  return l.userData = c, l;
2120
2175
  }), t = r;
2121
2176
  }
@@ -2268,7 +2323,7 @@ class k extends _ {
2268
2323
  break;
2269
2324
  }
2270
2325
  }
2271
- const e = this.mergeSameDirectionLine(wt(t)), n = [e[0]];
2326
+ const e = this.mergeSameDirectionLine(mt(t)), n = [e[0]];
2272
2327
  for (let s = 1; s < e.length; s++) {
2273
2328
  const i = e[s], r = e[(e.length + s - 1) % e.length];
2274
2329
  if (i.length() > this.width * 0.9) {
@@ -2283,7 +2338,7 @@ class k extends _ {
2283
2338
  const a = e[s + 2];
2284
2339
  a && r.includedAngle(a) < 2 ? (s = s + 2, n.push(a)) : n.push(i);
2285
2340
  }
2286
- return n.length > 3 ? Mt(this.mergeSameDirectionLine(n)) : [];
2341
+ return n.length > 3 ? wt(this.mergeSameDirectionLine(n)) : [];
2287
2342
  }
2288
2343
  /**
2289
2344
  * 移除短线段
@@ -2291,7 +2346,7 @@ class k extends _ {
2291
2346
  * @param path
2292
2347
  */
2293
2348
  removeShortLine(t, e = this.shortLine) {
2294
- const n = wt(t), s = [], i = Math.PI / 180;
2349
+ const n = mt(t), s = [], i = Math.PI / 180;
2295
2350
  for (let r = 0; r < n.length; r++) {
2296
2351
  const o = n[r], a = o.length(), c = r;
2297
2352
  if (a > e || s.length === 0) {
@@ -2319,12 +2374,12 @@ class k extends _ {
2319
2374
  } else
2320
2375
  r = c;
2321
2376
  }
2322
- return s.length > 3 ? Mt(s) : [];
2377
+ return s.length > 3 ? wt(s) : [];
2323
2378
  }
2324
2379
  /** 线偏移
2325
2380
  * @description 使用 ClipperLib 对每个点组进行线偏移处理,生成具有指定宽度的墙体路径
2326
2381
  */
2327
- lineOffset(t = k.EndType.etOpenSquare, e = k.JoinType.jtMiter, n = 1e4) {
2382
+ lineOffset(t = Y.EndType.etOpenSquare, e = Y.JoinType.jtMiter, n = 1e4) {
2328
2383
  let s = new pt.Paths();
2329
2384
  const i = new pt.ClipperOffset(20, 0.25);
2330
2385
  return this.pointsGroups.forEach((r) => {
@@ -2332,7 +2387,7 @@ class k extends _ {
2332
2387
  i.AddPaths(o, e, t);
2333
2388
  }), i.Execute(s, this.width / 2 * n), this.wallsGroup = s.map((r) => {
2334
2389
  let o = r.map((a) => M.from(a).divisionScalar(n));
2335
- return o = this.lineSegmentStraightening(o), t == k.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
2390
+ return o = this.lineSegmentStraightening(o), t == Y.EndType.etOpenSquare && (o = this.squareRemoveBurr(o)), o;
2336
2391
  }), this.dispatchEvent({
2337
2392
  type: "lineOffset",
2338
2393
  wallsGroup: this.wallsGroup
@@ -2344,7 +2399,7 @@ class k extends _ {
2344
2399
  axisAlignCorr(t) {
2345
2400
  if (this.verticalReferenceLine) {
2346
2401
  this.doorLineSegment;
2347
- const e = Pt.correction(this.getLineSegments(), this.verticalReferenceLine, t), n = J(e);
2402
+ const e = It.correction(this.getLineSegments(), this.verticalReferenceLine, t), n = J(e);
2348
2403
  this.set(n);
2349
2404
  } else
2350
2405
  throw new Error("未找到一条垂直纠正基准轴线");
@@ -2394,7 +2449,7 @@ class k extends _ {
2394
2449
  * 转为绘制数据
2395
2450
  */
2396
2451
  toDrawDataJson(t = "Millimeters") {
2397
- const e = we[t], n = {
2452
+ const e = De[t], n = {
2398
2453
  unit: t,
2399
2454
  line: [],
2400
2455
  arc: [],
@@ -2438,29 +2493,29 @@ class k extends _ {
2438
2493
  if (s = "cyan", l.length() < 1.2) {
2439
2494
  l.expansion(-o * 0.5);
2440
2495
  const h = c.normal();
2441
- let d = new A(
2496
+ let d = new L(
2442
2497
  l.start.clone(),
2443
2498
  l.start.clone().add(h.clone().multiplyScalar(l.length()))
2444
2499
  );
2445
2500
  const f = d.clone().directionMove(d.normal(), l.length() * -0.5).expandToRectangle(l.length(), "bothSides");
2446
- for (let g = 0; g < a.length; g++)
2447
- if (a[g].intersectRectangle(f)) {
2448
- d = new A(
2501
+ for (let m = 0; m < a.length; m++)
2502
+ if (a[m].intersectRectangle(f)) {
2503
+ d = new L(
2449
2504
  l.start.clone(),
2450
2505
  l.start.clone().add(h.clone().multiplyScalar(-l.length()))
2451
2506
  );
2452
2507
  break;
2453
2508
  }
2454
- d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((g, S) => i(g, S));
2455
- const p = l.length(), y = d.length(), x = (p ** 2 + y ** 2) / (2 * y), m = d.end.clone().add(d.direction().multiplyScalar(-x)), [D, w] = this.getArcAngleRange(m, l.end, d.end);
2456
- r(m, x, Math.min(D, w), Math.max(D, w)), a.push(f);
2509
+ d.expansion(-o * 0.5).expandToRectangle(this.width * 0.2, "bothSides").path2D((m, S) => i(m, S));
2510
+ const p = l.length(), y = d.length(), x = (p ** 2 + y ** 2) / (2 * y), g = d.end.clone().add(d.direction().multiplyScalar(-x)), [w, D] = this.getArcAngleRange(g, l.end, d.end);
2511
+ r(g, x, Math.min(w, D), Math.max(w, D)), a.push(f);
2457
2512
  } else
2458
2513
  l.clone().expansion(-this.width * 0.5).expandToRectangle(this.width).path2D((h, d) => i(h, d)), 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, d) => i(h, d)), 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, d) => i(h, d));
2459
2514
  }), s = "yellow", this.lineSegments.forEach((c) => {
2460
2515
  if (!c.userData.isWindow) return !1;
2461
2516
  Array.isArray(c.userData.drawWindow) && c.userData.drawWindow.forEach((l) => {
2462
- const { p: h, width: d } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(d * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-d * 0.5)), x = new A(p, y);
2463
- i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((m, D) => i(m, D));
2517
+ const { p: h, width: d } = l, f = M.from(h), p = f.clone().add(c.direction().multiplyScalar(d * 0.5)), y = f.clone().add(c.direction().multiplyScalar(-d * 0.5)), x = new L(p, y);
2518
+ i(x.start, x.end), x.expandToRectangle(this.width, "bothSides").path2D((g, w) => i(g, w));
2464
2519
  });
2465
2520
  }), n;
2466
2521
  }
@@ -2474,7 +2529,7 @@ class k extends _ {
2474
2529
  if (typeof window < "u")
2475
2530
  i = document.createElement("canvas");
2476
2531
  else if (typeof global < "u") {
2477
- const { createCanvas: c } = await Y("canvas");
2532
+ const { createCanvas: c } = await X("canvas");
2478
2533
  i = c();
2479
2534
  } else
2480
2535
  throw new Error("创建画布失败");
@@ -2491,8 +2546,8 @@ class k extends _ {
2491
2546
  a.strokeStyle = o[p], a.beginPath(), a.arc(c, l, h, d * (Math.PI / 180), f * (Math.PI / 180)), a.stroke();
2492
2547
  }), a.beginPath(), s.dimensionLine.forEach((c) => {
2493
2548
  let [l, h, d, f] = c;
2494
- 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;
2495
- 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);
2549
+ 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;
2550
+ 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);
2496
2551
  }), a.closePath(), a.strokeStyle = "#fff", a.stroke(), "toBlob" in i ? new Promise((c) => {
2497
2552
  i.toBlob((l) => {
2498
2553
  c(l);
@@ -2503,8 +2558,8 @@ class k extends _ {
2503
2558
  * 将点json结构转换为Dxf string
2504
2559
  */
2505
2560
  toDxfString(t = "Millimeters") {
2506
- const e = new $();
2507
- e.setUnits(t), e.addLayer("cyan", $.ACI.CYAN, "DOTTED"), e.addLayer("yellow", $.ACI.YELLOW, "DOTTED"), e.addLayer("white", $.ACI.WHITE, "DOTTED");
2561
+ const e = new K();
2562
+ e.setUnits(t), e.addLayer("cyan", K.ACI.CYAN, "DOTTED"), e.addLayer("yellow", K.ACI.YELLOW, "DOTTED"), e.addLayer("white", K.ACI.WHITE, "DOTTED");
2508
2563
  const n = this.toDrawDataJson();
2509
2564
  return n.line.forEach((s) => {
2510
2565
  let [i, r, o, a, c] = s;
@@ -2530,7 +2585,7 @@ class k extends _ {
2530
2585
  if (typeof window < "u") {
2531
2586
  const n = new Blob([e], { type: "application/json" }), s = document.createElement("a");
2532
2587
  s.href = URL.createObjectURL(n), s.download = t, s.click();
2533
- } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, e);
2588
+ } else typeof global < "u" && (await X("fs", !1)).writeFileSync(t, e);
2534
2589
  }
2535
2590
  /**
2536
2591
  * 下载
@@ -2540,7 +2595,7 @@ class k extends _ {
2540
2595
  if (typeof window < "u") {
2541
2596
  const n = this.toDxfBlob(e), s = document.createElement("a");
2542
2597
  s.href = URL.createObjectURL(n), s.download = t + ".dxf", s.click();
2543
- } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, this.toDxfString(e));
2598
+ } else typeof global < "u" && (await X("fs", !1)).writeFileSync(t, this.toDxfString(e));
2544
2599
  }
2545
2600
  /**
2546
2601
  * 下载
@@ -2552,7 +2607,7 @@ class k extends _ {
2552
2607
  if (typeof window < "u") {
2553
2608
  const i = document.createElement("a");
2554
2609
  i.href = URL.createObjectURL(s), i.download = t, i.click();
2555
- } else typeof global < "u" ? (await Y("fs", !1)).writeFileSync(t, s) : console.error("图片下载失败");
2610
+ } else typeof global < "u" ? (await X("fs", !1)).writeFileSync(t, s) : console.error("图片下载失败");
2556
2611
  return !0;
2557
2612
  }
2558
2613
  /**
@@ -2560,7 +2615,7 @@ class k extends _ {
2560
2615
  * @description 计算所有线段的起点和终点的最小最大值,形成一个边界框
2561
2616
  * @returns
2562
2617
  */
2563
- computedOriginalSize(t, e = new N(0, 0, 0, 0)) {
2618
+ computedOriginalSize(t, e = new P(0, 0, 0, 0)) {
2564
2619
  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);
2565
2620
  return e.set(i, r, o, a), e;
2566
2621
  }
@@ -2588,41 +2643,41 @@ class k extends _ {
2588
2643
  });
2589
2644
  }
2590
2645
  }
2591
- function ct(u) {
2646
+ function ht(u) {
2592
2647
  if (u === null || typeof u != "object") return u;
2593
2648
  if (u instanceof Date) return new Date(u.getTime());
2594
- if (Array.isArray(u)) return u.map(ct);
2649
+ if (Array.isArray(u)) return u.map(ht);
2595
2650
  const t = {};
2596
2651
  for (const e in u)
2597
- Object.prototype.hasOwnProperty.call(u, e) && (t[e] = ct(u[e]));
2652
+ Object.prototype.hasOwnProperty.call(u, e) && (t[e] = ht(u[e]));
2598
2653
  return t;
2599
2654
  }
2600
- const z = new A();
2601
- class Me extends k {
2655
+ const q = new L();
2656
+ class Le extends Y {
2602
2657
  static name = "AngleCorrectionDxf";
2603
2658
  angle = 0;
2604
2659
  onAddFromParent(t) {
2605
- t.findComponentByName("LineAnalysis").addEventListener("analysisCompleted", async () => this.update());
2660
+ t.DoorsAnalysis.addEventListener("analysisCompleted", async () => this.update());
2606
2661
  }
2607
2662
  async update() {
2608
2663
  const t = this.parent, e = t.findComponentByName("Dxf"), n = t.findComponentByName("LineAnalysis");
2609
2664
  let s = 0, i = null;
2610
2665
  for (let c = 0; c < e.originalData.length; c++) {
2611
2666
  const l = e.originalData[c];
2612
- if (z.start.copy(l.start), z.end.copy(l.end), l.isVerticalReferenceLine) {
2613
- const [h, d] = l.start.y < l.end.y ? [z.start, z.end] : [z.end, z.start];
2614
- s = -new A(h, d).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
2667
+ if (q.start.copy(l.start), q.end.copy(l.end), l.isVerticalReferenceLine) {
2668
+ const [h, d] = l.start.y < l.end.y ? [q.start, q.end] : [q.end, q.start];
2669
+ s = -new L(h, d).direction().angleBetween(new M(0, 1), "angle", "360"), i = null;
2615
2670
  break;
2616
2671
  }
2617
- (!i || z.length() > i.length()) && (i = z.clone(), i.userData.index = c);
2672
+ (!i || q.length() > i.length()) && (i = q.clone(), i.userData.index = c);
2618
2673
  }
2619
2674
  if (i) {
2620
2675
  e.originalData[i.userData.index].isVerticalReferenceLine = !0;
2621
2676
  const [c, l] = i.start.y < i.end.y ? [i.start, i.end] : [i.end, i.start];
2622
- s = -new A(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
2677
+ s = -new L(c, l).direction().angleBetween(new M(0, 1), "angle", "360");
2623
2678
  }
2624
2679
  const r = e.originalBox.center, o = M.zero(), a = e.originalData.map((c) => {
2625
- 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), d = Object.assign(ct(c), { start: l, end: h });
2680
+ 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), d = Object.assign(ht(c), { start: l, end: h });
2626
2681
  return d.drawWindow && d.drawWindow.forEach((f) => {
2627
2682
  f.p = o.copy(f.p).division(r).rotate(M.zero(), s * (Math.PI / 180)).toJson(f.p.z);
2628
2683
  }), d;
@@ -2643,7 +2698,7 @@ class Me extends k {
2643
2698
  });
2644
2699
  }
2645
2700
  }
2646
- class Rt extends _ {
2701
+ class Pt extends z {
2647
2702
  static name = "Variable";
2648
2703
  originalLineVisible = !0;
2649
2704
  dxfVisible = !0;
@@ -2670,14 +2725,166 @@ class Rt extends _ {
2670
2725
  if (t in this) return this[t];
2671
2726
  }
2672
2727
  }
2673
- class Se {
2728
+ class Rt extends z {
2729
+ static name = "LineAnalysis";
2730
+ Dxf = null;
2731
+ Variable = null;
2732
+ lineSegmentList = [];
2733
+ container = new I.Group();
2734
+ // 误差角度
2735
+ errorAngle = 4;
2736
+ width = 0.4;
2737
+ /**
2738
+ *
2739
+ * @param parent
2740
+ */
2741
+ onAddFromParent(t) {
2742
+ this.Dxf = t.findComponentByType(Y), this.Variable = this.parent?.findComponentByType(Pt), this.Dxf.addEventListener("setDta", () => {
2743
+ this.lineAnalysis(), this.dispatchEvent({ type: "analysisCompleted" });
2744
+ });
2745
+ }
2746
+ /**
2747
+ *
2748
+ * @param p1
2749
+ * @param p2
2750
+ * @param width
2751
+ * @returns
2752
+ */
2753
+ expandLineSegment(t, e, n = 0.1) {
2754
+ const s = e.normal(t), i = e.direction(t).mutiplyScalar(n * 0.5), r = t.direction(e).mutiplyScalar(n * 0.5), o = s.x * n * 0.5, a = s.y * n * 0.5;
2755
+ return {
2756
+ points: [
2757
+ // 第一条线
2758
+ new M(t.x + o, t.y + a).add(r),
2759
+ new M(e.x + o, e.y + a).add(i),
2760
+ // 第二条线
2761
+ new M(t.x - o, t.y - a).add(r),
2762
+ new M(e.x - o, e.y - a).add(i)
2763
+ ],
2764
+ indices: [0, 1, 1, 3, 3, 2, 2, 0],
2765
+ rectIndices: [0, 1, 3, 2, 0]
2766
+ };
2767
+ }
2768
+ appendLineSegmentList = [];
2769
+ /**
2770
+ * 追加数据
2771
+ * @param p1
2772
+ * @param p2
2773
+ */
2774
+ addData(t, e) {
2775
+ const n = this.Dxf;
2776
+ n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new L(t.clone(), e.clone()));
2777
+ }
2778
+ /** 结果分析创建矩形
2779
+ * @param result
2780
+ */
2781
+ createRectangle(t) {
2782
+ const e = this.Dxf, n = t.project, s = t.project2;
2783
+ 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]);
2784
+ 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]), d = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(d);
2785
+ p.multiplyScalar(e.width * 0.5);
2786
+ const y = d.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), g = d.direction(f), w = y.direction(x);
2787
+ 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)) {
2788
+ d.set(y.x, y.y), f.set(x.x, x.y);
2789
+ for (let D = 1; D < o; D++) {
2790
+ const m = l.clone().multiplyScalar(a * D), S = h.clone().multiplyScalar(c * D), T = d.clone().add(m), E = f.clone().add(S);
2791
+ this.addData(T, E);
2792
+ }
2793
+ }
2794
+ }
2795
+ quadtree;
2796
+ /**
2797
+ * 构建线段四叉树,快速查找,
2798
+ */
2799
+ buildQuadtree() {
2800
+ const t = this.Dxf, e = [];
2801
+ this.quadtree = new B(t.originalBox, 2), t.lineSegments.forEach((n) => {
2802
+ n.userData?.isDoor || (this.quadtree?.insert({
2803
+ line: n,
2804
+ userData: e.length
2805
+ }), e.push(n));
2806
+ }), this.lineSegmentList = e;
2807
+ }
2808
+ resultList = [];
2809
+ mergeWallLines = [];
2810
+ /** 线段分析
2811
+ * @description 判断两条线段距离是否较短且趋近平行,然后查找两条线段的重合部分的投影线,以此判断两根线是否需要合并
2812
+ * @param data
2813
+ */
2814
+ lineAnalysis() {
2815
+ this.buildQuadtree();
2816
+ const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
2817
+ e.forEach((i, r) => {
2818
+ const o = e[r], a = it.fromByLineSegment(o, this.width * 2, !1, -0.01);
2819
+ t.queryRect(a).map((l) => l.userData).filter((l) => l !== r).forEach((l) => {
2820
+ try {
2821
+ if (n.has(`${r}-${l}`) || n.has(`${l}-${r}`)) return;
2822
+ const h = this.projectionAnalysis(l, r, o, e);
2823
+ h && s.push(h), n.add(`${r}-${l}`);
2824
+ } catch {
2825
+ }
2826
+ });
2827
+ }), this.appendLineSegmentList.length = 0, s.forEach(this.createRectangle.bind(this)), this.resultList = s;
2828
+ }
2829
+ /** 线段投影分析
2830
+ * @param index
2831
+ * @param sourceLineSegment
2832
+ * @param lineSegmentList
2833
+ * @returns
2834
+ */
2835
+ projectionAnalysis(t, e, n, s) {
2836
+ const i = s[t], r = n.direction(), o = i.direction(), a = r.angleBetween(o) / (Math.PI / 180);
2837
+ if (a < this.errorAngle || a > 180 - this.errorAngle) {
2838
+ let c;
2839
+ const l = i.projectLineSegment(n), h = n.projectLineSegment(i);
2840
+ return l.getLength() > h.getLength() ? c = {
2841
+ target: i,
2842
+ targetIndex: t,
2843
+ source: n,
2844
+ sourceIndex: e,
2845
+ project: l,
2846
+ project2: h
2847
+ } : c = {
2848
+ target: n,
2849
+ targetIndex: e,
2850
+ source: i,
2851
+ sourceIndex: t,
2852
+ project: h,
2853
+ project2: l
2854
+ }, !c || c.project.getLength() < 0.2 || c.project2.getLength() < 0.2 ? void 0 : c;
2855
+ }
2856
+ }
2857
+ }
2858
+ function vt(u, t, e = 1e-3) {
2859
+ if (Array.isArray(u) && u[0] instanceof M) {
2860
+ const s = u;
2861
+ u = s.map((i, r) => {
2862
+ const o = s[(r + 1) % s.length];
2863
+ return new L(i, o);
2864
+ });
2865
+ }
2866
+ if (u instanceof L) return vt([u], t, e);
2867
+ const n = $.finalInstance;
2868
+ if (n) {
2869
+ const s = n.findComponentByName("Renderer"), i = n.findComponentByName("Editor"), r = s.createLineSegments(u, 0, t, i?.container);
2870
+ return r.position.z = e, r;
2871
+ }
2872
+ }
2873
+ function Ee(u, t, e = 1e-3) {
2874
+ const n = $.finalInstance;
2875
+ if (n) {
2876
+ const s = n.findComponentByName("Renderer"), i = n.findComponentByName("Editor"), r = s.createCircle(u, t, i?.container);
2877
+ return r.position.z = e, r;
2878
+ }
2879
+ }
2880
+ class Ae {
2674
2881
  // 所有可查找的点位
2675
2882
  possibleDoorPoints = [];
2676
2883
  doorPoint = [];
2677
2884
  calculatedDoorPoint = [];
2678
2885
  dxf;
2679
2886
  // 包含所有点的虚拟网格
2680
- pointVirtualGrid = new X();
2887
+ pointVirtualGrid = new k();
2681
2888
  // 只包含可查找点的虚拟网格
2682
2889
  findPointVirtualGrid;
2683
2890
  quadtree;
@@ -2690,7 +2897,7 @@ class Se {
2690
2897
  lineAnalysis;
2691
2898
  continueFind = !0;
2692
2899
  constructor(t) {
2693
- 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) => {
2900
+ this.lineAnalysis = t, this.dxf = t.Dxf, this.findPointVirtualGrid = new k(), this.quadtree = t.quadtree, this.resultList = t.resultList, this.lineSegments = t.lineSegmentList, this.dxf.doorLineSegment.length = 0, this.lineSegments.forEach((i) => {
2694
2901
  this.pointVirtualGrid.insert(i.start, i), this.pointVirtualGrid.insert(i.end, i);
2695
2902
  });
2696
2903
  const { doorPoints: e, calculatedDoorPoint: n } = this.getDoorPoint();
@@ -2730,15 +2937,15 @@ class Se {
2730
2937
  );
2731
2938
  const a = [];
2732
2939
  return o.forEach((c) => {
2733
- const l = new A(c?.start, c?.end), h = l.length();
2940
+ const l = new L(c?.start, c?.end), h = l.length();
2734
2941
  if (h < n) return;
2735
2942
  const d = l.normal(), f = l.direction(), p = (h - r.width * 2) / 2;
2736
2943
  for (let y = 0; y < 3; y++) {
2737
- const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), m = new A(
2944
+ const x = l.start.clone().add(f.clone().multiplyScalar(r.width + p * y)), g = new L(
2738
2945
  x,
2739
2946
  x.clone().add(d.clone().multiplyScalar(1))
2740
2947
  );
2741
- if (m.directionMove(d, -0.5), this.quadtree.queryLineSegment(m).length) return;
2948
+ if (g.directionMove(d, -0.5), this.quadtree.queryLineSegment(g).length) return;
2742
2949
  }
2743
2950
  a.push(l);
2744
2951
  }), a;
@@ -2758,7 +2965,7 @@ class Se {
2758
2965
  return this.lineSegments.forEach((e) => {
2759
2966
  e.points.forEach((n, s) => {
2760
2967
  for (let r = 0; r < this._pointsExcludeRule.length; r++) if (this._pointsExcludeRule[r](e, n, s)) return;
2761
- this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: K() });
2968
+ this.pointVirtualGrid.queryPoint(n).filter((r) => r.userData !== e).length === 0 && t.push({ line: e, point: n, uuid: Z() });
2762
2969
  });
2763
2970
  }), t;
2764
2971
  }
@@ -2771,7 +2978,7 @@ class Se {
2771
2978
  const r = n.lineSegments[i[4]], o = n.originalData[i[4]];
2772
2979
  if (o.doorDirectConnection) {
2773
2980
  this.continueFind = !1;
2774
- const a = new A(M.from(o.start), M.from(o.end));
2981
+ const a = new L(M.from(o.start), M.from(o.end));
2775
2982
  a.userData = {
2776
2983
  doorDirectConnection: !0,
2777
2984
  isDoor: !0
@@ -2780,7 +2987,7 @@ class Se {
2780
2987
  l.length && e.push({
2781
2988
  line: l[0].userData,
2782
2989
  point: l[0].point,
2783
- uuid: K()
2990
+ uuid: Z()
2784
2991
  });
2785
2992
  });
2786
2993
  } else if (o.drawDoorData) {
@@ -2794,7 +3001,7 @@ class Se {
2794
3001
  l.length && t.push({
2795
3002
  line: l[0].userData,
2796
3003
  point: a,
2797
- uuid: K()
3004
+ uuid: Z()
2798
3005
  });
2799
3006
  } else
2800
3007
  console.warn(`门的线段顺序${i[4]} 没有drawDoorData属性`);
@@ -2821,83 +3028,85 @@ class Se {
2821
3028
  */
2822
3029
  searchNearby(t, e = [], n = this.doorSearchDistance, s = this.doorSearchNearAngle) {
2823
3030
  const i = this.findPointVirtualGrid, r = this.quadtree;
2824
- function o({ point: x, line: m }, D, w) {
2825
- const g = m.direction();
2826
- m.start === x && g.multiplyScalar(-1);
2827
- const S = i.queryCircle(x, n).filter((L) => L.userData !== m).sort((L, b) => L.point.distance(x) - b.point.distance(x)), E = [];
2828
- for (let L = 0; L < S.length; L++) {
2829
- const b = e.findIndex((O) => O.point === S[L].point), R = t[D].uuid, P = e[b].uuid;
2830
- if (w.has(`${R}.${P}`)) continue;
2831
- w.add(`${R}.${P}`), w.add(`${P}.${R}`);
2832
- const B = S[L].point, C = new A(x.clone(), B.clone());
2833
- if (C.direction().angleBetween(g, "angle") < s) {
2834
- const O = t[D].line.direction(), v = S[L].userData;
2835
- 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({
2836
- findData: S[L],
2837
- findUuid: P,
2838
- doorLine: C,
2839
- doorUuid: R
3031
+ function o({ point: x, line: g }, w, D) {
3032
+ const m = g.direction();
3033
+ g.start === x && m.multiplyScalar(-1);
3034
+ const S = i.queryCircle(x, n).filter((E) => E.userData !== g).sort((E, A) => E.point.distance(x) - A.point.distance(x)), T = [];
3035
+ for (let E = 0; E < S.length; E++) {
3036
+ const A = e.findIndex((O) => O.point === S[E].point);
3037
+ if (A === -1) continue;
3038
+ const v = t[w].uuid, C = e[A].uuid;
3039
+ if (D.has(`${v}.${C}`)) continue;
3040
+ D.add(`${v}.${C}`), D.add(`${C}.${v}`);
3041
+ const F = S[E].point, N = new L(x.clone(), F.clone());
3042
+ if (N.direction().angleBetween(m, "angle") < s) {
3043
+ const O = t[w].line.direction(), R = S[E].userData;
3044
+ R.start.equal(S[E].point) && O.multiplyScalar(-1), N.direction().multiplyScalar(-1).angleBetween(O, "angle") < s && (r.queryLineSegment(N).filter((W) => !(W.line.start.equal(x) || W.line.end.equal(x) || W.line === R)).length || T.push({
3045
+ findData: S[E],
3046
+ findUuid: C,
3047
+ doorLine: N,
3048
+ doorUuid: v
2840
3049
  }));
2841
3050
  }
2842
3051
  }
2843
- return E;
3052
+ return T;
2844
3053
  }
2845
- function a(x, m, D, w, g) {
2846
- w.add(x);
3054
+ function a(x, g, w, D, m) {
3055
+ D.add(x);
2847
3056
  const S = [];
2848
- g && S.push(g);
2849
- for (let E = 0; E < D.length; E++) {
2850
- const L = D[E];
2851
- if (m.has(L.findUuid)) {
2852
- const b = m.get(L.findUuid);
2853
- a(L.findUuid, m, b, w, L) && S.push(L);
2854
- } else S.push(L);
3057
+ m && S.push(m);
3058
+ for (let T = 0; T < w.length; T++) {
3059
+ const E = w[T];
3060
+ if (g.has(E.findUuid)) {
3061
+ const A = g.get(E.findUuid);
3062
+ a(E.findUuid, g, A, D, E) && S.push(E);
3063
+ } else S.push(E);
2855
3064
  }
2856
- return S.sort((E, L) => E.doorLine.length() - L.doorLine.length()), g && S[0] === g ? (D.splice(0), !0) : (D.splice(1), !1);
3065
+ return S.sort((T, E) => T.doorLine.length() - E.doorLine.length()), m && S[0] === m ? (w.splice(0), !0) : (w.splice(1), !1);
2857
3066
  }
2858
3067
  const c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
2859
- t.map((x, m) => {
2860
- const D = o(x, m, c);
2861
- D.length && l.set(x.uuid, D);
3068
+ t.map((x, g) => {
3069
+ const w = o(x, g, c);
3070
+ w.length && l.set(x.uuid, w);
2862
3071
  }), c.clear();
2863
3072
  const h = /* @__PURE__ */ new Map();
2864
- l.forEach((x, m) => {
2865
- if (!c.has(m) && x.length && a(m, l, x, c), x.length) {
2866
- const D = x[0];
2867
- 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);
3073
+ l.forEach((x, g) => {
3074
+ if (!c.has(g) && x.length && a(g, l, x, c), x.length) {
3075
+ const w = x[0];
3076
+ 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);
2868
3077
  }
2869
3078
  });
2870
3079
  const d = /* @__PURE__ */ new Set();
2871
3080
  h.forEach((x) => {
2872
3081
  if (x.length > 1) {
2873
- x.sort((m, D) => m.doorLine.length() - D.doorLine.length());
2874
- for (let m = 1; m < x.length; m++) d.add(x[m]);
3082
+ x.sort((g, w) => g.doorLine.length() - w.doorLine.length());
3083
+ for (let g = 1; g < x.length; g++) d.add(x[g]);
2875
3084
  }
2876
3085
  });
2877
3086
  const f = [], p = [];
2878
3087
  l.forEach((x) => {
2879
3088
  if (x.length) {
2880
- const m = x[0];
2881
- d.has(m) || (f.push(m), p.push(m.doorUuid, m.findUuid));
3089
+ const g = x[0];
3090
+ d.has(g) || (f.push(g), p.push(g.doorUuid, g.findUuid));
2882
3091
  }
2883
3092
  });
2884
3093
  const y = [];
2885
3094
  return f.forEach((x) => {
2886
- 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);
2887
- if (L) {
2888
- w.copy(L);
2889
- const b = new A(w, g), R = E.includedAngle(b);
2890
- (R < 10 || R > 170 || Math.abs(90 - R) < 10) && y.push({
2891
- start: w,
2892
- end: g
3095
+ const g = t.findIndex((A) => A.uuid === x.doorUuid), w = e.findIndex((A) => A.uuid === x.findUuid), D = t[g].point.clone(), m = e[w].point.clone(), S = this.findLongLineSegment(t[g].line), T = this.findLongLineSegment(e[w].line), E = S.projectPoint(m);
3096
+ if (E) {
3097
+ D.copy(E);
3098
+ const A = new L(D, m), v = T.includedAngle(A);
3099
+ (v < 10 || v > 170 || Math.abs(90 - v) < 10) && y.push({
3100
+ start: D,
3101
+ end: m
2893
3102
  });
2894
3103
  } else {
2895
- const b = E.projectPoint(w);
2896
- b && g.copy(b);
2897
- const R = new A(w, g), P = S.includedAngle(R);
2898
- (P < 10 || P > 170 || Math.abs(90 - P) < 10) && y.push({
2899
- start: w,
2900
- end: g
3104
+ const A = T.projectPoint(D);
3105
+ A && m.copy(A);
3106
+ const v = new L(D, m), C = S.includedAngle(v);
3107
+ (C < 10 || C > 170 || Math.abs(90 - C) < 10) && y.push({
3108
+ start: D,
3109
+ end: m
2901
3110
  });
2902
3111
  }
2903
3112
  }), e.splice(
@@ -2918,7 +3127,7 @@ class Se {
2918
3127
  searchAlongDirection({ point: t, line: e }, n = this.doorSearchDistance) {
2919
3128
  const s = this.quadtree, i = e.direction();
2920
3129
  e.start === t && i.multiplyScalar(-1);
2921
- const r = t.clone().add(i.clone().multiplyScalar(n)), o = new A(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
3130
+ const r = t.clone().add(i.clone().multiplyScalar(n)), o = new L(t.clone(), r), a = s.queryLineSegment(o).map((c) => ({
2922
3131
  point: c.line.getIntersection(o),
2923
3132
  line: c.line
2924
3133
  })).filter((c) => c.point).sort((c, l) => t.distance(c.point) - t.distance(l.point));
@@ -2945,7 +3154,7 @@ class Se {
2945
3154
  break;
2946
3155
  }
2947
3156
  }
2948
- const l = new A(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((d) => ({
3157
+ const l = new L(t.clone(), t.clone().add(o.multiplyScalar(n))), h = i.queryLineSegment(l).map((d) => ({
2949
3158
  point: d.line.getIntersection(l),
2950
3159
  line: d.line
2951
3160
  })).filter((d) => d.point).sort((d, f) => t.distance(d.point) - t.distance(f.point));
@@ -2979,143 +3188,25 @@ class Se {
2979
3188
  return e;
2980
3189
  }
2981
3190
  }
2982
- class De extends _ {
2983
- static name = "LineAnalysis";
2984
- Dxf = null;
2985
- Variable = null;
2986
- lineSegmentList = [];
2987
- container = new I.Group();
2988
- // 误差角度
2989
- errorAngle = 4;
2990
- width = 0.4;
3191
+ class Te extends z {
3192
+ doorSearchNearAngle = 110;
3193
+ doorSearchDistance = 2;
3194
+ DoorsAnalysis;
3195
+ skipFindDoor = !1;
3196
+ needsSaveDoor = !1;
3197
+ doors = [];
2991
3198
  /**
2992
3199
  *
2993
3200
  * @param parent
2994
3201
  */
2995
3202
  onAddFromParent(t) {
2996
- 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));
2997
- }
2998
- /**
2999
- *
3000
- * @param p1
3001
- * @param p2
3002
- * @param width
3003
- * @returns
3004
- */
3005
- expandLineSegment(t, e, n = 0.1) {
3006
- const s = e.normal(t), i = e.direction(t).mutiplyScalar(n * 0.5), r = t.direction(e).mutiplyScalar(n * 0.5), o = s.x * n * 0.5, a = s.y * n * 0.5;
3007
- return {
3008
- points: [
3009
- // 第一条线
3010
- new M(t.x + o, t.y + a).add(r),
3011
- new M(e.x + o, e.y + a).add(i),
3012
- // 第二条线
3013
- new M(t.x - o, t.y - a).add(r),
3014
- new M(e.x - o, e.y - a).add(i)
3015
- ],
3016
- indices: [0, 1, 1, 3, 3, 2, 2, 0],
3017
- rectIndices: [0, 1, 3, 2, 0]
3018
- };
3019
- }
3020
- appendLineSegmentList = [];
3021
- /**
3022
- * 追加数据
3023
- * @param p1
3024
- * @param p2
3025
- */
3026
- addData(t, e) {
3027
- const n = this.Dxf;
3028
- n.data.push([t.clone(), e.clone(), [], !1, n.data.length]), this.appendLineSegmentList.push(new A(t.clone(), e.clone()));
3029
- }
3030
- /** 结果分析创建矩形
3031
- * @param result
3032
- */
3033
- createRectangle(t) {
3034
- const e = this.Dxf, n = t.project, s = t.project2;
3035
- 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]);
3036
- 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]), d = n.points[0].clone(), f = n.points[1].clone(), p = f.direction(d);
3037
- p.multiplyScalar(e.width * 0.5);
3038
- const y = d.clone().add(p), x = f.clone().add(p.multiplyScalar(-1)), m = d.direction(f), D = y.direction(x);
3039
- 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)) {
3040
- d.set(y.x, y.y), f.set(x.x, x.y);
3041
- for (let w = 1; w < o; w++) {
3042
- const g = l.clone().multiplyScalar(a * w), S = h.clone().multiplyScalar(c * w), E = d.clone().add(g), L = f.clone().add(S);
3043
- this.addData(E, L);
3044
- }
3045
- }
3046
- }
3047
- quadtree;
3048
- /**
3049
- * 构建线段四叉树,快速查找,
3050
- */
3051
- buildQuadtree() {
3052
- const t = this.Dxf, e = [];
3053
- this.quadtree = new F(t.originalBox, 2), t.lineSegments.forEach((n) => {
3054
- n.userData?.isDoor || (this.quadtree?.insert({
3055
- line: n,
3056
- userData: e.length
3057
- }), e.push(n));
3058
- }), this.lineSegmentList = e;
3059
- }
3060
- resultList = [];
3061
- mergeWallLines = [];
3062
- /** 线段分析
3063
- * @description 判断两条线段距离是否较短且趋近平行,然后查找两条线段的重合部分的投影线,以此判断两根线是否需要合并
3064
- * @param data
3065
- */
3066
- lineAnalysis() {
3067
- this.buildQuadtree();
3068
- const t = this.quadtree, e = this.lineSegmentList, n = /* @__PURE__ */ new Set(), s = [];
3069
- e.forEach((i, r) => {
3070
- const o = e[r], a = nt.fromByLineSegment(o, this.width * 2, !1, -0.01);
3071
- t.queryRect(a).map((l) => l.userData).filter((l) => l !== r).forEach((l) => {
3072
- try {
3073
- if (n.has(`${r}-${l}`) || n.has(`${l}-${r}`)) return;
3074
- const h = this.projectionAnalysis(l, r, o, e);
3075
- h && s.push(h), n.add(`${r}-${l}`);
3076
- } catch {
3077
- }
3078
- });
3079
- }), this.appendLineSegmentList.length = 0, s.forEach(this.createRectangle.bind(this)), this.resultList = s;
3080
- }
3081
- /** 线段投影分析
3082
- * @param index
3083
- * @param sourceLineSegment
3084
- * @param lineSegmentList
3085
- * @returns
3086
- */
3087
- projectionAnalysis(t, e, n, s) {
3088
- const i = s[t], r = n.direction(), o = i.direction(), a = r.angleBetween(o) / (Math.PI / 180);
3089
- if (a < this.errorAngle || a > 180 - this.errorAngle) {
3090
- let c;
3091
- const l = i.projectLineSegment(n), h = n.projectLineSegment(i);
3092
- return l.getLength() > h.getLength() ? c = {
3093
- target: i,
3094
- targetIndex: t,
3095
- source: n,
3096
- sourceIndex: e,
3097
- project: l,
3098
- project2: h
3099
- } : c = {
3100
- target: n,
3101
- targetIndex: e,
3102
- source: i,
3103
- sourceIndex: t,
3104
- project: h,
3105
- project2: l
3106
- }, !c || c.project.getLength() < 0.2 || c.project2.getLength() < 0.2 ? void 0 : c;
3107
- }
3108
- }
3109
- doorSearchNearAngle = 110;
3110
- doorSearchDistance = 2;
3111
- doors = [];
3112
- DoorsAnalysis;
3113
- skipFindDoor = !1;
3114
- doorsAnalysis() {
3115
- this.skipFindDoor || (this.DoorsAnalysis = new Se(this), this.skipFindDoor = !1), this.dispatchEvent({ type: "analysisCompleted" });
3203
+ const e = t.findComponentByType(Y), n = this.parent?.findComponentByType(Rt);
3204
+ e.addEventListener("createGroup", () => {
3205
+ this.skipFindDoor ? this.needsSaveDoor && (this.doors = e.doors.map((s) => e.lineSegments[s[4]])) : this.DoorsAnalysis = new Ae(n), this.skipFindDoor = !1, this.dispatchEvent({ type: "analysisCompleted" });
3206
+ });
3116
3207
  }
3117
3208
  }
3118
- class Le extends _ {
3209
+ class be extends z {
3119
3210
  static name = "ThreeVJia";
3120
3211
  lineSegments = [];
3121
3212
  onAddFromParent() {
@@ -3127,8 +3218,8 @@ class Le extends _ {
3127
3218
  t.resultList.forEach((l) => {
3128
3219
  const h = s.get(l.target) ?? [], d = s.get(l.source) ?? [], f = l.project.clone(), p = l.project2.clone();
3129
3220
  f.includedAngle(p) > 135 && (p.points = [p.points[1], p.points[0]]), h.push(...f.points), d.push(...p.points), s.set(l.target, h), s.set(l.source, d);
3130
- const y = new A(f.start, p.start), x = new A(f.end, p.end), m = new A(y.center, x.center);
3131
- m.userData.wallWidth = Math.max(y.length(), x.length()), r.push(m);
3221
+ const y = new L(f.start, p.start), x = new L(f.end, p.end), g = new L(y.center, x.center);
3222
+ g.userData.wallWidth = Math.max(y.length(), x.length()), r.push(g);
3132
3223
  });
3133
3224
  const a = [];
3134
3225
  i = i.filter((l) => {
@@ -3144,7 +3235,7 @@ class Le extends _ {
3144
3235
  const f = [];
3145
3236
  for (let p = 0; p < h.length; p++) {
3146
3237
  const y = h[p];
3147
- y.userData.type === "start" ? (f.length === 0 && (a.push(new A(d.start.clone(), y.clone())), d.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && d.start.copy(y));
3238
+ y.userData.type === "start" ? (f.length === 0 && (a.push(new L(d.start.clone(), y.clone())), d.start.copy(y)), f.push("start")) : (f.pop(), f.length === 0 && d.start.copy(y));
3148
3239
  }
3149
3240
  a.push(d);
3150
3241
  }
@@ -3235,13 +3326,15 @@ class Le extends _ {
3235
3326
  if (typeof window < "u") {
3236
3327
  const e = new Blob([JSON.stringify(this.toJson())]), n = document.createElement("a");
3237
3328
  n.href = URL.createObjectURL(e), n.download = t, n.click();
3238
- } else typeof global < "u" && (await Y("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
3329
+ } else typeof global < "u" && (await X("fs", !1)).writeFileSync(t, JSON.stringify(this.toJson()));
3239
3330
  }
3240
3331
  }
3241
- class ht extends se {
3332
+ class $ extends ie {
3242
3333
  Dxf;
3243
3334
  AngleCorrectionDxf;
3244
3335
  Variable;
3336
+ LineAnalysis;
3337
+ DoorsAnalysis;
3245
3338
  wallWidth;
3246
3339
  environment;
3247
3340
  static finalInstance;
@@ -3250,7 +3343,7 @@ class ht extends se {
3250
3343
  * @param scale 原始数据缩放比例
3251
3344
  */
3252
3345
  constructor(t = 0.1, e = 1) {
3253
- 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;
3346
+ super(), this.environment = typeof window < "u" ? "browser" : typeof global < "u" ? "node" : "unknown", this.wallWidth = t, this.Dxf = new Y(this.wallWidth, e), this.AngleCorrectionDxf = new Le(), this.Variable = new Pt(), this.LineAnalysis = new Rt(), this.DoorsAnalysis = new Te(), this.addComponent(this.Variable), this.addComponent(this.Dxf), this.addComponent(this.LineAnalysis), this.addComponent(this.DoorsAnalysis), this.addComponent(this.AngleCorrectionDxf), this.addComponent(new be()), $.finalInstance = this;
3254
3347
  }
3255
3348
  usePlugin(t) {
3256
3349
  return typeof t == "function" && t.call(this, this), this;
@@ -3270,12 +3363,12 @@ class ut {
3270
3363
  * @returns
3271
3364
  */
3272
3365
  static findExtWallByTraj(t, e, n = 0.4) {
3273
- const s = new F(N.fromByLineSegment(...t));
3366
+ const s = new B(P.fromByLineSegment(...t));
3274
3367
  return t.forEach((i) => s.insert({ line: i, userData: void 0 })), t = t.filter((i) => {
3275
3368
  const r = i.center, o = /* @__PURE__ */ new Set();
3276
3369
  for (const a of e) {
3277
3370
  if (o.size === 2) break;
3278
- const c = new A(r, a);
3371
+ const c = new L(r, a);
3279
3372
  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) {
3280
3373
  const h = i.pointPosition(a);
3281
3374
  h !== "on" && o.add(h);
@@ -3289,89 +3382,87 @@ class ut {
3289
3382
  * @param trajectoryPoints
3290
3383
  */
3291
3384
  static boundExtbyTraj(t, e, n = 0.12) {
3292
- function s(w, g) {
3293
- return g.queryLineSegment(w).filter((S) => S.line !== w).map(({ line: S }) => {
3294
- const E = { resultLine: S, type: "intersect", direction: "vertical", point: null, newLine: null };
3295
- w.sameEndpoint(S) && (E.type = "endpoint"), w.parallel(S) && (E.direction = "parallel");
3296
- const L = w.getSameEndpoint(S);
3297
- if (L) E.point = L[1];
3385
+ function s(g, w) {
3386
+ return w.queryLineSegment(g).filter((D) => D.line !== g).map(({ line: D }) => {
3387
+ const m = { resultLine: D, type: "intersect", direction: "vertical", point: null, newLine: null };
3388
+ g.sameEndpoint(D) && (m.type = "endpoint"), g.parallel(D) && (m.direction = "parallel");
3389
+ const S = g.getSameEndpoint(D);
3390
+ if (S) m.point = S[1];
3298
3391
  else {
3299
- const b = S.getIntersection(w);
3300
- b && (E.point = S.start.equal(b) ? S.start : S.end);
3392
+ const T = D.getIntersection(g);
3393
+ T && (m.point = D.start.equal(T) ? D.start : D.end);
3301
3394
  }
3302
- return E;
3395
+ return m;
3303
3396
  });
3304
3397
  }
3305
- function i(w) {
3306
- const g = w.userData.expandDirect;
3307
- if (g === "left") {
3308
- const S = w.getLeftDirection();
3309
- w.directionMove(S, n * 0.5);
3310
- } else if (g === "right") {
3311
- const S = w.getRightDirection();
3312
- w.directionMove(S, n * 0.5);
3398
+ function i(g) {
3399
+ const w = g.userData.expandDirect;
3400
+ if (w === "left") {
3401
+ const D = g.getLeftDirection();
3402
+ g.directionMove(D, n * 0.5);
3403
+ } else if (w === "right") {
3404
+ const D = g.getRightDirection();
3405
+ g.directionMove(D, n * 0.5);
3313
3406
  }
3314
3407
  }
3315
- function r({ resultLine: w, type: g, direction: S, point: E }, L, b, R) {
3316
- if (g === "intersect")
3317
- E && E.copy(L.projectPoint(E) ?? E);
3318
- else if (S === "vertical") {
3319
- if (E) {
3320
- const P = L.projectPoint(E, !1);
3321
- 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())));
3408
+ function r({ resultLine: g, type: w, direction: D, point: m }, S, T, E) {
3409
+ if (w === "intersect")
3410
+ m && m.copy(S.projectPoint(m) ?? m);
3411
+ else if (D === "vertical") {
3412
+ if (m) {
3413
+ const A = S.projectPoint(m, !1);
3414
+ m.copy(A), S.isPointOnSegment(A) || (S.start.distance(A) < S.end.distance(A) ? E.push(new L(A.clone(), S.start.clone())) : E.push(new L(A.clone(), S.end.clone())));
3322
3415
  }
3323
- } else if (!d.includes(w) && E) {
3324
- let P = L.projectPoint(E, !1), B;
3325
- if (L.start.distance(E) < L.end.distance(E) ? B = L.start : B = L.end, P) {
3326
- R.push(new A(E.clone(), P.clone()));
3327
- const C = new A(P.clone(), B.clone());
3328
- C.length() && R.push(C);
3416
+ } else if (!d.includes(g) && m) {
3417
+ let A = S.projectPoint(m, !1), v;
3418
+ if (S.start.distance(m) < S.end.distance(m) ? v = S.start : v = S.end, A) {
3419
+ E.push(new L(m.clone(), A.clone()));
3420
+ const C = new L(A.clone(), v.clone());
3421
+ C.length() && E.push(C);
3329
3422
  }
3330
3423
  }
3331
- b.update(w);
3424
+ T.update(g);
3332
3425
  }
3333
- const o = Object.keys(e).map((w) => M.from(e[w])), a = [];
3334
- let c = t.map(({ start: w, end: g, ...S }) => {
3335
- const E = new A(M.from(w), M.from(g));
3336
- return E.userData = S, a.push(w.z ?? 0, g.z ?? 0), E;
3426
+ const o = Object.keys(e).map((g) => M.from(e[g])), a = [];
3427
+ let c = t.map(({ start: g, end: w, ...D }) => {
3428
+ const m = new L(M.from(g), M.from(w));
3429
+ return m.userData = D, a.push(g.z ?? 0, w.z ?? 0), m;
3337
3430
  });
3338
- const l = a.reduce((w, g) => w + g, 0) / a.length;
3339
- let d = ut.findExtWallByTraj(c, o).filter((w) => w.userData.expandDirect);
3340
- c = c.filter((w) => !d.includes(w)), c.push(...d);
3341
- const p = this.parent?.findComponentByName("Renderer");
3342
- o.forEach((w) => p.createPointMesh(w, 0.05, {}).position.z = l), p.createLineSegments(d, 0, { color: 65280 }).position.z = l + 1e-3;
3343
- const y = A.groupBySamePointAndParallel(d), x = new F(N.fromByLineSegment(...c));
3344
- c.forEach((w) => w.userData.isDoor || x.insert(w));
3345
- const m = y.map((w) => w.flatMap((g) => s(g, x))), D = [];
3346
- return y.flatMap((w, g) => (w.forEach((E) => (i(E), x.update(E))), m[g].filter((E) => {
3347
- if (!d.includes(E.resultLine)) {
3348
- let L;
3349
- return Object.defineProperty(E, "newLine", {
3431
+ const l = a.reduce((g, w) => g + w, 0) / a.length;
3432
+ let d = ut.findExtWallByTraj(c, o).filter((g) => g.userData.expandDirect);
3433
+ c = c.filter((g) => !d.includes(g)), c.push(...d), vt(d, { color: 65280 }), Ee(o, { size: 6 });
3434
+ const f = L.groupBySamePointAndParallel(d), p = new B(P.fromByLineSegment(...c));
3435
+ c.forEach((g) => g.userData.isDoor || p.insert(g));
3436
+ const y = f.map((g) => g.flatMap((w) => s(w, p))), x = [];
3437
+ return f.flatMap((g, w) => (g.forEach((m) => (i(m), p.update(m))), y[w].filter((m) => {
3438
+ if (!d.includes(m.resultLine)) {
3439
+ let S;
3440
+ return Object.defineProperty(m, "newLine", {
3350
3441
  get() {
3351
- return L || (L = A.mergeLines(...w)), L;
3442
+ return S || (S = L.mergeLines(...g)), S;
3352
3443
  }
3353
3444
  }), !0;
3354
3445
  }
3355
- r(E, A.mergeLines(...w), x, D);
3356
- }))).reduce((w, g) => (w.has(g.resultLine) || w.set(g.resultLine, []), w.get(g.resultLine)?.push(g), w), /* @__PURE__ */ new Map()).forEach((w) => {
3357
- w.reduce((g, S) => (g.has(S.point) || g.set(S.point, []), g.get(S.point)?.push(S), g), /* @__PURE__ */ new Map()).forEach((g) => {
3358
- const S = /* @__PURE__ */ new Set();
3359
- for (let E = 0; E < g.length; E++) {
3360
- const L = g[E];
3361
- S.has(L.point) || (r(L, L.newLine, x, D), S.add(L.point));
3446
+ r(m, L.mergeLines(...g), p, x);
3447
+ }))).reduce((g, w) => (g.has(w.resultLine) || g.set(w.resultLine, []), g.get(w.resultLine)?.push(w), g), /* @__PURE__ */ new Map()).forEach((g) => {
3448
+ g.reduce((w, D) => (w.has(D.point) || w.set(D.point, []), w.get(D.point)?.push(D), w), /* @__PURE__ */ new Map()).forEach((w) => {
3449
+ const D = /* @__PURE__ */ new Set();
3450
+ for (let m = 0; m < w.length; m++) {
3451
+ const S = w[m];
3452
+ D.has(S.point) || (r(S, S.newLine, p, x), D.add(S.point));
3362
3453
  }
3363
3454
  });
3364
- }), c.push(...A.deduplication(D)), c.forEach((w) => w.userData.isWindow && tt(w)), c = lt(c), c = A.deduplication(c), J(c, l);
3455
+ }), c.push(...L.deduplication(x)), c.forEach((g) => g.userData.isWindow && nt(g)), c = et(c), c = L.deduplication(c), J(c, l);
3365
3456
  }
3366
3457
  }
3367
- const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3458
+ const fn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3368
3459
  __proto__: null,
3369
- AxisAlignCorr: Pt,
3460
+ AxisAlignCorr: It,
3370
3461
  BoundExt: ut,
3371
3462
  lineDataToOriginalData: J,
3372
- lineSegmentClipping: lt,
3373
- recomputedWindow: tt
3374
- }, Symbol.toStringTag, { value: "Module" })), St = {
3463
+ lineSegmentClipping: et,
3464
+ recomputedWindow: nt
3465
+ }, Symbol.toStringTag, { value: "Module" })), Mt = {
3375
3466
  POSITION: [
3376
3467
  "byte",
3377
3468
  "byte normalized",
@@ -3399,24 +3490,10 @@ const ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3399
3490
  "unsigned short"
3400
3491
  ]
3401
3492
  };
3402
- class et {
3493
+ class st {
3403
3494
  constructor() {
3404
3495
  this.textureUtils = null, this.pluginCallbacks = [], this.register(function(t) {
3405
- return new Be(t);
3406
- }), this.register(function(t) {
3407
- return new Oe(t);
3408
- }), this.register(function(t) {
3409
3496
  return new je(t);
3410
- }), this.register(function(t) {
3411
- return new ze(t);
3412
- }), this.register(function(t) {
3413
- return new qe(t);
3414
- }), this.register(function(t) {
3415
- return new _e(t);
3416
- }), this.register(function(t) {
3417
- return new Fe(t);
3418
- }), this.register(function(t) {
3419
- return new Ue(t);
3420
3497
  }), this.register(function(t) {
3421
3498
  return new Ge(t);
3422
3499
  }), this.register(function(t) {
@@ -3427,8 +3504,22 @@ class et {
3427
3504
  return new Xe(t);
3428
3505
  }), this.register(function(t) {
3429
3506
  return new Ve(t);
3507
+ }), this.register(function(t) {
3508
+ return new ze(t);
3509
+ }), this.register(function(t) {
3510
+ return new qe(t);
3511
+ }), this.register(function(t) {
3512
+ return new _e(t);
3430
3513
  }), this.register(function(t) {
3431
3514
  return new We(t);
3515
+ }), this.register(function(t) {
3516
+ return new He(t);
3517
+ }), this.register(function(t) {
3518
+ return new Je(t);
3519
+ }), this.register(function(t) {
3520
+ return new $e(t);
3521
+ }), this.register(function(t) {
3522
+ return new Ke(t);
3432
3523
  });
3433
3524
  }
3434
3525
  register(t) {
@@ -3441,7 +3532,7 @@ class et {
3441
3532
  return this.textureUtils = t, this;
3442
3533
  }
3443
3534
  parse(t, e, n, s) {
3444
- const i = new Ce(), r = [];
3535
+ const i = new Ue(), r = [];
3445
3536
  for (let o = 0, a = this.pluginCallbacks.length; o < a; o++)
3446
3537
  r.push(this.pluginCallbacks[o](i));
3447
3538
  i.setPlugins(r), i.setTextureUtils(this.textureUtils), i.writeAsync(t, e, s).catch(n);
@@ -3453,7 +3544,7 @@ class et {
3453
3544
  });
3454
3545
  }
3455
3546
  }
3456
- const T = {
3547
+ const b = {
3457
3548
  POINTS: 0,
3458
3549
  LINES: 1,
3459
3550
  LINE_LOOP: 2,
@@ -3477,34 +3568,34 @@ const T = {
3477
3568
  CLAMP_TO_EDGE: 33071,
3478
3569
  MIRRORED_REPEAT: 33648,
3479
3570
  REPEAT: 10497
3480
- }, it = "KHR_mesh_quantization", U = {};
3481
- U[Vt] = T.NEAREST;
3482
- U[Wt] = T.NEAREST_MIPMAP_NEAREST;
3483
- U[Ht] = T.NEAREST_MIPMAP_LINEAR;
3484
- U[Jt] = T.LINEAR;
3485
- U[$t] = T.LINEAR_MIPMAP_NEAREST;
3486
- U[Kt] = T.LINEAR_MIPMAP_LINEAR;
3487
- U[Zt] = T.CLAMP_TO_EDGE;
3488
- U[Qt] = T.REPEAT;
3489
- U[te] = T.MIRRORED_REPEAT;
3490
- const Dt = {
3571
+ }, ot = "KHR_mesh_quantization", U = {};
3572
+ U[Wt] = b.NEAREST;
3573
+ U[Ht] = b.NEAREST_MIPMAP_NEAREST;
3574
+ U[Jt] = b.NEAREST_MIPMAP_LINEAR;
3575
+ U[$t] = b.LINEAR;
3576
+ U[Kt] = b.LINEAR_MIPMAP_NEAREST;
3577
+ U[Zt] = b.LINEAR_MIPMAP_LINEAR;
3578
+ U[Qt] = b.CLAMP_TO_EDGE;
3579
+ U[te] = b.REPEAT;
3580
+ U[ee] = b.MIRRORED_REPEAT;
3581
+ const St = {
3491
3582
  scale: "scale",
3492
3583
  position: "translation",
3493
3584
  quaternion: "rotation",
3494
3585
  morphTargetInfluences: "weights"
3495
- }, Ee = new Ft(), Lt = 12, Ae = 1179937895, Te = 2, Et = 8, be = 1313821514, Ie = 5130562;
3586
+ }, Ie = new Ut(), Dt = 12, Pe = 1179937895, Re = 2, Lt = 8, ve = 1313821514, Ce = 5130562;
3496
3587
  function H(u, t) {
3497
3588
  return u.length === t.length && u.every(function(e, n) {
3498
3589
  return e === t[n];
3499
3590
  });
3500
3591
  }
3501
- function Pe(u) {
3592
+ function Ne(u) {
3502
3593
  return new TextEncoder().encode(u).buffer;
3503
3594
  }
3504
- function Re(u) {
3595
+ function Be(u) {
3505
3596
  return H(u.elements, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
3506
3597
  }
3507
- function ve(u, t, e) {
3598
+ function Oe(u, t, e) {
3508
3599
  const n = {
3509
3600
  min: new Array(u.itemSize).fill(Number.POSITIVE_INFINITY),
3510
3601
  max: new Array(u.itemSize).fill(Number.NEGATIVE_INFINITY)
@@ -3512,15 +3603,15 @@ function ve(u, t, e) {
3512
3603
  for (let s = t; s < t + e; s++)
3513
3604
  for (let i = 0; i < u.itemSize; i++) {
3514
3605
  let r;
3515
- u.itemSize > 4 ? r = u.array[s * u.itemSize + i] : (i === 0 ? r = u.getX(s) : i === 1 ? r = u.getY(s) : i === 2 ? r = u.getZ(s) : i === 3 && (r = u.getW(s)), u.normalized === !0 && (r = at.normalize(r, u.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3606
+ u.itemSize > 4 ? r = u.array[s * u.itemSize + i] : (i === 0 ? r = u.getX(s) : i === 1 ? r = u.getY(s) : i === 2 ? r = u.getZ(s) : i === 3 && (r = u.getW(s)), u.normalized === !0 && (r = lt.normalize(r, u.array))), n.min[i] = Math.min(n.min[i], r), n.max[i] = Math.max(n.max[i], r);
3516
3607
  }
3517
3608
  return n;
3518
3609
  }
3519
- function vt(u) {
3610
+ function Ct(u) {
3520
3611
  return Math.ceil(u / 4) * 4;
3521
3612
  }
3522
- function rt(u, t = 0) {
3523
- const e = vt(u.byteLength);
3613
+ function at(u, t = 0) {
3614
+ const e = Ct(u.byteLength);
3524
3615
  if (e !== u.byteLength) {
3525
3616
  const n = new Uint8Array(e);
3526
3617
  if (n.set(new Uint8Array(u)), t !== 0)
@@ -3530,10 +3621,10 @@ function rt(u, t = 0) {
3530
3621
  }
3531
3622
  return u;
3532
3623
  }
3533
- function At() {
3624
+ function Et() {
3534
3625
  return typeof document > "u" && typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : document.createElement("canvas");
3535
3626
  }
3536
- function Ne(u, t) {
3627
+ function Fe(u, t) {
3537
3628
  if (typeof OffscreenCanvas < "u" && u instanceof OffscreenCanvas) {
3538
3629
  let e;
3539
3630
  return t === "image/jpeg" ? e = 0.92 : t === "image/webp" && (e = 0.8), u.convertToBlob({
@@ -3543,7 +3634,7 @@ function Ne(u, t) {
3543
3634
  } else
3544
3635
  return new Promise((e) => u.toBlob(e, t));
3545
3636
  }
3546
- class Ce {
3637
+ class Ue {
3547
3638
  constructor() {
3548
3639
  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 = {
3549
3640
  asset: {
@@ -3585,26 +3676,26 @@ class Ce {
3585
3676
  const s = this, i = s.buffers, r = s.json;
3586
3677
  n = s.options;
3587
3678
  const o = s.extensionsUsed, a = s.extensionsRequired, c = new Blob(i, { type: "application/octet-stream" }), l = Object.keys(o), h = Object.keys(a);
3588
- 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(d) {
3589
- const f = rt(d), p = new DataView(new ArrayBuffer(Et));
3590
- p.setUint32(0, f.byteLength, !0), p.setUint32(4, Ie, !0);
3591
- const y = rt(Pe(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Et));
3592
- x.setUint32(0, y.byteLength, !0), x.setUint32(4, be, !0);
3593
- const m = new ArrayBuffer(Lt), D = new DataView(m);
3594
- D.setUint32(0, Ae, !0), D.setUint32(4, Te, !0);
3595
- const w = Lt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3596
- D.setUint32(8, w, !0);
3597
- const g = new Blob([
3598
- m,
3679
+ 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 ? ct(c).then(function(d) {
3680
+ const f = at(d), p = new DataView(new ArrayBuffer(Lt));
3681
+ p.setUint32(0, f.byteLength, !0), p.setUint32(4, Ce, !0);
3682
+ const y = at(Ne(JSON.stringify(r)), 32), x = new DataView(new ArrayBuffer(Lt));
3683
+ x.setUint32(0, y.byteLength, !0), x.setUint32(4, ve, !0);
3684
+ const g = new ArrayBuffer(Dt), w = new DataView(g);
3685
+ w.setUint32(0, Pe, !0), w.setUint32(4, Re, !0);
3686
+ const D = Dt + x.byteLength + y.byteLength + p.byteLength + f.byteLength;
3687
+ w.setUint32(8, D, !0);
3688
+ const m = new Blob([
3689
+ g,
3599
3690
  x,
3600
3691
  y,
3601
3692
  p,
3602
3693
  f
3603
3694
  ], { type: "application/octet-stream" });
3604
- ot(g).then((S) => {
3695
+ ct(m).then((S) => {
3605
3696
  e(S);
3606
3697
  });
3607
- }) : r.buffers && r.buffers.length > 0 ? He(c).then((d) => {
3698
+ }) : r.buffers && r.buffers.length > 0 ? Ze(c).then((d) => {
3608
3699
  r.buffers[0].uri = d, e(r);
3609
3700
  }) : e(r);
3610
3701
  }
@@ -3652,7 +3743,7 @@ class Ce {
3652
3743
  */
3653
3744
  isNormalizedNormalAttribute(t) {
3654
3745
  if (this.cache.attributesNormalized.has(t)) return !1;
3655
- const n = new Z();
3746
+ const n = new Q();
3656
3747
  for (let s = 0, i = t.count; s < i; s++)
3657
3748
  if (Math.abs(n.fromBufferAttribute(t, s).length() - 1) > 5e-4) return !1;
3658
3749
  return !0;
@@ -3667,7 +3758,7 @@ class Ce {
3667
3758
  createNormalizedNormalAttribute(t) {
3668
3759
  const e = this.cache;
3669
3760
  if (e.attributesNormalized.has(t)) return e.attributesNormalized.get(t);
3670
- const n = t.clone(), s = new Z();
3761
+ const n = t.clone(), s = new Q();
3671
3762
  for (let i = 0, r = n.count; i < r; i++)
3672
3763
  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);
3673
3764
  return e.attributesNormalized.set(t, n), n;
@@ -3687,14 +3778,14 @@ class Ce {
3687
3778
  async buildMetalRoughTextureAsync(t, e) {
3688
3779
  if (t === e) return t;
3689
3780
  function n(f) {
3690
- return f.colorSpace === Xt ? function(y) {
3781
+ return f.colorSpace === Vt ? function(y) {
3691
3782
  return y < 0.04045 ? y * 0.0773993808 : Math.pow(y * 0.9478672986 + 0.0521327014, 2.4);
3692
3783
  } : function(y) {
3693
3784
  return y;
3694
3785
  };
3695
3786
  }
3696
- t instanceof st && (t = await this.decompressTextureAsync(t)), e instanceof st && (e = await this.decompressTextureAsync(e));
3697
- 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();
3787
+ t instanceof rt && (t = await this.decompressTextureAsync(t)), e instanceof rt && (e = await this.decompressTextureAsync(e));
3788
+ 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();
3698
3789
  a.width = r, a.height = o;
3699
3790
  const c = a.getContext("2d", {
3700
3791
  willReadFrequently: !0
@@ -3715,7 +3806,7 @@ class Ce {
3715
3806
  }
3716
3807
  c.putImageData(l, 0, 0);
3717
3808
  const d = (t || e).clone();
3718
- return d.source = new jt(a), d.colorSpace = zt, d.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."), d;
3809
+ return d.source = new zt(a), d.colorSpace = qt, d.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."), d;
3719
3810
  }
3720
3811
  async decompressTextureAsync(t, e = 1 / 0) {
3721
3812
  if (this.textureUtils === null)
@@ -3745,25 +3836,25 @@ class Ce {
3745
3836
  r.bufferViews || (r.bufferViews = []);
3746
3837
  let o;
3747
3838
  switch (e) {
3748
- case T.BYTE:
3749
- case T.UNSIGNED_BYTE:
3839
+ case b.BYTE:
3840
+ case b.UNSIGNED_BYTE:
3750
3841
  o = 1;
3751
3842
  break;
3752
- case T.SHORT:
3753
- case T.UNSIGNED_SHORT:
3843
+ case b.SHORT:
3844
+ case b.UNSIGNED_SHORT:
3754
3845
  o = 2;
3755
3846
  break;
3756
3847
  default:
3757
3848
  o = 4;
3758
3849
  }
3759
3850
  let a = t.itemSize * o;
3760
- i === T.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
3761
- const c = vt(s * a), l = new DataView(new ArrayBuffer(c));
3851
+ i === b.ARRAY_BUFFER && (a = Math.ceil(a / 4) * 4);
3852
+ const c = Ct(s * a), l = new DataView(new ArrayBuffer(c));
3762
3853
  let h = 0;
3763
3854
  for (let p = n; p < n + s; p++) {
3764
3855
  for (let y = 0; y < t.itemSize; y++) {
3765
3856
  let x;
3766
- 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;
3857
+ 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 = lt.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;
3767
3858
  }
3768
3859
  h % a !== 0 && (h += a - h % a);
3769
3860
  }
@@ -3772,7 +3863,7 @@ class Ce {
3772
3863
  byteOffset: this.byteOffset,
3773
3864
  byteLength: c
3774
3865
  };
3775
- return i !== void 0 && (d.target = i), i === T.ARRAY_BUFFER && (d.byteStride = a), this.byteOffset += c, r.bufferViews.push(d), {
3866
+ return i !== void 0 && (d.target = i), i === b.ARRAY_BUFFER && (d.byteStride = a), this.byteOffset += c, r.bufferViews.push(d), {
3776
3867
  id: r.bufferViews.length - 1,
3777
3868
  byteLength: 0
3778
3869
  };
@@ -3785,8 +3876,8 @@ class Ce {
3785
3876
  processBufferViewImage(t) {
3786
3877
  const e = this, n = e.json;
3787
3878
  return n.bufferViews || (n.bufferViews = []), new Promise(async function(s) {
3788
- ot(t).then((i) => {
3789
- const r = rt(i), o = {
3879
+ ct(t).then((i) => {
3880
+ const r = at(i), o = {
3790
3881
  buffer: e.processBuffer(r),
3791
3882
  byteOffset: e.byteOffset,
3792
3883
  byteLength: r.byteLength
@@ -3814,25 +3905,25 @@ class Ce {
3814
3905
  };
3815
3906
  let o;
3816
3907
  if (t.array.constructor === Float32Array)
3817
- o = T.FLOAT;
3908
+ o = b.FLOAT;
3818
3909
  else if (t.array.constructor === Int32Array)
3819
- o = T.INT;
3910
+ o = b.INT;
3820
3911
  else if (t.array.constructor === Uint32Array)
3821
- o = T.UNSIGNED_INT;
3912
+ o = b.UNSIGNED_INT;
3822
3913
  else if (t.array.constructor === Int16Array)
3823
- o = T.SHORT;
3914
+ o = b.SHORT;
3824
3915
  else if (t.array.constructor === Uint16Array)
3825
- o = T.UNSIGNED_SHORT;
3916
+ o = b.UNSIGNED_SHORT;
3826
3917
  else if (t.array.constructor === Int8Array)
3827
- o = T.BYTE;
3918
+ o = b.BYTE;
3828
3919
  else if (t.array.constructor === Uint8Array)
3829
- o = T.UNSIGNED_BYTE;
3920
+ o = b.UNSIGNED_BYTE;
3830
3921
  else
3831
3922
  throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: " + t.array.constructor.name);
3832
3923
  if (n === void 0 && (n = 0), (s === void 0 || s === 1 / 0) && (s = t.count), s === 0) return null;
3833
- const a = ve(t, n, s);
3924
+ const a = Oe(t, n, s);
3834
3925
  let c;
3835
- e !== void 0 && (c = t === e.index ? T.ELEMENT_ARRAY_BUFFER : T.ARRAY_BUFFER);
3926
+ e !== void 0 && (c = t === e.index ? b.ELEMENT_ARRAY_BUFFER : b.ARRAY_BUFFER);
3836
3927
  const l = this.processBufferView(t, o, n, s, c), h = {
3837
3928
  bufferView: l.id,
3838
3929
  byteOffset: l.byteOffset,
@@ -3859,26 +3950,26 @@ class Ce {
3859
3950
  const l = r.images.get(t), h = s + ":flipY/" + n.toString();
3860
3951
  if (l[h] !== void 0) return l[h];
3861
3952
  o.images || (o.images = []);
3862
- const d = { mimeType: s }, f = At();
3953
+ const d = { mimeType: s }, f = Et();
3863
3954
  f.width = Math.min(t.width, a.maxTextureSize), f.height = Math.min(t.height, a.maxTextureSize);
3864
3955
  const p = f.getContext("2d", {
3865
3956
  willReadFrequently: !0
3866
3957
  });
3867
3958
  if (n === !0 && (p.translate(0, f.height), p.scale(1, -1)), t.data !== void 0) {
3868
- 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);
3959
+ 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);
3869
3960
  const x = new Uint8ClampedArray(t.height * t.width * 4);
3870
- for (let m = 0; m < x.length; m += 4)
3871
- 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];
3961
+ for (let g = 0; g < x.length; g += 4)
3962
+ 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];
3872
3963
  p.putImageData(new ImageData(x, t.width, t.height), 0, 0);
3873
3964
  } 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)
3874
3965
  p.drawImage(t, 0, 0, f.width, f.height);
3875
3966
  else
3876
3967
  throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");
3877
3968
  a.binary === !0 ? c.push(
3878
- Ne(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3969
+ Fe(f, s).then((x) => i.processBufferViewImage(x)).then((x) => {
3879
3970
  d.bufferView = x;
3880
3971
  })
3881
- ) : d.uri = _t.getDataURL(f, s);
3972
+ ) : d.uri = Yt.getDataURL(f, s);
3882
3973
  const y = o.images.push(d) - 1;
3883
3974
  return l[h] = y, y;
3884
3975
  } else
@@ -3908,7 +3999,7 @@ class Ce {
3908
3999
  async processTextureAsync(t) {
3909
4000
  const n = this.options, s = this.cache, i = this.json;
3910
4001
  if (s.textures.has(t)) return s.textures.get(t);
3911
- i.textures || (i.textures = []), t instanceof st && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
4002
+ i.textures || (i.textures = []), t instanceof rt && (t = await this.decompressTextureAsync(t, n.maxTextureSize));
3912
4003
  let r = t.userData.mimeType;
3913
4004
  r === "image/webp" && (r = "image/png");
3914
4005
  const o = {
@@ -3973,7 +4064,7 @@ class Ce {
3973
4064
  };
3974
4065
  t.aoMapIntensity !== 1 && (o.strength = t.aoMapIntensity), this.applyTextureTransform(o, t.aoMap), s.occlusionTexture = o;
3975
4066
  }
3976
- 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) {
4067
+ t.transparent ? s.alphaMode = "BLEND" : t.alphaTest > 0 && (s.alphaMode = "MASK", s.alphaCutoff = t.alphaTest), t.side === kt && (s.doubleSided = !0), t.name !== "" && (s.name = t.name), this.serializeUserData(t, s), await this._invokeAllAsync(async function(o) {
3977
4068
  o.writeMaterialAsync && await o.writeMaterialAsync(t, s);
3978
4069
  });
3979
4070
  const r = n.materials.push(s) - 1;
@@ -3987,15 +4078,15 @@ class Ce {
3987
4078
  async processMeshAsync(t) {
3988
4079
  const e = this.cache, n = this.json, s = [t.geometry.uuid];
3989
4080
  if (Array.isArray(t.material))
3990
- for (let g = 0, S = t.material.length; g < S; g++)
3991
- s.push(t.material[g].uuid);
4081
+ for (let m = 0, S = t.material.length; m < S; m++)
4082
+ s.push(t.material[m].uuid);
3992
4083
  else
3993
4084
  s.push(t.material.uuid);
3994
4085
  const i = s.join(":");
3995
4086
  if (e.meshes.has(i)) return e.meshes.get(i);
3996
4087
  const r = t.geometry;
3997
4088
  let o;
3998
- 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;
4089
+ 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;
3999
4090
  const a = {}, c = {}, l = [], h = [], d = {
4000
4091
  uv: "TEXCOORD_0",
4001
4092
  uv1: "TEXCOORD_1",
@@ -4007,76 +4098,76 @@ class Ce {
4007
4098
  }, f = r.getAttribute("normal");
4008
4099
  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)));
4009
4100
  let p = null;
4010
- for (let g in r.attributes) {
4011
- if (g.slice(0, 5) === "morph") continue;
4012
- const S = r.attributes[g];
4013
- if (g = d[g] || g.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(g) || (g = "_" + g), e.attributes.has(this.getUID(S))) {
4014
- c[g] = e.attributes.get(this.getUID(S));
4101
+ for (let m in r.attributes) {
4102
+ if (m.slice(0, 5) === "morph") continue;
4103
+ const S = r.attributes[m];
4104
+ if (m = d[m] || m.toUpperCase(), /^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(m) || (m = "_" + m), e.attributes.has(this.getUID(S))) {
4105
+ c[m] = e.attributes.get(this.getUID(S));
4015
4106
  continue;
4016
4107
  }
4017
4108
  p = null;
4018
- const L = S.array;
4019
- 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));
4020
- const b = this.processAccessor(p || S, r);
4021
- b !== null && (g.startsWith("_") || this.detectMeshQuantization(g, S), c[g] = b, e.attributes.set(this.getUID(S), b));
4109
+ const E = S.array;
4110
+ m === "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) && !m.startsWith("_") && (console.warn(`GLTFExporter: Attribute "${m}" converted to type FLOAT.`), p = st.Utils.toFloat32BufferAttribute(S));
4111
+ const A = this.processAccessor(p || S, r);
4112
+ A !== null && (m.startsWith("_") || this.detectMeshQuantization(m, S), c[m] = A, e.attributes.set(this.getUID(S), A));
4022
4113
  }
4023
4114
  if (f !== void 0 && r.setAttribute("normal", f), Object.keys(c).length === 0) return null;
4024
4115
  if (t.morphTargetInfluences !== void 0 && t.morphTargetInfluences.length > 0) {
4025
- const g = [], S = [], E = {};
4116
+ const m = [], S = [], T = {};
4026
4117
  if (t.morphTargetDictionary !== void 0)
4027
- for (const L in t.morphTargetDictionary)
4028
- E[t.morphTargetDictionary[L]] = L;
4029
- for (let L = 0; L < t.morphTargetInfluences.length; ++L) {
4030
- const b = {};
4031
- let R = !1;
4032
- for (const P in r.morphAttributes) {
4033
- if (P !== "position" && P !== "normal") {
4034
- R || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), R = !0);
4118
+ for (const E in t.morphTargetDictionary)
4119
+ T[t.morphTargetDictionary[E]] = E;
4120
+ for (let E = 0; E < t.morphTargetInfluences.length; ++E) {
4121
+ const A = {};
4122
+ let v = !1;
4123
+ for (const C in r.morphAttributes) {
4124
+ if (C !== "position" && C !== "normal") {
4125
+ v || (console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."), v = !0);
4035
4126
  continue;
4036
4127
  }
4037
- const B = r.morphAttributes[P][L], C = P.toUpperCase(), G = r.attributes[P];
4038
- if (e.attributes.has(this.getUID(B, !0))) {
4039
- b[C] = e.attributes.get(this.getUID(B, !0));
4128
+ const F = r.morphAttributes[C][E], N = C.toUpperCase(), j = r.attributes[C];
4129
+ if (e.attributes.has(this.getUID(F, !0))) {
4130
+ A[N] = e.attributes.get(this.getUID(F, !0));
4040
4131
  continue;
4041
4132
  }
4042
- const O = B.clone();
4133
+ const O = F.clone();
4043
4134
  if (!r.morphTargetsRelative)
4044
- for (let v = 0, V = B.count; v < V; v++)
4045
- for (let j = 0; j < B.itemSize; j++)
4046
- 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));
4047
- b[C] = this.processAccessor(O, r), e.attributes.set(this.getUID(G, !0), b[C]);
4135
+ for (let R = 0, V = F.count; R < V; R++)
4136
+ for (let G = 0; G < F.itemSize; G++)
4137
+ G === 0 && O.setX(R, F.getX(R) - j.getX(R)), G === 1 && O.setY(R, F.getY(R) - j.getY(R)), G === 2 && O.setZ(R, F.getZ(R) - j.getZ(R)), G === 3 && O.setW(R, F.getW(R) - j.getW(R));
4138
+ A[N] = this.processAccessor(O, r), e.attributes.set(this.getUID(j, !0), A[N]);
4048
4139
  }
4049
- h.push(b), g.push(t.morphTargetInfluences[L]), t.morphTargetDictionary !== void 0 && S.push(E[L]);
4140
+ h.push(A), m.push(t.morphTargetInfluences[E]), t.morphTargetDictionary !== void 0 && S.push(T[E]);
4050
4141
  }
4051
- a.weights = g, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
4142
+ a.weights = m, S.length > 0 && (a.extras = {}, a.extras.targetNames = S);
4052
4143
  }
4053
4144
  const y = Array.isArray(t.material);
4054
4145
  if (y && r.groups.length === 0) return null;
4055
4146
  let x = !1;
4056
4147
  if (y && r.index === null) {
4057
- const g = [];
4058
- for (let S = 0, E = r.attributes.position.count; S < E; S++)
4059
- g[S] = S;
4060
- r.setIndex(g), x = !0;
4148
+ const m = [];
4149
+ for (let S = 0, T = r.attributes.position.count; S < T; S++)
4150
+ m[S] = S;
4151
+ r.setIndex(m), x = !0;
4061
4152
  }
4062
- const m = y ? t.material : [t.material], D = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4063
- for (let g = 0, S = D.length; g < S; g++) {
4064
- const E = {
4153
+ const g = y ? t.material : [t.material], w = y ? r.groups : [{ materialIndex: 0, start: void 0, count: void 0 }];
4154
+ for (let m = 0, S = w.length; m < S; m++) {
4155
+ const T = {
4065
4156
  mode: o,
4066
4157
  attributes: c
4067
4158
  };
4068
- if (this.serializeUserData(r, E), h.length > 0 && (E.targets = h), r.index !== null) {
4069
- let b = this.getUID(r.index);
4070
- (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;
4159
+ if (this.serializeUserData(r, T), h.length > 0 && (T.targets = h), r.index !== null) {
4160
+ let A = this.getUID(r.index);
4161
+ (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;
4071
4162
  }
4072
- const L = await this.processMaterialAsync(m[D[g].materialIndex]);
4073
- L !== null && (E.material = L), l.push(E);
4163
+ const E = await this.processMaterialAsync(g[w[m].materialIndex]);
4164
+ E !== null && (T.material = E), l.push(T);
4074
4165
  }
4075
- x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(g) {
4076
- g.writeMesh && g.writeMesh(t, a);
4166
+ x === !0 && r.setIndex(null), a.primitives = l, n.meshes || (n.meshes = []), await this._invokeAllAsync(function(m) {
4167
+ m.writeMesh && m.writeMesh(t, a);
4077
4168
  });
4078
- const w = n.meshes.push(a) - 1;
4079
- return e.meshes.set(i, w), w;
4169
+ const D = n.meshes.push(a) - 1;
4170
+ return e.meshes.set(i, D), D;
4080
4171
  }
4081
4172
  /**
4082
4173
  * If a vertex attribute with a
@@ -4090,7 +4181,7 @@ class Ce {
4090
4181
  * @param {THREE.BufferAttribute} attribute
4091
4182
  */
4092
4183
  detectMeshQuantization(t, e) {
4093
- if (this.extensionsUsed[it]) return;
4184
+ if (this.extensionsUsed[ot]) return;
4094
4185
  let n;
4095
4186
  switch (e.array.constructor) {
4096
4187
  case Int8Array:
@@ -4110,7 +4201,7 @@ class Ce {
4110
4201
  }
4111
4202
  e.normalized && (n += " normalized");
4112
4203
  const s = t.split("_", 1)[0];
4113
- St[s] && St[s].includes(n) && (this.extensionsUsed[it] = !0, this.extensionsRequired[it] = !0);
4204
+ Mt[s] && Mt[s].includes(n) && (this.extensionsUsed[ot] = !0, this.extensionsRequired[ot] = !0);
4114
4205
  }
4115
4206
  /**
4116
4207
  * Process camera
@@ -4130,7 +4221,7 @@ class Ce {
4130
4221
  znear: t.near < 0 ? 0 : t.near
4131
4222
  } : s.perspective = {
4132
4223
  aspectRatio: t.aspect,
4133
- yfov: at.degToRad(t.fov),
4224
+ yfov: lt.degToRad(t.fov),
4134
4225
  zfar: t.far <= 0 ? 1e-3 : t.far,
4135
4226
  znear: t.near < 0 ? 0 : t.near
4136
4227
  }, t.name !== "" && (s.name = t.type), e.cameras.push(s) - 1;
@@ -4147,23 +4238,23 @@ class Ce {
4147
4238
  */
4148
4239
  processAnimation(t, e) {
4149
4240
  const n = this.json, s = this.nodeMap;
4150
- n.animations || (n.animations = []), t = et.Utils.mergeMorphTargetTracks(t.clone(), e);
4241
+ n.animations || (n.animations = []), t = st.Utils.mergeMorphTargetTracks(t.clone(), e);
4151
4242
  const i = t.tracks, r = [], o = [];
4152
4243
  for (let c = 0; c < i.length; ++c) {
4153
- const l = i[c], h = Q.parseTrackName(l.name);
4154
- let d = Q.findNode(e, h.nodeName);
4155
- const f = Dt[h.propertyName];
4244
+ const l = i[c], h = tt.parseTrackName(l.name);
4245
+ let d = tt.findNode(e, h.nodeName);
4246
+ const f = St[h.propertyName];
4156
4247
  if (h.objectName === "bones" && (d.isSkinnedMesh === !0 ? d = d.skeleton.getBoneByName(h.objectIndex) : d = void 0), !d || !f) {
4157
4248
  console.warn('THREE.GLTFExporter: Could not export animation track "%s".', l.name);
4158
4249
  continue;
4159
4250
  }
4160
4251
  const p = 1;
4161
4252
  let y = l.values.length / l.times.length;
4162
- f === Dt.morphTargetInfluences && (y /= d.morphTargetInfluences.length);
4253
+ f === St.morphTargetInfluences && (y /= d.morphTargetInfluences.length);
4163
4254
  let x;
4164
- l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === kt ? x = "STEP" : x = "LINEAR", o.push({
4165
- input: this.processAccessor(new q(l.times, p)),
4166
- output: this.processAccessor(new q(l.values, y)),
4255
+ l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline === !0 ? (x = "CUBICSPLINE", y /= 3) : l.getInterpolation() === Xt ? x = "STEP" : x = "LINEAR", o.push({
4256
+ input: this.processAccessor(new _(l.times, p)),
4257
+ output: this.processAccessor(new _(l.values, y)),
4167
4258
  interpolation: x
4168
4259
  }), r.push({
4169
4260
  sampler: o.length - 1,
@@ -4189,11 +4280,11 @@ class Ce {
4189
4280
  if (i === void 0) return null;
4190
4281
  const r = t.skeleton.bones[0];
4191
4282
  if (r === void 0) return null;
4192
- const o = [], a = new Float32Array(i.bones.length * 16), c = new bt();
4283
+ const o = [], a = new Float32Array(i.bones.length * 16), c = new Tt();
4193
4284
  for (let h = 0; h < i.bones.length; ++h)
4194
4285
  o.push(n.get(i.bones[h])), c.copy(i.boneInverses[h]), c.multiply(t.bindMatrix).toArray(a, h * 16);
4195
4286
  return e.skins === void 0 && (e.skins = []), e.skins.push({
4196
- inverseBindMatrices: this.processAccessor(new q(a, 16)),
4287
+ inverseBindMatrices: this.processAccessor(new _(a, 16)),
4197
4288
  joints: o,
4198
4289
  skeleton: n.get(r)
4199
4290
  }), s.skin = e.skins.length - 1;
@@ -4211,7 +4302,7 @@ class Ce {
4211
4302
  const o = t.quaternion.toArray(), a = t.position.toArray(), c = t.scale.toArray();
4212
4303
  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);
4213
4304
  } else
4214
- t.matrixAutoUpdate && t.updateMatrix(), Re(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4305
+ t.matrixAutoUpdate && t.updateMatrix(), Be(t.matrix) === !1 && (i.matrix = t.matrix.elements);
4215
4306
  if (t.name !== "" && (i.name = String(t.name)), this.serializeUserData(t, i), t.isMesh || t.isLine || t.isPoints) {
4216
4307
  const o = await this.processMeshAsync(t);
4217
4308
  o !== null && (i.mesh = o);
@@ -4288,7 +4379,7 @@ class Ce {
4288
4379
  await t(this.plugins[e]);
4289
4380
  }
4290
4381
  }
4291
- class Be {
4382
+ class je {
4292
4383
  constructor(t) {
4293
4384
  this.writer = t, this.name = "KHR_lights_punctual";
4294
4385
  }
@@ -4304,7 +4395,7 @@ class Be {
4304
4395
  o.push(r), e.extensions = e.extensions || {}, e.extensions[this.name] = { light: o.length - 1 };
4305
4396
  }
4306
4397
  }
4307
- class Oe {
4398
+ class Ge {
4308
4399
  constructor(t) {
4309
4400
  this.writer = t, this.name = "KHR_materials_unlit";
4310
4401
  }
@@ -4314,7 +4405,7 @@ class Oe {
4314
4405
  e.extensions = e.extensions || {}, e.extensions[this.name] = {}, s[this.name] = !0, e.pbrMetallicRoughness.metallicFactor = 0, e.pbrMetallicRoughness.roughnessFactor = 0.9;
4315
4406
  }
4316
4407
  }
4317
- class Fe {
4408
+ class ze {
4318
4409
  constructor(t) {
4319
4410
  this.writer = t, this.name = "KHR_materials_clearcoat";
4320
4411
  }
@@ -4345,7 +4436,7 @@ class Fe {
4345
4436
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4346
4437
  }
4347
4438
  }
4348
- class Ue {
4439
+ class qe {
4349
4440
  constructor(t) {
4350
4441
  this.writer = t, this.name = "KHR_materials_dispersion";
4351
4442
  }
@@ -4355,7 +4446,7 @@ class Ue {
4355
4446
  i.dispersion = t.dispersion, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4356
4447
  }
4357
4448
  }
4358
- class Ge {
4449
+ class _e {
4359
4450
  constructor(t) {
4360
4451
  this.writer = t, this.name = "KHR_materials_iridescence";
4361
4452
  }
@@ -4379,7 +4470,7 @@ class Ge {
4379
4470
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4380
4471
  }
4381
4472
  }
4382
- class je {
4473
+ class Ye {
4383
4474
  constructor(t) {
4384
4475
  this.writer = t, this.name = "KHR_materials_transmission";
4385
4476
  }
@@ -4396,7 +4487,7 @@ class je {
4396
4487
  e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4397
4488
  }
4398
4489
  }
4399
- class ze {
4490
+ class ke {
4400
4491
  constructor(t) {
4401
4492
  this.writer = t, this.name = "KHR_materials_volume";
4402
4493
  }
@@ -4413,7 +4504,7 @@ class ze {
4413
4504
  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;
4414
4505
  }
4415
4506
  }
4416
- class qe {
4507
+ class Xe {
4417
4508
  constructor(t) {
4418
4509
  this.writer = t, this.name = "KHR_materials_ior";
4419
4510
  }
@@ -4423,12 +4514,12 @@ class qe {
4423
4514
  i.ior = t.ior, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4424
4515
  }
4425
4516
  }
4426
- class _e {
4517
+ class Ve {
4427
4518
  constructor(t) {
4428
4519
  this.writer = t, this.name = "KHR_materials_specular";
4429
4520
  }
4430
4521
  async writeMaterialAsync(t, e) {
4431
- if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Ee) && !t.specularIntensityMap && !t.specularColorMap) return;
4522
+ if (!t.isMeshPhysicalMaterial || t.specularIntensity === 1 && t.specularColor.equals(Ie) && !t.specularIntensityMap && !t.specularColorMap) return;
4432
4523
  const n = this.writer, s = n.extensionsUsed, i = {};
4433
4524
  if (t.specularIntensityMap) {
4434
4525
  const r = {
@@ -4447,7 +4538,7 @@ class _e {
4447
4538
  i.specularFactor = t.specularIntensity, i.specularColorFactor = t.specularColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4448
4539
  }
4449
4540
  }
4450
- class Ye {
4541
+ class We {
4451
4542
  constructor(t) {
4452
4543
  this.writer = t, this.name = "KHR_materials_sheen";
4453
4544
  }
@@ -4471,7 +4562,7 @@ class Ye {
4471
4562
  i.sheenRoughnessFactor = t.sheenRoughness, i.sheenColorFactor = t.sheenColor.toArray(), e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4472
4563
  }
4473
4564
  }
4474
- class ke {
4565
+ class He {
4475
4566
  constructor(t) {
4476
4567
  this.writer = t, this.name = "KHR_materials_anisotropy";
4477
4568
  }
@@ -4485,7 +4576,7 @@ class ke {
4485
4576
  i.anisotropyStrength = t.anisotropy, i.anisotropyRotation = t.anisotropyRotation, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4486
4577
  }
4487
4578
  }
4488
- class Xe {
4579
+ class Je {
4489
4580
  constructor(t) {
4490
4581
  this.writer = t, this.name = "KHR_materials_emissive_strength";
4491
4582
  }
@@ -4495,7 +4586,7 @@ class Xe {
4495
4586
  i.emissiveStrength = t.emissiveIntensity, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4496
4587
  }
4497
4588
  }
4498
- class Ve {
4589
+ class $e {
4499
4590
  constructor(t) {
4500
4591
  this.writer = t, this.name = "EXT_materials_bump";
4501
4592
  }
@@ -4512,24 +4603,24 @@ class Ve {
4512
4603
  i.bumpFactor = t.bumpScale, e.extensions = e.extensions || {}, e.extensions[this.name] = i, s[this.name] = !0;
4513
4604
  }
4514
4605
  }
4515
- class We {
4606
+ class Ke {
4516
4607
  constructor(t) {
4517
4608
  this.writer = t, this.name = "EXT_mesh_gpu_instancing";
4518
4609
  }
4519
4610
  writeNode(t, e) {
4520
4611
  if (!t.isInstancedMesh) return;
4521
- 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();
4612
+ 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 Tt(), c = new Q(), l = new jt(), h = new Q();
4522
4613
  for (let f = 0; f < s.count; f++)
4523
4614
  s.getMatrixAt(f, a), a.decompose(c, l, h), c.toArray(i, f * 3), l.toArray(r, f * 4), h.toArray(o, f * 3);
4524
4615
  const d = {
4525
- TRANSLATION: n.processAccessor(new q(i, 3)),
4526
- ROTATION: n.processAccessor(new q(r, 4)),
4527
- SCALE: n.processAccessor(new q(o, 3))
4616
+ TRANSLATION: n.processAccessor(new _(i, 3)),
4617
+ ROTATION: n.processAccessor(new _(r, 4)),
4618
+ SCALE: n.processAccessor(new _(o, 3))
4528
4619
  };
4529
4620
  s.instanceColor && (d._COLOR_0 = n.processAccessor(s.instanceColor)), e.extensions = e.extensions || {}, e.extensions[this.name] = { attributes: d }, n.extensionsUsed[this.name] = !0, n.extensionsRequired[this.name] = !0;
4530
4621
  }
4531
4622
  }
4532
- et.Utils = {
4623
+ st.Utils = {
4533
4624
  insertKeyframe: function(u, t) {
4534
4625
  const n = u.getValueSize(), s = new u.TimeBufferType(u.times.length + 1), i = new u.ValueBufferType(u.values.length + n), r = u.createInterpolant(new u.ValueBufferType(n));
4535
4626
  let o;
@@ -4559,7 +4650,7 @@ et.Utils = {
4559
4650
  const e = [], n = {}, s = u.tracks;
4560
4651
  for (let i = 0; i < s.length; ++i) {
4561
4652
  let r = s[i];
4562
- const o = Q.parseTrackName(r.name), a = Q.findNode(t, o.nodeName);
4653
+ const o = tt.parseTrackName(r.name), a = tt.findNode(t, o.nodeName);
4563
4654
  if (o.propertyName !== "morphTargetInfluences" || o.propertyIndex === void 0) {
4564
4655
  e.push(r);
4565
4656
  continue;
@@ -4567,7 +4658,7 @@ et.Utils = {
4567
4658
  if (r.createInterpolant !== r.InterpolantFactoryMethodDiscrete && r.createInterpolant !== r.InterpolantFactoryMethodLinear) {
4568
4659
  if (r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)
4569
4660
  throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");
4570
- console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(ee);
4661
+ console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."), r = r.clone(), r.setInterpolation(ne);
4571
4662
  }
4572
4663
  const c = a.morphTargetInfluences.length, l = a.morphTargetDictionary[o.propertyIndex];
4573
4664
  if (l === void 0)
@@ -4593,7 +4684,7 @@ et.Utils = {
4593
4684
  return u.tracks = e, u;
4594
4685
  },
4595
4686
  toFloat32BufferAttribute: function(u) {
4596
- const t = new q(new Float32Array(u.count * u.itemSize), u.itemSize, !1);
4687
+ const t = new _(new Float32Array(u.count * u.itemSize), u.itemSize, !1);
4597
4688
  if (!u.normalized && !u.isInterleavedBufferAttribute)
4598
4689
  return t.array.set(u.array), t;
4599
4690
  for (let e = 0, n = u.count; e < n; e++)
@@ -4602,7 +4693,7 @@ et.Utils = {
4602
4693
  return t;
4603
4694
  }
4604
4695
  };
4605
- async function He(u) {
4696
+ async function Ze(u) {
4606
4697
  if (typeof FileReader > "u") {
4607
4698
  const t = await u.arrayBuffer(), n = Buffer.from(t).toString("base64");
4608
4699
  return `data:${u.type};base64,${n}`;
@@ -4612,7 +4703,7 @@ async function He(u) {
4612
4703
  n.onload = () => t(n.result), n.onerror = () => e(new Error("Failed to read Blob as Data URL")), n.readAsDataURL(u);
4613
4704
  });
4614
4705
  }
4615
- async function ot(u) {
4706
+ async function ct(u) {
4616
4707
  if (typeof u.arrayBuffer == "function")
4617
4708
  return await u.arrayBuffer();
4618
4709
  if (typeof FileReader < "u")
@@ -4625,8 +4716,8 @@ async function ot(u) {
4625
4716
  return t.buffer.slice(t.byteOffset, t.byteOffset + t.byteLength);
4626
4717
  }
4627
4718
  }
4628
- const Je = new ne(), $e = new et();
4629
- function Ke(u, t, e = 0.1) {
4719
+ const Qe = new se(), tn = new st();
4720
+ function en(u, t, e = 0.1) {
4630
4721
  const n = t.normal(u), s = t.direction(u).mutiplyScalar(e * 0.5), i = u.direction(t).mutiplyScalar(e * 0.5), r = n.x * e * 0.5, o = n.y * e * 0.5;
4631
4722
  return {
4632
4723
  points: [
@@ -4641,7 +4732,7 @@ function Ke(u, t, e = 0.1) {
4641
4732
  rectIndices: [0, 1, 3, 2, 0]
4642
4733
  };
4643
4734
  }
4644
- class Nt extends _ {
4735
+ class Nt extends z {
4645
4736
  static name = "WhiteModel";
4646
4737
  Dxf = null;
4647
4738
  Variable = null;
@@ -4671,7 +4762,7 @@ class Nt extends _ {
4671
4762
  new I.LineSegments(new I.EdgesGeometry(i), new I.LineBasicMaterial({ color: 0 }))
4672
4763
  );
4673
4764
  }), t.originalData.map(({ start: n, end: s, insetionArr: i }) => {
4674
- 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);
4765
+ 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 } = en(r, o, t.width);
4675
4766
  return {
4676
4767
  points: a,
4677
4768
  indices: c,
@@ -4704,7 +4795,7 @@ class Nt extends _ {
4704
4795
  toOBJ() {
4705
4796
  return new Promise((t) => {
4706
4797
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(() => {
4707
- t(Je.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4798
+ t(Qe.parse(this.whiteModelGroup)), this.material.opacity = 0.8, this.material.transparent = !0;
4708
4799
  }, 20);
4709
4800
  });
4710
4801
  }
@@ -4716,7 +4807,7 @@ class Nt extends _ {
4716
4807
  toGltf(t = !0) {
4717
4808
  return new Promise((e) => {
4718
4809
  this.material.opacity = 1, this.material.needsUpdate = !0, setTimeout(async () => {
4719
- $e.parse(this.whiteModelGroup.children, (n) => {
4810
+ tn.parse(this.whiteModelGroup.children, (n) => {
4720
4811
  e(n), this.material.opacity = 0.8, this.material.transparent = !0;
4721
4812
  }, () => {
4722
4813
  e(void 0);
@@ -4757,7 +4848,7 @@ class Nt extends _ {
4757
4848
  n.href = URL.createObjectURL(e), n.download = t, n.click();
4758
4849
  } else if (typeof global < "u") {
4759
4850
  const e = await this.toOBJ();
4760
- e && (await Y("fs", !1)).writeFileSync(t, e);
4851
+ e && (await X("fs", !1)).writeFileSync(t, e);
4761
4852
  }
4762
4853
  }
4763
4854
  /**
@@ -4773,11 +4864,11 @@ class Nt extends _ {
4773
4864
  s.href = URL.createObjectURL(n), s.download = t, s.click();
4774
4865
  } else if (typeof global < "u") {
4775
4866
  const n = await this.toGltf(e);
4776
- n && (await Y("fs", !1)).writeFileSync(t, e ? Buffer.from(n) : JSON.stringify(n));
4867
+ n && (await X("fs", !1)).writeFileSync(t, e ? Buffer.from(n) : JSON.stringify(n));
4777
4868
  }
4778
4869
  }
4779
4870
  }
4780
- class Ct extends _ {
4871
+ class Bt extends z {
4781
4872
  static name = "DetailsPoint";
4782
4873
  Dxf = null;
4783
4874
  WhiteModel = null;
@@ -4854,7 +4945,7 @@ class Ct extends _ {
4854
4945
  }, 50);
4855
4946
  }
4856
4947
  }
4857
- class Bt extends _ {
4948
+ class Ot extends z {
4858
4949
  static name = "DxfLineModel";
4859
4950
  dxfLineModel = new I.LineSegments();
4860
4951
  dxfDoorsLineModel = new I.LineSegments();
@@ -4877,38 +4968,38 @@ class Bt extends _ {
4877
4968
  });
4878
4969
  }
4879
4970
  }
4880
- const Ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4971
+ const nn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4881
4972
  __proto__: null,
4882
- DetailsPoint: Ct,
4883
- DxfLineModel: Bt,
4973
+ DetailsPoint: Bt,
4974
+ DxfLineModel: Ot,
4884
4975
  WhiteModel: Nt
4885
4976
  }, Symbol.toStringTag, { value: "Module" }));
4886
- function Tt(u, t = {}) {
4977
+ function At(u, t = {}) {
4887
4978
  const {
4888
4979
  detailsPoint: e = !0,
4889
4980
  whiteModel: n = !0,
4890
4981
  dxfLineModel: s = !0
4891
4982
  } = t;
4892
- s && u.addComponent(new Bt()), n && u.addComponent(new Nt()), e && u.addComponent(new Ct());
4983
+ s && u.addComponent(new Ot()), n && u.addComponent(new Nt()), e && u.addComponent(new Bt());
4893
4984
  }
4894
- const Qe = Object.assign(Tt, {
4985
+ const sn = Object.assign(At, {
4895
4986
  create(u = {}) {
4896
- return (t) => Tt(t, u);
4987
+ return (t) => At(t, u);
4897
4988
  }
4898
- }), tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4989
+ }), rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4899
4990
  __proto__: null,
4900
- ModelDataPlugin: Qe,
4901
- components: Ze
4991
+ ModelDataPlugin: sn,
4992
+ components: nn
4902
4993
  }, Symbol.toStringTag, { value: "Module" }));
4903
- function en() {
4994
+ function on() {
4904
4995
  return import("./index2.js");
4905
4996
  }
4906
- function nn() {
4997
+ function an() {
4907
4998
  return import("./index3.js");
4908
4999
  }
4909
5000
  let dt = null;
4910
- async function hn(u, t, e = !1, n) {
4911
- const s = await Promise.resolve().then(() => tn), i = await en(), r = await nn(), o = new ht().usePlugin(s.ModelDataPlugin.create({
5001
+ async function pn(u, t, e = !1, n) {
5002
+ const s = await Promise.resolve().then(() => rn), i = await on(), r = await an(), o = new $().usePlugin(s.ModelDataPlugin.create({
4912
5003
  detailsPoint: !1,
4913
5004
  whiteModel: !0
4914
5005
  })).usePlugin(i.RenderPlugin.create({
@@ -4920,10 +5011,10 @@ async function hn(u, t, e = !1, n) {
4920
5011
  })).usePlugin(r.Editor.create({ viewPermission: n })), a = o.findComponentByType(i.components.DomContainer);
4921
5012
  return a && u.appendChild(a.domElement), dt = o, {
4922
5013
  dxfSystem: o,
4923
- getFileAll: () => sn(o)
5014
+ getFileAll: () => cn(o)
4924
5015
  };
4925
5016
  }
4926
- async function sn(u = dt) {
5017
+ async function cn(u = dt) {
4927
5018
  const t = u.findComponentByName("WhiteModel"), e = new File([await u.AngleCorrectionDxf.toDxfImageBlob()], "img.jpg", { type: "image/jpeg" }), n = new File([u.Dxf.toDxfBlob()], "dxf.dxf", { type: "application/dxf" }), s = new File([u.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(u.Dxf.originalData)], "json.json", { type: "application/json" });
4928
5019
  return {
4929
5020
  dxf: n,
@@ -4935,31 +5026,31 @@ async function sn(u = dt) {
4935
5026
  correctionDxf: s
4936
5027
  };
4937
5028
  }
4938
- function un() {
5029
+ function yn() {
4939
5030
  return dt;
4940
5031
  }
4941
5032
  export {
4942
- Pt as A,
4943
- N as B,
4944
- _ as C,
4945
- ht as D,
4946
- It as E,
4947
- A as L,
4948
- Qe as M,
5033
+ It as A,
5034
+ P as B,
5035
+ z as C,
5036
+ $ as D,
5037
+ bt as E,
5038
+ L,
5039
+ sn as M,
4949
5040
  M as P,
4950
- F as Q,
4951
- Le as T,
4952
- Rt as V,
5041
+ B as Q,
5042
+ be as T,
5043
+ Pt as V,
4953
5044
  Nt as W,
4954
- Ct as a,
4955
- X as b,
4956
- De as c,
4957
- hn as d,
4958
- un as e,
4959
- k as f,
4960
- sn as g,
4961
- ln as h,
4962
- Ze as i,
4963
- tt as r,
4964
- K as u
5045
+ Bt as a,
5046
+ k as b,
5047
+ Te as c,
5048
+ pn as d,
5049
+ yn as e,
5050
+ Y as f,
5051
+ cn as g,
5052
+ fn as h,
5053
+ nn as i,
5054
+ nt as r,
5055
+ Z as u
4965
5056
  };