@mlightcad/libredwg-converter 3.5.33 → 3.5.35

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,5 +1,5 @@
1
- import { AcDbFace as H, AcGeVector3d as A, AcDbArc as j, transformOcsPointToWcs as x, AcDbCircle as z, AcDbEllipse as W, AcDbLine as X, AcGePoint3d as S, AcDbSpline as M, AcDbPoint as U, AcDbTrace as G, AcDbPolyline as Y, AcGePoint2d as m, AcDbPolygonMesh as Z, AcDbPolyFaceMesh as _, AcDbPoly2dType as b, AcDb2dPolyline as K, AcDbPoly3dType as I, AcDb3dPolyline as q, AcDbHatch as J, AcGePolyline2d as Q, AcGeLine2d as $, AcGeCircArc2d as ee, AcGeVector2d as te, AcGeEllipseArc2d as ne, AcGeSpline3d as v, AcGeLoop2d as k, AcDbHatchObjectType as oe, AcDbTable as re, AcDbText as ie, AcDbMText as se, AcDbLeader as ce, AcDbMLine as ae, AcDbMLeader as le, AcDbMLeaderLineType as de, AcDbMLeaderContentType as T, AcDbAlignedDimension as fe, AcDbRotatedDimension as pe, AcDb3PointAngularDimension as ge, AcDbOrdinateDimension as ue, AcDbRadialDimension as he, AcDbDiametricDimension as De, AcDbRasterImage as ye, AcDbWipeout as Ae, AcDbViewport as be, AcDbRay as Pe, AcDbXline as Ie, AcDbAttributeFlags as P, AcDbAttributeMTextFlag as O, AcDbAttribute as N, AcDbAttributeDefinition as Te, AcDbBlockReference as we, AcCmTransparency as Le, AcDbDatabaseConverter as Ce, createWorkerApi as Ee, AcDbLinetypeTableRecord as xe, AcDbTextStyleTableRecord as Se, DEFAULT_TEXT_STYLE as R, AcDbDimStyleTableRecord as Me, AcCmColor as me, AcDbLayerTableRecord as ve, AcDbViewportTableRecord as ke, AcDbBlockTableRecord as Oe, AcDbBatchProcessing as Ne, ByLayer as Re, AcDbLayout as Ve, AcDbRasterImageDef as Fe } from "@mlightcad/data-model";
2
- class V {
1
+ import { AcDbFace as j, AcGeVector3d as A, AcDbArc as z, transformOcsPointToWcs as x, AcDbCircle as U, AcDbEllipse as X, AcDbLine as _, AcGePoint3d as S, AcDbSpline as M, AcDbPoint as G, AcDbTrace as Y, AcDbPolyline as Z, AcGePoint2d as m, AcDbPolygonMesh as K, AcDbPolyFaceMesh as q, AcDbPoly2dType as b, AcDb2dPolyline as J, AcDbPoly3dType as I, AcDb3dPolyline as Q, AcDbHatch as $, AcGePolyline2d as ee, AcGeLine2d as te, AcGeCircArc2d as ne, AcGeVector2d as oe, AcGeEllipseArc2d as re, AcGeSpline3d as v, AcGeLoop2d as O, AcDbHatchObjectType as ie, AcDbTable as se, AcDbText as ce, AcDbMText as ae, AcDbLeader as le, AcDbMLine as de, AcDbMLeader as fe, AcDbMLeaderLineType as pe, AcDbMLeaderContentType as T, AcDbAlignedDimension as ue, AcDbRotatedDimension as ge, AcDb3PointAngularDimension as he, AcDbOrdinateDimension as De, AcDbRadialDimension as ye, AcDbDiametricDimension as Ae, AcDbRasterImage as be, AcDbWipeout as Pe, AcDbViewport as Ie, AcDbRay as Te, AcDbXline as Le, AcDbAttributeFlags as P, AcDbAttributeMTextFlag as k, AcDbAttribute as N, AcDbAttributeDefinition as we, AcDbBlockReference as Ce, AcCmColor as B, AcCmTransparency as Ee, AcDbDatabaseConverter as xe, createWorkerApi as Se, AcDbLinetypeTableRecord as Me, AcDbTextStyleTableRecord as me, DEFAULT_TEXT_STYLE as R, AcDbDimStyleTableRecord as ve, AcDbLayerTableRecord as Oe, AcDbViewportTableRecord as ke, VPORT_FALLBACK_CENTER_2D as V, VPORT_FALLBACK_LLC as Ne, VPORT_FALLBACK_URC as Re, VPORT_FALLBACK_VIEW_DIR as Ve, VPORT_FALLBACK_VIEW_TARGET as Fe, AcDbBlockTableRecord as Be, AcDbBatchProcessing as He, ByLayer as We, AcDbLayout as je, AcDbRasterImageDef as ze } from "@mlightcad/data-model";
2
+ class F {
3
3
  convert(e) {
4
4
  const t = this.createEntity(e);
5
5
  return t && this.processCommonAttrs(e, t), t;
@@ -8,12 +8,12 @@ class V {
8
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 == "MLINE" ? this.convertMLine(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "MULTILEADER" || e.type == "MLEADER" ? this.convertMLeader(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 t = new H();
11
+ const t = new j();
12
12
  return e.corner1 && t.setVertexAt(0, e.corner1), e.corner2 && t.setVertexAt(1, e.corner2), e.corner3 && t.setVertexAt(2, e.corner3), e.corner4 && t.setVertexAt(3, e.corner4), t.setEdgeInvisibilities(e.flag), t;
13
13
  }
14
14
  convertArc(e) {
15
15
  const t = e.extrusionDirection ?? A.Z_AXIS;
16
- return new j(
16
+ return new z(
17
17
  x(e.center, t),
18
18
  e.radius,
19
19
  e.startAngle,
@@ -23,7 +23,7 @@ class V {
23
23
  }
24
24
  convertCirle(e) {
25
25
  const t = e.extrusionDirection ?? A.Z_AXIS;
26
- return new z(
26
+ return new U(
27
27
  x(e.center, t),
28
28
  e.radius,
29
29
  t
@@ -31,7 +31,7 @@ class V {
31
31
  }
32
32
  convertEllipse(e) {
33
33
  const t = new A(e.majorAxisEndPoint), o = t.length();
34
- return new W(
34
+ return new X(
35
35
  e.center,
36
36
  e.extrusionDirection ?? A.Z_AXIS,
37
37
  t,
@@ -43,7 +43,7 @@ class V {
43
43
  }
44
44
  convertLine(e) {
45
45
  const t = e.startPoint, o = e.endPoint;
46
- return new X(
46
+ return new _(
47
47
  new S(t.x, t.y, t.z),
48
48
  new S(o.x, o.y, o.z)
49
49
  );
@@ -70,18 +70,18 @@ class V {
70
70
  return null;
71
71
  }
72
72
  convertPoint(e) {
73
- const t = new U();
73
+ const t = new G();
74
74
  return t.position = e.position, t;
75
75
  }
76
76
  convertSolid(e) {
77
- const t = new G();
77
+ const t = new Y();
78
78
  return t.setPointAt(0, { ...e.corner1, z: 0 }), t.setPointAt(1, { ...e.corner2, z: 0 }), t.setPointAt(2, { ...e.corner3, z: 0 }), t.setPointAt(
79
79
  3,
80
80
  e.corner4 ? { ...e.corner4, z: 0 } : { ...e.corner3, z: 0 }
81
81
  ), t.thickness = e.thickness, t;
82
82
  }
83
83
  convertLWPolyline(e) {
84
- const t = new Y();
84
+ const t = new Z();
85
85
  t.closed = !!(e.flag & 512);
86
86
  const o = e.constantWidth ?? -1;
87
87
  return e.vertices.forEach((n, r) => {
@@ -117,13 +117,13 @@ class V {
117
117
  }), a.push(c.bulge ?? 0);
118
118
  }), o) {
119
119
  const c = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
120
- return new Z(c, d, i, t, r);
120
+ return new K(c, d, i, t, r);
121
121
  } else {
122
122
  if (n)
123
- return new _(i, s);
123
+ return new q(i, s);
124
124
  {
125
125
  let c = b.SimplePoly;
126
- return e.flag & 2 ? c = b.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? c = b.CubicSplinePoly : e.smoothType == 5 && (c = b.QuadSplinePoly)), new K(
126
+ return e.flag & 2 ? c = b.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? c = b.CubicSplinePoly : e.smoothType == 5 && (c = b.QuadSplinePoly)), new J(
127
127
  c,
128
128
  i,
129
129
  0,
@@ -145,11 +145,11 @@ class V {
145
145
  });
146
146
  });
147
147
  let n = I.SimplePoly;
148
- return e.flag & 4 && (e.smoothType == 6 ? n = I.CubicSplinePoly : e.smoothType == 5 && (n = I.QuadSplinePoly)), new q(n, o, t);
148
+ return e.flag & 4 && (e.smoothType == 6 ? n = I.CubicSplinePoly : e.smoothType == 5 && (n = I.QuadSplinePoly)), new Q(n, o, t);
149
149
  }
150
150
  convertHatch(e) {
151
151
  var n;
152
- const t = new J();
152
+ const t = new $();
153
153
  if ((n = e.definitionLines) == null || n.forEach((r) => {
154
154
  t.definitionLines.push({
155
155
  angle: r.angle,
@@ -159,7 +159,7 @@ class V {
159
159
  });
160
160
  }), t.isSolidFill = e.solidFill == 1, t.hatchStyle = e.hatchStyle, t.patternName = e.patternName, t.patternType = e.patternType, t.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, t.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((r) => {
161
161
  if (r.boundaryPathTypeFlag & 2) {
162
- const a = r, s = new Q();
162
+ const a = r, s = new ee();
163
163
  s.closed = a.isClosed, a.vertices.forEach((c, d) => {
164
164
  s.addVertexAt(d, {
165
165
  x: c.x,
@@ -173,11 +173,11 @@ class V {
173
173
  if (d != null) {
174
174
  if (d.type == 1) {
175
175
  const l = d;
176
- s.push(new $(l.start, l.end));
176
+ s.push(new te(l.start, l.end));
177
177
  } else if (d.type == 2) {
178
178
  const l = d;
179
179
  s.push(
180
- new ee(
180
+ new ne(
181
181
  l.center,
182
182
  l.radius,
183
183
  l.startAngle,
@@ -187,18 +187,18 @@ class V {
187
187
  );
188
188
  } else if (d.type == 3) {
189
189
  const l = d;
190
- new te().subVectors(l.end, l.center);
190
+ new oe().subVectors(l.end, l.center);
191
191
  const p = Math.sqrt(
192
192
  Math.pow(l.end.x, 2) + Math.pow(l.end.y, 2)
193
- ), g = p * l.lengthOfMinorAxis;
194
- let u = l.startAngle, y = l.endAngle;
193
+ ), u = p * l.lengthOfMinorAxis;
194
+ let g = l.startAngle, y = l.endAngle;
195
195
  const h = Math.atan2(l.end.y, l.end.x);
196
- l.isCCW || (u = Math.PI * 2 - u, y = Math.PI * 2 - y), s.push(
197
- new ne(
196
+ l.isCCW || (g = Math.PI * 2 - g, y = Math.PI * 2 - y), s.push(
197
+ new re(
198
198
  { ...l.center, z: 0 },
199
199
  p,
200
- g,
201
200
  u,
201
+ g,
202
202
  y,
203
203
  !l.isCCW,
204
204
  h
@@ -208,19 +208,19 @@ class V {
208
208
  const l = d;
209
209
  if (l.numberOfControlPoints > 0 && l.numberOfKnots > 0) {
210
210
  const f = l.controlPoints.map(
211
- (u) => ({
212
- x: u.x,
213
- y: u.y,
211
+ (g) => ({
212
+ x: g.x,
213
+ y: g.y,
214
214
  z: 0
215
215
  })
216
216
  );
217
217
  let p = !0;
218
- const g = l.controlPoints.map((u) => (u.weight == null && (p = !1), u.weight || 1));
218
+ const u = l.controlPoints.map((g) => (g.weight == null && (p = !1), g.weight || 1));
219
219
  s.push(
220
220
  new v(
221
221
  f,
222
222
  l.knots,
223
- p ? g : void 0
223
+ p ? u : void 0
224
224
  )
225
225
  );
226
226
  } else if (l.numberOfFitData > 0) {
@@ -234,12 +234,12 @@ class V {
234
234
  }
235
235
  }
236
236
  });
237
- const c = k.buildFromEdges(s);
238
- c.length == 0 && s.length > 0 ? t.add(new k(s)) : c.forEach((d) => t.add(d));
237
+ const c = O.buildFromEdges(s);
238
+ c.length == 0 && s.length > 0 ? t.add(new O(s)) : c.forEach((d) => t.add(d));
239
239
  }
240
240
  }), e.gradientFlag) {
241
241
  const r = e;
242
- if (t.hatchObjectType = oe.GradientObject, t.gradientName = r.gradientName, t.gradientAngle = r.gradientRotation ?? 0, t.gradientShift = r.gradientDefinition ?? 0, t.gradientOneColorMode = r.gradientColorFlag == 1, t.shadeTintValue = r.colorTint ?? 0, r.gradientColors) {
242
+ if (t.hatchObjectType = ie.GradientObject, t.gradientName = r.gradientName, t.gradientAngle = r.gradientRotation ?? 0, t.gradientShift = r.gradientDefinition ?? 0, t.gradientOneColorMode = r.gradientColorFlag == 1, t.shadeTintValue = r.colorTint ?? 0, r.gradientColors) {
243
243
  const i = r.gradientColors.length;
244
244
  i > 1 ? (t.gradientStartColor = r.gradientColors[0].rgb, t.gradientEndColor = r.gradientColors[1].rgb) : i > 0 && (t.gradientStartColor = r.gradientColors[0].rgb);
245
245
  }
@@ -247,7 +247,7 @@ class V {
247
247
  return t;
248
248
  }
249
249
  convertTable(e) {
250
- const t = new re(
250
+ const t = new se(
251
251
  e.name,
252
252
  e.rowCount,
253
253
  e.columnCount
@@ -261,23 +261,23 @@ class V {
261
261
  }), t;
262
262
  }
263
263
  convertText(e) {
264
- const t = new ie();
264
+ const t = new ce();
265
265
  t.textString = e.text, t.styleName = e.styleName, t.height = e.textHeight, t.position.copy(e.startPoint);
266
266
  const o = !e.endPoint || e.endPoint.x === 0 && e.endPoint.y === 0 && (e.endPoint.z ?? 0) === 0;
267
267
  return e.endPoint && !o ? t.alignmentPoint.copy(e.endPoint) : t.alignmentPoint.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;
268
268
  }
269
269
  convertMText(e) {
270
- const t = new se();
270
+ const t = new ae();
271
271
  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 A(e.direction)), t.drawingDirection = e.drawingDirection, t;
272
272
  }
273
273
  convertLeader(e) {
274
- const t = new ce();
274
+ const t = new le();
275
275
  return e.vertices.forEach((o) => {
276
276
  t.appendVertex(o);
277
277
  }), t.hasArrowHead = e.isArrowheadEnabled, t.hasHookLine = e.isHooklineExists, t.isSplined = e.isSpline, t.dimensionStyle = e.styleName, t.annoType = e.leaderCreationFlag, t;
278
278
  }
279
279
  convertMLine(e) {
280
- const t = new ae();
280
+ const t = new de();
281
281
  return t.styleName = e.mlineStyle || "STANDARD", t.scale = e.scale, t.flags = e.flags, t.justification = e.justification, t.startPosition = e.startPoint, t.normal = e.extrusionDirection ?? A.Z_AXIS, t.styleCount = e.numberOfLines ?? 0, t.segments = (e.vertices ?? []).map((o) => ({
282
282
  position: o.vertex,
283
283
  direction: o.vertexDirection,
@@ -291,13 +291,13 @@ class V {
291
291
  })), t;
292
292
  }
293
293
  convertMLeader(e) {
294
- var p, g, u, y;
295
- const t = new le(), o = e;
294
+ var p, u, g, y;
295
+ const t = new fe(), o = e;
296
296
  t.leaderLineType = this.readNumber(o, [
297
297
  "multileaderType",
298
298
  "leaderLineType",
299
299
  "leaderType"
300
- ]) ?? de.StraightLeader;
300
+ ]) ?? pe.StraightLeader;
301
301
  const n = this.readNumber(o, ["contentType"]) ?? (e.textContent ? T.MTextContent : e.blockContent ? T.BlockContent : T.NoneContent);
302
302
  t.contentType = n, t.doglegEnabled = this.readBoolean(o, ["doglegEnabled", "enableDogleg"]) ?? !1, t.doglegLength = this.readNumber(o, ["doglegLength"]) ?? 0, e.landingPoint && (t.landingPoint = e.landingPoint), e.doglegVector && (t.doglegVector = e.doglegVector);
303
303
  const r = this.readString(o, [
@@ -350,7 +350,7 @@ class V {
350
350
  ]);
351
351
  h != null && D && (t.mtextContent = { text: h, anchorPoint: D });
352
352
  }
353
- if ((g = e.blockContent) != null && g.blockHandle && e.blockContent.position)
353
+ if ((u = e.blockContent) != null && u.blockHandle && e.blockContent.position)
354
354
  t.blockContent = {
355
355
  blockHandle: e.blockContent.blockHandle,
356
356
  position: e.blockContent.position
@@ -369,21 +369,21 @@ class V {
369
369
  position: D
370
370
  });
371
371
  }
372
- return (u = e.leaders) == null || u.forEach((h) => {
373
- var w;
372
+ return (g = e.leaders) == null || g.forEach((h) => {
373
+ var L;
374
374
  const D = t.addLeader({
375
375
  landingPoint: h.landingPoint ?? e.landingPoint,
376
376
  doglegVector: h.doglegVector ?? e.doglegVector,
377
377
  doglegLength: h.doglegLength ?? e.doglegLength
378
378
  });
379
- (w = h.leaderLines) == null || w.forEach((L) => {
379
+ (L = h.leaderLines) == null || L.forEach((w) => {
380
380
  var C;
381
- const B = t.addLeaderLine(
381
+ const W = t.addLeaderLine(
382
382
  D,
383
- L.vertices ?? []
383
+ w.vertices ?? []
384
384
  );
385
- (C = L.breaks) == null || C.forEach((E) => {
386
- t.addBreak(D, B, E.start, E.end);
385
+ (C = w.breaks) == null || C.forEach((E) => {
386
+ t.addBreak(D, W, E.start, E.end);
387
387
  });
388
388
  });
389
389
  }), t.numberOfLeaders === 0 && ((y = this.readLeaderLineArray(o)) == null || y.forEach((h) => {
@@ -397,7 +397,7 @@ class V {
397
397
  }
398
398
  convertDimension(e) {
399
399
  if (e.subclassMarker == "AcDbAlignedDimension") {
400
- const t = e, o = new fe(
400
+ const t = e, o = new ue(
401
401
  t.subDefinitionPoint1,
402
402
  t.subDefinitionPoint2,
403
403
  t.definitionPoint
@@ -408,7 +408,7 @@ class V {
408
408
  z: 0
409
409
  }), o.rotation = t.rotationAngle, this.processDimensionCommonAttrs(e, o), o;
410
410
  } else if (e.subclassMarker == "AcDbRotatedDimension") {
411
- const t = e, o = new pe(
411
+ const t = e, o = new ge(
412
412
  t.subDefinitionPoint1,
413
413
  t.subDefinitionPoint2,
414
414
  t.definitionPoint
@@ -419,7 +419,7 @@ class V {
419
419
  z: 0
420
420
  }), o.rotation = t.rotationAngle, this.processDimensionCommonAttrs(e, o), o;
421
421
  } else if (e.subclassMarker == "AcDb3PointAngularDimension") {
422
- const t = e, o = new ge(
422
+ const t = e, o = new he(
423
423
  t.centerPoint,
424
424
  t.subDefinitionPoint1,
425
425
  t.subDefinitionPoint2,
@@ -427,20 +427,20 @@ class V {
427
427
  );
428
428
  return this.processDimensionCommonAttrs(e, o), o;
429
429
  } else if (e.subclassMarker == "AcDbOrdinateDimension") {
430
- const t = e, o = new ue(
430
+ const t = e, o = new De(
431
431
  t.subDefinitionPoint1,
432
432
  t.subDefinitionPoint2
433
433
  );
434
434
  return this.processDimensionCommonAttrs(e, o), o;
435
435
  } else if (e.subclassMarker == "AcDbRadialDimension") {
436
- const t = e, o = new he(
436
+ const t = e, o = new ye(
437
437
  t.definitionPoint,
438
438
  t.centerPoint,
439
439
  t.leaderLength
440
440
  );
441
441
  return this.processDimensionCommonAttrs(e, o), o;
442
442
  } else if (e.subclassMarker == "AcDbDiametricDimension") {
443
- const t = e, o = new De(
443
+ const t = e, o = new Ae(
444
444
  t.definitionPoint,
445
445
  t.centerPoint,
446
446
  t.leaderLength
@@ -459,41 +459,41 @@ class V {
459
459
  ) * e.imageSize.y, t.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
460
460
  }
461
461
  convertImage(e) {
462
- const t = new ye();
462
+ const t = new be();
463
463
  return this.processImage(e, t), t;
464
464
  }
465
465
  convertWipeout(e) {
466
- const t = new Ae();
466
+ const t = new Pe();
467
467
  return this.processImage(e, t), t;
468
468
  }
469
469
  convertViewport(e) {
470
- const t = new be();
470
+ const t = new Ie();
471
471
  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;
472
472
  }
473
473
  convertRay(e) {
474
- const t = new Pe();
474
+ const t = new Te();
475
475
  return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
476
476
  }
477
477
  convertXline(e) {
478
- const t = new Ie();
478
+ const t = new Le();
479
479
  return t.basePoint.copy(e.firstPoint), t.unitDir.copy(e.unitDirection), t;
480
480
  }
481
481
  convertAttributeCommon(e, t) {
482
482
  const o = e.text;
483
483
  t.textString = o.text, t.styleName = o.styleName, t.height = o.textHeight, t.position.copy(o.startPoint);
484
484
  const n = e.alignmentPoint ?? o.endPoint, r = !n || n.x === 0 && n.y === 0 && (n.z ?? 0) === 0;
485
- n && !r ? t.alignmentPoint.copy(n) : t.alignmentPoint.copy(o.startPoint), t.rotation = o.rotation, t.oblique = o.obliqueAngle ?? 0, t.thickness = o.thickness, t.horizontalMode = o.halign, t.verticalMode = o.valign, t.widthFactor = o.xScale ?? 1, t.tag = e.tag, t.fieldLength = e.fieldLength, t.isInvisible = (e.flags & P.Invisible) !== 0, t.isConst = (e.flags & P.Const) !== 0, t.isVerifiable = (e.flags & P.Verifiable) !== 0, t.isPreset = (e.flags & P.Preset) !== 0, t.lockPositionInBlock = e.lockPositionFlag, t.isReallyLocked = e.isReallyLocked, t.isMTextAttribute = (e.mtextFlag & O.MultiLine) !== 0, t.isConstMTextAttribute = (e.mtextFlag & O.ConstMultiLine) !== 0;
485
+ n && !r ? t.alignmentPoint.copy(n) : t.alignmentPoint.copy(o.startPoint), t.rotation = o.rotation, t.oblique = o.obliqueAngle ?? 0, t.thickness = o.thickness, t.horizontalMode = o.halign, t.verticalMode = o.valign, t.widthFactor = o.xScale ?? 1, t.tag = e.tag, t.fieldLength = e.fieldLength, t.isInvisible = (e.flags & P.Invisible) !== 0, t.isConst = (e.flags & P.Const) !== 0, t.isVerifiable = (e.flags & P.Verifiable) !== 0, t.isPreset = (e.flags & P.Preset) !== 0, t.lockPositionInBlock = e.lockPositionFlag, t.isReallyLocked = e.isReallyLocked, t.isMTextAttribute = (e.mtextFlag & k.MultiLine) !== 0, t.isConstMTextAttribute = (e.mtextFlag & k.ConstMultiLine) !== 0;
486
486
  }
487
487
  convertAttribute(e) {
488
488
  const t = new N();
489
489
  return this.convertAttributeCommon(e, t), t;
490
490
  }
491
491
  convertAttributeDefinition(e) {
492
- const t = new Te();
492
+ const t = new we();
493
493
  return this.convertAttributeCommon(e, t), t.prompt = e.prompt, t;
494
494
  }
495
495
  convertBlockReference(e) {
496
- const t = new we(e.name);
496
+ const t = new Ce(e.name);
497
497
  return e.insertionPoint && t.position.copy(e.insertionPoint), t.scaleFactors.x = e.xScale, t.scaleFactors.y = e.yScale, t.scaleFactors.z = e.zScale, t.rotation = e.rotation, t.normal.copy(e.extrusionDirection), e.handle != null && (t.objectId = e.handle), e.attribs && e.attribs.forEach((o) => {
498
498
  const n = this.convert(o);
499
499
  n instanceof N && t.appendAttributes(n);
@@ -503,8 +503,12 @@ class V {
503
503
  t.dimBlockId = e.name, t.textPosition.copy(e.textPoint), t.textRotation = e.textRotation || 0, e.textLineSpacingFactor && (t.textLineSpacingFactor = e.textLineSpacingFactor), e.textLineSpacingStyle && (t.textLineSpacingStyle = e.textLineSpacingStyle), t.dimensionStyleName = e.styleName, t.dimensionText = e.text || "", t.measurement = e.measurement;
504
504
  }
505
505
  processCommonAttrs(e, t) {
506
- if (t.layer = e.layer || "0", t.objectId = e.handle, e.ownerBlockRecordSoftId != null && (t.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (t.lineType = e.lineType), e.lineweight != null && (t.lineWeight = e.lineweight), e.lineTypeScale != null && (t.linetypeScale = e.lineTypeScale), e.color != null && t.color.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (t.color.colorIndex = e.colorIndex), e.colorName && (t.color.colorName = e.colorName), e.isVisible != null && (t.visibility = e.isVisible), e.transparency != null) {
507
- const o = new Le();
506
+ if (t.layer = e.layer || "0", t.objectId = e.handle, e.ownerBlockRecordSoftId != null && (t.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (t.lineType = e.lineType), e.lineweight != null && (t.lineWeight = e.lineweight), e.lineTypeScale != null && (t.linetypeScale = e.lineTypeScale), e.color != null || e.colorIndex != null || e.colorName) {
507
+ const o = new B();
508
+ e.color != null && o.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (o.colorIndex = e.colorIndex), e.colorName && (o.colorName = e.colorName), t.color = o;
509
+ }
510
+ if (e.isVisible != null && (t.visibility = e.isVisible), e.transparency != null) {
511
+ const o = new Ee();
508
512
  o.method = e.transparencyType, (o.isByBlock || o.isByBlock) && (o.alpha = e.transparency), t.transparency = o;
509
513
  }
510
514
  }
@@ -553,15 +557,15 @@ class V {
553
557
  return !!e && typeof e == "object" && typeof e.x == "number" && typeof e.y == "number";
554
558
  }
555
559
  }
556
- const Be = "*MODEL_SPACE";
557
- class je extends Ce {
560
+ const Ue = "*MODEL_SPACE";
561
+ class _e extends xe {
558
562
  constructor(e = {}) {
559
563
  super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
560
564
  }
561
565
  async parse(e, t) {
562
566
  const o = this.config, n = this.getParserWorkerTimeout(e, t);
563
567
  if (o.useWorker && o.parserWorkerUrl) {
564
- const r = Ee({
568
+ const r = Se({
565
569
  workerUrl: o.parserWorkerUrl,
566
570
  timeout: n,
567
571
  maxConcurrentWorkers: 1
@@ -627,13 +631,13 @@ class je extends Ce {
627
631
  standardFlag: n.standardFlag,
628
632
  totalPatternLength: n.totalPatternLength,
629
633
  pattern: n.pattern
630
- }, i = new xe(r);
634
+ }, i = new Me(r);
631
635
  this.processCommonTableEntryAttrs(n, i), i.name = n.name, t.tables.linetypeTable.add(i);
632
636
  });
633
637
  }
634
638
  processTextStyles(e, t) {
635
639
  e.tables.STYLE.entries.forEach((n) => {
636
- const r = new Se(n);
640
+ const r = new me(n);
637
641
  this.processCommonTableEntryAttrs(n, r), t.tables.textStyleTable.add(r);
638
642
  });
639
643
  }
@@ -708,15 +712,15 @@ class je extends Ce {
708
712
  dimblk2: n.DIMBLK2 || "",
709
713
  dimlwd: n.DIMLWD,
710
714
  dimlwe: n.DIMLWE
711
- }, i = new Me(r);
715
+ }, i = new ve(r);
712
716
  this.processCommonTableEntryAttrs(n, i), t.tables.dimStyleTable.add(i);
713
717
  });
714
718
  }
715
719
  processLayers(e, t) {
716
720
  e.tables.LAYER.entries.forEach((n) => {
717
- const r = new me();
721
+ const r = new B();
718
722
  r.colorIndex = n.colorIndex;
719
- const i = new ve({
723
+ const i = new Oe({
720
724
  name: n.name,
721
725
  standardFlags: n.standardFlag,
722
726
  linetype: n.lineType,
@@ -731,19 +735,23 @@ class je extends Ce {
731
735
  processViewports(e, t) {
732
736
  e.tables.VPORT.entries.forEach((n) => {
733
737
  const r = new ke();
734
- this.processCommonTableEntryAttrs(n, r), n.circleSides && (r.circleSides = n.circleSides), r.standardFlag = n.standardFlag, r.center.copy(n.center), r.lowerLeftCorner.copy(n.lowerLeftCorner), r.upperRightCorner.copy(n.upperRightCorner), n.snapBasePoint && r.snapBase.copy(n.snapBasePoint), n.snapRotationAngle && (r.snapAngle = n.snapRotationAngle), n.snapSpacing && r.snapIncrements.copy(n.snapSpacing), n.majorGridLines && (r.gridMajor = n.majorGridLines), n.gridSpacing && r.gridIncrements.copy(n.gridSpacing), n.backgroundObjectId && (r.backgroundObjectId = n.backgroundObjectId), r.gsView.center.copy(n.center), r.gsView.viewDirectionFromTarget.copy(n.viewDirectionFromTarget), r.gsView.viewTarget.copy(n.viewTarget), n.lensLength && (r.gsView.lensLength = n.lensLength), n.frontClippingPlane && (r.gsView.frontClippingPlane = n.frontClippingPlane), n.backClippingPlane && (r.gsView.backClippingPlane = n.backClippingPlane), n.viewHeight && (r.gsView.viewHeight = n.viewHeight), n.viewTwistAngle && (r.gsView.viewTwistAngle = n.viewTwistAngle), n.frozenLayers && (r.gsView.frozenLayers = n.frozenLayers), n.styleSheet && (r.gsView.styleSheet = n.styleSheet), n.renderMode && (r.gsView.renderMode = n.renderMode), n.viewMode && (r.gsView.viewMode = n.viewMode), n.ucsIconSetting && (r.gsView.ucsIconSetting = n.ucsIconSetting), n.ucsOrigin && r.gsView.ucsOrigin.copy(n.ucsOrigin), n.ucsXAxis && r.gsView.ucsXAxis.copy(n.ucsXAxis), n.ucsYAxis && r.gsView.ucsYAxis.copy(n.ucsYAxis), n.orthographicType && (r.gsView.orthographicType = n.orthographicType), n.shadePlotSetting && (r.gsView.shadePlotSetting = n.shadePlotSetting), n.shadePlotObjectId && (r.gsView.shadePlotObjectId = n.shadePlotObjectId), n.visualStyleObjectId && (r.gsView.visualStyleObjectId = n.visualStyleObjectId), n.isDefaultLightingOn && (r.gsView.isDefaultLightingOn = n.isDefaultLightingOn), n.defaultLightingType && (r.gsView.defaultLightingType = n.defaultLightingType), n.brightness && (r.gsView.brightness = n.brightness), n.contrast && (r.gsView.contrast = n.contrast), n.ambientColor && (r.gsView.ambientColor = n.ambientColor), t.tables.viewportTable.add(r);
738
+ this.processCommonTableEntryAttrs(n, r), n.circleSides && (r.circleSides = n.circleSides), r.standardFlag = n.standardFlag, r.center.copy(n.center ?? V), r.lowerLeftCorner.copy(n.lowerLeftCorner ?? Ne), r.upperRightCorner.copy(n.upperRightCorner ?? Re), n.snapBasePoint && r.snapBase.copy(n.snapBasePoint), n.snapRotationAngle && (r.snapAngle = n.snapRotationAngle), n.snapSpacing && r.snapIncrements.copy(n.snapSpacing), n.majorGridLines && (r.gridMajor = n.majorGridLines), n.gridSpacing && r.gridIncrements.copy(n.gridSpacing), n.backgroundObjectId && (r.backgroundObjectId = n.backgroundObjectId), r.gsView.center.copy(n.center ?? V), r.gsView.viewDirectionFromTarget.copy(
739
+ n.viewDirectionFromTarget ?? Ve
740
+ ), r.gsView.viewTarget.copy(
741
+ n.viewTarget ?? Fe
742
+ ), n.lensLength && (r.gsView.lensLength = n.lensLength), n.frontClippingPlane && (r.gsView.frontClippingPlane = n.frontClippingPlane), n.backClippingPlane && (r.gsView.backClippingPlane = n.backClippingPlane), n.viewHeight && (r.gsView.viewHeight = n.viewHeight), n.viewTwistAngle && (r.gsView.viewTwistAngle = n.viewTwistAngle), n.frozenLayers && (r.gsView.frozenLayers = n.frozenLayers), n.styleSheet && (r.gsView.styleSheet = n.styleSheet), n.renderMode && (r.gsView.renderMode = n.renderMode), n.viewMode && (r.gsView.viewMode = n.viewMode), n.ucsIconSetting && (r.gsView.ucsIconSetting = n.ucsIconSetting), n.ucsOrigin && r.gsView.ucsOrigin.copy(n.ucsOrigin), n.ucsXAxis && r.gsView.ucsXAxis.copy(n.ucsXAxis), n.ucsYAxis && r.gsView.ucsYAxis.copy(n.ucsYAxis), n.orthographicType && (r.gsView.orthographicType = n.orthographicType), n.shadePlotSetting && (r.gsView.shadePlotSetting = n.shadePlotSetting), n.shadePlotObjectId && (r.gsView.shadePlotObjectId = n.shadePlotObjectId), n.visualStyleObjectId && (r.gsView.visualStyleObjectId = n.visualStyleObjectId), n.isDefaultLightingOn && (r.gsView.isDefaultLightingOn = n.isDefaultLightingOn), n.defaultLightingType && (r.gsView.defaultLightingType = n.defaultLightingType), n.brightness && (r.gsView.brightness = n.brightness), n.contrast && (r.gsView.contrast = n.contrast), n.ambientColor && (r.gsView.ambientColor = n.ambientColor), t.tables.viewportTable.add(r);
735
743
  });
736
744
  }
737
745
  processBlockTables(e, t) {
738
746
  e.tables.BLOCK_RECORD.entries.forEach((n) => {
739
747
  let r = t.tables.blockTable.getAt(n.name);
740
- r || (r = new Oe(), r.objectId = n.handle, r.name = n.name, r.ownerId = n.ownerHandle, r.origin.copy(n.basePoint), r.layoutId = n.layout, r.blockInsertUnits = n.insertionUnits, r.explodability = n.explodability, r.blockScaling = n.scalability, n.bmpPreview && (r.bmpPreview = n.bmpPreview), t.tables.blockTable.add(r)), !r.isModelSapce && n.entities && n.entities.length > 0 && this.processEntitiesInBlock(n.entities, r);
748
+ r || (r = new Be(), r.objectId = n.handle, r.name = n.name, r.ownerId = n.ownerHandle, r.origin.copy(n.basePoint), r.layoutId = n.layout, r.blockInsertUnits = n.insertionUnits, r.explodability = n.explodability, r.blockScaling = n.scalability, n.bmpPreview && (r.bmpPreview = n.bmpPreview), t.tables.blockTable.add(r)), !r.isModelSapce && n.entities && n.entities.length > 0 && this.processEntitiesInBlock(n.entities, r);
741
749
  });
742
750
  }
743
751
  processBlocks(e, t) {
744
752
  }
745
753
  async processEntitiesInBlock(e, t) {
746
- const o = new V(), n = e.length, r = [];
754
+ const o = new F(), n = e.length, r = [];
747
755
  for (let i = 0; i < n; i++) {
748
756
  const a = e[i], s = o.convert(a);
749
757
  s && r.push(s);
@@ -751,12 +759,12 @@ class je extends Ce {
751
759
  t.appendEntity(r);
752
760
  }
753
761
  async processEntities(e, t, o, n, r) {
754
- const i = new V();
762
+ const i = new F();
755
763
  let a = [];
756
764
  e.tables.BLOCK_RECORD.entries.forEach((l) => {
757
765
  this.isModelSpace(l.name) && (a = l.entities);
758
766
  });
759
- const s = a.length, c = new Ne(
767
+ const s = a.length, c = new He(
760
768
  s,
761
769
  100 - n.value,
762
770
  o
@@ -765,19 +773,19 @@ class je extends Ce {
765
773
  const d = t.tables.blockTable.modelSpace;
766
774
  await c.processChunk(async (l, f) => {
767
775
  const p = [];
768
- for (let g = l; g < f; g++) {
769
- const u = a[g], y = i.convert(u);
776
+ for (let u = l; u < f; u++) {
777
+ const g = a[u], y = i.convert(g);
770
778
  y && p.push(y);
771
779
  }
772
780
  if (d.appendEntity(p), r) {
773
- let g = n.value + f / s * (100 - n.value);
774
- g > 100 && (g = 100), await r(g, "ENTITY", "IN-PROGRESS");
781
+ let u = n.value + f / s * (100 - n.value);
782
+ u > 100 && (u = 100), await r(u, "ENTITY", "IN-PROGRESS");
775
783
  }
776
784
  });
777
785
  }
778
786
  processHeader(e, t) {
779
787
  const o = e.header;
780
- o.CECOLOR && (o.CECOLOR.index >= 0 && o.CECOLOR.index <= 256 ? t.cecolor.colorIndex = o.CECOLOR.index : t.cecolor.setRGBValue(o.CECOLOR.rgb)), t.angBase = o.ANGBASE ?? 0, t.angDir = o.ANGDIR ?? 0, t.aunits = o.AUNITS ?? 0, t.celtype = o.CELTYPE ?? Re, t.celtscale = o.CELTSCALE ?? 1, t.ltscale = o.LTSCALE ?? 1, o.EXTMAX && (t.extmax = o.EXTMAX), o.EXTMIN && (t.extmin = o.EXTMIN), t.insunits = o.INSUNITS ?? 1, t.pdmode = o.PDMODE ?? 0, t.pdsize = o.PDSIZE ?? 0, t.textstyle = o.TEXTSTYLE ?? R;
788
+ o.CECOLOR && (o.CECOLOR.index >= 0 && o.CECOLOR.index <= 256 ? t.cecolor.colorIndex = o.CECOLOR.index : t.cecolor.setRGBValue(o.CECOLOR.rgb)), t.angbase = o.ANGBASE ?? 0, t.angdir = o.ANGDIR ?? 0, t.aunits = o.AUNITS ?? 0, o.AUPREC != null && (t.auprec = o.AUPREC), o.LUNITS != null && (t.lunits = o.LUNITS), o.LUPREC != null && (t.luprec = o.LUPREC), t.celtype = o.CELTYPE ?? We, t.celtscale = o.CELTSCALE ?? 1, t.ltscale = o.LTSCALE ?? 1, o.EXTMAX && (t.extmax = o.EXTMAX), o.EXTMIN && (t.extmin = o.EXTMIN), t.insunits = o.INSUNITS ?? 1, t.pdmode = o.PDMODE ?? 0, t.pdsize = o.PDSIZE ?? 0, t.textstyle = o.TEXTSTYLE ?? R;
781
789
  }
782
790
  processCommonTableEntryAttrs(e, t) {
783
791
  t.name = e.name, t.objectId = e.handle, e.ownerHandle != null && (t.ownerId = e.ownerHandle);
@@ -788,7 +796,7 @@ class je extends Ce {
788
796
  processLayouts(e, t) {
789
797
  const o = t.objects.layout;
790
798
  e.objects.LAYOUT.forEach((r) => {
791
- const i = new Ve();
799
+ const i = new je();
792
800
  i.layoutName = r.layoutName, i.tabOrder = r.tabOrder;
793
801
  const a = t.tables.blockTable.newIterator();
794
802
  i.objectId = r.handle;
@@ -803,7 +811,7 @@ class je extends Ce {
803
811
  processImageDefs(e, t) {
804
812
  const o = t.objects.imageDefinition;
805
813
  e.objects.IMAGEDEF.forEach((r) => {
806
- const i = new Fe();
814
+ const i = new ze();
807
815
  i.sourceFileName = r.fileName, this.processCommonObjectAttrs(r, i), o.setAt(i.objectId, i);
808
816
  });
809
817
  }
@@ -817,9 +825,9 @@ class je extends Ce {
817
825
  return o.flatMap((n) => t[n]);
818
826
  }
819
827
  isModelSpace(e) {
820
- return e && e.toUpperCase() == Be;
828
+ return e && e.toUpperCase() == Ue;
821
829
  }
822
830
  }
823
831
  export {
824
- je as AcDbLibreDwgConverter
832
+ _e as AcDbLibreDwgConverter
825
833
  };