@mlightcad/cad-simple-viewer 1.0.19 → 1.0.20

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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AcDbLayout as et, AcCmEventManager as M, AcGePoint2d as S, AcGeBox2d as L, AcCmColor as Pe, AcGeBox3d as tt, AcDbDatabase as vt, AcDbFileType as ve, AcGeMathUtil as re, AcGeVector3d as be, AcGeGeometryUtil as St, AcGeVector2d as Te, acdbHostApplicationServices as it, AcDbViewport as nt, AcDbRasterImage as st, AcDbRay as rt, AcDbXline as ot, AcDbHatch as De, AcGePolyline2d as at, AcDbLine as ct, AcDbTextStyleTableRecord as ht, AcDbMText as lt, AcGiMTextAttachmentPoint as It, AcGePoint3d as ze, AcGeLoop2d as dt, AcGeCircArc2d as ut, AcGeLine2d as mt, AcDbArc as gt, AcGeLine3d as K, AcDbDatabaseConverter as Bt, createWorkerApi as Mt, AcDbLinetypeTableRecord as At, AcDbDimStyleTableRecord as Ct, AcDbLayerTableRecord as Lt, AcDbViewportTableRecord as Et, AcDbBlockTableRecord as Tt, AcDbBatchProcessing as Dt, AcDbRasterImageDef as zt, AcDbCircle as Pt, AcDbEllipse as Rt, AcDbSpline as je, AcDbPoint as Ot, AcDbTrace as Vt, AcDbPolyline as Ge, AcGeEllipseArc2d as jt, AcGeSpline3d as ke, AcDbTable as Gt, AcDbText as kt, AcDbLeader as Ft, AcDbAlignedDimension as Nt, AcDb3PointAngularDimension as Ut, AcDbOrdinateDimension as Wt, AcDbRadialDimension as Xt, AcDbDiametricDimension as $t, AcDbBlockReference as Yt, AcDbDxfConverter as Ht, AcDbDatabaseConverterManager as Fe } from "@mlightcad/data-model";
1
+ import { AcDbLayout as tt, AcCmEventManager as M, AcGePoint2d as S, AcGeBox2d as L, AcCmColor as Re, AcGeBox3d as it, AcDbDatabase as vt, AcDbFileType as ve, AcGeMathUtil as re, AcGeVector3d as be, AcGeGeometryUtil as St, AcGeVector2d as Te, acdbHostApplicationServices as nt, AcDbViewport as st, AcDbRasterImage as rt, AcDbRay as ot, AcDbXline as at, AcDbHatch as De, AcGePolyline2d as ct, AcDbLine as ht, AcDbTextStyleTableRecord as lt, AcDbMText as dt, AcGiMTextAttachmentPoint as It, AcGePoint3d as ze, AcGeLoop2d as ut, AcGeCircArc2d as mt, AcGeLine2d as gt, AcDbArc as pt, AcGeLine3d as K, AcDbDatabaseConverter as Bt, createWorkerApi as Mt, AcDbLinetypeTableRecord as At, AcDbDimStyleTableRecord as Ct, AcDbLayerTableRecord as Lt, AcDbViewportTableRecord as Et, AcDbBlockTableRecord as Tt, AcDbBatchProcessing as Dt, AcDbRasterImageDef as zt, AcDbCircle as Pt, AcDbEllipse as Rt, AcDbSpline as Ge, AcDbPoint as Ot, AcDbTrace as Vt, AcDbPolyline as ke, AcGeEllipseArc2d as jt, AcGeSpline3d as Fe, AcDbTable as Gt, AcDbText as kt, AcDbLeader as Ft, AcDbAlignedDimension as Nt, AcDb3PointAngularDimension as Ut, AcDbOrdinateDimension as Wt, AcDbRadialDimension as Xt, AcDbDiametricDimension as $t, AcDbBlockReference as Yt, AcDbDxfConverter as Ht, AcDbDatabaseConverterManager as Ne } from "@mlightcad/data-model";
2
2
  import * as d from "three";
3
3
  import { UnifiedRenderer as qt, FontManager as ee } from "@mlightcad/mtext-renderer";
4
4
  import { mergeGeometries as Qt } from "three/examples/jsm/utils/BufferGeometryUtils.js";
@@ -28,7 +28,7 @@ class ii {
28
28
  }), t.database.events.headerSysVarChanged.addEventListener((i) => {
29
29
  i.name == "pdmode" && this._view.rerenderPoints(i.database.pdmode);
30
30
  }), t.database.events.dictObjetSet.addEventListener((i) => {
31
- i.object instanceof et && this._view.addLayout(i.object);
31
+ i.object instanceof tt && this._view.addLayout(i.object);
32
32
  }), e.selectionSet.events.selectionAdded.addEventListener((i) => {
33
33
  e.highlight(i.ids);
34
34
  }), e.selectionSet.events.selectionRemoved.addEventListener((i) => {
@@ -443,7 +443,7 @@ class ri {
443
443
  );
444
444
  }
445
445
  }
