@nebula-spatial/cad-loader 0.2.3 → 0.2.4
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/CHANGELOG.md +8 -0
- package/README.md +22 -0
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +1396 -1321
- package/dist/core/parser/bin-parser.d.ts +17 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +560 -551
- package/dist/loader/internal/external-variant-sidecar-fetch.d.ts +0 -1
- package/dist/loader/internal/geo-loader-pipeline.d.ts +2 -0
- package/dist/loader/internal/geo-node-builder.d.ts +1 -0
- package/dist/loader/internal/geo-prepare-worker-types.d.ts +1 -0
- package/dist/shared/text-builder.d.ts +25 -0
- package/dist/workers/geo-prepare.worker.js +1046 -973
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
class
|
|
1
|
+
var xe = Object.defineProperty;
|
|
2
|
+
var ge = (t, n, e) => n in t ? xe(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
|
|
3
|
+
var gn = (t, n, e) => ge(t, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
class u extends Error {
|
|
5
5
|
constructor(e, o) {
|
|
6
6
|
super(o);
|
|
7
|
-
|
|
7
|
+
gn(this, "code");
|
|
8
8
|
this.name = "GeoLoaderError", this.code = e;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
const
|
|
12
|
-
function
|
|
11
|
+
const Yt = 4096;
|
|
12
|
+
function Oo(t, n, e, o, i = "u8") {
|
|
13
13
|
return {
|
|
14
14
|
count: o,
|
|
15
15
|
raw: new Uint8Array(t, n, e - n).slice(),
|
|
16
|
-
groupLayerEncoding:
|
|
16
|
+
groupLayerEncoding: i
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Qt(t) {
|
|
20
20
|
return t >= 6 ? "u16_lw" : t >= 5 ? "u8_lw" : t >= 4 ? "u16" : "u8";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function bn(t) {
|
|
23
23
|
return t === "u16_lw" ? 13 : t === "u8_lw" ? 12 : t === "u16" ? 9 : 8;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function Bn(t, n, e) {
|
|
26
26
|
return e === "u16" || e === "u16_lw" ? t.getUint16(n + 7, !0) : t.getUint8(n + 7);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function he(t) {
|
|
29
29
|
return t === "u16" || t === "u16_lw" ? 2 : 1;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Un(t, n, e) {
|
|
32
32
|
if (!(e !== "u8_lw" && e !== "u16_lw"))
|
|
33
|
-
return t.getFloat32(n + 7 +
|
|
34
|
-
}
|
|
35
|
-
function
|
|
36
|
-
if (e >
|
|
37
|
-
throw new
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
throw new
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
45
|
-
for (let
|
|
46
|
-
y[
|
|
47
|
-
|
|
33
|
+
return t.getFloat32(n + 7 + he(e), !0);
|
|
34
|
+
}
|
|
35
|
+
function ft(t, n, e, o, i = t.byteLength, r = "u8") {
|
|
36
|
+
if (e > i || i > t.byteLength)
|
|
37
|
+
throw new u("E_GROUP_RANGE", "Group byte range exceeds payload length");
|
|
38
|
+
let s = e;
|
|
39
|
+
const l = o * 2, a = l * 4;
|
|
40
|
+
if (s + a > i)
|
|
41
|
+
throw new u("E_GROUP_RANGE", "Group position bytes exceed payload length");
|
|
42
|
+
let c;
|
|
43
|
+
if (l > 0) {
|
|
44
|
+
const A = new Uint8Array(t, s, a), y = new Uint8Array(a), x = l;
|
|
45
|
+
for (let h = 0; h < l; h++)
|
|
46
|
+
y[h * 4] = A[h], y[h * 4 + 1] = A[x + h], y[h * 4 + 2] = A[x * 2 + h], y[h * 4 + 3] = A[x * 3 + h];
|
|
47
|
+
c = new Float32Array(y.buffer);
|
|
48
48
|
} else
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
throw new
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
const
|
|
57
|
-
for (let
|
|
58
|
-
if (
|
|
59
|
-
throw new
|
|
60
|
-
const y = n.getUint32(
|
|
61
|
-
if (
|
|
62
|
-
throw new
|
|
63
|
-
|
|
64
|
-
startVertex:
|
|
49
|
+
c = new Float32Array(0);
|
|
50
|
+
if (s += a, s + 4 > i)
|
|
51
|
+
throw new u("E_GROUP_RANGE", "Missing seg_count field for group");
|
|
52
|
+
const _ = n.getUint32(s, !0);
|
|
53
|
+
s += 4;
|
|
54
|
+
const f = [];
|
|
55
|
+
let d = 0;
|
|
56
|
+
const m = bn(r);
|
|
57
|
+
for (let A = 0; A < _; A++) {
|
|
58
|
+
if (s + m > i)
|
|
59
|
+
throw new u("E_GROUP_RANGE", "Segment record exceeds payload length");
|
|
60
|
+
const y = n.getUint32(s, !0), x = n.getUint8(s + 4), h = n.getUint8(s + 5), R = n.getUint8(s + 6), w = Bn(n, s, r), p = Un(n, s, r);
|
|
61
|
+
if (d + y > o)
|
|
62
|
+
throw new u("E_SEGMENT_SUM", "Segment vertex_count sum exceeds group count");
|
|
63
|
+
f.push({
|
|
64
|
+
startVertex: d,
|
|
65
65
|
vertexCount: y,
|
|
66
|
-
color: [
|
|
67
|
-
layerIndex:
|
|
68
|
-
...
|
|
69
|
-
}),
|
|
70
|
-
const
|
|
66
|
+
color: [x, h, R],
|
|
67
|
+
layerIndex: w,
|
|
68
|
+
...p === void 0 ? {} : { lineweightPx: p }
|
|
69
|
+
}), s += m;
|
|
70
|
+
const v = d * 2;
|
|
71
71
|
if (y > 1) {
|
|
72
|
-
let
|
|
73
|
-
for (let
|
|
74
|
-
const
|
|
75
|
-
|
|
72
|
+
let U = c[v], D = c[v + 1];
|
|
73
|
+
for (let $ = 1; $ < y; $++) {
|
|
74
|
+
const M = v + $ * 2;
|
|
75
|
+
U += c[M], D += c[M + 1], c[M] = U, c[M + 1] = D;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
d += y;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
throw new
|
|
80
|
+
if (d !== o)
|
|
81
|
+
throw new u("E_SEGMENT_SUM", `Segment vertex_count sum ${d} does not match group count ${o}`);
|
|
82
82
|
return {
|
|
83
|
-
chunk: { pos:
|
|
84
|
-
offset:
|
|
83
|
+
chunk: { pos: c, count: o, segments: f },
|
|
84
|
+
offset: s
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const r = o * 2,
|
|
89
|
-
if (e +
|
|
90
|
-
throw new
|
|
91
|
-
const
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
throw new
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
let
|
|
99
|
-
const
|
|
100
|
-
for (let
|
|
101
|
-
if (
|
|
102
|
-
throw new
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
throw new
|
|
106
|
-
|
|
107
|
-
startVertex:
|
|
108
|
-
vertexCount:
|
|
109
|
-
color: [y,
|
|
110
|
-
layerIndex:
|
|
111
|
-
...
|
|
112
|
-
}),
|
|
87
|
+
function ye(t, n, e, o, i = "u8") {
|
|
88
|
+
const r = o * 2, s = r * 4;
|
|
89
|
+
if (e + s > t.byteLength)
|
|
90
|
+
throw new u("E_GROUP_RANGE", "Group position bytes exceed payload length");
|
|
91
|
+
const l = new Uint8Array(t, e, s);
|
|
92
|
+
let a = e + s;
|
|
93
|
+
if (a + 4 > t.byteLength)
|
|
94
|
+
throw new u("E_GROUP_RANGE", "Missing seg_count field for group");
|
|
95
|
+
const c = n.getUint32(a, !0);
|
|
96
|
+
a += 4;
|
|
97
|
+
const _ = [];
|
|
98
|
+
let f = 0;
|
|
99
|
+
const d = bn(i);
|
|
100
|
+
for (let m = 0; m < c; m++) {
|
|
101
|
+
if (a + d > t.byteLength)
|
|
102
|
+
throw new u("E_GROUP_RANGE", "Segment record exceeds payload length");
|
|
103
|
+
const A = n.getUint32(a, !0), y = n.getUint8(a + 4), x = n.getUint8(a + 5), h = n.getUint8(a + 6), R = Bn(n, a, i), w = Un(n, a, i);
|
|
104
|
+
if (a += d, f + A > o)
|
|
105
|
+
throw new u("E_SEGMENT_SUM", "Segment vertex_count sum exceeds group count");
|
|
106
|
+
_.push({
|
|
107
|
+
startVertex: f,
|
|
108
|
+
vertexCount: A,
|
|
109
|
+
color: [y, x, h],
|
|
110
|
+
layerIndex: R,
|
|
111
|
+
...w === void 0 ? {} : { lineweightPx: w }
|
|
112
|
+
}), f += A;
|
|
113
113
|
}
|
|
114
|
-
if (
|
|
115
|
-
throw new
|
|
114
|
+
if (f !== o)
|
|
115
|
+
throw new u("E_SEGMENT_SUM", `Segment vertex_count sum ${f} does not match group count ${o}`);
|
|
116
116
|
return {
|
|
117
|
-
shuffled:
|
|
117
|
+
shuffled: l,
|
|
118
118
|
plane: r,
|
|
119
|
-
segments:
|
|
120
|
-
offset:
|
|
119
|
+
segments: _,
|
|
120
|
+
offset: a
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function we(t, n, e, o) {
|
|
124
124
|
if (o === 0)
|
|
125
125
|
return new Float32Array(0);
|
|
126
|
-
const
|
|
126
|
+
const i = new Uint8Array(o * 4);
|
|
127
127
|
for (let r = 0; r < o; r++)
|
|
128
|
-
|
|
129
|
-
return new Float32Array(
|
|
128
|
+
i[r * 4] = t[e + r], i[r * 4 + 1] = t[n + e + r], i[r * 4 + 2] = t[n * 2 + e + r], i[r * 4 + 3] = t[n * 3 + e + r];
|
|
129
|
+
return new Float32Array(i.buffer);
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const r =
|
|
131
|
+
function Ae(t, n, e, o, i) {
|
|
132
|
+
const r = we(
|
|
133
133
|
t.shuffled,
|
|
134
134
|
t.plane,
|
|
135
135
|
(n.startVertex + e) * 2,
|
|
136
136
|
o * 2
|
|
137
137
|
);
|
|
138
|
-
let
|
|
138
|
+
let s = (i == null ? void 0 : i[0]) ?? 0, l = (i == null ? void 0 : i[1]) ?? 0;
|
|
139
139
|
if (o > 0) {
|
|
140
|
-
e === 0 ? (
|
|
141
|
-
for (let
|
|
142
|
-
const
|
|
143
|
-
|
|
140
|
+
e === 0 ? (s = r[0], l = r[1]) : (s += r[0], l += r[1], r[0] = s, r[1] = l);
|
|
141
|
+
for (let c = 1; c < o; c++) {
|
|
142
|
+
const _ = c * 2;
|
|
143
|
+
s += r[_], l += r[_ + 1], r[_] = s, r[_ + 1] = l;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
const
|
|
146
|
+
const a = o > 0 ? [{
|
|
147
147
|
startVertex: 0,
|
|
148
148
|
vertexCount: o,
|
|
149
149
|
color: [n.color[0], n.color[1], n.color[2]],
|
|
@@ -151,30 +151,30 @@ function ue(t, n, e, o, a) {
|
|
|
151
151
|
...n.lineweightPx === void 0 ? {} : { lineweightPx: n.lineweightPx }
|
|
152
152
|
}] : [];
|
|
153
153
|
return {
|
|
154
|
-
chunk: { pos: r, count: o, segments:
|
|
155
|
-
lastPoint: o > 0 ? [
|
|
154
|
+
chunk: { pos: r, count: o, segments: a },
|
|
155
|
+
lastPoint: o > 0 ? [s, l] : i
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
function*
|
|
159
|
-
const r =
|
|
158
|
+
function* Re(t, n, e, o, i = "u8") {
|
|
159
|
+
const r = ye(t, n, e, o, i);
|
|
160
160
|
if (o === 0)
|
|
161
161
|
return yield { pos: new Float32Array(0), count: 0, segments: [] }, r.offset;
|
|
162
|
-
for (const
|
|
163
|
-
let
|
|
164
|
-
for (let
|
|
165
|
-
const
|
|
166
|
-
|
|
162
|
+
for (const s of r.segments) {
|
|
163
|
+
let l = null;
|
|
164
|
+
for (let a = 0; a < s.vertexCount; a += Yt) {
|
|
165
|
+
const c = Math.min(Yt, s.vertexCount - a), _ = Ae(r, s, a, c, l);
|
|
166
|
+
l = _.lastPoint, yield _.chunk;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
return r.offset;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function Sn() {
|
|
172
172
|
const t = globalThis.TextDecoder;
|
|
173
173
|
if (!t)
|
|
174
|
-
throw new
|
|
174
|
+
throw new u("E_HEADER_JSON", "TextDecoder is required to parse CAD pack metadata");
|
|
175
175
|
return new t();
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function Ft(t) {
|
|
178
178
|
return t ? {
|
|
179
179
|
minX: t.minX,
|
|
180
180
|
minY: t.minY,
|
|
@@ -182,73 +182,73 @@ function Yt(t) {
|
|
|
182
182
|
maxY: t.maxY
|
|
183
183
|
} : null;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function zt(t) {
|
|
186
186
|
return !!t && Number.isFinite(t.minX) && Number.isFinite(t.minY) && Number.isFinite(t.maxX) && Number.isFinite(t.maxY);
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
return
|
|
188
|
+
function Ne(t) {
|
|
189
|
+
return zt(t) ? Ft(t) : null;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
const e =
|
|
191
|
+
function pe(t, n) {
|
|
192
|
+
const e = zt(t) ? t : null, o = zt(n) ? n : null;
|
|
193
193
|
return e ? o ? {
|
|
194
194
|
minX: Math.min(e.minX, o.minX),
|
|
195
195
|
minY: Math.min(e.minY, o.minY),
|
|
196
196
|
maxX: Math.max(e.maxX, o.maxX),
|
|
197
197
|
maxY: Math.max(e.maxY, o.maxY)
|
|
198
|
-
} :
|
|
198
|
+
} : Ft(e) : Ft(o);
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function Cn(t, n) {
|
|
201
201
|
return !(n.maxX < t.minX || n.minX > t.maxX || n.maxY < t.minY || n.minY > t.maxY);
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function $o(t, n) {
|
|
204
204
|
return t.minX <= n.minX && t.minY <= n.minY && t.maxX >= n.maxX && t.maxY >= n.maxY;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Mo(t, n) {
|
|
207
207
|
return t === n ? !0 : !t || !n ? !1 : t.minX === n.minX && t.minY === n.minY && t.maxX === n.maxX && t.maxY === n.maxY;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
209
|
+
function Ie(t, n) {
|
|
210
|
+
return Cn(t, n) ? {
|
|
211
211
|
minX: Math.max(t.minX, n.minX),
|
|
212
212
|
minY: Math.max(t.minY, n.minY),
|
|
213
213
|
maxX: Math.min(t.maxX, n.maxX),
|
|
214
214
|
maxY: Math.min(t.maxY, n.maxY)
|
|
215
215
|
} : null;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
const e = Number.isFinite(n) ? Math.max(0, n) : 0, o = Math.max(0, t.maxX - t.minX),
|
|
217
|
+
function Ve(t, n) {
|
|
218
|
+
const e = Number.isFinite(n) ? Math.max(0, n) : 0, o = Math.max(0, t.maxX - t.minX), i = Math.max(0, t.maxY - t.minY), r = o * e, s = i * e;
|
|
219
219
|
return {
|
|
220
220
|
minX: t.minX - r,
|
|
221
|
-
minY: t.minY -
|
|
221
|
+
minY: t.minY - s,
|
|
222
222
|
maxX: t.maxX + r,
|
|
223
|
-
maxY: t.maxY +
|
|
223
|
+
maxY: t.maxY + s
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function Ge(t, n, e, o = 0, i = 1) {
|
|
227
227
|
if (n <= 0 || e <= 0) return null;
|
|
228
|
-
let r = Number.POSITIVE_INFINITY,
|
|
229
|
-
for (let
|
|
230
|
-
const
|
|
231
|
-
!Number.isFinite(
|
|
228
|
+
let r = Number.POSITIVE_INFINITY, s = Number.POSITIVE_INFINITY, l = Number.NEGATIVE_INFINITY, a = Number.NEGATIVE_INFINITY, c = !1;
|
|
229
|
+
for (let _ = 0; _ < n; _ += 1) {
|
|
230
|
+
const f = _ * e, d = t[f + o], m = t[f + i];
|
|
231
|
+
!Number.isFinite(d) || !Number.isFinite(m) || (d < r && (r = d), m < s && (s = m), d > l && (l = d), m > a && (a = m), c = !0);
|
|
232
232
|
}
|
|
233
|
-
return
|
|
233
|
+
return c ? { minX: r, minY: s, maxX: l, maxY: a } : null;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const e = t.minX, o = t.minY,
|
|
237
|
-
let
|
|
238
|
-
return
|
|
235
|
+
function On(t, n) {
|
|
236
|
+
const e = t.minX, o = t.minY, i = t.maxX, r = t.maxY, { matA: s, matB: l, matC: a, matD: c, tx: _, ty: f } = n;
|
|
237
|
+
let d = s * e + a * o + _, m = l * e + c * o + f, A = d, y = m, x = d, h = m;
|
|
238
|
+
return d = s * e + a * r + _, m = l * e + c * r + f, d < A && (A = d), m < y && (y = m), d > x && (x = d), m > h && (h = m), d = s * i + a * o + _, m = l * i + c * o + f, d < A && (A = d), m < y && (y = m), d > x && (x = d), m > h && (h = m), d = s * i + a * r + _, m = l * i + c * r + f, d < A && (A = d), m < y && (y = m), d > x && (x = d), m > h && (h = m), { minX: A, minY: y, maxX: x, maxY: h };
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Te(t) {
|
|
241
241
|
return Math.hypot(t.maxX - t.minX, t.maxY - t.minY);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
244
|
-
const e = (t.minX + t.maxX) / 2, o = (t.minY + t.maxY) / 2,
|
|
245
|
-
return Math.hypot(e -
|
|
243
|
+
function be(t, n) {
|
|
244
|
+
const e = (t.minX + t.maxX) / 2, o = (t.minY + t.maxY) / 2, i = (n.minX + n.maxX) / 2, r = (n.minY + n.maxY) / 2;
|
|
245
|
+
return Math.hypot(e - i, o - r);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
247
|
+
const Be = {};
|
|
248
|
+
function hn(t) {
|
|
249
249
|
return typeof t == "object" && t !== null;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function yt(t, n) {
|
|
252
252
|
return Object.prototype.hasOwnProperty.call(t, n);
|
|
253
253
|
}
|
|
254
254
|
function J(t) {
|
|
@@ -263,10 +263,10 @@ function J(t) {
|
|
|
263
263
|
}
|
|
264
264
|
return n;
|
|
265
265
|
}
|
|
266
|
-
function
|
|
267
|
-
return new
|
|
266
|
+
function yn(t, n, e, o) {
|
|
267
|
+
return new u("E_TEXT_ROUNDTRIP", `Text roundtrip mismatch at stage=${t} index=${n} path=${e}: ${o}`);
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function Ht(t, n, e) {
|
|
270
270
|
if (Object.is(t, n)) return null;
|
|
271
271
|
if (Array.isArray(t)) {
|
|
272
272
|
if (!Array.isArray(n))
|
|
@@ -274,211 +274,211 @@ function kt(t, n, e) {
|
|
|
274
274
|
if (t.length !== n.length)
|
|
275
275
|
return { path: J([...e, "length"]), reason: `array length ${t.length} !== ${n.length}` };
|
|
276
276
|
for (let o = 0; o < t.length; o += 1) {
|
|
277
|
-
const
|
|
278
|
-
if (
|
|
277
|
+
const i = Ht(t[o], n[o], [...e, o]);
|
|
278
|
+
if (i) return i;
|
|
279
279
|
}
|
|
280
280
|
return null;
|
|
281
281
|
}
|
|
282
|
-
if (
|
|
283
|
-
if (!
|
|
282
|
+
if (hn(t)) {
|
|
283
|
+
if (!hn(n) || Array.isArray(n))
|
|
284
284
|
return { path: J(e), reason: `expected object but found ${Array.isArray(n) ? "array" : typeof n}` };
|
|
285
|
-
const o = Object.keys(t),
|
|
286
|
-
if (o.length !==
|
|
287
|
-
const r = o.find((
|
|
285
|
+
const o = Object.keys(t), i = Object.keys(n);
|
|
286
|
+
if (o.length !== i.length) {
|
|
287
|
+
const r = o.find((l) => !yt(n, l));
|
|
288
288
|
if (r !== void 0)
|
|
289
289
|
return {
|
|
290
290
|
path: J([...e, r]),
|
|
291
291
|
reason: "missing key on actual"
|
|
292
292
|
};
|
|
293
|
-
const
|
|
294
|
-
if (
|
|
293
|
+
const s = i.find((l) => !yt(t, l));
|
|
294
|
+
if (s !== void 0)
|
|
295
295
|
return {
|
|
296
|
-
path: J([...e,
|
|
296
|
+
path: J([...e, s]),
|
|
297
297
|
reason: "extra key on actual"
|
|
298
298
|
};
|
|
299
299
|
}
|
|
300
300
|
for (const r of o) {
|
|
301
|
-
if (!
|
|
301
|
+
if (!yt(n, r))
|
|
302
302
|
return { path: J([...e, r]), reason: "missing key on actual" };
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
303
|
+
const s = Ht(t[r], n[r], [...e, r]);
|
|
304
|
+
if (s) return s;
|
|
305
305
|
}
|
|
306
|
-
for (const r of
|
|
307
|
-
if (!
|
|
306
|
+
for (const r of i)
|
|
307
|
+
if (!yt(t, r))
|
|
308
308
|
return { path: J([...e, r]), reason: "extra key on actual" };
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
311
|
return { path: J(e), reason: `expected ${String(t)} but found ${String(n)}` };
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
313
|
+
function Ue(t, n) {
|
|
314
|
+
return Ht(t, n, []);
|
|
315
315
|
}
|
|
316
|
-
function
|
|
316
|
+
function wn(t) {
|
|
317
317
|
if (t === !0 || t === "1" || t === "true") return !0;
|
|
318
318
|
if (t === !1 || t === "0" || t === "false") return !1;
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
var
|
|
322
|
-
const t = globalThis.process, n =
|
|
323
|
-
((
|
|
320
|
+
function Se() {
|
|
321
|
+
var i, r;
|
|
322
|
+
const t = globalThis.process, n = wn(
|
|
323
|
+
((i = t == null ? void 0 : t.env) == null ? void 0 : i.DXF_STRICT_TEXT_ROUNDTRIP) ?? ((r = t == null ? void 0 : t.env) == null ? void 0 : r.VITE_DXF_STRICT_TEXT_ROUNDTRIP)
|
|
324
324
|
);
|
|
325
325
|
if (n !== void 0) return n;
|
|
326
|
-
const e =
|
|
326
|
+
const e = Be, o = wn(e == null ? void 0 : e.VITE_DXF_STRICT_TEXT_ROUNDTRIP);
|
|
327
327
|
return o !== void 0 ? o : !1;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function vo(t) {
|
|
330
330
|
return t;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function Ce(t, n, e) {
|
|
333
333
|
if (n.length !== e.length)
|
|
334
|
-
throw
|
|
334
|
+
throw yn(t, Math.min(n.length, e.length), "$length", `text count ${n.length} !== ${e.length}`);
|
|
335
335
|
for (let o = 0; o < n.length; o += 1) {
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
throw
|
|
336
|
+
const i = Ue(n[o], e[o]);
|
|
337
|
+
if (i)
|
|
338
|
+
throw yn(t, o, i.path, i.reason);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
function
|
|
341
|
+
const Oe = Sn(), $e = ["left", "center", "right"], Me = ["top", "middle", "bottom", "alphabetic"];
|
|
342
|
+
function An(t, n) {
|
|
343
343
|
if (t > BigInt(Number.MAX_SAFE_INTEGER))
|
|
344
|
-
throw new
|
|
344
|
+
throw new u("E_GROUP_RANGE", `${n} exceeds safe integer range`);
|
|
345
345
|
return Number(t);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function jt(t, n, e, o) {
|
|
348
348
|
if (!Number.isInteger(t) || !Number.isInteger(n) || t < 0 || n < 0 || t + n > e)
|
|
349
|
-
throw new
|
|
349
|
+
throw new u("E_GROUP_RANGE", `${o} exceeds payload length`);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function ve(t) {
|
|
352
352
|
if (t.byteLength < 4) return !1;
|
|
353
353
|
const n = new Uint8Array(t, 0, 4);
|
|
354
354
|
return n[0] === 68 && n[1] === 88 && n[2] === 66 && n[3] === 83;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function tn(t) {
|
|
357
357
|
if (t.byteLength < 20)
|
|
358
|
-
throw new
|
|
359
|
-
if (!
|
|
360
|
-
throw new
|
|
361
|
-
const n = new DataView(t), e = n.getUint16(4, !0), o = n.getUint16(6, !0),
|
|
358
|
+
throw new u("E_HEADER", "DXBS payload too small: missing container header");
|
|
359
|
+
if (!ve(t))
|
|
360
|
+
throw new u("E_HEADER", "DXBS payload missing magic");
|
|
361
|
+
const n = new DataView(t), e = n.getUint16(4, !0), o = n.getUint16(6, !0), i = n.getUint16(8, !0), r = n.getUint16(10, !0), s = n.getUint16(12, !0), l = n.getUint16(14, !0), a = n.getUint32(16, !0);
|
|
362
362
|
if (e !== 3 || o < 3 || o > 6)
|
|
363
|
-
throw new
|
|
364
|
-
if (
|
|
365
|
-
throw new
|
|
366
|
-
if (
|
|
367
|
-
throw new
|
|
363
|
+
throw new u("E_GROUP_RANGE", `Unsupported DXBS version: ${e}.${o}`);
|
|
364
|
+
if (i !== 0)
|
|
365
|
+
throw new u("E_GROUP_RANGE", `Unsupported DXBS sidecar kind: ${i}`);
|
|
366
|
+
if (l !== 0)
|
|
367
|
+
throw new u("E_GROUP_RANGE", `Invalid DXBS reserved field: ${l}`);
|
|
368
368
|
if (r < 24)
|
|
369
|
-
throw new
|
|
370
|
-
if (
|
|
371
|
-
throw new
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
const
|
|
375
|
-
for (let
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
378
|
-
throw new
|
|
369
|
+
throw new u("E_GROUP_RANGE", `Invalid DXBS directory entry size: ${r}`);
|
|
370
|
+
if (a !== r * s)
|
|
371
|
+
throw new u("E_GROUP_RANGE", "DXBS directory byte size mismatch");
|
|
372
|
+
const c = 20;
|
|
373
|
+
jt(c, a, t.byteLength, "DXBS section directory");
|
|
374
|
+
const _ = /* @__PURE__ */ new Map();
|
|
375
|
+
for (let f = 0; f < s; f += 1) {
|
|
376
|
+
const d = c + f * r, m = n.getUint16(d, !0), A = n.getUint16(d + 2, !0), y = n.getUint32(d + 4, !0), x = An(n.getBigUint64(d + 8, !0), "DXBS section offset"), h = An(n.getBigUint64(d + 16, !0), "DXBS section length");
|
|
377
|
+
if (A !== 0)
|
|
378
|
+
throw new u("E_GROUP_RANGE", `Unsupported DXBS section flags for type ${m}: ${A}`);
|
|
379
379
|
if (y !== 0)
|
|
380
|
-
throw new
|
|
381
|
-
|
|
380
|
+
throw new u("E_GROUP_RANGE", `Invalid DXBS section reserved field for type ${m}: ${y}`);
|
|
381
|
+
jt(x, h, t.byteLength, `DXBS section ${m}`), _.set(m, { type: m, flags: A, offset: x, length: h });
|
|
382
382
|
}
|
|
383
|
-
return { versionMajor: e, versionMinor: o, sections:
|
|
383
|
+
return { versionMajor: e, versionMinor: o, sections: _ };
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function ot(t, n, e) {
|
|
386
386
|
const o = t.sections.get(n);
|
|
387
387
|
if (!o)
|
|
388
|
-
throw new
|
|
388
|
+
throw new u("E_GROUP_RANGE", `Missing DXBS section ${e}`);
|
|
389
389
|
return o;
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
return
|
|
391
|
+
function Pe(t, n, e, o) {
|
|
392
|
+
return jt(n, e, t.byteLength, o), Oe.decode(t.subarray(n, n + e));
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Ct(t, n, e, o, i, r) {
|
|
395
395
|
if (e + 4 > o)
|
|
396
|
-
throw new
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
399
|
-
throw new
|
|
400
|
-
return
|
|
401
|
-
}
|
|
402
|
-
function
|
|
403
|
-
const
|
|
404
|
-
if (
|
|
405
|
-
throw new
|
|
406
|
-
return { line:
|
|
407
|
-
}
|
|
408
|
-
function
|
|
409
|
-
const o = t.getUint32(n, !0),
|
|
396
|
+
throw new u("E_GROUP_RANGE", `Missing ${i} vertex_count`);
|
|
397
|
+
const s = n.getUint32(e, !0), l = ft(t, n, e + 4, s, o, r);
|
|
398
|
+
if (l.offset > o)
|
|
399
|
+
throw new u("E_GROUP_RANGE", `${i} exceeds section bounds`);
|
|
400
|
+
return l;
|
|
401
|
+
}
|
|
402
|
+
function $n(t, n, e, o) {
|
|
403
|
+
const i = new DataView(t), r = e.offset + e.length, s = Qt(n.versionMinor), l = Ct(t, i, e.offset, r, `${o} line`, s), a = Ct(t, i, l.offset, r, `${o} fill`, s), c = Ct(t, i, a.offset, r, `${o} dot`, s);
|
|
404
|
+
if (c.offset !== r)
|
|
405
|
+
throw new u("E_GROUP_RANGE", `${o} has trailing bytes`);
|
|
406
|
+
return { line: l.chunk, fill: a.chunk, dot: c.chunk };
|
|
407
|
+
}
|
|
408
|
+
function De(t, n, e) {
|
|
409
|
+
const o = t.getUint32(n, !0), i = t.getUint32(n + 4, !0), r = t.getUint8(n + 42), s = t.getUint8(n + 43), l = t.getFloat32(n + 24, !0), a = t.getFloat32(n + 28, !0);
|
|
410
410
|
return {
|
|
411
|
-
t:
|
|
411
|
+
t: Pe(e, o, i, "DXBS text value"),
|
|
412
412
|
x: t.getFloat32(n + 8, !0),
|
|
413
413
|
y: t.getFloat32(n + 12, !0),
|
|
414
414
|
h: t.getFloat32(n + 16, !0),
|
|
415
415
|
r: t.getFloat32(n + 20, !0),
|
|
416
416
|
c: [t.getUint8(n + 36), t.getUint8(n + 37), t.getUint8(n + 38)],
|
|
417
417
|
li: t.getUint16(n + 40, !0),
|
|
418
|
-
ha:
|
|
419
|
-
va:
|
|
418
|
+
ha: $e[r & 3] ?? "left",
|
|
419
|
+
va: Me[r >> 2 & 3] ?? "alphabetic",
|
|
420
420
|
lh: t.getFloat32(n + 32, !0),
|
|
421
|
-
...
|
|
422
|
-
...
|
|
423
|
-
...
|
|
424
|
-
...
|
|
421
|
+
...l ? { w: l } : {},
|
|
422
|
+
...a !== 1 ? { wf: a } : {},
|
|
423
|
+
...s & 1 ? { mx: !0 } : {},
|
|
424
|
+
...s & 2 ? { my: !0 } : {}
|
|
425
425
|
};
|
|
426
426
|
}
|
|
427
|
-
function
|
|
427
|
+
function Mn(t, n, e, o) {
|
|
428
428
|
if (n.length % 44 !== 0)
|
|
429
|
-
throw new
|
|
430
|
-
const
|
|
431
|
-
for (let
|
|
432
|
-
r.push(
|
|
429
|
+
throw new u("E_GROUP_RANGE", `${o} length must be a multiple of 44`);
|
|
430
|
+
const i = new Uint8Array(t, e.offset, e.length), r = [], s = new DataView(t);
|
|
431
|
+
for (let l = n.offset; l < n.offset + n.length; l += 44)
|
|
432
|
+
r.push(De(s, l, i));
|
|
433
433
|
return r;
|
|
434
434
|
}
|
|
435
|
-
function
|
|
436
|
-
const n =
|
|
435
|
+
function Po(t) {
|
|
436
|
+
const n = tn(t), e = ot(n, 513, "SCENE_ANNOTATION_GEOMETRY"), o = ot(n, 514, "SCENE_ANNOTATION_TEXT_TABLE"), i = ot(n, 515, "SCENE_ANNOTATION_STRING_TABLE");
|
|
437
437
|
return {
|
|
438
|
-
|
|
439
|
-
texts:
|
|
438
|
+
...$n(t, n, e, "SCENE_ANNOTATION_GEOMETRY"),
|
|
439
|
+
texts: Mn(t, o, i, "SCENE_ANNOTATION_TEXT_TABLE")
|
|
440
440
|
};
|
|
441
441
|
}
|
|
442
|
-
function
|
|
443
|
-
const n =
|
|
442
|
+
function Xe(t) {
|
|
443
|
+
const n = tn(t), e = ot(n, 258, "BLOCK_ANNOTATION_GEOMETRY"), o = ot(n, 259, "BLOCK_ANNOTATION_TEXT_TABLE"), i = ot(n, 260, "BLOCK_ANNOTATION_STRING_TABLE");
|
|
444
444
|
return {
|
|
445
|
-
|
|
446
|
-
texts:
|
|
445
|
+
...$n(t, n, e, "BLOCK_ANNOTATION_GEOMETRY"),
|
|
446
|
+
texts: Mn(t, o, i, "BLOCK_ANNOTATION_TEXT_TABLE")
|
|
447
447
|
};
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function Vt() {
|
|
450
450
|
return {
|
|
451
451
|
pos: new Float32Array(0),
|
|
452
452
|
count: 0,
|
|
453
453
|
segments: []
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function rt(t) {
|
|
457
457
|
if (t.segments && t.segments.length > 0)
|
|
458
|
-
return
|
|
458
|
+
return Ye(t.segments, t.count), t.segments;
|
|
459
459
|
if (t.count <= 0) return [];
|
|
460
460
|
if (!t.col || !t.lay)
|
|
461
|
-
throw new
|
|
462
|
-
return
|
|
461
|
+
throw new u("E_GROUP_RANGE", "Geometry chunk is missing segment or expanded color/layer metadata");
|
|
462
|
+
return ke(t.col, t.lay, t.count);
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function Le(t) {
|
|
465
465
|
if (t.col && t.lay)
|
|
466
466
|
return { col: t.col, lay: t.lay };
|
|
467
|
-
const n =
|
|
467
|
+
const n = rt(t), e = new Uint8Array(t.count * 3);
|
|
468
468
|
let o = 0;
|
|
469
469
|
for (const r of n)
|
|
470
470
|
r.layerIndex > o && (o = r.layerIndex);
|
|
471
|
-
const
|
|
471
|
+
const i = o > 255 ? new Uint16Array(t.count) : new Uint8Array(t.count);
|
|
472
472
|
for (const r of n) {
|
|
473
|
-
const
|
|
474
|
-
for (let
|
|
475
|
-
const
|
|
476
|
-
e[
|
|
473
|
+
const s = r.startVertex + r.vertexCount;
|
|
474
|
+
for (let l = r.startVertex; l < s; l += 1) {
|
|
475
|
+
const a = l * 3;
|
|
476
|
+
e[a] = r.color[0], e[a + 1] = r.color[1], e[a + 2] = r.color[2], i[l] = r.layerIndex;
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
return { col: e, lay:
|
|
479
|
+
return { col: e, lay: i };
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function qt(t, n) {
|
|
482
482
|
return t.map((e) => ({
|
|
483
483
|
startVertex: e.startVertex + n,
|
|
484
484
|
vertexCount: e.vertexCount,
|
|
@@ -487,7 +487,7 @@ function Ht(t, n) {
|
|
|
487
487
|
...e.lineweightPx === void 0 ? {} : { lineweightPx: e.lineweightPx }
|
|
488
488
|
}));
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function vn(t, n) {
|
|
491
491
|
return t.map((e) => ({
|
|
492
492
|
startVertex: e.startVertex,
|
|
493
493
|
vertexCount: e.vertexCount,
|
|
@@ -496,21 +496,21 @@ function Cn(t, n) {
|
|
|
496
496
|
...e.lineweightPx === void 0 ? {} : { lineweightPx: e.lineweightPx }
|
|
497
497
|
}));
|
|
498
498
|
}
|
|
499
|
-
function
|
|
500
|
-
const o = n + e,
|
|
499
|
+
function Do(t, n, e) {
|
|
500
|
+
const o = n + e, i = [];
|
|
501
501
|
for (const r of t) {
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
startVertex:
|
|
505
|
-
vertexCount:
|
|
502
|
+
const s = r.startVertex, l = r.startVertex + r.vertexCount, a = Math.max(n, s), c = Math.min(o, l);
|
|
503
|
+
a >= c || i.push({
|
|
504
|
+
startVertex: a - n,
|
|
505
|
+
vertexCount: c - a,
|
|
506
506
|
color: Gt(r),
|
|
507
507
|
layerIndex: r.layerIndex,
|
|
508
508
|
...r.lineweightPx === void 0 ? {} : { lineweightPx: r.lineweightPx }
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
|
-
return
|
|
511
|
+
return mt(i);
|
|
512
512
|
}
|
|
513
|
-
function
|
|
513
|
+
function mt(t) {
|
|
514
514
|
const n = [];
|
|
515
515
|
for (const e of t) {
|
|
516
516
|
const o = n[n.length - 1];
|
|
@@ -531,60 +531,60 @@ function dt(t) {
|
|
|
531
531
|
}
|
|
532
532
|
return n;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function ke(t, n, e) {
|
|
535
535
|
if (t.length < e * 3 || n.length < e)
|
|
536
|
-
throw new
|
|
536
|
+
throw new u("E_GROUP_RANGE", "Expanded color/layer metadata is shorter than geometry count");
|
|
537
537
|
const o = [];
|
|
538
|
-
let
|
|
539
|
-
for (;
|
|
540
|
-
const r =
|
|
541
|
-
let
|
|
542
|
-
for (;
|
|
543
|
-
const
|
|
544
|
-
if (n[
|
|
538
|
+
let i = 0;
|
|
539
|
+
for (; i < e; ) {
|
|
540
|
+
const r = i * 3, s = t[r] ?? 0, l = t[r + 1] ?? 0, a = t[r + 2] ?? 0, c = n[i] ?? 0;
|
|
541
|
+
let _ = i + 1;
|
|
542
|
+
for (; _ < e; ) {
|
|
543
|
+
const f = _ * 3;
|
|
544
|
+
if (n[_] !== c || t[f] !== s || t[f + 1] !== l || t[f + 2] !== a)
|
|
545
545
|
break;
|
|
546
|
-
|
|
546
|
+
_ += 1;
|
|
547
547
|
}
|
|
548
548
|
o.push({
|
|
549
|
-
startVertex:
|
|
550
|
-
vertexCount:
|
|
551
|
-
color: [
|
|
552
|
-
layerIndex:
|
|
553
|
-
}),
|
|
549
|
+
startVertex: i,
|
|
550
|
+
vertexCount: _ - i,
|
|
551
|
+
color: [s, l, a],
|
|
552
|
+
layerIndex: c
|
|
553
|
+
}), i = _;
|
|
554
554
|
}
|
|
555
555
|
return o;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Ye(t, n) {
|
|
558
558
|
let e = 0;
|
|
559
559
|
for (const o of t) {
|
|
560
560
|
if (o.vertexCount < 0 || o.startVertex !== e)
|
|
561
|
-
throw new
|
|
561
|
+
throw new u("E_SEGMENT_SUM", "Geometry segments must be contiguous and non-negative");
|
|
562
562
|
e += o.vertexCount;
|
|
563
563
|
}
|
|
564
564
|
if (e !== n)
|
|
565
|
-
throw new
|
|
565
|
+
throw new u("E_SEGMENT_SUM", `Geometry segment vertex sum ${e} does not match count ${n}`);
|
|
566
566
|
}
|
|
567
567
|
function Gt(t) {
|
|
568
568
|
return [t.color[0], t.color[1], t.color[2]];
|
|
569
569
|
}
|
|
570
|
-
const
|
|
571
|
-
function
|
|
570
|
+
const Fe = 8e6, ze = 0.25, He = 5, je = 4, qe = 2048, nn = Sn(), Ke = ["left", "center", "right"], We = ["top", "middle", "bottom", "alphabetic"];
|
|
571
|
+
function Rt(t, n, e) {
|
|
572
572
|
for (const o of t)
|
|
573
573
|
e(o);
|
|
574
574
|
for (const o of n)
|
|
575
575
|
e(o);
|
|
576
576
|
}
|
|
577
|
-
const
|
|
578
|
-
function
|
|
577
|
+
const Rn = /* @__PURE__ */ new WeakMap(), Pn = /* @__PURE__ */ new WeakSet();
|
|
578
|
+
function ut(t) {
|
|
579
579
|
return typeof t == "object" && t !== null;
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Je(t) {
|
|
582
582
|
return Array.isArray(t) ? "array" : t === null ? "null" : typeof t;
|
|
583
583
|
}
|
|
584
|
-
function
|
|
585
|
-
return !(!
|
|
584
|
+
function Ze(t) {
|
|
585
|
+
return !(!ut(t) || Array.isArray(t) || typeof t.t != "string" || typeof t.x != "number" || typeof t.y != "number" || typeof t.h != "number" || typeof t.r != "number" || !Array.isArray(t.c) || t.c.length !== 3 || !t.c.every((n) => typeof n == "number") || typeof t.li != "number" || t.ha !== "left" && t.ha !== "center" && t.ha !== "right" || t.va !== "top" && t.va !== "middle" && t.va !== "bottom" && t.va !== "alphabetic" || typeof t.lh != "number" || t.w !== void 0 && typeof t.w != "number" || t.wf !== void 0 && typeof t.wf != "number" || t.iv !== void 0 && typeof t.iv != "number" || t.io !== void 0 && typeof t.io != "number" || t.mx !== void 0 && t.mx !== !0 || t.my !== void 0 && t.my !== !0);
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function Qe(t) {
|
|
588
588
|
return t.map((n, e) => ({
|
|
589
589
|
index: e,
|
|
590
590
|
name: n.name,
|
|
@@ -593,26 +593,26 @@ function Ye(t) {
|
|
|
593
593
|
visible: n.visible ?? !0
|
|
594
594
|
}));
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
const n = t.texts, e = Array.isArray(n) ? n : [], o = e.filter(
|
|
598
|
-
if (
|
|
599
|
-
throw new
|
|
596
|
+
function en(t) {
|
|
597
|
+
const n = t.texts, e = Array.isArray(n) ? n : [], o = e.filter(Ze), i = Se();
|
|
598
|
+
if (i && n !== void 0 && !Array.isArray(n))
|
|
599
|
+
throw new u(
|
|
600
600
|
"E_TEXT_ROUNDTRIP",
|
|
601
|
-
`Text roundtrip mismatch at stage=Boundary-2:header->stream index=0 path=$: expected array but found ${
|
|
601
|
+
`Text roundtrip mismatch at stage=Boundary-2:header->stream index=0 path=$: expected array but found ${Je(n)}`
|
|
602
602
|
);
|
|
603
|
-
return
|
|
603
|
+
return i && Ce("Boundary-2:header->stream", e, o), {
|
|
604
604
|
bounds: [...t.bounds],
|
|
605
605
|
entityCount: Number(t.entity_count || 0),
|
|
606
606
|
lineCount: Number(t.line_count || 0),
|
|
607
607
|
fillCount: Number(t.fill_count || 0),
|
|
608
608
|
dotCount: Number(t.dot_count || 0),
|
|
609
609
|
textCount: o.length,
|
|
610
|
-
layers:
|
|
610
|
+
layers: Qe(t.layers ?? []),
|
|
611
611
|
texts: o
|
|
612
612
|
};
|
|
613
613
|
}
|
|
614
|
-
function
|
|
615
|
-
const n = t == null ? void 0 : t.maxExpandedInstanceVertices, e = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) :
|
|
614
|
+
function Dn(t) {
|
|
615
|
+
const n = t == null ? void 0 : t.maxExpandedInstanceVertices, e = typeof n == "number" && Number.isFinite(n) && n >= 0 ? Math.floor(n) : Fe;
|
|
616
616
|
return {
|
|
617
617
|
hiddenInstanceIds: t != null && t.hiddenInstanceIds ? new Set(t.hiddenInstanceIds) : /* @__PURE__ */ new Set(),
|
|
618
618
|
keepTextsForHiddenInstances: (t == null ? void 0 : t.keepTextsForHiddenInstances) === !0,
|
|
@@ -623,281 +623,282 @@ function On(t) {
|
|
|
623
623
|
externalVariantBuffers: t == null ? void 0 : t.externalVariantBuffers,
|
|
624
624
|
requiredExternalVariantIds: t == null ? void 0 : t.requiredExternalVariantIds,
|
|
625
625
|
externalVariantDeltaOnly: (t == null ? void 0 : t.externalVariantDeltaOnly) === !0,
|
|
626
|
-
deferExternalVariantGeometry: (t == null ? void 0 : t.deferExternalVariantGeometry) === !0
|
|
626
|
+
deferExternalVariantGeometry: (t == null ? void 0 : t.deferExternalVariantGeometry) === !0,
|
|
627
|
+
cacheDocument: (t == null ? void 0 : t.cacheDocument) === !0
|
|
627
628
|
};
|
|
628
629
|
}
|
|
629
|
-
function
|
|
630
|
+
function to(t) {
|
|
630
631
|
return t.loadBlocks && !t.suppressExpandedInsertGeometry;
|
|
631
632
|
}
|
|
632
633
|
function Nt(t, n) {
|
|
633
|
-
return
|
|
634
|
+
return to(n) && !n.hiddenInstanceIds.has(t);
|
|
634
635
|
}
|
|
635
|
-
function
|
|
636
|
+
function Xn(t, n, e) {
|
|
636
637
|
if (e <= 0)
|
|
637
638
|
return;
|
|
638
639
|
const o = t.expandedInstanceVertices + e;
|
|
639
640
|
if (o > t.maxExpandedInstanceVertices)
|
|
640
|
-
throw new
|
|
641
|
+
throw new u(
|
|
641
642
|
"E_EXPANSION_BUDGET",
|
|
642
643
|
`CPU-expanded ${n} instance vertices exceed budget: ${o}/${t.maxExpandedInstanceVertices}. Disable block loading or raise maxExpandedInstanceVertices.`
|
|
643
644
|
);
|
|
644
645
|
t.expandedInstanceVertices = o;
|
|
645
646
|
}
|
|
646
|
-
function
|
|
647
|
+
function no(t, n, e) {
|
|
647
648
|
return e.loadBlocks ? e.hiddenInstanceIds.size === 0 || e.keepTextsForHiddenInstances ? t : t.filter((o) => {
|
|
648
649
|
if (!Number.isInteger(o.iv) || !Number.isInteger(o.io))
|
|
649
650
|
return !0;
|
|
650
|
-
const
|
|
651
|
-
return
|
|
651
|
+
const i = n.get(`${o.iv}:${o.io}`);
|
|
652
|
+
return i === void 0 || !e.hiddenInstanceIds.has(i);
|
|
652
653
|
}) : t.filter((o) => !Number.isInteger(o.iv) || !Number.isInteger(o.io));
|
|
653
654
|
}
|
|
654
|
-
function
|
|
655
|
+
function eo(t, n) {
|
|
655
656
|
const e = /* @__PURE__ */ new Map();
|
|
656
|
-
return t.forEach((o,
|
|
657
|
+
return t.forEach((o, i) => {
|
|
657
658
|
if (!Number.isInteger(o.iv) || !Number.isInteger(o.io))
|
|
658
659
|
return;
|
|
659
660
|
const r = n.get(`${o.iv}:${o.io}`);
|
|
660
661
|
if (r === void 0)
|
|
661
662
|
return;
|
|
662
|
-
const
|
|
663
|
-
|
|
663
|
+
const s = e.get(r);
|
|
664
|
+
s ? s.push(i) : e.set(r, [i]);
|
|
664
665
|
}), e;
|
|
665
666
|
}
|
|
666
|
-
function
|
|
667
|
-
const
|
|
668
|
-
id:
|
|
669
|
-
blockName:
|
|
670
|
-
line: e[
|
|
671
|
-
fill: e[
|
|
672
|
-
dot: e[
|
|
673
|
-
texts: o.get(
|
|
667
|
+
function oo(t, n, e, o, i, r, s) {
|
|
668
|
+
const l = n.map((a, c) => ({
|
|
669
|
+
id: a.id,
|
|
670
|
+
blockName: Ln(a, c),
|
|
671
|
+
line: e[c].line,
|
|
672
|
+
fill: e[c].fill,
|
|
673
|
+
dot: e[c].dot,
|
|
674
|
+
texts: o.get(a.id) ?? []
|
|
674
675
|
}));
|
|
675
676
|
return {
|
|
676
677
|
layer0Index: t,
|
|
677
|
-
variants:
|
|
678
|
-
instances:
|
|
679
|
-
textIndexesByInstanceId:
|
|
680
|
-
ownerInstanceIdByVariantOrdinal:
|
|
678
|
+
variants: l,
|
|
679
|
+
instances: i,
|
|
680
|
+
textIndexesByInstanceId: eo(r, s),
|
|
681
|
+
ownerInstanceIdByVariantOrdinal: s
|
|
681
682
|
};
|
|
682
683
|
}
|
|
683
|
-
function
|
|
684
|
+
function ro(t) {
|
|
684
685
|
if (t.byteLength < 4)
|
|
685
|
-
throw new
|
|
686
|
-
const n = new DataView(t), e = n.getUint32(0, !0), o = 4,
|
|
687
|
-
if (
|
|
688
|
-
throw new
|
|
686
|
+
throw new u("E_HEADER", "Payload too small: missing header length");
|
|
687
|
+
const n = new DataView(t), e = n.getUint32(0, !0), o = 4, i = o + e;
|
|
688
|
+
if (i > t.byteLength)
|
|
689
|
+
throw new u("E_HEADER", "Header length exceeds payload length");
|
|
689
690
|
let r;
|
|
690
691
|
try {
|
|
691
|
-
r = JSON.parse(
|
|
692
|
-
} catch (
|
|
693
|
-
throw new
|
|
692
|
+
r = JSON.parse(nn.decode(new Uint8Array(t, o, e)));
|
|
693
|
+
} catch (s) {
|
|
694
|
+
throw new u("E_HEADER_JSON", `Invalid JSON header: ${s.message}`);
|
|
694
695
|
}
|
|
695
696
|
return {
|
|
696
697
|
meta: r,
|
|
697
|
-
header:
|
|
698
|
-
dataOffset:
|
|
698
|
+
header: en(r),
|
|
699
|
+
dataOffset: i,
|
|
699
700
|
view: n
|
|
700
701
|
};
|
|
701
702
|
}
|
|
702
|
-
function
|
|
703
|
-
var r,
|
|
703
|
+
function Ln(t, n) {
|
|
704
|
+
var r, s, l;
|
|
704
705
|
const e = (r = t.name) == null ? void 0 : r.trim();
|
|
705
706
|
if (e)
|
|
706
707
|
return e;
|
|
707
|
-
const o = (
|
|
708
|
+
const o = (s = t.block_name) == null ? void 0 : s.trim();
|
|
708
709
|
if (o)
|
|
709
710
|
return o;
|
|
710
|
-
const
|
|
711
|
-
return
|
|
711
|
+
const i = (l = t.blockName) == null ? void 0 : l.trim();
|
|
712
|
+
return i || `block_${n}`;
|
|
712
713
|
}
|
|
713
|
-
function
|
|
714
|
+
function io(t) {
|
|
714
715
|
const n = Number(t.version ?? 1), e = String(t.encoding ?? "").toLowerCase();
|
|
715
716
|
if (n === 2) {
|
|
716
717
|
const o = e ? ` ${e}` : "";
|
|
717
|
-
throw new
|
|
718
|
+
throw new u(
|
|
718
719
|
"E_UNSUPPORTED_PACK_VERSION",
|
|
719
720
|
`当前文件是 V2${o} pack,前端不再兼容解析;请升级到最新版本后再打开。`
|
|
720
721
|
);
|
|
721
722
|
}
|
|
722
723
|
}
|
|
723
|
-
function
|
|
724
|
-
const n =
|
|
725
|
-
return
|
|
724
|
+
function on(t) {
|
|
725
|
+
const n = ro(t);
|
|
726
|
+
return io(n.meta), n;
|
|
726
727
|
}
|
|
727
|
-
function
|
|
728
|
+
function Q(t) {
|
|
728
729
|
if (t.byteLength < 4)
|
|
729
730
|
return !1;
|
|
730
731
|
const n = new Uint8Array(t, 0, 4);
|
|
731
732
|
return n[0] === 68 && n[1] === 88 && n[2] === 66 && n[3] === 51;
|
|
732
733
|
}
|
|
733
|
-
function
|
|
734
|
+
function Nn(t, n) {
|
|
734
735
|
if (t > BigInt(Number.MAX_SAFE_INTEGER))
|
|
735
|
-
throw new
|
|
736
|
+
throw new u("E_GROUP_RANGE", `${n} exceeds safe integer range`);
|
|
736
737
|
return Number(t);
|
|
737
738
|
}
|
|
738
|
-
function
|
|
739
|
+
function _t(t, n, e, o) {
|
|
739
740
|
if (!Number.isInteger(t) || !Number.isInteger(n) || t < 0 || n < 0 || t + n > e)
|
|
740
|
-
throw new
|
|
741
|
+
throw new u("E_GROUP_RANGE", `${o} exceeds payload length`);
|
|
741
742
|
}
|
|
742
|
-
function
|
|
743
|
+
function Et(t) {
|
|
743
744
|
if (t.byteLength < 20)
|
|
744
|
-
throw new
|
|
745
|
-
const n = new DataView(t), e = n.getUint16(4, !0), o = n.getUint16(6, !0),
|
|
745
|
+
throw new u("E_HEADER", "V3 payload too small: missing container header");
|
|
746
|
+
const n = new DataView(t), e = n.getUint16(4, !0), o = n.getUint16(6, !0), i = n.getUint32(8, !0), r = n.getUint16(12, !0), s = n.getUint16(14, !0), l = n.getUint32(16, !0);
|
|
746
747
|
if (e !== 3 || o > 6)
|
|
747
|
-
throw new
|
|
748
|
-
if (
|
|
749
|
-
throw new
|
|
748
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 version: ${e}.${o}`);
|
|
749
|
+
if (i !== 0)
|
|
750
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 file flags: ${i}`);
|
|
750
751
|
if (r < 24)
|
|
751
|
-
throw new
|
|
752
|
-
if (
|
|
753
|
-
throw new
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
const
|
|
757
|
-
for (let
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
throw new
|
|
761
|
-
if (
|
|
762
|
-
throw new
|
|
763
|
-
|
|
752
|
+
throw new u("E_GROUP_RANGE", `Invalid V3 directory entry size: ${r}`);
|
|
753
|
+
if (l !== r * s)
|
|
754
|
+
throw new u("E_GROUP_RANGE", "V3 directory byte size mismatch");
|
|
755
|
+
const a = 20;
|
|
756
|
+
_t(a, l, t.byteLength, "V3 section directory");
|
|
757
|
+
const c = /* @__PURE__ */ new Map();
|
|
758
|
+
for (let _ = 0; _ < s; _ += 1) {
|
|
759
|
+
const f = a + _ * r, d = n.getUint16(f, !0), m = n.getUint16(f + 2, !0), A = n.getUint32(f + 4, !0), y = Nn(n.getBigUint64(f + 8, !0), "V3 section offset"), x = Nn(n.getBigUint64(f + 16, !0), "V3 section length");
|
|
760
|
+
if (m !== 0)
|
|
761
|
+
throw new u("E_GROUP_RANGE", `Unsupported V3 section flags for type ${d}: ${m}`);
|
|
762
|
+
if (A !== 0)
|
|
763
|
+
throw new u("E_GROUP_RANGE", `Invalid V3 section reserved field for type ${d}: ${A}`);
|
|
764
|
+
_t(y, x, t.byteLength, `V3 section ${d}`), c.set(d, { type: d, flags: m, offset: y, length: x });
|
|
764
765
|
}
|
|
765
|
-
return { versionMinor: o, sections:
|
|
766
|
+
return { versionMinor: o, sections: c };
|
|
766
767
|
}
|
|
767
|
-
function
|
|
768
|
+
function P(t, n, e) {
|
|
768
769
|
const o = t.get(n);
|
|
769
770
|
if (!o)
|
|
770
|
-
throw new
|
|
771
|
+
throw new u("E_GROUP_RANGE", `Missing V3 section ${e}`);
|
|
771
772
|
return o;
|
|
772
773
|
}
|
|
773
|
-
function
|
|
774
|
+
function dt(t, n) {
|
|
774
775
|
return t.get(n) ?? { type: n, flags: 0, offset: 0, length: 0 };
|
|
775
776
|
}
|
|
776
|
-
function
|
|
777
|
+
function xt(t, n, e) {
|
|
777
778
|
try {
|
|
778
|
-
return JSON.parse(
|
|
779
|
+
return JSON.parse(nn.decode(new Uint8Array(t, n.offset, n.length)));
|
|
779
780
|
} catch (o) {
|
|
780
|
-
throw new
|
|
781
|
+
throw new u("E_HEADER_JSON", `Invalid V3 ${e} JSON: ${o.message}`);
|
|
781
782
|
}
|
|
782
783
|
}
|
|
783
|
-
function
|
|
784
|
+
function rn(t) {
|
|
784
785
|
const n = String(t.encoding ?? "").toLowerCase();
|
|
785
786
|
return n === "nested_instanced_external" || n === "nested_instanced_external_annotations";
|
|
786
787
|
}
|
|
787
|
-
function
|
|
788
|
+
function sn(t) {
|
|
788
789
|
return String(t.encoding ?? "").toLowerCase() === "nested_instanced_external_annotations";
|
|
789
790
|
}
|
|
790
|
-
function
|
|
791
|
-
const o = t.features,
|
|
792
|
-
return n && (
|
|
791
|
+
function so(t, n, e) {
|
|
792
|
+
const o = t.features, i = o && typeof o == "object" && !Array.isArray(o) ? { ...o } : {};
|
|
793
|
+
return n && (i.has_external_variant_geometry = !0), e && (i.has_external_annotations = !0), Object.keys(i).length ? i : void 0;
|
|
793
794
|
}
|
|
794
|
-
function
|
|
795
|
+
function K(t, n) {
|
|
795
796
|
if (!Number.isInteger(t) || Number(t) < 0)
|
|
796
|
-
throw new
|
|
797
|
+
throw new u("E_HEADER", `${n} must be a non-negative integer`);
|
|
797
798
|
return Number(t);
|
|
798
799
|
}
|
|
799
|
-
function
|
|
800
|
+
function kn(t, n) {
|
|
800
801
|
if (typeof t != "string" || !t.trim())
|
|
801
|
-
throw new
|
|
802
|
+
throw new u("E_HEADER", `${n} must be a non-empty string`);
|
|
802
803
|
return t;
|
|
803
804
|
}
|
|
804
|
-
function
|
|
805
|
+
function pn(t, n) {
|
|
805
806
|
if (t == null)
|
|
806
807
|
return null;
|
|
807
808
|
if (!Array.isArray(t) || t.length !== 4 || t.some((e) => typeof e != "number" || !Number.isFinite(e)))
|
|
808
|
-
throw new
|
|
809
|
+
throw new u("E_HEADER", `${n} must be null or [minX, minY, maxX, maxY]`);
|
|
809
810
|
return [t[0], t[1], t[2], t[3]];
|
|
810
811
|
}
|
|
811
|
-
function
|
|
812
|
-
if (!
|
|
813
|
-
throw new
|
|
812
|
+
function Kt(t, n) {
|
|
813
|
+
if (!ut(t) || Array.isArray(t))
|
|
814
|
+
throw new u("E_HEADER", `${n} must be an object`);
|
|
814
815
|
return {
|
|
815
|
-
line_count:
|
|
816
|
-
fill_count:
|
|
817
|
-
dot_count:
|
|
818
|
-
bbox:
|
|
819
|
-
own_bbox:
|
|
816
|
+
line_count: K(t.line_count, `${n}.line_count`),
|
|
817
|
+
fill_count: K(t.fill_count, `${n}.fill_count`),
|
|
818
|
+
dot_count: K(t.dot_count, `${n}.dot_count`),
|
|
819
|
+
bbox: pn(t.bbox, `${n}.bbox`),
|
|
820
|
+
own_bbox: pn(t.own_bbox, `${n}.own_bbox`)
|
|
820
821
|
};
|
|
821
822
|
}
|
|
822
|
-
function
|
|
823
|
+
function ao(t) {
|
|
823
824
|
return t ? { minX: t[0], minY: t[1], maxX: t[2], maxY: t[3] } : null;
|
|
824
825
|
}
|
|
825
|
-
function
|
|
826
|
+
function Tt(t, n) {
|
|
826
827
|
const e = t.external_variants;
|
|
827
828
|
if (!Array.isArray(e))
|
|
828
|
-
throw new
|
|
829
|
+
throw new u("E_HEADER", "V3 external SCENE_META.external_variants must be an array");
|
|
829
830
|
if (e.length !== n)
|
|
830
|
-
throw new
|
|
831
|
+
throw new u(
|
|
831
832
|
"E_GROUP_RANGE",
|
|
832
833
|
`V3 external variant manifest count mismatch: manifest=${e.length}, table=${n}`
|
|
833
834
|
);
|
|
834
|
-
return e.map((o,
|
|
835
|
-
if (!
|
|
836
|
-
throw new
|
|
837
|
-
const r =
|
|
838
|
-
if (r !==
|
|
839
|
-
throw new
|
|
840
|
-
const
|
|
835
|
+
return e.map((o, i) => {
|
|
836
|
+
if (!ut(o) || Array.isArray(o))
|
|
837
|
+
throw new u("E_HEADER", `V3 external_variants[${i}] must be an object`);
|
|
838
|
+
const r = K(o.id, `V3 external_variants[${i}].id`);
|
|
839
|
+
if (r !== i)
|
|
840
|
+
throw new u("E_GROUP_RANGE", `V3 external_variants[${i}].id must equal ${i}, found ${r}`);
|
|
841
|
+
const s = kn(o.href, `V3 external_variants[${i}].href`), l = K(o.raw_size, `V3 external_variants[${i}].raw_size`);
|
|
841
842
|
if ("normal" in o || "annotation" in o) {
|
|
842
|
-
const
|
|
843
|
+
const a = Kt(o.annotation, `V3 external_variants[${i}].annotation`);
|
|
843
844
|
return {
|
|
844
845
|
id: r,
|
|
845
|
-
href:
|
|
846
|
-
raw_size:
|
|
847
|
-
normal:
|
|
846
|
+
href: s,
|
|
847
|
+
raw_size: l,
|
|
848
|
+
normal: Kt(o.normal, `V3 external_variants[${i}].normal`),
|
|
848
849
|
annotation: {
|
|
849
|
-
...
|
|
850
|
-
text_count:
|
|
851
|
-
|
|
852
|
-
`V3 external_variants[${
|
|
850
|
+
...a,
|
|
851
|
+
text_count: K(
|
|
852
|
+
ut(o.annotation) && !Array.isArray(o.annotation) ? o.annotation.text_count : void 0,
|
|
853
|
+
`V3 external_variants[${i}].annotation.text_count`
|
|
853
854
|
)
|
|
854
855
|
}
|
|
855
856
|
};
|
|
856
857
|
}
|
|
857
858
|
return {
|
|
858
859
|
id: r,
|
|
859
|
-
href:
|
|
860
|
-
raw_size:
|
|
861
|
-
line_count:
|
|
862
|
-
fill_count:
|
|
863
|
-
dot_count:
|
|
860
|
+
href: s,
|
|
861
|
+
raw_size: l,
|
|
862
|
+
line_count: K(o.line_count, `V3 external_variants[${i}].line_count`),
|
|
863
|
+
fill_count: K(o.fill_count, `V3 external_variants[${i}].fill_count`),
|
|
864
|
+
dot_count: K(o.dot_count, `V3 external_variants[${i}].dot_count`)
|
|
864
865
|
};
|
|
865
866
|
});
|
|
866
867
|
}
|
|
867
|
-
function
|
|
868
|
+
function Yn(t) {
|
|
868
869
|
const n = t.external_annotations;
|
|
869
870
|
if (n == null) return null;
|
|
870
|
-
if (!
|
|
871
|
-
throw new
|
|
871
|
+
if (!ut(n) || Array.isArray(n))
|
|
872
|
+
throw new u("E_HEADER", "V3 external_annotations must be an object");
|
|
872
873
|
const e = n.scene;
|
|
873
874
|
if (e == null) return {};
|
|
874
|
-
if (!
|
|
875
|
-
throw new
|
|
876
|
-
const o =
|
|
875
|
+
if (!ut(e) || Array.isArray(e))
|
|
876
|
+
throw new u("E_HEADER", "V3 external_annotations.scene must be an object");
|
|
877
|
+
const o = Kt(e, "V3 external_annotations.scene");
|
|
877
878
|
return {
|
|
878
879
|
scene: {
|
|
879
|
-
href:
|
|
880
|
-
raw_size:
|
|
880
|
+
href: kn(e.href, "V3 external_annotations.scene.href"),
|
|
881
|
+
raw_size: K(e.raw_size, "V3 external_annotations.scene.raw_size"),
|
|
881
882
|
...o,
|
|
882
|
-
text_count:
|
|
883
|
+
text_count: K(e.text_count, "V3 external_annotations.scene.text_count")
|
|
883
884
|
}
|
|
884
885
|
};
|
|
885
886
|
}
|
|
886
|
-
function
|
|
887
|
-
const { sections: n } =
|
|
888
|
-
return
|
|
887
|
+
function Fn(t) {
|
|
888
|
+
const { sections: n } = Et(t), e = P(n, 1, "SCENE_META");
|
|
889
|
+
return xt(t, e, "SCENE_META");
|
|
889
890
|
}
|
|
890
|
-
function
|
|
891
|
-
if (!
|
|
891
|
+
function Xo(t) {
|
|
892
|
+
if (!Q(t))
|
|
892
893
|
return [];
|
|
893
|
-
const { sections: n } =
|
|
894
|
-
if (!
|
|
894
|
+
const { sections: n } = Et(t), e = P(n, 1, "SCENE_META"), o = P(n, 5, "VARIANT_TABLE"), i = xt(t, e, "SCENE_META");
|
|
895
|
+
if (!rn(i))
|
|
895
896
|
return [];
|
|
896
897
|
if (o.length % 60 !== 0)
|
|
897
|
-
throw new
|
|
898
|
-
return
|
|
898
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
899
|
+
return Tt(i, o.length / 60);
|
|
899
900
|
}
|
|
900
|
-
function
|
|
901
|
+
function In() {
|
|
901
902
|
return {
|
|
902
903
|
manifest: [],
|
|
903
904
|
requiredVariantIds: [],
|
|
@@ -906,288 +907,288 @@ function An() {
|
|
|
906
907
|
skippedVariantIds: []
|
|
907
908
|
};
|
|
908
909
|
}
|
|
909
|
-
function
|
|
910
|
-
return
|
|
910
|
+
function lo(t, n) {
|
|
911
|
+
return Ve(t, n);
|
|
911
912
|
}
|
|
912
|
-
function
|
|
913
|
-
return
|
|
913
|
+
function Wt(t, n) {
|
|
914
|
+
return Cn(t, n);
|
|
914
915
|
}
|
|
915
|
-
function
|
|
916
|
-
return
|
|
916
|
+
function uo(t, n) {
|
|
917
|
+
return Ie(t, n);
|
|
917
918
|
}
|
|
918
|
-
function
|
|
919
|
+
function co(t, n, e, o) {
|
|
919
920
|
if (!n || e === void 0 || !Number.isFinite(e) || e <= 0 || !Number.isFinite(o) || o <= 0) return !1;
|
|
920
|
-
const
|
|
921
|
-
if (!
|
|
922
|
-
const r = Math.max(0,
|
|
923
|
-
return r < o &&
|
|
921
|
+
const i = uo(n, t);
|
|
922
|
+
if (!i) return !0;
|
|
923
|
+
const r = Math.max(0, i.maxX - i.minX) / e, s = Math.max(0, i.maxY - i.minY) / e;
|
|
924
|
+
return r < o && s < o;
|
|
924
925
|
}
|
|
925
|
-
function
|
|
926
|
-
const n = Math.min(t.minX, t.maxX), e = Math.max(t.minX, t.maxX), o = Math.min(t.minY, t.maxY),
|
|
927
|
-
return [n, e, o,
|
|
926
|
+
function zn(t) {
|
|
927
|
+
const n = Math.min(t.minX, t.maxX), e = Math.max(t.minX, t.maxX), o = Math.min(t.minY, t.maxY), i = Math.max(t.minY, t.maxY);
|
|
928
|
+
return [n, e, o, i].every(Number.isFinite) ? { minX: n, minY: o, maxX: e, maxY: i } : null;
|
|
928
929
|
}
|
|
929
|
-
function
|
|
930
|
+
function fo(t) {
|
|
930
931
|
return Math.max(1, Math.abs(t.maxX - t.minX), Math.abs(t.maxY - t.minY));
|
|
931
932
|
}
|
|
932
|
-
function
|
|
933
|
+
function Hn(t, n) {
|
|
933
934
|
return `${t}:${n}`;
|
|
934
935
|
}
|
|
935
|
-
function
|
|
936
|
-
const n = t.map((o) => o.worldBBox && !o.unknownBBox ?
|
|
937
|
-
return Math.max(1, e *
|
|
936
|
+
function mo(t) {
|
|
937
|
+
const n = t.map((o) => o.worldBBox && !o.unknownBBox ? fo(o.worldBBox) : 0).filter((o) => Number.isFinite(o) && o > 0).sort((o, i) => o - i), e = n.length > 0 ? n[Math.floor(n.length / 2)] : 1;
|
|
938
|
+
return Math.max(1, e * je);
|
|
938
939
|
}
|
|
939
|
-
function
|
|
940
|
-
const e = t.map((
|
|
941
|
-
const
|
|
940
|
+
function _o(t, n) {
|
|
941
|
+
const e = t.map((s, l) => {
|
|
942
|
+
const a = n(s), c = a.worldBBox ? zn(a.worldBBox) : null;
|
|
942
943
|
return {
|
|
943
|
-
sceneInstanceId:
|
|
944
|
-
sceneInstance:
|
|
945
|
-
worldBBox:
|
|
946
|
-
unknownBBox:
|
|
944
|
+
sceneInstanceId: l,
|
|
945
|
+
sceneInstance: s,
|
|
946
|
+
worldBBox: c,
|
|
947
|
+
unknownBBox: a.unknownBBox || !c
|
|
947
948
|
};
|
|
948
|
-
}), o =
|
|
949
|
-
for (const
|
|
950
|
-
if (
|
|
951
|
-
r.push(
|
|
949
|
+
}), o = mo(e), i = /* @__PURE__ */ new Map(), r = [];
|
|
950
|
+
for (const s of e) {
|
|
951
|
+
if (s.unknownBBox || !s.worldBBox) {
|
|
952
|
+
r.push(s);
|
|
952
953
|
continue;
|
|
953
954
|
}
|
|
954
|
-
const
|
|
955
|
-
if (!Number.isFinite(
|
|
956
|
-
r.push(
|
|
955
|
+
const l = Math.floor(s.worldBBox.minX / o), a = Math.floor(s.worldBBox.maxX / o), c = Math.floor(s.worldBBox.minY / o), _ = Math.floor(s.worldBBox.maxY / o), f = (a - l + 1) * (_ - c + 1);
|
|
956
|
+
if (!Number.isFinite(f) || f > qe) {
|
|
957
|
+
r.push(s);
|
|
957
958
|
continue;
|
|
958
959
|
}
|
|
959
|
-
for (let
|
|
960
|
-
for (let
|
|
961
|
-
const
|
|
962
|
-
y ? y.push(
|
|
960
|
+
for (let d = l; d <= a; d += 1)
|
|
961
|
+
for (let m = c; m <= _; m += 1) {
|
|
962
|
+
const A = Hn(d, m), y = i.get(A);
|
|
963
|
+
y ? y.push(s) : i.set(A, [s]);
|
|
963
964
|
}
|
|
964
965
|
}
|
|
965
|
-
return { cellSize: o, cells:
|
|
966
|
+
return { cellSize: o, cells: i, overflow: r, records: e };
|
|
966
967
|
}
|
|
967
|
-
function
|
|
968
|
-
const o =
|
|
968
|
+
function Eo(t, n, e) {
|
|
969
|
+
const o = Rn.get(t);
|
|
969
970
|
if (o && o.records.length === n.length)
|
|
970
971
|
return o;
|
|
971
|
-
const
|
|
972
|
-
return
|
|
972
|
+
const i = _o(n, e);
|
|
973
|
+
return Rn.set(t, i), i;
|
|
973
974
|
}
|
|
974
|
-
function
|
|
975
|
-
const e =
|
|
975
|
+
function xo(t, n) {
|
|
976
|
+
const e = zn(n);
|
|
976
977
|
if (!e)
|
|
977
978
|
return t.records;
|
|
978
|
-
const o = /* @__PURE__ */ new Set(),
|
|
979
|
-
for (let
|
|
980
|
-
for (let
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
for (const
|
|
984
|
-
|
|
979
|
+
const o = /* @__PURE__ */ new Set(), i = Math.floor(e.minX / t.cellSize), r = Math.floor(e.maxX / t.cellSize), s = Math.floor(e.minY / t.cellSize), l = Math.floor(e.maxY / t.cellSize);
|
|
980
|
+
for (let a = i; a <= r; a += 1)
|
|
981
|
+
for (let c = s; c <= l; c += 1) {
|
|
982
|
+
const _ = t.cells.get(Hn(a, c));
|
|
983
|
+
if (_)
|
|
984
|
+
for (const f of _)
|
|
985
|
+
f.worldBBox && Wt(e, f.worldBBox) && o.add(f);
|
|
985
986
|
}
|
|
986
|
-
for (const
|
|
987
|
-
(!
|
|
988
|
-
return Array.from(o).sort((
|
|
989
|
-
}
|
|
990
|
-
function
|
|
991
|
-
if (!
|
|
992
|
-
return
|
|
993
|
-
const e = new DataView(t), { sections: o } =
|
|
994
|
-
if (!
|
|
995
|
-
return
|
|
996
|
-
const
|
|
997
|
-
if (
|
|
998
|
-
throw new
|
|
999
|
-
const
|
|
1000
|
-
const
|
|
1001
|
-
var
|
|
1002
|
-
return
|
|
1003
|
-
}, 0),
|
|
1004
|
-
manifest:
|
|
1005
|
-
requiredVariantIds:
|
|
1006
|
-
requiredNormalBytes:
|
|
1007
|
-
totalManifestBytes:
|
|
1008
|
-
skippedVariantIds:
|
|
987
|
+
for (const a of t.overflow)
|
|
988
|
+
(!a.worldBBox || Wt(e, a.worldBBox)) && o.add(a);
|
|
989
|
+
return Array.from(o).sort((a, c) => a.sceneInstanceId - c.sceneInstanceId);
|
|
990
|
+
}
|
|
991
|
+
function Lo(t, n = {}) {
|
|
992
|
+
if (!Q(t))
|
|
993
|
+
return In();
|
|
994
|
+
const e = new DataView(t), { sections: o } = Et(t), i = P(o, 1, "SCENE_META"), r = xt(t, i, "SCENE_META");
|
|
995
|
+
if (!rn(r))
|
|
996
|
+
return In();
|
|
997
|
+
const s = P(o, 5, "VARIANT_TABLE");
|
|
998
|
+
if (s.length % 60 !== 0)
|
|
999
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1000
|
+
const l = s.length / 60, a = Tt(r, l), c = a.reduce((N, E) => N + E.raw_size, 0), _ = n.viewport === void 0 ? void 0 : n.viewport, f = (N, E) => {
|
|
1001
|
+
const V = Array.from(N).sort((B, O) => B - O), T = a.map((B) => B.id).filter((B) => !N.has(B)).sort((B, O) => B - O), C = V.reduce((B, O) => {
|
|
1002
|
+
var j;
|
|
1003
|
+
return B + (((j = a[O]) == null ? void 0 : j.raw_size) ?? 0);
|
|
1004
|
+
}, 0), b = {
|
|
1005
|
+
manifest: a,
|
|
1006
|
+
requiredVariantIds: V,
|
|
1007
|
+
requiredNormalBytes: C,
|
|
1008
|
+
totalManifestBytes: c,
|
|
1009
|
+
skippedVariantIds: T,
|
|
1009
1010
|
includedSceneInstanceIds: [...E]
|
|
1010
1011
|
};
|
|
1011
|
-
return
|
|
1012
|
+
return _ === void 0 ? b : { ...b, viewport: _ };
|
|
1012
1013
|
};
|
|
1013
1014
|
if (n.loadBlocks === !1)
|
|
1014
|
-
return
|
|
1015
|
-
const
|
|
1016
|
-
if (Number(r.variant_count ??
|
|
1017
|
-
throw new
|
|
1018
|
-
if (Number(r.scene_instance_count ??
|
|
1019
|
-
throw new
|
|
1015
|
+
return f(/* @__PURE__ */ new Set(), []);
|
|
1016
|
+
const d = P(o, 7, "SCENE_INSTANCE_TABLE"), m = dt(o, 8), A = Z(t, d, "V3 SCENE_INSTANCE_TABLE"), y = Z(t, m, "V3 NESTED_INSTANCE_TABLE");
|
|
1017
|
+
if (Number(r.variant_count ?? l) !== l)
|
|
1018
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1019
|
+
if (Number(r.scene_instance_count ?? A.length) !== A.length)
|
|
1020
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1020
1021
|
if (Number(r.nested_instance_count ?? y.length) !== y.length)
|
|
1021
|
-
throw new
|
|
1022
|
-
const
|
|
1023
|
-
for (let
|
|
1024
|
-
const E =
|
|
1025
|
-
if (
|
|
1026
|
-
throw new
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
id:
|
|
1030
|
-
nestedStart:
|
|
1031
|
-
nestedCount:
|
|
1022
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1023
|
+
const x = /* @__PURE__ */ new Map(), h = [];
|
|
1024
|
+
for (let N = 0; N < l; N += 1) {
|
|
1025
|
+
const E = s.offset + N * 60, V = e.getUint32(E + 32, !0), T = e.getUint32(E + 36, !0);
|
|
1026
|
+
if (V + T > y.length)
|
|
1027
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${N} nested range exceeds table`);
|
|
1028
|
+
const C = a[N], b = Ut(C);
|
|
1029
|
+
h[N] = {
|
|
1030
|
+
id: N,
|
|
1031
|
+
nestedStart: V,
|
|
1032
|
+
nestedCount: T,
|
|
1032
1033
|
precisionOriginX: e.getFloat32(E + 48, !0),
|
|
1033
1034
|
precisionOriginY: e.getFloat32(E + 52, !0),
|
|
1034
|
-
bbox:
|
|
1035
|
-
ownBBox:
|
|
1035
|
+
bbox: b,
|
|
1036
|
+
ownBBox: b
|
|
1036
1037
|
};
|
|
1037
|
-
const
|
|
1038
|
-
for (let
|
|
1039
|
-
|
|
1040
|
-
|
|
1038
|
+
const B = [];
|
|
1039
|
+
for (let O = 0; O < T; O += 1)
|
|
1040
|
+
B.push(y[V + O].variantId);
|
|
1041
|
+
x.set(N, B);
|
|
1041
1042
|
}
|
|
1042
|
-
|
|
1043
|
-
if (!
|
|
1044
|
-
throw new
|
|
1043
|
+
Rt(A, y, (N) => {
|
|
1044
|
+
if (!a[N.variantId])
|
|
1045
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N.variantId}`);
|
|
1045
1046
|
});
|
|
1046
|
-
const
|
|
1047
|
+
const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = (N, E, V) => {
|
|
1047
1048
|
if (E > 64)
|
|
1048
|
-
throw new
|
|
1049
|
-
if (
|
|
1050
|
-
throw new
|
|
1051
|
-
if (!
|
|
1052
|
-
throw new
|
|
1053
|
-
if (!
|
|
1054
|
-
|
|
1055
|
-
for (const
|
|
1056
|
-
|
|
1057
|
-
|
|
1049
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1050
|
+
if (V.has(N))
|
|
1051
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${N}`);
|
|
1052
|
+
if (!a[N])
|
|
1053
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N}`);
|
|
1054
|
+
if (!w.has(N)) {
|
|
1055
|
+
R.add(N), V.add(N);
|
|
1056
|
+
for (const T of x.get(N) ?? [])
|
|
1057
|
+
p(T, E + 1, V);
|
|
1058
|
+
V.delete(N), w.add(N);
|
|
1058
1059
|
}
|
|
1059
|
-
},
|
|
1060
|
+
}, v = n.hiddenInstanceIds ?? /* @__PURE__ */ new Set(), U = n.viewport == null ? null : lo(
|
|
1060
1061
|
n.viewport,
|
|
1061
|
-
n.viewportPaddingRatio ??
|
|
1062
|
-
), D = n.minViewportPixelSize ??
|
|
1062
|
+
n.viewportPaddingRatio ?? ze
|
|
1063
|
+
), D = n.minViewportPixelSize ?? He, $ = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Set(), Y = (N, E, V) => {
|
|
1063
1064
|
if (E > 64)
|
|
1064
|
-
throw new
|
|
1065
|
-
if (
|
|
1066
|
-
throw new
|
|
1067
|
-
if (
|
|
1068
|
-
return
|
|
1069
|
-
const
|
|
1070
|
-
if (!
|
|
1071
|
-
throw new
|
|
1072
|
-
|
|
1073
|
-
let
|
|
1074
|
-
for (let
|
|
1075
|
-
const
|
|
1076
|
-
if (!
|
|
1077
|
-
throw new
|
|
1078
|
-
const
|
|
1079
|
-
if ((!
|
|
1065
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1066
|
+
if (V.has(N))
|
|
1067
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${N}`);
|
|
1068
|
+
if ($.has(N))
|
|
1069
|
+
return $.get(N) ?? null;
|
|
1070
|
+
const T = h[N];
|
|
1071
|
+
if (!T)
|
|
1072
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${N}`);
|
|
1073
|
+
V.add(N);
|
|
1074
|
+
let C = T.ownBBox, b = !1;
|
|
1075
|
+
for (let B = 0; B < T.nestedCount; B += 1) {
|
|
1076
|
+
const O = y[T.nestedStart + B], j = h[O.variantId];
|
|
1077
|
+
if (!j)
|
|
1078
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${O.variantId}`);
|
|
1079
|
+
const H = Y(O.variantId, E + 1, V);
|
|
1080
|
+
if ((!H || M.has(O.variantId)) && (b = !0), !H)
|
|
1080
1081
|
continue;
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1082
|
+
const X = ln(O, T, j);
|
|
1083
|
+
C = pt(C, It(H, X));
|
|
1083
1084
|
}
|
|
1084
|
-
return
|
|
1085
|
-
},
|
|
1086
|
-
|
|
1087
|
-
|
|
1085
|
+
return V.delete(N), $.set(N, C), (!C || b) && M.add(N), C;
|
|
1086
|
+
}, z = [], S = (N, E, V) => {
|
|
1087
|
+
v.has(E) || U && V && (!Wt(U, V) || co(
|
|
1088
|
+
V,
|
|
1088
1089
|
n.viewport ?? null,
|
|
1089
1090
|
n.worldUnitsPerPixel,
|
|
1090
1091
|
D
|
|
1091
|
-
)) || (
|
|
1092
|
+
)) || (z.push(E), p(N.variantId, 0, /* @__PURE__ */ new Set()));
|
|
1092
1093
|
};
|
|
1093
|
-
if (
|
|
1094
|
-
const
|
|
1095
|
-
const
|
|
1094
|
+
if (U) {
|
|
1095
|
+
const N = Eo(t, A, (E) => {
|
|
1096
|
+
const V = Y(E.variantId, 0, /* @__PURE__ */ new Set()), T = !V || M.has(E.variantId);
|
|
1096
1097
|
return {
|
|
1097
|
-
worldBBox:
|
|
1098
|
-
unknownBBox:
|
|
1098
|
+
worldBBox: V ? It(V, E) : null,
|
|
1099
|
+
unknownBBox: T
|
|
1099
1100
|
};
|
|
1100
1101
|
});
|
|
1101
|
-
for (const E of
|
|
1102
|
-
|
|
1102
|
+
for (const E of xo(N, U))
|
|
1103
|
+
S(E.sceneInstance, E.sceneInstanceId, E.unknownBBox ? null : E.worldBBox);
|
|
1103
1104
|
} else
|
|
1104
|
-
|
|
1105
|
-
|
|
1105
|
+
A.forEach((N, E) => {
|
|
1106
|
+
S(N, E, null);
|
|
1106
1107
|
});
|
|
1107
|
-
return
|
|
1108
|
+
return f(R, z);
|
|
1108
1109
|
}
|
|
1109
|
-
function
|
|
1110
|
-
if (!
|
|
1110
|
+
function ko(t) {
|
|
1111
|
+
if (!Q(t))
|
|
1111
1112
|
return null;
|
|
1112
|
-
const n =
|
|
1113
|
-
return
|
|
1113
|
+
const n = Fn(t);
|
|
1114
|
+
return sn(n) ? Yn(n) : null;
|
|
1114
1115
|
}
|
|
1115
|
-
function
|
|
1116
|
+
function go(t, n) {
|
|
1116
1117
|
if (!Array.isArray(t) || t.length !== 4)
|
|
1117
|
-
throw new
|
|
1118
|
+
throw new u("E_HEADER", `${n} must be a four-number array`);
|
|
1118
1119
|
const e = t.map(Number);
|
|
1119
1120
|
if (!e.every(Number.isFinite))
|
|
1120
|
-
throw new
|
|
1121
|
+
throw new u("E_HEADER", `${n} must contain finite numbers`);
|
|
1121
1122
|
return [e[0], e[1], e[2], e[3]];
|
|
1122
1123
|
}
|
|
1123
|
-
function
|
|
1124
|
-
return
|
|
1124
|
+
function bt(t, n, e, o) {
|
|
1125
|
+
return _t(n, e, t.byteLength, o), nn.decode(t.subarray(n, n + e));
|
|
1125
1126
|
}
|
|
1126
|
-
function
|
|
1127
|
+
function jn(t, n, e) {
|
|
1127
1128
|
if (n.length % 20 !== 0)
|
|
1128
|
-
throw new
|
|
1129
|
-
const o = new DataView(t),
|
|
1129
|
+
throw new u("E_GROUP_RANGE", "V3 LAYER_TABLE length must be a multiple of 20");
|
|
1130
|
+
const o = new DataView(t), i = [];
|
|
1130
1131
|
for (let r = n.offset; r < n.offset + n.length; r += 20) {
|
|
1131
|
-
const
|
|
1132
|
-
|
|
1133
|
-
name:
|
|
1132
|
+
const s = o.getUint32(r, !0), l = o.getUint32(r + 4, !0);
|
|
1133
|
+
i.push({
|
|
1134
|
+
name: bt(e, s, l, "V3 layer name"),
|
|
1134
1135
|
color: [o.getUint8(r + 8), o.getUint8(r + 9), o.getUint8(r + 10)],
|
|
1135
1136
|
visible: o.getUint8(r + 11) !== 0,
|
|
1136
1137
|
lw_px: o.getFloat32(r + 12, !0)
|
|
1137
1138
|
});
|
|
1138
1139
|
}
|
|
1139
|
-
return
|
|
1140
|
+
return i;
|
|
1140
1141
|
}
|
|
1141
|
-
function
|
|
1142
|
+
function wt(t, n, e, o, i, r) {
|
|
1142
1143
|
if (e + 4 > o)
|
|
1143
|
-
throw new
|
|
1144
|
-
const
|
|
1145
|
-
if (
|
|
1146
|
-
throw new
|
|
1144
|
+
throw new u("E_GROUP_RANGE", `Missing ${i} vertex_count`);
|
|
1145
|
+
const s = n.getUint32(e, !0), l = e + 4, a = ft(t, n, l, s, o, r);
|
|
1146
|
+
if (a.offset > o)
|
|
1147
|
+
throw new u("E_GROUP_RANGE", `${i} exceeds section bounds`);
|
|
1147
1148
|
return {
|
|
1148
|
-
chunk:
|
|
1149
|
-
offset:
|
|
1149
|
+
chunk: a.chunk,
|
|
1150
|
+
offset: a.offset
|
|
1150
1151
|
};
|
|
1151
1152
|
}
|
|
1152
|
-
function
|
|
1153
|
-
const
|
|
1153
|
+
function qn(t, n, e, o, i, r) {
|
|
1154
|
+
const s = wt(t, n, e, o, i, r), l = e + 4;
|
|
1154
1155
|
return {
|
|
1155
|
-
chunk:
|
|
1156
|
+
chunk: s.chunk,
|
|
1156
1157
|
snapshot: {
|
|
1157
|
-
count:
|
|
1158
|
-
raw: new Uint8Array(t,
|
|
1158
|
+
count: s.chunk.count,
|
|
1159
|
+
raw: new Uint8Array(t, l, s.offset - l).slice(),
|
|
1159
1160
|
groupLayerEncoding: r
|
|
1160
1161
|
},
|
|
1161
|
-
offset:
|
|
1162
|
+
offset: s.offset
|
|
1162
1163
|
};
|
|
1163
1164
|
}
|
|
1164
|
-
function
|
|
1165
|
+
function At(t = "u8") {
|
|
1165
1166
|
return {
|
|
1166
1167
|
chunk: { pos: new Float32Array(0), col: new Uint8Array(0), lay: new Uint8Array(0), count: 0 },
|
|
1167
1168
|
snapshot: { count: 0, raw: new Uint8Array(0), groupLayerEncoding: t }
|
|
1168
1169
|
};
|
|
1169
1170
|
}
|
|
1170
|
-
function
|
|
1171
|
+
function Kn(t = "u8") {
|
|
1171
1172
|
return {
|
|
1172
|
-
line:
|
|
1173
|
-
fill:
|
|
1174
|
-
dot:
|
|
1173
|
+
line: At(t),
|
|
1174
|
+
fill: At(t),
|
|
1175
|
+
dot: At(t)
|
|
1175
1176
|
};
|
|
1176
1177
|
}
|
|
1177
|
-
function
|
|
1178
|
+
function Wn(t, n, e) {
|
|
1178
1179
|
var o;
|
|
1179
1180
|
return !!(n && e && t.deferExternalVariantGeometry && !((o = t.externalVariantBuffers) != null && o.has(n.id)));
|
|
1180
1181
|
}
|
|
1181
|
-
function
|
|
1182
|
-
if (
|
|
1183
|
-
return
|
|
1184
|
-
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1187
|
-
throw new
|
|
1188
|
-
return { chunk:
|
|
1182
|
+
function Ot(t, n, e, o, i, r, s) {
|
|
1183
|
+
if (i === 0)
|
|
1184
|
+
return At(s);
|
|
1185
|
+
_t(o, i, e.length, r);
|
|
1186
|
+
const l = e.offset + o, a = l + i, c = qn(t, n, l, a, r, s);
|
|
1187
|
+
if (c.offset !== a)
|
|
1188
|
+
throw new u("E_GROUP_RANGE", `${r} has trailing bytes`);
|
|
1189
|
+
return { chunk: c.chunk, snapshot: c.snapshot };
|
|
1189
1190
|
}
|
|
1190
|
-
function
|
|
1191
|
+
function an(t, n, e) {
|
|
1191
1192
|
if ([
|
|
1192
1193
|
t.getUint32(n + 8, !0),
|
|
1193
1194
|
t.getUint32(n + 12, !0),
|
|
@@ -1195,206 +1196,233 @@ function kn(t, n, e) {
|
|
|
1195
1196
|
t.getUint32(n + 20, !0),
|
|
1196
1197
|
t.getUint32(n + 24, !0),
|
|
1197
1198
|
t.getUint32(n + 28, !0)
|
|
1198
|
-
].some((
|
|
1199
|
-
throw new
|
|
1199
|
+
].some((i) => i !== 0))
|
|
1200
|
+
throw new u("E_GROUP_RANGE", `V3 external variant ${e} must use zero inline geometry offsets`);
|
|
1200
1201
|
}
|
|
1201
|
-
function
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
throw new
|
|
1202
|
+
function lt(t, n, e, o, i, r) {
|
|
1203
|
+
const s = qn(t, n, e, t.byteLength, i, r);
|
|
1204
|
+
if (s.chunk.count !== o)
|
|
1205
|
+
throw new u(
|
|
1205
1206
|
"E_GROUP_RANGE",
|
|
1206
|
-
`${
|
|
1207
|
+
`${i} vertex_count mismatch: manifest=${o}, sidecar=${s.chunk.count}`
|
|
1207
1208
|
);
|
|
1208
|
-
return
|
|
1209
|
+
return s;
|
|
1209
1210
|
}
|
|
1210
|
-
function
|
|
1211
|
+
function Bt(t) {
|
|
1211
1212
|
return "normal" in t ? t.normal : t;
|
|
1212
1213
|
}
|
|
1213
|
-
function
|
|
1214
|
-
const o =
|
|
1214
|
+
function ho(t, n, e) {
|
|
1215
|
+
const o = Bt(t), i = new DataView(n);
|
|
1215
1216
|
let r = 0;
|
|
1216
|
-
const
|
|
1217
|
-
r =
|
|
1218
|
-
const
|
|
1219
|
-
r =
|
|
1220
|
-
const
|
|
1221
|
-
if (r =
|
|
1222
|
-
throw new
|
|
1217
|
+
const s = lt(n, i, r, o.line_count, `V3 external variant ${t.id} line blob`, e);
|
|
1218
|
+
r = s.offset;
|
|
1219
|
+
const l = lt(n, i, r, o.fill_count, `V3 external variant ${t.id} fill blob`, e);
|
|
1220
|
+
r = l.offset;
|
|
1221
|
+
const a = lt(n, i, r, o.dot_count, `V3 external variant ${t.id} dot blob`, e);
|
|
1222
|
+
if (r = a.offset, r !== n.byteLength)
|
|
1223
|
+
throw new u("E_GROUP_RANGE", `V3 external variant ${t.id} sidecar has trailing bytes`);
|
|
1223
1224
|
return {
|
|
1224
|
-
line: { chunk:
|
|
1225
|
-
fill: { chunk:
|
|
1226
|
-
dot: { chunk:
|
|
1225
|
+
line: { chunk: s.chunk, snapshot: s.snapshot },
|
|
1226
|
+
fill: { chunk: l.chunk, snapshot: l.snapshot },
|
|
1227
|
+
dot: { chunk: a.chunk, snapshot: a.snapshot }
|
|
1227
1228
|
};
|
|
1228
1229
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const e =
|
|
1230
|
+
function yo(t, n) {
|
|
1231
|
+
const e = tn(n), o = ot(e, 257, "BLOCK_NORMAL_GEOMETRY"), i = new DataView(n);
|
|
1231
1232
|
let r = o.offset;
|
|
1232
|
-
const
|
|
1233
|
-
r =
|
|
1234
|
-
const
|
|
1235
|
-
r =
|
|
1236
|
-
const
|
|
1237
|
-
if (r =
|
|
1238
|
-
throw new
|
|
1233
|
+
const s = o.offset + o.length, l = Qt(e.versionMinor), a = lt(n, i, r, t.normal.line_count, `V3.3 external variant ${t.id} normal line blob`, l);
|
|
1234
|
+
r = a.offset;
|
|
1235
|
+
const c = lt(n, i, r, t.normal.fill_count, `V3.3 external variant ${t.id} normal fill blob`, l);
|
|
1236
|
+
r = c.offset;
|
|
1237
|
+
const _ = lt(n, i, r, t.normal.dot_count, `V3.3 external variant ${t.id} normal dot blob`, l);
|
|
1238
|
+
if (r = _.offset, r !== s)
|
|
1239
|
+
throw new u("E_GROUP_RANGE", `V3.3 external variant ${t.id} normal geometry section has trailing bytes`);
|
|
1239
1240
|
return {
|
|
1240
|
-
line: { chunk:
|
|
1241
|
-
fill: { chunk:
|
|
1242
|
-
dot: { chunk:
|
|
1241
|
+
line: { chunk: a.chunk, snapshot: a.snapshot },
|
|
1242
|
+
fill: { chunk: c.chunk, snapshot: c.snapshot },
|
|
1243
|
+
dot: { chunk: _.chunk, snapshot: _.snapshot }
|
|
1243
1244
|
};
|
|
1244
1245
|
}
|
|
1245
|
-
function
|
|
1246
|
+
function wo(t, n, e = "u8") {
|
|
1246
1247
|
if (n.byteLength !== t.raw_size)
|
|
1247
|
-
throw new
|
|
1248
|
+
throw new u(
|
|
1248
1249
|
"E_GROUP_RANGE",
|
|
1249
1250
|
`V3 external variant ${t.id} raw_size mismatch: manifest=${t.raw_size}, sidecar=${n.byteLength}`
|
|
1250
1251
|
);
|
|
1251
|
-
return "normal" in t ?
|
|
1252
|
+
return "normal" in t ? yo(t, n) : ho(t, n, e);
|
|
1252
1253
|
}
|
|
1253
|
-
function
|
|
1254
|
+
function Jn(t, n, e) {
|
|
1254
1255
|
const o = n == null ? void 0 : n.get(t.id);
|
|
1255
1256
|
if (!o)
|
|
1256
|
-
throw new
|
|
1257
|
-
return
|
|
1257
|
+
throw new u("E_GROUP_RANGE", `Missing V3 external sidecar buffer for variant ${t.id}`);
|
|
1258
|
+
return wo(t, o, e);
|
|
1258
1259
|
}
|
|
1259
|
-
function
|
|
1260
|
+
function $t(t, n, e, o, i) {
|
|
1260
1261
|
if (o === 0)
|
|
1261
1262
|
return 0;
|
|
1262
|
-
if (
|
|
1263
|
-
throw new
|
|
1263
|
+
if (_t(e, o, n.length, i), o < 4)
|
|
1264
|
+
throw new u("E_GROUP_RANGE", `Missing ${i} vertex_count`);
|
|
1264
1265
|
return t.getUint32(n.offset + e, !0);
|
|
1265
1266
|
}
|
|
1266
|
-
function
|
|
1267
|
-
const
|
|
1267
|
+
function Ao(t, n, e, o) {
|
|
1268
|
+
const i = e.offset + e.length;
|
|
1268
1269
|
let r = e.offset;
|
|
1269
|
-
const
|
|
1270
|
-
r =
|
|
1271
|
-
const
|
|
1272
|
-
r =
|
|
1273
|
-
const
|
|
1274
|
-
if (r =
|
|
1275
|
-
throw new
|
|
1270
|
+
const s = wt(t, n, r, i, "V3 BASE_GEOMETRY line", o);
|
|
1271
|
+
r = s.offset;
|
|
1272
|
+
const l = wt(t, n, r, i, "V3 BASE_GEOMETRY fill", o);
|
|
1273
|
+
r = l.offset;
|
|
1274
|
+
const a = wt(t, n, r, i, "V3 BASE_GEOMETRY dot", o);
|
|
1275
|
+
if (r = a.offset, r !== i)
|
|
1276
|
+
throw new u("E_GROUP_RANGE", "V3 BASE_GEOMETRY has trailing bytes");
|
|
1276
1277
|
return {
|
|
1277
|
-
line:
|
|
1278
|
-
fill:
|
|
1279
|
-
dot:
|
|
1278
|
+
line: s.chunk,
|
|
1279
|
+
fill: l.chunk,
|
|
1280
|
+
dot: a.chunk
|
|
1280
1281
|
};
|
|
1281
1282
|
}
|
|
1282
|
-
function
|
|
1283
|
-
return
|
|
1283
|
+
function Mt(t) {
|
|
1284
|
+
return Ge(t.pos, t.count, 2);
|
|
1284
1285
|
}
|
|
1285
|
-
function
|
|
1286
|
-
return
|
|
1286
|
+
function Zn(t, n, e) {
|
|
1287
|
+
return pt(pt(Mt(t), Mt(n)), Mt(e));
|
|
1287
1288
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return "normal" in t ?
|
|
1289
|
+
function Ut(t) {
|
|
1290
|
+
return "normal" in t ? ao(t.normal.bbox ?? t.normal.own_bbox ?? null) : null;
|
|
1290
1291
|
}
|
|
1291
|
-
function
|
|
1292
|
+
function Ro(t, n, e, o, i, r, s, l) {
|
|
1292
1293
|
if (e.length % 60 !== 0)
|
|
1293
|
-
throw new
|
|
1294
|
-
const
|
|
1295
|
-
for (let
|
|
1296
|
-
const
|
|
1297
|
-
line:
|
|
1294
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1295
|
+
const a = [], c = /* @__PURE__ */ new Map(), _ = [], f = e.length / 60;
|
|
1296
|
+
for (let d = 0; d < f; d += 1) {
|
|
1297
|
+
const m = e.offset + d * 60, A = n.getUint32(m, !0), y = n.getUint32(m + 4, !0), x = (r == null ? void 0 : r[d]) ?? null, h = !x || !l.requiredExternalVariantIds || l.requiredExternalVariantIds.has(d), R = Wn(l, x, h), w = x ? (an(n, m, d), !h || R ? Kn(s) : Jn(x, l.externalVariantBuffers, s)) : {
|
|
1298
|
+
line: Ot(
|
|
1298
1299
|
t,
|
|
1299
1300
|
n,
|
|
1300
1301
|
o,
|
|
1301
|
-
n.getUint32(
|
|
1302
|
-
n.getUint32(
|
|
1303
|
-
`V3 variant ${
|
|
1304
|
-
|
|
1302
|
+
n.getUint32(m + 8, !0),
|
|
1303
|
+
n.getUint32(m + 12, !0),
|
|
1304
|
+
`V3 variant ${d} line blob`,
|
|
1305
|
+
s
|
|
1305
1306
|
),
|
|
1306
|
-
fill:
|
|
1307
|
+
fill: Ot(
|
|
1307
1308
|
t,
|
|
1308
1309
|
n,
|
|
1309
1310
|
o,
|
|
1310
|
-
n.getUint32(
|
|
1311
|
-
n.getUint32(
|
|
1312
|
-
`V3 variant ${
|
|
1313
|
-
|
|
1311
|
+
n.getUint32(m + 16, !0),
|
|
1312
|
+
n.getUint32(m + 20, !0),
|
|
1313
|
+
`V3 variant ${d} fill blob`,
|
|
1314
|
+
s
|
|
1314
1315
|
),
|
|
1315
|
-
dot:
|
|
1316
|
+
dot: Ot(
|
|
1316
1317
|
t,
|
|
1317
1318
|
n,
|
|
1318
1319
|
o,
|
|
1319
|
-
n.getUint32(
|
|
1320
|
-
n.getUint32(
|
|
1321
|
-
`V3 variant ${
|
|
1322
|
-
|
|
1320
|
+
n.getUint32(m + 24, !0),
|
|
1321
|
+
n.getUint32(m + 28, !0),
|
|
1322
|
+
`V3 variant ${d} dot blob`,
|
|
1323
|
+
s
|
|
1323
1324
|
)
|
|
1324
|
-
},
|
|
1325
|
-
id:
|
|
1326
|
-
name:
|
|
1327
|
-
line_count:
|
|
1328
|
-
fill_count:
|
|
1329
|
-
dot_count:
|
|
1330
|
-
sourceLineCount:
|
|
1331
|
-
sourceFillCount:
|
|
1325
|
+
}, p = x ? Bt(x) : null, v = (p == null ? void 0 : p.line_count) ?? w.line.chunk.count, U = (p == null ? void 0 : p.fill_count) ?? w.fill.chunk.count, D = (p == null ? void 0 : p.dot_count) ?? w.dot.chunk.count, $ = x && (!h || R) ? Ut(x) : Zn(w.line.chunk, w.fill.chunk, w.dot.chunk), M = {
|
|
1326
|
+
id: d,
|
|
1327
|
+
name: bt(i, A, y, `V3 variant ${d} name`),
|
|
1328
|
+
line_count: R ? v : w.line.chunk.count,
|
|
1329
|
+
fill_count: R ? U : w.fill.chunk.count,
|
|
1330
|
+
dot_count: R ? D : w.dot.chunk.count,
|
|
1331
|
+
sourceLineCount: v,
|
|
1332
|
+
sourceFillCount: U,
|
|
1332
1333
|
sourceDotCount: D,
|
|
1333
|
-
nestedStart: n.getUint32(
|
|
1334
|
-
nestedCount: n.getUint32(
|
|
1335
|
-
textStart: n.getUint32(
|
|
1336
|
-
textCount: n.getUint32(
|
|
1337
|
-
precisionOriginX: n.getFloat32(
|
|
1338
|
-
precisionOriginY: n.getFloat32(
|
|
1339
|
-
lineSnapshot:
|
|
1340
|
-
fillSnapshot:
|
|
1341
|
-
dotSnapshot:
|
|
1342
|
-
bbox:
|
|
1334
|
+
nestedStart: n.getUint32(m + 32, !0),
|
|
1335
|
+
nestedCount: n.getUint32(m + 36, !0),
|
|
1336
|
+
textStart: n.getUint32(m + 40, !0),
|
|
1337
|
+
textCount: n.getUint32(m + 44, !0),
|
|
1338
|
+
precisionOriginX: n.getFloat32(m + 48, !0),
|
|
1339
|
+
precisionOriginY: n.getFloat32(m + 52, !0),
|
|
1340
|
+
lineSnapshot: w.line.snapshot,
|
|
1341
|
+
fillSnapshot: w.fill.snapshot,
|
|
1342
|
+
dotSnapshot: w.dot.snapshot,
|
|
1343
|
+
bbox: $
|
|
1343
1344
|
};
|
|
1344
|
-
|
|
1345
|
+
a.push(M), c.set(d, { line: w.line.chunk, fill: w.fill.chunk, dot: w.dot.chunk }), _.push({ line: w.line.snapshot, fill: w.fill.snapshot, dot: w.dot.snapshot });
|
|
1345
1346
|
}
|
|
1346
|
-
return { variantsById:
|
|
1347
|
+
return { variantsById: a, variants: c, snapshots: _ };
|
|
1347
1348
|
}
|
|
1348
|
-
function
|
|
1349
|
+
function Jt(t, n, e, o, i) {
|
|
1349
1350
|
if (n.length % 60 !== 0)
|
|
1350
|
-
throw new
|
|
1351
|
-
const r = [],
|
|
1352
|
-
for (let
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1351
|
+
throw new u("E_GROUP_RANGE", "V3 VARIANT_TABLE length must be a multiple of 60");
|
|
1352
|
+
const r = [], s = n.length / 60;
|
|
1353
|
+
for (let l = 0; l < s; l += 1) {
|
|
1354
|
+
const a = n.offset + l * 60, c = t.getUint32(a, !0), _ = t.getUint32(a + 4, !0), f = (i == null ? void 0 : i[l]) ?? null;
|
|
1355
|
+
f && an(t, a, l);
|
|
1356
|
+
const d = f ? Bt(f) : null, m = t.getFloat32(a + 48, !0), A = t.getFloat32(a + 52, !0);
|
|
1356
1357
|
r.push({
|
|
1357
|
-
id:
|
|
1358
|
-
name:
|
|
1359
|
-
line_count:
|
|
1358
|
+
id: l,
|
|
1359
|
+
name: bt(o, c, _, `V3 variant ${l} name`),
|
|
1360
|
+
line_count: f ? d.line_count : $t(
|
|
1360
1361
|
t,
|
|
1361
1362
|
e,
|
|
1362
|
-
t.getUint32(
|
|
1363
|
-
t.getUint32(
|
|
1364
|
-
`V3 variant ${
|
|
1363
|
+
t.getUint32(a + 8, !0),
|
|
1364
|
+
t.getUint32(a + 12, !0),
|
|
1365
|
+
`V3 variant ${l} line blob`
|
|
1365
1366
|
),
|
|
1366
|
-
fill_count:
|
|
1367
|
+
fill_count: f ? d.fill_count : $t(
|
|
1367
1368
|
t,
|
|
1368
1369
|
e,
|
|
1369
|
-
t.getUint32(
|
|
1370
|
-
t.getUint32(
|
|
1371
|
-
`V3 variant ${
|
|
1370
|
+
t.getUint32(a + 16, !0),
|
|
1371
|
+
t.getUint32(a + 20, !0),
|
|
1372
|
+
`V3 variant ${l} fill blob`
|
|
1372
1373
|
),
|
|
1373
|
-
dot_count:
|
|
1374
|
+
dot_count: f ? d.dot_count : $t(
|
|
1374
1375
|
t,
|
|
1375
1376
|
e,
|
|
1376
|
-
t.getUint32(
|
|
1377
|
-
t.getUint32(
|
|
1378
|
-
`V3 variant ${
|
|
1377
|
+
t.getUint32(a + 24, !0),
|
|
1378
|
+
t.getUint32(a + 28, !0),
|
|
1379
|
+
`V3 variant ${l} dot blob`
|
|
1379
1380
|
),
|
|
1380
|
-
nestedStart: t.getUint32(
|
|
1381
|
-
nestedCount: t.getUint32(
|
|
1382
|
-
textStart: t.getUint32(
|
|
1383
|
-
textCount: t.getUint32(
|
|
1384
|
-
precisionOriginX:
|
|
1385
|
-
precisionOriginY:
|
|
1386
|
-
bbox:
|
|
1381
|
+
nestedStart: t.getUint32(a + 32, !0),
|
|
1382
|
+
nestedCount: t.getUint32(a + 36, !0),
|
|
1383
|
+
textStart: t.getUint32(a + 40, !0),
|
|
1384
|
+
textCount: t.getUint32(a + 44, !0),
|
|
1385
|
+
precisionOriginX: m,
|
|
1386
|
+
precisionOriginY: A,
|
|
1387
|
+
bbox: f ? Ut(f) : null
|
|
1387
1388
|
});
|
|
1388
1389
|
}
|
|
1389
1390
|
return r;
|
|
1390
1391
|
}
|
|
1392
|
+
function No(t, n, e) {
|
|
1393
|
+
var l;
|
|
1394
|
+
const o = new DataView(t), i = [], r = /* @__PURE__ */ new Map(), s = [];
|
|
1395
|
+
for (const a of n.variantHeaders) {
|
|
1396
|
+
const c = ((l = n.externalVariants) == null ? void 0 : l[a.id]) ?? null, _ = !c || !e.requiredExternalVariantIds || e.requiredExternalVariantIds.has(a.id), f = Wn(e, c, _), d = c ? (() => {
|
|
1397
|
+
const w = n.sections.get(5).offset + a.id * 60;
|
|
1398
|
+
return an(o, w, a.id), !_ || f ? Kn(n.groupLayerEncoding) : Jn(c, e.externalVariantBuffers, n.groupLayerEncoding);
|
|
1399
|
+
})() : n.internalVariants.get(a.id);
|
|
1400
|
+
if (!d)
|
|
1401
|
+
throw new u("E_GROUP_RANGE", `Missing cached V3 variant geometry for variant ${a.id}`);
|
|
1402
|
+
const m = c ? Bt(c) : null, A = (m == null ? void 0 : m.line_count) ?? d.line.chunk.count, y = (m == null ? void 0 : m.fill_count) ?? d.fill.chunk.count, x = (m == null ? void 0 : m.dot_count) ?? d.dot.chunk.count, h = c && (!_ || f) ? Ut(c) : Zn(d.line.chunk, d.fill.chunk, d.dot.chunk), R = {
|
|
1403
|
+
...a,
|
|
1404
|
+
line_count: f ? A : d.line.chunk.count,
|
|
1405
|
+
fill_count: f ? y : d.fill.chunk.count,
|
|
1406
|
+
dot_count: f ? x : d.dot.chunk.count,
|
|
1407
|
+
sourceLineCount: A,
|
|
1408
|
+
sourceFillCount: y,
|
|
1409
|
+
sourceDotCount: x,
|
|
1410
|
+
lineSnapshot: d.line.snapshot,
|
|
1411
|
+
fillSnapshot: d.fill.snapshot,
|
|
1412
|
+
dotSnapshot: d.dot.snapshot,
|
|
1413
|
+
bbox: h
|
|
1414
|
+
};
|
|
1415
|
+
i.push(R), r.set(a.id, { line: d.line.chunk, fill: d.fill.chunk, dot: d.dot.chunk }), s.push({ line: d.line.snapshot, fill: d.fill.snapshot, dot: d.dot.snapshot });
|
|
1416
|
+
}
|
|
1417
|
+
return { variantsById: i, variants: r, snapshots: s };
|
|
1418
|
+
}
|
|
1391
1419
|
function Z(t, n, e) {
|
|
1392
1420
|
if (n.length % 32 !== 0)
|
|
1393
|
-
throw new
|
|
1394
|
-
const o = new DataView(t),
|
|
1421
|
+
throw new u("E_GROUP_RANGE", `${e} length must be a multiple of 32`);
|
|
1422
|
+
const o = new DataView(t), i = [];
|
|
1395
1423
|
for (let r = n.offset; r < n.offset + n.length; r += 32) {
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1424
|
+
const s = o.getUint16(r + 30, !0);
|
|
1425
|
+
bo(s), i.push({
|
|
1398
1426
|
variantId: o.getUint32(r, !0),
|
|
1399
1427
|
matA: o.getFloat32(r + 4, !0),
|
|
1400
1428
|
matB: o.getFloat32(r + 8, !0),
|
|
@@ -1403,44 +1431,44 @@ function Z(t, n, e) {
|
|
|
1403
1431
|
tx: o.getFloat32(r + 20, !0),
|
|
1404
1432
|
ty: o.getFloat32(r + 24, !0),
|
|
1405
1433
|
insLayerIdx: o.getUint16(r + 28, !0),
|
|
1406
|
-
flags:
|
|
1434
|
+
flags: s
|
|
1407
1435
|
});
|
|
1408
1436
|
}
|
|
1409
|
-
return
|
|
1437
|
+
return i;
|
|
1410
1438
|
}
|
|
1411
|
-
function
|
|
1412
|
-
const o = t.getUint32(n, !0),
|
|
1439
|
+
function po(t, n, e) {
|
|
1440
|
+
const o = t.getUint32(n, !0), i = t.getUint32(n + 4, !0), r = t.getUint8(n + 42), s = t.getUint8(n + 43), l = t.getFloat32(n + 24, !0), a = t.getFloat32(n + 28, !0);
|
|
1413
1441
|
return {
|
|
1414
|
-
t:
|
|
1442
|
+
t: bt(e, o, i, "V3 text value"),
|
|
1415
1443
|
x: t.getFloat32(n + 8, !0),
|
|
1416
1444
|
y: t.getFloat32(n + 12, !0),
|
|
1417
1445
|
h: t.getFloat32(n + 16, !0),
|
|
1418
1446
|
r: t.getFloat32(n + 20, !0),
|
|
1419
1447
|
c: [t.getUint8(n + 36), t.getUint8(n + 37), t.getUint8(n + 38)],
|
|
1420
1448
|
li: t.getUint16(n + 40, !0),
|
|
1421
|
-
ha:
|
|
1422
|
-
va:
|
|
1449
|
+
ha: Ke[r & 3] ?? "left",
|
|
1450
|
+
va: We[r >> 2 & 3] ?? "alphabetic",
|
|
1423
1451
|
lh: t.getFloat32(n + 32, !0),
|
|
1424
|
-
...
|
|
1425
|
-
...
|
|
1426
|
-
...
|
|
1427
|
-
...
|
|
1452
|
+
...l ? { w: l } : {},
|
|
1453
|
+
...a !== 1 ? { wf: a } : {},
|
|
1454
|
+
...s & 1 ? { mx: !0 } : {},
|
|
1455
|
+
...s & 2 ? { my: !0 } : {}
|
|
1428
1456
|
};
|
|
1429
1457
|
}
|
|
1430
|
-
function
|
|
1458
|
+
function vt(t, n, e, o) {
|
|
1431
1459
|
if (n.length % 44 !== 0)
|
|
1432
|
-
throw new
|
|
1433
|
-
const
|
|
1434
|
-
for (let
|
|
1435
|
-
|
|
1436
|
-
return
|
|
1460
|
+
throw new u("E_GROUP_RANGE", `${o} length must be a multiple of 44`);
|
|
1461
|
+
const i = [], r = new DataView(t);
|
|
1462
|
+
for (let s = n.offset; s < n.offset + n.length; s += 44)
|
|
1463
|
+
i.push(po(r, s, e));
|
|
1464
|
+
return i;
|
|
1437
1465
|
}
|
|
1438
|
-
function
|
|
1466
|
+
function Io(t, n) {
|
|
1439
1467
|
if (t.length % 44 !== 0)
|
|
1440
|
-
throw new
|
|
1468
|
+
throw new u("E_GROUP_RANGE", `${n} length must be a multiple of 44`);
|
|
1441
1469
|
return t.length / 44;
|
|
1442
1470
|
}
|
|
1443
|
-
function
|
|
1471
|
+
function Qn(t, n, e, o) {
|
|
1444
1472
|
return {
|
|
1445
1473
|
instanceId: e,
|
|
1446
1474
|
variantId: n.variantId,
|
|
@@ -1453,187 +1481,189 @@ function Hn(t, n, e, o) {
|
|
|
1453
1481
|
insLayerIdx: o
|
|
1454
1482
|
};
|
|
1455
1483
|
}
|
|
1456
|
-
function
|
|
1484
|
+
function te(t, n, e, o) {
|
|
1457
1485
|
var y;
|
|
1458
|
-
const
|
|
1486
|
+
const i = ((y = o[n.insLayerIdx]) == null ? void 0 : y.visible) === !1, r = n.matA * t.x + n.matC * t.y + n.tx, s = n.matB * t.x + n.matD * t.y + n.ty, l = Math.hypot(n.matA, n.matB), a = Math.hypot(n.matC, n.matD), c = a > 1e-12 ? a : l > 1e-12 ? l : 1, _ = l > 1e-12 && c > 1e-12 ? l / c : 1, f = Vo(t, n), { mx: d, my: m, ...A } = t;
|
|
1459
1487
|
return {
|
|
1460
|
-
...
|
|
1488
|
+
...A,
|
|
1461
1489
|
x: r,
|
|
1462
|
-
y:
|
|
1463
|
-
h: t.h *
|
|
1464
|
-
w: t.w === void 0 ? void 0 : t.w *
|
|
1465
|
-
wf: (t.wf ?? 1) *
|
|
1466
|
-
r:
|
|
1467
|
-
...
|
|
1468
|
-
...
|
|
1469
|
-
li:
|
|
1490
|
+
y: s,
|
|
1491
|
+
h: t.h * c,
|
|
1492
|
+
w: t.w === void 0 ? void 0 : t.w * c,
|
|
1493
|
+
wf: (t.wf ?? 1) * _,
|
|
1494
|
+
r: f.r,
|
|
1495
|
+
...f.mx ? { mx: !0 } : {},
|
|
1496
|
+
...f.my ? { my: !0 } : {},
|
|
1497
|
+
li: i || t.li === e ? n.insLayerIdx : t.li
|
|
1470
1498
|
};
|
|
1471
1499
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const e = t.r * Math.PI / 180, o = Math.cos(e),
|
|
1474
|
-
return
|
|
1500
|
+
function Vo(t, n) {
|
|
1501
|
+
const e = t.r * Math.PI / 180, o = Math.cos(e), i = Math.sin(e), r = t.mx ? -1 : 1, s = t.my ? -1 : 1, l = r * (n.matA * o + n.matC * i), a = r * (n.matB * o + n.matD * i), c = s * (n.matC * o - n.matA * i), _ = s * (n.matD * o - n.matB * i), f = l * _ - a * c, d = Math.atan2(a, l) * 180 / Math.PI;
|
|
1502
|
+
return f < 0 ? { r: Math.atan2(-a, -l) * 180 / Math.PI, mx: !0 } : { r: d };
|
|
1475
1503
|
}
|
|
1476
|
-
function
|
|
1477
|
-
var
|
|
1504
|
+
function Pt(t, n, e, o) {
|
|
1505
|
+
var l;
|
|
1478
1506
|
if (t.count === 0)
|
|
1479
|
-
return
|
|
1480
|
-
const
|
|
1481
|
-
for (let
|
|
1482
|
-
const
|
|
1483
|
-
|
|
1507
|
+
return Vt();
|
|
1508
|
+
const i = new Float32Array(t.count * 2);
|
|
1509
|
+
for (let a = 0; a < t.count; a += 1) {
|
|
1510
|
+
const c = a * 2, _ = t.pos[c], f = t.pos[c + 1];
|
|
1511
|
+
i[c] = n.matA * _ + n.matC * f + n.tx, i[c + 1] = n.matB * _ + n.matD * f + n.ty;
|
|
1484
1512
|
}
|
|
1485
|
-
const r = ((
|
|
1486
|
-
|
|
1487
|
-
(
|
|
1513
|
+
const r = ((l = o[n.insLayerIdx]) == null ? void 0 : l.visible) === !1, s = vn(
|
|
1514
|
+
rt(t),
|
|
1515
|
+
(a) => r || a === e ? n.insLayerIdx : a
|
|
1488
1516
|
);
|
|
1489
|
-
return { pos:
|
|
1517
|
+
return { pos: i, count: t.count, segments: s };
|
|
1490
1518
|
}
|
|
1491
|
-
function
|
|
1492
|
-
const n = t.reduce((r,
|
|
1519
|
+
function Dt(t) {
|
|
1520
|
+
const n = t.reduce((r, s) => r + s.count, 0);
|
|
1493
1521
|
if (n === 0)
|
|
1494
|
-
return
|
|
1522
|
+
return Vt();
|
|
1495
1523
|
const e = new Float32Array(n * 2), o = [];
|
|
1496
|
-
let
|
|
1524
|
+
let i = 0;
|
|
1497
1525
|
for (const r of t)
|
|
1498
|
-
e.set(r.pos,
|
|
1499
|
-
return { pos: e, count: n, segments:
|
|
1526
|
+
e.set(r.pos, i * 2), o.push(...qt(rt(r), i)), i += r.count;
|
|
1527
|
+
return { pos: e, count: n, segments: mt(o) };
|
|
1500
1528
|
}
|
|
1501
|
-
function
|
|
1529
|
+
function ne(t, n) {
|
|
1502
1530
|
return t === n ? n : t;
|
|
1503
1531
|
}
|
|
1504
|
-
function
|
|
1532
|
+
function ee(t, n, e) {
|
|
1505
1533
|
return t === e ? n : t;
|
|
1506
1534
|
}
|
|
1507
|
-
function
|
|
1508
|
-
const
|
|
1509
|
-
bounds:
|
|
1510
|
-
entity_count: Number(
|
|
1511
|
-
line_count: Number(
|
|
1512
|
-
fill_count: Number(
|
|
1513
|
-
dot_count: Number(
|
|
1514
|
-
layers:
|
|
1535
|
+
function oe(t, n, e) {
|
|
1536
|
+
const o = new DataView(t), i = e ? void 0 : Et(t), r = (e == null ? void 0 : e.versionMinor) ?? i.versionMinor, s = (e == null ? void 0 : e.sections) ?? i.sections, l = (e == null ? void 0 : e.groupLayerEncoding) ?? Qt(r), a = e ? e.sections.get(1) : P(s, 1, "SCENE_META"), c = e ? e.sections.get(2) : P(s, 2, "LAYER_TABLE"), _ = e ? e.sections.get(3) : P(s, 3, "STRING_TABLE"), f = e ? e.sections.get(4) : P(s, 4, "BASE_GEOMETRY"), d = e ? e.sections.get(5) : P(s, 5, "VARIANT_TABLE"), m = e ? e.sections.get(6) : P(s, 6, "VARIANT_GEOMETRY"), A = e ? e.sections.get(7) : P(s, 7, "SCENE_INSTANCE_TABLE"), y = (e == null ? void 0 : e.sections.get(8)) ?? dt(s, 8), x = (e == null ? void 0 : e.sections.get(9)) ?? dt(s, 9), h = (e == null ? void 0 : e.sections.get(10)) ?? dt(s, 10), R = (e == null ? void 0 : e.sceneMeta) ?? xt(t, a, "SCENE_META"), w = (e == null ? void 0 : e.externalVariants) ?? (rn(R) ? Tt(R, d.length / 60) : null), p = sn(R), v = (e == null ? void 0 : e.externalAnnotations) ?? (p ? Yn(R) : null), U = (e == null ? void 0 : e.geoMetaFeatures) ?? so(R, w, p), D = (e == null ? void 0 : e.geoMetaEncoding) ?? (p ? "nested_instanced_external_annotations" : w ? "nested_instanced_external" : "nested_instanced"), $ = (e == null ? void 0 : e.stringTable) ?? new Uint8Array(t, _.offset, _.length), M = e != null && e.layers ? [...e.layers] : jn(t, c, $), Y = (e == null ? void 0 : e.layer0Index) ?? Number(R.layer0_index ?? 0), z = (e == null ? void 0 : e.headerForValidation) ?? en({
|
|
1537
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1538
|
+
entity_count: Number(R.entity_count ?? 0),
|
|
1539
|
+
line_count: Number(R.base_line_count ?? 0),
|
|
1540
|
+
fill_count: Number(R.base_fill_count ?? 0),
|
|
1541
|
+
dot_count: Number(R.base_dot_count ?? 0),
|
|
1542
|
+
layers: M,
|
|
1515
1543
|
texts: []
|
|
1516
1544
|
});
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1545
|
+
ie(Y, z.layers);
|
|
1546
|
+
const S = (e == null ? void 0 : e.baseGeometry) ?? Ao(t, o, f, l);
|
|
1519
1547
|
if (!n.loadBlocks) {
|
|
1520
|
-
const g =
|
|
1521
|
-
if (Number(
|
|
1522
|
-
throw new
|
|
1523
|
-
if (Number(
|
|
1524
|
-
throw new
|
|
1525
|
-
if (Number(
|
|
1526
|
-
throw new
|
|
1527
|
-
if (Number(
|
|
1528
|
-
throw new
|
|
1529
|
-
if (Number(
|
|
1530
|
-
throw new
|
|
1531
|
-
for (const
|
|
1532
|
-
if (
|
|
1533
|
-
throw new
|
|
1534
|
-
if (
|
|
1535
|
-
throw new
|
|
1548
|
+
const g = (e == null ? void 0 : e.variantHeaders) ?? Jt(o, d, m, $, w), I = (e == null ? void 0 : e.sceneInstances) ?? Z(t, A, "V3 SCENE_INSTANCE_TABLE"), k = (e == null ? void 0 : e.nestedInstances) ?? Z(t, y, "V3 NESTED_INSTANCE_TABLE"), L = (e == null ? void 0 : e.sceneTexts) ?? vt(t, x, $, "V3 SCENE_TEXT_TABLE"), F = (e == null ? void 0 : e.variantTextCount) ?? Io(h, "V3 VARIANT_TEXT_TABLE");
|
|
1549
|
+
if (Number(R.variant_count ?? g.length) !== g.length)
|
|
1550
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1551
|
+
if (Number(R.scene_instance_count ?? I.length) !== I.length)
|
|
1552
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1553
|
+
if (Number(R.nested_instance_count ?? k.length) !== k.length)
|
|
1554
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1555
|
+
if (Number(R.scene_text_count ?? L.length) !== L.length)
|
|
1556
|
+
throw new u("E_GROUP_RANGE", "V3 scene text count mismatch");
|
|
1557
|
+
if (Number(R.variant_text_count ?? F) !== F)
|
|
1558
|
+
throw new u("E_GROUP_RANGE", "V3 variant text count mismatch");
|
|
1559
|
+
for (const G of g) {
|
|
1560
|
+
if (G.nestedStart + G.nestedCount > k.length)
|
|
1561
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${G.id} nested range exceeds table`);
|
|
1562
|
+
if (G.textStart + G.textCount > F)
|
|
1563
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${G.id} text range exceeds table`);
|
|
1536
1564
|
}
|
|
1537
|
-
return
|
|
1538
|
-
if (!g[
|
|
1539
|
-
throw new
|
|
1540
|
-
|
|
1565
|
+
return Rt(I, k, (G) => {
|
|
1566
|
+
if (!g[G.variantId])
|
|
1567
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${G.variantId}`);
|
|
1568
|
+
Zt(G.insLayerIdx, M.length);
|
|
1541
1569
|
}), {
|
|
1542
1570
|
meta: {
|
|
1543
|
-
bounds:
|
|
1544
|
-
entity_count: Number(
|
|
1545
|
-
line_count:
|
|
1546
|
-
fill_count:
|
|
1547
|
-
dot_count:
|
|
1571
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1572
|
+
entity_count: Number(R.entity_count ?? 0),
|
|
1573
|
+
line_count: S.line.count,
|
|
1574
|
+
fill_count: S.fill.count,
|
|
1575
|
+
dot_count: S.dot.count,
|
|
1548
1576
|
version: 3,
|
|
1549
|
-
version_minor:
|
|
1550
|
-
encoding:
|
|
1551
|
-
...
|
|
1552
|
-
...
|
|
1553
|
-
...
|
|
1554
|
-
layer0_index:
|
|
1555
|
-
block_variants: g.map((
|
|
1556
|
-
id:
|
|
1557
|
-
name:
|
|
1558
|
-
line_count:
|
|
1559
|
-
fill_count:
|
|
1560
|
-
dot_count:
|
|
1577
|
+
version_minor: r,
|
|
1578
|
+
encoding: D,
|
|
1579
|
+
...U ? { features: U } : {},
|
|
1580
|
+
...w ? { external_variants: [...w] } : {},
|
|
1581
|
+
...v ? { external_annotations: v } : {},
|
|
1582
|
+
layer0_index: Y,
|
|
1583
|
+
block_variants: g.map((G) => ({
|
|
1584
|
+
id: G.id,
|
|
1585
|
+
name: G.name,
|
|
1586
|
+
line_count: G.line_count,
|
|
1587
|
+
fill_count: G.fill_count,
|
|
1588
|
+
dot_count: G.dot_count
|
|
1561
1589
|
})),
|
|
1562
1590
|
instance_count: I.length,
|
|
1563
|
-
layers:
|
|
1591
|
+
layers: M,
|
|
1564
1592
|
texts: L
|
|
1565
1593
|
},
|
|
1566
1594
|
header: {
|
|
1567
|
-
|
|
1568
|
-
lineCount:
|
|
1569
|
-
fillCount:
|
|
1570
|
-
dotCount:
|
|
1595
|
+
...z,
|
|
1596
|
+
lineCount: S.line.count,
|
|
1597
|
+
fillCount: S.fill.count,
|
|
1598
|
+
dotCount: S.dot.count,
|
|
1571
1599
|
textCount: L.length,
|
|
1572
1600
|
texts: L
|
|
1573
1601
|
},
|
|
1574
1602
|
decoded: {
|
|
1575
|
-
baseLine:
|
|
1576
|
-
baseFill:
|
|
1577
|
-
baseDot:
|
|
1603
|
+
baseLine: S.line,
|
|
1604
|
+
baseFill: S.fill,
|
|
1605
|
+
baseDot: S.dot,
|
|
1578
1606
|
variants: /* @__PURE__ */ new Map(),
|
|
1579
1607
|
instances: [],
|
|
1580
1608
|
instanceIdByVariantOrdinal: /* @__PURE__ */ new Map()
|
|
1581
1609
|
}
|
|
1582
1610
|
};
|
|
1583
1611
|
}
|
|
1584
|
-
const
|
|
1612
|
+
const N = e ? No(t, e, n) : Ro(
|
|
1585
1613
|
t,
|
|
1586
|
-
|
|
1587
|
-
h,
|
|
1614
|
+
o,
|
|
1588
1615
|
d,
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1616
|
+
m,
|
|
1617
|
+
$,
|
|
1618
|
+
w,
|
|
1619
|
+
l,
|
|
1592
1620
|
n
|
|
1593
|
-
), E = Z(t,
|
|
1594
|
-
if (Number(
|
|
1595
|
-
throw new
|
|
1596
|
-
if (Number(
|
|
1597
|
-
throw new
|
|
1598
|
-
if (Number(
|
|
1599
|
-
throw new
|
|
1600
|
-
if (Number(
|
|
1601
|
-
throw new
|
|
1602
|
-
if (Number(
|
|
1603
|
-
throw new
|
|
1604
|
-
for (const g of
|
|
1605
|
-
if (g.nestedStart + g.nestedCount >
|
|
1606
|
-
throw new
|
|
1607
|
-
if (g.textStart + g.textCount >
|
|
1608
|
-
throw new
|
|
1621
|
+
), { variantsById: E, variants: V, snapshots: T } = N, C = (e == null ? void 0 : e.sceneInstances) ?? Z(t, A, "V3 SCENE_INSTANCE_TABLE"), b = (e == null ? void 0 : e.nestedInstances) ?? Z(t, y, "V3 NESTED_INSTANCE_TABLE"), B = (e == null ? void 0 : e.sceneTexts) ?? vt(t, x, $, "V3 SCENE_TEXT_TABLE"), O = (e == null ? void 0 : e.variantTexts) ?? vt(t, h, $, "V3 VARIANT_TEXT_TABLE");
|
|
1622
|
+
if (Number(R.variant_count ?? E.length) !== E.length)
|
|
1623
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1624
|
+
if (Number(R.scene_instance_count ?? C.length) !== C.length)
|
|
1625
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1626
|
+
if (Number(R.nested_instance_count ?? b.length) !== b.length)
|
|
1627
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1628
|
+
if (Number(R.scene_text_count ?? B.length) !== B.length)
|
|
1629
|
+
throw new u("E_GROUP_RANGE", "V3 scene text count mismatch");
|
|
1630
|
+
if (Number(R.variant_text_count ?? O.length) !== O.length)
|
|
1631
|
+
throw new u("E_GROUP_RANGE", "V3 variant text count mismatch");
|
|
1632
|
+
for (const g of E) {
|
|
1633
|
+
if (g.nestedStart + g.nestedCount > b.length)
|
|
1634
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${g.id} nested range exceeds table`);
|
|
1635
|
+
if (g.textStart + g.textCount > O.length)
|
|
1636
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${g.id} text range exceeds table`);
|
|
1609
1637
|
}
|
|
1610
|
-
|
|
1611
|
-
if (!
|
|
1612
|
-
throw new
|
|
1613
|
-
|
|
1638
|
+
Rt(C, b, (g) => {
|
|
1639
|
+
if (!E[g.variantId])
|
|
1640
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${g.variantId}`);
|
|
1641
|
+
Zt(g.insLayerIdx, M.length);
|
|
1614
1642
|
});
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
g.
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
},
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
if (
|
|
1628
|
-
throw new
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
const
|
|
1636
|
-
|
|
1643
|
+
const j = (e == null ? void 0 : e.variantTextsByVariantId) ?? (() => {
|
|
1644
|
+
const g = /* @__PURE__ */ new Map();
|
|
1645
|
+
for (const I of E)
|
|
1646
|
+
g.set(
|
|
1647
|
+
I.id,
|
|
1648
|
+
O.slice(I.textStart, I.textStart + I.textCount)
|
|
1649
|
+
);
|
|
1650
|
+
return g;
|
|
1651
|
+
})(), H = [], X = n.externalVariantDeltaOnly, gt = X ? [] : [...B], ct = /* @__PURE__ */ new Map(), it = /* @__PURE__ */ new Map(), un = /* @__PURE__ */ new Map(), le = (g, I) => {
|
|
1652
|
+
ct.set(g, pt(ct.get(g) ?? null, I));
|
|
1653
|
+
}, cn = (g, I, k, L, F, tt) => {
|
|
1654
|
+
var xn;
|
|
1655
|
+
if (F > 64)
|
|
1656
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1657
|
+
if (tt.has(g))
|
|
1658
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${g}`);
|
|
1659
|
+
const G = E[g];
|
|
1660
|
+
if (!G)
|
|
1661
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${g}`);
|
|
1662
|
+
tt.add(g);
|
|
1663
|
+
const nt = !n.requiredExternalVariantIds || n.requiredExternalVariantIds.has(g), W = X ? ((xn = n.requiredExternalVariantIds) == null ? void 0 : xn.has(g)) === !0 : nt;
|
|
1664
|
+
let q = !1;
|
|
1665
|
+
const En = !!(G.line_count || G.fill_count || G.dot_count), de = G.textCount > 0;
|
|
1666
|
+
if (W && (En || de) && (H.push({
|
|
1637
1667
|
instanceId: I.instanceId,
|
|
1638
1668
|
variantId: g,
|
|
1639
1669
|
matA: I.matA,
|
|
@@ -1643,29 +1673,29 @@ function Wn(t, n) {
|
|
|
1643
1673
|
tx: I.tx,
|
|
1644
1674
|
ty: I.ty,
|
|
1645
1675
|
insLayerIdx: I.insLayerIdx
|
|
1646
|
-
}),
|
|
1647
|
-
|
|
1648
|
-
for (let
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1651
|
-
...
|
|
1652
|
-
iv:
|
|
1676
|
+
}), En && le(I.instanceId, G.bbox ? re(G.bbox, I) : null), q = !0), W) {
|
|
1677
|
+
G.textCount > 0 && (q = !0);
|
|
1678
|
+
for (let et = 0; et < G.textCount; et += 1) {
|
|
1679
|
+
const st = te(O[G.textStart + et], I, Y, z.layers);
|
|
1680
|
+
gt.push({
|
|
1681
|
+
...st,
|
|
1682
|
+
iv: k,
|
|
1653
1683
|
io: L
|
|
1654
1684
|
});
|
|
1655
1685
|
}
|
|
1656
1686
|
}
|
|
1657
|
-
for (let
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1687
|
+
for (let et = 0; et < G.nestedCount; et += 1) {
|
|
1688
|
+
const st = b[G.nestedStart + et], me = ee(st.insLayerIdx, I.insLayerIdx, Y), _e = ln(st, G, E[st.variantId]), Ee = Qn(I, _e, I.instanceId, me);
|
|
1689
|
+
q = cn(st.variantId, Ee, k, L, F + 1, tt) || q;
|
|
1660
1690
|
}
|
|
1661
|
-
return
|
|
1662
|
-
},
|
|
1663
|
-
|
|
1664
|
-
if (!
|
|
1665
|
-
throw new
|
|
1666
|
-
const L =
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1691
|
+
return tt.delete(g), q;
|
|
1692
|
+
}, St = /* @__PURE__ */ new Map();
|
|
1693
|
+
C.forEach((g, I) => {
|
|
1694
|
+
if (!E[g.variantId])
|
|
1695
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 scene variantId ${g.variantId}`);
|
|
1696
|
+
const L = un.get(g.variantId) ?? 0;
|
|
1697
|
+
un.set(g.variantId, L + 1), it.set(`${g.variantId}:${L}`, I);
|
|
1698
|
+
const F = ne(g.insLayerIdx, Y), tt = {
|
|
1669
1699
|
instanceId: I,
|
|
1670
1700
|
variantId: g.variantId,
|
|
1671
1701
|
matA: g.matA,
|
|
@@ -1674,207 +1704,247 @@ function Wn(t, n) {
|
|
|
1674
1704
|
matD: g.matD,
|
|
1675
1705
|
tx: g.tx,
|
|
1676
1706
|
ty: g.ty,
|
|
1677
|
-
insLayerIdx:
|
|
1678
|
-
},
|
|
1679
|
-
if (
|
|
1707
|
+
insLayerIdx: F
|
|
1708
|
+
}, G = cn(g.variantId, tt, g.variantId, L, 0, /* @__PURE__ */ new Set());
|
|
1709
|
+
if (X && !G)
|
|
1680
1710
|
return;
|
|
1681
|
-
let
|
|
1682
|
-
|
|
1683
|
-
let W =
|
|
1684
|
-
W || (W = { count: 0, bboxes: [], inserts: [] },
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1711
|
+
let nt = St.get(F);
|
|
1712
|
+
nt || (nt = /* @__PURE__ */ new Map(), St.set(F, nt));
|
|
1713
|
+
let W = nt.get(g.variantId);
|
|
1714
|
+
W || (W = { count: 0, bboxes: [], inserts: [] }, nt.set(g.variantId, W)), W.count += 1;
|
|
1715
|
+
const q = ct.get(I) ?? null;
|
|
1716
|
+
q && W.bboxes.push(q), W.inserts.push({
|
|
1687
1717
|
instanceId: I,
|
|
1688
1718
|
variantId: g.variantId,
|
|
1689
1719
|
label: `#${I + 1} (${g.tx.toFixed(1)}, ${g.ty.toFixed(1)})`,
|
|
1690
1720
|
tx: g.tx,
|
|
1691
1721
|
ty: g.ty,
|
|
1692
|
-
canHighlight:
|
|
1693
|
-
...
|
|
1722
|
+
canHighlight: q !== null,
|
|
1723
|
+
...q ? { bbox: q } : {}
|
|
1694
1724
|
});
|
|
1695
1725
|
});
|
|
1696
|
-
const
|
|
1697
|
-
for (const [g, I] of
|
|
1698
|
-
const
|
|
1699
|
-
for (const [L,
|
|
1700
|
-
|
|
1726
|
+
const fn = /* @__PURE__ */ new Map();
|
|
1727
|
+
for (const [g, I] of St) {
|
|
1728
|
+
const k = [];
|
|
1729
|
+
for (const [L, F] of I)
|
|
1730
|
+
k.push({
|
|
1701
1731
|
variantId: L,
|
|
1702
|
-
blockName:
|
|
1703
|
-
instanceCount:
|
|
1704
|
-
bboxes:
|
|
1705
|
-
inserts:
|
|
1732
|
+
blockName: Ln(E[L], L),
|
|
1733
|
+
instanceCount: F.count,
|
|
1734
|
+
bboxes: F.bboxes,
|
|
1735
|
+
inserts: F.inserts
|
|
1706
1736
|
});
|
|
1707
|
-
|
|
1737
|
+
k.sort((L, F) => F.instanceCount - L.instanceCount), fn.set(g, k);
|
|
1708
1738
|
}
|
|
1709
|
-
let
|
|
1710
|
-
for (const g of
|
|
1711
|
-
const I =
|
|
1712
|
-
n.deferExternalVariantGeometry && I.lineSnapshot.count === 0 && I.fillSnapshot.count === 0 && I.dotSnapshot.count === 0 || !Nt(g.instanceId, n) || (
|
|
1739
|
+
let dn = X ? 0 : S.line.count, mn = X ? 0 : S.fill.count, _n = X ? 0 : S.dot.count;
|
|
1740
|
+
for (const g of H) {
|
|
1741
|
+
const I = E[g.variantId];
|
|
1742
|
+
n.deferExternalVariantGeometry && I.lineSnapshot.count === 0 && I.fillSnapshot.count === 0 && I.dotSnapshot.count === 0 || !Nt(g.instanceId, n) || (dn += I.line_count, mn += I.fill_count, _n += I.dot_count);
|
|
1713
1743
|
}
|
|
1714
|
-
const
|
|
1715
|
-
bounds:
|
|
1716
|
-
entity_count:
|
|
1717
|
-
line_count:
|
|
1718
|
-
fill_count:
|
|
1719
|
-
dot_count:
|
|
1744
|
+
const ht = no(gt, it, n), ue = {
|
|
1745
|
+
bounds: R.bounds ?? [0, 0, 0, 0],
|
|
1746
|
+
entity_count: X ? 0 : Number(R.entity_count ?? 0),
|
|
1747
|
+
line_count: S.line.count,
|
|
1748
|
+
fill_count: S.fill.count,
|
|
1749
|
+
dot_count: S.dot.count,
|
|
1720
1750
|
version: 3,
|
|
1721
|
-
version_minor:
|
|
1722
|
-
encoding:
|
|
1723
|
-
...
|
|
1724
|
-
...
|
|
1725
|
-
...
|
|
1726
|
-
layer0_index:
|
|
1727
|
-
block_variants:
|
|
1751
|
+
version_minor: r,
|
|
1752
|
+
encoding: D,
|
|
1753
|
+
...U ? { features: U } : {},
|
|
1754
|
+
...w ? { external_variants: [...w] } : {},
|
|
1755
|
+
...v ? { external_annotations: v } : {},
|
|
1756
|
+
layer0_index: Y,
|
|
1757
|
+
block_variants: E.map((g) => ({
|
|
1728
1758
|
id: g.id,
|
|
1729
1759
|
name: g.name,
|
|
1730
1760
|
line_count: g.sourceLineCount,
|
|
1731
1761
|
fill_count: g.sourceFillCount,
|
|
1732
1762
|
dot_count: g.sourceDotCount
|
|
1733
1763
|
})),
|
|
1734
|
-
instance_count:
|
|
1735
|
-
layers:
|
|
1736
|
-
texts:
|
|
1737
|
-
},
|
|
1738
|
-
|
|
1739
|
-
entityCount:
|
|
1740
|
-
lineCount:
|
|
1741
|
-
fillCount:
|
|
1742
|
-
dotCount:
|
|
1743
|
-
textCount:
|
|
1744
|
-
texts:
|
|
1764
|
+
instance_count: C.length,
|
|
1765
|
+
layers: M,
|
|
1766
|
+
texts: ht
|
|
1767
|
+
}, ce = {
|
|
1768
|
+
...z,
|
|
1769
|
+
entityCount: X ? 0 : z.entityCount,
|
|
1770
|
+
lineCount: dn,
|
|
1771
|
+
fillCount: mn,
|
|
1772
|
+
dotCount: _n,
|
|
1773
|
+
textCount: ht.length,
|
|
1774
|
+
texts: ht,
|
|
1745
1775
|
...n.loadBlocks ? {
|
|
1746
|
-
layerBlockUsages:
|
|
1747
|
-
insertRuntime:
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1776
|
+
layerBlockUsages: fn,
|
|
1777
|
+
insertRuntime: oo(
|
|
1778
|
+
Y,
|
|
1779
|
+
E,
|
|
1780
|
+
T,
|
|
1781
|
+
j,
|
|
1782
|
+
H,
|
|
1783
|
+
ht,
|
|
1784
|
+
it
|
|
1755
1785
|
)
|
|
1756
1786
|
} : {}
|
|
1757
|
-
}
|
|
1787
|
+
}, fe = e ?? (n.cacheDocument ? (() => {
|
|
1788
|
+
const g = /* @__PURE__ */ new Map();
|
|
1789
|
+
for (const [I, k] of V)
|
|
1790
|
+
w != null && w[I] || g.set(I, {
|
|
1791
|
+
line: { chunk: k.line, snapshot: T[I].line },
|
|
1792
|
+
fill: { chunk: k.fill, snapshot: T[I].fill },
|
|
1793
|
+
dot: { chunk: k.dot, snapshot: T[I].dot }
|
|
1794
|
+
});
|
|
1795
|
+
return {
|
|
1796
|
+
kind: "dxb3-v3",
|
|
1797
|
+
buffer: t,
|
|
1798
|
+
versionMinor: r,
|
|
1799
|
+
sections: s,
|
|
1800
|
+
groupLayerEncoding: l,
|
|
1801
|
+
sceneMeta: R,
|
|
1802
|
+
externalVariants: w,
|
|
1803
|
+
externalAnnotations: v,
|
|
1804
|
+
geoMetaFeatures: U,
|
|
1805
|
+
geoMetaEncoding: D,
|
|
1806
|
+
stringTable: $,
|
|
1807
|
+
layers: M,
|
|
1808
|
+
layer0Index: Y,
|
|
1809
|
+
headerForValidation: z,
|
|
1810
|
+
baseGeometry: S,
|
|
1811
|
+
variantHeaders: Jt(
|
|
1812
|
+
o,
|
|
1813
|
+
d,
|
|
1814
|
+
m,
|
|
1815
|
+
$,
|
|
1816
|
+
w
|
|
1817
|
+
),
|
|
1818
|
+
internalVariants: g,
|
|
1819
|
+
sceneInstances: C,
|
|
1820
|
+
nestedInstances: b,
|
|
1821
|
+
sceneTexts: B,
|
|
1822
|
+
variantTexts: O,
|
|
1823
|
+
variantTextCount: O.length,
|
|
1824
|
+
variantTextsByVariantId: j
|
|
1825
|
+
};
|
|
1826
|
+
})() : void 0);
|
|
1758
1827
|
return {
|
|
1759
|
-
meta:
|
|
1760
|
-
header:
|
|
1828
|
+
meta: ue,
|
|
1829
|
+
header: ce,
|
|
1830
|
+
documentCache: fe,
|
|
1761
1831
|
decoded: {
|
|
1762
|
-
baseLine:
|
|
1763
|
-
baseFill:
|
|
1764
|
-
baseDot:
|
|
1765
|
-
variants:
|
|
1766
|
-
instances:
|
|
1767
|
-
instanceIdByVariantOrdinal:
|
|
1832
|
+
baseLine: X ? kt() : S.line,
|
|
1833
|
+
baseFill: X ? kt() : S.fill,
|
|
1834
|
+
baseDot: X ? kt() : S.dot,
|
|
1835
|
+
variants: V,
|
|
1836
|
+
instances: H,
|
|
1837
|
+
instanceIdByVariantOrdinal: it
|
|
1768
1838
|
}
|
|
1769
1839
|
};
|
|
1770
1840
|
}
|
|
1771
|
-
function
|
|
1841
|
+
function Vn(t) {
|
|
1772
1842
|
return "annotation" in t && (t.annotation.line_count > 0 || t.annotation.fill_count > 0 || t.annotation.dot_count > 0 || t.annotation.text_count > 0);
|
|
1773
1843
|
}
|
|
1774
|
-
function
|
|
1844
|
+
function Go(t, n) {
|
|
1775
1845
|
if (n.line.count !== t.annotation.line_count || n.fill.count !== t.annotation.fill_count || n.dot.count !== t.annotation.dot_count || n.texts.length !== t.annotation.text_count)
|
|
1776
|
-
throw new
|
|
1846
|
+
throw new u(
|
|
1777
1847
|
"E_GROUP_RANGE",
|
|
1778
1848
|
`V3.3 external variant ${t.id} annotation count mismatch`
|
|
1779
1849
|
);
|
|
1780
1850
|
}
|
|
1781
|
-
function
|
|
1851
|
+
function To(t, n, e, o, i, r) {
|
|
1782
1852
|
return {
|
|
1783
|
-
line:
|
|
1784
|
-
fill:
|
|
1785
|
-
dot:
|
|
1786
|
-
texts: t.texts.map((
|
|
1787
|
-
...
|
|
1788
|
-
iv:
|
|
1853
|
+
line: Pt(t.line, n, e, o),
|
|
1854
|
+
fill: Pt(t.fill, n, e, o),
|
|
1855
|
+
dot: Pt(t.dot, n, e, o),
|
|
1856
|
+
texts: t.texts.map((s) => ({
|
|
1857
|
+
...te(s, n, e, o),
|
|
1858
|
+
iv: i,
|
|
1789
1859
|
io: r
|
|
1790
1860
|
}))
|
|
1791
1861
|
};
|
|
1792
1862
|
}
|
|
1793
|
-
function
|
|
1794
|
-
if (!
|
|
1863
|
+
function Yo(t, n) {
|
|
1864
|
+
if (!Q(t))
|
|
1795
1865
|
return null;
|
|
1796
|
-
const e = new DataView(t), { sections: o } =
|
|
1797
|
-
if (!
|
|
1866
|
+
const e = new DataView(t), { sections: o } = Et(t), i = P(o, 1, "SCENE_META"), r = P(o, 2, "LAYER_TABLE"), s = P(o, 3, "STRING_TABLE"), l = P(o, 5, "VARIANT_TABLE"), a = P(o, 6, "VARIANT_GEOMETRY"), c = P(o, 7, "SCENE_INSTANCE_TABLE"), _ = dt(o, 8), f = xt(t, i, "SCENE_META");
|
|
1867
|
+
if (!sn(f))
|
|
1798
1868
|
return null;
|
|
1799
|
-
const
|
|
1800
|
-
if (!
|
|
1869
|
+
const d = Tt(f, l.length / 60);
|
|
1870
|
+
if (!d.some(Vn))
|
|
1801
1871
|
return null;
|
|
1802
|
-
const
|
|
1803
|
-
bounds:
|
|
1804
|
-
entity_count: Number(
|
|
1805
|
-
line_count: Number(
|
|
1806
|
-
fill_count: Number(
|
|
1807
|
-
dot_count: Number(
|
|
1808
|
-
layers:
|
|
1872
|
+
const m = new Uint8Array(t, s.offset, s.length), A = jn(t, r, m), y = Number(f.layer0_index ?? 0), x = en({
|
|
1873
|
+
bounds: f.bounds ?? [0, 0, 0, 0],
|
|
1874
|
+
entity_count: Number(f.entity_count ?? 0),
|
|
1875
|
+
line_count: Number(f.base_line_count ?? 0),
|
|
1876
|
+
fill_count: Number(f.base_fill_count ?? 0),
|
|
1877
|
+
dot_count: Number(f.base_dot_count ?? 0),
|
|
1878
|
+
layers: A,
|
|
1809
1879
|
texts: []
|
|
1810
1880
|
});
|
|
1811
|
-
|
|
1812
|
-
const
|
|
1813
|
-
if (Number(
|
|
1814
|
-
throw new
|
|
1815
|
-
if (Number(
|
|
1816
|
-
throw new
|
|
1817
|
-
if (Number(
|
|
1818
|
-
throw new
|
|
1819
|
-
for (const E of
|
|
1820
|
-
if (E.nestedStart + E.nestedCount >
|
|
1821
|
-
throw new
|
|
1822
|
-
|
|
1823
|
-
if (!
|
|
1824
|
-
throw new
|
|
1825
|
-
|
|
1881
|
+
ie(y, x.layers);
|
|
1882
|
+
const h = Jt(e, l, a, m, d), R = Z(t, c, "V3 SCENE_INSTANCE_TABLE"), w = Z(t, _, "V3 NESTED_INSTANCE_TABLE");
|
|
1883
|
+
if (Number(f.variant_count ?? h.length) !== h.length)
|
|
1884
|
+
throw new u("E_GROUP_RANGE", "V3 variant count mismatch");
|
|
1885
|
+
if (Number(f.scene_instance_count ?? R.length) !== R.length)
|
|
1886
|
+
throw new u("E_GROUP_RANGE", "V3 scene instance count mismatch");
|
|
1887
|
+
if (Number(f.nested_instance_count ?? w.length) !== w.length)
|
|
1888
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance count mismatch");
|
|
1889
|
+
for (const E of h)
|
|
1890
|
+
if (E.nestedStart + E.nestedCount > w.length)
|
|
1891
|
+
throw new u("E_GROUP_RANGE", `V3 variant ${E.id} nested range exceeds table`);
|
|
1892
|
+
Rt(R, w, (E) => {
|
|
1893
|
+
if (!h[E.variantId])
|
|
1894
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${E.variantId}`);
|
|
1895
|
+
Zt(E.insLayerIdx, A.length);
|
|
1826
1896
|
});
|
|
1827
|
-
const
|
|
1828
|
-
var
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1897
|
+
const p = /* @__PURE__ */ new Map(), v = (E) => {
|
|
1898
|
+
var B;
|
|
1899
|
+
const V = d[E];
|
|
1900
|
+
if (!V || !Vn(V))
|
|
1831
1901
|
return null;
|
|
1832
|
-
const
|
|
1833
|
-
if (
|
|
1834
|
-
return
|
|
1835
|
-
const
|
|
1836
|
-
if (!
|
|
1902
|
+
const T = p.get(E);
|
|
1903
|
+
if (T)
|
|
1904
|
+
return T;
|
|
1905
|
+
const C = (B = n == null ? void 0 : n.externalVariantBuffers) == null ? void 0 : B.get(V.id);
|
|
1906
|
+
if (!C)
|
|
1837
1907
|
return null;
|
|
1838
|
-
if (
|
|
1839
|
-
throw new
|
|
1908
|
+
if (C.byteLength !== V.raw_size)
|
|
1909
|
+
throw new u(
|
|
1840
1910
|
"E_GROUP_RANGE",
|
|
1841
|
-
`V3.3 annotation sidecar ${
|
|
1911
|
+
`V3.3 annotation sidecar ${V.id} raw_size mismatch: manifest=${V.raw_size}, sidecar=${C.byteLength}`
|
|
1842
1912
|
);
|
|
1843
|
-
const
|
|
1844
|
-
return
|
|
1845
|
-
},
|
|
1846
|
-
const
|
|
1913
|
+
const b = Xe(C);
|
|
1914
|
+
return Go(V, b), p.set(E, b), b;
|
|
1915
|
+
}, U = [], D = [], $ = [], M = [], Y = (n == null ? void 0 : n.hiddenInstanceIds) ?? /* @__PURE__ */ new Set(), z = (E, V, T, C) => {
|
|
1916
|
+
const b = To(
|
|
1847
1917
|
E,
|
|
1848
|
-
|
|
1918
|
+
V,
|
|
1849
1919
|
y,
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1920
|
+
x.layers,
|
|
1921
|
+
T,
|
|
1922
|
+
C
|
|
1853
1923
|
);
|
|
1854
|
-
|
|
1855
|
-
},
|
|
1856
|
-
if (
|
|
1857
|
-
throw new
|
|
1858
|
-
if (
|
|
1859
|
-
throw new
|
|
1860
|
-
const
|
|
1861
|
-
if (!
|
|
1862
|
-
throw new
|
|
1863
|
-
|
|
1864
|
-
const
|
|
1865
|
-
|
|
1866
|
-
for (let
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1924
|
+
U.push(b.line), D.push(b.fill), $.push(b.dot), M.push(...b.texts);
|
|
1925
|
+
}, S = (E, V, T, C, b, B) => {
|
|
1926
|
+
if (b > 64)
|
|
1927
|
+
throw new u("E_GROUP_RANGE", "V3 nested instance depth exceeds limit");
|
|
1928
|
+
if (B.has(E))
|
|
1929
|
+
throw new u("E_GROUP_RANGE", `V3 nested variant cycle detected at ${E}`);
|
|
1930
|
+
const O = h[E];
|
|
1931
|
+
if (!O)
|
|
1932
|
+
throw new u("E_GROUP_RANGE", `Unknown V3 variantId ${E}`);
|
|
1933
|
+
B.add(E);
|
|
1934
|
+
const j = v(E);
|
|
1935
|
+
j && z(j, V, T, C);
|
|
1936
|
+
for (let H = 0; H < O.nestedCount; H += 1) {
|
|
1937
|
+
const X = w[O.nestedStart + H], gt = ee(X.insLayerIdx, V.insLayerIdx, y), ct = ln(X, O, h[X.variantId]), it = Qn(V, ct, V.instanceId, gt);
|
|
1938
|
+
S(X.variantId, it, T, C, b + 1, B);
|
|
1869
1939
|
}
|
|
1870
|
-
|
|
1871
|
-
},
|
|
1872
|
-
return
|
|
1873
|
-
const
|
|
1874
|
-
if (
|
|
1940
|
+
B.delete(E);
|
|
1941
|
+
}, N = /* @__PURE__ */ new Map();
|
|
1942
|
+
return R.forEach((E, V) => {
|
|
1943
|
+
const T = N.get(E.variantId) ?? 0;
|
|
1944
|
+
if (N.set(E.variantId, T + 1), Y.has(V))
|
|
1875
1945
|
return;
|
|
1876
|
-
const
|
|
1877
|
-
instanceId:
|
|
1946
|
+
const C = ne(E.insLayerIdx, y), b = {
|
|
1947
|
+
instanceId: V,
|
|
1878
1948
|
variantId: E.variantId,
|
|
1879
1949
|
matA: E.matA,
|
|
1880
1950
|
matB: E.matB,
|
|
@@ -1882,30 +1952,30 @@ function Po(t, n) {
|
|
|
1882
1952
|
matD: E.matD,
|
|
1883
1953
|
tx: E.tx,
|
|
1884
1954
|
ty: E.ty,
|
|
1885
|
-
insLayerIdx:
|
|
1955
|
+
insLayerIdx: C
|
|
1886
1956
|
};
|
|
1887
|
-
|
|
1888
|
-
}),
|
|
1889
|
-
line:
|
|
1890
|
-
fill:
|
|
1891
|
-
dot:
|
|
1892
|
-
texts:
|
|
1957
|
+
S(E.variantId, b, E.variantId, T, 0, /* @__PURE__ */ new Set());
|
|
1958
|
+
}), U.every((E) => E.count === 0) && D.every((E) => E.count === 0) && $.every((E) => E.count === 0) && M.length === 0 ? null : {
|
|
1959
|
+
line: Dt(U),
|
|
1960
|
+
fill: Dt(D),
|
|
1961
|
+
dot: Dt($),
|
|
1962
|
+
texts: M
|
|
1893
1963
|
};
|
|
1894
1964
|
}
|
|
1895
|
-
function
|
|
1896
|
-
return
|
|
1965
|
+
function pt(t, n) {
|
|
1966
|
+
return pe(t, n);
|
|
1897
1967
|
}
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1968
|
+
function re(t, n) {
|
|
1969
|
+
return On(t, n);
|
|
1900
1970
|
}
|
|
1901
|
-
function
|
|
1902
|
-
return
|
|
1971
|
+
function Gn(t) {
|
|
1972
|
+
return Te(t);
|
|
1903
1973
|
}
|
|
1904
|
-
function
|
|
1905
|
-
return
|
|
1974
|
+
function Tn(t, n) {
|
|
1975
|
+
return be(t, n);
|
|
1906
1976
|
}
|
|
1907
|
-
function
|
|
1908
|
-
return
|
|
1977
|
+
function It(t, n) {
|
|
1978
|
+
return re(t, {
|
|
1909
1979
|
variantId: n.variantId,
|
|
1910
1980
|
matA: n.matA,
|
|
1911
1981
|
matB: n.matB,
|
|
@@ -1916,168 +1986,168 @@ function pt(t, n) {
|
|
|
1916
1986
|
insLayerIdx: n.insLayerIdx
|
|
1917
1987
|
});
|
|
1918
1988
|
}
|
|
1919
|
-
function
|
|
1989
|
+
function ln(t, n, e) {
|
|
1920
1990
|
if (!(e != null && e.bbox) || !n.bbox)
|
|
1921
1991
|
return t;
|
|
1922
|
-
const o = n.precisionOriginX,
|
|
1923
|
-
if (!Number.isFinite(o) || !Number.isFinite(
|
|
1992
|
+
const o = n.precisionOriginX, i = n.precisionOriginY;
|
|
1993
|
+
if (!Number.isFinite(o) || !Number.isFinite(i) || o === 0 && i === 0)
|
|
1924
1994
|
return t;
|
|
1925
1995
|
const r = {
|
|
1926
1996
|
...t,
|
|
1927
1997
|
tx: t.tx - o,
|
|
1928
|
-
ty: t.ty -
|
|
1929
|
-
},
|
|
1930
|
-
if (
|
|
1998
|
+
ty: t.ty - i
|
|
1999
|
+
}, s = It(e.bbox, t), l = It(e.bbox, r), a = Math.max(Gn(n.bbox), Gn(e.bbox), 1), c = Math.hypot(o, i), _ = Math.hypot(t.tx, t.ty), f = Math.hypot(r.tx, r.ty);
|
|
2000
|
+
if (c <= a * 16 || _ <= a * 16)
|
|
1931
2001
|
return t;
|
|
1932
|
-
const
|
|
1933
|
-
return
|
|
2002
|
+
const d = Tn(n.bbox, s), m = Tn(n.bbox, l);
|
|
2003
|
+
return d > a * 16 && m * 4 < d && f * 4 < _ ? r : t;
|
|
1934
2004
|
}
|
|
1935
|
-
function
|
|
2005
|
+
function Zt(t, n) {
|
|
1936
2006
|
if (t >= n)
|
|
1937
|
-
throw new
|
|
2007
|
+
throw new u("E_GROUP_RANGE", `Instance layer index ${t} exceeds layer count ${n}`);
|
|
1938
2008
|
}
|
|
1939
|
-
function
|
|
2009
|
+
function ie(t, n) {
|
|
1940
2010
|
if (!Number.isInteger(t) || t < 0 || t >= n.length)
|
|
1941
|
-
throw new
|
|
2011
|
+
throw new u("E_GROUP_RANGE", `layer0_index out of range: ${t}`);
|
|
1942
2012
|
if (n[t].name !== "0")
|
|
1943
|
-
throw new
|
|
2013
|
+
throw new u("E_GROUP_RANGE", `layer0_index must reference layer "0": ${t}`);
|
|
1944
2014
|
}
|
|
1945
|
-
function
|
|
2015
|
+
function bo(t) {
|
|
1946
2016
|
if (t !== 0)
|
|
1947
|
-
throw new
|
|
2017
|
+
throw new u("E_GROUP_RANGE", `Instance flags must be zero for Stage 1, found ${t}`);
|
|
1948
2018
|
}
|
|
1949
|
-
function*
|
|
2019
|
+
function* Bo(t, n, e, o, i) {
|
|
1950
2020
|
let r = e;
|
|
1951
|
-
const
|
|
2021
|
+
const s = [
|
|
1952
2022
|
{ kind: "line", count: o.lineCount },
|
|
1953
2023
|
{ kind: "fill", count: o.fillCount },
|
|
1954
2024
|
{ kind: "dot", count: o.dotCount }
|
|
1955
2025
|
];
|
|
1956
|
-
for (const
|
|
1957
|
-
const
|
|
2026
|
+
for (const l of s) {
|
|
2027
|
+
const a = Re(t, n, r, l.count);
|
|
1958
2028
|
for (; ; ) {
|
|
1959
|
-
const
|
|
1960
|
-
if (
|
|
1961
|
-
r =
|
|
2029
|
+
const c = a.next();
|
|
2030
|
+
if (c.done) {
|
|
2031
|
+
r = c.value;
|
|
1962
2032
|
break;
|
|
1963
2033
|
}
|
|
1964
|
-
yield { kind:
|
|
2034
|
+
yield { kind: l.kind, payload: c.value };
|
|
1965
2035
|
}
|
|
1966
2036
|
}
|
|
1967
2037
|
if (r !== t.byteLength)
|
|
1968
|
-
throw new
|
|
1969
|
-
for (const
|
|
1970
|
-
yield { kind: "text", payload:
|
|
2038
|
+
throw new u("E_GROUP_RANGE", `Trailing bytes detected: offset=${r}, size=${t.byteLength}`);
|
|
2039
|
+
for (const l of o.texts)
|
|
2040
|
+
yield { kind: "text", payload: l };
|
|
1971
2041
|
}
|
|
1972
|
-
function*
|
|
1973
|
-
yield*
|
|
2042
|
+
function* Uo(t, n, e, o) {
|
|
2043
|
+
yield* Bo(t, n, e, o);
|
|
1974
2044
|
}
|
|
1975
|
-
function
|
|
1976
|
-
let
|
|
1977
|
-
for (const
|
|
1978
|
-
if (!Nt(
|
|
2045
|
+
function Xt(t, n, e, o, i, r, s) {
|
|
2046
|
+
let l = t.count, a = 0;
|
|
2047
|
+
for (const m of e) {
|
|
2048
|
+
if (!Nt(m.instanceId, s))
|
|
1979
2049
|
continue;
|
|
1980
|
-
const
|
|
1981
|
-
if (!
|
|
1982
|
-
throw new
|
|
1983
|
-
const y =
|
|
1984
|
-
|
|
2050
|
+
const A = n.get(m.variantId);
|
|
2051
|
+
if (!A)
|
|
2052
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${m.variantId}`);
|
|
2053
|
+
const y = A[o].count;
|
|
2054
|
+
a += y, l += y;
|
|
1985
2055
|
}
|
|
1986
|
-
if (
|
|
1987
|
-
return
|
|
1988
|
-
const
|
|
1989
|
-
let
|
|
1990
|
-
((
|
|
1991
|
-
|
|
2056
|
+
if (Xn(s, o, a), l === 0)
|
|
2057
|
+
return Vt();
|
|
2058
|
+
const c = new Float32Array(l * 2), _ = [];
|
|
2059
|
+
let f = 0;
|
|
2060
|
+
((m) => {
|
|
2061
|
+
c.set(m.pos, f * 2), _.push(...qt(rt(m), f)), f += m.count;
|
|
1992
2062
|
})(t);
|
|
1993
|
-
for (const
|
|
1994
|
-
if (!Nt(
|
|
2063
|
+
for (const m of e) {
|
|
2064
|
+
if (!Nt(m.instanceId, s))
|
|
1995
2065
|
continue;
|
|
1996
|
-
const
|
|
1997
|
-
if (!
|
|
1998
|
-
throw new
|
|
1999
|
-
const y =
|
|
2000
|
-
for (let
|
|
2001
|
-
const
|
|
2002
|
-
|
|
2066
|
+
const A = n.get(m.variantId);
|
|
2067
|
+
if (!A)
|
|
2068
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${m.variantId}`);
|
|
2069
|
+
const y = A[o], x = r[m.insLayerIdx].visible === !1;
|
|
2070
|
+
for (let h = 0; h < y.count; h += 1) {
|
|
2071
|
+
const R = h * 2, p = (f + h) * 2, v = y.pos[R], U = y.pos[R + 1];
|
|
2072
|
+
c[p] = m.matA * v + m.matC * U + m.tx, c[p + 1] = m.matB * v + m.matD * U + m.ty;
|
|
2003
2073
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
(
|
|
2074
|
+
_.push(...qt(
|
|
2075
|
+
vn(
|
|
2076
|
+
rt(y),
|
|
2077
|
+
(h) => x || h === i ? m.insLayerIdx : h
|
|
2008
2078
|
),
|
|
2009
|
-
|
|
2010
|
-
)),
|
|
2079
|
+
f
|
|
2080
|
+
)), f += y.count;
|
|
2011
2081
|
}
|
|
2012
|
-
return { pos:
|
|
2082
|
+
return { pos: c, count: l, segments: mt(_) };
|
|
2013
2083
|
}
|
|
2014
|
-
function*
|
|
2015
|
-
if (
|
|
2016
|
-
yield { kind: t, payload:
|
|
2084
|
+
function* Lt(t, n, e, o, i, r, s, l) {
|
|
2085
|
+
if (Xn(l, t, Math.max(0, n - e.count)), n === 0) {
|
|
2086
|
+
yield { kind: t, payload: Vt() };
|
|
2017
2087
|
return;
|
|
2018
2088
|
}
|
|
2019
|
-
const
|
|
2020
|
-
let
|
|
2021
|
-
const
|
|
2022
|
-
if (
|
|
2089
|
+
const a = Yt;
|
|
2090
|
+
let c = new Float32Array(a * 2), _ = [], f = 0, d = 0;
|
|
2091
|
+
const m = function* () {
|
|
2092
|
+
if (f <= 0)
|
|
2023
2093
|
return;
|
|
2024
|
-
const
|
|
2025
|
-
yield { kind: t, payload:
|
|
2026
|
-
},
|
|
2027
|
-
if (
|
|
2094
|
+
const x = f === a ? { pos: c, count: f, segments: mt(_) } : { pos: c.slice(0, f * 2), count: f, segments: mt(_) };
|
|
2095
|
+
yield { kind: t, payload: x }, d += f, f = 0, c = new Float32Array(a * 2), _ = [];
|
|
2096
|
+
}, A = (x, h, R, w) => {
|
|
2097
|
+
if (x <= 0)
|
|
2028
2098
|
return;
|
|
2029
|
-
const
|
|
2030
|
-
if (
|
|
2031
|
-
|
|
2032
|
-
...
|
|
2033
|
-
vertexCount:
|
|
2099
|
+
const p = _[_.length - 1];
|
|
2100
|
+
if (p && p.startVertex + p.vertexCount === f && p.layerIndex === R && p.color[0] === h[0] && p.color[1] === h[1] && p.color[2] === h[2] && p.lineweightPx === w) {
|
|
2101
|
+
_[_.length - 1] = {
|
|
2102
|
+
...p,
|
|
2103
|
+
vertexCount: p.vertexCount + x
|
|
2034
2104
|
};
|
|
2035
2105
|
return;
|
|
2036
2106
|
}
|
|
2037
|
-
|
|
2038
|
-
startVertex:
|
|
2039
|
-
vertexCount:
|
|
2040
|
-
color: [
|
|
2041
|
-
layerIndex:
|
|
2042
|
-
...
|
|
2107
|
+
_.push({
|
|
2108
|
+
startVertex: f,
|
|
2109
|
+
vertexCount: x,
|
|
2110
|
+
color: [h[0], h[1], h[2]],
|
|
2111
|
+
layerIndex: R,
|
|
2112
|
+
...w === void 0 ? {} : { lineweightPx: w }
|
|
2043
2113
|
});
|
|
2044
2114
|
};
|
|
2045
2115
|
yield* function* () {
|
|
2046
|
-
for (const
|
|
2047
|
-
let
|
|
2048
|
-
const
|
|
2049
|
-
for (;
|
|
2050
|
-
const
|
|
2051
|
-
|
|
2116
|
+
for (const x of rt(e)) {
|
|
2117
|
+
let h = x.startVertex;
|
|
2118
|
+
const R = x.startVertex + x.vertexCount;
|
|
2119
|
+
for (; h < R; ) {
|
|
2120
|
+
const w = Math.min(a - f, R - h), p = h * 2, v = f * 2;
|
|
2121
|
+
c.set(e.pos.subarray(p, p + w * 2), v), A(w, x.color, x.layerIndex, x.lineweightPx), h += w, f += w, f === a && (yield* m());
|
|
2052
2122
|
}
|
|
2053
2123
|
}
|
|
2054
2124
|
}();
|
|
2055
|
-
for (const
|
|
2056
|
-
if (!Nt(
|
|
2125
|
+
for (const x of i) {
|
|
2126
|
+
if (!Nt(x.instanceId, l))
|
|
2057
2127
|
continue;
|
|
2058
|
-
const
|
|
2059
|
-
if (!
|
|
2060
|
-
throw new
|
|
2061
|
-
const
|
|
2062
|
-
for (const
|
|
2063
|
-
const
|
|
2064
|
-
let
|
|
2065
|
-
const D =
|
|
2066
|
-
for (;
|
|
2067
|
-
const
|
|
2068
|
-
for (let
|
|
2069
|
-
const
|
|
2070
|
-
|
|
2128
|
+
const h = o.get(x.variantId);
|
|
2129
|
+
if (!h)
|
|
2130
|
+
throw new u("E_GROUP_RANGE", `Unknown variantId ${x.variantId}`);
|
|
2131
|
+
const R = h[t], w = s[x.insLayerIdx].visible === !1;
|
|
2132
|
+
for (const p of rt(R)) {
|
|
2133
|
+
const v = w || p.layerIndex === r ? x.insLayerIdx : p.layerIndex;
|
|
2134
|
+
let U = p.startVertex;
|
|
2135
|
+
const D = p.startVertex + p.vertexCount;
|
|
2136
|
+
for (; U < D; ) {
|
|
2137
|
+
const $ = Math.min(a - f, D - U);
|
|
2138
|
+
for (let M = 0; M < $; M += 1) {
|
|
2139
|
+
const Y = (U + M) * 2, z = (f + M) * 2, S = R.pos[Y], N = R.pos[Y + 1];
|
|
2140
|
+
c[z] = x.matA * S + x.matC * N + x.tx, c[z + 1] = x.matB * S + x.matD * N + x.ty;
|
|
2071
2141
|
}
|
|
2072
|
-
|
|
2142
|
+
A($, p.color, v, p.lineweightPx), U += $, f += $, f === a && (yield* m());
|
|
2073
2143
|
}
|
|
2074
2144
|
}
|
|
2075
2145
|
}
|
|
2076
|
-
if (yield*
|
|
2077
|
-
throw new
|
|
2146
|
+
if (yield* m(), d !== n)
|
|
2147
|
+
throw new u("E_GROUP_RANGE", `Expanded ${t} count mismatch: header=${n}, emitted=${d}`);
|
|
2078
2148
|
}
|
|
2079
|
-
function*
|
|
2080
|
-
yield*
|
|
2149
|
+
function* So(t, n, e, o) {
|
|
2150
|
+
yield* Lt(
|
|
2081
2151
|
"line",
|
|
2082
2152
|
n.lineCount,
|
|
2083
2153
|
t.baseLine,
|
|
@@ -2086,7 +2156,7 @@ function* po(t, n, e, o) {
|
|
|
2086
2156
|
e.layer0_index,
|
|
2087
2157
|
n.layers,
|
|
2088
2158
|
o
|
|
2089
|
-
), yield*
|
|
2159
|
+
), yield* Lt(
|
|
2090
2160
|
"fill",
|
|
2091
2161
|
n.fillCount,
|
|
2092
2162
|
t.baseFill,
|
|
@@ -2095,7 +2165,7 @@ function* po(t, n, e, o) {
|
|
|
2095
2165
|
e.layer0_index,
|
|
2096
2166
|
n.layers,
|
|
2097
2167
|
o
|
|
2098
|
-
), yield*
|
|
2168
|
+
), yield* Lt(
|
|
2099
2169
|
"dot",
|
|
2100
2170
|
n.dotCount,
|
|
2101
2171
|
t.baseDot,
|
|
@@ -2105,44 +2175,48 @@ function* po(t, n, e, o) {
|
|
|
2105
2175
|
n.layers,
|
|
2106
2176
|
o
|
|
2107
2177
|
);
|
|
2108
|
-
for (const
|
|
2109
|
-
yield { kind: "text", payload:
|
|
2110
|
-
}
|
|
2111
|
-
function
|
|
2112
|
-
const
|
|
2113
|
-
return {
|
|
2114
|
-
header:
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2178
|
+
for (const i of n.texts)
|
|
2179
|
+
yield { kind: "text", payload: i };
|
|
2180
|
+
}
|
|
2181
|
+
function se(t, n, e) {
|
|
2182
|
+
const o = Dn(n), i = oe(t, o, e);
|
|
2183
|
+
return i.documentCache && Pn.add(i.documentCache), {
|
|
2184
|
+
header: i.header,
|
|
2185
|
+
...i.documentCache ? { documentCache: i.documentCache } : {},
|
|
2186
|
+
chunks: So(
|
|
2187
|
+
i.decoded,
|
|
2188
|
+
i.header,
|
|
2189
|
+
{ layer0_index: i.meta.layer0_index ?? 0 },
|
|
2190
|
+
o
|
|
2120
2191
|
)
|
|
2121
2192
|
};
|
|
2122
2193
|
}
|
|
2123
|
-
function
|
|
2124
|
-
if (
|
|
2125
|
-
return
|
|
2126
|
-
const e =
|
|
2194
|
+
function ae(t, n) {
|
|
2195
|
+
if (Q(t))
|
|
2196
|
+
return se(t, n);
|
|
2197
|
+
const e = on(t);
|
|
2127
2198
|
return {
|
|
2128
2199
|
header: e.header,
|
|
2129
|
-
chunks:
|
|
2200
|
+
chunks: Uo(t, e.view, e.dataOffset, e.header)
|
|
2130
2201
|
};
|
|
2131
2202
|
}
|
|
2132
|
-
function
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2203
|
+
function Fo(t, n, e) {
|
|
2204
|
+
return n.kind !== "dxb3-v3" || n.buffer !== t || !Pn.has(n) || !Q(t) ? ae(t, e) : se(t, e, n);
|
|
2205
|
+
}
|
|
2206
|
+
function zo(t) {
|
|
2207
|
+
if (Q(t)) {
|
|
2208
|
+
const n = Fn(t);
|
|
2209
|
+
return go(n.bounds, "V3 SCENE_META bounds");
|
|
2136
2210
|
}
|
|
2137
|
-
return
|
|
2211
|
+
return on(t).header.bounds;
|
|
2138
2212
|
}
|
|
2139
|
-
function*
|
|
2140
|
-
const e =
|
|
2213
|
+
function* Ho(t, n) {
|
|
2214
|
+
const e = ae(t, n);
|
|
2141
2215
|
for (const o of e.chunks)
|
|
2142
2216
|
yield o;
|
|
2143
2217
|
return e.header;
|
|
2144
2218
|
}
|
|
2145
|
-
function
|
|
2219
|
+
function kt() {
|
|
2146
2220
|
return {
|
|
2147
2221
|
pos: new Float32Array(0),
|
|
2148
2222
|
col: new Uint8Array(0),
|
|
@@ -2150,8 +2224,8 @@ function Xt() {
|
|
|
2150
2224
|
count: 0
|
|
2151
2225
|
};
|
|
2152
2226
|
}
|
|
2153
|
-
function
|
|
2154
|
-
const n =
|
|
2227
|
+
function at(t) {
|
|
2228
|
+
const n = Le(t);
|
|
2155
2229
|
return {
|
|
2156
2230
|
pos: t.pos,
|
|
2157
2231
|
col: n.col,
|
|
@@ -2159,104 +2233,105 @@ function it(t) {
|
|
|
2159
2233
|
count: t.count
|
|
2160
2234
|
};
|
|
2161
2235
|
}
|
|
2162
|
-
function
|
|
2163
|
-
if (
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2236
|
+
function jo(t, n) {
|
|
2237
|
+
if (Q(t)) {
|
|
2238
|
+
const l = Dn(n), a = oe(t, l), c = Xt(
|
|
2239
|
+
a.decoded.baseLine,
|
|
2240
|
+
a.decoded.variants,
|
|
2241
|
+
a.decoded.instances,
|
|
2168
2242
|
"line",
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
),
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2243
|
+
a.meta.layer0_index ?? 0,
|
|
2244
|
+
a.header.layers,
|
|
2245
|
+
l
|
|
2246
|
+
), _ = Xt(
|
|
2247
|
+
a.decoded.baseFill,
|
|
2248
|
+
a.decoded.variants,
|
|
2249
|
+
a.decoded.instances,
|
|
2176
2250
|
"fill",
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
),
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2251
|
+
a.meta.layer0_index ?? 0,
|
|
2252
|
+
a.header.layers,
|
|
2253
|
+
l
|
|
2254
|
+
), f = Xt(
|
|
2255
|
+
a.decoded.baseDot,
|
|
2256
|
+
a.decoded.variants,
|
|
2257
|
+
a.decoded.instances,
|
|
2184
2258
|
"dot",
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2259
|
+
a.meta.layer0_index ?? 0,
|
|
2260
|
+
a.header.layers,
|
|
2261
|
+
l
|
|
2188
2262
|
);
|
|
2189
2263
|
return {
|
|
2190
|
-
meta:
|
|
2191
|
-
line:
|
|
2192
|
-
fill:
|
|
2193
|
-
dot:
|
|
2264
|
+
meta: a.meta,
|
|
2265
|
+
line: at(c),
|
|
2266
|
+
fill: at(_),
|
|
2267
|
+
dot: at(f),
|
|
2194
2268
|
rawBytes: t.byteLength
|
|
2195
2269
|
};
|
|
2196
2270
|
}
|
|
2197
|
-
const e =
|
|
2271
|
+
const e = on(t);
|
|
2198
2272
|
let o = e.dataOffset;
|
|
2199
|
-
const
|
|
2200
|
-
o =
|
|
2201
|
-
const r =
|
|
2273
|
+
const i = ft(t, e.view, o, e.header.lineCount);
|
|
2274
|
+
o = i.offset;
|
|
2275
|
+
const r = ft(t, e.view, o, e.header.fillCount);
|
|
2202
2276
|
o = r.offset;
|
|
2203
|
-
const
|
|
2204
|
-
if (o =
|
|
2205
|
-
throw new
|
|
2277
|
+
const s = ft(t, e.view, o, e.header.dotCount);
|
|
2278
|
+
if (o = s.offset, o !== t.byteLength)
|
|
2279
|
+
throw new u("E_GROUP_RANGE", `Trailing bytes detected: offset=${o}, size=${t.byteLength}`);
|
|
2206
2280
|
return {
|
|
2207
2281
|
meta: e.meta,
|
|
2208
|
-
line:
|
|
2209
|
-
fill:
|
|
2210
|
-
dot:
|
|
2282
|
+
line: at(i.chunk),
|
|
2283
|
+
fill: at(r.chunk),
|
|
2284
|
+
dot: at(s.chunk),
|
|
2211
2285
|
rawBytes: t.byteLength
|
|
2212
2286
|
};
|
|
2213
2287
|
}
|
|
2214
|
-
function
|
|
2215
|
-
return t ?
|
|
2288
|
+
function qo(t, n) {
|
|
2289
|
+
return t ? Ne(On(t, n)) : null;
|
|
2216
2290
|
}
|
|
2217
2291
|
export {
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2292
|
+
u as CadPackError,
|
|
2293
|
+
u as GeoLoaderError,
|
|
2294
|
+
Yt as STREAM_VERTEX_WINDOW,
|
|
2295
|
+
Ce as assertStrictTextRoundtrip,
|
|
2296
|
+
Oo as captureGroupSnapshot,
|
|
2297
|
+
Ft as cloneViewportRect,
|
|
2298
|
+
Ge as computeViewportRectFromPositions,
|
|
2299
|
+
Vt as emptyGeometryChunk,
|
|
2300
|
+
Le as expandGeometryChunkMetadata,
|
|
2301
|
+
Ve as expandViewportRect,
|
|
2302
|
+
ot as getDxbsSection,
|
|
2303
|
+
Qt as groupLayerEncodingForV3Minor,
|
|
2304
|
+
Ie as intersectViewportRects,
|
|
2305
|
+
ve as isDxbsPayload,
|
|
2306
|
+
Se as isStrictTextRoundtripEnabled,
|
|
2307
|
+
mt as mergeAdjacentSegments,
|
|
2308
|
+
pe as mergeViewportRects,
|
|
2309
|
+
rt as normalizeGeometrySegments,
|
|
2310
|
+
Ne as normalizeViewportRect,
|
|
2311
|
+
qt as offsetGeometrySegments,
|
|
2312
|
+
zo as parseBinBounds,
|
|
2313
|
+
jo as parseBinPayload,
|
|
2314
|
+
ae as parseBinStreaming,
|
|
2315
|
+
Fo as parseBinStreamingWithCache,
|
|
2316
|
+
Ho as parseBinToChunks,
|
|
2317
|
+
Xe as readBlockAnnotationSidecar,
|
|
2318
|
+
tn as readDxbsContainer,
|
|
2319
|
+
ko as readExternalAnnotationManifest,
|
|
2320
|
+
Yo as readExternalBlockAnnotations,
|
|
2321
|
+
Lo as readExternalVariantDependencyPlan,
|
|
2322
|
+
wo as readExternalVariantGeometrySidecar,
|
|
2323
|
+
Xo as readExternalVariantManifest,
|
|
2324
|
+
ft as readGroup,
|
|
2325
|
+
Po as readSceneAnnotationSidecar,
|
|
2326
|
+
vn as remapGeometrySegmentLayers,
|
|
2327
|
+
vo as shouldAssertStrictTextRoundtrip,
|
|
2328
|
+
Do as sliceGeometrySegments,
|
|
2329
|
+
Re as streamGroupChunks,
|
|
2330
|
+
qo as transformBBoxByInstance,
|
|
2331
|
+
On as transformViewportRect,
|
|
2332
|
+
be as viewportRectCenterDistance,
|
|
2333
|
+
$o as viewportRectContains,
|
|
2334
|
+
Te as viewportRectDiagonal,
|
|
2335
|
+
Mo as viewportRectEquals,
|
|
2336
|
+
Cn as viewportRectIntersects
|
|
2262
2337
|
};
|