@7niao/doc-previewer 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +15 -0
- package/README.md +217 -2
- package/dist/assets/ArchiveRenderer-BZsm87A2.js +514 -0
- package/dist/assets/CadRenderer-DQiBmk71.js +1838 -0
- package/dist/assets/DocxRenderer-6BCR0R9L.js +3173 -0
- package/dist/assets/GisRenderer-BQ_T-z1A.js +9758 -0
- package/dist/assets/ImageRenderer-D1SFZkV3.js +24 -0
- package/dist/assets/MediaRenderer-DKj0V7cL.js +66 -0
- package/dist/assets/Model3dRenderer-DDk-HsYP.js +1966 -0
- package/dist/assets/OfdRenderer-1kDqHPDa.js +67 -0
- package/dist/assets/PdfRenderer-DuZpWPAu.js +16370 -0
- package/dist/assets/PptxRenderer-BSoVSGOz.js +48492 -0
- package/dist/assets/TextRenderer-pKpgA2wF.js +38 -0
- package/dist/assets/UnsupportedRenderer-CnjuGXg3.js +29 -0
- package/dist/assets/XlsxRenderer-Bohk5iIA.js +16257 -0
- package/dist/assets/_plugin-vue_export-helper-Djzt4Yr7.js +7 -0
- package/dist/assets/createLucideIcon-C_l8giLP.js +91 -0
- package/dist/assets/dom-Ba50_9e0.js +93 -0
- package/dist/assets/dwg2dxf-wasm-DO6Y5cnM.js +2148 -0
- package/dist/assets/file-question-mark-D7iJe3UN.js +21 -0
- package/dist/assets/jszip.min-OjSHaKmg.js +3039 -0
- package/dist/assets/ofd.es-CauEO04U.js +24255 -0
- package/dist/assets/rolldown-runtime-CwxnZyOB.js +22 -0
- package/dist/assets/three.module-B04XcvCz.js +12454 -0
- package/dist/assets/types-CVtHVd2P.js +168 -0
- package/dist/index.js +725 -0
- package/dist/libarchive/libarchive.wasm +0 -0
- package/dist/libarchive/worker-bundle.js +6 -0
- package/dist/style.css +2 -0
- package/dist/types/FileViewer.vue.d.ts +48 -0
- package/dist/types/components/PreviewToolbar.vue.d.ts +33 -0
- package/dist/types/composables/useFullscreen.d.ts +6 -0
- package/dist/types/composables/usePreviewSource.d.ts +14 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/renderers/ArchiveRenderer.vue.d.ts +18 -0
- package/dist/types/renderers/CadRenderer.vue.d.ts +29 -0
- package/dist/types/renderers/DocxRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/GisRenderer.vue.d.ts +26 -0
- package/dist/types/renderers/ImageRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/MediaRenderer.vue.d.ts +17 -0
- package/dist/types/renderers/Model3dRenderer.vue.d.ts +29 -0
- package/dist/types/renderers/OfdRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/PdfRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/PptxRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/TextRenderer.vue.d.ts +16 -0
- package/dist/types/renderers/UnsupportedRenderer.vue.d.ts +14 -0
- package/dist/types/renderers/XlsxRenderer.vue.d.ts +16 -0
- package/dist/types/types.d.ts +51 -0
- package/dist/types/utils/detect.d.ts +10 -0
- package/dist/types/utils/dom.d.ts +13 -0
- package/dist/types/vendor/asn1js-stub.d.ts +10 -0
- package/package.json +77 -3
|
@@ -0,0 +1,1838 @@
|
|
|
1
|
+
import { i as e, t } from "./rolldown-runtime-CwxnZyOB.js";
|
|
2
|
+
import { A as n, O as r, Z as i, _ as a, c as o, d as s, g as c, gt as l, ht as u, l as d, lt as f, s as p, t as m, xt as h } from "./three.module-B04XcvCz.js";
|
|
3
|
+
import { i as g } from "./dom-Ba50_9e0.js";
|
|
4
|
+
import { t as _ } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
5
|
+
import { createCommentVNode as v, createElementBlock as y, createElementVNode as b, defineComponent as x, onBeforeUnmount as S, onMounted as C, openBlock as w, ref as T, toDisplayString as ee } from "vue";
|
|
6
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/DxfArrayScanner.js
|
|
7
|
+
var E = class {
|
|
8
|
+
constructor(e) {
|
|
9
|
+
this._pointer = 0, this._eof = !1, this._data = e;
|
|
10
|
+
}
|
|
11
|
+
next() {
|
|
12
|
+
if (!this.hasNext()) throw this._eof ? Error("Cannot call 'next' after EOF group has been read") : Error("Unexpected end of input: EOF group not read before end of file. Ended on code " + this._data[this._pointer]);
|
|
13
|
+
let e = { code: parseInt(this._data[this._pointer]) };
|
|
14
|
+
return this._pointer++, e.value = D(e.code, this._data[this._pointer].trim()), this._pointer++, e.code === 0 && e.value === "EOF" && (this._eof = !0), this.lastReadGroup = e, e;
|
|
15
|
+
}
|
|
16
|
+
peek() {
|
|
17
|
+
if (!this.hasNext()) throw this._eof ? Error("Cannot call 'next' after EOF group has been read") : Error("Unexpected end of input: EOF group not read before end of file. Ended on code " + this._data[this._pointer]);
|
|
18
|
+
let e = { code: parseInt(this._data[this._pointer]) };
|
|
19
|
+
return e.value = D(e.code, this._data[this._pointer + 1].trim()), e;
|
|
20
|
+
}
|
|
21
|
+
rewind(e = 1) {
|
|
22
|
+
this._pointer -= e * 2;
|
|
23
|
+
}
|
|
24
|
+
hasNext() {
|
|
25
|
+
return !(this._eof || this._pointer > this._data.length - 2);
|
|
26
|
+
}
|
|
27
|
+
isEOF() {
|
|
28
|
+
return this._eof;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function D(e, t) {
|
|
32
|
+
return e <= 9 ? t : e >= 10 && e <= 59 ? parseFloat(t) : e >= 60 && e <= 99 ? parseInt(t) : e >= 100 && e <= 109 ? t : e >= 110 && e <= 149 ? parseFloat(t) : e >= 160 && e <= 179 ? parseInt(t) : e >= 210 && e <= 239 ? parseFloat(t) : e >= 270 && e <= 289 ? parseInt(t) : e >= 290 && e <= 299 ? O(t) : e >= 300 && e <= 369 ? t : e >= 370 && e <= 389 ? parseInt(t) : e >= 390 && e <= 399 ? t : e >= 400 && e <= 409 ? parseInt(t) : e >= 410 && e <= 419 ? t : e >= 420 && e <= 429 ? parseInt(t) : e >= 430 && e <= 439 ? t : e >= 440 && e <= 459 ? parseInt(t) : e >= 460 && e <= 469 ? parseFloat(t) : e >= 470 && e <= 481 || e === 999 || e >= 1e3 && e <= 1009 ? t : e >= 1010 && e <= 1059 ? parseFloat(t) : e >= 1060 && e <= 1071 ? parseInt(t) : (console.log("WARNING: Group code does not have a defined type: %j", {
|
|
33
|
+
code: e,
|
|
34
|
+
value: t
|
|
35
|
+
}), t);
|
|
36
|
+
}
|
|
37
|
+
function O(e) {
|
|
38
|
+
if (e === "0") return !1;
|
|
39
|
+
if (e === "1") return !0;
|
|
40
|
+
throw TypeError("String '" + e + "' cannot be cast to Boolean type");
|
|
41
|
+
}
|
|
42
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/AutoCadColorIndex.js
|
|
43
|
+
var k = [
|
|
44
|
+
0,
|
|
45
|
+
16711680,
|
|
46
|
+
16776960,
|
|
47
|
+
65280,
|
|
48
|
+
65535,
|
|
49
|
+
255,
|
|
50
|
+
16711935,
|
|
51
|
+
16777215,
|
|
52
|
+
8421504,
|
|
53
|
+
12632256,
|
|
54
|
+
16711680,
|
|
55
|
+
16744319,
|
|
56
|
+
13369344,
|
|
57
|
+
13395558,
|
|
58
|
+
10027008,
|
|
59
|
+
10046540,
|
|
60
|
+
8323072,
|
|
61
|
+
8339263,
|
|
62
|
+
4980736,
|
|
63
|
+
4990502,
|
|
64
|
+
16727808,
|
|
65
|
+
16752511,
|
|
66
|
+
13382400,
|
|
67
|
+
13401958,
|
|
68
|
+
10036736,
|
|
69
|
+
10051404,
|
|
70
|
+
8331008,
|
|
71
|
+
8343359,
|
|
72
|
+
4985600,
|
|
73
|
+
4992806,
|
|
74
|
+
16744192,
|
|
75
|
+
16760703,
|
|
76
|
+
13395456,
|
|
77
|
+
13408614,
|
|
78
|
+
10046464,
|
|
79
|
+
10056268,
|
|
80
|
+
8339200,
|
|
81
|
+
8347455,
|
|
82
|
+
4990464,
|
|
83
|
+
4995366,
|
|
84
|
+
16760576,
|
|
85
|
+
16768895,
|
|
86
|
+
13408512,
|
|
87
|
+
13415014,
|
|
88
|
+
10056192,
|
|
89
|
+
10061132,
|
|
90
|
+
8347392,
|
|
91
|
+
8351551,
|
|
92
|
+
4995328,
|
|
93
|
+
4997670,
|
|
94
|
+
16776960,
|
|
95
|
+
16777087,
|
|
96
|
+
13421568,
|
|
97
|
+
13421670,
|
|
98
|
+
10000384,
|
|
99
|
+
10000460,
|
|
100
|
+
8355584,
|
|
101
|
+
8355647,
|
|
102
|
+
5000192,
|
|
103
|
+
5000230,
|
|
104
|
+
12582656,
|
|
105
|
+
14679935,
|
|
106
|
+
10079232,
|
|
107
|
+
11717734,
|
|
108
|
+
7510016,
|
|
109
|
+
8755276,
|
|
110
|
+
6258432,
|
|
111
|
+
7307071,
|
|
112
|
+
3755008,
|
|
113
|
+
4344870,
|
|
114
|
+
8388352,
|
|
115
|
+
12582783,
|
|
116
|
+
6736896,
|
|
117
|
+
10079334,
|
|
118
|
+
5019648,
|
|
119
|
+
7510092,
|
|
120
|
+
4161280,
|
|
121
|
+
6258495,
|
|
122
|
+
2509824,
|
|
123
|
+
3755046,
|
|
124
|
+
4194048,
|
|
125
|
+
10485631,
|
|
126
|
+
3394560,
|
|
127
|
+
8375398,
|
|
128
|
+
2529280,
|
|
129
|
+
6264908,
|
|
130
|
+
2064128,
|
|
131
|
+
5209919,
|
|
132
|
+
1264640,
|
|
133
|
+
3099686,
|
|
134
|
+
65280,
|
|
135
|
+
8388479,
|
|
136
|
+
52224,
|
|
137
|
+
6736998,
|
|
138
|
+
38912,
|
|
139
|
+
5019724,
|
|
140
|
+
32512,
|
|
141
|
+
4161343,
|
|
142
|
+
19456,
|
|
143
|
+
2509862,
|
|
144
|
+
65343,
|
|
145
|
+
8388511,
|
|
146
|
+
52275,
|
|
147
|
+
6737023,
|
|
148
|
+
38950,
|
|
149
|
+
5019743,
|
|
150
|
+
32543,
|
|
151
|
+
4161359,
|
|
152
|
+
19475,
|
|
153
|
+
2509871,
|
|
154
|
+
65407,
|
|
155
|
+
8388543,
|
|
156
|
+
52326,
|
|
157
|
+
6737049,
|
|
158
|
+
38988,
|
|
159
|
+
5019762,
|
|
160
|
+
32575,
|
|
161
|
+
4161375,
|
|
162
|
+
19494,
|
|
163
|
+
2509881,
|
|
164
|
+
65471,
|
|
165
|
+
8388575,
|
|
166
|
+
52377,
|
|
167
|
+
6737074,
|
|
168
|
+
39026,
|
|
169
|
+
5019781,
|
|
170
|
+
32607,
|
|
171
|
+
4161391,
|
|
172
|
+
19513,
|
|
173
|
+
2509890,
|
|
174
|
+
65535,
|
|
175
|
+
8388607,
|
|
176
|
+
52428,
|
|
177
|
+
6737100,
|
|
178
|
+
39064,
|
|
179
|
+
5019800,
|
|
180
|
+
32639,
|
|
181
|
+
4161407,
|
|
182
|
+
19532,
|
|
183
|
+
2509900,
|
|
184
|
+
49151,
|
|
185
|
+
8380415,
|
|
186
|
+
39372,
|
|
187
|
+
6730444,
|
|
188
|
+
29336,
|
|
189
|
+
5014936,
|
|
190
|
+
24447,
|
|
191
|
+
4157311,
|
|
192
|
+
14668,
|
|
193
|
+
2507340,
|
|
194
|
+
32767,
|
|
195
|
+
8372223,
|
|
196
|
+
26316,
|
|
197
|
+
6724044,
|
|
198
|
+
19608,
|
|
199
|
+
5010072,
|
|
200
|
+
16255,
|
|
201
|
+
4153215,
|
|
202
|
+
9804,
|
|
203
|
+
2505036,
|
|
204
|
+
16383,
|
|
205
|
+
8364031,
|
|
206
|
+
13260,
|
|
207
|
+
6717388,
|
|
208
|
+
9880,
|
|
209
|
+
5005208,
|
|
210
|
+
8063,
|
|
211
|
+
4149119,
|
|
212
|
+
4940,
|
|
213
|
+
2502476,
|
|
214
|
+
255,
|
|
215
|
+
8355839,
|
|
216
|
+
204,
|
|
217
|
+
6710988,
|
|
218
|
+
152,
|
|
219
|
+
5000344,
|
|
220
|
+
127,
|
|
221
|
+
4145023,
|
|
222
|
+
76,
|
|
223
|
+
2500172,
|
|
224
|
+
4129023,
|
|
225
|
+
10452991,
|
|
226
|
+
3342540,
|
|
227
|
+
8349388,
|
|
228
|
+
2490520,
|
|
229
|
+
6245528,
|
|
230
|
+
2031743,
|
|
231
|
+
5193599,
|
|
232
|
+
1245260,
|
|
233
|
+
3089996,
|
|
234
|
+
8323327,
|
|
235
|
+
12550143,
|
|
236
|
+
6684876,
|
|
237
|
+
10053324,
|
|
238
|
+
4980888,
|
|
239
|
+
7490712,
|
|
240
|
+
4128895,
|
|
241
|
+
6242175,
|
|
242
|
+
2490444,
|
|
243
|
+
3745356,
|
|
244
|
+
12517631,
|
|
245
|
+
14647295,
|
|
246
|
+
10027212,
|
|
247
|
+
11691724,
|
|
248
|
+
7471256,
|
|
249
|
+
8735896,
|
|
250
|
+
6226047,
|
|
251
|
+
7290751,
|
|
252
|
+
3735628,
|
|
253
|
+
4335180,
|
|
254
|
+
16711935,
|
|
255
|
+
16744447,
|
|
256
|
+
13369548,
|
|
257
|
+
13395660,
|
|
258
|
+
9961624,
|
|
259
|
+
9981080,
|
|
260
|
+
8323199,
|
|
261
|
+
8339327,
|
|
262
|
+
4980812,
|
|
263
|
+
4990540,
|
|
264
|
+
16711871,
|
|
265
|
+
16744415,
|
|
266
|
+
13369497,
|
|
267
|
+
13395634,
|
|
268
|
+
9961586,
|
|
269
|
+
9981061,
|
|
270
|
+
8323167,
|
|
271
|
+
8339311,
|
|
272
|
+
4980793,
|
|
273
|
+
4990530,
|
|
274
|
+
16711807,
|
|
275
|
+
16744383,
|
|
276
|
+
13369446,
|
|
277
|
+
13395609,
|
|
278
|
+
9961548,
|
|
279
|
+
9981042,
|
|
280
|
+
8323135,
|
|
281
|
+
8339295,
|
|
282
|
+
4980774,
|
|
283
|
+
4990521,
|
|
284
|
+
16711743,
|
|
285
|
+
16744351,
|
|
286
|
+
13369395,
|
|
287
|
+
13395583,
|
|
288
|
+
9961510,
|
|
289
|
+
9981023,
|
|
290
|
+
8323103,
|
|
291
|
+
8339279,
|
|
292
|
+
4980755,
|
|
293
|
+
4990511,
|
|
294
|
+
3355443,
|
|
295
|
+
5987163,
|
|
296
|
+
8684676,
|
|
297
|
+
11382189,
|
|
298
|
+
14079702,
|
|
299
|
+
16777215
|
|
300
|
+
];
|
|
301
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/ParseHelpers.js
|
|
302
|
+
function A(e) {
|
|
303
|
+
return k[e];
|
|
304
|
+
}
|
|
305
|
+
function j(e) {
|
|
306
|
+
let t = {};
|
|
307
|
+
e.rewind();
|
|
308
|
+
let n = e.next(), r = n.code;
|
|
309
|
+
if (t.x = n.value, r += 10, n = e.next(), n.code != r) throw Error("Expected code for point value to be " + r + " but got " + n.code + ".");
|
|
310
|
+
return t.y = n.value, r += 10, n = e.next(), n.code == r ? (t.z = n.value, t) : (e.rewind(), t);
|
|
311
|
+
}
|
|
312
|
+
function M(e, t, n) {
|
|
313
|
+
switch (t.code) {
|
|
314
|
+
case 0:
|
|
315
|
+
e.type = t.value;
|
|
316
|
+
break;
|
|
317
|
+
case 5:
|
|
318
|
+
e.handle = t.value;
|
|
319
|
+
break;
|
|
320
|
+
case 6:
|
|
321
|
+
e.lineType = t.value;
|
|
322
|
+
break;
|
|
323
|
+
case 8:
|
|
324
|
+
e.layer = t.value;
|
|
325
|
+
break;
|
|
326
|
+
case 48:
|
|
327
|
+
e.lineTypeScale = t.value;
|
|
328
|
+
break;
|
|
329
|
+
case 60:
|
|
330
|
+
e.visible = t.value === 0;
|
|
331
|
+
break;
|
|
332
|
+
case 62:
|
|
333
|
+
e.colorIndex = t.value, e.color = A(Math.abs(t.value));
|
|
334
|
+
break;
|
|
335
|
+
case 67:
|
|
336
|
+
e.inPaperSpace = t.value !== 0;
|
|
337
|
+
break;
|
|
338
|
+
case 100: break;
|
|
339
|
+
case 101:
|
|
340
|
+
for (; t.code != 0;) t = n.next();
|
|
341
|
+
n.rewind();
|
|
342
|
+
break;
|
|
343
|
+
case 330:
|
|
344
|
+
e.ownerHandle = t.value;
|
|
345
|
+
break;
|
|
346
|
+
case 347:
|
|
347
|
+
e.materialObjectHandle = t.value;
|
|
348
|
+
break;
|
|
349
|
+
case 370:
|
|
350
|
+
e.lineweight = t.value;
|
|
351
|
+
break;
|
|
352
|
+
case 420:
|
|
353
|
+
e.color = t.value;
|
|
354
|
+
break;
|
|
355
|
+
case 1e3:
|
|
356
|
+
e.extendedData = e.extendedData || {}, e.extendedData.customStrings = e.extendedData.customStrings || [], e.extendedData.customStrings.push(t.value);
|
|
357
|
+
break;
|
|
358
|
+
case 1001:
|
|
359
|
+
e.extendedData = e.extendedData || {}, e.extendedData.applicationName = t.value;
|
|
360
|
+
break;
|
|
361
|
+
default: return !1;
|
|
362
|
+
}
|
|
363
|
+
return !0;
|
|
364
|
+
}
|
|
365
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/entities/3dface.js
|
|
366
|
+
var N = class {
|
|
367
|
+
constructor() {
|
|
368
|
+
this.ForEntityName = "3DFACE";
|
|
369
|
+
}
|
|
370
|
+
parseEntity(e, t) {
|
|
371
|
+
let n = {
|
|
372
|
+
type: t.value,
|
|
373
|
+
vertices: []
|
|
374
|
+
};
|
|
375
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
376
|
+
switch (t.code) {
|
|
377
|
+
case 70:
|
|
378
|
+
n.shape = (t.value & 1) == 1, n.hasContinuousLinetypePattern = (t.value & 128) == 128;
|
|
379
|
+
break;
|
|
380
|
+
case 10:
|
|
381
|
+
n.vertices = P(e, t), t = e.lastReadGroup;
|
|
382
|
+
break;
|
|
383
|
+
default: M(n, t, e);
|
|
384
|
+
}
|
|
385
|
+
t = e.next();
|
|
386
|
+
}
|
|
387
|
+
return n;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
function P(e, t) {
|
|
391
|
+
var n = [], r = !1, i = !1, a = 4;
|
|
392
|
+
for (let s = 0; s <= a; s++) {
|
|
393
|
+
for (var o = {}; !e.isEOF() && !(t.code === 0 || i);) {
|
|
394
|
+
switch (t.code) {
|
|
395
|
+
case 10:
|
|
396
|
+
case 11:
|
|
397
|
+
case 12:
|
|
398
|
+
case 13:
|
|
399
|
+
if (r) {
|
|
400
|
+
i = !0;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
o.x = t.value, r = !0;
|
|
404
|
+
break;
|
|
405
|
+
case 20:
|
|
406
|
+
case 21:
|
|
407
|
+
case 22:
|
|
408
|
+
case 23:
|
|
409
|
+
o.y = t.value;
|
|
410
|
+
break;
|
|
411
|
+
case 30:
|
|
412
|
+
case 31:
|
|
413
|
+
case 32:
|
|
414
|
+
case 33:
|
|
415
|
+
o.z = t.value;
|
|
416
|
+
break;
|
|
417
|
+
default: return n;
|
|
418
|
+
}
|
|
419
|
+
t = e.next();
|
|
420
|
+
}
|
|
421
|
+
n.push(o), r = !1, i = !1;
|
|
422
|
+
}
|
|
423
|
+
return e.rewind(), n;
|
|
424
|
+
}
|
|
425
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/entities/arc.js
|
|
426
|
+
var F = class {
|
|
427
|
+
constructor() {
|
|
428
|
+
this.ForEntityName = "ARC";
|
|
429
|
+
}
|
|
430
|
+
parseEntity(e, t) {
|
|
431
|
+
let n = { type: t.value };
|
|
432
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
433
|
+
switch (t.code) {
|
|
434
|
+
case 10:
|
|
435
|
+
n.center = j(e);
|
|
436
|
+
break;
|
|
437
|
+
case 40:
|
|
438
|
+
n.radius = t.value;
|
|
439
|
+
break;
|
|
440
|
+
case 50:
|
|
441
|
+
n.startAngle = Math.PI / 180 * t.value;
|
|
442
|
+
break;
|
|
443
|
+
case 51:
|
|
444
|
+
n.endAngle = Math.PI / 180 * t.value, n.angleLength = n.endAngle - n.startAngle;
|
|
445
|
+
break;
|
|
446
|
+
case 210:
|
|
447
|
+
n.extrusionDirectionX = t.value;
|
|
448
|
+
break;
|
|
449
|
+
case 220:
|
|
450
|
+
n.extrusionDirectionY = t.value;
|
|
451
|
+
break;
|
|
452
|
+
case 230:
|
|
453
|
+
n.extrusionDirectionZ = t.value;
|
|
454
|
+
break;
|
|
455
|
+
default: M(n, t, e);
|
|
456
|
+
}
|
|
457
|
+
t = e.next();
|
|
458
|
+
}
|
|
459
|
+
return n;
|
|
460
|
+
}
|
|
461
|
+
}, I = class {
|
|
462
|
+
constructor() {
|
|
463
|
+
this.ForEntityName = "ATTDEF";
|
|
464
|
+
}
|
|
465
|
+
parseEntity(e, t) {
|
|
466
|
+
var n = {
|
|
467
|
+
type: t.value,
|
|
468
|
+
scale: 1,
|
|
469
|
+
textStyle: "STANDARD"
|
|
470
|
+
};
|
|
471
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
472
|
+
switch (t.code) {
|
|
473
|
+
case 1:
|
|
474
|
+
n.text = t.value;
|
|
475
|
+
break;
|
|
476
|
+
case 2:
|
|
477
|
+
n.tag = t.value;
|
|
478
|
+
break;
|
|
479
|
+
case 3:
|
|
480
|
+
n.prompt = t.value;
|
|
481
|
+
break;
|
|
482
|
+
case 7:
|
|
483
|
+
n.textStyle = t.value;
|
|
484
|
+
break;
|
|
485
|
+
case 10:
|
|
486
|
+
n.startPoint = j(e);
|
|
487
|
+
break;
|
|
488
|
+
case 11:
|
|
489
|
+
n.endPoint = j(e);
|
|
490
|
+
break;
|
|
491
|
+
case 39:
|
|
492
|
+
n.thickness = t.value;
|
|
493
|
+
break;
|
|
494
|
+
case 40:
|
|
495
|
+
n.textHeight = t.value;
|
|
496
|
+
break;
|
|
497
|
+
case 41:
|
|
498
|
+
n.scale = t.value;
|
|
499
|
+
break;
|
|
500
|
+
case 50:
|
|
501
|
+
n.rotation = t.value;
|
|
502
|
+
break;
|
|
503
|
+
case 51:
|
|
504
|
+
n.obliqueAngle = t.value;
|
|
505
|
+
break;
|
|
506
|
+
case 70:
|
|
507
|
+
n.invisible = !!(t.value & 1), n.constant = !!(t.value & 2), n.verificationRequired = !!(t.value & 4), n.preset = !!(t.value & 8);
|
|
508
|
+
break;
|
|
509
|
+
case 71:
|
|
510
|
+
n.backwards = !!(t.value & 2), n.mirrored = !!(t.value & 4);
|
|
511
|
+
break;
|
|
512
|
+
case 72:
|
|
513
|
+
n.horizontalJustification = t.value;
|
|
514
|
+
break;
|
|
515
|
+
case 73:
|
|
516
|
+
n.fieldLength = t.value;
|
|
517
|
+
break;
|
|
518
|
+
case 74:
|
|
519
|
+
n.verticalJustification = t.value;
|
|
520
|
+
break;
|
|
521
|
+
case 100: break;
|
|
522
|
+
case 210:
|
|
523
|
+
n.extrusionDirectionX = t.value;
|
|
524
|
+
break;
|
|
525
|
+
case 220:
|
|
526
|
+
n.extrusionDirectionY = t.value;
|
|
527
|
+
break;
|
|
528
|
+
case 230:
|
|
529
|
+
n.extrusionDirectionZ = t.value;
|
|
530
|
+
break;
|
|
531
|
+
default: M(n, t, e);
|
|
532
|
+
}
|
|
533
|
+
t = e.next();
|
|
534
|
+
}
|
|
535
|
+
return n;
|
|
536
|
+
}
|
|
537
|
+
}, L = class {
|
|
538
|
+
constructor() {
|
|
539
|
+
this.ForEntityName = "CIRCLE";
|
|
540
|
+
}
|
|
541
|
+
parseEntity(e, t) {
|
|
542
|
+
let n = { type: t.value };
|
|
543
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
544
|
+
switch (t.code) {
|
|
545
|
+
case 10:
|
|
546
|
+
n.center = j(e);
|
|
547
|
+
break;
|
|
548
|
+
case 40:
|
|
549
|
+
n.radius = t.value;
|
|
550
|
+
break;
|
|
551
|
+
case 50:
|
|
552
|
+
n.startAngle = Math.PI / 180 * t.value;
|
|
553
|
+
break;
|
|
554
|
+
case 51:
|
|
555
|
+
let r = Math.PI / 180 * t.value;
|
|
556
|
+
n.angleLength = r < n.startAngle ? r + 2 * Math.PI - n.startAngle : r - n.startAngle, n.endAngle = r;
|
|
557
|
+
break;
|
|
558
|
+
default: M(n, t, e);
|
|
559
|
+
}
|
|
560
|
+
t = e.next();
|
|
561
|
+
}
|
|
562
|
+
return n;
|
|
563
|
+
}
|
|
564
|
+
}, R = class {
|
|
565
|
+
constructor() {
|
|
566
|
+
this.ForEntityName = "DIMENSION";
|
|
567
|
+
}
|
|
568
|
+
parseEntity(e, t) {
|
|
569
|
+
let n = { type: t.value };
|
|
570
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
571
|
+
switch (t.code) {
|
|
572
|
+
case 2:
|
|
573
|
+
n.block = t.value;
|
|
574
|
+
break;
|
|
575
|
+
case 10:
|
|
576
|
+
n.anchorPoint = j(e);
|
|
577
|
+
break;
|
|
578
|
+
case 11:
|
|
579
|
+
n.middleOfText = j(e);
|
|
580
|
+
break;
|
|
581
|
+
case 12:
|
|
582
|
+
n.insertionPoint = j(e);
|
|
583
|
+
break;
|
|
584
|
+
case 13:
|
|
585
|
+
n.linearOrAngularPoint1 = j(e);
|
|
586
|
+
break;
|
|
587
|
+
case 14:
|
|
588
|
+
n.linearOrAngularPoint2 = j(e);
|
|
589
|
+
break;
|
|
590
|
+
case 15:
|
|
591
|
+
n.diameterOrRadiusPoint = j(e);
|
|
592
|
+
break;
|
|
593
|
+
case 16:
|
|
594
|
+
n.arcPoint = j(e);
|
|
595
|
+
break;
|
|
596
|
+
case 70:
|
|
597
|
+
n.dimensionType = t.value;
|
|
598
|
+
break;
|
|
599
|
+
case 71:
|
|
600
|
+
n.attachmentPoint = t.value;
|
|
601
|
+
break;
|
|
602
|
+
case 42:
|
|
603
|
+
n.actualMeasurement = t.value;
|
|
604
|
+
break;
|
|
605
|
+
case 1:
|
|
606
|
+
n.text = t.value;
|
|
607
|
+
break;
|
|
608
|
+
case 50:
|
|
609
|
+
n.angle = t.value;
|
|
610
|
+
break;
|
|
611
|
+
default: M(n, t, e);
|
|
612
|
+
}
|
|
613
|
+
t = e.next();
|
|
614
|
+
}
|
|
615
|
+
return n;
|
|
616
|
+
}
|
|
617
|
+
}, z = class {
|
|
618
|
+
constructor() {
|
|
619
|
+
this.ForEntityName = "ELLIPSE";
|
|
620
|
+
}
|
|
621
|
+
parseEntity(e, t) {
|
|
622
|
+
let n = { type: t.value };
|
|
623
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
624
|
+
switch (t.code) {
|
|
625
|
+
case 10:
|
|
626
|
+
n.center = j(e);
|
|
627
|
+
break;
|
|
628
|
+
case 11:
|
|
629
|
+
n.majorAxisEndPoint = j(e);
|
|
630
|
+
break;
|
|
631
|
+
case 40:
|
|
632
|
+
n.axisRatio = t.value;
|
|
633
|
+
break;
|
|
634
|
+
case 41:
|
|
635
|
+
n.startAngle = t.value;
|
|
636
|
+
break;
|
|
637
|
+
case 42:
|
|
638
|
+
n.endAngle = t.value;
|
|
639
|
+
break;
|
|
640
|
+
case 2:
|
|
641
|
+
n.name = t.value;
|
|
642
|
+
break;
|
|
643
|
+
default: M(n, t, e);
|
|
644
|
+
}
|
|
645
|
+
t = e.next();
|
|
646
|
+
}
|
|
647
|
+
return n;
|
|
648
|
+
}
|
|
649
|
+
}, B = class {
|
|
650
|
+
constructor() {
|
|
651
|
+
this.ForEntityName = "INSERT";
|
|
652
|
+
}
|
|
653
|
+
parseEntity(e, t) {
|
|
654
|
+
let n = { type: t.value };
|
|
655
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
656
|
+
switch (t.code) {
|
|
657
|
+
case 2:
|
|
658
|
+
n.name = t.value;
|
|
659
|
+
break;
|
|
660
|
+
case 41:
|
|
661
|
+
n.xScale = t.value;
|
|
662
|
+
break;
|
|
663
|
+
case 42:
|
|
664
|
+
n.yScale = t.value;
|
|
665
|
+
break;
|
|
666
|
+
case 43:
|
|
667
|
+
n.zScale = t.value;
|
|
668
|
+
break;
|
|
669
|
+
case 10:
|
|
670
|
+
n.position = j(e);
|
|
671
|
+
break;
|
|
672
|
+
case 50:
|
|
673
|
+
n.rotation = t.value;
|
|
674
|
+
break;
|
|
675
|
+
case 70:
|
|
676
|
+
n.columnCount = t.value;
|
|
677
|
+
break;
|
|
678
|
+
case 71:
|
|
679
|
+
n.rowCount = t.value;
|
|
680
|
+
break;
|
|
681
|
+
case 44:
|
|
682
|
+
n.columnSpacing = t.value;
|
|
683
|
+
break;
|
|
684
|
+
case 45:
|
|
685
|
+
n.rowSpacing = t.value;
|
|
686
|
+
break;
|
|
687
|
+
case 210:
|
|
688
|
+
n.extrusionDirection = j(e);
|
|
689
|
+
break;
|
|
690
|
+
default: M(n, t, e);
|
|
691
|
+
}
|
|
692
|
+
t = e.next();
|
|
693
|
+
}
|
|
694
|
+
return n;
|
|
695
|
+
}
|
|
696
|
+
}, te = class {
|
|
697
|
+
constructor() {
|
|
698
|
+
this.ForEntityName = "LINE";
|
|
699
|
+
}
|
|
700
|
+
parseEntity(e, t) {
|
|
701
|
+
let n = {
|
|
702
|
+
type: t.value,
|
|
703
|
+
vertices: []
|
|
704
|
+
};
|
|
705
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
706
|
+
switch (t.code) {
|
|
707
|
+
case 10:
|
|
708
|
+
n.vertices.unshift(j(e));
|
|
709
|
+
break;
|
|
710
|
+
case 11:
|
|
711
|
+
n.vertices.push(j(e));
|
|
712
|
+
break;
|
|
713
|
+
case 210:
|
|
714
|
+
n.extrusionDirection = j(e);
|
|
715
|
+
break;
|
|
716
|
+
case 100: break;
|
|
717
|
+
default: M(n, t, e);
|
|
718
|
+
}
|
|
719
|
+
t = e.next();
|
|
720
|
+
}
|
|
721
|
+
return n;
|
|
722
|
+
}
|
|
723
|
+
}, V = class {
|
|
724
|
+
constructor() {
|
|
725
|
+
this.ForEntityName = "LWPOLYLINE";
|
|
726
|
+
}
|
|
727
|
+
parseEntity(e, t) {
|
|
728
|
+
let n = {
|
|
729
|
+
type: t.value,
|
|
730
|
+
vertices: []
|
|
731
|
+
}, r = 0;
|
|
732
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
733
|
+
switch (t.code) {
|
|
734
|
+
case 38:
|
|
735
|
+
n.elevation = t.value;
|
|
736
|
+
break;
|
|
737
|
+
case 39:
|
|
738
|
+
n.depth = t.value;
|
|
739
|
+
break;
|
|
740
|
+
case 70:
|
|
741
|
+
n.shape = (t.value & 1) == 1, n.hasContinuousLinetypePattern = (t.value & 128) == 128;
|
|
742
|
+
break;
|
|
743
|
+
case 90:
|
|
744
|
+
r = t.value;
|
|
745
|
+
break;
|
|
746
|
+
case 10:
|
|
747
|
+
n.vertices = H(r, e);
|
|
748
|
+
break;
|
|
749
|
+
case 43:
|
|
750
|
+
t.value !== 0 && (n.width = t.value);
|
|
751
|
+
break;
|
|
752
|
+
case 210:
|
|
753
|
+
n.extrusionDirectionX = t.value;
|
|
754
|
+
break;
|
|
755
|
+
case 220:
|
|
756
|
+
n.extrusionDirectionY = t.value;
|
|
757
|
+
break;
|
|
758
|
+
case 230:
|
|
759
|
+
n.extrusionDirectionZ = t.value;
|
|
760
|
+
break;
|
|
761
|
+
default: M(n, t, e);
|
|
762
|
+
}
|
|
763
|
+
t = e.next();
|
|
764
|
+
}
|
|
765
|
+
return n;
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
function H(e, t) {
|
|
769
|
+
if (!e || e <= 0) throw Error("n must be greater than 0 verticies");
|
|
770
|
+
let n = [], r = !1, i = !1, a = t.lastReadGroup;
|
|
771
|
+
for (let o = 0; o < e; o++) {
|
|
772
|
+
let e = {};
|
|
773
|
+
for (; !t.isEOF() && !(a.code === 0 || i);) {
|
|
774
|
+
switch (a.code) {
|
|
775
|
+
case 10:
|
|
776
|
+
if (r) {
|
|
777
|
+
i = !0;
|
|
778
|
+
continue;
|
|
779
|
+
}
|
|
780
|
+
e.x = a.value, r = !0;
|
|
781
|
+
break;
|
|
782
|
+
case 20:
|
|
783
|
+
e.y = a.value;
|
|
784
|
+
break;
|
|
785
|
+
case 30:
|
|
786
|
+
e.z = a.value;
|
|
787
|
+
break;
|
|
788
|
+
case 40:
|
|
789
|
+
e.startWidth = a.value;
|
|
790
|
+
break;
|
|
791
|
+
case 41:
|
|
792
|
+
e.endWidth = a.value;
|
|
793
|
+
break;
|
|
794
|
+
case 42:
|
|
795
|
+
a.value != 0 && (e.bulge = a.value);
|
|
796
|
+
break;
|
|
797
|
+
default: return t.rewind(), r && n.push(e), t.rewind(), n;
|
|
798
|
+
}
|
|
799
|
+
a = t.next();
|
|
800
|
+
}
|
|
801
|
+
n.push(e), r = !1, i = !1;
|
|
802
|
+
}
|
|
803
|
+
return t.rewind(), n;
|
|
804
|
+
}
|
|
805
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/entities/mtext.js
|
|
806
|
+
var ne = class {
|
|
807
|
+
constructor() {
|
|
808
|
+
this.ForEntityName = "MTEXT";
|
|
809
|
+
}
|
|
810
|
+
parseEntity(e, t) {
|
|
811
|
+
let n = { type: t.value };
|
|
812
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
813
|
+
switch (t.code) {
|
|
814
|
+
case 3:
|
|
815
|
+
n.text ? n.text += t.value : n.text = t.value;
|
|
816
|
+
break;
|
|
817
|
+
case 1:
|
|
818
|
+
n.text ? n.text += t.value : n.text = t.value;
|
|
819
|
+
break;
|
|
820
|
+
case 10:
|
|
821
|
+
n.position = j(e);
|
|
822
|
+
break;
|
|
823
|
+
case 11:
|
|
824
|
+
n.directionVector = j(e);
|
|
825
|
+
break;
|
|
826
|
+
case 40:
|
|
827
|
+
n.height = t.value;
|
|
828
|
+
break;
|
|
829
|
+
case 41:
|
|
830
|
+
n.width = t.value;
|
|
831
|
+
break;
|
|
832
|
+
case 50:
|
|
833
|
+
n.rotation = t.value;
|
|
834
|
+
break;
|
|
835
|
+
case 71:
|
|
836
|
+
n.attachmentPoint = t.value;
|
|
837
|
+
break;
|
|
838
|
+
case 72:
|
|
839
|
+
n.drawingDirection = t.value;
|
|
840
|
+
break;
|
|
841
|
+
default: M(n, t, e);
|
|
842
|
+
}
|
|
843
|
+
t = e.next();
|
|
844
|
+
}
|
|
845
|
+
return n;
|
|
846
|
+
}
|
|
847
|
+
}, U = class {
|
|
848
|
+
constructor() {
|
|
849
|
+
this.ForEntityName = "POINT";
|
|
850
|
+
}
|
|
851
|
+
parseEntity(e, t) {
|
|
852
|
+
let n = { type: t.value };
|
|
853
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
854
|
+
switch (t.code) {
|
|
855
|
+
case 10:
|
|
856
|
+
n.position = j(e);
|
|
857
|
+
break;
|
|
858
|
+
case 39:
|
|
859
|
+
n.thickness = t.value;
|
|
860
|
+
break;
|
|
861
|
+
case 210:
|
|
862
|
+
n.extrusionDirection = j(e);
|
|
863
|
+
break;
|
|
864
|
+
case 100: break;
|
|
865
|
+
default: M(n, t, e);
|
|
866
|
+
}
|
|
867
|
+
t = e.next();
|
|
868
|
+
}
|
|
869
|
+
return n;
|
|
870
|
+
}
|
|
871
|
+
}, re = class {
|
|
872
|
+
constructor() {
|
|
873
|
+
this.ForEntityName = "VERTEX";
|
|
874
|
+
}
|
|
875
|
+
parseEntity(e, t) {
|
|
876
|
+
var n = { type: t.value };
|
|
877
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
878
|
+
switch (t.code) {
|
|
879
|
+
case 10:
|
|
880
|
+
n.x = t.value;
|
|
881
|
+
break;
|
|
882
|
+
case 20:
|
|
883
|
+
n.y = t.value;
|
|
884
|
+
break;
|
|
885
|
+
case 30:
|
|
886
|
+
n.z = t.value;
|
|
887
|
+
break;
|
|
888
|
+
case 40: break;
|
|
889
|
+
case 41: break;
|
|
890
|
+
case 42:
|
|
891
|
+
t.value != 0 && (n.bulge = t.value);
|
|
892
|
+
break;
|
|
893
|
+
case 70:
|
|
894
|
+
n.curveFittingVertex = !!(t.value & 1), n.curveFitTangent = !!(t.value & 2), n.splineVertex = !!(t.value & 8), n.splineControlPoint = !!(t.value & 16), n.threeDPolylineVertex = !!(t.value & 32), n.threeDPolylineMesh = !!(t.value & 64), n.polyfaceMeshVertex = !!(t.value & 128);
|
|
895
|
+
break;
|
|
896
|
+
case 50: break;
|
|
897
|
+
case 71:
|
|
898
|
+
n.faceA = t.value;
|
|
899
|
+
break;
|
|
900
|
+
case 72:
|
|
901
|
+
n.faceB = t.value;
|
|
902
|
+
break;
|
|
903
|
+
case 73:
|
|
904
|
+
n.faceC = t.value;
|
|
905
|
+
break;
|
|
906
|
+
case 74:
|
|
907
|
+
n.faceD = t.value;
|
|
908
|
+
break;
|
|
909
|
+
default: M(n, t, e);
|
|
910
|
+
}
|
|
911
|
+
t = e.next();
|
|
912
|
+
}
|
|
913
|
+
return n;
|
|
914
|
+
}
|
|
915
|
+
}, ie = class {
|
|
916
|
+
constructor() {
|
|
917
|
+
this.ForEntityName = "POLYLINE";
|
|
918
|
+
}
|
|
919
|
+
parseEntity(e, t) {
|
|
920
|
+
var n = {
|
|
921
|
+
type: t.value,
|
|
922
|
+
vertices: []
|
|
923
|
+
};
|
|
924
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
925
|
+
switch (t.code) {
|
|
926
|
+
case 10: break;
|
|
927
|
+
case 20: break;
|
|
928
|
+
case 30: break;
|
|
929
|
+
case 39:
|
|
930
|
+
n.thickness = t.value;
|
|
931
|
+
break;
|
|
932
|
+
case 40: break;
|
|
933
|
+
case 41: break;
|
|
934
|
+
case 70:
|
|
935
|
+
n.shape = !!(t.value & 1), n.includesCurveFitVertices = !!(t.value & 2), n.includesSplineFitVertices = !!(t.value & 4), n.is3dPolyline = !!(t.value & 8), n.is3dPolygonMesh = !!(t.value & 16), n.is3dPolygonMeshClosed = !!(t.value & 32), n.isPolyfaceMesh = !!(t.value & 64), n.hasContinuousLinetypePattern = !!(t.value & 128);
|
|
936
|
+
break;
|
|
937
|
+
case 71: break;
|
|
938
|
+
case 72: break;
|
|
939
|
+
case 73: break;
|
|
940
|
+
case 74: break;
|
|
941
|
+
case 75: break;
|
|
942
|
+
case 210:
|
|
943
|
+
n.extrusionDirection = j(e);
|
|
944
|
+
break;
|
|
945
|
+
default: M(n, t, e);
|
|
946
|
+
}
|
|
947
|
+
t = e.next();
|
|
948
|
+
}
|
|
949
|
+
return n.vertices = W(e, t), n;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
function W(e, t) {
|
|
953
|
+
let n = new re(), r = [];
|
|
954
|
+
for (; !e.isEOF();) if (t.code === 0) {
|
|
955
|
+
if (t.value === "VERTEX") r.push(n.parseEntity(e, t)), t = e.lastReadGroup;
|
|
956
|
+
else if (t.value === "SEQEND") {
|
|
957
|
+
G(e, t);
|
|
958
|
+
break;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return r;
|
|
962
|
+
}
|
|
963
|
+
function G(e, t) {
|
|
964
|
+
let n = { type: t.value };
|
|
965
|
+
for (t = e.next(); !e.isEOF() && t.code != 0;) M(n, t, e), t = e.next();
|
|
966
|
+
return n;
|
|
967
|
+
}
|
|
968
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/entities/solid.js
|
|
969
|
+
var K = class {
|
|
970
|
+
constructor() {
|
|
971
|
+
this.ForEntityName = "SOLID";
|
|
972
|
+
}
|
|
973
|
+
parseEntity(e, t) {
|
|
974
|
+
let n = {
|
|
975
|
+
type: t.value,
|
|
976
|
+
points: []
|
|
977
|
+
};
|
|
978
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
979
|
+
switch (t.code) {
|
|
980
|
+
case 10:
|
|
981
|
+
n.points[0] = j(e);
|
|
982
|
+
break;
|
|
983
|
+
case 11:
|
|
984
|
+
n.points[1] = j(e);
|
|
985
|
+
break;
|
|
986
|
+
case 12:
|
|
987
|
+
n.points[2] = j(e);
|
|
988
|
+
break;
|
|
989
|
+
case 13:
|
|
990
|
+
n.points[3] = j(e);
|
|
991
|
+
break;
|
|
992
|
+
case 210:
|
|
993
|
+
n.extrusionDirection = j(e);
|
|
994
|
+
break;
|
|
995
|
+
default: M(n, t, e);
|
|
996
|
+
}
|
|
997
|
+
t = e.next();
|
|
998
|
+
}
|
|
999
|
+
return n;
|
|
1000
|
+
}
|
|
1001
|
+
}, ae = class {
|
|
1002
|
+
constructor() {
|
|
1003
|
+
this.ForEntityName = "SPLINE";
|
|
1004
|
+
}
|
|
1005
|
+
parseEntity(e, t) {
|
|
1006
|
+
let n = { type: t.value };
|
|
1007
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
1008
|
+
switch (t.code) {
|
|
1009
|
+
case 10:
|
|
1010
|
+
n.controlPoints ||= [], n.controlPoints.push(j(e));
|
|
1011
|
+
break;
|
|
1012
|
+
case 11:
|
|
1013
|
+
n.fitPoints ||= [], n.fitPoints.push(j(e));
|
|
1014
|
+
break;
|
|
1015
|
+
case 12:
|
|
1016
|
+
n.startTangent = j(e);
|
|
1017
|
+
break;
|
|
1018
|
+
case 13:
|
|
1019
|
+
n.endTangent = j(e);
|
|
1020
|
+
break;
|
|
1021
|
+
case 40:
|
|
1022
|
+
n.knotValues ||= [], n.knotValues.push(t.value);
|
|
1023
|
+
break;
|
|
1024
|
+
case 70:
|
|
1025
|
+
t.value & 1 && (n.closed = !0), t.value & 2 && (n.periodic = !0), t.value & 4 && (n.rational = !0), t.value & 8 && (n.planar = !0), t.value & 16 && (n.planar = !0, n.linear = !0);
|
|
1026
|
+
break;
|
|
1027
|
+
case 71:
|
|
1028
|
+
n.degreeOfSplineCurve = t.value;
|
|
1029
|
+
break;
|
|
1030
|
+
case 72:
|
|
1031
|
+
n.numberOfKnots = t.value;
|
|
1032
|
+
break;
|
|
1033
|
+
case 73:
|
|
1034
|
+
n.numberOfControlPoints = t.value;
|
|
1035
|
+
break;
|
|
1036
|
+
case 74:
|
|
1037
|
+
n.numberOfFitPoints = t.value;
|
|
1038
|
+
break;
|
|
1039
|
+
case 210:
|
|
1040
|
+
n.normalVector = j(e);
|
|
1041
|
+
break;
|
|
1042
|
+
default: M(n, t, e);
|
|
1043
|
+
}
|
|
1044
|
+
t = e.next();
|
|
1045
|
+
}
|
|
1046
|
+
return n;
|
|
1047
|
+
}
|
|
1048
|
+
}, q = class {
|
|
1049
|
+
constructor() {
|
|
1050
|
+
this.ForEntityName = "TEXT";
|
|
1051
|
+
}
|
|
1052
|
+
parseEntity(e, t) {
|
|
1053
|
+
let n = { type: t.value };
|
|
1054
|
+
for (t = e.next(); !e.isEOF() && t.code !== 0;) {
|
|
1055
|
+
switch (t.code) {
|
|
1056
|
+
case 10:
|
|
1057
|
+
n.startPoint = j(e);
|
|
1058
|
+
break;
|
|
1059
|
+
case 11:
|
|
1060
|
+
n.endPoint = j(e);
|
|
1061
|
+
break;
|
|
1062
|
+
case 40:
|
|
1063
|
+
n.textHeight = t.value;
|
|
1064
|
+
break;
|
|
1065
|
+
case 41:
|
|
1066
|
+
n.xScale = t.value;
|
|
1067
|
+
break;
|
|
1068
|
+
case 50:
|
|
1069
|
+
n.rotation = t.value;
|
|
1070
|
+
break;
|
|
1071
|
+
case 1:
|
|
1072
|
+
n.text = t.value;
|
|
1073
|
+
break;
|
|
1074
|
+
case 72:
|
|
1075
|
+
n.halign = t.value;
|
|
1076
|
+
break;
|
|
1077
|
+
case 73:
|
|
1078
|
+
n.valign = t.value;
|
|
1079
|
+
break;
|
|
1080
|
+
default: M(n, t, e);
|
|
1081
|
+
}
|
|
1082
|
+
t = e.next();
|
|
1083
|
+
}
|
|
1084
|
+
return n;
|
|
1085
|
+
}
|
|
1086
|
+
}, J = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t, n) => {
|
|
1087
|
+
(function(e, n) {
|
|
1088
|
+
typeof define == "function" && define.amd ? define(n) : typeof t == "object" && t.exports ? t.exports = n() : e.log = n();
|
|
1089
|
+
})(n, function() {
|
|
1090
|
+
var e = function() {}, t = "undefined", n = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
|
|
1091
|
+
"trace",
|
|
1092
|
+
"debug",
|
|
1093
|
+
"info",
|
|
1094
|
+
"warn",
|
|
1095
|
+
"error"
|
|
1096
|
+
], i = {}, a = null;
|
|
1097
|
+
function o(e, t) {
|
|
1098
|
+
var n = e[t];
|
|
1099
|
+
if (typeof n.bind == "function") return n.bind(e);
|
|
1100
|
+
try {
|
|
1101
|
+
return Function.prototype.bind.call(n, e);
|
|
1102
|
+
} catch {
|
|
1103
|
+
return function() {
|
|
1104
|
+
return Function.prototype.apply.apply(n, [e, arguments]);
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
function s() {
|
|
1109
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
1110
|
+
}
|
|
1111
|
+
function c(r) {
|
|
1112
|
+
return r === "debug" && (r = "log"), typeof console === t ? !1 : r === "trace" && n ? s : console[r] === void 0 ? console.log === void 0 ? e : o(console, "log") : o(console, r);
|
|
1113
|
+
}
|
|
1114
|
+
function l() {
|
|
1115
|
+
for (var n = this.getLevel(), i = 0; i < r.length; i++) {
|
|
1116
|
+
var a = r[i];
|
|
1117
|
+
this[a] = i < n ? e : this.methodFactory(a, n, this.name);
|
|
1118
|
+
}
|
|
1119
|
+
if (this.log = this.debug, typeof console === t && n < this.levels.SILENT) return "No console available for logging";
|
|
1120
|
+
}
|
|
1121
|
+
function u(e) {
|
|
1122
|
+
return function() {
|
|
1123
|
+
typeof console !== t && (l.call(this), this[e].apply(this, arguments));
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function d(e, t, n) {
|
|
1127
|
+
return c(e) || u.apply(this, arguments);
|
|
1128
|
+
}
|
|
1129
|
+
function f(e, n) {
|
|
1130
|
+
var o = this, s, c, u, f = "loglevel";
|
|
1131
|
+
typeof e == "string" ? f += ":" + e : typeof e == "symbol" && (f = void 0);
|
|
1132
|
+
function p(e) {
|
|
1133
|
+
var n = (r[e] || "silent").toUpperCase();
|
|
1134
|
+
if (typeof window !== t && f) {
|
|
1135
|
+
try {
|
|
1136
|
+
window.localStorage[f] = n;
|
|
1137
|
+
return;
|
|
1138
|
+
} catch {}
|
|
1139
|
+
try {
|
|
1140
|
+
window.document.cookie = encodeURIComponent(f) + "=" + n + ";";
|
|
1141
|
+
} catch {}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
function m() {
|
|
1145
|
+
var e;
|
|
1146
|
+
if (typeof window !== t && f) {
|
|
1147
|
+
try {
|
|
1148
|
+
e = window.localStorage[f];
|
|
1149
|
+
} catch {}
|
|
1150
|
+
if (typeof e === t) try {
|
|
1151
|
+
var n = window.document.cookie, r = encodeURIComponent(f), i = n.indexOf(r + "=");
|
|
1152
|
+
i !== -1 && (e = /^([^;]+)/.exec(n.slice(i + r.length + 1))[1]);
|
|
1153
|
+
} catch {}
|
|
1154
|
+
return o.levels[e] === void 0 && (e = void 0), e;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
function h() {
|
|
1158
|
+
if (typeof window !== t && f) {
|
|
1159
|
+
try {
|
|
1160
|
+
window.localStorage.removeItem(f);
|
|
1161
|
+
} catch {}
|
|
1162
|
+
try {
|
|
1163
|
+
window.document.cookie = encodeURIComponent(f) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
1164
|
+
} catch {}
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
function g(e) {
|
|
1168
|
+
var t = e;
|
|
1169
|
+
if (typeof t == "string" && o.levels[t.toUpperCase()] !== void 0 && (t = o.levels[t.toUpperCase()]), typeof t == "number" && t >= 0 && t <= o.levels.SILENT) return t;
|
|
1170
|
+
throw TypeError("log.setLevel() called with invalid level: " + e);
|
|
1171
|
+
}
|
|
1172
|
+
o.name = e, o.levels = {
|
|
1173
|
+
TRACE: 0,
|
|
1174
|
+
DEBUG: 1,
|
|
1175
|
+
INFO: 2,
|
|
1176
|
+
WARN: 3,
|
|
1177
|
+
ERROR: 4,
|
|
1178
|
+
SILENT: 5
|
|
1179
|
+
}, o.methodFactory = n || d, o.getLevel = function() {
|
|
1180
|
+
return u ?? c ?? s;
|
|
1181
|
+
}, o.setLevel = function(e, t) {
|
|
1182
|
+
return u = g(e), t !== !1 && p(u), l.call(o);
|
|
1183
|
+
}, o.setDefaultLevel = function(e) {
|
|
1184
|
+
c = g(e), m() || o.setLevel(e, !1);
|
|
1185
|
+
}, o.resetLevel = function() {
|
|
1186
|
+
u = null, h(), l.call(o);
|
|
1187
|
+
}, o.enableAll = function(e) {
|
|
1188
|
+
o.setLevel(o.levels.TRACE, e);
|
|
1189
|
+
}, o.disableAll = function(e) {
|
|
1190
|
+
o.setLevel(o.levels.SILENT, e);
|
|
1191
|
+
}, o.rebuild = function() {
|
|
1192
|
+
if (a !== o && (s = g(a.getLevel())), l.call(o), a === o) for (var e in i) i[e].rebuild();
|
|
1193
|
+
}, s = g(a ? a.getLevel() : "WARN");
|
|
1194
|
+
var _ = m();
|
|
1195
|
+
_ != null && (u = g(_)), l.call(o);
|
|
1196
|
+
}
|
|
1197
|
+
a = new f(), a.getLogger = function(e) {
|
|
1198
|
+
if (typeof e != "symbol" && typeof e != "string" || e === "") throw TypeError("You must supply a name when creating a logger.");
|
|
1199
|
+
var t = i[e];
|
|
1200
|
+
return t ||= i[e] = new f(e, a.methodFactory), t;
|
|
1201
|
+
};
|
|
1202
|
+
var p = typeof window === t ? void 0 : window.log;
|
|
1203
|
+
return a.noConflict = function() {
|
|
1204
|
+
return typeof window !== t && window.log === a && (window.log = p), a;
|
|
1205
|
+
}, a.getLoggers = function() {
|
|
1206
|
+
return i;
|
|
1207
|
+
}, a.default = a, a;
|
|
1208
|
+
});
|
|
1209
|
+
})))());
|
|
1210
|
+
J.default.setLevel("error");
|
|
1211
|
+
function Y(e) {
|
|
1212
|
+
e.registerEntityHandler(N), e.registerEntityHandler(F), e.registerEntityHandler(I), e.registerEntityHandler(L), e.registerEntityHandler(R), e.registerEntityHandler(z), e.registerEntityHandler(B), e.registerEntityHandler(te), e.registerEntityHandler(V), e.registerEntityHandler(ne), e.registerEntityHandler(U), e.registerEntityHandler(ie), e.registerEntityHandler(K), e.registerEntityHandler(ae), e.registerEntityHandler(q);
|
|
1213
|
+
}
|
|
1214
|
+
var X = class {
|
|
1215
|
+
constructor() {
|
|
1216
|
+
this._entityHandlers = {}, Y(this);
|
|
1217
|
+
}
|
|
1218
|
+
parse(e) {
|
|
1219
|
+
return typeof e == "string" ? this._parse(e) : (console.error("Cannot read dxf source of type `" + typeof e), null);
|
|
1220
|
+
}
|
|
1221
|
+
registerEntityHandler(e) {
|
|
1222
|
+
let t = new e();
|
|
1223
|
+
this._entityHandlers[t.ForEntityName] = t;
|
|
1224
|
+
}
|
|
1225
|
+
parseSync(e) {
|
|
1226
|
+
return this.parse(e);
|
|
1227
|
+
}
|
|
1228
|
+
parseStream(e) {
|
|
1229
|
+
let t = "", n = this;
|
|
1230
|
+
return new Promise((r, i) => {
|
|
1231
|
+
e.on("data", (e) => {
|
|
1232
|
+
t += e;
|
|
1233
|
+
}), e.on("end", () => {
|
|
1234
|
+
try {
|
|
1235
|
+
r(n._parse(t));
|
|
1236
|
+
} catch (e) {
|
|
1237
|
+
i(e);
|
|
1238
|
+
}
|
|
1239
|
+
}), e.on("error", (e) => {
|
|
1240
|
+
i(e);
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
_parse(e) {
|
|
1245
|
+
let t = {}, n = 0, r = new E(e.split(/\r\n|\r|\n/g));
|
|
1246
|
+
if (!r.hasNext()) throw Error("Empty file");
|
|
1247
|
+
let i = this, a;
|
|
1248
|
+
function o() {
|
|
1249
|
+
for (a = r.next(); !r.isEOF();) if (a.code === 0 && a.value === "SECTION") {
|
|
1250
|
+
if (a = r.next(), a.code !== 2) {
|
|
1251
|
+
console.error("Unexpected code %s after 0:SECTION", $(a)), a = r.next();
|
|
1252
|
+
continue;
|
|
1253
|
+
}
|
|
1254
|
+
a.value === "HEADER" ? (J.default.debug("> HEADER"), t.header = s(), J.default.debug("<")) : a.value === "BLOCKS" ? (J.default.debug("> BLOCKS"), t.blocks = c(), J.default.debug("<")) : a.value === "ENTITIES" ? (J.default.debug("> ENTITIES"), t.entities = _(!1), J.default.debug("<")) : a.value === "TABLES" ? (J.default.debug("> TABLES"), t.tables = u(), J.default.debug("<")) : a.value === "EOF" ? J.default.debug("EOF") : J.default.warn("Skipping section '%s'", a.value);
|
|
1255
|
+
} else a = r.next();
|
|
1256
|
+
}
|
|
1257
|
+
function s() {
|
|
1258
|
+
let e = null, t = null, n = {};
|
|
1259
|
+
for (a = r.next();;) {
|
|
1260
|
+
if (Z(a, 0, "ENDSEC")) {
|
|
1261
|
+
e && (n[e] = t);
|
|
1262
|
+
break;
|
|
1263
|
+
}
|
|
1264
|
+
a.code === 9 ? (e && (n[e] = t), e = a.value) : a.code === 10 ? t = { x: a.value } : a.code === 20 ? t.y = a.value : a.code === 30 ? t.z = a.value : t = a.value, a = r.next();
|
|
1265
|
+
}
|
|
1266
|
+
return a = r.next(), n;
|
|
1267
|
+
}
|
|
1268
|
+
function c() {
|
|
1269
|
+
let e = {};
|
|
1270
|
+
for (a = r.next(); a.value !== "EOF" && !Z(a, 0, "ENDSEC");) if (Z(a, 0, "BLOCK")) {
|
|
1271
|
+
J.default.debug("block {");
|
|
1272
|
+
let t = l();
|
|
1273
|
+
J.default.debug("}"), y(t), t.name ? e[t.name] = t : J.default.error("block with handle \"" + t.handle + "\" is missing a name.");
|
|
1274
|
+
} else Q(a), a = r.next();
|
|
1275
|
+
return e;
|
|
1276
|
+
}
|
|
1277
|
+
function l() {
|
|
1278
|
+
let e = {};
|
|
1279
|
+
for (a = r.next(); a.value !== "EOF";) {
|
|
1280
|
+
switch (a.code) {
|
|
1281
|
+
case 1:
|
|
1282
|
+
e.xrefPath = a.value, a = r.next();
|
|
1283
|
+
break;
|
|
1284
|
+
case 2:
|
|
1285
|
+
e.name = a.value, a = r.next();
|
|
1286
|
+
break;
|
|
1287
|
+
case 3:
|
|
1288
|
+
e.name2 = a.value, a = r.next();
|
|
1289
|
+
break;
|
|
1290
|
+
case 5:
|
|
1291
|
+
e.handle = a.value, a = r.next();
|
|
1292
|
+
break;
|
|
1293
|
+
case 8:
|
|
1294
|
+
e.layer = a.value, a = r.next();
|
|
1295
|
+
break;
|
|
1296
|
+
case 10:
|
|
1297
|
+
e.position = v(a), a = r.next();
|
|
1298
|
+
break;
|
|
1299
|
+
case 67:
|
|
1300
|
+
e.paperSpace = !!(a.value && a.value == 1), a = r.next();
|
|
1301
|
+
break;
|
|
1302
|
+
case 70:
|
|
1303
|
+
a.value != 0 && (e.type = a.value), a = r.next();
|
|
1304
|
+
break;
|
|
1305
|
+
case 100:
|
|
1306
|
+
a = r.next();
|
|
1307
|
+
break;
|
|
1308
|
+
case 330:
|
|
1309
|
+
e.ownerHandle = a.value, a = r.next();
|
|
1310
|
+
break;
|
|
1311
|
+
case 0:
|
|
1312
|
+
if (a.value == "ENDBLK") break;
|
|
1313
|
+
e.entities = _(!0);
|
|
1314
|
+
break;
|
|
1315
|
+
default: Q(a), a = r.next();
|
|
1316
|
+
}
|
|
1317
|
+
if (Z(a, 0, "ENDBLK")) {
|
|
1318
|
+
a = r.next();
|
|
1319
|
+
break;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return e;
|
|
1323
|
+
}
|
|
1324
|
+
function u() {
|
|
1325
|
+
let e = {};
|
|
1326
|
+
for (a = r.next(); a.value !== "EOF" && !Z(a, 0, "ENDSEC");) Z(a, 0, "TABLE") ? (a = r.next(), g[a.value] ? (J.default.debug(a.value + " Table {"), e[g[a.value].tableName] = f(a), J.default.debug("}")) : J.default.debug("Unhandled Table " + a.value)) : a = r.next();
|
|
1327
|
+
return a = r.next(), e;
|
|
1328
|
+
}
|
|
1329
|
+
let d = "ENDTAB";
|
|
1330
|
+
function f(e) {
|
|
1331
|
+
let t = g[e.value], n = {}, i = 0;
|
|
1332
|
+
for (a = r.next(); !Z(a, 0, d);) switch (a.code) {
|
|
1333
|
+
case 5:
|
|
1334
|
+
n.handle = a.value, a = r.next();
|
|
1335
|
+
break;
|
|
1336
|
+
case 330:
|
|
1337
|
+
n.ownerHandle = a.value, a = r.next();
|
|
1338
|
+
break;
|
|
1339
|
+
case 100:
|
|
1340
|
+
a.value === "AcDbSymbolTable" || Q(a), a = r.next();
|
|
1341
|
+
break;
|
|
1342
|
+
case 70:
|
|
1343
|
+
i = a.value, a = r.next();
|
|
1344
|
+
break;
|
|
1345
|
+
case 0:
|
|
1346
|
+
a.value === t.dxfSymbolName ? n[t.tableRecordsProperty] = t.parseTableRecords() : (Q(a), a = r.next());
|
|
1347
|
+
break;
|
|
1348
|
+
default: Q(a), a = r.next();
|
|
1349
|
+
}
|
|
1350
|
+
let o = n[t.tableRecordsProperty];
|
|
1351
|
+
if (o) {
|
|
1352
|
+
let e = (() => {
|
|
1353
|
+
if (o.constructor === Array) return o.length;
|
|
1354
|
+
if (typeof o == "object") return Object.keys(o).length;
|
|
1355
|
+
})();
|
|
1356
|
+
i !== e && J.default.warn("Parsed " + e + " " + t.dxfSymbolName + "'s but expected " + i);
|
|
1357
|
+
}
|
|
1358
|
+
return a = r.next(), n;
|
|
1359
|
+
}
|
|
1360
|
+
function p() {
|
|
1361
|
+
let e = [], t = {};
|
|
1362
|
+
for (J.default.debug("ViewPort {"), a = r.next(); !Z(a, 0, d);) switch (a.code) {
|
|
1363
|
+
case 2:
|
|
1364
|
+
t.name = a.value, a = r.next();
|
|
1365
|
+
break;
|
|
1366
|
+
case 10:
|
|
1367
|
+
t.lowerLeftCorner = v(a), a = r.next();
|
|
1368
|
+
break;
|
|
1369
|
+
case 11:
|
|
1370
|
+
t.upperRightCorner = v(a), a = r.next();
|
|
1371
|
+
break;
|
|
1372
|
+
case 12:
|
|
1373
|
+
t.center = v(a), a = r.next();
|
|
1374
|
+
break;
|
|
1375
|
+
case 13:
|
|
1376
|
+
t.snapBasePoint = v(a), a = r.next();
|
|
1377
|
+
break;
|
|
1378
|
+
case 14:
|
|
1379
|
+
t.snapSpacing = v(a), a = r.next();
|
|
1380
|
+
break;
|
|
1381
|
+
case 15:
|
|
1382
|
+
t.gridSpacing = v(a), a = r.next();
|
|
1383
|
+
break;
|
|
1384
|
+
case 16:
|
|
1385
|
+
t.viewDirectionFromTarget = v(a), a = r.next();
|
|
1386
|
+
break;
|
|
1387
|
+
case 17:
|
|
1388
|
+
t.viewTarget = v(a), a = r.next();
|
|
1389
|
+
break;
|
|
1390
|
+
case 42:
|
|
1391
|
+
t.lensLength = a.value, a = r.next();
|
|
1392
|
+
break;
|
|
1393
|
+
case 43:
|
|
1394
|
+
t.frontClippingPlane = a.value, a = r.next();
|
|
1395
|
+
break;
|
|
1396
|
+
case 44:
|
|
1397
|
+
t.backClippingPlane = a.value, a = r.next();
|
|
1398
|
+
break;
|
|
1399
|
+
case 45:
|
|
1400
|
+
t.viewHeight = a.value, a = r.next();
|
|
1401
|
+
break;
|
|
1402
|
+
case 50:
|
|
1403
|
+
t.snapRotationAngle = a.value, a = r.next();
|
|
1404
|
+
break;
|
|
1405
|
+
case 51:
|
|
1406
|
+
t.viewTwistAngle = a.value, a = r.next();
|
|
1407
|
+
break;
|
|
1408
|
+
case 79:
|
|
1409
|
+
t.orthographicType = a.value, a = r.next();
|
|
1410
|
+
break;
|
|
1411
|
+
case 110:
|
|
1412
|
+
t.ucsOrigin = v(a), a = r.next();
|
|
1413
|
+
break;
|
|
1414
|
+
case 111:
|
|
1415
|
+
t.ucsXAxis = v(a), a = r.next();
|
|
1416
|
+
break;
|
|
1417
|
+
case 112:
|
|
1418
|
+
t.ucsYAxis = v(a), a = r.next();
|
|
1419
|
+
break;
|
|
1420
|
+
case 110:
|
|
1421
|
+
t.ucsOrigin = v(a), a = r.next();
|
|
1422
|
+
break;
|
|
1423
|
+
case 281:
|
|
1424
|
+
t.renderMode = a.value, a = r.next();
|
|
1425
|
+
break;
|
|
1426
|
+
case 281:
|
|
1427
|
+
t.defaultLightingType = a.value, a = r.next();
|
|
1428
|
+
break;
|
|
1429
|
+
case 292:
|
|
1430
|
+
t.defaultLightingOn = a.value, a = r.next();
|
|
1431
|
+
break;
|
|
1432
|
+
case 330:
|
|
1433
|
+
t.ownerHandle = a.value, a = r.next();
|
|
1434
|
+
break;
|
|
1435
|
+
case 63:
|
|
1436
|
+
case 421:
|
|
1437
|
+
case 431:
|
|
1438
|
+
t.ambientColor = a.value, a = r.next();
|
|
1439
|
+
break;
|
|
1440
|
+
case 0:
|
|
1441
|
+
a.value === "VPORT" && (J.default.debug("}"), e.push(t), J.default.debug("ViewPort {"), t = {}, a = r.next());
|
|
1442
|
+
break;
|
|
1443
|
+
default: Q(a), a = r.next();
|
|
1444
|
+
}
|
|
1445
|
+
return J.default.debug("}"), e.push(t), e;
|
|
1446
|
+
}
|
|
1447
|
+
function m() {
|
|
1448
|
+
let e = {}, t = {}, n = 0, i;
|
|
1449
|
+
for (J.default.debug("LType {"), a = r.next(); !Z(a, 0, "ENDTAB");) switch (a.code) {
|
|
1450
|
+
case 2:
|
|
1451
|
+
t.name = a.value, i = a.value, a = r.next();
|
|
1452
|
+
break;
|
|
1453
|
+
case 3:
|
|
1454
|
+
t.description = a.value, a = r.next();
|
|
1455
|
+
break;
|
|
1456
|
+
case 73:
|
|
1457
|
+
n = a.value, n > 0 && (t.pattern = []), a = r.next();
|
|
1458
|
+
break;
|
|
1459
|
+
case 40:
|
|
1460
|
+
t.patternLength = a.value, a = r.next();
|
|
1461
|
+
break;
|
|
1462
|
+
case 49:
|
|
1463
|
+
t.pattern.push(a.value), a = r.next();
|
|
1464
|
+
break;
|
|
1465
|
+
case 0:
|
|
1466
|
+
J.default.debug("}"), n > 0 && n !== t.pattern.length && J.default.warn("lengths do not match on LTYPE pattern"), e[i] = t, t = {}, J.default.debug("LType {"), a = r.next();
|
|
1467
|
+
break;
|
|
1468
|
+
default: a = r.next();
|
|
1469
|
+
}
|
|
1470
|
+
return J.default.debug("}"), e[i] = t, e;
|
|
1471
|
+
}
|
|
1472
|
+
function h() {
|
|
1473
|
+
let e = {}, t = {}, n;
|
|
1474
|
+
for (J.default.debug("Layer {"), a = r.next(); !Z(a, 0, "ENDTAB");) switch (a.code) {
|
|
1475
|
+
case 2:
|
|
1476
|
+
t.name = a.value, n = a.value, a = r.next();
|
|
1477
|
+
break;
|
|
1478
|
+
case 62:
|
|
1479
|
+
t.visible = a.value >= 0, t.colorIndex = Math.abs(a.value), t.color = oe(t.colorIndex), a = r.next();
|
|
1480
|
+
break;
|
|
1481
|
+
case 70:
|
|
1482
|
+
t.frozen = !!(a.value & 1) || !!(a.value & 2), a = r.next();
|
|
1483
|
+
break;
|
|
1484
|
+
case 0:
|
|
1485
|
+
a.value === "LAYER" && (J.default.debug("}"), e[n] = t, J.default.debug("Layer {"), t = {}, n = void 0, a = r.next());
|
|
1486
|
+
break;
|
|
1487
|
+
default: Q(a), a = r.next();
|
|
1488
|
+
}
|
|
1489
|
+
return J.default.debug("}"), e[n] = t, e;
|
|
1490
|
+
}
|
|
1491
|
+
let g = {
|
|
1492
|
+
VPORT: {
|
|
1493
|
+
tableRecordsProperty: "viewPorts",
|
|
1494
|
+
tableName: "viewPort",
|
|
1495
|
+
dxfSymbolName: "VPORT",
|
|
1496
|
+
parseTableRecords: p
|
|
1497
|
+
},
|
|
1498
|
+
LTYPE: {
|
|
1499
|
+
tableRecordsProperty: "lineTypes",
|
|
1500
|
+
tableName: "lineType",
|
|
1501
|
+
dxfSymbolName: "LTYPE",
|
|
1502
|
+
parseTableRecords: m
|
|
1503
|
+
},
|
|
1504
|
+
LAYER: {
|
|
1505
|
+
tableRecordsProperty: "layers",
|
|
1506
|
+
tableName: "layer",
|
|
1507
|
+
dxfSymbolName: "LAYER",
|
|
1508
|
+
parseTableRecords: h
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
function _(e) {
|
|
1512
|
+
let t = [], n = e ? "ENDBLK" : "ENDSEC";
|
|
1513
|
+
for (e || (a = r.next());;) if (a.code === 0) {
|
|
1514
|
+
if (a.value === n) break;
|
|
1515
|
+
let e = i._entityHandlers[a.value];
|
|
1516
|
+
if (e != null) {
|
|
1517
|
+
J.default.debug(a.value + " {");
|
|
1518
|
+
let n = e.parseEntity(r, a);
|
|
1519
|
+
a = r.lastReadGroup, J.default.debug("}"), y(n), t.push(n);
|
|
1520
|
+
} else {
|
|
1521
|
+
J.default.warn("Unhandled entity " + a.value), a = r.next();
|
|
1522
|
+
continue;
|
|
1523
|
+
}
|
|
1524
|
+
} else a = r.next();
|
|
1525
|
+
return n == "ENDSEC" && (a = r.next()), t;
|
|
1526
|
+
}
|
|
1527
|
+
function v(e) {
|
|
1528
|
+
let t = {}, n = e.code;
|
|
1529
|
+
if (t.x = e.value, n += 10, e = r.next(), e.code != n) throw Error("Expected code for point value to be " + n + " but got " + e.code + ".");
|
|
1530
|
+
return t.y = e.value, n += 10, e = r.next(), e.code == n ? (t.z = e.value, t) : (r.rewind(), t);
|
|
1531
|
+
}
|
|
1532
|
+
function y(e) {
|
|
1533
|
+
if (!e) throw TypeError("entity cannot be undefined or null");
|
|
1534
|
+
e.handle ||= n++;
|
|
1535
|
+
}
|
|
1536
|
+
return o(), t;
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
function Z(e, t, n) {
|
|
1540
|
+
return e.code === t && e.value === n;
|
|
1541
|
+
}
|
|
1542
|
+
function Q(e) {
|
|
1543
|
+
J.default.debug("unhandled group " + $(e));
|
|
1544
|
+
}
|
|
1545
|
+
function $(e) {
|
|
1546
|
+
return e.code + ":" + e.value;
|
|
1547
|
+
}
|
|
1548
|
+
function oe(e) {
|
|
1549
|
+
return k[e];
|
|
1550
|
+
}
|
|
1551
|
+
// node_modules/.pnpm/dxf-parser@1.1.2/node_modules/dxf-parser/dist/index.js
|
|
1552
|
+
var se = X, ce = { class: "fv-cad" }, le = {
|
|
1553
|
+
key: 0,
|
|
1554
|
+
class: "fv-cad-loading"
|
|
1555
|
+
}, ue = /*#__PURE__*/ _(/* @__PURE__ */ x({
|
|
1556
|
+
__name: "CadRenderer",
|
|
1557
|
+
props: {
|
|
1558
|
+
source: {},
|
|
1559
|
+
options: {},
|
|
1560
|
+
viewportWidth: {},
|
|
1561
|
+
viewportHeight: {}
|
|
1562
|
+
},
|
|
1563
|
+
emits: [
|
|
1564
|
+
"ready",
|
|
1565
|
+
"error",
|
|
1566
|
+
"zoom-change"
|
|
1567
|
+
],
|
|
1568
|
+
setup(e, { expose: t, emit: _ }) {
|
|
1569
|
+
let x = e, E = _, D = T(null), O = T(""), k = null, A = null, j = null, M = null, N = null, P = !1, F = 1, I = 10, L = 10, R = 0, z = 0, B = [];
|
|
1570
|
+
function te(e, t, n) {
|
|
1571
|
+
let r = e.color;
|
|
1572
|
+
if (typeof r == "number" && r > 0) return `#${(r & 16777215).toString(16).padStart(6, "0")}`;
|
|
1573
|
+
let i = e.layer;
|
|
1574
|
+
return i && t.get(i) || n;
|
|
1575
|
+
}
|
|
1576
|
+
function V(e, t, n, r = 12) {
|
|
1577
|
+
let i = t.x - e.x, a = t.y - e.y, o = Math.hypot(i, a);
|
|
1578
|
+
if (!n || o < 1e-9) return [e, t];
|
|
1579
|
+
let s = 4 * Math.atan(n), c = Math.abs(o / (2 * Math.sin(s / 2))), l = (e.x + t.x) / 2, u = (e.y + t.y) / 2, d = Math.sqrt(Math.max(0, c * c - (o / 2) ** 2)), f = -a / o, p = i / o, m = n > 0 ? 1 : -1, h = l + f * d * m, g = u + p * d * m, _ = Math.atan2(e.y - g, e.x - h), v = s, y = Math.max(4, r), b = [];
|
|
1580
|
+
for (let e = 0; e <= y; e += 1) {
|
|
1581
|
+
let t = _ + v * e / y;
|
|
1582
|
+
b.push({
|
|
1583
|
+
x: h + Math.cos(t) * c,
|
|
1584
|
+
y: g + Math.sin(t) * c
|
|
1585
|
+
});
|
|
1586
|
+
}
|
|
1587
|
+
return b;
|
|
1588
|
+
}
|
|
1589
|
+
function H(e, t, n, r, i, a, o, s = 64) {
|
|
1590
|
+
let c = [], l = o > a ? o - a : o - a + Math.PI * 2, u = Math.cos(i), d = Math.sin(i);
|
|
1591
|
+
for (let i = 0; i <= s; i += 1) {
|
|
1592
|
+
let o = a + l * i / s, f = Math.cos(o) * n, p = Math.sin(o) * r;
|
|
1593
|
+
c.push({
|
|
1594
|
+
x: e + f * u - p * d,
|
|
1595
|
+
y: t + f * d + p * u
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
return c;
|
|
1599
|
+
}
|
|
1600
|
+
let ne = [
|
|
1601
|
+
1,
|
|
1602
|
+
0,
|
|
1603
|
+
0,
|
|
1604
|
+
1,
|
|
1605
|
+
0,
|
|
1606
|
+
0
|
|
1607
|
+
];
|
|
1608
|
+
function U(e, t) {
|
|
1609
|
+
return {
|
|
1610
|
+
x: e[0] * t.x + e[2] * t.y + e[4],
|
|
1611
|
+
y: e[1] * t.x + e[3] * t.y + e[5]
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
function re(e, t) {
|
|
1615
|
+
return [
|
|
1616
|
+
e[0] * t[0] + e[2] * t[1],
|
|
1617
|
+
e[1] * t[0] + e[3] * t[1],
|
|
1618
|
+
e[0] * t[2] + e[2] * t[3],
|
|
1619
|
+
e[1] * t[2] + e[3] * t[3],
|
|
1620
|
+
e[0] * t[4] + e[2] * t[5] + e[4],
|
|
1621
|
+
e[1] * t[4] + e[3] * t[5] + e[5]
|
|
1622
|
+
];
|
|
1623
|
+
}
|
|
1624
|
+
function ie(e) {
|
|
1625
|
+
return {
|
|
1626
|
+
positions: [],
|
|
1627
|
+
colors: [],
|
|
1628
|
+
texts: [],
|
|
1629
|
+
lineColor: e
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
function W(e, t, n, r) {
|
|
1633
|
+
e.positions.push(t.x, t.y, 0, n.x, n.y, 0);
|
|
1634
|
+
let i = new s(r);
|
|
1635
|
+
for (let t = 0; t < 2; t += 1) e.colors.push(i.r, i.g, i.b);
|
|
1636
|
+
}
|
|
1637
|
+
function G(e, t, n, r = !1) {
|
|
1638
|
+
for (let r = 0; r < t.length - 1; r += 1) W(e, t[r], t[r + 1], n);
|
|
1639
|
+
r && t.length > 2 && W(e, t[t.length - 1], t[0], n);
|
|
1640
|
+
}
|
|
1641
|
+
function K(e, t, n, r, i, a = 0) {
|
|
1642
|
+
for (let o of e) {
|
|
1643
|
+
if (o.visible === !1) continue;
|
|
1644
|
+
let e = te(o, i, t.lineColor), s = String(o.type);
|
|
1645
|
+
if (s === "LINE" && o.vertices?.length >= 2) W(t, U(n, o.vertices[0]), U(n, o.vertices[1]), e);
|
|
1646
|
+
else if (s === "LWPOLYLINE" || s === "POLYLINE") {
|
|
1647
|
+
let r = o.vertices || [];
|
|
1648
|
+
if (!r.length) continue;
|
|
1649
|
+
let i = [U(n, r[0])];
|
|
1650
|
+
for (let e = 0; e < r.length - 1; e += 1) {
|
|
1651
|
+
let t = r[e], a = r[e + 1], o = U(n, t), s = U(n, a);
|
|
1652
|
+
Number(t.bulge) ? i.push(...V(o, s, Number(t.bulge)).slice(1)) : i.push(s);
|
|
1653
|
+
}
|
|
1654
|
+
if ((o.shape || o.flagsClosed) && r.length > 2) {
|
|
1655
|
+
let e = U(n, r[r.length - 1]), t = U(n, r[0]);
|
|
1656
|
+
Number(r[r.length - 1].bulge) ? i.push(...V(e, t, Number(r[r.length - 1].bulge)).slice(1)) : i.push(t);
|
|
1657
|
+
}
|
|
1658
|
+
G(t, i, e);
|
|
1659
|
+
} else if (s === "CIRCLE" && o.center) {
|
|
1660
|
+
let r = U(n, o.center), i = Math.abs(Number(o.radius) || 0) * Math.hypot(n[0], n[1]);
|
|
1661
|
+
G(t, H(r.x, r.y, i, i, 0, 0, Math.PI * 2, 56), e);
|
|
1662
|
+
} else if (s === "ARC" && o.center) {
|
|
1663
|
+
let r = U(n, o.center), i = Math.abs(Number(o.radius) || 0) * Math.hypot(n[0], n[1]), a = Number(o.startAngle) || 0, s = Number(o.endAngle) || 0;
|
|
1664
|
+
G(t, H(r.x, r.y, i, i, 0, a, s, Math.max(8, Math.abs(s - a) * 12)), e);
|
|
1665
|
+
} else if (s === "ELLIPSE" && o.center && o.majorAxisEndPoint) {
|
|
1666
|
+
let r = U(n, o.center), i = o.majorAxisEndPoint, a = Math.hypot(i.x, i.y), s = a * (Number(o.axisRatio) || 1), c = Math.atan2(i.y, i.x);
|
|
1667
|
+
G(t, H(r.x, r.y, a, s, c, Number(o.startAngle) || 0, Number(o.endAngle) || Math.PI * 2, 64), e);
|
|
1668
|
+
} else if (s === "SPLINE") {
|
|
1669
|
+
let r = (o.fitPoints?.length ? o.fitPoints : o.controlPoints) || [];
|
|
1670
|
+
if (r.length < 2) continue;
|
|
1671
|
+
let i = r.map((e) => U(n, e));
|
|
1672
|
+
G(t, new d(i.map((e) => new h(e.x, e.y, 0))).getPoints(Math.min(160, Math.max(24, i.length * 6))).map((e) => ({
|
|
1673
|
+
x: e.x,
|
|
1674
|
+
y: e.y
|
|
1675
|
+
})), e);
|
|
1676
|
+
} else if ((s === "SOLID" || s === "3DFACE") && (o.points || o.vertices)) G(t, (o.points || o.vertices).map((e) => U(n, e)), e, !0);
|
|
1677
|
+
else if (s === "POINT" && o.position) {
|
|
1678
|
+
let r = U(n, o.position), i = Math.max(I, L) * .004;
|
|
1679
|
+
W(t, {
|
|
1680
|
+
x: r.x - i,
|
|
1681
|
+
y: r.y
|
|
1682
|
+
}, {
|
|
1683
|
+
x: r.x + i,
|
|
1684
|
+
y: r.y
|
|
1685
|
+
}, e), W(t, {
|
|
1686
|
+
x: r.x,
|
|
1687
|
+
y: r.y - i
|
|
1688
|
+
}, {
|
|
1689
|
+
x: r.x,
|
|
1690
|
+
y: r.y + i
|
|
1691
|
+
}, e);
|
|
1692
|
+
} else if (s === "TEXT" || s === "MTEXT" || s === "ATTDEF") {
|
|
1693
|
+
let r = o.startPoint || o.position;
|
|
1694
|
+
if (!r || !o.text) continue;
|
|
1695
|
+
let i = U(n, r), a = Math.hypot(n[0], n[1]), s = (Number(o.rotation) || 0) * (Math.PI / 180);
|
|
1696
|
+
t.texts.push({
|
|
1697
|
+
x: i.x,
|
|
1698
|
+
y: i.y,
|
|
1699
|
+
text: String(o.text),
|
|
1700
|
+
height: Math.abs(Number(o.textHeight ?? o.height) || 2) * a,
|
|
1701
|
+
rotation: s + Math.atan2(n[1], n[0]),
|
|
1702
|
+
color: e
|
|
1703
|
+
});
|
|
1704
|
+
} else if (s === "INSERT" && typeof o.name == "string" && a < 4) {
|
|
1705
|
+
let e = r[o.name];
|
|
1706
|
+
if (!e?.entities?.length) continue;
|
|
1707
|
+
let s = Number(o.xScale) || 1, c = Number(o.yScale) || 1, l = (Number(o.rotation) || 0) * (Math.PI / 180), u = o.position || {
|
|
1708
|
+
x: 0,
|
|
1709
|
+
y: 0
|
|
1710
|
+
}, d = Math.cos(l), f = Math.sin(l), p = [
|
|
1711
|
+
s * d,
|
|
1712
|
+
s * f,
|
|
1713
|
+
-c * f,
|
|
1714
|
+
c * d,
|
|
1715
|
+
u.x,
|
|
1716
|
+
u.y
|
|
1717
|
+
];
|
|
1718
|
+
K(e.entities, t, re(n, p), r, i, a + 1);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
function ae(e, t, n) {
|
|
1723
|
+
let r = [];
|
|
1724
|
+
for (let i of e) {
|
|
1725
|
+
let e = document.createElement("canvas"), a = e.getContext("2d");
|
|
1726
|
+
if (!a) continue;
|
|
1727
|
+
a.font = "48px system-ui, sans-serif";
|
|
1728
|
+
let s = a.measureText(i.text);
|
|
1729
|
+
e.width = Math.max(8, Math.ceil(s.width) + 16), e.height = 72, a.font = "48px system-ui, sans-serif", a.fillStyle = i.color, a.textBaseline = "middle", a.fillText(i.text, 8, e.height / 2);
|
|
1730
|
+
let c = new o(e);
|
|
1731
|
+
c.needsUpdate = !0;
|
|
1732
|
+
let d = new l({
|
|
1733
|
+
map: c,
|
|
1734
|
+
transparent: !0,
|
|
1735
|
+
depthTest: !1
|
|
1736
|
+
}), f = new u(d), p = Math.max(i.height, .01);
|
|
1737
|
+
f.scale.set(p * e.width / e.height, p, 1), f.position.set(i.x - t, i.y - n, 0), f.material.rotation = i.rotation, r.push(f), B.push(f);
|
|
1738
|
+
}
|
|
1739
|
+
return r;
|
|
1740
|
+
}
|
|
1741
|
+
function q() {
|
|
1742
|
+
k && A && j && k.render(A, j);
|
|
1743
|
+
}
|
|
1744
|
+
function J() {
|
|
1745
|
+
if (!j) return;
|
|
1746
|
+
let e = R / Math.max(1, z), t = I, n = L;
|
|
1747
|
+
t / n < e ? t = n * e : n = t / e, j.left = -t / 2, j.right = t / 2, j.top = n / 2, j.bottom = -n / 2, j.zoom = F, j.updateProjectionMatrix(), q();
|
|
1748
|
+
}
|
|
1749
|
+
function Y() {
|
|
1750
|
+
let e = D.value;
|
|
1751
|
+
e && k && (R = e.clientWidth, z = e.clientHeight, R <= 0 || z <= 0 || (k.setSize(R, z, !1), J()));
|
|
1752
|
+
}
|
|
1753
|
+
function X(e) {
|
|
1754
|
+
F = Math.min(20, Math.max(.05, e)), J(), E("zoom-change", Math.round(F * 100));
|
|
1755
|
+
}
|
|
1756
|
+
function Z() {
|
|
1757
|
+
X(F * 1.25);
|
|
1758
|
+
}
|
|
1759
|
+
function Q() {
|
|
1760
|
+
X(F / 1.25);
|
|
1761
|
+
}
|
|
1762
|
+
function $() {
|
|
1763
|
+
F = 1, M && (M.rotation.z = 0), J(), E("zoom-change", 100);
|
|
1764
|
+
}
|
|
1765
|
+
function oe(e) {
|
|
1766
|
+
M && (M.rotation.z += e, q());
|
|
1767
|
+
}
|
|
1768
|
+
function ue() {
|
|
1769
|
+
k && A && j && (q(), g(k.domElement.toDataURL("image/png"), x.source.name));
|
|
1770
|
+
}
|
|
1771
|
+
async function de(e) {
|
|
1772
|
+
let { default: t } = await import("./dwg2dxf-wasm-DO6Y5cnM.js"), n = await t();
|
|
1773
|
+
n.FS.writeFile("a.dwg", new Uint8Array(e));
|
|
1774
|
+
try {
|
|
1775
|
+
let e = n._dwg2dxf();
|
|
1776
|
+
if (e !== 0) throw Error(`DWG 转换失败(code ${e})`);
|
|
1777
|
+
return new TextDecoder().decode(n.FS.readFile("a.dxf"));
|
|
1778
|
+
} finally {
|
|
1779
|
+
try {
|
|
1780
|
+
n.FS.unlink("a.dwg"), n.FS.unlink("a.dxf");
|
|
1781
|
+
} catch {}
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
async function fe() {
|
|
1785
|
+
let e = D.value;
|
|
1786
|
+
if (e) try {
|
|
1787
|
+
O.value = x.source.ext === "dwg" ? "正在转换 DWG 图纸…" : "正在解析图纸…";
|
|
1788
|
+
let t = await x.source.getArrayBuffer();
|
|
1789
|
+
if (P) return;
|
|
1790
|
+
let o = x.source.ext === "dwg" ? await de(t) : new TextDecoder().decode(t);
|
|
1791
|
+
if (P) return;
|
|
1792
|
+
let s = new se().parseSync(o);
|
|
1793
|
+
if (!s) throw Error("DXF 解析失败,文件可能不完整");
|
|
1794
|
+
let l = x.options.cadLineColor || "#1f2937", u = /* @__PURE__ */ new Map(), d = s.tables?.layers?.layers || {};
|
|
1795
|
+
for (let [e, t] of Object.entries(d)) typeof t?.color == "number" && t.color > 0 && u.set(e, `#${(t.color & 16777215).toString(16).padStart(6, "0")}`);
|
|
1796
|
+
let h = s.blocks || {}, g = ie(l);
|
|
1797
|
+
if (K(s.entities, g, ne, h, u), !g.positions.length && !g.texts.length) throw Error("图纸中没有可显示的实体");
|
|
1798
|
+
let _ = Infinity, v = Infinity, y = -Infinity, b = -Infinity;
|
|
1799
|
+
for (let e = 0; e < g.positions.length; e += 3) _ = Math.min(_, g.positions[e]), y = Math.max(y, g.positions[e]), v = Math.min(v, g.positions[e + 1]), b = Math.max(b, g.positions[e + 1]);
|
|
1800
|
+
if (!Number.isFinite(_)) for (let e of g.texts) _ = Math.min(_, e.x), y = Math.max(y, e.x), v = Math.min(v, e.y), b = Math.max(b, e.y);
|
|
1801
|
+
let S = (_ + y) / 2, C = (v + b) / 2;
|
|
1802
|
+
I = Math.max(1, (y - _) * 1.15), L = Math.max(1, (b - v) * 1.15);
|
|
1803
|
+
for (let e = 0; e < g.positions.length; e += 3) g.positions[e] -= S, g.positions[e + 1] -= C;
|
|
1804
|
+
let w = new p();
|
|
1805
|
+
w.setAttribute("position", new c(g.positions, 3)), w.setAttribute("color", new c(g.colors, 3));
|
|
1806
|
+
let T = new r({ vertexColors: !0 }), ee = new n(w, T);
|
|
1807
|
+
A = new f(), M = new a(), M.add(ee);
|
|
1808
|
+
for (let e of ae(g.texts, S, C)) M.add(e);
|
|
1809
|
+
A.add(M), k = new m({
|
|
1810
|
+
antialias: !0,
|
|
1811
|
+
alpha: !0,
|
|
1812
|
+
preserveDrawingBuffer: !0
|
|
1813
|
+
}), k.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2)), k.setClearColor(0, 0), e.appendChild(k.domElement), k.domElement.className = "fv-cad-canvas", j = new i(-1, 1, 1, -1, .1, 1e4), j.position.set(0, 0, 100), j.lookAt(0, 0, 0), N = new ResizeObserver(() => Y()), N.observe(e), Y(), X(1), O.value = "", E("ready");
|
|
1814
|
+
} catch (e) {
|
|
1815
|
+
if (O.value = "", P) return;
|
|
1816
|
+
E("error", e instanceof Error ? e.message : "CAD 图纸加载失败");
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
return C(fe), S(() => {
|
|
1820
|
+
P = !0, N?.disconnect(), N = null;
|
|
1821
|
+
for (let e of B) e.material.map?.dispose(), e.material.dispose();
|
|
1822
|
+
B.length = 0, M?.traverse((e) => {
|
|
1823
|
+
e instanceof n && (e.geometry.dispose(), e.material.dispose());
|
|
1824
|
+
}), k?.dispose(), k?.domElement.remove(), k = null, A = null, j = null, M = null;
|
|
1825
|
+
}), t({
|
|
1826
|
+
zoomIn: Z,
|
|
1827
|
+
zoomOut: Q,
|
|
1828
|
+
resetZoom: $,
|
|
1829
|
+
rotate: oe,
|
|
1830
|
+
print: ue
|
|
1831
|
+
}), (e, t) => (w(), y("div", ce, [b("div", {
|
|
1832
|
+
ref_key: "root",
|
|
1833
|
+
ref: D,
|
|
1834
|
+
class: "fv-cad-stage"
|
|
1835
|
+
}, null, 512), O.value ? (w(), y("div", le, [t[0] ||= b("span", { class: "fv-cad-spinner" }, null, -1), b("span", null, ee(O.value), 1)])) : v("", !0)]));
|
|
1836
|
+
}
|
|
1837
|
+
}), [["__scopeId", "data-v-b51026a0"]]);
|
|
1838
|
+
export { ue as default };
|