@flyfish-group/file-viewer 1.0.23 → 1.0.25

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.
Files changed (231) hide show
  1. package/README.en.md +390 -0
  2. package/README.md +83 -34
  3. package/dist/components/3MFLoader.js +1 -1
  4. package/dist/components/AMFLoader.js +1 -1
  5. package/dist/components/ArchiveViewer.js +314 -139
  6. package/dist/components/AudioViewer.js +1 -1
  7. package/dist/components/CadViewer.js +1 -1
  8. package/dist/components/CodeViewer.js +1 -1
  9. package/dist/components/ColladaLoader.js +1 -1
  10. package/dist/components/DrawingViewer.js +1 -1
  11. package/dist/components/EdaViewer.js +1 -1
  12. package/dist/components/EmailViewer.js +1 -1
  13. package/dist/components/EpubViewer.js +1 -1
  14. package/dist/components/FBXLoader.js +1 -1
  15. package/dist/components/GLTFLoader.js +1 -1
  16. package/dist/components/ImageViewer.js +1 -1
  17. package/dist/components/KMZLoader.js +1 -1
  18. package/dist/components/MarkdownViewer.js +1 -1
  19. package/dist/components/OBJLoader.js +1 -1
  20. package/dist/components/OfdViewer.js +1 -1
  21. package/dist/components/PCDLoader.js +1 -1
  22. package/dist/components/PLYLoader.js +1 -1
  23. package/dist/components/PdfView.js +5839 -5668
  24. package/dist/components/PptxRender.js +2356 -2332
  25. package/dist/components/STLLoader.js +1 -1
  26. package/dist/components/TDSLoader.js +1 -1
  27. package/dist/components/TypstViewer.js +320 -300
  28. package/dist/components/USDLoader.js +1 -1
  29. package/dist/components/UmdViewer.js +2 -2
  30. package/dist/components/VRMLLoader.js +1 -1
  31. package/dist/components/VTKLoader.js +1 -1
  32. package/dist/components/XYZLoader.js +1 -1
  33. package/dist/components/XlsxTable.js +1 -1
  34. package/dist/components/___vite-browser-external_commonjs-proxy.js +1 -1
  35. package/dist/components/_commonjs-dynamic-modules.js +1 -1
  36. package/dist/components/_commonjsHelpers.js +1 -1
  37. package/dist/components/ar-SA-G6X2FPQ2.js +1 -1
  38. package/dist/components/arc.js +1 -1
  39. package/dist/components/architecture-7EHR7CIX.js +1 -1
  40. package/dist/components/architectureDiagram-3BPJPVTR.js +1 -1
  41. package/dist/components/az-AZ-76LH7QW2.js +1 -1
  42. package/dist/components/bash.js +1 -0
  43. package/dist/components/bg-BG-XCXSNQG7.js +1 -1
  44. package/dist/components/blockDiagram-GPEHLZMM.js +1 -1
  45. package/dist/components/bn-BD-2XOGV67Q.js +1 -1
  46. package/dist/components/c4Diagram-AAUBKEIU.js +1 -1
  47. package/dist/components/ca-ES-6MX7JW3Y.js +1 -1
  48. package/dist/components/cfb.js +1 -1
  49. package/dist/components/channel.js +1 -1
  50. package/dist/components/chunk-2J33WTMH.js +1 -1
  51. package/dist/components/chunk-4BX2VUAB.js +1 -1
  52. package/dist/components/chunk-55IACEB6.js +1 -1
  53. package/dist/components/chunk-727SXJPM.js +1 -1
  54. package/dist/components/chunk-AQP2D5EJ.js +1 -1
  55. package/dist/components/chunk-FMBD7UC4.js +1 -1
  56. package/dist/components/chunk-ND2GUHAM.js +1 -1
  57. package/dist/components/chunk-QZHKN3VN.js +1 -1
  58. package/dist/components/classDiagram-4FO5ZUOK.js +1 -1
  59. package/dist/components/classDiagram-v2-Q7XG4LA2.js +1 -1
  60. package/dist/components/core.js +1 -0
  61. package/dist/components/cose-bilkent-S5V4N54A.js +1 -1
  62. package/dist/components/cpp.js +1 -0
  63. package/dist/components/cs-CZ-2BRQDIVT.js +1 -1
  64. package/dist/components/csharp.js +1 -0
  65. package/dist/components/css.js +1 -0
  66. package/dist/components/cytoscape.esm.js +1 -1
  67. package/dist/components/da-DK-5WZEPLOC.js +1 -1
  68. package/dist/components/dagre-BM42HDAG.js +1 -1
  69. package/dist/components/de-DE-XR44H4JA.js +1 -1
  70. package/dist/components/defaultLocale.js +1 -1
  71. package/dist/components/diagram-2AECGRRQ.js +1 -1
  72. package/dist/components/diagram-5GNKFQAL.js +1 -1
  73. package/dist/components/diagram-KO2AKTUF.js +1 -1
  74. package/dist/components/diagram-LMA3HP47.js +1 -1
  75. package/dist/components/diagram-OG6HWLK6.js +1 -1
  76. package/dist/components/diff.js +1 -0
  77. package/dist/components/directory-open-01563666.js +1 -1
  78. package/dist/components/directory-open-4ed118d0.js +1 -1
  79. package/dist/components/docx-preview.js +2 -2
  80. package/dist/components/el-GR-BZB4AONW.js +1 -1
  81. package/dist/components/en-B4ZKOASM.js +1 -1
  82. package/dist/components/erDiagram-TEJ5UH35.js +1 -1
  83. package/dist/components/es-ES-U4NZUMDT.js +1 -1
  84. package/dist/components/eu-ES-A7QVB2H4.js +1 -1
  85. package/dist/components/eventmodeling-FCH6USID.js +1 -1
  86. package/dist/components/fa-IR-HGAKTJCU.js +1 -1
  87. package/dist/components/fflate.module.js +1 -1
  88. package/dist/components/fi-FI-Z5N7JZ37.js +1 -1
  89. package/dist/components/file-open-002ab408.js +1 -1
  90. package/dist/components/file-open-7c801643.js +1 -1
  91. package/dist/components/file-save-3189631c.js +1 -1
  92. package/dist/components/file-save-745eba88.js +1 -1
  93. package/dist/components/flowDiagram-I6XJVG4X.js +1 -1
  94. package/dist/components/fr-FR-RHASNOE6.js +1 -1
  95. package/dist/components/ganttDiagram-6RSMTGT7.js +1 -1
  96. package/dist/components/gitGraph-WXDBUCRP.js +1 -1
  97. package/dist/components/gitGraphDiagram-PVQCEYII.js +1 -1
  98. package/dist/components/gl-ES-HMX3MZ6V.js +1 -1
  99. package/dist/components/global-compiler.js +1 -1
  100. package/dist/components/global-renderer.js +1 -1
  101. package/dist/components/go.js +1 -0
  102. package/dist/components/graph.js +1 -1
  103. package/dist/components/he-IL-6SHJWFNN.js +1 -1
  104. package/dist/components/hi-IN-IWLTKZ5I.js +1 -1
  105. package/dist/components/hu-HU-A5ZG7DT2.js +1 -1
  106. package/dist/components/id-ID-SAP4L64H.js +1 -1
  107. package/dist/components/image-GAAHSSAO.js +1 -1
  108. package/dist/components/image-blob-reduce.esm.js +1 -1
  109. package/dist/components/index10.js +1 -1
  110. package/dist/components/index11.js +1 -1
  111. package/dist/components/index12.js +1 -1
  112. package/dist/components/index13.js +1 -1
  113. package/dist/components/index14.js +1 -1
  114. package/dist/components/index15.js +1 -1
  115. package/dist/components/index16.js +1 -1
  116. package/dist/components/index17.js +1 -1
  117. package/dist/components/index18.js +1 -1
  118. package/dist/components/index19.js +1 -1
  119. package/dist/components/index2.js +1 -1
  120. package/dist/components/index20.js +1 -1
  121. package/dist/components/index21.js +1 -1
  122. package/dist/components/index22.js +2 -2
  123. package/dist/components/index23.js +1 -1
  124. package/dist/components/index24.js +1 -1
  125. package/dist/components/index3.js +1 -1
  126. package/dist/components/index4.js +1 -1
  127. package/dist/components/index5.js +1 -1
  128. package/dist/components/index6.js +1 -1
  129. package/dist/components/index7.js +1 -1
  130. package/dist/components/index8.js +1 -1
  131. package/dist/components/index9.js +1 -1
  132. package/dist/components/info-J43DQDTF.js +1 -1
  133. package/dist/components/infoDiagram-5YYISTIA.js +1 -1
  134. package/dist/components/ini.js +1 -0
  135. package/dist/components/init.js +1 -1
  136. package/dist/components/ishikawaDiagram-YF4QCWOH.js +1 -1
  137. package/dist/components/it-IT-JPQ66NNP.js +1 -1
  138. package/dist/components/ja-JP-DBVTYXUO.js +1 -1
  139. package/dist/components/java.js +1 -0
  140. package/dist/components/javascript.js +1 -0
  141. package/dist/components/journeyDiagram-JHISSGLW.js +1 -1
  142. package/dist/components/json.js +1 -0
  143. package/dist/components/jszip.min.js +1 -1
  144. package/dist/components/kaa-6HZHGXH3.js +1 -1
  145. package/dist/components/kab-KAB-ZGHBKWFO.js +1 -1
  146. package/dist/components/kanban-definition-UN3LZRKU.js +1 -1
  147. package/dist/components/katex.js +1 -1
  148. package/dist/components/kk-KZ-P5N5QNE5.js +1 -1
  149. package/dist/components/km-KH-HSX4SM5Z.js +1 -1
  150. package/dist/components/ko-KR-MTYHY66A.js +1 -1
  151. package/dist/components/ku-TR-6OUDTVRD.js +1 -1
  152. package/dist/components/layout.js +1 -1
  153. package/dist/components/libarchive.js +1 -1
  154. package/dist/components/linear.js +1 -1
  155. package/dist/components/lt-LT-XHIRWOB4.js +1 -1
  156. package/dist/components/lv-LV-5QDEKY6T.js +1 -1
  157. package/dist/components/markdown.js +1 -0
  158. package/dist/components/mermaid-parser.core.js +2 -2
  159. package/dist/components/mindmap-definition-RKZ34NQL.js +1 -1
  160. package/dist/components/mr-IN-CRQNXWMA.js +1 -1
  161. package/dist/components/my-MM-5M5IBNSE.js +1 -1
  162. package/dist/components/nb-NO-T6EIAALU.js +1 -1
  163. package/dist/components/nestedRender.js +1 -1
  164. package/dist/components/nl-NL-IS3SIHDZ.js +1 -1
  165. package/dist/components/nn-NO-6E72VCQL.js +1 -1
  166. package/dist/components/oc-FR-POXYY2M6.js +1 -1
  167. package/dist/components/ofd.js +1 -1
  168. package/dist/components/ordinal.js +1 -1
  169. package/dist/components/pa-IN-N4M65BXN.js +1 -1
  170. package/dist/components/packet-YPE3B663.js +1 -1
  171. package/dist/components/percentages-BXMCSKIN.js +1 -1
  172. package/dist/components/php.js +1 -0
  173. package/dist/components/pica.js +1 -1
  174. package/dist/components/pie-LRSECV5Y.js +1 -1
  175. package/dist/components/pie.js +1 -1
  176. package/dist/components/pieDiagram-4H26LBE5.js +1 -1
  177. package/dist/components/pl-PL-T2D74RX3.js +1 -1
  178. package/dist/components/postal-mime.js +1 -1
  179. package/dist/components/printLayout.js +1 -1
  180. package/dist/components/pt-BR-5N22H2LF.js +1 -1
  181. package/dist/components/pt-PT-UZXXM6DQ.js +1 -1
  182. package/dist/components/python.js +1 -0
  183. package/dist/components/quadrantDiagram-W4KKPZXB.js +1 -1
  184. package/dist/components/radar-GUYGQ44K.js +1 -1
  185. package/dist/components/requirementDiagram-4Y6WPE33.js +1 -1
  186. package/dist/components/ro-RO-JPDTUUEW.js +1 -1
  187. package/dist/components/rough.esm.js +1 -1
  188. package/dist/components/roundRect.js +1 -1
  189. package/dist/components/ru-RU-B4JR7IUQ.js +1 -1
  190. package/dist/components/rust.js +1 -0
  191. package/dist/components/sankeyDiagram-5OEKKPKP.js +1 -1
  192. package/dist/components/sequenceDiagram-3UESZ5HK.js +1 -1
  193. package/dist/components/si-LK-N5RQ5JYF.js +1 -1
  194. package/dist/components/sk-SK-C5VTKIMK.js +1 -1
  195. package/dist/components/sl-SI-NN7IZMDC.js +1 -1
  196. package/dist/components/sql.js +1 -0
  197. package/dist/components/stateDiagram-AJRCARHV.js +1 -1
  198. package/dist/components/stateDiagram-v2-BHNVJYJU.js +1 -1
  199. package/dist/components/subset-shared.chunk.js +1 -1
  200. package/dist/components/subset-worker.chunk.js +1 -1
  201. package/dist/components/sv-SE-XGPEYMSR.js +1 -1
  202. package/dist/components/ta-IN-2NMHFXQM.js +1 -1
  203. package/dist/components/th-TH-HPSO5L25.js +1 -1
  204. package/dist/components/time.js +1 -1
  205. package/dist/components/timeline-definition-PNZ67QCA.js +1 -1
  206. package/dist/components/tr-TR-DEFEU3FU.js +1 -1
  207. package/dist/components/transform.js +1 -1
  208. package/dist/components/treeView-BLDUP644.js +1 -1
  209. package/dist/components/treemap-LRROVOQU.js +1 -1
  210. package/dist/components/typescript.js +1 -0
  211. package/dist/components/uk-UA-QMV73CPH.js +1 -1
  212. package/dist/components/vennDiagram-CIIHVFJN.js +1 -1
  213. package/dist/components/vi-VN-M7AON7JQ.js +1 -1
  214. package/dist/components/wardley-L42UT6IY.js +1 -1
  215. package/dist/components/wardleyDiagram-YWT4CUSO.js +1 -1
  216. package/dist/components/wasm-pack-shim.js +1 -1
  217. package/dist/components/wasm-pack-shim2.js +1 -1
  218. package/dist/components/worker-ref.js +1 -1
  219. package/dist/components/xml.js +1 -0
  220. package/dist/components/xychartDiagram-2RQKCTM6.js +1 -1
  221. package/dist/components/yaml.js +1 -0
  222. package/dist/components/zh-CN-LNUGB5OW.js +1 -1
  223. package/dist/components/zh-HK-E62DVLB3.js +1 -1
  224. package/dist/components/zh-TW-RAJ6MFWO.js +1 -1
  225. package/dist/index.d.ts +248 -11
  226. package/dist/index.mjs +1 -1
  227. package/dist/style.css +3 -12
  228. package/dist/wasm/cad/dwg-worker.js +24 -349
  229. package/package.json +4 -2
  230. package/dist/wasm/cad/DwgWorker-CuZJ5EUe.js +0 -349
  231. package/dist/wasm/cad/index-C365l3i9.js +0 -4161
