@mlightcad/libredwg-converter 3.5.25 → 3.5.27

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.
@@ -1,19 +1,19 @@
1
- import { AcDbFace as O, AcGeVector3d as D, AcDbArc as m, transformOcsPointToWcs as w, AcDbCircle as k, AcDbEllipse as R, AcDbLine as F, AcGePoint3d as T, AcDbSpline as b, AcDbPoint as V, AcDbTrace as N, AcDbPolyline as B, AcGePoint2d as P, AcDbPolygonMesh as z, AcDbPolyFaceMesh as W, AcDbPoly2dType as A, AcDb2dPolyline as j, AcDbPoly3dType as y, AcDb3dPolyline as H, AcDbHatch as X, AcGePolyline2d as U, AcGeLine2d as G, AcGeCircArc2d as Y, AcGeVector2d as _, AcGeEllipseArc2d as Z, AcGeSpline3d as E, AcGeLoop2d as M, AcDbTable as K, AcDbText as q, AcDbMText as J, AcDbLeader as Q, AcDbAlignedDimension as $, AcDbRotatedDimension as ee, AcDb3PointAngularDimension as ne, AcDbOrdinateDimension as oe, AcDbRadialDimension as te, AcDbDiametricDimension as se, AcDbRasterImage as re, AcDbWipeout as ie, AcDbViewport as ce, AcDbRay as le, AcDbXline as ae, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as L, AcDbAttribute as de, AcDbAttributeDefinition as pe, AcDbBlockReference as fe, AcCmTransparency as ue, AcDbDatabaseConverter as he, createWorkerApi as ge, AcDbLinetypeTableRecord as De, AcDbTextStyleTableRecord as Ae, DEFAULT_TEXT_STYLE as C, AcDbDimStyleTableRecord as Ie, AcCmColor as ye, AcDbLayerTableRecord as we, AcDbViewportTableRecord as Te, AcDbBlockTableRecord as be, AcDbBatchProcessing as Pe, ByLayer as Ee, AcDbLayout as Me, AcDbRasterImageDef as Le } from "@mlightcad/data-model";
2
- class S {
1
+ import { AcDbFace as m, AcGeVector3d as D, AcDbArc as k, transformOcsPointToWcs as w, AcDbCircle as F, AcDbEllipse as R, AcDbLine as V, AcGePoint3d as T, AcDbSpline as b, AcDbPoint as N, AcDbTrace as B, AcDbPolyline as z, AcGePoint2d as P, AcDbPolygonMesh as j, AcDbPolyFaceMesh as W, AcDbPoly2dType as A, AcDb2dPolyline as H, AcDbPoly3dType as y, AcDb3dPolyline as X, AcDbHatch as G, AcGePolyline2d as U, AcGeLine2d as Y, AcGeCircArc2d as _, AcGeVector2d as Z, AcGeEllipseArc2d as K, AcGeSpline3d as E, AcGeLoop2d as M, AcDbHatchObjectType as q, AcDbTable as J, AcDbText as Q, AcDbMText as $, AcDbLeader as ee, AcDbAlignedDimension as ne, AcDbRotatedDimension as oe, AcDb3PointAngularDimension as te, AcDbOrdinateDimension as se, AcDbRadialDimension as re, AcDbDiametricDimension as ie, AcDbRasterImage as ce, AcDbWipeout as ae, AcDbViewport as le, AcDbRay as de, AcDbXline as pe, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as C, AcDbAttribute as L, AcDbAttributeDefinition as fe, AcDbBlockReference as ue, AcCmTransparency as he, AcDbDatabaseConverter as ge, createWorkerApi as De, AcDbLinetypeTableRecord as Ae, AcDbTextStyleTableRecord as Ie, DEFAULT_TEXT_STYLE as S, AcDbDimStyleTableRecord as ye, AcCmColor as we, AcDbLayerTableRecord as Te, AcDbViewportTableRecord as be, AcDbBlockTableRecord as Pe, AcDbBatchProcessing as Ee, ByLayer as Me, AcDbLayout as Ce, AcDbRasterImageDef as Le } from "@mlightcad/data-model";
2
+ class x {
3
3
  convert(e) {
4
4
  const n = this.createEntity(e);
5
5
  return n && this.processCommonAttrs(e, n), n;
6
6
  }
7
7
  createEntity(e) {
8
- return e.type == "3DFACE" ? this.convertFace(e) : e.type == "ARC" ? this.convertArc(e) : e.type == "ATTDEF" ? this.convertAttributeDefinition(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 == "POLYLINE2D" ? this.convertPolyline2d(e) : e.type == "POLYLINE3D" ? this.convertPolyline3d(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 == "WIPEOUT" ? this.convertWipeout(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
8
+ return e.type == "3DFACE" ? this.convertFace(e) : e.type == "ARC" ? this.convertArc(e) : e.type == "ATTDEF" ? this.convertAttributeDefinition(e) : e.type == "ATTRIB" ? this.convertAttribute(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 == "POLYLINE2D" ? this.convertPolyline2d(e) : e.type == "POLYLINE3D" ? this.convertPolyline3d(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 == "WIPEOUT" ? this.convertWipeout(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
9
9
  }
10
10
  convertFace(e) {
11
- const n = new O();
11
+ const n = new m();
12
12
  return e.corner1 && n.setVertexAt(0, e.corner1), e.corner2 && n.setVertexAt(1, e.corner2), e.corner3 && n.setVertexAt(2, e.corner3), e.corner4 && n.setVertexAt(3, e.corner4), n.setEdgeInvisibilities(e.flag), n;
13
13
  }
14
14
  convertArc(e) {
15
15
  const n = e.extrusionDirection ?? D.Z_AXIS;
16
- return new m(
16
+ return new k(
17
17
  w(e.center, n),
18
18
  e.radius,
19
19
  e.startAngle,
@@ -23,29 +23,29 @@ class S {
23
23
  }
24
24
  convertCirle(e) {
25
25
  const n = e.extrusionDirection ?? D.Z_AXIS;
26
- return new k(
26
+ return new F(
27
27
  w(e.center, n),
28
28
  e.radius,
29
29
  n
30
30
  );
31
31
  }
32
32
  convertEllipse(e) {
33
- const n = new D(e.majorAxisEndPoint), t = n.length();
33
+ const n = new D(e.majorAxisEndPoint), s = n.length();
34
34
  return new R(
35
35
  e.center,
36
36
  e.extrusionDirection ?? D.Z_AXIS,
37
37
  n,
38
- t,
39
- t * e.axisRatio,
38
+ s,
39
+ s * e.axisRatio,
40
40
  e.startAngle,
41
41
  e.endAngle
42
42
  );
43
43
  }
44
44
  convertLine(e) {
45
- const n = e.startPoint, t = e.endPoint;
46
- return new F(
45
+ const n = e.startPoint, s = e.endPoint;
46
+ return new V(
47
47
  new T(n.x, n.y, n.z),
48
- new T(t.x, t.y, t.z)
48
+ new T(s.x, s.y, s.z)
49
49
  );
50
50
  }
51
51
  convertSpline(e) {
@@ -70,32 +70,32 @@ class S {
70
70
  return null;
71
71
  }
72
72
  convertPoint(e) {
73
- const n = new V();
73
+ const n = new N();
74
74
  return n.position = e.position, n;
75
75
  }
76
76
  convertSolid(e) {
77
- const n = new N();
77
+ const n = new B();
78
78
  return n.setPointAt(0, { ...e.corner1, z: 0 }), n.setPointAt(1, { ...e.corner2, z: 0 }), n.setPointAt(2, { ...e.corner3, z: 0 }), n.setPointAt(
79
79
  3,
80
80
  e.corner4 ? { ...e.corner4, z: 0 } : { ...e.corner3, z: 0 }
81
81
  ), n.thickness = e.thickness, n;
82
82
  }
83
83
  convertLWPolyline(e) {
84
- const n = new B();
84
+ const n = new z();
85
85
  n.closed = !!(e.flag & 512);
86
- const t = e.constantWidth ?? -1;
87
- return e.vertices.forEach((o, s) => {
86
+ const s = e.constantWidth ?? -1;
87
+ return e.vertices.forEach((o, t) => {
88
88
  n.addVertexAt(
89
- s,
89
+ t,
90
90
  new P(o.x, o.y),
91
91
  o.bulge,
92
- o.startWidth ?? t,
93
- o.endWidth ?? t
92
+ o.startWidth ?? s,
93
+ o.endWidth ?? s
94
94
  );
95
95
  }), n;
96
96
  }
97
97
  convertPolyline2d(e) {
98
- const n = !!(e.flag & 1), t = !!(e.flag & 16), o = !!(e.flag & 64), s = !!(e.flag & 32), r = [], a = [], c = [];
98
+ const n = !!(e.flag & 1), s = !!(e.flag & 16), o = !!(e.flag & 64), t = !!(e.flag & 32), r = [], l = [], c = [];
99
99
  if (e.vertices.map((i) => {
100
100
  if (!(i.flag & 16))
101
101
  if (o && i.flag & 128)
@@ -104,7 +104,7 @@ class S {
104
104
  x: i.x,
105
105
  y: i.y,
106
106
  z: i.z
107
- }), a.push(i.bulge ?? 0);
107
+ }), l.push(i.bulge ?? 0);
108
108
  else {
109
109
  const d = [];
110
110
  i.polyfaceIndex0 != null && i.polyfaceIndex0 != 0 && d.push(Math.abs(i.polyfaceIndex0) - 1), i.polyfaceIndex1 != null && i.polyfaceIndex1 != 0 && d.push(Math.abs(i.polyfaceIndex1) - 1), i.polyfaceIndex2 != null && i.polyfaceIndex2 != 0 && d.push(Math.abs(i.polyfaceIndex2) - 1), i.polyfaceIndex3 != null && i.polyfaceIndex3 != 0 && d.push(Math.abs(i.polyfaceIndex3) - 1), d.length >= 3 && c.push(d);
@@ -114,53 +114,53 @@ class S {
114
114
  x: i.x,
115
115
  y: i.y,
116
116
  z: i.z
117
- }), a.push(i.bulge ?? 0);
118
- }), t) {
117
+ }), l.push(i.bulge ?? 0);
118
+ }), s) {
119
119
  const i = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
120
- return new z(i, d, r, n, s);
120
+ return new j(i, d, r, n, t);
121
121
  } else {
122
122
  if (o)
123
123
  return new W(r, c);
124
124
  {
125
125
  let i = A.SimplePoly;
126
- return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new j(
126
+ return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new H(
127
127
  i,
128
128
  r,
129
129
  0,
130
130
  n,
131
131
  e.startWidth,
132
132
  e.endWidth,
133
- a
133
+ l
134
134
  );
135
135
  }
136
136
  }
137
137
  }
138
138
  convertPolyline3d(e) {
139
- const n = !!(e.flag & 1), t = [];
140
- e.vertices.map((s) => {
141
- s.flag & 16 || t.push({
142
- x: s.x,
143
- y: s.y,
144
- z: s.z
139
+ const n = !!(e.flag & 1), s = [];
140
+ e.vertices.map((t) => {
141
+ t.flag & 16 || s.push({
142
+ x: t.x,
143
+ y: t.y,
144
+ z: t.z
145
145
  });
146
146
  });
147
147
  let o = y.SimplePoly;
148
- return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new H(o, t, n);
148
+ return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new X(o, s, n);
149
149
  }
150
150
  convertHatch(e) {
151
151
  var o;
152
- const n = new X();
153
- return (o = e.definitionLines) == null || o.forEach((s) => {
152
+ const n = new G();
153
+ if ((o = e.definitionLines) == null || o.forEach((t) => {
154
154
  n.definitionLines.push({
155
- angle: s.angle,
156
- base: s.base,
157
- offset: s.offset,
158
- dashLengths: s.numberOfDashLengths > 0 ? s.dashLengths : []
155
+ angle: t.angle,
156
+ base: t.base,
157
+ offset: t.offset,
158
+ dashLengths: t.numberOfDashLengths > 0 ? t.dashLengths : []
159
159
  });
160
- }), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((s) => {
161
- if (s.boundaryPathTypeFlag & 2) {
162
- const a = s, c = new U();
163
- c.closed = a.isClosed, a.vertices.forEach((i, d) => {
160
+ }), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((t) => {
161
+ if (t.boundaryPathTypeFlag & 2) {
162
+ const l = t, c = new U();
163
+ c.closed = l.isClosed, l.vertices.forEach((i, d) => {
164
164
  c.addVertexAt(d, {
165
165
  x: i.x,
166
166
  y: i.y,
@@ -168,46 +168,46 @@ class S {
168
168
  });
169
169
  }), n.add(c);
170
170
  } else {
171
- const a = s, c = [];
172
- a.edges.forEach((d) => {
171
+ const l = t, c = [];
172
+ l.edges.forEach((d) => {
173
173
  if (d != null) {
174
174
  if (d.type == 1) {
175
- const l = d;
176
- c.push(new G(l.start, l.end));
175
+ const a = d;
176
+ c.push(new Y(a.start, a.end));
177
177
  } else if (d.type == 2) {
178
- const l = d;
178
+ const a = d;
179
179
  c.push(
180
- new Y(
181
- l.center,
182
- l.radius,
183
- l.startAngle,
184
- l.endAngle,
185
- !l.isCCW
180
+ new _(
181
+ a.center,
182
+ a.radius,
183
+ a.startAngle,
184
+ a.endAngle,
185
+ !a.isCCW
186
186
  )
187
187
  );
188
188
  } else if (d.type == 3) {
189
- const l = d;
190
- new _().subVectors(l.end, l.center);
189
+ const a = d;
190
+ new Z().subVectors(a.end, a.center);
191
191
  const p = Math.sqrt(
192
- Math.pow(l.end.x, 2) + Math.pow(l.end.y, 2)
193
- ), f = p * l.lengthOfMinorAxis;
194
- let u = l.startAngle, g = l.endAngle;
195
- const v = Math.atan2(l.end.y, l.end.x);
196
- l.isCCW || (u = Math.PI * 2 - u, g = Math.PI * 2 - g), c.push(
197
- new Z(
198
- { ...l.center, z: 0 },
192
+ Math.pow(a.end.x, 2) + Math.pow(a.end.y, 2)
193
+ ), f = p * a.lengthOfMinorAxis;
194
+ let u = a.startAngle, g = a.endAngle;
195
+ const O = Math.atan2(a.end.y, a.end.x);
196
+ a.isCCW || (u = Math.PI * 2 - u, g = Math.PI * 2 - g), c.push(
197
+ new K(
198
+ { ...a.center, z: 0 },
199
199
  p,
200
200
  f,
201
201
  u,
202
202
  g,
203
- !l.isCCW,
204
- v
203
+ !a.isCCW,
204
+ O
205
205
  )
206
206
  );
207
207
  } else if (d.type == 4) {
208
- const l = d;
209
- if (l.numberOfControlPoints > 0 && l.numberOfKnots > 0) {
210
- const h = l.controlPoints.map(
208
+ const a = d;
209
+ if (a.numberOfControlPoints > 0 && a.numberOfKnots > 0) {
210
+ const h = a.controlPoints.map(
211
211
  (u) => ({
212
212
  x: u.x,
213
213
  y: u.y,
@@ -215,16 +215,16 @@ class S {
215
215
  })
216
216
  );
217
217
  let p = !0;
218
- const f = l.controlPoints.map((u) => (u.weight == null && (p = !1), u.weight || 1));
218
+ const f = a.controlPoints.map((u) => (u.weight == null && (p = !1), u.weight || 1));
219
219
  c.push(
220
220
  new E(
221
221
  h,
222
- l.knots,
222
+ a.knots,
223
223
  p ? f : void 0
224
224
  )
225
225
  );
226
- } else if (l.numberOfFitData > 0) {
227
- const h = l.fitDatum.map((p) => ({
226
+ } else if (a.numberOfFitData > 0) {
227
+ const h = a.fitDatum.map((p) => ({
228
228
  x: p.x,
229
229
  y: p.y,
230
230
  z: 0
@@ -237,93 +237,100 @@ class S {
237
237
  const i = M.buildFromEdges(c);
238
238
  i.length == 0 && c.length > 0 ? n.add(new M(c)) : i.forEach((d) => n.add(d));
239
239
  }
240
- }), n;
240
+ }), e.gradientFlag) {
241
+ const t = e;
242
+ if (n.hatchObjectType = q.GradientObject, n.gradientName = t.gradientName, n.gradientAngle = t.gradientRotation ?? 0, n.gradientShift = t.gradientDefinition ?? 0, n.gradientOneColorMode = t.gradientColorFlag == 1, n.shadeTintValue = t.colorTint ?? 0, t.gradientColors) {
243
+ const r = t.gradientColors.length;
244
+ r > 1 ? (n.gradientStartColor = t.gradientColors[0].rgb, n.gradientEndColor = t.gradientColors[1].rgb) : r > 0 && (n.gradientStartColor = t.gradientColors[0].rgb);
245
+ }
246
+ }
247
+ return n;
241
248
  }
242
249
  convertTable(e) {
243
- const n = new K(
250
+ const n = new J(
244
251
  e.name,
245
252
  e.rowCount,
246
253
  e.columnCount
247
254
  );
248
255
  return n.tableStyleId = e.tableStyleId, n.owningBlockRecordId = e.blockRecordHandle, e.directionVector && (n.horizontalDirection = new D(e.directionVector)), n.attachmentPoint = e.attachmentPoint, n.position.copy(e.startPoint), n.tableValueFlag = e.tableValue, n.tableOverrideFlag = e.overrideFlag, n.borderColorOverrideFlag = e.borderColorOverrideFlag, n.borderLineweightOverrideFlag = e.borderLineWeightOverrideFlag, n.borderVisibilityOverrideFlag = e.borderVisibilityOverrideFlag, e.columnWidthArr.forEach(
249
- (t, o) => n.setColumnWidth(o, t)
256
+ (s, o) => n.setColumnWidth(o, s)
250
257
  ), e.rowHeightArr.forEach(
251
- (t, o) => n.setRowHeight(o, t)
252
- ), e.cells.forEach((t, o) => {
253
- n.setCell(o, t);
258
+ (s, o) => n.setRowHeight(o, s)
259
+ ), e.cells.forEach((s, o) => {
260
+ n.setCell(o, s);
254
261
  }), n;
255
262
  }
256
263
  convertText(e) {
257
- const n = new q();
264
+ const n = new Q();
258
265
  return n.textString = e.text, n.styleName = e.styleName, n.height = e.textHeight, n.position.copy(e.startPoint), n.rotation = e.rotation, n.oblique = e.obliqueAngle ?? 0, n.thickness = e.thickness, n.horizontalMode = e.halign, n.verticalMode = e.valign, n.widthFactor = e.xScale ?? 1, n;
259
266
  }
260
267
  convertMText(e) {
261
- const n = new J();
268
+ const n = new $();
262
269
  return n.contents = e.text, e.styleName != null && (n.styleName = e.styleName), n.height = e.textHeight, n.width = e.rectWidth, n.rotation = e.rotation || 0, n.location = e.insertionPoint, n.attachmentPoint = e.attachmentPoint, e.direction && (n.direction = new D(e.direction)), n.drawingDirection = e.drawingDirection, n;
263
270
  }
264
271
  convertLeader(e) {
265
- const n = new Q();
266
- return e.vertices.forEach((t) => {
267
- n.appendVertex(t);
272
+ const n = new ee();
273
+ return e.vertices.forEach((s) => {
274
+ n.appendVertex(s);
268
275
  }), n.hasArrowHead = e.isArrowheadEnabled, n.hasHookLine = e.isHooklineExists, n.isSplined = e.isSpline, n.dimensionStyle = e.styleName, n.annoType = e.leaderCreationFlag, n;
269
276
  }
270
277
  convertDimension(e) {
271
278
  if (e.subclassMarker == "AcDbAlignedDimension") {
272
- const n = e, t = new $(
279
+ const n = e, s = new ne(
273
280
  n.subDefinitionPoint1,
274
281
  n.subDefinitionPoint2,
275
282
  n.definitionPoint
276
283
  );
277
- return n.insertionPoint && (t.dimBlockPosition = {
284
+ return n.insertionPoint && (s.dimBlockPosition = {
278
285
  x: n.insertionPoint.x,
279
286
  y: n.insertionPoint.y,
280
287
  z: 0
281
- }), t.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, t), t;
288
+ }), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
282
289
  } else if (e.subclassMarker == "AcDbRotatedDimension") {
283
- const n = e, t = new ee(
290
+ const n = e, s = new oe(
284
291
  n.subDefinitionPoint1,
285
292
  n.subDefinitionPoint2,
286
293
  n.definitionPoint
287
294
  );
288
- return n.insertionPoint && (t.dimBlockPosition = {
295
+ return n.insertionPoint && (s.dimBlockPosition = {
289
296
  x: n.insertionPoint.x,
290
297
  y: n.insertionPoint.y,
291
298
  z: 0
292
- }), t.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, t), t;
299
+ }), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
293
300
  } else if (e.subclassMarker == "AcDb3PointAngularDimension") {
294
- const n = e, t = new ne(
301
+ const n = e, s = new te(
295
302
  n.centerPoint,
296
303
  n.subDefinitionPoint1,
297
304
  n.subDefinitionPoint2,
298
305
  n.definitionPoint
299
306
  );
300
- return this.processDimensionCommonAttrs(e, t), t;
307
+ return this.processDimensionCommonAttrs(e, s), s;
301
308
  } else if (e.subclassMarker == "AcDbOrdinateDimension") {
302
- const n = e, t = new oe(
309
+ const n = e, s = new se(
303
310
  n.subDefinitionPoint1,
304
311
  n.subDefinitionPoint2
305
312
  );
306
- return this.processDimensionCommonAttrs(e, t), t;
313
+ return this.processDimensionCommonAttrs(e, s), s;
307
314
  } else if (e.subclassMarker == "AcDbRadialDimension") {
308
- const n = e, t = new te(
315
+ const n = e, s = new re(
309
316
  n.definitionPoint,
310
317
  n.centerPoint,
311
318
  n.leaderLength
312
319
  );
313
- return this.processDimensionCommonAttrs(e, t), t;
320
+ return this.processDimensionCommonAttrs(e, s), s;
314
321
  } else if (e.subclassMarker == "AcDbDiametricDimension") {
315
- const n = e, t = new se(
322
+ const n = e, s = new ie(
316
323
  n.definitionPoint,
317
324
  n.centerPoint,
318
325
  n.leaderLength
319
326
  );
320
- return this.processDimensionCommonAttrs(e, t), t;
327
+ return this.processDimensionCommonAttrs(e, s), s;
321
328
  }
322
329
  return null;
323
330
  }
324
331
  processImage(e, n) {
325
- n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((t) => {
326
- n.clipBoundary.push(new P(t));
332
+ n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((s) => {
333
+ n.clipBoundary.push(new P(s));
327
334
  }), n.clipBoundaryType = e.clippingBoundaryType, n.width = Math.sqrt(
328
335
  e.uPixel.x ** 2 + e.uPixel.y ** 2 + e.uPixel.z ** 2
329
336
  ) * e.imageSize.x, n.height = Math.sqrt(
@@ -331,42 +338,42 @@ class S {
331
338
  ) * e.imageSize.y, n.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
332
339
  }
333
340
  convertImage(e) {
334
- const n = new re();
341
+ const n = new ce();
335
342
  return this.processImage(e, n), n;
336
343
  }
337
344
  convertWipeout(e) {
338
- const n = new ie();
345
+ const n = new ae();
339
346
  return this.processImage(e, n), n;
340
347
  }
341
348
  convertViewport(e) {
342
- const n = new ce();
349
+ const n = new le();
343
350
  return n.number = e.viewportId, n.centerPoint.copy(e.viewportCenter), n.height = e.height, n.width = e.width, n.viewCenter.copy(e.displayCenter), n.viewHeight = e.viewHeight, n;
344
351
  }
345
352
  convertRay(e) {
346
- const n = new le();
353
+ const n = new de();
347
354
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
348
355
  }
349
356
  convertXline(e) {
350
- const n = new ae();
357
+ const n = new pe();
351
358
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
352
359
  }
353
360
  convertAttributeCommon(e, n) {
354
- const t = e.text;
355
- n.textString = t.text, n.styleName = t.styleName, n.height = t.textHeight, n.position.copy(t.startPoint), n.rotation = t.rotation, n.oblique = t.obliqueAngle ?? 0, n.thickness = t.thickness, n.horizontalMode = t.halign, n.verticalMode = t.valign, n.widthFactor = t.xScale ?? 1, n.tag = e.tag, n.fieldLength = e.fieldLength, n.isInvisible = (e.flags & I.Invisible) !== 0, n.isConst = (e.flags & I.Const) !== 0, n.isVerifiable = (e.flags & I.Verifiable) !== 0, n.isPreset = (e.flags & I.Preset) !== 0, n.lockPositionInBlock = e.lockPositionFlag, n.isReallyLocked = e.isReallyLocked, n.isMTextAttribute = (e.mtextFlag & L.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & L.ConstMultiLine) !== 0;
361
+ const s = e.text;
362
+ n.textString = s.text, n.styleName = s.styleName, n.height = s.textHeight, n.position.copy(s.startPoint), n.rotation = s.rotation, n.oblique = s.obliqueAngle ?? 0, n.thickness = s.thickness, n.horizontalMode = s.halign, n.verticalMode = s.valign, n.widthFactor = s.xScale ?? 1, n.tag = e.tag, n.fieldLength = e.fieldLength, n.isInvisible = (e.flags & I.Invisible) !== 0, n.isConst = (e.flags & I.Const) !== 0, n.isVerifiable = (e.flags & I.Verifiable) !== 0, n.isPreset = (e.flags & I.Preset) !== 0, n.lockPositionInBlock = e.lockPositionFlag, n.isReallyLocked = e.isReallyLocked, n.isMTextAttribute = (e.mtextFlag & C.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & C.ConstMultiLine) !== 0;
356
363
  }
357
364
  convertAttribute(e) {
358
- const n = new de();
365
+ const n = new L();
359
366
  return this.convertAttributeCommon(e, n), n;
360
367
  }
361
368
  convertAttributeDefinition(e) {
362
- const n = new pe();
369
+ const n = new fe();
363
370
  return this.convertAttributeCommon(e, n), n.prompt = e.prompt, n;
364
371
  }
365
372
  convertBlockReference(e) {
366
- const n = new fe(e.name);
367
- return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.attribs && e.attribs.forEach((t) => {
368
- const o = this.convertAttribute(t);
369
- n.appendAttributes(o);
373
+ const n = new ue(e.name);
374
+ return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.handle != null && (n.objectId = e.handle), e.attribs && e.attribs.forEach((s) => {
375
+ const o = this.convert(s);
376
+ o instanceof L && n.appendAttributes(o);
370
377
  }), n;
371
378
  }
372
379
  processDimensionCommonAttrs(e, n) {
@@ -374,25 +381,25 @@ class S {
374
381
  }
375
382
  processCommonAttrs(e, n) {
376
383
  if (n.layer = e.layer || "0", n.objectId = e.handle, e.ownerBlockRecordSoftId != null && (n.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (n.lineType = e.lineType), e.lineweight != null && (n.lineWeight = e.lineweight), e.lineTypeScale != null && (n.linetypeScale = e.lineTypeScale), e.color != null && n.color.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (n.color.colorIndex = e.colorIndex), e.colorName && (n.color.colorName = e.colorName), e.isVisible != null && (n.visibility = e.isVisible), e.transparency != null) {
377
- const t = new ue();
378
- t.method = e.transparencyType, (t.isByBlock || t.isByBlock) && (t.alpha = e.transparency), n.transparency = t;
384
+ const s = new he();
385
+ s.method = e.transparencyType, (s.isByBlock || s.isByBlock) && (s.alpha = e.transparency), n.transparency = s;
379
386
  }
380
387
  }
381
388
  }
382
- const Ce = "*MODEL_SPACE";
383
- class xe extends he {
389
+ const Se = "*MODEL_SPACE";
390
+ class ve extends ge {
384
391
  constructor(e = {}) {
385
392
  super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
386
393
  }
387
394
  async parse(e, n) {
388
- const t = this.config, o = this.getParserWorkerTimeout(e, n);
389
- if (t.useWorker && t.parserWorkerUrl) {
390
- const s = ge({
391
- workerUrl: t.parserWorkerUrl,
395
+ const s = this.config, o = this.getParserWorkerTimeout(e, n);
396
+ if (s.useWorker && s.parserWorkerUrl) {
397
+ const t = De({
398
+ workerUrl: s.parserWorkerUrl,
392
399
  timeout: o,
393
400
  maxConcurrentWorkers: 1
394
- }), r = await s.execute(e);
395
- if (s.destroy(), r.success)
401
+ }), r = await t.execute(e);
402
+ if (t.destroy(), r.success)
396
403
  return r.data;
397
404
  throw new Error(
398
405
  `Failed to parse drawing due to error: '${r.error}'`
@@ -405,60 +412,60 @@ class xe extends he {
405
412
  e.tables.BLOCK_RECORD.entries.forEach((r) => {
406
413
  n.set(r.name, r);
407
414
  });
408
- const t = /* @__PURE__ */ new Map(), o = (r) => {
415
+ const s = /* @__PURE__ */ new Map(), o = (r) => {
409
416
  if (r) {
410
- const a = r.lastIndexOf(".");
411
- return a >= 0 ? r.substring(0, a).toLowerCase() : r.toLowerCase();
417
+ const l = r.lastIndexOf(".");
418
+ return l >= 0 ? r.substring(0, l).toLowerCase() : r.toLowerCase();
412
419
  }
413
420
  };
414
421
  e.tables.STYLE.entries.forEach((r) => {
415
- const a = [];
422
+ const l = [];
416
423
  let c = o(r.font);
417
- c && a.push(c), c = o(r.bigFont), c && a.push(c), t.set(r.name, a);
424
+ c && l.push(c), c = o(r.bigFont), c && l.push(c), s.set(r.name, l);
418
425
  });
419
- const s = /* @__PURE__ */ new Set();
420
- return this.getFontsInBlock(e.entities, n, t, s), Array.from(s);
426
+ const t = /* @__PURE__ */ new Set();
427
+ return this.getFontsInBlock(e.entities, n, s, t), Array.from(t);
421
428
  }
422
- getFontsInBlock(e, n, t, o) {
423
- const s = /\\f(.*?)\|/g;
429
+ getFontsInBlock(e, n, s, o) {
430
+ const t = /\\f(.*?)\|/g;
424
431
  e.forEach((r) => {
425
432
  if (r.type == "MTEXT") {
426
- const a = r;
427
- [...a.text.matchAll(s)].forEach((i) => {
433
+ const l = r;
434
+ [...l.text.matchAll(t)].forEach((i) => {
428
435
  o.add(i[1].toLowerCase());
429
436
  });
430
- const c = t.get(a.styleName);
437
+ const c = s.get(l.styleName);
431
438
  c == null || c.forEach((i) => o.add(i));
432
439
  } else if (r.type == "TEXT") {
433
- const a = r, c = t.get(a.styleName);
440
+ const l = r, c = s.get(l.styleName);
434
441
  c == null || c.forEach((i) => o.add(i));
435
442
  } else if (r.type == "INSERT") {
436
- const a = r, c = n.get(a.name);
437
- c && this.getFontsInBlock(c.entities, n, t, o);
443
+ const l = r, c = n.get(l.name);
444
+ c && this.getFontsInBlock(c.entities, n, s, o);
438
445
  }
439
446
  });
440
447
  }
441
448
  processLineTypes(e, n) {
442
449
  e.tables.LTYPE.entries.forEach((o) => {
443
- const s = {
450
+ const t = {
444
451
  name: o.name,
445
452
  description: o.description,
446
453
  standardFlag: o.standardFlag,
447
454
  totalPatternLength: o.totalPatternLength,
448
455
  pattern: o.pattern
449
- }, r = new De(s);
456
+ }, r = new Ae(t);
450
457
  this.processCommonTableEntryAttrs(o, r), r.name = o.name, n.tables.linetypeTable.add(r);
451
458
  });
452
459
  }
453
460
  processTextStyles(e, n) {
454
461
  e.tables.STYLE.entries.forEach((o) => {
455
- const s = new Ae(o);
456
- this.processCommonTableEntryAttrs(o, s), n.tables.textStyleTable.add(s);
462
+ const t = new Ie(o);
463
+ this.processCommonTableEntryAttrs(o, t), n.tables.textStyleTable.add(t);
457
464
  });
458
465
  }
459
466
  processDimStyles(e, n) {
460
467
  e.tables.DIMSTYLE.entries.forEach((o) => {
461
- const s = {
468
+ const t = {
462
469
  name: o.name,
463
470
  ownerId: o.ownerHandle,
464
471
  dimpost: o.DIMPOST || "",
@@ -520,28 +527,28 @@ class xe extends he {
520
527
  dimfit: o.DIMFIT || 0,
521
528
  dimupt: o.DIMUPT,
522
529
  dimatfit: o.DIMATFIT,
523
- dimtxsty: C,
530
+ dimtxsty: S,
524
531
  dimldrblk: "",
525
532
  dimblk: o.DIMBLK || "",
526
533
  dimblk1: o.DIMBLK1 || "",
527
534
  dimblk2: o.DIMBLK2 || "",
528
535
  dimlwd: o.DIMLWD,
529
536
  dimlwe: o.DIMLWE
530
- }, r = new Ie(s);
537
+ }, r = new ye(t);
531
538
  this.processCommonTableEntryAttrs(o, r), n.tables.dimStyleTable.add(r);
532
539
  });
533
540
  }
534
541
  processLayers(e, n) {
535
542
  e.tables.LAYER.entries.forEach((o) => {
536
- const s = new ye();
537
- s.colorIndex = o.colorIndex;
538
- const r = new we({
543
+ const t = new we();
544
+ t.colorIndex = o.colorIndex;
545
+ const r = new Te({
539
546
  name: o.name,
540
547
  standardFlags: o.standardFlag,
541
548
  linetype: o.lineType,
542
549
  lineWeight: o.lineweight,
543
550
  isOff: o.off,
544
- color: s,
551
+ color: t,
545
552
  isPlottable: o.plotFlag != 0
546
553
  });
547
554
  this.processCommonTableEntryAttrs(o, r), n.tables.layerTable.add(r);
@@ -549,54 +556,54 @@ class xe extends he {
549
556
  }
550
557
  processViewports(e, n) {
551
558
  e.tables.VPORT.entries.forEach((o) => {
552
- const s = new Te();
553
- this.processCommonTableEntryAttrs(o, s), o.circleSides && (s.circleSides = o.circleSides), s.standardFlag = o.standardFlag, s.center.copy(o.center), s.lowerLeftCorner.copy(o.lowerLeftCorner), s.upperRightCorner.copy(o.upperRightCorner), o.snapBasePoint && s.snapBase.copy(o.snapBasePoint), o.snapRotationAngle && (s.snapAngle = o.snapRotationAngle), o.snapSpacing && s.snapIncrements.copy(o.snapSpacing), o.majorGridLines && (s.gridMajor = o.majorGridLines), o.gridSpacing && s.gridIncrements.copy(o.gridSpacing), o.backgroundObjectId && (s.backgroundObjectId = o.backgroundObjectId), s.gsView.center.copy(o.center), s.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget), s.gsView.viewTarget.copy(o.viewTarget), o.lensLength && (s.gsView.lensLength = o.lensLength), o.frontClippingPlane && (s.gsView.frontClippingPlane = o.frontClippingPlane), o.backClippingPlane && (s.gsView.backClippingPlane = o.backClippingPlane), o.viewHeight && (s.gsView.viewHeight = o.viewHeight), o.viewTwistAngle && (s.gsView.viewTwistAngle = o.viewTwistAngle), o.frozenLayers && (s.gsView.frozenLayers = o.frozenLayers), o.styleSheet && (s.gsView.styleSheet = o.styleSheet), o.renderMode && (s.gsView.renderMode = o.renderMode), o.viewMode && (s.gsView.viewMode = o.viewMode), o.ucsIconSetting && (s.gsView.ucsIconSetting = o.ucsIconSetting), o.ucsOrigin && s.gsView.ucsOrigin.copy(o.ucsOrigin), o.ucsXAxis && s.gsView.ucsXAxis.copy(o.ucsXAxis), o.ucsYAxis && s.gsView.ucsYAxis.copy(o.ucsYAxis), o.orthographicType && (s.gsView.orthographicType = o.orthographicType), o.shadePlotSetting && (s.gsView.shadePlotSetting = o.shadePlotSetting), o.shadePlotObjectId && (s.gsView.shadePlotObjectId = o.shadePlotObjectId), o.visualStyleObjectId && (s.gsView.visualStyleObjectId = o.visualStyleObjectId), o.isDefaultLightingOn && (s.gsView.isDefaultLightingOn = o.isDefaultLightingOn), o.defaultLightingType && (s.gsView.defaultLightingType = o.defaultLightingType), o.brightness && (s.gsView.brightness = o.brightness), o.contrast && (s.gsView.contrast = o.contrast), o.ambientColor && (s.gsView.ambientColor = o.ambientColor), n.tables.viewportTable.add(s);
559
+ const t = new be();
560
+ this.processCommonTableEntryAttrs(o, t), o.circleSides && (t.circleSides = o.circleSides), t.standardFlag = o.standardFlag, t.center.copy(o.center), t.lowerLeftCorner.copy(o.lowerLeftCorner), t.upperRightCorner.copy(o.upperRightCorner), o.snapBasePoint && t.snapBase.copy(o.snapBasePoint), o.snapRotationAngle && (t.snapAngle = o.snapRotationAngle), o.snapSpacing && t.snapIncrements.copy(o.snapSpacing), o.majorGridLines && (t.gridMajor = o.majorGridLines), o.gridSpacing && t.gridIncrements.copy(o.gridSpacing), o.backgroundObjectId && (t.backgroundObjectId = o.backgroundObjectId), t.gsView.center.copy(o.center), t.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget), t.gsView.viewTarget.copy(o.viewTarget), o.lensLength && (t.gsView.lensLength = o.lensLength), o.frontClippingPlane && (t.gsView.frontClippingPlane = o.frontClippingPlane), o.backClippingPlane && (t.gsView.backClippingPlane = o.backClippingPlane), o.viewHeight && (t.gsView.viewHeight = o.viewHeight), o.viewTwistAngle && (t.gsView.viewTwistAngle = o.viewTwistAngle), o.frozenLayers && (t.gsView.frozenLayers = o.frozenLayers), o.styleSheet && (t.gsView.styleSheet = o.styleSheet), o.renderMode && (t.gsView.renderMode = o.renderMode), o.viewMode && (t.gsView.viewMode = o.viewMode), o.ucsIconSetting && (t.gsView.ucsIconSetting = o.ucsIconSetting), o.ucsOrigin && t.gsView.ucsOrigin.copy(o.ucsOrigin), o.ucsXAxis && t.gsView.ucsXAxis.copy(o.ucsXAxis), o.ucsYAxis && t.gsView.ucsYAxis.copy(o.ucsYAxis), o.orthographicType && (t.gsView.orthographicType = o.orthographicType), o.shadePlotSetting && (t.gsView.shadePlotSetting = o.shadePlotSetting), o.shadePlotObjectId && (t.gsView.shadePlotObjectId = o.shadePlotObjectId), o.visualStyleObjectId && (t.gsView.visualStyleObjectId = o.visualStyleObjectId), o.isDefaultLightingOn && (t.gsView.isDefaultLightingOn = o.isDefaultLightingOn), o.defaultLightingType && (t.gsView.defaultLightingType = o.defaultLightingType), o.brightness && (t.gsView.brightness = o.brightness), o.contrast && (t.gsView.contrast = o.contrast), o.ambientColor && (t.gsView.ambientColor = o.ambientColor), n.tables.viewportTable.add(t);
554
561
  });
555
562
  }
556
563
  processBlockTables(e, n) {
557
564
  e.tables.BLOCK_RECORD.entries.forEach((o) => {
558
- let s = n.tables.blockTable.getAt(o.name);
559
- s || (s = new be(), s.objectId = o.handle, s.name = o.name, s.ownerId = o.ownerHandle, s.origin.copy(o.basePoint), s.layoutId = o.layout, s.blockInsertUnits = o.insertionUnits, s.explodability = o.explodability, s.blockScaling = o.scalability, o.bmpPreview && (s.bmpPreview = o.bmpPreview), n.tables.blockTable.add(s)), !s.isModelSapce && o.entities && o.entities.length > 0 && this.processEntitiesInBlock(o.entities, s);
565
+ let t = n.tables.blockTable.getAt(o.name);
566
+ t || (t = new Pe(), t.objectId = o.handle, t.name = o.name, t.ownerId = o.ownerHandle, t.origin.copy(o.basePoint), t.layoutId = o.layout, t.blockInsertUnits = o.insertionUnits, t.explodability = o.explodability, t.blockScaling = o.scalability, o.bmpPreview && (t.bmpPreview = o.bmpPreview), n.tables.blockTable.add(t)), !t.isModelSapce && o.entities && o.entities.length > 0 && this.processEntitiesInBlock(o.entities, t);
560
567
  });
561
568
  }
562
569
  processBlocks(e, n) {
563
570
  }
564
571
  async processEntitiesInBlock(e, n) {
565
- const t = new S(), o = e.length, s = [];
572
+ const s = new x(), o = e.length, t = [];
566
573
  for (let r = 0; r < o; r++) {
567
- const a = e[r], c = t.convert(a);
568
- c && s.push(c);
574
+ const l = e[r], c = s.convert(l);
575
+ c && t.push(c);
569
576
  }
570
- n.appendEntity(s);
577
+ n.appendEntity(t);
571
578
  }
572
- async processEntities(e, n, t, o, s) {
573
- const r = new S();
574
- let a = [];
575
- e.tables.BLOCK_RECORD.entries.forEach((l) => {
576
- this.isModelSpace(l.name) && (a = l.entities);
579
+ async processEntities(e, n, s, o, t) {
580
+ const r = new x();
581
+ let l = [];
582
+ e.tables.BLOCK_RECORD.entries.forEach((a) => {
583
+ this.isModelSpace(a.name) && (l = a.entities);
577
584
  });
578
- const c = a.length, i = new Pe(
585
+ const c = l.length, i = new Ee(
579
586
  c,
580
587
  100 - o.value,
581
- t
588
+ s
582
589
  );
583
- this.config.convertByEntityType && (a = this.groupAndFlattenByType(a));
590
+ this.config.convertByEntityType && (l = this.groupAndFlattenByType(l));
584
591
  const d = n.tables.blockTable.modelSpace;
585
- await i.processChunk(async (l, h) => {
592
+ await i.processChunk(async (a, h) => {
586
593
  const p = [];
587
- for (let f = l; f < h; f++) {
588
- const u = a[f], g = r.convert(u);
594
+ for (let f = a; f < h; f++) {
595
+ const u = l[f], g = r.convert(u);
589
596
  g && p.push(g);
590
597
  }
591
- if (d.appendEntity(p), s) {
598
+ if (d.appendEntity(p), t) {
592
599
  let f = o.value + h / c * (100 - o.value);
593
- f > 100 && (f = 100), await s(f, "ENTITY", "IN-PROGRESS");
600
+ f > 100 && (f = 100), await t(f, "ENTITY", "IN-PROGRESS");
594
601
  }
595
602
  });
596
603
  }
597
604
  processHeader(e, n) {
598
- const t = e.header;
599
- t.CECOLOR && (t.CECOLOR.index >= 0 && t.CECOLOR.index <= 256 ? n.cecolor.colorIndex = t.CECOLOR.index : n.cecolor.setRGBValue(t.CECOLOR.rgb)), n.angBase = t.ANGBASE ?? 0, n.angDir = t.ANGDIR ?? 0, n.aunits = t.AUNITS ?? 0, n.celtype = t.CELTYPE ?? Ee, n.celtscale = t.CELTSCALE ?? 1, n.ltscale = t.LTSCALE ?? 1, t.EXTMAX && (n.extmax = t.EXTMAX), t.EXTMIN && (n.extmin = t.EXTMIN), n.insunits = t.INSUNITS ?? 1, n.pdmode = t.PDMODE ?? 0, n.pdsize = t.PDSIZE ?? 0, n.textstyle = t.TEXTSTYLE ?? C;
605
+ const s = e.header;
606
+ s.CECOLOR && (s.CECOLOR.index >= 0 && s.CECOLOR.index <= 256 ? n.cecolor.colorIndex = s.CECOLOR.index : n.cecolor.setRGBValue(s.CECOLOR.rgb)), n.angBase = s.ANGBASE ?? 0, n.angDir = s.ANGDIR ?? 0, n.aunits = s.AUNITS ?? 0, n.celtype = s.CELTYPE ?? Me, n.celtscale = s.CELTSCALE ?? 1, n.ltscale = s.LTSCALE ?? 1, s.EXTMAX && (n.extmax = s.EXTMAX), s.EXTMIN && (n.extmin = s.EXTMIN), n.insunits = s.INSUNITS ?? 1, n.pdmode = s.PDMODE ?? 0, n.pdsize = s.PDSIZE ?? 0, n.textstyle = s.TEXTSTYLE ?? S;
600
607
  }
601
608
  processCommonTableEntryAttrs(e, n) {
602
609
  n.name = e.name, n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
@@ -605,40 +612,40 @@ class xe extends he {
605
612
  this.processLayouts(e, n), this.processImageDefs(e, n);
606
613
  }
607
614
  processLayouts(e, n) {
608
- const t = n.objects.layout;
609
- e.objects.LAYOUT.forEach((s) => {
610
- const r = new Me();
611
- r.layoutName = s.layoutName, r.tabOrder = s.tabOrder;
612
- const a = n.tables.blockTable.newIterator();
613
- r.objectId = s.handle;
614
- for (const c of a)
615
+ const s = n.objects.layout;
616
+ e.objects.LAYOUT.forEach((t) => {
617
+ const r = new Ce();
618
+ r.layoutName = t.layoutName, r.tabOrder = t.tabOrder;
619
+ const l = n.tables.blockTable.newIterator();
620
+ r.objectId = t.handle;
621
+ for (const c of l)
615
622
  if (c.layoutId === r.objectId) {
616
623
  r.blockTableRecordId = c.objectId;
617
624
  break;
618
625
  }
619
- r.blockTableRecordId || s.layoutName === "Model" && (r.blockTableRecordId = n.tables.blockTable.modelSpace.objectId), r.limits.min.copy(s.minLimit), r.limits.max.copy(s.maxLimit), r.extents.min.copy(s.minExtent), r.extents.max.copy(s.maxExtent), s.viewportId && r.viewportArray.push(s.viewportId), this.processCommonObjectAttrs(s, r), t.setAt(r.layoutName, r);
626
+ r.blockTableRecordId || t.layoutName === "Model" && (r.blockTableRecordId = n.tables.blockTable.modelSpace.objectId), r.limits.min.copy(t.minLimit), r.limits.max.copy(t.maxLimit), r.extents.min.copy(t.minExtent), r.extents.max.copy(t.maxExtent), t.viewportId && r.viewportArray.push(t.viewportId), this.processCommonObjectAttrs(t, r), s.setAt(r.layoutName, r);
620
627
  });
621
628
  }
622
629
  processImageDefs(e, n) {
623
- const t = n.objects.imageDefinition;
624
- e.objects.IMAGEDEF.forEach((s) => {
630
+ const s = n.objects.imageDefinition;
631
+ e.objects.IMAGEDEF.forEach((t) => {
625
632
  const r = new Le();
626
- r.sourceFileName = s.fileName, this.processCommonObjectAttrs(s, r), t.setAt(r.objectId, r);
633
+ r.sourceFileName = t.fileName, this.processCommonObjectAttrs(t, r), s.setAt(r.objectId, r);
627
634
  });
628
635
  }
629
636
  processCommonObjectAttrs(e, n) {
630
637
  n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
631
638
  }
632
639
  groupAndFlattenByType(e) {
633
- const n = {}, t = [];
640
+ const n = {}, s = [];
634
641
  for (const o of e)
635
- n[o.type] || (n[o.type] = [], t.push(o.type)), n[o.type].push(o);
636
- return t.flatMap((o) => n[o]);
642
+ n[o.type] || (n[o.type] = [], s.push(o.type)), n[o.type].push(o);
643
+ return s.flatMap((o) => n[o]);
637
644
  }
638
645
  isModelSpace(e) {
639
- return e && e.toUpperCase() == Ce;
646
+ return e && e.toUpperCase() == Se;
640
647
  }
641
648
  }
642
649
  export {
643
- xe as AcDbLibreDwgConverter
650
+ ve as AcDbLibreDwgConverter
644
651
  };