446
- class Re {
446
+ class Oe {
447
447
  /**
448
448
  * Creates a new base input instance.
449
449
  *
@@ -509,7 +509,7 @@ class Re {
509
509
  });
510
510
  }
511
511
  }
512
- class oi extends Re {
512
+ class oi extends Oe {
513
513
  /**
514
514
  * Creates a new jig loop instance.
515
515
  *
@@ -679,7 +679,7 @@ class ai {
679
679
  }
680
680
  }
681
681
  const ci = 16777215, hi = "1px";
682
- class li extends Re {
682
+ class li extends Oe {
683
683
  /**
684
684
  * Creates a new box selector instance.
685
685
  *
@@ -756,7 +756,7 @@ class li extends Re {
756
756
  */
757
757
  drawRect(e, t) {
758
758
  if (!this.boxDom) {
759
- const s = new Pe();
759
+ const s = new Re();
760
760
  s.color = this.color, this.boxDom = document.createElement("div"), this.boxDom.style.cssText = `position: absolute;border: ${hi} solid ${s.cssColor};`, document.body.appendChild(this.boxDom);
761
761
  }
762
762
  this.setRectDomVisible(!0), e.x <= 0 && (e.x = 0), e.y <= 0 && (e.y = 0), t.x >= this.container.clientWidth - 2 && (t.x = this.container.clientWidth - 2), t.y >= this.container.clientHeight - 2 && (t.y = this.container.clientHeight - 2), this.boxDom.style.left = `${e.x}px`, this.boxDom.style.top = `${e.y}px`;
@@ -784,7 +784,7 @@ class li extends Re {
784
784
  return t.expandByPoint(this.view.cwcs2Wcs(i)), t.expandByPoint(this.view.cwcs2Wcs(n)), t;
785
785
  }
786
786
  }
787
- class di extends Re {
787
+ class di extends Oe {
788
788
  /**
789
789
  * Creates a new point input instance.
790
790
  *
@@ -1031,7 +1031,7 @@ class gi {
1031
1031
  unhover: new M()
1032
1032
  }, this._canvas = e;
1033
1033
  const t = e.getBoundingClientRect();
1034
- this._bbox = new tt(), this._width = t.width, this._height = t.height, this._curPos = new S(), this._curScreenPos = new S(), this._selectionSet = new mi(), this._editor = new ui(this), this._canvas.addEventListener("mousemove", (i) => this.onMouseMove(i)), this._canvas.addEventListener("mousedown", (i) => {
1034
+ this._bbox = new it(), this._width = t.width, this._height = t.height, this._curPos = new S(), this._curScreenPos = new S(), this._selectionSet = new mi(), this._editor = new ui(this), this._canvas.addEventListener("mousemove", (i) => this.onMouseMove(i)), this._canvas.addEventListener("mousedown", (i) => {
1035
1035
  i.button === 1 && this._editor.setCursor(de.Grab);
1036
1036
  }), this._canvas.addEventListener("mouseup", (i) => {
1037
1037
  i.button === 1 && this._editor.restoreCursor();
@@ -1703,7 +1703,7 @@ class Li {
1703
1703
  return this.pointsSameX(e, t) ? this.pointsSameY(e, t) ? 0 : e[1] < t[1] ? -1 : 1 : e[0] < t[0] ? -1 : 1;
1704
1704
  }
1705
1705
  }
1706
- class pt extends Li {
1706
+ class yt extends Li {
1707
1707
  constructor(e = 1e-10) {
1708
1708
  super(), this.epsilon = e;
1709
1709
  }
@@ -1740,7 +1740,7 @@ class pt extends Li {
1740
1740
  };
1741
1741
  }
1742
1742
  }
1743
- class Ne {
1743
+ class Ue {
1744
1744
  constructor() {
1745
1745
  this.nodes = [];
1746
1746
  }
@@ -1787,14 +1787,14 @@ class Z {
1787
1787
  };
1788
1788
  }
1789
1789
  }
1790
- class Ue {
1790
+ class We {
1791
1791
  constructor(e, t, i, n) {
1792
1792
  this.status = null, this.isStart = e, this.p = t, this.seg = i, this.primary = n;
1793
1793
  }
1794
1794
  }
1795
- class We {
1795
+ class Xe {
1796
1796
  constructor(e, t, i = null) {
1797
- this.events = new Ne(), this.status = new Ne(), this.selfIntersection = e, this.geo = t, this.log = i;
1797
+ this.events = new Ue(), this.status = new Ue(), this.selfIntersection = e, this.geo = t, this.log = i;
1798
1798
  }
1799
1799
  compareEvents(e, t, i, n, s, o) {
1800
1800
  const r = this.geo.pointsCompare(t, s);
@@ -1818,7 +1818,7 @@ class We {
1818
1818
  return i === 0 ? null : i < 0 ? new Z(e, t, null, this.log) : new Z(t, e, null, this.log);
1819
1819
  }
1820
1820
  addSegment(e, t) {
1821
- const i = new Ue(!0, e.start, e, t), n = new Ue(!1, e.end, e, t);
1821
+ const i = new We(!0, e.start, e, t), n = new We(!1, e.end, e, t);
1822
1822
  return i.other = n, n.other = i, this.addEvent(i), this.addEvent(n), i;
1823
1823
  }
1824
1824
  addRegion(e) {
@@ -2099,7 +2099,7 @@ class Ti {
2099
2099
  this.push("done", null);
2100
2100
  }
2101
2101
  }
2102
- class yt {
2102
+ class ft {
2103
2103
  constructor(e) {
2104
2104
  this.log = null, this.geo = e;
2105
2105
  }
@@ -2108,7 +2108,7 @@ class yt {
2108
2108
  return this.log = e ? new Ti() : null, (t = this.log) === null || t === void 0 ? void 0 : t.list;
2109
2109
  }
2110
2110
  segments(e) {
2111
- const t = new We(!0, this.geo, this.log);
2111
+ const t = new Xe(!0, this.geo, this.log);
2112
2112
  for (const i of e.regions)
2113
2113
  t.addRegion(i);
2114
2114
  return {
@@ -2117,7 +2117,7 @@ class yt {
2117
2117
  };
2118
2118
  }
2119
2119
  combine(e, t) {
2120
- const i = new We(!1, this.geo, this.log);
2120
+ const i = new Xe(!1, this.geo, this.log);
2121
2121
  for (const n of e.segments)
2122
2122
  i.addSegment(new Z(n.start, n.end, n, this.log), !0);
2123
2123
  for (const n of t.segments)
@@ -2186,7 +2186,7 @@ class yt {
2186
2186
  return this.polygon(o);
2187
2187
  }
2188
2188
  }
2189
- new yt(new pt());
2189
+ new ft(new yt());
2190
2190
  class Se extends d.Object3D {
2191
2191
  /**
2192
2192
  * Flatten the hierarchy of the specified object so that all children are moved to be direct
@@ -2833,7 +2833,7 @@ class R {
2833
2833
  throw new Error(
2834
2834
  `[AcTrPointSymbolCreator] Invalid point type value: '${e}'!`
2835
2835
  );
2836
- ne.copy(t), Xe.identity().makeTranslation(ne), i.line = n.clone().applyMatrix4(Xe), (e == 32 || e == 64 || e == 96) && (i.point = new d.BufferGeometry().setFromPoints([ne]));
2836
+ ne.copy(t), $e.identity().makeTranslation(ne), i.line = n.clone().applyMatrix4($e), (e == 32 || e == 64 || e == 96) && (i.point = new d.BufferGeometry().setFromPoints([ne]));
2837
2837
  }
2838
2838
  return i;
2839
2839
  }
@@ -2848,7 +2848,7 @@ class R {
2848
2848
  }), e;
2849
2849
  }
2850
2850
  }
2851
- const Xe = /* @__PURE__ */ new d.Matrix4(), ne = /* @__PURE__ */ new d.Vector3(), zi = new d.Color(583902);
2851
+ const $e = /* @__PURE__ */ new d.Matrix4(), ne = /* @__PURE__ */ new d.Vector3(), zi = new d.Color(583902);
2852
2852
  class Ie {
2853
2853
  /**
2854
2854
  * Clone given material(s)
@@ -2924,10 +2924,10 @@ class ue {
2924
2924
  return e;
2925
2925
  }
2926
2926
  }
2927
- function Oe(c, e) {
2927
+ function Ve(c, e) {
2928
2928
  return c - e;
2929
2929
  }
2930
- function Ve(c, e, t = 0) {
2930
+ function je(c, e, t = 0) {
2931
2931
  const i = e.itemSize;
2932
2932
  if (c.isInterleavedBufferAttribute || c.array.constructor !== e.array.constructor) {
2933
2933
  const n = c.count;
@@ -2948,7 +2948,7 @@ function J(c, e) {
2948
2948
  e.set(new c.constructor(c.buffer, 0, t));
2949
2949
  }
2950
2950
  }
2951
- const $e = /* @__PURE__ */ new d.Box3(), F = /* @__PURE__ */ new d.Vector3(), N = /* @__PURE__ */ new d.LineSegments(), me = [];
2951
+ const Ye = /* @__PURE__ */ new d.Box3(), F = /* @__PURE__ */ new d.Vector3(), N = /* @__PURE__ */ new d.LineSegments(), me = [];
2952
2952
  class Pi extends d.LineSegments {
2953
2953
  constructor(e = 1e3, t = e * 2, i) {
2954
2954
  super(new d.BufferGeometry(), i), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e, this._maxIndexCount = t;
@@ -3093,7 +3093,7 @@ class Pi extends d.LineSegments {
3093
3093
  "AcTrBatchedLine: Reserved space request exceeds the maximum buffer size."
3094
3094
  );
3095
3095
  let r;
3096
- return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Oe), r = this._availableGeometryIds.shift(), s[r] = n) : (r = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(r, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, r;
3096
+ return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve), r = this._availableGeometryIds.shift(), s[r] = n) : (r = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(r, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, r;
3097
3097
  }
3098
3098
  setGeometryInfo(e, t) {
3099
3099
  if (e >= this._geometryCount)
@@ -3116,7 +3116,7 @@ class Pi extends d.LineSegments {
3116
3116
  const m = t.getAttribute(l), u = i.getAttribute(
3117
3117
  l
3118
3118
  );
3119
- Ve(m, u, a);
3119
+ je(m, u, a);
3120
3120
  const p = m.itemSize;
3121
3121
  for (let g = m.count, y = h; g < y; g++) {
3122
3122
  const f = a + g;
@@ -3204,7 +3204,7 @@ class Pi extends d.LineSegments {
3204
3204
  const i = this.geometry, n = this._geometryInfo[e];
3205
3205
  if (n.boundingSphere === null) {
3206
3206
  const s = new d.Sphere();
3207
- this.getBoundingBoxAt(e, $e), $e.getCenter(s.center);
3207
+ this.getBoundingBoxAt(e, Ye), Ye.getCenter(s.center);
3208
3208
  const o = i.index, r = i.attributes.position;
3209
3209
  let a = 0;
3210
3210
  for (let h = n.start, l = n.start + n.count; h < l; h++) {
@@ -3313,7 +3313,7 @@ class Pi extends d.LineSegments {
3313
3313
  return this.geometry.dispose(), this;
3314
3314
  }
3315
3315
  }
3316
- const Ye = /* @__PURE__ */ new d.Box3(), U = /* @__PURE__ */ new d.Vector3(), W = /* @__PURE__ */ new d.Mesh(), ge = [];
3316
+ const He = /* @__PURE__ */ new d.Box3(), U = /* @__PURE__ */ new d.Vector3(), W = /* @__PURE__ */ new d.Mesh(), ge = [];
3317
3317
  class Ri extends d.Mesh {
3318
3318
  constructor(e = 1e3, t = e * 2, i) {
3319
3319
  super(new d.BufferGeometry(), i), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextIndexStart = 0, this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e, this._maxIndexCount = t;
@@ -3428,7 +3428,7 @@ class Ri extends d.Mesh {
3428
3428
  "AcTrBatchedMesh: Reserved space request exceeds the maximum buffer size."
3429
3429
  );
3430
3430
  let r;
3431
- return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Oe), r = this._availableGeometryIds.shift(), s[r] = n) : (r = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(r, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, r;
3431
+ return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve), r = this._availableGeometryIds.shift(), s[r] = n) : (r = this._geometryCount, this._geometryCount++, s.push(n)), this.setGeometryAt(r, e), this._nextIndexStart = n.indexStart + n.reservedIndexCount, this._nextVertexStart = n.vertexStart + n.reservedVertexCount, r;
3432
3432
  }
3433
3433
  setGeometryInfo(e, t) {
3434
3434
  if (e >= this._geometryCount)
@@ -3451,7 +3451,7 @@ class Ri extends d.Mesh {
3451
3451
  const m = t.getAttribute(l), u = i.getAttribute(
3452
3452
  l
3453
3453
  );
3454
- Ve(m, u, a);
3454
+ je(m, u, a);
3455
3455
  const p = m.itemSize;
3456
3456
  for (let g = m.count, y = h; g < y; g++) {
3457
3457
  const f = a + g;
@@ -3539,7 +3539,7 @@ class Ri extends d.Mesh {
3539
3539
  const i = this.geometry, n = this._geometryInfo[e];
3540
3540
  if (n.boundingSphere === null) {
3541
3541
  const s = new d.Sphere();
3542
- this.getBoundingBoxAt(e, Ye), Ye.getCenter(s.center);
3542
+ this.getBoundingBoxAt(e, He), He.getCenter(s.center);
3543
3543
  const o = i.index, r = i.attributes.position;
3544
3544
  let a = 0;
3545
3545
  for (let h = n.start, l = n.start + n.count; h < l; h++) {
@@ -3648,7 +3648,7 @@ class Ri extends d.Mesh {
3648
3648
  return this.geometry.dispose(), this;
3649
3649
  }
3650
3650
  }
3651
- const He = /* @__PURE__ */ new d.Box3(), X = /* @__PURE__ */ new d.Vector3(), $ = /* @__PURE__ */ new d.Points(), pe = [];
3651
+ const qe = /* @__PURE__ */ new d.Box3(), X = /* @__PURE__ */ new d.Vector3(), $ = /* @__PURE__ */ new d.Points(), pe = [];
3652
3652
  class Oi extends d.Points {
3653
3653
  constructor(e = 1e3, t) {
3654
3654
  super(new d.BufferGeometry(), t), this.boundingBox = null, this.boundingSphere = null, this._geometryInfo = [], this._availableGeometryIds = [], this._nextVertexStart = 0, this._geometryCount = 0, this._geometryInitialized = !1, this.frustumCulled = !1, this._maxVertexCount = e;
@@ -3744,7 +3744,7 @@ class Oi extends d.Points {
3744
3744
  }, n = this._geometryInfo;
3745
3745
  i.vertexStart = this._nextVertexStart, i.reservedVertexCount = t === -1 ? e.getAttribute("position").count : t;
3746
3746
  let s;
3747
- return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Oe), s = this._availableGeometryIds.shift(), n[s] = i) : (s = this._geometryCount, this._geometryCount++, n.push(i)), this.setGeometryAt(s, e), this._nextVertexStart = i.vertexStart + i.reservedVertexCount, this.geometry.setDrawRange(0, this._nextVertexStart), s;
3747
+ return this._availableGeometryIds.length > 0 ? (this._availableGeometryIds.sort(Ve), s = this._availableGeometryIds.shift(), n[s] = i) : (s = this._geometryCount, this._geometryCount++, n.push(i)), this.setGeometryAt(s, e), this._nextVertexStart = i.vertexStart + i.reservedVertexCount, this.geometry.setDrawRange(0, this._nextVertexStart), s;
3748
3748
  }
3749
3749
  setGeometryInfo(e, t) {
3750
3750
  if (e >= this._geometryCount)
@@ -3762,7 +3762,7 @@ class Oi extends d.Points {
3762
3762
  const a = t.getAttribute(r), h = i.getAttribute(
3763
3763
  r
3764
3764
  );
3765
- Ve(a, h, s);
3765
+ je(a, h, s);
3766
3766
  const l = a.itemSize;
3767
3767
  for (let m = a.count, u = o; m < u; m++) {
3768
3768
  const p = s + m;
@@ -3828,7 +3828,7 @@ class Oi extends d.Points {
3828
3828
  const i = this.geometry, n = this._geometryInfo[e];
3829
3829
  if (n.boundingSphere === null) {
3830
3830
  const s = new d.Sphere();
3831
- this.getBoundingBoxAt(e, He), He.getCenter(s.center);
3831
+ this.getBoundingBoxAt(e, qe), qe.getCenter(s.center);
3832
3832
  const o = i.index, r = i.attributes.position;
3833
3833
  let a = 0;
3834
3834
  for (let h = n.vertexStart, l = n.vertexStart + n.vertexCount; h < l; h++) {
@@ -4171,7 +4171,7 @@ class Vi extends d.Group {
4171
4171
  return t;
4172
4172
  }
4173
4173
  }
4174
- class ft extends Se {
4174
+ class xt extends Se {
4175
4175
  constructor(e) {
4176
4176
  super(), this._styleManager = e;
4177
4177
  }
@@ -4185,7 +4185,7 @@ class ft extends Se {
4185
4185
  return this._styleManager = e._styleManager, super.copy(e, t);
4186
4186
  }
4187
4187
  }
4188
- class E extends ft {
4188
+ class E extends xt {
4189
4189
  constructor(e) {
4190
4190
  super(e), this._objectId = "", this._ownerId = "", this._layerName = "", this._box = new d.Box3();
4191
4191
  }
@@ -4321,7 +4321,7 @@ class E extends ft {
4321
4321
  return o;
4322
4322
  }
4323
4323
  }
4324
- const xt = class H {
4324
+ const _t = class H {
4325
4325
  constructor() {
4326
4326
  }
4327
4327
  /**
@@ -4359,8 +4359,8 @@ const xt = class H {
4359
4359
  this._renderer && (this._renderer.destroy(), this._renderer = void 0), H._instance = null;
4360
4360
  }
4361
4361
  };
4362
- xt._instance = null;
4363
- let _t = xt;
4362
+ _t._instance = null;
4363
+ let Pe = _t;
4364
4364
  class ji extends E {
4365
4365
  constructor(e, t) {
4366
4366
  super(t), e.forEach((i) => {
@@ -4565,7 +4565,7 @@ class Ni extends E {
4565
4565
  super(i), this._text = e, this._style = t;
4566
4566
  }
4567
4567
  async draw() {
4568
- const e = _t.getInstance();
4568
+ const e = Pe.getInstance();
4569
4569
  if (e)
4570
4570
  try {
4571
4571
  const t = this._style;
@@ -4678,7 +4678,7 @@ class Xi extends E {
4678
4678
  try {
4679
4679
  p.forEach((f, _) => {
4680
4680
  y = Math.min(e[f][0].relativeEps(), 1e-6);
4681
- const x = new yt(new pt(y));
4681
+ const x = new ft(new yt(y));
4682
4682
  if (_ === 0)
4683
4683
  g = x.segments({
4684
4684
  regions: [r(e[f])],
@@ -5282,7 +5282,7 @@ class qi {
5282
5282
  * Create one empty drawable object
5283
5283
  */
5284
5284
  createObject() {
5285
- return new ft(this._styleManager);
5285
+ return new xt(this._styleManager);
5286
5286
  }
5287
5287
  /**
5288
5288
  * Create one empty entity
@@ -5651,7 +5651,7 @@ class Be extends bt {
5651
5651
  }
5652
5652
  }
5653
5653
  }
5654
- const Zi = (c) => new tt(c.min, c.max), Ji = (c) => new L(
5654
+ const Zi = (c) => new it(c.min, c.max), Ji = (c) => new L(
5655
5655
  c.min,
5656
5656
  c.max
5657
5657
  ), Ki = (c) => new d.Box3(
@@ -6177,10 +6177,10 @@ class mn {
6177
6177
  return r = q(e.slice(t, i + 1)), Y(r, this.toBBox), r;
6178
6178
  n || (n = Math.ceil(Math.log(s) / Math.log(o)), o = Math.ceil(s / Math.pow(o, n - 1))), r = q([]), r.leaf = !1, r.height = n;
6179
6179
  const a = Math.ceil(s / o), h = a * Math.ceil(Math.sqrt(o));
6180
- qe(e, t, i, h, this.compareMinX);
6180
+ Qe(e, t, i, h, this.compareMinX);
6181
6181
  for (let l = t; l <= i; l += h) {
6182
6182
  const m = Math.min(l + h - 1, i);
6183
- qe(e, l, m, a, this.compareMinY);
6183
+ Qe(e, l, m, a, this.compareMinY);
6184
6184
  for (let u = l; u <= m; u += a) {
6185
6185
  const p = Math.min(u + a - 1, m);
6186
6186
  r.children.push(this._build(e, u, p, n - 1));
@@ -6308,7 +6308,7 @@ function q(c) {
6308
6308
  maxY: -1 / 0
6309
6309
  };
6310
6310
  }
6311
- function qe(c, e, t, i, n) {
6311
+ function Qe(c, e, t, i, n) {
6312
6312
  const s = [e, t];
6313
6313
  for (; s.length; ) {
6314
6314
  if (t = s.pop(), e = s.pop(), t - e <= i) continue;
@@ -6871,7 +6871,7 @@ class wn {
6871
6871
  }), this;
6872
6872
  }
6873
6873
  }
6874
- const Qe = {
6874
+ const Ze = {
6875
6875
  background: 0
6876
6876
  };
6877
6877
  class vn extends gi {
@@ -6883,9 +6883,9 @@ class vn extends gi {
6883
6883
  * @param options.calculateSizeCallback - Optional callback function to calculate canvas size on window resize
6884
6884
  * @param options.background - Optional background color as hex number (default: 0x000000)
6885
6885
  */
6886
- constructor(e = Qe) {
6886
+ constructor(e = Ze) {
6887
6887
  const t = {
6888
- ...Qe,
6888
+ ...Ze,
6889
6889
  ...e
6890
6890
  }, i = new d.WebGLRenderer({
6891
6891
  antialias: !0,
@@ -6905,7 +6905,7 @@ class vn extends gi {
6905
6905
  this.mode == O.SELECTION && this.select();
6906
6906
  }), document.addEventListener("keydown", (s) => {
6907
6907
  s.code === "Escape" && this.selectionSet.clear();
6908
- }), it().layoutManager.events.layoutSwitched.addEventListener(
6908
+ }), nt().layoutManager.events.layoutSwitched.addEventListener(
6909
6909
  (s) => {
6910
6910
  this.activeLayoutBtrId = s.layout.blockTableRecordId;
6911
6911
  }
@@ -7225,10 +7225,10 @@ class vn extends gi {
7225
7225
  );
7226
7226
  if (s) {
7227
7227
  s.objectId = n.objectId, s.ownerId = n.ownerId, s.layerName = n.layer, s.visible = n.visibility;
7228
- const o = !(n instanceof rt || n instanceof ot);
7228
+ const o = !(n instanceof ot || n instanceof at);
7229
7229
  if (s.draw().then(() => {
7230
7230
  this._scene.addEntity(s, o), s.dispose(), this._isDirty = !0;
7231
- }), n instanceof nt) {
7231
+ }), n instanceof st) {
7232
7232
  if (n.number > 1) {
7233
7233
  const r = this._layoutViewManager.getAt(n.ownerId);
7234
7234
  if (r) {
@@ -7240,7 +7240,7 @@ class vn extends gi {
7240
7240
  r.addViewport(a);
7241
7241
  }
7242
7242
  }
7243
- } else if (n instanceof st) {
7243
+ } else if (n instanceof rt) {
7244
7244
  const r = n.imageFileName;
7245
7245
  r && this._missedImages.set(n.objectId, r);
7246
7246
  }
@@ -7249,7 +7249,7 @@ class vn extends gi {
7249
7249
  return t;
7250
7250
  }
7251
7251
  }
7252
- const Ze = "simsun";
7252
+ const Je = "simsun";
7253
7253
  class Q {
7254
7254
  /**
7255
7255
  * Gets the singleton instance of the document creator.
@@ -7278,7 +7278,7 @@ class Q {
7278
7278
  createExampleDoc1(e) {
7279
7279
  for (let n = 0; n < 2; ++n)
7280
7280
  for (let s = 0; s < 2; ++s) {
7281
- const o = new De(), r = new at();
7281
+ const o = new De(), r = new ct();
7282
7282
  r.addVertexAt(0, { x: s * 100, y: n * 100, bulge: 1 }), r.addVertexAt(1, { x: s * 100 + 100, y: n * 100, bulge: 1 }), r.closed = !0, o.add(r), e.tables.blockTable.modelSpace.appendEntity(o);
7283
7283
  }
7284
7284
  }
@@ -7308,7 +7308,7 @@ class Q {
7308
7308
  const t = e.tables.blockTable.modelSpace;
7309
7309
  t.appendEntity(this.createArc()), this.createLines().forEach((n) => {
7310
7310
  e.tables.blockTable.modelSpace.appendEntity(
7311
- new ct(n.startPoint, n.endPoint)
7311
+ new ht(n.startPoint, n.endPoint)
7312
7312
  );
7313
7313
  }), t.appendEntity(this.createHatch()), e.tables.textStyleTable.add(this.createTextStyle()), t.appendEntity(this.createMText());
7314
7314
  }
@@ -7316,9 +7316,9 @@ class Q {
7316
7316
  const e = {
7317
7317
  bigFont: "",
7318
7318
  color: 16777215,
7319
- extendedFont: Ze,
7319
+ extendedFont: Je,
7320
7320
  fixedTextHeight: 0,
7321
- font: Ze,
7321
+ font: Je,
7322
7322
  lastHeight: 0.2,
7323
7323
  name: "Standard",
7324
7324
  obliqueAngle: 0,
@@ -7326,16 +7326,16 @@ class Q {
7326
7326
  textGenerationFlag: 0,
7327
7327
  widthFactor: 0.667
7328
7328
  };
7329
- return new ht(e);
7329
+ return new lt(e);
7330
7330
  }
7331
7331
  createMText() {
7332
- const e = new lt();
7333
- return e.attachmentPoint = It.MiddleLeft, e.color = new Pe().setColorName("red"), e.layer = "0", e.location = new ze(9850, 86773, 0), e.contents = "{\\W0.667;\\T1.1;智慧8081}", e.height = 200, e.width = 1e3, e.styleName = "Standard", e;
7332
+ const e = new dt();
7333
+ return e.attachmentPoint = It.MiddleLeft, e.color = new Re().setColorName("red"), e.layer = "0", e.location = new ze(9850, 86773, 0), e.contents = "{\\W0.667;\\T1.1;智慧8081}", e.height = 200, e.width = 1e3, e.styleName = "Standard", e;
7334
7334
  }
7335
7335
  createHatch() {
7336
- const e = this.createLines(), t = new De(), i = new dt();
7336
+ const e = this.createLines(), t = new De(), i = new ut();
7337
7337
  return i.add(
7338
- new ut(
7338
+ new mt(
7339
7339
  { x: 20241.23355899991, y: 174118.6312674369 },
7340
7340
  89258.30757455899,
7341
7341
  re.degToRad(262.2471115358437),
@@ -7343,11 +7343,11 @@ class Q {
7343
7343
  !1
7344
7344
  )
7345
7345
  ), e.forEach((n) => {
7346
- i.add(new mt(n.startPoint, n.endPoint));
7346
+ i.add(new gt(n.startPoint, n.endPoint));
7347
7347
  }), t.add(i), t;
7348
7348
  }
7349
7349
  createArc() {
7350
- return new gt(
7350
+ return new pt(
7351
7351
  { x: 20241.23355899991, y: 174118.6312674369, z: 0 },
7352
7352
  89258.30757455899,
7353
7353
  re.degToRad(262.2471115358437),
@@ -7507,7 +7507,7 @@ class C {
7507
7507
  width: window.innerWidth,
7508
7508
  height: window.innerHeight - 30
7509
7509
  }), n = new vn({ canvas: e, calculateSizeCallback: i });
7510
- this._context = new ii(n, t), this._fontLoader = new Sn(n.renderer), it().workingDatabase = t.database, this.registerCommands();
7510
+ this._context = new ii(n, t), this._fontLoader = new Sn(n.renderer), nt().workingDatabase = t.database, this.registerCommands();
7511
7511
  }
7512
7512
  /**
7513
7513
  * Creates the singleton instance with an optional canvas element.
@@ -7827,7 +7827,7 @@ class C {
7827
7827
  e.activeLayoutBtrId = this.curDocument.database.currentSpaceId, e.modelSpaceBtrId = this.curDocument.database.currentSpaceId;
7828
7828
  }
7829
7829
  }
7830
- class Je {
7830
+ class Ke {
7831
7831
  convert(e) {
7832
7832
  const t = this.createEntity(e);
7833
7833
  return t && this.processCommonAttrs(e, t), t;
@@ -7841,7 +7841,7 @@ class Je {
7841
7841
  return e.type == "ARC" ? this.convertArc(e) : e.type == "CIRCLE" ? this.convertCirle(e) : e.type == "DIMENSION" ? this.convertDimension(e) : e.type == "ELLIPSE" ? this.convertEllipse(e) : e.type == "HATCH" ? this.convertHatch(e) : e.type == "IMAGE" ? this.convertImage(e) : e.type == "LEADER" ? this.convertLeader(e) : e.type == "LINE" ? this.convertLine(e) : e.type == "LWPOLYLINE" ? this.convertLWPolyline(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "POINT" ? this.convertPoint(e) : e.type == "POLYLINE" ? this.convertPolyline(e) : e.type == "RAY" ? this.convertRay(e) : e.type == "SPLINE" ? this.convertSpline(e) : e.type == "ACAD_TABLE" ? this.convertTable(e) : e.type == "TEXT" ? this.convertText(e) : e.type == "SOLID" ? this.convertSolid(e) : e.type == "VIEWPORT" ? this.convertViewport(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
7842
7842
  }
7843
7843
  convertArc(e) {
7844
- return new gt(
7844
+ return new pt(
7845
7845
  e.center,
7846
7846
  e.radius,
7847
7847
  e.startAngle,
@@ -7865,19 +7865,19 @@ class Je {
7865
7865
  }
7866
7866
  convertLine(e) {
7867
7867
  const t = e.startPoint, i = e.endPoint;
7868
- return new ct(
7868
+ return new ht(
7869
7869
  new ze(t.x, t.y, t.z),
7870
7870
  new ze(i.x, i.y, i.z)
7871
7871
  );
7872
7872
  }
7873
7873
  convertSpline(e) {
7874
- return e.numberOfControlPoints > 0 && e.numberOfKnots > 0 ? new je(
7874
+ return e.numberOfControlPoints > 0 && e.numberOfKnots > 0 ? new Ge(
7875
7875
  e.controlPoints,
7876
7876
  e.knots,
7877
7877
  e.weights,
7878
7878
  e.degree,
7879
7879
  !!(e.flag & 1)
7880
- ) : e.numberOfFitPoints > 0 ? new je(
7880
+ ) : e.numberOfFitPoints > 0 ? new Ge(
7881
7881
  e.fitPoints,
7882
7882
  "Uniform",
7883
7883
  e.degree,
@@ -7896,7 +7896,7 @@ class Je {
7896
7896
  ), t.thickness = e.thickness, t;
7897
7897
  }
7898
7898
  convertLWPolyline(e) {
7899
- const t = new Ge();
7899
+ const t = new ke();
7900
7900
  return t.closed = !!(e.flag & 512), e.vertices.forEach((i, n) => {
7901
7901
  t.addVertexAt(
7902
7902
  n,
@@ -7908,7 +7908,7 @@ class Je {
7908
7908
  }), t;
7909
7909
  }
7910
7910
  convertPolyline(e) {
7911
- const t = new Ge();
7911
+ const t = new ke();
7912
7912
  return t.closed = !!(e.flag & 1), e.vertices.forEach((i, n) => {
7913
7913
  t.addVertexAt(
7914
7914
  n,
@@ -7931,7 +7931,7 @@ class Je {
7931
7931
  });
7932
7932
  }), i.hatchStyle = e.hatchStyle, i.patternName = e.patternName, i.patternType = e.patternType, i.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, i.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((n) => {
7933
7933
  if (n.boundaryPathTypeFlag & 2) {
7934
- const s = n, o = new at();
7934
+ const s = n, o = new ct();
7935
7935
  o.closed = s.isClosed, s.vertices.forEach((r, a) => {
7936
7936
  o.addVertexAt(a, {
7937
7937
  x: r.x,
@@ -7940,15 +7940,15 @@ class Je {
7940
7940
  });
7941
7941
  }), i.add(o);
7942
7942
  } else {
7943
- const s = n, o = new dt();
7943
+ const s = n, o = new ut();
7944
7944
  s.edges.forEach((r) => {
7945
7945
  if (r.type == 1) {
7946
7946
  const a = r;
7947
- o.add(new mt(a.start, a.end));
7947
+ o.add(new gt(a.start, a.end));
7948
7948
  } else if (r.type == 2) {
7949
7949
  const a = r;
7950
7950
  o.add(
7951
- new ut(
7951
+ new mt(
7952
7952
  a.center,
7953
7953
  a.radius,
7954
7954
  a.startAngle,
@@ -7988,7 +7988,7 @@ class Je {
7988
7988
  let l = !0;
7989
7989
  const m = a.controlPoints.map((u) => (u.weight == null && (l = !1), u.weight || 1));
7990
7990
  o.add(
7991
- new ke(
7991
+ new Fe(
7992
7992
  h,
7993
7993
  a.knots,
7994
7994
  l ? m : void 0
@@ -8000,7 +8000,7 @@ class Je {
8000
8000
  y: l.y,
8001
8001
  z: 0
8002
8002
  }));
8003
- o.add(new ke(h, "Uniform"));
8003
+ o.add(new Fe(h, "Uniform"));
8004
8004
  }
8005
8005
  }
8006
8006
  }), i.add(o);
@@ -8026,7 +8026,7 @@ class Je {
8026
8026
  return t.textString = e.text, t.styleName = e.styleName, t.height = e.textHeight, t.position.copy(e.startPoint), t.rotation = e.rotation, t.oblique = e.obliqueAngle ?? 0, t.thickness = e.thickness, t.horizontalMode = e.halign, t.verticalMode = e.valign, t.widthFactor = e.xScale ?? 1, t;
8027
8027
  }
8028
8028
  convertMText(e) {
8029
- const t = new lt();
8029
+ const t = new dt();
8030
8030
  return t.contents = e.text, e.styleName != null && (t.styleName = e.styleName), t.height = e.textHeight, t.width = e.rectWidth, t.rotation = e.rotation || 0, t.location = e.insertionPoint, t.attachmentPoint = e.attachmentPoint, e.direction && (t.direction = new be(e.direction)), t.drawingDirection = e.drawingDirection, t;
8031
8031
  }
8032
8032
  convertLeader(e) {
@@ -8084,7 +8084,7 @@ class Je {
8084
8084
  ) * e.imageSize.y, t.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
8085
8085
  }
8086
8086
  convertImage(e) {
8087
- const t = new st();
8087
+ const t = new rt();
8088
8088
  return this.processImage(e, t), t;
8089
8089
  }
8090
8090
  // private convertWipeout(wipeout: WipeoutEntity) {
@@ -8093,15 +8093,15 @@ class Je {
8093
8093
  // return dbWipeout
8094
8094
  // }
8095
8095
  convertViewport(e) {
8096
- const t = new nt();
8096
+ const t = new st();
8097
8097
  return t.number = e.viewportId, t.centerPoint.copy(e.viewportCenter), t.height = e.height, t.width = e.width, t.viewCenter.copy(e.displayCenter), t.viewHeight = e.viewHeight, t;
8098
8098
  }
8099
8099
  convertRay(e) {
8100
- const t = new rt();
8100
+ const t = new ot();
8101
8101
  return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
8102
8102
  }
8103
8103
  convertXline(e) {
8104
- const t = new ot();
8104
+ const t = new at();
8105
8105
  return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
8106
8106
  }
8107
8107
  convertBlockReference(e) {
@@ -8190,7 +8190,7 @@ class In extends Bt {
8190
8190
  }
8191
8191
  processTextStyles(e, t) {
8192
8192
  e.tables.STYLE.entries.forEach((i) => {
8193
- const n = new ht(i);
8193
+ const n = new lt(i);
8194
8194
  this.processCommonTableEntryAttrs(i, n), t.tables.textStyleTable.add(n);
8195
8195
  });
8196
8196
  }
@@ -8276,7 +8276,7 @@ class In extends Bt {
8276
8276
  }
8277
8277
  processLayers(e, t) {
8278
8278
  e.tables.LAYER.entries.forEach((i) => {
8279
- const n = new Pe();
8279
+ const n = new Re();
8280
8280
  n.colorIndex = i.colorIndex;
8281
8281
  const s = new Lt({
8282
8282
  name: i.name,
@@ -8305,7 +8305,7 @@ class In extends Bt {
8305
8305
  processBlocks(e, t) {
8306
8306
  }
8307
8307
  async processEntitiesInBlock(e, t) {
8308
- const i = new Je(), n = e.length, s = [];
8308
+ const i = new Ke(), n = e.length, s = [];
8309
8309
  for (let o = 0; o < n; o++) {
8310
8310
  const r = e[o], a = i.convert(r);
8311
8311
  a && s.push(a);
@@ -8318,7 +8318,7 @@ class In extends Bt {
8318
8318
  * smaller pieces and executed in small intervals to allow the UI to remain responsive.
8319
8319
  */
8320
8320
  async processEntities(e, t, i, n, s) {
8321
- const o = new Je();
8321
+ const o = new Ke();
8322
8322
  let r = e.entities;
8323
8323
  const a = r.length, h = new Dt(
8324
8324
  a,
@@ -8352,7 +8352,7 @@ class In extends Bt {
8352
8352
  processLayouts(e, t) {
8353
8353
  const i = t.dictionaries.layouts;
8354
8354
  e.objects.LAYOUT.forEach((n) => {
8355
- const s = new et();
8355
+ const s = new tt();
8356
8356
  s.layoutName = n.layoutName, s.tabOrder = n.tabOrder;
8357
8357
  const o = t.tables.blockTable.newIterator();
8358
8358
  s.objectId = n.handle.toString();
@@ -8401,7 +8401,7 @@ function Bn() {
8401
8401
  useWorker: !0,
8402
8402
  parserWorkerUrl: "./assets/dxf-parser-worker.js"
8403
8403
  });
8404
- Fe.instance.register(ve.DXF, c);
8404
+ Ne.instance.register(ve.DXF, c);
8405
8405
  } catch (c) {
8406
8406
  console.error("Failed to register dxf converter: ", c);
8407
8407
  }
@@ -8411,13 +8411,15 @@ function Bn() {
8411
8411
  useWorker: !0,
8412
8412
  parserWorkerUrl: "./assets/libredwg-parser-worker.js"
8413
8413
  });
8414
- Fe.instance.register(ve.DWG, c);
8414
+ Ne.instance.register(ve.DWG, c);
8415
8415
  } catch (c) {
8416
8416
  console.error("Failed to register dwg converter: ", c);
8417
8417
  }
8418
8418
  }
8419
8419
  function Pn() {
8420
- Bn(), _t.getInstance().initialize("/assets/mtext-renderer-worker.js");
8420
+ Bn(), typeof window < "u" && !!window.location && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? Pe.getInstance().initialize(
8421
+ "/assets/mtext-renderer-worker.js"
8422
+ ) : Pe.getInstance().initialize("./mtext-renderer-worker.js");
8421
8423
  }
8422
8424
  const Mn = {
8423
8425
  isDebug: !1,
@@ -8426,7 +8428,7 @@ const Mn = {
8426
8428
  isShowToolbar: !0,
8427
8429
  isShowStats: !1,
8428
8430
  fontMapping: {}
8429
- }, Ke = "settings";
8431
+ }, et = "settings";
8430
8432
  class he {
8431
8433
  constructor() {
8432
8434
  this.events = {
@@ -8461,7 +8463,7 @@ class he {
8461
8463
  */
8462
8464
  set(e, t) {
8463
8465
  const i = this.settings;
8464
- i[e] = t, localStorage.setItem(Ke, JSON.stringify(i)), this.events.modified.dispatch({
8466
+ i[e] = t, localStorage.setItem(et, JSON.stringify(i)), this.events.modified.dispatch({
8465
8467
  key: e,
8466
8468
  value: t
8467
8469
  });
@@ -8616,7 +8618,7 @@ class he {
8616
8618
  * @returns The current settings object
8617
8619
  */
8618
8620
  get settings() {
8619
- const e = localStorage.getItem(Ke), t = e == null ? {} : JSON.parse(e);
8621
+ const e = localStorage.getItem(et), t = e == null ? {} : JSON.parse(e);
8620
8622
  return ei(t, Mn);
8621
8623
  }
8622
8624
  }
@@ -8643,7 +8645,7 @@ export {
8643
8645
  O as AcEdViewMode,
8644
8646
  ui as AcEditor,
8645
8647
  vn as AcTrView2d,
8646
- Qe as DEFAULT_VIEW_2D_OPTIONS,
8648
+ Ze as DEFAULT_VIEW_2D_OPTIONS,
8647
8649
  zn as acedAlert,
8648
8650
  V as eventBus,
8649
8651
  Bn as registerConverters,