filens-preview 0.3.0 → 0.3.2
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/README.md +13 -7
- package/dist/all-in-one/THIRD-PARTY-NOTICES.txt +870 -0
- package/dist/all-in-one/filens.js +5069 -114897
- package/dist/index.d.ts +2 -0
- package/dist/split/THIRD-PARTY-NOTICES.txt +870 -0
- package/dist/split/chunks/archive-haip2eOP.js +1 -0
- package/dist/split/chunks/browser-video-session-C_14e_mG.js +1 -0
- package/dist/split/chunks/cad-5oTkbaDV.js +7 -0
- package/dist/split/chunks/core-EjELrtsP.js +17 -0
- package/dist/split/chunks/diagram-BRcdlitF.js +1 -0
- package/dist/split/chunks/docx-I39iDYpR.js +1 -0
- package/dist/split/chunks/ebook-BRfadCGl.js +5 -0
- package/dist/split/chunks/index-C4jdVbDq.js +1 -0
- package/dist/split/chunks/index-DkF8PBGR.js +1 -0
- package/dist/split/chunks/iwork-DXq9Adf7.js +4 -0
- package/dist/split/chunks/media-runtime-B6322raw.js +1 -0
- package/dist/split/chunks/mindmap-CyR3TRfx.js +1 -0
- package/dist/split/chunks/model3d-BEt6INTt.js +55 -0
- package/dist/split/chunks/mp4box.all-Bw_Tlr0T-D0URDfA1.js +1 -0
- package/dist/split/chunks/panorama-ChsqnvWC.js +973 -0
- package/dist/split/chunks/pdf-Dzzffz3p.js +12 -0
- package/dist/split/chunks/vendor-C1aIdQ-w.js +4115 -0
- package/dist/split/chunks/xlsx-CITQo0Od.js +3 -0
- package/dist/split/converter-image.wasm +0 -0
- package/dist/split/filens.js +2 -5012
- package/package.json +1 -1
- package/dist/split/chunks/archive-B4jVwD9o.js +0 -921
- package/dist/split/chunks/cad-DMg-lGJX.js +0 -2405
- package/dist/split/chunks/core--zVW212C.js +0 -14627
- package/dist/split/chunks/diagram-CDwCA6LZ.js +0 -654
- package/dist/split/chunks/docx-CuQfFJqr.js +0 -299
- package/dist/split/chunks/ebook-CLlJ8KX3.js +0 -623
- package/dist/split/chunks/iwork-dNVC0X8j.js +0 -772
- package/dist/split/chunks/media-runtime-gcsBQMuo.js +0 -48
- package/dist/split/chunks/mindmap-g0-VoK-K.js +0 -560
- package/dist/split/chunks/model3d-1G1CC52V.js +0 -5093
- package/dist/split/chunks/panorama-D7GVivtM.js +0 -5972
- package/dist/split/chunks/pdf-CecYOWld.js +0 -17898
- package/dist/split/chunks/vendor-DPFNKNkh.js +0 -59575
- package/dist/split/chunks/xlsx-Co26yo-R.js +0 -818
|
@@ -1,2405 +0,0 @@
|
|
|
1
|
-
var Ot = Object.defineProperty;
|
|
2
|
-
var Ht = (t, e, n) => e in t ? Ot(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
-
var F = (t, e, n) => Ht(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { c as Yt, b as zt, a as Vt, v as at, f as jt } from "./core--zVW212C.js";
|
|
5
|
-
const Wt = [
|
|
6
|
-
{
|
|
7
|
-
extensions: ["dxf"],
|
|
8
|
-
family: "cad",
|
|
9
|
-
driverId: "cad",
|
|
10
|
-
targetFormat: "dxf",
|
|
11
|
-
contentTypes: ["image/vnd.dxf", "application/dxf", "application/x-dxf"]
|
|
12
|
-
}
|
|
13
|
-
], D = "#223245";
|
|
14
|
-
class Ut {
|
|
15
|
-
constructor(e, n = {}) {
|
|
16
|
-
F(this, "listeners", {
|
|
17
|
-
loading: /* @__PURE__ */ new Set(),
|
|
18
|
-
rendered: /* @__PURE__ */ new Set(),
|
|
19
|
-
error: /* @__PURE__ */ new Set(),
|
|
20
|
-
statechange: /* @__PURE__ */ new Set(),
|
|
21
|
-
warnings: /* @__PURE__ */ new Set()
|
|
22
|
-
});
|
|
23
|
-
F(this, "root");
|
|
24
|
-
F(this, "canvas", null);
|
|
25
|
-
F(this, "drawing", null);
|
|
26
|
-
F(this, "panX", 0);
|
|
27
|
-
F(this, "panY", 0);
|
|
28
|
-
F(this, "state");
|
|
29
|
-
F(this, "loadController", null);
|
|
30
|
-
F(this, "resourceUrls", /* @__PURE__ */ new Set());
|
|
31
|
-
F(this, "layerElements", /* @__PURE__ */ new Map());
|
|
32
|
-
F(this, "appliedLayers", /* @__PURE__ */ new Set());
|
|
33
|
-
F(this, "fontLoading");
|
|
34
|
-
F(this, "fontReferences", []);
|
|
35
|
-
this.host = e, this.options = n, this.root = document.createElement("div"), this.root.className = "cadv-preview", this.host.replaceChildren(this.root), this.state = {
|
|
36
|
-
loading: !1,
|
|
37
|
-
error: null,
|
|
38
|
-
family: "cad",
|
|
39
|
-
warnings: [],
|
|
40
|
-
capabilities: {
|
|
41
|
-
zoom: !0,
|
|
42
|
-
fit: !0,
|
|
43
|
-
pan: !0,
|
|
44
|
-
fullscreen: !0,
|
|
45
|
-
layers: !0,
|
|
46
|
-
metadata: !0
|
|
47
|
-
},
|
|
48
|
-
scale: this.options.initialScale ?? 1,
|
|
49
|
-
layers: [],
|
|
50
|
-
activeLayerIds: []
|
|
51
|
-
}, this.fontLoading = zt(this, e.ownerDocument, n);
|
|
52
|
-
}
|
|
53
|
-
async load(e, n) {
|
|
54
|
-
var c, a, l, f, d;
|
|
55
|
-
this.stopLoad(), this.fontLoading.reset(n.signal, ((c = n.route) == null ? void 0 : c.targetFormat) ?? n.descriptor.extension ?? "dxf");
|
|
56
|
-
const o = new AbortController();
|
|
57
|
-
this.loadController = o;
|
|
58
|
-
const r = o.signal, i = this.resourceUrls = /* @__PURE__ */ new Set(), s = () => o.abort();
|
|
59
|
-
r.addEventListener("abort", () => {
|
|
60
|
-
var h;
|
|
61
|
-
(h = n.signal) == null || h.removeEventListener("abort", s), this.loadController === o && (this.stopLoad(), this.state.loading = !1, this.emit("statechange", this.state));
|
|
62
|
-
}, { once: !0 }), (a = n.signal) == null || a.addEventListener("abort", s, { once: !0 }), this.state = {
|
|
63
|
-
...this.state,
|
|
64
|
-
loading: !0,
|
|
65
|
-
error: null,
|
|
66
|
-
title: n.descriptor.name,
|
|
67
|
-
warnings: [],
|
|
68
|
-
fonts: []
|
|
69
|
-
}, this.emit("loading", this.state), this.emit("statechange", this.state);
|
|
70
|
-
try {
|
|
71
|
-
(l = n.signal) != null && l.aborted && o.abort(), C(r);
|
|
72
|
-
const h = Xt(((f = n.route) == null ? void 0 : f.sourceFormat) ?? n.descriptor.extension);
|
|
73
|
-
if (h !== "dxf")
|
|
74
|
-
throw new Error(`CAD preview currently supports browser-native DXF files, got ${h || "unknown"}.`);
|
|
75
|
-
const p = await $n(e, { ...n, signal: r });
|
|
76
|
-
C(r);
|
|
77
|
-
const g = qt(p), m = await Fn(
|
|
78
|
-
g,
|
|
79
|
-
this.options.resourceResolver,
|
|
80
|
-
h,
|
|
81
|
-
i,
|
|
82
|
-
r
|
|
83
|
-
);
|
|
84
|
-
C(r);
|
|
85
|
-
const b = Cn(m, this.options.fontResolver, h);
|
|
86
|
-
C(r), this.fontReferences = Ln(m, b);
|
|
87
|
-
const S = Vt(this.fontReferences, this.host.ownerDocument), A = at(S.fonts.filter((M) => M.status !== "unsupported")), I = b.layerStyles.length ? b.layerStyles.filter((M) => M.visible).map((M) => M.name) : b.layers;
|
|
88
|
-
this.state = {
|
|
89
|
-
...this.state,
|
|
90
|
-
loading: !1,
|
|
91
|
-
error: null,
|
|
92
|
-
warnings: [.../* @__PURE__ */ new Set([...b.warnings, ...A])],
|
|
93
|
-
fonts: S.fonts,
|
|
94
|
-
layers: yn(b),
|
|
95
|
-
activeLayerIds: I
|
|
96
|
-
}, this.render(b), this.state.warnings.length && this.emit("warnings", this.state.warnings), this.emit("rendered", this.state), this.emit("statechange", this.state);
|
|
97
|
-
} catch (h) {
|
|
98
|
-
if (r.aborted) {
|
|
99
|
-
(d = n.signal) != null && d.aborted && C(r);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
this.stopLoad();
|
|
103
|
-
const p = h instanceof Error ? h : new Error(String(h));
|
|
104
|
-
throw this.state.loading = !1, this.state.error = p.message, this.emit("error", p), this.emit("statechange", this.state), p;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
destroy() {
|
|
108
|
-
this.fontLoading.destroy(), this.stopLoad(), this.state.loading = !1, this.root.parentElement === this.host && this.host.replaceChildren();
|
|
109
|
-
for (const e of Object.values(this.listeners)) e.clear();
|
|
110
|
-
}
|
|
111
|
-
stopLoad() {
|
|
112
|
-
this.fontReferences = [];
|
|
113
|
-
const e = this.loadController;
|
|
114
|
-
this.loadController = null, e == null || e.abort(), this.root.replaceChildren(), this.canvas = null, this.drawing = null, this.layerElements.clear(), this.appliedLayers.clear(), this.panX = 0, this.panY = 0, this.state.layers = [], this.state.activeLayerIds = [], this.state.fonts = [];
|
|
115
|
-
for (const n of this.resourceUrls) URL.revokeObjectURL(n);
|
|
116
|
-
this.resourceUrls.clear();
|
|
117
|
-
}
|
|
118
|
-
getState() {
|
|
119
|
-
var e;
|
|
120
|
-
return {
|
|
121
|
-
...this.state,
|
|
122
|
-
warnings: [...this.state.warnings],
|
|
123
|
-
fonts: (e = this.state.fonts) == null ? void 0 : e.map((n) => ({ ...n, classification: n.classification ? { ...n.classification } : void 0 })),
|
|
124
|
-
layers: [...this.state.layers ?? []],
|
|
125
|
-
activeLayerIds: [...this.state.activeLayerIds ?? []]
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
getFontReferences() {
|
|
129
|
-
return this.fontReferences;
|
|
130
|
-
}
|
|
131
|
-
refreshFonts(e) {
|
|
132
|
-
var o, r;
|
|
133
|
-
if (!this.drawing || (o = this.loadController) != null && o.signal.aborted) return;
|
|
134
|
-
for (const i of this.drawing.entities) {
|
|
135
|
-
if (i.type !== "text") continue;
|
|
136
|
-
const s = this.fontReferences.findIndex((a) => a.styleName === i.styleName && (a.resolvedFontFamily ?? a.fontFamily) === i.fontFamily), c = (r = e.references[s]) == null ? void 0 : r.resolvedFontFamily;
|
|
137
|
-
c && (i.fontFamily = c);
|
|
138
|
-
}
|
|
139
|
-
this.fontReferences = e.references;
|
|
140
|
-
const n = jt(e, this.host.ownerDocument);
|
|
141
|
-
this.state.fonts = n.fonts, this.state.warnings = [.../* @__PURE__ */ new Set([...this.drawing.warnings, ...at(n.fonts.filter((i) => i.status !== "unsupported")), ...e.warnings])], (e.loaded.length || e.relayout) && (this.render(this.drawing), this.appliedLayers = new Set(this.drawing.layers), this.applyLayerVisibility()), this.emit("warnings", this.state.warnings), this.emit("rendered", this.getState()), this.emit("statechange", this.getState());
|
|
142
|
-
}
|
|
143
|
-
setScale(e) {
|
|
144
|
-
this.state = {
|
|
145
|
-
...this.state,
|
|
146
|
-
scale: Math.max(0.1, Math.min(e, 8))
|
|
147
|
-
}, this.applyTransform(), this.emit("statechange", this.state);
|
|
148
|
-
}
|
|
149
|
-
fit() {
|
|
150
|
-
this.panX = 0, this.panY = 0, this.setScale(1);
|
|
151
|
-
}
|
|
152
|
-
pan(e, n) {
|
|
153
|
-
this.panX += e, this.panY += n, this.applyTransform(), this.emit("statechange", this.state);
|
|
154
|
-
}
|
|
155
|
-
setActiveLayers(e) {
|
|
156
|
-
var r;
|
|
157
|
-
const n = ((r = this.drawing) == null ? void 0 : r.layers) ?? [], o = new Set(e.filter((i) => n.includes(i)));
|
|
158
|
-
this.state = {
|
|
159
|
-
...this.state,
|
|
160
|
-
activeLayerIds: [...o]
|
|
161
|
-
}, this.applyLayerVisibility(), this.emit("statechange", this.state);
|
|
162
|
-
}
|
|
163
|
-
toggleLayer(e, n) {
|
|
164
|
-
var s;
|
|
165
|
-
if (!(((s = this.drawing) == null ? void 0 : s.layers) ?? []).includes(e))
|
|
166
|
-
return;
|
|
167
|
-
const r = new Set(this.state.activeLayerIds ?? []);
|
|
168
|
-
n ?? !r.has(e) ? r.add(e) : r.delete(e), this.setActiveLayers([...r]);
|
|
169
|
-
}
|
|
170
|
-
async fullscreen() {
|
|
171
|
-
var e, n;
|
|
172
|
-
await ((n = (e = this.root).requestFullscreen) == null ? void 0 : n.call(e));
|
|
173
|
-
}
|
|
174
|
-
on(e, n) {
|
|
175
|
-
return this.listeners[e].add(n), () => {
|
|
176
|
-
this.listeners[e].delete(n);
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
render(e) {
|
|
180
|
-
this.drawing = e;
|
|
181
|
-
const n = document.createElement("div");
|
|
182
|
-
n.className = "cadv-stage", this.layerElements.clear();
|
|
183
|
-
const o = Fe(e, this.layerElements);
|
|
184
|
-
this.canvas = o, this.appliedLayers = new Set(this.state.activeLayerIds), n.appendChild(o), this.root.replaceChildren(n), this.applyTransform();
|
|
185
|
-
}
|
|
186
|
-
applyLayerVisibility() {
|
|
187
|
-
if (!this.canvas)
|
|
188
|
-
return;
|
|
189
|
-
const e = new Set(this.state.activeLayerIds ?? []);
|
|
190
|
-
for (const [n, o] of this.layerElements)
|
|
191
|
-
if (e.has(n) !== this.appliedLayers.has(n))
|
|
192
|
-
for (const r of o) {
|
|
193
|
-
const s = r.getAttribute("data-entity-visible") !== "false" && (!n || e.has(n));
|
|
194
|
-
s ? r.removeAttribute("display") : r.setAttribute("display", "none"), r.setAttribute("data-layer-visible", s ? "true" : "false");
|
|
195
|
-
}
|
|
196
|
-
this.appliedLayers = e;
|
|
197
|
-
}
|
|
198
|
-
applyTransform() {
|
|
199
|
-
this.canvas && (this.canvas.style.transform = `translate(${this.panX}px, ${this.panY}px) scale(${this.state.scale})`);
|
|
200
|
-
}
|
|
201
|
-
emit(e, n) {
|
|
202
|
-
for (const o of this.listeners[e])
|
|
203
|
-
o(n);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
function Xn() {
|
|
207
|
-
return {
|
|
208
|
-
id: "cad",
|
|
209
|
-
family: "cad",
|
|
210
|
-
supports: (t) => Xt(t) === "dxf",
|
|
211
|
-
createSession: (t, e) => new Ut(t, e)
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function On(t = Yt()) {
|
|
215
|
-
return [
|
|
216
|
-
...Wt,
|
|
217
|
-
...t.filter((e) => !e.extensions.some((n) => n === "dxf"))
|
|
218
|
-
];
|
|
219
|
-
}
|
|
220
|
-
function qt(t) {
|
|
221
|
-
var A, I;
|
|
222
|
-
const e = Gt(_t(t)), n = e.get("HEADER") ?? [], o = e.get("TABLES") ?? [], r = Kt(n), i = Zt(n), s = Nn(o), c = gn(e.get("OBJECTS") ?? []), a = pn(o), l = bn(o, a), f = [], d = [], h = ye(e.get("BLOCKS") ?? [], s, d, c), p = e.get("ENTITIES") ?? [];
|
|
223
|
-
let g = !1, m = 0;
|
|
224
|
-
for (; m < p.length; ) {
|
|
225
|
-
const M = p[m];
|
|
226
|
-
if (M.code === 0 && M.value === "SECTION" && ((A = p[m + 1]) == null ? void 0 : A.code) === 2 && ((I = p[m + 1]) == null ? void 0 : I.value) === "ENTITIES") {
|
|
227
|
-
g = !0, m += 2;
|
|
228
|
-
continue;
|
|
229
|
-
}
|
|
230
|
-
if (M.code === 0 && M.value === "ENDSEC") {
|
|
231
|
-
g = !1, m += 1;
|
|
232
|
-
continue;
|
|
233
|
-
}
|
|
234
|
-
if (!g || M.code !== 0) {
|
|
235
|
-
m += 1;
|
|
236
|
-
continue;
|
|
237
|
-
}
|
|
238
|
-
const E = O(p, m);
|
|
239
|
-
if (E.type === "POLYLINE") {
|
|
240
|
-
const N = bt(p, m);
|
|
241
|
-
N.entity && f.push(N.entity), m = N.nextIndex;
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
if (E.type === "INSERT" || E.type === "MINSERT") {
|
|
245
|
-
const N = wt(E.type, E.values);
|
|
246
|
-
if (N)
|
|
247
|
-
for (const L of Ne(N, h, d)) f.push(L);
|
|
248
|
-
m = E.nextIndex;
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (E.type === "DIMENSION") {
|
|
252
|
-
const N = Ee(E.values);
|
|
253
|
-
if (N != null && N.blockName && h.has(X(N.blockName)))
|
|
254
|
-
for (const L of Te(N, h, d)) f.push(L);
|
|
255
|
-
else {
|
|
256
|
-
const L = ve(E.values);
|
|
257
|
-
L && f.push(L), N != null && N.blockName && !L && d.push(`DXF DIMENSION references missing block "${N.blockName}"; skipped.`);
|
|
258
|
-
}
|
|
259
|
-
m = E.nextIndex;
|
|
260
|
-
continue;
|
|
261
|
-
}
|
|
262
|
-
const ct = mt(E.type, E.values, s, c);
|
|
263
|
-
ct && f.push(ct), m = E.nextIndex;
|
|
264
|
-
}
|
|
265
|
-
const b = An(f, l, a, i.lineTypeScale), S = Ze(b, r);
|
|
266
|
-
return {
|
|
267
|
-
entities: b,
|
|
268
|
-
bounds: S,
|
|
269
|
-
header: i,
|
|
270
|
-
layers: En([
|
|
271
|
-
...[...l.values()].map((M) => M.name),
|
|
272
|
-
...b.map((M) => M.layer).filter(Boolean)
|
|
273
|
-
]),
|
|
274
|
-
layerStyles: [...l.values()].sort((M, E) => M.name.localeCompare(E.name)),
|
|
275
|
-
lineTypes: [...a.values()].sort((M, E) => M.name.localeCompare(E.name)),
|
|
276
|
-
textStyles: [...s.values()],
|
|
277
|
-
warnings: [...rt(b, s), ...vn(d)]
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
function Gt(t) {
|
|
281
|
-
var n;
|
|
282
|
-
const e = /* @__PURE__ */ new Map();
|
|
283
|
-
for (let o = 0; o < t.length; o++) {
|
|
284
|
-
if (t[o].code !== 0 || t[o].value !== "SECTION" || ((n = t[o + 1]) == null ? void 0 : n.code) !== 2) continue;
|
|
285
|
-
const r = o, i = t[o + 1].value;
|
|
286
|
-
for (o += 2; o < t.length && !(t[o].code === 0 && t[o].value === "ENDSEC"); ) o++;
|
|
287
|
-
const s = e.get(i);
|
|
288
|
-
if (s)
|
|
289
|
-
for (let c = r; c <= o && c < t.length; c++) s.push(t[c]);
|
|
290
|
-
else
|
|
291
|
-
e.set(i, t.slice(r, o + 1));
|
|
292
|
-
}
|
|
293
|
-
return e;
|
|
294
|
-
}
|
|
295
|
-
function _t(t) {
|
|
296
|
-
const e = [];
|
|
297
|
-
let n = 0;
|
|
298
|
-
for (; n < t.length; ) {
|
|
299
|
-
const o = t.indexOf(`
|
|
300
|
-
`, n);
|
|
301
|
-
if (o < 0) break;
|
|
302
|
-
const r = t.indexOf(`
|
|
303
|
-
`, o + 1), i = r < 0 ? t.length : r, s = Number(t.slice(n, o).trim());
|
|
304
|
-
Number.isFinite(s) && e.push({ code: s, value: t.slice(o + 1, i).trimEnd() }), n = i + 1;
|
|
305
|
-
}
|
|
306
|
-
return e;
|
|
307
|
-
}
|
|
308
|
-
function Kt(t) {
|
|
309
|
-
const e = lt(t, "$EXTMIN", "$EXTMAX");
|
|
310
|
-
return e || lt(t, "$LIMMIN", "$LIMMAX");
|
|
311
|
-
}
|
|
312
|
-
function Zt(t) {
|
|
313
|
-
const e = G(t, "$INSUNITS"), n = G(t, "$MEASUREMENT"), o = P(G(t, "$LTSCALE")), r = Jt(e, n);
|
|
314
|
-
return {
|
|
315
|
-
...r ? { units: r } : {},
|
|
316
|
-
...o == null ? {} : { lineTypeScale: o }
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
function G(t, e) {
|
|
320
|
-
var o, r, i, s, c;
|
|
321
|
-
let n = !1;
|
|
322
|
-
for (let a = 0; a < t.length; a += 1) {
|
|
323
|
-
const l = t[a];
|
|
324
|
-
if (l.code === 0 && l.value === "SECTION" && ((o = t[a + 1]) == null ? void 0 : o.code) === 2 && ((r = t[a + 1]) == null ? void 0 : r.value) === "HEADER") {
|
|
325
|
-
n = !0, a += 1;
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
if (n && l.code === 0 && l.value === "ENDSEC")
|
|
329
|
-
return;
|
|
330
|
-
if (!n || l.code !== 9 || l.value !== e)
|
|
331
|
-
continue;
|
|
332
|
-
let f = a + 1;
|
|
333
|
-
for (; f < t.length && ((i = t[f]) == null ? void 0 : i.code) !== 9 && ((s = t[f]) == null ? void 0 : s.code) !== 0; ) {
|
|
334
|
-
const d = Number((c = t[f]) == null ? void 0 : c.value);
|
|
335
|
-
if (Number.isFinite(d))
|
|
336
|
-
return d;
|
|
337
|
-
f += 1;
|
|
338
|
-
}
|
|
339
|
-
return;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
function Jt(t, e) {
|
|
343
|
-
const n = t == null || !Number.isFinite(t) ? void 0 : Math.trunc(t), o = e === 0 ? "imperial" : e === 1 ? "metric" : void 0;
|
|
344
|
-
if (!(n == null && !o))
|
|
345
|
-
return {
|
|
346
|
-
code: n,
|
|
347
|
-
name: Qt(n),
|
|
348
|
-
measurement: o
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
function Qt(t) {
|
|
352
|
-
return t == null ? void 0 : {
|
|
353
|
-
0: "Unitless",
|
|
354
|
-
1: "Inches",
|
|
355
|
-
2: "Feet",
|
|
356
|
-
3: "Miles",
|
|
357
|
-
4: "Millimeters",
|
|
358
|
-
5: "Centimeters",
|
|
359
|
-
6: "Meters",
|
|
360
|
-
7: "Kilometers",
|
|
361
|
-
8: "Microinches",
|
|
362
|
-
9: "Mils",
|
|
363
|
-
10: "Yards",
|
|
364
|
-
11: "Angstroms",
|
|
365
|
-
12: "Nanometers",
|
|
366
|
-
13: "Microns",
|
|
367
|
-
14: "Decimeters",
|
|
368
|
-
15: "Decameters",
|
|
369
|
-
16: "Hectometers",
|
|
370
|
-
17: "Gigameters",
|
|
371
|
-
18: "Astronomical units",
|
|
372
|
-
19: "Light years",
|
|
373
|
-
20: "Parsecs",
|
|
374
|
-
21: "US survey feet",
|
|
375
|
-
22: "US survey inches",
|
|
376
|
-
23: "US survey yards",
|
|
377
|
-
24: "US survey miles"
|
|
378
|
-
}[t];
|
|
379
|
-
}
|
|
380
|
-
function lt(t, e, n) {
|
|
381
|
-
const o = ut(t, e), r = ut(t, n);
|
|
382
|
-
if (!(!o || !r || o.x >= r.x || o.y >= r.y))
|
|
383
|
-
return {
|
|
384
|
-
minX: o.x,
|
|
385
|
-
minY: o.y,
|
|
386
|
-
maxX: r.x,
|
|
387
|
-
maxY: r.y
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
function ut(t, e) {
|
|
391
|
-
var o, r, i, s, c, a, l, f;
|
|
392
|
-
let n = !1;
|
|
393
|
-
for (let d = 0; d < t.length; d += 1) {
|
|
394
|
-
const h = t[d];
|
|
395
|
-
if (h.code === 0 && h.value === "SECTION" && ((o = t[d + 1]) == null ? void 0 : o.code) === 2 && ((r = t[d + 1]) == null ? void 0 : r.value) === "HEADER") {
|
|
396
|
-
n = !0, d += 1;
|
|
397
|
-
continue;
|
|
398
|
-
}
|
|
399
|
-
if (n && h.code === 0 && h.value === "ENDSEC")
|
|
400
|
-
return;
|
|
401
|
-
if (!n || h.code !== 9 || h.value !== e)
|
|
402
|
-
continue;
|
|
403
|
-
let p, g, m = d + 1;
|
|
404
|
-
for (; m < t.length && ((i = t[m]) == null ? void 0 : i.code) !== 9 && ((s = t[m]) == null ? void 0 : s.code) !== 0; )
|
|
405
|
-
((c = t[m]) == null ? void 0 : c.code) === 10 && (p = Number((a = t[m]) == null ? void 0 : a.value)), ((l = t[m]) == null ? void 0 : l.code) === 20 && (g = Number((f = t[m]) == null ? void 0 : f.value)), m += 1;
|
|
406
|
-
return x(p, g);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
function te(t, e, n, o = /* @__PURE__ */ new Map()) {
|
|
410
|
-
const r = O(t, e);
|
|
411
|
-
return {
|
|
412
|
-
entity: mt(r.type, r.values, n, o),
|
|
413
|
-
nextIndex: r.nextIndex
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function O(t, e) {
|
|
417
|
-
var r, i;
|
|
418
|
-
const n = (r = t[e]) == null ? void 0 : r.value;
|
|
419
|
-
let o = e + 1;
|
|
420
|
-
for (; o < t.length && ((i = t[o]) == null ? void 0 : i.code) !== 0; )
|
|
421
|
-
o += 1;
|
|
422
|
-
return {
|
|
423
|
-
type: n,
|
|
424
|
-
values: t.slice(e + 1, o),
|
|
425
|
-
nextIndex: o
|
|
426
|
-
};
|
|
427
|
-
}
|
|
428
|
-
function mt(t, e, n, o = /* @__PURE__ */ new Map()) {
|
|
429
|
-
switch (t) {
|
|
430
|
-
case "LINE":
|
|
431
|
-
return ne(e);
|
|
432
|
-
case "XLINE":
|
|
433
|
-
return ft(e, !1);
|
|
434
|
-
case "RAY":
|
|
435
|
-
return ft(e, !0);
|
|
436
|
-
case "POINT":
|
|
437
|
-
return ee(e);
|
|
438
|
-
case "CIRCLE":
|
|
439
|
-
return oe(e);
|
|
440
|
-
case "ARC":
|
|
441
|
-
return ie(e);
|
|
442
|
-
case "ELLIPSE":
|
|
443
|
-
return re(e);
|
|
444
|
-
case "LWPOLYLINE":
|
|
445
|
-
return se(e);
|
|
446
|
-
case "LEADER":
|
|
447
|
-
return ce(e);
|
|
448
|
-
case "SOLID":
|
|
449
|
-
case "TRACE":
|
|
450
|
-
case "3DFACE":
|
|
451
|
-
return ae(e);
|
|
452
|
-
case "HATCH":
|
|
453
|
-
return le(e);
|
|
454
|
-
case "SPLINE":
|
|
455
|
-
return me(e);
|
|
456
|
-
case "TEXT":
|
|
457
|
-
case "MTEXT":
|
|
458
|
-
case "ATTRIB":
|
|
459
|
-
case "ATTDEF":
|
|
460
|
-
return ge(t, e, n);
|
|
461
|
-
case "IMAGE":
|
|
462
|
-
return xe(e, o);
|
|
463
|
-
default:
|
|
464
|
-
return;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
function ee(t) {
|
|
468
|
-
const e = x(u(t, 10), u(t, 20));
|
|
469
|
-
if (e)
|
|
470
|
-
return {
|
|
471
|
-
...T(t),
|
|
472
|
-
type: "point",
|
|
473
|
-
point: e
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
function ne(t) {
|
|
477
|
-
const e = x(u(t, 10), u(t, 20)), n = x(u(t, 11), u(t, 21));
|
|
478
|
-
if (!(!e || !n))
|
|
479
|
-
return {
|
|
480
|
-
...T(t),
|
|
481
|
-
type: "line",
|
|
482
|
-
start: e,
|
|
483
|
-
end: n
|
|
484
|
-
};
|
|
485
|
-
}
|
|
486
|
-
function ft(t, e) {
|
|
487
|
-
const n = x(u(t, 10), u(t, 20)), o = x(u(t, 11), u(t, 21));
|
|
488
|
-
if (!(!n || !o || z(o) < 1e-9))
|
|
489
|
-
return {
|
|
490
|
-
...T(t),
|
|
491
|
-
type: "construction-line",
|
|
492
|
-
point: n,
|
|
493
|
-
direction: o,
|
|
494
|
-
ray: e
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
function oe(t) {
|
|
498
|
-
const e = x(u(t, 10), u(t, 20)), n = u(t, 40);
|
|
499
|
-
if (!(!e || !n || n <= 0))
|
|
500
|
-
return {
|
|
501
|
-
...T(t),
|
|
502
|
-
type: "circle",
|
|
503
|
-
center: e,
|
|
504
|
-
radius: n
|
|
505
|
-
};
|
|
506
|
-
}
|
|
507
|
-
function ie(t) {
|
|
508
|
-
const e = x(u(t, 10), u(t, 20)), n = u(t, 40), o = u(t, 50), r = u(t, 51);
|
|
509
|
-
if (!(!e || !n || n <= 0 || o == null || r == null))
|
|
510
|
-
return {
|
|
511
|
-
...T(t),
|
|
512
|
-
type: "arc",
|
|
513
|
-
center: e,
|
|
514
|
-
radius: n,
|
|
515
|
-
startAngle: o,
|
|
516
|
-
endAngle: r
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
function re(t) {
|
|
520
|
-
const e = x(u(t, 10), u(t, 20)), n = x(u(t, 11), u(t, 21)), o = u(t, 40);
|
|
521
|
-
if (!(!e || !n || o == null || o <= 0))
|
|
522
|
-
return {
|
|
523
|
-
...T(t),
|
|
524
|
-
type: "ellipse",
|
|
525
|
-
center: e,
|
|
526
|
-
majorAxis: n,
|
|
527
|
-
ratio: o,
|
|
528
|
-
startParameter: u(t, 41) ?? 0,
|
|
529
|
-
endParameter: u(t, 42) ?? Math.PI * 2
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
function se(t) {
|
|
533
|
-
const e = [], n = [], o = [];
|
|
534
|
-
let r, i, s = 0, c, a;
|
|
535
|
-
const l = () => {
|
|
536
|
-
const d = x(r, i);
|
|
537
|
-
d && (e.push(d), n.push(s), o.push(et(c, a))), r = void 0, i = void 0, s = 0, c = void 0, a = void 0;
|
|
538
|
-
};
|
|
539
|
-
for (const d of t) {
|
|
540
|
-
if (d.code === 10) {
|
|
541
|
-
l(), r = Number(d.value);
|
|
542
|
-
continue;
|
|
543
|
-
}
|
|
544
|
-
if (d.code === 20) {
|
|
545
|
-
i = Number(d.value);
|
|
546
|
-
continue;
|
|
547
|
-
}
|
|
548
|
-
if (d.code === 42) {
|
|
549
|
-
const h = Number(d.value);
|
|
550
|
-
s = Number.isFinite(h) ? h : 0;
|
|
551
|
-
continue;
|
|
552
|
-
}
|
|
553
|
-
if (d.code === 40) {
|
|
554
|
-
c = Number(d.value);
|
|
555
|
-
continue;
|
|
556
|
-
}
|
|
557
|
-
d.code === 41 && (a = Number(d.value));
|
|
558
|
-
}
|
|
559
|
-
l();
|
|
560
|
-
const f = u(t, 43);
|
|
561
|
-
if (!(e.length < 2))
|
|
562
|
-
return {
|
|
563
|
-
...T(t),
|
|
564
|
-
type: "polyline",
|
|
565
|
-
points: e,
|
|
566
|
-
closed: !!((u(t, 70) ?? 0) & 1),
|
|
567
|
-
bulges: n.some((d) => Math.abs(d) > 1e-9) ? n : void 0,
|
|
568
|
-
strokeWidth: Bt(f, o)
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function ce(t) {
|
|
572
|
-
const e = R(t, 10, 20);
|
|
573
|
-
if (!(e.length < 2))
|
|
574
|
-
return {
|
|
575
|
-
...T(t),
|
|
576
|
-
type: "polyline",
|
|
577
|
-
points: e,
|
|
578
|
-
closed: !1
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
function ae(t) {
|
|
582
|
-
const e = x(u(t, 10), u(t, 20)), n = x(u(t, 11), u(t, 21)), o = x(u(t, 12), u(t, 22)), r = x(u(t, 13), u(t, 23)) ?? o, i = [e, n, o, r].filter((s) => !!s);
|
|
583
|
-
if (!(i.length < 3))
|
|
584
|
-
return {
|
|
585
|
-
...T(t),
|
|
586
|
-
type: "face",
|
|
587
|
-
points: $t(i)
|
|
588
|
-
};
|
|
589
|
-
}
|
|
590
|
-
function le(t) {
|
|
591
|
-
const e = ue(t);
|
|
592
|
-
if (e.length)
|
|
593
|
-
return {
|
|
594
|
-
...T(t),
|
|
595
|
-
type: "hatch",
|
|
596
|
-
loops: e,
|
|
597
|
-
patternName: w(t, 2),
|
|
598
|
-
solid: u(t, 70) === 1 || /^solid$/i.test(w(t, 2) ?? "")
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
function ue(t) {
|
|
602
|
-
var n;
|
|
603
|
-
const e = [];
|
|
604
|
-
for (let o = 0; o < t.length; o += 1) {
|
|
605
|
-
if (((n = t[o]) == null ? void 0 : n.code) !== 92)
|
|
606
|
-
continue;
|
|
607
|
-
const r = fe(t, o);
|
|
608
|
-
r.points.length >= 3 && e.push($t(r.points)), o = Math.max(o, r.nextIndex - 1);
|
|
609
|
-
}
|
|
610
|
-
return e;
|
|
611
|
-
}
|
|
612
|
-
function fe(t, e) {
|
|
613
|
-
const n = de(t, e);
|
|
614
|
-
return n.points.length >= 3 ? n : he(t, e);
|
|
615
|
-
}
|
|
616
|
-
function de(t, e) {
|
|
617
|
-
var o, r, i, s, c, a;
|
|
618
|
-
let n = e + 1;
|
|
619
|
-
for (let l = 0; l < t.length; l += 1) {
|
|
620
|
-
if (l !== e || ((o = t[l]) == null ? void 0 : o.code) !== 92)
|
|
621
|
-
continue;
|
|
622
|
-
let f = l + 1;
|
|
623
|
-
if (((r = t[f]) == null ? void 0 : r.code) !== 72 || (f += 1, ((i = t[f]) == null ? void 0 : i.code) === 73 && (f += 1), ((s = t[f]) == null ? void 0 : s.code) !== 93))
|
|
624
|
-
continue;
|
|
625
|
-
const d = Number((c = t[f]) == null ? void 0 : c.value);
|
|
626
|
-
if (!Number.isFinite(d) || d < 3)
|
|
627
|
-
continue;
|
|
628
|
-
f += 1, n = f;
|
|
629
|
-
const h = [], p = [];
|
|
630
|
-
let g, m, b = 0;
|
|
631
|
-
const S = () => {
|
|
632
|
-
const A = x(g, m);
|
|
633
|
-
A && (h.push(A), p.push(b)), g = void 0, m = void 0, b = 0;
|
|
634
|
-
};
|
|
635
|
-
for (; f < t.length && h.length < d; ) {
|
|
636
|
-
const A = t[f];
|
|
637
|
-
if (A.code === 10)
|
|
638
|
-
S(), g = Number(A.value);
|
|
639
|
-
else if (A.code === 20)
|
|
640
|
-
m = Number(A.value);
|
|
641
|
-
else if (A.code === 42) {
|
|
642
|
-
const I = Number(A.value);
|
|
643
|
-
b = Number.isFinite(I) ? I : 0;
|
|
644
|
-
}
|
|
645
|
-
if (f += 1, x(g, m) && h.length + 1 >= d && ((a = t[f]) == null ? void 0 : a.code) !== 42)
|
|
646
|
-
break;
|
|
647
|
-
}
|
|
648
|
-
if (n = f, S(), h.length >= 3)
|
|
649
|
-
return {
|
|
650
|
-
points: p.some((A) => Math.abs(A) > 1e-9) ? vt({
|
|
651
|
-
points: h,
|
|
652
|
-
closed: !0,
|
|
653
|
-
bulges: p
|
|
654
|
-
}) : h,
|
|
655
|
-
nextIndex: n
|
|
656
|
-
};
|
|
657
|
-
}
|
|
658
|
-
return {
|
|
659
|
-
points: [],
|
|
660
|
-
nextIndex: n
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
function he(t, e) {
|
|
664
|
-
var o, r, i, s, c, a, l;
|
|
665
|
-
let n = e + 1;
|
|
666
|
-
for (let f = 0; f < t.length; f += 1) {
|
|
667
|
-
if (f !== e || ((o = t[f]) == null ? void 0 : o.code) !== 92)
|
|
668
|
-
continue;
|
|
669
|
-
let d = f + 1;
|
|
670
|
-
if (((r = t[d]) == null ? void 0 : r.code) !== 93)
|
|
671
|
-
continue;
|
|
672
|
-
const h = Number((i = t[d]) == null ? void 0 : i.value);
|
|
673
|
-
if (!Number.isFinite(h) || h < 1)
|
|
674
|
-
continue;
|
|
675
|
-
d += 1, n = d;
|
|
676
|
-
const p = [];
|
|
677
|
-
let g = 0;
|
|
678
|
-
for (; d < t.length && g < h; ) {
|
|
679
|
-
if (((s = t[d]) == null ? void 0 : s.code) !== 72) {
|
|
680
|
-
d += 1;
|
|
681
|
-
continue;
|
|
682
|
-
}
|
|
683
|
-
const m = Number((c = t[d]) == null ? void 0 : c.value), b = [];
|
|
684
|
-
for (d += 1; d < t.length && ((a = t[d]) == null ? void 0 : a.code) !== 72 && ((l = t[d]) == null ? void 0 : l.code) !== 92; )
|
|
685
|
-
b.push(t[d]), d += 1;
|
|
686
|
-
const S = pe(m, b);
|
|
687
|
-
for (const A of S)
|
|
688
|
-
fn(p, A);
|
|
689
|
-
g += 1, n = d;
|
|
690
|
-
}
|
|
691
|
-
if (p.length >= 3)
|
|
692
|
-
return {
|
|
693
|
-
points: p,
|
|
694
|
-
nextIndex: n
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
return {
|
|
698
|
-
points: [],
|
|
699
|
-
nextIndex: n
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
function pe(t, e) {
|
|
703
|
-
if (t === 1)
|
|
704
|
-
return [x(u(e, 10), u(e, 20)), x(u(e, 11), u(e, 21))].filter(
|
|
705
|
-
(n) => !!n
|
|
706
|
-
);
|
|
707
|
-
if (t === 2) {
|
|
708
|
-
const n = x(u(e, 10), u(e, 20)), o = u(e, 40), r = u(e, 50), i = u(e, 51);
|
|
709
|
-
return !n || o == null || o <= 0 || r == null || i == null ? [] : Ve(n, o, r, i, u(e, 73) !== 0);
|
|
710
|
-
}
|
|
711
|
-
if (t === 3) {
|
|
712
|
-
const n = x(u(e, 10), u(e, 20)), o = x(u(e, 11), u(e, 21)), r = u(e, 40), i = u(e, 50), s = u(e, 51);
|
|
713
|
-
return !n || !o || r == null || r <= 0 || i == null || s == null ? [] : je(n, o, r, i, s, u(e, 73) !== 0);
|
|
714
|
-
}
|
|
715
|
-
if (t === 4) {
|
|
716
|
-
const n = R(e, 11, 21), o = R(e, 10, 20), r = n.length >= 2 ? n : o;
|
|
717
|
-
return We(r, !!((u(e, 74) ?? 0) & 1), u(e, 94) ?? 3);
|
|
718
|
-
}
|
|
719
|
-
return [];
|
|
720
|
-
}
|
|
721
|
-
function me(t) {
|
|
722
|
-
const e = R(t, 11, 21), n = R(t, 10, 20), o = e.length >= 2 ? e : n;
|
|
723
|
-
if (!(o.length < 2))
|
|
724
|
-
return {
|
|
725
|
-
...T(t),
|
|
726
|
-
type: "spline",
|
|
727
|
-
points: o,
|
|
728
|
-
degree: u(t, 71) ?? 3,
|
|
729
|
-
closed: !!((u(t, 70) ?? 0) & 1)
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
function ge(t, e, n) {
|
|
733
|
-
const o = t === "MTEXT", r = x(u(e, 10), u(e, 20)), i = o ? void 0 : x(u(e, 11), u(e, 21)), s = o ? en(u(e, 71)) : Qe(u(e, 72)), c = o ? nn(u(e, 71)) : tn(u(e, 73)), l = !o && (u(e, 72) != null || u(e, 73) != null) ? i ?? r : r, f = Lt(
|
|
734
|
-
[w(e, 1), ...e.filter((g) => g.code === 3).map((g) => g.value)].filter(Boolean).join("")
|
|
735
|
-
);
|
|
736
|
-
if (!l || !f) return;
|
|
737
|
-
const d = w(e, 7), h = d ? n.get(k(d)) : void 0, p = o ? u(e, 50) ?? on(e) ?? 0 : u(e, 50) ?? 0;
|
|
738
|
-
return {
|
|
739
|
-
...T(e),
|
|
740
|
-
type: "text",
|
|
741
|
-
point: l,
|
|
742
|
-
value: f,
|
|
743
|
-
height: u(e, 40) ?? 12,
|
|
744
|
-
rotation: p,
|
|
745
|
-
widthFactor: o ? 1 : u(e, 41) ?? 1,
|
|
746
|
-
obliqueAngle: u(e, 51) ?? 0,
|
|
747
|
-
horizontalAlign: s,
|
|
748
|
-
verticalAlign: c,
|
|
749
|
-
styleName: d,
|
|
750
|
-
fontFamily: h == null ? void 0 : h.fontFamily,
|
|
751
|
-
fontFile: h == null ? void 0 : h.fontFile
|
|
752
|
-
};
|
|
753
|
-
}
|
|
754
|
-
function xe(t, e) {
|
|
755
|
-
const n = x(u(t, 10), u(t, 20)), o = x(u(t, 11), u(t, 21)), r = x(u(t, 12), u(t, 22)), i = u(t, 13), s = u(t, 23);
|
|
756
|
-
if (!n || !o || !r || i == null || s == null || i <= 0 || s <= 0)
|
|
757
|
-
return;
|
|
758
|
-
const c = hn(t), a = c ? e.get(Ct(c)) : void 0;
|
|
759
|
-
return {
|
|
760
|
-
...T(t),
|
|
761
|
-
type: "image",
|
|
762
|
-
point: n,
|
|
763
|
-
uVector: o,
|
|
764
|
-
vVector: r,
|
|
765
|
-
width: i,
|
|
766
|
-
height: s,
|
|
767
|
-
source: a == null ? void 0 : a.source,
|
|
768
|
-
imageDefHandle: c,
|
|
769
|
-
clipBoundary: be(t, i, s),
|
|
770
|
-
brightness: u(t, 281),
|
|
771
|
-
contrast: u(t, 282),
|
|
772
|
-
fade: u(t, 283)
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
function be(t, e, n) {
|
|
776
|
-
const o = u(t, 280), r = u(t, 91);
|
|
777
|
-
if (o === 0 || r == null || r <= 0)
|
|
778
|
-
return;
|
|
779
|
-
const i = R(t, 14, 24).slice(0, r);
|
|
780
|
-
if (!(i.length < 2)) {
|
|
781
|
-
if (i.length === 2) {
|
|
782
|
-
const [s, c] = i;
|
|
783
|
-
return !s || !c ? void 0 : gt(s, c, e, n);
|
|
784
|
-
}
|
|
785
|
-
return i.map((s) => we(s, e, n));
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
function gt(t, e, n, o) {
|
|
789
|
-
const r = Math.max(0, Math.min(t.x, e.x, n)), i = Math.max(0, Math.min(Math.max(t.x, e.x), n)), s = Math.max(0, Math.min(t.y, e.y, o)), c = Math.max(0, Math.min(Math.max(t.y, e.y), o));
|
|
790
|
-
return [
|
|
791
|
-
{ x: r, y: s },
|
|
792
|
-
{ x: i, y: s },
|
|
793
|
-
{ x: i, y: c },
|
|
794
|
-
{ x: r, y: c }
|
|
795
|
-
];
|
|
796
|
-
}
|
|
797
|
-
function we(t, e, n) {
|
|
798
|
-
return {
|
|
799
|
-
x: Math.max(0, Math.min(t.x, e)),
|
|
800
|
-
y: Math.max(0, Math.min(t.y, n))
|
|
801
|
-
};
|
|
802
|
-
}
|
|
803
|
-
function ye(t, e, n, o = /* @__PURE__ */ new Map()) {
|
|
804
|
-
var c, a, l;
|
|
805
|
-
const r = /* @__PURE__ */ new Map();
|
|
806
|
-
let i = !1, s = 0;
|
|
807
|
-
for (; s < t.length; ) {
|
|
808
|
-
const f = t[s];
|
|
809
|
-
if (f.code === 0 && f.value === "SECTION" && ((c = t[s + 1]) == null ? void 0 : c.code) === 2 && ((a = t[s + 1]) == null ? void 0 : a.value) === "BLOCKS") {
|
|
810
|
-
i = !0, s += 2;
|
|
811
|
-
continue;
|
|
812
|
-
}
|
|
813
|
-
if (i && f.code === 0 && f.value === "ENDSEC") {
|
|
814
|
-
i = !1, s += 1;
|
|
815
|
-
continue;
|
|
816
|
-
}
|
|
817
|
-
if (!i || f.code !== 0 || f.value !== "BLOCK") {
|
|
818
|
-
s += 1;
|
|
819
|
-
continue;
|
|
820
|
-
}
|
|
821
|
-
const d = [];
|
|
822
|
-
for (s += 1; s < t.length && ((l = t[s]) == null ? void 0 : l.code) !== 0; )
|
|
823
|
-
d.push(t[s]), s += 1;
|
|
824
|
-
const h = Ae(d), p = [], g = [];
|
|
825
|
-
for (; s < t.length; ) {
|
|
826
|
-
const m = t[s];
|
|
827
|
-
if (m.code === 0 && m.value === "ENDBLK") {
|
|
828
|
-
s = St(t, s + 1);
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
if (m.code === 0) {
|
|
832
|
-
if (m.value === "POLYLINE") {
|
|
833
|
-
const S = bt(t, s);
|
|
834
|
-
S.entity && p.push(S.entity), s = S.nextIndex;
|
|
835
|
-
continue;
|
|
836
|
-
}
|
|
837
|
-
if (m.value === "INSERT" || m.value === "MINSERT") {
|
|
838
|
-
const S = O(t, s), A = wt(m.value, S.values);
|
|
839
|
-
A && g.push(A), s = S.nextIndex;
|
|
840
|
-
continue;
|
|
841
|
-
}
|
|
842
|
-
const b = te(t, s, e, o);
|
|
843
|
-
b.entity && p.push(b.entity), s = b.nextIndex;
|
|
844
|
-
continue;
|
|
845
|
-
}
|
|
846
|
-
s += 1;
|
|
847
|
-
}
|
|
848
|
-
h && r.set(X(h.name), {
|
|
849
|
-
...h,
|
|
850
|
-
entities: p,
|
|
851
|
-
inserts: g
|
|
852
|
-
});
|
|
853
|
-
}
|
|
854
|
-
return Se(r, n), r;
|
|
855
|
-
}
|
|
856
|
-
function Ae(t) {
|
|
857
|
-
const e = w(t, 2);
|
|
858
|
-
if (e)
|
|
859
|
-
return {
|
|
860
|
-
name: e,
|
|
861
|
-
basePoint: {
|
|
862
|
-
x: u(t, 10) ?? 0,
|
|
863
|
-
y: u(t, 20) ?? 0
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
function Se(t, e) {
|
|
868
|
-
const n = /* @__PURE__ */ new Map();
|
|
869
|
-
for (const o of t.values())
|
|
870
|
-
o.entities = xt(o, t, e, n, []);
|
|
871
|
-
}
|
|
872
|
-
function xt(t, e, n, o, r) {
|
|
873
|
-
const i = X(t.name), s = o.get(i);
|
|
874
|
-
if (s)
|
|
875
|
-
return s;
|
|
876
|
-
if (r.includes(i))
|
|
877
|
-
return n.push(`DXF block nesting cycle detected at "${t.name}"; nested INSERT expansion skipped.`), t.entities;
|
|
878
|
-
const c = [...r, i], a = t.inserts.flatMap((f) => Me(f, e, n, o, c)), l = [...t.entities, ...a];
|
|
879
|
-
return o.set(i, l), l;
|
|
880
|
-
}
|
|
881
|
-
function Me(t, e, n, o, r) {
|
|
882
|
-
const i = e.get(X(t.blockName));
|
|
883
|
-
if (!i)
|
|
884
|
-
return n.push(`DXF nested INSERT references missing block "${t.blockName}"; skipped.`), [];
|
|
885
|
-
const s = xt(i, e, n, o, r), c = [];
|
|
886
|
-
for (let a = 0; a < t.rows; a += 1)
|
|
887
|
-
for (let l = 0; l < t.columns; l += 1) {
|
|
888
|
-
const f = {
|
|
889
|
-
blockBasePoint: i.basePoint,
|
|
890
|
-
insertionPoint: yt(t, l, a),
|
|
891
|
-
scaleX: t.scaleX,
|
|
892
|
-
scaleY: t.scaleY,
|
|
893
|
-
rotation: t.rotation
|
|
894
|
-
};
|
|
895
|
-
for (const d of s) c.push(ot(At(d, f), t));
|
|
896
|
-
}
|
|
897
|
-
return c;
|
|
898
|
-
}
|
|
899
|
-
function bt(t, e) {
|
|
900
|
-
const n = O(t, e), o = [], r = [], i = [];
|
|
901
|
-
let s, c, a = n.nextIndex;
|
|
902
|
-
for (; a < t.length; ) {
|
|
903
|
-
const l = t[a];
|
|
904
|
-
if (l.code !== 0) {
|
|
905
|
-
a += 1;
|
|
906
|
-
continue;
|
|
907
|
-
}
|
|
908
|
-
if (l.value === "SEQEND") {
|
|
909
|
-
a = St(t, a + 1);
|
|
910
|
-
break;
|
|
911
|
-
}
|
|
912
|
-
if (l.value !== "VERTEX")
|
|
913
|
-
break;
|
|
914
|
-
const f = O(t, a), d = x(u(f.values, 10), u(f.values, 20));
|
|
915
|
-
d && (o.push(d), r.push(u(f.values, 42) ?? 0), i.push(et(u(f.values, 40), u(f.values, 41))), s ?? (s = w(f.values, 8)), c ?? (c = u(f.values, 62))), a = f.nextIndex;
|
|
916
|
-
}
|
|
917
|
-
return o.length < 2 ? {
|
|
918
|
-
nextIndex: a
|
|
919
|
-
} : {
|
|
920
|
-
entity: {
|
|
921
|
-
...T(n.values),
|
|
922
|
-
type: "polyline",
|
|
923
|
-
points: o,
|
|
924
|
-
closed: !!((u(n.values, 70) ?? 0) & 1),
|
|
925
|
-
bulges: r.some((l) => Math.abs(l) > 1e-9) ? r : void 0,
|
|
926
|
-
strokeWidth: Bt(et(u(n.values, 40), u(n.values, 41)), i),
|
|
927
|
-
layer: w(n.values, 8) ?? s,
|
|
928
|
-
colorIndex: u(n.values, 62) ?? c
|
|
929
|
-
},
|
|
930
|
-
nextIndex: a
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
function wt(t, e) {
|
|
934
|
-
const n = w(e, 2), o = x(u(e, 10), u(e, 20));
|
|
935
|
-
if (!n || !o)
|
|
936
|
-
return;
|
|
937
|
-
const r = t === "MINSERT";
|
|
938
|
-
return {
|
|
939
|
-
blockName: n,
|
|
940
|
-
point: o,
|
|
941
|
-
scaleX: u(e, 41) ?? 1,
|
|
942
|
-
scaleY: u(e, 42) ?? 1,
|
|
943
|
-
rotation: u(e, 50) ?? 0,
|
|
944
|
-
columns: r ? Math.max(u(e, 70) ?? 1, 1) : 1,
|
|
945
|
-
rows: r ? Math.max(u(e, 71) ?? 1, 1) : 1,
|
|
946
|
-
columnSpacing: r ? u(e, 44) ?? 0 : 0,
|
|
947
|
-
rowSpacing: r ? u(e, 45) ?? 0 : 0,
|
|
948
|
-
layer: w(e, 8),
|
|
949
|
-
colorIndex: u(e, 62),
|
|
950
|
-
trueColor: U(u(e, 420)),
|
|
951
|
-
opacity: q(u(e, 440)),
|
|
952
|
-
entityVisible: it(u(e, 60)),
|
|
953
|
-
lineType: V(w(e, 6)),
|
|
954
|
-
lineTypeScale: P(u(e, 48)),
|
|
955
|
-
lineWeight: W(u(e, 370))
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
function Ee(t) {
|
|
959
|
-
const e = w(t, 2);
|
|
960
|
-
if (e)
|
|
961
|
-
return {
|
|
962
|
-
blockName: e,
|
|
963
|
-
layer: w(t, 8),
|
|
964
|
-
colorIndex: u(t, 62),
|
|
965
|
-
trueColor: U(u(t, 420)),
|
|
966
|
-
opacity: q(u(t, 440)),
|
|
967
|
-
entityVisible: it(u(t, 60)),
|
|
968
|
-
lineType: V(w(t, 6)),
|
|
969
|
-
lineTypeScale: P(u(t, 48)),
|
|
970
|
-
lineWeight: W(u(t, 370))
|
|
971
|
-
};
|
|
972
|
-
}
|
|
973
|
-
function ve(t) {
|
|
974
|
-
const e = x(u(t, 13), u(t, 23)), n = x(u(t, 14), u(t, 24));
|
|
975
|
-
if (!e || !n)
|
|
976
|
-
return;
|
|
977
|
-
const o = x(u(t, 11), u(t, 21)) ?? _e(e, n), r = w(t, 1), i = r && r !== "<>" ? Lt(r) : ln(B(e, n));
|
|
978
|
-
return {
|
|
979
|
-
...T(t),
|
|
980
|
-
type: "dimension",
|
|
981
|
-
start: e,
|
|
982
|
-
end: n,
|
|
983
|
-
textPoint: o,
|
|
984
|
-
text: i,
|
|
985
|
-
height: u(t, 140) ?? u(t, 40) ?? Math.max(B(e, n) * 0.08, 1)
|
|
986
|
-
};
|
|
987
|
-
}
|
|
988
|
-
function Ne(t, e, n) {
|
|
989
|
-
const o = e.get(X(t.blockName));
|
|
990
|
-
if (!o)
|
|
991
|
-
return n.push(`DXF INSERT references missing block "${t.blockName}"; skipped.`), [];
|
|
992
|
-
const r = [];
|
|
993
|
-
for (let i = 0; i < t.rows; i += 1)
|
|
994
|
-
for (let s = 0; s < t.columns; s += 1) {
|
|
995
|
-
const c = {
|
|
996
|
-
blockBasePoint: o.basePoint,
|
|
997
|
-
insertionPoint: yt(t, s, i),
|
|
998
|
-
scaleX: t.scaleX,
|
|
999
|
-
scaleY: t.scaleY,
|
|
1000
|
-
rotation: t.rotation
|
|
1001
|
-
};
|
|
1002
|
-
for (const a of o.entities) r.push(ot(At(a, c), t));
|
|
1003
|
-
}
|
|
1004
|
-
return r;
|
|
1005
|
-
}
|
|
1006
|
-
function Te(t, e, n) {
|
|
1007
|
-
const o = e.get(X(t.blockName));
|
|
1008
|
-
return o ? o.entities.map((r) => ot(r, t)) : (n.push(`DXF DIMENSION references missing block "${t.blockName}"; skipped.`), []);
|
|
1009
|
-
}
|
|
1010
|
-
function yt(t, e, n) {
|
|
1011
|
-
const o = {
|
|
1012
|
-
x: e * t.columnSpacing,
|
|
1013
|
-
y: n * t.rowSpacing
|
|
1014
|
-
}, r = t.rotation * Math.PI / 180, i = Math.cos(r), s = Math.sin(r);
|
|
1015
|
-
return {
|
|
1016
|
-
x: t.point.x + o.x * i - o.y * s,
|
|
1017
|
-
y: t.point.y + o.x * s + o.y * i
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
function At(t, e) {
|
|
1021
|
-
const n = dt(e);
|
|
1022
|
-
switch (t.type) {
|
|
1023
|
-
case "line":
|
|
1024
|
-
return {
|
|
1025
|
-
...t,
|
|
1026
|
-
start: v(t.start, e),
|
|
1027
|
-
end: v(t.end, e)
|
|
1028
|
-
};
|
|
1029
|
-
case "construction-line":
|
|
1030
|
-
return {
|
|
1031
|
-
...t,
|
|
1032
|
-
point: v(t.point, e),
|
|
1033
|
-
direction: _(t.direction, e)
|
|
1034
|
-
};
|
|
1035
|
-
case "dimension":
|
|
1036
|
-
return {
|
|
1037
|
-
...t,
|
|
1038
|
-
start: v(t.start, e),
|
|
1039
|
-
end: v(t.end, e),
|
|
1040
|
-
textPoint: v(t.textPoint, e),
|
|
1041
|
-
height: t.height * n
|
|
1042
|
-
};
|
|
1043
|
-
case "point":
|
|
1044
|
-
return {
|
|
1045
|
-
...t,
|
|
1046
|
-
point: v(t.point, e)
|
|
1047
|
-
};
|
|
1048
|
-
case "circle":
|
|
1049
|
-
return {
|
|
1050
|
-
...t,
|
|
1051
|
-
center: v(t.center, e),
|
|
1052
|
-
radius: t.radius * n
|
|
1053
|
-
};
|
|
1054
|
-
case "arc":
|
|
1055
|
-
return {
|
|
1056
|
-
...t,
|
|
1057
|
-
center: v(t.center, e),
|
|
1058
|
-
radius: t.radius * n,
|
|
1059
|
-
startAngle: t.startAngle + e.rotation,
|
|
1060
|
-
endAngle: t.endAngle + e.rotation
|
|
1061
|
-
};
|
|
1062
|
-
case "ellipse": {
|
|
1063
|
-
const o = v(t.center, e), r = v(tt(t.center, t.majorAxis), e);
|
|
1064
|
-
return {
|
|
1065
|
-
...t,
|
|
1066
|
-
center: o,
|
|
1067
|
-
majorAxis: {
|
|
1068
|
-
x: r.x - o.x,
|
|
1069
|
-
y: r.y - o.y
|
|
1070
|
-
},
|
|
1071
|
-
ratio: t.ratio * (Math.abs(e.scaleY) / Math.abs(e.scaleX) || 1)
|
|
1072
|
-
};
|
|
1073
|
-
}
|
|
1074
|
-
case "polyline":
|
|
1075
|
-
return {
|
|
1076
|
-
...t,
|
|
1077
|
-
points: t.points.map((o) => v(o, e)),
|
|
1078
|
-
strokeWidth: t.strokeWidth == null ? void 0 : t.strokeWidth * dt(e)
|
|
1079
|
-
};
|
|
1080
|
-
case "face":
|
|
1081
|
-
return {
|
|
1082
|
-
...t,
|
|
1083
|
-
points: t.points.map((o) => v(o, e))
|
|
1084
|
-
};
|
|
1085
|
-
case "hatch":
|
|
1086
|
-
return {
|
|
1087
|
-
...t,
|
|
1088
|
-
loops: t.loops.map((o) => o.map((r) => v(r, e)))
|
|
1089
|
-
};
|
|
1090
|
-
case "spline":
|
|
1091
|
-
return {
|
|
1092
|
-
...t,
|
|
1093
|
-
points: t.points.map((o) => v(o, e))
|
|
1094
|
-
};
|
|
1095
|
-
case "text":
|
|
1096
|
-
return {
|
|
1097
|
-
...t,
|
|
1098
|
-
point: v(t.point, e),
|
|
1099
|
-
height: t.height * n,
|
|
1100
|
-
rotation: t.rotation + e.rotation,
|
|
1101
|
-
widthFactor: t.widthFactor * (Math.abs(e.scaleX) / n || 1)
|
|
1102
|
-
};
|
|
1103
|
-
case "image":
|
|
1104
|
-
return {
|
|
1105
|
-
...t,
|
|
1106
|
-
point: v(t.point, e),
|
|
1107
|
-
uVector: _(t.uVector, e),
|
|
1108
|
-
vVector: _(t.vVector, e)
|
|
1109
|
-
};
|
|
1110
|
-
default:
|
|
1111
|
-
return t;
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
function ot(t, e) {
|
|
1115
|
-
const n = !t.layer || H(t.layer) === "0", o = n ? e.layer ?? t.layer : t.layer, r = t.colorIndex === 0 || t.colorIndex == null && n, i = r ? e.colorIndex ?? t.colorIndex : t.colorIndex, s = t.trueColor ?? (r ? e.trueColor : void 0), c = t.opacity ?? (n ? e.opacity : void 0), a = t.entityVisible ?? e.entityVisible, l = t.lineType ?? (n ? e.lineType : void 0), f = t.lineTypeScale ?? (n ? e.lineTypeScale : void 0), d = t.lineWeight ?? (n ? e.lineWeight : void 0);
|
|
1116
|
-
return {
|
|
1117
|
-
...t,
|
|
1118
|
-
layer: o,
|
|
1119
|
-
colorIndex: i,
|
|
1120
|
-
trueColor: s,
|
|
1121
|
-
opacity: c,
|
|
1122
|
-
entityVisible: a,
|
|
1123
|
-
lineType: l,
|
|
1124
|
-
lineTypeScale: f,
|
|
1125
|
-
lineWeight: d
|
|
1126
|
-
};
|
|
1127
|
-
}
|
|
1128
|
-
function v(t, e) {
|
|
1129
|
-
const n = (t.x - e.blockBasePoint.x) * e.scaleX, o = (t.y - e.blockBasePoint.y) * e.scaleY, r = e.rotation * Math.PI / 180, i = Math.cos(r), s = Math.sin(r);
|
|
1130
|
-
return {
|
|
1131
|
-
x: e.insertionPoint.x + n * i - o * s,
|
|
1132
|
-
y: e.insertionPoint.y + n * s + o * i
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
function _(t, e) {
|
|
1136
|
-
const n = t.x * e.scaleX, o = t.y * e.scaleY, r = e.rotation * Math.PI / 180, i = Math.cos(r), s = Math.sin(r);
|
|
1137
|
-
return {
|
|
1138
|
-
x: n * i - o * s,
|
|
1139
|
-
y: n * s + o * i
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
function dt(t) {
|
|
1143
|
-
return Math.max((Math.abs(t.scaleX) + Math.abs(t.scaleY)) / 2, 1e-4);
|
|
1144
|
-
}
|
|
1145
|
-
function St(t, e) {
|
|
1146
|
-
var n;
|
|
1147
|
-
for (; e < t.length && ((n = t[e]) == null ? void 0 : n.code) !== 0; )
|
|
1148
|
-
e += 1;
|
|
1149
|
-
return e;
|
|
1150
|
-
}
|
|
1151
|
-
function Fe(t, e) {
|
|
1152
|
-
const n = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1153
|
-
n.classList.add("cadv-canvas");
|
|
1154
|
-
const o = Math.max(t.bounds.maxX - t.bounds.minX, 1), r = Math.max(t.bounds.maxY - t.bounds.minY, 1), i = Math.max(o, r) * 0.04;
|
|
1155
|
-
n.setAttribute("viewBox", `${-i} ${-i} ${o + i * 2} ${r + i * 2}`), n.setAttribute("role", "img"), n.setAttribute("aria-label", "CAD drawing preview");
|
|
1156
|
-
const s = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
1157
|
-
s.setAttribute("x", String(-i)), s.setAttribute("y", String(-i)), s.setAttribute("width", String(o + i * 2)), s.setAttribute("height", String(r + i * 2)), s.setAttribute("fill", "#ffffff"), n.appendChild(s);
|
|
1158
|
-
const c = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1159
|
-
c.setAttribute("fill", "none"), c.setAttribute("stroke", "#223245"), c.setAttribute("stroke-width", String(Math.max(o, r) / 520)), c.setAttribute("stroke-linecap", "round"), c.setAttribute("stroke-linejoin", "round"), n.appendChild(c);
|
|
1160
|
-
for (const a of t.entities) {
|
|
1161
|
-
const l = Ie(a, t.bounds, e);
|
|
1162
|
-
l && c.appendChild(l);
|
|
1163
|
-
}
|
|
1164
|
-
if (!t.entities.length) {
|
|
1165
|
-
const a = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1166
|
-
a.classList.add("cadv-empty"), a.setAttribute("x", "0"), a.setAttribute("y", "0"), a.textContent = "No supported DXF entities found.", n.appendChild(a);
|
|
1167
|
-
}
|
|
1168
|
-
return n;
|
|
1169
|
-
}
|
|
1170
|
-
function Ie(t, e, n) {
|
|
1171
|
-
var r;
|
|
1172
|
-
const o = (i, s = "stroke") => {
|
|
1173
|
-
if (i.setAttribute(s, t.color ?? D), s === "stroke") {
|
|
1174
|
-
!i.hasAttribute("stroke-width") && t.lineWeight != null && t.lineWeight > 0 && i.setAttribute("stroke-width", String(t.lineWeight));
|
|
1175
|
-
const c = un(t.lineType, t.lineTypePattern, t.lineTypeScale);
|
|
1176
|
-
c && i.setAttribute("stroke-dasharray", c);
|
|
1177
|
-
}
|
|
1178
|
-
if (t.layer) {
|
|
1179
|
-
i.setAttribute("data-layer", t.layer);
|
|
1180
|
-
const c = n.get(t.layer);
|
|
1181
|
-
c ? c.push(i) : n.set(t.layer, [i]);
|
|
1182
|
-
}
|
|
1183
|
-
return t.colorIndex != null && i.setAttribute("data-color-index", String(t.colorIndex)), t.trueColor && i.setAttribute("data-true-color", t.trueColor), t.opacity != null && i.setAttribute("opacity", String(t.opacity)), t.entityVisible === !1 && i.setAttribute("data-entity-visible", "false"), t.visible === !1 ? (i.setAttribute("display", "none"), i.setAttribute("data-layer-visible", "false")) : t.layer && i.setAttribute("data-layer-visible", "true"), i;
|
|
1184
|
-
};
|
|
1185
|
-
switch (t.type) {
|
|
1186
|
-
case "line": {
|
|
1187
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "line"), s = y(t.start, e), c = y(t.end, e);
|
|
1188
|
-
return i.setAttribute("x1", String(s.x)), i.setAttribute("y1", String(s.y)), i.setAttribute("x2", String(c.x)), i.setAttribute("y2", String(c.y)), o(i);
|
|
1189
|
-
}
|
|
1190
|
-
case "construction-line": {
|
|
1191
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "line"), s = Be(t, e), c = y(s.start, e), a = y(s.end, e);
|
|
1192
|
-
return i.setAttribute("x1", String(c.x)), i.setAttribute("y1", String(c.y)), i.setAttribute("x2", String(a.x)), i.setAttribute("y2", String(a.y)), i.setAttribute("data-construction-line", t.ray ? "ray" : "xline"), o(i);
|
|
1193
|
-
}
|
|
1194
|
-
case "dimension": {
|
|
1195
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1196
|
-
i.setAttribute("data-dimension", "true");
|
|
1197
|
-
const s = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1198
|
-
s.setAttribute("d", Re(t, e));
|
|
1199
|
-
const c = y(t.textPoint, e), a = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
1200
|
-
return a.setAttribute("x", String(c.x)), a.setAttribute("y", String(c.y)), a.setAttribute("stroke", "none"), a.setAttribute("fill", t.color ?? D), a.setAttribute("font-family", J(void 0)), a.setAttribute("font-size", String(t.height)), a.setAttribute("text-anchor", "middle"), a.setAttribute("dominant-baseline", "middle"), a.textContent = t.text, i.append(s, a), o(i);
|
|
1201
|
-
}
|
|
1202
|
-
case "point": {
|
|
1203
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "g"), s = y(t.point, e), c = Math.max(Math.max(e.maxX - e.minX, e.maxY - e.minY) / 140, 0.8), a = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
1204
|
-
a.setAttribute("x1", String(s.x - c)), a.setAttribute("y1", String(s.y)), a.setAttribute("x2", String(s.x + c)), a.setAttribute("y2", String(s.y));
|
|
1205
|
-
const l = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
1206
|
-
return l.setAttribute("x1", String(s.x)), l.setAttribute("y1", String(s.y - c)), l.setAttribute("x2", String(s.x)), l.setAttribute("y2", String(s.y + c)), i.setAttribute("data-point", "true"), i.append(a, l), o(i);
|
|
1207
|
-
}
|
|
1208
|
-
case "circle": {
|
|
1209
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = y(t.center, e);
|
|
1210
|
-
return i.setAttribute("cx", String(s.x)), i.setAttribute("cy", String(s.y)), i.setAttribute("r", String(t.radius)), o(i);
|
|
1211
|
-
}
|
|
1212
|
-
case "arc": {
|
|
1213
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1214
|
-
return i.setAttribute("d", De(t, e)), o(i);
|
|
1215
|
-
}
|
|
1216
|
-
case "ellipse": {
|
|
1217
|
-
const i = Ge(t) ? Le(t, e) : Ce(t, e);
|
|
1218
|
-
return o(i);
|
|
1219
|
-
}
|
|
1220
|
-
case "polyline": {
|
|
1221
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1222
|
-
return i.setAttribute("d", Pe(t, e)), t.strokeWidth != null && t.strokeWidth > 0 && i.setAttribute("stroke-width", String(t.strokeWidth)), o(i);
|
|
1223
|
-
}
|
|
1224
|
-
case "face": {
|
|
1225
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
1226
|
-
return i.setAttribute(
|
|
1227
|
-
"points",
|
|
1228
|
-
t.points.map((s) => {
|
|
1229
|
-
const c = y(s, e);
|
|
1230
|
-
return `${c.x},${c.y}`;
|
|
1231
|
-
}).join(" ")
|
|
1232
|
-
), i.setAttribute("fill-opacity", "0.18"), i.setAttribute("stroke-opacity", "0.85"), o(i), i.setAttribute("fill", t.color ?? D), i;
|
|
1233
|
-
}
|
|
1234
|
-
case "hatch": {
|
|
1235
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1236
|
-
return i.setAttribute("d", $e(t, e)), i.setAttribute("fill-rule", "evenodd"), i.setAttribute("clip-rule", "evenodd"), i.setAttribute("fill-opacity", t.solid ? "0.18" : "0.1"), i.setAttribute("stroke-opacity", "0.85"), t.patternName && i.setAttribute("data-hatch-pattern", t.patternName), o(i), i.setAttribute("fill", t.color ?? D), i;
|
|
1237
|
-
}
|
|
1238
|
-
case "spline": {
|
|
1239
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1240
|
-
return i.setAttribute("d", ke(t, e)), o(i);
|
|
1241
|
-
}
|
|
1242
|
-
case "text": {
|
|
1243
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "text"), s = y(t.point, e), c = It(t.value);
|
|
1244
|
-
return i.setAttribute("x", String(s.x)), i.setAttribute("y", String(s.y)), i.setAttribute("stroke", "none"), i.setAttribute("font-family", J(t.fontFamily)), i.setAttribute("font-size", String(t.height)), i.setAttribute("text-anchor", rn(t.horizontalAlign)), i.setAttribute("dominant-baseline", sn(t.verticalAlign)), i.setAttribute("transform", cn(t, s)), t.obliqueAngle && i.setAttribute("font-style", "italic"), c.length > 1 ? c.forEach((a, l) => {
|
|
1245
|
-
const f = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
|
1246
|
-
f.setAttribute("x", String(s.x)), l > 0 && f.setAttribute("dy", String(t.height * 1.2)), f.textContent = a, i.appendChild(f);
|
|
1247
|
-
}) : i.textContent = c[0] ?? "", o(i, "fill");
|
|
1248
|
-
}
|
|
1249
|
-
case "image": {
|
|
1250
|
-
const i = document.createElementNS("http://www.w3.org/2000/svg", "g"), c = Mt(t).map((p) => y(p, e)), [a, l, f, d] = c;
|
|
1251
|
-
if (!a || !l || !f || !d)
|
|
1252
|
-
return null;
|
|
1253
|
-
const h = st(t.source) ? t.source : void 0;
|
|
1254
|
-
if (h) {
|
|
1255
|
-
const p = document.createElementNS("http://www.w3.org/2000/svg", "image");
|
|
1256
|
-
if (p.setAttribute("href", h), p.setAttribute("x", "0"), p.setAttribute("y", "0"), p.setAttribute("width", String(t.width)), p.setAttribute("height", String(t.height)), p.setAttribute("preserveAspectRatio", "none"), p.setAttribute("transform", He(t, e)), t.fade != null && p.setAttribute("opacity", String(Math.max(0, Math.min(1, 1 - t.fade / 100)))), t.source && p.setAttribute("data-image-source", t.source), t.imageDefHandle && p.setAttribute("data-image-def", t.imageDefHandle), (r = t.clipBoundary) != null && r.length) {
|
|
1257
|
-
const g = Oe(t), m = document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), b = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
1258
|
-
m.setAttribute("id", g), m.setAttribute("clipPathUnits", "userSpaceOnUse"), b.setAttribute("points", c.map((S) => `${S.x},${S.y}`).join(" ")), m.appendChild(b), i.appendChild(m), p.setAttribute("clip-path", `url(#${g})`), p.setAttribute("data-image-clipped", "true");
|
|
1259
|
-
}
|
|
1260
|
-
i.appendChild(p);
|
|
1261
|
-
} else {
|
|
1262
|
-
const p = document.createElementNS("http://www.w3.org/2000/svg", "polygon");
|
|
1263
|
-
p.setAttribute("points", c.map((b) => `${b.x},${b.y}`).join(" ")), p.setAttribute("fill", "#f8fafc"), p.setAttribute("fill-opacity", "0.72"), p.setAttribute("stroke-dasharray", "6 3"), t.imageDefHandle && p.setAttribute("data-image-def", t.imageDefHandle), t.source && p.setAttribute("data-image-source", t.source), i.appendChild(o(p));
|
|
1264
|
-
const g = document.createElementNS("http://www.w3.org/2000/svg", "text"), m = Ke(c);
|
|
1265
|
-
g.setAttribute("x", String(m.x)), g.setAttribute("y", String(m.y)), g.setAttribute("text-anchor", "middle"), g.setAttribute("dominant-baseline", "middle"), g.setAttribute("font-family", J(void 0)), g.setAttribute("font-size", String(Math.max(Math.min(t.width, t.height) * 0.12, 2))), t.imageDefHandle && g.setAttribute("data-image-def", t.imageDefHandle), t.source && g.setAttribute("data-image-source", t.source), g.textContent = "IMAGE", i.appendChild(o(g, "fill"));
|
|
1266
|
-
}
|
|
1267
|
-
return t.imageDefHandle && i.setAttribute("data-image-def", t.imageDefHandle), t.source && i.setAttribute("data-image-source", t.source), o(i);
|
|
1268
|
-
}
|
|
1269
|
-
default:
|
|
1270
|
-
return null;
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
function Le(t, e) {
|
|
1274
|
-
const n = document.createElementNS("http://www.w3.org/2000/svg", "ellipse"), o = y(t.center, e), r = z(t.majorAxis), i = r * t.ratio;
|
|
1275
|
-
return n.setAttribute("cx", String(o.x)), n.setAttribute("cy", String(o.y)), n.setAttribute("rx", String(r)), n.setAttribute("ry", String(i)), n.setAttribute("transform", `rotate(${-Ft(t.majorAxis)} ${o.x} ${o.y})`), n;
|
|
1276
|
-
}
|
|
1277
|
-
function Ce(t, e) {
|
|
1278
|
-
const n = document.createElementNS("http://www.w3.org/2000/svg", "path"), r = Nt(t).map((i, s) => {
|
|
1279
|
-
const c = y(i, e);
|
|
1280
|
-
return `${s === 0 ? "M" : "L"} ${c.x} ${c.y}`;
|
|
1281
|
-
});
|
|
1282
|
-
return n.setAttribute("d", r.join(" ")), n;
|
|
1283
|
-
}
|
|
1284
|
-
function Pe(t, e) {
|
|
1285
|
-
var s;
|
|
1286
|
-
const n = t.points[0];
|
|
1287
|
-
if (!n)
|
|
1288
|
-
return "";
|
|
1289
|
-
const o = [], r = y(n, e);
|
|
1290
|
-
o.push(`M ${r.x} ${r.y}`);
|
|
1291
|
-
const i = t.closed ? t.points.length : t.points.length - 1;
|
|
1292
|
-
for (let c = 0; c < i; c += 1) {
|
|
1293
|
-
const a = t.points[c], l = t.points[(c + 1) % t.points.length];
|
|
1294
|
-
if (!a || !l)
|
|
1295
|
-
continue;
|
|
1296
|
-
const f = y(l, e), d = ((s = t.bulges) == null ? void 0 : s[c]) ?? 0;
|
|
1297
|
-
if (Math.abs(d) < 1e-9) {
|
|
1298
|
-
o.push(`L ${f.x} ${f.y}`);
|
|
1299
|
-
continue;
|
|
1300
|
-
}
|
|
1301
|
-
const h = B(a, l);
|
|
1302
|
-
if (h < 1e-9)
|
|
1303
|
-
continue;
|
|
1304
|
-
const p = Math.abs(4 * Math.atan(d)), g = h * (1 + d * d) / (4 * Math.abs(d)), m = p > Math.PI ? 1 : 0, b = d > 0 ? 0 : 1;
|
|
1305
|
-
o.push(`A ${g} ${g} 0 ${m} ${b} ${f.x} ${f.y}`);
|
|
1306
|
-
}
|
|
1307
|
-
return t.closed && o.push("Z"), o.join(" ");
|
|
1308
|
-
}
|
|
1309
|
-
function ke(t, e) {
|
|
1310
|
-
const n = t.points.map((i) => y(i, e));
|
|
1311
|
-
if (n.length < 2)
|
|
1312
|
-
return "";
|
|
1313
|
-
if (n.length === 2 || t.degree <= 1)
|
|
1314
|
-
return n.map((i, s) => `${s === 0 ? "M" : "L"} ${i.x} ${i.y}`).join(" ");
|
|
1315
|
-
const o = t.closed ? [...n, n[0]] : n, r = [`M ${o[0].x} ${o[0].y}`];
|
|
1316
|
-
for (let i = 0; i < o.length - 1; i += 1) {
|
|
1317
|
-
const s = o[i - 1] ?? o[i], c = o[i], a = o[i + 1], l = o[i + 2] ?? a, f = {
|
|
1318
|
-
x: c.x + (a.x - s.x) / 6,
|
|
1319
|
-
y: c.y + (a.y - s.y) / 6
|
|
1320
|
-
}, d = {
|
|
1321
|
-
x: a.x - (l.x - c.x) / 6,
|
|
1322
|
-
y: a.y - (l.y - c.y) / 6
|
|
1323
|
-
};
|
|
1324
|
-
r.push(`C ${f.x} ${f.y} ${d.x} ${d.y} ${a.x} ${a.y}`);
|
|
1325
|
-
}
|
|
1326
|
-
return t.closed && r.push("Z"), r.join(" ");
|
|
1327
|
-
}
|
|
1328
|
-
function $e(t, e) {
|
|
1329
|
-
return t.loops.map((n) => {
|
|
1330
|
-
const o = n[0];
|
|
1331
|
-
if (!o)
|
|
1332
|
-
return "";
|
|
1333
|
-
const r = [], i = y(o, e);
|
|
1334
|
-
r.push(`M ${i.x} ${i.y}`);
|
|
1335
|
-
for (const s of n.slice(1)) {
|
|
1336
|
-
const c = y(s, e);
|
|
1337
|
-
r.push(`L ${c.x} ${c.y}`);
|
|
1338
|
-
}
|
|
1339
|
-
return r.push("Z"), r.join(" ");
|
|
1340
|
-
}).filter(Boolean).join(" ");
|
|
1341
|
-
}
|
|
1342
|
-
function De(t, e) {
|
|
1343
|
-
const n = Q(t.center, t.radius, t.startAngle), o = Q(t.center, t.radius, t.endAngle), r = y(n, e), i = y(o, e), c = Ye(t.startAngle, t.endAngle) > 180 ? 1 : 0;
|
|
1344
|
-
return `M ${r.x} ${r.y} A ${t.radius} ${t.radius} 0 ${c} 0 ${i.x} ${i.y}`;
|
|
1345
|
-
}
|
|
1346
|
-
function Be(t, e) {
|
|
1347
|
-
const n = z(t.direction), o = {
|
|
1348
|
-
x: t.direction.x / n,
|
|
1349
|
-
y: t.direction.y / n
|
|
1350
|
-
}, r = Math.max(e.maxX - e.minX, e.maxY - e.minY, 1) * 2;
|
|
1351
|
-
return {
|
|
1352
|
-
start: t.ray ? t.point : {
|
|
1353
|
-
x: t.point.x - o.x * r,
|
|
1354
|
-
y: t.point.y - o.y * r
|
|
1355
|
-
},
|
|
1356
|
-
end: {
|
|
1357
|
-
x: t.point.x + o.x * r,
|
|
1358
|
-
y: t.point.y + o.y * r
|
|
1359
|
-
}
|
|
1360
|
-
};
|
|
1361
|
-
}
|
|
1362
|
-
function Re(t, e) {
|
|
1363
|
-
const n = y(t.start, e), o = y(t.end, e), r = Math.max(t.height * 0.8, B(t.start, t.end) * 0.04, 1), i = B(t.start, t.end) || 1, s = {
|
|
1364
|
-
x: -((o.y - n.y) / i),
|
|
1365
|
-
y: (o.x - n.x) / i
|
|
1366
|
-
}, c = {
|
|
1367
|
-
x: n.x + s.x * r,
|
|
1368
|
-
y: n.y + s.y * r
|
|
1369
|
-
}, a = {
|
|
1370
|
-
x: n.x - s.x * r,
|
|
1371
|
-
y: n.y - s.y * r
|
|
1372
|
-
}, l = {
|
|
1373
|
-
x: o.x + s.x * r,
|
|
1374
|
-
y: o.y + s.y * r
|
|
1375
|
-
}, f = {
|
|
1376
|
-
x: o.x - s.x * r,
|
|
1377
|
-
y: o.y - s.y * r
|
|
1378
|
-
};
|
|
1379
|
-
return [
|
|
1380
|
-
`M ${n.x} ${n.y} L ${o.x} ${o.y}`,
|
|
1381
|
-
`M ${c.x} ${c.y} L ${a.x} ${a.y}`,
|
|
1382
|
-
`M ${l.x} ${l.y} L ${f.x} ${f.y}`
|
|
1383
|
-
].join(" ");
|
|
1384
|
-
}
|
|
1385
|
-
function Mt(t) {
|
|
1386
|
-
var e;
|
|
1387
|
-
return (e = t.clipBoundary) != null && e.length ? t.clipBoundary.map((n) => Et(t, n)) : Xe(t);
|
|
1388
|
-
}
|
|
1389
|
-
function Xe(t) {
|
|
1390
|
-
return gt({ x: 0, y: 0 }, { x: t.width, y: t.height }, t.width, t.height).map(
|
|
1391
|
-
(e) => Et(t, e)
|
|
1392
|
-
);
|
|
1393
|
-
}
|
|
1394
|
-
function Et(t, e) {
|
|
1395
|
-
return tt(tt(t.point, ht(t.uVector, e.x)), ht(t.vVector, e.y));
|
|
1396
|
-
}
|
|
1397
|
-
function Oe(t) {
|
|
1398
|
-
return `cadv-image-clip-${(t.imageDefHandle ?? t.source ?? `${t.point.x}-${t.point.y}`).replace(/[^a-z0-9_-]+/gi, "-")}`;
|
|
1399
|
-
}
|
|
1400
|
-
function He(t, e) {
|
|
1401
|
-
const n = y(t.point, e);
|
|
1402
|
-
return [
|
|
1403
|
-
"matrix(",
|
|
1404
|
-
$(t.uVector.x),
|
|
1405
|
-
$(-t.uVector.y),
|
|
1406
|
-
$(t.vVector.x),
|
|
1407
|
-
$(-t.vVector.y),
|
|
1408
|
-
$(n.x),
|
|
1409
|
-
$(n.y),
|
|
1410
|
-
")"
|
|
1411
|
-
].join(" ");
|
|
1412
|
-
}
|
|
1413
|
-
function Ye(t, e) {
|
|
1414
|
-
let n = e - t;
|
|
1415
|
-
for (; n < 0; ) n += 360;
|
|
1416
|
-
for (; n > 360; ) n -= 360;
|
|
1417
|
-
return n;
|
|
1418
|
-
}
|
|
1419
|
-
function Q(t, e, n) {
|
|
1420
|
-
const o = n * Math.PI / 180;
|
|
1421
|
-
return {
|
|
1422
|
-
x: t.x + Math.cos(o) * e,
|
|
1423
|
-
y: t.y + Math.sin(o) * e
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
function vt(t) {
|
|
1427
|
-
var r;
|
|
1428
|
-
const e = [], n = t.closed ? t.points.length : t.points.length - 1;
|
|
1429
|
-
for (let i = 0; i < n; i += 1) {
|
|
1430
|
-
const s = t.points[i], c = t.points[(i + 1) % t.points.length];
|
|
1431
|
-
if (!s || !c)
|
|
1432
|
-
continue;
|
|
1433
|
-
e.push(s);
|
|
1434
|
-
const a = ((r = t.bulges) == null ? void 0 : r[i]) ?? 0;
|
|
1435
|
-
Math.abs(a) >= 1e-9 && e.push(...ze(s, c, a));
|
|
1436
|
-
}
|
|
1437
|
-
const o = t.points[t.points.length - 1];
|
|
1438
|
-
return !t.closed && o && e.push(o), e;
|
|
1439
|
-
}
|
|
1440
|
-
function ze(t, e, n, o = 24) {
|
|
1441
|
-
const r = B(t, e);
|
|
1442
|
-
if (r < 1e-9 || Math.abs(n) < 1e-9)
|
|
1443
|
-
return [];
|
|
1444
|
-
const i = r * (1 + n * n) / (4 * Math.abs(n)), s = r * (1 - n * n) / (4 * n), c = {
|
|
1445
|
-
x: (t.x + e.x) / 2,
|
|
1446
|
-
y: (t.y + e.y) / 2
|
|
1447
|
-
}, a = {
|
|
1448
|
-
x: -(e.y - t.y) / r,
|
|
1449
|
-
y: (e.x - t.x) / r
|
|
1450
|
-
}, l = {
|
|
1451
|
-
x: c.x + a.x * s,
|
|
1452
|
-
y: c.y + a.y * s
|
|
1453
|
-
}, f = Math.atan2(t.y - l.y, t.x - l.x), d = 4 * Math.atan(n), h = Math.max(6, Math.ceil(Math.abs(d) / (Math.PI * 2) * o)), p = [];
|
|
1454
|
-
for (let g = 1; g < h; g += 1) {
|
|
1455
|
-
const m = f + d * g / h;
|
|
1456
|
-
p.push({
|
|
1457
|
-
x: l.x + Math.cos(m) * i,
|
|
1458
|
-
y: l.y + Math.sin(m) * i
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
return p;
|
|
1462
|
-
}
|
|
1463
|
-
function Ve(t, e, n, o, r, i = 36) {
|
|
1464
|
-
let s = o - n;
|
|
1465
|
-
if (r)
|
|
1466
|
-
for (; s <= 0; ) s += 360;
|
|
1467
|
-
else
|
|
1468
|
-
for (; s >= 0; ) s -= 360;
|
|
1469
|
-
const c = Math.max(6, Math.ceil(Math.abs(s) / 360 * i)), a = [];
|
|
1470
|
-
for (let l = 0; l <= c; l += 1)
|
|
1471
|
-
a.push(Q(t, e, n + s * l / c));
|
|
1472
|
-
return a;
|
|
1473
|
-
}
|
|
1474
|
-
function je(t, e, n, o, r, i, s = 72) {
|
|
1475
|
-
let c = o * Math.PI / 180, l = r * Math.PI / 180 - c;
|
|
1476
|
-
if (i)
|
|
1477
|
-
for (; l <= 0; ) l += Math.PI * 2;
|
|
1478
|
-
else
|
|
1479
|
-
for (; l >= 0; ) l -= Math.PI * 2;
|
|
1480
|
-
const f = Math.max(8, Math.ceil(Math.abs(l) / (Math.PI * 2) * s)), d = {
|
|
1481
|
-
x: -e.y * n,
|
|
1482
|
-
y: e.x * n
|
|
1483
|
-
}, h = [];
|
|
1484
|
-
for (let p = 0; p <= f; p += 1) {
|
|
1485
|
-
const g = c + l * p / f;
|
|
1486
|
-
h.push({
|
|
1487
|
-
x: t.x + e.x * Math.cos(g) + d.x * Math.sin(g),
|
|
1488
|
-
y: t.y + e.y * Math.cos(g) + d.y * Math.sin(g)
|
|
1489
|
-
});
|
|
1490
|
-
}
|
|
1491
|
-
return h;
|
|
1492
|
-
}
|
|
1493
|
-
function We(t, e, n, o = 8) {
|
|
1494
|
-
if (t.length < 2)
|
|
1495
|
-
return [];
|
|
1496
|
-
if (t.length === 2 || n <= 1)
|
|
1497
|
-
return [...t];
|
|
1498
|
-
const r = e ? [...t, t[0]] : t, i = [];
|
|
1499
|
-
for (let s = 0; s < r.length - 1; s += 1) {
|
|
1500
|
-
const c = r[s - 1] ?? r[s], a = r[s], l = r[s + 1], f = r[s + 2] ?? l;
|
|
1501
|
-
for (let d = 0; d < o; d += 1) {
|
|
1502
|
-
const h = d / o;
|
|
1503
|
-
i.push(Ue(c, a, l, f, h));
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
return i.push(r[r.length - 1]), i;
|
|
1507
|
-
}
|
|
1508
|
-
function Ue(t, e, n, o, r) {
|
|
1509
|
-
const i = r * r, s = i * r;
|
|
1510
|
-
return {
|
|
1511
|
-
x: 0.5 * (2 * e.x + (-t.x + n.x) * r + (2 * t.x - 5 * e.x + 4 * n.x - o.x) * i + (-t.x + 3 * e.x - 3 * n.x + o.x) * s),
|
|
1512
|
-
y: 0.5 * (2 * e.y + (-t.y + n.y) * r + (2 * t.y - 5 * e.y + 4 * n.y - o.y) * i + (-t.y + 3 * e.y - 3 * n.y + o.y) * s)
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
function Nt(t, e = 72) {
|
|
1516
|
-
const n = Tt(t.startParameter, t.endParameter), o = Math.max(8, Math.ceil(n / (Math.PI * 2) * e)), r = qe(t), i = [];
|
|
1517
|
-
for (let s = 0; s <= o; s += 1) {
|
|
1518
|
-
const c = t.startParameter + n * s / o;
|
|
1519
|
-
i.push({
|
|
1520
|
-
x: t.center.x + t.majorAxis.x * Math.cos(c) + r.x * Math.sin(c),
|
|
1521
|
-
y: t.center.y + t.majorAxis.y * Math.cos(c) + r.y * Math.sin(c)
|
|
1522
|
-
});
|
|
1523
|
-
}
|
|
1524
|
-
return i;
|
|
1525
|
-
}
|
|
1526
|
-
function qe(t) {
|
|
1527
|
-
return {
|
|
1528
|
-
x: -t.majorAxis.y * t.ratio,
|
|
1529
|
-
y: t.majorAxis.x * t.ratio
|
|
1530
|
-
};
|
|
1531
|
-
}
|
|
1532
|
-
function Ge(t) {
|
|
1533
|
-
return Math.abs(Tt(t.startParameter, t.endParameter) - Math.PI * 2) < 1e-4;
|
|
1534
|
-
}
|
|
1535
|
-
function Tt(t, e) {
|
|
1536
|
-
let n = e - t;
|
|
1537
|
-
for (; n < 0; ) n += Math.PI * 2;
|
|
1538
|
-
for (; n > Math.PI * 2; ) n -= Math.PI * 2;
|
|
1539
|
-
return n || Math.PI * 2;
|
|
1540
|
-
}
|
|
1541
|
-
function z(t) {
|
|
1542
|
-
return Math.hypot(t.x, t.y);
|
|
1543
|
-
}
|
|
1544
|
-
function B(t, e) {
|
|
1545
|
-
return Math.hypot(e.x - t.x, e.y - t.y);
|
|
1546
|
-
}
|
|
1547
|
-
function Ft(t) {
|
|
1548
|
-
return Math.atan2(t.y, t.x) * 180 / Math.PI;
|
|
1549
|
-
}
|
|
1550
|
-
function tt(t, e) {
|
|
1551
|
-
return {
|
|
1552
|
-
x: t.x + e.x,
|
|
1553
|
-
y: t.y + e.y
|
|
1554
|
-
};
|
|
1555
|
-
}
|
|
1556
|
-
function ht(t, e) {
|
|
1557
|
-
return {
|
|
1558
|
-
x: t.x * e,
|
|
1559
|
-
y: t.y * e
|
|
1560
|
-
};
|
|
1561
|
-
}
|
|
1562
|
-
function _e(t, e) {
|
|
1563
|
-
return {
|
|
1564
|
-
x: (t.x + e.x) / 2,
|
|
1565
|
-
y: (t.y + e.y) / 2
|
|
1566
|
-
};
|
|
1567
|
-
}
|
|
1568
|
-
function Ke(t) {
|
|
1569
|
-
if (!t.length)
|
|
1570
|
-
return { x: 0, y: 0 };
|
|
1571
|
-
const e = t.reduce(
|
|
1572
|
-
(n, o) => ({
|
|
1573
|
-
x: n.x + o.x,
|
|
1574
|
-
y: n.y + o.y
|
|
1575
|
-
}),
|
|
1576
|
-
{ x: 0, y: 0 }
|
|
1577
|
-
);
|
|
1578
|
-
return {
|
|
1579
|
-
x: e.x / t.length,
|
|
1580
|
-
y: e.y / t.length
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
|
-
function y(t, e) {
|
|
1584
|
-
return {
|
|
1585
|
-
x: t.x - e.minX,
|
|
1586
|
-
y: e.maxY - t.y
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
function Ze(t, e) {
|
|
1590
|
-
let n = 1 / 0, o = 1 / 0, r = -1 / 0, i = -1 / 0, s = 0;
|
|
1591
|
-
const c = (l) => {
|
|
1592
|
-
n = Math.min(n, l.x), o = Math.min(o, l.y), r = Math.max(r, l.x), i = Math.max(i, l.y), s++;
|
|
1593
|
-
}, a = (l) => {
|
|
1594
|
-
for (const f of l) c(f);
|
|
1595
|
-
};
|
|
1596
|
-
e && (c({ x: e.minX, y: e.minY }), c({ x: e.maxX, y: e.maxY }));
|
|
1597
|
-
for (const l of t)
|
|
1598
|
-
switch (l.type) {
|
|
1599
|
-
case "line":
|
|
1600
|
-
c(l.start), c(l.end);
|
|
1601
|
-
break;
|
|
1602
|
-
case "construction-line":
|
|
1603
|
-
case "point":
|
|
1604
|
-
c(l.point);
|
|
1605
|
-
break;
|
|
1606
|
-
case "dimension":
|
|
1607
|
-
c(l.start), c(l.end), a(pt(an(l)));
|
|
1608
|
-
break;
|
|
1609
|
-
case "circle":
|
|
1610
|
-
case "arc":
|
|
1611
|
-
c({ x: l.center.x - l.radius, y: l.center.y - l.radius }), c({ x: l.center.x + l.radius, y: l.center.y + l.radius });
|
|
1612
|
-
break;
|
|
1613
|
-
case "ellipse":
|
|
1614
|
-
a(Nt(l, 144));
|
|
1615
|
-
break;
|
|
1616
|
-
case "polyline":
|
|
1617
|
-
a(Je(vt(l), l.strokeWidth));
|
|
1618
|
-
break;
|
|
1619
|
-
case "face":
|
|
1620
|
-
case "spline":
|
|
1621
|
-
a(l.points);
|
|
1622
|
-
break;
|
|
1623
|
-
case "hatch":
|
|
1624
|
-
for (const f of l.loops) a(f);
|
|
1625
|
-
break;
|
|
1626
|
-
case "text":
|
|
1627
|
-
a(pt(l));
|
|
1628
|
-
break;
|
|
1629
|
-
case "image":
|
|
1630
|
-
a(Mt(l));
|
|
1631
|
-
break;
|
|
1632
|
-
}
|
|
1633
|
-
return s ? { minX: n, minY: o, maxX: r, maxY: i } : {
|
|
1634
|
-
minX: 0,
|
|
1635
|
-
minY: 0,
|
|
1636
|
-
maxX: 100,
|
|
1637
|
-
maxY: 100
|
|
1638
|
-
};
|
|
1639
|
-
}
|
|
1640
|
-
function Je(t, e) {
|
|
1641
|
-
if (!e || e <= 0)
|
|
1642
|
-
return t;
|
|
1643
|
-
const n = e / 2;
|
|
1644
|
-
return t.flatMap((o) => [
|
|
1645
|
-
{
|
|
1646
|
-
x: o.x - n,
|
|
1647
|
-
y: o.y - n
|
|
1648
|
-
},
|
|
1649
|
-
{
|
|
1650
|
-
x: o.x + n,
|
|
1651
|
-
y: o.y + n
|
|
1652
|
-
}
|
|
1653
|
-
]);
|
|
1654
|
-
}
|
|
1655
|
-
function Qe(t) {
|
|
1656
|
-
switch (t) {
|
|
1657
|
-
case 1:
|
|
1658
|
-
case 4:
|
|
1659
|
-
return "center";
|
|
1660
|
-
case 2:
|
|
1661
|
-
case 3:
|
|
1662
|
-
case 5:
|
|
1663
|
-
return "right";
|
|
1664
|
-
default:
|
|
1665
|
-
return "left";
|
|
1666
|
-
}
|
|
1667
|
-
}
|
|
1668
|
-
function tn(t) {
|
|
1669
|
-
switch (t) {
|
|
1670
|
-
case 1:
|
|
1671
|
-
return "bottom";
|
|
1672
|
-
case 2:
|
|
1673
|
-
return "middle";
|
|
1674
|
-
case 3:
|
|
1675
|
-
return "top";
|
|
1676
|
-
default:
|
|
1677
|
-
return "baseline";
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
function en(t) {
|
|
1681
|
-
switch (t) {
|
|
1682
|
-
case 2:
|
|
1683
|
-
case 5:
|
|
1684
|
-
case 8:
|
|
1685
|
-
return "center";
|
|
1686
|
-
case 3:
|
|
1687
|
-
case 6:
|
|
1688
|
-
case 9:
|
|
1689
|
-
return "right";
|
|
1690
|
-
default:
|
|
1691
|
-
return "left";
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
function nn(t) {
|
|
1695
|
-
switch (t) {
|
|
1696
|
-
case 1:
|
|
1697
|
-
case 2:
|
|
1698
|
-
case 3:
|
|
1699
|
-
return "top";
|
|
1700
|
-
case 4:
|
|
1701
|
-
case 5:
|
|
1702
|
-
case 6:
|
|
1703
|
-
return "middle";
|
|
1704
|
-
case 7:
|
|
1705
|
-
case 8:
|
|
1706
|
-
case 9:
|
|
1707
|
-
return "bottom";
|
|
1708
|
-
default:
|
|
1709
|
-
return "top";
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
function on(t) {
|
|
1713
|
-
const e = x(u(t, 11), u(t, 21));
|
|
1714
|
-
return e && z(e) > 1e-9 ? Ft(e) : void 0;
|
|
1715
|
-
}
|
|
1716
|
-
function rn(t) {
|
|
1717
|
-
switch (t) {
|
|
1718
|
-
case "center":
|
|
1719
|
-
return "middle";
|
|
1720
|
-
case "right":
|
|
1721
|
-
return "end";
|
|
1722
|
-
default:
|
|
1723
|
-
return "start";
|
|
1724
|
-
}
|
|
1725
|
-
}
|
|
1726
|
-
function sn(t) {
|
|
1727
|
-
switch (t) {
|
|
1728
|
-
case "bottom":
|
|
1729
|
-
return "text-after-edge";
|
|
1730
|
-
case "middle":
|
|
1731
|
-
return "middle";
|
|
1732
|
-
case "top":
|
|
1733
|
-
return "text-before-edge";
|
|
1734
|
-
default:
|
|
1735
|
-
return "alphabetic";
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
function cn(t, e) {
|
|
1739
|
-
const n = [];
|
|
1740
|
-
if (t.rotation && n.push(`rotate(${-t.rotation} ${e.x} ${e.y})`), t.widthFactor !== 1 || t.obliqueAngle) {
|
|
1741
|
-
const o = t.obliqueAngle ? ` skewX(${-t.obliqueAngle})` : "";
|
|
1742
|
-
n.push(`translate(${e.x} ${e.y}) scale(${t.widthFactor} 1)${o} translate(${-e.x} ${-e.y})`);
|
|
1743
|
-
}
|
|
1744
|
-
return n.join(" ");
|
|
1745
|
-
}
|
|
1746
|
-
function It(t) {
|
|
1747
|
-
return t.replace(/\\P/g, `
|
|
1748
|
-
`).split(`
|
|
1749
|
-
`);
|
|
1750
|
-
}
|
|
1751
|
-
function pt(t) {
|
|
1752
|
-
const e = It(t.value), n = Math.max(...e.map((a) => a.length * t.height * 0.58 * t.widthFactor), t.height), o = t.height * Math.max(e.length, 1) * 1.2, r = t.horizontalAlign === "center" ? t.point.x - n / 2 : t.horizontalAlign === "right" ? t.point.x - n : t.point.x, i = t.horizontalAlign === "center" ? t.point.x + n / 2 : t.horizontalAlign === "right" ? t.point.x : t.point.x + n, s = t.verticalAlign === "middle" ? t.point.y - o / 2 : t.verticalAlign === "top" ? t.point.y - o : t.point.y, c = t.verticalAlign === "middle" ? t.point.y + o / 2 : t.verticalAlign === "top" ? t.point.y : t.point.y + o;
|
|
1753
|
-
return [
|
|
1754
|
-
t.point,
|
|
1755
|
-
{ x: r, y: s },
|
|
1756
|
-
{ x: i, y: c }
|
|
1757
|
-
];
|
|
1758
|
-
}
|
|
1759
|
-
function an(t) {
|
|
1760
|
-
return {
|
|
1761
|
-
type: "text",
|
|
1762
|
-
point: t.textPoint,
|
|
1763
|
-
value: t.text,
|
|
1764
|
-
height: t.height,
|
|
1765
|
-
rotation: 0,
|
|
1766
|
-
widthFactor: 1,
|
|
1767
|
-
obliqueAngle: 0,
|
|
1768
|
-
horizontalAlign: "center",
|
|
1769
|
-
verticalAlign: "middle"
|
|
1770
|
-
};
|
|
1771
|
-
}
|
|
1772
|
-
function ln(t) {
|
|
1773
|
-
return Number(t.toFixed(4)).toString();
|
|
1774
|
-
}
|
|
1775
|
-
function Lt(t) {
|
|
1776
|
-
return t.replace(/\r\n/g, `
|
|
1777
|
-
`).replace(/\\P/g, `
|
|
1778
|
-
`).replace(/\\~/g, " ").replace(/%%d/gi, "°").replace(/%%p/gi, "±").replace(/%%c/gi, "Ø").replace(/\\[Ss]([^;]*);/g, (e, n) => n.replace(/[#$^]/g, "/")).replace(/\\[AaCcFfHhWwQqTt][^;]*;/g, "").replace(/\\[LlOoKk]/g, "").replace(/\\([{}\\])/g, "$1").replace(/[{}]/g, "");
|
|
1779
|
-
}
|
|
1780
|
-
function x(t, e) {
|
|
1781
|
-
if (!(t == null || e == null || !Number.isFinite(t) || !Number.isFinite(e)))
|
|
1782
|
-
return { x: t, y: e };
|
|
1783
|
-
}
|
|
1784
|
-
function T(t) {
|
|
1785
|
-
let e, n, o, r, i, s, c, a, l = 0;
|
|
1786
|
-
for (const f of t)
|
|
1787
|
-
switch (f.code) {
|
|
1788
|
-
case 8:
|
|
1789
|
-
l & 1 || (e = f.value.trim() || void 0, l |= 1);
|
|
1790
|
-
break;
|
|
1791
|
-
case 62:
|
|
1792
|
-
l & 2 || (n = Number(f.value), l |= 2);
|
|
1793
|
-
break;
|
|
1794
|
-
case 420:
|
|
1795
|
-
l & 4 || (o = Number(f.value), l |= 4);
|
|
1796
|
-
break;
|
|
1797
|
-
case 440:
|
|
1798
|
-
l & 8 || (r = Number(f.value), l |= 8);
|
|
1799
|
-
break;
|
|
1800
|
-
case 60:
|
|
1801
|
-
l & 16 || (i = Number(f.value), l |= 16);
|
|
1802
|
-
break;
|
|
1803
|
-
case 6:
|
|
1804
|
-
l & 32 || (s = f.value.trim() || void 0, l |= 32);
|
|
1805
|
-
break;
|
|
1806
|
-
case 48:
|
|
1807
|
-
l & 64 || (c = Number(f.value), l |= 64);
|
|
1808
|
-
break;
|
|
1809
|
-
case 370:
|
|
1810
|
-
l & 128 || (a = Number(f.value), l |= 128);
|
|
1811
|
-
break;
|
|
1812
|
-
}
|
|
1813
|
-
return {
|
|
1814
|
-
layer: e,
|
|
1815
|
-
colorIndex: Number.isFinite(n) ? n : void 0,
|
|
1816
|
-
trueColor: U(o),
|
|
1817
|
-
opacity: q(r),
|
|
1818
|
-
entityVisible: it(i),
|
|
1819
|
-
lineType: V(s),
|
|
1820
|
-
lineTypeScale: P(c),
|
|
1821
|
-
lineWeight: W(a)
|
|
1822
|
-
};
|
|
1823
|
-
}
|
|
1824
|
-
function V(t) {
|
|
1825
|
-
const e = t == null ? void 0 : t.trim();
|
|
1826
|
-
if (!(!e || /^by(layer|block)$/i.test(e) || /^continuous$/i.test(e)))
|
|
1827
|
-
return j(e);
|
|
1828
|
-
}
|
|
1829
|
-
function j(t) {
|
|
1830
|
-
const e = t == null ? void 0 : t.trim();
|
|
1831
|
-
return e ? e.toUpperCase() : void 0;
|
|
1832
|
-
}
|
|
1833
|
-
function Ct(t) {
|
|
1834
|
-
return t.trim().toUpperCase();
|
|
1835
|
-
}
|
|
1836
|
-
function W(t) {
|
|
1837
|
-
if (!(t == null || !Number.isFinite(t) || t <= 0))
|
|
1838
|
-
return Math.max(t / 100, 0.2);
|
|
1839
|
-
}
|
|
1840
|
-
function P(t) {
|
|
1841
|
-
if (!(t == null || !Number.isFinite(t) || t <= 0))
|
|
1842
|
-
return t;
|
|
1843
|
-
}
|
|
1844
|
-
function un(t, e, n = 1) {
|
|
1845
|
-
const o = P(n) ?? 1, r = Pt(e, o);
|
|
1846
|
-
if (r)
|
|
1847
|
-
return r;
|
|
1848
|
-
if (t) {
|
|
1849
|
-
if (/DASHDOT|CENTER/.test(t))
|
|
1850
|
-
return K([8, 3, 1.5, 3], o);
|
|
1851
|
-
if (/DOT/.test(t))
|
|
1852
|
-
return K([1.5, 3], o);
|
|
1853
|
-
if (/DASH|HIDDEN|BORDER|PHANTOM/.test(t))
|
|
1854
|
-
return K([7, 4], o);
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
function Pt(t, e = 1) {
|
|
1858
|
-
const n = (t == null ? void 0 : t.filter((i) => Number.isFinite(i))) ?? [];
|
|
1859
|
-
if (!n.length || !n.some((i) => Math.abs(i) > 1e-9))
|
|
1860
|
-
return;
|
|
1861
|
-
const o = Math.max(...n.map((i) => Math.abs(i))), r = Math.max(o * 0.1, 0.1);
|
|
1862
|
-
return n.map((i) => {
|
|
1863
|
-
const s = Math.abs(i) < 1e-9 ? r : Math.abs(i);
|
|
1864
|
-
return kt(s * e);
|
|
1865
|
-
}).join(" ");
|
|
1866
|
-
}
|
|
1867
|
-
function K(t, e) {
|
|
1868
|
-
return t.map((n) => kt(n * e)).join(" ");
|
|
1869
|
-
}
|
|
1870
|
-
function kt(t) {
|
|
1871
|
-
return String(Number(t.toFixed(4)));
|
|
1872
|
-
}
|
|
1873
|
-
function $(t) {
|
|
1874
|
-
return String(Number(t.toFixed(6)));
|
|
1875
|
-
}
|
|
1876
|
-
function $t(t) {
|
|
1877
|
-
return t.filter((e, n) => {
|
|
1878
|
-
const o = t[n - 1];
|
|
1879
|
-
return !Dt(o, e);
|
|
1880
|
-
});
|
|
1881
|
-
}
|
|
1882
|
-
function Dt(t, e) {
|
|
1883
|
-
return !!(t && e && Math.abs(t.x - e.x) < 1e-9 && Math.abs(t.y - e.y) < 1e-9);
|
|
1884
|
-
}
|
|
1885
|
-
function fn(t, e) {
|
|
1886
|
-
Dt(t[t.length - 1], e) || t.push(e);
|
|
1887
|
-
}
|
|
1888
|
-
function et(t, e) {
|
|
1889
|
-
const n = [t, e].filter((o) => typeof o == "number" && Number.isFinite(o) && o > 0);
|
|
1890
|
-
if (n.length)
|
|
1891
|
-
return n.reduce((o, r) => o + r, 0) / n.length;
|
|
1892
|
-
}
|
|
1893
|
-
function Bt(t, e) {
|
|
1894
|
-
if (t != null && Number.isFinite(t) && t > 0)
|
|
1895
|
-
return t;
|
|
1896
|
-
const n = e.filter((o) => typeof o == "number" && Number.isFinite(o) && o > 0);
|
|
1897
|
-
if (n.length)
|
|
1898
|
-
return n.reduce((o, r) => o + r, 0) / n.length;
|
|
1899
|
-
}
|
|
1900
|
-
function R(t, e, n) {
|
|
1901
|
-
const o = [];
|
|
1902
|
-
let r;
|
|
1903
|
-
for (const i of t) {
|
|
1904
|
-
if (i.code === e) {
|
|
1905
|
-
r = Number(i.value);
|
|
1906
|
-
continue;
|
|
1907
|
-
}
|
|
1908
|
-
if (i.code === n && r != null) {
|
|
1909
|
-
const s = Number(i.value);
|
|
1910
|
-
Number.isFinite(r) && Number.isFinite(s) && o.push({
|
|
1911
|
-
x: r,
|
|
1912
|
-
y: s
|
|
1913
|
-
}), r = void 0;
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
return o;
|
|
1917
|
-
}
|
|
1918
|
-
function u(t, e) {
|
|
1919
|
-
for (const n of t)
|
|
1920
|
-
if (n.code === e) {
|
|
1921
|
-
const o = Number(n.value);
|
|
1922
|
-
return Number.isFinite(o) ? o : void 0;
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
function dn(t, e) {
|
|
1926
|
-
return t.filter((n) => n.code === e).map((n) => Number(n.value)).filter((n) => Number.isFinite(n));
|
|
1927
|
-
}
|
|
1928
|
-
function w(t, e) {
|
|
1929
|
-
var o;
|
|
1930
|
-
return ((o = t.find((r) => r.code === e)) == null ? void 0 : o.value.trim()) || void 0;
|
|
1931
|
-
}
|
|
1932
|
-
function hn(t) {
|
|
1933
|
-
var e;
|
|
1934
|
-
for (let n = 0; n < t.length; n += 1) {
|
|
1935
|
-
const o = t[n];
|
|
1936
|
-
if ((o == null ? void 0 : o.code) === 360 || (o == null ? void 0 : o.code) === 340)
|
|
1937
|
-
return o.value;
|
|
1938
|
-
if ((o == null ? void 0 : o.code) === 1001 && /^ACAD_IMAGE_DICT$/i.test(o.value)) {
|
|
1939
|
-
const r = (e = t.slice(n + 1).find((i) => i.code === 360 || i.code === 340)) == null ? void 0 : e.value;
|
|
1940
|
-
if (r)
|
|
1941
|
-
return r;
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
}
|
|
1945
|
-
function pn(t) {
|
|
1946
|
-
var i, s, c, a, l;
|
|
1947
|
-
const e = /* @__PURE__ */ new Map();
|
|
1948
|
-
let n = !1, o = !1, r = 0;
|
|
1949
|
-
for (; r < t.length; ) {
|
|
1950
|
-
const f = t[r];
|
|
1951
|
-
if (f.code === 0 && f.value === "SECTION" && ((i = t[r + 1]) == null ? void 0 : i.code) === 2 && ((s = t[r + 1]) == null ? void 0 : s.value) === "TABLES") {
|
|
1952
|
-
n = !0, r += 2;
|
|
1953
|
-
continue;
|
|
1954
|
-
}
|
|
1955
|
-
if (n && f.code === 0 && f.value === "ENDSEC") {
|
|
1956
|
-
n = !1, o = !1, r += 1;
|
|
1957
|
-
continue;
|
|
1958
|
-
}
|
|
1959
|
-
if (!n) {
|
|
1960
|
-
r += 1;
|
|
1961
|
-
continue;
|
|
1962
|
-
}
|
|
1963
|
-
if (f.code === 0 && f.value === "TABLE" && ((c = t[r + 1]) == null ? void 0 : c.code) === 2 && ((a = t[r + 1]) == null ? void 0 : a.value) === "LTYPE") {
|
|
1964
|
-
o = !0, r += 2;
|
|
1965
|
-
continue;
|
|
1966
|
-
}
|
|
1967
|
-
if (o && f.code === 0 && f.value === "ENDTAB") {
|
|
1968
|
-
o = !1, r += 1;
|
|
1969
|
-
continue;
|
|
1970
|
-
}
|
|
1971
|
-
if (!o || f.code !== 0 || f.value !== "LTYPE") {
|
|
1972
|
-
r += 1;
|
|
1973
|
-
continue;
|
|
1974
|
-
}
|
|
1975
|
-
const d = [];
|
|
1976
|
-
for (r += 1; r < t.length && ((l = t[r]) == null ? void 0 : l.code) !== 0; )
|
|
1977
|
-
d.push(t[r]), r += 1;
|
|
1978
|
-
const h = mn(d), p = j(h == null ? void 0 : h.name);
|
|
1979
|
-
h && p && e.set(p, h);
|
|
1980
|
-
}
|
|
1981
|
-
return e;
|
|
1982
|
-
}
|
|
1983
|
-
function mn(t) {
|
|
1984
|
-
const e = w(t, 2);
|
|
1985
|
-
if (!e)
|
|
1986
|
-
return;
|
|
1987
|
-
const n = dn(t, 49);
|
|
1988
|
-
return {
|
|
1989
|
-
name: j(e) ?? e,
|
|
1990
|
-
description: w(t, 3),
|
|
1991
|
-
pattern: n,
|
|
1992
|
-
dashArray: Pt(n)
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
function gn(t) {
|
|
1996
|
-
var r, i, s;
|
|
1997
|
-
const e = /* @__PURE__ */ new Map();
|
|
1998
|
-
let n = !1, o = 0;
|
|
1999
|
-
for (; o < t.length; ) {
|
|
2000
|
-
const c = t[o];
|
|
2001
|
-
if (c.code === 0 && c.value === "SECTION" && ((r = t[o + 1]) == null ? void 0 : r.code) === 2 && ((i = t[o + 1]) == null ? void 0 : i.value) === "OBJECTS") {
|
|
2002
|
-
n = !0, o += 2;
|
|
2003
|
-
continue;
|
|
2004
|
-
}
|
|
2005
|
-
if (n && c.code === 0 && c.value === "ENDSEC") {
|
|
2006
|
-
n = !1, o += 1;
|
|
2007
|
-
continue;
|
|
2008
|
-
}
|
|
2009
|
-
if (!n || c.code !== 0 || c.value !== "IMAGEDEF") {
|
|
2010
|
-
o += 1;
|
|
2011
|
-
continue;
|
|
2012
|
-
}
|
|
2013
|
-
const a = [];
|
|
2014
|
-
for (o += 1; o < t.length && ((s = t[o]) == null ? void 0 : s.code) !== 0; )
|
|
2015
|
-
a.push(t[o]), o += 1;
|
|
2016
|
-
const l = xn(a);
|
|
2017
|
-
l && e.set(Ct(l.handle), l);
|
|
2018
|
-
}
|
|
2019
|
-
return e;
|
|
2020
|
-
}
|
|
2021
|
-
function xn(t) {
|
|
2022
|
-
const e = w(t, 5);
|
|
2023
|
-
if (e)
|
|
2024
|
-
return {
|
|
2025
|
-
handle: e,
|
|
2026
|
-
source: w(t, 1),
|
|
2027
|
-
width: u(t, 10),
|
|
2028
|
-
height: u(t, 20)
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
function bn(t, e) {
|
|
2032
|
-
var s, c, a, l, f;
|
|
2033
|
-
const n = /* @__PURE__ */ new Map();
|
|
2034
|
-
let o = !1, r = !1, i = 0;
|
|
2035
|
-
for (; i < t.length; ) {
|
|
2036
|
-
const d = t[i];
|
|
2037
|
-
if (d.code === 0 && d.value === "SECTION" && ((s = t[i + 1]) == null ? void 0 : s.code) === 2 && ((c = t[i + 1]) == null ? void 0 : c.value) === "TABLES") {
|
|
2038
|
-
o = !0, i += 2;
|
|
2039
|
-
continue;
|
|
2040
|
-
}
|
|
2041
|
-
if (o && d.code === 0 && d.value === "ENDSEC") {
|
|
2042
|
-
o = !1, r = !1, i += 1;
|
|
2043
|
-
continue;
|
|
2044
|
-
}
|
|
2045
|
-
if (!o) {
|
|
2046
|
-
i += 1;
|
|
2047
|
-
continue;
|
|
2048
|
-
}
|
|
2049
|
-
if (d.code === 0 && d.value === "TABLE" && ((a = t[i + 1]) == null ? void 0 : a.code) === 2 && ((l = t[i + 1]) == null ? void 0 : l.value) === "LAYER") {
|
|
2050
|
-
r = !0, i += 2;
|
|
2051
|
-
continue;
|
|
2052
|
-
}
|
|
2053
|
-
if (r && d.code === 0 && d.value === "ENDTAB") {
|
|
2054
|
-
r = !1, i += 1;
|
|
2055
|
-
continue;
|
|
2056
|
-
}
|
|
2057
|
-
if (!r || d.code !== 0 || d.value !== "LAYER") {
|
|
2058
|
-
i += 1;
|
|
2059
|
-
continue;
|
|
2060
|
-
}
|
|
2061
|
-
const h = [];
|
|
2062
|
-
for (i += 1; i < t.length && ((f = t[i]) == null ? void 0 : f.code) !== 0; )
|
|
2063
|
-
h.push(t[i]), i += 1;
|
|
2064
|
-
const p = wn(h, e);
|
|
2065
|
-
p && n.set(H(p.name), p);
|
|
2066
|
-
}
|
|
2067
|
-
return n;
|
|
2068
|
-
}
|
|
2069
|
-
function wn(t, e) {
|
|
2070
|
-
var d;
|
|
2071
|
-
const n = w(t, 2);
|
|
2072
|
-
if (!n)
|
|
2073
|
-
return;
|
|
2074
|
-
const o = u(t, 62), r = o == null ? void 0 : Math.abs(o), i = V(w(t, 6)), s = i ? (d = e.get(i)) == null ? void 0 : d.pattern : void 0, c = U(u(t, 420)), a = u(t, 70) ?? 0, l = !!(a & 1), f = !!(a & 4);
|
|
2075
|
-
return {
|
|
2076
|
-
name: n,
|
|
2077
|
-
colorIndex: r,
|
|
2078
|
-
trueColor: c,
|
|
2079
|
-
color: c ?? Rt(r),
|
|
2080
|
-
opacity: q(u(t, 440)),
|
|
2081
|
-
lineType: i,
|
|
2082
|
-
lineTypePattern: s,
|
|
2083
|
-
lineWeight: W(u(t, 370)),
|
|
2084
|
-
frozen: l,
|
|
2085
|
-
locked: f,
|
|
2086
|
-
visible: (o == null ? !0 : o >= 0) && !l
|
|
2087
|
-
};
|
|
2088
|
-
}
|
|
2089
|
-
function yn(t) {
|
|
2090
|
-
const e = new Map(t.layerStyles.map((n) => [H(n.name), n]));
|
|
2091
|
-
return t.layers.map((n) => {
|
|
2092
|
-
const o = e.get(H(n));
|
|
2093
|
-
return {
|
|
2094
|
-
id: n,
|
|
2095
|
-
name: n,
|
|
2096
|
-
color: o == null ? void 0 : o.color,
|
|
2097
|
-
visible: (o == null ? void 0 : o.visible) ?? !0
|
|
2098
|
-
};
|
|
2099
|
-
});
|
|
2100
|
-
}
|
|
2101
|
-
function An(t, e, n, o = 1) {
|
|
2102
|
-
for (const r of t) {
|
|
2103
|
-
const i = r.layer ? e.get(H(r.layer)) : void 0, s = r.trueColor ?? Rt(r.colorIndex), c = r.lineType ?? (i == null ? void 0 : i.lineType), a = r.lineTypePattern ?? Mn(c, n) ?? (i == null ? void 0 : i.lineTypePattern), l = Sn(r.lineTypeScale, o);
|
|
2104
|
-
r.lineType = c, r.lineTypePattern = a, r.lineTypeScale = l, r.lineWeight ?? (r.lineWeight = i == null ? void 0 : i.lineWeight), r.trueColor ?? (r.trueColor = i == null ? void 0 : i.trueColor), r.opacity ?? (r.opacity = i == null ? void 0 : i.opacity), r.color = s ?? (i == null ? void 0 : i.color) ?? D, r.visible = (r.entityVisible ?? !0) && ((i == null ? void 0 : i.visible) ?? !0);
|
|
2105
|
-
}
|
|
2106
|
-
return t;
|
|
2107
|
-
}
|
|
2108
|
-
function Sn(t, e) {
|
|
2109
|
-
const n = P(t) ?? 1, o = P(e) ?? 1, r = n * o;
|
|
2110
|
-
return Math.abs(r - 1) < 1e-9 ? void 0 : r;
|
|
2111
|
-
}
|
|
2112
|
-
function Mn(t, e) {
|
|
2113
|
-
var o;
|
|
2114
|
-
const n = j(t);
|
|
2115
|
-
return n ? (o = e.get(n)) == null ? void 0 : o.pattern : void 0;
|
|
2116
|
-
}
|
|
2117
|
-
function Rt(t) {
|
|
2118
|
-
if (t == null)
|
|
2119
|
-
return;
|
|
2120
|
-
const e = Math.abs(t);
|
|
2121
|
-
return e === 0 || e === 256 ? void 0 : {
|
|
2122
|
-
1: "#ff0000",
|
|
2123
|
-
2: "#ffff00",
|
|
2124
|
-
3: "#00ff00",
|
|
2125
|
-
4: "#00ffff",
|
|
2126
|
-
5: "#0000ff",
|
|
2127
|
-
6: "#ff00ff",
|
|
2128
|
-
7: D,
|
|
2129
|
-
8: "#808080",
|
|
2130
|
-
9: "#c0c0c0"
|
|
2131
|
-
}[e] ?? void 0;
|
|
2132
|
-
}
|
|
2133
|
-
function U(t) {
|
|
2134
|
-
if (t == null || !Number.isFinite(t))
|
|
2135
|
-
return;
|
|
2136
|
-
const e = Math.trunc(t) & 16777215, n = e >> 16 & 255, o = e >> 8 & 255, r = e & 255;
|
|
2137
|
-
return `#${Z(n)}${Z(o)}${Z(r)}`;
|
|
2138
|
-
}
|
|
2139
|
-
function Z(t) {
|
|
2140
|
-
return t.toString(16).padStart(2, "0");
|
|
2141
|
-
}
|
|
2142
|
-
function q(t) {
|
|
2143
|
-
if (t == null || !Number.isFinite(t) || t < 0)
|
|
2144
|
-
return;
|
|
2145
|
-
const e = Math.trunc(t);
|
|
2146
|
-
if (e <= 90)
|
|
2147
|
-
return Number(Math.max(0, Math.min(1, 1 - e / 100)).toFixed(3));
|
|
2148
|
-
if ((e & 33554432) === 33554432)
|
|
2149
|
-
return Number(Math.max(0, Math.min(1, (e & 255) / 255)).toFixed(3));
|
|
2150
|
-
}
|
|
2151
|
-
function it(t) {
|
|
2152
|
-
if (!(t == null || !Number.isFinite(t)))
|
|
2153
|
-
return t !== 1;
|
|
2154
|
-
}
|
|
2155
|
-
function En(t) {
|
|
2156
|
-
const e = /* @__PURE__ */ new Set();
|
|
2157
|
-
for (const n of t) {
|
|
2158
|
-
const o = n.trim();
|
|
2159
|
-
o && e.add(o);
|
|
2160
|
-
}
|
|
2161
|
-
return [...e].sort();
|
|
2162
|
-
}
|
|
2163
|
-
function H(t) {
|
|
2164
|
-
return t.trim().toLowerCase();
|
|
2165
|
-
}
|
|
2166
|
-
function X(t) {
|
|
2167
|
-
return t.trim().toLowerCase();
|
|
2168
|
-
}
|
|
2169
|
-
function vn(t) {
|
|
2170
|
-
return [...new Set(t)];
|
|
2171
|
-
}
|
|
2172
|
-
function Nn(t) {
|
|
2173
|
-
var i, s, c, a, l;
|
|
2174
|
-
const e = /* @__PURE__ */ new Map();
|
|
2175
|
-
let n = !1, o = !1, r = 0;
|
|
2176
|
-
for (; r < t.length; ) {
|
|
2177
|
-
const f = t[r];
|
|
2178
|
-
if (f.code === 0 && f.value === "SECTION" && ((i = t[r + 1]) == null ? void 0 : i.code) === 2 && ((s = t[r + 1]) == null ? void 0 : s.value) === "TABLES") {
|
|
2179
|
-
n = !0, r += 2;
|
|
2180
|
-
continue;
|
|
2181
|
-
}
|
|
2182
|
-
if (n && f.code === 0 && f.value === "ENDSEC") {
|
|
2183
|
-
n = !1, o = !1, r += 1;
|
|
2184
|
-
continue;
|
|
2185
|
-
}
|
|
2186
|
-
if (!n) {
|
|
2187
|
-
r += 1;
|
|
2188
|
-
continue;
|
|
2189
|
-
}
|
|
2190
|
-
if (f.code === 0 && f.value === "TABLE" && ((c = t[r + 1]) == null ? void 0 : c.code) === 2 && ((a = t[r + 1]) == null ? void 0 : a.value) === "STYLE") {
|
|
2191
|
-
o = !0, r += 2;
|
|
2192
|
-
continue;
|
|
2193
|
-
}
|
|
2194
|
-
if (o && f.code === 0 && f.value === "ENDTAB") {
|
|
2195
|
-
o = !1, r += 1;
|
|
2196
|
-
continue;
|
|
2197
|
-
}
|
|
2198
|
-
if (!o || f.code !== 0 || f.value !== "STYLE") {
|
|
2199
|
-
r += 1;
|
|
2200
|
-
continue;
|
|
2201
|
-
}
|
|
2202
|
-
const d = [];
|
|
2203
|
-
for (r += 1; r < t.length && ((l = t[r]) == null ? void 0 : l.code) !== 0; )
|
|
2204
|
-
d.push(t[r]), r += 1;
|
|
2205
|
-
const h = Tn(d);
|
|
2206
|
-
h && e.set(k(h.name), h);
|
|
2207
|
-
}
|
|
2208
|
-
return e;
|
|
2209
|
-
}
|
|
2210
|
-
function Tn(t) {
|
|
2211
|
-
const e = w(t, 2);
|
|
2212
|
-
if (!e)
|
|
2213
|
-
return;
|
|
2214
|
-
const n = w(t, 3), o = w(t, 4);
|
|
2215
|
-
return {
|
|
2216
|
-
name: e,
|
|
2217
|
-
fontFile: n,
|
|
2218
|
-
bigFontFile: o,
|
|
2219
|
-
fontFamily: n && !nt(n) ? kn(n) : void 0
|
|
2220
|
-
};
|
|
2221
|
-
}
|
|
2222
|
-
async function Fn(t, e, n, o, r) {
|
|
2223
|
-
if (!e)
|
|
2224
|
-
return t;
|
|
2225
|
-
const i = /* @__PURE__ */ new Set(), s = [];
|
|
2226
|
-
for (const a of t.entities) {
|
|
2227
|
-
if (C(r), a.type !== "image" || !a.source || st(a.source)) {
|
|
2228
|
-
s.push(a);
|
|
2229
|
-
continue;
|
|
2230
|
-
}
|
|
2231
|
-
const l = a.source, f = await e({
|
|
2232
|
-
family: "cad",
|
|
2233
|
-
sourceFormat: n,
|
|
2234
|
-
source: l,
|
|
2235
|
-
relation: "image",
|
|
2236
|
-
handle: a.imageDefHandle,
|
|
2237
|
-
name: l.split(/[\\/]/).pop() ?? l
|
|
2238
|
-
});
|
|
2239
|
-
C(r);
|
|
2240
|
-
const d = In(f, o);
|
|
2241
|
-
for (const h of d.warnings)
|
|
2242
|
-
i.add(h);
|
|
2243
|
-
s.push({
|
|
2244
|
-
...a,
|
|
2245
|
-
source: d.source ?? a.source
|
|
2246
|
-
});
|
|
2247
|
-
}
|
|
2248
|
-
const c = new Map(t.textStyles.map((a) => [k(a.name), a]));
|
|
2249
|
-
return {
|
|
2250
|
-
...t,
|
|
2251
|
-
entities: s,
|
|
2252
|
-
warnings: [...rt(s, c), ...i]
|
|
2253
|
-
};
|
|
2254
|
-
}
|
|
2255
|
-
function In(t, e) {
|
|
2256
|
-
return t ? typeof t == "string" ? {
|
|
2257
|
-
source: t,
|
|
2258
|
-
warnings: []
|
|
2259
|
-
} : t instanceof Blob || ArrayBuffer.isView(t) || t instanceof ArrayBuffer ? {
|
|
2260
|
-
source: Y(t, e),
|
|
2261
|
-
warnings: []
|
|
2262
|
-
} : {
|
|
2263
|
-
source: Y(t.source, e),
|
|
2264
|
-
warnings: t.warnings ?? []
|
|
2265
|
-
} : { warnings: [] };
|
|
2266
|
-
}
|
|
2267
|
-
function Y(t, e) {
|
|
2268
|
-
if (t) {
|
|
2269
|
-
if (typeof t == "string")
|
|
2270
|
-
return t;
|
|
2271
|
-
if (t instanceof Blob) {
|
|
2272
|
-
const n = URL.createObjectURL(t);
|
|
2273
|
-
return e.add(n), n;
|
|
2274
|
-
}
|
|
2275
|
-
if (ArrayBuffer.isView(t)) {
|
|
2276
|
-
const n = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
2277
|
-
return Y(new Blob([new Uint8Array(n)]), e);
|
|
2278
|
-
}
|
|
2279
|
-
if (t instanceof ArrayBuffer)
|
|
2280
|
-
return Y(new Blob([t]), e);
|
|
2281
|
-
}
|
|
2282
|
-
}
|
|
2283
|
-
function C(t) {
|
|
2284
|
-
if (t != null && t.aborted) throw new DOMException("CAD preview aborted.", "AbortError");
|
|
2285
|
-
}
|
|
2286
|
-
function Ln(t, e) {
|
|
2287
|
-
const n = [], o = /* @__PURE__ */ new Set();
|
|
2288
|
-
for (const [r, i] of t.entities.entries()) {
|
|
2289
|
-
if (i.type !== "text") continue;
|
|
2290
|
-
i.styleName && o.add(k(i.styleName));
|
|
2291
|
-
const s = e.entities[r], c = s !== i && s.type === "text";
|
|
2292
|
-
n.push({
|
|
2293
|
-
fontFamily: i.fontFamily,
|
|
2294
|
-
fontFile: i.fontFile,
|
|
2295
|
-
styleName: i.styleName,
|
|
2296
|
-
resolvedFontFamily: c ? s.fontFamily : void 0,
|
|
2297
|
-
source: c ? "application" : void 0
|
|
2298
|
-
});
|
|
2299
|
-
}
|
|
2300
|
-
for (const r of t.textStyles)
|
|
2301
|
-
o.has(k(r.name)) || n.push({ fontFamily: r.fontFamily, fontFile: r.fontFile, styleName: r.name }), r.bigFontFile && n.push({ fontFile: r.bigFontFile, styleName: r.name });
|
|
2302
|
-
return n;
|
|
2303
|
-
}
|
|
2304
|
-
function Cn(t, e, n) {
|
|
2305
|
-
if (!e)
|
|
2306
|
-
return t;
|
|
2307
|
-
const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = t.entities.map((c) => {
|
|
2308
|
-
if (c.type !== "text")
|
|
2309
|
-
return c;
|
|
2310
|
-
const a = Pn(
|
|
2311
|
-
e({
|
|
2312
|
-
family: "cad",
|
|
2313
|
-
sourceFormat: n,
|
|
2314
|
-
fontFamily: c.fontFamily,
|
|
2315
|
-
fontFile: c.fontFile,
|
|
2316
|
-
styleName: c.styleName,
|
|
2317
|
-
text: c.value
|
|
2318
|
-
})
|
|
2319
|
-
);
|
|
2320
|
-
for (const l of a.warnings)
|
|
2321
|
-
o.add(l);
|
|
2322
|
-
return a.fontFamily ? (c.fontFile && r.add(c.fontFile), {
|
|
2323
|
-
...c,
|
|
2324
|
-
fontFamily: a.fontFamily
|
|
2325
|
-
}) : c;
|
|
2326
|
-
}), s = new Map(t.textStyles.map((c) => [k(c.name), c]));
|
|
2327
|
-
return {
|
|
2328
|
-
...t,
|
|
2329
|
-
entities: i,
|
|
2330
|
-
warnings: [...rt(i, s, r), ...o]
|
|
2331
|
-
};
|
|
2332
|
-
}
|
|
2333
|
-
function Pn(t) {
|
|
2334
|
-
return t ? typeof t == "string" ? {
|
|
2335
|
-
fontFamily: t,
|
|
2336
|
-
warnings: []
|
|
2337
|
-
} : {
|
|
2338
|
-
fontFamily: t.fontFamily,
|
|
2339
|
-
warnings: t.warnings ?? []
|
|
2340
|
-
} : { warnings: [] };
|
|
2341
|
-
}
|
|
2342
|
-
function rt(t, e, n = /* @__PURE__ */ new Set()) {
|
|
2343
|
-
const o = /* @__PURE__ */ new Set(), r = t.filter((c) => c.type === "text"), i = t.filter((c) => c.type === "image"), s = /* @__PURE__ */ new Set();
|
|
2344
|
-
for (const c of e.values())
|
|
2345
|
-
c.fontFile && nt(c.fontFile) && !n.has(c.fontFile) && s.add(c.fontFile), c.bigFontFile && nt(c.bigFontFile) && !n.has(c.bigFontFile) && s.add(c.bigFontFile);
|
|
2346
|
-
for (const c of r)
|
|
2347
|
-
c.styleName && !e.has(k(c.styleName)) && o.add(`DXF text style "${c.styleName}" was referenced but not found; browser fallback fonts are used.`);
|
|
2348
|
-
s.size && o.add(`DXF references SHX font files (${[...s].sort().join(", ")}), which browsers cannot render directly; CSS fallback fonts are used.`);
|
|
2349
|
-
for (const c of i) {
|
|
2350
|
-
if (!c.source) {
|
|
2351
|
-
o.add(
|
|
2352
|
-
c.imageDefHandle ? `DXF IMAGE references IMAGEDEF "${c.imageDefHandle}" but no image path was found; placeholder is shown.` : "DXF IMAGE is missing an IMAGEDEF reference; placeholder is shown."
|
|
2353
|
-
);
|
|
2354
|
-
continue;
|
|
2355
|
-
}
|
|
2356
|
-
st(c.source) || o.add(`DXF IMAGE source "${c.source}" requires an application resource resolver; placeholder is shown.`);
|
|
2357
|
-
}
|
|
2358
|
-
return [...o];
|
|
2359
|
-
}
|
|
2360
|
-
function J(t) {
|
|
2361
|
-
const e = "system-ui, sans-serif";
|
|
2362
|
-
return t ? `"${t.replace(/"/g, "")}", ${e}` : e;
|
|
2363
|
-
}
|
|
2364
|
-
function kn(t) {
|
|
2365
|
-
const e = t.split(/[\\/]/).pop() ?? t;
|
|
2366
|
-
return e.replace(/\.(ttf|otf|ttc|woff2?|fon)$/i, "").replace(/[_-]+/g, " ").trim() || e;
|
|
2367
|
-
}
|
|
2368
|
-
function nt(t) {
|
|
2369
|
-
return /\.shx$/i.test(t.trim());
|
|
2370
|
-
}
|
|
2371
|
-
function st(t) {
|
|
2372
|
-
return !!(t && /^(data:image\/|blob:|https?:\/\/)/i.test(t.trim()));
|
|
2373
|
-
}
|
|
2374
|
-
function k(t) {
|
|
2375
|
-
return t.trim().toLowerCase();
|
|
2376
|
-
}
|
|
2377
|
-
async function $n(t, e) {
|
|
2378
|
-
if (typeof t == "string") {
|
|
2379
|
-
if (t.trimStart().toLowerCase().startsWith("data:"))
|
|
2380
|
-
return Dn(t);
|
|
2381
|
-
const n = await fetch(t, { signal: e.signal });
|
|
2382
|
-
if (!n.ok)
|
|
2383
|
-
throw new Error(`Failed to load CAD source: ${n.status} ${n.statusText}`.trim());
|
|
2384
|
-
return n.text();
|
|
2385
|
-
}
|
|
2386
|
-
return t instanceof Blob ? t.text() : ArrayBuffer.isView(t) ? new TextDecoder().decode(new Uint8Array(t.buffer, t.byteOffset, t.byteLength)) : t instanceof ArrayBuffer ? new TextDecoder().decode(t) : String(t);
|
|
2387
|
-
}
|
|
2388
|
-
function Dn(t) {
|
|
2389
|
-
const e = t.indexOf(",");
|
|
2390
|
-
if (e < 0)
|
|
2391
|
-
return t;
|
|
2392
|
-
const n = t.slice(0, e).toLowerCase(), o = t.slice(e + 1);
|
|
2393
|
-
if (n.includes(";base64")) {
|
|
2394
|
-
const r = atob(o), i = Uint8Array.from(r, (s) => s.charCodeAt(0));
|
|
2395
|
-
return new TextDecoder().decode(i);
|
|
2396
|
-
}
|
|
2397
|
-
return decodeURIComponent(o);
|
|
2398
|
-
}
|
|
2399
|
-
function Xt(t) {
|
|
2400
|
-
return String(t ?? "").trim().replace(/^\./, "").toLowerCase();
|
|
2401
|
-
}
|
|
2402
|
-
export {
|
|
2403
|
-
On as a,
|
|
2404
|
-
Xn as c
|
|
2405
|
-
};
|