@@ -1,349 +1,24 @@
1
- function D(e) {
2
- return {
3
- format: e.format,
4
- sourceName: e.sourceName,
5
- units: e.units,
6
- header: e.header ?? {},
7
- layers: e.layers ?? {},
8
- blocks: e.blocks ?? {},
9
- entities: e.entities ?? [],
10
- pages: e.pages,
11
- metadata: e.metadata ?? {},
12
- warnings: e.warnings ?? [],
13
- raw: e.raw
14
- };
15
- }
16
- function L(e) {
17
- switch (String(e ?? "").toUpperCase()) {
18
- case "LINE":
19
- return "line";
20
- case "CIRCLE":
21
- return "circle";
22
- case "ARC":
23
- return "arc";
24
- case "LWPOLYLINE":
25
- case "POLYLINE":
26
- case "POLYLINE_2D":
27
- case "POLYLINE2D":
28
- case "POLYLINE_3D":
29
- case "POLYLINE3D":
30
- case "LEADER":
31
- case "MULTILEADER":
32
- return "polyline";
33
- case "ELLIPSE":
34
- return "ellipse";
35
- case "TEXT":
36
- case "MTEXT":
37
- case "ATTRIB":
38
- case "ATTDEF":
39
- case "DIMENSION":
40
- return "text";
41
- case "POINT":
42
- return "point";
43
- case "INSERT":
44
- return "insert";
45
- case "SOLID":
46
- case "TRACE":
47
- case "3DFACE":
48
- return "solid";
49
- case "HATCH":
50
- return "hatch";
51
- case "SPLINE":
52
- return "spline";
53
- case "PATH":
54
- case "XPS_PATH":
55
- case "DWF_PATH":
56
- return "path";
57
- case "IMAGE":
58
- case "RASTER_IMAGE":
59
- case "DWF_IMAGE":
60
- return "image";
61
- case "VIEWPORT":
62
- return "viewport";
63
- default:
64
- return "unsupported";
65
- }
66
- }
67
- function M(e, t, o = {}) {
68
- const i = t ?? String(e.type ?? e.entityType ?? e.objectName ?? "UNKNOWN").toUpperCase(), n = o.includeUnknownProperties === !1 ? { type: i, kind: L(i) } : { ...e, type: i, kind: L(i) };
69
- o.keepRaw && (n.raw = e), n.handle = g(e.handle ?? e.id), n.layer = g(e.layer ?? e.layerName), n.lineType = g(e.lineType ?? e.linetype);
70
- const c = o.numericColorMode ?? "auto", s = u(e.color), r = u(e.colorIndex ?? e.colorNumber ?? e.aci ?? e.aciColor ?? e.color_index);
71
- n.colorIndex = r ?? (c !== "rgb" && s !== void 0 && Math.abs(s) <= 257 ? s : void 0);
72
- const a = e.trueColor ?? e.true_color ?? e.truecolor ?? e.colorRGB ?? e.colorRgb ?? e.rgbColor ?? e.rgb, d = s !== void 0 && s >= 0 && s <= 16777215 && (c === "rgb" || c === "auto" && Math.abs(s) > 257);
73
- n.trueColor = a ?? (d ? s : void 0), (typeof e.color == "string" || typeof e.color == "number") && (n.color = e.color), n.colorNumber = u(e.colorNumber) ?? n.colorNumber, n.colorName = g(e.colorName ?? e.color_name) ?? n.colorName, n.fillColor = e.fillColor ?? e.fill_color, n.fillColorIndex = u(e.fillColorIndex ?? e.fill_color_index ?? e.fillColorNumber) ?? n.fillColorIndex, n.opacity = u(e.opacity ?? e.alpha) ?? n.opacity, n.lineweight = u(e.lineweight ?? e.lineWeight), n.isVisible = !(e.isVisible === !1 || e.visible === !1), n.startPoint = p(e.startPoint ?? e.start ?? e.p0 ?? e.from) ?? n.startPoint, n.endPoint = p(e.endPoint ?? e.end ?? e.p1 ?? e.to) ?? n.endPoint, n.center = p(e.center ?? e.centerPoint) ?? n.center, n.insertionPoint = p(e.insertionPoint ?? e.position ?? e.location ?? e.point ?? e.basePoint) ?? n.insertionPoint, n.radius = u(e.radius) ?? n.radius, n.startAngle = u(e.startAngle ?? e.start_angle) ?? n.startAngle, n.endAngle = u(e.endAngle ?? e.end_angle) ?? n.endAngle, n.majorAxisEndPoint = p(e.majorAxisEndPoint ?? e.majorAxis ?? e.major) ?? n.majorAxisEndPoint, n.axisRatio = u(e.axisRatio ?? e.ratio) ?? n.axisRatio, n.height = u(e.height ?? e.textHeight) ?? n.height, n.textHeight = u(e.textHeight ?? e.height) ?? n.textHeight, n.rotation = u(e.rotation ?? e.angle) ?? n.rotation, n.text = g(e.text ?? e.value ?? e.string ?? e.contents) ?? n.text, n.name = g(e.name ?? e.blockName) ?? n.name, n.blockName = g(e.blockName ?? e.name) ?? n.blockName;
74
- const f = N(e.vertices ?? e.points);
75
- f.length > 0 && (n.vertices = f);
76
- const l = N(e.controlPoints ?? e.control_points);
77
- l.length > 0 && (n.controlPoints = l);
78
- const m = N(e.fitPoints ?? e.fit_points);
79
- return m.length > 0 && (n.fitPoints = m), n;
80
- }
81
- function p(e) {
82
- if (!e || typeof e != "object") return;
83
- const t = e, o = Number(t.x ?? t.X ?? t[0]), i = Number(t.y ?? t.Y ?? t[1]), n = t.z ?? t.Z ?? t[2], c = n === void 0 ? void 0 : Number(n);
84
- if (!(!Number.isFinite(o) || !Number.isFinite(i)))
85
- return Number.isFinite(c) ? { x: o, y: i, z: c } : { x: o, y: i };
86
- }
87
- function N(e) {
88
- if (!Array.isArray(e)) return [];
89
- const t = [];
90
- for (const o of e) {
91
- const i = p(o);
92
- if (!i) continue;
93
- const n = o, c = i, s = u(n.bulge);
94
- s !== void 0 && (c.bulge = s);
95
- const r = u(n.startWidth ?? n.start_width);
96
- r !== void 0 && (c.startWidth = r);
97
- const a = u(n.endWidth ?? n.end_width);
98
- a !== void 0 && (c.endWidth = a), t.push(c);
99
- }
100
- return t;
101
- }
102
- function T(e, t) {
103
- t.name && (e[t.name] = t, e[t.name.toLowerCase()] = t);
104
- }
105
- function _(e, t) {
106
- t.name && (e[t.name] = t, e[t.name.toLowerCase()] = t);
107
- }
108
- function u(e) {
109
- const t = Number(e);
110
- return Number.isFinite(t) ? t : void 0;
111
- }
112
- function g(e) {
113
- if (typeof e != "string" && typeof e != "number") return;
114
- const t = String(e);
115
- return t.length > 0 ? t : void 0;
116
- }
117
- function O(e) {
118
- return e.byteOffset === 0 && e.byteLength === e.buffer.byteLength ? e.buffer : e.slice().buffer;
119
- }
120
- const S = {
121
- AC1009: "R12",
122
- AC1012: "R13",
123
- AC1014: "R14",
124
- AC1015: "R2000",
125
- AC1018: "R2004",
126
- AC1021: "R2007",
127
- AC1024: "R2010",
128
- AC1027: "R2013",
129
- AC1032: "R2018"
130
- };
131
- function U(e) {
132
- const t = Array.from(e.slice(0, 6), (i) => String.fromCharCode(i)).join(""), o = S[t] ?? "UNKNOWN";
133
- return {
134
- signature: t,
135
- release: o,
136
- supportedByOpenDesignSpec: o !== "UNKNOWN",
137
- notes: o === "UNKNOWN" ? "Unknown or unsupported DWG signature." : void 0
138
- };
139
- }
140
- const C = /* @__PURE__ */ new Map();
141
- async function B(e, t = {}) {
142
- var m, y, b, A, w, R;
143
- const o = performance.now(), i = t.sourceName;
144
- (m = t.onProgress) == null || m.call(t, { phase: "detect", format: "dwg", message: "Validating DWG header…", total: e.byteLength });
145
- const n = U(e);
146
- if (!n.signature.startsWith("AC"))
147
- throw new Error(`Invalid DWG header: ${JSON.stringify(n.signature)}.`);
148
- (y = t.onProgress) == null || y.call(t, { phase: "wasm-init", format: "dwg", message: "Initializing LibreDWG WebAssembly…", total: e.byteLength });
149
- const c = await k(t.wasmPath ?? "/wasm/");
150
- (b = t.onProgress) == null || b.call(t, { phase: "parse", format: "dwg", message: `Decoding ${n.signature} DWG…`, total: e.byteLength, percent: 35 });
151
- const s = O(e), r = ((A = c.Dwg_File_Type) == null ? void 0 : A.DWG) ?? 0, a = c.instance.dwg_read_data(s, r);
152
- if (!a) throw new Error("LibreDWG returned an empty DWG result.");
153
- if (typeof a.error == "number" && a.error !== 0) throw new Error(`LibreDWG parse error code: ${a.error}.`);
154
- (w = t.onProgress) == null || w.call(t, { phase: "normalize", format: "dwg", message: "Normalizing DWG database…", total: e.byteLength, percent: 72 });
155
- const d = typeof c.instance.convert == "function" ? c.instance.convert(a) : a;
156
- try {
157
- typeof c.instance.dwg_free == "function" && c.instance.dwg_free(a);
158
- } catch {
159
- }
160
- const f = z(d, i, n, { keepRaw: !!t.keepRaw }), l = performance.now() - o;
161
- return (R = t.onProgress) == null || R.call(t, { phase: "done", format: "dwg", message: "DWG loaded.", total: e.byteLength, percent: 100, elapsedMs: l }), {
162
- document: f,
163
- raw: t.keepRaw ? d : void 0,
164
- bytes: e.byteLength,
165
- elapsedMs: l,
166
- format: "dwg",
167
- warnings: f.warnings
168
- };
169
- }
170
- async function k(e = "/wasm/") {
171
- const t = H(e);
172
- let o = C.get(t);
173
- o || (o = import("./index-C365l3i9.js").then(async (c) => {
174
- const s = c, r = s.LibreDwg;
175
- if (!r || typeof r.create != "function")
176
- throw new Error("@mlightcad/libredwg-web did not expose LibreDwg.create().");
177
- try {
178
- if (typeof s.createModule == "function" && typeof r.createByWasmInstance == "function") {
179
- const a = E(t), d = await V(a), f = await s.createModule({
180
- wasmBinary: d,
181
- locateFile: (l) => new URL(l, x(t)).href
182
- });
183
- return r.createByWasmInstance(f);
184
- }
185
- return await r.create(t);
186
- } catch (a) {
187
- const d = a instanceof Error ? a.message : String(a);
188
- throw new Error(`Failed to initialize LibreDWG WebAssembly from ${t}. Ensure libredwg-web.wasm is deployed at ${E(t)} and wasmPath is resolved relative to the page, not the worker script. Run npm run copy:wasm before dev/build. Original error: ${d}`);
189
- }
190
- }), C.set(t, o));
191
- const i = await o, n = await import("./index-C365l3i9.js");
192
- return { module: n, instance: i, Dwg_File_Type: n.Dwg_File_Type };
193
- }
194
- function z(e, t, o, i = {}) {
195
- const n = e && typeof e == "object" ? e : {}, c = F(n, i), s = $(n, i), r = Array.isArray(n.entities) ? n.entities : [], a = { keepRaw: !!i.keepRaw, includeUnknownProperties: !!i.keepRaw }, d = r.filter((l) => !!l && typeof l == "object").map((l) => I(l, a)), f = D({
196
- format: "dwg",
197
- sourceName: t,
198
- header: j(n.header, o),
199
- layers: c,
200
- blocks: s,
201
- entities: d,
202
- metadata: {
203
- parser: "@mlightcad/libredwg-web",
204
- parserMode: "wasm",
205
- version: o
206
- },
207
- warnings: [],
208
- raw: i.keepRaw ? e : void 0
209
- });
210
- return d.length === 0 && f.warnings.push("DWG parsed successfully but no model-space entities were exposed by the converter. Check layout/paper-space content or unsupported proxy objects."), f;
211
- }
212
- function I(e, t) {
213
- const o = M(e, void 0, { ...t, numericColorMode: "rgb" }), i = u(e.color);
214
- return i !== void 0 && i >= 0 && i <= 16777215 && (o.color = i, o.trueColor = i), o.colorIndex = u(e.colorIndex ?? e.colorNumber ?? e.aci) ?? o.colorIndex, o.colorName = g(e.colorName ?? e.color_name) ?? o.colorName, o;
215
- }
216
- function G(e) {
217
- return typeof e == "number" && Number.isFinite(e) && Math.abs(Math.trunc(e)) >= 1 && Math.abs(Math.trunc(e)) <= 255;
218
- }
219
- function j(e, t) {
220
- const o = e && typeof e == "object" ? { ...e } : {};
221
- return t && (o.dwgVersion = t), o;
222
- }
223
- function F(e, t) {
224
- const o = {}, i = [], n = e.tables;
225
- for (const c of ["LAYER", "layer", "layers"]) {
226
- const s = e[c] ?? (n == null ? void 0 : n[c]);
227
- s && i.push(s);
228
- }
229
- for (const c of i)
230
- for (const s of W(c)) {
231
- const r = s, a = g(r.name ?? r.layerName ?? r.entryName);
232
- if (!a) continue;
233
- const d = u(r.colorIndex ?? r.colorNumber), f = u(r.trueColor ?? r.true_color ?? r.truecolor ?? r.colorRGB ?? r.colorRgb ?? r.rgbColor ?? r.rgb), l = u(r.color), m = G(d), y = f ?? (!m && l !== void 0 && l >= 0 && l <= 16777215 ? l : void 0), b = {
234
- name: a,
235
- color: m ? void 0 : r.color ?? r.colorName,
236
- colorIndex: d ?? (l !== void 0 && Math.abs(l) <= 257 ? l : void 0),
237
- trueColor: y,
238
- lineType: g(r.lineType ?? r.linetype),
239
- lineweight: u(r.lineweight ?? r.lineWeight),
240
- isVisible: !(r.isVisible === !1 || r.off === !0 || Number(d ?? r.color ?? 1) < 0),
241
- isFrozen: !!(r.isFrozen ?? r.frozen),
242
- isLocked: !!(r.isLocked ?? r.locked),
243
- raw: t.keepRaw ? r : void 0
244
- };
245
- T(o, b);
246
- }
247
- return o;
248
- }
249
- function $(e, t) {
250
- const o = {}, i = [e.blocks, e.blockHeaders, e.block_records, e.blockRecords], n = e.tables;
251
- i.push(n == null ? void 0 : n.BLOCK, n == null ? void 0 : n.BLOCK_RECORD, n == null ? void 0 : n.blocks);
252
- const c = { keepRaw: !!t.keepRaw, includeUnknownProperties: !!t.keepRaw };
253
- for (const s of i)
254
- for (const r of W(s)) {
255
- const a = r, d = g(a.name ?? a.blockName ?? a.name2);
256
- if (!d) continue;
257
- const l = (Array.isArray(a.entities) ? a.entities : Array.isArray(a.ownedObjects) ? a.ownedObjects : []).filter((m) => !!m && typeof m == "object").map((m) => I(m, c));
258
- _(o, {
259
- name: d,
260
- basePoint: p(a.basePoint ?? a.origin) ?? { x: 0, y: 0 },
261
- entities: l,
262
- raw: t.keepRaw ? a : void 0
263
- });
264
- }
265
- return o;
266
- }
267
- function W(e) {
268
- if (!e) return [];
269
- if (Array.isArray(e)) return e;
270
- if (typeof e != "object") return [];
271
- const t = e, o = Object.values(t).filter((n) => n && typeof n == "object"), i = ["entries", "records", "items", "values", "layers", "blocks"].flatMap((n) => Array.isArray(t[n]) ? t[n] : []);
272
- return i.length > 0 ? i : o;
273
- }
274
- function H(e) {
275
- const t = e.trim() || "/wasm";
276
- if (t === "/") return P();
277
- const o = t.replace(/\/+$/, "");
278
- return q(o) ? o : o.startsWith("/") ? `${P()}${o}` : new URL(o, v()).href.replace(/\/+$/, "");
279
- }
280
- function E(e) {
281
- return new URL("libredwg-web.wasm", x(e)).href;
282
- }
283
- function x(e) {
284
- return e.endsWith("/") ? e : `${e}/`;
285
- }
286
- function q(e) {
287
- return /^[a-z][a-z0-9+.-]*:/i.test(e);
288
- }
289
- function v() {
290
- return typeof document < "u" && document.baseURI ? document.baseURI : typeof location < "u" && location.href ? location.href : "http://localhost/";
291
- }
292
- function P() {
293
- return typeof location < "u" && location.origin ? location.origin : new URL(v()).origin;
294
- }
295
- async function V(e) {
296
- if (typeof fetch != "function")
297
- throw new Error("fetch() is not available, so the LibreDWG WASM binary cannot be loaded.");
298
- const t = await fetch(e, { credentials: "same-origin", cache: "force-cache" });
299
- if (!t.ok)
300
- throw new Error(`WASM asset request failed with HTTP ${t.status} for ${e}.`);
301
- const o = new Uint8Array(await t.arrayBuffer());
302
- if (!Y(o)) {
303
- const i = X(o), n = t.headers.get("content-type") ?? "unknown content-type";
304
- throw new Error(`Invalid WASM asset at ${e}. Expected bytes 00 61 73 6d, got ${K(o)} (${n}). The server probably returned an HTML fallback page instead of libredwg-web.wasm. Response preview: ${i}`);
305
- }
306
- return o;
307
- }
308
- function Y(e) {
309
- return e.length >= 4 && e[0] === 0 && e[1] === 97 && e[2] === 115 && e[3] === 109;
310
- }
311
- function K(e) {
312
- return Array.from(e.slice(0, 4)).map((t) => t.toString(16).padStart(2, "0")).join(" ");
313
- }
314
- function X(e) {
315
- const t = Array.from(e.slice(0, 32)).map((o) => o >= 32 && o <= 126 ? String.fromCharCode(o) : ".").join("");
316
- return JSON.stringify(t);
317
- }
318
- const h = self;
319
- h.postMessage({ type: "ready" });
320
- h.onmessage = async (e) => {
321
- var n, c;
322
- const t = e.data;
323
- if (!t) return;
324
- const o = performance.now(), i = (s) => {
325
- h.postMessage({ type: "progress", requestId: t.requestId, progress: s });
326
- };
327
- try {
328
- if (t.type === "warmup") {
329
- i({ phase: "wasm-init", format: "dwg", message: "Warming LibreDWG WebAssembly instance…" }), await k(((n = t.options) == null ? void 0 : n.wasmPath) ?? "/wasm/"), h.postMessage({ type: "warmup-result", requestId: t.requestId, elapsedMs: performance.now() - o });
330
- return;
331
- }
332
- if (t.type !== "load") return;
333
- i({ phase: "worker-ready", format: "dwg", message: "DWG worker received file bytes.", total: t.bytes.byteLength });
334
- const s = await B(new Uint8Array(t.bytes), {
335
- ...t.options,
336
- sourceName: t.fileName,
337
- keepRaw: !!((c = t.options) != null && c.keepRaw),
338
- onProgress: i
339
- });
340
- s.document.metadata.loaderMode = "worker", s.elapsedMs = performance.now() - o, h.postMessage({ type: "result", requestId: t.requestId, result: s });
341
- } catch (s) {
342
- const r = J(s);
343
- h.postMessage({ type: "error", requestId: t.requestId, error: r });
344
- }
345
- };
346
- function J(e) {
347
- return e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : { message: String(e) };
348
- }
349
- //# sourceMappingURL=DwgWorker-CuZJ5EUe.js.map
1
+ var Hn=Object.defineProperty;var Kn=(t,n,a)=>n in t?Hn(t,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[n]=a;var S=(t,n,a)=>Kn(t,typeof n!="symbol"?n+"":n,a);const Vn="modulepreload",$n=function(t){return"/"+t},kt={},Xt=function(n,a,e){let i=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=o?.nonce||o?.getAttribute("nonce");i=Promise.allSettled(a.map(_=>{if(_=$n(_),_ in kt)return;kt[_]=!0;const d=_.endsWith(".css"),l=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${_}"]${l}`))return;const c=document.createElement("link");if(c.rel=d?"stylesheet":Vn,d||(c.as="script"),c.crossOrigin="",c.href=_,s&&c.setAttribute("nonce",s),document.head.appendChild(c),d)return new Promise((u,E)=>{c.addEventListener("load",u),c.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${_}`)))})}))}function r(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return i.then(o=>{for(const s of o||[])s.status==="rejected"&&r(s.reason);return n().catch(r)})};function zn(t){return{format:t.format,sourceName:t.sourceName,units:t.units,header:t.header??{},layers:t.layers??{},blocks:t.blocks??{},entities:t.entities??[],pages:t.pages,metadata:t.metadata??{},warnings:t.warnings??[],raw:t.raw}}function Ht(t){switch(String(t??"").toUpperCase()){case"LINE":return"line";case"CIRCLE":return"circle";case"ARC":return"arc";case"LWPOLYLINE":case"POLYLINE":case"POLYLINE_2D":case"POLYLINE2D":case"POLYLINE_3D":case"POLYLINE3D":case"LEADER":case"MULTILEADER":return"polyline";case"ELLIPSE":return"ellipse";case"TEXT":case"MTEXT":case"ATTRIB":case"ATTDEF":case"DIMENSION":return"text";case"POINT":return"point";case"INSERT":return"insert";case"SOLID":case"TRACE":case"3DFACE":return"solid";case"HATCH":return"hatch";case"SPLINE":return"spline";case"PATH":case"XPS_PATH":case"DWF_PATH":return"path";case"IMAGE":case"RASTER_IMAGE":case"DWF_IMAGE":return"image";case"VIEWPORT":return"viewport";default:return"unsupported"}}function Jn(t,n,a={}){const e=n??String(t.type??t.entityType??t.objectName??"UNKNOWN").toUpperCase(),i=a.includeUnknownProperties===!1?{type:e,kind:Ht(e)}:{...t,type:e,kind:Ht(e)};a.keepRaw&&(i.raw=t),i.handle=y(t.handle??t.id),i.layer=y(t.layer??t.layerName),i.lineType=y(t.lineType??t.linetype);const r=a.numericColorMode??"auto",o=N(t.color),s=N(t.colorIndex??t.colorNumber??t.aci??t.aciColor??t.color_index);i.colorIndex=s??(r!=="rgb"&&o!==void 0&&Math.abs(o)<=257?o:void 0);const _=t.trueColor??t.true_color??t.truecolor??t.colorRGB??t.colorRgb??t.rgbColor??t.rgb,d=o!==void 0&&o>=0&&o<=16777215&&(r==="rgb"||r==="auto"&&Math.abs(o)>257);i.trueColor=_??(d?o:void 0),(typeof t.color=="string"||typeof t.color=="number")&&(i.color=t.color),i.colorNumber=N(t.colorNumber)??i.colorNumber,i.colorName=y(t.colorName??t.color_name)??i.colorName,i.fillColor=t.fillColor??t.fill_color,i.fillColorIndex=N(t.fillColorIndex??t.fill_color_index??t.fillColorNumber)??i.fillColorIndex,i.opacity=N(t.opacity??t.alpha)??i.opacity,i.lineweight=N(t.lineweight??t.lineWeight),i.isVisible=!(t.isVisible===!1||t.visible===!1),i.startPoint=b(t.startPoint??t.start??t.p0??t.from)??i.startPoint,i.endPoint=b(t.endPoint??t.end??t.p1??t.to)??i.endPoint,i.center=b(t.center??t.centerPoint)??i.center,i.insertionPoint=b(t.insertionPoint??t.position??t.location??t.point??t.basePoint)??i.insertionPoint,i.radius=N(t.radius)??i.radius,i.startAngle=N(t.startAngle??t.start_angle)??i.startAngle,i.endAngle=N(t.endAngle??t.end_angle)??i.endAngle,i.majorAxisEndPoint=b(t.majorAxisEndPoint??t.majorAxis??t.major)??i.majorAxisEndPoint,i.axisRatio=N(t.axisRatio??t.ratio)??i.axisRatio,i.height=N(t.height??t.textHeight)??i.height,i.textHeight=N(t.textHeight??t.height)??i.textHeight,i.rotation=N(t.rotation??t.angle)??i.rotation,i.text=y(t.text??t.value??t.string??t.contents)??i.text,i.name=y(t.name??t.blockName)??i.name,i.blockName=y(t.blockName??t.name)??i.blockName;const l=Pt(t.vertices??t.points);l.length>0&&(i.vertices=l);const c=Pt(t.controlPoints??t.control_points);c.length>0&&(i.controlPoints=c);const u=Pt(t.fitPoints??t.fit_points);return u.length>0&&(i.fitPoints=u),i}function b(t){if(!t||typeof t!="object")return;const n=t,a=Number(n.x??n.X??n[0]),e=Number(n.y??n.Y??n[1]),i=n.z??n.Z??n[2],r=i===void 0?void 0:Number(i);if(!(!Number.isFinite(a)||!Number.isFinite(e)))return Number.isFinite(r)?{x:a,y:e,z:r}:{x:a,y:e}}function Pt(t){if(!Array.isArray(t))return[];const n=[];for(const a of t){const e=b(a);if(!e)continue;const i=a,r=e,o=N(i.bulge);o!==void 0&&(r.bulge=o);const s=N(i.startWidth??i.start_width);s!==void 0&&(r.startWidth=s);const _=N(i.endWidth??i.end_width);_!==void 0&&(r.endWidth=_),n.push(r)}return n}function Zn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function qn(t,n){n.name&&(t[n.name]=n,t[n.name.toLowerCase()]=n)}function N(t){const n=Number(t);return Number.isFinite(n)?n:void 0}function y(t){if(typeof t!="string"&&typeof t!="number")return;const n=String(t);return n.length>0?n:void 0}function Qn(t){return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.slice().buffer}const jn={AC1009:"R12",AC1012:"R13",AC1014:"R14",AC1015:"R2000",AC1018:"R2004",AC1021:"R2007",AC1024:"R2010",AC1027:"R2013",AC1032:"R2018"};function te(t){const n=Array.from(t.slice(0,6),e=>String.fromCharCode(e)).join(""),a=jn[n]??"UNKNOWN";return{signature:n,release:a,supportedByOpenDesignSpec:a!=="UNKNOWN",notes:a==="UNKNOWN"?"Unknown or unsupported DWG signature.":void 0}}const Kt=new Map;async function ne(t,n={}){const a=performance.now(),e=n.sourceName;n.onProgress?.({phase:"detect",format:"dwg",message:"Validating DWG header…",total:t.byteLength});const i=te(t);if(!i.signature.startsWith("AC"))throw new Error(`Invalid DWG header: ${JSON.stringify(i.signature)}.`);n.onProgress?.({phase:"wasm-init",format:"dwg",message:"Initializing LibreDWG WebAssembly…",total:t.byteLength});const r=await Zt(n.wasmPath??"/wasm/");n.onProgress?.({phase:"parse",format:"dwg",message:`Decoding ${i.signature} DWG…`,total:t.byteLength,percent:35});const o=Qn(t),s=r.Dwg_File_Type?.DWG??0,_=r.instance.dwg_read_data(o,s);if(!_)throw new Error("LibreDWG returned an empty DWG result.");if(typeof _.error=="number"&&_.error!==0)throw new Error(`LibreDWG parse error code: ${_.error}.`);n.onProgress?.({phase:"normalize",format:"dwg",message:"Normalizing DWG database…",total:t.byteLength,percent:72});const d=typeof r.instance.convert=="function"?r.instance.convert(_):_;try{typeof r.instance.dwg_free=="function"&&r.instance.dwg_free(_)}catch{}const l=ee(d,e,i,{keepRaw:!!n.keepRaw}),c=performance.now()-a;return n.onProgress?.({phase:"done",format:"dwg",message:"DWG loaded.",total:t.byteLength,percent:100,elapsedMs:c}),{document:l,raw:n.keepRaw?d:void 0,bytes:t.byteLength,elapsedMs:c,format:"dwg",warnings:l.warnings}}async function Zt(t="/wasm/"){const n=se(t);let a=Kt.get(n);a||(a=Xt(()=>Promise.resolve().then(()=>Jt),[]).then(async r=>{const o=r,s=o.LibreDwg;if(!s||typeof s.create!="function")throw new Error("@mlightcad/libredwg-web did not expose LibreDwg.create().");try{if(typeof o.createModule=="function"&&typeof s.createByWasmInstance=="function"){const _=Vt(n),d=await de(_),l=await o.createModule({wasmBinary:d,locateFile:c=>new URL(c,jt(n)).href});return s.createByWasmInstance(l)}return await s.create(n)}catch(_){const d=_ instanceof Error?_.message:String(_);throw new Error(`Failed to initialize LibreDWG WebAssembly from ${n}. Ensure libredwg-web.wasm is deployed at ${Vt(n)} and wasmPath is resolved relative to the page, not the worker script. Run npm run copy:wasm before dev/build. Original error: ${d}`)}}),Kt.set(n,a));const e=await a,i=await Xt(()=>Promise.resolve().then(()=>Jt),void 0);return{module:i,instance:e,Dwg_File_Type:i.Dwg_File_Type}}function ee(t,n,a,e={}){const i=t&&typeof t=="object"?t:{},r=oe(i,e),o=re(i,e),s=Array.isArray(i.entities)?i.entities:[],_={keepRaw:!!e.keepRaw,includeUnknownProperties:!!e.keepRaw},d=s.filter(c=>!!c&&typeof c=="object").map(c=>qt(c,_)),l=zn({format:"dwg",sourceName:n,header:ie(i.header,a),layers:r,blocks:o,entities:d,metadata:{parser:"@mlightcad/libredwg-web",parserMode:"wasm",version:a},warnings:[],raw:e.keepRaw?t:void 0});return d.length===0&&l.warnings.push("DWG parsed successfully but no model-space entities were exposed by the converter. Check layout/paper-space content or unsupported proxy objects."),l}function qt(t,n){const a=Jn(t,void 0,{...n,numericColorMode:"rgb"}),e=N(t.color);return e!==void 0&&e>=0&&e<=16777215&&(a.color=e,a.trueColor=e),a.colorIndex=N(t.colorIndex??t.colorNumber??t.aci)??a.colorIndex,a.colorName=y(t.colorName??t.color_name)??a.colorName,a}function ae(t){return typeof t=="number"&&Number.isFinite(t)&&Math.abs(Math.trunc(t))>=1&&Math.abs(Math.trunc(t))<=255}function ie(t,n){const a=t&&typeof t=="object"?{...t}:{};return n&&(a.dwgVersion=n),a}function oe(t,n){const a={},e=[],i=t.tables;for(const r of["LAYER","layer","layers"]){const o=t[r]??i?.[r];o&&e.push(o)}for(const r of e)for(const o of Qt(r)){const s=o,_=y(s.name??s.layerName??s.entryName);if(!_)continue;const d=N(s.colorIndex??s.colorNumber),l=N(s.trueColor??s.true_color??s.truecolor??s.colorRGB??s.colorRgb??s.rgbColor??s.rgb),c=N(s.color),u=ae(d),E=l??(!u&&c!==void 0&&c>=0&&c<=16777215?c:void 0),f={name:_,color:u?void 0:s.color??s.colorName,colorIndex:d??(c!==void 0&&Math.abs(c)<=257?c:void 0),trueColor:E,lineType:y(s.lineType??s.linetype),lineweight:N(s.lineweight??s.lineWeight),isVisible:!(s.isVisible===!1||s.off===!0||Number(d??s.color??1)<0),isFrozen:!!(s.isFrozen??s.frozen),isLocked:!!(s.isLocked??s.locked),raw:n.keepRaw?s:void 0};Zn(a,f)}return a}function re(t,n){const a={},e=[t.blocks,t.blockHeaders,t.block_records,t.blockRecords],i=t.tables;e.push(i?.BLOCK,i?.BLOCK_RECORD,i?.blocks);const r={keepRaw:!!n.keepRaw,includeUnknownProperties:!!n.keepRaw};for(const o of e)for(const s of Qt(o)){const _=s,d=y(_.name??_.blockName??_.name2);if(!d)continue;const c=(Array.isArray(_.entities)?_.entities:Array.isArray(_.ownedObjects)?_.ownedObjects:[]).filter(u=>!!u&&typeof u=="object").map(u=>qt(u,r));qn(a,{name:d,basePoint:b(_.basePoint??_.origin)??{x:0,y:0},entities:c,raw:n.keepRaw?_:void 0})}return a}function Qt(t){if(!t)return[];if(Array.isArray(t))return t;if(typeof t!="object")return[];const n=t,a=Object.values(n).filter(i=>i&&typeof i=="object"),e=["entries","records","items","values","layers","blocks"].flatMap(i=>Array.isArray(n[i])?n[i]:[]);return e.length>0?e:a}function se(t){const n=t.trim()||"/wasm";if(n==="/")return $t();const a=n.replace(/\/+$/,"");return _e(a)?a:a.startsWith("/")?`${$t()}${a}`:new URL(a,tn()).href.replace(/\/+$/,"")}function Vt(t){return new URL("libredwg-web.wasm",jt(t)).href}function jt(t){return t.endsWith("/")?t:`${t}/`}function _e(t){return/^[a-z][a-z0-9+.-]*:/i.test(t)}function tn(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof location<"u"&&location.href?location.href:"http://localhost/"}function $t(){return typeof location<"u"&&location.origin?location.origin:new URL(tn()).origin}async function de(t){if(typeof fetch!="function")throw new Error("fetch() is not available, so the LibreDWG WASM binary cannot be loaded.");const n=await fetch(t,{credentials:"same-origin",cache:"force-cache"});if(!n.ok)throw new Error(`WASM asset request failed with HTTP ${n.status} for ${t}.`);const a=new Uint8Array(await n.arrayBuffer());if(!le(a)){const e=Ee(a),i=n.headers.get("content-type")??"unknown content-type";throw new Error(`Invalid WASM asset at ${t}. Expected bytes 00 61 73 6d, got ${ce(a)} (${i}). The server probably returned an HTML fallback page instead of libredwg-web.wasm. Response preview: ${e}`)}return a}function le(t){return t.length>=4&&t[0]===0&&t[1]===97&&t[2]===115&&t[3]===109}function ce(t){return Array.from(t.slice(0,4)).map(n=>n.toString(16).padStart(2,"0")).join(" ")}function Ee(t){const n=Array.from(t.slice(0,32)).map(a=>a>=32&&a<=126?String.fromCharCode(a):".").join("");return JSON.stringify(n)}const H=self;H.postMessage({type:"ready"});H.onmessage=async t=>{const n=t.data;if(!n)return;const a=performance.now(),e=i=>{H.postMessage({type:"progress",requestId:n.requestId,progress:i})};try{if(n.type==="warmup"){e({phase:"wasm-init",format:"dwg",message:"Warming LibreDWG WebAssembly instance…"}),await Zt(n.options?.wasmPath??"/wasm/"),H.postMessage({type:"warmup-result",requestId:n.requestId,elapsedMs:performance.now()-a});return}if(n.type!=="load")return;e({phase:"worker-ready",format:"dwg",message:"DWG worker received file bytes.",total:n.bytes.byteLength});const i=await ne(new Uint8Array(n.bytes),{...n.options,sourceName:n.fileName,keepRaw:!!n.options?.keepRaw,onProgress:e});i.document.metadata.loaderMode="worker",i.elapsedMs=performance.now()-a,H.postMessage({type:"result",requestId:n.requestId,result:i})}catch(i){const r=ue(i);H.postMessage({type:"error",requestId:n.requestId,error:r})}};function ue(t){return t instanceof Error?{name:t.name,message:t.message,stack:t.stack}:{message:String(t)}}var ft;(function(t){t[t.CP_UTF8=0]="CP_UTF8",t[t.CP_US_ASCII=1]="CP_US_ASCII",t[t.CP_ISO_8859_1=2]="CP_ISO_8859_1",t[t.CP_ISO_8859_2=3]="CP_ISO_8859_2",t[t.CP_ISO_8859_3=4]="CP_ISO_8859_3",t[t.CP_ISO_8859_4=5]="CP_ISO_8859_4",t[t.CP_ISO_8859_5=6]="CP_ISO_8859_5",t[t.CP_ISO_8859_6=7]="CP_ISO_8859_6",t[t.CP_ISO_8859_7=8]="CP_ISO_8859_7",t[t.CP_ISO_8859_8=9]="CP_ISO_8859_8",t[t.CP_ISO_8859_9=10]="CP_ISO_8859_9",t[t.CP_CP437=11]="CP_CP437",t[t.CP_CP850=12]="CP_CP850",t[t.CP_CP852=13]="CP_CP852",t[t.CP_CP855=14]="CP_CP855",t[t.CP_CP857=15]="CP_CP857",t[t.CP_CP860=16]="CP_CP860",t[t.CP_CP861=17]="CP_CP861",t[t.CP_CP863=18]="CP_CP863",t[t.CP_CP864=19]="CP_CP864",t[t.CP_CP865=20]="CP_CP865",t[t.CP_CP869=21]="CP_CP869",t[t.CP_CP932=22]="CP_CP932",t[t.CP_MACINTOSH=23]="CP_MACINTOSH",t[t.CP_BIG5=24]="CP_BIG5",t[t.CP_CP949=25]="CP_CP949",t[t.CP_JOHAB=26]="CP_JOHAB",t[t.CP_CP866=27]="CP_CP866",t[t.CP_ANSI_1250=28]="CP_ANSI_1250",t[t.CP_ANSI_1251=29]="CP_ANSI_1251",t[t.CP_ANSI_1252=30]="CP_ANSI_1252",t[t.CP_GB2312=31]="CP_GB2312",t[t.CP_ANSI_1253=32]="CP_ANSI_1253",t[t.CP_ANSI_1254=33]="CP_ANSI_1254",t[t.CP_ANSI_1255=34]="CP_ANSI_1255",t[t.CP_ANSI_1256=35]="CP_ANSI_1256",t[t.CP_ANSI_1257=36]="CP_ANSI_1257",t[t.CP_ANSI_874=37]="CP_ANSI_874",t[t.CP_ANSI_932=38]="CP_ANSI_932",t[t.CP_ANSI_936=39]="CP_ANSI_936",t[t.CP_ANSI_949=40]="CP_ANSI_949",t[t.CP_ANSI_950=41]="CP_ANSI_950",t[t.CP_ANSI_1361=42]="CP_ANSI_1361",t[t.CP_UTF16=43]="CP_UTF16",t[t.CP_ANSI_1258=44]="CP_ANSI_1258",t[t.CP_UNDEFINED=255]="CP_UNDEFINED"})(ft||(ft={}));const Ae=["utf-8","utf-8","iso-8859-1","iso-8859-2","iso-8859-3","iso-8859-4","iso-8859-5","iso-8859-6","iso-8859-7","iso-8859-8","iso-8859-9","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","utf-8","shift-jis","macintosh","big5","utf-8","utf-8","ibm866","windows-1250","windows-1251","windows-1252","gbk","windows-1253","windows-1254","windows-1255","windows-1256","windows-1257","windows-874","shift-jis","gbk","euc-kr","big5","utf-8","utf-16le","windows-1258"],ht=t=>Ae[t];var Ct;(function(t){t[t.Rotated=0]="Rotated",t[t.Aligned=1]="Aligned",t[t.Angular=2]="Angular",t[t.Diameter=3]="Diameter",t[t.Radius=4]="Radius",t[t.Angular3Point=5]="Angular3Point",t[t.Ordinate=6]="Ordinate",t[t.ReferenceIsExclusive=32]="ReferenceIsExclusive",t[t.IsOrdinateXTypeFlag=64]="IsOrdinateXTypeFlag",t[t.IsCustomTextPositionFlag=128]="IsCustomTextPositionFlag"})(Ct||(Ct={}));var w;(function(t){t[t.TopLeft=1]="TopLeft",t[t.TopCenter=2]="TopCenter",t[t.TopRight=3]="TopRight",t[t.MiddleLeft=4]="MiddleLeft",t[t.MiddleCenter=5]="MiddleCenter",t[t.MiddleRight=6]="MiddleRight",t[t.BottomLeft=7]="BottomLeft",t[t.BottomCenter=8]="BottomCenter",t[t.BottomRight=9]="BottomRight"})(w||(w={}));var Rt;(function(t){t[t.AtLeast=1]="AtLeast",t[t.Exact=2]="Exact"})(Rt||(Rt={}));var Yt;(function(t){t[t.Center=0]="Center",t[t.Above=1]="Above",t[t.Outside=2]="Outside",t[t.JIS=3]="JIS",t[t.Below=4]="Below"})(Yt||(Yt={}));var gt;(function(t){t[t.Feet=0]="Feet",t[t.None=1]="None",t[t.Inch=2]="Inch",t[t.FeetAndInch=3]="FeetAndInch",t[t.Leading=4]="Leading",t[t.Trailing=8]="Trailing",t[t.LeadingAndTrailing=12]="LeadingAndTrailing"})(gt||(gt={}));var Lt;(function(t){t[t.None=0]="None",t[t.Leading=1]="Leading",t[t.Trailing=2]="Trailing",t[t.LeadingAndTrailing=3]="LeadingAndTrailing"})(Lt||(Lt={}));var vt;(function(t){t[t.Center=0]="Center",t[t.Left=1]="Left",t[t.Right=2]="Right",t[t.OverFirst=3]="OverFirst",t[t.OverSecond=4]="OverSecond"})(vt||(vt={}));var Nt;(function(t){t[t.Bottom=0]="Bottom",t[t.Center=1]="Center",t[t.Top=2]="Top"})(Nt||(Nt={}));var Q;(function(t){t[t.PatternFill=0]="PatternFill",t[t.SolidFill=1]="SolidFill"})(Q||(Q={}));var j;(function(t){t[t.NonAssociative=0]="NonAssociative",t[t.Associative=1]="Associative"})(j||(j={}));var St;(function(t){t[t.Normal=0]="Normal",t[t.Outer=1]="Outer",t[t.Ignore=2]="Ignore"})(St||(St={}));var Gt;(function(t){t[t.UserDefined=0]="UserDefined",t[t.Predefined=1]="Predefined",t[t.Custom=2]="Custom"})(Gt||(Gt={}));var Dt;(function(t){t[t.NotAnnotated=0]="NotAnnotated",t[t.Annotated=1]="Annotated"})(Dt||(Dt={}));var at;(function(t){t[t.Solid=0]="Solid",t[t.Gradient=1]="Gradient"})(at||(at={}));var tt;(function(t){t[t.TwoColor=0]="TwoColor",t[t.OneColor=1]="OneColor"})(tt||(tt={}));var pt;(function(t){t[t.Default=0]="Default",t[t.External=1]="External",t[t.Polyline=2]="Polyline",t[t.Derived=4]="Derived",t[t.Textbox=8]="Textbox",t[t.Outermost=16]="Outermost"})(pt||(pt={}));var F;(function(t){t[t.Line=1]="Line",t[t.Circular=2]="Circular",t[t.Elliptic=3]="Elliptic",t[t.Spline=4]="Spline"})(F||(F={}));var yt;(function(t){t[t.CLOSED_POLYLINE=1]="CLOSED_POLYLINE",t[t.CURVE_FIT=2]="CURVE_FIT",t[t.SPLINE_FIT=4]="SPLINE_FIT",t[t.POLYLINE_3D=8]="POLYLINE_3D",t[t.POLYGON_3D=16]="POLYGON_3D",t[t.CLOSED_POLYGON=32]="CLOSED_POLYGON",t[t.POLYFACE=64]="POLYFACE",t[t.CONTINUOUS=128]="CONTINUOUS"})(yt||(yt={}));var Wt;(function(t){t[t.NONE=0]="NONE",t[t.QUADRATIC=5]="QUADRATIC",t[t.CUBIC=6]="CUBIC",t[t.BEZIER=8]="BEZIER"})(Wt||(Wt={}));var Mt;(function(t){t[t.NONE=0]="NONE",t[t.MIRRORED_X=2]="MIRRORED_X",t[t.MIRRORED_Y=4]="MIRRORED_Y"})(Mt||(Mt={}));var nt;(function(t){t[t.LEFT=0]="LEFT",t[t.CENTER=1]="CENTER",t[t.RIGHT=2]="RIGHT",t[t.ALIGNED=3]="ALIGNED",t[t.MIDDLE=4]="MIDDLE",t[t.FIT=5]="FIT"})(nt||(nt={}));var mt;(function(t){t[t.BASELINE=0]="BASELINE",t[t.BOTTOM=1]="BOTTOM",t[t.MIDDLE=2]="MIDDLE",t[t.TOP=3]="TOP"})(mt||(mt={}));const nn=Object.freeze(["ACADMAINTVER","ACADVER","ANGBASE","ANGDIR","ATTMODE","AUNITS","AUPREC","CECOLOR","CELTSCALE","CELTYPE","CELWEIGHT","CEPSNID","CEPSNTYPE","CHAMFERA","CHAMFERB","CHAMFERC","CHAMFERD","CLAYER","CMLJUST","CMLSCALE","CMLSTYLE","CSHADOW","DIMADEC","DIMALT","DIMALTD","DIMALTF","DIMALTRND","DIMALTTD","DIMALTTZ","DIMALTU","DIMALTZ","DIMAPOST","DIMASO","DIMASSOC","DIMASZ","DIMATFIT","DIMAUNIT","DIMAZIN","DIMBLK","DIMBLK1","DIMBLK2","DIMCEN","DIMCLRD","DIMCLRE","DIMCLRT","DIMDEC","DIMDLE","DIMDLI","DIMDSEP","DIMEXE","DIMEXO","DIMFAC","DIMGAP","DIMJUST","DIMLDRBLK","DIMLFAC","DIMLIM","DIMLUNIT","DIMLWD","DIMLWE","DIMPOST","DIMRND","DIMSAH","DIMSCALE","DIMSD1","DIMSD2","DIMSE1","DIMSE2","DIMSHO","DIMSOXD","DIMSTYLE","DIMTAD","DIMTDEC","DIMTFAC","DIMTIH","DIMTIX","DIMTM","DIMTMOVE","DIMTOFL","DIMTOH","DIMTOL","DIMTOLJ","DIMTP","DIMTSZ","DIMTVP","DIMTXSTY","DIMTXT","DIMTZIN","DIMUPT","DIMZIN","DISPSILH","DRAGVS","DWGCODEPAGE","ELEVATION","ENDCAPS","EXTMAX","EXTMIN","EXTNAMES","FILLETRAD","FILLMODE","FINGERPRINTGUID","HALOGAP","HANDSEED","HIDETEXT","HYPERLINKBASE","INDEXCTL","INSBASE","INSUNITS","INTERFERECOLOR","INTERFEREOBJVS","INTERFEREVPVS","INTERSECTIONCOLOR","INTERSECTIONDISPLAY","JOINSTYLE","LIMCHECK","LIMMAX","LIMMIN","LTSCALE","LUNITS","LUPREC","LWDISPLAY","MAXACTVP","MEASUREMENT","MENU","MIRRTEXT","OBSCOLOR","OBSLTYPE","ORTHOMODE","PDMODE","PDSIZE","PELEVATION","PEXTMAX","PEXTMIN","PINSBASE","PLIMCHECK","PLIMMAX","PLIMMIN","PLINEGEN","PLINEWID","PROJECTNAME","PROXYGRAPHICS","PSLTSCALE","PSTYLEMODE","PSVPSCALE","PUCSBASE","PUCSNAME","PUCSORG","PUCSORGBACK","PUCSORGBOTTOM","PUCSORGFRONT","PUCSORGLEFT","PUCSORGRIGHT","PUCSORGTOP","PUCSORTHOREF","PUCSORTHOVIEW","PUCSXDIR","PUCSYDIR","QTEXTMODE","REGENMODE","SHADEDGE","SHADEDIF","SHADOWPLANELOCATION","SKETCHINC","SKPOLY","SORTENTS","SPLINESEGS","SPLINETYPE","SURFTAB1","SURFTAB2","SURFTYPE","SURFU","SURFV","TDCREATE","TDINDWG","TDUCREATE","TDUPDATE","TDUSRTIMER","TDUUPDATE","TEXTSIZE","TEXTSTYLE","THICKNESS","TILEMODE","TRACEWID","TREEDEPTH","UCSBASE","UCSNAME","UCSORG","UCSORGBACK","UCSORGBOTTOM","UCSORGFRONT","UCSORGLEFT","UCSORGRIGHT","UCSORGTOP","UCSORTHOREF","UCSORTHOVIEW","UCSXDIR","UCSYDIR","UNITMODE","USERI1","USERI2","USERI3","USERI4","USERI5","USERR1","USERR2","USERR3","USERR4","USERR5","USRTIMER","VERSIONGUID","VISRETAIN","WORLDVIEW","XCLIPFRAME","XEDIT"]);var xt;(function(t){t[t.NotApplicable=0]="NotApplicable",t[t.KeepExisting=1]="KeepExisting",t[t.UseClone=2]="UseClone",t[t.XrefName=3]="XrefName",t[t.Name=4]="Name",t[t.UnmangleName=5]="UnmangleName"})(xt||(xt={}));const en=[{type:"invalid",hdr:"INVALI",description:"No DWG",version:0},{type:"r1.1",hdr:"MC0.0",description:"MicroCAD Release 1.1",version:0},{type:"r1.2",hdr:"AC1.2",description:"AutoCAD Release 1.2",version:0},{type:"r1.3",hdr:"AC1.3",description:"AutoCAD Release 1.3",version:1},{type:"r1.4",hdr:"AC1.40",description:"AutoCAD Release 1.4",version:2},{type:"r2.0b",hdr:"AC1.50",description:"AutoCAD 2.0 beta",version:3},{type:"r2.0",hdr:"AC1.50",description:"AutoCAD Release 2.0",version:4},{type:"r2.10",hdr:"AC2.10",description:"AutoCAD Release 2.10",version:5},{type:"r2.21",hdr:"AC2.21",description:"AutoCAD Release 2.21",version:6},{type:"r2.22",hdr:"AC2.22",description:"AutoCAD Release 2.22",version:7},{type:"r2.4",hdr:"AC1001",description:"AutoCAD Release 2.4",version:8},{type:"r2.5",hdr:"AC1002",description:"AutoCAD Release 2.5",version:9},{type:"r2.6",hdr:"AC1003",description:"AutoCAD Release 2.6",version:10},{type:"r9",hdr:"AC1004",description:"AutoCAD Release 9",version:11},{type:"r9c1",hdr:"AC1005",description:"AutoCAD Release 9c1",version:12},{type:"r10",hdr:"AC1006",description:"AutoCAD Release 10",version:13},{type:"r11b1",hdr:"AC1007",description:"AutoCAD 11 beta 1",version:14},{type:"r11b2",hdr:"AC1008",description:"AutoCAD 11 beta 2",version:15},{type:"r11",hdr:"AC1009",description:"AutoCAD Release 11/12 (LT R1/R2)",version:16},{type:"r13b1",hdr:"AC1010",description:"AutoCAD pre-R13 a",version:17},{type:"r13b2",hdr:"AC1011",description:"AutoCAD pre-R13 b",version:18},{type:"r13",hdr:"AC1012",description:"AutoCAD Release 13",version:19},{type:"r13c3",hdr:"AC1013",description:"AutoCAD Release 13c3",version:20},{type:"r14",hdr:"AC1014",description:"AutoCAD Release 14",version:21},{type:"r2000b",hdr:"AC1500",description:"AutoCAD 2000 beta",version:22},{type:"r2000",hdr:"AC1015",description:"AutoCAD Release 2000",version:23},{type:"r2000i",hdr:"AC1016",description:"AutoCAD Release 2000i",version:23},{type:"r2002",hdr:"AC1017",description:"AutoCAD Release 2002",version:23},{type:"r2004a",hdr:"AC402a",description:"AutoCAD 2004 alpha a",version:24},{type:"r2004b",hdr:"AC402b",description:"AutoCAD 2004 alpha b",version:24},{type:"r2004c",hdr:"AC1018",description:"AutoCAD 2004 beta",version:24},{type:"r2004",hdr:"AC1018",description:"AutoCAD Release 2004",version:25},{type:"r2007a",hdr:"AC701a",description:"AutoCAD 2007 alpha",version:26},{type:"r2007b",hdr:"AC1021",description:"AutoCAD 2007 beta",version:26},{type:"r2007",hdr:"AC1021",description:"AutoCAD Release 2007",version:27},{type:"r2010b",hdr:"AC1024",description:"AutoCAD 2010 beta",version:28},{type:"r2010",hdr:"AC1024",description:"AutoCAD Release 2010",version:29},{type:"r2013b",hdr:"AC1027",description:"AutoCAD 2013 beta",version:30},{type:"r2013",hdr:"AC1027",description:"AutoCAD Release 2013",version:31},{type:"r2018b",hdr:"AC1032",description:"AutoCAD 2018 beta",version:32},{type:"r2018",hdr:"AC1032",description:"AutoCAD Release 2018",version:33},{type:"r2022b",hdr:"AC103-4",description:"AutoCAD 2022 beta",version:36},{type:"r>2022",hdr:"",description:"AutoCAD Release >2022",version:0}];async function Ot(t={}){const n=Ie(t),a=await import(n),e=a.default??a.createModule??a;if(typeof e!="function")throw new Error(`LibreDWG runtime module at ${n} did not export a createModule function.`);return e(t)}function Ie(t){const n=t.locateFile;if(typeof n=="function")try{const a=n("libredwg-web.js","");if(typeof a=="string"&&a.length>0)return a}catch{}return typeof document<"u"&&document.baseURI?new URL("wasm/libredwg-web.js",document.baseURI).href:typeof location<"u"&&location.href?new URL("/wasm/libredwg-web.js",location.origin).href:"/wasm/libredwg-web.js"}var wt;(function(t){t[t.DWG_SUPERTYPE_ENTITY=0]="DWG_SUPERTYPE_ENTITY",t[t.DWG_SUPERTYPE_OBJECT=1]="DWG_SUPERTYPE_OBJECT"})(wt||(wt={}));var P;(function(t){t[t.DWG_TYPE_UNUSED=0]="DWG_TYPE_UNUSED",t[t.DWG_TYPE_TEXT=1]="DWG_TYPE_TEXT",t[t.DWG_TYPE_ATTRIB=2]="DWG_TYPE_ATTRIB",t[t.DWG_TYPE_ATTDEF=3]="DWG_TYPE_ATTDEF",t[t.DWG_TYPE_BLOCK=4]="DWG_TYPE_BLOCK",t[t.DWG_TYPE_ENDBLK=5]="DWG_TYPE_ENDBLK",t[t.DWG_TYPE_SEQEND=6]="DWG_TYPE_SEQEND",t[t.DWG_TYPE_INSERT=7]="DWG_TYPE_INSERT",t[t.DWG_TYPE_MINSERT=8]="DWG_TYPE_MINSERT",t[t.DWG_TYPE_VERTEX_2D=10]="DWG_TYPE_VERTEX_2D",t[t.DWG_TYPE_VERTEX_3D=11]="DWG_TYPE_VERTEX_3D",t[t.DWG_TYPE_VERTEX_MESH=12]="DWG_TYPE_VERTEX_MESH",t[t.DWG_TYPE_VERTEX_PFACE=13]="DWG_TYPE_VERTEX_PFACE",t[t.DWG_TYPE_VERTEX_PFACE_FACE=14]="DWG_TYPE_VERTEX_PFACE_FACE",t[t.DWG_TYPE_POLYLINE_2D=15]="DWG_TYPE_POLYLINE_2D",t[t.DWG_TYPE_POLYLINE_3D=16]="DWG_TYPE_POLYLINE_3D",t[t.DWG_TYPE_ARC=17]="DWG_TYPE_ARC",t[t.DWG_TYPE_CIRCLE=18]="DWG_TYPE_CIRCLE",t[t.DWG_TYPE_LINE=19]="DWG_TYPE_LINE",t[t.DWG_TYPE_DIMENSION_ORDINATE=20]="DWG_TYPE_DIMENSION_ORDINATE",t[t.DWG_TYPE_DIMENSION_LINEAR=21]="DWG_TYPE_DIMENSION_LINEAR",t[t.DWG_TYPE_DIMENSION_ALIGNED=22]="DWG_TYPE_DIMENSION_ALIGNED",t[t.DWG_TYPE_DIMENSION_ANG3PT=23]="DWG_TYPE_DIMENSION_ANG3PT",t[t.DWG_TYPE_DIMENSION_ANG2LN=24]="DWG_TYPE_DIMENSION_ANG2LN",t[t.DWG_TYPE_DIMENSION_RADIUS=25]="DWG_TYPE_DIMENSION_RADIUS",t[t.DWG_TYPE_DIMENSION_DIAMETER=26]="DWG_TYPE_DIMENSION_DIAMETER",t[t.DWG_TYPE_POINT=27]="DWG_TYPE_POINT",t[t.DWG_TYPE_3DFACE=28]="DWG_TYPE_3DFACE",t[t.DWG_TYPE_POLYLINE_PFACE=29]="DWG_TYPE_POLYLINE_PFACE",t[t.DWG_TYPE_POLYLINE_MESH=30]="DWG_TYPE_POLYLINE_MESH",t[t.DWG_TYPE_SOLID=31]="DWG_TYPE_SOLID",t[t.DWG_TYPE_TRACE=32]="DWG_TYPE_TRACE",t[t.DWG_TYPE_SHAPE=33]="DWG_TYPE_SHAPE",t[t.DWG_TYPE_VIEWPORT=34]="DWG_TYPE_VIEWPORT",t[t.DWG_TYPE_ELLIPSE=35]="DWG_TYPE_ELLIPSE",t[t.DWG_TYPE_SPLINE=36]="DWG_TYPE_SPLINE",t[t.DWG_TYPE_REGION=37]="DWG_TYPE_REGION",t[t.DWG_TYPE_3DSOLID=38]="DWG_TYPE_3DSOLID",t[t.DWG_TYPE_BODY=39]="DWG_TYPE_BODY",t[t.DWG_TYPE_RAY=40]="DWG_TYPE_RAY",t[t.DWG_TYPE_XLINE=41]="DWG_TYPE_XLINE",t[t.DWG_TYPE_DICTIONARY=42]="DWG_TYPE_DICTIONARY",t[t.DWG_TYPE_OLEFRAME=43]="DWG_TYPE_OLEFRAME",t[t.DWG_TYPE_MTEXT=44]="DWG_TYPE_MTEXT",t[t.DWG_TYPE_LEADER=45]="DWG_TYPE_LEADER",t[t.DWG_TYPE_TOLERANCE=46]="DWG_TYPE_TOLERANCE",t[t.DWG_TYPE_MLINE=47]="DWG_TYPE_MLINE",t[t.DWG_TYPE_BLOCK_CONTROL=48]="DWG_TYPE_BLOCK_CONTROL",t[t.DWG_TYPE_BLOCK_HEADER=49]="DWG_TYPE_BLOCK_HEADER",t[t.DWG_TYPE_LAYER_CONTROL=50]="DWG_TYPE_LAYER_CONTROL",t[t.DWG_TYPE_LAYER=51]="DWG_TYPE_LAYER",t[t.DWG_TYPE_STYLE_CONTROL=52]="DWG_TYPE_STYLE_CONTROL",t[t.DWG_TYPE_STYLE=53]="DWG_TYPE_STYLE",t[t.DWG_TYPE_LTYPE_CONTROL=56]="DWG_TYPE_LTYPE_CONTROL",t[t.DWG_TYPE_LTYPE=57]="DWG_TYPE_LTYPE",t[t.DWG_TYPE_VIEW_CONTROL=60]="DWG_TYPE_VIEW_CONTROL",t[t.DWG_TYPE_VIEW=61]="DWG_TYPE_VIEW",t[t.DWG_TYPE_UCS_CONTROL=62]="DWG_TYPE_UCS_CONTROL",t[t.DWG_TYPE_UCS=63]="DWG_TYPE_UCS",t[t.DWG_TYPE_VPORT_CONTROL=64]="DWG_TYPE_VPORT_CONTROL",t[t.DWG_TYPE_VPORT=65]="DWG_TYPE_VPORT",t[t.DWG_TYPE_APPID_CONTROL=66]="DWG_TYPE_APPID_CONTROL",t[t.DWG_TYPE_APPID=67]="DWG_TYPE_APPID",t[t.DWG_TYPE_DIMSTYLE_CONTROL=68]="DWG_TYPE_DIMSTYLE_CONTROL",t[t.DWG_TYPE_DIMSTYLE=69]="DWG_TYPE_DIMSTYLE",t[t.DWG_TYPE_VX_CONTROL=70]="DWG_TYPE_VX_CONTROL",t[t.DWG_TYPE_VX_TABLE_RECORD=71]="DWG_TYPE_VX_TABLE_RECORD",t[t.DWG_TYPE_GROUP=72]="DWG_TYPE_GROUP",t[t.DWG_TYPE_MLINESTYLE=73]="DWG_TYPE_MLINESTYLE",t[t.DWG_TYPE_OLE2FRAME=74]="DWG_TYPE_OLE2FRAME",t[t.DWG_TYPE_DUMMY=75]="DWG_TYPE_DUMMY",t[t.DWG_TYPE_LONG_TRANSACTION=76]="DWG_TYPE_LONG_TRANSACTION",t[t.DWG_TYPE_LWPOLYLINE=77]="DWG_TYPE_LWPOLYLINE",t[t.DWG_TYPE_HATCH=78]="DWG_TYPE_HATCH",t[t.DWG_TYPE_XRECORD=79]="DWG_TYPE_XRECORD",t[t.DWG_TYPE_PLACEHOLDER=80]="DWG_TYPE_PLACEHOLDER",t[t.DWG_TYPE_VBA_PROJECT=81]="DWG_TYPE_VBA_PROJECT",t[t.DWG_TYPE_LAYOUT=82]="DWG_TYPE_LAYOUT",t[t.DWG_TYPE_PROXY_ENTITY=498]="DWG_TYPE_PROXY_ENTITY",t[t.DWG_TYPE_PROXY_OBJECT=499]="DWG_TYPE_PROXY_OBJECT",t[t.DWG_TYPE_ACDSRECORD=500]="DWG_TYPE_ACDSRECORD",t[t.DWG_TYPE_ACDSSCHEMA=501]="DWG_TYPE_ACDSSCHEMA",t[t.DWG_TYPE_ACMECOMMANDHISTORY=502]="DWG_TYPE_ACMECOMMANDHISTORY",t[t.DWG_TYPE_ACMESCOPE=503]="DWG_TYPE_ACMESCOPE",t[t.DWG_TYPE_ACMESTATEMGR=504]="DWG_TYPE_ACMESTATEMGR",t[t.DWG_TYPE_ACSH_BOOLEAN_CLASS=505]="DWG_TYPE_ACSH_BOOLEAN_CLASS",t[t.DWG_TYPE_ACSH_BOX_CLASS=506]="DWG_TYPE_ACSH_BOX_CLASS",t[t.DWG_TYPE_ACSH_BREP_CLASS=507]="DWG_TYPE_ACSH_BREP_CLASS",t[t.DWG_TYPE_ACSH_CHAMFER_CLASS=508]="DWG_TYPE_ACSH_CHAMFER_CLASS",t[t.DWG_TYPE_ACSH_CONE_CLASS=509]="DWG_TYPE_ACSH_CONE_CLASS",t[t.DWG_TYPE_ACSH_CYLINDER_CLASS=510]="DWG_TYPE_ACSH_CYLINDER_CLASS",t[t.DWG_TYPE_ACSH_EXTRUSION_CLASS=511]="DWG_TYPE_ACSH_EXTRUSION_CLASS",t[t.DWG_TYPE_ACSH_FILLET_CLASS=512]="DWG_TYPE_ACSH_FILLET_CLASS",t[t.DWG_TYPE_ACSH_HISTORY_CLASS=513]="DWG_TYPE_ACSH_HISTORY_CLASS",t[t.DWG_TYPE_ACSH_LOFT_CLASS=514]="DWG_TYPE_ACSH_LOFT_CLASS",t[t.DWG_TYPE_ACSH_PYRAMID_CLASS=515]="DWG_TYPE_ACSH_PYRAMID_CLASS",t[t.DWG_TYPE_ACSH_REVOLVE_CLASS=516]="DWG_TYPE_ACSH_REVOLVE_CLASS",t[t.DWG_TYPE_ACSH_SPHERE_CLASS=517]="DWG_TYPE_ACSH_SPHERE_CLASS",t[t.DWG_TYPE_ACSH_SWEEP_CLASS=518]="DWG_TYPE_ACSH_SWEEP_CLASS",t[t.DWG_TYPE_ACSH_TORUS_CLASS=519]="DWG_TYPE_ACSH_TORUS_CLASS",t[t.DWG_TYPE_ACSH_WEDGE_CLASS=520]="DWG_TYPE_ACSH_WEDGE_CLASS",t[t.DWG_TYPE_ALDIMOBJECTCONTEXTDATA=521]="DWG_TYPE_ALDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ALIGNMENTPARAMETERENTITY=522]="DWG_TYPE_ALIGNMENTPARAMETERENTITY",t[t.DWG_TYPE_ANGDIMOBJECTCONTEXTDATA=523]="DWG_TYPE_ANGDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA=524]="DWG_TYPE_ANNOTSCALEOBJECTCONTEXTDATA",t[t.DWG_TYPE_ARCALIGNEDTEXT=525]="DWG_TYPE_ARCALIGNEDTEXT",t[t.DWG_TYPE_ARC_DIMENSION=526]="DWG_TYPE_ARC_DIMENSION",t[t.DWG_TYPE_ASSOC2DCONSTRAINTGROUP=527]="DWG_TYPE_ASSOC2DCONSTRAINTGROUP",t[t.DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY=528]="DWG_TYPE_ASSOC3POINTANGULARDIMACTIONBODY",t[t.DWG_TYPE_ASSOCACTION=529]="DWG_TYPE_ASSOCACTION",t[t.DWG_TYPE_ASSOCACTIONPARAM=530]="DWG_TYPE_ASSOCACTIONPARAM",t[t.DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY=531]="DWG_TYPE_ASSOCALIGNEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYACTIONBODY=532]="DWG_TYPE_ASSOCARRAYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY=533]="DWG_TYPE_ASSOCARRAYMODIFYACTIONBODY",t[t.DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS=534]="DWG_TYPE_ASSOCARRAYMODIFYPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPATHPARAMETERS=535]="DWG_TYPE_ASSOCARRAYPATHPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYPOLARPARAMETERS=536]="DWG_TYPE_ASSOCARRAYPOLARPARAMETERS",t[t.DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS=537]="DWG_TYPE_ASSOCARRAYRECTANGULARPARAMETERS",t[t.DWG_TYPE_ASSOCASMBODYACTIONPARAM=538]="DWG_TYPE_ASSOCASMBODYACTIONPARAM",t[t.DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY=539]="DWG_TYPE_ASSOCBLENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM=540]="DWG_TYPE_ASSOCCOMPOUNDACTIONPARAM",t[t.DWG_TYPE_ASSOCDEPENDENCY=541]="DWG_TYPE_ASSOCDEPENDENCY",t[t.DWG_TYPE_ASSOCDIMDEPENDENCYBODY=542]="DWG_TYPE_ASSOCDIMDEPENDENCYBODY",t[t.DWG_TYPE_ASSOCEDGEACTIONPARAM=543]="DWG_TYPE_ASSOCEDGEACTIONPARAM",t[t.DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY=544]="DWG_TYPE_ASSOCEDGECHAMFERACTIONBODY",t[t.DWG_TYPE_ASSOCEDGEFILLETACTIONBODY=545]="DWG_TYPE_ASSOCEDGEFILLETACTIONBODY",t[t.DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY=546]="DWG_TYPE_ASSOCEXTENDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY=547]="DWG_TYPE_ASSOCEXTRUDEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCFACEACTIONPARAM=548]="DWG_TYPE_ASSOCFACEACTIONPARAM",t[t.DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY=549]="DWG_TYPE_ASSOCFILLETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCGEOMDEPENDENCY=550]="DWG_TYPE_ASSOCGEOMDEPENDENCY",t[t.DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY=551]="DWG_TYPE_ASSOCLOFTEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCMLEADERACTIONBODY=552]="DWG_TYPE_ASSOCMLEADERACTIONBODY",t[t.DWG_TYPE_ASSOCNETWORK=553]="DWG_TYPE_ASSOCNETWORK",t[t.DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY=554]="DWG_TYPE_ASSOCNETWORKSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCOBJECTACTIONPARAM=555]="DWG_TYPE_ASSOCOBJECTACTIONPARAM",t[t.DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY=556]="DWG_TYPE_ASSOCOFFSETSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCORDINATEDIMACTIONBODY=557]="DWG_TYPE_ASSOCORDINATEDIMACTIONBODY",t[t.DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM=558]="DWG_TYPE_ASSOCOSNAPPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY=559]="DWG_TYPE_ASSOCPATCHSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPATHACTIONPARAM=560]="DWG_TYPE_ASSOCPATHACTIONPARAM",t[t.DWG_TYPE_ASSOCPERSSUBENTMANAGER=561]="DWG_TYPE_ASSOCPERSSUBENTMANAGER",t[t.DWG_TYPE_ASSOCPLANESURFACEACTIONBODY=562]="DWG_TYPE_ASSOCPLANESURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCPOINTREFACTIONPARAM=563]="DWG_TYPE_ASSOCPOINTREFACTIONPARAM",t[t.DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY=564]="DWG_TYPE_ASSOCRESTOREENTITYSTATEACTIONBODY",t[t.DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY=565]="DWG_TYPE_ASSOCREVOLVEDSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCROTATEDDIMACTIONBODY=566]="DWG_TYPE_ASSOCROTATEDDIMACTIONBODY",t[t.DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY=567]="DWG_TYPE_ASSOCSWEPTSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY=568]="DWG_TYPE_ASSOCTRIMSURFACEACTIONBODY",t[t.DWG_TYPE_ASSOCVALUEDEPENDENCY=569]="DWG_TYPE_ASSOCVALUEDEPENDENCY",t[t.DWG_TYPE_ASSOCVARIABLE=570]="DWG_TYPE_ASSOCVARIABLE",t[t.DWG_TYPE_ASSOCVERTEXACTIONPARAM=571]="DWG_TYPE_ASSOCVERTEXACTIONPARAM",t[t.DWG_TYPE_BASEPOINTPARAMETERENTITY=572]="DWG_TYPE_BASEPOINTPARAMETERENTITY",t[t.DWG_TYPE_BLKREFOBJECTCONTEXTDATA=573]="DWG_TYPE_BLKREFOBJECTCONTEXTDATA",t[t.DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER=574]="DWG_TYPE_BLOCKALIGNEDCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKALIGNMENTGRIP=575]="DWG_TYPE_BLOCKALIGNMENTGRIP",t[t.DWG_TYPE_BLOCKALIGNMENTPARAMETER=576]="DWG_TYPE_BLOCKALIGNMENTPARAMETER",t[t.DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER=577]="DWG_TYPE_BLOCKANGULARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKARRAYACTION=578]="DWG_TYPE_BLOCKARRAYACTION",t[t.DWG_TYPE_BLOCKBASEPOINTPARAMETER=579]="DWG_TYPE_BLOCKBASEPOINTPARAMETER",t[t.DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER=580]="DWG_TYPE_BLOCKDIAMETRICCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKFLIPACTION=581]="DWG_TYPE_BLOCKFLIPACTION",t[t.DWG_TYPE_BLOCKFLIPGRIP=582]="DWG_TYPE_BLOCKFLIPGRIP",t[t.DWG_TYPE_BLOCKFLIPPARAMETER=583]="DWG_TYPE_BLOCKFLIPPARAMETER",t[t.DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT=584]="DWG_TYPE_BLOCKGRIPLOCATIONCOMPONENT",t[t.DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER=585]="DWG_TYPE_BLOCKHORIZONTALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER=586]="DWG_TYPE_BLOCKLINEARCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKLINEARGRIP=587]="DWG_TYPE_BLOCKLINEARGRIP",t[t.DWG_TYPE_BLOCKLINEARPARAMETER=588]="DWG_TYPE_BLOCKLINEARPARAMETER",t[t.DWG_TYPE_BLOCKLOOKUPACTION=589]="DWG_TYPE_BLOCKLOOKUPACTION",t[t.DWG_TYPE_BLOCKLOOKUPGRIP=590]="DWG_TYPE_BLOCKLOOKUPGRIP",t[t.DWG_TYPE_BLOCKLOOKUPPARAMETER=591]="DWG_TYPE_BLOCKLOOKUPPARAMETER",t[t.DWG_TYPE_BLOCKMOVEACTION=592]="DWG_TYPE_BLOCKMOVEACTION",t[t.DWG_TYPE_BLOCKPARAMDEPENDENCYBODY=593]="DWG_TYPE_BLOCKPARAMDEPENDENCYBODY",t[t.DWG_TYPE_BLOCKPOINTPARAMETER=594]="DWG_TYPE_BLOCKPOINTPARAMETER",t[t.DWG_TYPE_BLOCKPOLARGRIP=595]="DWG_TYPE_BLOCKPOLARGRIP",t[t.DWG_TYPE_BLOCKPOLARPARAMETER=596]="DWG_TYPE_BLOCKPOLARPARAMETER",t[t.DWG_TYPE_BLOCKPOLARSTRETCHACTION=597]="DWG_TYPE_BLOCKPOLARSTRETCHACTION",t[t.DWG_TYPE_BLOCKPROPERTIESTABLE=598]="DWG_TYPE_BLOCKPROPERTIESTABLE",t[t.DWG_TYPE_BLOCKPROPERTIESTABLEGRIP=599]="DWG_TYPE_BLOCKPROPERTIESTABLEGRIP",t[t.DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER=600]="DWG_TYPE_BLOCKRADIALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKREPRESENTATION=601]="DWG_TYPE_BLOCKREPRESENTATION",t[t.DWG_TYPE_BLOCKROTATEACTION=602]="DWG_TYPE_BLOCKROTATEACTION",t[t.DWG_TYPE_BLOCKROTATIONGRIP=603]="DWG_TYPE_BLOCKROTATIONGRIP",t[t.DWG_TYPE_BLOCKROTATIONPARAMETER=604]="DWG_TYPE_BLOCKROTATIONPARAMETER",t[t.DWG_TYPE_BLOCKSCALEACTION=605]="DWG_TYPE_BLOCKSCALEACTION",t[t.DWG_TYPE_BLOCKSTRETCHACTION=606]="DWG_TYPE_BLOCKSTRETCHACTION",t[t.DWG_TYPE_BLOCKUSERPARAMETER=607]="DWG_TYPE_BLOCKUSERPARAMETER",t[t.DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER=608]="DWG_TYPE_BLOCKVERTICALCONSTRAINTPARAMETER",t[t.DWG_TYPE_BLOCKVISIBILITYGRIP=609]="DWG_TYPE_BLOCKVISIBILITYGRIP",t[t.DWG_TYPE_BLOCKVISIBILITYPARAMETER=610]="DWG_TYPE_BLOCKVISIBILITYPARAMETER",t[t.DWG_TYPE_BLOCKXYGRIP=611]="DWG_TYPE_BLOCKXYGRIP",t[t.DWG_TYPE_BLOCKXYPARAMETER=612]="DWG_TYPE_BLOCKXYPARAMETER",t[t.DWG_TYPE_CAMERA=613]="DWG_TYPE_CAMERA",t[t.DWG_TYPE_CELLSTYLEMAP=614]="DWG_TYPE_CELLSTYLEMAP",t[t.DWG_TYPE_CONTEXTDATAMANAGER=615]="DWG_TYPE_CONTEXTDATAMANAGER",t[t.DWG_TYPE_CSACDOCUMENTOPTIONS=616]="DWG_TYPE_CSACDOCUMENTOPTIONS",t[t.DWG_TYPE_CURVEPATH=617]="DWG_TYPE_CURVEPATH",t[t.DWG_TYPE_DATALINK=618]="DWG_TYPE_DATALINK",t[t.DWG_TYPE_DATATABLE=619]="DWG_TYPE_DATATABLE",t[t.DWG_TYPE_DBCOLOR=620]="DWG_TYPE_DBCOLOR",t[t.DWG_TYPE_DETAILVIEWSTYLE=621]="DWG_TYPE_DETAILVIEWSTYLE",t[t.DWG_TYPE_DGNDEFINITION=622]="DWG_TYPE_DGNDEFINITION",t[t.DWG_TYPE_DGNUNDERLAY=623]="DWG_TYPE_DGNUNDERLAY",t[t.DWG_TYPE_DICTIONARYVAR=624]="DWG_TYPE_DICTIONARYVAR",t[t.DWG_TYPE_DICTIONARYWDFLT=625]="DWG_TYPE_DICTIONARYWDFLT",t[t.DWG_TYPE_DIMASSOC=626]="DWG_TYPE_DIMASSOC",t[t.DWG_TYPE_DMDIMOBJECTCONTEXTDATA=627]="DWG_TYPE_DMDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_DWFDEFINITION=628]="DWG_TYPE_DWFDEFINITION",t[t.DWG_TYPE_DWFUNDERLAY=629]="DWG_TYPE_DWFUNDERLAY",t[t.DWG_TYPE_DYNAMICBLOCKPROXYNODE=630]="DWG_TYPE_DYNAMICBLOCKPROXYNODE",t[t.DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER=631]="DWG_TYPE_DYNAMICBLOCKPURGEPREVENTER",t[t.DWG_TYPE_EVALUATION_GRAPH=632]="DWG_TYPE_EVALUATION_GRAPH",t[t.DWG_TYPE_EXTRUDEDSURFACE=633]="DWG_TYPE_EXTRUDEDSURFACE",t[t.DWG_TYPE_FCFOBJECTCONTEXTDATA=634]="DWG_TYPE_FCFOBJECTCONTEXTDATA",t[t.DWG_TYPE_FIELD=635]="DWG_TYPE_FIELD",t[t.DWG_TYPE_FIELDLIST=636]="DWG_TYPE_FIELDLIST",t[t.DWG_TYPE_FLIPPARAMETERENTITY=637]="DWG_TYPE_FLIPPARAMETERENTITY",t[t.DWG_TYPE_FLIPACTIONENTITY=638]="DWG_TYPE_FLIPACTIONENTITY",t[t.DWG_TYPE_GEODATA=639]="DWG_TYPE_GEODATA",t[t.DWG_TYPE_GEOMAPIMAGE=640]="DWG_TYPE_GEOMAPIMAGE",t[t.DWG_TYPE_GEOPOSITIONMARKER=641]="DWG_TYPE_GEOPOSITIONMARKER",t[t.DWG_TYPE_GRADIENT_BACKGROUND=642]="DWG_TYPE_GRADIENT_BACKGROUND",t[t.DWG_TYPE_GROUND_PLANE_BACKGROUND=643]="DWG_TYPE_GROUND_PLANE_BACKGROUND",t[t.DWG_TYPE_HELIX=644]="DWG_TYPE_HELIX",t[t.DWG_TYPE_IBL_BACKGROUND=645]="DWG_TYPE_IBL_BACKGROUND",t[t.DWG_TYPE_IDBUFFER=646]="DWG_TYPE_IDBUFFER",t[t.DWG_TYPE_IMAGE=647]="DWG_TYPE_IMAGE",t[t.DWG_TYPE_IMAGEDEF=648]="DWG_TYPE_IMAGEDEF",t[t.DWG_TYPE_IMAGEDEF_REACTOR=649]="DWG_TYPE_IMAGEDEF_REACTOR",t[t.DWG_TYPE_IMAGE_BACKGROUND=650]="DWG_TYPE_IMAGE_BACKGROUND",t[t.DWG_TYPE_INDEX=651]="DWG_TYPE_INDEX",t[t.DWG_TYPE_LARGE_RADIAL_DIMENSION=652]="DWG_TYPE_LARGE_RADIAL_DIMENSION",t[t.DWG_TYPE_LAYERFILTER=653]="DWG_TYPE_LAYERFILTER",t[t.DWG_TYPE_LAYER_INDEX=654]="DWG_TYPE_LAYER_INDEX",t[t.DWG_TYPE_LAYOUTPRINTCONFIG=655]="DWG_TYPE_LAYOUTPRINTCONFIG",t[t.DWG_TYPE_LEADEROBJECTCONTEXTDATA=656]="DWG_TYPE_LEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_LIGHT=657]="DWG_TYPE_LIGHT",t[t.DWG_TYPE_LIGHTLIST=658]="DWG_TYPE_LIGHTLIST",t[t.DWG_TYPE_LINEARPARAMETERENTITY=659]="DWG_TYPE_LINEARPARAMETERENTITY",t[t.DWG_TYPE_LOFTEDSURFACE=660]="DWG_TYPE_LOFTEDSURFACE",t[t.DWG_TYPE_MATERIAL=661]="DWG_TYPE_MATERIAL",t[t.DWG_TYPE_MENTALRAYRENDERSETTINGS=662]="DWG_TYPE_MENTALRAYRENDERSETTINGS",t[t.DWG_TYPE_MESH=663]="DWG_TYPE_MESH",t[t.DWG_TYPE_MLEADEROBJECTCONTEXTDATA=664]="DWG_TYPE_MLEADEROBJECTCONTEXTDATA",t[t.DWG_TYPE_MLEADERSTYLE=665]="DWG_TYPE_MLEADERSTYLE",t[t.DWG_TYPE_MOVEACTIONENTITY=666]="DWG_TYPE_MOVEACTIONENTITY",t[t.DWG_TYPE_MOTIONPATH=667]="DWG_TYPE_MOTIONPATH",t[t.DWG_TYPE_MPOLYGON=668]="DWG_TYPE_MPOLYGON",t[t.DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA=669]="DWG_TYPE_MTEXTATTRIBUTEOBJECTCONTEXTDATA",t[t.DWG_TYPE_MTEXTOBJECTCONTEXTDATA=670]="DWG_TYPE_MTEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_MULTILEADER=671]="DWG_TYPE_MULTILEADER",t[t.DWG_TYPE_NAVISWORKSMODEL=672]="DWG_TYPE_NAVISWORKSMODEL",t[t.DWG_TYPE_NAVISWORKSMODELDEF=673]="DWG_TYPE_NAVISWORKSMODELDEF",t[t.DWG_TYPE_NPOCOLLECTION=674]="DWG_TYPE_NPOCOLLECTION",t[t.DWG_TYPE_NURBSURFACE=675]="DWG_TYPE_NURBSURFACE",t[t.DWG_TYPE_OBJECT_PTR=676]="DWG_TYPE_OBJECT_PTR",t[t.DWG_TYPE_ORDDIMOBJECTCONTEXTDATA=677]="DWG_TYPE_ORDDIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_PARTIAL_VIEWING_INDEX=678]="DWG_TYPE_PARTIAL_VIEWING_INDEX",t[t.DWG_TYPE_PDFDEFINITION=679]="DWG_TYPE_PDFDEFINITION",t[t.DWG_TYPE_PDFUNDERLAY=680]="DWG_TYPE_PDFUNDERLAY",t[t.DWG_TYPE_PERSUBENTMGR=681]="DWG_TYPE_PERSUBENTMGR",t[t.DWG_TYPE_PLANESURFACE=682]="DWG_TYPE_PLANESURFACE",t[t.DWG_TYPE_PLOTSETTINGS=683]="DWG_TYPE_PLOTSETTINGS",t[t.DWG_TYPE_POINTCLOUD=684]="DWG_TYPE_POINTCLOUD",t[t.DWG_TYPE_POINTCLOUDCOLORMAP=685]="DWG_TYPE_POINTCLOUDCOLORMAP",t[t.DWG_TYPE_POINTCLOUDDEF=686]="DWG_TYPE_POINTCLOUDDEF",t[t.DWG_TYPE_POINTCLOUDDEFEX=687]="DWG_TYPE_POINTCLOUDDEFEX",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR=688]="DWG_TYPE_POINTCLOUDDEF_REACTOR",t[t.DWG_TYPE_POINTCLOUDDEF_REACTOR_EX=689]="DWG_TYPE_POINTCLOUDDEF_REACTOR_EX",t[t.DWG_TYPE_POINTCLOUDEX=690]="DWG_TYPE_POINTCLOUDEX",t[t.DWG_TYPE_POINTPARAMETERENTITY=691]="DWG_TYPE_POINTPARAMETERENTITY",t[t.DWG_TYPE_POINTPATH=692]="DWG_TYPE_POINTPATH",t[t.DWG_TYPE_POLARGRIPENTITY=693]="DWG_TYPE_POLARGRIPENTITY",t[t.DWG_TYPE_RADIMLGOBJECTCONTEXTDATA=694]="DWG_TYPE_RADIMLGOBJECTCONTEXTDATA",t[t.DWG_TYPE_RADIMOBJECTCONTEXTDATA=695]="DWG_TYPE_RADIMOBJECTCONTEXTDATA",t[t.DWG_TYPE_RAPIDRTRENDERSETTINGS=696]="DWG_TYPE_RAPIDRTRENDERSETTINGS",t[t.DWG_TYPE_RASTERVARIABLES=697]="DWG_TYPE_RASTERVARIABLES",t[t.DWG_TYPE_RENDERENTRY=698]="DWG_TYPE_RENDERENTRY",t[t.DWG_TYPE_RENDERENVIRONMENT=699]="DWG_TYPE_RENDERENVIRONMENT",t[t.DWG_TYPE_RENDERGLOBAL=700]="DWG_TYPE_RENDERGLOBAL",t[t.DWG_TYPE_RENDERSETTINGS=701]="DWG_TYPE_RENDERSETTINGS",t[t.DWG_TYPE_REVOLVEDSURFACE=702]="DWG_TYPE_REVOLVEDSURFACE",t[t.DWG_TYPE_ROTATIONPARAMETERENTITY=703]="DWG_TYPE_ROTATIONPARAMETERENTITY",t[t.DWG_TYPE_ROTATEACTIONENTITY=704]="DWG_TYPE_ROTATEACTIONENTITY",t[t.DWG_TYPE_RTEXT=705]="DWG_TYPE_RTEXT",t[t.DWG_TYPE_SCALE=706]="DWG_TYPE_SCALE",t[t.DWG_TYPE_SCALEACTIONENTITY=707]="DWG_TYPE_SCALEACTIONENTITY",t[t.DWG_TYPE_SECTIONOBJECT=708]="DWG_TYPE_SECTIONOBJECT",t[t.DWG_TYPE_SECTIONVIEWSTYLE=709]="DWG_TYPE_SECTIONVIEWSTYLE",t[t.DWG_TYPE_SECTION_MANAGER=710]="DWG_TYPE_SECTION_MANAGER",t[t.DWG_TYPE_SECTION_SETTINGS=711]="DWG_TYPE_SECTION_SETTINGS",t[t.DWG_TYPE_SKYLIGHT_BACKGROUND=712]="DWG_TYPE_SKYLIGHT_BACKGROUND",t[t.DWG_TYPE_SOLID_BACKGROUND=713]="DWG_TYPE_SOLID_BACKGROUND",t[t.DWG_TYPE_SORTENTSTABLE=714]="DWG_TYPE_SORTENTSTABLE",t[t.DWG_TYPE_SPATIAL_FILTER=715]="DWG_TYPE_SPATIAL_FILTER",t[t.DWG_TYPE_SPATIAL_INDEX=716]="DWG_TYPE_SPATIAL_INDEX",t[t.DWG_TYPE_STRETCHACTIONENTITY=717]="DWG_TYPE_STRETCHACTIONENTITY",t[t.DWG_TYPE_SUN=718]="DWG_TYPE_SUN",t[t.DWG_TYPE_SUNSTUDY=719]="DWG_TYPE_SUNSTUDY",t[t.DWG_TYPE_SWEPTSURFACE=720]="DWG_TYPE_SWEPTSURFACE",t[t.DWG_TYPE_TABLE=721]="DWG_TYPE_TABLE",t[t.DWG_TYPE_TABLECONTENT=722]="DWG_TYPE_TABLECONTENT",t[t.DWG_TYPE_TABLEGEOMETRY=723]="DWG_TYPE_TABLEGEOMETRY",t[t.DWG_TYPE_TABLESTYLE=724]="DWG_TYPE_TABLESTYLE",t[t.DWG_TYPE_TEXTOBJECTCONTEXTDATA=725]="DWG_TYPE_TEXTOBJECTCONTEXTDATA",t[t.DWG_TYPE_TVDEVICEPROPERTIES=726]="DWG_TYPE_TVDEVICEPROPERTIES",t[t.DWG_TYPE_VISIBILITYGRIPENTITY=727]="DWG_TYPE_VISIBILITYGRIPENTITY",t[t.DWG_TYPE_VISIBILITYPARAMETERENTITY=728]="DWG_TYPE_VISIBILITYPARAMETERENTITY",t[t.DWG_TYPE_VISUALSTYLE=729]="DWG_TYPE_VISUALSTYLE",t[t.DWG_TYPE_WIPEOUT=730]="DWG_TYPE_WIPEOUT",t[t.DWG_TYPE_WIPEOUTVARIABLES=731]="DWG_TYPE_WIPEOUTVARIABLES",t[t.DWG_TYPE_XREFPANELOBJECT=732]="DWG_TYPE_XREFPANELOBJECT",t[t.DWG_TYPE_XYPARAMETERENTITY=733]="DWG_TYPE_XYPARAMETERENTITY",t[t.DWG_TYPE_BREAKDATA=734]="DWG_TYPE_BREAKDATA",t[t.DWG_TYPE_BREAKPOINTREF=735]="DWG_TYPE_BREAKPOINTREF",t[t.DWG_TYPE_FLIPGRIPENTITY=736]="DWG_TYPE_FLIPGRIPENTITY",t[t.DWG_TYPE_LINEARGRIPENTITY=737]="DWG_TYPE_LINEARGRIPENTITY",t[t.DWG_TYPE_ROTATIONGRIPENTITY=738]="DWG_TYPE_ROTATIONGRIPENTITY",t[t.DWG_TYPE_XYGRIPENTITY=739]="DWG_TYPE_XYGRIPENTITY",t[t.DWG_TYPE__3DLINE=740]="DWG_TYPE__3DLINE",t[t.DWG_TYPE_REPEAT=741]="DWG_TYPE_REPEAT",t[t.DWG_TYPE_ENDREP=742]="DWG_TYPE_ENDREP",t[t.DWG_TYPE_JUMP=743]="DWG_TYPE_JUMP",t[t.DWG_TYPE_LOAD=744]="DWG_TYPE_LOAD",t[t.DWG_TYPE_FREED=65533]="DWG_TYPE_FREED",t[t.DWG_TYPE_UNKNOWN_ENT=65534]="DWG_TYPE_UNKNOWN_ENT",t[t.DWG_TYPE_UNKNOWN_OBJ=65535]="DWG_TYPE_UNKNOWN_OBJ"})(P||(P={}));const Pe=Object.fromEntries(Object.entries(P).map(([t,n])=>[n,t]));var it;(function(t){t[t.DWG=0]="DWG",t[t.DXF=1]="DXF"})(it||(it={}));var U;(function(t){t[t.Line=1]="Line",t[t.CircularArc=2]="CircularArc",t[t.EllipticArc=3]="EllipticArc",t[t.Spline=4]="Spline"})(U||(U={}));var Bt;(function(t){t[t.ByLayer=192]="ByLayer",t[t.ByBlock=193]="ByBlock",t[t.Entities=194]="Entities",t[t.TrueColor=195]="TrueColor",t[t.ForegroundColor=197]="ForegroundColor",t[t.None=200]="None"})(Bt||(Bt={}));const Te="*MODEL_SPACE",fe="*PAPER_SPACE",an=t=>t&&t.toUpperCase()==Te,he=t=>t&&t.toUpperCase().startsWith(fe),L=t=>t.toString(16).toUpperCase();class Ce{constructor(n){S(this,"libredwg");S(this,"layers",new Map);S(this,"ltypes",new Map);S(this,"unknownEntityCount");this.libredwg=n,this.unknownEntityCount=0}prepare(n,a=!1){(a||this.layers.size==0)&&(this.layers.clear(),n.tables.LAYER.entries.forEach(e=>{this.layers.set(e.handle,e.name)})),(a||this.ltypes.size==0)&&(this.ltypes.clear(),n.tables.LTYPE.entries.forEach(e=>{this.ltypes.set(e.handle,e.name)})),this.unknownEntityCount=0}clear(){this.layers.clear(),this.ltypes.clear(),this.unknownEntityCount=0}convert(n){const a=this.libredwg,e=a.dwg_object_to_entity(n),i=a.dwg_object_to_entity_tio(n);if(e&&i){const r=this.getCommonAttrs(e),o=a.dwg_object_get_fixedtype(n);if(o==P.DWG_TYPE_3DFACE)return this.convert3dFace(i,r);if(o==P.DWG_TYPE_ARC)return this.convertArc(i,r);if(o==P.DWG_TYPE_ATTDEF)return this.convertAttdef(i,r);if(o==P.DWG_TYPE_CIRCLE)return this.convertCircle(i,r);if(o==P.DWG_TYPE_DIMENSION_ALIGNED||o==P.DWG_TYPE_DIMENSION_LINEAR)return this.convertAlignedDimension(i,r);if(o==P.DWG_TYPE_DIMENSION_ANG3PT)return this.convert3PointAngularDimension(i,r);if(o==P.DWG_TYPE_DIMENSION_DIAMETER)return this.convertDiameterDimension(i,r);if(o==P.DWG_TYPE_DIMENSION_ORDINATE)return this.convertOrdinateDimension(i,r);if(o==P.DWG_TYPE_DIMENSION_RADIUS)return this.convertRadiusDimension(i,r);if(o==P.DWG_TYPE_ELLIPSE)return this.convertEllise(i,r);if(o==P.DWG_TYPE_HATCH)return this.convertHatch(i,r);if(o==P.DWG_TYPE_IMAGE)return this.convertImage(i,r);if(o==P.DWG_TYPE_INSERT)return this.convertInsert(i,r);if(o==P.DWG_TYPE_LEADER)return this.convertLeader(i,r);if(o==P.DWG_TYPE_LINE)return this.convertLine(i,r);if(o==P.DWG_TYPE_LWPOLYLINE)return this.convertLWPolyline(i,r);if(o==P.DWG_TYPE_MLINE)return this.convertMLine(i,r);if(o==P.DWG_TYPE_MTEXT)return this.convertMText(i,r);if(o==P.DWG_TYPE_OLE2FRAME)return this.convertOle2Frame(i,r);if(o==P.DWG_TYPE_OLEFRAME)return this.convertOleFrame(i,r);if(o==P.DWG_TYPE_POINT)return this.convertPoint(i,r);if(o==P.DWG_TYPE_POLYLINE_2D)return this.convertPolyline2d(i,r,n);if(o==P.DWG_TYPE_POLYLINE_3D)return this.convertPolyline3d(i,r,n);if(o==P.DWG_TYPE_PROXY_ENTITY)return this.convertProxy(i,r);if(o==P.DWG_TYPE_RAY)return this.convertRay(i,r);if(o==P.DWG_TYPE_SECTIONOBJECT)return this.convertSection(i,r);if(o==P.DWG_TYPE_SOLID)return this.convertSolid(i,r);if(o==P.DWG_TYPE_SPLINE)return this.convertSpline(i,r);if(o==P.DWG_TYPE_TABLE)return this.convertTable(i,r);if(o==P.DWG_TYPE_TEXT)return this.convertText(i,r);if(o==P.DWG_TYPE_TOLERANCE)return this.convertTolerance(i,r);if(o==P.DWG_TYPE_VIEWPORT)return this.convertViewport(i,r);if(o==P.DWG_TYPE_WIPEOUT)return this.convertWipeout(i,r);if(o==P.DWG_TYPE_XLINE)return this.convertXline(i,r);o===P.DWG_TYPE_UNKNOWN_ENT&&this.unknownEntityCount++}}convert3dFace(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,r=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,s=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"invis_flags").data;return{type:"3DFACE",...a,corner1:i,corner2:r,corner3:o,corner4:s,flag:_}}convertArc(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ARC",...a,thickness:o,center:i,radius:r,startAngle:_,endAngle:d,extrusionDirection:s}}convertEmbeddedMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,a,"attachment").data,r=e.dwg_dynapi_subclass_value(n,a,"ins_pt").data,o=e.dwg_dynapi_subclass_value(n,a,"x_axis_dir").data,s=e.dwg_dynapi_subclass_value(n,a,"rect_height").data,_=e.dwg_dynapi_subclass_value(n,a,"rect_width").data,d=e.dwg_dynapi_subclass_value(n,a,"extents_height").data,l=e.dwg_dynapi_subclass_value(n,a,"extents_width").data;return{insertionPoint:r,rectHeight:s,rectWidth:_,extentsHeight:d,extentsWidth:l,attachmentPoint:i,direction:o}}convertAttdef(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"default_value").data,r=this.convertTextBase(n);r.text=i;const o=e.dwg_dynapi_entity_value(n,"prompt").data,s=e.dwg_dynapi_entity_value(n,"tag").data,_=e.dwg_dynapi_entity_value(n,"flags").data,d=e.dwg_dynapi_entity_value(n,"field_length").data,l=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,c=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,u=e.dwg_dynapi_entity_value(n,"is_really_locked").data,E=e.dwg_dynapi_entity_value(n,"mtext_type").data,f=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTDEF",...a,text:this.convertTextBase(n),prompt:o,tag:s,flags:_,fieldLength:d,lockPositionFlag:l>0,duplicateRecordCloningFlag:c>0,mtextFlag:E,isReallyLocked:u>0,alignmentPoint:f,annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertAttrib(n,a){const e=this.libredwg,i=this.convertTextBase(n),r=e.dwg_dynapi_entity_value(n,"tag").data,o=e.dwg_dynapi_entity_value(n,"flags").data,s=e.dwg_dynapi_entity_value(n,"field_length").data,_=e.dwg_dynapi_entity_value(n,"lock_position_flag").data,d=e.dwg_dynapi_entity_value(n,"keep_duplicate_records").data,l=e.dwg_dynapi_entity_value(n,"mtext_type").data,c=e.dwg_dynapi_entity_value(n,"is_really_locked").data,u=e.dwg_dynapi_entity_value(n,"alignment_pt").data;return{type:"ATTRIB",...a,text:i,tag:r,flags:o,fieldLength:s,lockPositionFlag:!!_,duplicateRecordCloningFlag:!!d,mtextFlag:l,isReallyLocked:!!c,numberOfSecondaryAttrs:0,secondaryAttrsHardId:"0",alignmentPoint:{...u,z:0},annotationScale:1,attrTag:"",mtext:this.convertEmbeddedMText(n,"ATTDEF_mtext")}}convertCircle(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"radius").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"CIRCLE",...a,thickness:o,center:i,radius:r,extrusionDirection:s}}convertAlignedDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"clone_ins_pt").data,o=e.dwg_dynapi_entity_value(n,"xline1_pt").data,s=e.dwg_dynapi_entity_value(n,"xline2_pt").data,_=e.dwg_dynapi_entity_value(n,"ins_rotation").data,d=e.dwg_dynapi_entity_value(n,"oblique_angle").data;return{subclassMarker:"AcDbAlignedDimension",...a,...i,insertionPoint:r,subDefinitionPoint1:o,subDefinitionPoint2:s,rotationAngle:_??0,obliqueAngle:d}}convert3PointAngularDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"xline1_pt").data,o=e.dwg_dynapi_entity_value(n,"xline2_pt").data,s=e.dwg_dynapi_entity_value(n,"center_pt").data,_=e.dwg_dynapi_entity_value(n,"xline2end_pt").data;return{subclassMarker:"AcDb3PointAngularDimension",...a,...i,subDefinitionPoint1:r,subDefinitionPoint2:o,centerPoint:s,arcPoint:_}}convertDiameterDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbDiametricDimension",...a,...i,centerPoint:r,leaderLength:o}}convertOrdinateDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"feature_location_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_endpt").data;return{subclassMarker:"AcDbOrdinateDimension",...a,...i,subDefinitionPoint1:r,subDefinitionPoint2:o}}convertRadiusDimension(n,a){const e=this.libredwg,i=this.getDimensionCommonAttrs(n),r=e.dwg_dynapi_entity_value(n,"first_arc_pt").data,o=e.dwg_dynapi_entity_value(n,"leader_len").data;return{subclassMarker:"AcDbRadialDimension",...a,...i,centerPoint:r,leaderLength:o}}convertEllise(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"sm_axis").data,o=e.dwg_dynapi_entity_value(n,"extrusion").data,s=e.dwg_dynapi_entity_value(n,"axis_ratio").data,_=e.dwg_dynapi_entity_value(n,"start_angle").data,d=e.dwg_dynapi_entity_value(n,"end_angle").data;return{type:"ELLIPSE",...a,center:i,majorAxisEndPoint:r,extrusionDirection:o,axisRatio:s,startAngle:_,endAngle:d}}convertHatch(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"extrusion").data,r=e.dwg_dynapi_entity_value(n,"name").data,o=e.dwg_dynapi_entity_value(n,"is_solid_fill").data,s=e.dwg_dynapi_entity_value(n,"is_associative").data,_=e.dwg_dynapi_entity_value(n,"num_paths").data,d=e.dwg_dynapi_entity_value(n,"paths").data,l=e.dwg_ptr_to_hatch_path_array(d,_),c=e.dwg_dynapi_entity_value(n,"style").data,u=e.dwg_dynapi_entity_value(n,"pattern_type").data,E=e.dwg_dynapi_entity_value(n,"angle").data,f=e.dwg_dynapi_entity_value(n,"scale_spacing").data,I=e.dwg_dynapi_entity_value(n,"num_deflines").data,A=e.dwg_dynapi_entity_value(n,"deflines").data,T=e.dwg_ptr_to_hatch_defline_array(A,I),h=e.dwg_dynapi_entity_value(n,"pixel_size").data,C=e.dwg_dynapi_entity_value(n,"num_seeds").data,R=e.dwg_dynapi_entity_value(n,"seeds").data,Y=e.dwg_ptr_to_point2d_array(R,C),g={...a,extrusionDirection:i,patternName:r,solidFill:o?Q.SolidFill:Q.PatternFill,associativity:s?j.Associative:j.NonAssociative,numberOfBoundaryPaths:_,boundaryPaths:this.convertHatchBoundaryPaths(l),hatchStyle:c,patternType:u,patternAngle:E,patternScale:f,numberOfDefinitionLines:I,definitionLines:T.map(v=>({angle:v.angle,base:v.pt0,offset:v.offset,numberOfDashLengths:v.dashes.length,dashLengths:v.dashes})),pixelSize:h,numberOfSeedPoints:C,seedPoints:Y};if(e.dwg_dynapi_entity_value(n,"is_gradient_fill").data>0){const v=e.dwg_dynapi_entity_value(n,"gradient_name").data,m=e.dwg_dynapi_entity_value(n,"gradient_angle").data,x=e.dwg_dynapi_entity_value(n,"gradient_shift").data,W=e.dwg_dynapi_entity_value(n,"gradient_tint").data,M=e.dwg_dynapi_entity_value(n,"single_color_gradient").data,O=e.dwg_dynapi_entity_value(n,"colors").data,B=e.dwg_ptr_to_hatch_gradient_color_array(O,M==1?1:2);return{type:"HATCH",...g,gradientFlag:at.Gradient,gradientColorFlag:M==1?tt.OneColor:tt.TwoColor,gradientName:v,gradientRotation:m,gradientDefinition:x,colorTint:W,gradientColors:B}}else return{type:"HATCH",...g}}convertHatchBoundaryPaths(n){return n.filter(e=>e.num_segs_or_paths>0).map(e=>{const i={boundaryPathTypeFlag:e.flag};if(e.flag&2)return{...i,hasBulge:e.bulges_present,isClosed:e.closed,numberOfVertices:e.num_segs_or_paths,vertices:e.polyline_paths.map(r=>({x:r.point.x,y:r.point.y,bulge:r.bulge}))};{const r=e.segs.map(o=>{if(o.curve_type==U.Line)return{type:F.Line,start:o.first_endpoint,end:o.second_endpoint};if(o.curve_type==U.CircularArc)return{type:F.Circular,center:o.center,radius:o.radius,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.EllipticArc)return{type:F.Elliptic,center:o.center,end:o.endpoint,lengthOfMinorAxis:o.minor_major_ratio,startAngle:o.start_angle,endAngle:o.end_angle,isCCW:o.is_ccw};if(o.curve_type==U.Spline)return{type:F.Spline,degree:o.degree,isRational:o.is_rational,isPeriodic:o.is_periodic,numberOfKnots:o.num_knots,numberOfControlPoints:o.num_control_points,knots:o.knots,controlPoints:o.control_points,numberOfFitData:o.num_fitpts,fitDatum:o.fitpts,startTangent:o.start_tangent,endTangent:o.end_tangent}});return{...i,numberOfEdges:e.num_segs_or_paths,edges:r}}})}convertImage(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,r=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,s=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,c=e.dwg_dynapi_entity_value(n,"brightness").data,u=e.dwg_dynapi_entity_value(n,"contrast").data,E=e.dwg_dynapi_entity_value(n,"fade").data,f=e.dwg_dynapi_entity_value(n,"clip_mode").data,I=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,A=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,T=e.dwg_dynapi_entity_value(n,"clip_verts").data,h=e.dwg_ptr_to_point3d_array(T,A),C=e.dwg_dynapi_entity_value(n,"imagedef").data,R=L(e.dwg_ref_get_absref(C)),Y=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,g=L(e.dwg_ref_get_absref(Y));return{type:"IMAGE",...a,version:i,position:r,uPixel:o,vPixel:s,imageSize:_,imageDefHandle:R,flags:d,clipping:l,brightness:c,contrast:u,fade:E,imageDefReactorHandle:g,clippingBoundaryType:I,countBoundaryPoints:A,clippingBoundaryPath:h,clipMode:f}}convertInsert(n,a){const e=this.libredwg;let i="";const r=e.dwg_dynapi_entity_value(n,"block_header").data;if(r){const A=e.dwg_ref_get_object(r);if(A){const T=e.dwg_object_to_object_tio(A);T&&(i=e.dwg_entity_block_header_get_block(T).name)}}i||(i=e.dwg_dynapi_entity_value(n,"block_name").data);const o=e.dwg_dynapi_entity_value(n,"ins_pt").data,s=e.dwg_dynapi_entity_value(n,"scale").data,_=e.dwg_dynapi_entity_value(n,"rotation").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"num_rows").data,c=e.dwg_dynapi_entity_value(n,"col_spacing").data,u=e.dwg_dynapi_entity_value(n,"row_spacing").data,E=e.dwg_dynapi_entity_value(n,"extrusion").data,f=e.dwg_entity_insert_get_attribs(n),I=[];return f.forEach(A=>{const T=e.dwg_object_to_entity(A),h=e.dwg_object_to_entity_tio(A);if(T&&h){const C=this.getCommonAttrs(T);e.dwg_object_get_fixedtype(A)==P.DWG_TYPE_ATTRIB&&I.push(this.convertAttrib(h,C))}}),{type:"INSERT",...a,name:i,insertionPoint:o,xScale:s?s.x:1,yScale:s?s.y:1,zScale:s?s.z:1,rotation:_,columnCount:d,rowCount:l,columnSpacing:c,rowSpacing:u,extrusionDirection:E,attribs:I}}convertLeader(n,a){const e=this.libredwg,i=e.dwg_entity_mtext_get_style_name(n),r=e.dwg_dynapi_entity_value(n,"arrowhead_type").data,o=e.dwg_dynapi_entity_value(n,"path_type").data,s=e.dwg_dynapi_entity_value(n,"annot_type").data,_=e.dwg_dynapi_entity_value(n,"hookline_dir").data,d=e.dwg_dynapi_entity_value(n,"hookline_on").data,l=e.dwg_dynapi_entity_value(n,"box_height").data,c=e.dwg_dynapi_entity_value(n,"box_width").data,u=e.dwg_dynapi_entity_value(n,"num_points").data,E=e.dwg_dynapi_entity_value(n,"points").data,f=u>0?e.dwg_ptr_to_point3d_array(E,u):[],I=e.dwg_dynapi_entity_value(n,"byblock_color").data,A=e.dwg_dynapi_entity_value(n,"extrusion").data,T=e.dwg_dynapi_entity_value(n,"x_direction").data,h=e.dwg_dynapi_entity_value(n,"inspt_offset").data,C=e.dwg_dynapi_entity_value(n,"endptproj").data;return{type:"LEADER",...a,styleName:i,isArrowheadEnabled:r>0,isSpline:o>0,leaderCreationFlag:s,isHooklineSameDirection:_>0,isHooklineExists:d>0,textHeight:l,textWidth:c,numberOfVertices:u,vertices:f,byBlockColor:I,normal:A,horizontalDirection:T,offsetFromBlock:h,offsetFromAnnotation:C}}convertLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"start").data,r=e.dwg_dynapi_entity_value(n,"end").data,o=e.dwg_dynapi_entity_value(n,"thickness").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"LINE",...a,thickness:o,startPoint:i,endPoint:r,extrusionDirection:s}}convertLWPolyline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"num_points").data,r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"const_width").data,s=e.dwg_dynapi_entity_value(n,"elevation").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=[],c=e.dwg_dynapi_entity_value(n,"num_points").data,u=e.dwg_dynapi_entity_value(n,"points").data,E=e.dwg_ptr_to_point2d_array(u,c),f=e.dwg_dynapi_entity_value(n,"num_bulges").data,I=e.dwg_dynapi_entity_value(n,"bulges").data,A=e.dwg_ptr_to_double_array(I,f);return E.forEach((T,h)=>{l.push({id:h,x:T.x,y:T.y,bulge:A.length>h?A[h]:0})}),{type:"LWPOLYLINE",...a,numberOfVertices:i,flag:r,constantWidth:o,elevation:s,thickness:_,extrusionDirection:d,vertices:l}}convertMLine(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"scale").data,r=e.dwg_dynapi_entity_value(n,"flags").data,o=e.dwg_dynapi_entity_value(n,"justification").data,s=e.dwg_dynapi_entity_value(n,"base_point").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"num_lines").data,l=e.dwg_dynapi_entity_value(n,"num_verts").data,c=e.dwg_dynapi_entity_value(n,"verts").data,u=e.dwg_ptr_to_mline_vertex_array(c,l),E=[];return u.forEach(f=>{E.push({vertex:f.vertex,vertexDirection:f.vertex_direction,miterDirection:f.miter_direction,numberOfLines:f.num_lines,lines:f.lines.map(I=>({numberOfSegmentParams:I.num_segparms,segmentParams:I.segparms,numberOfAreaFillParams:I.num_areafillparms,areaFillParams:I.areafillparms}))})}),{type:"MLINE",...a,scale:i,flags:r,justification:o,startPoint:s,extrusionDirection:_,numberOfLines:d,numberOfVertices:l,vertices:E,mlineStyle:""}}convertOle2Frame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"oleversion").data,r=e.dwg_dynapi_entity_value(n,"oleclient").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,s=e.dwg_dynapi_entity_value(n,"pt1").data,_=e.dwg_dynapi_entity_value(n,"pt2").data,d=e.dwg_dynapi_entity_value(n,"lock_aspect").data,l=e.dwg_dynapi_entity_value(n,"type").data,c=e.dwg_dynapi_entity_value(n,"mode").data,u=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLE2FRAME",...a,oleVersion:i,oleClient:r,dataSize:o,leftUpPoint:s,rightDownPoint:_,lockAspect:d,oleObjectType:l,tileModeDescriptor:c,binaryData:u}}convertOleFrame(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"flag").data,r=e.dwg_dynapi_entity_value(n,"mode").data,o=e.dwg_dynapi_entity_value(n,"data_size").data,s=e.dwg_dynapi_entity_value(n,"data").data;return{type:"OLEFRAME",...a,flag:i,mode:r,dataSize:o,binaryData:s}}convertMText(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,r=e.dwg_dynapi_entity_value(n,"text_height").data,o=e.dwg_dynapi_entity_value(n,"rect_height").data,s=e.dwg_dynapi_entity_value(n,"rect_width").data,_=e.dwg_dynapi_entity_value(n,"extents_width").data,d=e.dwg_dynapi_entity_value(n,"extents_height").data,l=e.dwg_dynapi_entity_value(n,"attachment").data,c=e.dwg_dynapi_entity_value(n,"flow_dir").data,u=e.dwg_dynapi_entity_value(n,"text").data,E=e.dwg_entity_mtext_get_style_name(n),f=e.dwg_dynapi_entity_value(n,"extrusion").data,I=e.dwg_dynapi_entity_value(n,"x_axis_dir").data,A=e.dwg_dynapi_entity_value(n,"linespace_style").data,T=e.dwg_dynapi_entity_value(n,"linespace_factor").data,h=e.dwg_dynapi_entity_value(n,"bg_fill_flag").data,C=e.dwg_dynapi_entity_value(n,"bg_fill_scale").data,R=e.dwg_dynapi_entity_value(n,"bg_fill_color").data,Y=e.dwg_dynapi_entity_value(n,"bg_fill_trans").data,g=e.dwg_dynapi_entity_value(n,"column_type").data,G=e.dwg_dynapi_entity_value(n,"flow_reversed").data,v=e.dwg_dynapi_entity_value(n,"auto_height").data,m=e.dwg_dynapi_entity_value(n,"column_width").data,x=e.dwg_dynapi_entity_value(n,"gutter").data,W=e.dwg_dynapi_entity_value(n,"num_column_heights").data,M=e.dwg_dynapi_entity_value(n,"column_heights").data,O=e.dwg_ptr_to_double_array(M,W);return{type:"MTEXT",...a,insertionPoint:i,textHeight:r,rectHeight:o,rectWidth:s,extentsHeight:d,extentsWidth:_,attachmentPoint:l,drawingDirection:c,text:u,styleName:E,extrusionDirection:f,direction:I,rotation:0,lineSpacingStyle:A,lineSpacing:T,backgroundFill:h,fillBoxScale:C,backgroundFillColor:R.rgb,backgroundFillTransparency:Y,columnType:g,columnFlowReversed:G,columnAutoHeight:v,columnWidth:m,columnGutter:x,columnHeightCount:W,columnHeights:O}}convertPoint(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"x").data,r=e.dwg_dynapi_entity_value(n,"y").data,o=e.dwg_dynapi_entity_value(n,"z").data,s=e.dwg_dynapi_entity_value(n,"thickness").data,_=e.dwg_dynapi_entity_value(n,"extrusion").data,d=e.dwg_dynapi_entity_value(n,"x_ang").data;return{type:"POINT",...a,position:{x:i,y:r,z:o},thickness:s,extrusionDirection:_,angle:d}}convertPolyline2d(n,a,e){const i=this.libredwg,r=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,s=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"elevation").data,l=i.dwg_dynapi_entity_value(n,"thickness").data,c=i.dwg_dynapi_entity_value(n,"extrusion").data,u=i.dwg_entity_polyline_2d_get_vertices(e);return{type:"POLYLINE2D",...a,flag:r,smoothType:o,startWidth:s,endWidth:_,elevation:d,thickness:l,extrusionDirection:c,vertices:u.map(E=>({x:E.point.x,y:E.point.y,z:E.point.z,startWidth:E.start_width,endWidth:E.end_width,bulge:E.bulge,flag:E.flag,tangentDirection:E.tangent_dir})),meshMVertexCount:0,meshNVertexCount:0,surfaceMDensity:0,surfaceNDensity:0}}convertPolyline3d(n,a,e){const i=this.libredwg,r=i.dwg_dynapi_entity_value(n,"flag").data,o=i.dwg_dynapi_entity_value(n,"curve_type").data,s=i.dwg_dynapi_entity_value(n,"start_width").data,_=i.dwg_dynapi_entity_value(n,"end_width").data,d=i.dwg_dynapi_entity_value(n,"extrusion").data,l=i.dwg_entity_polyline_3d_get_vertices(e);return{type:"POLYLINE3D",...a,flag:r,smoothType:o,startWidth:s,endWidth:_,extrusionDirection:d,vertices:l.map(c=>({x:c.point.x,y:c.point.y,z:c.point.z,flag:c.flag}))}}convertProxy(n,a){const i=this.libredwg.dwg_dynapi_entity_value(n,"class_id").data;return{type:"PROXY",...a,applicationEntityClassId:i}}convertRay(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,r=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"RAY",...a,firstPoint:i,unitDirection:r}}convertSection(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"state").data,r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"name").data,s=e.dwg_dynapi_entity_value(n,"vert_dir").data,_=e.dwg_dynapi_entity_value(n,"top_height").data,d=e.dwg_dynapi_entity_value(n,"bottom_height").data,l=e.dwg_dynapi_entity_value(n,"indicator_alpha").data,c=e.dwg_dynapi_entity_value(n,"indicator_color").data,u=e.dwg_dynapi_entity_value(n,"num_verts").data,E=e.dwg_dynapi_entity_value(n,"verts").data,f=u>0?e.dwg_ptr_to_point3d_array(E,u):[],I=e.dwg_dynapi_entity_value(n,"num_blverts").data,A=e.dwg_dynapi_entity_value(n,"blverts").data,T=I>0?e.dwg_ptr_to_point3d_array(A,I):[],h=e.dwg_dynapi_entity_value(n,"geometrySettingHardId").data,C=e.dwg_ref_get_handle_absolute_ref(h);return{type:"SECTION",...a,state:i,flags:r,name:o,verticalDirection:s,topHeight:_,bottomHeight:d,indicatorTransparency:l,indicatorColor:c.rgb,numberOfVertices:u,vertices:f,numberOfBackLineVertices:I,backLineVertices:T,geometrySettingHardId:C}}convertSolid(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"corner1").data,r=e.dwg_dynapi_entity_value(n,"corner2").data,o=e.dwg_dynapi_entity_value(n,"corner3").data,s=e.dwg_dynapi_entity_value(n,"corner4").data,_=e.dwg_dynapi_entity_value(n,"thickness").data,d=e.dwg_dynapi_entity_value(n,"extrusion").data;return{type:"SOLID",...a,corner1:i,corner2:r,corner3:o,corner4:s,thickness:_,extrusionDirection:d}}convertSpline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"splineflags").data,r=e.dwg_dynapi_entity_value(n,"degree").data,o=e.dwg_dynapi_entity_value(n,"knot_tol").data,s=e.dwg_dynapi_entity_value(n,"num_knots").data,_=e.dwg_dynapi_entity_value(n,"knots").data,d=e.dwg_ptr_to_double_array(_,s),l=e.dwg_dynapi_entity_value(n,"fit_tol").data,c=e.dwg_dynapi_entity_value(n,"num_fit_pts").data,u=e.dwg_dynapi_entity_value(n,"fit_pts").data,E=e.dwg_ptr_to_point3d_array(u,c),f=e.dwg_dynapi_entity_value(n,"weighted").data,I=e.dwg_dynapi_entity_value(n,"ctrl_tol").data,A=e.dwg_dynapi_entity_value(n,"num_ctrl_pts").data,T=e.dwg_dynapi_entity_value(n,"ctrl_pts").data,h=e.dwg_ptr_to_point4d_array(T,A),C=e.dwg_dynapi_entity_value(n,"beg_tan_vec").data,R=e.dwg_dynapi_entity_value(n,"end_tan_vec").data;return{type:"SPLINE",...a,flag:i,degree:r,numberOfKnots:s,numberOfControlPoints:A,numberOfFitPoints:c,knotTolerance:o,controlTolerance:I,fitTolerance:l,startTangent:C,endTangent:R,knots:d,weights:f?h.map(Y=>Y.w):void 0,controlPoints:h.map(Y=>({x:Y.x,y:Y.y,z:Y.z})),fitPoints:E}}convertTable(n,a){const e=this.libredwg,i=e.dwg_dynapi_subclass_value(n,"ldata","name").data,r=e.dwg_dynapi_entity_value(n,"ins_pt").data,o=e.dwg_dynapi_entity_value(n,"horiz_direction").data,s=e.dwg_dynapi_entity_value(n,"flag_for_table_value").data,_=e.dwg_dynapi_entity_value(n,"num_rows").data,d=e.dwg_dynapi_entity_value(n,"num_cols").data,l=e.dwg_dynapi_entity_value(n,"row_heights").data,c=e.dwg_ptr_to_double_array(l,_),u=e.dwg_dynapi_entity_value(n,"col_widths").data,E=e.dwg_ptr_to_double_array(u,d),f=e.dwg_dynapi_entity_value(n,"tablestyle").data,I=L(e.dwg_ref_get_absref(f)),A=e.dwg_dynapi_entity_value(n,"block_header").data,T=L(e.dwg_ref_get_absref(A)),h=e.dwg_dynapi_entity_value(n,"table_flag_override").data,C=e.dwg_dynapi_entity_value(n,"border_color_overrides_flag").data,R=e.dwg_dynapi_entity_value(n,"border_lineweight_overrides_flag").data,Y=e.dwg_dynapi_entity_value(n,"border_visibility_overrides_flag").data,g=e.dwg_dynapi_entity_value(n,"num_cells").data,G=e.dwg_dynapi_entity_value(n,"cells").data,v=e.dwg_ptr_to_table_cell_array(G,g);return{type:"ACAD_TABLE",...a,name:i,startPoint:r,directionVector:o,tableValue:s,rowCount:_,columnCount:d,overrideFlag:h,borderColorOverrideFlag:C,borderLineWeightOverrideFlag:R,borderVisibilityOverrideFlag:Y,rowHeightArr:c,columnWidthArr:E,tableStyleId:I,blockRecordHandle:T,cells:this.convertTableCells(v),bmpPreview:""}}convertTableCells(n){const a=[];return n.forEach(e=>({text:e.text_value,attachmentPoint:e.cell_alignment,textStyle:e.text_style,rotation:e.rotation,cellType:e.type,flagValue:e.flags,mergedValue:e.is_merged_value,autoFit:e.is_autofit_flag,topBorderVisibility:e.top_visibility,bottomBorderVisibility:e.bottom_visibility,leftBorderVisibility:e.left_visibility,rightBorderVisibility:e.right_visibility,overrideFlag:e.cell_flag_override,virtualEdgeFlag:e.virtual_edge_flag,blockTableRecordI:e.block_handle.absolute_ref,blockScale:e.block_scale,blockAttrNum:e.attr_defs.length,attrDefineId:e.attr_defs.map(i=>i.attdef.absolute_ref),extendedCellFlags:e.additional_data_flag})),a}convertTextBase(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"text_value").data,i=a.dwg_dynapi_entity_value(n,"thickness").data,r=a.dwg_dynapi_entity_value(n,"ins_pt").data,o=a.dwg_dynapi_entity_value(n,"alignment_pt").data,s=a.dwg_dynapi_entity_value(n,"rotation").data,_=a.dwg_dynapi_entity_value(n,"height").data,d=a.dwg_dynapi_entity_value(n,"width_factor").data,l=a.dwg_dynapi_entity_value(n,"oblique_angle").data,c=a.dwg_entity_text_get_style_name(n),u=a.dwg_dynapi_entity_value(n,"generation").data,E=a.dwg_dynapi_entity_value(n,"horiz_alignment").data,f=a.dwg_dynapi_entity_value(n,"vert_alignment").data,I=a.dwg_dynapi_entity_value(n,"extrusion").data;return{text:e,thickness:i,startPoint:r,endPoint:o,textHeight:_,rotation:s,xScale:d,obliqueAngle:l,styleName:c,generationFlag:u,halign:E,valign:f,extrusionDirection:I}}convertText(n,a){return{type:"TEXT",...a,...this.convertTextBase(n)}}convertTolerance(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"ins_pt").data,r=e.dwg_dynapi_entity_value(n,"text_value").data,o=e.dwg_dynapi_entity_value(n,"x_direction").data,s=e.dwg_dynapi_entity_value(n,"extrusion").data,_=e.dwg_entity_get_dimstyle_name(n);return{type:"TOLERANCE",...a,styleName:_,insertionPoint:i,text:r,extrusionDirection:s,xAxisDirection:o}}convertViewport(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"center").data,r=e.dwg_dynapi_entity_value(n,"width").data,o=e.dwg_dynapi_entity_value(n,"height").data,s=e.dwg_dynapi_entity_value(n,"on_off").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,l=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,c=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,u=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,E=e.dwg_dynapi_entity_value(n,"view_target").data,f=e.dwg_dynapi_entity_value(n,"lens_length").data,I=e.dwg_dynapi_entity_value(n,"front_clip_z").data,A=e.dwg_dynapi_entity_value(n,"back_clip_z").data,T=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,h=e.dwg_dynapi_entity_value(n,"SNAPANG").data,C=e.dwg_dynapi_entity_value(n,"twist_angle").data,R=e.dwg_dynapi_entity_value(n,"circle_zoom").data,Y=e.dwg_dynapi_entity_value(n,"status_flag").data,g=e.dwg_dynapi_entity_value(n,"style_sheet").data,G=e.dwg_dynapi_entity_value(n,"render_mode").data,v=e.dwg_dynapi_entity_value(n,"UCSVP").data,m=e.dwg_dynapi_entity_value(n,"ucsorg").data,x=e.dwg_dynapi_entity_value(n,"ucsxdir").data,W=e.dwg_dynapi_entity_value(n,"ucsydir").data,M=e.dwg_dynapi_entity_value(n,"named_ucs").data,O=e.dwg_ref_get_absref(M),B=e.dwg_dynapi_entity_value(n,"base_ucs").data,K=e.dwg_ref_get_absref(B),V=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"shadeplot_mode").data,k=e.dwg_dynapi_entity_value(n,"use_default_lights").data,J=e.dwg_dynapi_entity_value(n,"default_lighting_type").data,X=e.dwg_dynapi_entity_value(n,"brightness").data,Z=e.dwg_dynapi_entity_value(n,"contrast").data,st=e.dwg_dynapi_entity_value(n,"grid_major").data,_t=e.dwg_dynapi_entity_value(n,"background").data,dt=e.dwg_ref_get_absref(_t),lt=e.dwg_dynapi_entity_value(n,"shadeplot").data,ct=e.dwg_ref_get_absref(lt),Et=e.dwg_dynapi_entity_value(n,"visualstyle").data,ut=e.dwg_ref_get_absref(Et),At=e.dwg_dynapi_entity_value(n,"sun").data,It=e.dwg_ref_get_absref(At);return{type:"VIEWPORT",...a,viewportCenter:i,width:r,height:o,status:s,viewportId:0,displayCenter:_,snapBase:d,snapSpacing:l,gridSpacing:c,viewDirection:u,targetPoint:E,perspectiveLensLength:f,frontClipZ:I,backClipZ:A,viewHeight:T,snapAngle:h,viewTwistAngle:C,circleZoomPercent:R,statusBitFlags:Y,sheetName:g,renderMode:G,ucsPerViewport:v,ucsOrigin:m,ucsXAxis:x,ucsYAxis:W,ucsId:L(O),ucsBaseId:L(K),orthographicType:V,elevation:$,shadePlotMode:z,majorGridFrequency:st,backgroundId:L(dt),shadePlotId:L(ct),visualStyleId:L(ut),isDefaultLighting:!!k,defaultLightingType:J,brightness:X,contrast:Z,sunId:L(It)}}convertWipeout(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"class_version").data,r=e.dwg_dynapi_entity_value(n,"pt0").data,o=e.dwg_dynapi_entity_value(n,"uvec").data,s=e.dwg_dynapi_entity_value(n,"vvec").data,_=e.dwg_dynapi_entity_value(n,"image_size").data,d=e.dwg_dynapi_entity_value(n,"display_props").data,l=e.dwg_dynapi_entity_value(n,"clipping").data,c=e.dwg_dynapi_entity_value(n,"brightness").data,u=e.dwg_dynapi_entity_value(n,"contrast").data,E=e.dwg_dynapi_entity_value(n,"fade").data,f=e.dwg_dynapi_entity_value(n,"clip_mode").data,I=e.dwg_dynapi_entity_value(n,"clip_boundary_type").data,A=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,T=e.dwg_dynapi_entity_value(n,"clip_verts").data,h=e.dwg_ptr_to_point2d_array(T,A),C=e.dwg_dynapi_entity_value(n,"imagedef").data,R=e.dwg_ref_get_absref(C),Y=e.dwg_dynapi_entity_value(n,"imagedefreactor").data,g=e.dwg_ref_get_absref(Y);return{type:"WIPEOUT",...a,version:i,position:r,uPixel:o,vPixel:s,imageSize:_,imageDefHandle:R,flags:d,clipping:l,brightness:c,contrast:u,fade:E,imageDefReactorHandle:g,clippingBoundaryType:I,countBoundaryPoints:A,clippingBoundaryPath:h,clipMode:f}}convertXline(n,a){const e=this.libredwg,i=e.dwg_dynapi_entity_value(n,"point").data,r=e.dwg_dynapi_entity_value(n,"vector").data;return{type:"XLINE",...a,firstPoint:i,unitDirection:r}}getDimensionCommonAttrs(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"class_version").data,i=a.dwg_entity_get_block_name(n,"block"),r=a.dwg_dynapi_entity_value(n,"def_pt").data,o=a.dwg_dynapi_entity_value(n,"text_midpt").data,s=a.dwg_dynapi_entity_value(n,"attachmentPoint").data,_=a.dwg_dynapi_entity_value(n,"flag").data,d=a.dwg_dynapi_entity_value(n,"lspace_factor").data,l=a.dwg_dynapi_entity_value(n,"lspace_factor").data,c=a.dwg_dynapi_entity_value(n,"act_measurement").data,u=a.dwg_dynapi_entity_value(n,"user_text").data,E=a.dwg_dynapi_entity_value(n,"text_rotation").data,f=a.dwg_dynapi_entity_value(n,"ins_rotation").data,I=a.dwg_dynapi_entity_value(n,"extrusion").data,A=a.dwg_entity_get_dimstyle_name(n);return{type:"DIMENSION",version:e,name:i,definitionPoint:r,textPoint:o,dimensionType:_,attachmentPoint:s,textLineSpacingStyle:d,textLineSpacingFactor:l||1,measurement:c,text:u,textRotation:E,ocsRotation:f,extrusionDirection:I,styleName:A}}getCommonAttrs(n){const a=this.libredwg,e=a.dwg_object_entity_get_color_object(n),i=e.method,r=e.index;let o;(i==194||(e.rgb>>>24&255)===194)&&(o=e.rgb&16777215);const s=this.getLayerName(n),_=a.dwg_object_entity_get_handle_object(n),d=a.dwg_object_entity_get_ownerhandle_object(n),l=a.dwg_object_entity_get_xdicobjhandle_object(n),c=this.getLtypeName(n),u=a.dwg_object_entity_get_line_weight(n),E=a.dwg_object_entity_get_ltype_scale(n),f=!a.dwg_object_entity_get_invisible(n),I=a.dwg_object_entity_get_xdata(n);return{handle:L(_.value),ownerDictionaryHardId:L(l.absolute_ref),ownerBlockRecordSoftId:L(d.absolute_ref),layer:s,color:o,colorIndex:r,colorName:e.name,lineType:c,lineweight:u,lineTypeScale:E,isVisible:f,transparency:e.alpha,transparencyType:e.alpha_type,xdata:I}}getLayerName(n){const e=this.libredwg.dwg_object_entity_get_layer_object_ref(n);return this.layers.get(L(e.handleref.value))??"0"}getLtypeName(n){const e=this.libredwg.dwg_object_entity_get_ltype_object_ref(n);return this.ltypes.get(L(e.handleref.value))??""}}class zt{constructor(n){S(this,"libredwg");S(this,"entityConverter");this.libredwg=n,this.entityConverter=new Ce(n)}convert(n){this.entityConverter.clear();const a={tables:{APPID:{entries:[]},BLOCK_RECORD:{entries:[]},DIMSTYLE:{entries:[]},LAYER:{entries:[]},LTYPE:{entries:[]},STYLE:{entries:[]},VPORT:{entries:[]}},objects:{DICTIONARY:[],IMAGEDEF:[],LAYOUT:[],SPATIAL_FILTER:[]},header:{},entities:[],classes:[]},e=this.libredwg;this.convertHeader(n,a.header),this.convertClasses(n,a.classes);const i=e.dwg_get_num_objects(n);for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o);if(s){const _=e.dwg_object_to_object_tio(s);if(_)switch(e.dwg_object_get_fixedtype(s)){case P.DWG_TYPE_LAYER:{const l=this.convertLayer(_,s);a.tables.LAYER.entries.push(l),this.entityConverter.layers.set(l.handle,l.name)}break;case P.DWG_TYPE_LTYPE:{const l=this.convertLineType(_,s);a.tables.LTYPE.entries.push(l),this.entityConverter.ltypes.set(l.handle,l.name)}break}}}for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o);if(s){const _=e.dwg_object_to_object_tio(s);if(_)switch(e.dwg_object_get_fixedtype(s)){case P.DWG_TYPE_APPID:a.tables.APPID.entries.push(this.convertAppId(_));break;case P.DWG_TYPE_BLOCK_HEADER:{const l=this.convertBlockRecord(_,s);a.tables.BLOCK_RECORD.entries.push(l),(an(l.name)||he(l.name))&&l.entities.forEach(c=>{a.entities.push(c),c.type==="INSERT"&&c.attribs.forEach(u=>{a.entities.push(u)})})}break;case P.DWG_TYPE_DIMSTYLE:a.tables.DIMSTYLE.entries.push(this.convertDimStyle(_,s));break;case P.DWG_TYPE_STYLE:a.tables.STYLE.entries.push(this.convertStyle(_,s));break;case P.DWG_TYPE_VPORT:a.tables.VPORT.entries.push(this.convertViewport(_,s));break;case P.DWG_TYPE_DICTIONARY:a.objects.DICTIONARY.push(this.convertDictionary(_,s));break;case P.DWG_TYPE_IMAGEDEF:a.objects.IMAGEDEF.push(this.convertImageDef(_,s));break;case P.DWG_TYPE_LAYOUT:a.objects.LAYOUT.push(this.convertLayout(_,s));break;case P.DWG_TYPE_SPATIAL_FILTER:a.objects.SPATIAL_FILTER.push(this.convertSpatialFilter(_,s));break}}}const r=a.entities.filter(o=>o.type==="VIEWPORT");return r.sort((o,s)=>{const _=parseInt(o.handle,16),d=parseInt(s.handle,16);return _-d}),r.forEach((o,s)=>{o.viewportId=s+1}),a}getConversionStats(){return{unknownEntityCount:this.entityConverter.unknownEntityCount}}convertHeader(n,a){const e=this.libredwg;nn.forEach(i=>{let r=i;(i=="DIMBLK"||i=="DIMBLK1"||i=="DIMBLK2")&&(r=r+"_T");let o=e.dwg_dynapi_header_value(n,r).data;i=="CELTYPE"||i=="CLAYER"||i=="CLAYER"||i=="DIMSTYLE"||i=="DIMTXSTY"||i=="TEXTSTYLE"?o=o?e.dwg_ref_get_object_name(o):"":i=="DRAGVS"&&(o=o?e.dwg_ref_get_absref(o):2),a[i]=o})}convertClasses(n,a){const e=this.libredwg,i=e.dwg_get_num_classes(n);for(let r=0;r<i;r++){const o=e.dwg_get_class(n,r);a.push({dxfName:o.dxfname,cppName:o.cppname,appName:o.appname,capabilitiesFlag:o.proxyflag,instanceCount:o.num_instances,wasAProxyFlag:o.s_zombie,isAnEntityFlag:o.item_class_id===498})}}convertAppId(n){const a=this.libredwg,e=a.dwg_dynapi_entity_value(n,"name").data,i=a.dwg_dynapi_entity_value(n,"flag").data;return{name:e,standardFlag:i}}convertBlockRecord(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_entity_block_header_get_block(n);r.name&&(i.name=r.name);const o=e.dwg_dynapi_entity_value(n,"num_owned").data,s=e.dwg_dynapi_entity_value(n,"flag").data,_=e.dwg_dynapi_entity_value(n,"description").data,d=e.dwg_dynapi_entity_value(n,"base_pt").data,l=e.dwg_dynapi_entity_value(n,"insert_units").data,c=e.dwg_dynapi_entity_value(n,"explodable").data,u=e.dwg_dynapi_entity_value(n,"block_scaling").data,E=e.dwg_dynapi_entity_value(n,"layout").data,f=L(e.dwg_ref_get_absref(E));let I="";const A=C=>{const R=new Array(C.length);for(let Y=0;Y<C.length;Y++)R[Y]=C[Y].toString(16).toUpperCase();return R.join("")},T=e.dwg_entity_block_header_get_preview(n);T&&T.length>0&&(I=A(T));let h=this.convertEntities(a,i.handle);if(!h||h.length==0){h=[];const C=e.dwg_dynapi_entity_value(n,"entities").data;if(C){const R=e.dwg_ptr_to_object_ref_ptr_array(C,o),Y=this.entityConverter;for(let g=0;g<o;g++){const G=e.dwg_ref_get_object(R[g]),v=Y.convert(G);v&&(v.ownerBlockRecordSoftId=i.handle,h.push(v))}}}return{...i,flags:s,description:_,basePoint:d,layout:f,insertionUnits:l,explodability:c,scalability:u,bmpPreview:I,entities:h}}convertEntities(n,a){const e=this.libredwg,i=this.entityConverter,r=[];let o=e.get_first_owned_entity(n);for(;o;){const s=i.convert(o);s&&(s.ownerBlockRecordSoftId=a,r.push(s)),o=e.get_next_owned_entity(n,o)}return r}convertDimStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"DIMTOL").data,o=e.dwg_dynapi_entity_value(n,"DIMLIM").data,s=e.dwg_dynapi_entity_value(n,"DIMTIH").data,_=e.dwg_dynapi_entity_value(n,"DIMTOH").data,d=e.dwg_dynapi_entity_value(n,"DIMSE1").data,l=e.dwg_dynapi_entity_value(n,"DIMSE2").data,c=e.dwg_dynapi_entity_value(n,"DIMALT").data,u=e.dwg_dynapi_entity_value(n,"DIMTOFL").data,E=e.dwg_dynapi_entity_value(n,"DIMSAH").data,f=e.dwg_dynapi_entity_value(n,"DIMTIX").data,I=e.dwg_dynapi_entity_value(n,"DIMSOXD").data,A=e.dwg_dynapi_entity_value(n,"DIMALTD").data,T=e.dwg_dynapi_entity_value(n,"DIMZIN").data,h=e.dwg_dynapi_entity_value(n,"DIMSD1").data,C=e.dwg_dynapi_entity_value(n,"DIMSD2").data,R=e.dwg_dynapi_entity_value(n,"DIMTOLJ").data,Y=e.dwg_dynapi_entity_value(n,"DIMJUST").data,g=e.dwg_dynapi_entity_value(n,"DIMFIT").data,G=e.dwg_dynapi_entity_value(n,"DIMUPT").data,v=e.dwg_dynapi_entity_value(n,"DIMTZIN").data,m=e.dwg_dynapi_entity_value(n,"DIMALTZ").data,x=e.dwg_dynapi_entity_value(n,"DIMALTTZ").data,W=e.dwg_dynapi_entity_value(n,"DIMTAD").data,M=e.dwg_dynapi_entity_value(n,"DIMUNIT").data,O=e.dwg_dynapi_entity_value(n,"DIMAUNIT").data,B=e.dwg_dynapi_entity_value(n,"DIMDEC").data,K=e.dwg_dynapi_entity_value(n,"DIMTDEC").data,V=e.dwg_dynapi_entity_value(n,"DIMALTU").data,$=e.dwg_dynapi_entity_value(n,"DIMALTTD").data,z=e.dwg_dynapi_entity_value(n,"DIMSCALE").data,k=e.dwg_dynapi_entity_value(n,"DIMASZ").data,J=e.dwg_dynapi_entity_value(n,"DIMEXO").data,X=e.dwg_dynapi_entity_value(n,"DIMDLI").data,Z=e.dwg_dynapi_entity_value(n,"DIMEXE").data,st=e.dwg_dynapi_entity_value(n,"DIMRND").data,_t=e.dwg_dynapi_entity_value(n,"DIMDLE").data,dt=e.dwg_dynapi_entity_value(n,"DIMTP").data,lt=e.dwg_dynapi_entity_value(n,"DIMTM").data,ct=e.dwg_dynapi_entity_value(n,"DIMFXL").data,Et=e.dwg_dynapi_entity_value(n,"DIMJOGANG").data,ut=e.dwg_dynapi_entity_value(n,"DIMTFILL").data,At=e.dwg_dynapi_entity_value(n,"DIMTFILLCLR").data,It=e.dwg_dynapi_entity_value(n,"DIMAZIN").data,on=e.dwg_dynapi_entity_value(n,"DIMARCSYM").data,rn=e.dwg_dynapi_entity_value(n,"DIMTXT").data,sn=e.dwg_dynapi_entity_value(n,"DIMCEN").data,_n=e.dwg_dynapi_entity_value(n,"DIMTSZ").data,dn=e.dwg_dynapi_entity_value(n,"DIMALTF").data,ln=e.dwg_dynapi_entity_value(n,"DIMLFAC").data,cn=e.dwg_dynapi_entity_value(n,"DIMTVP").data,En=e.dwg_dynapi_entity_value(n,"DIMTFAC").data,un=e.dwg_dynapi_entity_value(n,"DIMGAP").data,An=e.dwg_dynapi_entity_value(n,"DIMPOST").data,In=e.dwg_dynapi_entity_value(n,"DIMAPOST").data,Pn=e.dwg_dynapi_entity_value(n,"DIMBLK_T").data,Tn=e.dwg_dynapi_entity_value(n,"DIMBLK1_T").data,fn=e.dwg_dynapi_entity_value(n,"DIMBLK2_T").data,hn=e.dwg_dynapi_entity_value(n,"DIMALTRND").data,Cn=e.dwg_dynapi_entity_value(n,"DIMCLRD_N").data,Rn=e.dwg_dynapi_entity_value(n,"DIMCLRE_N").data,Yn=e.dwg_dynapi_entity_value(n,"DIMCLRT_N").data,gn=e.dwg_dynapi_entity_value(n,"DIMCLRD").data,Ln=e.dwg_dynapi_entity_value(n,"DIMCLRE").data,vn=e.dwg_dynapi_entity_value(n,"DIMCLRT").data,Nn=e.dwg_dynapi_entity_value(n,"DIMADEC").data,Sn=e.dwg_dynapi_entity_value(n,"DIMFRAC").data,Gn=e.dwg_dynapi_entity_value(n,"DIMLUNIT").data,Dn=e.dwg_dynapi_entity_value(n,"DIMDSEP").data,pn=e.dwg_dynapi_entity_value(n,"DIMTMOVE").data,yn=e.dwg_dynapi_entity_value(n,"DIMATFIT").data,Wn=e.dwg_dynapi_entity_value(n,"DIMFXLON").data,Mn=e.dwg_dynapi_entity_value(n,"DIMTXTDIRECTION").data,mn=e.dwg_dynapi_entity_value(n,"DIMALTMZF").data,xn=e.dwg_dynapi_entity_value(n,"DIMALTMZS").data,On=e.dwg_dynapi_entity_value(n,"DIMMZF").data,wn=e.dwg_dynapi_entity_value(n,"DIMMZS").data,Bn=e.dwg_dynapi_entity_value(n,"DIMLWD").data,bn=e.dwg_dynapi_entity_value(n,"DIMLWE").data,Fn=e.dwg_dynapi_entity_value(n,"DIMTXSTY").data,Un=e.dwg_ref_get_absref(Fn),kn=e.dwg_dynapi_entity_value(n,"DIMLDRBLK").data,Xn=e.dwg_ref_get_absref(kn);return{...i,DIMPOST:An,DIMAPOST:In,DIMBLK:Pn,DIMBLK1:Tn,DIMBLK2:fn,DIMSCALE:z,DIMASZ:k,DIMEXO:J,DIMDLI:X,DIMEXE:Z,DIMRND:st,DIMDLE:_t,DIMTP:dt,DIMTM:lt,DIMTXT:rn,DIMCEN:sn,DIMTSZ:_n,DIMALTF:dn,DIMLFAC:ln,DIMTVP:cn,DIMTFAC:En,DIMGAP:un,DIMALTRND:hn,DIMTOL:r,DIMLIM:o,DIMTIH:s,DIMTOH:_,DIMSE1:d,DIMSE2:l,DIMTAD:W,DIMZIN:T,DIMAZIN:It,DIMALT:c,DIMALTD:A,DIMTOFL:u,DIMSAH:E,DIMTIX:f,DIMSOXD:I,DIMCLRD:gn,DIMCLRE:Ln,DIMCLRT:vn,DIMADEC:Nn,DIMUNIT:M,DIMDEC:B,DIMTDEC:K,DIMALTU:V,DIMALTTD:$,DIMAUNIT:O,DIMFRAC:Sn,DIMLUNIT:Gn,DIMDSEP:String.fromCharCode(Dn),DIMTMOVE:pn,DIMJUST:Y,DIMSD1:h,DIMSD2:C,DIMTOLJ:R,DIMTZIN:v,DIMALTZ:m,DIMALTTZ:x,DIMFIT:g,DIMUPT:G,DIMATFIT:yn,DIMTXSTY:Un,DIMLDRBLK:Xn,DIMLWD:Bn,DIMLWE:bn,DIMFXL:ct,DIMJOGANG:Et,DIMTFILL:ut,DIMTFILLCLR:At,DIMARCSYM:on,DIMCLRD_N:Cn,DIMCLRE_N:Rn,DIMCLRT_N:Yn,DIMFXLON:Wn,DIMTXTDIRECTION:Mn,DIMALTMZF:mn,DIMALTMZS:xn,DIMMZF:On,DIMMZS:wn}}convertLayer(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"frozen").data,s=e.dwg_dynapi_entity_value(n,"off").data,_=e.dwg_dynapi_entity_value(n,"frozen_in_new").data,d=e.dwg_dynapi_entity_value(n,"plotflockedlag").data,l=e.dwg_dynapi_entity_value(n,"plotflag").data,c=e.dwg_dynapi_entity_value(n,"linewt").data,u=e.dwg_dynapi_entity_value(n,"color").data,E=e.dwg_dynapi_entity_value(n,"ltype").data;let f="Continuous";if(E)try{f=e.dwg_ref_get_object_name(E)}catch{}const I=u.method;let A=256,T=16777215;return I===195||(u.rgb>>>24&255)===195?A=u.rgb&255:I==194||(u.rgb>>>24&255)===194?T=u.rgb&16777215:u.index>=1&&u.index<=255&&(A=u.index),{...i,standardFlag:r,colorIndex:A,color:T,colorName:u.name,transparency:u.alpha,lineType:f,frozen:o!=0,off:s!=0,frozenInNew:_!=0,locked:d!=0,plotFlag:l,lineweight:c,plotStyleNameObjectId:"",materialObjectId:""}}convertLineType(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"description").data,s=e.dwg_dynapi_entity_value(n,"numdashes").data,_=e.dwg_dynapi_entity_value(n,"pattern_len").data,d=e.dwg_dynapi_entity_value(n,"dashes").data,l=d?e.dwg_ptr_to_ltype_dash_array(d,s):[];return{...i,description:o,standardFlag:r,numberOfLineTypes:s,totalPatternLength:_,pattern:this.convertLineTypePattern(l)}}convertLineTypePattern(n){const a=[];return n.forEach(e=>{a.push({elementLength:e.length||0,elementTypeFlag:e.complex_shapecode,shapeNumber:e.shape_flag,scale:e.scale,rotation:e.rotation,offsetX:e.x_offset,offsetY:e.y_offset,text:e.text})}),a}convertStyle(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"width_factor").data,s=e.dwg_dynapi_entity_value(n,"oblique_angle").data,_=e.dwg_dynapi_entity_value(n,"generation").data,d=e.dwg_dynapi_entity_value(n,"last_height").data,l=e.dwg_dynapi_entity_value(n,"font_file").data,c=e.dwg_dynapi_entity_value(n,"bigfont_file").data;return{...i,standardFlag:r,fixedTextHeight:0,widthFactor:o,obliqueAngle:s,textGenerationFlag:_,lastHeight:d,font:l,bigFont:c}}convertViewport(n,a){const e=this.libredwg,i=this.getCommonTableEntryAttrs(n,a),r=e.dwg_dynapi_entity_value(n,"flag").data,o=e.dwg_dynapi_entity_value(n,"VIEWSIZE").data,s=e.dwg_dynapi_entity_value(n,"aspect_ratio").data,_=e.dwg_dynapi_entity_value(n,"VIEWCTR").data,d=e.dwg_dynapi_entity_value(n,"view_target").data,l=e.dwg_dynapi_entity_value(n,"VIEWDIR").data,c=e.dwg_dynapi_entity_value(n,"view_twist").data,u=e.dwg_dynapi_entity_value(n,"lens_length").data,E=e.dwg_dynapi_entity_value(n,"front_clip_z").data,f=e.dwg_dynapi_entity_value(n,"back_clip_z").data,I=e.dwg_dynapi_entity_value(n,"VIEWMODE").data,A=e.dwg_dynapi_entity_value(n,"render_mode").data,T=e.dwg_dynapi_entity_value(n,"use_default_lights").data!=0,h=e.dwg_dynapi_entity_value(n,"default_lightning_type").data,C=e.dwg_dynapi_entity_value(n,"brightness").data,R=e.dwg_dynapi_entity_value(n,"contrast").data,Y=e.dwg_dynapi_entity_value(n,"ambient_color").data,g=e.dwg_dynapi_entity_value(n,"lower_left").data,G=e.dwg_dynapi_entity_value(n,"upper_right").data,v=e.dwg_dynapi_entity_value(n,"circle_zoom").data,m=e.dwg_dynapi_entity_value(n,"UCSICON").data,x=e.dwg_dynapi_entity_value(n,"GRIDUNIT").data,W=e.dwg_dynapi_entity_value(n,"SNAPANG").data,M=e.dwg_dynapi_entity_value(n,"SNAPBASE").data,O=e.dwg_dynapi_entity_value(n,"SNAPUNIT").data,B=e.dwg_dynapi_entity_value(n,"ucsorg").data,K=e.dwg_dynapi_entity_value(n,"ucsxdir").data,V=e.dwg_dynapi_entity_value(n,"ucsydir").data,$=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,z=e.dwg_dynapi_entity_value(n,"grid_major").data,k=e.dwg_dynapi_entity_value(n,"background").data,J=k?L(e.dwg_ref_get_absref(k)):void 0,X=e.dwg_dynapi_entity_value(n,"visualstyle").data,Z=X?L(e.dwg_ref_get_absref(X)):void 0;return{...i,standardFlag:r,lowerLeftCorner:g,upperRightCorner:G,center:_,snapBasePoint:M,snapSpacing:O,gridSpacing:x,viewDirectionFromTarget:l,viewTarget:d,lensLength:u,frontClippingPlane:E,backClippingPlane:f,viewHeight:o,aspectRatio:s,snapRotationAngle:W,viewTwistAngle:c,circleSides:v,frozenLayers:[],styleSheet:"",renderMode:A,viewMode:I,ucsIconSetting:m,ucsOrigin:B,ucsXAxis:K,ucsYAxis:V,orthographicType:0,elevation:$,shadePlotSetting:0,majorGridLines:z,backgroundObjectId:J,visualStyleObjectId:Z,isDefaultLightingOn:T,defaultLightingType:h,brightness:C,contrast:R,ambientColor:Y.index}}getCommonTableEntryAttrs(n,a){const e=this.libredwg,i=e.dwg_object_get_tio(a),r=e.dwg_object_object_get_ownerhandle_object(i),o=e.dwg_object_get_handle_object(a);return{handle:L(o.value),ownerHandle:L(r.absolute_ref),name:e.dwg_dynapi_entity_value(n,"name").data}}convertDictionary(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"is_hardowner").data,o=e.dwg_dynapi_entity_value(n,"cloning").data,s=e.dwg_dynapi_entity_value(n,"numitems").data,_=e.dwg_dynapi_entity_value(n,"itemhandles").data,d=e.dwg_ptr_to_object_ref_array(_,s),l=e.dwg_object_dictionary_get_texts(a),c={};return d.forEach((u,E)=>c[l[E]]=L(u.absolute_ref)),{...i,isHardOwner:!!r,cloningFlag:o,entries:c}}convertImageDef(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"image_size").data,o=e.dwg_dynapi_entity_value(n,"file_path").data,s=e.dwg_dynapi_entity_value(n,"is_loaded").data,_=e.dwg_dynapi_entity_value(n,"pixel_size").data,d=e.dwg_dynapi_entity_value(n,"resunits").data;return{...i,fileName:o,size:r,sizeOfOnePixel:_,isLoaded:s,resolutionUnits:d}}convertLayout(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"layout_name").data,o=e.dwg_dynapi_entity_value(n,"tab_order").data,s=e.dwg_dynapi_entity_value(n,"layout_flags").data,_=e.dwg_dynapi_entity_value(n,"INSBASE").data,d=e.dwg_dynapi_entity_value(n,"LIMMIN").data,l=e.dwg_dynapi_entity_value(n,"LIMMAX").data,c=e.dwg_dynapi_entity_value(n,"UCSORG").data,u=e.dwg_dynapi_entity_value(n,"UCSXDIR").data,E=e.dwg_dynapi_entity_value(n,"UCSYDIR").data,f=e.dwg_dynapi_entity_value(n,"UCSORTHOVIEW").data,I=e.dwg_dynapi_entity_value(n,"EXTMIN").data,A=e.dwg_dynapi_entity_value(n,"EXTMAX").data,T=e.dwg_dynapi_entity_value(n,"ucs_elevation").data,h=e.dwg_dynapi_entity_value(n,"block_header").data,C=L(e.dwg_ref_get_absref(h)),R=e.dwg_dynapi_entity_value(n,"active_viewport").data,Y=L(e.dwg_ref_get_absref(R)),g=e.dwg_dynapi_entity_value(n,"named_ucs").data,G=g?L(e.dwg_ref_get_absref(g)):void 0;return{...i,layoutName:r,controlFlag:s,tabOrder:o,minLimit:d,maxLimit:l,insertionPoint:_,minExtent:I,maxExtent:A,elevation:T,ucsOrigin:c,ucsXAxis:u,ucsYAxis:E,orthographicType:f,paperSpaceTableId:C,viewportId:Y,namedUcsId:G,shadePlotId:""}}convertSpatialFilter(n,a){const e=this.libredwg,i=this.getCommonObjectAttrs(a),r=e.dwg_dynapi_entity_value(n,"origin").data,o=e.dwg_dynapi_entity_value(n,"num_clip_verts").data,s=e.dwg_dynapi_entity_value(n,"clip_verts").data,_=e.dwg_ptr_to_point2d_array(s,o),d=e.dwg_dynapi_entity_value(n,"extrusion").data,l=e.dwg_dynapi_entity_value(n,"display_boundary_on").data,c=e.dwg_dynapi_entity_value(n,"front_clip_on").data,u=e.dwg_dynapi_entity_value(n,"front_clip_z").data,E=e.dwg_dynapi_entity_value(n,"back_clip_on").data,f=e.dwg_dynapi_entity_value(n,"back_clip_z").data,I=e.dwg_dynapi_entity_value(n,"transform").data,A=e.dwg_ptr_to_double_array(I,12),T=e.dwg_dynapi_entity_value(n,"inverse_transform").data,h=e.dwg_ptr_to_double_array(T,12);return{...i,origin:r,numberOfPointsOnClipBoundary:o,vertices:_,extrusionDirection:d,clipBoundaryVisible:!!l,frontClippingPlaneFlag:!!c,frontClippingPlaneDistance:u,backClippingPlaneFlag:!!E,backClippingPlaneDistance:f,matrix:A,invertBlockMatrix:h}}getCommonObjectAttrs(n){const a=this.libredwg,e=a.dwg_object_get_tio(n),i=a.dwg_object_object_get_ownerhandle_object(e),r=a.dwg_object_get_handle_object(n);return{handle:L(r.value),ownerHandle:L(i.absolute_ref)}}}class D{constructor(){S(this,"min");S(this,"max");S(this,"valid");this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}expandByPoint(n){return this.min.x=Math.min(this.min.x,n.x),this.min.y=Math.min(this.min.y,n.y),this.max.x=Math.max(this.max.x,n.x),this.max.y=Math.max(this.max.y,n.y),this.valid=!0,this}transform(n,a){const e=this.getCorners().map(i=>({x:i.x*n.x+a.x,y:i.y*n.y+a.y}));this.reset();for(const i of e)this.expandByPoint(i);return this}rotate(n,a){const e=Math.cos(n),i=Math.sin(n),r=this.getCorners().map(o=>{const s=o.x-a.x,_=o.y-a.y;return{x:a.x+s*e-_*i,y:a.y+s*i+_*e}});this.reset();for(const o of r)this.expandByPoint(o);return this}clone(){const n=new D;return n.min={x:this.min.x,y:this.min.y},n.max={x:this.max.x,y:this.max.y},n.valid=this.valid,n}reset(){this.min={x:1/0,y:1/0},this.max={x:-1/0,y:-1/0},this.valid=!1}getCorners(){return[{x:this.min.x,y:this.min.y},{x:this.min.x,y:this.max.y},{x:this.max.x,y:this.min.y},{x:this.max.x,y:this.max.y}]}}function Re(t,n,a,e,i){const r=a.length;if(r===0)throw new Error("points must not be empty");const o=a[0].length;if(t<0||t>1)throw new Error(`t out of bounds [0,1]: ${t}`);if(n<1)throw new Error("degree must be at least 1 (linear)");if(n>r-1)throw new Error("degree must be less than or equal to point count - 1");const s=i??new Array(r).fill(1),_=e??(()=>{const I=[];for(let A=0;A<r+n+1;A++)I.push(A);return I})();if(_.length!==r+n+1)throw new Error("bad knot vector length");const d=[n,_.length-1-n],l=_[d[0]],c=_[d[1]];t=t*(c-l)+l,t=Math.max(t,l),t=Math.min(t,c);let u=d[0];for(;u<d[1]&&!(t>=_[u]&&t<=_[u+1]);u++);const E=new Array(r);for(let I=0;I<r;I++){E[I]=new Array(o+1);for(let A=0;A<o;A++)E[I][A]=a[I][A]*s[I];E[I][o]=s[I]}for(let I=1;I<=n+1;I++)for(let A=u;A>u-n-1+I;A--){const T=_[A+n+1-I]-_[A],h=T===0?0:(t-_[A])/T;for(let C=0;C<o+1;C++)E[A][C]=(1-h)*E[A-1][C]+h*E[A][C]}const f=new Array(o);for(let I=0;I<o;I++)f[I]=Ye(E[u][I]/E[u][o],-9);return f}function Ye(t,n){if(isNaN(t)||!Number.isInteger(n))return NaN;const[a,e="0"]=t.toString().split("e"),i=Math.round(+`${a}e${+e-n}`),[r,o="0"]=i.toString().split("e");return+`${r}e${+o+n}`}const et={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Tt=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215,0];function q(t,n,a){return Math.max(n,Math.min(a,t))}const ot=class ot{constructor(){S(this,"_colorIndex");S(this,"_color");S(this,"_colorName");this._colorIndex=256,this._color=null,this._colorName=null}get color(){return this._color}set color(n){n==null?this._color=null:(this._color=Math.round(q(n,0,256*256*256-1)),this._colorIndex=this.getColorIndexByValue(this._color),this._colorName=this.getColorNameByValue(this._color))}get hexColor(){if(this._color&&this._color>0&&this._color<=16777215){let n=this._color.toString(16).toUpperCase();for(;n.length<6;)n="0"+n;return`0x${n}`}return""}get cssColor(){return`rgb(${this.red},${this.green},${this.blue})`}get red(){return this.color!=null?this.color>>16&255:null}get green(){return this.color!=null?this.color>>8&255:null}get blue(){return this.color!=null?this.color&255:null}get colorIndex(){return this._colorIndex}set colorIndex(n){n==null?this._colorIndex=null:(this._colorIndex=q(n,0,256),this._color=Tt[n],this._colorName=this.getColorNameByValue(this._color))}get colorName(){return this._colorName}set colorName(n){if(n){const a=et[n.toLowerCase()];a!==void 0?(this._colorName=n,this._color=a,this._colorIndex=this.getColorIndexByValue(this._color)):console.warn("Unknown color: "+n)}else this._colorName=null}get hasColorName(){return this._colorName==null}get hasColorIndex(){return this._colorIndex==null}get isByLayer(){return this.colorIndex==256}setByLayer(){return this.colorIndex=256,this}get isByBlock(){return this.colorIndex==0}setByBlock(){return this.colorIndex=0,this}setScalar(n){return this.setRGB(n,n,n),this}setRGB(n,a,e){const i=Math.round(q(n,0,255)),r=Math.round(q(a,0,255)),o=Math.round(q(e,0,255));return this.color=(i<<16)+(r<<8)+o,this}setColorName(n){const a=et[n.toLowerCase()];return a!==void 0?this.color=a:console.warn("Unknown color "+n),this}clone(){const n=new ot;return n.colorIndex=this.colorIndex,n.color=this.color,n._colorName=this._colorName,this}copy(n){return this.colorIndex=n.colorIndex,this.color=n.color,this._colorName=n._colorName,this}equals(n){return n.color==this.color&&n.colorIndex==this.colorIndex&&n._colorName==this._colorName}toString(){return this.isByLayer?"ByLayer":this.isByBlock?"ByBlock":this.colorName?this.colorName:this.hexColor}getColorNameByValue(n){for(const[a,e]of Object.entries(et))if(e===n)return a;return null}getColorIndexByValue(n){const a=Tt.length-1;for(let e=1;e<a;++e)if(Tt[e]===n)return e;return null}};S(ot,"NAMES",et);let bt=ot;class p{constructor(n,a){S(this,"x");S(this,"y");this.x=n,this.y=a}add(n){return new p(this.x+n.x,this.y+n.y)}sub(n){return new p(this.x-n.x,this.y-n.y)}multiply(n){return new p(this.x*n,this.y*n)}length(){return Math.sqrt(this.x**2+this.y**2)}norm(){const n=this.length();return n===0?new p(0,0):new p(this.x/n,this.y/n)}}function ge(t,n,a,e=5){let i,r,o;a<0?(i=Math.atan(-a)*4,r=new p(t.x,t.y),o=new p(n.x,n.y)):(i=Math.atan(a)*4,r=new p(n.x,n.y),o=new p(t.x,t.y));const s=o.sub(r),_=s.length(),d=r.add(s.multiply(.5)),l=Math.abs(_/2/Math.tan(i/2)),c=s.norm(),u=new p(c.x*Math.cos(Math.PI/2)-c.y*Math.sin(Math.PI/2),c.y*Math.cos(Math.PI/2)+c.x*Math.sin(Math.PI/2)),E=i<Math.PI?d.add(u.multiply(-l)):d.add(u.multiply(l)),f=Math.atan2(o.y-E.y,o.x-E.x)/Math.PI*180;let I=Math.atan2(r.y-E.y,r.x-E.x)/Math.PI*180;I<f&&(I+=360);const A=o.sub(E).length(),T=Math.floor(f/e)*e+e,h=Math.ceil(I/e)*e-e,C=[];for(let R=T;R<=h;R+=e){const Y=R/180*Math.PI,g=E.add(new p(Math.cos(Y)*A,Math.sin(Y)*A));C.push(g)}return a<0&&C.reverse(),C}function Le(t,n=!1){let a=[];const e=t.vertices.map(i=>({x:i.x,y:i.y,bulge:i.bulge}));n&&e.push(e[0]);for(let i=0,r=e.length;i<r-1;++i){const o=e[i],s=e[i+1];a.push(o),e[i].bulge&&(a=a.concat(ge(o,s,t.vertices[i].bulge))),i===r-2&&a.push(s)}return a}class ve{constructor(){S(this,"blockMap",new Map)}rotate(n,a){const e=Math.cos(a),i=Math.sin(a);return{x:n.x*e-n.y*i,y:n.x*i+n.y*e}}interpolateBSpline(n,a,e,i=25,r){const o=[],s=n.map(l=>[l.x,l.y]),_=[e[a]],d=[e[a],e[e.length-1-a]];for(let l=a+1;l<e.length-a;++l)_[_.length-1]!==e[l]&&_.push(e[l]);for(let l=1;l<_.length;++l){const c=_[l-1],u=_[l];for(let E=0;E<=i;++E){let I=(E/i*(u-c)+c-d[0])/(d[1]-d[0]);I=Math.max(0,Math.min(1,I));const A=Re(I,a,s,e,r);o.push({x:A[0],y:A[1]})}}return o}addFlipXIfApplicable(n,{bbox:a,element:e}){return"extrusionDirection"in n&&n.extrusionDirection.z===-1?{bbox:new D().expandByPoint({x:-a.min.x,y:a.min.y}).expandByPoint({x:-a.max.x,y:a.max.y}),element:`<g transform="matrix(-1 0 0 1 0 0)">${e}</g>`}:{bbox:a,element:e}}line(n){const a=new D().expandByPoint({x:n.startPoint.x,y:n.startPoint.y}).expandByPoint({x:n.endPoint.x,y:n.endPoint.y}),e=`<line x1="${n.startPoint.x}" y1="${n.startPoint.y}" x2="${n.endPoint.x}" y2="${n.endPoint.y}" />`;return{bbox:a,element:e}}ray(n){const e=n.firstPoint,i={x:e.x+n.unitDirection.x*1e4,y:e.y+n.unitDirection.y*1e4},r=new D().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:r,element:o}}xline(n){const e={x:n.firstPoint.x-n.unitDirection.x*1e4,y:n.firstPoint.y-n.unitDirection.y*1e4},i={x:n.firstPoint.x+n.unitDirection.x*1e4,y:n.firstPoint.y+n.unitDirection.y*1e4},r=new D().expandByPoint(e).expandByPoint(i),o=`<line x1="${e.x}" y1="${e.y}" x2="${i.x}" y2="${i.y}" />`;return{bbox:r,element:o}}extractMTextLines(n){return n.replace(/\\U\+([0-9A-Fa-f]{4})/g,(a,e)=>String.fromCharCode(parseInt(e,16))).replace(/\\P/g,`
2
+ `).replace(/\\[LOlo]/g,"").replace(/\\[Ff][^;\\]*?(?:\|[^;\\]*)*;/g,"").replace(/\\[KkCcHhWwTtAa][^;\\]*;?/g,"").replace(/\\[a-zA-Z]+;?/g,"").replace(/%%(d|p|c|%)/gi,"").replace(/\\\\/g,"\\").replace(/\\~/g," ").replace(/[{}]/g,"").split(`
3
+ `).map(a=>a.trim()).filter(a=>a.length>0)}lines(n,a,e,i,r="start"){const o=new D().expandByPoint({x:e.x,y:e.y}).expandByPoint({x:e.x+i,y:e.y-n.length*a*1.5}),s=n.map((_,d)=>{const l=e.x,c=e.y-d*a*1.5,u=`translate(${l},${c}) scale(1,-1) translate(${-l},${-c})`;return`<text x="${l}" y="${c}" font-size="${a}" text-anchor="${r}" transform="${u}">${_}</text>`});return{bbox:o,element:s.join(`
4
+ `)}}mtext(n){const a=n.textHeight,e=n.insertionPoint,i=this.extractMTextLines(n.text),r=n.attachmentPoint;let o="start";return r==w.BottomCenter||r==w.MiddleCenter||r==w.TopCenter?o="middle":(r==w.BottomRight||r==w.MiddleRight||r==w.TopRight)&&(o="end"),this.lines(i,a,e,n.extentsWidth,o)}table(n){const{rowCount:a,columnCount:e,rowHeightArr:i,columnWidthArr:r,startPoint:o,cells:s}=n,_=o.x,d=o.y,l=[];for(let A=0,T=d;A<a;A++){const h=i[A];let C=_;for(let R=0;R<e;R++){const Y=A*e+R,g=s[Y],G=r[R];l.push({x:C,y:T,width:G,height:h,cell:g,row:A,col:R}),C+=G}T+=h}const c=l.map(({x:A,y:T,width:h,height:C,cell:R})=>{const Y=[];R.topBorderVisibility&&Y.push(`<line x1="${A}" y1="${T}" x2="${A+h}" y2="${T}" stroke="black" />`),R.bottomBorderVisibility&&Y.push(`<line x1="${A}" y1="${T+C}" x2="${A+h}" y2="${T+C}" stroke="black" />`),R.leftBorderVisibility&&Y.push(`<line x1="${A}" y1="${T}" x2="${A}" y2="${T+C}" stroke="black" />`),R.rightBorderVisibility&&Y.push(`<line x1="${A+h}" y1="${T}" x2="${A+h}" y2="${T+C}" stroke="black" />`);const g=A+h/2,G=T+C/2+R.textHeight/3,v=`<text x="${g}" y="${G}" font-size="${R.textHeight}" text-anchor="middle" dominant-baseline="middle">${R.text}</text>`;return[...Y,v].join(`
5
+ `)}).join(`
6
+ `),u=r.reduce((A,T)=>A+T,0),E=i.reduce((A,T)=>A+T,0),f=new D().expandByPoint({x:_,y:d}).expandByPoint({x:_+u,y:d+E}),I=`
7
+ <svg xmlns="http://www.w3.org/2000/svg" width="${u}" height="${E}" viewBox="${_} ${d} ${u} ${E}">
8
+ ${c}
9
+ </svg>
10
+ `.trim();return{bbox:f,element:I}}text(n){const a=n.textHeight,e=n.startPoint,i=[n.text];let r=n.endPoint.x-n.endPoint.x;n.halign==0&&(r=n.text.length*a+n.startPoint.x);let o="start";return n.halign==nt.CENTER?o="middle":n.halign==nt.RIGHT&&(o="end"),this.lines(i,a,e,r,o)}vertices(n,a=!1){const e=n.reduce((r,o)=>r.expandByPoint(o),new D);let i=n.reduce((r,o,s)=>(r+=s===0?"M":"L",r+=o.x+","+o.y,r),"");return a&&(i+="Z"),{bbox:e,element:`<path d="${i}" />`}}circle(n){const a=new D().expandByPoint({x:n.center.x+n.radius,y:n.center.y+n.radius}).expandByPoint({x:n.center.x-n.radius,y:n.center.y-n.radius}),e=`<circle cx="${n.center.x}" cy="${n.center.y}" r="${n.radius}" />`;return{bbox:a,element:e}}ellipseOrArc(n,a,e,i,r,o,s){const _=Math.sqrt(e*e+i*i),d=r*_,l=-Math.atan2(-i,e),c=this.bboxEllipseOrArc(n,a,e,i,r,o,s);if(Math.abs(o-s)<1e-9||Math.abs(o-s+Math.PI*2)<1e-9){const u=`<g transform="rotate(${l/Math.PI*180} ${n}, ${a})"><ellipse cx="${n}" cy="${a}" rx="${_}" ry="${d}" /></g>`;return{bbox:c,element:u}}else{const u=this.rotate({x:Math.cos(o)*_,y:Math.sin(o)*d},l),E={x:n+u.x,y:a+u.y},f=this.rotate({x:Math.cos(s)*_,y:Math.sin(s)*d},l),I={x:n+f.x,y:a+f.y},T=(s<o?s+Math.PI*2:s)-o<Math.PI?0:1,C=`<path d="${`M ${E.x} ${E.y} A ${_} ${d} ${l/Math.PI*180} ${T} 1 ${I.x} ${I.y}`}" />`;return{bbox:c,element:C}}}bboxEllipseOrArc(n,a,e,i,r,o,s){for(;o<0;)o+=Math.PI*2;for(;s<=o;)s+=Math.PI*2;const _=[];if(Math.abs(e)<1e-12||Math.abs(i)<1e-12)for(let E=0;E<4;E++)_.push(E/2*Math.PI);else _[0]=Math.atan(-i*r/e)-Math.PI,_[1]=Math.atan(e*r/i)-Math.PI,_[2]=_[0]-Math.PI,_[3]=_[1]-Math.PI;for(let E=4;E>=0;E--){for(;_[E]<o;)_[E]+=Math.PI*2;_[E]>s&&_.splice(E,1)}_.push(o),_.push(s);const d=_.map(E=>({x:Math.cos(E),y:Math.sin(E)})),l=[[e,-i*r],[i,e*r]];return d.map(E=>({x:E.x*l[0][0]+E.y*l[0][1]+n,y:E.x*l[1][0]+E.y*l[1][1]+a})).reduce((E,f)=>(E.expandByPoint(f),E),new D)}ellipse(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.majorAxisEndPoint.x,n.majorAxisEndPoint.y,n.axisRatio,n.startAngle,n.endAngle);return{bbox:a,element:e}}arc(n){const{bbox:a,element:e}=this.ellipseOrArc(n.center.x,n.center.y,n.radius,0,1,n.startAngle,n.endAngle);return{bbox:a,element:e}}dimension(n){const a=this.blockMap.get(n.name);return a?{bbox:a.bbox,element:`<use href="#${n.name}" />`}:null}insert(n){const a=this.blockMap.get(n.name);if(a){const e=n.insertionPoint,i=n.rotation*(180/Math.PI),r=`translate(${e.x},${e.y}) rotate(${i}) scale(${n.xScale},${n.yScale})`;return{bbox:a.bbox.clone().transform({x:n.xScale,y:n.yScale},{x:e.x,y:e.y}).rotate(n.rotation,e),element:`<use href="#${n.name}" transform="${r}" />`}}return null}block(n,a){const e=n.entities,{bbox:i,elements:r}=e.reduce((o,s)=>{const _=this.entityToBoundsAndElement(s);if(_){const{bbox:d,element:l}=_;d.valid&&(o.bbox.expandByPoint(d.min),o.bbox.expandByPoint(d.max));const c=this.getEntityColor(a.tables.LAYER.entries,s),u=s.type=="TEXT"||s.type=="MTEXT"?c.cssColor:"none";c.isByBlock?o.elements.push(`<g id="${s.handle}">${l}</g>`):o.elements.push(`<g id="${s.handle}" stroke="${c.cssColor}" fill="${u}">${l}</g>`)}return o},{bbox:new D,elements:[]});return i.valid?{bbox:i,element:`<g id="${n.name}">${r.join(`
11
+ `)}</g>`}:null}entityToBoundsAndElement(n){let a=null;switch(n.type){case"ARC":a=this.arc(n);break;case"CIRCLE":a=this.circle(n);break;case"DIMENSION":a=this.dimension(n);break;case"ELLIPSE":a=this.ellipse(n);break;case"INSERT":a=this.insert(n);break;case"LINE":a=this.line(n);break;case"LWPOLYLINE":{const e=n,i=!!(e.flag&512),r=Le(e,i);a=this.vertices(r,i);break}case"MTEXT":a=this.mtext(n);break;case"SPLINE":{const e=n;a=this.vertices(this.interpolateBSpline(e.controlPoints,e.degree,e.knots,25,e.weights));break}case"POLYLINE":break;case"RAY":a=this.ray(n);break;case"TABLE":a=this.table(n);break;case"TEXT":a=this.text(n);break;case"XLINE":a=this.xline(n);break;default:a=null;break}return a?this.addFlipXIfApplicable(n,a):null}getEntityColor(n,a){const e=new bt;if(a.colorIndex!=null?e.colorIndex=a.colorIndex:a.colorName?e.colorName=a.colorName:a.color!=null&&(e.color=a.color),e.colorIndex==7&&(e.colorIndex=256),e.isByLayer){const i=n.find(r=>r.name===a.layer);i!=null&&(e.colorIndex=i.colorIndex)}return e.color==null&&(e.color=16777215),e}convert(n){let a=null;this.blockMap.clear();let e="";n.tables.BLOCK_RECORD.entries.forEach(o=>{if(an(o.name))a=o;else{const s=this.block(o,n);s&&(e+=s.element,this.blockMap.set(o.name,s))}});const i=this.block(a,n),r=i&&i.bbox.valid?{x:i.bbox.min.x,y:-i.bbox.max.y,width:i.bbox.max.x-i.bbox.min.x,height:i.bbox.max.y-i.bbox.min.y}:{x:0,y:0,width:0,height:0};return`<?xml version="1.0"?>
12
+ <svg
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"
15
+ preserveAspectRatio="xMinYMin meet"
16
+ viewBox="${r.x} ${r.y} ${r.width} ${r.height}"
17
+ width="100%" height="100%"
18
+ >
19
+ <defs>${e}</defs>
20
+ <g stroke="#000000" stroke-width="0.1%" fill="none" transform="matrix(1,0,0,-1,0,0)">
21
+ ${i?i.element:""}
22
+ </g>
23
+ </svg>`}}var Ft;(function(t){t[t.BMP=2]="BMP",t[t.WMF=3]="WMF",t[t.PNG=6]="PNG"})(Ft||(Ft={}));const rt=class rt{constructor(n){S(this,"wasmInstance");S(this,"decoder");return this.wasmInstance=n,new Proxy(this,{get:(a,e,i)=>e in a?Reflect.get(a,e,i):Reflect.get(a.wasmInstance,e,i)})}dwg_read_data(n,a){if(a==it.DWG){const e="tmp.dwg";try{this.wasmInstance.FS.writeFile(e,new Uint8Array(n));const i=this.wasmInstance.dwg_read_file(e);return i.error!=0&&console.log("Open dwg file with error code: ",i.error),i.data}finally{this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}}dwg_write_dxf(n){const a="tmp.dwg",e="tmp.dxf";try{this.wasmInstance.FS.writeFile(a,new Uint8Array(n));const i=this.wasmInstance.dwg_write_dxf(a,e);return i!=0?(console.log("Convert dwg to dxf with error code: ",i),null):this.wasmInstance.FS.readFile(e)}finally{this.wasmInstance.FS.analyzePath(a,!1).exists&&this.wasmInstance.FS.unlink(a),this.wasmInstance.FS.analyzePath(e,!1).exists&&this.wasmInstance.FS.unlink(e)}}dwg_get_version_type(n){const a=this.wasmInstance.dwg_get_version_type(n);return en[a]}dwg_get_codepage(n){return this.wasmInstance.dwg_get_codepage(n)}dwg_bmp(n){return this.wasmInstance.dwg_bmp(n)}dwg_get_num_classes(n){return this.wasmInstance.dwg_get_num_classes(n)}dwg_get_class(n,a){return this.wasmInstance.dwg_get_class(n,a)}convert(n){const a=this.dwg_get_codepage(n),e=ht(a);return this.decoder=new TextDecoder(e),new zt(this).convert(n)}convertEx(n){const a=this.dwg_get_codepage(n),e=ht(a);this.decoder=new TextDecoder(e);const i=new zt(this);return{database:i.convert(n),stats:i.getConversionStats()}}dwg_to_svg(n){return new ve().convert(n)}dwg_free(n){this.wasmInstance.dwg_free(n)}dwg_free_object(n){this.wasmInstance.dwg_free_object(n)}dwg_ref_object(n,a){return this.wasmInstance.dwg_ref_object(n,a)}dwg_ref_object_silent(n,a){return this.wasmInstance.dwg_ref_object_silent(n,a)}dwg_ref_object_relative(n,a,e){return this.wasmInstance.dwg_ref_object_relative(n,a,e)}dwg_resolve_handle(n,a){return this.wasmInstance.dwg_resolve_handle(n,a)}dwg_resolve_handle_silent(n,a){return this.wasmInstance.dwg_resolve_handle_silent(n,a)}dwg_resolve_handleref(n,a){return this.wasmInstance.dwg_resolve_handleref(n,a)}dwg_ref_get_object_name(n){const a=this.wasmInstance,e=a.dwg_ref_get_object(n),i=a.dwg_object_to_object_tio(e);return this.dwg_dynapi_entity_value(i,"name").data}dwg_obj_obj_to_object(n){return this.wasmInstance.dwg_obj_obj_to_object(n)}dwg_obj_generic_to_object(n){return this.wasmInstance.dwg_obj_generic_to_object(n)}dwg_object_to_object(n){return this.wasmInstance.dwg_object_to_object(n)}dwg_object_to_object_tio(n){return this.wasmInstance.dwg_object_to_object_tio(n)}dwg_object_to_entity(n){return this.wasmInstance.dwg_object_to_entity(n)}dwg_object_to_entity_tio(n){return this.wasmInstance.dwg_object_to_entity_tio(n)}dwg_getall_entities_in_model_space(n){const a=this.wasmInstance,e=a.dwg_model_space_object(n),i=[];let r=a.get_first_owned_entity(e);for(;r;)i.push(r),r=a.get_next_owned_entity(e,r);return i}dwg_getall_object_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),r=[];for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o),_=e.dwg_object_to_object_tio(s);_&&e.dwg_object_get_fixedtype(s)==a&&r.push(_)}return r}dwg_getall_entity_by_type(n,a){const e=this.wasmInstance,i=e.dwg_get_num_objects(n),r=[];for(let o=0;o<i;o++){const s=e.dwg_get_object(n,o),_=e.dwg_object_to_entity_tio(s);_&&e.dwg_object_get_fixedtype(s)==a&&r.push(_)}return r}dwg_getall_LAYER(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_LAYER)}dwg_getall_LTYPE(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_LTYPE)}dwg_getall_STYLE(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_STYLE)}dwg_getall_DIMSTYLE(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_DIMSTYLE)}dwg_getall_VPORT(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_VPORT)}dwg_getall_LAYOUT(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_LAYOUT)}dwg_getall_BLOCK(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_BLOCK)}dwg_getall_BLOCK_HEADER(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_BLOCK_HEADER)}dwg_getall_IMAGEDEF(n){return this.dwg_getall_object_by_type(n,P.DWG_TYPE_IMAGEDEF)}dwg_getall_VERTEX_2D(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_VERTEX_2D)}dwg_getall_VERTEX_3D(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_VERTEX_3D)}dwg_getall_POLYLINE_2D(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_POLYLINE_2D)}dwg_getall_POLYLINE_3D(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_POLYLINE_3D)}dwg_getall_IMAGE(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_IMAGE)}dwg_getall_LWPOLYLINE(n){return this.dwg_getall_entity_by_type(n,P.DWG_TYPE_LWPOLYLINE)}dwg_ptr_to_object_ref_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_array(n,a)}dwg_ptr_to_object_ref_ptr_array(n,a){return this.wasmInstance.dwg_ptr_to_object_ref_ptr_array(n,a)}dwg_ptr_to_wchar_string_array(n,a){return this.wasmInstance.dwg_ptr_to_wchar_string_array(n,a)}dwg_ptr_to_unsigned_char_array(n,a){return this.wasmInstance.dwg_ptr_to_unsigned_char_array(n,a)}dwg_ptr_to_signed_char_array(n,a){return this.wasmInstance.dwg_ptr_to_signed_char_array(n,a)}dwg_ptr_to_uint16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint16_t_array(n,a)}dwg_ptr_to_int16_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int16_t_array(n,a)}dwg_ptr_to_uint32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint32_t_array(n,a)}dwg_ptr_to_int32_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int32_t_array(n,a)}dwg_ptr_to_uint64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_uint64_t_array(n,a)}dwg_ptr_to_int64_t_array(n,a){return this.wasmInstance.dwg_ptr_to_int64_t_array(n,a)}dwg_ptr_to_double_array(n,a){return this.wasmInstance.dwg_ptr_to_double_array(n,a)}dwg_ptr_to_point2d_array(n,a){return this.wasmInstance.dwg_ptr_to_point2d_array(n,a)}dwg_ptr_to_point3d_array(n,a){return this.wasmInstance.dwg_ptr_to_point3d_array(n,a)}dwg_ptr_to_point4d_array(n,a){return this.wasmInstance.dwg_ptr_to_point4d_array(n,a)}dwg_ptr_to_ltype_dash_array(n,a){return this.wasmInstance.dwg_ptr_to_ltype_dash_array(n,a)}dwg_ptr_to_table_cell_array(n,a){return this.wasmInstance.dwg_ptr_to_table_cell_array(n,a)}dwg_ptr_to_hatch_defline_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_defline_array(n,a)}dwg_ptr_to_hatch_path_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_path_array(n,a)}dwg_ptr_to_hatch_gradient_color_array(n,a){return this.wasmInstance.dwg_ptr_to_hatch_gradient_color_array(n,a)}dwg_ptr_to_mline_vertex_array(n,a){return this.wasmInstance.dwg_ptr_to_mline_vertex_array(n,a)}dwg_dynapi_entity_value(n,a){const e=this.wasmInstance.dwg_dynapi_entity_value(n,a);return e.bin&&this.decoder&&(e.data=this.decoder.decode(e.bin)),e}dwg_dynapi_header_value(n,a){return this.wasmInstance.dwg_dynapi_header_value(n,a)}dwg_dynapi_common_value(n,a){return this.wasmInstance.dwg_dynapi_common_value(n,a)}dwg_dynapi_subclass_value(n,a,e){return this.wasmInstance.dwg_dynapi_subclass_value(n,a,e)}dwg_object_get_handle_object(n){return this.wasmInstance.dwg_object_get_handle_object(n)}dwg_object_object_get_handle_object(n){return this.wasmInstance.dwg_object_object_get_handle_object(n)}dwg_object_object_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_object_get_ownerhandle_object(n)}dwg_object_entity_get_handle_object(n){return this.wasmInstance.dwg_object_entity_get_handle_object(n)}dwg_object_entity_get_ownerhandle_object(n){return this.wasmInstance.dwg_object_entity_get_ownerhandle_object(n)}dwg_object_entity_get_xdicobjhandle_object(n){return this.wasmInstance.dwg_object_entity_get_xdicobjhandle_object(n)}dwg_object_entity_get_layer_object_ref(n){return this.wasmInstance.dwg_object_entity_get_layer_object_ref(n)}dwg_object_entity_get_ltype_object_ref(n){return this.wasmInstance.dwg_object_entity_get_ltype_object_ref(n)}dwg_object_entity_get_color_object(n){return this.wasmInstance.dwg_object_entity_get_color_object(n)}dwg_object_entity_get_xdata(n){return this.wasmInstance.dwg_object_entity_get_xdata(n)}dwg_entity_owner(n){return this.wasmInstance.dwg_entity_owner(n)}dwg_entity_get_block_name(n,a){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,r=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(r);return this.dwg_entity_block_header_get_block(o).name}dwg_entity_get_dimstyle_name(n,a="dimstyle"){const e=this.wasmInstance,i=e.dwg_dynapi_entity_value(n,a).data,r=e.dwg_ref_get_object(i),o=e.dwg_object_to_object_tio(r);return this.dwg_dynapi_entity_value(o,"name").data}dwg_entity_block_header_get_block(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"block_entity").data,i=a.dwg_ref_get_object(e),r=a.dwg_object_to_entity_tio(i),o=a.dwg_dynapi_entity_value(r,"name").data,s=a.dwg_dynapi_entity_value(r,"base_pt").data;return{name:o,base_pt:s}}dwg_entity_block_header_get_preview(n){return this.wasmInstance.dwg_entity_block_header_get_preview(n).data}get_first_owned_entity(n){return this.wasmInstance.get_first_owned_entity(n)}get_next_owned_entity(n,a){return this.wasmInstance.get_next_owned_entity(n,a)}dwg_entity_mtext_get_style_name(n){const a=this.wasmInstance,e=a.dwg_dynapi_entity_value(n,"style").data,i=a.dwg_ref_get_object(e),r=a.dwg_object_to_object_tio(i);return a.dwg_dynapi_entity_value(r,"name").data}dwg_entity_text_get_style_name(n){return this.dwg_entity_mtext_get_style_name(n)}dwg_entity_polyline_2d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_2d_get_numpoints(n).data}dwg_entity_polyline_2d_get_points(n){return this.wasmInstance.dwg_entity_polyline_2d_get_points(n).data}dwg_entity_polyline_2d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_2d_get_vertices(n).data}dwg_entity_polyline_3d_get_numpoints(n){return this.wasmInstance.dwg_entity_polyline_3d_get_numpoints(n).data}dwg_entity_polyline_3d_get_points(n){return this.wasmInstance.dwg_entity_polyline_3d_get_points(n).data}dwg_entity_polyline_3d_get_vertices(n){return this.wasmInstance.dwg_entity_polyline_3d_get_vertices(n).data}dwg_entity_insert_get_attribs(n){return this.wasmInstance.dwg_entity_insert_get_attribs(n).data}dwg_object_dictionary_get_texts(n){return this.wasmInstance.dwg_object_dictionary_get_texts(n).data}static createByWasmInstance(n){return this.instance==null?new rt(n):this.instance}static async create(n){const a=n==null?await Ot():await Ot({locateFile:e=>`${n}/${e}`});return this.createByWasmInstance(a)}};S(rt,"instance");let Ut=rt;const Jt=Object.freeze(Object.defineProperty({__proto__:null,get DwgAttachmentPoint(){return w},get DwgBoundaryPathEdgeType(){return F},get DwgBoundaryPathTypeFlag(){return pt},get DwgCodePage(){return ft},get DwgDictionaryCloningFlags(){return xt},get DwgDimensionTextHorizontal(){return vt},get DwgDimensionTextLineSpacing(){return Rt},get DwgDimensionTextVertical(){return Yt},get DwgDimensionToleranceTextVertical(){return Nt},get DwgDimensionType(){return Ct},get DwgDimensionZeroSuppression(){return gt},get DwgDimensionZeroSuppressionAngular(){return Lt},get DwgHatchAssociativity(){return j},get DwgHatchBoundaryAnnotation(){return Dt},get DwgHatchGradientColorFlag(){return tt},get DwgHatchGradientFlag(){return at},get DwgHatchPatternType(){return Gt},get DwgHatchSolidFill(){return Q},get DwgHatchStyle(){return St},get DwgPolylineFlag(){return yt},get DwgSmoothType(){return Wt},get DwgTextGenerationFlag(){return Mt},get DwgTextHorizontalAlign(){return nt},get DwgTextVerticalAlign(){return mt},get DwgThumbnailImageType(){return Ft},get Dwg_Color_Method(){return Bt},get Dwg_File_Type(){return it},get Dwg_Hatch_Edge_Type(){return U},get Dwg_Object_Supertype(){return wt},get Dwg_Object_Type(){return P},Dwg_Object_Type_Inverted:Pe,HEADER_VARIABLES:nn,LibreDwg:Ut,createModule:Ot,dwgCodePageToEncoding:ht,dwgVersions:en},Symbol.toStringTag,{value:"Module"}));
24
+ //# sourceMappingURL=dwg-worker.js.map